socket.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #if defined(TARGET_MIPS)
  2. // MIPS special values for constants
  3. /*
  4. * For setsockopt(2)
  5. *
  6. * This defines are ABI conformant as far as Linux supports these ...
  7. */
  8. #define TARGET_SOL_SOCKET 0xffff
  9. #define TARGET_SO_DEBUG 0x0001 /* Record debugging information. */
  10. #define TARGET_SO_REUSEADDR 0x0004 /* Allow reuse of local addresses. */
  11. #define TARGET_SO_KEEPALIVE 0x0008 /* Keep connections alive and send
  12. SIGPIPE when they die. */
  13. #define TARGET_SO_DONTROUTE 0x0010 /* Don't do local routing. */
  14. #define TARGET_SO_BROADCAST 0x0020 /* Allow transmission of
  15. broadcast messages. */
  16. #define TARGET_SO_LINGER 0x0080 /* Block on close of a reliable
  17. socket to transmit pending data. */
  18. #define TARGET_SO_OOBINLINE 0x0100 /* Receive out-of-band data in-band. */
  19. #if 0
  20. To add: #define TARGET_SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
  21. #endif
  22. #define TARGET_SO_TYPE 0x1008 /* Compatible name for SO_STYLE. */
  23. #define TARGET_SO_STYLE SO_TYPE /* Synonym */
  24. #define TARGET_SO_ERROR 0x1007 /* get error status and clear */
  25. #define TARGET_SO_SNDBUF 0x1001 /* Send buffer size. */
  26. #define TARGET_SO_RCVBUF 0x1002 /* Receive buffer. */
  27. #define TARGET_SO_SNDLOWAT 0x1003 /* send low-water mark */
  28. #define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
  29. #define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
  30. #define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
  31. #define TARGET_SO_ACCEPTCONN 0x1009
  32. /* linux-specific, might as well be the same as on i386 */
  33. #define TARGET_SO_NO_CHECK 11
  34. #define TARGET_SO_PRIORITY 12
  35. #define TARGET_SO_BSDCOMPAT 14
  36. #define TARGET_SO_PASSCRED 17
  37. #define TARGET_SO_PEERCRED 18
  38. /* Security levels - as per NRL IPv6 - don't actually do anything */
  39. #define TARGET_SO_SECURITY_AUTHENTICATION 22
  40. #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
  41. #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
  42. #define TARGET_SO_BINDTODEVICE 25
  43. /* Socket filtering */
  44. #define TARGET_SO_ATTACH_FILTER 26
  45. #define TARGET_SO_DETACH_FILTER 27
  46. #define TARGET_SO_PEERNAME 28
  47. #define TARGET_SO_TIMESTAMP 29
  48. #define SCM_TIMESTAMP SO_TIMESTAMP
  49. #define TARGET_SO_PEERSEC 30
  50. #define TARGET_SO_SNDBUFFORCE 31
  51. #define TARGET_SO_RCVBUFFORCE 33
  52. /** sock_type - Socket types
  53. *
  54. * Please notice that for binary compat reasons MIPS has to
  55. * override the enum sock_type in include/linux/net.h, so
  56. * we define ARCH_HAS_SOCKET_TYPES here.
  57. *
  58. * @SOCK_DGRAM - datagram (conn.less) socket
  59. * @SOCK_STREAM - stream (connection) socket
  60. * @SOCK_RAW - raw socket
  61. * @SOCK_RDM - reliably-delivered message
  62. * @SOCK_SEQPACKET - sequential packet socket
  63. * @SOCK_PACKET - linux specific way of getting packets at the dev level.
  64. * For writing rarp and other similar things on the user level.
  65. */
  66. enum sock_type {
  67. TARGET_SOCK_DGRAM = 1,
  68. TARGET_SOCK_STREAM = 2,
  69. TARGET_SOCK_RAW = 3,
  70. TARGET_SOCK_RDM = 4,
  71. TARGET_SOCK_SEQPACKET = 5,
  72. TARGET_SOCK_DCCP = 6,
  73. TARGET_SOCK_PACKET = 10,
  74. };
  75. #define TARGET_SOCK_MAX (SOCK_PACKET + 1)
  76. #else
  77. /* For setsockopt(2) */
  78. #define TARGET_SOL_SOCKET 1
  79. #define TARGET_SO_DEBUG 1
  80. #define TARGET_SO_REUSEADDR 2
  81. #define TARGET_SO_TYPE 3
  82. #define TARGET_SO_ERROR 4
  83. #define TARGET_SO_DONTROUTE 5
  84. #define TARGET_SO_BROADCAST 6
  85. #define TARGET_SO_SNDBUF 7
  86. #define TARGET_SO_RCVBUF 8
  87. #define TARGET_SO_SNDBUFFORCE 32
  88. #define TARGET_SO_RCVBUFFORCE 33
  89. #define TARGET_SO_KEEPALIVE 9
  90. #define TARGET_SO_OOBINLINE 10
  91. #define TARGET_SO_NO_CHECK 11
  92. #define TARGET_SO_PRIORITY 12
  93. #define TARGET_SO_LINGER 13
  94. #define TARGET_SO_BSDCOMPAT 14
  95. /* To add :#define TARGET_SO_REUSEPORT 15 */
  96. #if defined(TARGET_PPC)
  97. #define TARGET_SO_RCVLOWAT 16
  98. #define TARGET_SO_SNDLOWAT 17
  99. #define TARGET_SO_RCVTIMEO 18
  100. #define TARGET_SO_SNDTIMEO 19
  101. #define TARGET_SO_PASSCRED 20
  102. #define TARGET_SO_PEERCRED 21
  103. #else
  104. #define TARGET_SO_PASSCRED 16
  105. #define TARGET_SO_PEERCRED 17
  106. #define TARGET_SO_RCVLOWAT 18
  107. #define TARGET_SO_SNDLOWAT 19
  108. #define TARGET_SO_RCVTIMEO 20
  109. #define TARGET_SO_SNDTIMEO 21
  110. #endif
  111. /* Security levels - as per NRL IPv6 - don't actually do anything */
  112. #define TARGET_SO_SECURITY_AUTHENTICATION 22
  113. #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 23
  114. #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK 24
  115. #define TARGET_SO_BINDTODEVICE 25
  116. /* Socket filtering */
  117. #define TARGET_SO_ATTACH_FILTER 26
  118. #define TARGET_SO_DETACH_FILTER 27
  119. #define TARGET_SO_PEERNAME 28
  120. #define TARGET_SO_TIMESTAMP 29
  121. #define TARGET_SCM_TIMESTAMP TARGET_SO_TIMESTAMP
  122. #define TARGET_SO_ACCEPTCONN 30
  123. #define TARGET_SO_PEERSEC 31
  124. #endif