Changeset 849ed54 in mainline for uspace/srv/net/tl/tcp
- Timestamp:
- 2010-03-30T18:39:04Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7553689
- Parents:
- 7d6fe4db
- Location:
- uspace/srv/net/tl/tcp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/tcp/Makefile
r7d6fe4db r849ed54 28 28 # 29 29 30 NET_BASE = ../..31 30 USPACE_PREFIX = ../../../.. 31 LIBS = $(LIBNET_PREFIX)/libnet.a $(LIBSOCKET_PREFIX)/libsocket.a 32 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include -I$(LIBSOCKET_PREFIX)/include 32 33 BINARY = tcp 33 34 34 35 SOURCES = \ 35 36 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 54 38 55 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/net/tl/tcp/tcp.c
r7d6fe4db r849ed54 46 46 #include <ipc/services.h> 47 47 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> 74 70 75 71 #include "tcp.h" 76 72 #include "tcp_header.h" 77 73 #include "tcp_module.h" 74 75 /** TCP module name. 76 */ 77 #define NAME "TCP protocol" 78 78 79 79 /** The TCP window default value. … … 1997 1997 } 1998 1998 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 */ 2009 static 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 */ 2049 int 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 1999 2067 /** @} 2000 2068 */ -
uspace/srv/net/tl/tcp/tcp.h
r7d6fe4db r849ed54 40 40 #include <fibril_synch.h> 41 41 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> 49 46 50 47 /** Type definition of the TCP global data. -
uspace/srv/net/tl/tcp/tcp_module.c
r7d6fe4db r849ed54 40 40 #include <async.h> 41 41 #include <stdio.h> 42 43 42 #include <ipc/ipc.h> 44 43 #include <ipc/services.h> 45 44 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> 54 52 55 53 #include "tcp.h" 56 54 #include "tcp_module.h" 57 55 58 /** TCP module name.56 /** TCP module global data. 59 57 */ 60 #define NAME "TCP protocol" 61 62 /** Prints the module name. 63 * @see NAME 64 */ 65 void module_print_name(void); 58 extern tcp_globals_t tcp_globals; 66 59 67 60 /** Starts the TCP module. … … 72 65 * @returns Other error codes as defined for the REGISTER_ME() macro function. 73 66 */ 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){ 67 int tl_module_start(async_client_conn_t client_connection){ 95 68 ERROR_DECLARE; 96 69 … … 112 85 } 113 86 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 */ 95 int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 115 96 return tcp_message(callid, call, answer, answer_count); 116 97 } -
uspace/srv/net/tl/tcp/tcp_module.h
r7d6fe4db r849ed54 47 47 * @returns ENOMEM if there is not enough memory left. 48 48 */ 49 int tcp_initialize(async_client_conn_t client_connection);49 extern int tcp_initialize(async_client_conn_t client_connection); 50 50 51 51 /** Processes the TCP message. … … 59 59 * @see IS_NET_TCP_MESSAGE() 60 60 */ 61 int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);61 extern int tcp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count); 62 62 63 63 #endif
Note:
See TracChangeset
for help on using the changeset viewer.