xref: /openbmc/qemu/linux-user/socket.h (revision 2993683b)
1 
2 #if defined(TARGET_MIPS)
3 	// MIPS special values for constants
4 
5 	/*
6 	 * For setsockopt(2)
7 	 *
8 	 * This defines are ABI conformant as far as Linux supports these ...
9 	 */
10 	#define TARGET_SOL_SOCKET      0xffff
11 
12 	#define TARGET_SO_DEBUG        0x0001  /* Record debugging information.  */
13 	#define TARGET_SO_REUSEADDR    0x0004  /* Allow reuse of local addresses.  */
14 	#define TARGET_SO_KEEPALIVE    0x0008  /* Keep connections alive and send
15 					  SIGPIPE when they die.  */
16 	#define TARGET_SO_DONTROUTE    0x0010  /* Don't do local routing.  */
17 	#define TARGET_SO_BROADCAST    0x0020  /* Allow transmission of
18 					  broadcast messages.  */
19 	#define TARGET_SO_LINGER       0x0080  /* Block on close of a reliable
20 					  socket to transmit pending data.  */
21 	#define TARGET_SO_OOBINLINE 0x0100     /* Receive out-of-band data in-band.  */
22 	#if 0
23 	To add: #define TARGET_SO_REUSEPORT 0x0200     /* Allow local address and port reuse.  */
24 	#endif
25 
26 	#define TARGET_SO_TYPE         0x1008  /* Compatible name for SO_STYLE.  */
27 	#define TARGET_SO_STYLE        SO_TYPE /* Synonym */
28 	#define TARGET_SO_ERROR        0x1007  /* get error status and clear */
29 	#define TARGET_SO_SNDBUF       0x1001  /* Send buffer size. */
30 	#define TARGET_SO_RCVBUF       0x1002  /* Receive buffer. */
31 	#define TARGET_SO_SNDLOWAT     0x1003  /* send low-water mark */
32 	#define TARGET_SO_RCVLOWAT     0x1004  /* receive low-water mark */
33 	#define TARGET_SO_SNDTIMEO     0x1005  /* send timeout */
34 	#define TARGET_SO_RCVTIMEO     0x1006  /* receive timeout */
35 	#define TARGET_SO_ACCEPTCONN   0x1009
36 
37 	/* linux-specific, might as well be the same as on i386 */
38 	#define TARGET_SO_NO_CHECK     11
39 	#define TARGET_SO_PRIORITY     12
40 	#define TARGET_SO_BSDCOMPAT    14
41 
42 	#define TARGET_SO_PASSCRED     17
43 	#define TARGET_SO_PEERCRED     18
44 
45 	/* Security levels - as per NRL IPv6 - don't actually do anything */
46 	#define TARGET_SO_SECURITY_AUTHENTICATION              22
47 	#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        23
48 	#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          24
49 
50 	#define TARGET_SO_BINDTODEVICE         25
51 
52 	/* Socket filtering */
53 	#define TARGET_SO_ATTACH_FILTER        26
54 	#define TARGET_SO_DETACH_FILTER        27
55 
56 	#define TARGET_SO_PEERNAME             28
57 	#define TARGET_SO_TIMESTAMP            29
58 	#define SCM_TIMESTAMP          SO_TIMESTAMP
59 
60 	#define TARGET_SO_PEERSEC              30
61 	#define TARGET_SO_SNDBUFFORCE          31
62 	#define TARGET_SO_RCVBUFFORCE          33
63 
64 	/** sock_type - Socket types
65 	 *
66 	 * Please notice that for binary compat reasons MIPS has to
67 	 * override the enum sock_type in include/linux/net.h, so
68 	 * we define ARCH_HAS_SOCKET_TYPES here.
69 	 *
70 	 * @SOCK_DGRAM - datagram (conn.less) socket
71 	 * @SOCK_STREAM - stream (connection) socket
72 	 * @SOCK_RAW - raw socket
73 	 * @SOCK_RDM - reliably-delivered message
74 	 * @SOCK_SEQPACKET - sequential packet socket
75 	 * @SOCK_PACKET - linux specific way of getting packets at the dev level.
76 	 *               For writing rarp and other similar things on the user level.
77 	 */
78 	enum sock_type {
79 	       TARGET_SOCK_DGRAM       = 1,
80 	       TARGET_SOCK_STREAM      = 2,
81 	       TARGET_SOCK_RAW = 3,
82 	       TARGET_SOCK_RDM = 4,
83 	       TARGET_SOCK_SEQPACKET   = 5,
84 	       TARGET_SOCK_DCCP        = 6,
85 	       TARGET_SOCK_PACKET      = 10,
86 	};
87 
88 	#define TARGET_SOCK_MAX (SOCK_PACKET + 1)
89 
90 #elif defined(TARGET_ALPHA)
91 
92     /* For setsockopt(2) */
93     #define TARGET_SOL_SOCKET   0xffff
94 
95     #define TARGET_SO_DEBUG 0x0001
96     #define TARGET_SO_REUSEADDR 0x0004
97     #define TARGET_SO_KEEPALIVE 0x0008
98     #define TARGET_SO_DONTROUTE 0x0010
99     #define TARGET_SO_BROADCAST 0x0020
100     #define TARGET_SO_LINGER    0x0080
101     #define TARGET_SO_OOBINLINE 0x0100
102     /* To add :#define TARGET_SO_REUSEPORT 0x0200 */
103 
104     #define TARGET_SO_TYPE      0x1008
105     #define TARGET_SO_ERROR 0x1007
106     #define TARGET_SO_SNDBUF    0x1001
107     #define TARGET_SO_RCVBUF    0x1002
108     #define TARGET_SO_SNDBUFFORCE   0x100a
109     #define TARGET_SO_RCVBUFFORCE   0x100b
110     #define TARGET_SO_RCVLOWAT  0x1010
111     #define TARGET_SO_SNDLOWAT  0x1011
112     #define TARGET_SO_RCVTIMEO  0x1012
113     #define TARGET_SO_SNDTIMEO  0x1013
114     #define TARGET_SO_ACCEPTCONN    0x1014
115     #define TARGET_SO_PROTOCOL  0x1028
116     #define TARGET_SO_DOMAIN    0x1029
117 
118     /* linux-specific, might as well be the same as on i386 */
119     #define TARGET_SO_NO_CHECK  11
120     #define TARGET_SO_PRIORITY  12
121     #define TARGET_SO_BSDCOMPAT 14
122 
123     #define TARGET_SO_PASSCRED  17
124     #define TARGET_SO_PEERCRED  18
125     #define TARGET_SO_BINDTODEVICE 25
126 
127     /* Socket filtering */
128     #define TARGET_SO_ATTACH_FILTER        26
129     #define TARGET_SO_DETACH_FILTER        27
130 
131     #define TARGET_SO_PEERNAME      28
132     #define TARGET_SO_TIMESTAMP     29
133     #define TARGET_SCM_TIMESTAMP        TARGET_SO_TIMESTAMP
134 
135     #define TARGET_SO_PEERSEC       30
136     #define TARGET_SO_PASSSEC       34
137     #define TARGET_SO_TIMESTAMPNS       35
138     #define TARGET_SCM_TIMESTAMPNS      TARGET_SO_TIMESTAMPNS
139 
140     /* Security levels - as per NRL IPv6 - don't actually do anything */
141     #define TARGET_SO_SECURITY_AUTHENTICATION       19
142     #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 20
143     #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK       21
144 
145     #define TARGET_SO_MARK          36
146 
147     #define TARGET_SO_TIMESTAMPING      37
148     #define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING
149 
150     #define TARGET_SO_RXQ_OVFL             40
151 
152     #define TARGET_SO_WIFI_STATUS       41
153     #define TARGET_SCM_WIFI_STATUS      TARGET_SO_WIFI_STATUS
154     #define TARGET_SO_PEEK_OFF      42
155 
156     /* Instruct lower device to use last 4-bytes of skb data as FCS */
157     #define TARGET_SO_NOFCS     43
158 
159 #else
160 
161 	/* For setsockopt(2) */
162 	#define TARGET_SOL_SOCKET      1
163 
164 	#define TARGET_SO_DEBUG        1
165 	#define TARGET_SO_REUSEADDR    2
166 	#define TARGET_SO_TYPE         3
167 	#define TARGET_SO_ERROR        4
168 	#define TARGET_SO_DONTROUTE    5
169 	#define TARGET_SO_BROADCAST    6
170 	#define TARGET_SO_SNDBUF       7
171 	#define TARGET_SO_RCVBUF       8
172 	#define TARGET_SO_SNDBUFFORCE  32
173 	#define TARGET_SO_RCVBUFFORCE  33
174 	#define TARGET_SO_KEEPALIVE    9
175 	#define TARGET_SO_OOBINLINE    10
176 	#define TARGET_SO_NO_CHECK     11
177 	#define TARGET_SO_PRIORITY     12
178 	#define TARGET_SO_LINGER       13
179 	#define TARGET_SO_BSDCOMPAT    14
180 	/* To add :#define TARGET_SO_REUSEPORT 15 */
181 #if defined(TARGET_PPC)
182 	#define TARGET_SO_RCVLOWAT     16
183 	#define TARGET_SO_SNDLOWAT     17
184 	#define TARGET_SO_RCVTIMEO     18
185 	#define TARGET_SO_SNDTIMEO     19
186 	#define TARGET_SO_PASSCRED     20
187 	#define TARGET_SO_PEERCRED     21
188 #else
189 	#define TARGET_SO_PASSCRED     16
190 	#define TARGET_SO_PEERCRED     17
191 	#define TARGET_SO_RCVLOWAT     18
192 	#define TARGET_SO_SNDLOWAT     19
193 	#define TARGET_SO_RCVTIMEO     20
194 	#define TARGET_SO_SNDTIMEO     21
195 #endif
196 
197 	/* Security levels - as per NRL IPv6 - don't actually do anything */
198 	#define TARGET_SO_SECURITY_AUTHENTICATION              22
199 	#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        23
200 	#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          24
201 
202 	#define TARGET_SO_BINDTODEVICE 25
203 
204 	/* Socket filtering */
205 	#define TARGET_SO_ATTACH_FILTER        26
206 	#define TARGET_SO_DETACH_FILTER        27
207 
208 	#define TARGET_SO_PEERNAME             28
209 	#define TARGET_SO_TIMESTAMP            29
210 	#define TARGET_SCM_TIMESTAMP           TARGET_SO_TIMESTAMP
211 
212 	#define TARGET_SO_ACCEPTCONN           30
213 
214 	#define TARGET_SO_PEERSEC              31
215 
216 #endif
217