0.9.3:
[sbcl/lichteblau.git] / contrib / sb-bsd-sockets / constants.lisp
blobc5d19a31fca3d969d9c1dba9053c59e3c5b94ba9
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")
78 (:integer ENOTCONN "ENOTCONN")
80 (:integer NETDB-INTERNAL "NETDB_INTERNAL" "See errno.")
81 (:integer NETDB-SUCCESS "NETDB_SUCCESS" "No problem.")
82 (:integer HOST-NOT-FOUND "HOST_NOT_FOUND" "Authoritative Answer Host not found.")
83 (:integer TRY-AGAIN "TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
84 (:integer NO-RECOVERY "NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
85 (:integer NO-DATA "NO_DATA" "Valid name, no data record of requested type.")
86 (:integer NO-ADDRESS "NO_ADDRESS" "No address, look for MX record.")
88 (:integer O-NONBLOCK "O_NONBLOCK")
89 (:integer f-getfl "F_GETFL")
90 (:integer f-setfl "F_SETFL")
92 #+linux (:integer msg-nosignal "MSG_NOSIGNAL")
93 (:integer msg-oob "MSG_OOB")
94 (:integer msg-peek "MSG_PEEK")
95 (:integer msg-trunc "MSG_TRUNC")
96 (:integer msg-waitall "MSG_WAITALL")
98 ;; for socket-receive
99 (:type socklen-t "socklen_t")
102 ;;; stat is nothing to do with sockets, but I keep it around for testing
103 ;;; the ffi glue
104 (:structure stat ("struct stat"
105 (t dev "dev_t" "st_dev")
106 ((alien:integer 32) atime "time_t" "st_atime")))
107 (:function stat ("stat" (integer 32)
108 (file-name (* t))
109 (buf (* t))))
111 (:structure protoent ("struct protoent"
112 (c-string-pointer name "char *" "p_name")
113 ((* (* t)) aliases "char **" "p_aliases")
114 (integer proto "int" "p_proto")))
115 (:function getprotobyname ("getprotobyname" (* protoent)
116 (name c-string)))
117 (:integer inaddr-any "INADDR_ANY")
118 (:structure in-addr ("struct in_addr"
119 ((array (unsigned 8)) addr "u_int32_t" "s_addr")))
120 (:structure sockaddr-in ("struct sockaddr_in"
121 (integer family "sa_family_t" "sin_family")
122 ;; These two could be in-port-t and
123 ;; in-addr-t, but then we'd throw away the
124 ;; convenience (and byte-order agnosticism)
125 ;; of the old sb-grovel scheme.
126 ((array (unsigned 8)) port "u_int16_t" "sin_port")
127 ((array (unsigned 8)) addr "struct in_addr" "sin_addr")))
128 (:structure sockaddr-un ("struct sockaddr_un"
129 (integer family "sa_family_t" "sun_family")
130 (c-string path "char" "sun_path")))
131 (:structure hostent ("struct hostent"
132 (c-string-pointer name "char *" "h_name")
133 ((* c-string) aliases "char **" "h_aliases")
134 (integer type "int" "h_addrtype")
135 (integer length "int" "h_length")
136 ((* (* (unsigned 8))) addresses "char **" "h_addr_list")))
137 (:function socket ("socket" int
138 (domain int)
139 (type int)
140 (protocol int)))
141 (:function bind ("bind" int
142 (sockfd int)
143 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
144 (addrlen int)))
145 (:function listen ("listen" int
146 (socket int)
147 (backlog int)))
148 (:function accept ("accept" int
149 (socket int)
150 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
151 (addrlen int :in-out)))
152 (:function getpeername ("getpeername" int
153 (socket int)
154 (her-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
155 (addrlen int :in-out)))
156 (:function getsockname ("getsockname" int
157 (socket int)
158 (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
159 (addrlen int :in-out)))
160 (:function connect ("connect" int
161 (socket int)
162 (his-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
163 (addrlen int )))
165 (:function close ("close" int
166 (fd int)))
167 (:function recvfrom ("recvfrom" int
168 (socket int)
169 (buf (* t))
170 (len integer)
171 (flags int)
172 (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un?
173 (socklen (* socklen-t))))
174 (:function gethostbyname ("gethostbyname" (* hostent) (name c-string)))
175 (:function gethostbyaddr ("gethostbyaddr" (* hostent)
176 (addr (* t))
177 (len int)
178 (af int)))
179 (:function setsockopt ("setsockopt" int
180 (socket int)
181 (level int)
182 (optname int)
183 (optval (* t))
184 (optlen int)))
185 (:function fcntl ("fcntl" int
186 (fd int)
187 (cmd int)
188 (arg long)))
189 (:function getsockopt ("getsockopt" int
190 (socket int)
191 (level int)
192 (optname int)
193 (optval (* t))
194 (optlen (* int)))))