xref: /linux/tools/include/uapi/asm-generic/socket.h (revision c83b49383b595be50647f0c764a48c78b5f3c4f8)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef __ASM_GENERIC_SOCKET_H
3 #define __ASM_GENERIC_SOCKET_H
4 
5 #include <linux/posix_types.h>
6 #include <asm/sockios.h>
7 
8 /* For setsockopt(2) */
9 #define SOL_SOCKET	1
10 
11 #define SO_DEBUG	1
12 #define SO_REUSEADDR	2
13 #define SO_TYPE		3
14 #define SO_ERROR	4
15 #define SO_DONTROUTE	5
16 #define SO_BROADCAST	6
17 #define SO_SNDBUF	7
18 #define SO_RCVBUF	8
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
25 #define SO_LINGER	13
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
35 #endif
36 
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
41 
42 #define SO_BINDTODEVICE	25
43 
44 /* Socket filtering */
45 #define SO_ATTACH_FILTER	26
46 #define SO_DETACH_FILTER	27
47 #define SO_GET_FILTER		SO_ATTACH_FILTER
48 
49 #define SO_PEERNAME		28
50 
51 #define SO_ACCEPTCONN		30
52 
53 #define SO_PEERSEC		31
54 #define SO_PASSSEC		34
55 
56 #define SO_MARK			36
57 
58 #define SO_PROTOCOL		38
59 #define SO_DOMAIN		39
60 
61 #define SO_RXQ_OVFL             40
62 
63 #define SO_WIFI_STATUS		41
64 #define SCM_WIFI_STATUS	SO_WIFI_STATUS
65 #define SO_PEEK_OFF		42
66 
67 /* Instruct lower device to use last 4-bytes of skb data as FCS */
68 #define SO_NOFCS		43
69 
70 #define SO_LOCK_FILTER		44
71 
72 #define SO_SELECT_ERR_QUEUE	45
73 
74 #define SO_BUSY_POLL		46
75 
76 #define SO_MAX_PACING_RATE	47
77 
78 #define SO_BPF_EXTENSIONS	48
79 
80 #define SO_INCOMING_CPU		49
81 
82 #define SO_ATTACH_BPF		50
83 #define SO_DETACH_BPF		SO_DETACH_FILTER
84 
85 #define SO_ATTACH_REUSEPORT_CBPF	51
86 #define SO_ATTACH_REUSEPORT_EBPF	52
87 
88 #define SO_CNX_ADVICE		53
89 
90 #define SCM_TIMESTAMPING_OPT_STATS	54
91 
92 #define SO_MEMINFO		55
93 
94 #define SO_INCOMING_NAPI_ID	56
95 
96 #define SO_COOKIE		57
97 
98 #define SCM_TIMESTAMPING_PKTINFO	58
99 
100 #define SO_PEERGROUPS		59
101 
102 #define SO_ZEROCOPY		60
103 
104 #define SO_TXTIME		61
105 #define SCM_TXTIME		SO_TXTIME
106 
107 #define SO_BINDTOIFINDEX	62
108 
109 #define SO_TIMESTAMP_OLD        29
110 #define SO_TIMESTAMPNS_OLD      35
111 #define SO_TIMESTAMPING_OLD     37
112 
113 #define SO_TIMESTAMP_NEW        63
114 #define SO_TIMESTAMPNS_NEW      64
115 #define SO_TIMESTAMPING_NEW     65
116 
117 #define SO_RCVTIMEO_NEW         66
118 #define SO_SNDTIMEO_NEW         67
119 
120 #define SO_DETACH_REUSEPORT_BPF 68
121 
122 #define SO_RCVMARK		75
123 
124 #if !defined(__KERNEL__)
125 
126 #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
127 /* on 64-bit and x32, avoid the ?: operator */
128 #define SO_TIMESTAMP		SO_TIMESTAMP_OLD
129 #define SO_TIMESTAMPNS		SO_TIMESTAMPNS_OLD
130 #define SO_TIMESTAMPING		SO_TIMESTAMPING_OLD
131 
132 #define SO_RCVTIMEO		SO_RCVTIMEO_OLD
133 #define SO_SNDTIMEO		SO_SNDTIMEO_OLD
134 #else
135 #define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
136 #define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
137 #define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
138 
139 #define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
140 #define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
141 #endif
142 
143 #define SCM_TIMESTAMP           SO_TIMESTAMP
144 #define SCM_TIMESTAMPNS         SO_TIMESTAMPNS
145 #define SCM_TIMESTAMPING        SO_TIMESTAMPING
146 
147 #endif
148 
149 #endif /* __ASM_GENERIC_SOCKET_H */
150