9ff308ee4182cf393773b8b6fe24a92efbc028c6
[davej-history.git] / include / linux / socket.h
blob9ff308ee4182cf393773b8b6fe24a92efbc028c6
1 #ifndef _LINUX_SOCKET_H
2 #define _LINUX_SOCKET_H
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 */
8 struct sockaddr {
9 unsigned short sa_family;/* address family, AF_xxx */
10 char sa_data[14];/* 14 bytes of protocol address */
13 struct linger {
14 int l_onoff;/* Linger active */
15 int l_linger;/* How long to linger for */
18 struct msghdr
20 void* msg_name;/* Socket name */
21 int msg_namelen;/* Length of name */
22 struct iovec * msg_iov;/* Data blocks */
23 int msg_iovlen;/* Number of blocks */
24 void* msg_accrights;/* Per protocol magic (eg BSD file descriptor passing) */
25 int msg_accrightslen;/* Length of rights list */
28 /* Socket types. */
29 #define SOCK_STREAM 1/* stream (connection) socket */
30 #define SOCK_DGRAM 2/* datagram (conn.less) socket */
31 #define SOCK_RAW 3/* raw socket */
32 #define SOCK_RDM 4/* reliably-delivered message */
33 #define SOCK_SEQPACKET 5/* sequential packet socket */
34 #define SOCK_PACKET 10/* linux specific way of */
35 /* getting packets at the dev */
36 /* level. For writing rarp and */
37 /* other similar things on the */
38 /* user level. */
40 /* Supported address families. */
41 #define AF_UNSPEC 0
42 #define AF_UNIX 1/* Unix domain sockets */
43 #define AF_INET 2/* Internet IP Protocol */
44 #define AF_AX25 3/* Amateur Radio AX.25 */
45 #define AF_IPX 4/* Novell IPX */
46 #define AF_APPLETALK 5/* Appletalk DDP */
47 #define AF_NETROM 6/* Amateur radio NetROM */
48 #define AF_BRIDGE 7/* Multiprotocol bridge */
49 #define AF_AAL5 8/* Reserved for Werner's ATM */
50 #define AF_X25 9/* Reserved for X.25 project */
51 #define AF_MAX 12/* For now.. */
53 /* Protocol families, same as address families. */
54 #define PF_UNSPEC AF_UNSPEC
55 #define PF_UNIX AF_UNIX
56 #define PF_INET AF_INET
57 #define PF_AX25 AF_AX25
58 #define PF_IPX AF_IPX
59 #define PF_APPLETALK AF_APPLETALK
60 #define PF_NETROM AF_NETROM
61 #define PF_BRIDGE AF_BRIDGE
62 #define PF_AAL5 AF_AAL5
63 #define PF_X25 AF_X25
65 #define PF_MAX AF_MAX
67 /* Flags we can use with send/ and recv. */
68 #define MSG_OOB 1
69 #define MSG_PEEK 2
70 #define MSG_DONTROUTE 4
72 /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
73 #define SOL_IP 0
74 #define SOL_IPX 256
75 #define SOL_AX25 257
76 #define SOL_ATALK 258
77 #define SOL_NETROM 259
78 #define SOL_TCP 6
79 #define SOL_UDP 17
81 /* IP options */
82 #define IP_TOS 1
83 #define IPTOS_LOWDELAY 0x10
84 #define IPTOS_THROUGHPUT 0x08
85 #define IPTOS_RELIABILITY 0x04
86 #define IP_TTL 2
87 #ifdef V1_3_WILL_DO_THIS_FUNKY_STUFF
88 #define IP_HRDINCL 3
89 #define IP_OPTIONS 4
90 #endif
92 #define IP_MULTICAST_IF 32
93 #define IP_MULTICAST_TTL 33
94 #define IP_MULTICAST_LOOP 34
95 #define IP_ADD_MEMBERSHIP 35
96 #define IP_DROP_MEMBERSHIP 36
99 /* These need to appear somewhere around here */
100 #define IP_DEFAULT_MULTICAST_TTL 1
101 #define IP_DEFAULT_MULTICAST_LOOP 1
102 #define IP_MAX_MEMBERSHIPS 20
104 /* IPX options */
105 #define IPX_TYPE 1
107 /* TCP options - this way around because someone left a set in the c library includes */
108 #define TCP_NODELAY 1
109 #define TCP_MAXSEG 2
111 /* The various priorities. */
112 #define SOPRI_INTERACTIVE 0
113 #define SOPRI_NORMAL 1
114 #define SOPRI_BACKGROUND 2
116 #ifdef __KERNEL__
117 externvoidmemcpy_fromiovec(unsigned char*kdata,struct iovec *iov,int len);
118 externintverify_iovec(struct msghdr *m,struct iovec *iov,char*address,int mode);
119 externvoidmemcpy_toiovec(struct iovec *v,unsigned char*kdata,int len);
120 externintmove_addr_to_user(void*kaddr,int klen,void*uaddr,int*ulen);
121 externintmove_addr_to_kernel(void*uaddr,int ulen,void*kaddr);
122 #endif
123 #endif/* _LINUX_SOCKET_H */
close