PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/sb-bsd-sockets/win32-constants.lisp

http://github.com/antifuchs/sbcl
Lisp | 234 lines | 178 code | 43 blank | 13 comment | 4 complexity | 6599e82ae36d9abf30778b0fa8f11596 MD5 | raw file
  1. ;;; -*- Lisp -*-
  2. ;;; This isn't really lisp, but it's definitely a source file. we
  3. ;;; name it thus to avoid having to mess with the clc lpn translations
  4. ;;; first, the headers necessary to find definitions of everything
  5. ("winsock2.h")
  6. ;;; then the stuff we're looking for
  7. ((:integer af-inet "AF_INET" "IP Protocol family")
  8. (:integer af-unspec "AF_UNSPEC" "Unspecified")
  9. (:integer sock-stream "SOCK_STREAM"
  10. "Sequenced, reliable, connection-based byte streams.")
  11. (:integer sock-dgram "SOCK_DGRAM"
  12. "Connectionless, unreliable datagrams of fixed maximum length.")
  13. (:integer sock-raw "SOCK_RAW"
  14. "Raw protocol interface.")
  15. (:integer sock-rdm "SOCK_RDM"
  16. "Reliably-delivered messages.")
  17. (:integer sock-seqpacket "SOCK_SEQPACKET"
  18. "Sequenced, reliable, connection-based, datagrams of fixed maximum length.")
  19. (:integer sol-socket "SOL_SOCKET")
  20. ;; some of these may be linux-specific
  21. (:integer so-debug "SO_DEBUG"
  22. "Enable debugging in underlying protocol modules")
  23. (:integer so-reuseaddr "SO_REUSEADDR" "Enable local address reuse")
  24. (:integer so-type "SO_TYPE") ;get only
  25. (:integer so-error "SO_ERROR") ;get only (also clears)
  26. (:integer so-dontroute "SO_DONTROUTE"
  27. "Bypass routing facilities: instead send direct to appropriate network interface for the network portion of the destination address")
  28. (:integer so-broadcast "SO_BROADCAST" "Request permission to send broadcast datagrams")
  29. (:integer so-sndbuf "SO_SNDBUF")
  30. (:integer so-rcvbuf "SO_RCVBUF")
  31. (:integer so-keepalive "SO_KEEPALIVE"
  32. "Send periodic keepalives: if peer does not respond, we get SIGPIPE")
  33. (:integer so-oobinline "SO_OOBINLINE"
  34. "Put out-of-band data into the normal input queue when received")
  35. (:integer so-linger "SO_LINGER"
  36. "For reliable streams, pause a while on closing when unsent messages are queued")
  37. (:integer so-sndlowat "SO_SNDLOWAT")
  38. (:integer so-rcvlowat "SO_RCVLOWAT")
  39. (:integer so-sndtimeo "SO_SNDTIMEO")
  40. (:integer so-rcvtimeo "SO_RCVTIMEO")
  41. (:integer tcp-nodelay "TCP_NODELAY")
  42. (:integer HOST-NOT-FOUND "HOST_NOT_FOUND" "Authoritative Answer Host not found.")
  43. (:integer TRY-AGAIN "TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
  44. (:integer NO-RECOVERY "NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
  45. (:integer NO-DATA "NO_DATA" "Valid name, no data record of requested type.")
  46. (:integer NO-ADDRESS "NO_ADDRESS" "No address, look for MX record.")
  47. (:integer msg-oob "MSG_OOB")
  48. (:integer msg-peek "MSG_PEEK")
  49. (:integer msg-dontroute "MSG_DONTROUTE")
  50. (:integer EADDRINUSE "WSAEADDRINUSE")
  51. (:integer EAGAIN "WSAEWOULDBLOCK")
  52. (:integer EBADF "WSAEBADF")
  53. (:integer ECONNREFUSED "WSAECONNREFUSED")
  54. (:integer ETIMEDOUT "WSAETIMEDOUT")
  55. (:integer EINTR "WSAEINTR")
  56. (:integer EINVAL "WSAEINVAL")
  57. (:integer ENOBUFS "WSAENOBUFS")
  58. (:integer ENOMEM "WSAENOBUFS")
  59. (:integer EOPNOTSUPP "WSAEOPNOTSUPP")
  60. (:integer EPERM "WSAENETDOWN")
  61. (:integer EPROTONOSUPPORT "WSAEPROTONOSUPPORT")
  62. (:integer ESOCKTNOSUPPORT "WSAESOCKTNOSUPPORT")
  63. (:integer ENETUNREACH "WSAENETUNREACH")
  64. (:integer ENOTCONN "WSAENOTCONN")
  65. (:integer inaddr-any "INADDR_ANY")
  66. ;; for socket-receive
  67. (:type socklen-t "int")
  68. (:type size-t "size_t")
  69. (:type ssize-t "ssize_t")
  70. (:structure in-addr ("struct in_addr"
  71. ((array (unsigned 8)) addr "u_int32_t" "s_addr")))
  72. (:structure sockaddr-in ("struct sockaddr_in"
  73. (integer family "sa_family_t" "sin_family")
  74. ;; These two could be in-port-t and
  75. ;; in-addr-t, but then we'd throw away the
  76. ;; convenience (and byte-order agnosticism)
  77. ;; of the old sb-grovel scheme.
  78. ((array (unsigned 8)) port "u_int16_t" "sin_port")
  79. ((array (unsigned 8)) addr "struct in_addr" "sin_addr")))
  80. (:structure hostent ("struct hostent"
  81. (c-string-pointer name "char *" "h_name")
  82. ((* c-string) aliases "char **" "h_aliases")
  83. (integer type "int" "h_addrtype")
  84. (integer length "int" "h_length")
  85. ((* (* (unsigned 8))) addresses "char **" "h_addr_list")))
  86. (:structure protoent ("struct protoent"
  87. (c-string-pointer name "char *" "p_name")
  88. ((* (* t)) aliases "char **" "p_aliases")
  89. (integer proto "int" "p_proto")))
  90. (:function getprotobyname ("getprotobyname" (* protoent)
  91. (name c-string)))
  92. (:function getprotobynumber ("getprotobynumber" (* protoent)
  93. (proto int)))
  94. (:function win32-bind
  95. ("bind" int
  96. (sockfd int)
  97. (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  98. (addrlen socklen-t)))
  99. (:function win32-listen ("listen" int
  100. (socket int)
  101. (backlog int)))
  102. (:function win32-accept ("accept" int
  103. (socket int)
  104. (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  105. (addrlen int :in-out)))
  106. (:function win32-getpeername ("getpeername" int
  107. (socket int)
  108. (her-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  109. (addrlen socklen-t :in-out)))
  110. (:function win32-getsockname ("getsockname" int
  111. (socket int)
  112. (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  113. (addrlen socklen-t :in-out)))
  114. (:function win32-connect ("connect" int
  115. (socket int)
  116. (his-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  117. (addrlen socklen-t)))
  118. (:function win32-close ("closesocket" int
  119. (fd int)))
  120. (:function win32-recvfrom ("recvfrom" ssize-t
  121. (socket int)
  122. (buf (* t))
  123. (len integer)
  124. (flags int)
  125. (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  126. (socklen (* socklen-t))))
  127. (:function win32-recv ("recv" int
  128. (socket int)
  129. (buf (* t))
  130. (len integer)
  131. (flags integer)))
  132. (:function win32-send ("send" ssize-t
  133. (socket int)
  134. (buf (* t))
  135. (len size-t)
  136. (flags int)))
  137. (:function win32-sendto ("sendto" int
  138. (socket int)
  139. (buf (* t))
  140. (len size-t)
  141. (flags int)
  142. (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
  143. (socklen socklen-t)))
  144. (:function gethostbyname ("gethostbyname" (* hostent) (name c-string)))
  145. (:function gethostbyaddr ("gethostbyaddr" (* hostent)
  146. (addr (* t))
  147. (len int)
  148. (af int)))
  149. ;;; should be using getaddrinfo instead?
  150. (:function win32-setsockopt ("setsockopt" int
  151. (socket int)
  152. (level int)
  153. (optname int)
  154. (optval (* t))
  155. (optlen int))) ;;; should be socklen-t!
  156. (:function win32-getsockopt ("getsockopt" int
  157. (socket int)
  158. (level int)
  159. (optname int)
  160. (optval (* t))
  161. (optlen int :in-out))) ;;; should be socklen-t!
  162. (:function win32-ioctl ("ioctlsocket" int
  163. (socket int)
  164. (cmd int)
  165. (argp (unsigned 32) :in-out)))
  166. ;;; Win32 specific cruft
  167. (:function wsa-socket ("WSASocketA" int
  168. (af int)
  169. (type int)
  170. (protocol int)
  171. (lpProtocolInfo (* t))
  172. (g int)
  173. (flags int)))
  174. (:function fd->handle ("_get_osfhandle" int
  175. (fd int)))
  176. (:function handle->fd ("_open_osfhandle" int
  177. (osfhandle int)
  178. (flags int)))
  179. (:structure wsa-data ("struct WSAData"
  180. (integer version "u_int16_t" "wVersion")
  181. (integer high-version "u_int16_t" "wHighVersion")
  182. (c-string description "char" "szDescription")
  183. (c-string system-status "char" "szSystemStatus")
  184. (integer max-sockets "unsigned short" "iMaxSockets")
  185. (integer max-udp-dg "unsigned short" "iMaxUdpDg")
  186. (c-string-pointer vendor-info "char *" "lpVendorInfo")))
  187. (:function wsa-startup ("WSAStartup" int
  188. (wVersionRequested (unsigned 16))
  189. (lpWSAData wsa-data :out)))
  190. (:function wsa-get-last-error ("WSAGetLastError" int))
  191. )