Changeset 59ecd4a in mainline for uspace/srv/net/nil/eth/eth.c


Ignore:
Timestamp:
2010-04-04T21:41:47Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5db9084
Parents:
36a75a2 (diff), ee7e82a9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r36a75a2 r59ecd4a  
    4545#include <ipc/services.h>
    4646
    47 #include "../../err.h"
    48 #include "../../messages.h"
    49 #include "../../modules.h"
    50 
    51 #include "../../include/byteorder.h"
    52 #include "../../include/checksum.h"
    53 #include "../../include/ethernet_lsap.h"
    54 #include "../../include/ethernet_protocols.h"
    55 #include "../../include/protocol_map.h"
    56 #include "../../include/device.h"
    57 #include "../../include/netif_interface.h"
    58 #include "../../include/net_interface.h"
    59 #include "../../include/nil_interface.h"
    60 #include "../../include/il_interface.h"
    61 
    62 #include "../../structures/measured_strings.h"
    63 #include "../../structures/packet/packet_client.h"
    64 
    65 #include "../nil_module.h"
     47#include <net_err.h>
     48#include <net_messages.h>
     49#include <net_modules.h>
     50#include <net_byteorder.h>
     51#include <net_checksum.h>
     52#include <ethernet_lsap.h>
     53#include <ethernet_protocols.h>
     54#include <protocol_map.h>
     55#include <net_device.h>
     56#include <netif_interface.h>
     57#include <net_interface.h>
     58#include <nil_interface.h>
     59#include <il_interface.h>
     60#include <adt/measured_strings.h>
     61#include <packet/packet_client.h>
    6662
    6763#include "eth.h"
    6864#include "eth_header.h"
     65
     66/** The module name.
     67 */
     68#define NAME    "Ethernet protocol"
    6969
    7070/** Reserved packet prefix length.
     
    769769}
    770770
     771#ifdef CONFIG_NETWORKING_modular
     772
     773#include <nil_standalone.h>
     774
     775/** Default thread for new connections.
     776 *
     777 *  @param[in] iid The initial message identifier.
     778 *  @param[in] icall The initial message call structure.
     779 *
     780 */
     781static void nil_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     782{
     783        /*
     784         * Accept the connection
     785         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     786         */
     787        ipc_answer_0(iid, EOK);
     788       
     789        while(true) {
     790                ipc_call_t answer;
     791                int answer_count;
     792               
     793                /* Clear the answer structure */
     794                refresh_answer(&answer, &answer_count);
     795               
     796                /* Fetch the next message */
     797                ipc_call_t call;
     798                ipc_callid_t callid = async_get_call(&call);
     799               
     800                /* Process the message */
     801                int res = nil_module_message(callid, &call, &answer, &answer_count);
     802               
     803                /* End if said to either by the message or the processing result */
     804                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     805                        return;
     806               
     807                /* Answer the message */
     808                answer_call(callid, res, &answer, answer_count);
     809        }
     810}
     811
     812/** Starts the module.
     813 *
     814 *  @param argc The count of the command line arguments. Ignored parameter.
     815 *  @param argv The command line parameters. Ignored parameter.
     816 *
     817 *  @returns EOK on success.
     818 *  @returns Other error codes as defined for each specific module start function.
     819 *
     820 */
     821int main(int argc, char *argv[])
     822{
     823        ERROR_DECLARE;
     824       
     825        /* Print the module label */
     826        printf("Task %d - %s\n", task_get_id(), NAME);
     827       
     828        /* Start the module */
     829        if (ERROR_OCCURRED(nil_module_start(nil_client_connection))) {
     830                printf(" - ERROR %i\n", ERROR_CODE);
     831                return ERROR_CODE;
     832        }
     833       
     834        return EOK;
     835}
     836
     837#endif /* CONFIG_NETWORKING_modular */
     838
    771839/** @}
    772840 */
Note: See TracChangeset for help on using the changeset viewer.