Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | #ifndef _LINUX_SOCKET_H |
2 | #define _LINUX_SOCKET_H |
||
3 | |||
4 | struct sockaddr |
||
5 | { |
||
6 | unsigned short sa_family; /* address family, AF_xxx */ |
||
7 | char sa_data[14]; /* 14 bytes of protocol address */ |
||
8 | }; |
||
9 | |||
10 | struct linger { |
||
11 | int l_onoff; /* Linger active */ |
||
12 | int l_linger; /* How long to linger for */ |
||
13 | }; |
||
14 | |||
15 | /* |
||
16 | * As we do 4.4BSD message passing we use a 4.4BSD message passing |
||
17 | * system, not 4.3. Thus msg_accrights(len) are now missing. They |
||
18 | * belong in an obscure libc emulation or the bin. |
||
19 | */ |
||
20 | |||
21 | struct msghdr |
||
22 | { |
||
23 | void * msg_name; /* Socket name */ |
||
24 | int msg_namelen; /* Length of name */ |
||
25 | struct iovec * msg_iov; /* Data blocks */ |
||
26 | int msg_iovlen; /* Number of blocks */ |
||
27 | void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ |
||
28 | int msg_controllen; /* Length of rights list */ |
||
29 | int msg_flags; /* 4.4 BSD item we dont use */ |
||
30 | }; |
||
31 | |||
32 | /* Control Messages */ |
||
33 | |||
34 | #define SCM_RIGHTS 1 |
||
35 | |||
36 | /* Socket types. */ |
||
37 | #define SOCK_STREAM 1 /* stream (connection) socket */ |
||
38 | #define SOCK_DGRAM 2 /* datagram (conn.less) socket */ |
||
39 | #define SOCK_RAW 3 /* raw socket */ |
||
40 | #define SOCK_RDM 4 /* reliably-delivered message */ |
||
41 | #define SOCK_SEQPACKET 5 /* sequential packet socket */ |
||
42 | #define SOCK_PACKET 10 /* linux specific way of */ |
||
43 | /* getting packets at the dev */ |
||
44 | /* level. For writing rarp and */ |
||
45 | /* other similar things on the */ |
||
46 | /* user level. */ |
||
47 | |||
48 | /* Supported address families. */ |
||
49 | #define AF_UNSPEC 0 |
||
50 | #define AF_UNIX 1 /* Unix domain sockets */ |
||
51 | #define AF_INET 2 /* Internet IP Protocol */ |
||
52 | #define AF_AX25 3 /* Amateur Radio AX.25 */ |
||
53 | #define AF_IPX 4 /* Novell IPX */ |
||
54 | #define AF_APPLETALK 5 /* Appletalk DDP */ |
||
55 | #define AF_NETROM 6 /* Amateur radio NetROM */ |
||
56 | #define AF_BRIDGE 7 /* Multiprotocol bridge */ |
||
57 | #define AF_AAL5 8 /* Reserved for Werner's ATM */ |
||
58 | #define AF_X25 9 /* Reserved for X.25 project */ |
||
59 | #define AF_INET6 10 /* IP version 6 */ |
||
60 | #define AF_MAX 12 /* For now.. */ |
||
61 | |||
62 | /* Protocol families, same as address families. */ |
||
63 | #define PF_UNSPEC AF_UNSPEC |
||
64 | #define PF_UNIX AF_UNIX |
||
65 | #define PF_INET AF_INET |
||
66 | #define PF_AX25 AF_AX25 |
||
67 | #define PF_IPX AF_IPX |
||
68 | #define PF_APPLETALK AF_APPLETALK |
||
69 | #define PF_NETROM AF_NETROM |
||
70 | #define PF_BRIDGE AF_BRIDGE |
||
71 | #define PF_AAL5 AF_AAL5 |
||
72 | #define PF_X25 AF_X25 |
||
73 | #define PF_INET6 AF_INET6 |
||
74 | |||
75 | #define PF_MAX AF_MAX |
||
76 | |||
77 | /* Maximum queue length specifiable by listen. */ |
||
78 | #define SOMAXCONN 128 |
||
79 | |||
80 | /* Flags we can use with send/ and recv. */ |
||
81 | #define MSG_OOB 1 |
||
82 | #define MSG_PEEK 2 |
||
83 | #define MSG_DONTROUTE 4 |
||
84 | /*#define MSG_CTRUNC 8 - We need to support this for BSD oddments */ |
||
85 | #define MSG_PROXY 16 /* Supply or ask second address. */ |
||
86 | |||
87 | /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ |
||
88 | #define SOL_IP 0 |
||
89 | #define SOL_IPX 256 |
||
90 | #define SOL_AX25 257 |
||
91 | #define SOL_ATALK 258 |
||
92 | #define SOL_NETROM 259 |
||
93 | #define SOL_TCP 6 |
||
94 | #define SOL_UDP 17 |
||
95 | |||
96 | /* IP options */ |
||
97 | #define IP_TOS 1 |
||
98 | #define IPTOS_LOWDELAY 0x10 |
||
99 | #define IPTOS_THROUGHPUT 0x08 |
||
100 | #define IPTOS_RELIABILITY 0x04 |
||
101 | #define IPTOS_MINCOST 0x02 |
||
102 | #define IP_TTL 2 |
||
103 | #define IP_HDRINCL 3 |
||
104 | #define IP_OPTIONS 4 |
||
105 | |||
106 | #define IP_MULTICAST_IF 32 |
||
107 | #define IP_MULTICAST_TTL 33 |
||
108 | #define IP_MULTICAST_LOOP 34 |
||
109 | #define IP_ADD_MEMBERSHIP 35 |
||
110 | #define IP_DROP_MEMBERSHIP 36 |
||
111 | |||
112 | /* These need to appear somewhere around here */ |
||
113 | #define IP_DEFAULT_MULTICAST_TTL 1 |
||
114 | #define IP_DEFAULT_MULTICAST_LOOP 1 |
||
115 | #define IP_MAX_MEMBERSHIPS 20 |
||
116 | |||
117 | /* IPX options */ |
||
118 | #define IPX_TYPE 1 |
||
119 | |||
120 | /* TCP options - this way around because someone left a set in the c library includes */ |
||
121 | #define TCP_NODELAY 1 |
||
122 | #define TCP_MAXSEG 2 |
||
123 | |||
124 | /* The various priorities. */ |
||
125 | #define SOPRI_INTERACTIVE 0 |
||
126 | #define SOPRI_NORMAL 1 |
||
127 | #define SOPRI_BACKGROUND 2 |
||
128 | |||
129 | #define SIOCDEVPRIVATE 0x89f0 |
||
130 | |||
131 | #ifdef __KERNEL__ |
||
132 | extern void memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); |
||
133 | extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); |
||
134 | extern void memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); |
||
135 | extern int move_addr_to_user(void *kaddr, int klen, void *uaddr, int *ulen); |
||
136 | extern int move_addr_to_kernel(void *uaddr, int ulen, void *kaddr); |
||
137 | #endif |
||
138 | #endif /* _LINUX_SOCKET_H */ |