in.h 18 KB

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