1 /* Copyright (C) 1991-1999, 2000, 2004, 2008 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 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 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, write to the Free 16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 17 02111-1307 USA. */ 18 19 /* Linux version. */ 20 21 #ifndef _NETINET_IN_H 22 # error "Never use <bits/in.h> directly; include <netinet/in.h> instead." 23 #endif 24 25 /* Options for use with `getsockopt' and `setsockopt' at the IP level. 26 The first word in the comment at the right is the data type used; 27 "bool" means a boolean value stored in an `int'. */ 28 #define IP_OPTIONS 4 /* ip_opts; IP per-packet options. */ 29 #define IP_HDRINCL 3 /* int; Header is included with data. */ 30 #define IP_TOS 1 /* int; IP type of service and precedence. */ 31 #define IP_TTL 2 /* int; IP time to live. */ 32 #define IP_RECVOPTS 6 /* bool; Receive all IP options w/datagram. */ 33 /* For BSD compatibility. */ 34 #define IP_RECVRETOPTS IP_RETOPTS /* bool; Receive IP options for response. */ 35 #define IP_RETOPTS 7 /* ip_opts; Set/get IP per-packet options. */ 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 #define IP_UNBLOCK_SOURCE 37 /* ip_mreq_source: unblock data from source */ 42 #define IP_BLOCK_SOURCE 38 /* ip_mreq_source: block data from source */ 43 #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */ 44 #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */ 45 #define IP_MSFILTER 41 46 #if defined __USE_MISC || defined __USE_GNU 47 # define MCAST_JOIN_GROUP 42 /* group_req: join any-source group */ 48 # define MCAST_BLOCK_SOURCE 43 /* group_source_req: block from given group */ 49 # define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/ 50 # define MCAST_LEAVE_GROUP 45 /* group_req: leave any-source group */ 51 # define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */ 52 # define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/ 53 # define MCAST_MSFILTER 48 54 55 # define MCAST_EXCLUDE 0 56 # define MCAST_INCLUDE 1 57 #endif 58 59 #define IP_ROUTER_ALERT 5 /* bool */ 60 #define IP_PKTINFO 8 /* bool */ 61 #define IP_PKTOPTIONS 9 62 #define IP_PMTUDISC 10 /* obsolete name? */ 63 #define IP_MTU_DISCOVER 10 /* int; see below */ 64 #define IP_RECVERR 11 /* bool */ 65 #define IP_RECVTTL 12 /* bool */ 66 #define IP_RECVTOS 13 /* bool */ 67 68 69 /* IP_MTU_DISCOVER arguments. */ 70 #define IP_PMTUDISC_DONT 0 /* Never send DF frames. */ 71 #define IP_PMTUDISC_WANT 1 /* Use per route hints. */ 72 #define IP_PMTUDISC_DO 2 /* Always DF. */ 73 74 /* To select the IP level. */ 75 #define SOL_IP 0 76 77 #define IP_DEFAULT_MULTICAST_TTL 1 78 #define IP_DEFAULT_MULTICAST_LOOP 1 79 #define IP_MAX_MEMBERSHIPS 20 80 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 91 /* Like `struct ip_mreq' but including interface specification by index. */ 92 struct ip_mreqn 93 { 94 struct in_addr imr_multiaddr; /* IP multicast address of group */ 95 struct in_addr imr_address; /* local IP address of interface */ 96 int imr_ifindex; /* Interface index */ 97 }; 98 99 /* Structure used for IP_PKTINFO. */ 100 struct in_pktinfo 101 { 102 int ipi_ifindex; /* Interface index */ 103 struct in_addr ipi_spec_dst; /* Routing destination address */ 104 struct in_addr ipi_addr; /* Header destination address */ 105 }; 106 #endif 107 108 /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level. 109 The first word in the comment at the right is the data type used; 110 "bool" means a boolean value stored in an `int'. */ 111 #define IPV6_ADDRFORM 1 112 #define IPV6_2292PKTINFO 2 113 #define IPV6_2292HOPOPTS 3 114 #define IPV6_2292DSTOPTS 4 115 #define IPV6_2292RTHDR 5 116 #define IPV6_2292PKTOPTIONS 6 117 #define IPV6_CHECKSUM 7 118 #define IPV6_2292HOPLIMIT 8 119 120 #define SCM_SRCRT IPV6_RXSRCRT 121 122 #define IPV6_NEXTHOP 9 123 #define IPV6_AUTHHDR 10 124 #define IPV6_UNICAST_HOPS 16 125 #define IPV6_MULTICAST_IF 17 126 #define IPV6_MULTICAST_HOPS 18 127 #define IPV6_MULTICAST_LOOP 19 128 #define IPV6_JOIN_GROUP 20 129 #define IPV6_LEAVE_GROUP 21 130 #define IPV6_ROUTER_ALERT 22 131 #define IPV6_MTU_DISCOVER 23 132 #define IPV6_MTU 24 133 #define IPV6_RECVERR 25 134 #define IPV6_V6ONLY 26 135 #define IPV6_JOIN_ANYCAST 27 136 #define IPV6_LEAVE_ANYCAST 28 137 #define IPV6_IPSEC_POLICY 34 138 #define IPV6_XFRM_POLICY 35 139 140 #define IPV6_RECVPKTINFO 49 141 #define IPV6_PKTINFO 50 142 #define IPV6_RECVHOPLIMIT 51 143 #define IPV6_HOPLIMIT 52 144 #define IPV6_RECVHOPOPTS 53 145 #define IPV6_HOPOPTS 54 146 #define IPV6_RTHDRDSTOPTS 55 147 #define IPV6_RECVRTHDR 56 148 #define IPV6_RTHDR 57 149 #define IPV6_RECVDSTOPTS 58 150 #define IPV6_DSTOPTS 59 151 152 #define IPV6_RECVTCLASS 66 153 #define IPV6_TCLASS 67 154 155 /* Obsolete synonyms for the above. */ 156 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP 157 #define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP 158 #define IPV6_RXHOPOPTS IPV6_HOPOPTS 159 #define IPV6_RXDSTOPTS IPV6_DSTOPTS 160 161 /* IPV6_MTU_DISCOVER values. */ 162 #define IPV6_PMTUDISC_DONT 0 /* Never send DF frames. */ 163 #define IPV6_PMTUDISC_WANT 1 /* Use per route hints. */ 164 #define IPV6_PMTUDISC_DO 2 /* Always DF. */ 165 166 /* Socket level values for IPv6. */ 167 #define SOL_IPV6 41 168 #define SOL_ICMPV6 58 169 170 /* Routing header options for IPv6. */ 171 #define IPV6_RTHDR_LOOSE 0 /* Hop doesn't need to be neighbour. */ 172 #define IPV6_RTHDR_STRICT 1 /* Hop must be a neighbour. */ 173 174 #define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0. */ 175