in.h 19 KB

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