Subversion Repositories shark

Rev

Rev 80 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
#ifndef _LINUX_SOCKET_H
2
#define _LINUX_SOCKET_H
3
 
80 pj 4
#include "ll/sys/cdefs.h"
5
 
6
__BEGIN_DECLS
7
 
2 pj 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
#define AF_INET6        10      /* IP version 6                 */
64
#define AF_MAX          12      /* For now.. */
65
 
66
/* Protocol families, same as address families. */
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
/* Maximum queue length specifiable by listen.  */
82
#define SOMAXCONN       128
83
 
84
/* Flags we can use with send/ and recv. */
85
#define MSG_OOB         1
86
#define MSG_PEEK        2
87
#define MSG_DONTROUTE   4
88
/*#define MSG_CTRUNC    8       - We need to support this for BSD oddments */
89
#define MSG_PROXY       16      /* Supply or ask second address. */
90
 
91
/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
92
#define SOL_IP          0
93
#define SOL_IPX         256
94
#define SOL_AX25        257
95
#define SOL_ATALK       258
96
#define SOL_NETROM      259
97
#define SOL_TCP         6
98
#define SOL_UDP         17
99
 
100
/* IP options */
101
#define IP_TOS          1
102
#define IPTOS_LOWDELAY          0x10
103
#define IPTOS_THROUGHPUT        0x08
104
#define IPTOS_RELIABILITY       0x04
105
#define IPTOS_MINCOST           0x02
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
/* These need to appear somewhere around here */
117
#define IP_DEFAULT_MULTICAST_TTL        1
118
#define IP_DEFAULT_MULTICAST_LOOP       1
119
#define IP_MAX_MEMBERSHIPS              20
120
 
121
/* IPX options */
122
#define IPX_TYPE        1
123
 
124
/* TCP options - this way around because someone left a set in the c library includes */
125
#define TCP_NODELAY     1
126
#define TCP_MAXSEG      2
127
 
128
/* The various priorities. */
129
#define SOPRI_INTERACTIVE       0
130
#define SOPRI_NORMAL            1
131
#define SOPRI_BACKGROUND        2
132
 
133
#define SIOCDEVPRIVATE 0x89f0
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
80 pj 142
 
143
__END_DECLS
2 pj 144
#endif /* _LINUX_SOCKET_H */