Changeset 849ed54 in mainline for uspace/srv/net/il/ip/ip.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/ip/ip.c

    r7d6fe4db r849ed54  
    4141#include <stdio.h>
    4242#include <str.h>
    43 
    4443#include <ipc/ipc.h>
    4544#include <ipc/services.h>
    46 
    4745#include <sys/types.h>
    4846
    49 #include "../../err.h"
    50 #include "../../messages.h"
    51 #include "../../modules.h"
    52 
    53 #include "../../include/arp_interface.h"
    54 #include "../../include/byteorder.h"
    55 #include "../../include/checksum.h"
    56 #include "../../include/device.h"
    57 #include "../../include/icmp_client.h"
    58 #include "../../include/icmp_codes.h"
    59 #include "../../include/icmp_interface.h"
    60 #include "../../include/il_interface.h"
    61 #include "../../include/in.h"
    62 #include "../../include/in6.h"
    63 #include "../../include/inet.h"
    64 #include "../../include/ip_client.h"
    65 #include "../../include/ip_interface.h"
    66 #include "../../include/net_interface.h"
    67 #include "../../include/nil_interface.h"
    68 #include "../../include/tl_interface.h"
    69 #include "../../include/socket_codes.h"
    70 #include "../../include/socket_errno.h"
    71 #include "../../structures/measured_strings.h"
    72 #include "../../structures/module_map.h"
    73 #include "../../structures/packet/packet_client.h"
    74 
    75 #include "../../nil/nil_messages.h"
    76 
    77 #include "../il_messages.h"
     47#include <net_err.h>
     48#include <net_messages.h>
     49#include <net_modules.h>
     50#include <arp_interface.h>
     51#include <net_byteorder.h>
     52#include <net_checksum.h>
     53#include <net_device.h>
     54#include <icmp_client.h>
     55#include <icmp_codes.h>
     56#include <icmp_interface.h>
     57#include <il_interface.h>
     58#include <in.h>
     59#include <in6.h>
     60#include <inet.h>
     61#include <ip_client.h>
     62#include <ip_interface.h>
     63#include <net_interface.h>
     64#include <nil_interface.h>
     65#include <tl_interface.h>
     66#include <socket_codes.h>
     67#include <socket_errno.h>
     68#include <adt/measured_strings.h>
     69#include <adt/module_map.h>
     70#include <packet/packet_client.h>
     71#include <nil_messages.h>
     72#include <il_messages.h>
    7873
    7974#include "ip.h"
     
    8176#include "ip_messages.h"
    8277#include "ip_module.h"
     78
     79/** IP module name.
     80 */
     81#define NAME    "IP protocol"
    8382
    8483/** IP version 4.
     
    16241623}
    16251624
     1625#ifdef CONFIG_NETWORKING_modular
     1626
     1627#include <il_standalone.h>
     1628
     1629/** Default thread for new connections.
     1630 *
     1631 *  @param[in] iid The initial message identifier.
     1632 *  @param[in] icall The initial message call structure.
     1633 *
     1634 */
     1635static void il_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     1636{
     1637        /*
     1638         * Accept the connection
     1639         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     1640         */
     1641        ipc_answer_0(iid, EOK);
     1642       
     1643        while(true) {
     1644                ipc_call_t answer;
     1645                int answer_count;
     1646               
     1647                /* Clear the answer structure */
     1648                refresh_answer(&answer, &answer_count);
     1649               
     1650                /* Fetch the next message */
     1651                ipc_call_t call;
     1652                ipc_callid_t callid = async_get_call(&call);
     1653               
     1654                /* Process the message */
     1655                int res = il_module_message(callid, &call, &answer, &answer_count);
     1656               
     1657                /* End if said to either by the message or the processing result */
     1658                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     1659                        return;
     1660               
     1661                /* Answer the message */
     1662                answer_call(callid, res, &answer, answer_count);
     1663        }
     1664}
     1665
     1666/** Starts the module.
     1667 *
     1668 *  @param argc The count of the command line arguments. Ignored parameter.
     1669 *  @param argv The command line parameters. Ignored parameter.
     1670 *
     1671 *  @returns EOK on success.
     1672 *  @returns Other error codes as defined for each specific module start function.
     1673 *
     1674 */
     1675int main(int argc, char *argv[])
     1676{
     1677        ERROR_DECLARE;
     1678       
     1679        /* Print the module label */
     1680        printf("Task %d - %s\n", task_get_id(), NAME);
     1681       
     1682        /* Start the module */
     1683        if (ERROR_OCCURRED(il_module_start(il_client_connection))) {
     1684                printf(" - ERROR %i\n", ERROR_CODE);
     1685                return ERROR_CODE;
     1686        }
     1687       
     1688        return EOK;
     1689}
     1690
     1691#endif /* CONFIG_NETWORKING_modular */
     1692
    16261693/** @}
    16271694 */
Note: See TracChangeset for help on using the changeset viewer.