1 #ifndef _LINUX_SOCKET_H
2 #define _LINUX_SOCKET_H
3
4 #include <asm/socket.h>
5 #include <linux/sockios.h>
6 #include <linux/uio.h>
7
8 struct sockaddr
9 {
10 unsigned short sa_family;
11 char sa_data[14];
12 };
13
14 struct linger {
15 int l_onoff;
16 int l_linger;
17 };
18
19 struct msghdr
20 {
21 void * msg_name;
22 int msg_namelen;
23 struct iovec * msg_iov;
24 int msg_iovlen;
25 void * msg_accrights;
26 int msg_accrightslen;
27 };
28
29
30
31
32
33 #define msg_control msg_accrights
34 #define msg_controllen msg_accrightslen
35
36
37
38 #define SCM_RIGHTS 1
39
40
41 #define SOCK_STREAM 1
42 #define SOCK_DGRAM 2
43 #define SOCK_RAW 3
44 #define SOCK_RDM 4
45 #define SOCK_SEQPACKET 5
46 #define SOCK_PACKET 10
47
48
49
50
51
52
53 #define AF_UNSPEC 0
54 #define AF_UNIX 1
55 #define AF_INET 2
56 #define AF_AX25 3
57 #define AF_IPX 4
58 #define AF_APPLETALK 5
59 #define AF_NETROM 6
60 #define AF_BRIDGE 7
61 #define AF_AAL5 8
62 #define AF_X25 9
63 #define AF_INET6 10
64 #define AF_MAX 12
65
66
67 #define PF_UNSPEC AF_UNSPEC
68 #define PF_UNIX AF_UNIX
69 #define PF_INET AF_INET
70 #define PF_AX25 AF_AX25
71 #define PF_IPX AF_IPX
72 #define PF_APPLETALK AF_APPLETALK
73 #define PF_NETROM AF_NETROM
74 #define PF_BRIDGE AF_BRIDGE
75 #define PF_AAL5 AF_AAL5
76 #define PF_X25 AF_X25
77 #define PF_INET6 AF_INET6
78
79 #define PF_MAX AF_MAX
80
81
82 #define SOMAXCONN 128
83
84
85 #define MSG_OOB 1
86 #define MSG_PEEK 2
87 #define MSG_DONTROUTE 4
88
89
90
91 #define SOL_IP 0
92 #define SOL_IPX 256
93 #define SOL_AX25 257
94 #define SOL_ATALK 258
95 #define SOL_NETROM 259
96 #define SOL_TCP 6
97 #define SOL_UDP 17
98
99 #ifdef __KERNEL__
100
101
102 #define IP_TOS 1
103 #define IPTOS_LOWDELAY 0x10
104 #define IPTOS_THROUGHPUT 0x08
105 #define IPTOS_RELIABILITY 0x04
106 #define IP_TTL 2
107 #define IP_HDRINCL 3
108 #define IP_OPTIONS 4
109
110 #define IP_MULTICAST_IF 32
111 #define IP_MULTICAST_TTL 33
112 #define IP_MULTICAST_LOOP 34
113 #define IP_ADD_MEMBERSHIP 35
114 #define IP_DROP_MEMBERSHIP 36
115
116 #endif
117
118
119 #define IP_DEFAULT_MULTICAST_TTL 1
120 #define IP_DEFAULT_MULTICAST_LOOP 1
121 #define IP_MAX_MEMBERSHIPS 20
122
123
124 #define IPX_TYPE 1
125
126
127 #define TCP_NODELAY 1
128 #define TCP_MAXSEG 2
129
130
131 #define SOPRI_INTERACTIVE 0
132 #define SOPRI_NORMAL 1
133 #define SOPRI_BACKGROUND 2
134
135 #ifdef __KERNEL__
136 extern void memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
137 extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
138 extern void memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
139 extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen);
140 extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr);
141 #endif
142 #endif