add DEFINE-MORE-FUN, use it for vararg arithmetic functions
[sbcl.git] / contrib / sb-bsd-sockets / defpackage.lisp
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"))
6
7 (defpackage "SB-BSD-SOCKETS"
8   (:export socket local-socket local-abstract-socket inet-socket
9            make-local-socket make-inet-socket
10            socket-bind socket-accept socket-connect
11            socket-send socket-receive socket-recv
12            socket-name socket-peername socket-listen
13            socket-close socket-file-descriptor
14            socket-family socket-protocol socket-open-p
15            socket-type socket-make-stream get-protocol-by-name
16
17            get-host-by-name get-host-by-address
18            host-ent
19            host-ent-addresses host-ent-address
20            host-ent-aliases host-ent-name
21            name-service-error
22            getaddrinfo
23            ;; not sure if these are really good names or not
24            netdb-internal-error
25            netdb-success-error
26            host-not-found-error
27            try-again-error
28            no-recovery-error
29
30            unknown-protocol
31
32            ;; all socket options are also exported, by code in
33            ;; sockopt.lisp
34
35            socket-error
36
37            ;; other errno-based socket errors are exported by code in
38            ;; sockets.lisp
39
40            make-inet-address
41
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.
48
49 We represent sockets as CLOS objects, and rename a lot of methods and
50 arguments to fit Lisp style more closely."))
51
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 is broken on x86-64/darwin
61 #-(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*)))