1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef _LINUX_IN_H
13#define _LINUX_IN_H
14
15#include <linux/types.h>
16#include <linux/socket.h>
17
18enum {
19 IPPROTO_IP = 0,
20 IPPROTO_ICMP = 1,
21 IPPROTO_IGMP = 2,
22 IPPROTO_IPIP = 4,
23 IPPROTO_TCP = 6,
24 IPPROTO_EGP = 8,
25 IPPROTO_PUP = 12,
26 IPPROTO_UDP = 17,
27 IPPROTO_IDP = 22,
28 IPPROTO_DCCP = 33,
29 IPPROTO_RSVP = 46,
30 IPPROTO_GRE = 47,
31
32 IPPROTO_IPV6 = 41,
33
34 IPPROTO_ESP = 50,
35 IPPROTO_AH = 51,
36 IPPROTO_PIM = 103,
37
38 IPPROTO_COMP = 108,
39 IPPROTO_SCTP = 132,
40
41 IPPROTO_RAW = 255,
42 IPPROTO_MAX
43};
44
45struct in_addr {
46 __u32 s_addr;
47};
48
49#define IP_TOS 1
50#define IP_TTL 2
51#define IP_HDRINCL 3
52#define IP_OPTIONS 4
53#define IP_ROUTER_ALERT 5
54#define IP_RECVOPTS 6
55#define IP_RETOPTS 7
56#define IP_PKTINFO 8
57#define IP_PKTOPTIONS 9
58#define IP_MTU_DISCOVER 10
59#define IP_RECVERR 11
60#define IP_RECVTTL 12
61#define IP_RECVTOS 13
62#define IP_MTU 14
63#define IP_FREEBIND 15
64#define IP_IPSEC_POLICY 16
65#define IP_XFRM_POLICY 17
66#define IP_PASSSEC 18
67
68#define IP_RECVRETOPTS IP_RETOPTS
69
70#define IP_PMTUDISC_DONT 0
71#define IP_PMTUDISC_WANT 1
72#define IP_PMTUDISC_DO 2
73
74#define IP_MULTICAST_IF 32
75#define IP_MULTICAST_TTL 33
76#define IP_MULTICAST_LOOP 34
77#define IP_ADD_MEMBERSHIP 35
78#define IP_DROP_MEMBERSHIP 36
79#define IP_UNBLOCK_SOURCE 37
80#define IP_BLOCK_SOURCE 38
81#define IP_ADD_SOURCE_MEMBERSHIP 39
82#define IP_DROP_SOURCE_MEMBERSHIP 40
83#define IP_MSFILTER 41
84#define MCAST_JOIN_GROUP 42
85#define MCAST_BLOCK_SOURCE 43
86#define MCAST_UNBLOCK_SOURCE 44
87#define MCAST_LEAVE_GROUP 45
88#define MCAST_JOIN_SOURCE_GROUP 46
89#define MCAST_LEAVE_SOURCE_GROUP 47
90#define MCAST_MSFILTER 48
91
92#define MCAST_EXCLUDE 0
93#define MCAST_INCLUDE 1
94
95#define IP_DEFAULT_MULTICAST_TTL 1
96#define IP_DEFAULT_MULTICAST_LOOP 1
97
98struct ip_mreq
99{
100 struct in_addr imr_multiaddr;
101 struct in_addr imr_interface;
102};
103
104struct ip_mreqn
105{
106 struct in_addr imr_multiaddr;
107 struct in_addr imr_address;
108 int imr_ifindex;
109};
110
111struct ip_mreq_source {
112 __u32 imr_multiaddr;
113 __u32 imr_interface;
114 __u32 imr_sourceaddr;
115};
116
117struct ip_msfilter {
118 __u32 imsf_multiaddr;
119 __u32 imsf_interface;
120 __u32 imsf_fmode;
121 __u32 imsf_numsrc;
122 __u32 imsf_slist[1];
123};
124
125#define IP_MSFILTER_SIZE(numsrc)   (sizeof(struct ip_msfilter) - sizeof(__u32)   + (numsrc) * sizeof(__u32))
126
127struct group_req
128{
129 __u32 gr_interface;
130 struct __kernel_sockaddr_storage gr_group;
131};
132
133struct group_source_req
134{
135 __u32 gsr_interface;
136 struct __kernel_sockaddr_storage gsr_group;
137 struct __kernel_sockaddr_storage gsr_source;
138};
139
140struct group_filter
141{
142 __u32 gf_interface;
143 struct __kernel_sockaddr_storage gf_group;
144 __u32 gf_fmode;
145 __u32 gf_numsrc;
146 struct __kernel_sockaddr_storage gf_slist[1];
147};
148
149#define GROUP_FILTER_SIZE(numsrc)   (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage)   + (numsrc) * sizeof(struct __kernel_sockaddr_storage))
150
151struct in_pktinfo
152{
153 int ipi_ifindex;
154 struct in_addr ipi_spec_dst;
155 struct in_addr ipi_addr;
156};
157
158#define __SOCK_SIZE__ 16
159struct sockaddr_in {
160 sa_family_t sin_family;
161 unsigned short int sin_port;
162 struct in_addr sin_addr;
163
164 unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) -
165 sizeof(unsigned short int) - sizeof(struct in_addr)];
166};
167#define sin_zero __pad
168
169#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
170#define IN_CLASSA_NET 0xff000000
171#define IN_CLASSA_NSHIFT 24
172#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
173#define IN_CLASSA_MAX 128
174
175#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
176#define IN_CLASSB_NET 0xffff0000
177#define IN_CLASSB_NSHIFT 16
178#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
179#define IN_CLASSB_MAX 65536
180
181#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
182#define IN_CLASSC_NET 0xffffff00
183#define IN_CLASSC_NSHIFT 8
184#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
185
186#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
187#define IN_MULTICAST(a) IN_CLASSD(a)
188#define IN_MULTICAST_NET 0xF0000000
189
190#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
191#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
192
193#define INADDR_ANY ((unsigned long int) 0x00000000)
194
195#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
196
197#define INADDR_NONE ((unsigned long int) 0xffffffff)
198
199#define IN_LOOPBACKNET 127
200
201#define INADDR_LOOPBACK 0x7f000001
202#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
203
204#define INADDR_UNSPEC_GROUP 0xe0000000U
205#define INADDR_ALLHOSTS_GROUP 0xe0000001U
206#define INADDR_ALLRTRS_GROUP 0xe0000002U
207#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU
208
209#include <asm/byteorder.h>
210
211#endif
212