socket.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef __ASM_GENERIC_SOCKET_H
  3. #define __ASM_GENERIC_SOCKET_H
  4. #include <linux/posix_types.h>
  5. #include <asm/sockios.h>
  6. /* For setsockopt(2) */
  7. #define SOL_SOCKET 1
  8. #define SO_DEBUG 1
  9. #define SO_REUSEADDR 2
  10. #define SO_TYPE 3
  11. #define SO_ERROR 4
  12. #define SO_DONTROUTE 5
  13. #define SO_BROADCAST 6
  14. #define SO_SNDBUF 7
  15. #define SO_RCVBUF 8
  16. #define SO_SNDBUFFORCE 32
  17. #define SO_RCVBUFFORCE 33
  18. #define SO_KEEPALIVE 9
  19. #define SO_OOBINLINE 10
  20. #define SO_NO_CHECK 11
  21. #define SO_PRIORITY 12
  22. #define SO_LINGER 13
  23. #define SO_BSDCOMPAT 14
  24. #define SO_REUSEPORT 15
  25. #ifndef SO_PASSCRED /* powerpc only differs in these */
  26. #define SO_PASSCRED 16
  27. #define SO_PEERCRED 17
  28. #define SO_RCVLOWAT 18
  29. #define SO_SNDLOWAT 19
  30. #define SO_RCVTIMEO_OLD 20
  31. #define SO_SNDTIMEO_OLD 21
  32. #endif
  33. /* Security levels - as per NRL IPv6 - don't actually do anything */
  34. #define SO_SECURITY_AUTHENTICATION 22
  35. #define SO_SECURITY_ENCRYPTION_TRANSPORT 23
  36. #define SO_SECURITY_ENCRYPTION_NETWORK 24
  37. #define SO_BINDTODEVICE 25
  38. /* Socket filtering */
  39. #define SO_ATTACH_FILTER 26
  40. #define SO_DETACH_FILTER 27
  41. #define SO_GET_FILTER SO_ATTACH_FILTER
  42. #define SO_PEERNAME 28
  43. #define SO_ACCEPTCONN 30
  44. #define SO_PEERSEC 31
  45. #define SO_PASSSEC 34
  46. #define SO_MARK 36
  47. #define SO_PROTOCOL 38
  48. #define SO_DOMAIN 39
  49. #define SO_RXQ_OVFL 40
  50. #define SO_WIFI_STATUS 41
  51. #define SCM_WIFI_STATUS SO_WIFI_STATUS
  52. #define SO_PEEK_OFF 42
  53. /* Instruct lower device to use last 4-bytes of skb data as FCS */
  54. #define SO_NOFCS 43
  55. #define SO_LOCK_FILTER 44
  56. #define SO_SELECT_ERR_QUEUE 45
  57. #define SO_BUSY_POLL 46
  58. #define SO_MAX_PACING_RATE 47
  59. #define SO_BPF_EXTENSIONS 48
  60. #define SO_INCOMING_CPU 49
  61. #define SO_ATTACH_BPF 50
  62. #define SO_DETACH_BPF SO_DETACH_FILTER
  63. #define SO_ATTACH_REUSEPORT_CBPF 51
  64. #define SO_ATTACH_REUSEPORT_EBPF 52
  65. #define SO_CNX_ADVICE 53
  66. #define SCM_TIMESTAMPING_OPT_STATS 54
  67. #define SO_MEMINFO 55
  68. #define SO_INCOMING_NAPI_ID 56
  69. #define SO_COOKIE 57
  70. #define SCM_TIMESTAMPING_PKTINFO 58
  71. #define SO_PEERGROUPS 59
  72. #define SO_ZEROCOPY 60
  73. #define SO_TXTIME 61
  74. #define SCM_TXTIME SO_TXTIME
  75. #define SO_BINDTOIFINDEX 62
  76. #define SO_TIMESTAMP_OLD 29
  77. #define SO_TIMESTAMPNS_OLD 35
  78. #define SO_TIMESTAMPING_OLD 37
  79. #define SO_TIMESTAMP_NEW 63
  80. #define SO_TIMESTAMPNS_NEW 64
  81. #define SO_TIMESTAMPING_NEW 65
  82. #define SO_RCVTIMEO_NEW 66
  83. #define SO_SNDTIMEO_NEW 67
  84. #define SO_DETACH_REUSEPORT_BPF 68
  85. #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__))
  86. /* on 64-bit and x32, avoid the ?: operator */
  87. #define SO_TIMESTAMP SO_TIMESTAMP_OLD
  88. #define SO_TIMESTAMPNS SO_TIMESTAMPNS_OLD
  89. #define SO_TIMESTAMPING SO_TIMESTAMPING_OLD
  90. #define SO_RCVTIMEO SO_RCVTIMEO_OLD
  91. #define SO_SNDTIMEO SO_SNDTIMEO_OLD
  92. #else
  93. #define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW)
  94. #define SO_TIMESTAMPNS (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPNS_OLD : SO_TIMESTAMPNS_NEW)
  95. #define SO_TIMESTAMPING (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_TIMESTAMPING_OLD : SO_TIMESTAMPING_NEW)
  96. #define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW)
  97. #define SO_SNDTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? SO_SNDTIMEO_OLD : SO_SNDTIMEO_NEW)
  98. #endif
  99. #define SCM_TIMESTAMP SO_TIMESTAMP
  100. #define SCM_TIMESTAMPNS SO_TIMESTAMPNS
  101. #define SCM_TIMESTAMPING SO_TIMESTAMPING
  102. #endif /* __ASM_GENERIC_SOCKET_H */