in.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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. /* 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. extern const struct in6_addr in6addr_any; /* :: */
  183. extern const struct in6_addr in6addr_loopback; /* ::1 */
  184. libc_hidden_proto(in6addr_loopback)
  185. #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
  186. #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
  187. #define INET_ADDRSTRLEN 16
  188. #define INET6_ADDRSTRLEN 46
  189. #if 1 /*def __UCLIBC_HAS_IPV4__*/
  190. /* Structure describing an Internet socket address. */
  191. struct sockaddr_in
  192. {
  193. __SOCKADDR_COMMON (sin_);
  194. in_port_t sin_port; /* Port number. */
  195. struct in_addr sin_addr; /* Internet address. */
  196. /* Pad to size of `struct sockaddr'. */
  197. unsigned char sin_zero[sizeof (struct sockaddr) -
  198. __SOCKADDR_COMMON_SIZE -
  199. sizeof (in_port_t) -
  200. sizeof (struct in_addr)];
  201. };
  202. #endif
  203. /* Ditto, for IPv6. */
  204. struct sockaddr_in6
  205. {
  206. __SOCKADDR_COMMON (sin6_);
  207. in_port_t sin6_port; /* Transport layer port # */
  208. uint32_t sin6_flowinfo; /* IPv6 flow information */
  209. struct in6_addr sin6_addr; /* IPv6 address */
  210. uint32_t sin6_scope_id; /* IPv6 scope-id */
  211. };
  212. #if defined __USE_MISC || defined __USE_GNU
  213. /* IPv4 multicast request. */
  214. struct ip_mreq
  215. {
  216. /* IP multicast address of group. */
  217. struct in_addr imr_multiaddr;
  218. /* Local IP address of interface. */
  219. struct in_addr imr_interface;
  220. };
  221. struct ip_mreq_source
  222. {
  223. /* IP multicast address of group. */
  224. struct in_addr imr_multiaddr;
  225. /* IP address of source. */
  226. struct in_addr imr_interface;
  227. /* IP address of interface. */
  228. struct in_addr imr_sourceaddr;
  229. };
  230. #endif
  231. /* Likewise, for IPv6. */
  232. struct ipv6_mreq
  233. {
  234. /* IPv6 multicast address of group */
  235. struct in6_addr ipv6mr_multiaddr;
  236. /* local interface */
  237. unsigned int ipv6mr_interface;
  238. };
  239. #if defined __USE_MISC || defined __USE_GNU
  240. /* Multicast group request. */
  241. struct group_req
  242. {
  243. /* Interface index. */
  244. uint32_t gr_interface;
  245. /* Group address. */
  246. struct sockaddr_storage gr_group;
  247. };
  248. struct group_source_req
  249. {
  250. /* Interface index. */
  251. uint32_t gsr_interface;
  252. /* Group address. */
  253. struct sockaddr_storage gsr_group;
  254. /* Source address. */
  255. struct sockaddr_storage gsr_source;
  256. };
  257. /* Full-state filter operations. */
  258. struct ip_msfilter
  259. {
  260. /* IP multicast address of group. */
  261. struct in_addr imsf_multiaddr;
  262. /* Local IP address of interface. */
  263. struct in_addr imsf_interface;
  264. /* Filter mode. */
  265. uint32_t imsf_fmode;
  266. /* Number of source addresses. */
  267. uint32_t imsf_numsrc;
  268. /* Source addresses. */
  269. struct in_addr imsf_slist[1];
  270. };
  271. #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
  272. - sizeof (struct in_addr) \
  273. + (numsrc) * sizeof (struct in_addr))
  274. struct group_filter
  275. {
  276. /* Interface index. */
  277. uint32_t gf_interface;
  278. /* Group address. */
  279. struct sockaddr_storage gf_group;
  280. /* Filter mode. */
  281. uint32_t gf_fmode;
  282. /* Number of source addresses. */
  283. uint32_t gf_numsrc;
  284. /* Source addresses. */
  285. struct sockaddr_storage gf_slist[1];
  286. };
  287. #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
  288. - sizeof (struct sockaddr_storage) \
  289. + ((numsrc) \
  290. * sizeof (struct sockaddr_storage)))
  291. #endif
  292. /* Get system-specific definitions. */
  293. #include <bits/in.h>
  294. /* Functions to convert between host and network byte order.
  295. Please note that these functions normally take `unsigned long int' or
  296. `unsigned short int' values as arguments and also return them. But
  297. this was a short-sighted decision since on different systems the types
  298. may have different representations but the values are always the same. */
  299. extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
  300. libc_hidden_proto(ntohl)
  301. extern uint16_t ntohs (uint16_t __netshort)
  302. __THROW __attribute__ ((__const__));
  303. libc_hidden_proto(ntohs)
  304. extern uint32_t htonl (uint32_t __hostlong)
  305. __THROW __attribute__ ((__const__));
  306. libc_hidden_proto(htonl)
  307. extern uint16_t htons (uint16_t __hostshort)
  308. __THROW __attribute__ ((__const__));
  309. libc_hidden_proto(htons)
  310. #include <endian.h>
  311. /* Get machine dependent optimized versions of byte swapping functions. */
  312. #include <bits/byteswap.h>
  313. #ifdef __OPTIMIZE__
  314. /* We can optimize calls to the conversion functions. Either nothing has
  315. to be done or we are using directly the byte-swapping functions which
  316. often can be inlined. */
  317. # if __BYTE_ORDER == __BIG_ENDIAN
  318. /* The host byte order is the same as network byte order,
  319. so these functions are all just identity. */
  320. # define ntohl(x) (x)
  321. # define ntohs(x) (x)
  322. # define htonl(x) (x)
  323. # define htons(x) (x)
  324. # else
  325. # if __BYTE_ORDER == __LITTLE_ENDIAN
  326. # define ntohl(x) __bswap_32 (x)
  327. # define ntohs(x) __bswap_16 (x)
  328. # define htonl(x) __bswap_32 (x)
  329. # define htons(x) __bswap_16 (x)
  330. # endif
  331. # endif
  332. #endif
  333. #define IN6_IS_ADDR_UNSPECIFIED(a) \
  334. (((__const uint32_t *) (a))[0] == 0 \
  335. && ((__const uint32_t *) (a))[1] == 0 \
  336. && ((__const uint32_t *) (a))[2] == 0 \
  337. && ((__const uint32_t *) (a))[3] == 0)
  338. #define IN6_IS_ADDR_LOOPBACK(a) \
  339. (((__const uint32_t *) (a))[0] == 0 \
  340. && ((__const uint32_t *) (a))[1] == 0 \
  341. && ((__const uint32_t *) (a))[2] == 0 \
  342. && ((__const uint32_t *) (a))[3] == htonl (1))
  343. #define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
  344. #define IN6_IS_ADDR_LINKLOCAL(a) \
  345. ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
  346. == htonl (0xfe800000))
  347. #define IN6_IS_ADDR_SITELOCAL(a) \
  348. ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
  349. == htonl (0xfec00000))
  350. #define IN6_IS_ADDR_V4MAPPED(a) \
  351. ((((__const uint32_t *) (a))[0] == 0) \
  352. && (((__const uint32_t *) (a))[1] == 0) \
  353. && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
  354. #define IN6_IS_ADDR_V4COMPAT(a) \
  355. ((((__const uint32_t *) (a))[0] == 0) \
  356. && (((__const uint32_t *) (a))[1] == 0) \
  357. && (((__const uint32_t *) (a))[2] == 0) \
  358. && (ntohl (((__const uint32_t *) (a))[3]) > 1))
  359. #define IN6_ARE_ADDR_EQUAL(a,b) \
  360. ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
  361. && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
  362. && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
  363. && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
  364. #if defined __USE_MISC || defined __USE_GNU
  365. /* Bind socket to a privileged IP port. */
  366. extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
  367. libc_hidden_proto(bindresvport)
  368. # if 0 /*def __UCLIBC_HAS_IPV6__*/
  369. /* The IPv6 version of this function. */
  370. extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
  371. __THROW;
  372. # endif
  373. #endif
  374. #define IN6_IS_ADDR_MC_NODELOCAL(a) \
  375. (IN6_IS_ADDR_MULTICAST(a) \
  376. && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
  377. #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
  378. (IN6_IS_ADDR_MULTICAST(a) \
  379. && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
  380. #define IN6_IS_ADDR_MC_SITELOCAL(a) \
  381. (IN6_IS_ADDR_MULTICAST(a) \
  382. && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
  383. #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
  384. (IN6_IS_ADDR_MULTICAST(a) \
  385. && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
  386. #define IN6_IS_ADDR_MC_GLOBAL(a) \
  387. (IN6_IS_ADDR_MULTICAST(a) \
  388. && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
  389. #if defined __USE_GNU && defined __UCLIBC_HAS_IPV6__
  390. /* IPv6 packet information. */
  391. struct in6_pktinfo
  392. {
  393. struct in6_addr ipi6_addr; /* src/dst IPv6 address */
  394. unsigned int ipi6_ifindex; /* send/recv interface index */
  395. };
  396. /* IPv6 MTU information. */
  397. struct ip6_mtuinfo
  398. {
  399. struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
  400. uint32_t ip6m_mtu; /* path MTU in host byte order */
  401. };
  402. #endif
  403. #if 0 /*def __USE_GNU*/
  404. /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
  405. extern int inet6_option_space (int __nbytes)
  406. __THROW __attribute_deprecated__;
  407. extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
  408. int __type) __THROW __attribute_deprecated__;
  409. extern int inet6_option_append (struct cmsghdr *__cmsg,
  410. __const uint8_t *__typep, int __multx,
  411. int __plusy) __THROW __attribute_deprecated__;
  412. extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
  413. int __multx, int __plusy)
  414. __THROW __attribute_deprecated__;
  415. extern int inet6_option_next (__const struct cmsghdr *__cmsg,
  416. uint8_t **__tptrp)
  417. __THROW __attribute_deprecated__;
  418. extern int inet6_option_find (__const struct cmsghdr *__cmsg,
  419. uint8_t **__tptrp, int __type)
  420. __THROW __attribute_deprecated__;
  421. /* Hop-by-Hop and Destination Options Processing (RFC 3542). */
  422. extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
  423. extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
  424. uint8_t __type, socklen_t __len, uint8_t __align,
  425. void **__databufp) __THROW;
  426. extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
  427. __THROW;
  428. extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
  429. socklen_t __vallen) __THROW;
  430. extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
  431. uint8_t *__typep, socklen_t *__lenp,
  432. void **__databufp) __THROW;
  433. extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
  434. uint8_t __type, socklen_t *__lenp,
  435. void **__databufp) __THROW;
  436. extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
  437. socklen_t __vallen) __THROW;
  438. /* Routing Header Option (RFC 3542). */
  439. extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
  440. extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
  441. int __segments) __THROW;
  442. extern int inet6_rth_add (void *__bp, __const struct in6_addr *__addr) __THROW;
  443. extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW;
  444. extern int inet6_rth_segments (__const void *__bp) __THROW;
  445. extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index)
  446. __THROW;
  447. /* Multicast source filter support. */
  448. /* Get IPv4 source filter. */
  449. extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
  450. struct in_addr __group, uint32_t *__fmode,
  451. uint32_t *__numsrc, struct in_addr *__slist)
  452. __THROW;
  453. /* Set IPv4 source filter. */
  454. extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
  455. struct in_addr __group, uint32_t __fmode,
  456. uint32_t __numsrc,
  457. __const struct in_addr *__slist)
  458. __THROW;
  459. /* Get source filter. */
  460. extern int getsourcefilter (int __s, uint32_t __interface_addr,
  461. __const struct sockaddr *__group,
  462. socklen_t __grouplen, uint32_t *__fmode,
  463. uint32_t *__numsrc,
  464. struct sockaddr_storage *__slist) __THROW;
  465. /* Set source filter. */
  466. extern int setsourcefilter (int __s, uint32_t __interface_addr,
  467. __const struct sockaddr *__group,
  468. socklen_t __grouplen, uint32_t __fmode,
  469. uint32_t __numsrc,
  470. __const struct sockaddr_storage *__slist) __THROW;
  471. #endif /* use GNU */
  472. __END_DECLS
  473. #endif /* netinet/in.h */