X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Fname-service.lisp;h=03dd6c5ec210a0620c9aa5f316bbb2c6dbebe8b8;hb=78fa16bf55be44cc16845be84d98023e83fb14bc;hp=8015908093ffba4457e458335d08b88e7b0fc79b;hpb=ecae2f9323086c64d026d4ce719590907f486c63;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/name-service.lisp b/contrib/sb-bsd-sockets/name-service.lisp index 8015908..03dd6c5 100644 --- a/contrib/sb-bsd-sockets/name-service.lisp +++ b/contrib/sb-bsd-sockets/name-service.lisp @@ -1,25 +1,21 @@ (in-package :sb-bsd-sockets) -#||

Name Service

- -

Presently name service is implemented by calling whatever -gethostbyname(2) uses. This may be any or all of /etc/hosts, NIS, DNS, -or something completely different. Typically it's controlled by -/etc/nsswitch.conf - -

Direct links to the asynchronous resolver(3) routines would be nice to have -eventually, so that we can do DNS lookups in parallel with other things -|# (defclass host-ent () ((name :initarg :name :accessor host-ent-name) (aliases :initarg :aliases :accessor host-ent-aliases) (address-type :initarg :type :accessor host-ent-address-type) ; presently always AF_INET - (addresses :initarg :addresses :accessor host-ent-addresses))) + (addresses :initarg :addresses :accessor host-ent-addresses)) + ;; FIXME: Our Texinfo documentation extracter need at least his to spit + ;; out the signature. Real documentation would be better... + (:documentation "")) -(defgeneric host-ent-address (host-ent)) +(defgeneric host-ent-address (host-ent) + ;; FIXME: Our Texinfo documentation extracter need at least his to spit + ;; out the signature. Real documentation would be better... + (:documentation "")) -(defmethod host-ent-address ((host-ent host-ent)) +(defmethod host-ent-address ((host-ent host-ent)) (car (host-ent-addresses host-ent))) ;(define-condition host-not-found-error (socket-error)) ; host unknown @@ -40,8 +36,11 @@ eventually, so that we can do DNS lookups in parallel with other things until (sb-alien:null-alien ad) collect (ecase (sockint::hostent-type h) (#.sockint::af-inet - (loop for i from 0 below length - collect (sb-alien:deref ad i))) + (assert (= length 4)) + (let ((addr (make-array 4 :element-type '(unsigned-byte 8)))) + (loop for i from 0 below length + do (setf (elt addr i) (sb-alien:deref ad i))) + addr)) (#.sockint::af-local (sb-alien:cast ad sb-alien:c-string)))))) (make-instance 'host-ent @@ -76,6 +75,9 @@ grisly details." GET-NAME-SERVICE-ERRNO") (defun name-service-error (where) + ;; FIXME: Our Texinfo documentation extracter need at least his to spit + ;; out the signature. Real documentation would be better... + "" (get-name-service-errno) ;; Comment next to NETDB_INTERNAL in netdb.h says "See errno.". ;; This special case treatment hasn't actually been tested yet.