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.")
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
11)
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 EINTR
"EINTR")
69 (:integer EINVAL
"EINVAL")
70 (:integer ENOBUFS
"ENOBUFS")
71 (:integer ENOMEM
"ENOMEM")
72 (:integer EOPNOTSUPP
"EOPNOTSUPP")
73 (:integer EPERM
"EPERM")
74 (:integer EPROTONOSUPPORT
"EPROTONOSUPPORT")
75 (:integer ESOCKTNOSUPPORT
"ESOCKTNOSUPPORT")
76 (:integer ENETUNREACH
"ENETUNREACH")
78 (:integer NETDB-INTERNAL
"NETDB_INTERNAL" "See errno.")
79 (:integer NETDB-SUCCESS
"NETDB_SUCCESS" "No problem.")
80 (:integer HOST-NOT-FOUND
"HOST_NOT_FOUND" "Authoritative Answer Host not found.")
81 (:integer TRY-AGAIN
"TRY_AGAIN" "Non-Authoritative Host not found, or SERVERFAIL.")
82 (:integer NO-RECOVERY
"NO_RECOVERY" "Non recoverable errors, FORMERR, REFUSED, NOTIMP.")
83 (:integer NO-DATA
"NO_DATA" "Valid name, no data record of requested type.")
84 (:integer NO-ADDRESS
"NO_ADDRESS" "No address, look for MX record.")
86 (:integer O-NONBLOCK
"O_NONBLOCK")
87 (:integer f-getfl
"F_GETFL")
88 (:integer f-setfl
"F_SETFL")
90 #+linux
(:integer msg-nosignal
"MSG_NOSIGNAL")
91 (:integer msg-oob
"MSG_OOB")
92 (:integer msg-peek
"MSG_PEEK")
93 (:integer msg-trunc
"MSG_TRUNC")
94 (:integer msg-waitall
"MSG_WAITALL")
97 ;;; stat is nothing to do with sockets, but I keep it around for testing
99 (:structure stat
("struct stat"
100 (t dev
"dev_t" "st_dev")
101 ((alien:integer
32) atime
"time_t" "st_atime")))
102 (:function stat
("stat" (integer 32)
106 (:structure protoent
("struct protoent"
107 ((* t
) name
"char *" "p_name")
108 ((* (* t
)) aliases
"char **" "p_aliases")
109 (integer proto
"int" "p_proto")))
110 (:function getprotobyname
("getprotobyname" (* t
)
112 (:integer inaddr-any
"INADDR_ANY")
113 (:structure in-addr
("struct in_addr"
114 ((array (unsigned 8) 4) addr
"u_int32_t" "s_addr")))
115 (:structure sockaddr-in
("struct sockaddr_in"
116 (integer family
"sa_family_t" "sin_family")
117 ((array (unsigned 8) 2) port
"u_int16_t" "sin_port")
118 ((array (unsigned 8) 4) addr
"struct in_addr" "sin_addr")))
119 (:structure sockaddr-un
("struct sockaddr_un"
120 (integer family
"sa_family_t" "sun_family")
121 ((array (unsigned 8) 108) path
"char" "sun_path")))
122 (:structure hostent
("struct hostent"
123 ((* t
) name
"char *" "h_name")
124 ((* c-string
) aliases
"char **" "h_aliases")
125 (integer type
"int" "h_addrtype")
126 (integer length
"int" "h_length")
127 ((* (* (unsigned 8))) addresses
"char **" "h_addr_list")))
128 (:function socket
("socket" integer
132 (:function bind
("bind" integer
136 (:function listen
("listen" integer
139 (:function accept
("accept" integer
142 (addrlen integer
:in-out
)))
143 (:function getpeername
("getpeername" integer
146 (addrlen integer
:in-out
)))
147 (:function getsockname
("getsockname" integer
150 (addrlen integer
:in-out
)))
151 (:function connect
("connect" integer
156 (:function close
("close" integer
158 (:function recvfrom
("recvfrom" integer
164 (socklen (* integer
))))
165 (:function gethostbyname
("gethostbyname" (* t
) (name c-string
)))
166 (:function gethostbyaddr
("gethostbyaddr" (* t
)
170 (:structure hostent
("struct hostent"
171 ((* t
) name
"char *" "h_name")
172 (integer length
"int" "h_length")))
174 (:function setsockopt
("setsockopt" integer
180 (:function fcntl
("fcntl" integer
184 (:function getsockopt
("getsockopt" integer
189 (optlen integer
:in-out
))))