Changeset 849ed54 in mainline for uspace/srv/net/tl/icmp
- 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/icmp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tl/icmp/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 = icmp 33 34 34 35 SOURCES = \ 35 36 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 48 38 49 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/srv/net/tl/icmp/icmp.c
r7d6fe4db r849ed54 42 42 #include <stdint.h> 43 43 #include <str.h> 44 45 44 #include <ipc/ipc.h> 46 45 #include <ipc/services.h> 47 48 46 #include <sys/time.h> 49 47 #include <sys/types.h> 50 48 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> 74 71 75 72 #include "icmp.h" 76 #include "icmp_header.h"77 #include "icmp_messages.h"78 73 #include "icmp_module.h" 74 75 /** ICMP module name. 76 */ 77 #define NAME "ICMP protocol" 79 78 80 79 /** Default ICMP error reporting. … … 820 819 } 821 820 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 */ 831 static 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 */ 871 int 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 822 889 /** @} 823 890 */ -
uspace/srv/net/tl/icmp/icmp.h
r7d6fe4db r849ed54 40 40 #include <fibril_synch.h> 41 41 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> 47 45 48 46 /** Type definition of the ICMP reply data. -
uspace/srv/net/tl/icmp/icmp_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 "icmp.h" 54 52 #include "icmp_module.h" 55 53 56 /** ICMP module name.54 /** ICMP module global data. 57 55 */ 58 #define NAME "ICMP protocol" 59 60 /** Prints the module name. 61 * @see NAME 62 */ 63 void module_print_name(void); 56 extern icmp_globals_t icmp_globals; 64 57 65 58 /** Starts the ICMP 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 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){ 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 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 */ 96 int tl_module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 116 97 return icmp_message(callid, call, answer, answer_count); 117 98 }
Note:
See TracChangeset
for help on using the changeset viewer.