X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Fconstants.lisp;h=ab29f6641263ee70ad89d55b4439c29d293ab454;hb=3b3086ad5ad36a66302e1e6c5b7c8246c7963462;hp=e79288838f72fdf16eb2fbbd92aa8628201c7b75;hpb=10d2c05ea44ca0837091434fe2223c0c31687615;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/constants.lisp b/contrib/sb-bsd-sockets/constants.lisp index e792888..ab29f66 100644 --- a/contrib/sb-bsd-sockets/constants.lisp +++ b/contrib/sb-bsd-sockets/constants.lisp @@ -10,13 +10,14 @@ ;;; 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 af-unspec "AF_UNSPEC" "Unspecified") + (:integer af-local + #+(or sunos solaris) "AF_UNIX" + #-(or sunos solaris) "AF_LOCAL" + "Local to host (pipes and file-domain).") + #+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" @@ -46,8 +47,8 @@ "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-no-check "SO_NO_CHECK") +#+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") @@ -64,6 +65,7 @@ (:integer EAGAIN "EAGAIN") (:integer EBADF "EBADF") (:integer ECONNREFUSED "ECONNREFUSED") + (:integer ETIMEDOUT "ETIMEDOUT") (:integer EINTR "EINTR") (:integer EINVAL "EINVAL") (:integer ENOBUFS "ENOBUFS") @@ -92,6 +94,9 @@ (:integer msg-trunc "MSG_TRUNC") (:integer msg-waitall "MSG_WAITALL") + ;; for socket-receive + (:type socklen-t "socklen_t") + #| ;;; stat is nothing to do with sockets, but I keep it around for testing ;;; the ffi glue @@ -103,87 +108,87 @@ (buf (* t)))) |# (:structure protoent ("struct protoent" - ((* t) name "char *" "p_name") + (c-string-pointer name "char *" "p_name") ((* (* t)) aliases "char **" "p_aliases") (integer proto "int" "p_proto"))) - (:function getprotobyname ("getprotobyname" (* t) + (:function getprotobyname ("getprotobyname" (* protoent) (name c-string))) (:integer inaddr-any "INADDR_ANY") (:structure in-addr ("struct in_addr" - ((array (unsigned 8) 4) addr "u_int32_t" "s_addr"))) + ((array (unsigned 8)) 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"))) + ;; These two could be in-port-t and + ;; in-addr-t, but then we'd throw away the + ;; convenience (and byte-order agnosticism) + ;; of the old sb-grovel scheme. + ((array (unsigned 8)) port "u_int16_t" "sin_port") + ((array (unsigned 8)) 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"))) + (c-string path "char" "sun_path"))) (:structure hostent ("struct hostent" - ((* t) name "char *" "h_name") + (c-string-pointer 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 socket ("socket" int + (domain int) + (type int) + (protocol int))) + (:function bind ("bind" int + (sockfd int) + (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? + (addrlen int))) + (:function listen ("listen" int + (socket int) + (backlog int))) + (:function accept ("accept" int + (socket int) + (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? + (addrlen int :in-out))) + (:function getpeername ("getpeername" int + (socket int) + (her-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? + (addrlen int :in-out))) + (:function getsockname ("getsockname" int + (socket int) + (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? + (addrlen int :in-out))) + (:function connect ("connect" int + (socket int) + (his-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? + (addrlen int ))) - (:function close ("close" integer - (fd integer))) - (:function recvfrom ("recvfrom" integer - (socket integer) + (:function close ("close" int + (fd int))) + (:function recvfrom ("recvfrom" int + (socket int) (buf (* t)) (len integer) - (flags integer) - (sockaddr (* t)) - (socklen (* integer)))) - (:function gethostbyname ("gethostbyname" (* t ) (name c-string))) - (:function gethostbyaddr ("gethostbyaddr" (* t ) + (flags int) + (sockaddr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? + (socklen (* socklen-t)))) + (:function gethostbyname ("gethostbyname" (* hostent) (name c-string))) + (:function gethostbyaddr ("gethostbyaddr" (* hostent) (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) + (len int) + (af int))) + (:function setsockopt ("setsockopt" int + (socket int) + (level int) + (optname int) (optval (* t)) - (optlen integer))) - (:function fcntl ("fcntl" integer - (fd integer) - (cmd integer) - (arg integer))) - (:function getsockopt ("getsockopt" integer - (socket integer) - (level integer) - (optname integer) + (optlen int))) + (:function fcntl ("fcntl" int + (fd int) + (cmd int) + (arg long))) + (:function getsockopt ("getsockopt" int + (socket int) + (level int) + (optname int) (optval (* t)) - (optlen integer :in-out)))) + (optlen (* int))))) )