A few random genesis cleanups
[sbcl.git] / contrib / sb-bsd-sockets / defpackage.lisp
blobc09c8e6a9e75bd9db919e5fcb11aacf6aa081c1e
1 (defpackage "SB-BSD-SOCKETS-INTERNAL"
2 (:nicknames "SOCKINT")
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"
8 (:export socket local-socket local-abstract-socket inet-socket inet6-socket
9 make-inet-socket ; deprecated
10 socket-bind socket-accept socket-connect
11 socket-send socket-receive
12 socket-name socket-peername socket-listen
13 socket-close socket-shutdown socket-file-descriptor
14 socket-family socket-protocol socket-open-p
15 socket-type socket-make-stream get-protocol-by-name
17 get-host-by-name get-host-by-address
18 host-ent
19 host-ent-address-type host-ent-addresses host-ent-address
20 host-ent-aliases host-ent-name
21 name-service-error
22 ;; not sure if these are really good names or not
23 netdb-internal-error
24 netdb-success-error
25 host-not-found-error
26 try-again-error
27 no-recovery-error
29 unknown-protocol
31 ;; all socket options are also exported, by code in
32 ;; sockopt.lisp
34 socket-error
36 ;; other errno-based socket errors are exported by code in
37 ;; sockets.lisp
39 make-inet-address
40 make-inet6-address
42 non-blocking-mode)
43 (:use "COMMON-LISP" "SB-BSD-SOCKETS-INTERNAL")
44 (:import-from "SB-INT" "UNSUPPORTED-OPERATOR" "FEATUREP")
45 (:documentation
46 "A thinly-disguised BSD socket API for SBCL. Ideas stolen from the BSD
47 socket API for C and Graham Barr's IO::Socket classes for Perl.
49 We represent sockets as CLOS objects, and rename a lot of methods and
50 arguments to fit Lisp style more closely."))
52 ;;; gethostbyname/gethostbyaddr are generally not thread safe. POSIX
53 ;;; 1003.1-2003 defines an alternative API, which is specified in the
54 ;;; RFC to be thread-safe. If it seems to be available, use it.
55 ;;;
56 ;;; Unfortunately the manual page claims that these functions are not
57 ;;; thread-safe on OS X, but they probably can't be any worse than
58 ;;; gethostbyname and gethostbyaddr.
59 ;;;
60 ;;; CLH: getaddrinfo seems to be broken on x86-64/darwin
61 #-(or win32 (and x86-64 darwin))
62 (let ((addr (sb-alien::find-dynamic-foreign-symbol-address "getaddrinfo")))
63 (when addr
64 (pushnew :sb-bsd-sockets-addrinfo *features*)))