1 /****************************************************************************
2 ****************************************************************************
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.
10 ****************************************************************************
11 ****************************************************************************/
12 #ifndef _LINUX_SOCKET_H
13 #define _LINUX_SOCKET_H
15 #define _K_SS_MAXSIZE 128
16 #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
18 struct __kernel_sockaddr_storage {
19 unsigned short ss_family;
21 char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
23 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));
25 #if !defined(__GLIBC__) || __GLIBC__ < 2
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>
33 typedef unsigned short sa_family_t;
36 sa_family_t sa_family;
45 #define sockaddr_storage __kernel_sockaddr_storage
50 struct iovec * msg_iov;
51 __kernel_size_t msg_iovlen;
53 __kernel_size_t msg_controllen;
58 __kernel_size_t cmsg_len;
63 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
64 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
66 #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
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))
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)))
77 #define __KINLINE static __inline__
78 #elif defined(__cplusplus)
79 #define __KINLINE static inline
81 #define __KINLINE static
84 __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
85 struct cmsghdr *__cmsg)
87 struct cmsghdr * __ptr;
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;
96 __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
98 return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
101 #define SCM_RIGHTS 0x01
102 #define SCM_CREDENTIALS 0x02
103 #define SCM_SECURITY 0x03
117 #define AF_APPLETALK 5
125 #define AF_NETBEUI 13
126 #define AF_SECURITY 14
128 #define AF_NETLINK 16
129 #define AF_ROUTE AF_NETLINK
137 #define AF_WANPIPE 25
140 #define AF_BLUETOOTH 31
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
175 #define SOMAXCONN 128
179 #define MSG_DONTROUTE 4
180 #define MSG_TRYHARD 4
182 #define MSG_PROBE 0x10
183 #define MSG_TRUNC 0x20
184 #define MSG_DONTWAIT 0x40
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
195 #define MSG_EOF MSG_FIN
197 #define MSG_CMSG_COMPAT 0
204 #define SOL_ICMPV6 58
209 #define SOL_ATALK 258
210 #define SOL_NETROM 259
212 #define SOL_DECNET 261
214 #define SOL_PACKET 263
218 #define SOL_NETBEUI 267
221 #define SOL_NETLINK 270