1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef __ASM_GENERIC_SOCKET_H
3 #define __ASM_GENERIC_SOCKET_H
5 #include <linux/posix_types.h>
6 #include <asm/sockios.h>
8 /* For setsockopt(2) */
12 #define SO_REUSEADDR 2
15 #define SO_DONTROUTE 5
16 #define SO_BROADCAST 6
19 #define SO_SNDBUFFORCE 32
20 #define SO_RCVBUFFORCE 33
21 #define SO_KEEPALIVE 9
22 #define SO_OOBINLINE 10
23 #define SO_NO_CHECK 11
24 #define SO_PRIORITY 12
26 #define SO_BSDCOMPAT 14
27 #define SO_REUSEPORT 15
28 #ifndef SO_PASSCRED /* powerpc only differs in these */
29 #define SO_PASSCRED 16
30 #define SO_PEERCRED 17
31 #define SO_RCVLOWAT 18
32 #define SO_SNDLOWAT 19
33 #define SO_RCVTIMEO_OLD 20
34 #define SO_SNDTIMEO_OLD 21
37 /* Security levels - as per NRL IPv6 - don't actually do anything */
38 #define SO_SECURITY_AUTHENTICATION 22
39 #define SO_SECURITY_ENCRYPTION_TRANSPORT 23
40 #define SO_SECURITY_ENCRYPTION_NETWORK 24
42 #define SO_BINDTODEVICE 25
44 /* Socket filtering */
45 #define SO_ATTACH_FILTER 26
46 #define SO_DETACH_FILTER 27
47 #define SO_GET_FILTER SO_ATTACH_FILTER
49 #define SO_PEERNAME 28
51 #define SO_ACCEPTCONN 30
58 #define SO_PROTOCOL 38
61 #define SO_RXQ_OVFL 40
63 #define SO_WIFI_STATUS 41
64 #define SCM_WIFI_STATUS SO_WIFI_STATUS
65 #define SO_PEEK_OFF 42
67 /* Instruct lower device to use last 4-bytes of skb data as FCS */
70 #define SO_LOCK_FILTER 44
72 #define SO_SELECT_ERR_QUEUE 45
74 #define SO_BUSY_POLL 46
76 #define SO_MAX_PACING_RATE 47
78 #define SO_BPF_EXTENSIONS 48
80 #define SO_INCOMING_CPU 49
82 #define SO_ATTACH_BPF 50
83 #define SO_DETACH_BPF SO_DETACH_FILTER
85 #define SO_ATTACH_REUSEPORT_CBPF 51
86 #define SO_ATTACH_REUSEPORT_EBPF 52
88 #define SO_CNX_ADVICE 53
90 #define SCM_TIMESTAMPING_OPT_STATS 54
94 #define SO_INCOMING_NAPI_ID 56
98 #define SCM_TIMESTAMPING_PKTINFO 58
100 #define SO_PEERGROUPS 59
102 #define SO_ZEROCOPY 60
105 #define SCM_TXTIME SO_TXTIME
107 #define SO_BINDTOIFINDEX 62
109 #define SO_TIMESTAMP_OLD 29
110 #define SO_TIMESTAMPNS_OLD 35
111 #define SO_TIMESTAMPING_OLD 37
113 #define SO_TIMESTAMP_NEW 63
114 #define SO_TIMESTAMPNS_NEW 64
115 #define SO_TIMESTAMPING_NEW 65
117 #define SO_RCVTIMEO_NEW 66
118 #define SO_SNDTIMEO_NEW 67
120 #define SO_DETACH_REUSEPORT_BPF 68
122 #if !defined(__KERNEL__)
124 #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
125 /* on 64-bit and x32, avoid the ?: operator */
126 #define SO_TIMESTAMP SO_TIMESTAMP_OLD
127 #define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
128 #define SO_TIMESTAMPING SO_TIMESTAMPING_OLD
130 #define SO_RCVTIMEO SO_RCVTIMEO_OLD
131 #define SO_SNDTIMEO SO_SNDTIMEO_OLD
133 #define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
134 #define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
135 #define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
137 #define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
138 #define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
141 #define SCM_TIMESTAMP SO_TIMESTAMP
142 #define SCM_TIMESTAMPNS SO_TIMESTAMPNS
143 #define SCM_TIMESTAMPING SO_TIMESTAMPING
147 #endif /* __ASM_GENERIC_SOCKET_H */