xref: /openbmc/qemu/linux-user/socket.h (revision 438c78da)
1 #include "sockbits.h"
2 
3 #ifndef TARGET_ARCH_HAS_SOCKET_TYPES
4 /** sock_type - Socket types - default values
5  *
6  *
7  * @SOCK_STREAM - stream (connection) socket
8  * @SOCK_DGRAM - datagram (conn.less) socket
9  * @SOCK_RAW - raw socket
10  * @SOCK_RDM - reliably-delivered message
11  * @SOCK_SEQPACKET - sequential packet socket
12  * @SOCK_DCCP - Datagram Congestion Control Protocol socket
13  * @SOCK_PACKET - linux specific way of getting packets at the dev level.
14  *                For writing rarp and other similar things on the user
15  *                level.
16  * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
17  * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
18  */
19 enum sock_type {
20        TARGET_SOCK_STREAM      = 1,
21        TARGET_SOCK_DGRAM       = 2,
22        TARGET_SOCK_RAW         = 3,
23        TARGET_SOCK_RDM         = 4,
24        TARGET_SOCK_SEQPACKET   = 5,
25        TARGET_SOCK_DCCP        = 6,
26        TARGET_SOCK_PACKET      = 10,
27 };
28 
29 #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
30 #define TARGET_SOCK_TYPE_MASK    0xf  /* Covers up to TARGET_SOCK_MAX-1. */
31 
32 /* Flags for socket, socketpair, accept4 */
33 #define TARGET_SOCK_CLOEXEC    TARGET_O_CLOEXEC
34 #ifndef TARGET_SOCK_NONBLOCK
35 #define TARGET_SOCK_NONBLOCK   TARGET_O_NONBLOCK
36 #endif
37 #endif /* TARGET_ARCH_HAS_SOCKET_TYPES */
38