in.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008
  2. Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _NETINET_IN_H
  16. #define _NETINET_IN_H 1
  17. #include <features.h>
  18. #include <stdint.h>
  19. #include <sys/socket.h>
  20. #include <bits/types.h>
  21. __BEGIN_DECLS
  22. /* Standard well-defined IP protocols. */
  23. enum
  24. {
  25. IPPROTO_IP = 0, /* Dummy protocol for TCP. */
  26. #define IPPROTO_IP IPPROTO_IP
  27. IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
  28. #define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
  29. IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
  30. #define IPPROTO_ICMP IPPROTO_ICMP
  31. IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */
  32. #define IPPROTO_IGMP IPPROTO_IGMP
  33. IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94). */
  34. #define IPPROTO_IPIP IPPROTO_IPIP
  35. IPPROTO_TCP = 6, /* Transmission Control Protocol. */
  36. #define IPPROTO_TCP IPPROTO_TCP
  37. IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */
  38. #define IPPROTO_EGP IPPROTO_EGP
  39. IPPROTO_PUP = 12, /* PUP protocol. */
  40. #define IPPROTO_PUP IPPROTO_PUP
  41. IPPROTO_UDP = 17, /* User Datagram Protocol. */
  42. #define IPPROTO_UDP IPPROTO_UDP
  43. IPPROTO_IDP = 22, /* XNS IDP protocol. */
  44. #define IPPROTO_IDP IPPROTO_IDP
  45. IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */
  46. #define IPPROTO_TP IPPROTO_TP
  47. IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol. */
  48. #define IPPROTO_DCCP IPPROTO_DCCP
  49. IPPROTO_IPV6 = 41, /* IPv6 header. */
  50. #define IPPROTO_IPV6 IPPROTO_IPV6
  51. IPPROTO_ROUTING = 43, /* IPv6 routing header. */
  52. #define IPPROTO_ROUTING IPPROTO_ROUTING
  53. IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
  54. #define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
  55. IPPROTO_RSVP = 46, /* Reservation Protocol. */
  56. #define IPPROTO_RSVP IPPROTO_RSVP
  57. IPPROTO_GRE = 47, /* General Routing Encapsulation. */
  58. #define IPPROTO_GRE IPPROTO_GRE
  59. IPPROTO_ESP = 50, /* encapsulating security payload. */
  60. #define IPPROTO_ESP IPPROTO_ESP
  61. IPPROTO_AH = 51, /* authentication header. */
  62. #define IPPROTO_AH IPPROTO_AH
  63. IPPROTO_ICMPV6 = 58, /* ICMPv6. */
  64. #define IPPROTO_ICMPV6 IPPROTO_ICMPV6
  65. IPPROTO_NONE = 59, /* IPv6 no next header. */
  66. #define IPPROTO_NONE IPPROTO_NONE
  67. IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
  68. #define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
  69. IPPROTO_MTP = 92, /* Multicast Transport Protocol. */
  70. #define IPPROTO_MTP IPPROTO_MTP
  71. IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */
  72. #define IPPROTO_BEETPH IPPROTO_BEETPH
  73. IPPROTO_ENCAP = 98, /* Encapsulation Header. */
  74. #define IPPROTO_ENCAP IPPROTO_ENCAP
  75. IPPROTO_PIM = 103, /* Protocol Independent Multicast. */
  76. #define IPPROTO_PIM IPPROTO_PIM
  77. IPPROTO_COMP = 108, /* Compression Header Protocol. */
  78. #define IPPROTO_COMP IPPROTO_COMP
  79. IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */
  80. #define IPPROTO_SCTP IPPROTO_SCTP
  81. IPPROTO_MH = 135, /* IPv6 mobility header. */
  82. #define IPPROTO_MH IPPROTO_MH
  83. IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */
  84. #define IPPROTO_UDPLITE IPPROTO_UDPLITE
  85. IPPROTO_MPLS = 137, /* MPLS in IP. */
  86. #define IPPROTO_MPLS IPPROTO_MPLS
  87. IPPROTO_ETHERNET = 143, /* Ethernet-within-IPv6 Encapsulation. */
  88. #define IPPROTO_ETHERNET IPPROTO_ETHERNET
  89. IPPROTO_RAW = 255, /* Raw IP packets. */
  90. #define IPPROTO_RAW IPPROTO_RAW
  91. IPPROTO_SMC = 256, /* Shared Memory Communications. */
  92. #define IPPROTO_SMC IPPROTO_SMC
  93. IPPROTO_MPTCP = 262, /* Multipath TCP connection. */
  94. #define IPPROTO_MPTCP IPPROTO_MPTCP
  95. IPPROTO_MAX
  96. };
  97. /* Type to represent a port. */
  98. typedef uint16_t in_port_t;
  99. /* Standard well-known ports. */
  100. enum
  101. {
  102. IPPORT_ECHO = 7, /* Echo service. */
  103. IPPORT_DISCARD = 9, /* Discard transmissions service. */
  104. IPPORT_SYSTAT = 11, /* System status service. */
  105. IPPORT_DAYTIME = 13, /* Time of day service. */
  106. IPPORT_NETSTAT = 15, /* Network status service. */
  107. IPPORT_FTP = 21, /* File Transfer Protocol. */
  108. IPPORT_TELNET = 23, /* Telnet protocol. */
  109. IPPORT_SMTP = 25, /* Simple Mail Transfer Protocol. */
  110. IPPORT_TIMESERVER = 37, /* Timeserver service. */
  111. IPPORT_NAMESERVER = 42, /* Domain Name Service. */
  112. IPPORT_WHOIS = 43, /* Internet Whois service. */
  113. IPPORT_MTP = 57,
  114. IPPORT_TFTP = 69, /* Trivial File Transfer Protocol. */
  115. IPPORT_RJE = 77,
  116. IPPORT_FINGER = 79, /* Finger service. */
  117. IPPORT_TTYLINK = 87,
  118. IPPORT_SUPDUP = 95, /* SUPDUP protocol. */
  119. IPPORT_EXECSERVER = 512, /* execd service. */
  120. IPPORT_LOGINSERVER = 513, /* rlogind service. */
  121. IPPORT_CMDSERVER = 514,
  122. IPPORT_EFSSERVER = 520,
  123. /* UDP ports. */
  124. IPPORT_BIFFUDP = 512,
  125. IPPORT_WHOSERVER = 513,
  126. IPPORT_ROUTESERVER = 520,
  127. /* Ports less than this value are reserved for privileged processes. */
  128. IPPORT_RESERVED = 1024,
  129. /* Ports greater this value are reserved for (non-privileged) servers. */
  130. IPPORT_USERRESERVED = 5000
  131. };
  132. /* Internet address. */
  133. typedef uint32_t in_addr_t;
  134. struct in_addr
  135. {
  136. in_addr_t s_addr;
  137. };
  138. /* Definitions of the bits in an Internet address integer.
  139. On subnets, host and network parts are found according to
  140. the subnet mask, not these masks. */
  141. #define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
  142. #define IN_CLASSA_NET 0xff000000
  143. #define IN_CLASSA_NSHIFT 24
  144. #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
  145. #define IN_CLASSA_MAX 128
  146. #define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
  147. #define IN_CLASSB_NET 0xffff0000
  148. #define IN_CLASSB_NSHIFT 16
  149. #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
  150. #define IN_CLASSB_MAX 65536
  151. #define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
  152. #define IN_CLASSC_NET 0xffffff00
  153. #define IN_CLASSC_NSHIFT 8
  154. #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
  155. #define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
  156. #define IN_MULTICAST(a) IN_CLASSD(a)
  157. #define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
  158. #define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
  159. /* Address to accept any incoming messages. */
  160. #define INADDR_ANY ((in_addr_t) 0x00000000)
  161. /* Address to send to all hosts. */
  162. #define INADDR_BROADCAST ((in_addr_t) 0xffffffff)
  163. /* Address indicating an error return. */
  164. #define INADDR_NONE ((in_addr_t) 0xffffffff)
  165. /* Network number for local host loopback. */
  166. #define IN_LOOPBACKNET 127
  167. /* Address to loopback in software to local host. */
  168. #ifndef INADDR_LOOPBACK
  169. # define INADDR_LOOPBACK ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1. */
  170. #endif
  171. /* Defines for Multicast INADDR. */
  172. #define INADDR_UNSPEC_GROUP ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
  173. #define INADDR_ALLHOSTS_GROUP ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
  174. #define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
  175. #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
  176. #if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
  177. /* IPv6 address */
  178. struct in6_addr
  179. {
  180. union
  181. {
  182. uint8_t __u6_addr8[16];
  183. #if defined __USE_MISC || defined __USE_GNU
  184. uint16_t __u6_addr16[8];
  185. uint32_t __u6_addr32[4];
  186. #endif
  187. } __in6_u;
  188. #define s6_addr __in6_u.__u6_addr8
  189. #if defined __USE_MISC || defined __USE_GNU
  190. # define s6_addr16 __in6_u.__u6_addr16
  191. # define s6_addr32 __in6_u.__u6_addr32
  192. #endif
  193. };
  194. #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
  195. #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
  196. #define INET6_ADDRSTRLEN 46
  197. #endif
  198. #ifdef __UCLIBC_HAS_IPV6__
  199. extern const struct in6_addr in6addr_any; /* :: */
  200. extern const struct in6_addr in6addr_loopback; /* ::1 */
  201. libc_hidden_proto(in6addr_loopback)
  202. #endif
  203. #define INET_ADDRSTRLEN 16
  204. #if 1 /*def __UCLIBC_HAS_IPV4__*/
  205. /* Structure describing an Internet socket address. */
  206. struct sockaddr_in
  207. {
  208. __SOCKADDR_COMMON (sin_);
  209. in_port_t sin_port; /* Port number. */
  210. struct in_addr sin_addr; /* Internet address. */
  211. /* Pad to size of `struct sockaddr'. */
  212. unsigned char sin_zero[sizeof (struct sockaddr) -
  213. __SOCKADDR_COMMON_SIZE -
  214. sizeof (in_port_t) -
  215. sizeof (struct in_addr)];
  216. };
  217. #endif
  218. #if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
  219. /* Ditto, for IPv6. */
  220. struct sockaddr_in6
  221. {
  222. __SOCKADDR_COMMON (sin6_);
  223. in_port_t sin6_port; /* Transport layer port # */
  224. uint32_t sin6_flowinfo; /* IPv6 flow information */
  225. struct in6_addr sin6_addr; /* IPv6 address */
  226. uint32_t sin6_scope_id; /* IPv6 scope-id */
  227. };
  228. #endif
  229. #if defined __USE_MISC || defined __USE_GNU
  230. /* IPv4 multicast request. */
  231. struct ip_mreq
  232. {
  233. /* IP multicast address of group. */
  234. struct in_addr imr_multiaddr;
  235. /* Local IP address of interface. */
  236. struct in_addr imr_interface;
  237. };
  238. struct ip_mreq_source
  239. {
  240. /* IP multicast address of group. */
  241. struct in_addr imr_multiaddr;
  242. /* IP address of source. */
  243. struct in_addr imr_interface;
  244. /* IP address of interface. */
  245. struct in_addr imr_sourceaddr;
  246. };
  247. #endif
  248. #if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
  249. /* Likewise, for IPv6. */
  250. struct ipv6_mreq
  251. {
  252. /* IPv6 multicast address of group */
  253. struct in6_addr ipv6mr_multiaddr;
  254. /* local interface */
  255. unsigned int ipv6mr_interface;
  256. };
  257. #endif
  258. #if defined __USE_MISC || defined __USE_GNU
  259. /* Multicast group request. */
  260. struct group_req
  261. {
  262. /* Interface index. */
  263. uint32_t gr_interface;
  264. /* Group address. */
  265. struct sockaddr_storage gr_group;
  266. };
  267. struct group_source_req
  268. {
  269. /* Interface index. */
  270. uint32_t gsr_interface;
  271. /* Group address. */
  272. struct sockaddr_storage gsr_group;
  273. /* Source address. */
  274. struct sockaddr_storage gsr_source;
  275. };
  276. /* Full-state filter operations. */
  277. struct ip_msfilter
  278. {
  279. /* IP multicast address of group. */
  280. struct in_addr imsf_multiaddr;
  281. /* Local IP address of interface. */
  282. struct in_addr imsf_interface;
  283. /* Filter mode. */
  284. uint32_t imsf_fmode;
  285. /* Number of source addresses. */
  286. uint32_t imsf_numsrc;
  287. /* Source addresses. */
  288. struct in_addr imsf_slist[1];
  289. };
  290. #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
  291. - sizeof (struct in_addr) \
  292. + (numsrc) * sizeof (struct in_addr))
  293. struct group_filter
  294. {
  295. /* Interface index. */
  296. uint32_t gf_interface;
  297. /* Group address. */
  298. struct sockaddr_storage gf_group;
  299. /* Filter mode. */
  300. uint32_t gf_fmode;
  301. /* Number of source addresses. */
  302. uint32_t gf_numsrc;
  303. /* Source addresses. */
  304. struct sockaddr_storage gf_slist[1];
  305. };
  306. #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
  307. - sizeof (struct sockaddr_storage) \
  308. + ((numsrc) \
  309. * sizeof (struct sockaddr_storage)))
  310. #endif
  311. /* Get system-specific definitions. */
  312. #include <bits/in.h>
  313. /* Functions to convert between host and network byte order.
  314. Please note that these functions normally take `unsigned long int' or
  315. `unsigned short int' values as arguments and also return them. But
  316. this was a short-sighted decision since on different systems the types
  317. may have different representations but the values are always the same. */
  318. extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
  319. libc_hidden_proto(ntohl)
  320. extern uint16_t ntohs (uint16_t __netshort)
  321. __THROW __attribute__ ((__const__));
  322. libc_hidden_proto(ntohs)
  323. extern uint32_t htonl (uint32_t __hostlong)
  324. __THROW __attribute__ ((__const__));
  325. libc_hidden_proto(htonl)
  326. extern uint16_t htons (uint16_t __hostshort)
  327. __THROW __attribute__ ((__const__));
  328. libc_hidden_proto(htons)
  329. #include <endian.h>
  330. /* Get machine dependent optimized versions of byte swapping functions. */
  331. #include <bits/byteswap.h>
  332. #ifdef __OPTIMIZE__
  333. /* We can optimize calls to the conversion functions. Either nothing has
  334. to be done or we are using directly the byte-swapping functions which
  335. often can be inlined. */
  336. # if __BYTE_ORDER == __BIG_ENDIAN
  337. /* The host byte order is the same as network byte order,
  338. so these functions are all just identity. */
  339. # define ntohl(x) (x)
  340. # define ntohs(x) (x)
  341. # define htonl(x) (x)
  342. # define htons(x) (x)
  343. # else
  344. # if __BYTE_ORDER == __LITTLE_ENDIAN
  345. # define ntohl(x) __bswap_32 (x)
  346. # define ntohs(x) __bswap_16 (x)
  347. # define htonl(x) __bswap_32 (x)
  348. # define htons(x) __bswap_16 (x)
  349. # endif
  350. # endif
  351. #endif
  352. #if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
  353. #define IN6_IS_ADDR_UNSPECIFIED(a) \
  354. (((const uint32_t *) (a))[0] == 0 \
  355. && ((const uint32_t *) (a))[1] == 0 \
  356. && ((const uint32_t *) (a))[2] == 0 \
  357. && ((const uint32_t *) (a))[3] == 0)
  358. #define IN6_IS_ADDR_LOOPBACK(a) \
  359. (((const uint32_t *) (a))[0] == 0 \
  360. && ((const uint32_t *) (a))[1] == 0 \
  361. && ((const uint32_t *) (a))[2] == 0 \
  362. && ((const uint32_t *) (a))[3] == htonl (1))
  363. #define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff)
  364. #define IN6_IS_ADDR_LINKLOCAL(a) \
  365. ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
  366. == htonl (0xfe800000))
  367. #define IN6_IS_ADDR_SITELOCAL(a) \
  368. ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
  369. == htonl (0xfec00000))
  370. #define IN6_IS_ADDR_V4MAPPED(a) \
  371. ((((const uint32_t *) (a))[0] == 0) \
  372. && (((const uint32_t *) (a))[1] == 0) \
  373. && (((const uint32_t *) (a))[2] == htonl (0xffff)))
  374. #define IN6_IS_ADDR_V4COMPAT(a) \
  375. ((((const uint32_t *) (a))[0] == 0) \
  376. && (((const uint32_t *) (a))[1] == 0) \
  377. && (((const uint32_t *) (a))[2] == 0) \
  378. && (ntohl (((const uint32_t *) (a))[3]) > 1))
  379. #define IN6_ARE_ADDR_EQUAL(a,b) \
  380. ((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) \
  381. && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) \
  382. && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) \
  383. && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
  384. #endif
  385. #if defined __USE_MISC || defined __USE_GNU
  386. /* Bind socket to a privileged IP port. */
  387. extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
  388. libc_hidden_proto(bindresvport)
  389. # if 0 /*def __UCLIBC_HAS_IPV6__*/
  390. /* The IPv6 version of this function. */
  391. extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
  392. __THROW;
  393. # endif
  394. #endif
  395. #if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
  396. #define IN6_IS_ADDR_MC_NODELOCAL(a) \
  397. (IN6_IS_ADDR_MULTICAST(a) \
  398. && ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
  399. #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
  400. (IN6_IS_ADDR_MULTICAST(a) \
  401. && ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
  402. #define IN6_IS_ADDR_MC_SITELOCAL(a) \
  403. (IN6_IS_ADDR_MULTICAST(a) \
  404. && ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
  405. #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
  406. (IN6_IS_ADDR_MULTICAST(a) \
  407. && ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
  408. #define IN6_IS_ADDR_MC_GLOBAL(a) \
  409. (IN6_IS_ADDR_MULTICAST(a) \
  410. && ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
  411. #endif
  412. #ifdef __USE_GNU
  413. # if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
  414. /* IPv6 packet information. */
  415. struct in6_pktinfo
  416. {
  417. struct in6_addr ipi6_addr; /* src/dst IPv6 address */
  418. unsigned int ipi6_ifindex; /* send/recv interface index */
  419. };
  420. /* IPv6 MTU information. */
  421. struct ip6_mtuinfo
  422. {
  423. struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
  424. uint32_t ip6m_mtu; /* path MTU in host byte order */
  425. };
  426. # if 0
  427. /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
  428. extern int inet6_option_space (int __nbytes)
  429. __THROW __attribute_deprecated__;
  430. extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
  431. int __type) __THROW __attribute_deprecated__;
  432. extern int inet6_option_append (struct cmsghdr *__cmsg,
  433. const uint8_t *__typep, int __multx,
  434. int __plusy) __THROW __attribute_deprecated__;
  435. extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
  436. int __multx, int __plusy)
  437. __THROW __attribute_deprecated__;
  438. extern int inet6_option_next (const struct cmsghdr *__cmsg,
  439. uint8_t **__tptrp)
  440. __THROW __attribute_deprecated__;
  441. extern int inet6_option_find (const struct cmsghdr *__cmsg,
  442. uint8_t **__tptrp, int __type)
  443. __THROW __attribute_deprecated__;
  444. /* Hop-by-Hop and Destination Options Processing (RFC 3542). */
  445. extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
  446. extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
  447. uint8_t __type, socklen_t __len, uint8_t __align,
  448. void **__databufp) __THROW;
  449. extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
  450. __THROW;
  451. extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
  452. socklen_t __vallen) __THROW;
  453. extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
  454. uint8_t *__typep, socklen_t *__lenp,
  455. void **__databufp) __THROW;
  456. extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
  457. uint8_t __type, socklen_t *__lenp,
  458. void **__databufp) __THROW;
  459. extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
  460. socklen_t __vallen) __THROW;
  461. /* Routing Header Option (RFC 3542). */
  462. extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
  463. extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
  464. int __segments) __THROW;
  465. extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW;
  466. extern int inet6_rth_reverse (const void *__in, void *__out) __THROW;
  467. extern int inet6_rth_segments (const void *__bp) __THROW;
  468. extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index)
  469. __THROW;
  470. # endif
  471. # endif
  472. # if 0
  473. /* Multicast source filter support. */
  474. /* Get IPv4 source filter. */
  475. extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
  476. struct in_addr __group, uint32_t *__fmode,
  477. uint32_t *__numsrc, struct in_addr *__slist)
  478. __THROW;
  479. /* Set IPv4 source filter. */
  480. extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
  481. struct in_addr __group, uint32_t __fmode,
  482. uint32_t __numsrc,
  483. const struct in_addr *__slist)
  484. __THROW;
  485. /* Get source filter. */
  486. extern int getsourcefilter (int __s, uint32_t __interface_addr,
  487. const struct sockaddr *__group,
  488. socklen_t __grouplen, uint32_t *__fmode,
  489. uint32_t *__numsrc,
  490. struct sockaddr_storage *__slist) __THROW;
  491. /* Set source filter. */
  492. extern int setsourcefilter (int __s, uint32_t __interface_addr,
  493. const struct sockaddr *__group,
  494. socklen_t __grouplen, uint32_t __fmode,
  495. uint32_t __numsrc,
  496. const struct sockaddr_storage *__slist) __THROW;
  497. # endif
  498. #endif /* use GNU */
  499. __END_DECLS
  500. #endif /* netinet/in.h */