0.9.0:
[sbcl/lichteblau.git] / contrib / sb-bsd-sockets / constants.lisp
blobab29f6641263ee70ad89d55b4439c29d293ab454
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 ("sys/types.h" "sys/socket.h" "sys/stat.h" "unistd.h" "sys/un.h"
8 "netinet/in.h" "netinet/in_systm.h" "netinet/ip.h" "net/if.h"
9 "netdb.h" "errno.h" "netinet/tcp.h" "fcntl.h" )
11 ;;; then the stuff we're looking for
12 ((:integer af-inet "AF_INET" "IP Protocol family")
13 (:integer af-unspec "AF_UNSPEC" "Unspecified")
14 (:integer af-local
15 #+(or sunos solaris) "AF_UNIX"
16 #-(or sunos solaris) "AF_LOCAL"
17 "Local to host (pipes and file-domain).")
18 #+linux (:integer af-inet6 "AF_INET6" "IP version 6")
19 #+linux (:integer af-route "AF_NETLINK" "Alias to emulate 4.4BSD ")
21 (:integer sock-stream "SOCK_STREAM"
22 "Sequenced, reliable, connection-based byte streams.")
23 (:integer sock-dgram "SOCK_DGRAM"
24 "Connectionless, unreliable datagrams of fixed maximum length.")
25 (:integer sock-raw "SOCK_RAW"
26 "Raw protocol interface.")
27 (:integer sock-rdm "SOCK_RDM"
28 "Reliably-delivered messages.")
29 (:integer sock-seqpacket "SOCK_SEQPACKET"
30 "Sequenced, reliable, connection-based, datagrams of fixed maximum length.")
32 (:integer sol-socket "SOL_SOCKET")
34 ;; some of these may be linux-specific
35 (:integer so-debug "SO_DEBUG"
36 "Enable debugging in underlying protocol modules")
37 (:integer so-reuseaddr "SO_REUSEADDR" "Enable local address reuse")
38 (:integer so-type "SO_TYPE") ;get only
39 (:integer so-error "SO_ERROR") ;get only (also clears)
40 (:integer so-dontroute "SO_DONTROUTE"
41 "Bypass routing facilities: instead send direct to appropriate network interface for the network portion of the destination address")
42 (:integer so-broadcast "SO_BROADCAST" "Request permission to send broadcast datagrams")
43 (:integer so-sndbuf "SO_SNDBUF")
44 #+linux (:integer so-passcred "SO_PASSCRED")
45 (:integer so-rcvbuf "SO_RCVBUF")
46 (:integer so-keepalive "SO_KEEPALIVE"
47 "Send periodic keepalives: if peer does not respond, we get SIGPIPE")
48 (:integer so-oobinline "SO_OOBINLINE"
49 "Put out-of-band data into the normal input queue when received")
50 (:integer so-no-check "SO_NO_CHECK")
51 #+linux (:integer so-priority "SO_PRIORITY")
52 (:integer so-linger "SO_LINGER"
53 "For reliable streams, pause a while on closing when unsent messages are queued")
54 #+linux (:integer so-bsdcompat "SO_BSDCOMPAT")
55 (:integer so-sndlowat "SO_SNDLOWAT")
56 (:integer so-rcvlowat "SO_RCVLOWAT")
57 (:integer so-sndtimeo "SO_SNDTIMEO")
58 (:integer so-rcvtimeo "SO_RCVTIMEO")
60 (:integer tcp-nodelay "TCP_NODELAY")
61 #+linux (:integer so-bindtodevice "SO_BINDTODEVICE")
62 (:integer ifnamsiz "IFNAMSIZ")
64 (:integer EADDRINUSE "EADDRINUSE")
65 (:integer EAGAIN "EAGAIN")
66 (:integer EBADF "EBADF")
67 (:integer ECONNREFUSED "ECONNREFUSED")
68 (:integer ETIMEDOUT "ETIMEDOUT")
69 (:integer EINTR "EINTR")
70 (:integer EINVAL "EINVAL")
71 (:integer ENOBUFS "ENOBUFS")
72 (:integer ENOMEM "ENOMEM")
73 (:integer EOPNOTSUPP "EOPNOTSUPP")
74 (:integer EPERM "EPERM")
75 (:integer EPROTONOSUPPORT "EPROTONOSUPPORT")
76 (:integer ESOCKTNOSUPPORT "ESOCKTNOSUPPORT")
77 (:integer ENETUNREACH "ENETUNREACH")
79 (:integer NETDB-INTERNAL "NETDB_INTERNAL" "See errno.")
80 (:integer NETDB-SUCCESS "NETDB_SUCCESS" "No problem.")
81 (:integer HOST-NOT-FOUND "HOST_NOT_FOUND" "Authoritative Answer Host not found.")
82 (:integer TRY-AGAIN "TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
83 (:integer NO-RECOVERY "NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
84 (:integer NO-DATA "NO_DATA" "Valid name, no data record of requested type.")
85 (:integer NO-ADDRESS "NO_ADDRESS" "No address, look for MX record.")
87 (:integer O-NONBLOCK "O_NONBLOCK")
88 (:integer f-getfl "F_GETFL")
89 (:integer f-setfl "F_SETFL")
91 #+linux (:integer msg-nosignal "MSG_NOSIGNAL")
92 (:integer msg-oob "MSG_OOB")
93 (:integer msg-peek "MSG_PEEK")
94 (:integer msg-trunc "MSG_TRUNC")
95 (:integer msg-waitall "MSG_WAITALL")
97 ;; for socket-receive
98 (:type socklen-t "socklen_t")
101 ;;; stat is nothing to do with sockets, but I keep it around for testing
102 ;;; the ffi glue
103 (:structure stat ("struct stat"
104 (t dev "dev_t" "st_dev")
105 ((alien:integer 32) atime "time_t" "st_atime")))
106 (:function stat ("stat" (integer 32)
107 (file-name (* t))
108 (buf (* t))))
110 (:structure protoent ("struct protoent"
111 (c-string-pointer name "char *" "p_name")
112 ((* (* t)) aliases "char **" "p_aliases")
113 (integer proto "int" "p_proto")))
114 (:function getprotobyname ("getprotobyname" (* protoent)
115 (name c-string)))
116 (:integer inaddr-any "INADDR_ANY")
117 (:structure in-addr ("struct in_addr"
118 ((array (unsigned 8)) addr "u_int32_t" "s_addr")))
119 (:structure sockaddr-in ("struct sockaddr_in"
120 (integer family "sa_family_t" "sin_family")
121 ;; These two could be in-port-t and
122 ;; in-addr-t, but then we'd throw away the
123 ;; convenience (and byte-order agnosticism)
124 ;; of the old sb-grovel scheme.
125 ((array (unsigned 8)) port "u_int16_t" "sin_port")
126 ((array (unsigned 8)) addr "struct in_addr" "sin_addr")))
127 (:structure sockaddr-un ("struct sockaddr_un"
128 (integer family "sa_family_t" "sun_family")
129 (c-string path "char" "sun_path")))
130 (:structure hostent ("struct hostent"
131 (c-string-pointer name "char *" "h_name")
132 ((* c-string) aliases "char **" "h_aliases")
133 (integer type "int" "h_addrtype")
134 (integer length "int" "h_length")
135 ((* (* (unsigned 8))) addresses "char **" "h_addr_list")))
136 (:function socket ("socket" int
137 (domain int)
138 (type int)
139 (protocol int)))
140 (:function bind ("bind" int
141 (sockfd int)
142 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
143 (addrlen int)))
144 (:function listen ("listen" int
145 (socket int)
146 (backlog int)))
147 (:function accept ("accept" int
148 (socket int)
149 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
150 (addrlen int :in-out)))
151 (:function getpeername ("getpeername" int
152 (socket int)
153 (her-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
154 (addrlen int :in-out)))
155 (:function getsockname ("getsockname" int
156 (socket int)
157 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
158 (addrlen int :in-out)))
159 (:function connect ("connect" int
160 (socket int)
161 (his-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
162 (addrlen int )))
164 (:function close ("close" int
165 (fd int)))
166 (:function recvfrom ("recvfrom" int
167 (socket int)
168 (buf (* t))
169 (len integer)
170 (flags int)
171 (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
172 (socklen (* socklen-t))))
173 (:function gethostbyname ("gethostbyname" (* hostent) (name c-string)))
174 (:function gethostbyaddr ("gethostbyaddr" (* hostent)
175 (addr (* t))
176 (len int)
177 (af int)))
178 (:function setsockopt ("setsockopt" int
179 (socket int)
180 (level int)
181 (optname int)
182 (optval (* t))
183 (optlen int)))
184 (:function fcntl ("fcntl" int
185 (fd int)
186 (cmd int)
187 (arg long)))
188 (:function getsockopt ("getsockopt" int
189 (socket int)
190 (level int)
191 (optname int)
192 (optval (* t))
193 (optlen (* int)))))