in.h 19 KB

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