Changes in / [dfda6a1:33dbbd2] in mainline
- Location:
- uspace
- Files:
-
- 1 added
- 4 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/dev_iface.h
rdfda6a1 r33dbbd2 42 42 } dev_inferface_idx_t; 43 43 44 #define DEV_IFACE_ID(idx) 45 #define DEV_IFACE_IDX(id) 44 #define DEV_IFACE_ID(idx) ((idx) + IPC_FIRST_USER_METHOD) 45 #define DEV_IFACE_IDX(id) ((id) - IPC_FIRST_USER_METHOD) 46 46 47 #define DEV_IFACE_COUNT DEV_IFACE_MAX 48 #define DEV_FIRST_CUSTOM_METHOD_IDX DEV_IFACE_MAX 49 #define DEV_FIRST_CUSTOM_METHOD \ 50 DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX) 47 #define DEV_IFACE_COUNT DEV_IFACE_MAX 48 #define DEV_FIRST_CUSTOM_METHOD_IDX DEV_IFACE_MAX 49 #define DEV_FIRST_CUSTOM_METHOD DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX) 51 50 52 51 -
uspace/lib/c/include/net/icmp_codes.h
rdfda6a1 r33dbbd2 42 42 #define LIBC_ICMP_CODES_H_ 43 43 44 #include <sys/types.h>45 46 44 /** ICMP type type definition. */ 47 45 typedef uint8_t icmp_type_t; -
uspace/lib/net/Makefile
rdfda6a1 r33dbbd2 38 38 generic/packet_client.c \ 39 39 generic/packet_remote.c \ 40 generic/ protocol_map.c \40 generic/socket_core.c \ 41 41 adt/module_map.c \ 42 42 netif/netif_local.c \ 43 43 netif/netif_remote.c \ 44 44 nil/nil_remote.c \ 45 il/il_interface.c \46 45 il/ip_remote.c \ 47 46 il/ip_client.c \ … … 49 48 tl/icmp_remote.c \ 50 49 tl/icmp_client.c \ 51 tl/socket_core.c \52 tl/tl_interface.c \53 50 tl/tl_common.c 54 51 -
uspace/lib/net/il/ip_remote.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup ip 30 30 * @{ 31 31 */ … … 72 72 } 73 73 74 /** Creates bidirectional connection with the ip module service and registers75 * the message receiver.76 *77 * @param[in] service The IP module service.78 * @param[in] protocol The transport layer protocol.79 * @param[in] me The requesting module service.80 * @param[in] receiver The message receiver. Used for remote connection.81 * @returns The phone of the needed service.82 * @returns EOK on success.83 * @returns Other error codes as defined for the bind_service()84 * function.85 */86 74 int ip_bind_service(services_t service, int protocol, services_t me, 87 75 async_client_conn_t receiver) … … 91 79 } 92 80 93 /** Connects to the IP module.94 *95 * @param service The IP module service. Ignored parameter.96 * @returns The IP module phone on success.97 */98 81 int ip_connect_module(services_t service) 99 82 { … … 127 110 } 128 111 129 /** Return the device identifier and the IP pseudo header based on the 130 * destination address. 112 /** Return the device identifier and the IP pseudo header based on the destination address. 131 113 * 132 114 * @param[in] ip_phone The IP module phone used for (semi)remote calls. … … 155 137 (ipcarg_t) protocol, &answer); 156 138 157 if ((async_data_write_start(ip_phone, destination, addrlen) == EOK) &&158 (async_data_read_start(ip_phone, headerlen,159 sizeof(*headerlen)) == EOK)&& (*headerlen > 0)) {139 if ((async_data_write_start(ip_phone, destination, addrlen) == EOK) 140 && (async_data_read_start(ip_phone, headerlen, sizeof(*headerlen)) == EOK) 141 && (*headerlen > 0)) { 160 142 *header = malloc(*headerlen); 161 143 if (*header) { 162 if (async_data_read_start(ip_phone, *header, 163 *headerlen) != EOK) 144 if (async_data_read_start(ip_phone, *header, *headerlen) != EOK) 164 145 free(*header); 165 146 } … … 192 173 packet_dimension_ref packet_dimension) 193 174 { 194 return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE, 195 device_id,packet_dimension);175 return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE, device_id, 176 packet_dimension); 196 177 } 197 178 -
uspace/lib/net/include/ethernet_lsap.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup eth 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Link service access point identifiers.34 * Link service access point identifiers. 35 35 */ 36 36 37 #ifndef LIBNET_ETHERNET_LSAP_H_38 #define LIBNET_ETHERNET_LSAP_H_37 #ifndef __NET_ETHERNET_LSAP_H__ 38 #define __NET_ETHERNET_LSAP_H__ 39 39 40 40 #include <sys/types.h> 41 41 42 /** Ethernet LSAP type definition. */ 43 typedef uint8_t eth_lsap_t; 42 /** Ethernet LSAP type definition. 43 */ 44 typedef uint8_t eth_lsap_t; 44 45 45 /** @name Ethernet LSAP values definitions */ 46 /** @name Ethernet LSAP values definitions 47 */ 46 48 /*@{*/ 47 49 48 /** Null LSAP LSAP identifier. */ 50 /** Null LSAP LSAP identifier. 51 */ 49 52 #define ETH_LSAP_NULL 0x00 50 /** ARPANET Internet Protocol (IP) LSAP identifier. */ 53 /** Individual LLC Sublayer Management Function LSAP identifier. 54 */ 55 #define ETH_LSAP_ISLMF 0x02 56 /** Group LLC Sublayer Management Function LSAP identifier. 57 */ 58 #define ETH_LSAP_GSLMI 0x03 59 /** IBM SNA Path Control (individual) LSAP identifier. 60 */ 61 #define ETH_LSAP_ISNA 0x04 62 /** IBM SNA Path Control (group) LSAP identifier. 63 */ 64 #define ETH_LSAP_GSNA 0x05 65 /** ARPANET Internet Protocol (IP) LSAP identifier. 66 */ 51 67 #define ETH_LSAP_IP 0x06 52 /** ARPANET Address Resolution Protocol (ARP) LSAP identifier. */ 68 /** SNA LSAP identifier. 69 */ 70 #define ETH_LSAP_SNA 0x08 71 /** SNA LSAP identifier. 72 */ 73 #define ETH_LSAP_SNA2 0x0C 74 /** PROWAY (IEC955) Network Management &Initialization LSAP identifier. 75 */ 76 #define ETH_LSAP_PROWAY_NMI 0x0E 77 /** Texas Instruments LSAP identifier. 78 */ 79 #define ETH_LSAP_TI 0x18 80 /** IEEE 802.1 Bridge Spanning Tree Protocol LSAP identifier. 81 */ 82 #define ETH_LSAP_BRIDGE 0x42 83 /** EIA RS-511 Manufacturing Message Service LSAP identifier. 84 */ 85 #define ETH_LSAP_EIS 0x4E 86 /** ISO 8208 (X.25 over IEEE 802.2 Type 2 LLC) LSAP identifier. 87 */ 88 #define ETH_LSAP_ISO8208 0x7E 89 /** Xerox Network Systems (XNS) LSAP identifier. 90 */ 91 #define ETH_LSAP_XNS 0x80 92 /** Nestar LSAP identifier. 93 */ 94 #define ETH_LSAP_NESTAR 0x86 95 /** PROWAY (IEC 955) Active Station List Maintenance LSAP identifier. 96 */ 97 #define ETH_LSAP_PROWAY_ASLM 0x8E 98 /** ARPANET Address Resolution Protocol (ARP) LSAP identifier. 99 */ 53 100 #define ETH_LSAP_ARP 0x98 54 /** SubNetwork Access Protocol (SNAP) LSAP identifier. */ 101 /** Banyan VINES LSAP identifier. 102 */ 103 #define ETH_LSAP_VINES 0xBC 104 /** SubNetwork Access Protocol (SNAP) LSAP identifier. 105 */ 55 106 #define ETH_LSAP_SNAP 0xAA 56 /** Global LSAP LSAP identifier. */ 107 /** Novell NetWare LSAP identifier. 108 */ 109 #define ETH_LSAP_NETWARE 0xE0 110 /** IBM NetBIOS LSAP identifier. 111 */ 112 #define ETH_LSAP_NETBIOS 0xF0 113 /** IBM LAN Management (individual) LSAP identifier. 114 */ 115 #define ETH_LSAP_ILAN 0xF4 116 /** IBM LAN Management (group) LSAP identifier. 117 */ 118 #define ETH_LSAP_GLAN 0xF5 119 /** IBM Remote Program Load (RPL) LSAP identifier. 120 */ 121 #define ETH_LSAP_RPL 0xF8 122 /** Ungermann-Bass LSAP identifier. 123 */ 124 #define ETH_LSAP_UB 0xFA 125 /** ISO Network Layer Protocol LSAP identifier. 126 */ 127 #define ETH_LSAP_ISONLP 0xFE 128 /** Global LSAP LSAP identifier. 129 */ 57 130 #define ETH_LSAP_GLSAP 0xFF 58 131 -
uspace/lib/net/include/ethernet_protocols.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup eth 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Ethernet protocol numbers according to the on-line IANA - Ethernet numbers 35 * http://www.iana.org/assignments/ethernet-numbers 36 * cited January 17 2009. 37 */ 38 39 #ifndef LIBNET_ETHERNET_PROTOCOLS_H_ 40 #define LIBNET_ETHERNET_PROTOCOLS_H_ 34 * Ethernet protocol numbers according to the on-line IANA - Ethernet numbers - <http://www.iana.org/assignments/ethernet-numbers>, cited January 17 2009. 35 */ 36 37 #ifndef __NET_ETHERNET_PROTOCOLS_H__ 38 #define __NET_ETHERNET_PROTOCOLS_H__ 41 39 42 40 #include <sys/types.h> 43 41 44 /** Ethernet protocol type definition. */ 45 typedef uint16_t eth_type_t; 46 47 /** @name Ethernet protocols definitions */ 42 /** Ethernet protocol type definition. 43 */ 44 typedef uint16_t eth_type_t; 45 46 /** @name Ethernet protocols definitions 47 */ 48 48 /*@{*/ 49 49 50 50 /** Ethernet minimal protocol number. 51 * According to the IEEE 802.3 specification. 52 */ 53 #define ETH_MIN_PROTO 0x0600 /* 1536 */ 54 55 /** Internet IP (IPv4) ethernet protocol type. */ 51 * According to the IEEE 802.3 specification. 52 */ 53 #define ETH_MIN_PROTO 0x0600 /*1536*/ 54 55 /** Ethernet loopback packet protocol type. 56 */ 57 #define ETH_P_LOOP 0x0060 58 59 /** XEROX PUP (see 0A00) ethernet protocol type. 60 */ 61 #define ETH_P_PUP 0x0200 62 63 /** PUP Addr Trans (see 0A01) ethernet protocol type. 64 */ 65 #define ETH_P_PUPAT 0x0201 66 67 /** Nixdorf ethernet protocol type. 68 */ 69 #define ETH_P_Nixdorf 0x0400 70 71 /** XEROX NS IDP ethernet protocol type. 72 */ 73 #define ETH_P_XEROX_NS_IDP 0x0600 74 75 /** DLOG ethernet protocol type. 76 */ 77 #define ETH_P_DLOG 0x0660 78 79 /** DLOG ethernet protocol type. 80 */ 81 #define ETH_P_DLOG2 0x0661 82 83 /** Internet IP (IPv4) ethernet protocol type. 84 */ 56 85 #define ETH_P_IP 0x0800 57 86 58 /** ARP ethernet protocol type. */ 87 /** X.75 Internet ethernet protocol type. 88 */ 89 #define ETH_P_X_75 0x0801 90 91 /** NBS Internet ethernet protocol type. 92 */ 93 #define ETH_P_NBS 0x0802 94 95 /** ECMA Internet ethernet protocol type. 96 */ 97 #define ETH_P_ECMA 0x0803 98 99 /** Chaosnet ethernet protocol type. 100 */ 101 #define ETH_P_Chaosnet 0x0804 102 103 /** X.25 Level 3 ethernet protocol type. 104 */ 105 #define ETH_P_X25 0x0805 106 107 /** ARP ethernet protocol type. 108 */ 59 109 #define ETH_P_ARP 0x0806 60 110 111 /** XNS Compatability ethernet protocol type. 112 */ 113 #define ETH_P_XNS_Compatability 0x0807 114 115 /** Frame Relay ARP ethernet protocol type. 116 */ 117 #define ETH_P_Frame_Relay_ARP 0x0808 118 119 /** Symbolics Private ethernet protocol type. 120 */ 121 #define ETH_P_Symbolics_Private 0x081C 122 123 /** Xyplex ethernet protocol type. 124 */ 125 #define ETH_P_Xyplex_MIN 0x0888 126 127 /** Xyplex ethernet protocol type. 128 */ 129 #define ETH_P_Xyplex_MAX 0x088A 130 131 /** Ungermann-Bass net debugr ethernet protocol type. 132 */ 133 #define ETH_P_Ungermann_Bass_net_debugr 0x0900 134 135 /** Xerox IEEE802.3 PUP ethernet protocol type. 136 */ 137 #define ETH_P_IEEEPUP 0x0A00 138 139 /** PUP Addr Trans ethernet protocol type. 140 */ 141 #define ETH_P_IEEEPUPAT 0x0A01 142 143 /** Banyan VINES ethernet protocol type. 144 */ 145 #define ETH_P_Banyan_VINES 0x0BAD 146 147 /** VINES Loopback ethernet protocol type. 148 */ 149 #define ETH_P_VINES_Loopback 0x0BAE 150 151 /** VINES Echo ethernet protocol type. 152 */ 153 #define ETH_P_VINES_Echo 0x0BAF 154 155 /** Berkeley Trailer nego ethernet protocol type. 156 */ 157 #define ETH_P_Berkeley_Trailer_nego 0x1000 158 159 /** Berkeley Trailer encap/IP ethernet protocol type. 160 */ 161 #define ETH_P_Berkeley_Trailer_encapIP_MIN 0x1001 162 163 /** Berkeley Trailer encap/IP ethernet protocol type. 164 */ 165 #define ETH_P_Berkeley_Trailer_encapIP_MAX 0x100F 166 167 /** Valid Systems ethernet protocol type. 168 */ 169 #define ETH_P_Valid_Systems 0x1600 170 171 /** PCS Basic Block Protocol ethernet protocol type. 172 */ 173 #define ETH_P_PCS_Basic_Block_Protocol 0x4242 174 175 /** BBN Simnet ethernet protocol type. 176 */ 177 #define ETH_P_BBN_Simnet 0x5208 178 179 /** DEC Unassigned (Exp.) ethernet protocol type. 180 */ 181 #define ETH_P_DEC 0x6000 182 183 /** DEC MOP Dump/Load ethernet protocol type. 184 */ 185 #define ETH_P_DNA_DL 0x6001 186 187 /** DEC MOP Remote Console ethernet protocol type. 188 */ 189 #define ETH_P_DNA_RC 0x6002 190 191 /** DEC DECNET Phase IV Route ethernet protocol type. 192 */ 193 #define ETH_P_DNA_RT 0x6003 194 195 /** DEC LAT ethernet protocol type. 196 */ 197 #define ETH_P_LAT 0x6004 198 199 /** DEC Diagnostic Protocol ethernet protocol type. 200 */ 201 #define ETH_P_DIAG 0x6005 202 203 /** DEC Customer Protocol ethernet protocol type. 204 */ 205 #define ETH_P_CUST 0x6006 206 207 /** DEC LAVC, SCA ethernet protocol type. 208 */ 209 #define ETH_P_SCA 0x6007 210 211 /** DEC Unassigned ethernet protocol type. 212 */ 213 #define ETH_P_DEC_Unassigned_MIN 0x6008 214 215 /** DEC Unassigned ethernet protocol type. 216 */ 217 #define ETH_P_DEC_Unassigned_MAX 0x6009 218 219 /** Com Corporation ethernet protocol type. 220 */ 221 #define ETH_P_Com_Corporation_MIN 0x6010 222 223 /** Com Corporation ethernet protocol type. 224 */ 225 #define ETH_P_Com_Corporation_MAX 0x6014 226 227 /** Trans Ether Bridging ethernet protocol type. 228 */ 229 #define ETH_P_Trans_Ether_Bridging 0x6558 230 231 /** Raw Frame Relay ethernet protocol type. 232 */ 233 #define ETH_P_Raw_Frame_Relay 0x6559 234 235 /** Ungermann-Bass download ethernet protocol type. 236 */ 237 #define ETH_P_Ungermann_Bass_download 0x7000 238 239 /** Ungermann-Bass dia/loop ethernet protocol type. 240 */ 241 #define ETH_P_Ungermann_Bass_dialoop 0x7002 242 243 /** LRT ethernet protocol type. 244 */ 245 #define ETH_P_LRT_MIN 0x7020 246 247 /** LRT ethernet protocol type. 248 */ 249 #define ETH_P_LRT_MAX 0x7029 250 251 /** Proteon ethernet protocol type. 252 */ 253 #define ETH_P_Proteon 0x7030 254 255 /** Cabletron ethernet protocol type. 256 */ 257 #define ETH_P_Cabletron 0x7034 258 259 /** Cronus VLN ethernet protocol type. 260 */ 261 #define ETH_P_Cronus_VLN 0x8003 262 263 /** Cronus Direct ethernet protocol type. 264 */ 265 #define ETH_P_Cronus_Direct 0x8004 266 267 /** HP Probe ethernet protocol type. 268 */ 269 #define ETH_P_HP_Probe 0x8005 270 271 /** Nestar ethernet protocol type. 272 */ 273 #define ETH_P_Nestar 0x8006 274 275 /** AT&T ethernet protocol type. 276 */ 277 #define ETH_P_AT_T 0x8008 278 279 /** Excelan ethernet protocol type. 280 */ 281 #define ETH_P_Excelan 0x8010 282 283 /** SGI diagnostics ethernet protocol type. 284 */ 285 #define ETH_P_SGI_diagnostics 0x8013 286 287 /** SGI network games ethernet protocol type. 288 */ 289 #define ETH_P_SGI_network_games 0x8014 290 291 /** SGI reserved ethernet protocol type. 292 */ 293 #define ETH_P_SGI_reserved 0x8015 294 295 /** SGI bounce server ethernet protocol type. 296 */ 297 #define ETH_P_SGI_bounce_server 0x8016 298 299 /** Apollo Domain ethernet protocol type. 300 */ 301 #define ETH_P_Apollo_Domain 0x8019 302 303 /** Tymshare ethernet protocol type. 304 */ 305 #define ETH_P_Tymshare 0x802E 306 307 /** Tigan, Inc. ethernet protocol type. 308 */ 309 #define ETH_P_Tigan 0x802F 310 311 /** Reverse ARP ethernet protocol type. 312 */ 313 #define ETH_P_RARP 0x8035 314 315 /** Aeonic Systems ethernet protocol type. 316 */ 317 #define ETH_P_Aeonic_Systems 0x8036 318 319 /** DEC LANBridge ethernet protocol type. 320 */ 321 #define ETH_P_DEC_LANBridge 0x8038 322 323 /** DEC Unassigned ethernet protocol type. 324 */ 325 #define ETH_P_DEC_Unassigned_MIN1 0x8039 326 327 /** DEC Unassigned ethernet protocol type. 328 */ 329 #define ETH_P_DEC_Unassigned_MAX2 0x803C 330 331 /** DEC Ethernet Encryption ethernet protocol type. 332 */ 333 #define ETH_P_DEC_Ethernet_Encryption 0x803D 334 335 /** DEC Unassigned ethernet protocol type. 336 */ 337 #define ETH_P_DEC_Unassigned 0x803E 338 339 /** DEC LAN Traffic Monitor ethernet protocol type. 340 */ 341 #define ETH_P_DEC_LAN_Traffic_Monitor 0x803F 342 343 /** DEC Unassigned ethernet protocol type. 344 */ 345 #define ETH_P_DEC_Unassigned_MIN3 0x8040 346 347 /** DEC Unassigned ethernet protocol type. 348 */ 349 #define ETH_P_DEC_Unassigned_MAX3 0x8042 350 351 /** Planning Research Corp. ethernet protocol type. 352 */ 353 #define ETH_P_Planning_Research_Corp 0x8044 354 355 /** AT&T ethernet protocol type. 356 */ 357 #define ETH_P_AT_T2 0x8046 358 359 /** AT&T ethernet protocol type. 360 */ 361 #define ETH_P_AT_T3 0x8047 362 363 /** ExperData ethernet protocol type. 364 */ 365 #define ETH_P_ExperData 0x8049 366 367 /** Stanford V Kernel exp. ethernet protocol type. 368 */ 369 #define ETH_P_Stanford_V_Kernel_exp 0x805B 370 371 /** Stanford V Kernel prod. ethernet protocol type. 372 */ 373 #define ETH_P_Stanford_V_Kernel_prod 0x805C 374 375 /** Evans &Sutherland ethernet protocol type. 376 */ 377 #define ETH_P_Evans_Sutherland 0x805D 378 379 /** Little Machines ethernet protocol type. 380 */ 381 #define ETH_P_Little_Machines 0x8060 382 383 /** Counterpoint Computers ethernet protocol type. 384 */ 385 #define ETH_P_Counterpoint_Computers 0x8062 386 387 /** Univ. of Mass. @ Amherst ethernet protocol type. 388 */ 389 #define ETH_P_Univ_of_Mass 0x8065 390 391 /** Univ. of Mass. @ Amherst ethernet protocol type. 392 */ 393 #define ETH_P_Univ_of_Mass2 0x8066 394 395 /** Veeco Integrated Auto. ethernet protocol type. 396 */ 397 #define ETH_P_Veeco_Integrated_Auto 0x8067 398 399 /** General Dynamics ethernet protocol type. 400 */ 401 #define ETH_P_General_Dynamics 0x8068 402 403 /** AT&T ethernet protocol type. 404 */ 405 #define ETH_P_AT_T4 0x8069 406 407 /** Autophon ethernet protocol type. 408 */ 409 #define ETH_P_Autophon 0x806A 410 411 /** ComDesign ethernet protocol type. 412 */ 413 #define ETH_P_ComDesign 0x806C 414 415 /** Computgraphic Corp. ethernet protocol type. 416 */ 417 #define ETH_P_Computgraphic_Corp 0x806D 418 419 /** Landmark Graphics Corp. ethernet protocol type. 420 */ 421 #define ETH_P_Landmark_Graphics_Corp_MIN 0x806E 422 423 /** Landmark Graphics Corp. ethernet protocol type. 424 */ 425 #define ETH_P_Landmark_Graphics_Corp_MAX 0x8077 426 427 /** Matra ethernet protocol type. 428 */ 429 #define ETH_P_Matra 0x807A 430 431 /** Dansk Data Elektronik ethernet protocol type. 432 */ 433 #define ETH_P_Dansk_Data_Elektronik 0x807B 434 435 /** Merit Internodal ethernet protocol type. 436 */ 437 #define ETH_P_Merit_Internodal 0x807C 438 439 /** Vitalink Communications ethernet protocol type. 440 */ 441 #define ETH_P_Vitalink_Communications_MIN 0x807D 442 443 /** Vitalink Communications ethernet protocol type. 444 */ 445 #define ETH_P_Vitalink_Communications_MAX 0x807F 446 447 /** Vitalink TransLAN III ethernet protocol type. 448 */ 449 #define ETH_P_Vitalink_TransLAN_III 0x8080 450 451 /** Counterpoint Computers ethernet protocol type. 452 */ 453 #define ETH_P_Counterpoint_Computers_MIN 0x8081 454 455 /** Counterpoint Computers ethernet protocol type. 456 */ 457 #define ETH_P_Counterpoint_Computers_MAX 0x8083 458 459 /** Appletalk ethernet protocol type. 460 */ 461 #define ETH_P_ATALK 0x809B 462 463 /** Datability ethernet protocol type. 464 */ 465 #define ETH_P_Datability_MIN 0x809C 466 467 /** Datability ethernet protocol type. 468 */ 469 #define ETH_P_Datability_MAX 0x809E 470 471 /** Spider Systems Ltd. ethernet protocol type. 472 */ 473 #define ETH_P_Spider_Systems_Ltd 0x809F 474 475 /** Nixdorf Computers ethernet protocol type. 476 */ 477 #define ETH_P_Nixdorf_Computers 0x80A3 478 479 /** Siemens Gammasonics Inc. ethernet protocol type. 480 */ 481 #define ETH_P_Siemens_Gammasonics_Inc_MIN 0x80A4 482 483 /** Siemens Gammasonics Inc. ethernet protocol type. 484 */ 485 #define ETH_P_Siemens_Gammasonics_Inc_MAX 0x80B3 486 487 /** DCA Data Exchange Cluster ethernet protocol type. 488 */ 489 #define ETH_P_DCA_Data_Exchange_Cluster_MIN 0x80C0 490 491 /** DCA Data Exchange Cluster ethernet protocol type. 492 */ 493 #define ETH_P_DCA_Data_Exchange_Cluster_MAX 0x80C3 494 495 /** Banyan Systems ethernet protocol type. 496 */ 497 #define ETH_P_Banyan_Systems 0x80C4 498 499 /** Banyan Systems ethernet protocol type. 500 */ 501 #define ETH_P_Banyan_Systems2 0x80C5 502 503 /** Pacer Software ethernet protocol type. 504 */ 505 #define ETH_P_Pacer_Software 0x80C6 506 507 /** Applitek Corporation ethernet protocol type. 508 */ 509 #define ETH_P_Applitek_Corporation 0x80C7 510 511 /** Intergraph Corporation ethernet protocol type. 512 */ 513 #define ETH_P_Intergraph_Corporation_MIN 0x80C8 514 515 /** Intergraph Corporation ethernet protocol type. 516 */ 517 #define ETH_P_Intergraph_Corporation_MAX 0x80CC 518 519 /** Harris Corporation ethernet protocol type. 520 */ 521 #define ETH_P_Harris_Corporation_MIN 0x80CD 522 523 /** Harris Corporation ethernet protocol type. 524 */ 525 #define ETH_P_Harris_Corporation_MAX 0x80CE 526 527 /** Taylor Instrument ethernet protocol type. 528 */ 529 #define ETH_P_Taylor_Instrument_MIN 0x80CF 530 531 /** Taylor Instrument ethernet protocol type. 532 */ 533 #define ETH_P_Taylor_Instrument_MAX 0x80D2 534 535 /** Rosemount Corporation ethernet protocol type. 536 */ 537 #define ETH_P_Rosemount_Corporation_MIN 0x80D3 538 539 /** Rosemount Corporation ethernet protocol type. 540 */ 541 #define ETH_P_Rosemount_Corporation_MAX 0x80D4 542 543 /** IBM SNA Service on Ether ethernet protocol type. 544 */ 545 #define ETH_P_IBM_SNA_Service_on_Ether 0x80D5 546 547 /** Varian Associates ethernet protocol type. 548 */ 549 #define ETH_P_Varian_Associates 0x80DD 550 551 /** Integrated Solutions TRFS ethernet protocol type. 552 */ 553 #define ETH_P_Integrated_Solutions_TRFS_MIN 0x80DE 554 555 /** Integrated Solutions TRFS ethernet protocol type. 556 */ 557 #define ETH_P_Integrated_Solutions_TRFS_MAX 0x80DF 558 559 /** Allen-Bradley ethernet protocol type. 560 */ 561 #define ETH_P_Allen_Bradley_MIN 0x80E0 562 563 /** Allen-Bradley ethernet protocol type. 564 */ 565 #define ETH_P_Allen_Bradley_MAX 0x80E3 566 567 /** Datability ethernet protocol type. 568 */ 569 #define ETH_P_Datability_MIN2 0x80E4 570 571 /** Datability ethernet protocol type. 572 */ 573 #define ETH_P_Datability_MAX2 0x80F0 574 575 /** Retix ethernet protocol type. 576 */ 577 #define ETH_P_Retix 0x80F2 578 579 /** AppleTalk AARP (Kinetics) ethernet protocol type. 580 */ 581 #define ETH_P_AARP 0x80F3 582 583 /** Kinetics ethernet protocol type. 584 */ 585 #define ETH_P_Kinetics_MIN 0x80F4 586 587 /** Kinetics ethernet protocol type. 588 */ 589 #define ETH_P_Kinetics_MAX 0x80F5 590 591 /** Apollo Computer ethernet protocol type. 592 */ 593 #define ETH_P_Apollo_Computer 0x80F7 594 595 /** Wellfleet Communications ethernet protocol type. 596 */ 597 #define ETH_P_Wellfleet_Communications 0x80FF 598 599 /** IEEE 802.1Q VLAN-tagged frames (initially Wellfleet) ethernet protocol type. 600 */ 601 #define ETH_P_8021Q 0x8100 602 603 /** Wellfleet Communications ethernet protocol type. 604 */ 605 #define ETH_P_Wellfleet_Communications_MIN 0x8101 606 607 /** Wellfleet Communications ethernet protocol type. 608 */ 609 #define ETH_P_Wellfleet_Communications_MAX 0x8103 610 611 /** Symbolics Private ethernet protocol type. 612 */ 613 #define ETH_P_Symbolics_Private_MIN 0x8107 614 615 /** Symbolics Private ethernet protocol type. 616 */ 617 #define ETH_P_Symbolics_Private_MAX 0x8109 618 619 /** Hayes Microcomputers ethernet protocol type. 620 */ 621 #define ETH_P_Hayes_Microcomputers 0x8130 622 623 /** VG Laboratory Systems ethernet protocol type. 624 */ 625 #define ETH_P_VG_Laboratory_Systems 0x8131 626 627 /** Bridge Communications ethernet protocol type. 628 */ 629 #define ETH_P_Bridge_Communications_MIN 0x8132 630 631 /** Bridge Communications ethernet protocol type. 632 */ 633 #define ETH_P_Bridge_Communications_MAX 0x8136 634 635 /** Novell, Inc. ethernet protocol type. 636 */ 637 #define ETH_P_Novell_Inc_MIN 0x8137 638 639 /** Novell, Inc. ethernet protocol type. 640 */ 641 #define ETH_P_Novell_Inc_MAX 0x8138 642 643 /** KTI ethernet protocol type. 644 */ 645 #define ETH_P_KTI_MIN 0x8139 646 647 /** KTI ethernet protocol type. 648 */ 649 #define ETH_P_KTI_MAX 0x813D 650 651 /** Logicraft ethernet protocol type. 652 */ 653 #define ETH_P_Logicraft 0x8148 654 655 /** Network Computing Devices ethernet protocol type. 656 */ 657 #define ETH_P_Network_Computing_Devices 0x8149 658 659 /** Alpha Micro ethernet protocol type. 660 */ 661 #define ETH_P_Alpha_Micro 0x814A 662 663 /** SNMP ethernet protocol type. 664 */ 665 #define ETH_P_SNMP 0x814C 666 667 /** BIIN ethernet protocol type. 668 */ 669 #define ETH_P_BIIN 0x814D 670 671 /** BIIN ethernet protocol type. 672 */ 673 #define ETH_P_BIIN2 0x814E 674 675 /** Technically Elite Concept ethernet protocol type. 676 */ 677 #define ETH_P_Technically_Elite_Concept 0x814F 678 679 /** Rational Corp ethernet protocol type. 680 */ 681 #define ETH_P_Rational_Corp 0x8150 682 683 /** Qualcomm ethernet protocol type. 684 */ 685 #define ETH_P_Qualcomm_MIN 0x8151 686 687 /** Qualcomm ethernet protocol type. 688 */ 689 #define ETH_P_Qualcomm_MAX 0x8153 690 691 /** Computer Protocol Pty Ltd ethernet protocol type. 692 */ 693 #define ETH_P_Computer_Protocol_Pty_Ltd_MIN 0x815C 694 695 /** Computer Protocol Pty Ltd ethernet protocol type. 696 */ 697 #define ETH_P_Computer_Protocol_Pty_Ltd_MAX 0x815E 698 699 /** Charles River Data System ethernet protocol type. 700 */ 701 #define ETH_P_Charles_River_Data_System_MIN 0x8164 702 703 /** Charles River Data System ethernet protocol type. 704 */ 705 #define ETH_P_Charles_River_Data_System_MAX 0x8166 706 707 /** XTP ethernet protocol type. 708 */ 709 #define ETH_P_XTP 0x817D 710 711 /** SGI/Time Warner prop. ethernet protocol type. 712 */ 713 #define ETH_P_SGITime_Warner_prop 0x817E 714 715 /** HIPPI-FP encapsulation ethernet protocol type. 716 */ 717 #define ETH_P_HIPPI_FP_encapsulation 0x8180 718 719 /** STP, HIPPI-ST ethernet protocol type. 720 */ 721 #define ETH_P_STP_HIPPI_ST 0x8181 722 723 /** Reserved for HIPPI-6400 ethernet protocol type. 724 */ 725 #define ETH_P_Reserved_for_HIPPI_6400 0x8182 726 727 /** Reserved for HIPPI-6400 ethernet protocol type. 728 */ 729 #define ETH_P_Reserved_for_HIPPI_64002 0x8183 730 731 /** Silicon Graphics prop. ethernet protocol type. 732 */ 733 #define ETH_P_Silicon_Graphics_prop_MIN 0x8184 734 735 /** Silicon Graphics prop. ethernet protocol type. 736 */ 737 #define ETH_P_Silicon_Graphics_prop_MAX 0x818C 738 739 /** Motorola Computer ethernet protocol type. 740 */ 741 #define ETH_P_Motorola_Computer 0x818D 742 743 /** Qualcomm ethernet protocol type. 744 */ 745 #define ETH_P_Qualcomm_MIN2 0x819A 746 747 /** Qualcomm ethernet protocol type. 748 */ 749 #define ETH_P_Qualcomm_MAX2 0x81A3 750 751 /** ARAI Bunkichi ethernet protocol type. 752 */ 753 #define ETH_P_ARAI_Bunkichi 0x81A4 754 755 /** RAD Network Devices ethernet protocol type. 756 */ 757 #define ETH_P_RAD_Network_Devices_MIN 0x81A5 758 759 /** RAD Network Devices ethernet protocol type. 760 */ 761 #define ETH_P_RAD_Network_Devices_MAX 0x81AE 762 763 /** Xyplex ethernet protocol type. 764 */ 765 #define ETH_P_Xyplex_MIN2 0x81B7 766 767 /** Xyplex ethernet protocol type. 768 */ 769 #define ETH_P_Xyplex_MAX2 0x81B9 770 771 /** Apricot Computers ethernet protocol type. 772 */ 773 #define ETH_P_Apricot_Computers_MIN 0x81CC 774 775 /** Apricot Computers ethernet protocol type. 776 */ 777 #define ETH_P_Apricot_Computers_MAX 0x81D5 778 779 /** Artisoft ethernet protocol type. 780 */ 781 #define ETH_P_Artisoft_MIN 0x81D6 782 783 /** Artisoft ethernet protocol type. 784 */ 785 #define ETH_P_Artisoft_MAX 0x81DD 786 787 /** Polygon ethernet protocol type. 788 */ 789 #define ETH_P_Polygon_MIN 0x81E6 790 791 /** Polygon ethernet protocol type. 792 */ 793 #define ETH_P_Polygon_MAX 0x81EF 794 795 /** Comsat Labs ethernet protocol type. 796 */ 797 #define ETH_P_Comsat_Labs_MIN 0x81F0 798 799 /** Comsat Labs ethernet protocol type. 800 */ 801 #define ETH_P_Comsat_Labs_MAX 0x81F2 802 803 /** SAIC ethernet protocol type. 804 */ 805 #define ETH_P_SAIC_MIN 0x81F3 806 807 /** SAIC ethernet protocol type. 808 */ 809 #define ETH_P_SAIC_MAX 0x81F5 810 811 /** VG Analytical ethernet protocol type. 812 */ 813 #define ETH_P_VG_Analytical_MIN 0x81F6 814 815 /** VG Analytical ethernet protocol type. 816 */ 817 #define ETH_P_VG_Analytical_MAX 0x81F8 818 819 /** Quantum Software ethernet protocol type. 820 */ 821 #define ETH_P_Quantum_Software_MIN 0x8203 822 823 /** Quantum Software ethernet protocol type. 824 */ 825 #define ETH_P_Quantum_Software_MAX 0x8205 826 827 /** Ascom Banking Systems ethernet protocol type. 828 */ 829 #define ETH_P_Ascom_Banking_Systems_MIN 0x8221 830 831 /** Ascom Banking Systems ethernet protocol type. 832 */ 833 #define ETH_P_Ascom_Banking_Systems_MAX 0x8222 834 835 /** Advanced Encryption Syste ethernet protocol type. 836 */ 837 #define ETH_P_Advanced_Encryption_Syste_MIN 0x823E 838 839 /** Advanced Encryption Syste ethernet protocol type. 840 */ 841 #define ETH_P_Advanced_Encryption_Syste_MAX 0x8240 842 843 /** Athena Programming ethernet protocol type. 844 */ 845 #define ETH_P_Athena_Programming_MIN 0x827F 846 847 /** Athena Programming ethernet protocol type. 848 */ 849 #define ETH_P_Athena_Programming_MAX 0x8282 850 851 /** Charles River Data System ethernet protocol type. 852 */ 853 #define ETH_P_Charles_River_Data_System_MIN2 0x8263 854 855 /** Charles River Data System ethernet protocol type. 856 */ 857 #define ETH_P_Charles_River_Data_System_MAX2 0x826A 858 859 /** Inst Ind Info Tech ethernet protocol type. 860 */ 861 #define ETH_P_Inst_Ind_Info_Tech_MIN 0x829A 862 863 /** Inst Ind Info Tech ethernet protocol type. 864 */ 865 #define ETH_P_Inst_Ind_Info_Tech_MAX 0x829B 866 867 /** Taurus Controls ethernet protocol type. 868 */ 869 #define ETH_P_Taurus_Controls_MIN 0x829C 870 871 /** Taurus Controls ethernet protocol type. 872 */ 873 #define ETH_P_Taurus_Controls_MAX 0x82AB 874 875 /** Walker Richer &Quinn ethernet protocol type. 876 */ 877 #define ETH_P_Walker_Richer_Quinn_MIN 0x82AC 878 879 /** Walker Richer &Quinn ethernet protocol type. 880 */ 881 #define ETH_P_Walker_Richer_Quinn_MAX 0x8693 882 883 /** Idea Courier ethernet protocol type. 884 */ 885 #define ETH_P_Idea_Courier_MIN 0x8694 886 887 /** Idea Courier ethernet protocol type. 888 */ 889 #define ETH_P_Idea_Courier_MAX 0x869D 890 891 /** Computer Network Tech ethernet protocol type. 892 */ 893 #define ETH_P_Computer_Network_Tech_MIN 0x869E 894 895 /** Computer Network Tech ethernet protocol type. 896 */ 897 #define ETH_P_Computer_Network_Tech_MAX 0x86A1 898 899 /** Gateway Communications ethernet protocol type. 900 */ 901 #define ETH_P_Gateway_Communications_MIN 0x86A3 902 903 /** Gateway Communications ethernet protocol type. 904 */ 905 #define ETH_P_Gateway_Communications_MAX 0x86AC 906 907 /** SECTRA ethernet protocol type. 908 */ 909 #define ETH_P_SECTRA 0x86DB 910 911 /** Delta Controls ethernet protocol type. 912 */ 913 #define ETH_P_Delta_Controls 0x86DE 914 915 /** IPv6 ethernet protocol type. 916 */ 917 #define ETH_P_IPV6 0x86DD 918 919 /** ATOMIC ethernet protocol type. 920 */ 921 #define ETH_P_ATOMIC 0x86DF 922 923 /** Landis &Gyr Powers ethernet protocol type. 924 */ 925 #define ETH_P_Landis_Gyr_Powers_MIN 0x86E0 926 927 /** Landis &Gyr Powers ethernet protocol type. 928 */ 929 #define ETH_P_Landis_Gyr_Powers_MAX 0x86EF 930 931 /** Motorola ethernet protocol type. 932 */ 933 #define ETH_P_Motorola_MIN 0x8700 934 935 /** Motorola ethernet protocol type. 936 */ 937 #define ETH_P_Motorola_MAX 0x8710 938 939 /** TCP/IP Compression ethernet protocol type. 940 */ 941 #define ETH_P_TCPIP_Compression 0x876B 942 943 /** IP Autonomous Systems ethernet protocol type. 944 */ 945 #define ETH_P_IP_Autonomous_Systems 0x876C 946 947 /** Secure Data ethernet protocol type. 948 */ 949 #define ETH_P_Secure_Data 0x876D 950 951 /** PPP ethernet protocol type. 952 */ 953 #define ETH_P_PPP 0x880B 954 955 /** MPLS ethernet protocol type. 956 */ 957 #define ETH_P_MPLS_UC 0x8847 958 959 /** MPLS with upstream-assigned label ethernet protocol type. 960 */ 961 #define ETH_P_MPLS_MC 0x8848 962 963 /** Invisible Software ethernet protocol type. 964 */ 965 #define ETH_P_Invisible_Software_MIN 0x8A96 966 967 /** Invisible Software ethernet protocol type. 968 */ 969 #define ETH_P_Invisible_Software_MAX 0x8A97 970 971 /** PPPoE Discovery Stage ethernet protocol type. 972 */ 973 #define ETH_P_PPP_DISC 0x8863 974 975 /** PPPoE Session Stage ethernet protocol type. 976 */ 977 #define ETH_P_PPP_SES 0x8864 978 979 /** Loopback ethernet protocol type. 980 */ 981 #define ETH_P_Loopback 0x9000 982 983 /** Com(Bridge) XNS Sys Mgmt ethernet protocol type. 984 */ 985 #define ETH_P_Com_XNS_Sys_Mgmt 0x9001 986 987 /** Com(Bridge) TCP-IP Sys ethernet protocol type. 988 */ 989 #define ETH_P_Com_TCP_IP_Sys 0x9002 990 991 /** Com(Bridge) loop detect ethernet protocol type. 992 */ 993 #define ETH_P_Com_loop_detect 0x9003 994 995 /** BBN VITAL-LanBridge cache ethernet protocol type. 996 */ 997 #define ETH_P_BBN_VITAL_LanBridge_cache 0xFF00 998 999 /** ISC Bunker Ramo ethernet protocol type. 1000 */ 1001 #define ETH_P_ISC_Bunker_Ramo_MIN 0xFF00 1002 1003 /** ISC Bunker Ramo ethernet protocol type. 1004 */ 1005 #define ETH_P_ISC_Bunker_Ramo_MAX 0xFF0F 1006 61 1007 /*@}*/ 62 1008 -
uspace/lib/net/include/icmp_client.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup icmp 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP client interface.34 * ICMP client interface. 35 35 */ 36 36 37 #ifndef LIBNET_ICMP_CLIENT_H_38 #define LIBNET_ICMP_CLIENT_H_37 #ifndef __NET_ICMP_CLIENT_H__ 38 #define __NET_ICMP_CLIENT_H__ 39 39 40 40 #include <net/icmp_codes.h> 41 41 #include <net/packet.h> 42 42 43 extern int icmp_client_process_packet(packet_t, icmp_type_t *, icmp_code_t *, 44 icmp_param_t *, icmp_param_t *); 45 extern size_t icmp_client_header_length(packet_t); 43 /** Processes the received packet prefixed with an ICMP header. 44 * @param[in] packet The received packet. 45 * @param[out] type The ICMP header type. 46 * @param[out] code The ICMP header code. 47 * @param[out] pointer The ICMP header pointer. 48 * @param[out] mtu The ICMP header MTU. 49 * @returns The ICMP header length. 50 * @returns Zero (0) if the packet contains no data. 51 */ 52 extern int icmp_client_process_packet(packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu); 53 54 /** Returns the ICMP header length. 55 * @param[in] packet The packet. 56 * @returns The ICMP header length in bytes. 57 */ 58 extern size_t icmp_client_header_length(packet_t packet); 46 59 47 60 #endif -
uspace/lib/net/include/icmp_header.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup icmp 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP header definition.35 * Based on the RFC792.34 * ICMP header definition. 35 * Based on the RFC~792. 36 36 */ 37 37 38 #ifndef LIBNET_ICMP_HEADER_H_39 #define LIBNET_ICMP_HEADER_H_38 #ifndef __NET_ICMP_HEADER_H__ 39 #define __NET_ICMP_HEADER_H__ 40 40 41 41 #include <sys/types.h> … … 44 44 #include <net/icmp_codes.h> 45 45 46 /** ICMP header size in bytes. */ 47 #define ICMP_HEADER_SIZE sizeof(icmp_header_t) 46 /** ICMP header size in bytes. 47 */ 48 #define ICMP_HEADER_SIZE sizeof(icmp_header_t) 48 49 49 50 /** Type definition of the echo specific data. 50 * @see icmp_echo51 * @see icmp_echo 51 52 */ 52 typedef struct icmp_echo 53 typedef struct icmp_echo icmp_echo_t; 53 54 54 55 /** Type definition of the echo specific data pointer. 55 * @see icmp_echo56 * @see icmp_echo 56 57 */ 57 typedef icmp_echo_t * icmp_echo_ref;58 typedef icmp_echo_t * icmp_echo_ref; 58 59 59 /** Echo specific data. */ 60 struct icmp_echo { 61 /** Message idintifier. */ 60 /** Echo specific data. 61 */ 62 struct icmp_echo{ 63 /** Message idintifier. 64 */ 62 65 icmp_param_t identifier; 63 /** Message sequence number. */ 66 /** Message sequence number. 67 */ 64 68 icmp_param_t sequence_number; 65 69 } __attribute__ ((packed)); 66 70 67 71 /** Type definition of the internet control message header. 68 * @see icmp_header72 * @see icmp_header 69 73 */ 70 typedef struct icmp_header 74 typedef struct icmp_header icmp_header_t; 71 75 72 76 /** Type definition of the internet control message header pointer. 73 * @see icmp_header77 * @see icmp_header 74 78 */ 75 typedef icmp_header_t * icmp_header_ref;79 typedef icmp_header_t * icmp_header_ref; 76 80 77 /** Internet control message header. */ 78 struct icmp_header { 79 /** The type of the message. */ 81 /** Internet control message header. 82 */ 83 struct icmp_header{ 84 /** The type of the message. 85 */ 80 86 uint8_t type; 81 82 /** 83 * The error code for the datagram reported by the ICMP message. 84 * The interpretation is dependent on the message type. 87 /** The error code for the datagram reported by the ICMP message. 88 * The interpretation is dependent on the message type. 85 89 */ 86 90 uint8_t code; 87 88 /** 89 * The checksum is the 16-bit ones's complement of the one's complement 90 * sum of the ICMP message starting with the ICMP Type. For computing 91 * the checksum, the checksum field should be zero. If the checksum does 92 * not match the contents, the datagram is discarded. 91 /** The checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. 92 * For computing the checksum, the checksum field should be zero. 93 * If the checksum does not match the contents, the datagram is discarded. 93 94 */ 94 95 uint16_t checksum; 95 96 /** Message specific data. */ 97 union { 98 /** Echo specific data. */ 96 /** Message specific data. 97 */ 98 union{ 99 /** Echo specific data. 100 */ 99 101 icmp_echo_t echo; 100 /** Proposed gateway value. */ 102 /** Proposed gateway value. 103 */ 101 104 in_addr_t gateway; 102 103 /** Fragmentation needed specific data. */ 104 struct { 105 /** Reserved field. Must be zero. */ 105 /** Fragmentation needed specific data. 106 */ 107 struct{ 108 /** Reserved field. 109 * Must be zero. 110 */ 106 111 icmp_param_t reserved; 107 /** Proposed MTU. */ 112 /** Proposed MTU. 113 */ 108 114 icmp_param_t mtu; 109 115 } frag; 110 111 /** Parameter problem specific data. */ 112 struct { 113 /** Problem pointer. */ 116 /** Parameter problem specific data. 117 */ 118 struct{ 119 /** Problem pointer. 120 */ 114 121 icmp_param_t pointer; 115 /** Reserved field. Must be zero. */ 122 /** Reserved field. 123 * Must be zero. 124 */ 116 125 icmp_param_t reserved; 117 126 } param; -
uspace/lib/net/include/icmp_interface.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup icmp 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_ICMP_INTERFACE_H_34 #define LIBNET_ICMP_INTERFACE_H_33 #ifndef __NET_ICMP_INTERFACE_H__ 34 #define __NET_ICMP_INTERFACE_H__ 35 35 36 36 #include <net/socket_codes.h> … … 46 46 47 47 /** @name ICMP module interface 48 * This interface is used by other modules.48 * This interface is used by other modules. 49 49 */ 50 50 /*@{*/ 51 51 52 extern int icmp_destination_unreachable_msg(int, icmp_code_t, icmp_param_t, 53 packet_t); 54 extern int icmp_source_quench_msg(int, packet_t); 55 extern int icmp_time_exceeded_msg(int, icmp_code_t, packet_t); 56 extern int icmp_parameter_problem_msg(int, icmp_code_t, icmp_param_t, packet_t); 52 /** Sends the Destination Unreachable error notification packet. 53 * Beginning of the packet is sent as the notification packet data. 54 * The source and the destination addresses should be set in the original packet. 55 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 56 * @param[in] code The error specific code. 57 * @param[in] mtu The error MTU value. 58 * @param[in] packet The original packet. 59 * @returns EOK on success. 60 * @returns EPERM if the ICMP error notifications are disabled. 61 * @returns ENOMEM if there is not enough memory left. 62 */ 63 extern int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet); 64 65 /** Sends the Source Quench error notification packet. 66 * Beginning of the packet is sent as the notification packet data. 67 * The source and the destination addresses should be set in the original packet. 68 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 69 * @param[in] packet The original packet. 70 * @returns EOK on success. 71 * @returns EPERM if the ICMP error notifications are disabled. 72 * @returns ENOMEM if there is not enough memory left. 73 */ 74 extern int icmp_source_quench_msg(int icmp_phone, packet_t packet); 75 76 /** Sends the Time Exceeded error notification packet. 77 * Beginning of the packet is sent as the notification packet data. 78 * The source and the destination addresses should be set in the original packet. 79 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 80 * @param[in] code The error specific code. 81 * @param[in] packet The original packet. 82 * @returns EOK on success. 83 * @returns EPERM if the ICMP error notifications are disabled. 84 * @returns ENOMEM if there is not enough memory left. 85 */ 86 extern int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet); 87 88 /** Sends the Parameter Problem error notification packet. 89 * Beginning of the packet is sent as the notification packet data. 90 * The source and the destination addresses should be set in the original packet. 91 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 92 * @param[in] code The error specific code. 93 * @param[in] pointer The problematic parameter offset. 94 * @param[in] packet The original packet. 95 * @returns EOK on success. 96 * @returns EPERM if the ICMP error notifications are disabled. 97 * @returns ENOMEM if there is not enough memory left. 98 */ 99 extern int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet); 57 100 58 101 /*@}*/ -
uspace/lib/net/include/il_interface.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_il 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Internetwork layer module interface for the underlying network interface 35 * layer.This interface is always called by the remote modules.34 * Internetwork layer module interface for the underlying network interface layer. 35 * This interface is always called by the remote modules. 36 36 */ 37 37 38 #ifndef LIBNET_IL_INTERFACE_H_ 39 #define LIBNET_IL_INTERFACE_H_ 38 #ifndef __NET_IL_INTERFACE_H__ 39 #define __NET_IL_INTERFACE_H__ 40 41 #include <generic.h> 40 42 41 43 #include <ipc/services.h> 42 #include < sys/types.h>44 #include <ipc/il.h> 43 45 44 46 #include <net/device.h> 45 47 #include <net/packet.h> 48 49 #include <packet_client.h> 46 50 47 51 /** @name Internetwork layer module interface … … 50 54 /*@{*/ 51 55 52 extern int il_device_state_msg(int, device_id_t, device_state_t, services_t); 53 extern int il_received_msg(int, device_id_t, packet_t, services_t); 54 extern int il_mtu_changed_msg(int, device_id_t, size_t, services_t); 56 /** Notify the internetwork layer modules about the device state change. 57 * 58 * @param[in] il_phone The internetwork layer module phone used for 59 * (semi)remote calls. 60 * @param[in] device_id The device identifier. 61 * @param[in] state The new device state. 62 * @param[in] target The target internetwork module service to be 63 * delivered to. 64 * 65 * @return EOK on success. 66 * 67 */ 68 static inline int il_device_state_msg(int il_phone, device_id_t device_id, 69 device_state_t state, services_t target) 70 { 71 return generic_device_state_msg_remote(il_phone, NET_IL_DEVICE_STATE, 72 device_id, state, target); 73 } 74 75 /** Notify the internetwork layer modules about the received packet/s. 76 * 77 * @param[in] il_phone The internetwork layer module phone used for 78 * (semi)remote calls. 79 * @param[in] device_id The device identifier. 80 * @param[in] packet The received packet or the received packet queue. 81 * @param[in] target The target internetwork module service to be 82 * delivered to. 83 * 84 * @return EOK on success. 85 * 86 */ 87 inline static int il_received_msg(int il_phone, device_id_t device_id, 88 packet_t packet, services_t target) 89 { 90 return generic_received_msg_remote(il_phone, NET_IL_RECEIVED, device_id, 91 packet_get_id(packet), target, 0); 92 } 93 94 /** Notify the internetwork layer modules about the mtu change. 95 * 96 * @param[in] il_phone The internetwork layer module phone used for 97 * (semi)remote calls. 98 * @param[in] device_id The device identifier. 99 * @param[in] mtu The new mtu value. 100 * @param[in] target The target internetwork module service to be 101 * delivered to. 102 * 103 * @return EOK on success. 104 * 105 */ 106 inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, 107 size_t mtu, services_t target) 108 { 109 return generic_device_state_msg_remote(il_phone, NET_IL_MTU_CHANGED, 110 device_id, (int) mtu, target); 111 } 55 112 56 113 /*@}*/ -
uspace/lib/net/include/il_local.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup il_local 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_IL_LOCAL_H_34 #define LIBNET_IL_LOCAL_H_33 #ifndef __IL_LOCAL_H__ 34 #define __IL_LOCAL_H__ 35 35 36 36 #include <ipc/ipc.h> 37 37 #include <async.h> 38 38 39 /** Processes the Internet layer module message.40 *41 * @param[in] callid The message identifier.42 * @param[in] call The message parameters.43 * @param[out] answer The message answer parameters.44 * @param[out] answer_count The last parameter for the actual answer in45 * the answer parameter.46 * @returns EOK on success.47 * @returns Other error codes as defined for the arp_message()48 * function.49 */50 39 extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call, 51 40 ipc_call_t *answer, int *answer_count); 52 53 /** Starts the Internet layer module.54 *55 * Initializes the client connection servicing function, initializes the module,56 * registers the module service and starts the async manager, processing IPC57 * messages in an infinite loop.58 *59 * @param[in] client_connection The client connection processing function. The60 * module skeleton propagates its own one.61 * @returns EOK on successful module termination.62 * @returns Other error codes as defined for the arp_initialize()63 * function.64 * @returns Other error codes as defined for the REGISTER_ME() macro65 * function.66 */67 41 extern int il_module_start_standalone(async_client_conn_t client_connection); 68 42 -
uspace/lib/net/include/ip_header.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup ip 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * IP header and options definitions.35 * Based on the RFC791.36 */ 37 38 #ifndef LIBNET_IP_HEADER_H_39 #define LIBNET_IP_HEADER_H_34 * IP header and options definitions. 35 * Based on the RFC~791. 36 */ 37 38 #ifndef __NET_IP_HEADER_H__ 39 #define __NET_IP_HEADER_H__ 40 40 41 41 #include <byteorder.h> … … 43 43 44 44 /** Returns the fragment offest high bits. 45 * @param[in] length The prefixed data total length. 46 */ 47 #define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) \ 48 ((((length) / 8U) & 0x1f00) >> 8) 45 * @param[in] length The prefixed data total length. 46 */ 47 #define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) ((((length) / 8u) &0x1F00) >> 8) 49 48 50 49 /** Returns the fragment offest low bits. 51 * @param[in] length The prefixed data total length. 52 */ 53 #define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) \ 54 (((length) / 8U) & 0xff) 50 * @param[in] length The prefixed data total length. 51 */ 52 #define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8u) &0xFF) 55 53 56 54 /** Returns the IP header length. 57 * @param[in] length The IP header length in bytes. 58 */ 59 #define IP_COMPUTE_HEADER_LENGTH(length) \ 60 ((uint8_t) ((length) / 4U)) 55 * @param[in] length The IP header length in bytes. 56 */ 57 #define IP_COMPUTE_HEADER_LENGTH(length) ((uint8_t) ((length) / 4u)) 61 58 62 59 /** Returns the fragment offest. 63 * @param[in] header The IP packet header. 64 */ 65 #define IP_FRAGMENT_OFFSET(header) \ 66 ((((header)->fragment_offset_high << 8) + \ 67 (header)->fragment_offset_low) * 8U) 60 * @param[in] header The IP packet header. 61 */ 62 #define IP_FRAGMENT_OFFSET(header) ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u) 68 63 69 64 /** Returns the IP packet header checksum. 70 65 * @param[in] header The IP packet header. 71 66 */ 72 #define IP_HEADER_CHECKSUM(header) \ 73 (htons(ip_checksum((uint8_t *) (header), IP_HEADER_LENGTH(header)))) 67 #define IP_HEADER_CHECKSUM(header) (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header)))) 74 68 75 69 /** Returns the actual IP packet data length. 76 * @param[in] header The IP packet header. 77 */ 78 #define IP_HEADER_DATA_LENGTH(header) \ 79 (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header)) 70 * @param[in] header The IP packet header. 71 */ 72 #define IP_HEADER_DATA_LENGTH(header) (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header)) 80 73 81 74 /** Returns the actual IP header length in bytes. 82 * @param[in] header The IP packet header. 83 */ 84 #define IP_HEADER_LENGTH(header) \ 85 ((header)->header_length * 4U) 75 * @param[in] header The IP packet header. 76 */ 77 #define IP_HEADER_LENGTH(header) ((header)->header_length * 4u) 86 78 87 79 /** Returns the actual IP packet total length. 88 * @param[in] header The IP packet header.89 */ 90 #define IP_TOTAL_LENGTH(header) \91 ntohs((header)->total_length) 92 93 /** @name IP flags definitions*/80 * @param[in] header The IP packet header. 81 */ 82 #define IP_TOTAL_LENGTH(header) ntohs((header)->total_length) 83 84 /** @name IP flags definitions 85 */ 94 86 /*@{*/ 95 87 96 /** Fragment flag field shift. */ 97 #define IPFLAG_FRAGMENT_SHIFT 1 98 99 /** Fragmented flag field shift. */ 100 #define IPFLAG_FRAGMENTED_SHIFT 0 88 /** Fragment flag field shift. 89 */ 90 #define IPFLAG_FRAGMENT_SHIFT 1 91 92 /** Fragmented flag field shift. 93 */ 94 #define IPFLAG_FRAGMENTED_SHIFT 0 101 95 102 96 /** Don't fragment flag value. 103 * Permits the packet fragmentation.104 */ 105 #define IPFLAG_DONT_FRAGMENT (0x1 << IPFLAG_FRAGMENT_SHIFT)97 * Permits the packet fragmentation. 98 */ 99 #define IPFLAG_DONT_FRAGMENT (0x1 << IPFLAG_FRAGMENT_SHIFT) 106 100 107 101 /** Last fragment flag value. 108 * Indicates the last packet fragment.109 */ 110 #define IPFLAG_LAST_FRAGMENT (0x0 << IPFLAG_FRAGMENTED_SHIFT)102 * Indicates the last packet fragment. 103 */ 104 #define IPFLAG_LAST_FRAGMENT (0x0 << IPFLAG_FRAGMENTED_SHIFT) 111 105 112 106 /** May fragment flag value. 113 * Allows the packet fragmentation.114 */ 115 #define IPFLAG_MAY_FRAGMENT (0x0 << IPFLAG_FRAGMENT_SHIFT)107 * Allows the packet fragmentation. 108 */ 109 #define IPFLAG_MAY_FRAGMENT (0x0 << IPFLAG_FRAGMENT_SHIFT) 116 110 117 111 /** More fragments flag value. 118 * Indicates that more packet fragments follow.119 */ 120 #define IPFLAG_MORE_FRAGMENTS (0x1 << IPFLAG_FRAGMENTED_SHIFT)112 * Indicates that more packet fragments follow. 113 */ 114 #define IPFLAG_MORE_FRAGMENTS (0x1 << IPFLAG_FRAGMENTED_SHIFT) 121 115 122 116 /*@}*/ 123 117 124 118 /** Type definition of the internet header. 125 * @see ip_header126 */ 127 typedef struct ip_header 119 * @see ip_header 120 */ 121 typedef struct ip_header ip_header_t; 128 122 129 123 /** Type definition of the internet header pointer. 130 * @see ip_header131 */ 132 typedef ip_header_t * ip_header_ref;124 * @see ip_header 125 */ 126 typedef ip_header_t * ip_header_ref; 133 127 134 128 /** Type definition of the internet option header. 135 * @see ip_header136 */ 137 typedef struct ip_option 129 * @see ip_header 130 */ 131 typedef struct ip_option ip_option_t; 138 132 139 133 /** Type definition of the internet option header pointer. 140 * @see ip_header141 */ 142 typedef ip_option_t * ip_option_ref;134 * @see ip_header 135 */ 136 typedef ip_option_t * ip_option_ref; 143 137 144 138 /** Type definition of the internet version 4 pseudo header. 145 * @see ipv4_pseudo_header146 */ 147 typedef struct ipv4_pseudo_header 139 * @see ipv4_pseudo_header 140 */ 141 typedef struct ipv4_pseudo_header ipv4_pseudo_header_t; 148 142 149 143 /** Type definition of the internet version 4 pseudo header pointer. 150 * @see ipv4_pseudo_header151 */ 152 typedef ipv4_pseudo_header_t * ipv4_pseudo_header_ref;144 * @see ipv4_pseudo_header 145 */ 146 typedef ipv4_pseudo_header_t * ipv4_pseudo_header_ref; 153 147 154 148 /** Internet header. 155 * 156 * The variable options should be included after the header itself and 157 * indicated by the increased header length value. 158 */ 159 struct ip_header { 149 * The variable options should be included after the header itself and indicated by the increased header length value. 150 */ 151 struct ip_header{ 160 152 #ifdef ARCH_IS_BIG_ENDIAN 161 uint8_t version : 4; 162 uint8_t header_length : 4; 153 /** The Version field indicates the format of the internet header. 154 */ 155 uint8_t version:4; 156 /** Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data. 157 * Note that the minimum value for a~correct header is~5. 158 */ 159 uint8_t header_length:4; 163 160 #else 164 uint8_t header_length : 4; 165 uint8_t version : 4; 166 #endif 167 161 /** Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data. 162 * Note that the minimum value for a~correct header is~5. 163 */ 164 uint8_t header_length:4; 165 /** The Version field indicates the format of the internet header. 166 */ 167 uint8_t version:4; 168 #endif 169 /** The Type of Service provides an indication of the abstract parameters of the quality of service desired. 170 * These parameters are to be used to guide the selection of the actual service parameters when transmitting a~datagram through a~particular network. 171 * Several networks offer service precedence, which somehow treats high precedence traffic as more important than other traffic (generally by accepting only traffic above a~certain precedence at time of high load). 172 * The major choice is a~three way tradeoff between low-delay, high-reliability, and high-throughput. 173 */ 168 174 uint8_t tos; 175 /** Total Length is the length of the datagram, measured in octets, including internet header and data. 176 * This field allows the length of a~datagram to be up to 65,535~octets. 177 */ 169 178 uint16_t total_length; 179 /** An identifying value assigned by the sender to aid in assembling the fragments of a~datagram. 180 */ 170 181 uint16_t identification; 171 172 182 #ifdef ARCH_IS_BIG_ENDIAN 173 uint8_t flags : 3; 174 uint8_t fragment_offset_high : 5; 183 /** Various control flags. 184 */ 185 uint8_t flags:3; 186 /** This field indicates where in the datagram this fragment belongs. 187 * High bits. 188 */ 189 uint8_t fragment_offset_high:5; 175 190 #else 176 uint8_t fragment_offset_high : 5; 177 uint8_t flags : 3; 178 #endif 179 191 /** This field indicates where in the datagram this fragment belongs. 192 * High bits. 193 */ 194 uint8_t fragment_offset_high:5; 195 /** Various control flags. 196 */ 197 uint8_t flags:3; 198 #endif 199 /** This field indicates where in the datagram this fragment belongs. 200 * Low bits. 201 */ 180 202 uint8_t fragment_offset_low; 203 /** This field indicates the maximum time the datagram is allowed to remain in the internet system. 204 * If this field contains the value zero, then the datagram must be destroyed. 205 * This field is modified in internet header processing. 206 * The time is measured in units of seconds, but since every module that processes a~datagram must decrease the TTL by at least one even if it process the datagram in less than a~second, the TTL must be thought of only as an upper bound on the time a~datagram may exist. 207 * The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime. 208 */ 181 209 uint8_t ttl; 210 /** This field indicates the next level protocol used in the data portion of the internet datagram. 211 */ 182 212 uint8_t protocol; 213 /** A checksum of the header only. 214 * Since some header fields change (e.g., time to live), this is recomputed and verified at each point that the internet header is processed. 215 * The checksum algorithm is: The checksum field is the 16~bit one's complement of the one's complement sum of all 16~bit words in the header. 216 * For purposes of computing the checksum, the value of the checksum field is zero. 217 */ 183 218 uint16_t header_checksum; 219 /** The source address. 220 */ 184 221 uint32_t source_address; 222 /** The destination address. 223 */ 185 224 uint32_t destination_address; 186 225 } __attribute__ ((packed)); 187 226 188 227 /** Internet option header. 189 * 190 * Only type field is always valid. 191 * Other fields' validity depends on the option type. 192 */ 193 struct ip_option { 228 * Only type field is always valid. 229 * Other fields' validity depends on the option type. 230 */ 231 struct ip_option{ 232 /** A single octet of option-type. 233 */ 194 234 uint8_t type; 235 /** An option length octet. 236 */ 195 237 uint8_t length; 238 /** A~pointer. 239 */ 196 240 uint8_t pointer; 197 198 241 #ifdef ARCH_IS_BIG_ENDIAN 199 uint8_t overflow : 4; 200 uint8_t flags : 4; 242 /** The number of IP modules that cannot register timestamps due to lack of space. 243 */ 244 uint8_t overflow:4; 245 /** Various internet timestamp control flags. 246 */ 247 uint8_t flags:4; 201 248 #else 202 uint8_t flags : 4; 203 uint8_t overflow : 4; 249 /** Various internet timestamp control flags. 250 */ 251 uint8_t flags:4; 252 /** The number of IP modules that cannot register timestamps due to lack of space. 253 */ 254 uint8_t overflow:4; 204 255 #endif 205 256 } __attribute__ ((packed)); 206 257 207 /** Internet version 4 pseudo header. */ 208 struct ipv4_pseudo_header { 258 /** Internet version 4 pseudo header. 259 */ 260 struct ipv4_pseudo_header{ 261 /** The source address. 262 */ 209 263 uint32_t source_address; 264 /** The destination address. 265 */ 210 266 uint32_t destination_address; 267 /** Reserved byte. 268 * Must be zero. 269 */ 211 270 uint8_t reserved; 271 /** This field indicates the next level protocol used in the data portion of the internet datagram. 272 */ 212 273 uint8_t protocol; 274 /** Data length is the length of the datagram, measured in octets. 275 */ 213 276 uint16_t data_length; 214 277 } __attribute__ ((packed)); -
uspace/lib/net/include/ip_interface.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup ip 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_IP_INTERFACE_H_34 #define LIBNET_IP_INTERFACE_H_33 #ifndef __NET_IP_INTERFACE_H__ 34 #define __NET_IP_INTERFACE_H__ 35 35 36 36 #include <net/socket_codes.h> … … 55 55 56 56 /** @name IP module interface 57 * This interface is used by other modules.57 * This interface is used by other modules. 58 58 */ 59 59 /*@{*/ 60 60 61 61 /** The transport layer notification function type definition. 62 * 63 * Notifies the transport layer modules about the received packet/s. 64 * 65 * @param[in] device_id The device identifier. 66 * @param[in] packet The received packet or the received packet queue. 67 * @param[in] receiver The receiving module service. 68 * @param[in] error The packet error reporting service. Prefixes the 69 * received packet. 70 * @returns EOK on success. 62 * Notifies the transport layer modules about the received packet/s. 63 * @param[in] device_id The device identifier. 64 * @param[in] packet The received packet or the received packet queue. 65 * @param[in] receiver The receiving module service. 66 * @param[in] error The packet error reporting service. Prefixes the received packet. 67 * @returns EOK on success. 71 68 */ 72 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet, 73 services_t receiver, services_t error); 69 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet, services_t receiver, services_t error); 74 70 75 extern int ip_bind_service(services_t, int, services_t, async_client_conn_t); 76 extern int ip_connect_module(services_t); 71 /** Creates bidirectional connection with the ip module service and registers the message receiver. 72 * @param[in] service The IP module service. 73 * @param[in] protocol The transport layer protocol. 74 * @param[in] me The requesting module service. 75 * @param[in] receiver The message receiver. Used for remote connection. 76 * @returns The phone of the needed service. 77 * @returns EOK on success. 78 * @returns Other error codes as defined for the bind_service() function. 79 */ 80 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver); 81 82 /** Connects to the IP module. 83 * @param service The IP module service. Ignored parameter. 84 * @returns The IP module phone on success. 85 */ 86 extern int ip_connect_module(services_t service); 77 87 78 88 /*@}*/ -
uspace/lib/net/include/ip_remote.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup ip 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_IP_REMOTE_H_34 #define LIBNET_IP_REMOTE_H_33 #ifndef __NET_IP_REMOTE_H__ 34 #define __NET_IP_REMOTE_H__ 35 35 36 36 #include <ipc/services.h> -
uspace/lib/net/include/net_hardware.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_nil 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Hardware types according to the on-line IANA - Address Resolution Protocol 35 * (ARP) Parameters 36 * http://www.iana.org/assignments/arp-parameters/arp-parameters.xml, 37 * cited January 14 2009. 34 * Hardware types according to the on-line IANA - Address Resolution Protocol (ARP) Parameters - <http://www.iana.org/assignments/arp-parameters/arp-parameters.xml>, cited January 14 2009. 38 35 */ 39 36 40 #ifndef LIBNET_NET_HARDWARE_H_41 #define LIBNET_NET_HARDWARE_H_37 #ifndef __NET_HW_TYPES_H__ 38 #define __NET_HW_TYPES_H__ 42 39 43 40 #include <sys/types.h> 44 41 45 /** Network interface layer type type definition. */ 46 typedef uint8_t hw_type_t; 42 /** Network interface layer type type definition. 43 */ 44 typedef uint8_t hw_type_t; 47 45 48 /** @name Network interface layer types definitions */ 46 /** @name Network interface layer types definitions 47 */ 49 48 /*@{*/ 50 49 51 /** Ethernet (10Mb) hardware type. */ 50 /** Ethernet (10Mb) hardware type. 51 */ 52 52 #define HW_ETHER 1 53 54 /** Experimental Ethernet (3Mb) hardware type. 55 */ 56 #define HW_EETHER 2 57 58 /** Amateur Radio AX.25 hardware type. 59 */ 60 #define HW_AX25 3 61 62 /** Proteon ProNET Token Ring hardware type. 63 */ 64 #define HW_PRONET 4 65 66 /** Chaos hardware type. 67 */ 68 #define HW_CHAOS 5 69 70 /** IEEE 802 Networks hardware type. 71 */ 72 #define HW_IEEE802 6 73 74 /** ARCNET hardware type. 75 */ 76 #define HW_ARCNET 7 77 78 /** Hyperchannel hardware type. 79 */ 80 #define HW_Hyperchannel 8 81 82 /** Lanstar hardware type. 83 */ 84 #define HW_Lanstar 9 85 86 /** Autonet Short Address hardware type. 87 */ 88 #define HW_ASA 10 89 90 /** LocalTalk hardware type. 91 */ 92 #define HW_LocalTalk 11 93 94 /** LocalNet (IBM PCNet or SYTEK LocalNET) hardware type. 95 */ 96 #define HW_LocalNet 12 97 98 /** Ultra link hardware type. 99 */ 100 #define HW_Ultra_link 13 101 102 /** SMDS hardware type. 103 */ 104 #define HW_SMDS 14 105 106 /** Frame Relay DLCI hardware type. 107 */ 108 #define HW_DLCI 15 109 110 /** Asynchronous Transmission Mode (ATM) hardware type. 111 */ 112 #define HW_ATM 16 113 114 /** HDLC hardware type. 115 */ 116 #define HW_HDLC 17 117 118 /** Fibre Channel hardware type. 119 */ 120 #define HW_Fibre_Channel 18 121 122 /** Asynchronous Transmission Mode (ATM) hardware type. 123 */ 124 #define HW_ATM2 19 125 126 /** Serial Line hardware type. 127 */ 128 #define HW_Serial_Line 20 129 130 /** Asynchronous Transmission Mode (ATM) hardware type. 131 */ 132 #define HW_ATM3 21 133 134 /** MIL-STD-188-220 hardware type. 135 */ 136 #define HW_MIL_STD_188_220 22 137 138 /** Metricom hardware type. 139 */ 140 #define HW_METRICOM 23 141 142 /** IEEE 1394.1995 hardware type. 143 */ 144 #define HW_IEEE1394 24 145 146 /** MAPOS hardware type. 147 */ 148 #define HW_MAPOS 25 149 150 /** Twinaxial hardware type. 151 */ 152 #define HW_Twinaxial 26 153 154 /** EUI-64 hardware type. 155 */ 156 #define HW_EUI64 27 157 158 /** HIPARP hardware type. 159 */ 160 #define HW_HIPARP 28 161 162 /** IP and ARP over ISO 7816-3 hardware type. 163 */ 164 #define HW_ISO_7816_3 29 165 166 /** ARPSec hardware type. 167 */ 168 #define HW_ARPSec 30 169 170 /** IPsec tunnel hardware type. 171 */ 172 #define HW_IPsec_tunnel 31 173 174 /** InfiniBand (TM) hardware type. 175 */ 176 #define HW_INFINIBAND 32 177 178 /** TIA-102 Project 25 Common Air Interface (CAI) hardware type. 179 */ 180 #define HW_CAI 33 181 182 /** Wiegand Interface hardware type. 183 */ 184 #define HW_Wiegand 34 185 186 /** Pure IP hardware type. 187 */ 188 #define HW_Pure_IP 35 53 189 54 190 /*@}*/ … … 58 194 /** @} 59 195 */ 60 -
uspace/lib/net/include/netif_interface.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup netif 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_NETIF_INTERFACE_H_34 #define LIBNET_NETIF_INTERFACE_H_33 #ifndef __NET_NETIF_INTERFACE_H__ 34 #define __NET_NETIF_INTERFACE_H__ 35 35 36 36 #include <netif_remote.h> -
uspace/lib/net/include/netif_local.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup netif 30 30 * @{ 31 31 */ … … 36 36 */ 37 37 38 #ifndef NET_NETIF_LOCAL_H_39 #define NET_NETIF_LOCAL_H_38 #ifndef __NET_NETIF_LOCAL_H__ 39 #define __NET_NETIF_LOCAL_H__ 40 40 41 41 #include <async.h> … … 43 43 #include <ipc/ipc.h> 44 44 #include <ipc/services.h> 45 #include <err.h> 45 46 46 47 #include <adt/measured_strings.h> … … 48 49 #include <net/packet.h> 49 50 50 /** Network interface device specific data. */ 51 /** Network interface device specific data. 52 * 53 */ 51 54 typedef struct { 52 55 device_id_t device_id; /**< Device identifier. */ … … 64 67 DEVICE_MAP_DECLARE(netif_device_map, netif_device_t); 65 68 66 /** Network interface module skeleton global data. */ 69 /** Network interface module skeleton global data. 70 * 71 */ 67 72 typedef struct { 68 73 int net_phone; /**< Networking module phone. */ … … 76 81 * 77 82 * This function has to be implemented in user code. 83 * 78 84 */ 79 85 extern int netif_initialize(void); … … 83 89 * This has to be implemented in user code. 84 90 * 85 * @param[in] device_id 86 * @param[in] irq 87 * @param[in] io 88 * 89 * @return 90 * @return Other error codes as defined for the find_device()91 * function.92 * @return Other error codes as defined for the specific module93 * message implementation.91 * @param[in] device_id The device identifier. 92 * @param[in] irq The device interrupt number. 93 * @param[in] io The device input/output address. 94 * 95 * @return EOK on success. 96 * @return Other error codes as defined for the find_device() function. 97 * @return Other error codes as defined for the specific module message 98 * implementation. 99 * 94 100 */ 95 101 extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io); … … 99 105 * This has to be implemented in user code. 100 106 * 101 * @param[in] device_id The device identifier. 102 * @param[in] packet The packet queue. 103 * @param[in] sender The sending module service. 104 * 105 * @return EOK on success. 106 * @return EFORWARD if the device is not active (in the 107 * NETIF_ACTIVE state). 108 * @return Other error codes as defined for the find_device() 109 * function. 110 * @return Other error codes as defined for the specific module 111 * message implementation. 107 * @param[in] device_id The device identifier. 108 * @param[in] packet The packet queue. 109 * @param[in] sender The sending module service. 110 * 111 * @return EOK on success. 112 * @return EFORWARD if the device is not active (in the NETIF_ACTIVE state). 113 * @return Other error codes as defined for the find_device() function. 114 * @return Other error codes as defined for the specific module message 115 * implementation. 116 * 112 117 */ 113 118 extern int netif_send_message(device_id_t device_id, packet_t packet, … … 118 123 * This has to be implemented in user code. 119 124 * 120 * @param[in] device 121 * 122 * @return 123 * @return Other error codes as defined for the find_device()124 * function.125 * @return Other error codes as defined for the specific module126 * message implementation.125 * @param[in] device The device structure. 126 * 127 * @return EOK on success. 128 * @return Other error codes as defined for the find_device() function. 129 * @return Other error codes as defined for the specific module message 130 * implementation. 131 * 127 132 */ 128 133 extern int netif_start_message(netif_device_t *device); … … 132 137 * This has to be implemented in user code. 133 138 * 134 * @param[in] device 135 * 136 * @return 137 * @return Other error codes as defined for the find_device()138 * function.139 * @return Other error codes as defined for the specific module140 * message implementation.139 * @param[in] device The device structure. 140 * 141 * @return EOK on success. 142 * @return Other error codes as defined for the find_device() function. 143 * @return Other error codes as defined for the specific module message 144 * implementation. 145 * 141 146 */ 142 147 extern int netif_stop_message(netif_device_t *device); … … 146 151 * This has to be implemented in user code. 147 152 * 148 * @param[in] device_idThe device identifier.149 * @param[out] address 150 * 151 * @return 152 * @return 153 * @return 154 * @return Other error codes as defined for the find_device()155 * function.156 * @return Other error codes as defined for the specific module157 * message implementation.153 * @param[in] device_id The device identifier. 154 * @param[out] address The device local hardware address. 155 * 156 * @return EOK on success. 157 * @return EBADMEM if the address parameter is NULL. 158 * @return ENOENT if there no such device. 159 * @return Other error codes as defined for the find_device() function. 160 * @return Other error codes as defined for the specific module message 161 * implementation. 162 * 158 163 */ 159 164 extern int netif_get_addr_message(device_id_t device_id, … … 165 170 * skeleton. This has to be implemented in user code. 166 171 * 167 * @param[in] callidThe message identifier.168 * @param[in] callThe message parameters.169 * @param[out] answer 172 * @param[in] callid The message identifier. 173 * @param[in] call The message parameters. 174 * @param[out] answer The message answer parameters. 170 175 * @param[out] answer_count The last parameter for the actual answer in 171 * the answer parameter. 172 * 173 * @return EOK on success. 174 * @return ENOTSUP if the message is not known. 175 * @return Other error codes as defined for the specific module 176 * message implementation. 176 * the answer parameter. 177 * 178 * @return EOK on success. 179 * @return ENOTSUP if the message is not known. 180 * @return Other error codes as defined for the specific module message 181 * implementation. 182 * 177 183 */ 178 184 extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call, … … 183 189 * This has to be implemented in user code. 184 190 * 185 * @param[in] device_idThe device identifier.186 * @param[out] stats 187 * 188 * @return 189 * @return Other error codes as defined for the find_device()190 * function.191 * @return Other error codes as defined for the specific module192 * message implementation.191 * @param[in] device_id The device identifier. 192 * @param[out] stats The device usage statistics. 193 * 194 * @return EOK on success. 195 * @return Other error codes as defined for the find_device() function. 196 * @return Other error codes as defined for the specific module message 197 * implementation. 198 * 193 199 */ 194 200 extern int netif_get_device_stats(device_id_t device_id, -
uspace/lib/net/include/netif_remote.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup netif 30 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_NETIF_REMOTE_H_34 #define LIBNET_NETIF_REMOTE_H_33 #ifndef __NET_NETIF_REMOTE_H__ 34 #define __NET_NETIF_REMOTE_H__ 35 35 36 #include <async.h>37 36 #include <ipc/services.h> 38 37 #include <adt/measured_strings.h> 39 40 38 #include <net/device.h> 41 #include <net/packet.h>42 39 43 40 extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ref *, -
uspace/lib/net/include/nil_interface.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_nil 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_NIL_INTERFACE_H_34 #define LIBNET_NIL_INTERFACE_H_33 #ifndef __NET_NIL_INTERFACE_H__ 34 #define __NET_NIL_INTERFACE_H__ 35 35 36 36 #include <async.h> … … 47 47 48 48 #define nil_packet_size_req(nil_phone, device_id, packet_dimension) \ 49 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \50 device_id,packet_dimension)49 generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, device_id, \ 50 packet_dimension) 51 51 52 52 #define nil_get_addr_req(nil_phone, device_id, address, data) \ -
uspace/lib/net/include/nil_local.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_nil 30 * @{ 31 31 */ 32 32 … … 36 36 */ 37 37 38 #ifndef LIBNET_NIL_LOCAL_H_39 #define LIBNET_NIL_LOCAL_H_38 #ifndef __NET_NIL_LOCAL_H__ 39 #define __NET_NIL_LOCAL_H__ 40 40 41 41 #include <ipc/ipc.h> … … 45 45 * Is called by the module_start() function. 46 46 * 47 * @param[in] net_phone The networking moduel phone. 48 * @return EOK on success. 49 * @return Other error codes as defined for each specific module 50 * initialize function. 47 * @param[in] net_phone The networking moduel phone. 48 * 49 * @return EOK on success. 50 * @return Other error codes as defined for each specific module initialize function. 51 * 51 52 */ 52 53 extern int nil_initialize(int); 53 54 54 /** Notify the network interface layer about the device state change.55 *56 * @param[in] nil_phone The network interface layer phone.57 * @param[in] device_id The device identifier.58 * @param[in] state The new device state.59 * @return EOK on success.60 * @return Other error codes as defined for each specific module61 * device state function.62 */63 55 extern int nil_device_state_msg_local(int, device_id_t, int); 64 65 66 /** Pass the packet queue to the network interface layer.67 *68 * Process and redistribute the received packet queue to the registered69 * upper layers.70 *71 * @param[in] nil_phone The network interface layer phone.72 * @param[in] device_id The source device identifier.73 * @param[in] packet The received packet or the received packet queue.74 * @param target The target service. Ignored parameter.75 * @return EOK on success.76 * @return Other error codes as defined for each specific module77 * received function.78 */79 56 extern int nil_received_msg_local(int, device_id_t, packet_t, services_t); 80 57 81 58 /** Message processing function. 82 59 * 83 * @param[in] name Module name. 84 * @param[in] callid The message identifier. 85 * @param[in] call The message parameters. 86 * @param[out] answer The message answer parameters. 87 * @param[out] answer_count The last parameter for the actual answer in the 88 * answer parameter. 89 * @return EOK on success. 90 * @return ENOTSUP if the message is not known. 91 * @return Other error codes as defined for each specific module 92 * message function. 60 * @param[in] name Module name. 61 * @param[in] callid The message identifier. 62 * @param[in] call The message parameters. 63 * @param[out] answer The message answer parameters. 64 * @param[out] answer_count The last parameter for the actual answer 65 * in the answer parameter. 66 * 67 * @return EOK on success. 68 * @return ENOTSUP if the message is not known. 69 * @return Other error codes as defined for each specific 70 * module message function. 93 71 * 94 72 * @see nil_interface.h 95 73 * @see IS_NET_NIL_MESSAGE() 74 * 96 75 */ 97 extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *, 98 i pc_call_t *, int *);76 extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *, 77 int *); 99 78 100 /** Pass the parameters to the module specific nil_message() function.101 *102 * @param[in] name Module name.103 * @param[in] callid The message identifier.104 * @param[in] call The message parameters.105 * @param[out] answer The message answer parameters.106 * @param[out] answer_count The last parameter for the actual answer in the107 * answer parameter.108 * @return EOK on success.109 * @return ENOTSUP if the message is not known.110 * @return Other error codes as defined for each specific module111 * message function.112 */113 79 extern int nil_module_message_standalone(const char *, ipc_callid_t, 114 80 ipc_call_t *, ipc_call_t *, int *); 115 116 /** Start the standalone nil layer module.117 *118 * Initialize the client connection serving function, initialize119 * the module, register the module service and start the async120 * manager, processing IPC messages in an infinite loop.121 *122 * @param[in] client_connection The client connection processing function.123 * The module skeleton propagates its own one.124 * @return EOK on success.125 * @return Other error codes as defined for the pm_init() function.126 * @return Other error codes as defined for the nil_initialize()127 * function.128 * @return Other error codes as defined for the REGISTER_ME() macro129 * function.130 */131 81 extern int nil_module_start_standalone(async_client_conn_t); 132 82 -
uspace/lib/net/include/protocol_map.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_nil 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Internetwork layer services - network interface layer service type 35 * translation. 34 * Internetwork layer services - network interface layer service type translation. 36 35 */ 37 36 38 #ifndef LIBNET_PROTOCOL_MAP_H_ 39 #define LIBNET_PROTOCOL_MAP_H_ 37 #ifndef __NET_PROTOCOL_MAP_H__ 38 #define __NET_PROTOCOL_MAP_H__ 39 40 #include <ipc/services.h> 40 41 41 42 #include <ethernet_lsap.h> … … 43 44 #include <net_hardware.h> 44 45 45 #include <ipc/services.h> 46 /** Maps the internetwork layer service to the network interface layer type. 47 * @param[in] nil Network interface layer service. 48 * @param[in] il Internetwork layer service. 49 * @returns Network interface layer type of the internetworking layer service. 50 * @returns 0 if mapping is not found. 51 */ 52 static inline eth_type_t protocol_map(services_t nil, services_t il){ 53 switch(nil){ 54 case SERVICE_ETHERNET: 55 case SERVICE_DP8390: 56 switch(il){ 57 case SERVICE_IP: 58 return ETH_P_IP; 59 case SERVICE_ARP: 60 return ETH_P_ARP; 61 default: 62 return 0; 63 } 64 default: 65 return 0; 66 } 67 } 46 68 47 eth_type_t protocol_map(services_t, services_t); 48 services_t protocol_unmap(services_t, int); 49 eth_type_t lsap_map(eth_lsap_t); 50 eth_lsap_t lsap_unmap(eth_type_t); 51 hw_type_t hardware_map(services_t); 69 /** Maps the network interface layer type to the internetwork layer service. 70 * @param[in] nil Network interface layer service. 71 * @param[in] protocol Network interface layer type. 72 * @returns Internetwork layer service of the network interface layer type. 73 * @returns 0 if mapping is not found. 74 */ 75 static inline services_t protocol_unmap(services_t nil, int protocol){ 76 switch(nil){ 77 case SERVICE_ETHERNET: 78 case SERVICE_DP8390: 79 switch(protocol){ 80 case ETH_P_IP: 81 return SERVICE_IP; 82 case ETH_P_ARP: 83 return SERVICE_ARP; 84 default: 85 return 0; 86 } 87 default: 88 return 0; 89 } 90 } 91 92 /** Maps the link service access point identifier to the Ethernet protocol identifier. 93 * @param[in] lsap Link service access point identifier. 94 * @returns Ethernet protocol identifier of the link service access point identifier. 95 * @returns ETH_LSAP_NULL if mapping is not found. 96 */ 97 static inline eth_type_t lsap_map(eth_lsap_t lsap){ 98 switch(lsap){ 99 case ETH_LSAP_IP: 100 return ETH_P_IP; 101 case ETH_LSAP_ARP: 102 return ETH_P_ARP; 103 default: 104 return ETH_LSAP_NULL; 105 } 106 } 107 108 /** Maps the Ethernet protocol identifier to the link service access point identifier. 109 * @param[in] ethertype Ethernet protocol identifier. 110 * @returns Link service access point identifier. 111 * @returns 0 if mapping is not found. 112 */ 113 static inline eth_lsap_t lsap_unmap(eth_type_t ethertype){ 114 switch(ethertype){ 115 case ETH_P_IP: 116 return ETH_LSAP_IP; 117 case ETH_P_ARP: 118 return ETH_LSAP_ARP; 119 default: 120 return 0; 121 } 122 } 123 124 /** Maps the network interface layer services to the hardware types. 125 * @param[in] nil The network interface service. 126 * @returns The hardware type of the network interface service. 127 * @returns 0 if mapping is not found. 128 */ 129 static inline hw_type_t hardware_map(services_t nil){ 130 switch(nil){ 131 case SERVICE_ETHERNET: 132 case SERVICE_DP8390: 133 return HW_ETHER; 134 default: 135 return 0; 136 } 137 } 52 138 53 139 #endif -
uspace/lib/net/include/tl_common.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_tl 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Transport layer common functions.34 * Transport layer common functions. 35 35 */ 36 36 37 #ifndef LIBNET_TL_COMMON_H_ 38 #define LIBNET_TL_COMMON_H_ 39 40 #include <ipc/services.h> 37 #ifndef __NET_TL_COMMON_H__ 38 #define __NET_TL_COMMON_H__ 41 39 42 40 #include <net/socket_codes.h> … … 46 44 47 45 /** Device packet dimensions. 48 * Maps devices to the packet dimensions.49 * @see device.h46 * Maps devices to the packet dimensions. 47 * @see device.h 50 48 */ 51 49 DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t); … … 53 51 extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref, 54 52 device_id_t, packet_dimension_ref *); 55 extern int tl_get_address_port(const struct sockaddr *, int, uint16_t *); 56 extern int tl_update_ip_packet_dimension(packet_dimensions_ref, device_id_t, 57 size_t); 58 extern int tl_set_address_port(struct sockaddr *, int, uint16_t); 59 extern int tl_prepare_icmp_packet(int, int, packet_t, services_t); 60 extern int tl_socket_read_packet_data(int, packet_ref, size_t, 61 const packet_dimension_ref, const struct sockaddr *, socklen_t); 53 54 /** Gets the address port. 55 * Supports AF_INET and AF_INET6 address families. 56 * @param[in,out] addr The address to be updated. 57 * @param[in] addrlen The address length. 58 * @param[out] port The set port. 59 * @returns EOK on success. 60 * @returns EINVAL if the address length does not match the address family. 61 * @returns EAFNOSUPPORT if the address family is not supported. 62 */ 63 extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port); 64 65 /** Updates IP device packet dimensions cache. 66 * @param[in,out] packet_dimensions The packet dimensions cache. 67 * @param[in] device_id The device identifier. 68 * @param[in] content The new maximum content size. 69 * @returns EOK on success. 70 * @returns ENOENT if the packet dimension is not cached. 71 */ 72 extern int tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content); 73 74 /** Sets the address port. 75 * Supports AF_INET and AF_INET6 address families. 76 * @param[in,out] addr The address to be updated. 77 * @param[in] addrlen The address length. 78 * @param[in] port The port to be set. 79 * @returns EOK on success. 80 * @returns EINVAL if the address length does not match the address family. 81 * @returns EAFNOSUPPORT if the address family is not supported. 82 */ 83 extern int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port); 84 85 /** Prepares the packet for ICMP error notification. 86 * Keeps the first packet and releases all the others. 87 * Releases all the packets on error. 88 * @param[in] packet_phone The packet server module phone. 89 * @param[in] icmp_phone The ICMP module phone. 90 * @param[in] packet The packet to be send. 91 * @param[in] error The packet error reporting service. Prefixes the received packet. 92 * @returns EOK on success. 93 * @returns ENOENT if no packet may be sent. 94 */ 95 extern int tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet, services_t error); 96 97 /** Receives data from the socket into a packet. 98 * @param[in] packet_phone The packet server module phone. 99 * @param[out] packet The new created packet. 100 * @param[in] prefix Reserved packet data prefix length. 101 * @param[in] dimension The packet dimension. 102 * @param[in] addr The destination address. 103 * @param[in] addrlen The address length. 104 * @returns Number of bytes received. 105 * @returns EINVAL if the client does not send data. 106 * @returns ENOMEM if there is not enough memory left. 107 * @returns Other error codes as defined for the async_data_read_finalize() function. 108 */ 109 extern int tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen); 62 110 63 111 #endif -
uspace/lib/net/include/tl_interface.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_tl 30 * @{ 31 31 */ 32 32 … … 35 35 */ 36 36 37 #ifndef LIBNET_TL_INTERFACE_H_38 #define LIBNET_TL_INTERFACE_H_37 #ifndef __NET_TL_INTERFACE_H__ 38 #define __NET_TL_INTERFACE_H__ 39 39 40 40 #include <async.h> … … 52 52 /*@{*/ 53 53 54 extern int tl_received_msg(int, device_id_t, packet_t, services_t, services_t); 54 /** Notify the remote transport layer modules about the received packet/s. 55 * 56 * @param[in] tl_phone The transport layer module phone used for remote calls. 57 * @param[in] device_id The device identifier. 58 * @param[in] packet The received packet or the received packet queue. 59 * The packet queue is used to carry a fragmented 60 * datagram. The first packet contains the headers, 61 * the others contain only data. 62 * @param[in] target The target transport layer module service to be 63 * delivered to. 64 * @param[in] error The packet error reporting service. Prefixes the 65 * received packet. 66 * 67 * @return EOK on success. 68 * 69 */ 70 inline static int tl_received_msg(int tl_phone, device_id_t device_id, 71 packet_t packet, services_t target, services_t error) 72 { 73 return generic_received_msg_remote(tl_phone, NET_TL_RECEIVED, device_id, 74 packet_get_id(packet), target, error); 75 } 55 76 56 77 /*@}*/ -
uspace/lib/net/include/tl_local.h
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup tl_local 30 * @{ 31 31 */ 32 32 33 #ifndef LIBNET_TL_LOCAL_H_34 #define LIBNET_TL_LOCAL_H_33 #ifndef __TL_LOCAL_H__ 34 #define __TL_LOCAL_H__ 35 35 36 36 #include <ipc/ipc.h> -
uspace/lib/net/netif/netif_local.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup netif 30 30 * @{ 31 31 */ … … 58 58 DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t); 59 59 60 /** Network interface global data. */ 60 /** Network interface global data. 61 */ 61 62 netif_globals_t netif_globals; 62 63 … … 64 65 * 65 66 * @param[in] netif_phone The network interface phone. 66 * @param[in] device_id 67 * @param[in] irq 68 * @param[in] io 69 * @return EOK on success.70 * @return Other error codes as defined for the71 * 72 * /73 int 74 netif_probe_req_local(int netif_phone, device_id_t device_id, int irq, int io)67 * @param[in] device_id The device identifier. 68 * @param[in] irq The device interrupt number. 69 * @param[in] io The device input/output address. 70 * 71 * @return EOK on success. 72 * @return Other errro codes as defined for the netif_probe_message(). 73 * 74 */ 75 int netif_probe_req_local(int netif_phone, device_id_t device_id, int irq, int io) 75 76 { 76 77 fibril_rwlock_write_lock(&netif_globals.lock); … … 84 85 * 85 86 * @param[in] netif_phone The network interface phone. 86 * @param[in] device_id The device identifier. 87 * @param[in] packet The packet queue. 88 * @param[in] sender The sending module service. 89 * @return EOK on success. 90 * @return Other error codes as defined for the generic_send_msg() 91 * function. 87 * @param[in] device_id The device identifier. 88 * @param[in] packet The packet queue. 89 * @param[in] sender The sending module service. 90 * 91 * @return EOK on success. 92 * @return Other error codes as defined for the generic_send_msg() function. 93 * 92 94 */ 93 95 int netif_send_msg_local(int netif_phone, device_id_t device_id, … … 104 106 * 105 107 * @param[in] netif_phone The network interface phone. 106 * @param[in] device_id 107 * @return EOK on success.108 * @return Other error codes as defined for the find_device()109 * 110 * @return Other error codes as defined for the111 * netif_start_message() function.108 * @param[in] device_id The device identifier. 109 * 110 * @return EOK on success. 111 * @return Other error codes as defined for the find_device() function. 112 * @return Other error codes as defined for the netif_start_message() function. 113 * 112 114 */ 113 115 int netif_start_req_local(int netif_phone, device_id_t device_id) … … 139 141 * 140 142 * @param[in] netif_phone The network interface phone. 141 * @param[in] device_id 142 * @return EOK on success.143 * @return Other error codes as defined for the find_device()144 * 145 * @return Other error codes as defined for the146 * netif_stop_message() function.143 * @param[in] device_id The device identifier. 144 * 145 * @return EOK on success. 146 * @return Other error codes as defined for the find_device() function. 147 * @return Other error codes as defined for the netif_stop_message() function. 148 * 147 149 */ 148 150 int netif_stop_req_local(int netif_phone, device_id_t device_id) … … 173 175 /** Return the device usage statistics. 174 176 * 175 * @param[in] netif_phone The network interface phone. 176 * @param[in] device_id The device identifier. 177 * @param[out] stats The device usage statistics. 178 * @return EOK on success. 177 * @param[in] netif_phone The network interface phone. 178 * @param[in] device_id The device identifier. 179 * @param[out] stats The device usage statistics. 180 * 181 * @return EOK on success. 182 * 179 183 */ 180 184 int netif_stats_req_local(int netif_phone, device_id_t device_id, … … 190 194 /** Return the device local hardware address. 191 195 * 192 * @param[in] netif_phone The network interface phone. 193 * @param[in] device_id The device identifier. 194 * @param[out] address The device local hardware address. 195 * @param[out] data The address data. 196 * @return EOK on success. 197 * @return EBADMEM if the address parameter is NULL. 198 * @return ENOENT if there no such device. 199 * @return Other error codes as defined for the 200 * netif_get_addr_message() function. 196 * @param[in] netif_phone The network interface phone. 197 * @param[in] device_id The device identifier. 198 * @param[out] address The device local hardware address. 199 * @param[out] data The address data. 200 * 201 * @return EOK on success. 202 * @return EBADMEM if the address parameter is NULL. 203 * @return ENOENT if there no such device. 204 * @return Other error codes as defined for the netif_get_addr_message() 205 * function. 206 * 201 207 */ 202 208 int netif_get_addr_req_local(int netif_phone, device_id_t device_id, … … 205 211 ERROR_DECLARE; 206 212 207 if ( !address || !data)213 if ((!address) || (!data)) 208 214 return EBADMEM; 209 215 … … 225 231 /** Find the device specific data. 226 232 * 227 * @param[in] device_id The device identifier. 228 * @param[out] device The device specific data. 229 * @return EOK on success. 230 * @return ENOENT if device is not found. 231 * @return EPERM if the device is not initialized. 233 * @param[in] device_id The device identifier. 234 * @param[out] device The device specific data. 235 * 236 * @return EOK on success. 237 * @return ENOENT if device is not found. 238 * @return EPERM if the device is not initialized. 239 * 232 240 */ 233 241 int find_device(device_id_t device_id, netif_device_t **device) … … 248 256 /** Clear the usage statistics. 249 257 * 250 * @param[in] stats The usage statistics. 258 * @param[in] stats The usage statistics. 259 * 251 260 */ 252 261 void null_device_stats(device_stats_ref stats) … … 257 266 /** Initialize the netif module. 258 267 * 259 * @param[in] client_connection The client connection functio to be registered. 260 * @return EOK on success. 261 * @return Other error codes as defined for each specific module 262 * message function. 268 * @param[in] client_connection The client connection functio to be 269 * registered. 270 * 271 * @return EOK on success. 272 * @return Other error codes as defined for each specific module 273 * message function. 274 * 263 275 */ 264 276 int netif_init_module(async_client_conn_t client_connection) … … 286 298 * Prepared for future optimization. 287 299 * 288 * @param[in] packet_id The packet identifier. 300 * @param[in] packet_id The packet identifier. 301 * 289 302 */ 290 303 void netif_pq_release(packet_id_t packet_id) … … 295 308 /** Allocate new packet to handle the given content size. 296 309 * 297 * @param[in] content The minimum content size. 298 * @return The allocated packet. 299 * @return NULL if there is an error. 310 * @param[in] content The minimum content size. 311 * 312 * @return The allocated packet. 313 * @return NULL if there is an error. 300 314 * 301 315 */ … … 305 319 } 306 320 307 /** Register the device notification receiver, the network interface layer 308 * module. 309 * 310 * @param[in] name Module name. 311 * @param[in] device_id The device identifier. 312 * @param[in] phone The network interface layer module phone. 313 * @return EOK on success. 314 * @return ENOENT if there is no such device. 315 * @return ELIMIT if there is another module registered. 321 /** Register the device notification receiver, the network interface layer module. 322 * 323 * @param[in] name Module name. 324 * @param[in] device_id The device identifier. 325 * @param[in] phone The network interface layer module phone. 326 * 327 * @return EOK on success. 328 * @return ENOENT if there is no such device. 329 * @return ELIMIT if there is another module registered. 330 * 316 331 */ 317 332 static int register_message(const char *name, device_id_t device_id, int phone) … … 332 347 /** Process the netif module messages. 333 348 * 334 * @param[in] nameModule name.335 * @param[in] callidThe message identifier.336 * @param[in] callThe message parameters.337 * @param[out] answer 338 * @param[out] answer_count The last parameter for the actual answer in the339 * 340 * @return EOK on success.341 * @return ENOTSUP if the message is not known.342 * @return Other error codes as defined for each specific module343 * 349 * @param[in] name Module name. 350 * @param[in] callid The message identifier. 351 * @param[in] call The message parameters. 352 * @param[out] answer The message answer parameters. 353 * @param[out] answer_count The last parameter for the actual answer 354 * in the answer parameter. 355 * 356 * @return EOK on success. 357 * @return ENOTSUP if the message is not known. 358 * @return Other error codes as defined for each specific module message function. 344 359 * 345 360 * @see IS_NET_NETIF_MESSAGE() … … 358 373 *answer_count = 0; 359 374 switch (IPC_GET_METHOD(*call)) { 360 case IPC_M_PHONE_HUNGUP: 361 return EOK; 362 363 case NET_NETIF_PROBE: 364 return netif_probe_req_local(0, IPC_GET_DEVICE(call), 365 NETIF_GET_IRQ(call), NETIF_GET_IO(call)); 366 367 case IPC_M_CONNECT_TO_ME: 368 fibril_rwlock_write_lock(&netif_globals.lock); 369 ERROR_CODE = register_message(name, IPC_GET_DEVICE(call), 370 IPC_GET_PHONE(call)); 371 fibril_rwlock_write_unlock(&netif_globals.lock); 372 return ERROR_CODE; 373 374 case NET_NETIF_SEND: 375 ERROR_PROPAGATE(packet_translate_remote(netif_globals.net_phone, 376 &packet, IPC_GET_PACKET(call))); 377 return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet, 378 IPC_GET_SENDER(call)); 379 380 case NET_NETIF_START: 381 return netif_start_req_local(0, IPC_GET_DEVICE(call)); 382 383 case NET_NETIF_STATS: 384 fibril_rwlock_read_lock(&netif_globals.lock); 385 386 if (ERROR_OCCURRED(async_data_read_receive(&callid, &length))) { 375 case IPC_M_PHONE_HUNGUP: 376 return EOK; 377 case NET_NETIF_PROBE: 378 return netif_probe_req_local(0, IPC_GET_DEVICE(call), 379 NETIF_GET_IRQ(call), NETIF_GET_IO(call)); 380 case IPC_M_CONNECT_TO_ME: 381 fibril_rwlock_write_lock(&netif_globals.lock); 382 ERROR_CODE = register_message(name, IPC_GET_DEVICE(call), 383 IPC_GET_PHONE(call)); 384 fibril_rwlock_write_unlock(&netif_globals.lock); 385 return ERROR_CODE; 386 case NET_NETIF_SEND: 387 ERROR_PROPAGATE(packet_translate_remote(netif_globals.net_phone, 388 &packet, IPC_GET_PACKET(call))); 389 return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet, 390 IPC_GET_SENDER(call)); 391 case NET_NETIF_START: 392 return netif_start_req_local(0, IPC_GET_DEVICE(call)); 393 case NET_NETIF_STATS: 394 fibril_rwlock_read_lock(&netif_globals.lock); 395 if (!ERROR_OCCURRED(async_data_read_receive(&callid, &length))) { 396 if (length < sizeof(device_stats_t)) 397 ERROR_CODE = EOVERFLOW; 398 else { 399 if (!ERROR_OCCURRED(netif_get_device_stats( 400 IPC_GET_DEVICE(call), &stats))) 401 ERROR_CODE = async_data_read_finalize(callid, &stats, 402 sizeof(device_stats_t)); 403 } 404 } 387 405 fibril_rwlock_read_unlock(&netif_globals.lock); 388 406 return ERROR_CODE; 389 } 390 if (length < sizeof(device_stats_t)) { 407 case NET_NETIF_STOP: 408 return netif_stop_req_local(0, IPC_GET_DEVICE(call)); 409 case NET_NETIF_GET_ADDR: 410 fibril_rwlock_read_lock(&netif_globals.lock); 411 if (!ERROR_OCCURRED(netif_get_addr_message(IPC_GET_DEVICE(call), 412 &address))) 413 ERROR_CODE = measured_strings_reply(&address, 1); 391 414 fibril_rwlock_read_unlock(&netif_globals.lock); 392 return EOVERFLOW; 393 } 394 395 if (ERROR_NONE(netif_get_device_stats(IPC_GET_DEVICE(call), 396 &stats))) { 397 ERROR_CODE = async_data_read_finalize(callid, &stats, 398 sizeof(device_stats_t)); 399 } 400 401 fibril_rwlock_read_unlock(&netif_globals.lock); 402 return ERROR_CODE; 403 404 case NET_NETIF_STOP: 405 return netif_stop_req_local(0, IPC_GET_DEVICE(call)); 406 407 case NET_NETIF_GET_ADDR: 408 fibril_rwlock_read_lock(&netif_globals.lock); 409 if (ERROR_NONE(netif_get_addr_message(IPC_GET_DEVICE(call), 410 &address))) 411 ERROR_CODE = measured_strings_reply(&address, 1); 412 fibril_rwlock_read_unlock(&netif_globals.lock); 413 return ERROR_CODE; 415 return ERROR_CODE; 414 416 } 415 417 … … 419 421 /** Start the network interface module. 420 422 * 421 * Initialize the client connection serving function, initialize the module, 422 * registers the module service and start the async manager, processing IPC 423 * messages in an infinite loop. 424 * 425 * @param[in] client_connection The client connection processing function. 426 * The module skeleton propagates its own one. 427 * @return EOK on success. 428 * @return Other error codes as defined for each specific module 429 * message function. 423 * Initialize the client connection serving function, initialize 424 * the module, registers the module service and start the async 425 * manager, processing IPC messages in an infinite loop. 426 * 427 * @param[in] client_connection The client connection processing 428 * function. The module skeleton propagates 429 * its own one. 430 * 431 * @return EOK on success. 432 * @return Other error codes as defined for each specific module message 433 * function. 434 * 430 435 */ 431 436 int netif_module_start_standalone(async_client_conn_t client_connection) -
uspace/lib/net/netif/netif_remote.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup netif 30 30 * @{ 31 31 */ … … 35 35 */ 36 36 37 #include <netif_remote.h>38 #include <packet_client.h>39 #include <generic.h>40 41 37 #include <ipc/services.h> 42 38 #include <ipc/netif.h> … … 45 41 #include <adt/measured_strings.h> 46 42 #include <net/packet.h> 43 #include <packet_client.h> 47 44 #include <net/device.h> 45 #include <netif_remote.h> 46 #include <generic.h> 48 47 49 /** Return the device local hardware address.50 *51 * @param[in] netif_phone The network interface phone.52 * @param[in] device_id The device identifier.53 * @param[out] address The device local hardware address.54 * @param[out] data The address data.55 * @return EOK on success.56 * @return EBADMEM if the address parameter is NULL.57 * @return ENOENT if there no such device.58 * @return Other error codes as defined for the59 * netif_get_addr_message() function.60 */61 48 int netif_get_addr_req_remote(int netif_phone, device_id_t device_id, 62 49 measured_string_ref *address, char **data) … … 66 53 } 67 54 68 /** Probe the existence of the device. 69 * 70 * @param[in] netif_phone The network interface phone. 71 * @param[in] device_id The device identifier. 72 * @param[in] irq The device interrupt number. 73 * @param[in] io The device input/output address. 74 * @return EOK on success. 75 * @return Other error codes as defined for the 76 * netif_probe_message(). 77 */ 78 int 79 netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io) 55 int netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io) 80 56 { 81 57 return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io); 82 58 } 83 59 84 /** Send the packet queue. 85 * 86 * @param[in] netif_phone The network interface phone. 87 * @param[in] device_id The device identifier. 88 * @param[in] packet The packet queue. 89 * @param[in] sender The sending module service. 90 * @return EOK on success. 91 * @return Other error codes as defined for the generic_send_msg() 92 * function. 93 */ 94 int 95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet, 60 int netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet, 96 61 services_t sender) 97 62 { … … 100 65 } 101 66 102 /** Start the device.103 *104 * @param[in] netif_phone The network interface phone.105 * @param[in] device_id The device identifier.106 * @return EOK on success.107 * @return Other error codes as defined for the find_device()108 * function.109 * @return Other error codes as defined for the110 * netif_start_message() function.111 */112 67 int netif_start_req_remote(int netif_phone, device_id_t device_id) 113 68 { … … 115 70 } 116 71 117 /** Stop the device.118 *119 * @param[in] netif_phone The network interface phone.120 * @param[in] device_id The device identifier.121 * @return EOK on success.122 * @return Other error codes as defined for the find_device()123 * function.124 * @return Other error codes as defined for the125 * netif_stop_message() function.126 */127 72 int netif_stop_req_remote(int netif_phone, device_id_t device_id) 128 73 { … … 130 75 } 131 76 132 /** Return the device usage statistics.133 *134 * @param[in] netif_phone The network interface phone.135 * @param[in] device_id The device identifier.136 * @param[out] stats The device usage statistics.137 * @return EOK on success.138 */139 77 int netif_stats_req_remote(int netif_phone, device_id_t device_id, 140 78 device_stats_ref stats) … … 161 99 * @param[in] receiver The message receiver. 162 100 * 163 * @return 164 * @return 165 * @return Other error codes as defined for the bind_service()166 * function.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 * 167 105 */ 168 int 169 netif_bind_service_remote(services_t service, device_id_t device_id, 170 services_t me, async_client_conn_t receiver) 106 int netif_bind_service_remote(services_t service, device_id_t device_id, services_t me, 107 async_client_conn_t receiver) 171 108 { 172 109 return bind_service(service, device_id, me, 0, receiver); -
uspace/lib/net/nil/nil_remote.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup net_nil 30 30 * @{ 31 31 */ … … 47 47 /** Notify the network interface layer about the device state change. 48 48 * 49 * @param[in] nil_phone The network interface layer phone. 50 * @param[in] device_id The device identifier. 51 * @param[in] state The new device state. 52 * @return EOK on success. 53 * @return Other error codes as defined for each specific module 54 * device state function. 49 * @param[in] nil_phone The network interface layer phone. 50 * @param[in] device_id The device identifier. 51 * @param[in] state The new device state. 52 * 53 * @return EOK on success. 54 * @return Other error codes as defined for each specific module device 55 * state function. 56 * 55 57 */ 56 58 int nil_device_state_msg_remote(int nil_phone, device_id_t device_id, int state) … … 65 67 * upper layers. 66 68 * 67 * @param[in] nil_phone The network interface layer phone. 68 * @param[in] device_id The source device identifier. 69 * @param[in] packet The received packet or the received packet queue. 70 * @param target The target service. Ignored parameter. 71 * @return EOK on success. 72 * @return Other error codes as defined for each specific module 73 * received function. 69 * @param[in] nil_phone The network interface layer phone. 70 * @param[in] device_id The source device identifier. 71 * @param[in] packet The received packet or the received packet queue. 72 * @param target The target service. Ignored parameter. 73 * 74 * @return EOK on success. 75 * @return Other error codes as defined for each specific module 76 * received function. 77 * 74 78 */ 75 79 int nil_received_msg_remote(int nil_phone, device_id_t device_id, 76 80 packet_t packet, services_t target) 77 81 { 78 return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED, 79 device_id,packet_get_id(packet), target, 0);82 return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED, device_id, 83 packet_get_id(packet), target, 0); 80 84 } 81 85 -
uspace/lib/net/tl/icmp_client.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup icmp 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP client interface implementation.35 * @see icmp_client.h34 * ICMP client interface implementation. 35 * @see icmp_client.h 36 36 */ 37 37 38 #include <icmp_client.h>39 #include <icmp_header.h>40 #include <packet_client.h>41 42 38 #ifdef CONFIG_DEBUG 43 #include <stdio.h>39 #include <stdio.h> 44 40 #endif 45 41 … … 48 44 49 45 #include <net/icmp_codes.h> 46 #include <icmp_client.h> 50 47 #include <net/packet.h> 48 #include <packet_client.h> 49 #include <icmp_header.h> 51 50 52 /** Processes the received packet prefixed with an ICMP header. 53 * 54 * @param[in] packet The received packet. 55 * @param[out] type The ICMP header type. 56 * @param[out] code The ICMP header code. 57 * @param[out] pointer The ICMP header pointer. 58 * @param[out] mtu The ICMP header MTU. 59 * @returns The ICMP header length. 60 * @returns Zero if the packet contains no data. 61 */ 62 int 63 icmp_client_process_packet(packet_t packet, icmp_type_t *type, 64 icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu) 65 { 51 int icmp_client_process_packet(packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu){ 66 52 icmp_header_ref header; 67 53 68 54 header = (icmp_header_ref) packet_get_data(packet); 69 if (!header ||70 (packet_get_data_length(packet) < sizeof(icmp_header_t))){55 if((! header) 56 || (packet_get_data_length(packet) < sizeof(icmp_header_t))){ 71 57 return 0; 72 58 } 73 74 if (type) 59 if(type){ 75 60 *type = header->type; 76 if (code) 61 } 62 if(code){ 77 63 *code = header->code; 78 if (pointer) 64 } 65 if(pointer){ 79 66 *pointer = header->un.param.pointer; 80 if (mtu) 67 } 68 if(mtu){ 81 69 *mtu = header->un.frag.mtu; 82 70 } 83 71 // remove debug dump 84 72 #ifdef CONFIG_DEBUG 85 printf("ICMP error %d (%d) in packet %d\n", header->type, header->code, 86 packet_get_id(packet)); 73 printf("ICMP error %d (%d) in packet %d\n", header->type, header->code, packet_get_id(packet)); 87 74 #endif 88 75 return sizeof(icmp_header_t); 89 76 } 90 77 91 /** Returns the ICMP header length. 92 * 93 * @param[in] packet The packet. 94 * @returns The ICMP header length in bytes. 95 */ 96 size_t icmp_client_header_length(packet_t packet) 97 { 98 if (packet_get_data_length(packet) < sizeof(icmp_header_t)) 78 size_t icmp_client_header_length(packet_t packet){ 79 if(packet_get_data_length(packet) < sizeof(icmp_header_t)){ 99 80 return 0; 100 81 } 101 82 return sizeof(icmp_header_t); 102 83 } -
uspace/lib/net/tl/icmp_remote.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet29 /** @addtogroup icmp 30 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * ICMP interface implementation for remote modules.35 * @see icmp_interface.h34 * ICMP interface implementation for remote modules. 35 * @see icmp_interface.h 36 36 */ 37 38 #include <icmp_interface.h>39 #include <net/modules.h>40 #include <packet_client.h>41 37 42 38 #include <async.h> … … 47 43 #include <sys/types.h> 48 44 49 /** Sends the Destination Unreachable error notification packet. 50 * 51 * Beginning of the packet is sent as the notification packet data. 52 * The source and the destination addresses should be set in the original 53 * packet. 54 * 55 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 56 * @param[in] code The error specific code. 57 * @param[in] mtu The error MTU value. 58 * @param[in] packet The original packet. 59 * @returns EOK on success. 60 * @returns EPERM if the ICMP error notifications are disabled. 61 * @returns ENOMEM if there is not enough memory left. 62 */ 63 int 64 icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, 65 icmp_param_t mtu, packet_t packet) 66 { 67 async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (ipcarg_t) code, 68 (ipcarg_t) packet_get_id(packet), (ipcarg_t) mtu); 45 #include <net/modules.h> 46 #include <icmp_interface.h> 47 #include <packet_client.h> 48 49 int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet){ 50 async_msg_3(icmp_phone, NET_ICMP_DEST_UNREACH, (ipcarg_t) code, (ipcarg_t) packet_get_id(packet), (ipcarg_t) mtu); 69 51 return EOK; 70 52 } 71 53 72 /** Sends the Source Quench error notification packet. 73 * 74 * Beginning of the packet is sent as the notification packet data. 75 * The source and the destination addresses should be set in the original 76 * packet. 77 * 78 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 79 * @param[in] packet The original packet. 80 * @returns EOK on success. 81 * @returns EPERM if the ICMP error notifications are disabled. 82 * @returns ENOMEM if there is not enough memory left. 83 */ 84 int icmp_source_quench_msg(int icmp_phone, packet_t packet) 85 { 86 async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, 87 (ipcarg_t) packet_get_id(packet)); 54 int icmp_source_quench_msg(int icmp_phone, packet_t packet){ 55 async_msg_2(icmp_phone, NET_ICMP_SOURCE_QUENCH, 0, (ipcarg_t) packet_get_id(packet)); 88 56 return EOK; 89 57 } 90 58 91 /** Sends the Time Exceeded error notification packet. 92 * 93 * Beginning of the packet is sent as the notification packet data. 94 * The source and the destination addresses should be set in the original 95 * packet. 96 * 97 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 98 * @param[in] code The error specific code. 99 * @param[in] packet The original packet. 100 * @returns EOK on success. 101 * @returns EPERM if the ICMP error notifications are disabled. 102 * @returns ENOMEM if there is not enough memory left. 103 */ 104 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet) 105 { 106 async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (ipcarg_t) code, 107 (ipcarg_t) packet_get_id(packet)); 59 int icmp_time_exceeded_msg(int icmp_phone, icmp_code_t code, packet_t packet){ 60 async_msg_2(icmp_phone, NET_ICMP_TIME_EXCEEDED, (ipcarg_t) code, (ipcarg_t) packet_get_id(packet)); 108 61 return EOK; 109 62 } 110 63 111 /** Sends the Parameter Problem error notification packet. 112 * 113 * Beginning of the packet is sent as the notification packet data. 114 * The source and the destination addresses should be set in the original 115 * packet. 116 * 117 * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls. 118 * @param[in] code The error specific code. 119 * @param[in] pointer The problematic parameter offset. 120 * @param[in] packet The original packet. 121 * @returns EOK on success. 122 * @returns EPERM if the ICMP error notifications are disabled. 123 * @returns ENOMEM if there is not enough memory left. 124 */ 125 int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, 126 icmp_param_t pointer, packet_t packet) 127 { 128 async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (ipcarg_t) code, 129 (ipcarg_t) packet_get_id(packet), (ipcarg_t) pointer); 64 int icmp_parameter_problem_msg(int icmp_phone, icmp_code_t code, icmp_param_t pointer, packet_t packet){ 65 async_msg_3(icmp_phone, NET_ICMP_PARAMETERPROB, (ipcarg_t) code, (ipcarg_t) packet_get_id(packet), (ipcarg_t) pointer); 130 66 return EOK; 131 67 } … … 133 69 /** @} 134 70 */ 135 -
uspace/lib/net/tl/tl_common.c
rdfda6a1 r33dbbd2 27 27 */ 28 28 29 /** @addtogroup libnet30 * @{29 /** @addtogroup net_tl 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Transport layer common functions implementation. 35 * @see tl_common.h 36 */ 37 38 #include <tl_common.h> 34 * Transport layer common functions implementation. 35 * @see tl_common.h 36 */ 37 38 #include <net/socket_codes.h> 39 #include <net/in.h> 40 #include <net/in6.h> 41 #include <net/inet.h> 42 #include <async.h> 43 #include <ipc/services.h> 44 #include <errno.h> 45 #include <err.h> 46 47 #include <net/packet.h> 39 48 #include <packet_client.h> 40 49 #include <packet_remote.h> 50 #include <net/device.h> 41 51 #include <icmp_interface.h> 42 52 #include <ip_remote.h> 43 53 #include <ip_interface.h> 44 54 #include <tl_interface.h> 45 46 #include <net/socket_codes.h> 47 #include <net/in.h> 48 #include <net/in6.h> 49 #include <net/inet.h> 50 #include <net/device.h> 51 #include <net/packet.h> 52 53 #include <async.h> 54 #include <ipc/services.h> 55 #include <errno.h> 56 #include <err.h> 55 #include <tl_common.h> 57 56 58 57 DEVICE_MAP_IMPLEMENT(packet_dimensions, packet_dimension_t); 59 58 60 /** Gets the address port.61 *62 * Supports AF_INET and AF_INET6 address families.63 *64 * @param[in,out] addr The address to be updated.65 * @param[in] addrlen The address length.66 * @param[out] port The set port.67 * @returns EOK on success.68 * @returns EINVAL if the address length does not match the address69 * family.70 * @returns EAFNOSUPPORT if the address family is not supported.71 */72 59 int 73 60 tl_get_address_port(const struct sockaddr *addr, int addrlen, uint16_t *port) … … 87 74 *port = ntohs(address_in->sin_port); 88 75 break; 89 90 76 case AF_INET6: 91 77 if (addrlen != sizeof(struct sockaddr_in6)) 92 return EINVAL;78 return EINVAL; 93 79 94 80 address_in6 = (struct sockaddr_in6 *) addr; 95 81 *port = ntohs(address_in6->sin6_port); 96 82 break; 97 98 83 default: 99 84 return EAFNOSUPPORT; … … 108 93 * The reply is cached then. 109 94 * 110 * @param[in] ip_phoneThe IP moduel phone for (semi)remote calls.111 * @param[in] packet_dimensions The packet dimensions cache.112 * @param[in] device_idThe device identifier.113 * @param[out] packet_dimension The IP packet dimensions.114 * @return EOK on success.115 * @return EBADMEM if the packet_dimension parameter is NULL.116 * @return ENOMEM if there is not enough memory left.117 * @return EINVAL if the packet_dimensions cache is not valid.118 * @return Other codes as defined for the ip_packet_size_req()119 * 120 * /121 int 122 tl_get_ip_packet_dimension(int ip_phone,95 * @param[in] ip_phone The IP moduel phone for (semi)remote calls. 96 * @param[in] packet_dimensions The packet dimensions cache. 97 * @param[in] device_id The device identifier. 98 * @param[out] packet_dimension The IP packet dimensions. 99 * 100 * @return EOK on success. 101 * @return EBADMEM if the packet_dimension parameter is NULL. 102 * @return ENOMEM if there is not enough memory left. 103 * @return EINVAL if the packet_dimensions cache is not valid. 104 * @return Other codes as defined for the ip_packet_size_req() function. 105 * 106 */ 107 int tl_get_ip_packet_dimension(int ip_phone, 123 108 packet_dimensions_ref packet_dimensions, device_id_t device_id, 124 109 packet_dimension_ref *packet_dimension) … … 154 139 } 155 140 156 /** Updates IP device packet dimensions cache.157 *158 * @param[in,out] packet_dimensions The packet dimensions cache.159 * @param[in] device_id The device identifier.160 * @param[in] content The new maximum content size.161 * @returns EOK on success.162 * @return ENOENT if the packet dimension is not cached.163 */164 141 int 165 142 tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions, … … 171 148 if (!packet_dimension) 172 149 return ENOENT; 173 174 150 packet_dimension->content = content; 175 151 … … 184 160 packet_dimensions_exclude(packet_dimensions, 185 161 DEVICE_INVALID_ID); 162 186 163 } 187 164 } … … 190 167 } 191 168 192 /** Sets the address port.193 *194 * Supports AF_INET and AF_INET6 address families.195 *196 * @param[in,out] addr The address to be updated.197 * @param[in] addrlen The address length.198 * @param[in] port The port to be set.199 * @returns EOK on success.200 * @returns EINVAL if the address length does not match the address201 * family.202 * @returns EAFNOSUPPORT if the address family is not supported.203 */204 169 int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port) 205 170 { … … 222 187 address_in->sin_port = htons(port); 223 188 return EOK; 224 225 189 case AF_INET6: 226 190 if (length != sizeof(struct sockaddr_in6)) … … 229 193 address_in6->sin6_port = htons(port); 230 194 return EOK; 231 232 195 default: 233 196 return EAFNOSUPPORT; … … 235 198 } 236 199 237 /** Prepares the packet for ICMP error notification.238 *239 * Keeps the first packet and releases all the others.240 * Releases all the packets on error.241 *242 * @param[in] packet_phone The packet server module phone.243 * @param[in] icmp_phone The ICMP module phone.244 * @param[in] packet The packet to be send.245 * @param[in] error The packet error reporting service. Prefixes the246 * received packet.247 * @returns EOK on success.248 * @returns ENOENT if no packet may be sent.249 */250 200 int 251 201 tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet, … … 273 223 } 274 224 275 /** Receives data from the socket into a packet.276 *277 * @param[in] packet_phone The packet server module phone.278 * @param[out] packet The new created packet.279 * @param[in] prefix Reserved packet data prefix length.280 * @param[in] dimension The packet dimension.281 * @param[in] addr The destination address.282 * @param[in] addrlen The address length.283 * @returns Number of bytes received.284 * @returns EINVAL if the client does not send data.285 * @returns ENOMEM if there is not enough memory left.286 * @returns Other error codes as defined for the287 * async_data_read_finalize() function.288 */289 225 int 290 226 tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix, -
uspace/srv/net/il/arp/arp_module.c
rdfda6a1 r33dbbd2 57 57 extern arp_globals_t arp_globals; 58 58 59 /** Processes the ARP message. 60 * @param[in] callid The message identifier. 61 * @param[in] call The message parameters. 62 * @param[out] answer The message answer parameters. 63 * @param[out] answer_count The last parameter for the actual answer in the answer parameter. 64 * @returns EOK on success. 65 * @returns Other error codes as defined for the arp_message() function. 66 */ 59 67 int il_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 60 68 return arp_message_standalone(callid, call, answer, answer_count); 61 69 } 62 70 71 /** Starts the ARP module. 72 * Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop. 73 * @param[in] client_connection The client connection processing function. The module skeleton propagates its own one. 74 * @returns EOK on successful module termination. 75 * @returns Other error codes as defined for the arp_initialize() function. 76 * @returns Other error codes as defined for the REGISTER_ME() macro function. 77 */ 63 78 int il_module_start_standalone(async_client_conn_t client_connection){ 64 79 ERROR_DECLARE; -
uspace/srv/net/il/ip/ip.c
rdfda6a1 r33dbbd2 67 67 #include <ip_client.h> 68 68 #include <ip_interface.h> 69 #include <ip_header.h>70 69 #include <net_interface.h> 71 70 #include <nil_interface.h> … … 78 77 79 78 #include "ip.h" 79 #include "ip_header.h" 80 80 #include "ip_module.h" 81 81 #include "ip_local.h" -
uspace/srv/net/il/ip/ip_module.c
rdfda6a1 r33dbbd2 56 56 extern ip_globals_t ip_globals; 57 57 58 /** Processes the IP message. 59 * @param[in] callid The message identifier. 60 * @param[in] call The message parameters. 61 * @param[out] answer The message answer parameters. 62 * @param[out] answer_count The last parameter for the actual answer in the answer parameter. 63 * @returns EOK on success. 64 * @returns Other error codes as defined for the ip_message() function. 65 */ 58 66 int il_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){ 59 67 return ip_message_standalone(callid, call, answer, answer_count); 60 68 } 61 69 70 /** Starts the IP module. 71 * Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop. 72 * @param[in] client_connection The client connection processing function. The module skeleton propagates its own one. 73 * @returns EOK on successful module termination. 74 * @returns Other error codes as defined for the ip_initialize() function. 75 * @returns Other error codes as defined for the REGISTER_ME() macro function. 76 */ 62 77 int il_module_start_standalone(async_client_conn_t client_connection){ 63 78 ERROR_DECLARE; -
uspace/srv/net/nil/eth/eth_module.c
rdfda6a1 r33dbbd2 50 50 #include "eth.h" 51 51 52 /** Starts the Ethernet module. 53 * Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop. 54 * @param[in] client_connection The client connection processing function. The module skeleton propagates its own one. 55 * @returns EOK on success. 56 * @returns Other error codes as defined for the pm_init() function. 57 * @returns Other error codes as defined for the nil_initialize() function. 58 * @returns Other error codes as defined for the REGISTER_ME() macro function. 59 */ 52 60 int nil_module_start_standalone(async_client_conn_t client_connection) 53 61 { … … 71 79 } 72 80 81 /** Pass the parameters to the module specific nil_message() function. 82 * 83 * @param[in] name Module name. 84 * @param[in] callid The message identifier. 85 * @param[in] call The message parameters. 86 * @param[out] answer The message answer parameters. 87 * @param[out] answer_count The last parameter for the actual answer 88 * in the answer parameter. 89 * 90 * @return EOK on success. 91 * @return ENOTSUP if the message is not known. 92 * @return Other error codes as defined for each 93 * specific module message function. 94 * 95 */ 73 96 int nil_module_message_standalone(const char *name, ipc_callid_t callid, ipc_call_t *call, 74 97 ipc_call_t *answer, int *answer_count) -
uspace/srv/net/nil/nildummy/nildummy_module.c
rdfda6a1 r33dbbd2 50 50 #include "nildummy.h" 51 51 52 /** Start the dummy nil module. 53 * 54 * Initialize the client connection serving function, initialize 55 * the module, register the module service and start the async 56 * manager, processing IPC messages in an infinite loop. 57 * 58 * @param[in] client_connection The client connection processing 59 * function. The module skeleton propagates 60 * its own one. 61 * 62 * @return EOK on success. 63 * @return Other error codes as defined for the pm_init() function. 64 * @return Other error codes as defined for the nil_initialize() function. 65 * @return Other error codes as defined for the REGISTER_ME() macro function. 66 * 67 */ 52 68 int nil_module_start_standalone(async_client_conn_t client_connection) 53 69 { … … 71 87 } 72 88 89 /** Pass the parameters to the module specific nil_message() function. 90 * 91 * @param[in] name Module name. 92 * @param[in] callid The message identifier. 93 * @param[in] call The message parameters. 94 * @param[out] answer The message answer parameters. 95 * @param[out] answer_count The last parameter for the actual answer 96 * in the answer parameter. 97 * 98 * @return EOK on success. 99 * @return ENOTSUP if the message is not known. 100 * @return Other error codes as defined for each specific 101 * module message function. 102 * 103 */ 73 104 int nil_module_message_standalone(const char *name, ipc_callid_t callid, 74 105 ipc_call_t *call, ipc_call_t *answer, int *answer_count)
Note:
See TracChangeset
for help on using the changeset viewer.