X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Fconstants.lisp;h=22f6793e8580de8346763e4058eb8c91c1ea6039;hb=4bc6b918bb99e8dcd17bbe6479a06e52b2d04a6c;hp=9dbf4f7d658596d99bdee6e61f3684c37f8759f7;hpb=3a38ef48c9ae55b932b5639ac9ac3ccd56c7dd9f;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/constants.lisp b/contrib/sb-bsd-sockets/constants.lisp index 9dbf4f7..22f6793 100644 --- a/contrib/sb-bsd-sockets/constants.lisp +++ b/contrib/sb-bsd-sockets/constants.lisp @@ -65,6 +65,7 @@ (:integer EAGAIN "EAGAIN") (:integer EBADF "EBADF") (:integer ECONNREFUSED "ECONNREFUSED") + (:integer ETIMEDOUT "ETIMEDOUT") (:integer EINTR "EINTR") (:integer EINVAL "EINVAL") (:integer ENOBUFS "ENOBUFS") @@ -93,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 @@ -104,23 +108,27 @@ (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") @@ -131,26 +139,26 @@ (protocol integer))) (:function bind ("bind" integer (sockfd integer) - (my-addr (* t)) + (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? (addrlen integer))) (:function listen ("listen" integer (socket integer) (backlog integer))) (:function accept ("accept" integer (socket integer) - (my-addr (* t)) + (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? (addrlen integer :in-out))) (:function getpeername ("getpeername" integer (socket integer) - (her-addr (* t)) + (her-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? (addrlen integer :in-out))) (:function getsockname ("getsockname" integer (socket integer) - (my-addr (* t)) + (my-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? (addrlen integer :in-out))) (:function connect ("connect" integer (socket integer) - (his-addr (* t)) + (his-addr (* t)) ; KLUDGE: sockaddr-in or sockaddr-un? (addrlen integer ))) (:function close ("close" integer @@ -160,10 +168,10 @@ (buf (* t)) (len integer) (flags integer) - (sockaddr (* t)) - (socklen (* integer)))) - (:function gethostbyname ("gethostbyname" (* t ) (name c-string))) - (:function gethostbyaddr ("gethostbyaddr" (* t ) + (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))) @@ -182,5 +190,5 @@ (level integer) (optname integer) (optval (* t)) - (optlen integer :in-out)))) + (optlen (* integer))))) )