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