Changeset 10056483 in mainline
- Timestamp:
- 2010-10-13T22:48:25Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef689ef0
- Parents:
- b278b4e (diff), 753bca3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 2 added
- 2 deleted
- 25 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/netecho/print_error.c
rb278b4e r10056483 38 38 #include <errno.h> 39 39 40 #include < icmp_codes.h>40 #include <net/icmp_codes.h> 41 41 42 42 #include "print_error.h" -
uspace/app/ping/ping.c
rb278b4e r10056483 45 45 #include <arg_parse.h> 46 46 47 #include < icmp_api.h>47 #include <net/icmp_api.h> 48 48 #include <net/in.h> 49 49 #include <net/in6.h> 50 50 #include <net/inet.h> 51 51 #include <net/socket_parse.h> 52 #include < ip_codes.h>52 #include <net/ip_codes.h> 53 53 54 54 #include "print_error.h" -
uspace/lib/c/Makefile
rb278b4e r10056483 100 100 generic/vfs/canonify.c \ 101 101 generic/net/inet.c \ 102 generic/net/icmp_common.c \ 103 generic/net/icmp_api.c \ 102 104 generic/net/modules.c \ 103 105 generic/net/packet.c \ -
uspace/lib/c/generic/net/icmp_common.c
rb278b4e r10056483 27 27 */ 28 28 29 /** @addtogroup icmp29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 35 * 34 * ICMP common interface implementation. 35 * @see icmp_common.h 36 36 */ 37 37 38 #include <net/modules.h> 39 #include <net/icmp_common.h> 40 41 #include <ipc/services.h> 42 #include <ipc/icmp.h> 43 44 #include <sys/time.h> 38 45 #include <async.h> 39 #include <ipc/services.h>40 46 41 #include <net/modules.h> 42 #include <icmp_common.h> 43 #include <icmp_messages.h> 44 45 int icmp_connect_module(services_t service, suseconds_t timeout){ 47 /** Connects to the ICMP module. 48 * 49 * @param service The ICMP module service. Ignored parameter. 50 * @param[in] timeout The connection timeout in microseconds. No timeout if 51 * set to zero. 52 * @returns The ICMP module phone on success. 53 * @returns ETIMEOUT if the connection timeouted. 54 */ 55 int icmp_connect_module(services_t service, suseconds_t timeout) 56 { 46 57 int phone; 47 58 48 59 phone = connect_to_service_timeout(SERVICE_ICMP, timeout); 49 if (phone >= 0){60 if (phone >= 0) 50 61 async_req_0_0(phone, NET_ICMP_INIT); 51 } 62 52 63 return phone; 53 64 } -
uspace/lib/c/include/ipc/icmp.h
rb278b4e r10056483 27 27 */ 28 28 29 /** @addtogroup icmp30 * 29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 35 * 34 * ICMP module messages. 35 * @see icmp_interface.h 36 36 */ 37 37 38 #ifndef __NET_ICMP_MESSAGES__39 #define __NET_ICMP_MESSAGES__38 #ifndef LIBC_ICMP_MESSAGES_ 39 #define LIBC_ICMP_MESSAGES_ 40 40 41 41 #include <ipc/ipc.h> 42 42 #include <ipc/net.h> 43 43 #include <sys/types.h> 44 #include <sys/time.h> 44 45 45 #include < icmp_codes.h>46 #include <net/icmp_codes.h> 46 47 47 /** ICMP module messages. 48 */ 49 typedef enum{ 50 /** Sends echo request. 51 * @see icmp_echo() 52 */ 48 /** ICMP module messages. */ 49 typedef enum { 50 /** Sends echo request. @see icmp_echo() */ 53 51 NET_ICMP_ECHO = NET_ICMP_FIRST, 54 /** Sends destination unreachable error message. 55 * @see icmp_destination_unreachable_msg() 52 53 /** 54 * Sends destination unreachable error message. 55 * @see icmp_destination_unreachable_msg() 56 56 */ 57 57 NET_ICMP_DEST_UNREACH, 58 /** Sends source quench error message. 59 * @see icmp_source_quench_msg() 58 59 /** 60 * Sends source quench error message. 61 * @see icmp_source_quench_msg() 60 62 */ 61 63 NET_ICMP_SOURCE_QUENCH, 62 /** Sends time exceeded error message. 63 * @see icmp_time_exceeded_msg() 64 65 /** 66 * Sends time exceeded error message. 67 * @see icmp_time_exceeded_msg() 64 68 */ 65 69 NET_ICMP_TIME_EXCEEDED, 66 /** Sends parameter problem error message. 67 * @see icmp_parameter_problem_msg() 70 71 /** 72 * Sends parameter problem error message. 73 * @see icmp_parameter_problem_msg() 68 74 */ 69 75 NET_ICMP_PARAMETERPROB, 70 /** Initializes new connection.71 */76 77 /** Initializes new connection. */ 72 78 NET_ICMP_INIT 73 79 } icmp_messages; 74 80 75 /** @name ICMP specific message parameters definitions 76 */ 81 /** @name ICMP specific message parameters definitions */ 77 82 /*@{*/ 78 83 79 84 /** Returns the ICMP code message parameter. 80 * @param[in] call The message call structure. 85 * 86 * @param[in] call The message call structure. 81 87 */ 82 88 #define ICMP_GET_CODE(call) \ 83 ({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;}) 89 ({ \ 90 icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \ 91 code; \ 92 }) 84 93 85 94 /** Returns the ICMP link MTU message parameter. 86 * @param[in] call The message call structure. 95 * 96 * @param[in] call The message call structure. 87 97 */ 88 98 #define ICMP_GET_MTU(call) \ 89 ({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;}) 99 ({ \ 100 icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \ 101 mtu; \ 102 }) 90 103 91 104 /** Returns the pointer message parameter. 92 * @param[in] call The message call structure. 105 * 106 * @param[in] call The message call structure. 93 107 */ 94 108 #define ICMP_GET_POINTER(call) \ 95 ({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;}) 109 ({ \ 110 icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \ 111 pointer; \ 112 }) 96 113 97 114 /** Returns the size message parameter. 98 * @param[in] call The message call structure. 115 * 116 * @param[in] call The message call structure. 99 117 */ 100 118 #define ICMP_GET_SIZE(call) \ 101 ({size_t size = (size_t) IPC_GET_ARG1(call); size;}) 119 ({ \ 120 size_t size = (size_t) IPC_GET_ARG1(call); \ 121 size; \ 122 }) 102 123 103 124 /** Returns the timeout message parameter. 104 * @param[in] call The message call structure. 125 * 126 * @param[in] call The message call structure. 105 127 */ 106 128 #define ICMP_GET_TIMEOUT(call) \ 107 (({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;})) 129 ({ \ 130 suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \ 131 timeout; \ 132 }) 108 133 109 134 /** Returns the time to live message parameter. 110 * @param[in] call The message call structure. 135 * 136 * @param[in] call The message call structure. 111 137 */ 112 138 #define ICMP_GET_TTL(call) \ 113 ({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;}) 139 ({ \ 140 ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \ 141 ttl; \ 142 }) 114 143 115 144 /** Returns the type of service message parameter. 116 * @param[in] call The message call structure. 145 * 146 * @param[in] call The message call structure. 117 147 */ 118 148 #define ICMP_GET_TOS(call) \ 119 ({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;}) 149 ({ \ 150 ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \ 151 tos; \ 152 }) 120 153 121 154 /** Returns the dont fragment message parameter. 122 * @param[in] call The message call structure. 155 * 156 * @param[in] call The message call structure. 123 157 */ 124 158 #define ICMP_GET_DONT_FRAGMENT(call) \ 125 ({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;}) 159 ({ \ 160 int dont_fragment = (int) IPC_GET_ARG5(call); \ 161 dont_fragment; \ 162 }) 126 163 127 164 /*@}*/ -
uspace/lib/c/include/net/icmp_api.h
rb278b4e r10056483 27 27 */ 28 28 29 /** @addtogroup icmp30 * 29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP application interface implementation. 35 * @see icmp_api.h 34 * ICMP module application interface. 36 35 */ 36 37 #ifndef LIBC_ICMP_API_H_ 38 #define LIBC_ICMP_API_H_ 37 39 38 40 #include <net/socket_codes.h> 39 41 #include <net/inet.h> 40 #include <async.h> 42 #include <sys/types.h> 43 #include <sys/time.h> 41 44 42 #include <ipc/ipc.h> 43 #include <ipc/services.h> 45 #include <adt/measured_strings.h> 46 #include <net/packet.h> 47 #include <net/ip_codes.h> 48 #include <net/icmp_codes.h> 49 #include <net/icmp_common.h> 44 50 45 #include <sys/types.h> 51 /** @name ICMP module application interface 52 * This interface is used by other application modules. 53 */ 54 /*@{*/ 46 55 47 #include <net/modules.h> 48 #include <icmp_api.h> 49 #include <ip_codes.h> 50 #include <icmp_messages.h> 56 extern int icmp_echo_msg(int, size_t, mseconds_t, ip_ttl_t, ip_tos_t, int, 57 const struct sockaddr *, socklen_t); 51 58 52 int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen){ 53 aid_t message_id; 54 ipcarg_t result; 59 /*@}*/ 55 60 56 if(addrlen <= 0){ 57 return EINVAL; 58 } 59 message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, (ipcarg_t) dont_fragment, NULL); 60 // send the address 61 async_data_write_start(icmp_phone, addr, (size_t) addrlen); 62 // timeout version may cause inconsistency - there is also an inner timer 63 // return async_wait_timeout(message_id, &result, timeout); 64 async_wait_for(message_id, &result); 65 return (int) result; 66 } 61 #endif 67 62 68 63 /** @} -
uspace/lib/c/include/net/icmp_codes.h
rb278b4e r10056483 27 27 */ 28 28 29 /** @addtogroup icmp29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP types and codes according to the on-line IANA - ICMP Type Numbers - <http://http://www.iana.org/assignments/icmp-parameters>, cited September 14 2009. 35 */ 36 37 #ifndef __NET_ICMP_CODES_H__ 38 #define __NET_ICMP_CODES_H__ 39 40 /** ICMP type type definition. 41 */ 42 typedef uint8_t icmp_type_t; 43 44 /** ICMP code type definition. 45 */ 46 typedef uint8_t icmp_code_t; 47 48 /** ICMP parameter type definition. 49 */ 50 typedef uint16_t icmp_param_t; 51 52 /** @name ICMP types definitions 53 */ 54 /*@{*/ 55 56 /** Echo Reply. 57 */ 34 * ICMP types and codes according to the on-line IANA - ICMP Type Numbers 35 * 36 * http://www.iana.org/assignments/icmp-parameters> 37 * 38 * cited September 14 2009. 39 */ 40 41 #ifndef LIBC_ICMP_CODES_H_ 42 #define LIBC_ICMP_CODES_H_ 43 44 /** ICMP type type definition. */ 45 typedef uint8_t icmp_type_t; 46 47 /** ICMP code type definition. */ 48 typedef uint8_t icmp_code_t; 49 50 /** ICMP parameter type definition. */ 51 typedef uint16_t icmp_param_t; 52 53 /** @name ICMP types definitions */ 54 /*@{*/ 55 56 /** Echo Reply. */ 58 57 #define ICMP_ECHOREPLY 0 59 58 60 /** Destination Unreachable. 61 */ 59 /** Destination Unreachable. */ 62 60 #define ICMP_DEST_UNREACH 3 63 61 64 /** Source Quench. 65 */ 62 /** Source Quench. */ 66 63 #define ICMP_SOURCE_QUENCH 4 67 64 68 /** Redirect. 69 */ 65 /** Redirect. */ 70 66 #define ICMP_REDIRECT 5 71 67 72 /** Alternate Host Address. 73 */ 68 /** Alternate Host Address. */ 74 69 #define ICMP_ALTERNATE_ADDR 6 75 70 76 /** Echo Request. 77 */ 78 #define ICMP_ECHO 8 79 80 /** Router Advertisement. 81 */ 71 /** Echo Request. */ 72 #define ICMP_ECHO 8 73 74 /** Router Advertisement. */ 82 75 #define ICMP_ROUTER_ADV 9 83 76 84 /** Router solicitation. 85 */ 77 /** Router solicitation. */ 86 78 #define ICMP_ROUTER_SOL 10 87 79 88 /** Time Exceeded. 89 */ 80 /** Time Exceeded. */ 90 81 #define ICMP_TIME_EXCEEDED 11 91 82 92 /** Parameter Problem. 93 */ 83 /** Parameter Problem. */ 94 84 #define ICMP_PARAMETERPROB 12 95 85 96 /** Timestamp Request. 97 */ 86 /** Timestamp Request. */ 98 87 #define ICMP_TIMESTAMP 13 99 88 100 /** Timestamp Reply. 101 */ 89 /** Timestamp Reply. */ 102 90 #define ICMP_TIMESTAMPREPLY 14 103 91 104 /** Information Request. 105 */ 92 /** Information Request. */ 106 93 #define ICMP_INFO_REQUEST 15 107 94 108 /** Information Reply. 109 */ 95 /** Information Reply. */ 110 96 #define ICMP_INFO_REPLY 16 111 97 112 /** Address Mask Request. 113 */ 98 /** Address Mask Request. */ 114 99 #define ICMP_ADDRESS 17 115 100 116 /** Address Mask Reply. 117 */ 101 /** Address Mask Reply. */ 118 102 #define ICMP_ADDRESSREPLY 18 119 103 120 /** Traceroute. 121 */ 104 /** Traceroute. */ 122 105 #define ICMP_TRACEROUTE 30 123 106 124 /** Datagram Conversion Error. 125 */ 107 /** Datagram Conversion Error. */ 126 108 #define ICMP_CONVERSION_ERROR 31 127 109 128 /** Mobile Host Redirect. 129 */ 110 /** Mobile Host Redirect. */ 130 111 #define ICMP_REDIRECT_MOBILE 32 131 112 132 /** IPv6 Where-Are-You. 133 */ 113 /** IPv6 Where-Are-You. */ 134 114 #define ICMP_IPV6_WHERE_ARE_YOU 33 135 115 136 /** IPv6 I-Am-Here. 137 */ 116 /** IPv6 I-Am-Here. */ 138 117 #define ICMP_IPV6_I_AM_HERE 34 139 118 140 /** Mobile Registration Request. 141 */ 119 /** Mobile Registration Request. */ 142 120 #define ICMP_MOBILE_REQUEST 35 143 121 144 /** Mobile Registration Reply. 145 */ 122 /** Mobile Registration Reply. */ 146 123 #define ICMP_MOBILE_REPLY 36 147 124 148 /** Domain name request. 149 */ 125 /** Domain name request. */ 150 126 #define ICMP_DN_REQUEST 37 151 127 152 /** Domain name reply. 153 */ 128 /** Domain name reply. */ 154 129 #define ICMP_DN_REPLY 38 155 130 156 /** SKIP. 157 */ 158 #define ICMP_SKIP 39 159 160 /** Photuris. 161 */ 131 /** SKIP. */ 132 #define ICMP_SKIP 39 133 134 /** Photuris. */ 162 135 #define ICMP_PHOTURIS 40 163 136 … … 168 141 /*@{*/ 169 142 170 /** Network Unreachable. 171 */ 143 /** Network Unreachable. */ 172 144 #define ICMP_NET_UNREACH 0 173 145 174 /** Host Unreachable. 175 */ 146 /** Host Unreachable. */ 176 147 #define ICMP_HOST_UNREACH 1 177 148 178 /** Protocol Unreachable. 179 */ 149 /** Protocol Unreachable. */ 180 150 #define ICMP_PROT_UNREACH 2 181 151 182 /** Port Unreachable. 183 */ 152 /** Port Unreachable. */ 184 153 #define ICMP_PORT_UNREACH 3 185 154 186 /** Fragmentation needed but the Do Not Fragment bit was set. 187 */ 155 /** Fragmentation needed but the Do Not Fragment bit was set. */ 188 156 #define ICMP_FRAG_NEEDED 4 189 157 190 /** Source Route failed. 191 */ 158 /** Source Route failed. */ 192 159 #define ICMP_SR_FAILED 5 193 160 194 /** Destination network unknown. 195 */ 161 /** Destination network unknown. */ 196 162 #define ICMP_NET_UNKNOWN 6 197 163 198 /** Destination host unknown. 199 */ 164 /** Destination host unknown. */ 200 165 #define ICMP_HOST_UNKNOWN 7 201 166 202 /** Source host isolated (obsolete). 203 */ 167 /** Source host isolated (obsolete). */ 204 168 #define ICMP_HOST_ISOLATED 8 205 169 206 /** Destination network administratively prohibited. 207 */ 170 /** Destination network administratively prohibited. */ 208 171 #define ICMP_NET_ANO 9 209 172 210 /** Destination host administratively prohibited. 211 */ 173 /** Destination host administratively prohibited. */ 212 174 #define ICMP_HOST_ANO 10 213 175 214 /** Network unreachable for this type of service. 215 */ 176 /** Network unreachable for this type of service. */ 216 177 #define ICMP_NET_UNR_TOS 11 217 178 218 /** Host unreachable for this type of service. 219 */ 179 /** Host unreachable for this type of service. */ 220 180 #define ICMP_HOST_UNR_TOS 12 221 181 222 /** Communication administratively prohibited by filtering. 223 */ 182 /** Communication administratively prohibited by filtering. */ 224 183 #define ICMP_PKT_FILTERED 13 225 184 226 /** Host precedence violation. 227 */ 185 /** Host precedence violation. */ 228 186 #define ICMP_PREC_VIOLATION 14 229 187 230 /** Precedence cutoff in effect. 231 */ 188 /** Precedence cutoff in effect. */ 232 189 #define ICMP_PREC_CUTOFF 15 233 190 234 191 /*@}*/ 235 192 236 /** @name ICMP_REDIRECT codes definitions 237 */ 238 /*@{*/ 239 240 /** Network redirect (or subnet). 241 */ 193 /** @name ICMP_REDIRECT codes definitions */ 194 /*@{*/ 195 196 /** Network redirect (or subnet). */ 242 197 #define ICMP_REDIR_NET 0 243 198 244 /** Host redirect. 245 */ 199 /** Host redirect. */ 246 200 #define ICMP_REDIR_HOST 1 247 201 248 /** Network redirect for this type of service. 249 */ 202 /** Network redirect for this type of service. */ 250 203 #define ICMP_REDIR_NETTOS 2 251 204 252 /** Host redirect for this type of service. 253 */ 205 /** Host redirect for this type of service. */ 254 206 #define ICMP_REDIR_HOSTTOS 3 255 207 256 208 /*@}*/ 257 209 258 /** @name ICMP_ALTERNATE_ADDRESS codes definitions 259 */ 260 /*@{*/ 261 262 /** Alternate address for host. 263 */ 210 /** @name ICMP_ALTERNATE_ADDRESS codes definitions */ 211 /*@{*/ 212 213 /** Alternate address for host. */ 264 214 #define ICMP_ALTERNATE_HOST 0 265 215 266 216 /*@}*/ 267 217 268 /** @name ICMP_ROUTER_ADV codes definitions 269 */ 270 /*@{*/ 271 272 /** Normal router advertisement. 273 */ 218 /** @name ICMP_ROUTER_ADV codes definitions */ 219 /*@{*/ 220 221 /** Normal router advertisement. */ 274 222 #define ICMP_ROUTER_NORMAL 0 275 223 276 /** Does not route common traffic. 277 */ 224 /** Does not route common traffic. */ 278 225 #define ICMP_ROUTER_NO_NORMAL_TRAFFIC 16 279 226 280 227 /*@}*/ 281 228 282 /** @name ICMP_TIME_EXCEEDED codes definitions 283 */ 284 /*@{*/ 285 286 /** Transit TTL exceeded. 287 */ 229 /** @name ICMP_TIME_EXCEEDED codes definitions */ 230 /*@{*/ 231 232 /** Transit TTL exceeded. */ 288 233 #define ICMP_EXC_TTL 0 289 234 290 /** Reassembly TTL exceeded. 291 */ 235 /** Reassembly TTL exceeded. */ 292 236 #define ICMP_EXC_FRAGTIME 1 293 237 294 238 /*@}*/ 295 239 296 /** @name ICMP_PARAMETERPROB codes definitions 297 */ 298 /*@{*/ 299 300 /** Pointer indicates the error. 301 */ 240 /** @name ICMP_PARAMETERPROB codes definitions */ 241 /*@{*/ 242 243 /** Pointer indicates the error. */ 302 244 #define ICMP_PARAM_POINTER 0 303 245 304 /** Missing required option. 305 */ 246 /** Missing required option. */ 306 247 #define ICMP_PARAM_MISSING 1 307 248 308 /** Bad length. 309 */ 249 /** Bad length. */ 310 250 #define ICMP_PARAM_LENGTH 2 311 251 312 252 /*@}*/ 313 253 314 /** @name ICMP_PHOTURIS codes definitions 315 */ 316 /*@{*/ 317 318 /** Bad SPI. 319 */ 320 #define ICMP_PHOTURIS_BAD_SPI 0 321 322 /** Authentication failed. 323 */ 324 #define ICMP_PHOTURIS_AUTHENTICATION 1 325 326 /** Decompression failed. 327 */ 254 /** @name ICMP_PHOTURIS codes definitions */ 255 /*@{*/ 256 257 /** Bad SPI. */ 258 #define ICMP_PHOTURIS_BAD_SPI 0 259 260 /** Authentication failed. */ 261 #define ICMP_PHOTURIS_AUTHENTICATION 1 262 263 /** Decompression failed. */ 328 264 #define ICMP_PHOTURIS_DECOMPRESSION 2 329 265 330 /** Decryption failed. 331 */ 332 #define ICMP_PHOTURIS_DECRYPTION 3 333 334 /** Need authentication. 335 */ 266 /** Decryption failed. */ 267 #define ICMP_PHOTURIS_DECRYPTION 3 268 269 /** Need authentication. */ 336 270 #define ICMP_PHOTURIS_NEED_AUTHENTICATION 4 337 271 338 /** Need authorization. 339 */ 272 /** Need authorization. */ 340 273 #define ICMP_PHOTURIS_NEED_AUTHORIZATION 5 341 274 -
uspace/lib/c/include/net/icmp_common.h
rb278b4e r10056483 27 27 */ 28 28 29 /** @addtogroup icmp29 /** @addtogroup libc 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * 34 * ICMP module common interface. 35 35 */ 36 36 37 #ifndef __NET_ICMP_COMMON_H__38 #define __NET_ICMP_COMMON_H__37 #ifndef LIBC_ICMP_COMMON_H_ 38 #define LIBC_ICMP_COMMON_H_ 39 39 40 40 #include <ipc/services.h> 41 42 41 #include <sys/time.h> 43 42 44 /** Default timeout for incoming connections in microseconds. 45 */ 43 /** Default timeout for incoming connections in microseconds. */ 46 44 #define ICMP_CONNECT_TIMEOUT (1 * 1000 * 1000) 47 45 48 /** Connects to the ICMP module. 49 * @param service The ICMP module service. Ignored parameter. 50 * @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0). 51 * @returns The ICMP module phone on success. 52 * @returns ETIMEOUT if the connection timeouted. 53 */ 54 extern int icmp_connect_module(services_t service, suseconds_t timeout); 46 extern int icmp_connect_module(services_t, suseconds_t); 55 47 56 48 #endif -
uspace/lib/c/include/sys/time.h
rb278b4e r10056483 43 43 typedef long suseconds_t; 44 44 45 typedef uint32_t useconds_t; 46 typedef uint32_t mseconds_t; 47 45 48 struct timeval { 46 49 time_t tv_sec; /* seconds */ -
uspace/lib/c/include/unistd.h
rb278b4e r10056483 37 37 38 38 #include <sys/types.h> 39 #include <time.h> 39 40 #include <libarch/config.h> 40 41 … … 56 57 #define SEEK_END 2 57 58 #endif 58 59 typedef uint32_t useconds_t;60 59 61 60 extern int dup2(int oldfd, int newfd); -
uspace/lib/net/il/ip_remote.c
rb278b4e r10056483 72 72 73 73 int ip_bind_service(services_t service, int protocol, services_t me, 74 async_client_conn_t receiver , tl_received_msg_t tl_received_msg)74 async_client_conn_t receiver) 75 75 { 76 76 return (int) bind_service(service, (ipcarg_t) protocol, me, service, -
uspace/lib/net/include/icmp_client.h
rb278b4e r10056483 38 38 #define __NET_ICMP_CLIENT_H__ 39 39 40 #include < icmp_codes.h>40 #include <net/icmp_codes.h> 41 41 #include <net/packet.h> 42 42 -
uspace/lib/net/include/icmp_header.h
rb278b4e r10056483 42 42 43 43 #include <net/in.h> 44 #include < icmp_codes.h>44 #include <net/icmp_codes.h> 45 45 46 46 /** ICMP header size in bytes. -
uspace/lib/net/include/icmp_interface.h
rb278b4e r10056483 41 41 #include <net/packet.h> 42 42 #include <net/inet.h> 43 #include < ip_codes.h>44 #include < icmp_codes.h>45 #include < icmp_common.h>43 #include <net/ip_codes.h> 44 #include <net/icmp_codes.h> 45 #include <net/icmp_common.h> 46 46 47 47 /** @name ICMP module interface -
uspace/lib/net/include/ip_client.h
rb278b4e r10056483 42 42 43 43 #include <net/packet.h> 44 #include < ip_codes.h>44 #include <net/ip_codes.h> 45 45 #include <ip_interface.h> 46 46 -
uspace/lib/net/include/ip_interface.h
rb278b4e r10056483 42 42 43 43 #include <net/in.h> 44 #include < ip_codes.h>44 #include <net/ip_codes.h> 45 45 46 46 #include <ip_remote.h> … … 74 74 * @param[in] me The requesting module service. 75 75 * @param[in] receiver The message receiver. Used for remote connection. 76 * @param[in] tl_received_msg The message processing function. Used if bundled together.77 76 * @returns The phone of the needed service. 78 77 * @returns EOK on success. 79 78 * @returns Other error codes as defined for the bind_service() function. 80 79 */ 81 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver , tl_received_msg_t tl_received_msg);80 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver); 82 81 83 82 /** Connects to the IP module. -
uspace/lib/net/include/ip_local.h
rb278b4e r10056483 37 37 #include <ipc/services.h> 38 38 39 #include < ip_codes.h>39 #include <net/ip_codes.h> 40 40 #include <net/inet.h> 41 41 #include <net/in.h> -
uspace/lib/net/include/ip_messages.h
rb278b4e r10056483 43 43 44 44 #include <net/in.h> 45 #include < ip_codes.h>45 #include <net/ip_codes.h> 46 46 47 47 /** IP module messages. -
uspace/lib/net/include/ip_remote.h
rb278b4e r10056483 37 37 #include <ipc/services.h> 38 38 39 #include < ip_codes.h>39 #include <net/ip_codes.h> 40 40 #include <net/inet.h> 41 41 #include <net/in.h> -
uspace/lib/net/netif/netif_local.c
rb278b4e r10056483 228 228 229 229 return ERROR_CODE; 230 }231 232 /** Create bidirectional connection with the network interface module and registers the message receiver.233 *234 * @param[in] service The network interface module service.235 * @param[in] device_id The device identifier.236 * @param[in] me The requesting module service.237 * @param[in] receiver The message receiver.238 *239 * @return The phone of the needed service.240 * @return EOK on success.241 * @return Other error codes as defined for the bind_service() function.242 *243 */244 int netif_bind_service_local(services_t service, device_id_t device_id,245 services_t me, async_client_conn_t receiver)246 {247 return EOK;248 230 } 249 231 -
uspace/lib/net/netif/netif_remote.c
rb278b4e r10056483 91 91 } 92 92 93 /** Create bidirectional connection with the network interface module and 94 * registers the message receiver. 95 * 96 * @param[in] service The network interface module service. 97 * @param[in] device_id The device identifier. 98 * @param[in] me The requesting module service. 99 * @param[in] receiver The message receiver. 100 * 101 * @return The phone of the needed service. 102 * @return EOK on success. 103 * @return Other error codes as defined for the bind_service() function. 104 * 105 */ 93 106 int netif_bind_service_remote(services_t service, device_id_t device_id, services_t me, 94 107 async_client_conn_t receiver) -
uspace/lib/net/tl/icmp_client.c
rb278b4e r10056483 43 43 #include <sys/types.h> 44 44 45 #include < icmp_codes.h>45 #include <net/icmp_codes.h> 46 46 #include <icmp_client.h> 47 47 #include <net/packet.h> -
uspace/lib/net/tl/icmp_remote.c
rb278b4e r10056483 40 40 #include <ipc/ipc.h> 41 41 #include <ipc/services.h> 42 #include <ipc/icmp.h> 42 43 #include <sys/types.h> 43 44 … … 46 47 #include <icmp_interface.h> 47 48 #include <packet_client.h> 48 #include <icmp_messages.h>49 49 50 50 int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet){ -
uspace/lib/socket/Makefile
rb278b4e r10056483 33 33 34 34 SOURCES = \ 35 generic/icmp_common.c \36 generic/icmp_api.c \37 35 packet/packet_server.c 38 36 -
uspace/srv/net/il/arp/arp.c
rb278b4e r10056483 227 227 printf("Device %d cleared\n", device_id); 228 228 fibril_rwlock_write_unlock(&arp_globals.lock); 229 return EOK;230 }231 232 int arp_connect_module(services_t service){233 if(service != SERVICE_ARP){234 return EINVAL;235 }236 229 return EOK; 237 230 } … … 603 596 nil_send_msg(device->phone, device_id, packet, SERVICE_ARP); 604 597 return NULL; 605 }606 607 int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data){608 measured_string_ref tmp;609 610 fibril_rwlock_read_lock(&arp_globals.lock);611 tmp = arp_translate_message(device_id, protocol, address);612 if(tmp){613 *translation = measured_string_copy(tmp);614 fibril_rwlock_read_unlock(&arp_globals.lock);615 if(*translation){616 *data = (** translation).value;617 return EOK;618 }else{619 return ENOMEM;620 }621 }else{622 fibril_rwlock_read_unlock(&arp_globals.lock);623 return ENOENT;624 }625 598 } 626 599 -
uspace/srv/net/il/ip/ip.c
rb278b4e r10056483 58 58 #include <net_device.h> 59 59 #include <icmp_client.h> 60 #include < icmp_codes.h>60 #include <net/icmp_codes.h> 61 61 #include <icmp_interface.h> 62 62 #include <il_interface.h> … … 618 618 printf("%s: Device %d changed state to %d\n", NAME, device_id, state); 619 619 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); 620 return EOK;621 }622 623 int ip_connect_module(services_t service){624 620 return EOK; 625 621 } -
uspace/srv/net/tl/icmp/icmp.c
rb278b4e r10056483 44 44 #include <ipc/ipc.h> 45 45 #include <ipc/services.h> 46 #include <ipc/icmp.h> 46 47 #include <sys/time.h> 47 48 #include <sys/types.h> … … 59 60 #include <packet_remote.h> 60 61 #include <net_checksum.h> 61 #include < icmp_api.h>62 #include <net/icmp_api.h> 62 63 #include <icmp_client.h> 63 #include < icmp_codes.h>64 #include < icmp_common.h>64 #include <net/icmp_codes.h> 65 #include <net/icmp_common.h> 65 66 #include <icmp_interface.h> 66 67 #include <il_interface.h> … … 71 72 #include <tl_interface.h> 72 73 #include <tl_local.h> 73 #include <icmp_messages.h>74 74 #include <icmp_header.h> 75 75 … … 449 449 } 450 450 451 int icmp_connect_module(services_t service, suseconds_t timeout){452 icmp_echo_ref echo_data;453 icmp_param_t id;454 int index;455 456 echo_data = (icmp_echo_ref) malloc(sizeof(*echo_data));457 if(! echo_data){458 return ENOMEM;459 }460 // assign a new identifier461 fibril_rwlock_write_lock(&icmp_globals.lock);462 index = icmp_bind_free_id(echo_data);463 if(index < 0){464 free(echo_data);465 fibril_rwlock_write_unlock(&icmp_globals.lock);466 return index;467 }else{468 id = echo_data->identifier;469 fibril_rwlock_write_unlock(&icmp_globals.lock);470 // return the echo data identifier as the ICMP phone471 return id;472 }473 }474 475 451 int icmp_initialize(async_client_conn_t client_connection){ 476 452 ERROR_DECLARE; … … 485 461 icmp_replies_initialize(&icmp_globals.replies); 486 462 icmp_echo_data_initialize(&icmp_globals.echo_data); 487 icmp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection , icmp_received_msg);463 icmp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_ICMP, SERVICE_ICMP, client_connection); 488 464 if(icmp_globals.ip_phone < 0){ 489 465 return icmp_globals.ip_phone; -
uspace/srv/net/tl/icmp/icmp.h
rb278b4e r10056483 40 40 #include <fibril_synch.h> 41 41 42 #include < icmp_codes.h>42 #include <net/icmp_codes.h> 43 43 #include <adt/int_map.h> 44 44 #include <icmp_header.h> … … 67 67 68 68 /** Echo specific data map. 69 * The bundle module gets an identifier of the assigned echo specific data while connecting.70 69 * The identifier is used in the future semi-remote calls instead of the ICMP phone. 71 70 */ -
uspace/srv/net/tl/tcp/tcp.c
rb278b4e r10056483 260 260 ICMP_CONNECT_TIMEOUT); 261 261 tcp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_TCP, 262 SERVICE_TCP, client_connection , tcp_received_msg);262 SERVICE_TCP, client_connection); 263 263 if (tcp_globals.ip_phone < 0) 264 264 return tcp_globals.ip_phone; -
uspace/srv/net/tl/udp/udp.c
rb278b4e r10056483 241 241 ICMP_CONNECT_TIMEOUT); 242 242 udp_globals.ip_phone = ip_bind_service(SERVICE_IP, IPPROTO_UDP, 243 SERVICE_UDP, client_connection , udp_received_msg);243 SERVICE_UDP, client_connection); 244 244 if (udp_globals.ip_phone < 0) 245 245 return udp_globals.ip_phone;
Note:
See TracChangeset
for help on using the changeset viewer.