Changeset 14f1db0 in mainline for uspace/lib/net/netif


Ignore:
Timestamp:
2010-04-09T12:54:57Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1caa3c2
Parents:
24ab58b3
Message:

networking overhaul:

  • separation of conserns
  • removal of (almost all) overlaping symbols, libnetif is not needed anymore
  • again, it is possible to build the networking in multiple architecture configurations (however, currently only the bundling netif and nil layers is supported, more to come)
  • code style updates and fixes (still a huge amount of work to do)
Location:
uspace/lib/net/netif
Files:
1 added
2 deleted
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/netif/netif_nil_bundle.c

    r24ab58b3 r14f1db0  
    4141#include <net_messages.h>
    4242#include <packet/packet.h>
    43 #include <nil_module.h>
    4443#include <netif_nil_bundle.h>
    45 #include <netif.h>
     44#include <netif_local.h>
     45#include <nil_local.h>
    4646
    4747/** Distribute the messages between the module parts.
     
    6262    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
    6363{
    64         if (IS_NET_NIL_MESSAGE(call)
     64        if ((IS_NET_NIL_MESSAGE(call))
    6565            || (IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME))
    66                 return nil_message(name, callid, call, answer, answer_count);
     66                return nil_message_standalone(name, callid, call, answer,
     67                    answer_count);
    6768        else
    68                 return netif_message(name, callid, call, answer, answer_count);
     69                return netif_module_message_standalone(name, callid, call, answer,
     70                    answer_count);
    6971}
    7072
    71 /** Starts the bundle network interface module.
    72  *  Initializes the client connection serving function, initializes both module parts, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
    73  *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
    74  *  @returns EOK on success.
    75  *  @returns Other error codes as defined for each specific module message function.
     73/** Start the bundle network interface module.
     74 *
     75 * Initialize the client connection serving function, initialize
     76 * both module parts, register the module service and start the
     77 * async manager, processing IPC messages in an infinite loop.
     78 *
     79 * @param[in] client_connection The client connection processing
     80 *                              function. The module skeleton propagates
     81 *                              its own one.
     82 *
     83 * @return EOK on success.
     84 * @return Other error codes as defined for each specific module message
     85 *         function.
     86 *
    7687 */
    77 int netif_nil_module_start(async_client_conn_t client_connection){
     88int netif_nil_module_start(async_client_conn_t client_connection)
     89{
    7890        ERROR_DECLARE;
    79 
     91       
    8092        ERROR_PROPAGATE(netif_init_module(client_connection));
    81         if(ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))){
     93        if (ERROR_OCCURRED(nil_initialize(netif_globals.net_phone))) {
    8294                pm_destroy();
    8395                return ERROR_CODE;
    8496        }
    85         return netif_run_module();
     97       
     98        async_manager();
     99       
     100        pm_destroy();
     101        return EOK;
    86102}
    87103
  • uspace/lib/net/netif/netif_remote.c

    r24ab58b3 r14f1db0  
    2828
    2929/** @addtogroup netif
    30  *  @{
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Network interface module interface implementation for standalone remote modules.
    35  *  @see netif_interface.h
     34 * Network interface module interface implementation for remote modules.
    3635 */
    3736
     
    4342#include <packet/packet_client.h>
    4443#include <net_device.h>
    45 #include <netif_interface.h>
     44#include <netif_remote.h>
    4645#include <netif_messages.h>
    4746
    48 int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data){
    49         return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id, address, data);
     47int netif_get_addr_req_remote(int netif_phone, device_id_t device_id,
     48    measured_string_ref *address, char **data)
     49{
     50        return generic_get_addr_req(netif_phone, NET_NETIF_GET_ADDR, device_id,
     51            address, data);
    5052}
    5153
    52 int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io){
     54int netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io)
     55{
    5356        return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
    5457}
    5558
    56 int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender){
    57         return generic_send_msg(netif_phone, NET_NETIF_SEND, device_id, packet_get_id(packet), sender, 0);
     59int netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,
     60    services_t sender)
     61{
     62        return generic_send_msg_remote(netif_phone, NET_NETIF_SEND, device_id,
     63            packet_get_id(packet), sender, 0);
    5864}
    5965
    60 int netif_start_req(int netif_phone, device_id_t device_id){
     66int netif_start_req_remote(int netif_phone, device_id_t device_id)
     67{
    6168        return async_req_1_0(netif_phone, NET_NETIF_START, device_id);
    6269}
    6370
    64 int netif_stop_req(int netif_phone, device_id_t device_id){
     71int netif_stop_req_remote(int netif_phone, device_id_t device_id)
     72{
    6573        return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id);
    6674}
    6775
    68 int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats){
    69         aid_t message_id;
     76int netif_stats_req_remote(int netif_phone, device_id_t device_id,
     77    device_stats_ref stats)
     78{
     79        if (!stats)
     80                return EBADMEM;
     81       
     82        aid_t message_id = async_send_1(netif_phone, NET_NETIF_STATS,
     83            (ipcarg_t) device_id, NULL);
     84        async_data_read_start(netif_phone, stats, sizeof(*stats));
     85       
    7086        ipcarg_t result;
    71 
    72         if(! stats){
    73                 return EBADMEM;
    74         }
    75         message_id = async_send_1(netif_phone, NET_NETIF_STATS, (ipcarg_t) device_id, NULL);
    76         async_data_read_start(netif_phone, stats, sizeof(*stats));
    7787        async_wait_for(message_id, &result);
     88       
    7889        return (int) result;
    7990}
    8091
    81 int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver){
     92int netif_bind_service_remote(services_t service, device_id_t device_id, services_t me,
     93    async_client_conn_t receiver)
     94{
    8295        return bind_service(service, device_id, me, 0, receiver);
    8396}
Note: See TracChangeset for help on using the changeset viewer.