Changeset 849ed54 in mainline for uspace/srv


Ignore:
Timestamp:
2010-03-30T18:39:04Z (16 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.

Location:
uspace/srv
Files:
1 added
3 deleted
37 edited
13 moved

Legend:

Unmodified
Added
Removed
  • uspace/srv/hw/netif/dp8390/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
    3231ROOT_PATH = $(USPACE_PREFIX)/..
     32LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     33EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3334
    3435COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
    3536CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3637
    37 BINARY = dp8390
    38 
    3938-include $(COMMON_MAKEFILE)
    4039-include $(CONFIG_MAKEFILE)
     40
     41ifeq ($(CONFIG_NETWORKING),modular)
     42        BINARY = dp8390
     43endif
     44
     45ifeq ($(CONFIG_NETWORKING),module)
     46        LIBRARY = libdp8390
     47endif
    4148
    4249SOURCES = \
    4350        dp8390.c \
    4451        dp8390_module.c \
    45         ne2000.c \
    46         $(NET_BASE)/module.c \
    47         $(NET_BASE)/modules.c \
    48         $(NET_BASE)/netif/netif.c \
    49         $(NET_BASE)/structures/measured_strings.c \
    50         $(NET_BASE)/structures/packet/packet.c \
    51         $(NET_BASE)/structures/packet/packet_client.c \
    52         $(NET_BASE)/structures/packet/packet_remote.c
    53 
    54 ifeq ($(CONFIG_NETWORKING),module)
    55         SOURCES += \
    56                 $(NET_BASE)/checksum.c \
    57                 $(NET_BASE)/nil/eth/eth.c \
    58                 $(NET_BASE)/net/net_remote.c \
    59                 $(NET_BASE)/netif/netif_nil_bundle.c
    60 endif
    61 
    62 ifeq ($(CONFIG_NETWORKING),modular)
    63         SOURCES += \
    64                 $(NET_BASE)/nil/nil_remote.c \
    65                 $(NET_BASE)/netif/netif_standalone.c
    66 endif
     52        ne2000.c
    6753
    6854include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/hw/netif/dp8390/dp8390.c

    r7d6fe4db r849ed54  
    3636#include <errno.h>
    3737
    38 #include "../../include/byteorder.h"
    39 
    40 #include "../../structures/packet/packet.h"
    41 #include "../../structures/packet/packet_client.h"
    42 
    43 #include "../netif.h"
     38#include <net_byteorder.h>
     39
     40#include <packet/packet.h>
     41#include <packet/packet_client.h>
     42
     43#include <netif.h>
    4444
    4545#include "dp8390_drv.h"
  • uspace/srv/hw/netif/dp8390/dp8390.h

    r7d6fe4db r849ed54  
    3636#define __NET_NETIF_DP8390_H__
    3737
    38 #include "../../structures/packet/packet.h"
     38#include <packet/packet.h>
    3939
    4040#include "dp8390_port.h"
  • uspace/srv/hw/netif/dp8390/dp8390_module.c

    r7d6fe4db r849ed54  
    4040#include <errno.h>
    4141#include <malloc.h>
    42 //#include <stdio.h>
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../messages.h"
    48 #include "../../modules.h"
    49 
    50 #include "../../structures/packet/packet_client.h"
    51 #include "../../structures/measured_strings.h"
    52 
    53 #include "../../include/device.h"
    54 #include "../../include/nil_interface.h"
    55 
    56 #include "../netif.h"
    57 #include "../netif_module.h"
     45#include <net_err.h>
     46#include <net_messages.h>
     47#include <net_modules.h>
     48#include <packet/packet_client.h>
     49#include <adt/measured_strings.h>
     50#include <net_device.h>
     51#include <nil_interface.h>
     52#include <netif.h>
     53#include <netif_module.h>
    5854
    5955#include "dp8390.h"
     
    10298 */
    10399netif_globals_t netif_globals;
    104 
    105 /** Prints the module name.
    106  *  @see NAME
    107  */
    108 void module_print_name(void);
    109100
    110101/** Handles the interrupt messages.
     
    151142        stats->send_window_errors = de_stat->ets_OWC;
    152143        return EOK;
    153 }
    154 
    155 void module_print_name(void){
    156         printf("%s", NAME);
    157144}
    158145
     
    329316}
    330317
     318#ifdef CONFIG_NETWORKING_modular
     319
     320#include <netif_standalone.h>
     321
     322/** Default thread for new connections.
     323 *
     324 *  @param[in] iid The initial message identifier.
     325 *  @param[in] icall The initial message call structure.
     326 *
     327 */
     328static void netif_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     329{
     330        /*
     331         * Accept the connection
     332         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     333         */
     334        ipc_answer_0(iid, EOK);
     335       
     336        while(true) {
     337                ipc_call_t answer;
     338                int answer_count;
     339               
     340                /* Clear the answer structure */
     341                refresh_answer(&answer, &answer_count);
     342               
     343                /* Fetch the next message */
     344                ipc_call_t call;
     345                ipc_callid_t callid = async_get_call(&call);
     346               
     347                /* Process the message */
     348                int res = netif_module_message(callid, &call, &answer, &answer_count);
     349               
     350                /* End if said to either by the message or the processing result */
     351                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     352                        return;
     353               
     354                /* Answer the message */
     355                answer_call(callid, res, &answer, answer_count);
     356        }
     357}
     358
     359/** Starts the module.
     360 *
     361 *  @param argc The count of the command line arguments. Ignored parameter.
     362 *  @param argv The command line parameters. Ignored parameter.
     363 *
     364 *  @returns EOK on success.
     365 *  @returns Other error codes as defined for each specific module start function.
     366 *
     367 */
     368int main(int argc, char *argv[])
     369{
     370        ERROR_DECLARE;
     371       
     372        /* Print the module label */
     373        printf("Task %d - %s\n", task_get_id(), NAME);
     374       
     375        /* Start the module */
     376        if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) {
     377                printf(" - ERROR %i\n", ERROR_CODE);
     378                return ERROR_CODE;
     379        }
     380       
     381        return EOK;
     382}
     383
     384#endif /* CONFIG_NETWORKING_modular */
     385
     386
    331387/** @}
    332388 */
  • uspace/srv/net/il/arp/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = arp
    3334
    3435SOURCES = \
    3536        arp.c \
    36         arp_module.c \
    37         $(NET_BASE)/module.c \
    38         $(NET_BASE)/modules.c \
    39         $(NET_BASE)/net/net_remote.c \
    40         $(NET_BASE)/nil/nil_remote.c \
    41         $(NET_BASE)/structures/char_map.c \
    42         $(NET_BASE)/structures/measured_strings.c \
    43         $(NET_BASE)/structures/packet/packet.c \
    44         $(NET_BASE)/structures/packet/packet_client.c \
    45         $(NET_BASE)/structures/packet/packet_remote.c
     37        arp_module.c
    4638
    4739include $(USPACE_PREFIX)/Makefile.common
  • 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 */
  • uspace/srv/net/il/arp/arp.h

    r7d6fe4db r849ed54  
    4343#include <ipc/services.h>
    4444
    45 #include "../../include/device.h"
    46 #include "../../include/hardware.h"
    47 
    48 #include "../../structures/generic_char_map.h"
    49 #include "../../structures/int_map.h"
    50 #include "../../structures/measured_strings.h"
     45#include <net_device.h>
     46#include <net_hardware.h>
     47#include <adt/generic_char_map.h>
     48#include <adt/int_map.h>
     49#include <adt/measured_strings.h>
    5150
    5251
  • uspace/srv/net/il/arp/arp_module.c

    r7d6fe4db r849ed54  
    4444#include <ipc/services.h>
    4545
    46 #include "../../err.h"
    47 #include "../../modules.h"
    48 
    49 #include "../../include/net_interface.h"
    50 
    51 #include "../../structures/packet/packet.h"
     46#include <net_err.h>
     47#include <net_modules.h>
     48#include <net_interface.h>
     49#include <packet/packet.h>
     50#include <il_standalone.h>
    5251
    5352#include "arp.h"
    5453#include "arp_module.h"
    55 
    56 /** ARP module name.
    57  */
    58 #define NAME    "ARP protocol"
    5954
    6055/** ARP module global data.
     
    7065 *  @returns Other error codes as defined for the arp_message() function.
    7166 */
    72 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    73 
    74 /** Prints the module name.
    75  *  @see NAME
    76  */
    77 void module_print_name(void);
     67int il_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     68        return arp_message(callid, call, answer, answer_count);
     69}
    7870
    7971/** Starts the ARP module.
     
    8476 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    8577 */
    86 int module_start(async_client_conn_t client_connection);
    87 
    88 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    89         return arp_message(callid, call, answer, answer_count);
    90 }
    91 
    92 void module_print_name(void){
    93         printf("%s", NAME);
    94 }
    95 
    96 int module_start(async_client_conn_t client_connection){
     78int il_module_start(async_client_conn_t client_connection){
    9779        ERROR_DECLARE;
    9880
  • uspace/srv/net/il/ip/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = ip
    3334
    3435SOURCES = \
    3536        ip.c \
    36         ip_client.c \
    37         ip_module.c \
    38         $(NET_BASE)/checksum.c \
    39         $(NET_BASE)/inet.c \
    40         $(NET_BASE)/module.c \
    41         $(NET_BASE)/modules.c \
    42         $(NET_BASE)/il/arp/arp_remote.c \
    43         $(NET_BASE)/nil/nil_remote.c \
    44         $(NET_BASE)/net/net_remote.c \
    45         $(NET_BASE)/tl/icmp/icmp_client.c \
    46         $(NET_BASE)/tl/icmp/icmp_common.c \
    47         $(NET_BASE)/tl/icmp/icmp_remote.c \
    48         $(NET_BASE)/structures/char_map.c \
    49         $(NET_BASE)/structures/measured_strings.c \
    50         $(NET_BASE)/structures/module_map.c \
    51         $(NET_BASE)/structures/packet/packet.c \
    52         $(NET_BASE)/structures/packet/packet_client.c \
    53         $(NET_BASE)/structures/packet/packet_remote.c
     37        ip_module.c
    5438
    5539include $(USPACE_PREFIX)/Makefile.common
  • 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 */
  • uspace/srv/net/il/ip/ip.h

    r7d6fe4db r849ed54  
    3939
    4040#include <fibril_synch.h>
    41 
    4241#include <ipc/ipc.h>
    4342#include <ipc/services.h>
    4443
    45 #include "../../include/device.h"
    46 #include "../../include/inet.h"
    47 #include "../../include/ip_interface.h"
    48 
    49 #include "../../structures/int_map.h"
    50 #include "../../structures/generic_field.h"
    51 #include "../../structures/module_map.h"
     44#include <net_device.h>
     45#include <inet.h>
     46#include <ip_interface.h>
     47#include <adt/int_map.h>
     48#include <adt/generic_field.h>
     49#include <adt/module_map.h>
    5250
    5351/** Type definition of the IP global data.
  • uspace/srv/net/il/ip/ip_module.c

    r7d6fe4db r849ed54  
    4040#include <async.h>
    4141#include <stdio.h>
    42 
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../modules.h"
    48 
    49 #include "../../include/net_interface.h"
    50 
    51 #include "../../structures/packet/packet.h"
     45#include <net_err.h>
     46#include <net_modules.h>
     47#include <net_interface.h>
     48#include <packet/packet.h>
     49#include <il_standalone.h>
    5250
    5351#include "ip.h"
    5452#include "ip_module.h"
    55 
    56 /** IP module name.
    57  */
    58 #define NAME    "IP protocol"
    5953
    6054/** IP module global data.
     
    7064 *  @returns Other error codes as defined for the ip_message() function.
    7165 */
    72 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    73 
    74 /** Prints the module name.
    75  *  @see NAME
    76  */
    77 void module_print_name(void);
     66int il_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     67        return ip_message(callid, call, answer, answer_count);
     68}
    7869
    7970/** Starts the IP module.
     
    8475 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    8576 */
    86 int module_start(async_client_conn_t client_connection);
    87 
    88 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    89         return ip_message(callid, call, answer, answer_count);
    90 }
    91 
    92 void module_print_name(void){
    93         printf("%s", NAME);
    94 }
    95 
    96 int module_start(async_client_conn_t client_connection){
     77int il_module_start(async_client_conn_t client_connection){
    9778        ERROR_DECLARE;
    9879
  • uspace/srv/net/net/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ..
    3130USPACE_PREFIX = ../../..
    3231ROOT_PATH = $(USPACE_PREFIX)/..
     32LIBS = $(LIBNETIF_PREFIX)/libnetif.a $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     33EXTRA_CFLAGS = -I$(LIBNETIF_PREFIX)/include -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3334
    3435COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
    3536CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3637
    37 BINARY = net
    38 
    3938-include $(COMMON_MAKEFILE)
    4039-include $(CONFIG_MAKEFILE)
    4140
     41BINARY = net
     42
    4243SOURCES = \
    4344        net.c \
    44         $(NET_BASE)/module.c \
    45         $(NET_BASE)/modules.c \
    46         $(NET_BASE)/netif/netif_remote.c \
    47         $(NET_BASE)/structures/char_map.c \
    48         $(NET_BASE)/structures/measured_strings.c \
    49         $(NET_BASE)/structures/module_map.c \
    50         $(NET_BASE)/structures/packet/packet.c \
    51         $(NET_BASE)/structures/packet/packet_client.c \
    52         $(NET_BASE)/structures/packet/packet_server.c
    53 
    54 ifeq ($(CONFIG_NETWORKING),module)
    55         SOURCES += \
    56                 net_bundle.c \
    57                 $(NET_BASE)/checksum.c \
    58                 $(NET_BASE)/inet.c \
    59                 $(NET_BASE)/il/arp/arp.c \
    60                 $(NET_BASE)/il/ip/ip.c \
    61                 $(NET_BASE)/il/ip/ip_client.c \
    62                 $(NET_BASE)/socket/socket_core.c \
    63                 $(NET_BASE)/tl/icmp/icmp.c \
    64                 $(NET_BASE)/tl/icmp/icmp_client.c \
    65                 $(NET_BASE)/tl/tcp/tcp.c \
    66                 $(NET_BASE)/tl/tl_common.c \
    67                 $(NET_BASE)/tl/udp/udp.c \
    68                 $(NET_BASE)/structures/dynamic_fifo.c
    69 endif
    70 
    71 ifeq ($(CONFIG_NETWORKING),modular)
    72         SOURCES += \
    73                 net_standalone.c \
    74                 $(NET_BASE)/il/ip/ip_remote.c
    75 endif
     45        net_standalone.c
    7646
    7747include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/net/net.c

    r7d6fe4db r849ed54  
    4646#include <ipc/services.h>
    4747
    48 #include "../err.h"
    49 #include "../messages.h"
    50 #include "../modules.h"
    51 
    52 #include "../structures/char_map.h"
    53 #include "../structures/generic_char_map.h"
    54 #include "../structures/measured_strings.h"
    55 #include "../structures/module_map.h"
    56 #include "../structures/packet/packet.h"
    57 
    58 #include "../il/il_messages.h"
    59 #include "../include/device.h"
    60 #include "../include/netif_interface.h"
    61 #include "../include/nil_interface.h"
    62 #include "../include/net_interface.h"
    63 #include "../include/ip_interface.h"
     48#include <net_err.h>
     49#include <net_messages.h>
     50#include <net_modules.h>
     51#include <adt/char_map.h>
     52#include <adt/generic_char_map.h>
     53#include <adt/measured_strings.h>
     54#include <adt/module_map.h>
     55#include <packet/packet.h>
     56#include <il_messages.h>
     57#include <net_device.h>
     58#include <netif_interface.h>
     59#include <nil_interface.h>
     60#include <net_interface.h>
     61#include <ip_interface.h>
     62#include <net_net_messages.h>
    6463
    6564#include "net.h"
    66 #include "net_messages.h"
    6765
    6866/** File read buffer size.
     
    8280 */
    8381device_id_t generate_new_device_id(void);
    84 
    85 /** Prints the module name.
    86  *  @see NAME
    87  */
    88 void module_print_name(void);
    89 
    90 /** Starts the networking module.
    91  *  Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
    92  *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
    93  *  @returns EOK on successful module termination.
    94  *  @returns Other error codes as defined for the net_initialize() function.
    95  *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    96  */
    97 int module_start(async_client_conn_t client_connection);
    9882
    9983/** Returns the configured values.
     
    185169}
    186170
    187 void module_print_name(void){
    188         printf("%s", NAME);
    189 }
    190 
    191 int module_start(async_client_conn_t client_connection){
     171/** Starts the networking module.
     172 *  Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
     173 *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
     174 *  @returns EOK on successful module termination.
     175 *  @returns Other error codes as defined for the net_initialize() function.
     176 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
     177 */
     178static int net_module_start(async_client_conn_t client_connection){
    192179        ERROR_DECLARE;
    193180
     
    511498        ERROR_DECLARE;
    512499
    513 #ifdef CONFIG_NETIF_DP8390
    514500        const char * conf_files[] = {"lo", "ne2k"};
    515 #else
    516         const char * conf_files[] = {"lo"};
    517 #endif
    518501
    519502        int count = sizeof(conf_files) / sizeof(char *);
     
    580563}
    581564
     565/** Default thread for new connections.
     566 *
     567 *  @param[in] iid The initial message identifier.
     568 *  @param[in] icall The initial message call structure.
     569 *
     570 */
     571static void net_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     572{
     573        /*
     574         * Accept the connection
     575         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     576         */
     577        ipc_answer_0(iid, EOK);
     578       
     579        while(true) {
     580                ipc_call_t answer;
     581                int answer_count;
     582               
     583                /* Clear the answer structure */
     584                refresh_answer(&answer, &answer_count);
     585               
     586                /* Fetch the next message */
     587                ipc_call_t call;
     588                ipc_callid_t callid = async_get_call(&call);
     589               
     590                /* Process the message */
     591                int res = net_module_message(callid, &call, &answer, &answer_count);
     592               
     593                /* End if said to either by the message or the processing result */
     594                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     595                        return;
     596               
     597                /* Answer the message */
     598                answer_call(callid, res, &answer, answer_count);
     599        }
     600}
     601
     602/** Starts the module.
     603 *
     604 *  @param argc The count of the command line arguments. Ignored parameter.
     605 *  @param argv The command line parameters. Ignored parameter.
     606 *
     607 *  @returns EOK on success.
     608 *  @returns Other error codes as defined for each specific module start function.
     609 *
     610 */
     611int main(int argc, char *argv[])
     612{
     613        ERROR_DECLARE;
     614       
     615        /* Print the module label */
     616        printf("Task %d - %s\n", task_get_id(), NAME);
     617       
     618        /* Start the module */
     619        if (ERROR_OCCURRED(net_module_start(net_client_connection))) {
     620                printf(" - ERROR %i\n", ERROR_CODE);
     621                return ERROR_CODE;
     622        }
     623       
     624        return EOK;
     625}
     626
    582627/** @}
    583628 */
  • uspace/srv/net/net/net.h

    r7d6fe4db r849ed54  
    4040#include <ipc/ipc.h>
    4141
    42 #include "../include/device.h"
    43 
    44 #include "../structures/char_map.h"
    45 #include "../structures/generic_char_map.h"
    46 #include "../structures/measured_strings.h"
    47 #include "../structures/module_map.h"
    48 #include "../structures/packet/packet.h"
     42#include <net_device.h>
     43#include <adt/char_map.h>
     44#include <adt/generic_char_map.h>
     45#include <adt/measured_strings.h>
     46#include <adt/module_map.h>
     47#include <packet/packet.h>
    4948
    5049/** @name Modules definitions
     
    222221 *  @returns Other error codes as defined for each bundled module message function.
    223222 */
    224 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     223int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    225224
    226225/** Initializes the networking module for the chosen subsystem build type.
  • uspace/srv/net/net/net_bundle.c

    r7d6fe4db r849ed54  
    7979}
    8080
    81 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     81int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    8282        if((IPC_GET_METHOD(*call) == IPC_M_CONNECT_TO_ME)
    8383                || IS_NET_IL_MESSAGE(call)
  • uspace/srv/net/net/net_standalone.c

    r7d6fe4db r849ed54  
    3939#include <ipc/ipc.h>
    4040
    41 #include "../messages.h"
    42 
    43 #include "../include/ip_interface.h"
    44 
    45 #include "../structures/measured_strings.h"
    46 #include "../structures/module_map.h"
    47 #include "../structures/packet/packet_server.h"
     41#include <net_messages.h>
     42#include <ip_interface.h>
     43#include <adt/measured_strings.h>
     44#include <adt/module_map.h>
     45#include <packet/packet_server.h>
    4846
    4947#include "net.h"
     
    7573}
    7674
    77 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     75int net_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    7876        if(IS_NET_PACKET_MESSAGE(call)){
    7977                return packet_server_message(callid, call, answer, answer_count);
  • uspace/srv/net/netif/lo/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
    3231ROOT_PATH = $(USPACE_PREFIX)/..
     32LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     33EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3334
    3435COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
    3536CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
    3637
    37 BINARY = lo
    38 
    3938-include $(COMMON_MAKEFILE)
    4039-include $(CONFIG_MAKEFILE)
    4140
    42 SOURCES = \
    43         lo.c \
    44         $(NET_BASE)/module.c \
    45         $(NET_BASE)/modules.c \
    46         $(NET_BASE)/net/net_remote.c \
    47         $(NET_BASE)/netif/netif.c \
    48         $(NET_BASE)/structures/measured_strings.c \
    49         $(NET_BASE)/structures/packet/packet.c \
    50         $(NET_BASE)/structures/packet/packet_client.c \
    51         $(NET_BASE)/structures/packet/packet_remote.c
     41ifeq ($(CONFIG_NETWORKING),modular)
     42        BINARY = lo
     43endif
    5244
    5345ifeq ($(CONFIG_NETWORKING),module)
    54         SOURCES += \
    55                 $(NET_BASE)/nil/nildummy/nildummy.c \
    56                 $(NET_BASE)/netif/netif_nil_bundle.c
     46        LIBRARY = liblo
    5747endif
    5848
    59 ifeq ($(CONFIG_NETWORKING),modular)
    60         SOURCES += \
    61                 $(NET_BASE)/nil/nil_remote.c \
    62                 $(NET_BASE)/netif/netif_standalone.c
    63 endif
     49SOURCES = \
     50        lo.c
    6451
    6552include $(USPACE_PREFIX)/Makefile.common
  • 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 */
  • uspace/srv/net/netstart/netstart.c

    r7d6fe4db r849ed54  
    4444#include <ipc/services.h>
    4545
    46 #include "../../err.h"
    47 #include "../../modules.h"
    48 #include "../../self_test.h"
    49 
    50 #include "../net_messages.h"
     46#include <net_err.h>
     47#include <net_modules.h>
     48#include <net_net_messages.h>
     49#include "self_test.h"
    5150
    5251/** Networking startup module name.
    5352 */
    5453#define NAME    "Networking startup"
     54
     55/** Starts the module.
     56 *  @param[in] fname The module absolute name.
     57 *  @returns The started module task identifier.
     58 *  @returns Other error codes as defined for the task_spawn() function.
     59 */
     60static task_id_t spawn(const char * fname){
     61        const char * argv[2];
     62        task_id_t res;
     63
     64        argv[0] = fname;
     65        argv[1] = NULL;
     66        res = task_spawn(fname, argv);
     67       
     68        return res;
     69}
    5570
    5671/** Module entry point.
     
    6277 *  @returns Other error codes as defined for the NET_NET_STARTUP message.
    6378 */
    64 int main(int argc, char * argv[]);
    65 
    66 /** Starts the module.
    67  *  @param[in] fname The module absolute name.
    68  *  @returns The started module task identifier.
    69  *  @returns Other error codes as defined for the task_spawn() function.
    70  */
    71 task_id_t spawn(const char * fname);
    72 
    7379int main(int argc, char * argv[]){
    7480        ERROR_DECLARE;
     
    101107}
    102108
    103 task_id_t spawn(const char * fname){
    104         const char * argv[2];
    105         task_id_t res;
    106 
    107         argv[0] = fname;
    108         argv[1] = NULL;
    109         res = task_spawn(fname, argv);
    110        
    111         return res;
    112 }
    113 
    114109/** @}
    115110 */
  • uspace/srv/net/netstart/self_test.c

    r7d6fe4db r849ed54  
    4343#include <stdio.h>
    4444
    45 #include "include/checksum.h"
    46 #include "structures/int_map.h"
    47 #include "structures/char_map.h"
    48 #include "structures/generic_char_map.h"
    49 #include "structures/measured_strings.h"
    50 #include "structures/dynamic_fifo.h"
     45#include <net_checksum.h>
     46#include <adt/int_map.h>
     47#include <adt/char_map.h>
     48#include <adt/generic_char_map.h>
     49#include <adt/measured_strings.h>
     50#include <adt/dynamic_fifo.h>
    5151
    5252#include "self_test.h"
  • uspace/srv/net/netstart/self_test.h

    r7d6fe4db r849ed54  
    4949#if NET_SELF_TEST
    5050
    51 int self_test(void);
     51extern int self_test(void);
    5252
    5353#else
  • uspace/srv/net/nil/eth/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNETIF_PREFIX)/libnetif.a $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNETIF_PREFIX)/include -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = eth
    3334
    3435SOURCES = \
    3536        eth.c \
    36         eth_module.c \
    37         $(NET_BASE)/checksum.c \
    38         $(NET_BASE)/module.c \
    39         $(NET_BASE)/modules.c \
    40         $(NET_BASE)/net/net_remote.c \
    41         $(NET_BASE)/netif/netif_remote.c \
    42         $(NET_BASE)/structures/measured_strings.c \
    43         $(NET_BASE)/structures/packet/packet.c \
    44         $(NET_BASE)/structures/packet/packet_client.c \
    45         $(NET_BASE)/structures/packet/packet_remote.c
     37        eth_module.c
    4638
    4739include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/nil/eth/eth.c

    r7d6fe4db r849ed54  
    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 */
  • uspace/srv/net/nil/eth/eth.h

    r7d6fe4db r849ed54  
    4141#include <ipc/services.h>
    4242
    43 #include "../../include/device.h"
    44 #include "../../structures/measured_strings.h"
     43#include <net_device.h>
     44#include <adt/measured_strings.h>
    4545
    4646/** Type definition of the Ethernet global data.
     
    147147};
    148148
     149/** Module initialization.
     150 *  Is called by the module_start() function.
     151 *  @param[in] net_phone The networking moduel phone.
     152 *  @returns EOK on success.
     153 *  @returns Other error codes as defined for each specific module initialize function.
     154 */
     155extern int nil_initialize(int net_phone);
     156
     157/** Message processing function.
     158 *  @param[in] callid The message identifier.
     159 *  @param[in] call The message parameters.
     160 *  @param[out] answer The message answer parameters.
     161 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     162 *  @returns EOK on success.
     163 *  @returns ENOTSUP if the message is not known.
     164 *  @returns Other error codes as defined for each specific module message function.
     165 *  @see nil_interface.h
     166 *  @see IS_NET_NIL_MESSAGE()
     167 */
     168extern int nil_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     169
    149170#endif
    150171
  • uspace/srv/net/nil/eth/eth_module.c

    r7d6fe4db r849ed54  
    4242#include <ipc/services.h>
    4343
    44 #include "../../err.h"
    45 #include "../../modules.h"
    46 
    47 #include "../../include/net_interface.h"
    48 
    49 #include "../../structures/packet/packet.h"
    50 
    51 #include "../nil_module.h"
     44#include <net_err.h>
     45#include <net_modules.h>
     46#include <net_interface.h>
     47#include <packet/packet.h>
     48#include <nil_standalone.h>
    5249
    5350#include "eth.h"
    54 
    55 /** The module name.
    56  */
    57 #define NAME    "Ethernet protocol"
    58 
    59 /** Prints the module name.
    60  */
    61 void module_print_name(void);
    6251
    6352/** Starts the Ethernet module.
     
    6958 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    7059 */
    71 int module_start(async_client_conn_t client_connection);
    72 
    73 /** Passes the parameters to the module specific nil_message() function.
    74  *  @param[in] callid The message identifier.
    75  *  @param[in] call The message parameters.
    76  *  @param[out] answer The message answer parameters.
    77  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    78  *  @returns EOK on success.
    79  *  @returns ENOTSUP if the message is not known.
    80  *  @returns Other error codes as defined for each specific module message function.
    81  */
    82 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    83 
    84 void module_print_name(void){
    85         printf("%s", NAME);
    86 }
    87 
    88 int module_start(async_client_conn_t client_connection){
     60int nil_module_start(async_client_conn_t client_connection){
    8961        ERROR_DECLARE;
    9062
     
    10779}
    10880
    109 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     81/** Passes the parameters to the module specific nil_message() function.
     82 *  @param[in] callid The message identifier.
     83 *  @param[in] call The message parameters.
     84 *  @param[out] answer The message answer parameters.
     85 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     86 *  @returns EOK on success.
     87 *  @returns ENOTSUP if the message is not known.
     88 *  @returns Other error codes as defined for each specific module message function.
     89 */
     90int nil_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    11091        return nil_message(callid, call, answer, answer_count);
    11192}
  • uspace/srv/net/nil/nildummy/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNETIF_PREFIX)/libnetif.a $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNETIF_PREFIX)/include -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = nildummy
    3334
    3435SOURCES = \
    3536        nildummy.c \
    36         nildummy_module.c \
    37         $(NET_BASE)/module.c \
    38         $(NET_BASE)/modules.c \
    39         $(NET_BASE)/net/net_remote.c \
    40         $(NET_BASE)/netif/netif_remote.c \
    41         $(NET_BASE)/structures/measured_strings.c \
    42         $(NET_BASE)/structures/packet/packet.c \
    43         $(NET_BASE)/structures/packet/packet_client.c \
    44         $(NET_BASE)/structures/packet/packet_remote.c
     37        nildummy_module.c
    4538
    4639include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/nil/nildummy/nildummy.c

    r7d6fe4db r849ed54  
    4545#include <ipc/services.h>
    4646
    47 #include "../../err.h"
    48 #include "../../messages.h"
    49 #include "../../modules.h"
    50 
    51 #include "../../include/device.h"
    52 #include "../../include/netif_interface.h"
    53 #include "../../include/nil_interface.h"
    54 #include "../../include/il_interface.h"
    55 
    56 #include "../../structures/measured_strings.h"
    57 #include "../../structures/packet/packet.h"
    58 
    59 #include "../nil_module.h"
     47#include <net_err.h>
     48#include <net_messages.h>
     49#include <net_modules.h>
     50#include <net_device.h>
     51#include <netif_interface.h>
     52#include <nil_interface.h>
     53#include <il_interface.h>
     54#include <adt/measured_strings.h>
     55#include <packet/packet.h>
     56#include <nil_module.h>
    6057
    6158#include "nildummy.h"
     59
     60/** The module name.
     61 */
     62#define NAME    "Dummy nil protocol"
    6263
    6364/** Default maximum transmission unit.
     
    373374}
    374375
     376#ifdef CONFIG_NETWORKING_modular
     377
     378#include <nil_standalone.h>
     379
     380/** Default thread for new connections.
     381 *
     382 *  @param[in] iid The initial message identifier.
     383 *  @param[in] icall The initial message call structure.
     384 *
     385 */
     386static void nil_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     387{
     388        /*
     389         * Accept the connection
     390         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     391         */
     392        ipc_answer_0(iid, EOK);
     393       
     394        while(true) {
     395                ipc_call_t answer;
     396                int answer_count;
     397               
     398                /* Clear the answer structure */
     399                refresh_answer(&answer, &answer_count);
     400               
     401                /* Fetch the next message */
     402                ipc_call_t call;
     403                ipc_callid_t callid = async_get_call(&call);
     404               
     405                /* Process the message */
     406                int res = nil_module_message(callid, &call, &answer, &answer_count);
     407               
     408                /* End if said to either by the message or the processing result */
     409                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     410                        return;
     411               
     412                /* Answer the message */
     413                answer_call(callid, res, &answer, answer_count);
     414        }
     415}
     416
     417/** Starts the module.
     418 *
     419 *  @param argc The count of the command line arguments. Ignored parameter.
     420 *  @param argv The command line parameters. Ignored parameter.
     421 *
     422 *  @returns EOK on success.
     423 *  @returns Other error codes as defined for each specific module start function.
     424 *
     425 */
     426int main(int argc, char *argv[])
     427{
     428        ERROR_DECLARE;
     429       
     430        /* Print the module label */
     431        printf("Task %d - %s\n", task_get_id(), NAME);
     432       
     433        /* Start the module */
     434        if (ERROR_OCCURRED(nil_module_start(nil_client_connection))) {
     435                printf(" - ERROR %i\n", ERROR_CODE);
     436                return ERROR_CODE;
     437        }
     438       
     439        return EOK;
     440}
     441
     442#endif /* CONFIG_NETWORKING_modular */
     443
    375444/** @}
    376445 */
  • uspace/srv/net/nil/nildummy/nildummy.h

    r7d6fe4db r849ed54  
    4141#include <ipc/services.h>
    4242
    43 #include "../../include/device.h"
    44 #include "../../structures/measured_strings.h"
     43#include <net_device.h>
     44#include <adt/measured_strings.h>
    4545
    4646/** Type definition of the dummy nil global data.
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r7d6fe4db r849ed54  
    4242#include <ipc/services.h>
    4343
    44 #include "../../err.h"
    45 #include "../../modules.h"
    46 
    47 #include "../../include/net_interface.h"
    48 
    49 #include "../../structures/packet/packet.h"
    50 
    51 #include "../nil_module.h"
     44#include <net_err.h>
     45#include <net_modules.h>
     46#include <net_interface.h>
     47#include <packet/packet.h>
     48#include <nil_module.h>
     49#include <nil_standalone.h>
    5250
    5351#include "nildummy.h"
    54 
    55 /** The module name.
    56  */
    57 #define NAME    "Dummy nil protocol"
    58 
    59 /** Prints the module name.
    60  */
    61 void module_print_name(void);
    6252
    6353/** Starts the dummy nil module.
     
    6959 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    7060 */
    71 int module_start(async_client_conn_t client_connection);
    72 
    73 /** Passes the parameters to the module specific nil_message() function.
    74  *  @param[in] callid The message identifier.
    75  *  @param[in] call The message parameters.
    76  *  @param[out] answer The message answer parameters.
    77  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    78  *  @returns EOK on success.
    79  *  @returns ENOTSUP if the message is not known.
    80  *  @returns Other error codes as defined for each specific module message function.
    81  */
    82 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    83 
    84 void module_print_name(void){
    85         printf("%s", NAME);
    86 }
    87 
    88 int module_start(async_client_conn_t client_connection){
     61int nil_module_start(async_client_conn_t client_connection){
    8962        ERROR_DECLARE;
    9063
     
    10780}
    10881
    109 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     82/** Passes the parameters to the module specific nil_message() function.
     83 *  @param[in] callid The message identifier.
     84 *  @param[in] call The message parameters.
     85 *  @param[out] answer The message answer parameters.
     86 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     87 *  @returns EOK on success.
     88 *  @returns ENOTSUP if the message is not known.
     89 *  @returns Other error codes as defined for each specific module message function.
     90 */
     91int nil_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    11092        return nil_message(callid, call, answer, answer_count);
    11193}
  • uspace/srv/net/tl/icmp/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = icmp
    3334
    3435SOURCES = \
    3536        icmp.c \
    36         icmp_module.c \
    37         icmp_client.c \
    38         $(NET_BASE)/checksum.c \
    39         $(NET_BASE)/module.c \
    40         $(NET_BASE)/modules.c \
    41         $(NET_BASE)/il/ip/ip_client.c \
    42         $(NET_BASE)/il/ip/ip_remote.c \
    43         $(NET_BASE)/net/net_remote.c \
    44         $(NET_BASE)/structures/measured_strings.c \
    45         $(NET_BASE)/structures/packet/packet.c \
    46         $(NET_BASE)/structures/packet/packet_client.c \
    47         $(NET_BASE)/structures/packet/packet_remote.c
     37        icmp_module.c
    4838
    4939include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/tl/icmp/icmp.c

    r7d6fe4db r849ed54  
    4242#include <stdint.h>
    4343#include <str.h>
    44 
    4544#include <ipc/ipc.h>
    4645#include <ipc/services.h>
    47 
    4846#include <sys/time.h>
    4947#include <sys/types.h>
    5048
    51 #include "../../err.h"
    52 #include "../../messages.h"
    53 #include "../../modules.h"
    54 
    55 #include "../../structures/packet/packet_client.h"
    56 
    57 #include "../../include/byteorder.h"
    58 #include "../../include/checksum.h"
    59 #include "../../include/icmp_api.h"
    60 #include "../../include/icmp_client.h"
    61 #include "../../include/icmp_codes.h"
    62 #include "../../include/icmp_common.h"
    63 #include "../../include/icmp_interface.h"
    64 #include "../../include/il_interface.h"
    65 #include "../../include/inet.h"
    66 #include "../../include/ip_client.h"
    67 #include "../../include/ip_interface.h"
    68 #include "../../include/ip_protocols.h"
    69 #include "../../include/net_interface.h"
    70 #include "../../include/socket_codes.h"
    71 #include "../../include/socket_errno.h"
    72 
    73 #include "../../tl/tl_messages.h"
     49#include <net_err.h>
     50#include <net_messages.h>
     51#include <net_modules.h>
     52#include <packet/packet_client.h>
     53#include <net_byteorder.h>
     54#include <net_checksum.h>
     55#include <icmp_api.h>
     56#include <icmp_client.h>
     57#include <icmp_codes.h>
     58#include <icmp_common.h>
     59#include <icmp_interface.h>
     60#include <il_interface.h>
     61#include <inet.h>
     62#include <ip_client.h>
     63#include <ip_interface.h>
     64#include <ip_protocols.h>
     65#include <net_interface.h>
     66#include <socket_codes.h>
     67#include <socket_errno.h>
     68#include <tl_messages.h>
     69#include <icmp_messages.h>
     70#include <icmp_header.h>
    7471
    7572#include "icmp.h"
    76 #include "icmp_header.h"
    77 #include "icmp_messages.h"
    7873#include "icmp_module.h"
     74
     75/** ICMP module name.
     76 */
     77#define NAME    "ICMP protocol"
    7978
    8079/** Default ICMP error reporting.
     
    820819}
    821820
     821#ifdef CONFIG_NETWORKING_modular
     822
     823#include <tl_standalone.h>
     824
     825/** Default thread for new connections.
     826 *
     827 *  @param[in] iid The initial message identifier.
     828 *  @param[in] icall The initial message call structure.
     829 *
     830 */
     831static void tl_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     832{
     833        /*
     834         * Accept the connection
     835         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     836         */
     837        ipc_answer_0(iid, EOK);
     838       
     839        while(true) {
     840                ipc_call_t answer;
     841                int answer_count;
     842               
     843                /* Clear the answer structure */
     844                refresh_answer(&answer, &answer_count);
     845               
     846                /* Fetch the next message */
     847                ipc_call_t call;
     848                ipc_callid_t callid = async_get_call(&call);
     849               
     850                /* Process the message */
     851                int res = tl_module_message(callid, &call, &answer, &answer_count);
     852               
     853                /* End if said to either by the message or the processing result */
     854                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     855                        return;
     856               
     857                /* Answer the message */
     858                answer_call(callid, res, &answer, answer_count);
     859        }
     860}
     861
     862/** Starts the module.
     863 *
     864 *  @param argc The count of the command line arguments. Ignored parameter.
     865 *  @param argv The command line parameters. Ignored parameter.
     866 *
     867 *  @returns EOK on success.
     868 *  @returns Other error codes as defined for each specific module start function.
     869 *
     870 */
     871int main(int argc, char *argv[])
     872{
     873        ERROR_DECLARE;
     874       
     875        /* Print the module label */
     876        printf("Task %d - %s\n", task_get_id(), NAME);
     877       
     878        /* Start the module */
     879        if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
     880                printf(" - ERROR %i\n", ERROR_CODE);
     881                return ERROR_CODE;
     882        }
     883       
     884        return EOK;
     885}
     886
     887#endif /* CONFIG_NETWORKING_modular */
     888
    822889/** @}
    823890 */
  • uspace/srv/net/tl/icmp/icmp.h

    r7d6fe4db r849ed54  
    4040#include <fibril_synch.h>
    4141
    42 #include "../../include/icmp_codes.h"
    43 
    44 #include "../../structures/int_map.h"
    45 
    46 #include "icmp_header.h"
     42#include <icmp_codes.h>
     43#include <adt/int_map.h>
     44#include <icmp_header.h>
    4745
    4846/** Type definition of the ICMP reply data.
  • uspace/srv/net/tl/icmp/icmp_module.c

    r7d6fe4db r849ed54  
    4040#include <async.h>
    4141#include <stdio.h>
    42 
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../modules.h"
    48 
    49 #include "../../structures/packet/packet.h"
    50 
    51 #include "../../include/net_interface.h"
     45#include <net_err.h>
     46#include <net_modules.h>
     47#include <packet/packet.h>
     48#include <net_interface.h>
     49#include <tl_standalone.h>
    5250
    5351#include "icmp.h"
    5452#include "icmp_module.h"
    5553
    56 /** ICMP module name.
     54/** ICMP module global data.
    5755 */
    58 #define NAME    "ICMP protocol"
    59 
    60 /** Prints the module name.
    61  *  @see NAME
    62  */
    63 void module_print_name(void);
     56extern icmp_globals_t   icmp_globals;
    6457
    6558/** Starts the ICMP module.
     
    7063 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    7164 */
    72 int module_start(async_client_conn_t client_connection);
    73 
    74 /** Processes the ICMP message.
    75  *  @param[in] callid The message identifier.
    76  *  @param[in] call The message parameters.
    77  *  @param[out] answer The message answer parameters.
    78  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    79  *  @returns EOK on success.
    80  *  @returns Other error codes as defined for the icmp_message() function.
    81  */
    82 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    83 
    84 /** ICMP module global data.
    85  */
    86 extern icmp_globals_t   icmp_globals;
    87 
    88 void module_print_name(void){
    89         printf("%s", NAME);
    90 }
    91 
    92 int module_start(async_client_conn_t client_connection){
     65int tl_module_start(async_client_conn_t client_connection){
    9366        ERROR_DECLARE;
    9467
     
    11386}
    11487
    115 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     88/** Processes the ICMP message.
     89 *  @param[in] callid The message identifier.
     90 *  @param[in] call The message parameters.
     91 *  @param[out] answer The message answer parameters.
     92 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     93 *  @returns EOK on success.
     94 *  @returns Other error codes as defined for the icmp_message() function.
     95 */
     96int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    11697        return icmp_message(callid, call, answer, answer_count);
    11798}
  • uspace/srv/net/tl/tcp/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = tcp
    3334
    3435SOURCES = \
    3536        tcp.c \
    36         tcp_module.c \
    37         $(NET_BASE)/checksum.c \
    38         $(NET_BASE)/module.c \
    39         $(NET_BASE)/modules.c \
    40         $(NET_BASE)/il/ip/ip_client.c \
    41         $(NET_BASE)/il/ip/ip_remote.c \
    42         $(NET_BASE)/net/net_remote.c \
    43         $(NET_BASE)/socket/socket_core.c \
    44         $(NET_BASE)/tl/icmp/icmp_client.c \
    45         $(NET_BASE)/tl/icmp/icmp_common.c \
    46         $(NET_BASE)/tl/icmp/icmp_remote.c \
    47         $(NET_BASE)/tl/tl_common.c \
    48         $(NET_BASE)/structures/char_map.c \
    49         $(NET_BASE)/structures/dynamic_fifo.c \
    50         $(NET_BASE)/structures/measured_strings.c \
    51         $(NET_BASE)/structures/packet/packet.c \
    52         $(NET_BASE)/structures/packet/packet_client.c \
    53         $(NET_BASE)/structures/packet/packet_remote.c
     37        tcp_module.c
    5438
    5539include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/tl/tcp/tcp.c

    r7d6fe4db r849ed54  
    4646#include <ipc/services.h>
    4747
    48 #include "../../err.h"
    49 #include "../../messages.h"
    50 #include "../../modules.h"
    51 
    52 #include "../../structures/dynamic_fifo.h"
    53 #include "../../structures/packet/packet_client.h"
    54 
    55 #include "../../include/checksum.h"
    56 #include "../../include/in.h"
    57 #include "../../include/in6.h"
    58 #include "../../include/inet.h"
    59 #include "../../include/ip_client.h"
    60 #include "../../include/ip_interface.h"
    61 #include "../../include/ip_protocols.h"
    62 #include "../../include/icmp_client.h"
    63 #include "../../include/icmp_interface.h"
    64 #include "../../include/net_interface.h"
    65 #include "../../include/socket_codes.h"
    66 #include "../../include/socket_errno.h"
    67 #include "../../include/tcp_codes.h"
    68 
    69 #include "../../socket/socket_core.h"
    70 #include "../../socket/socket_messages.h"
    71 
    72 #include "../tl_common.h"
    73 #include "../tl_messages.h"
     48#include <net_err.h>
     49#include <net_messages.h>
     50#include <net_modules.h>
     51#include <adt/dynamic_fifo.h>
     52#include <packet/packet_client.h>
     53#include <net_checksum.h>
     54#include <in.h>
     55#include <in6.h>
     56#include <inet.h>
     57#include <ip_client.h>
     58#include <ip_interface.h>
     59#include <ip_protocols.h>
     60#include <icmp_client.h>
     61#include <icmp_interface.h>
     62#include <net_interface.h>
     63#include <socket_codes.h>
     64#include <socket_errno.h>
     65#include <tcp_codes.h>
     66#include <socket_core.h>
     67#include <socket_messages.h>
     68#include <tl_common.h>
     69#include <tl_messages.h>
    7470
    7571#include "tcp.h"
    7672#include "tcp_header.h"
    7773#include "tcp_module.h"
     74
     75/** TCP module name.
     76 */
     77#define NAME    "TCP protocol"
    7878
    7979/** The TCP window default value.
     
    19971997}
    19981998
     1999#ifdef CONFIG_NETWORKING_modular
     2000
     2001#include <tl_standalone.h>
     2002
     2003/** Default thread for new connections.
     2004 *
     2005 *  @param[in] iid The initial message identifier.
     2006 *  @param[in] icall The initial message call structure.
     2007 *
     2008 */
     2009static void tl_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     2010{
     2011        /*
     2012         * Accept the connection
     2013         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     2014         */
     2015        ipc_answer_0(iid, EOK);
     2016       
     2017        while(true) {
     2018                ipc_call_t answer;
     2019                int answer_count;
     2020               
     2021                /* Clear the answer structure */
     2022                refresh_answer(&answer, &answer_count);
     2023               
     2024                /* Fetch the next message */
     2025                ipc_call_t call;
     2026                ipc_callid_t callid = async_get_call(&call);
     2027               
     2028                /* Process the message */
     2029                int res = tl_module_message(callid, &call, &answer, &answer_count);
     2030               
     2031                /* End if said to either by the message or the processing result */
     2032                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     2033                        return;
     2034               
     2035                /* Answer the message */
     2036                answer_call(callid, res, &answer, answer_count);
     2037        }
     2038}
     2039
     2040/** Starts the module.
     2041 *
     2042 *  @param argc The count of the command line arguments. Ignored parameter.
     2043 *  @param argv The command line parameters. Ignored parameter.
     2044 *
     2045 *  @returns EOK on success.
     2046 *  @returns Other error codes as defined for each specific module start function.
     2047 *
     2048 */
     2049int main(int argc, char *argv[])
     2050{
     2051        ERROR_DECLARE;
     2052       
     2053        /* Print the module label */
     2054        printf("Task %d - %s\n", task_get_id(), NAME);
     2055       
     2056        /* Start the module */
     2057        if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
     2058                printf(" - ERROR %i\n", ERROR_CODE);
     2059                return ERROR_CODE;
     2060        }
     2061       
     2062        return EOK;
     2063}
     2064
     2065#endif /* CONFIG_NETWORKING_modular */
     2066
    19992067/** @}
    20002068 */
  • uspace/srv/net/tl/tcp/tcp.h

    r7d6fe4db r849ed54  
    4040#include <fibril_synch.h>
    4141
    42 #include "../../structures/packet/packet.h"
    43 
    44 #include "../../include/device.h"
    45 
    46 #include "../../socket/socket_core.h"
    47 
    48 #include "../tl_common.h"
     42#include <packet/packet.h>
     43#include <net_device.h>
     44#include <socket_core.h>
     45#include <tl_common.h>
    4946
    5047/** Type definition of the TCP global data.
  • uspace/srv/net/tl/tcp/tcp_module.c

    r7d6fe4db r849ed54  
    4040#include <async.h>
    4141#include <stdio.h>
    42 
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../modules.h"
    48 
    49 #include "../../structures/packet/packet.h"
    50 
    51 #include "../../include/net_interface.h"
    52 #include "../../include/ip_protocols.h"
    53 #include "../../include/ip_interface.h"
     45#include <net_err.h>
     46#include <net_modules.h>
     47#include <packet/packet.h>
     48#include <net_interface.h>
     49#include <ip_protocols.h>
     50#include <ip_interface.h>
     51#include <tl_standalone.h>
    5452
    5553#include "tcp.h"
    5654#include "tcp_module.h"
    5755
    58 /** TCP module name.
     56/** TCP module global data.
    5957 */
    60 #define NAME    "TCP protocol"
    61 
    62 /** Prints the module name.
    63  *  @see NAME
    64  */
    65 void module_print_name(void);
     58extern tcp_globals_t    tcp_globals;
    6659
    6760/** Starts the TCP module.
     
    7265 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    7366 */
    74 int module_start(async_client_conn_t client_connection);
    75 
    76 /** Processes the TCP message.
    77  *  @param[in] callid The message identifier.
    78  *  @param[in] call The message parameters.
    79  *  @param[out] answer The message answer parameters.
    80  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    81  *  @returns EOK on success.
    82  *  @returns Other error codes as defined for the tcp_message() function.
    83  */
    84 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    85 
    86 /** TCP module global data.
    87  */
    88 extern tcp_globals_t    tcp_globals;
    89 
    90 void module_print_name(void){
    91         printf("%s", NAME);
    92 }
    93 
    94 int module_start(async_client_conn_t client_connection){
     67int tl_module_start(async_client_conn_t client_connection){
    9568        ERROR_DECLARE;
    9669
     
    11285}
    11386
    114 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     87/** Processes the TCP message.
     88 *  @param[in] callid The message identifier.
     89 *  @param[in] call The message parameters.
     90 *  @param[out] answer The message answer parameters.
     91 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     92 *  @returns EOK on success.
     93 *  @returns Other error codes as defined for the tcp_message() function.
     94 */
     95int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    11596        return tcp_message(callid, call, answer, answer_count);
    11697}
  • uspace/srv/net/tl/tcp/tcp_module.h

    r7d6fe4db r849ed54  
    4747 *  @returns ENOMEM if there is not enough memory left.
    4848 */
    49 int tcp_initialize(async_client_conn_t client_connection);
     49extern int tcp_initialize(async_client_conn_t client_connection);
    5050
    5151/** Processes the TCP message.
     
    5959 *  @see IS_NET_TCP_MESSAGE()
    6060 */
    61 int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     61extern int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    6262
    6363#endif
  • uspace/srv/net/tl/udp/Makefile

    r7d6fe4db r849ed54  
    2828#
    2929
    30 NET_BASE = ../..
    3130USPACE_PREFIX = ../../../..
     31LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a
     32EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include
    3233BINARY = udp
    3334
    3435SOURCES = \
    3536        udp.c \
    36         udp_module.c \
    37         $(NET_BASE)/checksum.c \
    38         $(NET_BASE)/module.c \
    39         $(NET_BASE)/modules.c \
    40         $(NET_BASE)/il/ip/ip_client.c \
    41         $(NET_BASE)/il/ip/ip_remote.c \
    42         $(NET_BASE)/net/net_remote.c \
    43         $(NET_BASE)/socket/socket_core.c \
    44         $(NET_BASE)/tl/icmp/icmp_client.c \
    45         $(NET_BASE)/tl/icmp/icmp_common.c \
    46         $(NET_BASE)/tl/icmp/icmp_remote.c \
    47         $(NET_BASE)/tl/tl_common.c \
    48         $(NET_BASE)/structures/char_map.c \
    49         $(NET_BASE)/structures/dynamic_fifo.c \
    50         $(NET_BASE)/structures/measured_strings.c \
    51         $(NET_BASE)/structures/packet/packet.c \
    52         $(NET_BASE)/structures/packet/packet_client.c \
    53         $(NET_BASE)/structures/packet/packet_remote.c
     37        udp_module.c
    5438
    5539include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/tl/udp/udp.c

    r7d6fe4db r849ed54  
    4040#include <malloc.h>
    4141#include <stdio.h>
    42 
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../messages.h"
    48 #include "../../modules.h"
    49 
    50 #include "../../structures/dynamic_fifo.h"
    51 #include "../../structures/packet/packet_client.h"
    52 
    53 #include "../../include/checksum.h"
    54 #include "../../include/in.h"
    55 #include "../../include/in6.h"
    56 #include "../../include/inet.h"
    57 #include "../../include/ip_client.h"
    58 #include "../../include/ip_interface.h"
    59 #include "../../include/ip_protocols.h"
    60 #include "../../include/icmp_client.h"
    61 #include "../../include/icmp_interface.h"
    62 #include "../../include/net_interface.h"
    63 #include "../../include/socket_codes.h"
    64 #include "../../include/socket_errno.h"
    65 
    66 #include "../../socket/socket_core.h"
    67 #include "../../socket/socket_messages.h"
    68 
    69 #include "../tl_common.h"
    70 #include "../tl_messages.h"
     45#include <net_err.h>
     46#include <net_messages.h>
     47#include <net_modules.h>
     48#include <adt/dynamic_fifo.h>
     49#include <packet/packet_client.h>
     50#include <net_checksum.h>
     51#include <in.h>
     52#include <in6.h>
     53#include <inet.h>
     54#include <ip_client.h>
     55#include <ip_interface.h>
     56#include <ip_protocols.h>
     57#include <icmp_client.h>
     58#include <icmp_interface.h>
     59#include <net_interface.h>
     60#include <socket_codes.h>
     61#include <socket_errno.h>
     62#include <socket_core.h>
     63#include <socket_messages.h>
     64#include <tl_common.h>
     65#include <tl_messages.h>
    7166
    7267#include "udp.h"
    7368#include "udp_header.h"
    7469#include "udp_module.h"
     70
     71/** UDP module name.
     72 */
     73#define NAME    "UDP protocol"
    7574
    7675/** Default UDP checksum computing.
     
    700699}
    701700
     701#ifdef CONFIG_NETWORKING_modular
     702
     703#include <tl_standalone.h>
     704
     705/** Default thread for new connections.
     706 *
     707 *  @param[in] iid The initial message identifier.
     708 *  @param[in] icall The initial message call structure.
     709 *
     710 */
     711static void tl_client_connection(ipc_callid_t iid, ipc_call_t * icall)
     712{
     713        /*
     714         * Accept the connection
     715         *  - Answer the first IPC_M_CONNECT_ME_TO call.
     716         */
     717        ipc_answer_0(iid, EOK);
     718       
     719        while(true) {
     720                ipc_call_t answer;
     721                int answer_count;
     722               
     723                /* Clear the answer structure */
     724                refresh_answer(&answer, &answer_count);
     725               
     726                /* Fetch the next message */
     727                ipc_call_t call;
     728                ipc_callid_t callid = async_get_call(&call);
     729               
     730                /* Process the message */
     731                int res = tl_module_message(callid, &call, &answer, &answer_count);
     732               
     733                /* End if said to either by the message or the processing result */
     734                if ((IPC_GET_METHOD(call) == IPC_M_PHONE_HUNGUP) || (res == EHANGUP))
     735                        return;
     736               
     737                /* Answer the message */
     738                answer_call(callid, res, &answer, answer_count);
     739        }
     740}
     741
     742/** Starts the module.
     743 *
     744 *  @param argc The count of the command line arguments. Ignored parameter.
     745 *  @param argv The command line parameters. Ignored parameter.
     746 *
     747 *  @returns EOK on success.
     748 *  @returns Other error codes as defined for each specific module start function.
     749 *
     750 */
     751int main(int argc, char *argv[])
     752{
     753        ERROR_DECLARE;
     754       
     755        /* Print the module label */
     756        printf("Task %d - %s\n", task_get_id(), NAME);
     757       
     758        /* Start the module */
     759        if (ERROR_OCCURRED(tl_module_start(tl_client_connection))) {
     760                printf(" - ERROR %i\n", ERROR_CODE);
     761                return ERROR_CODE;
     762        }
     763       
     764        return EOK;
     765}
     766
     767#endif /* CONFIG_NETWORKING_modular */
     768
    702769/** @}
    703770 */
  • uspace/srv/net/tl/udp/udp.h

    r7d6fe4db r849ed54  
    3939
    4040#include <fibril_synch.h>
    41 
    42 #include "../../socket/socket_core.h"
    43 
    44 #include "../tl_common.h"
     41#include <socket_core.h>
     42#include <tl_common.h>
    4543
    4644/** Type definition of the UDP global data.
  • uspace/srv/net/tl/udp/udp_module.c

    r7d6fe4db r849ed54  
    4040#include <async.h>
    4141#include <stdio.h>
    42 
    4342#include <ipc/ipc.h>
    4443#include <ipc/services.h>
    4544
    46 #include "../../err.h"
    47 #include "../../modules.h"
    48 
    49 #include "../../structures/packet/packet.h"
    50 
    51 #include "../../include/net_interface.h"
     45#include <net_err.h>
     46#include <net_modules.h>
     47#include <packet/packet.h>
     48#include <net_interface.h>
     49#include <tl_standalone.h>
    5250
    5351#include "udp.h"
    5452#include "udp_module.h"
    5553
    56 /** UDP module name.
     54/** UDP module global data.
    5755 */
    58 #define NAME    "UDP protocol"
    59 
    60 /** Prints the module name.
    61  *  @see NAME
    62  */
    63 void module_print_name(void);
     56extern udp_globals_t    udp_globals;
    6457
    6558/** Starts the UDP module.
     
    7063 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
    7164 */
    72 int module_start(async_client_conn_t client_connection);
    73 
    74 /** Processes the UDP message.
    75  *  @param[in] callid The message identifier.
    76  *  @param[in] call The message parameters.
    77  *  @param[out] answer The message answer parameters.
    78  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    79  *  @returns EOK on success.
    80  *  @returns Other error codes as defined for the udp_message() function.
    81  */
    82 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    83 
    84 /** UDP module global data.
    85  */
    86 extern udp_globals_t    udp_globals;
    87 
    88 void module_print_name(void){
    89         printf("%s", NAME);
    90 }
    91 
    92 int module_start(async_client_conn_t client_connection){
     65int tl_module_start(async_client_conn_t client_connection){
    9366        ERROR_DECLARE;
    9467
     
    11386}
    11487
    115 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     88/** Processes the UDP message.
     89 *  @param[in] callid The message identifier.
     90 *  @param[in] call The message parameters.
     91 *  @param[out] answer The message answer parameters.
     92 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     93 *  @returns EOK on success.
     94 *  @returns Other error codes as defined for the udp_message() function.
     95 */
     96int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    11697        return udp_message(callid, call, answer, answer_count);
    11798}
  • uspace/srv/net/tl/udp/udp_module.h

    r7d6fe4db r849ed54  
    4747 *  @returns ENOMEM if there is not enough memory left.
    4848 */
    49 int udp_initialize(async_client_conn_t client_connection);
     49extern int udp_initialize(async_client_conn_t client_connection);
    5050
    5151/** Processes the UDP message.
     
    5959 *  @see IS_NET_UDP_MESSAGE()
    6060 */
    61 int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     61extern int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    6262
    6363#endif
Note: See TracChangeset for help on using the changeset viewer.