Back to index

glibc  2.9
in.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991-1999, 2000, 2004, 2008 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /* Linux version.  */
00020 
00021 #ifndef _NETINET_IN_H
00022 # error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
00023 #endif
00024 
00025 /* Options for use with `getsockopt' and `setsockopt' at the IP level.
00026    The first word in the comment at the right is the data type used;
00027    "bool" means a boolean value stored in an `int'.  */
00028 #define        IP_OPTIONS      4       /* ip_opts; IP per-packet options.  */
00029 #define        IP_HDRINCL      3       /* int; Header is included with data.  */
00030 #define        IP_TOS          1       /* int; IP type of service and precedence.  */
00031 #define        IP_TTL          2       /* int; IP time to live.  */
00032 #define        IP_RECVOPTS     6       /* bool; Receive all IP options w/datagram.  */
00033 /* For BSD compatibility.  */
00034 #define        IP_RECVRETOPTS  IP_RETOPTS       /* bool; Receive IP options for response.  */
00035 #define        IP_RETOPTS      7       /* ip_opts; Set/get IP per-packet options.  */
00036 #define IP_MULTICAST_IF 32  /* in_addr; set/get IP multicast i/f */
00037 #define IP_MULTICAST_TTL 33 /* u_char; set/get IP multicast ttl */
00038 #define IP_MULTICAST_LOOP 34       /* i_char; set/get IP multicast loopback */
00039 #define IP_ADD_MEMBERSHIP 35       /* ip_mreq; add an IP group membership */
00040 #define IP_DROP_MEMBERSHIP 36      /* ip_mreq; drop an IP group membership */
00041 #define IP_UNBLOCK_SOURCE 37       /* ip_mreq_source: unblock data from source */
00042 #define IP_BLOCK_SOURCE 38  /* ip_mreq_source: block data from source */
00043 #define IP_ADD_SOURCE_MEMBERSHIP 39 /* ip_mreq_source: join source group */
00044 #define IP_DROP_SOURCE_MEMBERSHIP 40 /* ip_mreq_source: leave source group */
00045 #define IP_MSFILTER 41
00046 #if defined __USE_MISC || defined __USE_GNU
00047 # define MCAST_JOIN_GROUP 42       /* group_req: join any-source group */
00048 # define MCAST_BLOCK_SOURCE 43     /* group_source_req: block from given group */
00049 # define MCAST_UNBLOCK_SOURCE 44 /* group_source_req: unblock from given group*/
00050 # define MCAST_LEAVE_GROUP 45      /* group_req: leave any-source group */
00051 # define MCAST_JOIN_SOURCE_GROUP 46 /* group_source_req: join source-spec gr */
00052 # define MCAST_LEAVE_SOURCE_GROUP 47 /* group_source_req: leave source-spec gr*/
00053 # define MCAST_MSFILTER 48
00054 
00055 # define MCAST_EXCLUDE   0
00056 # define MCAST_INCLUDE   1
00057 #endif
00058 
00059 #define IP_ROUTER_ALERT    5       /* bool */
00060 #define IP_PKTINFO         8       /* bool */
00061 #define IP_PKTOPTIONS      9
00062 #define IP_PMTUDISC        10      /* obsolete name? */
00063 #define IP_MTU_DISCOVER    10      /* int; see below */
00064 #define IP_RECVERR         11      /* bool */
00065 #define IP_RECVTTL         12      /* bool */
00066 #define IP_RECVTOS         13      /* bool */
00067 
00068 
00069 /* IP_MTU_DISCOVER arguments.  */
00070 #define IP_PMTUDISC_DONT   0       /* Never send DF frames.  */
00071 #define IP_PMTUDISC_WANT   1       /* Use per route hints.  */
00072 #define IP_PMTUDISC_DO     2       /* Always DF.  */
00073 #define IP_PMTUDISC_PROBE  3       /* Ignore dst pmtu.  */
00074 
00075 /* To select the IP level.  */
00076 #define SOL_IP       0
00077 
00078 #define IP_DEFAULT_MULTICAST_TTL        1
00079 #define IP_DEFAULT_MULTICAST_LOOP       1
00080 #define IP_MAX_MEMBERSHIPS              20
00081 
00082 #if defined __USE_MISC || defined __USE_GNU
00083 /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS.
00084    The `ip_dst' field is used for the first-hop gateway when using a
00085    source route (this gets put into the header proper).  */
00086 struct ip_opts
00087   {
00088     struct in_addr ip_dst;  /* First hop; zero without source route.  */
00089     char ip_opts[40];              /* Actually variable in size.  */
00090   };
00091 
00092 /* Like `struct ip_mreq' but including interface specification by index.  */
00093 struct ip_mreqn
00094   {
00095     struct in_addr imr_multiaddr;  /* IP multicast address of group */
00096     struct in_addr imr_address;           /* local IP address of interface */
00097     int       imr_ifindex;                /* Interface index */
00098   };
00099 
00100 /* Structure used for IP_PKTINFO.  */
00101 struct in_pktinfo
00102   {
00103     int ipi_ifindex;               /* Interface index  */
00104     struct in_addr ipi_spec_dst;   /* Routing destination address  */
00105     struct in_addr ipi_addr;              /* Header destination address  */
00106   };
00107 #endif
00108 
00109 /* Options for use with `getsockopt' and `setsockopt' at the IPv6 level.
00110    The first word in the comment at the right is the data type used;
00111    "bool" means a boolean value stored in an `int'.  */
00112 #define IPV6_ADDRFORM              1
00113 #define IPV6_2292PKTINFO    2
00114 #define IPV6_2292HOPOPTS    3
00115 #define IPV6_2292DSTOPTS    4
00116 #define IPV6_2292RTHDR             5
00117 #define IPV6_2292PKTOPTIONS 6
00118 #define IPV6_CHECKSUM              7
00119 #define IPV6_2292HOPLIMIT   8
00120 
00121 #define SCM_SRCRT           IPV6_RXSRCRT
00122 
00123 #define IPV6_NEXTHOP        9
00124 #define IPV6_AUTHHDR        10
00125 #define IPV6_UNICAST_HOPS   16
00126 #define IPV6_MULTICAST_IF   17
00127 #define IPV6_MULTICAST_HOPS 18
00128 #define IPV6_MULTICAST_LOOP 19
00129 #define IPV6_JOIN_GROUP            20
00130 #define IPV6_LEAVE_GROUP    21
00131 #define IPV6_ROUTER_ALERT   22
00132 #define IPV6_MTU_DISCOVER   23
00133 #define IPV6_MTU            24
00134 #define IPV6_RECVERR        25
00135 #define IPV6_V6ONLY         26
00136 #define IPV6_JOIN_ANYCAST   27
00137 #define IPV6_LEAVE_ANYCAST  28
00138 #define IPV6_IPSEC_POLICY   34
00139 #define IPV6_XFRM_POLICY    35
00140 
00141 #define IPV6_RECVPKTINFO    49
00142 #define IPV6_PKTINFO        50
00143 #define IPV6_RECVHOPLIMIT   51
00144 #define IPV6_HOPLIMIT              52
00145 #define IPV6_RECVHOPOPTS    53
00146 #define IPV6_HOPOPTS        54
00147 #define IPV6_RTHDRDSTOPTS   55
00148 #define IPV6_RECVRTHDR             56
00149 #define IPV6_RTHDR          57
00150 #define IPV6_RECVDSTOPTS    58
00151 #define IPV6_DSTOPTS        59
00152 
00153 #define IPV6_RECVTCLASS            66
00154 #define IPV6_TCLASS         67
00155 
00156 /* Obsolete synonyms for the above.  */
00157 #define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
00158 #define IPV6_DROP_MEMBERSHIP       IPV6_LEAVE_GROUP
00159 #define IPV6_RXHOPOPTS             IPV6_HOPOPTS
00160 #define IPV6_RXDSTOPTS             IPV6_DSTOPTS
00161 
00162 /* IPV6_MTU_DISCOVER values.  */
00163 #define IPV6_PMTUDISC_DONT  0      /* Never send DF frames.  */
00164 #define IPV6_PMTUDISC_WANT  1      /* Use per route hints.  */
00165 #define IPV6_PMTUDISC_DO    2      /* Always DF.  */
00166 #define IPV6_PMTUDISC_PROBE 3      /* Ignore dst pmtu.  */
00167 
00168 /* Socket level values for IPv6.  */
00169 #define SOL_IPV6        41
00170 #define SOL_ICMPV6      58
00171 
00172 /* Routing header options for IPv6.  */
00173 #define IPV6_RTHDR_LOOSE    0      /* Hop doesn't need to be neighbour. */
00174 #define IPV6_RTHDR_STRICT   1      /* Hop must be a neighbour.  */
00175 
00176 #define IPV6_RTHDR_TYPE_0   0      /* IPv6 Routing header type 0.  */