Changeset 849ed54 in mainline for uspace/srv/net/tl


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

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

Location:
uspace/srv/net/tl
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • 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.