00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _NETINET_IN_H_
00036 #define _NETINET_IN_H_
00037
00038 #include <sys/cdefs.h>
00039
00040 #ifdef __SYMBIAN32__
00041 #include <sys/types.h>
00042 #else
00043 #include <sys/_types.h>
00044
00045 #endif
00046
00047 #include <machine/endian.h>
00048
00049
00050 #ifdef __SYMBIAN32__
00051 #define IPPROTO_IP 0x100
00052 #else
00053 #define IPPROTO_IP 0
00054
00055 #endif
00056 #define IPPROTO_ICMP 1
00057 #define IPPROTO_TCP 6
00058 #define IPPROTO_UDP 17
00059
00060 #define INADDR_ANY (u_int32_t)0x00000000
00061 #define INADDR_BROADCAST (u_int32_t)0xffffffff
00062
00063 #ifndef _UINT8_T_DECLARED
00064 typedef __uint8_t uint8_t;
00065 #define _UINT8_T_DECLARED
00066 #endif
00067
00068 #ifndef _UINT16_T_DECLARED
00069 typedef __uint16_t uint16_t;
00070 #define _UINT16_T_DECLARED
00071 #endif
00072
00073 #ifndef _UINT32_T_DECLARED
00074 typedef __uint32_t uint32_t;
00075 #define _UINT32_T_DECLARED
00076 #endif
00077
00078 #ifndef _IN_ADDR_T_DECLARED
00079 typedef uint32_t in_addr_t;
00080 #define _IN_ADDR_T_DECLARED
00081 #endif
00082
00083 #ifndef _IN_PORT_T_DECLARED
00084 typedef uint16_t in_port_t;
00085 #define _IN_PORT_T_DECLARED
00086 #endif
00087
00088 #ifndef _SA_FAMILY_T_DECLARED
00089 typedef __sa_family_t sa_family_t;
00090 #define _SA_FAMILY_T_DECLARED
00091 #endif
00092
00093
00094 #ifndef _STRUCT_IN_ADDR_DECLARED
00095 struct in_addr {
00096 in_addr_t s_addr;
00097 };
00098 #define _STRUCT_IN_ADDR_DECLARED
00099 #endif
00100
00101
00102 #ifdef __SYMBIAN32__
00103 struct sockaddr_in {
00104 u_short sin_family;
00105 u_short sin_port;
00106 struct in_addr sin_addr;
00107 char sin_zero[20];
00108 };
00109 #else
00110 struct sockaddr_in {
00111 uint8_t sin_len;
00112 sa_family_t sin_family;
00113 in_port_t sin_port;
00114 struct in_addr sin_addr;
00115 char sin_zero[8];
00116 };
00117
00118 #endif
00119
00120 #ifdef __SYMBIAN32__
00121 #define SOL_IP 0x100
00122 #define SOL_TCP 0x106
00123
00124
00125
00126
00127 #define TCP_NODELAY 0x304
00128 #define TCP_MAXSEG 0x303
00129
00130
00131 #endif
00132
00133 #ifndef _KERNEL
00134
00135 #ifndef _BYTEORDER_PROTOTYPED
00136 #define _BYTEORDER_PROTOTYPED
00137 __BEGIN_DECLS
00138 IMPORT_C uint32_t htonl(uint32_t);
00139 IMPORT_C uint16_t htons(uint16_t);
00140 uint32_t ntohl(uint32_t);
00141 uint16_t ntohs(uint16_t);
00142 __END_DECLS
00143 #endif
00144
00145 #ifndef _BYTEORDER_FUNC_DEFINED
00146 #define _BYTEORDER_FUNC_DEFINED
00147 #define htonl(x) __htonl(x)
00148 #define htons(x) __htons(x)
00149 #define ntohl(x) __ntohl(x)
00150 #define ntohs(x) __ntohs(x)
00151 #endif
00152
00153 #endif
00154
00155 #if __POSIX_VISIBLE >= 200112
00156 #define IPPROTO_RAW 255
00157 #define INET_ADDRSTRLEN 16
00158 #endif
00159
00160 #if __BSD_VISIBLE
00161
00162
00163
00164
00165
00166
00167
00168
00169 #define IPPROTO_HOPOPTS 0
00170 #define IPPROTO_IGMP 2
00171 #define IPPROTO_GGP 3
00172 #define IPPROTO_IPV4 4
00173 #define IPPROTO_IPIP IPPROTO_IPV4
00174 #define IPPROTO_ST 7
00175 #define IPPROTO_EGP 8
00176 #define IPPROTO_PIGP 9
00177 #define IPPROTO_RCCMON 10
00178 #define IPPROTO_NVPII 11
00179 #define IPPROTO_PUP 12
00180 #define IPPROTO_ARGUS 13
00181 #define IPPROTO_EMCON 14
00182 #define IPPROTO_XNET 15
00183 #define IPPROTO_CHAOS 16
00184 #define IPPROTO_MUX 18
00185 #define IPPROTO_MEAS 19
00186 #define IPPROTO_HMP 20
00187 #define IPPROTO_PRM 21
00188 #define IPPROTO_IDP 22
00189 #define IPPROTO_TRUNK1 23
00190 #define IPPROTO_TRUNK2 24
00191 #define IPPROTO_LEAF1 25
00192 #define IPPROTO_LEAF2 26
00193 #define IPPROTO_RDP 27
00194 #define IPPROTO_IRTP 28
00195 #define IPPROTO_TP 29
00196 #define IPPROTO_BLT 30
00197 #define IPPROTO_NSP 31
00198 #define IPPROTO_INP 32
00199 #define IPPROTO_SEP 33
00200 #define IPPROTO_3PC 34
00201 #define IPPROTO_IDPR 35
00202 #define IPPROTO_XTP 36
00203 #define IPPROTO_DDP 37
00204 #define IPPROTO_CMTP 38
00205 #define IPPROTO_TPXX 39
00206 #define IPPROTO_IL 40
00207 #define IPPROTO_IPV6 41
00208 #define IPPROTO_SDRP 42
00209 #define IPPROTO_ROUTING 43
00210 #define IPPROTO_FRAGMENT 44
00211 #define IPPROTO_IDRP 45
00212 #define IPPROTO_RSVP 46
00213 #define IPPROTO_GRE 47
00214 #define IPPROTO_MHRP 48
00215 #define IPPROTO_BHA 49
00216 #define IPPROTO_ESP 50
00217 #define IPPROTO_AH 51
00218 #define IPPROTO_INLSP 52
00219 #define IPPROTO_SWIPE 53
00220 #define IPPROTO_NHRP 54
00221 #define IPPROTO_MOBILE 55
00222 #define IPPROTO_TLSP 56
00223 #define IPPROTO_SKIP 57
00224 #define IPPROTO_ICMPV6 58
00225 #define IPPROTO_NONE 59
00226 #define IPPROTO_DSTOPTS 60
00227 #define IPPROTO_AHIP 61
00228 #define IPPROTO_CFTP 62
00229 #define IPPROTO_HELLO 63
00230 #define IPPROTO_SATEXPAK 64
00231 #define IPPROTO_KRYPTOLAN 65
00232 #define IPPROTO_RVD 66
00233 #define IPPROTO_IPPC 67
00234 #define IPPROTO_ADFS 68
00235 #define IPPROTO_SATMON 69
00236 #define IPPROTO_VISA 70
00237 #define IPPROTO_IPCV 71
00238 #define IPPROTO_CPNX 72
00239 #define IPPROTO_CPHB 73
00240 #define IPPROTO_WSN 74
00241 #define IPPROTO_PVP 75
00242 #define IPPROTO_BRSATMON 76
00243 #define IPPROTO_ND 77
00244 #define IPPROTO_WBMON 78
00245 #define IPPROTO_WBEXPAK 79
00246 #define IPPROTO_EON 80
00247 #define IPPROTO_VMTP 81
00248 #define IPPROTO_SVMTP 82
00249 #define IPPROTO_VINES 83
00250 #define IPPROTO_TTP 84
00251 #define IPPROTO_IGP 85
00252 #define IPPROTO_DGP 86
00253 #define IPPROTO_TCF 87
00254 #define IPPROTO_IGRP 88
00255 #define IPPROTO_OSPFIGP 89
00256 #define IPPROTO_SRPC 90
00257 #define IPPROTO_LARP 91
00258 #define IPPROTO_MTP 92
00259 #define IPPROTO_AX25 93
00260 #define IPPROTO_IPEIP 94
00261 #define IPPROTO_MICP 95
00262 #define IPPROTO_SCCSP 96
00263 #define IPPROTO_ETHERIP 97
00264 #ifdef __SYMBIAN32__
00265 #define IPPROTO_ENCAP 4
00266 #else
00267 #define IPPROTO_ENCAP 98
00268
00269 #endif
00270 #define IPPROTO_APES 99
00271 #define IPPROTO_GMTP 100
00272 #define IPPROTO_IPCOMP 108
00273
00274 #define IPPROTO_PIM 103
00275 #define IPPROTO_CARP 112
00276 #define IPPROTO_PGM 113
00277 #define IPPROTO_PFSYNC 240
00278
00279
00280 #define IPPROTO_OLD_DIVERT 254
00281 #ifdef __SYMBIAN32__
00282 #define IPPROTO_MAX 0x101
00283 #else
00284 #define IPPROTO_MAX 256
00285
00286 #endif
00287
00288
00289 #define IPPROTO_DONE 257
00290
00291
00292 #define IPPROTO_DIVERT 258
00293
00294
00295
00296
00297
00298 #define IPPROTO_SPACER 32767
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350 #define IPPORT_RESERVED 1024
00351
00352
00353
00354
00355
00356 #define IPPORT_HIFIRSTAUTO 49152
00357 #define IPPORT_HILASTAUTO 65535
00358
00359
00360
00361
00362
00363
00364
00365 #define IPPORT_RESERVEDSTART 600
00366
00367 #define IPPORT_MAX 65535
00368
00369
00370
00371
00372
00373
00374 #define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0)
00375 #define IN_CLASSA_NET 0xff000000
00376 #define IN_CLASSA_NSHIFT 24
00377 #define IN_CLASSA_HOST 0x00ffffff
00378 #define IN_CLASSA_MAX 128
00379
00380 #define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
00381 #define IN_CLASSB_NET 0xffff0000
00382 #define IN_CLASSB_NSHIFT 16
00383 #define IN_CLASSB_HOST 0x0000ffff
00384 #define IN_CLASSB_MAX 65536
00385
00386 #define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
00387 #define IN_CLASSC_NET 0xffffff00
00388 #define IN_CLASSC_NSHIFT 8
00389 #define IN_CLASSC_HOST 0x000000ff
00390
00391 #define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
00392 #define IN_CLASSD_NET 0xf0000000
00393 #define IN_CLASSD_NSHIFT 28
00394 #define IN_CLASSD_HOST 0x0fffffff
00395 #define IN_MULTICAST(i) IN_CLASSD(i)
00396
00397 #define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
00398 #define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
00399
00400 #define INADDR_LOOPBACK (u_int32_t)0x7f000001
00401 #ifndef _KERNEL
00402 #define INADDR_NONE 0xffffffff
00403 #endif
00404
00405 #define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000
00406 #define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001
00407 #define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002
00408 #define INADDR_CARP_GROUP (u_int32_t)0xe0000012
00409 #define INADDR_PFSYNC_GROUP (u_int32_t)0xe00000f0
00410 #define INADDR_ALLMDNS_GROUP (u_int32_t)0xe00000fb
00411 #define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff
00412
00413 #define IN_LOOPBACKNET 127
00414
00415
00416
00417
00418
00419 #ifdef __SYMBIAN32__
00420 #define IP_OPTIONS 0x306
00421 #else
00422 #define IP_OPTIONS 1
00423
00424 #endif
00425 #ifdef __SYMBIAN32__
00426 #define IP_HDRINCL 0x308
00427 #else
00428 #define IP_HDRINCL 2
00429
00430 #endif
00431 #ifdef __SYMBIAN32__
00432 #define IP_TOS 0x309
00433 #else
00434 #define IP_TOS 3
00435
00436 #endif
00437 #ifdef __SYMBIAN32__
00438 #define IP_TTL 0x310
00439 #else
00440 #define IP_TTL 4
00441
00442 #endif
00443 #ifdef __SYMBIAN32__
00444 #define IP_RECVOPTS -1
00445 #else
00446 #define IP_RECVOPTS 5
00447 #endif
00448 #ifdef __SYMBIAN32__
00449 #define IP_RECVRETOPTS -2
00450 #else
00451 #define IP_RECVRETOPTS 6
00452 #endif
00453 #ifdef __SYMBIAN32__
00454 #define IP_RECVDSTADDR -3
00455 #else
00456 #define IP_RECVDSTADDR 7
00457 #endif
00458 #define IP_SENDSRCADDR IP_RECVDSTADDR
00459 #ifdef __SYMBIAN32__
00460 #define IP_RETOPTS -4
00461 #else
00462 #define IP_RETOPTS 8
00463
00464 #endif
00465 #ifdef __SYMBIAN32__
00466 #define IP_MULTICAST_IF -5
00467 #else
00468 #define IP_MULTICAST_IF 9
00469
00470 #endif
00471 #ifdef __SYMBIAN32__
00472 #define IP_MULTICAST_TTL -6
00473 #else
00474 #define IP_MULTICAST_TTL 10
00475
00476 #endif
00477 #ifdef __SYMBIAN32__
00478 #define IP_MULTICAST_LOOP -7
00479 #else
00480 #define IP_MULTICAST_LOOP 11
00481
00482 #endif
00483 #ifdef __SYMBIAN32__
00484 #define IP_ADD_MEMBERSHIP 0x46d
00485 #else
00486 #define IP_ADD_MEMBERSHIP 12
00487
00488 #endif
00489 #ifdef __SYMBIAN32__
00490 #define IP_DROP_MEMBERSHIP 0x46e
00491 #else
00492 #define IP_DROP_MEMBERSHIP 13
00493
00494 #endif
00495 #define IP_MULTICAST_VIF 14
00496 #define IP_RSVP_ON 15
00497 #define IP_RSVP_OFF 16
00498 #define IP_RSVP_VIF_ON 17
00499 #define IP_RSVP_VIF_OFF 18
00500 #define IP_PORTRANGE 19
00501 #define IP_RECVIF 20
00502
00503 #define IP_IPSEC_POLICY 21
00504 #define IP_FAITH 22
00505
00506 #define IP_ONESBCAST 23
00507
00508 #define IP_FW_TABLE_ADD 40
00509 #define IP_FW_TABLE_DEL 41
00510 #define IP_FW_TABLE_FLUSH 42
00511 #define IP_FW_TABLE_GETSIZE 43
00512 #define IP_FW_TABLE_LIST 44
00513
00514 #define IP_FW_ADD 50
00515 #define IP_FW_DEL 51
00516 #define IP_FW_FLUSH 52
00517 #define IP_FW_ZERO 53
00518 #define IP_FW_GET 54
00519 #define IP_FW_RESETLOG 55
00520
00521 #define IP_DUMMYNET_CONFIGURE 60
00522 #define IP_DUMMYNET_DEL 61
00523 #define IP_DUMMYNET_FLUSH 62
00524 #define IP_DUMMYNET_GET 64
00525
00526 #define IP_RECVTTL 65
00527 #define IP_MINTTL 66
00528 #define IP_DONTFRAG 67
00529
00530
00531
00532
00533 #define IP_DEFAULT_MULTICAST_TTL 1
00534 #define IP_DEFAULT_MULTICAST_LOOP 1
00535 #define IP_MAX_MEMBERSHIPS 20
00536
00537
00538
00539
00540 struct ip_mreq {
00541 struct in_addr imr_multiaddr;
00542 struct in_addr imr_interface;
00543 };
00544
00545
00546
00547
00548
00549 #define IP_PORTRANGE_DEFAULT 0
00550 #define IP_PORTRANGE_HIGH 1
00551 #define IP_PORTRANGE_LOW 2
00552
00553
00554
00555
00556
00557
00558
00559 #define IPPROTO_MAXID (IPPROTO_AH + 1)
00560
00561 #define CTL_IPPROTO_NAMES { \
00562 { "ip", CTLTYPE_NODE }, \
00563 { "icmp", CTLTYPE_NODE }, \
00564 { "igmp", CTLTYPE_NODE }, \
00565 { "ggp", CTLTYPE_NODE }, \
00566 { 0, 0 }, \
00567 { 0, 0 }, \
00568 { "tcp", CTLTYPE_NODE }, \
00569 { 0, 0 }, \
00570 { "egp", CTLTYPE_NODE }, \
00571 { 0, 0 }, \
00572 { 0, 0 }, \
00573 { 0, 0 }, \
00574 { "pup", CTLTYPE_NODE }, \
00575 { 0, 0 }, \
00576 { 0, 0 }, \
00577 { 0, 0 }, \
00578 { 0, 0 }, \
00579 { "udp", CTLTYPE_NODE }, \
00580 { 0, 0 }, \
00581 { 0, 0 }, \
00582 { 0, 0 }, \
00583 { 0, 0 }, \
00584 { "idp", CTLTYPE_NODE }, \
00585 { 0, 0 }, \
00586 { 0, 0 }, \
00587 { 0, 0 }, \
00588 { 0, 0 }, \
00589 { 0, 0 }, \
00590 { 0, 0 }, \
00591 { 0, 0 }, \
00592 { 0, 0 }, \
00593 { 0, 0 }, \
00594 { 0, 0 }, \
00595 { 0, 0 }, \
00596 { 0, 0 }, \
00597 { 0, 0 }, \
00598 { 0, 0 }, \
00599 { 0, 0 }, \
00600 { 0, 0 }, \
00601 { 0, 0 }, \
00602 { 0, 0 }, \
00603 { 0, 0 }, \
00604 { 0, 0 }, \
00605 { 0, 0 }, \
00606 { 0, 0 }, \
00607 { 0, 0 }, \
00608 { 0, 0 }, \
00609 { 0, 0 }, \
00610 { 0, 0 }, \
00611 { 0, 0 }, \
00612 { 0, 0 }, \
00613 { "ipsec", CTLTYPE_NODE }, \
00614 { 0, 0 }, \
00615 { 0, 0 }, \
00616 { 0, 0 }, \
00617 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00618 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00619 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00620 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00621 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00622 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00623 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00624 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00625 { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
00626 { 0, 0 }, \
00627 { 0, 0 }, \
00628 { 0, 0 }, \
00629 { "pim", CTLTYPE_NODE }, \
00630 }
00631
00632
00633
00634
00635 #define IPCTL_FORWARDING 1
00636 #define IPCTL_SENDREDIRECTS 2
00637 #define IPCTL_DEFTTL 3
00638 #ifdef notyet
00639 #define IPCTL_DEFMTU 4
00640 #endif
00641 #define IPCTL_RTEXPIRE 5
00642 #define IPCTL_RTMINEXPIRE 6
00643 #define IPCTL_RTMAXCACHE 7
00644 #define IPCTL_SOURCEROUTE 8
00645 #define IPCTL_DIRECTEDBROADCAST 9
00646 #define IPCTL_INTRQMAXLEN 10
00647 #define IPCTL_INTRQDROPS 11
00648 #define IPCTL_STATS 12
00649 #define IPCTL_ACCEPTSOURCEROUTE 13
00650 #define IPCTL_FASTFORWARDING 14
00651 #define IPCTL_KEEPFAITH 15
00652 #define IPCTL_GIF_TTL 16
00653 #define IPCTL_MAXID 17
00654
00655 #define IPCTL_NAMES { \
00656 { 0, 0 }, \
00657 { "forwarding", CTLTYPE_INT }, \
00658 { "redirect", CTLTYPE_INT }, \
00659 { "ttl", CTLTYPE_INT }, \
00660 { "mtu", CTLTYPE_INT }, \
00661 { "rtexpire", CTLTYPE_INT }, \
00662 { "rtminexpire", CTLTYPE_INT }, \
00663 { "rtmaxcache", CTLTYPE_INT }, \
00664 { "sourceroute", CTLTYPE_INT }, \
00665 { "directed-broadcast", CTLTYPE_INT }, \
00666 { "intr-queue-maxlen", CTLTYPE_INT }, \
00667 { "intr-queue-drops", CTLTYPE_INT }, \
00668 { "stats", CTLTYPE_STRUCT }, \
00669 { "accept_sourceroute", CTLTYPE_INT }, \
00670 { "fastforwarding", CTLTYPE_INT }, \
00671 }
00672
00673 #endif
00674
00675 #ifdef _KERNEL
00676
00677 struct ifnet; struct mbuf;
00678
00679 char *inet_ntoa(struct in_addr);
00680
00681 #define in_hosteq(s, t) ((s).s_addr == (t).s_addr)
00682 #define in_nullhost(x) ((x).s_addr == INADDR_ANY)
00683
00684 #define satosin(sa) ((struct sockaddr_in *)(sa))
00685 #define sintosa(sin) ((struct sockaddr *)(sin))
00686 #define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
00687
00688 #endif
00689
00690
00691 #if __POSIX_VISIBLE >= 200112
00692 #define __KAME_NETINET_IN_H_INCLUDED_
00693 #include <netinet6/in6.h>
00694 #undef __KAME_NETINET_IN_H_INCLUDED_
00695 #endif
00696
00697 #ifndef _KERNEL
00698
00699 __BEGIN_DECLS
00700 IMPORT_C int bindresvport (int __sockfd, struct sockaddr_in *__sock_in);
00701 __END_DECLS
00702
00703 #endif
00704
00705 #endif