Changeset 849ed54 in mainline for uspace/srv/net/tl/udp
- Timestamp:
- 2010-03-30T18:39:04Z (16 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/udp
- Files:
-
- 5 edited
-
Makefile (modified) (1 diff)
-
udp.c (modified) (2 diffs)
-
udp.h (modified) (1 diff)
-
udp_module.c (modified) (3 diffs)
-
udp_module.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/udp/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 = udp 33 34 34 35 SOURCES = \ 35 36 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 54 38 55 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/net/tl/udp/udp.c
r7d6fe4db r849ed54 40 40 #include <malloc.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 "../../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> 71 66 72 67 #include "udp.h" 73 68 #include "udp_header.h" 74 69 #include "udp_module.h" 70 71 /** UDP module name. 72 */ 73 #define NAME "UDP protocol" 75 74 76 75 /** Default UDP checksum computing. … … 700 699 } 701 700 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 */ 711 static 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 */ 751 int 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 702 769 /** @} 703 770 */ -
uspace/srv/net/tl/udp/udp.h
r7d6fe4db r849ed54 39 39 40 40 #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> 45 43 46 44 /** Type definition of the UDP global data. -
uspace/srv/net/tl/udp/udp_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" 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> 52 50 53 51 #include "udp.h" 54 52 #include "udp_module.h" 55 53 56 /** UDP module name.54 /** UDP module global data. 57 55 */ 58 #define NAME "UDP protocol" 59 60 /** Prints the module name. 61 * @see NAME 62 */ 63 void module_print_name(void); 56 extern udp_globals_t udp_globals; 64 57 65 58 /** Starts the UDP module. … … 70 63 * @returns Other error codes as defined for the REGISTER_ME() macro function. 71 64 */ 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){ 65 int tl_module_start(async_client_conn_t client_connection){ 93 66 ERROR_DECLARE; 94 67 … … 113 86 } 114 87 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 */ 96 int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 116 97 return udp_message(callid, call, answer, answer_count); 117 98 } -
uspace/srv/net/tl/udp/udp_module.h
r7d6fe4db r849ed54 47 47 * @returns ENOMEM if there is not enough memory left. 48 48 */ 49 int udp_initialize(async_client_conn_t client_connection);49 extern int udp_initialize(async_client_conn_t client_connection); 50 50 51 51 /** Processes the UDP message. … … 59 59 * @see IS_NET_UDP_MESSAGE() 60 60 */ 61 int udp_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);61 extern int udp_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.
