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_SOCKET_H
13 #define _LINUX_SOCKET_H
14 
15 #define _K_SS_MAXSIZE 128
16 #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
17 
18 struct __kernel_sockaddr_storage {
19  unsigned short ss_family;
20 
21  char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
22 
23 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));
24 
25 #if !defined(__GLIBC__) || __GLIBC__ < 2
26 
27 #include <asm/socket.h>
28 #include <linux/sockios.h>
29 #include <linux/uio.h>
30 #include <linux/types.h>
31 #include <linux/compiler.h>
32 
33 typedef unsigned short sa_family_t;
34 
35 struct sockaddr {
36  sa_family_t sa_family;
37  char sa_data[14];
38 };
39 
40 struct linger {
41  int l_onoff;
42  int l_linger;
43 };
44 
45 #define sockaddr_storage __kernel_sockaddr_storage
46 
47 struct msghdr {
48  void * msg_name;
49  int msg_namelen;
50  struct iovec * msg_iov;
51  __kernel_size_t msg_iovlen;
52  void * msg_control;
53  __kernel_size_t msg_controllen;
54  unsigned msg_flags;
55 };
56 
57 struct cmsghdr {
58  __kernel_size_t cmsg_len;
59  int cmsg_level;
60  int cmsg_type;
61 };
62 
63 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
64 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
65 
66 #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
67 
68 #define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
69 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
70 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
71 
72 #define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ?   (struct cmsghdr *)(ctl) :   (struct cmsghdr *)NULL)
73 #define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
74 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) &&   (cmsg)->cmsg_len <= (unsigned long)   ((mhdr)->msg_controllen -   ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
75 
76 #ifdef __GNUC__
77 #define __KINLINE static __inline__
78 #elif defined(__cplusplus)
79 #define __KINLINE static inline
80 #else
81 #define __KINLINE static
82 #endif
83 
__cmsg_nxthdr(void * __ctl,__kernel_size_t __size,struct cmsghdr * __cmsg)84 __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
85  struct cmsghdr *__cmsg)
86 {
87  struct cmsghdr * __ptr;
88 
89  __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
90  if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
91  return (struct cmsghdr *)0;
92 
93  return __ptr;
94 }
95 
cmsg_nxthdr(struct msghdr * __msg,struct cmsghdr * __cmsg)96 __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
97 {
98  return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
99 }
100 
101 #define SCM_RIGHTS 0x01
102 #define SCM_CREDENTIALS 0x02
103 #define SCM_SECURITY 0x03
104 
105 struct ucred {
106  __u32 pid;
107  __u32 uid;
108  __u32 gid;
109 };
110 
111 #define AF_UNSPEC 0
112 #define AF_UNIX 1
113 #define AF_LOCAL 1
114 #define AF_INET 2
115 #define AF_AX25 3
116 #define AF_IPX 4
117 #define AF_APPLETALK 5
118 #define AF_NETROM 6
119 #define AF_BRIDGE 7
120 #define AF_ATMPVC 8
121 #define AF_X25 9
122 #define AF_INET6 10
123 #define AF_ROSE 11
124 #define AF_DECnet 12
125 #define AF_NETBEUI 13
126 #define AF_SECURITY 14
127 #define AF_KEY 15
128 #define AF_NETLINK 16
129 #define AF_ROUTE AF_NETLINK
130 #define AF_PACKET 17
131 #define AF_ASH 18
132 #define AF_ECONET 19
133 #define AF_ATMSVC 20
134 #define AF_SNA 22
135 #define AF_IRDA 23
136 #define AF_PPPOX 24
137 #define AF_WANPIPE 25
138 #define AF_LLC 26
139 #define AF_TIPC 30
140 #define AF_BLUETOOTH 31
141 #define AF_MAX 32
142 
143 #define PF_UNSPEC AF_UNSPEC
144 #define PF_UNIX AF_UNIX
145 #define PF_LOCAL AF_LOCAL
146 #define PF_INET AF_INET
147 #define PF_AX25 AF_AX25
148 #define PF_IPX AF_IPX
149 #define PF_APPLETALK AF_APPLETALK
150 #define PF_NETROM AF_NETROM
151 #define PF_BRIDGE AF_BRIDGE
152 #define PF_ATMPVC AF_ATMPVC
153 #define PF_X25 AF_X25
154 #define PF_INET6 AF_INET6
155 #define PF_ROSE AF_ROSE
156 #define PF_DECnet AF_DECnet
157 #define PF_NETBEUI AF_NETBEUI
158 #define PF_SECURITY AF_SECURITY
159 #define PF_KEY AF_KEY
160 #define PF_NETLINK AF_NETLINK
161 #define PF_ROUTE AF_ROUTE
162 #define PF_PACKET AF_PACKET
163 #define PF_ASH AF_ASH
164 #define PF_ECONET AF_ECONET
165 #define PF_ATMSVC AF_ATMSVC
166 #define PF_SNA AF_SNA
167 #define PF_IRDA AF_IRDA
168 #define PF_PPPOX AF_PPPOX
169 #define PF_WANPIPE AF_WANPIPE
170 #define PF_LLC AF_LLC
171 #define PF_TIPC AF_TIPC
172 #define PF_BLUETOOTH AF_BLUETOOTH
173 #define PF_MAX AF_MAX
174 
175 #define SOMAXCONN 128
176 
177 #define MSG_OOB 1
178 #define MSG_PEEK 2
179 #define MSG_DONTROUTE 4
180 #define MSG_TRYHARD 4
181 #define MSG_CTRUNC 8
182 #define MSG_PROBE 0x10
183 #define MSG_TRUNC 0x20
184 #define MSG_DONTWAIT 0x40
185 #define MSG_EOR 0x80
186 #define MSG_WAITALL 0x100
187 #define MSG_FIN 0x200
188 #define MSG_SYN 0x400
189 #define MSG_CONFIRM 0x800
190 #define MSG_RST 0x1000
191 #define MSG_ERRQUEUE 0x2000
192 #define MSG_NOSIGNAL 0x4000
193 #define MSG_MORE 0x8000
194 
195 #define MSG_EOF MSG_FIN
196 
197 #define MSG_CMSG_COMPAT 0
198 
199 #define SOL_IP 0
200 
201 #define SOL_TCP 6
202 #define SOL_UDP 17
203 #define SOL_IPV6 41
204 #define SOL_ICMPV6 58
205 #define SOL_SCTP 132
206 #define SOL_RAW 255
207 #define SOL_IPX 256
208 #define SOL_AX25 257
209 #define SOL_ATALK 258
210 #define SOL_NETROM 259
211 #define SOL_ROSE 260
212 #define SOL_DECNET 261
213 #define SOL_X25 262
214 #define SOL_PACKET 263
215 #define SOL_ATM 264
216 #define SOL_AAL 265
217 #define SOL_IRDA 266
218 #define SOL_NETBEUI 267
219 #define SOL_LLC 268
220 #define SOL_DCCP 269
221 #define SOL_NETLINK 270
222 #define SOL_TIPC 271
223 
224 #define IPX_TYPE 1
225 
226 #endif
227 #endif
228