blob: 680a9218a919268192e1350ba82f7b99c947324e [file] [log] [blame]
Markus Armbrusterf91005e2019-06-04 20:16:18 +02001#ifndef LINUX_USER_SOCKET_H
2#define LINUX_USER_SOCKET_H
3
Laurent Vivier5de33b12018-05-19 11:29:49 +02004#include "sockbits.h"
Petar Jovanovicf651e6a2013-07-01 02:44:14 +02005
Laurent Vivier8f553bf2018-05-19 11:29:54 +02006#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 */
22enum 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};
Petar Jovanovicf651e6a2013-07-01 02:44:14 +020031
Laurent Vivier8f553bf2018-05-19 11:29:54 +020032#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
33#define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */
bellard3532fa72006-06-24 15:06:03 +000034
Laurent Vivier8f553bf2018-05-19 11:29:54 +020035/* 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
bellard3532fa72006-06-24 15:06:03 +000039#endif
Laurent Vivier8f553bf2018-05-19 11:29:54 +020040#endif /* TARGET_ARCH_HAS_SOCKET_TYPES */
Markus Armbrusterf91005e2019-06-04 20:16:18 +020041
42#endif