Markus Armbruster | f91005e | 2019-06-04 20:16:18 +0200 | [diff] [blame] | 1 | #ifndef LINUX_USER_SOCKET_H |
| 2 | #define LINUX_USER_SOCKET_H |
| 3 | |
Laurent Vivier | 5de33b1 | 2018-05-19 11:29:49 +0200 | [diff] [blame] | 4 | #include "sockbits.h" |
Petar Jovanovic | f651e6a | 2013-07-01 02:44:14 +0200 | [diff] [blame] | 5 | |
Laurent Vivier | 8f553bf | 2018-05-19 11:29:54 +0200 | [diff] [blame] | 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 | }; |
Petar Jovanovic | f651e6a | 2013-07-01 02:44:14 +0200 | [diff] [blame] | 31 | |
Laurent Vivier | 8f553bf | 2018-05-19 11:29:54 +0200 | [diff] [blame] | 32 | #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1) |
| 33 | #define TARGET_SOCK_TYPE_MASK 0xf /* Covers up to TARGET_SOCK_MAX-1. */ |
bellard | 3532fa7 | 2006-06-24 15:06:03 +0000 | [diff] [blame] | 34 | |
Laurent Vivier | 8f553bf | 2018-05-19 11:29:54 +0200 | [diff] [blame] | 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 |
bellard | 3532fa7 | 2006-06-24 15:06:03 +0000 | [diff] [blame] | 39 | #endif |
Laurent Vivier | 8f553bf | 2018-05-19 11:29:54 +0200 | [diff] [blame] | 40 | #endif /* TARGET_ARCH_HAS_SOCKET_TYPES */ |
Markus Armbruster | f91005e | 2019-06-04 20:16:18 +0200 | [diff] [blame] | 41 | |
| 42 | #endif |