in.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* Copyright (C) 1991-2013 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. /* Linux version. */
  15. #ifndef _NETINET_IN_H
  16. # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
  17. #endif
  18. /* Options for use with `getsockopt' and `setsockopt' at the IP level.
  19. The first word in the comment at the right is the data type used;
  20. "bool" means a boolean value stored in an `int'. */
  21. #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */
  22. #define IP_HDRINCL 3 /* int; Header is included with data. */
  23. #define IP_TOS 1 /* int; IP type of service and precedence. */
  24. #define IP_TTL 2 /* int; IP time to live. */
  25. #define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */
  26. /* For BSD compatibility. */
  27. #define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */
  28. #define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */
  29. #define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */
  30. #define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */
  31. #define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */
  32. #define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */
  33. #define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */
  34. #define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */
  35. #define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */
  36. #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */
  37. #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */
  38. #define IP_MSFILTER 41
  39. #if defined __USE_MISC || defined __USE_GNU
  40. # define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */
  41. # define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */
  42. # define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/
  43. # define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */
  44. # define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */
  45. # define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/
  46. # define MCAST_MSFILTER 48
  47. # define IP_MULTICAST_ALL 49
  48. # define IP_UNICAST_IF 50
  49. # define MCAST_EXCLUDE 0
  50. # define MCAST_INCLUDE 1
  51. #endif
  52. #define IP_ROUTER_ALERT 5 /* bool */
  53. #define IP_PKTINFO 8 /* bool */
  54. #define IP_PKTOPTIONS 9
  55. #define IP_PMTUDISC 10 /* obsolete name? */
  56. #define IP_MTU_DISCOVER 10 /* int; see below */
  57. #define IP_RECVERR 11 /* bool */
  58. #define IP_RECVTTL 12 /* bool */
  59. #define IP_RECVTOS 13 /* bool */
  60. #define IP_MTU 14 /* int */
  61. #define IP_FREEBIND 15
  62. #define IP_IPSEC_POLICY 16
  63. #define IP_XFRM_POLICY 17
  64. #define IP_PASSSEC 18
  65. #define IP_TRANSPARENT 19
  66. #define IP_MULTICAST_ALL 49 /* bool */
  67. /* TProxy original addresses */
  68. #define IP_ORIGDSTADDR 20
  69. #define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
  70. #define IP_MINTTL 21
  71. /* IP_MTU_DISCOVER arguments. */
  72. #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */
  73. #define IP_PMTUDISC_WANT 1 /* Use per route hints. */
  74. #define IP_PMTUDISC_DO 2 /* Always DF. */
  75. #define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */
  76. /* To select the IP level. */
  77. #define SOL_IP 0
  78. #define IP_DEFAULT_MULTICAST_TTL 1
  79. #define IP_DEFAULT_MULTICAST_LOOP 1
  80. #define IP_MAX_MEMBERSHIPS 20
  81. #if defined __USE_MISC || defined __USE_GNU
  82. /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
  83. The `ip_dst' field is used for the first-hop gateway when using a
  84. source route (this gets put into the header proper). */
  85. struct ip_opts
  86. {
  87. struct in_addr ip_dst; /* First hop; zero without source route. */
  88. char ip_opts[40]; /* Actually variable in size. */
  89. };
  90. /* Like `struct ip_mreq' but including interface specification by index. */
  91. struct ip_mreqn
  92. {
  93. struct in_addr imr_multiaddr; /* IP multicast address of group */
  94. struct in_addr imr_address; /* local IP address of interface */
  95. int imr_ifindex; /* Interface index */
  96. };
  97. /* Structure used for IP_PKTINFO. */
  98. struct in_pktinfo
  99. {
  100. int ipi_ifindex; /* Interface index */
  101. struct in_addr ipi_spec_dst; /* Routing destination address */
  102. struct in_addr ipi_addr; /* Header destination address */
  103. };
  104. #endif
  105. #ifdef __UCLIBC_HAS_IPV6__
  106. /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
  107. The first word in the comment at the right is the data type used;
  108. "bool" means a boolean value stored in an `int'. */
  109. #define IPV6_ADDRFORM 1
  110. #define IPV6_2292PKTINFO 2
  111. #define IPV6_2292HOPOPTS 3
  112. #define IPV6_2292DSTOPTS 4
  113. #define IPV6_2292RTHDR 5
  114. #define IPV6_2292PKTOPTIONS 6
  115. #define IPV6_CHECKSUM 7
  116. #define IPV6_2292HOPLIMIT 8
  117. #define SCM_SRCRT IPV6_RXSRCRT
  118. #define IPV6_NEXTHOP 9
  119. #define IPV6_AUTHHDR 10
  120. #define IPV6_UNICAST_HOPS 16
  121. #define IPV6_MULTICAST_IF 17
  122. #define IPV6_MULTICAST_HOPS 18
  123. #define IPV6_MULTICAST_LOOP 19
  124. #define IPV6_JOIN_GROUP 20
  125. #define IPV6_LEAVE_GROUP 21
  126. #define IPV6_ROUTER_ALERT 22
  127. #define IPV6_MTU_DISCOVER 23
  128. #define IPV6_MTU 24
  129. #define IPV6_RECVERR 25
  130. #define IPV6_V6ONLY 26
  131. #define IPV6_JOIN_ANYCAST 27
  132. #define IPV6_LEAVE_ANYCAST 28
  133. #define IPV6_IPSEC_POLICY 34
  134. #define IPV6_XFRM_POLICY 35
  135. #define IPV6_RECVPKTINFO 49
  136. #define IPV6_PKTINFO 50
  137. #define IPV6_RECVHOPLIMIT 51
  138. #define IPV6_HOPLIMIT 52
  139. #define IPV6_RECVHOPOPTS 53
  140. #define IPV6_HOPOPTS 54
  141. #define IPV6_RTHDRDSTOPTS 55
  142. #define IPV6_RECVRTHDR 56
  143. #define IPV6_RTHDR 57
  144. #define IPV6_RECVDSTOPTS 58
  145. #define IPV6_DSTOPTS 59
  146. #define IPV6_RECVTCLASS 66
  147. #define IPV6_TCLASS 67
  148. /* Obsolete synonyms for the above. */
  149. #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
  150. #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
  151. #define IPV6_RXHOPOPTS IPV6_HOPOPTS
  152. #define IPV6_RXDSTOPTS IPV6_DSTOPTS
  153. /* IPV6_MTU_DISCOVER values. */
  154. #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */
  155. #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */
  156. #define IPV6_PMTUDISC_DO 2 /* Always DF. */
  157. #define IPV6_PMTUDISC_PROBE 3 /* Ignore dst pmtu. */
  158. /* Socket level values for IPv6. */
  159. #define SOL_IPV6 41
  160. #define SOL_ICMPV6 58
  161. /* Routing header options for IPv6. */
  162. #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */
  163. #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */
  164. #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */
  165. #endif /* __UCLIBC_HAS_IPV6__ */