in.h 19 KB

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