in.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* Copyright (C) 1991-1999, 2000 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, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. /* Linux version. */
  16. #ifndef _NETINET_IN_H
  17. # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
  18. #endif
  19. /* Options for use with `getsockopt' and `setsockopt' at the IP level.
  20. The first word in the comment at the right is the data type used;
  21. "bool" means a boolean value stored in an `int'. */
  22. #define IP_TOS 1 /* int; IP type of service and precedence. */
  23. #define IP_TTL 2 /* int; IP time to live. */
  24. #define IP_HDRINCL 3 /* int; Header is included with data. */
  25. #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */
  26. #define IP_ROUTER_ALERT 5 /* bool */
  27. #define IP_RECVOPTS 6 /* bool */
  28. #define IP_RETOPTS 7 /* bool */
  29. #define IP_PKTINFO 8 /* bool */
  30. #define IP_PKTOPTIONS 9
  31. #define IP_PMTUDISC 10 /* obsolete name? */
  32. #define IP_MTU_DISCOVER 10 /* int; see below */
  33. #define IP_RECVERR 11 /* bool */
  34. #define IP_RECVTTL 12 /* bool */
  35. #define IP_RECVTOS 13 /* bool */
  36. #define IP_MULTICAST_IF 32 /* in_addr; set/get IP multicast i/f */
  37. #define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */
  38. #define IP_MULTICAST_LOOP 34 /* i_char; set/get IP multicast loopback */
  39. #define IP_ADD_MEMBERSHIP 35 /* ip_mreq; add an IP group membership */
  40. #define IP_DROP_MEMBERSHIP 36 /* ip_mreq; drop an IP group membership */
  41. /* For BSD compatibility. */
  42. #define IP_RECVRETOPTS IP_RETOPTS
  43. /* IP_MTU_DISCOVER arguments. */
  44. #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */
  45. #define IP_PMTUDISC_WANT 1 /* Use per route hints. */
  46. #define IP_PMTUDISC_DO 2 /* Always DF. */
  47. /* To select the IP level. */
  48. #define SOL_IP 0
  49. #define IP_DEFAULT_MULTICAST_TTL 1
  50. #define IP_DEFAULT_MULTICAST_LOOP 1
  51. #define IP_MAX_MEMBERSHIPS 20
  52. /* Structure used to describe IP options for IP_OPTIONS. The `ip_dst'
  53. field is used for the first-hop gateway when using a source route
  54. (this gets put into the header proper). */
  55. struct ip_opts
  56. {
  57. struct in_addr ip_dst; /* First hop; zero without source route. */
  58. char ip_opts[40]; /* Actually variable in size. */
  59. };
  60. /* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */
  61. struct ip_mreq
  62. {
  63. struct in_addr imr_multiaddr; /* IP multicast address of group */
  64. struct in_addr imr_interface; /* local IP address of interface */
  65. };
  66. /* As above but including interface specification by index. */
  67. struct ip_mreqn
  68. {
  69. struct in_addr imr_multiaddr; /* IP multicast address of group */
  70. struct in_addr imr_address; /* local IP address of interface */
  71. int imr_ifindex; /* Interface index */
  72. };
  73. /* Structure used for IP_PKTINFO. */
  74. struct in_pktinfo
  75. {
  76. int ipi_ifindex; /* Interface index */
  77. struct in_addr ipi_spec_dst; /* Routing destination address */
  78. struct in_addr ipi_addr; /* Header destination address */
  79. };
  80. /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
  81. The first word in the comment at the right is the data type used;
  82. "bool" means a boolean value stored in an `int'. */
  83. #define IPV6_ADDRFORM 1
  84. #define IPV6_PKTINFO 2
  85. #define IPV6_HOPOPTS 3
  86. #define IPV6_DSTOPTS 4
  87. #define IPV6_RTHDR 5
  88. #define IPV6_PKTOPTIONS 6
  89. #define IPV6_CHECKSUM 7
  90. #define IPV6_HOPLIMIT 8
  91. #define IPV6_NEXTHOP 9
  92. #define IPV6_AUTHHDR 10
  93. #define IPV6_UNICAST_HOPS 16
  94. #define IPV6_MULTICAST_IF 17
  95. #define IPV6_MULTICAST_HOPS 18
  96. #define IPV6_MULTICAST_LOOP 19
  97. #define IPV6_JOIN_GROUP 20
  98. #define IPV6_LEAVE_GROUP 21
  99. #define IPV6_ROUTER_ALERT 22
  100. #define IPV6_MTU_DISCOVER 23
  101. #define IPV6_MTU 24
  102. #define IPV6_RECVERR 25
  103. #define SCM_SRCRT IPV6_RXSRCRT
  104. /* Obsolete synonyms for the above. */
  105. #define IPV6_RXHOPOPTS IPV6_HOPOPTS
  106. #define IPV6_RXDSTOPTS IPV6_DSTOPTS
  107. #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
  108. #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
  109. /* IPV6_MTU_DISCOVER values. */
  110. #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */
  111. #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */
  112. #define IPV6_PMTUDISC_DO 2 /* Always DF. */
  113. /* Socket level values for IPv6. */
  114. #define SOL_IPV6 41
  115. #define SOL_ICMPV6 58
  116. /* Routing header options for IPv6. */
  117. #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */
  118. #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */
  119. #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */