Fix hidden bug in immobile space defrag.
[sbcl.git] / contrib / sb-bsd-sockets / win32-constants.lisp
blobd66e6c996fc96b5404e6c0f7dedbcc051a6c3ec2
1 ;;; -*- Lisp -*-
3 ;;; This isn't really lisp, but it's definitely a source file. we
4 ;;; name it thus to avoid having to mess with the clc lpn translations
6 ;;; first, the headers necessary to find definitions of everything
7 ("winsock2.h" "errno.h")
9 ;;; then the stuff we're looking for
10 ((:integer af-inet "AF_INET" "IP Protocol family")
11 (:integer af-unspec "AF_UNSPEC" "Unspecified")
12 (:integer sock-stream "SOCK_STREAM"
13 "Sequenced, reliable, connection-based byte streams.")
14 (:integer sock-dgram "SOCK_DGRAM"
15 "Connectionless, unreliable datagrams of fixed maximum length.")
16 (:integer sock-raw "SOCK_RAW"
17 "Raw protocol interface.")
18 (:integer sock-rdm "SOCK_RDM"
19 "Reliably-delivered messages.")
20 (:integer sock-seqpacket "SOCK_SEQPACKET"
21 "Sequenced, reliable, connection-based, datagrams of fixed maximum length.")
23 (:integer sol-socket "SOL_SOCKET")
25 ;; some of these may be linux-specific
26 (:integer so-debug "SO_DEBUG"
27 "Enable debugging in underlying protocol modules")
28 (:integer so-reuseaddr "SO_REUSEADDR" "Enable local address reuse")
29 (:integer so-type "SO_TYPE") ;get only
30 (:integer so-error "SO_ERROR") ;get only (also clears)
31 (:integer so-dontroute "SO_DONTROUTE"
32 "Bypass routing facilities: instead send direct to appropriate network interface for the network portion of the destination address")
33 (:integer so-broadcast "SO_BROADCAST" "Request permission to send broadcast datagrams")
34 (:integer so-sndbuf "SO_SNDBUF")
35 (:integer so-rcvbuf "SO_RCVBUF")
36 (:integer so-keepalive "SO_KEEPALIVE"
37 "Send periodic keepalives: if peer does not respond, we get SIGPIPE")
38 (:integer so-oobinline "SO_OOBINLINE"
39 "Put out-of-band data into the normal input queue when received")
40 (:integer so-linger "SO_LINGER"
41 "For reliable streams, pause a while on closing when unsent messages are queued")
42 (:integer so-sndlowat "SO_SNDLOWAT")
43 (:integer so-rcvlowat "SO_RCVLOWAT")
44 (:integer so-sndtimeo "SO_SNDTIMEO")
45 (:integer so-rcvtimeo "SO_RCVTIMEO")
47 (:integer tcp-nodelay "TCP_NODELAY")
49 (:integer HOST-NOT-FOUND "HOST_NOT_FOUND" "Authoritative Answer Host not found.")
50 (:integer TRY-AGAIN "TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
51 (:integer NO-RECOVERY "NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
52 (:integer NO-DATA "NO_DATA" "Valid name, no data record of requested type.")
53 (:integer NO-ADDRESS "NO_ADDRESS" "No address, look for MX record.")
55 (:integer msg-oob "MSG_OOB")
56 (:integer msg-peek "MSG_PEEK")
57 (:integer msg-dontroute "MSG_DONTROUTE")
59 ;; socket shutdown flags
60 (:integer SHUT_RD "SD_RECEIVE")
61 (:integer SHUT_WR "SD_SEND")
62 (:integer SHUT_RDWR "SD_BOTH")
64 ;; errors
65 (:integer EADDRINUSE "WSAEADDRINUSE")
66 (:integer EAGAIN "WSAEWOULDBLOCK")
67 (:integer EBADF "WSAEBADF")
68 (:integer ECONNREFUSED "WSAECONNREFUSED")
69 (:integer ETIMEDOUT "WSAETIMEDOUT")
70 (:integer EINTR "WSAEINTR")
71 (:integer EINVAL "WSAEINVAL")
72 (:integer ENOBUFS "WSAENOBUFS")
73 (:integer ENOMEM "WSAENOBUFS")
74 (:integer EOPNOTSUPP "WSAEOPNOTSUPP")
75 (:integer EPERM "WSAENETDOWN")
76 (:integer EPROTONOSUPPORT "WSAEPROTONOSUPPORT")
77 (:integer ESOCKTNOSUPPORT "WSAESOCKTNOSUPPORT")
78 (:integer ENETUNREACH "WSAENETUNREACH")
79 (:integer ENOTCONN "WSAENOTCONN")
80 (:integer EAFNOSUPPORT "EAFNOSUPPORT")
81 (:integer EINPROGRESS "EINPROGRESS")
83 (:integer inaddr-any "INADDR_ANY")
84 (:integer FIONBIO "FIONBIO")
87 ;; for socket-receive
88 (:type socklen-t "int")
90 (:structure in-addr ("struct in_addr"
91 ((array (unsigned 8)) addr "u_int32_t" "s_addr")))
93 (:structure sockaddr-in ("struct sockaddr_in"
94 (integer family "sa_family_t" "sin_family")
95 ;; These two could be in-port-t and
96 ;; in-addr-t, but then we'd throw away the
97 ;; convenience (and byte-order agnosticism)
98 ;; of the old sb-grovel scheme.
99 ((array (unsigned 8)) port "u_int16_t" "sin_port")
100 ((array (unsigned 8)) addr "struct in_addr" "sin_addr")))
102 (:structure hostent ("struct hostent"
103 (c-string-pointer name "char *" "h_name")
104 ((* c-string) aliases "char **" "h_aliases")
105 (integer type "int" "h_addrtype")
106 (integer length "int" "h_length")
107 ((* (* (unsigned 8))) addresses "char **" "h_addr_list")))
109 (:structure protoent ("struct protoent"
110 (c-string-pointer name "char *" "p_name")
111 ((* (* t)) aliases "char **" "p_aliases")
112 (integer proto "int" "p_proto")))
114 (:function getprotobyname ("getprotobyname" (* protoent)
115 (name c-string)))
117 (:function getprotobynumber ("getprotobynumber" (* protoent)
118 (proto int)))
120 ;; FIXME: We should probably grovel the windows SOCKET type and use it in
121 ;; these instead of int...
123 (:function bind ("bind" int
124 (sockfd int)
125 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
126 (addrlen socklen-t)))
128 (:function listen ("listen" int
129 (socket int)
130 (backlog int)))
132 (:function accept ("accept" int
133 (socket int)
134 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
135 (addrlen int :in-out)))
137 (:function getpeername ("getpeername" int
138 (socket int)
139 (her-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
140 (addrlen socklen-t :in-out)))
142 (:function getsockname ("getsockname" int
143 (socket int)
144 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
145 (addrlen socklen-t :in-out)))
147 (:function connect ("connect" int
148 (socket int)
149 (his-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
150 (addrlen socklen-t)))
152 (:function close ("closesocket" int
153 (fd int)))
155 (:function shutdown ("shutdown" int
156 (socket int) ; KLUDGE: should be SOCKET, not int.
157 (how int)))
159 (:function recvfrom ("recvfrom" int
160 (socket int)
161 (buf (* t))
162 (len integer)
163 (flags int)
164 (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
165 (socklen (* socklen-t))))
167 (:function recv ("recv" int
168 (socket int)
169 (buf (* t))
170 (len integer)
171 (flags integer)))
173 (:function send ("send" int
174 (socket int)
175 (buf (* t))
176 (len int)
177 (flags int)))
179 (:function sendto ("sendto" int
180 (socket int)
181 (buf (* t))
182 (len int)
183 (flags int)
184 (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
185 (socklen socklen-t)))
187 (:function gethostbyname ("gethostbyname" (* hostent) (name c-string)))
189 (:function gethostbyaddr ("gethostbyaddr" (* hostent)
190 (addr (* t))
191 (len int)
192 (af int)))
194 ;;; FIXME should be using getaddrinfo instead?
196 (:function setsockopt ("setsockopt" int
197 (socket int)
198 (level int)
199 (optname int)
200 (optval (* t))
201 (optlen int))) ;;; should be socklen-t!
203 (:function getsockopt ("getsockopt" int
204 (socket int)
205 (level int)
206 (optname int)
207 (optval (* t))
208 (optlen int :in-out))) ;;; should be socklen-t!
210 (:function ioctl ("ioctlsocket" int
211 (socket int)
212 (cmd int)
213 (argp (unsigned 32) :in-out)))
216 ;;; Win32 specific cruft
217 (:function wsa-socket ("WSASocketA" int
218 (af int)
219 (type int)
220 (protocol int)
221 (lpProtocolInfo (* t))
222 (g int)
223 (flags int)))
225 (:structure wsa-data ("struct WSAData"
226 (integer version "u_int16_t" "wVersion")
227 (integer high-version "u_int16_t" "wHighVersion")
228 (c-string description "char" "szDescription")
229 (c-string system-status "char" "szSystemStatus")
230 (integer max-sockets "unsigned short" "iMaxSockets")
231 (integer max-udp-dg "unsigned short" "iMaxUdpDg")
232 (c-string-pointer vendor-info "char *" "lpVendorInfo")))
234 (:function wsa-startup ("WSAStartup" int
235 (wVersionRequested (unsigned 16))
236 (lpWSAData wsa-data :out)))
238 (:function wsa-get-last-error ("WSAGetLastError" int))
239 (:integer IPPROTO_IP "IPPROTO_IP")
240 (:integer IPPROTO_IPV6 "IPPROTO_IPV6")
241 (:integer IPPROTO_ICMP "IPPROTO_ICMP")
242 (:integer IPPROTO_IGMP "IPPROTO_IGMP")
243 (:integer IPPROTO_TCP "IPPROTO_TCP")
244 (:integer IPPROTO_UDP "IPPROTO_UDP")
245 (:integer IPPROTO_RAW "IPPROTO_RAW"))