0.8.13.78: Birds of Feather
[sbcl.git] / contrib / sb-bsd-sockets / constants.lisp
index 2629aef..22f6793 100644 (file)
 
 ;;; then the stuff we're looking for
 ((:integer af-inet "AF_INET" "IP Protocol family")
- (:integer af-unspec "AF_UNSPEC" "Unspecified.")
+ (: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-inet6 "AF_INET6"   "IP version 6")
  #+linux (:integer af-route "AF_NETLINK" "Alias to emulate 4.4BSD ")
  
  (:integer sock-stream "SOCK_STREAM"
@@ -47,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")
@@ -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
  (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")
                     (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
                                 (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)))
                         (level integer)
                         (optname integer)
                         (optval (* t))
-                        (optlen integer :in-out))))
+                        (optlen (* integer)))))
 )