1 (defpackage "SB-BSD-SOCKETS-INTERNAL"
3 (:shadow
#:close
#:listen
)
4 (:shadowing-import-from
"SB-KERNEL" #:with-array-data
)
5 (:use
"COMMON-LISP" "SB-ALIEN" "SB-EXT"))
7 (defpackage "SB-BSD-SOCKETS"
9 #-win32
#:local-socket
#-win32
#:local-abstract-socket
10 #:inet-socket
#:inet6-socket
11 #:make-inet-socket
; deprecated
13 #:socket-bind
#:socket-accept
#:socket-connect
14 #:socket-send
#:socket-receive
15 #:socket-name
#:socket-peername
#:socket-listen
16 #:socket-close
#:socket-shutdown
#:socket-file-descriptor
17 #:socket-family
#:socket-protocol
#:socket-open-p
18 #:socket-type
#:socket-make-stream
#:get-protocol-by-name
20 #:get-host-by-name
#:get-host-by-address
22 #:host-ent-address-type
#:host-ent-addresses
#:host-ent-address
23 #:host-ent-aliases
#:host-ent-name
25 ;; not sure if these are really good names or not
26 #:netdb-internal-error
28 #:host-not-found-error
34 ;; all socket options are also exported, by code in
39 ;; other errno-based socket errors are exported by code in
46 (:use
"COMMON-LISP" "SB-BSD-SOCKETS-INTERNAL")
47 (:import-from
"SB-INT" "UNSUPPORTED-OPERATOR" "FEATUREP")
49 "A thinly-disguised BSD socket API for SBCL. Ideas stolen from the BSD
50 socket API for C and Graham Barr's IO::Socket classes for Perl.
52 We represent sockets as CLOS objects, and rename a lot of methods and
53 arguments to fit Lisp style more closely."))
55 ;;; gethostbyname/gethostbyaddr are generally not thread safe. POSIX
56 ;;; 1003.1-2003 defines an alternative API, which is specified in the
57 ;;; RFC to be thread-safe. If it seems to be available, use it.
59 ;;; Unfortunately the manual page claims that these functions are not
60 ;;; thread-safe on OS X, but they probably can't be any worse than
61 ;;; gethostbyname and gethostbyaddr.
63 ;;; CLH: getaddrinfo seems to be broken on x86-64/darwin
64 #-
(or win32
(and x86-64 darwin
))
65 (let ((addr (sb-alien::find-dynamic-foreign-symbol-address
"getaddrinfo")))
67 (pushnew :sb-bsd-sockets-addrinfo
*features
*)))