Changeset 6b82009 in mainline for uspace/srv/net/net/net.c


Ignore:
Timestamp:
2011-06-22T20:41:41Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef09a7a
Parents:
55091847
Message:

networking stack: convert to the new async framework

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/net/net.c

    r55091847 r6b82009  
    3636 */
    3737
    38 #include "net.h"
    39 
    4038#include <async.h>
    4139#include <ctype.h>
    4240#include <ddi.h>
    43 #include <ns.h>
    4441#include <errno.h>
    4542#include <malloc.h>
     
    4744#include <str.h>
    4845#include <str_error.h>
    49 
     46#include <ns.h>
    5047#include <ipc/services.h>
    5148#include <ipc/net.h>
     
    5350#include <ipc/il.h>
    5451#include <ipc/nil.h>
    55 
    5652#include <net/modules.h>
    5753#include <net/packet.h>
    5854#include <net/device.h>
    59 
    6055#include <adt/char_map.h>
    6156#include <adt/generic_char_map.h>
    6257#include <adt/measured_strings.h>
    6358#include <adt/module_map.h>
    64 
    6559#include <netif_remote.h>
    6660#include <nil_remote.h>
    6761#include <net_interface.h>
    6862#include <ip_interface.h>
     63#include "net.h"
    6964
    7065/** Networking module name. */
     
    394389}
    395390
    396 int net_get_conf_req(int net_phone, measured_string_t **configuration,
     391static int net_get_conf_req_local(measured_string_t **configuration,
    397392    size_t count, uint8_t **data)
    398393{
     
    403398}
    404399
    405 int net_get_device_conf_req(int net_phone, device_id_t device_id,
     400static int net_get_device_conf_req_local(device_id_t device_id,
    406401    measured_string_t **configuration, size_t count, uint8_t **data)
    407402{
     
    479474        uintptr_t io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
    480475       
    481         rc = netif_probe_req(netif->driver->phone, netif->id, irq, (void *) io);
     476        rc = netif_probe_req(netif->driver->sess, netif->id, irq, (void *) io);
    482477        if (rc != EOK)
    483478                return rc;
    484479       
    485480        /* Network interface layer startup */
    486         services_t internet_service;
    487481        if (netif->nil) {
    488482                setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_MTU, 0);
     
    493487                int mtu = setting ? strtol((char *) setting->value, NULL, 10) : 0;
    494488               
    495                 rc = nil_device_req(netif->nil->phone, netif->id, mtu,
    496                     netif->driver->service);
     489                rc = nil_device_req(netif->nil->sess, netif->id, mtu);
    497490                if (rc != EOK)
    498491                        return rc;
    499                
    500                 internet_service = netif->nil->service;
    501         } else
    502                 internet_service = netif->driver->service;
     492        }
    503493       
    504494        /* Inter-network layer startup */
    505         switch (netif->il->service) {
    506         case SERVICE_IP:
    507                 rc = ip_device_req(netif->il->phone, netif->id,
    508                     internet_service);
    509                 if (rc != EOK)
    510                         return rc;
    511                 break;
    512         default:
    513                 return ENOENT;
    514         }
    515        
    516         return netif_start_req(netif->driver->phone, netif->id);
     495        rc = ip_device_req(netif->il->sess, netif->id);
     496        if (rc != EOK)
     497                return rc;
     498       
     499        return netif_start_req(netif->driver->sess, netif->id);
    517500}
    518501
     
    649632                if (rc != EOK)
    650633                        return rc;
    651                 net_get_device_conf_req(0, IPC_GET_DEVICE(*call), &strings,
     634                net_get_device_conf_req_local(IPC_GET_DEVICE(*call), &strings,
    652635                    IPC_GET_COUNT(*call), NULL);
    653636               
     
    663646                if (rc != EOK)
    664647                        return rc;
    665                 net_get_conf_req(0, &strings, IPC_GET_COUNT(*call), NULL);
     648                net_get_conf_req_local(&strings, IPC_GET_COUNT(*call), NULL);
    666649               
    667650                /* Strings should not contain received data anymore */
     
    683666 * @param[in] icall The initial message call structure.
    684667 * @param[in] arg   Local argument.
     668 *
    685669 */
    686670static void net_client_connection(ipc_callid_t iid, ipc_call_t *icall,
Note: See TracChangeset for help on using the changeset viewer.