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 #-solaris
(:integer af-local
"AF_LOCAL" "Local to host (pipes and file-domain).")
15 (:integer af-unix
"AF_UNIX" "Old BSD name for af-local. ")
16 #-
(or solaris freebsd
) (:integer af-file
"AF_FILE" "POSIX name for af-local. ")
17 #+linux
(:integer af-inet6
"AF_INET6" "IP version 6. ")
18 #+linux
(:integer af-route
"AF_NETLINK" "Alias to emulate 4.4BSD ")
20 (:integer sock-stream
"SOCK_STREAM"
21 "Sequenced, reliable, connection-based byte streams.")
22 (:integer sock-dgram
"SOCK_DGRAM"
23 "Connectionless, unreliable datagrams of fixed maximum length.")
24 (:integer sock-raw
"SOCK_RAW"
25 "Raw protocol interface.")
26 (:integer sock-rdm
"SOCK_RDM"
27 "Reliably-delivered messages.")
28 (:integer sock-seqpacket
"SOCK_SEQPACKET"
29 "Sequenced, reliable, connection-based, datagrams of fixed maximum length.")
31 (:integer sol-socket
"SOL_SOCKET")
33 ;; some of these may be linux-specific
34 (:integer so-debug
"SO_DEBUG"
35 "Enable debugging in underlying protocol modules")
36 (:integer so-reuseaddr
"SO_REUSEADDR" "Enable local address reuse")
37 (:integer so-type
"SO_TYPE") ;get only
38 (:integer so-error
"SO_ERROR") ;get only (also clears)
39 (:integer so-dontroute
"SO_DONTROUTE"
40 "Bypass routing facilities: instead send direct to appropriate network interface for the network portion of the destination address")
41 (:integer so-broadcast
"SO_BROADCAST" "Request permission to send broadcast datagrams")
42 (:integer so-sndbuf
"SO_SNDBUF")
43 #+linux
(:integer so-passcred
"SO_PASSCRED")
44 (:integer so-rcvbuf
"SO_RCVBUF")
45 (:integer so-keepalive
"SO_KEEPALIVE"
46 "Send periodic keepalives: if peer does not respond, we get SIGPIPE")
47 (:integer so-oobinline
"SO_OOBINLINE"
48 "Put out-of-band data into the normal input queue when received")
49 (:integer so-no-check
11)
50 #+linux
(:integer so-priority
"SO_PRIORITY")
51 (:integer so-linger
"SO_LINGER"
52 "For reliable streams, pause a while on closing when unsent messages are queued")
53 #+linux
(:integer so-bsdcompat
"SO_BSDCOMPAT")
54 (:integer so-sndlowat
"SO_SNDLOWAT")
55 (:integer so-rcvlowat
"SO_RCVLOWAT")
56 (:integer so-sndtimeo
"SO_SNDTIMEO")
57 (:integer so-rcvtimeo
"SO_RCVTIMEO")
59 (:integer tcp-nodelay
"TCP_NODELAY")
60 #+linux
(:integer so-bindtodevice
"SO_BINDTODEVICE")
61 (:integer ifnamsiz
"IFNAMSIZ")
63 (:integer EADDRINUSE
"EADDRINUSE")
64 (:integer EAGAIN
"EAGAIN")
65 (:integer EBADF
"EBADF")
66 (:integer ECONNREFUSED
"ECONNREFUSED")
67 (:integer EINTR
"EINTR")
68 (:integer EINVAL
"EINVAL")
69 (:integer ENOBUFS
"ENOBUFS")
70 (:integer ENOMEM
"ENOMEM")
71 (:integer EOPNOTSUPP
"EOPNOTSUPP")
72 (:integer EPERM
"EPERM")
73 (:integer EPROTONOSUPPORT
"EPROTONOSUPPORT")
74 (:integer ESOCKTNOSUPPORT
"ESOCKTNOSUPPORT")
75 (:integer ENETUNREACH
"ENETUNREACH")
77 (:integer NETDB-INTERNAL
"NETDB_INTERNAL" "See errno.")
78 (:integer NETDB-SUCCESS
"NETDB_SUCCESS" "No problem.")
79 (:integer HOST-NOT-FOUND
"HOST_NOT_FOUND" "Authoritative Answer Host not found.")
80 (:integer TRY-AGAIN
"TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
81 (:integer NO-RECOVERY
"NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
82 (:integer NO-DATA
"NO_DATA" "Valid name, no data record of requested type.")
83 (:integer NO-ADDRESS
"NO_ADDRESS" "No address, look for MX record.")
85 (:integer O-NONBLOCK
"O_NONBLOCK")
86 (:integer f-getfl
"F_GETFL")
87 (:integer f-setfl
"F_SETFL")
89 #+linux
(:integer msg-nosignal
"MSG_NOSIGNAL")
90 (:integer msg-oob
"MSG_OOB")
91 (:integer msg-peek
"MSG_PEEK")
92 (:integer msg-trunc
"MSG_TRUNC")
93 (:integer msg-waitall
"MSG_WAITALL")
96 ;;; stat is nothing to do with sockets, but I keep it around for testing
98 (:structure stat
("struct stat"
99 (t dev
"dev_t" "st_dev")
100 ((alien:integer
32) atime
"time_t" "st_atime")))
101 (:function stat
("stat" (integer 32)
105 (:structure protoent
("struct protoent"
106 ((* t
) name
"char *" "p_name")
107 ((* (* t
)) aliases
"char **" "p_aliases")
108 (integer proto
"int" "p_proto")))
109 (:function getprotobyname
("getprotobyname" (* t
)
111 (:integer inaddr-any
"INADDR_ANY")
112 (:structure in-addr
("struct in_addr"
113 ((array (unsigned 8) 4) addr
"u_int32_t" "s_addr")))
114 (:structure sockaddr-in
("struct sockaddr_in"
115 (integer family
"sa_family_t" "sin_family")
116 ((array (unsigned 8) 2) port
"u_int16_t" "sin_port")
117 ((array (unsigned 8) 4) addr
"struct in_addr" "sin_addr")))
118 (:structure sockaddr-un
("struct sockaddr_un"
119 (integer family
"sa_family_t" "sun_family")
120 ((array (unsigned 8) 108) path
"char" "sun_path")))
121 (:structure hostent
("struct hostent"
122 ((* t
) name
"char *" "h_name")
123 ((* c-string
) aliases
"char **" "h_aliases")
124 (integer type
"int" "h_addrtype")
125 (integer length
"int" "h_length")
126 ((* (* (unsigned 8))) addresses
"char **" "h_addr_list")))
127 (:function socket
("socket" integer
131 (:function bind
("bind" integer
135 (:function listen
("listen" integer
138 (:function accept
("accept" integer
141 (addrlen integer
:in-out
)))
142 (:function getpeername
("getpeername" integer
145 (addrlen integer
:in-out
)))
146 (:function getsockname
("getsockname" integer
149 (addrlen integer
:in-out
)))
150 (:function connect
("connect" integer
155 (:function close
("close" integer
157 (:function recvfrom
("recvfrom" integer
163 (socklen (* integer
))))
164 (:function gethostbyname
("gethostbyname" (* t
) (name c-string
)))
165 (:function gethostbyaddr
("gethostbyaddr" (* t
)
169 (:structure hostent
("struct hostent"
170 ((* t
) name
"char *" "h_name")
171 (integer length
"int" "h_length")))
173 (:function setsockopt
("setsockopt" integer
179 (:function fcntl
("fcntl" integer
183 (:function getsockopt
("getsockopt" integer
188 (optlen integer
:in-out
))))