xref: /openbmc/qemu/linux-user/mips/sockbits.h (revision 7d87775f)
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation, or (at your option) any
5  * later version. See the COPYING file in the top-level directory.
6  */
7 
8 #ifndef MIPS_SOCKBITS_H
9 #define MIPS_SOCKBITS_H
10 /* MIPS special values for constants */
11 
12 /*
13  * For setsockopt(2)
14  *
15  * This defines are ABI conformant as far as Linux supports these ...
16  */
17 #define TARGET_SOL_SOCKET      0xffff
18 
19 #define TARGET_SO_DEBUG        0x0001  /* Record debugging information. */
20 #define TARGET_SO_REUSEADDR    0x0004  /* Allow reuse of local addresses. */
21 #define TARGET_SO_KEEPALIVE    0x0008  /* Keep connections alive and send
22                                           SIGPIPE when they die. */
23 #define TARGET_SO_DONTROUTE    0x0010  /* Don't do local routing. */
24 #define TARGET_SO_BROADCAST    0x0020  /* Allow transmission of
25                                           broadcast messages. */
26 #define TARGET_SO_LINGER       0x0080  /* Block on close of a reliable
27                                         * socket to transmit pending data.
28                                         */
29 #define TARGET_SO_OOBINLINE 0x0100     /* Receive out-of-band data in-band.
30                                         */
31 #define TARGET_SO_REUSEPORT 0x0200
32 
33 #define TARGET_SO_TYPE         0x1008  /* Compatible name for SO_STYLE. */
34 #define TARGET_SO_STYLE        SO_TYPE /* Synonym */
35 #define TARGET_SO_ERROR        0x1007  /* get error status and clear */
36 #define TARGET_SO_SNDBUF       0x1001  /* Send buffer size. */
37 #define TARGET_SO_RCVBUF       0x1002  /* Receive buffer. */
38 #define TARGET_SO_SNDLOWAT     0x1003  /* send low-water mark */
39 #define TARGET_SO_RCVLOWAT     0x1004  /* receive low-water mark */
40 #define TARGET_SO_SNDTIMEO     0x1005  /* send timeout */
41 #define TARGET_SO_RCVTIMEO     0x1006  /* receive timeout */
42 #define TARGET_SO_ACCEPTCONN   0x1009
43 #define TARGET_SO_PROTOCOL     0x1028  /* protocol type */
44 #define TARGET_SO_DOMAIN       0x1029  /* domain/socket family */
45 
46 /* linux-specific, might as well be the same as on i386 */
47 #define TARGET_SO_NO_CHECK     11
48 #define TARGET_SO_PRIORITY     12
49 #define TARGET_SO_BSDCOMPAT    14
50 
51 #define TARGET_SO_PASSCRED     17
52 #define TARGET_SO_PEERCRED     18
53 
54 /* Security levels - as per NRL IPv6 - don't actually do anything */
55 #define TARGET_SO_SECURITY_AUTHENTICATION              22
56 #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT        23
57 #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK          24
58 
59 #define TARGET_SO_BINDTODEVICE         25
60 
61 /* Socket filtering */
62 #define TARGET_SO_ATTACH_FILTER        26
63 #define TARGET_SO_DETACH_FILTER        27
64 
65 #define TARGET_SO_PEERNAME             28
66 #define TARGET_SO_TIMESTAMP            29
67 #define SCM_TIMESTAMP          SO_TIMESTAMP
68 
69 #define TARGET_SO_PEERSEC              30
70 #define TARGET_SO_SNDBUFFORCE          31
71 #define TARGET_SO_RCVBUFFORCE          33
72 #define TARGET_SO_PASSSEC              34
73 
74 /** sock_type - Socket types
75  *
76  * Please notice that for binary compat reasons MIPS has to
77  * override the enum sock_type in include/linux/net.h, so
78  * we define ARCH_HAS_SOCKET_TYPES here.
79  *
80  * @SOCK_DGRAM - datagram (conn.less) socket
81  * @SOCK_STREAM - stream (connection) socket
82  * @SOCK_RAW - raw socket
83  * @SOCK_RDM - reliably-delivered message
84  * @SOCK_SEQPACKET - sequential packet socket
85  * @SOCK_DCCP - Datagram Congestion Control Protocol socket
86  * @SOCK_PACKET - linux specific way of getting packets at the dev level.
87  *                For writing rarp and other similar things on the user
88  *                level.
89  * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
90  * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
91  */
92 
93 #define TARGET_ARCH_HAS_SOCKET_TYPES          1
94 
95 enum sock_type {
96        TARGET_SOCK_DGRAM       = 1,
97        TARGET_SOCK_STREAM      = 2,
98        TARGET_SOCK_RAW         = 3,
99        TARGET_SOCK_RDM         = 4,
100        TARGET_SOCK_SEQPACKET   = 5,
101        TARGET_SOCK_DCCP        = 6,
102        TARGET_SOCK_PACKET      = 10,
103 };
104 
105 #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
106 #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
107 
108 /* Flags for socket, socketpair, paccept */
109 #define TARGET_SOCK_CLOEXEC    TARGET_O_CLOEXEC
110 #define TARGET_SOCK_NONBLOCK   TARGET_O_NONBLOCK
111 
112 #endif
113