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