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