[10d2c0]: contrib / sb-bsd-sockets / constants.lisp Maximize Restore History

Download this file

constants.lisp    190 lines (175 with data), 8.0 kB

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