in.h 19 KB

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