Changeset 849ed54 in mainline for uspace/srv/net/netif/lo/lo.c


Ignore:
Timestamp:
2010-03-30T18:39:04Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7553689
Parents:
7d6fe4db
Message:

Networking work:
Split the networking stack into end-user library (libsocket) and two helper libraries (libnet and libnetif).
Don't use over-the-hand compiling and linking, but rather separation of conserns.
There might be still some issues and the non-modular networking architecture is currently broken, but this will be fixed soon.

File:
1 edited

Legend:

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

    r7d6fe4db r849ed54  
    4343#include <ipc/services.h>
    4444
    45 #include "../../err.h"
    46 #include "../../messages.h"
    47 #include "../../modules.h"
    48 
    49 #include "../../structures/measured_strings.h"
    50 #include "../../structures/packet/packet_client.h"
    51 
    52 #include "../../include/device.h"
    53 #include "../../include/nil_interface.h"
    54 
    55 #include "../../nil/nil_messages.h"
    56 
    57 #include "../netif.h"
    58 #include "../netif_module.h"
     45#include <net_err.h>
     46#include <net_messages.h>
     47#include <net_modules.h>
     48#include <adt/measured_strings.h>
     49#include <packet/packet_client.h>
     50#include <net_device.h>
     51#include <nil_interface.h>
     52#include <nil_messages.h>
     53#include <netif.h>
     54#include <netif_module.h>
    5955
    6056/** Default hardware address.
     
    9086 */
    9187int create(device_id_t device_id, device_ref * device);
    92 
    93 /** Prints the module name.
    94  *  @see NAME
    95  */
    96 void module_print_name(void);
    9788
    9889int netif_specific_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     
    167158}
    168159
    169 void module_print_name(void){
    170         printf("%s", NAME);
    171 }
    172 
    173160int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){
    174161        ERROR_DECLARE;
     
    220207}
    221208
     209#ifdef CONFIG_NETWORKING_modular
     210
     211#include <netif_standalone.h>
     212
     213/** Default thread for new connections.
     214 *
     215 *  @param[in] iid The initial message identifier.
     216 *  @param[in] icall The initial message call structure.
     217 *
     218 */
     219static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     220{
     221        /*
     222         * Accept the connection
     223         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     224         */
     225        ipc_answer_0(iid, EOK);
     226       
     227        while(true) {
     228                ipc_call_t answer;
     229                int answer_count;
     230               
     231                /* Clear the answer structure */
     232                refresh_answer(&answer, &answer_count);
     233               
     234                /* Fetch the next message */
     235                ipc_call_t call;
     236                ipc_callid_t callid = async_get_call(&call);
     237               
     238                /* Process the message */
     239                int res = netif_module_message(callid, &call, &answer, &answer_count);
     240               
     241                /* End if said to either by the message or the processing result */
     242                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     243                        return;
     244               
     245                /* Answer the message */
     246                answer_call(callid, res, &answer, answer_count);
     247        }
     248}
     249
     250/** Starts the module.
     251 *
     252 *  @param argc The count of the command line arguments. Ignored parameter.
     253 *  @param argv The command line parameters. Ignored parameter.
     254 *
     255 *  @returns EOK on success.
     256 *  @returns Other error codes as defined for each specific module start function.
     257 *
     258 */
     259int main(int argc, char *argv[])
     260{
     261        ERROR_DECLARE;
     262       
     263        /* Print the module label */
     264        printf("Task %d - %s\n", task_get_id(), NAME);
     265       
     266        /* Start the module */
     267        if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
     268                printf(" - ERROR %i\n", ERROR_CODE);
     269                return ERROR_CODE;
     270        }
     271       
     272        return EOK;
     273}
     274
     275#endif /* CONFIG_NETWORKING_modular */
     276
    222277/** @}
    223278 */
Note: See TracChangeset for help on using the changeset viewer.