Changeset 849ed54 in mainline for uspace/srv/net/il/arp/arp.c


Ignore:
Timestamp:
2010-03-30T18:39:04Z (14 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/il/arp/arp.c

    r7d6fe4db r849ed54  
    4343#include <str.h>
    4444#include <task.h>
    45 
    4645#include <ipc/ipc.h>
    4746#include <ipc/services.h>
    4847
    49 #include "../../err.h"
    50 #include "../../messages.h"
    51 #include "../../modules.h"
    52 
    53 #include "../../include/byteorder.h"
    54 #include "../../include/device.h"
    55 #include "../../include/arp_interface.h"
    56 #include "../../include/nil_interface.h"
    57 #include "../../include/protocol_map.h"
    58 
    59 #include "../../structures/measured_strings.h"
    60 #include "../../structures/packet/packet.h"
    61 #include "../../structures/packet/packet_client.h"
    62 
    63 #include "../il_messages.h"
     48#include <net_err.h>
     49#include <net_messages.h>
     50#include <net_modules.h>
     51#include <net_byteorder.h>
     52#include <net_device.h>
     53#include <arp_interface.h>
     54#include <nil_interface.h>
     55#include <protocol_map.h>
     56#include <adt/measured_strings.h>
     57#include <packet/packet.h>
     58#include <packet/packet_client.h>
     59#include <il_messages.h>
     60#include <arp_messages.h>
    6461
    6562#include "arp.h"
     
    6764#include "arp_oc.h"
    6865#include "arp_module.h"
    69 #include "arp_messages.h"
     66
     67
     68/** ARP module name.
     69 */
     70#define NAME    "ARP protocol"
    7071
    7172/** ARP global data.
     
    618619}
    619620
     621#ifdef CONFIG_NETWORKING_modular
     622
     623#include <il_standalone.h>
     624
     625/** Default thread for new connections.
     626 *
     627 *  @param[in] iid The initial message identifier.
     628 *  @param[in] icall The initial message call structure.
     629 *
     630 */
     631static void il_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     632{
     633        /*
     634         * Accept the connection
     635         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     636         */
     637        ipc_answer_0(iid, EOK);
     638       
     639        while(true) {
     640                ipc_call_t answer;
     641                int answer_count;
     642               
     643                /* Clear the answer structure */
     644                refresh_answer(&answer, &answer_count);
     645               
     646                /* Fetch the next message */
     647                ipc_call_t call;
     648                ipc_callid_t callid = async_get_call(&call);
     649               
     650                /* Process the message */
     651                int res = il_module_message(callid, &call, &answer, &answer_count);
     652               
     653                /* End if said to either by the message or the processing result */
     654                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     655                        return;
     656               
     657                /* Answer the message */
     658                answer_call(callid, res, &answer, answer_count);
     659        }
     660}
     661
     662/** Starts the module.
     663 *
     664 *  @param argc The count of the command line arguments. Ignored parameter.
     665 *  @param argv The command line parameters. Ignored parameter.
     666 *
     667 *  @returns EOK on success.
     668 *  @returns Other error codes as defined for each specific module start function.
     669 *
     670 */
     671int main(int argc, char *argv[])
     672{
     673        ERROR_DECLARE;
     674       
     675        /* Print the module label */
     676        printf("Task %d - %s\n", task_get_id(), NAME);
     677       
     678        /* Start the module */
     679        if (ERROR_OCCURRED(il_module_start(il_client_connection))) {
     680                printf(" - ERROR %i\n", ERROR_CODE);
     681                return ERROR_CODE;
     682        }
     683       
     684        return EOK;
     685}
     686
     687#endif /* CONFIG_NETWORKING_modular */
     688
    620689/** @}
    621690 */
Note: See TracChangeset for help on using the changeset viewer.