From ehuelsmann at common-lisp.net Wed Feb 1 22:00:17 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 1 Feb 2006 16:00:17 -0600 (CST) Subject: [usocket-cvs] r17 - in usocket/trunk: . doc Message-ID: <20060201220017.73D7A368B1@common-lisp.net> Author: ehuelsmann Date: Wed Feb 1 16:00:16 2006 New Revision: 17 Modified: usocket/trunk/condition.lisp (contents, props changed) usocket/trunk/doc/design.txt usocket/trunk/doc/errors.txt usocket/trunk/package.lisp (contents, props changed) usocket/trunk/usocket.lisp Log: Update with latest condition ideas and API promises. Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Wed Feb 1 16:00:16 2006 @@ -1,18 +1,74 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. (in-package :usocket) -(define-condition usocket-error (error) - ((real-condition - :reader real-condition - :initarg :real-condition) - (socket - :reader socket - :initarg :socket)) - (:report (lambda (c stream) - (format stream "Error (~A) occured in socket: ~A." - (real-condition c) (socket c))))) - +;; (define-condition usocket-error (error) +;; ((real-condition +;; :reader real-condition +;; :initarg :real-condition) +;; (socket +;; :reader socket +;; :initarg :socket)) +;; (:report (lambda (c stream) +;; (format stream "Error (~A) occured in socket: ~A." +;; (real-condition c) (socket c))))) + +(define-condition usocket-condition (condition) + () ;;###FIXME: no slots (yet); should at least be the affected usocket... + (:documentation "")) + +(define-condition usocket-error (usocket-condition error) + () ;; no slots (yet) + (:documentation "")) + + + +(eval-when (:compile-toplevel :load-toplevel :execute) + (defun define-usocket-condition-class (class &rest parents) + `(progn + (define-condition ,class ,parents ()) + (export ',class)))) + +(defmacro define-usocket-condition-classes (class-list parents) + `(progn ,@(mapcar #'(lambda (x) + (apply #'define-usocket-condition-class + x parents)) + class-list))) + +;; Mass define and export our conditions +(define-usocket-condition-classes + (usocket-interrupted-condition) + (usocket-condition)) + +(define-condition usocket-unknown-condition (usocket-condition) + ((real-condition)) + (:documentation "")) + + +;; Mass define and export our errors +(define-usocket-condition-classes + (usocket-address-in-use-error + usocket-address-not-available-error + usocket-bad-file-descriptor-error + usocket-connection-refused-error + usocket-invalid-argument-error + usocket-no-buffers-error + usocket-operation-not-supported-error + usocket-operation-not-permitted-error + usocket-protocol-not-supported-error + usocket-socket-type-not-supported-error + usocket-network-unreachable-error + usocket-network-down-error + usocket-network-reset-error + usocket-host-down-error + usocket-host-unreachable-error + usocket-shutdown-error + usocket-timeout-error) + (usocket-error)) + +(define-condition usocket-unknown-error (usocket-error) + ((real-error)) + (:documentation "")) Modified: usocket/trunk/doc/design.txt ============================================================================== --- usocket/trunk/doc/design.txt (original) +++ usocket/trunk/doc/design.txt Wed Feb 1 16:00:16 2006 @@ -59,10 +59,19 @@ The interface provided should allow: - 'client'/active sockets - 'server'/listening sockets - - retrieve IP addresses/ports for both sides of the connection - provide the usual stream methods to operate on the connection stream (not necessarily the socket itself; maybe a socket slot too) +For now, as long as there are no possibilities to have UDP sockets +to write a DNS client library: (which in the end may work better, +because in this respect all implementations are different...) + - retrieve IP addresses/ports for both sides of the connection +--- later addition +I don't think it's a good idea to implement name lookup in the +very first of steps: we'll see if this is required to get the +package accepted; not all implementations support it. +--- later addition; end + Several relevant support functionalities will have to be provided too: - long <-> quad-vector operators - quad-vector <-> string operators Modified: usocket/trunk/doc/errors.txt ============================================================================== --- usocket/trunk/doc/errors.txt (original) +++ usocket/trunk/doc/errors.txt Wed Feb 1 16:00:16 2006 @@ -1,13 +1,20 @@ -EADDRINUSE address-in-use-error -EAGAIN interrupted-error -EBADF bad-file-descriptor-error -ECONNREFUSED connection-refused-error -EINTR interrupted-error -EINVAL invalid-argument-error -ENOBUFS no-buffers-error -ENOMEM out-of-memory-error -EOPNOTSUPP operation-not-supported-error -EPERM operation-not-permitted-error -EPROTONOSUPPORT protocol-not-supported-error -ESOCKTNOSUPPORT socket-type-not-supported-error -ENETUNREACH network-unreachable-error +EADDRINUSE 48 address-in-use-error +EADDRNOTAVAIL 49 address-not-available-error +EAGAIN interrupted-error ;; not 1 error code: bsd == 11; non-bsd == 35 +EBADF 9 bad-file-descriptor-error +ECONNREFUSED 61 connection-refused-error +EINTR 4 interrupted-error +EINVAL 22 invalid-argument-error +ENOBUFS 55 no-buffers-error +ENOMEM 12 out-of-memory-error +EOPNOTSUPP 45 operation-not-supported-error +EPERM 1 operation-not-permitted-error +EPROTONOSUPPORT 43 protocol-not-supported-error +ESOCKTNOSUPPORT 44 socket-type-not-supported-error +ENETUNREACH 51 network-unreachable-error +ENETDOWN 50 network-down-error +ENETRESET 52 network-reset-error +ESHUTDOWN 58 already-shutdown-error +ETIMEDOUT 60 connection-timeout-error +EHOSTDOWN 64 host-down-error +EHOSTUNREACH 65 host-unreachable-error Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Wed Feb 1 16:00:16 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See the LICENSE file for licensing information. @@ -16,17 +16,14 @@ :usocket ; socket object and accessors :socket-stream - :get-host-by-address ; name services - :get-hosts-by-name - :get-host-by-name - :get-random-host-by-name - :host-byte-order ; IPv4 utility functions :hbo-to-dotted-quad :hbo-to-vector-quad :vector-quad-to-dotted-quad :dotted-quad-to-vector-quad - :usocket-error ; conditions - :no-route-to-host))) + :usocket-condition ; conditions + :usocket-error ; errors + :usocket-unknown-condition + :usocket-unknown-error))) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Wed Feb 1 16:00:16 2006 @@ -5,6 +5,8 @@ (in-package :usocket) + + (defclass usocket () ((socket :initarg :socket @@ -19,14 +21,21 @@ :initarg :local-port :accessor local-port))) -(defun make-socket (&key socket local-address local-port stream) +(defun make-socket (&key socket stream) (make-instance 'usocket :socket socket - :local-address local-address - :local-port local-port :stream stream)) -(defgeneric socket-close (usocket)) +(defgeneric socket-close (usocket) + (:documentation "Close a previously opened USOCKET.")) + +(defmacro with-connected-socket ((var socket) &body body) + `(let ((,var ,socket)) + (unwind-protect + (progn + , at body) + (when ,var + (socket-close ,var))))) ;; ;; IPv4 utility functions From ehuelsmann at common-lisp.net Wed Feb 1 22:01:18 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 1 Feb 2006 16:01:18 -0600 (CST) Subject: [usocket-cvs] r18 - usocket/trunk/backend Message-ID: <20060201220118.9DD861C68D@common-lisp.net> Author: ehuelsmann Date: Wed Feb 1 16:01:18 2006 New Revision: 18 Modified: usocket/trunk/backend/allegro.lisp Log: Update with latest documentation research. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Wed Feb 1 16:01:18 2006 @@ -25,7 +25,10 @@ (defun get-host-by-address (address) - (sock:lookup-host address)) + (sock:ipaddr-to-hostname address)) (defun get-hosts-by-name (name) - (sock:lookup-host name)) + ;;###FIXME: ACL has the acldns module which returns all A records + ;; only problem: it doesn't fall back to tcp (from udp) if the returned + ;; structure is too long. + (list (hbo-to-vector-quad (sock:lookup-hostname name)))) From ehuelsmann at common-lisp.net Wed Feb 1 22:02:27 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 1 Feb 2006 16:02:27 -0600 (CST) Subject: [usocket-cvs] r19 - usocket/trunk/doc Message-ID: <20060201220227.82D6E368B1@common-lisp.net> Author: ehuelsmann Date: Wed Feb 1 16:02:27 2006 New Revision: 19 Modified: usocket/trunk/doc/active-sockets-apis.txt usocket/trunk/doc/clisp-sockets.txt usocket/trunk/doc/sb-bsd-sockets.txt Log: Update with latest code+docs research. Modified: usocket/trunk/doc/active-sockets-apis.txt ============================================================================== --- usocket/trunk/doc/active-sockets-apis.txt (original) +++ usocket/trunk/doc/active-sockets-apis.txt Wed Feb 1 16:02:27 2006 @@ -19,7 +19,7 @@ - socket-bind - make-instance 'inet-socket - socket-make-stream - - socket-connect + - socket-connect (ip vector-quad) port - socket-close DNS name resolution: @@ -33,7 +33,7 @@ ===== sockets: - - ext:connect-to-inet-socket + - ext:connect-to-inet-socket (ip integer) port - sys:make-fd-stream - ext:close-socket @@ -43,3 +43,33 @@ - ext:host-entry-addr-list - ext:lookup-host-entry + +ABCL +==== + + sockets + - ext:socket-connect (hostname string) port + - ext:get-socket-stream + - ext:socket-close + + +clisp +===== + + sockets + - socket-connect port (hostname string) + - close (socket) + + +Allegro +======= + + sockets + - make-socket + - socket-connect + - close + + DNS resolution + - lookup-hostname + - ipaddr-to-hostname + Modified: usocket/trunk/doc/clisp-sockets.txt ============================================================================== --- usocket/trunk/doc/clisp-sockets.txt (original) +++ usocket/trunk/doc/clisp-sockets.txt Wed Feb 1 16:02:27 2006 @@ -24,3 +24,15 @@ aliases - LIST of aliases addr-list - LIST of IPs as dotted quads (IPv4) or coloned octets (IPv6) addrtype - INTEGER address type IPv4 or IPv6 + + +Errors are of type + +SYSTEM::SIMPLE-OS-ERROR + with a 1 element (integer) SYSTEM::$FORMAT-ARGUMENTS list + +This integer stores the OS error reported; meaning WSA* codes on Win32 +and E* codes on *nix, only: unix.lisp in CMUCL shows +BSD, Linux and SRV4 have different number assignments for the same +E* constant names :-( + Modified: usocket/trunk/doc/sb-bsd-sockets.txt ============================================================================== --- usocket/trunk/doc/sb-bsd-sockets.txt (original) +++ usocket/trunk/doc/sb-bsd-sockets.txt Wed Feb 1 16:02:27 2006 @@ -89,24 +89,20 @@ Exported errors: * (apropos "ERROR" :sb-bsd-sockets) - + SB-BSD-SOCKETS:INTERRUPTED-ERROR SB-BSD-SOCKETS:TRY-AGAIN-ERROR -SB-BSD-SOCKETS:NO-RECOVERY-ERROR +* SB-BSD-SOCKETS:NO-RECOVERY-ERROR (EFAIL?) SB-BSD-SOCKETS:CONNECTION-REFUSED-ERROR SB-BSD-SOCKETS:INVALID-ARGUMENT-ERROR -SB-BSD-SOCKETS:HOST-NOT-FOUND-ERROR +* SB-BSD-SOCKETS:HOST-NOT-FOUND-ERROR SB-BSD-SOCKETS:OPERATION-NOT-PERMITTED-ERROR -SB-BSD-SOCKETS:SOCKET-ERROR (fbound) <-- geen condition -SB-BSD-SOCKETS:NAME-SERVICE-ERROR (fbound) <-- geen condition -? --> SB-BSD-SOCKETS:NETDB-INTERNAL-ERROR SB-BSD-SOCKETS:OPERATION-NOT-SUPPORTED-ERROR SB-BSD-SOCKETS:PROTOCOL-NOT-SUPPORTED-ERROR SB-BSD-SOCKETS:OPERATION-TIMEOUT-ERROR SB-BSD-SOCKETS:SOCKET-TYPE-NOT-SUPPORTED-ERROR SB-BSD-SOCKETS:NO-BUFFERS-ERROR SB-BSD-SOCKETS:NETWORK-UNREACHABLE-ERROR -? --> SB-BSD-SOCKETS:NETDB-SUCCESS-ERROR SB-BSD-SOCKETS:BAD-FILE-DESCRIPTOR-ERROR SB-BSD-SOCKETS:ADDRESS-IN-USE-ERROR SB-BSD-SOCKETS:OUT-OF-MEMORY-ERROR @@ -114,3 +110,5 @@ And 1 non-exported error: SB-BSD-SOCKETS::NO-ADDRESS-ERROR + +*-ed errors aren't yet addressed in the errorlist supported by usocket From ehuelsmann at common-lisp.net Wed Feb 1 22:05:53 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 1 Feb 2006 16:05:53 -0600 (CST) Subject: [usocket-cvs] r20 - public_html Message-ID: <20060201220553.4807A35553@common-lisp.net> Author: ehuelsmann Date: Wed Feb 1 16:05:52 2006 New Revision: 20 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Wed Feb 1 16:05:52 2006 @@ -27,6 +27,12 @@

Development roadmap

+

Development will at least follow the steps outlined below. + Yet to be determined is whether the currently mentioned steps will + be enough to release version 1.0. Possibly, UDP sockets remain to be + addressed before doing 1.0; that will depend on your reactions :-) +

+ @@ -68,16 +74,16 @@ - + - + - + From ehuelsmann at common-lisp.net Thu Feb 2 19:50:43 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 2 Feb 2006 13:50:43 -0600 (CST) Subject: [usocket-cvs] r21 - public_html Message-ID: <20060202195043.4BBB82A031@common-lisp.net> Author: ehuelsmann Date: Thu Feb 2 13:50:42 2006 New Revision: 21 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Feb 2 13:50:42 2006 @@ -13,28 +13,38 @@

+

Goal

+ +

The project wants to provide a portable TCP/IP (and later on maybe +UDP) socket interface for as many Common Lisp implementations as +possible, while keeping the abstraction and portability layer as thin +as possible.

+

Community

-

This project has recently started. See the design -document for more information.

+

This project has recently started. There isn't much of a community + yet, except me (Erik Huelsmann). So, you're invited to join the mailing + list, announce yourself and maybe even join the effort. +

Development discussion takes place on usocket-devel at common-lisp.net. - Please feel free to join and chip in! (This currently being a single man project, please announce yourself.)

Development roadmap

-

Development will at least follow the steps outlined below. - Yet to be determined is whether the currently mentioned steps will - be enough to release version 1.0. Possibly, UDP sockets remain to be - addressed before doing 1.0; that will depend on your reactions :-) -

+

Development will at least follow the steps outlined below. + Yet to be determined is whether the currently mentioned steps will + be enough to release version 1.0. Possibly, UDP sockets remain to be + addressed before doing 1.0; that will depend on your reactions :-) +

+

The targeted implementations listed in the status table below are not + a final list: others can be added if/when the need or interest arrises. +

Roadmap
WIP TODO WIPTODOWIP TODO TODO
Implement active socket support. WIPWIPWIP TODOWIPWIP WIP TODO TODO
- + From ehuelsmann at common-lisp.net Thu Feb 2 19:53:35 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 2 Feb 2006 13:53:35 -0600 (CST) Subject: [usocket-cvs] r22 - public_html Message-ID: <20060202195335.44CA92A031@common-lisp.net> Author: ehuelsmann Date: Thu Feb 2 13:53:34 2006 New Revision: 22 Modified: public_html/index.shtml Log: Fix XHTML 1.1 conformance. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Feb 2 13:53:34 2006 @@ -53,13 +53,13 @@ - - - - - - - + + + + + + + From ehuelsmann at common-lisp.net Thu Feb 2 20:00:08 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 2 Feb 2006 14:00:08 -0600 (CST) Subject: [usocket-cvs] r23 - usocket/trunk/backend Message-ID: <20060202200008.9C7E02A031@common-lisp.net> Author: ehuelsmann Date: Thu Feb 2 14:00:08 2006 New Revision: 23 Modified: usocket/trunk/backend/allegro.lisp (contents, props changed) usocket/trunk/backend/clisp.lisp (contents, props changed) usocket/trunk/backend/cmucl.lisp (contents, props changed) usocket/trunk/backend/lispworks.lisp (contents, props changed) usocket/trunk/backend/sbcl.lisp (contents, props changed) Log: Set keywords. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Thu Feb 2 14:00:08 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Thu Feb 2 14:00:08 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Thu Feb 2 14:00:08 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Thu Feb 2 14:00:08 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Thu Feb 2 14:00:08 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. From ehuelsmann at common-lisp.net Fri Feb 3 18:47:58 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 12:47:58 -0600 (CST) Subject: [usocket-cvs] r24 - usocket/trunk Message-ID: <20060203184758.02337202CE@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 12:47:57 2006 New Revision: 24 Modified: usocket/trunk/usocket.lisp Log: Add comments and documentation. Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Fri Feb 3 12:47:57 2006 @@ -14,10 +14,10 @@ (stream :initarg :stream :accessor socket-stream) - (local-address + (local-address ;; possibly need to eliminate :initarg :local-address :accessor local-address) - (local-port + (local-port ;; possibly need to eliminate :initarg :local-port :accessor local-port))) @@ -27,9 +27,12 @@ :stream stream)) (defgeneric socket-close (usocket) - (:documentation "Close a previously opened USOCKET.")) + (:documentation "Close a previously opened `usocket'.")) (defmacro with-connected-socket ((var socket) &body body) + "Bind `socket' to `var', ensuring socket destruction on exit. + +The `body' is an implied progn form." `(let ((,var ,socket)) (unwind-protect (progn @@ -100,3 +103,4 @@ (defun get-random-host-by-name (name) (let ((hosts (get-hosts-by-name name))) (elt hosts (random (length hosts))))) + From ehuelsmann at common-lisp.net Fri Feb 3 19:09:09 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 13:09:09 -0600 (CST) Subject: [usocket-cvs] r25 - in usocket/trunk: . backend Message-ID: <20060203190909.56AF8202D3@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 13:09:09 2006 New Revision: 25 Modified: usocket/trunk/backend/sbcl.lisp usocket/trunk/condition.lisp Log: Error translation for SBCL (non-Win32). Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Fri Feb 3 13:09:09 2006 @@ -5,12 +5,53 @@ (in-package :usocket) +(defun map-socket-error (sock-err) + (map-errno-error (sb-bsd-sockets::socket-error-errno sock-err))) + +(defparameter +sbcl-condition-map+ + '((interrupted-error . usocket-interrupted-condition))) + +(defparameter +sbcl-error-map+ + `((sb-bsd-sockets:address-in-use-error . usocket-address-in-use-error) + (sb-bsd-sockets::no-address-error . usocket-address-not-available-error) + (sb-bsd-sockets:bad-file-descriptor-error . usocket-bad-file-descriptor-error) + (sb-bsd-sockets:connection-refused-error . usocket-connection-refused-error) + (sb-bsd-sockets:invalid-argument-error . usocket-invalid-argument-error) + (no-buffers-error . usocket-no-buffers-error) + (operation-not-supported-error . usocket-operation-not-supported-error) + (operation-not-permitted-error . usocket-operation-not-permitted-error) + (protocol-not-supported-error . usocket-protocol-not-supported-error) + (socket-type-not-supported-error . usocket-socket-type-not-supported-error) + (network-unreachable-error . usocket-network-unreachable-error) + ;; (... . usocket-network-down-error) + (no-recovery-error . usocket-network-reset-error) + ;; (... . usocket-host-down-error) + ;; (... . usocket-host-unreachable-error) + ;; (... . usocket-shutdown-error) + (operation-timeout-error . usocket-timeout-error) + (sb-bsd-sockets:socket-error . ,#'map-socket-error))) + (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (condition (error 'usocket-error - :real-condition condition - :socket socket)))) + (error (let* ((usock-error (cdr (assoc (type-of condition) + +sbcl-error-map+))) + (usock-error (if (functionp usock-error) + (funcall usock-error condition) + usock-error))) + (if usock-error + (error usock-error :socket socket) + (error 'usocket-unknown-error :real-error condition)))) + (condition (let* ((usock-cond (cdr (assoc (type-of condition) + +sbcl-condition-map+))) + (usock-cond (if (functionp usock-cond) + (funcall usock-cond condition) + usock-cond))) + (if usock-cond + (signal usock-cond :socket socket) + (signal 'usocket-unkown-condition + :real-condition condition)))))) + (defun socket-connect (host port &optional (type :stream)) "Connect to `host' on `port'. `host' is assumed to be a string of @@ -27,24 +68,24 @@ :element-type 'character)) ;;###FIXME: The above line probably needs an :external-format (usocket (make-instance 'usocket :stream stream :socket socket))) - (handler-case (sb-bsd-sockets:socket-connect socket host port) - (condition (condition) (handle-condition condition usocket))) + (with-mapped-conditions (usocket) + (sb-bsd-sockets:socket-connect socket host port)) usocket)) (defmethod socket-close ((usocket usocket)) "Close socket." - (handler-case (sb-bsd-sockets:socket-close (socket usocket)) - (condition (condition) (handle-condition condition usocket)))) + (with-mapped-conditions (usocket) + (sb-bsd-sockets:socket-close (socket usocket)))) (defun get-host-by-address (address) - (handler-case (sb-bsd-sockets::host-ent-name - (sb-bsd-sockets:get-host-by-address address)) - (condition (condition) (handle-condition condition)))) + (with-mapped-conditions () + (sb-bsd-sockets::host-ent-name + (sb-bsd-sockets:get-host-by-address address)))) (defun get-hosts-by-name (name) - (handler-case (sb-bsd-sockets::host-ent-addresses - (sb-bsd-sockets:get-host-by-name name)) - (condition (condition) (handle-condition condition)))) + (with-mapped-conditions () + (sb-bsd-sockets::host-ent-addresses + (sb-bsd-sockets:get-host-by-name name)))) Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Fri Feb 3 13:09:09 2006 @@ -44,7 +44,8 @@ (usocket-condition)) (define-condition usocket-unknown-condition (usocket-condition) - ((real-condition)) + ((real-condition :initarg :real-condition + :accessor usocket-real-condition)) (:documentation "")) @@ -70,5 +71,54 @@ (usocket-error)) (define-condition usocket-unknown-error (usocket-error) - ((real-error)) + ((real-error :initarg :real-error + :accessor usocket-real-error)) (:documentation "")) + + +(defmacro with-mapped-conditions ((&optional socket) &body body) + `(handler-case + (progn , at body) + (condition (condition) (handle-condition condition ,socket)))) + +(defparameter +unix-errno-condition-map+ + `((11 . usocket-retry-condition) ;; EAGAIN + (35 . usocket-retry-condition) ;; EDEADLCK + (4 . usocket-interrupted-condition))) ;; EINTR + +(defparameter +unix-errno-error-map+ + ;;### the first column is for non-(linux or srv4) systems + ;; the second for linux + ;; the third for srv4 + ;;###FIXME: How do I determine on which Unix we're running + ;; (at least in clisp and sbcl; I know about cmucl...) + ;; The table below works under the assumption we'll *only* see + ;; socket associated errors... + `(((48 98) . usocket-address-in-use-error) + ((49 99) . usocket-address-not-available-error) + ((9) . usocket-bad-file-descriptor-error) + ((61 111) . usocket-connection-refused-error) + ((22) . usocket-invalid-argument-error) + ((55 105) . usocket-no-buffers-error) + ((12) . usocket-out-of-memory-error) + ((45 95) . usocket-operation-not-supported-error) + ((1) . usocket-operation-not-permitted-error) + ((43 92) . usocket-protocol-not-supported-error) + ((44 93) . usocket-socket-type-not-supported-error) + ((51 102) . usocket-network-unreachable-error) + ((50 100) . usocket-network-down-error) + ((52 102) . usocket-network-reset-error) + ((58 108) . usocket-already-shutdown-error) + ((60 110) . usocket-connection-timeout-error) + ((64 112) . usocket-host-down-error) + ((65 113) . usocket-host-unreachable-error))) + + + + +(defun map-errno-condition (errno) + (cdr (assoc errno +unix-errno-error-map+))) + + +(defun map-errno-error (errno) + (cdr (assoc errno +unix-errno-error-map+ :test #'member))) From ehuelsmann at common-lisp.net Fri Feb 3 20:21:00 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 14:21:00 -0600 (CST) Subject: [usocket-cvs] r26 - usocket/trunk Message-ID: <20060203202100.47A4E202EB@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 14:20:59 2006 New Revision: 26 Modified: usocket/trunk/package.lisp usocket/trunk/usocket.lisp Log: Remove/add interfaces to be implemented at this stage. Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Fri Feb 3 14:20:59 2006 @@ -13,6 +13,8 @@ (:export :socket-connect ; socket constructors and methods :socket-close + :with-connected-socket ; macros + :usocket ; socket object and accessors :socket-stream Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Fri Feb 3 14:20:59 2006 @@ -14,12 +14,13 @@ (stream :initarg :stream :accessor socket-stream) - (local-address ;; possibly need to eliminate - :initarg :local-address - :accessor local-address) - (local-port ;; possibly need to eliminate - :initarg :local-port - :accessor local-port))) +;; (local-address ;; possibly need to eliminate +;; :initarg :local-address +;; :accessor local-address) +;; (local-port ;; possibly need to eliminate +;; :initarg :local-port +;; :accessor local-port) + )) (defun make-socket (&key socket stream) (make-instance 'usocket From ehuelsmann at common-lisp.net Fri Feb 3 21:19:43 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 15:19:43 -0600 (CST) Subject: [usocket-cvs] r27 - usocket/trunk Message-ID: <20060203211943.87501202E7@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 15:19:43 2006 New Revision: 27 Modified: usocket/trunk/README Log: Update interface documentation. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Fri Feb 3 15:19:43 2006 @@ -2,37 +2,50 @@ $Id$ -;; the backends must implement -;; -;; - handle-condition -;; - open -;; - close -;; - listen -;; - accept -;; - read-line -;; - write-sequence -;; - get-host-by-address -;; - get-host-by-name -;; -;; the backend must wrap all calls to its socket functions in a -;; handler-case/bind to make sure handle-condition is called. -;; open should take either the hostname or an vectorized ip - -usocket socket interface: +usocket interface: - usocket (class) - - socket-create (function) [ to create a passive socket ] - socket-connect (function) [ to create an active/connected socket ] + socket-connect host port + where `host' is a vectorized ip + or a string representation of a dotted ip address + or a hostname for lookup in the DNS system - socket-close (method) - - socket-accept (method) - - socket-local-address (method) - - socket-peer-address (method) + socket-close socket + where socket a previously returned socket - socket-stream (usocket slot accessor), - the value of which satisfies the normal stream interface + socket-stream socket + the return value of which satisfies the normal stream interface -usocket name resolution interface: - - get-host-by-address - - get-host-by-name +Errors: + - usocket-address-in-use-error + - usocket-address-not-available-error + - usocket-bad-file-descriptor-error + - usocket-connection-refused-error + - usocket-invalid-argument-error + - usocket-no-buffers-error + - usocket-operation-not-supported-error + - usocket-operation-not-permitted-error + - usocket-protocol-not-supported-error + - usocket-socket-type-not-supported-error + - usocket-network-unreachable-error + - usocket-network-down-error + - usocket-network-reset-error + - usocket-host-down-error + - usocket-host-unreachable-error + - usocket-shutdown-error + - usocket-timeout-error + - usocket-unkown-error + +Non-fatal conditions: + - usocket-interrupted-condition + - usocket-unkown-condition + +TODO: + - socket-create (function) [ to create a passive socket ] + - socket-accept (method) + - socket-local-address (method) + - socket-peer-address (method) From ehuelsmann at common-lisp.net Fri Feb 3 21:24:31 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 15:24:31 -0600 (CST) Subject: [usocket-cvs] r28 - in usocket/trunk: . backend Message-ID: <20060203212431.B5D8C202EB@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 15:24:31 2006 New Revision: 28 Modified: usocket/trunk/backend/sbcl.lisp usocket/trunk/usocket.lisp Log: Fix error where hostnames were erroneously not translated to vector quads. Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Fri Feb 3 15:24:31 2006 @@ -41,7 +41,9 @@ usock-error))) (if usock-error (error usock-error :socket socket) - (error 'usocket-unknown-error :real-error condition)))) + (error 'usocket-unknown-error + :socket socket + :real-error condition)))) (condition (let* ((usock-cond (cdr (assoc (type-of condition) +sbcl-condition-map+))) (usock-cond (if (functionp usock-cond) @@ -67,9 +69,10 @@ :buffering :full :element-type 'character)) ;;###FIXME: The above line probably needs an :external-format - (usocket (make-instance 'usocket :stream stream :socket socket))) + (usocket (make-instance 'usocket :stream stream :socket socket)) + (ip (host-to-vector-quad host))) (with-mapped-conditions (usocket) - (sb-bsd-sockets:socket-connect socket host port)) + (sb-bsd-sockets:socket-connect socket ip port)) usocket)) (defmethod socket-close ((usocket usocket)) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Fri Feb 3 15:24:31 2006 @@ -97,11 +97,30 @@ ;; DNS helper functions ;; +#-clisp (defun get-host-by-name (name) (let ((hosts (get-hosts-by-name name))) (car hosts))) +#-clisp (defun get-random-host-by-name (name) (let ((hosts (get-hosts-by-name name))) (elt hosts (random (length hosts))))) +#-clisp +(defun host-to-vector-quad (host) + "Translate a host specification (vector quad, dotted quad or domain name) +to a vector quad." + (if (vectorp host) + host + (let* ((ip (ignore-errors + (dotted-quad-to-vector-quad host)))) + (if (and ip (= 4 (length ip))) + ip + (get-random-host-by-name host))))) + +(defun host-to-hostname (host) + "Translate a string or vector quad to a stringified hostname." + (if (stringp host) + host + (vector-quad-to-dotted-quad host))) From ehuelsmann at common-lisp.net Fri Feb 3 21:26:05 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 15:26:05 -0600 (CST) Subject: [usocket-cvs] r29 - in usocket/trunk: . backend Message-ID: <20060203212605.43F15202EA@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 15:26:05 2006 New Revision: 29 Modified: usocket/trunk/backend/clisp.lisp usocket/trunk/condition.lisp Log: Make clisp error translation work. Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Fri Feb 3 15:26:05 2006 @@ -5,22 +5,45 @@ (in-package :usocket) +(defun remap-maybe-for-win32 (z &optional errorp) + (mapcar #'(lambda (x) + (list #-win32 (car x) + #+win32 (mapcar #'(lambda (y) + (+ 10000 y)) + (car x)) + (cdr x) + errorp)) + z)) + +(defparameter +clisp-error-map+ + (append (remap-maybe-for-win32 +unix-errno-condition-map+) + (remap-maybe-for-win32 +unix-errno-error-map+ t))) + (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (condition (error 'usocket-error - :real-condition condition - :socket socket)))) + (system::simple-os-error + (destructuring-bind + (&optional usock-err errorp) + (cdr (assoc (car (system::$format-arguments)) + +clisp-error-map+)) + (if usock-err + (if errorp + (error usock-err :socket socket) + (signal usock-err :socket socket)) + (error 'usocket-unkown-error + :socket socket + :real-error condition)))))) (defun socket-connect (host port &optional (type :stream)) (declare (ignore type)) - (let ((socket (socket:socket-connect port host + (let ((socket (socket:socket-connect port (host-to-hostname host) :element-type 'character :buffered t))) (make-socket :socket socket - :stream socket ;; the socket is a stream too - :host host - :port port)) + :stream socket))) ;; the socket is a stream too +;; :host host +;; :port port)) (defmethod socket-close ((usocket usocket)) "Close socket." Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Fri Feb 3 15:26:05 2006 @@ -82,9 +82,9 @@ (condition (condition) (handle-condition condition ,socket)))) (defparameter +unix-errno-condition-map+ - `((11 . usocket-retry-condition) ;; EAGAIN - (35 . usocket-retry-condition) ;; EDEADLCK - (4 . usocket-interrupted-condition))) ;; EINTR + `(((11) . usocket-retry-condition) ;; EAGAIN + ((35) . usocket-retry-condition) ;; EDEADLCK + ((4) . usocket-interrupted-condition))) ;; EINTR (defparameter +unix-errno-error-map+ ;;### the first column is for non-(linux or srv4) systems @@ -117,7 +117,7 @@ (defun map-errno-condition (errno) - (cdr (assoc errno +unix-errno-error-map+))) + (cdr (assoc errno +unix-errno-error-map+ :test #'member))) (defun map-errno-error (errno) From ehuelsmann at common-lisp.net Fri Feb 3 22:10:44 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 16:10:44 -0600 (CST) Subject: [usocket-cvs] r30 - in usocket/trunk: . backend Message-ID: <20060203221044.26F29202F7@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 16:10:43 2006 New Revision: 30 Modified: usocket/trunk/backend/clisp.lisp usocket/trunk/condition.lisp Log: Implement condition handling for clisp. Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Fri Feb 3 16:10:43 2006 @@ -25,21 +25,25 @@ (system::simple-os-error (destructuring-bind (&optional usock-err errorp) - (cdr (assoc (car (system::$format-arguments)) - +clisp-error-map+)) + (cdr (assoc (car (simple-condition-format-arguments condition)) + +clisp-error-map+ :test #'member)) (if usock-err (if errorp (error usock-err :socket socket) (signal usock-err :socket socket)) - (error 'usocket-unkown-error + (error 'usocket-unknown-error :socket socket :real-error condition)))))) (defun socket-connect (host port &optional (type :stream)) (declare (ignore type)) - (let ((socket (socket:socket-connect port (host-to-hostname host) - :element-type 'character - :buffered t))) + (let ((socket) + (hostname (host-to-hostname host))) + (with-mapped-conditions (socket) + (setf socket + (socket:socket-connect port hostname + :element-type 'character + :buffered t))) (make-socket :socket socket :stream socket))) ;; the socket is a stream too ;; :host host @@ -47,19 +51,6 @@ (defmethod socket-close ((usocket usocket)) "Close socket." - (close (socket usocket))) - - - -(defun get-host-by-address (address) - (handler-case - (posix:hostent-name - (posix:resolve-host-ipaddr (vector-quad-to-dotted-quad address))) - (condition (condition) (handle-condition condition)))) - -(defun get-hosts-by-name (name) - (handler-case - (mapcar #'dotted-quad-to-vector-quad - (posix:hostent-addr-list (posix:resolve-host-ipaddr name))) - (condition (condition) (handle-condition condition)))) + (with-mapped-conditions (usocket) + (close (socket usocket)))) Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Fri Feb 3 16:10:43 2006 @@ -17,7 +17,9 @@ ;; (real-condition c) (socket c))))) (define-condition usocket-condition (condition) - () ;;###FIXME: no slots (yet); should at least be the affected usocket... + ((socket :initarg :socket + :accessor :usocket-socket)) + ;;###FIXME: no slots (yet); should at least be the affected usocket... (:documentation "")) (define-condition usocket-error (usocket-condition error) @@ -72,7 +74,12 @@ (define-condition usocket-unknown-error (usocket-error) ((real-error :initarg :real-error - :accessor usocket-real-error)) + :accessor usocket-real-error) + ;; clisp error wrt its condition system... + ;;it doesn't seem to inherit slots + #+clisp + (socket :initarg :socket + :accessor :usocket-socket)) (:documentation "")) From ehuelsmann at common-lisp.net Fri Feb 3 22:11:41 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 16:11:41 -0600 (CST) Subject: [usocket-cvs] r31 - public_html Message-ID: <20060203221141.48CAF203A2@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 16:11:39 2006 New Revision: 31 Modified: public_html/index.shtml public_html/style.css Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 3 16:11:39 2006 @@ -80,10 +80,10 @@ - + - + Modified: public_html/style.css ============================================================================== --- public_html/style.css (original) +++ public_html/style.css Fri Feb 3 16:11:39 2006 @@ -71,3 +71,6 @@ font-weight: bold; text-align: center; } +.DONE { background-color: #080; + color: #000; + text-align: center; } From ehuelsmann at common-lisp.net Fri Feb 3 22:33:39 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 16:33:39 -0600 (CST) Subject: [usocket-cvs] r32 - usocket/trunk/doc Message-ID: <20060203223339.16F741A8B5@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 16:33:39 2006 New Revision: 32 Modified: usocket/trunk/doc/backends.txt (contents, props changed) Log: Update backend implementation requirements. Modified: usocket/trunk/doc/backends.txt ============================================================================== --- usocket/trunk/doc/backends.txt (original) +++ usocket/trunk/doc/backends.txt Fri Feb 3 16:33:39 2006 @@ -1,5 +1,7 @@ -*- text -*- +$Id$ + A document to describe which APIs a backend should implement. @@ -15,12 +17,29 @@ - socket-close -Name resolution functions: - - - get-host-by-address (name string) - - get-hosts-by-name (address vector-quad) - - An error-handling function, resolving implementation specific errors to this list of errors: + - usocket-address-in-use-error + - usocket-address-not-available-error + - usocket-bad-file-descriptor-error + - usocket-connection-refused-error + - usocket-invalid-argument-error + - usocket-no-buffers-error + - usocket-operation-not-supported-error + - usocket-operation-not-permitted-error + - usocket-protocol-not-supported-error + - usocket-socket-type-not-supported-error + - usocket-network-unreachable-error + - usocket-network-down-error + - usocket-network-reset-error + - usocket-host-down-error + - usocket-host-unreachable-error + - usocket-shutdown-error + - usocket-timeout-error + - usocket-unkown-error + +and these conditions: + + - usocket-interrupted-condition + - usocket-unkown-condition From ehuelsmann at common-lisp.net Fri Feb 3 23:27:32 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 17:27:32 -0600 (CST) Subject: [usocket-cvs] r33 - usocket/trunk Message-ID: <20060203232732.4ABD6330BC@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 17:27:31 2006 New Revision: 33 Modified: usocket/trunk/condition.lisp Log: Fix clisp hack. That should teach me using old clisp... Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Fri Feb 3 17:27:31 2006 @@ -74,12 +74,7 @@ (define-condition usocket-unknown-error (usocket-error) ((real-error :initarg :real-error - :accessor usocket-real-error) - ;; clisp error wrt its condition system... - ;;it doesn't seem to inherit slots - #+clisp - (socket :initarg :socket - :accessor :usocket-socket)) + :accessor usocket-real-error)) (:documentation "")) From ehuelsmann at common-lisp.net Fri Feb 3 23:35:45 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 17:35:45 -0600 (CST) Subject: [usocket-cvs] r34 - public_html Message-ID: <20060203233545.46A2F2A031@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 17:35:44 2006 New Revision: 34 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 3 17:35:44 2006 @@ -146,6 +146,16 @@
RoadmapStatus for the currently targeted backends
Major steps
Minor stepsSBCLCMUCLABCLclispAllegroLispWorksOpenMCLSBCLCMUCLABCLclispAllegroLispWorksOpenMCL
Identify socket errors generated.WIPDONE WIP TODOWIPDONE WIP TODO TODO
+

Project history

+ +

Long ago the project was conceived and started by Erik Enge in an +attempt to factor out all implementation specific sockets code from +cl-irc. This 'long ago' must have been +way before 2003 when I entered the cl-irc project.

+ +

In januari 2006, Erik Huelsmann found Erik Enge willing to donate +the code he had still laying around to restart the project.

+
From ehuelsmann at common-lisp.net Sat Feb 4 00:14:38 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 3 Feb 2006 18:14:38 -0600 (CST) Subject: [usocket-cvs] r35 - public_html usocket/trunk usocket/trunk/backend Message-ID: <20060204001438.B88B4159CD@common-lisp.net> Author: ehuelsmann Date: Fri Feb 3 18:14:37 2006 New Revision: 35 Modified: public_html/index.shtml usocket/trunk/README usocket/trunk/backend/allegro.lisp Log: Implement Allegro backend (and update website). Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 3 18:14:37 2006 @@ -84,7 +84,7 @@ WIP TODO DONE - WIP + DONE TODO TODO Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Fri Feb 3 18:14:37 2006 @@ -24,6 +24,8 @@ - usocket-address-not-available-error - usocket-bad-file-descriptor-error - usocket-connection-refused-error + - usocket-connection-aborted-error * TODO + - usocket-connection-reset-error * TODO - usocket-invalid-argument-error - usocket-no-buffers-error - usocket-operation-not-supported-error Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Fri Feb 3 18:14:37 2006 @@ -5,30 +5,55 @@ (in-package :usocket) +(defparameter +allegro-identifier-error-map+ + '((:address-in-use . usocket-address-in-use-error) + (:address-not-available . usocket-address-not-available-error) + (:network-down . usocket-network-down-error) + (:network-reset . usocket-network-reset-error) +;; (:connection-aborted . ) FIXME: take these 2 errors in the supported list +;; (:connection-reset . ) + (:no-buffer-space . usocket-no-buffers-error) + (:shutdown . usocket-shutdown-error) + (:connection-timed-out . usocket-timeout-error) + (:connection-refused . usocket-connection-refused-error) + (:host-down . usocket-host-down-error) + (:host-unreachable . usocket-host-unreachable-error))) + (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (condition (error 'usocket-error - :real-condition condition - :socket socket)))) + (socket-error (let ((usock-err + (cdr (assoc (stream-error-identifier condition) + +allegro-identifier-error-map+)))) + (if usock-err + (error usock-err :socket socket) + (error 'usocket-unknown-error + :real-condition condition + :socket socket)))))) -(defun open (host port &optional (type :stream)) +(defun socket-connect (host port &optional (type :stream)) (declare (ignore type)) - (let ((socket (sock:make-socket :remote-host host - :remote-port port))) + (let ((socket)) + (setf socket + (with-mapped-conditions (socket) + (sock:make-socket :remote-host (host-to-hostname host) + :remote-port port))) (make-socket :socket socket :stream socket))) (defmethod close ((usocket usocket)) "Close socket." - (sock:close (socket usocket))) + (with-mapped-conditions (usocket) + (sock:close (socket usocket)))) (defun get-host-by-address (address) - (sock:ipaddr-to-hostname address)) + (with-mapped-conditions () + (sock:ipaddr-to-hostname address))) (defun get-hosts-by-name (name) ;;###FIXME: ACL has the acldns module which returns all A records ;; only problem: it doesn't fall back to tcp (from udp) if the returned ;; structure is too long. - (list (hbo-to-vector-quad (sock:lookup-hostname name)))) + (with-mapped-conditions () + (list (hbo-to-vector-quad (sock:lookup-hostname name))))) From ehuelsmann at common-lisp.net Sat Feb 4 08:54:30 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 4 Feb 2006 02:54:30 -0600 (CST) Subject: [usocket-cvs] r36 - public_html Message-ID: <20060204085430.8D6C116790@common-lisp.net> Author: ehuelsmann Date: Sat Feb 4 02:54:29 2006 New Revision: 36 Modified: public_html/index.shtml Log: Add more project documentation. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sat Feb 4 02:54:29 2006 @@ -32,7 +32,7 @@

-

Development roadmap

+

Development

Development will at least follow the steps outlined below. Yet to be determined is whether the currently mentioned steps will @@ -42,9 +42,28 @@

The targeted implementations listed in the status table below are not a final list: others can be added if/when the need or interest arrises.

+

Active development is taking place in the + Subversion repository. + To be kept up to date, please + subscribe to the commit message mailing list. To use the latest + development version, make sure you have Subversion installed and + execute this command: +

+ +
+ $ svn checkout svn://common-lisp.net/project/usocket/svn/usocket/trunk usocket-svn
+  
+ +

Please send patches, bug reports and suggestions to the development + mailing list address given above. The table below indicates the + current state of development. +

- + @@ -153,8 +172,10 @@ cl-irc. This 'long ago' must have been way before 2003 when I entered the cl-irc project.

-

In januari 2006, Erik Huelsmann found Erik Enge willing to donate -the code he had still laying around to restart the project.

+

In january 2006, Erik Huelsmann found Erik Enge willing to donate +the code he had still laying around to restart the project. The restart +took place at the 27th of january when the old code was imported into the +public repository.


From ehuelsmann at common-lisp.net Sat Feb 4 12:24:15 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 4 Feb 2006 06:24:15 -0600 (CST) Subject: [usocket-cvs] r37 - in usocket/trunk: . backend doc Message-ID: <20060204122415.4233A29465@common-lisp.net> Author: ehuelsmann Date: Sat Feb 4 06:24:14 2006 New Revision: 37 Modified: usocket/trunk/README usocket/trunk/backend/allegro.lisp usocket/trunk/backend/clisp.lisp usocket/trunk/backend/sbcl.lisp usocket/trunk/condition.lisp usocket/trunk/doc/backends.txt Log: Remove usocket- prefix from (most) errors. Also eliminate clisp error- and condition-map remapping. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Sat Feb 4 06:24:14 2006 @@ -20,30 +20,30 @@ Errors: - - usocket-address-in-use-error - - usocket-address-not-available-error - - usocket-bad-file-descriptor-error - - usocket-connection-refused-error - - usocket-connection-aborted-error * TODO - - usocket-connection-reset-error * TODO - - usocket-invalid-argument-error - - usocket-no-buffers-error - - usocket-operation-not-supported-error - - usocket-operation-not-permitted-error - - usocket-protocol-not-supported-error - - usocket-socket-type-not-supported-error - - usocket-network-unreachable-error - - usocket-network-down-error - - usocket-network-reset-error - - usocket-host-down-error - - usocket-host-unreachable-error - - usocket-shutdown-error - - usocket-timeout-error - - usocket-unkown-error + - address-in-use-error + - address-not-available-error + - bad-file-descriptor-error + - connection-refused-error + - connection-aborted-error * TODO + - connection-reset-error * TODO + - invalid-argument-error + - no-buffers-error + - operation-not-supported-error + - operation-not-permitted-error + - protocol-not-supported-error + - socket-type-not-supported-error + - network-unreachable-error + - network-down-error + - network-reset-error + - host-down-error + - host-unreachable-error + - shutdown-error + - timeout-error + - unkown-error Non-fatal conditions: - - usocket-interrupted-condition - - usocket-unkown-condition + - interrupted-condition + - unkown-condition TODO: Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Sat Feb 4 06:24:14 2006 @@ -10,8 +10,8 @@ (:address-not-available . usocket-address-not-available-error) (:network-down . usocket-network-down-error) (:network-reset . usocket-network-reset-error) -;; (:connection-aborted . ) FIXME: take these 2 errors in the supported list -;; (:connection-reset . ) + (:connection-aborted . usocket-connection-aborted-error) + (:connection-reset . usocket-connection-reset-error) (:no-buffer-space . usocket-no-buffers-error) (:shutdown . usocket-shutdown-error) (:connection-timed-out . usocket-timeout-error) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Sat Feb 4 06:24:14 2006 @@ -5,33 +5,36 @@ (in-package :usocket) -(defun remap-maybe-for-win32 (z &optional errorp) + +#+win32 +(defun remap-maybe-for-win32 (z) (mapcar #'(lambda (x) - (list #-win32 (car x) - #+win32 (mapcar #'(lambda (y) - (+ 10000 y)) - (car x)) - (cdr x) - errorp)) + (cons (mapcar #'(lambda (y) + (+ 10000 y)) + (car x)) + (cdr x))) z)) (defparameter +clisp-error-map+ - (append (remap-maybe-for-win32 +unix-errno-condition-map+) - (remap-maybe-for-win32 +unix-errno-error-map+ t))) + #+win32 + (append (remap-for-win32 +unix-errno-condition-map+) + (remap-for-win32 +unix-errno-error-map+)) + #-win32 + (append +unix-errno-condition-map+ + +unix-errno-error-map+)) (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition (system::simple-os-error - (destructuring-bind - (&optional usock-err errorp) - (cdr (assoc (car (simple-condition-format-arguments condition)) - +clisp-error-map+ :test #'member)) + (let ((usock-err + (cdr (assoc (car (simple-condition-format-arguments condition)) + +clisp-error-map+ :test member)))) (if usock-err - (if errorp + (if (subtypep usock-err 'error) (error usock-err :socket socket) (signal usock-err :socket socket)) - (error 'usocket-unknown-error + (error 'unknown-error :socket socket :real-error condition)))))) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Sat Feb 4 06:24:14 2006 @@ -9,27 +9,34 @@ (map-errno-error (sb-bsd-sockets::socket-error-errno sock-err))) (defparameter +sbcl-condition-map+ - '((interrupted-error . usocket-interrupted-condition))) + '((interrupted-error . interrupted-condition))) (defparameter +sbcl-error-map+ - `((sb-bsd-sockets:address-in-use-error . usocket-address-in-use-error) - (sb-bsd-sockets::no-address-error . usocket-address-not-available-error) - (sb-bsd-sockets:bad-file-descriptor-error . usocket-bad-file-descriptor-error) - (sb-bsd-sockets:connection-refused-error . usocket-connection-refused-error) - (sb-bsd-sockets:invalid-argument-error . usocket-invalid-argument-error) - (no-buffers-error . usocket-no-buffers-error) - (operation-not-supported-error . usocket-operation-not-supported-error) - (operation-not-permitted-error . usocket-operation-not-permitted-error) - (protocol-not-supported-error . usocket-protocol-not-supported-error) - (socket-type-not-supported-error . usocket-socket-type-not-supported-error) - (network-unreachable-error . usocket-network-unreachable-error) - ;; (... . usocket-network-down-error) - (no-recovery-error . usocket-network-reset-error) - ;; (... . usocket-host-down-error) - ;; (... . usocket-host-unreachable-error) - ;; (... . usocket-shutdown-error) - (operation-timeout-error . usocket-timeout-error) - (sb-bsd-sockets:socket-error . ,#'map-socket-error))) + ;;### FIXME: sb-bsd-sockets also has a name-service-error + ;; which is signalled when a hostname can't be resolved... + ;; what to do with that? + `((sb-bsd-sockets:address-in-use-error . address-in-use-error) + (sb-bsd-sockets::no-address-error . address-not-available-error) + (sb-bsd-sockets:bad-file-descriptor-error . bad-file-descriptor-error) + (sb-bsd-sockets:connection-refused-error . connection-refused-error) + (sb-bsd-sockets:invalid-argument-error . invalid-argument-error) + (sb-bsd-sockets:no-buffers-error . no-buffers-error) + (sb-bsd-sockets:operation-not-supported-error . operation-not-supported-error) + (sb-bsd-sockets:operation-not-permitted-error . operation-not-permitted-error) + (sb-bsd-sockets:protocol-not-supported-error . protocol-not-supported-error) + (sb-bsd-sockets:socket-type-not-supported-error . socket-type-not-supported-error) + (sb-bsd-sockets:network-unreachable-error . network-unreachable-error) + ;; (... . network-down-error) + ;; (... . host-down-error) + ;; (... . host-unreachable-error) + ;; (... . shutdown-error) + (sb-bsd-sockets:operation-timeout-error . timeout-error) + (sb-bsd-sockets:socket-error . ,#'map-socket-error) + ;; Nameservice errors + (sb-bsd-sockets:no-recovery-error . network-reset-error) +;; (sb-bsd-sockets:try-again-condition ...) +;; (sb-bsd-sockets:host-not-found ...) + )) (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." @@ -41,7 +48,7 @@ usock-error))) (if usock-error (error usock-error :socket socket) - (error 'usocket-unknown-error + (error 'unknown-error :socket socket :real-error condition)))) (condition (let* ((usock-cond (cdr (assoc (type-of condition) @@ -51,7 +58,7 @@ usock-cond))) (if usock-cond (signal usock-cond :socket socket) - (signal 'usocket-unkown-condition + (signal 'unkown-condition :real-condition condition)))))) Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Sat Feb 4 06:24:14 2006 @@ -42,10 +42,10 @@ ;; Mass define and export our conditions (define-usocket-condition-classes - (usocket-interrupted-condition) + (interrupted-condition) (usocket-condition)) -(define-condition usocket-unknown-condition (usocket-condition) +(define-condition unknown-condition (usocket-condition) ((real-condition :initarg :real-condition :accessor usocket-real-condition)) (:documentation "")) @@ -53,26 +53,28 @@ ;; Mass define and export our errors (define-usocket-condition-classes - (usocket-address-in-use-error - usocket-address-not-available-error - usocket-bad-file-descriptor-error - usocket-connection-refused-error - usocket-invalid-argument-error - usocket-no-buffers-error - usocket-operation-not-supported-error - usocket-operation-not-permitted-error - usocket-protocol-not-supported-error - usocket-socket-type-not-supported-error - usocket-network-unreachable-error - usocket-network-down-error - usocket-network-reset-error - usocket-host-down-error - usocket-host-unreachable-error - usocket-shutdown-error - usocket-timeout-error) + (address-in-use-error + address-not-available-error + bad-file-descriptor-error + connection-refused-error + connection-aborted-error + connection-reset-error + invalid-argument-error + no-buffers-error + operation-not-supported-error + operation-not-permitted-error + protocol-not-supported-error + socket-type-not-supported-error + network-unreachable-error + network-down-error + network-reset-error + host-down-error + host-unreachable-error + shutdown-error + timeout-error) (usocket-error)) -(define-condition usocket-unknown-error (usocket-error) +(define-condition unknown-error (usocket-error) ((real-error :initarg :real-error :accessor usocket-real-error)) (:documentation "")) @@ -84,9 +86,9 @@ (condition (condition) (handle-condition condition ,socket)))) (defparameter +unix-errno-condition-map+ - `(((11) . usocket-retry-condition) ;; EAGAIN - ((35) . usocket-retry-condition) ;; EDEADLCK - ((4) . usocket-interrupted-condition))) ;; EINTR + `(((11) . retry-condition) ;; EAGAIN + ((35) . retry-condition) ;; EDEADLCK + ((4) . interrupted-condition))) ;; EINTR (defparameter +unix-errno-error-map+ ;;### the first column is for non-(linux or srv4) systems @@ -96,24 +98,26 @@ ;; (at least in clisp and sbcl; I know about cmucl...) ;; The table below works under the assumption we'll *only* see ;; socket associated errors... - `(((48 98) . usocket-address-in-use-error) - ((49 99) . usocket-address-not-available-error) - ((9) . usocket-bad-file-descriptor-error) - ((61 111) . usocket-connection-refused-error) - ((22) . usocket-invalid-argument-error) - ((55 105) . usocket-no-buffers-error) - ((12) . usocket-out-of-memory-error) - ((45 95) . usocket-operation-not-supported-error) - ((1) . usocket-operation-not-permitted-error) - ((43 92) . usocket-protocol-not-supported-error) - ((44 93) . usocket-socket-type-not-supported-error) - ((51 102) . usocket-network-unreachable-error) - ((50 100) . usocket-network-down-error) - ((52 102) . usocket-network-reset-error) - ((58 108) . usocket-already-shutdown-error) - ((60 110) . usocket-connection-timeout-error) - ((64 112) . usocket-host-down-error) - ((65 113) . usocket-host-unreachable-error))) + `(((48 98) . address-in-use-error) + ((49 99) . address-not-available-error) + ((9) . bad-file-descriptor-error) + ((61 111) . connection-refused-error) + ((64 131) . connection-reset-error) + ((130) . connection-aborted-error) + ((22) . invalid-argument-error) + ((55 105) . no-buffers-error) + ((12) . out-of-memory-error) + ((45 95) . operation-not-supported-error) + ((1) . operation-not-permitted-error) + ((43 92) . protocol-not-supported-error) + ((44 93) . socket-type-not-supported-error) + ((51 102) . network-unreachable-error) + ((50 100) . network-down-error) + ((52 102) . network-reset-error) + ((58 108) . already-shutdown-error) + ((60 110) . connection-timeout-error) + ((64 112) . host-down-error) + ((65 113) . host-unreachable-error))) Modified: usocket/trunk/doc/backends.txt ============================================================================== --- usocket/trunk/doc/backends.txt (original) +++ usocket/trunk/doc/backends.txt Sat Feb 4 06:24:14 2006 @@ -20,26 +20,26 @@ An error-handling function, resolving implementation specific errors to this list of errors: - - usocket-address-in-use-error - - usocket-address-not-available-error - - usocket-bad-file-descriptor-error - - usocket-connection-refused-error - - usocket-invalid-argument-error - - usocket-no-buffers-error - - usocket-operation-not-supported-error - - usocket-operation-not-permitted-error - - usocket-protocol-not-supported-error - - usocket-socket-type-not-supported-error - - usocket-network-unreachable-error - - usocket-network-down-error - - usocket-network-reset-error - - usocket-host-down-error - - usocket-host-unreachable-error - - usocket-shutdown-error - - usocket-timeout-error - - usocket-unkown-error + - address-in-use-error + - address-not-available-error + - bad-file-descriptor-error + - connection-refused-error + - invalid-argument-error + - no-buffers-error + - operation-not-supported-error + - operation-not-permitted-error + - protocol-not-supported-error + - socket-type-not-supported-error + - network-unreachable-error + - network-down-error + - network-reset-error + - host-down-error + - host-unreachable-error + - shutdown-error + - timeout-error + - unkown-error and these conditions: - - usocket-interrupted-condition - - usocket-unkown-condition + - interrupted-condition + - unkown-condition From ehuelsmann at common-lisp.net Sat Feb 4 14:14:32 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 4 Feb 2006 08:14:32 -0600 (CST) Subject: [usocket-cvs] r38 - public_html usocket/trunk/backend Message-ID: <20060204141432.5281FE010@common-lisp.net> Author: ehuelsmann Date: Sat Feb 4 08:14:30 2006 New Revision: 38 Modified: public_html/index.shtml usocket/trunk/backend/cmucl.lisp Log: Implement CMUCL error mapping and update status table. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sat Feb 4 08:14:30 2006 @@ -100,7 +100,7 @@ - + Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Sat Feb 4 08:14:30 2006 @@ -5,12 +5,19 @@ (in-package :usocket) + +;; CMUCL error handling is brain-dead: it doesn't preserve any +;; information other than the OS error string from which the +;; error can be determined. The OS error string isn't good enough +;; given that it may have been localized (l10n). +;; +;; Just catch the errors and encapsulate them in an unknown-error (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (condition (error 'usocket-error - :real-condition condition - :socket socket)))) + (simple-error (error 'unknown-error + :real-condition condition + :socket socket)))) (defun socket-connect (host port &optional (type :stream)) (let* ((socket (ext:connect-to-inet-socket (host-byte-order host) port type)) From ehuelsmann at common-lisp.net Sat Feb 4 14:16:42 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 4 Feb 2006 08:16:42 -0600 (CST) Subject: [usocket-cvs] r39 - usocket/trunk Message-ID: <20060204141642.E7640368A7@common-lisp.net> Author: ehuelsmann Date: Sat Feb 4 08:16:42 2006 New Revision: 39 Modified: usocket/trunk/README Log: Update README with a 'known problems' section. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Sat Feb 4 08:16:42 2006 @@ -24,8 +24,8 @@ - address-not-available-error - bad-file-descriptor-error - connection-refused-error - - connection-aborted-error * TODO - - connection-reset-error * TODO + - connection-aborted-error + - connection-reset-error - invalid-argument-error - no-buffers-error - operation-not-supported-error @@ -51,3 +51,9 @@ - socket-accept (method) - socket-local-address (method) - socket-peer-address (method) + + +KNOWN PROBLEMS +- CMUCL error reporting wrt sockets raises only simple-errors + meaning there's no way to tell different error conditions apart. + All errors are mapped to unknown-error on CMUCL. From ehuelsmann at common-lisp.net Sat Feb 4 21:41:49 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 4 Feb 2006 15:41:49 -0600 (CST) Subject: [usocket-cvs] r40 - usocket/trunk/backend Message-ID: <20060204214149.86563201AD@common-lisp.net> Author: ehuelsmann Date: Sat Feb 4 15:41:49 2006 New Revision: 40 Modified: usocket/trunk/backend/cmucl.lisp Log: Fix condition mapping for CMUCL. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Sat Feb 4 15:41:49 2006 @@ -20,18 +20,22 @@ :socket socket)))) (defun socket-connect (host port &optional (type :stream)) - (let* ((socket (ext:connect-to-inet-socket (host-byte-order host) port type)) - (stream (sys:make-fd-stream socket :input t :output t - :element-type 'character - :buffering :full)) - ;;###FIXME the above line probably needs an :external-format - (usocket (make-socket :socket socket - :host host :port port :stream stream))) - usocket)) + (let* ((socket)) + (setf socket + (with-mapped-conditions (socket) + (ext:connect-to-inet-socket (host-byte-order host) port type))) + (let* ((stream (sys:make-fd-stream socket :input t :output t + :element-type 'character + :buffering :full)) + ;;###FIXME the above line probably needs an :external-format + (usocket (make-socket :socket socket + :host host :port port :stream stream))) + usocket))) (defmethod socket-close ((usocket usocket)) "Close socket." - (ext:close-socket (socket usocket))) + (with-mapped-conditions (usocket) + (ext:close-socket (socket usocket)))) From ehuelsmann at common-lisp.net Sat Feb 4 21:43:49 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 4 Feb 2006 15:43:49 -0600 (CST) Subject: [usocket-cvs] r41 - in usocket/trunk: . backend Message-ID: <20060204214349.003DA2A031@common-lisp.net> Author: ehuelsmann Date: Sat Feb 4 15:43:49 2006 New Revision: 41 Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/usocket.asd Log: Fix loading errors for Allegro CL. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Sat Feb 4 15:43:49 2006 @@ -6,18 +6,18 @@ (in-package :usocket) (defparameter +allegro-identifier-error-map+ - '((:address-in-use . usocket-address-in-use-error) - (:address-not-available . usocket-address-not-available-error) - (:network-down . usocket-network-down-error) - (:network-reset . usocket-network-reset-error) - (:connection-aborted . usocket-connection-aborted-error) - (:connection-reset . usocket-connection-reset-error) - (:no-buffer-space . usocket-no-buffers-error) - (:shutdown . usocket-shutdown-error) - (:connection-timed-out . usocket-timeout-error) - (:connection-refused . usocket-connection-refused-error) - (:host-down . usocket-host-down-error) - (:host-unreachable . usocket-host-unreachable-error))) + '((:address-in-use . address-in-use-error) + (:address-not-available . address-not-available-error) + (:network-down . network-down-error) + (:network-reset . network-reset-error) + (:connection-aborted . connection-aborted-error) + (:connection-reset . connection-reset-error) + (:no-buffer-space . no-buffers-error) + (:shutdown . shutdown-error) + (:connection-timed-out . timeout-error) + (:connection-refused . connection-refused-error) + (:host-down . host-down-error) + (:host-unreachable . host-unreachable-error))) (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." @@ -27,7 +27,7 @@ +allegro-identifier-error-map+)))) (if usock-err (error usock-err :socket socket) - (error 'usocket-unknown-error + (error 'unknown-error :real-condition condition :socket socket)))))) @@ -36,24 +36,24 @@ (let ((socket)) (setf socket (with-mapped-conditions (socket) - (sock:make-socket :remote-host (host-to-hostname host) - :remote-port port))) + (socket:make-socket :remote-host (host-to-hostname host) + :remote-port port))) (make-socket :socket socket :stream socket))) -(defmethod close ((usocket usocket)) +(defmethod socket-close ((usocket usocket)) "Close socket." (with-mapped-conditions (usocket) - (sock:close (socket usocket)))) + (close (socket usocket)))) (defun get-host-by-address (address) (with-mapped-conditions () - (sock:ipaddr-to-hostname address))) + (socket:ipaddr-to-hostname address))) (defun get-hosts-by-name (name) ;;###FIXME: ACL has the acldns module which returns all A records ;; only problem: it doesn't fall back to tcp (from udp) if the returned ;; structure is too long. (with-mapped-conditions () - (list (hbo-to-vector-quad (sock:lookup-hostname name))))) + (list (hbo-to-vector-quad (socket:lookup-hostname name))))) Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Sat Feb 4 15:43:49 2006 @@ -17,7 +17,9 @@ :version "0.1.0" :licence "MIT" :description "Universal socket library for Common Lisp" - :depends-on (#+sbcl :sb-bsd-sockets :split-sequence) + :depends-on (:split-sequence + #+allegro :socket + #+sbcl :sb-bsd-sockets) :components ((:file "package") (:file "usocket" :depends-on ("package")) From ehuelsmann at common-lisp.net Sun Feb 5 21:44:22 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 5 Feb 2006 15:44:22 -0600 (CST) Subject: [usocket-cvs] r42 - usocket/trunk Message-ID: <20060205214422.B7B722A018@common-lisp.net> Author: ehuelsmann Date: Sun Feb 5 15:44:22 2006 New Revision: 42 Modified: usocket/trunk/usocket.lisp Log: Fix host transformation routines. Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Sun Feb 5 15:44:22 2006 @@ -111,16 +111,26 @@ (defun host-to-vector-quad (host) "Translate a host specification (vector quad, dotted quad or domain name) to a vector quad." - (if (vectorp host) - host - (let* ((ip (ignore-errors - (dotted-quad-to-vector-quad host)))) - (if (and ip (= 4 (length ip))) - ip - (get-random-host-by-name host))))) + (etypecase host + (string (let* ((ip (ignore-errors + (dotted-quad-to-vector-quad host)))) + (if (and ip (= 4 (length ip))) + ;; valid IP dotted quad? + ip + (get-random-host-by-name host)))) + ((vector t 4) host) + (integer (hbo-to-vector-quad host)))) (defun host-to-hostname (host) "Translate a string or vector quad to a stringified hostname." - (if (stringp host) - host - (vector-quad-to-dotted-quad host))) + (etypecase host + (string host) + ((vector t 4) (vector-quad-to-dotted-quad host)) + (integer (hbo-to-dotted-quad host)))) + + +(defun host-to-hbo (host) + (etypecase host + (string (host-to-hbo (get-host-by-name host))) + ((vector t 4) (host-byte-order host)) + (integer host))) From ehuelsmann at common-lisp.net Sun Feb 5 21:45:33 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 5 Feb 2006 15:45:33 -0600 (CST) Subject: [usocket-cvs] r43 - usocket/trunk Message-ID: <20060205214533.8C9CF2A018@common-lisp.net> Author: ehuelsmann Date: Sun Feb 5 15:45:33 2006 New Revision: 43 Modified: usocket/trunk/usocket.asd Log: Add required lispworks module. Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Sun Feb 5 15:45:33 2006 @@ -19,7 +19,8 @@ :description "Universal socket library for Common Lisp" :depends-on (:split-sequence #+allegro :socket - #+sbcl :sb-bsd-sockets) + #+sbcl :sb-bsd-sockets + #+lispworks "comm") :components ((:file "package") (:file "usocket" :depends-on ("package")) From ehuelsmann at common-lisp.net Sun Feb 5 21:46:10 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 5 Feb 2006 15:46:10 -0600 (CST) Subject: [usocket-cvs] r44 - usocket/trunk/doc Message-ID: <20060205214610.3DE532A018@common-lisp.net> Author: ehuelsmann Date: Sun Feb 5 15:46:10 2006 New Revision: 44 Modified: usocket/trunk/doc/design.txt Log: Extend design document. Modified: usocket/trunk/doc/design.txt ============================================================================== --- usocket/trunk/doc/design.txt (original) +++ usocket/trunk/doc/design.txt Sun Feb 5 15:46:10 2006 @@ -66,11 +66,6 @@ to write a DNS client library: (which in the end may work better, because in this respect all implementations are different...) - retrieve IP addresses/ports for both sides of the connection ---- later addition -I don't think it's a good idea to implement name lookup in the -very first of steps: we'll see if this is required to get the -package accepted; not all implementations support it. ---- later addition; end Several relevant support functionalities will have to be provided too: - long <-> quad-vector operators @@ -86,3 +81,40 @@ - Allegro - LispWorks - OpenMCL + + +Comments on the design above +============================ + +I don't think it's a good idea to implement name lookup in the +very first of steps: we'll see if this is required to get the +package accepted; not all implementations support it. + +Name resolution errors ... +Since there is no name resolution library (yet), nor standardized +hooks into the standard C library to do it the same way on +all platforms, name resolution errors can manifest themselves +in a lot of different ways. How to marshall these to the +library users? + +Several solutions come to mind: + +1) Map them to 'unknown-error +2) Give them their own errors and map to those +3) ... + +Given that the library doesn't now, but may in the future, +include name resolution officially, I tend to think (1) is the +right answer: it leaves it all undecided. + +These errors can be raised by the nameresolution service +(netdb.h) as values for 'int h_errno': + +- HOST_NOT_FOUND (1) +- TRY_AGAIN (2) /* Server fail or non-authoritive Host not found */ +- NO_RECOVERY (3) /* Failed permanently */ +- NO_DATA (4) /* Valid address, no data for requested record */ + +int *__h_errno_location(void) points to thread local h_errno on +threaded glibc2 systems. + From ehuelsmann at common-lisp.net Sun Feb 5 21:50:41 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 5 Feb 2006 15:50:41 -0600 (CST) Subject: [usocket-cvs] r45 - usocket/trunk/backend Message-ID: <20060205215041.C57202A018@common-lisp.net> Author: ehuelsmann Date: Sun Feb 5 15:50:41 2006 New Revision: 45 Modified: usocket/trunk/backend/cmucl.lisp Log: Introduce error handling for cmucl 19b and later. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Sun Feb 5 15:50:41 2006 @@ -6,15 +6,47 @@ (in-package :usocket) +(defun remap-maybe-for-win32 (z) + (mapcar #'(lambda (x) + (cons (mapcar #'(lambda (y) + (+ 10000 y)) + (car x)) + (cdr x))) + z)) + +(defparameter +cmucl-error-map+ + #+win32 + (append (remap-for-win32 +unix-errno-condition-map+) + (remap-for-win32 +unix-errno-error-map+)) + #-win32 + (append +unix-errno-condition-map+ + +unix-errno-error-map+)) + + ;; CMUCL error handling is brain-dead: it doesn't preserve any ;; information other than the OS error string from which the ;; error can be determined. The OS error string isn't good enough ;; given that it may have been localized (l10n). ;; +;; The above applies to versions pre 19b; 19d and newer are expected to +;; contain even better error reporting. +;; +;; ;; Just catch the errors and encapsulate them in an unknown-error (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition + (ext::simple-error + (let ((usock-err + (cdr (assoc (ext::socket-errno c) + +cmucl-error-map+ :test member)))) + (if usock-err + (if (subtypep usock-err 'error) + (error usock-err :socket socket) + (signal usock-err :socket socket)) + (error 'unknown-error + :socket socket + :real-error condition)))) (simple-error (error 'unknown-error :real-condition condition :socket socket)))) @@ -23,7 +55,7 @@ (let* ((socket)) (setf socket (with-mapped-conditions (socket) - (ext:connect-to-inet-socket (host-byte-order host) port type))) + (ext:connect-to-inet-socket (host-to-hbo host) port type))) (let* ((stream (sys:make-fd-stream socket :input t :output t :element-type 'character :buffering :full)) From ehuelsmann at common-lisp.net Mon Feb 6 20:50:07 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 14:50:07 -0600 (CST) Subject: [usocket-cvs] r46 - in usocket/trunk: . test Message-ID: <20060206205007.A40B57E00C@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 14:50:07 2006 New Revision: 46 Added: usocket/trunk/run-usocket-tests.sh (contents, props changed) Modified: usocket/trunk/ (props changed) usocket/trunk/package.lisp usocket/trunk/test/package.lisp (contents, props changed) usocket/trunk/test/test-usocket.lisp (contents, props changed) usocket/trunk/test/usocket-test.asd (contents, props changed) Log: Commit test script update. Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Mon Feb 6 14:50:07 2006 @@ -16,6 +16,7 @@ :with-connected-socket ; macros :usocket ; socket object and accessors + :socket :socket-stream :host-byte-order ; IPv4 utility functions Added: usocket/trunk/run-usocket-tests.sh ============================================================================== --- (empty file) +++ usocket/trunk/run-usocket-tests.sh Mon Feb 6 14:50:07 2006 @@ -0,0 +1,23 @@ +#!/bin/sh + +# Test script to be run from the usocket source root +# +# Unfortunately, it currently works only with SBCL +# in my setup... +# +# I need to figure out how to setup ASDF with the other lisps +# I have installed: cmucl, ABCL, clisp, allegro and lispworks + +for my_lisp in sbcl ; do + +echo " +(require 'usocket-test) + +(usocket-test:run-usocket-tests) + +(quit) +" | $my_lisp + +echo "Above test results for $my_lisp." + +done Modified: usocket/trunk/test/package.lisp ============================================================================== --- usocket/trunk/test/package.lisp (original) +++ usocket/trunk/test/package.lisp Mon Feb 6 14:50:07 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See the LICENSE file for licensing information. @@ -9,5 +9,5 @@ (defpackage :usocket-test (:use :cl :rt) (:nicknames :usoct) - (:export :do-tests))) + (:export :do-tests :run-usocket-tests))) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Mon Feb 6 14:50:07 2006 @@ -1,17 +1,82 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See LICENSE for licensing information. (in-package :usocket-test) -(defvar *soc1* (usoc:make-socket :socket :stream - :host #(1 2 3 4) - :port 80 - :stream :my-stream)) - -(deftest make-socket.1 (usoc::real-socket usoct::*soc1*) :my-socket) -(deftest make-socket.2 (usoc::real-stream usoct::*soc1*) :my-stream) -(deftest make-socket.3 (usoc:host usoct::*soc1*) #(1 2 3 4)) -(deftest make-socket.4 (usoc:host usoct::*soc1*) 80) +(defparameter *soc1* (usocket::make-socket :socket :my-socket + :stream :my-stream)) +(deftest make-socket.1 (usocket:socket *soc1*) :my-socket) +(deftest make-socket.2 (usocket:socket-stream *soc1*) :my-stream) + +(deftest socket-no-connect.1 + (catch 'caught-error + (handler-bind ((usocket:usocket-error + #'(lambda (c) (throw 'caught-error nil)))) + (usocket:socket-connect "127.0.0.0" 80) + t)) + nil) +(deftest socket-no-connect.2 + (catch 'caught-error + (handler-bind ((usocket:usocket-error + #'(lambda (c) (throw 'caught-error nil)))) + (usocket:socket-connect #(127 0 0 0) 80) + t)) + nil) +(deftest socket-no-connect.3 + (catch 'caught-error + (handler-bind ((usocket:usocket-error + #'(lambda (c) (throw 'caught-error nil)))) + (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) + t)) + nil) + +(deftest socket-failure.1 + (catch 'caught-error + (handler-bind ((usocket:network-unreachable-error + #'(lambda (c) (throw 'caught-error nil))) + (condition + #'(lambda (c) (throw 'caught-error t)))) + (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) + t)) + nil) + +;; let's hope c-l.net doesn't move soon, or that people start to +;; test usocket like crazy.. +(deftest socket-connect.1 + (let ((sock (usocket:socket-connect "common-lisp.net" 80))) + (unwind-protect + (typep sock 'usocket:usocket) + (usocket:socket-close sock))) + t) +(deftest socket-connect.2 + (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (unwind-protect + (typep sock 'usocket:usocket) + (usocket:socket-close sock))) + t) +(deftest socket-connect.3 + (let ((sock (usocket:socket-connect 1097731309 80))) + (unwind-protect + (typep sock 'usocket:usocket) + (usocket:socket-close sock))) + t) + +;; let's hope c-l.net doesn't change its software any time soon +(deftest socket-stream.1 + (let ((sock (usocket:socket-connect "common-lisp.net" 80))) + (unwind-protect + (progn + (format (usocket:socket-stream sock) + "GET / HTTP/1.0~A~A~A~A" + #\Return #\Newline #\Return #\Newline) + (force-output (usocket:socket-stream sock)) + (read-line (usocket:socket-stream sock))) + (usocket:socket-close sock))) + #.(format nil "HTTP/1.1 200 OK~A" #\Return) nil) + + +(defun run-usocket-tests () + (do-tests)) Modified: usocket/trunk/test/usocket-test.asd ============================================================================== --- usocket/trunk/test/usocket-test.asd (original) +++ usocket/trunk/test/usocket-test.asd Mon Feb 6 14:50:07 2006 @@ -1,5 +1,5 @@ ;;;; $Id$ -;;;; $Source$ +;;;; $URL$ ;;;; See the LICENSE file for licensing information. From ehuelsmann at common-lisp.net Mon Feb 6 20:51:51 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 14:51:51 -0600 (CST) Subject: [usocket-cvs] r47 - usocket/trunk/backend Message-ID: <20060206205151.35F192A034@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 14:51:50 2006 New Revision: 47 Modified: usocket/trunk/backend/lispworks.lisp Log: Update LispWorks backend. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Mon Feb 6 14:51:50 2006 @@ -5,33 +5,59 @@ (in-package :usocket) + +#+win32 +(defun remap-maybe-for-win32 (z) + (mapcar #'(lambda (x) + (cons (mapcar #'(lambda (y) + (+ 10000 y)) + (car x)) + (cdr x))) + z)) + +(defparameter +lispworks-error-map+ + #+win32 + (append (remap-for-win32 +unix-errno-condition-map+) + (remap-for-win32 +unix-errno-error-map+)) + #-win32 + (append +unix-errno-condition-map+ + +unix-errno-error-map+)) + + + (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (condition (error 'usocket-error - :real-condition condition - :socket socket)))) + (simple-error (destructuring-bind (&optional host port err-msg errno) + (simple-condition-format-arguments condition) + (declare (ignore host port err-msg)) + (let* ((usock-err + (cdr (assoc errno +lispworks-error-map+ + :test #'member)))) + (if usock-err + (if (subtypep usock-err 'error) + (error usock-err :socket socket) + (signal usock-err :socket socket)) + (error 'unknown-error + :socket socket + :real-error condition))))))) +;; (condition (error 'usocket-error +;; :real-condition condition +;; :socket socket)))) -(defun open (host port &optional (type :stream)) +(defun socket-connect (host port &optional (type :stream)) (declare (ignore type)) - (make-socket :socket (comm:open-tcp-stream host port) - :host host - :port port)) - -(defmethod close ((socket socket)) - "Close socket." - (cl:close (real-socket socket))) - -(defmethod read-line ((socket socket)) - (cl:read-line (real-socket socket))) + (let ((hostname (host-to-hostname host)) + (stream)) + (setf stream + (with-mapped-conditions () + (comm:open-tcp-stream host port))) + (make-socket :socket (comm:socket-stream-socket stream) + :stream stream))) +;; :host host +;; :port port)) -(defmethod write-sequence ((socket socket) sequence) - (cl:write-sequence sequence (real-socket socket))) - -(defun get-host-by-address (address) - (comm:get-host-entry (vector-quad-to-dotted-quad address) - :fields '(:name))) +(defmethod socket-close ((usocket usocket)) + "Close socket." + (close (stream usocket))) -(defun get-host-by-name (name) - (mapcar #'hbo-to-vector-quad - (comm:get-host-entry name :fields '(:addresses)))) From ehuelsmann at common-lisp.net Mon Feb 6 21:15:35 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 15:15:35 -0600 (CST) Subject: [usocket-cvs] r48 - public_html Message-ID: <20060206211535.4B53E4200D@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 15:15:34 2006 New Revision: 48 Modified: public_html/index.shtml public_html/style.css Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Mon Feb 6 15:15:34 2006 @@ -83,41 +83,61 @@ - - - + + - - - - + + + + - + - + + + + + + + + + + + + + + + + + + + + + Modified: public_html/style.css ============================================================================== --- public_html/style.css (original) +++ public_html/style.css Mon Feb 6 15:15:34 2006 @@ -74,3 +74,14 @@ .DONE { background-color: #080; color: #000; text-align: center; } + +.UNTESTED { text-align: center; } + +.PASS { background-color: #080; + color: #000; + text-align: center; } + +.FAIL { background-color: #b00; + color: #fff; + text-align: center; + font-weight: bold } From ehuelsmann at common-lisp.net Mon Feb 6 23:25:14 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 17:25:14 -0600 (CST) Subject: [usocket-cvs] r49 - in usocket/trunk: . backend test Message-ID: <20060206232514.EEAA777018@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 17:25:14 2006 New Revision: 49 Modified: usocket/trunk/ (props changed) usocket/trunk/backend/ (props changed) usocket/trunk/test/ (props changed) Log: Change ignore patterns to accomodate CMUCL. From ehuelsmann at common-lisp.net Mon Feb 6 23:27:38 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 17:27:38 -0600 (CST) Subject: [usocket-cvs] r50 - usocket/trunk Message-ID: <20060206232738.398957A002@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 17:27:37 2006 New Revision: 50 Modified: usocket/trunk/usocket.lisp Log: Limit hostname resolution to non-dotted quad strings. Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Mon Feb 6 17:27:37 2006 @@ -80,6 +80,7 @@ (let ((list (list-of-strings-to-integers (split-sequence:split-sequence #\. string)))) (vector (first list) (second list) (third list) (fourth list)))) +(defgeneric host-byte-order (address)) (defmethod host-byte-order ((string string)) "Convert a string, such as 192.168.1.1, to host-byte-order, such as 3232235777." @@ -128,9 +129,13 @@ ((vector t 4) (vector-quad-to-dotted-quad host)) (integer (hbo-to-dotted-quad host)))) - +#-clisp (defun host-to-hbo (host) (etypecase host - (string (host-to-hbo (get-host-by-name host))) + (string (let ((ip (ignore-errors + (dotted-quad-to-vector-quad host)))) + (if (and ip (= 4 (length ip))) + ip + (host-to-hbo (get-host-by-name host))))) ((vector t 4) (host-byte-order host)) (integer host))) From ehuelsmann at common-lisp.net Mon Feb 6 23:28:23 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 17:28:23 -0600 (CST) Subject: [usocket-cvs] r51 - usocket/trunk Message-ID: <20060206232823.63BCD7A002@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 17:28:23 2006 New Revision: 51 Modified: usocket/trunk/package.lisp Log: Adjust to new naming. Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Mon Feb 6 17:28:23 2006 @@ -27,6 +27,6 @@ :usocket-condition ; conditions :usocket-error ; errors - :usocket-unknown-condition - :usocket-unknown-error))) + :unknown-condition + :unknown-error))) From ehuelsmann at common-lisp.net Mon Feb 6 23:28:52 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 17:28:52 -0600 (CST) Subject: [usocket-cvs] r52 - in usocket/trunk: backend test Message-ID: <20060206232852.473567B001@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 17:28:51 2006 New Revision: 52 Modified: usocket/trunk/backend/cmucl.lisp usocket/trunk/test/test-usocket.lisp Log: Make CMUCL pass the test-suite. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Mon Feb 6 17:28:51 2006 @@ -5,8 +5,8 @@ (in-package :usocket) - -(defun remap-maybe-for-win32 (z) +#+win32 +(defun remap-for-win32 (z) (mapcar #'(lambda (x) (cons (mapcar #'(lambda (y) (+ 10000 y)) @@ -16,12 +16,22 @@ (defparameter +cmucl-error-map+ #+win32 - (append (remap-for-win32 +unix-errno-condition-map+) + (append (remap-for-win32 +unix-errno-condition-map+) (remap-for-win32 +unix-errno-error-map+)) #-win32 (append +unix-errno-condition-map+ +unix-errno-error-map+)) +(defun cmucl-map-socket-error (err &key condition socket) + (let ((usock-err + (cdr (assoc err +cmucl-error-map+ :test #'member)))) + (if usock-err + (if (subtypep usock-err 'error) + (error usock-err :socket socket) + (signal usock-err :socket socket)) + (error 'unknown-error + :socket socket + :real-error condition)))) ;; CMUCL error handling is brain-dead: it doesn't preserve any ;; information other than the OS error string from which the @@ -36,17 +46,9 @@ (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (ext::simple-error - (let ((usock-err - (cdr (assoc (ext::socket-errno c) - +cmucl-error-map+ :test member)))) - (if usock-err - (if (subtypep usock-err 'error) - (error usock-err :socket socket) - (signal usock-err :socket socket)) - (error 'unknown-error - :socket socket - :real-error condition)))) + (ext::socket-error (cmucl-map-socket-error (ext::socket-errno condition) + :socket socket + :condition condition)) (simple-error (error 'unknown-error :real-condition condition :socket socket)))) @@ -56,13 +58,16 @@ (setf socket (with-mapped-conditions (socket) (ext:connect-to-inet-socket (host-to-hbo host) port type))) - (let* ((stream (sys:make-fd-stream socket :input t :output t - :element-type 'character - :buffering :full)) - ;;###FIXME the above line probably needs an :external-format - (usocket (make-socket :socket socket - :host host :port port :stream stream))) - usocket))) + (if socket + (let* ((stream (sys:make-fd-stream socket :input t :output t + :element-type 'character + :buffering :full)) + ;;###FIXME the above line probably needs an :external-format + (usocket (make-socket :socket socket + :stream stream))) + usocket) + (let ((err (unix:unix-errno))) + (when err (cmucl-map-socket-error err)))))) (defmethod socket-close ((usocket usocket)) "Close socket." @@ -76,7 +81,7 @@ (ext::lookup-host-entry (host-byte-order address))) (condition (condition) (handle-condition condition)))) -(defun get-host-by-name (name) +(defun get-hosts-by-name (name) (handler-case (mapcar #'hbo-to-vector-quad (ext:host-entry-addr-list (ext:lookup-host-entry name))) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Mon Feb 6 17:28:51 2006 @@ -37,10 +37,14 @@ (catch 'caught-error (handler-bind ((usocket:network-unreachable-error #'(lambda (c) (throw 'caught-error nil))) + ;; cmu doesn't report as specific as above + #+cmu + (usocket:unknown-error + #'(lambda (c) (throw 'caught-error nil))) (condition #'(lambda (c) (throw 'caught-error t)))) (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) - t)) + :unreach)) nil) ;; let's hope c-l.net doesn't move soon, or that people start to @@ -50,7 +54,7 @@ (unwind-protect (typep sock 'usocket:usocket) (usocket:socket-close sock))) - t) + t) (deftest socket-connect.2 (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) (unwind-protect From ehuelsmann at common-lisp.net Mon Feb 6 23:30:10 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 6 Feb 2006 17:30:10 -0600 (CST) Subject: [usocket-cvs] r53 - public_html Message-ID: <20060206233010.45A8A7D00E@common-lisp.net> Author: ehuelsmann Date: Mon Feb 6 17:30:09 2006 New Revision: 53 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Mon Feb 6 17:30:09 2006 @@ -130,7 +130,7 @@ - + From ehuelsmann at common-lisp.net Tue Feb 7 07:53:54 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 7 Feb 2006 01:53:54 -0600 (CST) Subject: [usocket-cvs] r54 - public_html usocket/trunk usocket/trunk/backend usocket/trunk/test Message-ID: <20060207075354.1333D2A034@common-lisp.net> Author: ehuelsmann Date: Tue Feb 7 01:53:52 2006 New Revision: 54 Modified: public_html/index.shtml usocket/trunk/ (props changed) usocket/trunk/backend/ (props changed) usocket/trunk/backend/clisp.lisp usocket/trunk/condition.lisp usocket/trunk/test/ (props changed) usocket/trunk/test/test-usocket.lisp Log: Make clisp work, adjusting ignore patterns and update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Feb 7 01:53:52 2006 @@ -132,7 +132,7 @@ - + Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Tue Feb 7 01:53:52 2006 @@ -29,7 +29,7 @@ (system::simple-os-error (let ((usock-err (cdr (assoc (car (simple-condition-format-arguments condition)) - +clisp-error-map+ :test member)))) + +clisp-error-map+ :test #'member)))) (if usock-err (if (subtypep usock-err 'error) (error usock-err :socket socket) Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Tue Feb 7 01:53:52 2006 @@ -111,7 +111,7 @@ ((1) . operation-not-permitted-error) ((43 92) . protocol-not-supported-error) ((44 93) . socket-type-not-supported-error) - ((51 102) . network-unreachable-error) + ((51 101) . network-unreachable-error) ((50 100) . network-down-error) ((52 102) . network-reset-error) ((58 108) . already-shutdown-error) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Tue Feb 7 01:53:52 2006 @@ -79,7 +79,8 @@ (force-output (usocket:socket-stream sock)) (read-line (usocket:socket-stream sock))) (usocket:socket-close sock))) - #.(format nil "HTTP/1.1 200 OK~A" #\Return) nil) + #+clisp "HTTP/1.1 200 OK" + #-clisp #.(format nil "HTTP/1.1 200 OK~A" #\Return) nil) (defun run-usocket-tests () From ehuelsmann at common-lisp.net Tue Feb 7 18:27:50 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 7 Feb 2006 12:27:50 -0600 (CST) Subject: [usocket-cvs] r55 - in usocket/trunk: . backend Message-ID: <20060207182750.846042A034@common-lisp.net> Author: ehuelsmann Date: Tue Feb 7 12:27:50 2006 New Revision: 55 Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/usocket.asd Log: Make Allegro work. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Tue Feb 7 12:27:50 2006 @@ -10,6 +10,7 @@ (:address-not-available . address-not-available-error) (:network-down . network-down-error) (:network-reset . network-reset-error) + (:network-unreachable . network-unreachable-error) (:connection-aborted . connection-aborted-error) (:connection-reset . connection-reset-error) (:no-buffer-space . no-buffers-error) @@ -22,14 +23,15 @@ (defun handle-condition (condition &optional (socket nil)) "Dispatch correct usocket condition." (typecase condition - (socket-error (let ((usock-err - (cdr (assoc (stream-error-identifier condition) - +allegro-identifier-error-map+)))) - (if usock-err - (error usock-err :socket socket) - (error 'unknown-error - :real-condition condition - :socket socket)))))) + (excl:socket-error + (let ((usock-err + (cdr (assoc (excl:stream-error-identifier condition) + +allegro-identifier-error-map+)))) + (if usock-err + (error usock-err :socket socket) + (error 'unknown-error + :real-error condition + :socket socket)))))) (defun socket-connect (host port &optional (type :stream)) (declare (ignore type)) Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Tue Feb 7 12:27:50 2006 @@ -18,7 +18,6 @@ :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence - #+allegro :socket #+sbcl :sb-bsd-sockets #+lispworks "comm") :components ((:file "package") From ehuelsmann at common-lisp.net Tue Feb 7 18:37:00 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 7 Feb 2006 12:37:00 -0600 (CST) Subject: [usocket-cvs] r56 - public_html Message-ID: <20060207183700.457072A034@common-lisp.net> Author: ehuelsmann Date: Tue Feb 7 12:36:58 2006 New Revision: 56 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Feb 7 12:36:58 2006 @@ -133,7 +133,7 @@ - + From ehuelsmann at common-lisp.net Tue Feb 7 19:39:46 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 7 Feb 2006 13:39:46 -0600 (CST) Subject: [usocket-cvs] r57 - in usocket/trunk: . backend test Message-ID: <20060207193946.E66FA2A034@common-lisp.net> Author: ehuelsmann Date: Tue Feb 7 13:39:46 2006 New Revision: 57 Modified: usocket/trunk/ (props changed) usocket/trunk/backend/ (props changed) usocket/trunk/backend/lispworks.lisp usocket/trunk/condition.lisp usocket/trunk/test/ (props changed) usocket/trunk/test/package.lisp usocket/trunk/test/test-usocket.lisp usocket/trunk/usocket.asd Log: Make LispWorks work. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Feb 7 13:39:46 2006 @@ -5,6 +5,8 @@ (in-package :usocket) +(eval-when (:compile-toplevel :load-toplevel :execute) + (require "comm")) #+win32 (defun remap-maybe-for-win32 (z) @@ -51,13 +53,15 @@ (stream)) (setf stream (with-mapped-conditions () - (comm:open-tcp-stream host port))) - (make-socket :socket (comm:socket-stream-socket stream) - :stream stream))) + (comm:open-tcp-stream hostname port))) + (if stream + (make-socket :socket (comm:socket-stream-socket stream) + :stream stream) + (error 'unknown-error)))) ;; :host host ;; :port port)) (defmethod socket-close ((usocket usocket)) "Close socket." - (close (stream usocket))) + (close (socket-stream usocket))) Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Tue Feb 7 13:39:46 2006 @@ -18,7 +18,7 @@ (define-condition usocket-condition (condition) ((socket :initarg :socket - :accessor :usocket-socket)) + :accessor usocket-socket)) ;;###FIXME: no slots (yet); should at least be the affected usocket... (:documentation "")) Modified: usocket/trunk/test/package.lisp ============================================================================== --- usocket/trunk/test/package.lisp (original) +++ usocket/trunk/test/package.lisp Tue Feb 7 13:39:46 2006 @@ -7,7 +7,7 @@ (eval-when (:execute :load-toplevel :compile-toplevel) (defpackage :usocket-test - (:use :cl :rt) + (:use :cl :regression-test) (:nicknames :usoct) (:export :do-tests :run-usocket-tests))) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Tue Feb 7 13:39:46 2006 @@ -38,7 +38,7 @@ (handler-bind ((usocket:network-unreachable-error #'(lambda (c) (throw 'caught-error nil))) ;; cmu doesn't report as specific as above - #+cmu + #+(or cmu lispworks) (usocket:unknown-error #'(lambda (c) (throw 'caught-error nil))) (condition Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Tue Feb 7 13:39:46 2006 @@ -18,8 +18,7 @@ :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence - #+sbcl :sb-bsd-sockets - #+lispworks "comm") + #+sbcl :sb-bsd-sockets) :components ((:file "package") (:file "usocket" :depends-on ("package")) From ehuelsmann at common-lisp.net Tue Feb 7 19:40:39 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 7 Feb 2006 13:40:39 -0600 (CST) Subject: [usocket-cvs] r58 - public_html Message-ID: <20060207194039.4755E4300D@common-lisp.net> Author: ehuelsmann Date: Tue Feb 7 13:40:37 2006 New Revision: 58 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Feb 7 13:40:37 2006 @@ -134,7 +134,7 @@ - + From ehuelsmann at common-lisp.net Tue Feb 7 20:03:24 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 7 Feb 2006 14:03:24 -0600 (CST) Subject: [usocket-cvs] r59 - public_html Message-ID: <20060207200324.453F64A081@common-lisp.net> Author: ehuelsmann Date: Tue Feb 7 14:03:22 2006 New Revision: 59 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Feb 7 14:03:22 2006 @@ -104,7 +104,7 @@ - + @@ -113,8 +113,8 @@ - - + + From ehuelsmann at common-lisp.net Wed Feb 8 20:42:28 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 8 Feb 2006 14:42:28 -0600 (CST) Subject: [usocket-cvs] r60 - usocket/trunk/backend Message-ID: <20060208204228.0004B66000@common-lisp.net> Author: ehuelsmann Date: Wed Feb 8 14:42:28 2006 New Revision: 60 Modified: usocket/trunk/backend/sbcl.lisp Log: Clean up SBCL backend. Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Wed Feb 8 14:42:28 2006 @@ -12,28 +12,25 @@ '((interrupted-error . interrupted-condition))) (defparameter +sbcl-error-map+ - ;;### FIXME: sb-bsd-sockets also has a name-service-error - ;; which is signalled when a hostname can't be resolved... - ;; what to do with that? `((sb-bsd-sockets:address-in-use-error . address-in-use-error) (sb-bsd-sockets::no-address-error . address-not-available-error) (sb-bsd-sockets:bad-file-descriptor-error . bad-file-descriptor-error) (sb-bsd-sockets:connection-refused-error . connection-refused-error) (sb-bsd-sockets:invalid-argument-error . invalid-argument-error) (sb-bsd-sockets:no-buffers-error . no-buffers-error) - (sb-bsd-sockets:operation-not-supported-error . operation-not-supported-error) - (sb-bsd-sockets:operation-not-permitted-error . operation-not-permitted-error) - (sb-bsd-sockets:protocol-not-supported-error . protocol-not-supported-error) - (sb-bsd-sockets:socket-type-not-supported-error . socket-type-not-supported-error) + (sb-bsd-sockets:operation-not-supported-error + . operation-not-supported-error) + (sb-bsd-sockets:operation-not-permitted-error + . operation-not-permitted-error) + (sb-bsd-sockets:protocol-not-supported-error + . protocol-not-supported-error) + (sb-bsd-sockets:socket-type-not-supported-error + . socket-type-not-supported-error) (sb-bsd-sockets:network-unreachable-error . network-unreachable-error) - ;; (... . network-down-error) - ;; (... . host-down-error) - ;; (... . host-unreachable-error) - ;; (... . shutdown-error) (sb-bsd-sockets:operation-timeout-error . timeout-error) (sb-bsd-sockets:socket-error . ,#'map-socket-error) - ;; Nameservice errors - (sb-bsd-sockets:no-recovery-error . network-reset-error) + ;; Nameservice errors: mapped to unknown-error +;; (sb-bsd-sockets:no-recovery-error . network-reset-error) ;; (sb-bsd-sockets:try-again-condition ...) ;; (sb-bsd-sockets:host-not-found ...) )) @@ -63,11 +60,6 @@ (defun socket-connect (host port &optional (type :stream)) - "Connect to `host' on `port'. `host' is assumed to be a string of -an IP address represented in vector notation, such as #(192 168 1 1). -`port' is assumed to be an integer. - -Returns a usocket object." (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket :type type :protocol :tcp)) (stream (sb-bsd-sockets:socket-make-stream socket @@ -83,7 +75,6 @@ usocket)) (defmethod socket-close ((usocket usocket)) - "Close socket." (with-mapped-conditions (usocket) (sb-bsd-sockets:socket-close (socket usocket)))) From ehuelsmann at common-lisp.net Wed Feb 8 20:43:08 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 8 Feb 2006 14:43:08 -0600 (CST) Subject: [usocket-cvs] r61 - usocket/trunk/test Message-ID: <20060208204308.BFC3767000@common-lisp.net> Author: ehuelsmann Date: Wed Feb 8 14:43:08 2006 New Revision: 61 Modified: usocket/trunk/test/test-usocket.lisp Log: One more test case. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Wed Feb 8 14:43:08 2006 @@ -5,6 +5,8 @@ (in-package :usocket-test) + +(defparameter +non-existing-host+ "10.0.0.13") (defparameter *soc1* (usocket::make-socket :socket :my-socket :stream :my-stream)) @@ -46,6 +48,20 @@ (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) :unreach)) nil) +(deftest socket-failure.2 + (catch 'caught-error + (handler-bind ((usocket:host-unreachable-error + #'(lambda (c) (throw 'caught-error nil))) + ;; cmu doesn't report as specific as above + #+(or cmu lispworks) + (usocket:unknown-error + #'(lambda (c) (throw 'caught-error nil))) + (condition + #'(lambda (c) (throw 'caught-error t)))) + (usocket:socket-connect +non-existing-host+ 80) ;; == #(127 0 0 0) + :unreach)) + nil) + ;; let's hope c-l.net doesn't move soon, or that people start to ;; test usocket like crazy.. From ehuelsmann at common-lisp.net Wed Feb 8 20:45:56 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 8 Feb 2006 14:45:56 -0600 (CST) Subject: [usocket-cvs] r62 - in usocket/trunk: . doc Message-ID: <20060208204556.5C9426B00D@common-lisp.net> Author: ehuelsmann Date: Wed Feb 8 14:45:56 2006 New Revision: 62 Added: usocket/trunk/TODO Modified: usocket/trunk/doc/design.txt Log: Add TODO and update design doc. Added: usocket/trunk/TODO ============================================================================== --- (empty file) +++ usocket/trunk/TODO Wed Feb 8 14:45:56 2006 @@ -0,0 +1,16 @@ + +- Check consistency of error translation for each of the backends + with the design document. + +- Move all function documentation from the backends to + (setf documentation) forms in usocket.lisp. + +- Extend ABCL socket support with the 4 java errors in java.net + so that they can map to our usocket errors instead of mapping + all errors to unknown-error. + +- Investigate which backends would support streams with other + elements than :element-type 'character, especially since + cl-irc chokes on characters which are non-UTF8 conforming... + Probably other clients do too (try that with a binary HTTP stream!) + Modified: usocket/trunk/doc/design.txt ============================================================================== --- usocket/trunk/doc/design.txt (original) +++ usocket/trunk/doc/design.txt Wed Feb 8 14:45:56 2006 @@ -101,6 +101,7 @@ 1) Map them to 'unknown-error 2) Give them their own errors and map to those + ... which implies that they are actually supported atm. 3) ... Given that the library doesn't now, but may in the future, From ehuelsmann at common-lisp.net Wed Feb 8 20:47:19 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 8 Feb 2006 14:47:19 -0600 (CST) Subject: [usocket-cvs] r63 - usocket/trunk Message-ID: <20060208204719.105256D002@common-lisp.net> Author: ehuelsmann Date: Wed Feb 8 14:47:18 2006 New Revision: 63 Modified: usocket/trunk/usocket.lisp Log: Move function documentation out of the backend file. Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Wed Feb 8 14:47:18 2006 @@ -139,3 +139,15 @@ (host-to-hbo (get-host-by-name host))))) ((vector t 4) (host-byte-order host)) (integer host))) + +;; +;; Setting of documentation for backend defined functions +;; + +(setf (documentation 'socket-connect 'function) + "Connect to `host' on `port'. `host' is assumed to be a string of +an IP address represented in vector notation, such as #(192 168 1 1). +`port' is assumed to be an integer. + +Returns a usocket object.") + From ehuelsmann at common-lisp.net Thu Feb 9 22:06:54 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 9 Feb 2006 16:06:54 -0600 (CST) Subject: [usocket-cvs] r64 - in usocket/trunk: . backend Message-ID: <20060209220654.C8A322A03A@common-lisp.net> Author: ehuelsmann Date: Thu Feb 9 16:06:54 2006 New Revision: 64 Added: usocket/trunk/backend/armedbear.lisp (contents, props changed) usocket/trunk/backend/openmcl.lisp (contents, props changed) Modified: usocket/trunk/usocket.asd usocket/trunk/usocket.lisp Log: Add OpenMCL (untested) and Armedbear (tested with FAILures) support. Added: usocket/trunk/backend/armedbear.lisp ============================================================================== --- (empty file) +++ usocket/trunk/backend/armedbear.lisp Thu Feb 9 16:06:54 2006 @@ -0,0 +1,24 @@ +;;;; $Id$ +;;;; $URL$ + +;;;; See LICENSE for licensing information. + +(in-package :usocket) + + + +(defun handle-condition (condition &optional socket) + (typecase condition + (error (error 'unkown-error :socket socket :real-error condition)))) + +(defun socket-connect (host port) + (let ((usock)) + (with-mapped-conditions (usock) + (let ((sock (ext:make-socket (host-to-hostname host) port))) + (setf usock + (make-socket :socket sock + :stream (ext:get-socket-stream sock))))))) + +(defmethod socket-close ((usocket usocket)) + (with-mapped-conditions (usocket) + (ext:socket-close (socket usocket)))) Added: usocket/trunk/backend/openmcl.lisp ============================================================================== --- (empty file) +++ usocket/trunk/backend/openmcl.lisp Thu Feb 9 16:06:54 2006 @@ -0,0 +1,47 @@ +;;;; $Id$ +;;;; $URL$ + +;;;; See LICENSE for licensing information. + +(in-package :usocket) + + + +(defparameter +openmcl-error-map+ + '((:address-in-use . address-in-use-error) + (:connection-aborted . connection-aborted-error) + (:no-buffer-space . no-buffers-error) + (:connection-timed-out . timeout-error) + (:connection-refused . connection-refused-error) + (:host-unreachable . host-unreachable-error) + (:host-down . host-down-error) + (:network-down . network-down-error) + (:address-not-available . address-not-available-error) + (:network-reset . network-reset-error) + (:connection-reset . connection-reset-error) + (:shutdown . shutdown-error) + (:access-denied . operation-not-permitted-error))) + + +(defun handle-condition (condition &optional socket) + (typecase condition + (socket-error + (let ((usock-err (cdr (assoc (socket-error-identifier condition) + +openmcl-error-map+)))) + (if usock-err + (error usock-err :socket socket) + (error 'unknown-error :socket socket :real-erorr condition)))) + (error (error 'unknown-error :socket socket :real-erorr condition)) + (condition (signal 'unkown-condition :real-condition condition)))) + +(defun socket-connect (host port) + (let ((sock)) + (with-mapped-conditions (sock) + (setf sock + (make-socket :remote-host (host-to-hostname host) + :remote-port port)) + (socket-connect sock)))) + +(defmethod socket-close ((usocket usocket)) + (with-mapped-conditions (usocket) + (close (socket usocket)))) Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Thu Feb 9 16:06:54 2006 @@ -36,4 +36,6 @@ :depends-on ("condition")) #+allegro (:file "allegro" :pathname "backend/allegro" :depends-on ("condition")) + #+armedbear (:file "armedbear" :pathname "backend/armedbear" + :depends-on ("condition")) )) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Thu Feb 9 16:06:54 2006 @@ -98,29 +98,38 @@ ;; DNS helper functions ;; -#-clisp -(defun get-host-by-name (name) - (let ((hosts (get-hosts-by-name name))) - (car hosts))) - -#-clisp -(defun get-random-host-by-name (name) - (let ((hosts (get-hosts-by-name name))) - (elt hosts (random (length hosts))))) - -#-clisp -(defun host-to-vector-quad (host) - "Translate a host specification (vector quad, dotted quad or domain name) +#-(or clisp openmcl armedbear) +(progn + (defun get-host-by-name (name) + (let ((hosts (get-hosts-by-name name))) + (car hosts))) + + (defun get-random-host-by-name (name) + (let ((hosts (get-hosts-by-name name))) + (elt hosts (random (length hosts))))) + + (defun host-to-vector-quad (host) + "Translate a host specification (vector quad, dotted quad or domain name) to a vector quad." - (etypecase host - (string (let* ((ip (ignore-errors - (dotted-quad-to-vector-quad host)))) - (if (and ip (= 4 (length ip))) - ;; valid IP dotted quad? - ip - (get-random-host-by-name host)))) - ((vector t 4) host) - (integer (hbo-to-vector-quad host)))) + (etypecase host + (string (let* ((ip (ignore-errors + (dotted-quad-to-vector-quad host)))) + (if (and ip (= 4 (length ip))) + ;; valid IP dotted quad? + ip + (get-random-host-by-name host)))) + ((vector t 4) host) + (integer (hbo-to-vector-quad host)))) + + (defun host-to-hbo (host) + (etypecase host + (string (let ((ip (ignore-errors + (dotted-quad-to-vector-quad host)))) + (if (and ip (= 4 (length ip))) + ip + (host-to-hbo (get-host-by-name host))))) + ((vector t 4) (host-byte-order host)) + (integer host)))) (defun host-to-hostname (host) "Translate a string or vector quad to a stringified hostname." @@ -129,17 +138,6 @@ ((vector t 4) (vector-quad-to-dotted-quad host)) (integer (hbo-to-dotted-quad host)))) -#-clisp -(defun host-to-hbo (host) - (etypecase host - (string (let ((ip (ignore-errors - (dotted-quad-to-vector-quad host)))) - (if (and ip (= 4 (length ip))) - ip - (host-to-hbo (get-host-by-name host))))) - ((vector t 4) (host-byte-order host)) - (integer host))) - ;; ;; Setting of documentation for backend defined functions ;; From ehuelsmann at common-lisp.net Thu Feb 9 22:08:30 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 9 Feb 2006 16:08:30 -0600 (CST) Subject: [usocket-cvs] r65 - in usocket/trunk: . backend test Message-ID: <20060209220830.B32642A03A@common-lisp.net> Author: ehuelsmann Date: Thu Feb 9 16:08:30 2006 New Revision: 65 Modified: usocket/trunk/ (props changed) usocket/trunk/backend/ (props changed) usocket/trunk/test/ (props changed) Log: Update ignore patterns to accomodate Armedbear. From ehuelsmann at common-lisp.net Fri Feb 10 16:57:17 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 10:57:17 -0600 (CST) Subject: [usocket-cvs] r66 - in usocket/trunk: backend test Message-ID: <20060210165717.0C0655C006@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 10:57:16 2006 New Revision: 66 Modified: usocket/trunk/backend/armedbear.lisp usocket/trunk/test/test-usocket.lisp Log: Fix Armedbear test failures. Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Fri Feb 10 10:57:16 2006 @@ -8,8 +8,9 @@ (defun handle-condition (condition &optional socket) + (describe condition) (typecase condition - (error (error 'unkown-error :socket socket :real-error condition)))) + (error (error 'unknown-error :socket socket :real-error condition)))) (defun socket-connect (host port) (let ((usock)) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Fri Feb 10 10:57:16 2006 @@ -39,8 +39,8 @@ (catch 'caught-error (handler-bind ((usocket:network-unreachable-error #'(lambda (c) (throw 'caught-error nil))) - ;; cmu doesn't report as specific as above - #+(or cmu lispworks) + ;; some lisps don't report as specific as above + #+(or cmu lispworks armedbear) (usocket:unknown-error #'(lambda (c) (throw 'caught-error nil))) (condition @@ -52,8 +52,8 @@ (catch 'caught-error (handler-bind ((usocket:host-unreachable-error #'(lambda (c) (throw 'caught-error nil))) - ;; cmu doesn't report as specific as above - #+(or cmu lispworks) + ;; some lisps don't report as specific as above + #+(or cmu lispworks armedbear) (usocket:unknown-error #'(lambda (c) (throw 'caught-error nil))) (condition From ehuelsmann at common-lisp.net Fri Feb 10 17:41:42 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 11:41:42 -0600 (CST) Subject: [usocket-cvs] r67 - usocket/trunk/backend Message-ID: <20060210174142.1C6F8E017@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 11:41:41 2006 New Revision: 67 Modified: usocket/trunk/backend/armedbear.lisp Log: Remove debugging statement. Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Fri Feb 10 11:41:41 2006 @@ -8,7 +8,6 @@ (defun handle-condition (condition &optional socket) - (describe condition) (typecase condition (error (error 'unknown-error :socket socket :real-error condition)))) From ehuelsmann at common-lisp.net Fri Feb 10 18:18:39 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 12:18:39 -0600 (CST) Subject: [usocket-cvs] r68 - public_html Message-ID: <20060210181839.46EE82A033@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 12:18:35 2006 New Revision: 68 Modified: public_html/index.shtml Log: Update website status diagram. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 10 12:18:35 2006 @@ -90,10 +90,10 @@ - + - + @@ -101,37 +101,37 @@ - + + - - - + + - - - + + + + - - + From ehuelsmann at common-lisp.net Fri Feb 10 21:57:25 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 15:57:25 -0600 (CST) Subject: [usocket-cvs] r69 - usocket/trunk/backend Message-ID: <20060210215725.9128277016@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 15:57:25 2006 New Revision: 69 Modified: usocket/trunk/backend/openmcl.lisp Log: Fix typo. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Fri Feb 10 15:57:25 2006 @@ -32,7 +32,7 @@ (error usock-err :socket socket) (error 'unknown-error :socket socket :real-erorr condition)))) (error (error 'unknown-error :socket socket :real-erorr condition)) - (condition (signal 'unkown-condition :real-condition condition)))) + (condition (signal 'unknown-condition :real-condition condition)))) (defun socket-connect (host port) (let ((sock)) From ehuelsmann at common-lisp.net Fri Feb 10 21:58:19 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 15:58:19 -0600 (CST) Subject: [usocket-cvs] r70 - usocket/trunk Message-ID: <20060210215819.E8E4778004@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 15:58:19 2006 New Revision: 70 Modified: usocket/trunk/condition.lisp Log: Add host name resolution conditions. Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Fri Feb 10 15:58:19 2006 @@ -5,28 +5,26 @@ (in-package :usocket) -;; (define-condition usocket-error (error) -;; ((real-condition -;; :reader real-condition -;; :initarg :real-condition) -;; (socket -;; :reader socket -;; :initarg :socket)) -;; (:report (lambda (c stream) -;; (format stream "Error (~A) occured in socket: ~A." -;; (real-condition c) (socket c))))) +;; Conditions raised by sockets operations -(define-condition usocket-condition (condition) +(define-condition socket-condition (condition) ((socket :initarg :socket :accessor usocket-socket)) ;;###FIXME: no slots (yet); should at least be the affected usocket... - (:documentation "")) + (:documentation "Parent condition for all socket related conditions.")) -(define-condition usocket-error (usocket-condition error) +(define-condition socket-error (usocket-condition error) () ;; no slots (yet) - (:documentation "")) - + (:documentation "Parent error for all socket related errors")) +(define-condition ns-condition (condition) + ((host-or-ip :initarg :host-or-ip + :accessor host-or-ip)) + (:documentation "Parent condition for all name resolution conditions.")) + +(define-condition ns-error (ns-condition error) + () + (:documentation "Parent error for all name resolution errors.")) (eval-when (:compile-toplevel :load-toplevel :execute) (defun define-usocket-condition-class (class &rest parents) @@ -48,7 +46,8 @@ (define-condition unknown-condition (usocket-condition) ((real-condition :initarg :real-condition :accessor usocket-real-condition)) - (:documentation "")) + (:documentation "Condition raised when there's no other - more applicable - +condition available.")) ;; Mass define and export our errors @@ -77,8 +76,34 @@ (define-condition unknown-error (usocket-error) ((real-error :initarg :real-error :accessor usocket-real-error)) - (:documentation "")) + (:documentation "Error raised when there's no other - more applicable - +error available.")) + + +(define-usocket-condition-classes + (ns-try-again) + (ns-condition)) +(define-condition ns-unknown-condition (ns-condition) + ((real-error :initarg :real-condition + :accessor ns-real-condition)) + (:documentation "Condition raised when there's no other - more applicable - +condition available.")) + +(define-usocket-condition-classes + ;; the no-data error code in the Unix 98 api + ;; isn't really an error: there's just no data to return. + ;; with lisp, we just return NIL (indicating no data) instead of + ;; raising an exception... + (ns-host-not-found + ns-no-recovery) + (ns-error)) + +(define-condition ns-unknown-error (ns-error) + ((real-error :initarg :real-error + :accessor ns-real-error)) + (:documentation "Error raised when there's no other - more applicable - +error available.")) (defmacro with-mapped-conditions ((&optional socket) &body body) `(handler-case @@ -120,11 +145,16 @@ ((65 113) . host-unreachable-error))) - - (defun map-errno-condition (errno) (cdr (assoc errno +unix-errno-error-map+ :test #'member))) (defun map-errno-error (errno) (cdr (assoc errno +unix-errno-error-map+ :test #'member))) + + +(defparameter +unix-ns-error-map+ + `((1 . ns-host-not-found-error) + (2 . ns-try-again-condition) + (3 . ns-no-recovery-error))) + From ehuelsmann at common-lisp.net Fri Feb 10 22:29:52 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 16:29:52 -0600 (CST) Subject: [usocket-cvs] r71 - in usocket/trunk: . test Message-ID: <20060210222952.CA5D82A033@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 16:29:52 2006 New Revision: 71 Modified: usocket/trunk/condition.lisp usocket/trunk/package.lisp usocket/trunk/run-usocket-tests.sh usocket/trunk/test/test-usocket.lisp Log: Make the tests work again. Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Fri Feb 10 16:29:52 2006 @@ -13,7 +13,7 @@ ;;###FIXME: no slots (yet); should at least be the affected usocket... (:documentation "Parent condition for all socket related conditions.")) -(define-condition socket-error (usocket-condition error) +(define-condition socket-error (socket-condition error) () ;; no slots (yet) (:documentation "Parent error for all socket related errors")) @@ -41,9 +41,9 @@ ;; Mass define and export our conditions (define-usocket-condition-classes (interrupted-condition) - (usocket-condition)) + (socket-condition)) -(define-condition unknown-condition (usocket-condition) +(define-condition unknown-condition (socket-condition) ((real-condition :initarg :real-condition :accessor usocket-real-condition)) (:documentation "Condition raised when there's no other - more applicable - @@ -71,9 +71,9 @@ host-unreachable-error shutdown-error timeout-error) - (usocket-error)) + (socket-error)) -(define-condition unknown-error (usocket-error) +(define-condition unknown-error (socket-error) ((real-error :initarg :real-error :accessor usocket-real-error)) (:documentation "Error raised when there's no other - more applicable - Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Fri Feb 10 16:29:52 2006 @@ -25,8 +25,8 @@ :vector-quad-to-dotted-quad :dotted-quad-to-vector-quad - :usocket-condition ; conditions - :usocket-error ; errors + :socket-condition ; conditions + :socket-error ; errors :unknown-condition :unknown-error))) Modified: usocket/trunk/run-usocket-tests.sh ============================================================================== --- usocket/trunk/run-usocket-tests.sh (original) +++ usocket/trunk/run-usocket-tests.sh Fri Feb 10 16:29:52 2006 @@ -13,7 +13,7 @@ echo " (require 'usocket-test) -(usocket-test:run-usocket-tests) +(usocket-test:do-tests) (quit) " | $my_lisp Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Fri Feb 10 16:29:52 2006 @@ -15,21 +15,21 @@ (deftest socket-no-connect.1 (catch 'caught-error - (handler-bind ((usocket:usocket-error + (handler-bind ((usocket:socket-error #'(lambda (c) (throw 'caught-error nil)))) (usocket:socket-connect "127.0.0.0" 80) t)) nil) (deftest socket-no-connect.2 (catch 'caught-error - (handler-bind ((usocket:usocket-error + (handler-bind ((usocket:socket-error #'(lambda (c) (throw 'caught-error nil)))) (usocket:socket-connect #(127 0 0 0) 80) t)) nil) (deftest socket-no-connect.3 (catch 'caught-error - (handler-bind ((usocket:usocket-error + (handler-bind ((usocket:socket-error #'(lambda (c) (throw 'caught-error nil)))) (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) t)) From ehuelsmann at common-lisp.net Fri Feb 10 22:34:52 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 10 Feb 2006 16:34:52 -0600 (CST) Subject: [usocket-cvs] r72 - usocket/trunk/backend Message-ID: <20060210223452.489A72A033@common-lisp.net> Author: ehuelsmann Date: Fri Feb 10 16:34:52 2006 New Revision: 72 Modified: usocket/trunk/backend/openmcl.lisp Log: Fix typo. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Fri Feb 10 16:34:52 2006 @@ -30,8 +30,8 @@ +openmcl-error-map+)))) (if usock-err (error usock-err :socket socket) - (error 'unknown-error :socket socket :real-erorr condition)))) - (error (error 'unknown-error :socket socket :real-erorr condition)) + (error 'unknown-error :socket socket :real-error condition)))) + (error (error 'unknown-error :socket socket :real-error condition)) (condition (signal 'unknown-condition :real-condition condition)))) (defun socket-connect (host port) From ehuelsmann at common-lisp.net Sat Feb 11 09:19:50 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 03:19:50 -0600 (CST) Subject: [usocket-cvs] r73 - usocket/trunk Message-ID: <20060211091950.D4A344B00E@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 03:19:50 2006 New Revision: 73 Modified: usocket/trunk/Makefile Log: Add more cleanup: Armedbear writes other files. Modified: usocket/trunk/Makefile ============================================================================== --- usocket/trunk/Makefile (original) +++ usocket/trunk/Makefile Sat Feb 11 03:19:50 2006 @@ -2,7 +2,7 @@ # $Source$ clean: - find -name -o -name "*~" -o -name "*.err" -o -name "*.x86f" -o -name "*.lib" -o -name "*.fas" -o -name "*.fasl" -o -name "*.faslmt" -o -name "*.ufsl" | xargs rm + find -name -o -name "*~" -o -name "*.err" -o -name "*.x86f" -o -name "*.lib" -o -name "*.fas" -o -name "*.fasl" -o -name "*.faslmt" -o -name "*.ufsl" -o -name "*.abcl" | xargs rm commit: make clean; cvs up; cvs ci From ehuelsmann at common-lisp.net Sat Feb 11 09:20:56 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 03:20:56 -0600 (CST) Subject: [usocket-cvs] r74 - in usocket/trunk: . test Message-ID: <20060211092056.708564E012@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 03:20:56 2006 New Revision: 74 Added: usocket/trunk/test/usocket.asd (contents, props changed) Modified: usocket/trunk/run-usocket-tests.sh usocket/trunk/test/ (props changed) Log: Rearrange and extend test scripts. Modified: usocket/trunk/run-usocket-tests.sh ============================================================================== --- usocket/trunk/run-usocket-tests.sh (original) +++ usocket/trunk/run-usocket-tests.sh Sat Feb 11 03:20:56 2006 @@ -8,15 +8,34 @@ # I need to figure out how to setup ASDF with the other lisps # I have installed: cmucl, ABCL, clisp, allegro and lispworks -for my_lisp in sbcl ; do +cd `dirname $0`/test + +if test -z "$1" ; then + lisps="sbcl clisp $HOME/src/acl/acl70_trial/alisp" +else + lisps=$1 +fi + +for my_lisp in $lisps ; do + +# *.fasl are used by both sbcl and allegro, +# so remove them to prevent choking either + +args= +if test "`basename $my_lisp`" == "alisp" ; then + args=-batch +fi echo " -(require 'usocket-test) +#-sbcl (load \"asdf.lisp\") + +(asdf:operate #-sbcl 'asdf:load-source-op + #+sbcl 'asdf:load-op :usocket-test) (usocket-test:do-tests) -(quit) -" | $my_lisp +#-allegro (quit) +" | $my_lisp $args echo "Above test results for $my_lisp." Added: usocket/trunk/test/usocket.asd ============================================================================== --- (empty file) +++ usocket/trunk/test/usocket.asd Sat Feb 11 03:20:56 2006 @@ -0,0 +1 @@ +link ../usocket.asd \ No newline at end of file From ehuelsmann at common-lisp.net Sat Feb 11 22:09:29 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 16:09:29 -0600 (CST) Subject: [usocket-cvs] r75 - usocket/trunk/test Message-ID: <20060211220929.5C30E2A01A@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 16:09:28 2006 New Revision: 75 Modified: usocket/trunk/test/test-usocket.lisp Log: Always print error information. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Sat Feb 11 16:09:28 2006 @@ -5,6 +5,34 @@ (in-package :usocket-test) +(defmacro with-caught-conditions ((expect throw) &body body) + `(catch 'caught-error + (handler-case + (progn , at body) + (usocket:unknown-error (c) (if (typep c ,expect) + (throw 'caught-error ,throw) + (progn + (describe c) + (describe + (usocket::usocket-real-error c)) + c))) + (error (c) (if (typep c ,expect) + (throw 'caught-error ,throw) + (progn + (describe c) + c))) + (usocket:unknown-condition (c) (if (typep c ,expect) + (throw 'caught-error ,throw) + (progn + (describe c) + (describe + (usocket::usocket-real-condition c)) + c))) + (condition (c) (if (typep c ,expect) + (throw 'caught-error ,throw) + (progn + (describe c) + c)))))) (defparameter +non-existing-host+ "10.0.0.13") (defparameter *soc1* (usocket::make-socket :socket :my-socket @@ -14,87 +42,79 @@ (deftest make-socket.2 (usocket:socket-stream *soc1*) :my-stream) (deftest socket-no-connect.1 - (catch 'caught-error - (handler-bind ((usocket:socket-error - #'(lambda (c) (throw 'caught-error nil)))) + (with-caught-conditions ('usocket:socket-error nil) (usocket:socket-connect "127.0.0.0" 80) - t)) + t) nil) (deftest socket-no-connect.2 - (catch 'caught-error - (handler-bind ((usocket:socket-error - #'(lambda (c) (throw 'caught-error nil)))) - (usocket:socket-connect #(127 0 0 0) 80) - t)) + (with-caught-conditions ('usocket:socket-error nil) + (usocket:socket-connect #(127 0 0 0) 80) + t) nil) (deftest socket-no-connect.3 - (catch 'caught-error - (handler-bind ((usocket:socket-error - #'(lambda (c) (throw 'caught-error nil)))) - (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) - t)) + (with-caught-conditions ('usocket:socket-error nil) + (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) + t) nil) (deftest socket-failure.1 - (catch 'caught-error - (handler-bind ((usocket:network-unreachable-error - #'(lambda (c) (throw 'caught-error nil))) - ;; some lisps don't report as specific as above - #+(or cmu lispworks armedbear) - (usocket:unknown-error - #'(lambda (c) (throw 'caught-error nil))) - (condition - #'(lambda (c) (throw 'caught-error t)))) - (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) - :unreach)) + (with-caught-conditions (#-(or cmu lispworks armedbear) + 'usocket:network-unreachable-error + #+(or cmu lispworks armedbear) + 'usocket:unknown-error + nil) + (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) + :unreach) nil) (deftest socket-failure.2 - (catch 'caught-error - (handler-bind ((usocket:host-unreachable-error - #'(lambda (c) (throw 'caught-error nil))) - ;; some lisps don't report as specific as above - #+(or cmu lispworks armedbear) - (usocket:unknown-error - #'(lambda (c) (throw 'caught-error nil))) - (condition - #'(lambda (c) (throw 'caught-error t)))) + (with-caught-conditions (#+(or lispworks armedbear) + 'usocket:unknown-error + #+cmu + 'usocket:network-unreachable-error + #-(or lispworks armedbear cmu) + 'usocket:host-unreachable-error + nil) (usocket:socket-connect +non-existing-host+ 80) ;; == #(127 0 0 0) - :unreach)) + :unreach) nil) ;; let's hope c-l.net doesn't move soon, or that people start to ;; test usocket like crazy.. (deftest socket-connect.1 - (let ((sock (usocket:socket-connect "common-lisp.net" 80))) - (unwind-protect - (typep sock 'usocket:usocket) - (usocket:socket-close sock))) - t) + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect "common-lisp.net" 80))) + (unwind-protect + (typep sock 'usocket:usocket) + (usocket:socket-close sock)))) + t) (deftest socket-connect.2 - (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) - (unwind-protect - (typep sock 'usocket:usocket) - (usocket:socket-close sock))) + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (unwind-protect + (typep sock 'usocket:usocket) + (usocket:socket-close sock)))) t) (deftest socket-connect.3 - (let ((sock (usocket:socket-connect 1097731309 80))) - (unwind-protect - (typep sock 'usocket:usocket) - (usocket:socket-close sock))) + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect 1097731309 80))) + (unwind-protect + (typep sock 'usocket:usocket) + (usocket:socket-close sock)))) t) ;; let's hope c-l.net doesn't change its software any time soon (deftest socket-stream.1 - (let ((sock (usocket:socket-connect "common-lisp.net" 80))) - (unwind-protect - (progn - (format (usocket:socket-stream sock) - "GET / HTTP/1.0~A~A~A~A" - #\Return #\Newline #\Return #\Newline) - (force-output (usocket:socket-stream sock)) - (read-line (usocket:socket-stream sock))) - (usocket:socket-close sock))) + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect "common-lisp.net" 80))) + (unwind-protect + (progn + (format (usocket:socket-stream sock) + "GET / HTTP/1.0~A~A~A~A" + #\Return #\Newline #\Return #\Newline) + (force-output (usocket:socket-stream sock)) + (read-line (usocket:socket-stream sock))) + (usocket:socket-close sock)))) #+clisp "HTTP/1.1 200 OK" #-clisp #.(format nil "HTTP/1.1 200 OK~A" #\Return) nil) From ehuelsmann at common-lisp.net Sat Feb 11 22:39:07 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 16:39:07 -0600 (CST) Subject: [usocket-cvs] r76 - usocket/trunk/backend Message-ID: <20060211223907.549597A00B@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 16:39:07 2006 New Revision: 76 Modified: usocket/trunk/backend/openmcl.lisp Log: Add package prefixes. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sat Feb 11 16:39:07 2006 @@ -26,7 +26,7 @@ (defun handle-condition (condition &optional socket) (typecase condition (socket-error - (let ((usock-err (cdr (assoc (socket-error-identifier condition) + (let ((usock-err (cdr (assoc (socket:socket-error-identifier condition) +openmcl-error-map+)))) (if usock-err (error usock-err :socket socket) @@ -38,10 +38,10 @@ (let ((sock)) (with-mapped-conditions (sock) (setf sock - (make-socket :remote-host (host-to-hostname host) - :remote-port port)) - (socket-connect sock)))) + (socket:make-socket :remote-host (host-to-hostname host) + :remote-port port)) + (socket:socket-connect sock)))) (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) - (close (socket usocket)))) + (socket:close (socket usocket)))) From ehuelsmann at common-lisp.net Sat Feb 11 22:57:04 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 16:57:04 -0600 (CST) Subject: [usocket-cvs] r77 - in usocket/trunk: . test Message-ID: <20060211225704.9437C4300E@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 16:57:04 2006 New Revision: 77 Added: usocket/trunk/test/abcl.conf.in usocket/trunk/test/allegro.conf.in usocket/trunk/test/clisp.conf.in usocket/trunk/test/cmucl.conf.in usocket/trunk/test/sbcl.conf.in usocket/trunk/test/your-lisp.conf.in Modified: usocket/trunk/run-usocket-tests.sh usocket/trunk/test/ (props changed) Log: Change test script to take arguments from .conf files and add those. Modified: usocket/trunk/run-usocket-tests.sh ============================================================================== --- usocket/trunk/run-usocket-tests.sh (original) +++ usocket/trunk/run-usocket-tests.sh Sat Feb 11 16:57:04 2006 @@ -9,21 +9,31 @@ # I have installed: cmucl, ABCL, clisp, allegro and lispworks cd `dirname $0`/test +rm tests.log if test -z "$1" ; then - lisps="sbcl clisp $HOME/src/acl/acl70_trial/alisp" + lisps=*.conf else lisps=$1 fi -for my_lisp in $lisps ; do +for my_lisp_conf in $lisps ; do -# *.fasl are used by both sbcl and allegro, -# so remove them to prevent choking either args= -if test "`basename $my_lisp`" == "alisp" ; then - args=-batch +lisp_bin= +lisp_name= +lisp_exit="(quit result)" + +. $my_lisp_conf + +if test -z "$lisp_bin" ; then + echo "YOU NEED TO SET A LISP BINARY IN YOUR CONF FILE" + exit 1 +fi + +if test -z "$lisp_name" ; then + lisp_name="`basename \"$lisp_bin\"`" fi echo " @@ -32,11 +42,16 @@ (asdf:operate #-sbcl 'asdf:load-source-op #+sbcl 'asdf:load-op :usocket-test) -(usocket-test:do-tests) +(let ((result (if (usocket-test:do-tests) 1 0))) + $lisp_exit) +" | $lisp_bin $args -#-allegro (quit) -" | $my_lisp $args +if test $? -eq 1 ; then + echo "PASS: $lisp_name" >> tests.log +else + echo "FAIL: $lisp_name" >> tests.log +fi -echo "Above test results for $my_lisp." +echo "Above the test results gathered for $lisp_name." done Added: usocket/trunk/test/abcl.conf.in ============================================================================== --- (empty file) +++ usocket/trunk/test/abcl.conf.in Sat Feb 11 16:57:04 2006 @@ -0,0 +1,10 @@ +# lisp binary test setup file + +args= + +# lisp_bin is required! +lisp_bin=~/src/abcl-0.0.9/abcl +lisp_name=ArmedBear + +# lisp_exit is required! +lisp_exit="(quit :status result)" Added: usocket/trunk/test/allegro.conf.in ============================================================================== --- (empty file) +++ usocket/trunk/test/allegro.conf.in Sat Feb 11 16:57:04 2006 @@ -0,0 +1,10 @@ +# lisp binary test setup file + +args="-batch" + +# lisp_bin is required! +lisp_bin="~/src/acl/acl70_trial/alisp" +lisp_name=Allegro + +# lisp_exit is required! +lisp_exit="(exit result :no-unwind t)" Added: usocket/trunk/test/clisp.conf.in ============================================================================== --- (empty file) +++ usocket/trunk/test/clisp.conf.in Sat Feb 11 16:57:04 2006 @@ -0,0 +1,10 @@ +# lisp binary test setup file + +args= + +# lisp_bin is required! +lisp_bin=clisp +lisp_name=clisp + +# lisp_exit is required! +lisp_exit="(quit result)" Added: usocket/trunk/test/cmucl.conf.in ============================================================================== --- (empty file) +++ usocket/trunk/test/cmucl.conf.in Sat Feb 11 16:57:04 2006 @@ -0,0 +1,10 @@ +# lisp binary test setup file + +args= + +# lisp_bin is required! +lisp_bin="~/src/bin/lisp" +lisp_name=CMUCL + +# lisp_exit is required! +lisp_exit="(unix:unix-exit result)" Added: usocket/trunk/test/sbcl.conf.in ============================================================================== --- (empty file) +++ usocket/trunk/test/sbcl.conf.in Sat Feb 11 16:57:04 2006 @@ -0,0 +1,10 @@ +# lisp binary test setup file + +args= + +# lisp_bin is required! +lisp_bin=sbcl +lisp_name=SBCL + +# lisp_exit is required! +lisp_exit="(quit status :recklessly-p t)" Added: usocket/trunk/test/your-lisp.conf.in ============================================================================== --- (empty file) +++ usocket/trunk/test/your-lisp.conf.in Sat Feb 11 16:57:04 2006 @@ -0,0 +1,10 @@ +# lisp binary test setup file + +args= + +# lisp_bin is required! +lisp_bin= +lisp_name= + +# lisp_exit is required! +lisp_exit= From ehuelsmann at common-lisp.net Sat Feb 11 23:18:55 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 17:18:55 -0600 (CST) Subject: [usocket-cvs] r78 - usocket/trunk/backend Message-ID: <20060211231855.757D82A01A@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 17:18:52 2006 New Revision: 78 Modified: usocket/trunk/backend/openmcl.lisp Log: Adjust package prefixes. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sat Feb 11 17:18:52 2006 @@ -25,9 +25,10 @@ (defun handle-condition (condition &optional socket) (typecase condition - (socket-error - (let ((usock-err (cdr (assoc (socket:socket-error-identifier condition) - +openmcl-error-map+)))) + (openmcl-socket:socket-error + (let ((usock-err + (cdr (assoc (openmcl-socket:socket-error-identifier condition) + +openmcl-error-map+)))) (if usock-err (error usock-err :socket socket) (error 'unknown-error :socket socket :real-error condition)))) @@ -38,10 +39,10 @@ (let ((sock)) (with-mapped-conditions (sock) (setf sock - (socket:make-socket :remote-host (host-to-hostname host) - :remote-port port)) - (socket:socket-connect sock)))) + (openmcl-socket:make-socket :remote-host (host-to-hostname host) + :remote-port port)) + (openmcl-socket:socket-connect sock)))) (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) - (socket:close (socket usocket)))) + (close (socket usocket)))) From ehuelsmann at common-lisp.net Sat Feb 11 23:27:35 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 11 Feb 2006 17:27:35 -0600 (CST) Subject: [usocket-cvs] r79 - usocket/trunk/backend Message-ID: <20060211232735.0D0952A01A@common-lisp.net> Author: ehuelsmann Date: Sat Feb 11 17:27:34 2006 New Revision: 79 Modified: usocket/trunk/backend/openmcl.lisp Log: Fix return type of socket-connect. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sat Feb 11 17:27:34 2006 @@ -36,12 +36,12 @@ (condition (signal 'unknown-condition :real-condition condition)))) (defun socket-connect (host port) - (let ((sock)) - (with-mapped-conditions (sock) - (setf sock - (openmcl-socket:make-socket :remote-host (host-to-hostname host) - :remote-port port)) - (openmcl-socket:socket-connect sock)))) + (with-mapped-conditions () + (let ((mcl-sock (openmcl-socket:make-socket :remote-host + (host-to-hostname host) + :remote-port port))) + (openmcl-socket:socket-connect mcl-sock) + (make-socket :stream mcl-sock :socket mcl-sock)))) (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) From ehuelsmann at common-lisp.net Sun Feb 12 10:09:49 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 04:09:49 -0600 (CST) Subject: [usocket-cvs] r80 - usocket/trunk Message-ID: <20060212100949.E38E82A024@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 04:09:49 2006 New Revision: 80 Modified: usocket/trunk/Makefile (contents, props changed) Log: Ajust for use with svn and set keywords. Modified: usocket/trunk/Makefile ============================================================================== --- usocket/trunk/Makefile (original) +++ usocket/trunk/Makefile Sun Feb 12 04:09:49 2006 @@ -1,9 +1,9 @@ # $Id$ -# $Source$ +# $URL$ clean: - find -name -o -name "*~" -o -name "*.err" -o -name "*.x86f" -o -name "*.lib" -o -name "*.fas" -o -name "*.fasl" -o -name "*.faslmt" -o -name "*.ufsl" -o -name "*.abcl" | xargs rm + find -name -o -name "*~" -o -name "*.err" -o -name "*.x86f" -o -name "*.lib" -o -name "*.fas" -o -name "*.fasl" -o -name "*.faslmt" -o -name "*.ufsl" -o -name "*.abcl" | xargs rm commit: - make clean; cvs up; cvs ci + make clean; svn up; svn ci From ehuelsmann at common-lisp.net Sun Feb 12 10:13:17 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 04:13:17 -0600 (CST) Subject: [usocket-cvs] r81 - public_html Message-ID: <20060212101317.464512A024@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 04:13:16 2006 New Revision: 81 Modified: public_html/index.shtml Log: Update website with more explicit plans. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sun Feb 12 04:13:16 2006 @@ -172,7 +172,20 @@ - + + + + + + + + + + + + From ehuelsmann at common-lisp.net Sun Feb 12 13:39:24 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 07:39:24 -0600 (CST) Subject: [usocket-cvs] r82 - public_html Message-ID: <20060212133924.65FB52A024@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 07:39:23 2006 New Revision: 82 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sun Feb 12 07:39:23 2006 @@ -20,6 +20,9 @@ possible, while keeping the abstraction and portability layer as thin as possible.

+

If your lisp isn't mentioned in the table below, please feel free to +submit a request for it at the mailing list mentioned below.

+

Community

This project has recently started. There isn't much of a community @@ -135,11 +138,11 @@

- + - + @@ -172,7 +175,7 @@ - From ehuelsmann at common-lisp.net Sun Feb 12 19:27:25 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 13:27:25 -0600 (CST) Subject: [usocket-cvs] r83 - in usocket/trunk: . backend test Message-ID: <20060212192725.F23842A024@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 13:27:25 2006 New Revision: 83 Modified: usocket/trunk/ (props changed) usocket/trunk/backend/ (props changed) usocket/trunk/test/ (props changed) Log: Add OpenMCL fasls to ignores list. From ehuelsmann at common-lisp.net Sun Feb 12 20:17:34 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 14:17:34 -0600 (CST) Subject: [usocket-cvs] r84 - in usocket/trunk: backend test Message-ID: <20060212201734.D4F4E2A024@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 14:17:34 2006 New Revision: 84 Modified: usocket/trunk/backend/openmcl.lisp usocket/trunk/test/test-usocket.lisp Log: More OpenMCL fixes. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sun Feb 12 14:17:34 2006 @@ -23,15 +23,20 @@ (:access-denied . operation-not-permitted-error))) +(defun raise-error-from-id (condition-id socket real-condition) + (let ((usock-err (cdr (assoc condition-id +openmcl-error-map+)))) + (if usock-err + (error usock-err :socket socket) + (error 'unknown-error :socket socket :real-error real-condition))) + (defun handle-condition (condition &optional socket) (typecase condition (openmcl-socket:socket-error - (let ((usock-err - (cdr (assoc (openmcl-socket:socket-error-identifier condition) - +openmcl-error-map+)))) - (if usock-err - (error usock-err :socket socket) - (error 'unknown-error :socket socket :real-error condition)))) + (raise-error-from-id (openmcl-socket:socket-error-identifier condition) + socket condition)) + (ccl::socket-creation-error #| ugh! |# + (raise-error-from-id (ccl::socket-creationg-error-idenitifier condition) + socket condition)) (error (error 'unknown-error :socket socket :real-error condition)) (condition (signal 'unknown-condition :real-condition condition)))) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Sun Feb 12 14:17:34 2006 @@ -58,10 +58,12 @@ nil) (deftest socket-failure.1 - (with-caught-conditions (#-(or cmu lispworks armedbear) + (with-caught-conditions (#-(or cmu lispworks armedbear openmcl) 'usocket:network-unreachable-error #+(or cmu lispworks armedbear) 'usocket:unknown-error + #+openmcl + 'usocket:timeout-error nil) (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) :unreach) @@ -71,7 +73,9 @@ 'usocket:unknown-error #+cmu 'usocket:network-unreachable-error - #-(or lispworks armedbear cmu) + #+openmcl + 'usocket:timeout-error + #-(or lispworks armedbear cmu openmcl) 'usocket:host-unreachable-error nil) (usocket:socket-connect +non-existing-host+ 80) ;; == #(127 0 0 0) From ehuelsmann at common-lisp.net Sun Feb 12 20:26:14 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 14:26:14 -0600 (CST) Subject: [usocket-cvs] r85 - usocket/trunk/backend Message-ID: <20060212202614.DB1AD6B013@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 14:26:14 2006 New Revision: 85 Modified: usocket/trunk/backend/openmcl.lisp Log: Fix compilation error. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sun Feb 12 14:26:14 2006 @@ -27,7 +27,7 @@ (let ((usock-err (cdr (assoc condition-id +openmcl-error-map+)))) (if usock-err (error usock-err :socket socket) - (error 'unknown-error :socket socket :real-error real-condition))) + (error 'unknown-error :socket socket :real-error real-condition)))) (defun handle-condition (condition &optional socket) (typecase condition From ehuelsmann at common-lisp.net Sun Feb 12 20:58:42 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 14:58:42 -0600 (CST) Subject: [usocket-cvs] r86 - usocket/trunk/backend Message-ID: <20060212205842.721751F016@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 14:58:42 2006 New Revision: 86 Modified: usocket/trunk/backend/openmcl.lisp Log: Fix typo. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sun Feb 12 14:58:42 2006 @@ -35,7 +35,7 @@ (raise-error-from-id (openmcl-socket:socket-error-identifier condition) socket condition)) (ccl::socket-creation-error #| ugh! |# - (raise-error-from-id (ccl::socket-creationg-error-idenitifier condition) + (raise-error-from-id (ccl::socket-creationg-error-identifier condition) socket condition)) (error (error 'unknown-error :socket socket :real-error condition)) (condition (signal 'unknown-condition :real-condition condition)))) From ehuelsmann at common-lisp.net Sun Feb 12 21:09:23 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 15:09:23 -0600 (CST) Subject: [usocket-cvs] r87 - public_html Message-ID: <20060212210923.470472A024@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 15:09:22 2006 New Revision: 87 Modified: public_html/index.shtml Log: Update status page. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sun Feb 12 15:09:22 2006 @@ -138,7 +138,7 @@ - + - + - - + + @@ -175,8 +175,30 @@ - + + + + + + + + + + + + + + + + + + + + + + Modified: public_html/style.css ============================================================================== --- public_html/style.css (original) +++ public_html/style.css Sun Feb 12 16:12:44 2006 @@ -85,3 +85,12 @@ color: #fff; text-align: center; font-weight: bold } + +.TOSTART { background-color: #fcc; + color: #000; } + +.RECONSIDER { background-color: #fc3; + color: #000; } + +.CHECKED { background-color: #cfc; + color: #000; } From ehuelsmann at common-lisp.net Sun Feb 12 22:15:08 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 16:15:08 -0600 (CST) Subject: [usocket-cvs] r89 - usocket/trunk Message-ID: <20060212221508.2C7AD7500B@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 16:15:07 2006 New Revision: 89 Modified: usocket/trunk/README Log: Extend README. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Sun Feb 12 16:15:07 2006 @@ -3,6 +3,31 @@ $Id$ +This is the usocket Common Lisp sockets library: a library to bring +sockets access to the broadest of common lisp implementations as possible. + + +The library currently supports: + + - SBCL + - CMUCL + - ArmedBear + - clisp + - Allegro + - LispWorks + - OpenMCL + - + +If your favorite common lisp misses in the list above, please contact +usocket-devel at common-lisp.net and submit a request. Please include +references to available sockets functions in your lisp implementation. + +The library has been ASDF (http://cliki.net/ASDF) enabled, meaning +that you can tar up a checkout and use that to ASDF-INSTALL:INSTALL +the package in your system package site. (Or use your usual ASDF +tricks to use the checkout directly.) + + usocket interface: - usocket (class) @@ -46,14 +71,14 @@ - unkown-condition -TODO: - - socket-create (function) [ to create a passive socket ] - - socket-accept (method) - - socket-local-address (method) - - socket-peer-address (method) KNOWN PROBLEMS - CMUCL error reporting wrt sockets raises only simple-errors meaning there's no way to tell different error conditions apart. All errors are mapped to unknown-error on CMUCL. + +- When running the test suite through the run-usocket-tests.sh shell + script, ArmedBear 0.0.9 will report failure - even when it didn't. + You need a CVS version later than 2006-02-11, or later than 0.0.9 + for the script to work correctly. From ehuelsmann at common-lisp.net Sun Feb 12 22:15:27 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 16:15:27 -0600 (CST) Subject: [usocket-cvs] r90 - usocket/trunk Message-ID: <20060212221527.921C076003@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 16:15:27 2006 New Revision: 90 Modified: usocket/trunk/TODO Log: Extend TODO. Modified: usocket/trunk/TODO ============================================================================== --- usocket/trunk/TODO (original) +++ usocket/trunk/TODO Sun Feb 12 16:15:27 2006 @@ -14,3 +14,7 @@ cl-irc chokes on characters which are non-UTF8 conforming... Probably other clients do too (try that with a binary HTTP stream!) +- change CMUCL implementation to catch name resolution errors: + Don't send host names into connect-to-inet-socket, but use + gethostbyname, binding the return value and the error code. + Raise an error if gethostbyname returns one. From ehuelsmann at common-lisp.net Mon Feb 13 08:01:52 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 13 Feb 2006 02:01:52 -0600 (CST) Subject: [usocket-cvs] r91 - in usocket/trunk: doc notes Message-ID: <20060213080152.4718E4A07A@common-lisp.net> Author: ehuelsmann Date: Mon Feb 13 02:01:51 2006 New Revision: 91 Added: usocket/trunk/notes/ usocket/trunk/notes/abcl-socket.txt - copied unchanged from r82, usocket/trunk/doc/abcl-socket.txt usocket/trunk/notes/active-sockets-apis.txt - copied unchanged from r82, usocket/trunk/doc/active-sockets-apis.txt usocket/trunk/notes/allegro-socket.txt - copied unchanged from r82, usocket/trunk/doc/allegro-socket.txt usocket/trunk/notes/clisp-sockets.txt - copied unchanged from r82, usocket/trunk/doc/clisp-sockets.txt usocket/trunk/notes/cmucl-sockets.txt - copied unchanged from r82, usocket/trunk/doc/cmucl-sockets.txt usocket/trunk/notes/errors.txt - copied unchanged from r82, usocket/trunk/doc/errors.txt usocket/trunk/notes/lw-sockets.txt - copied unchanged from r82, usocket/trunk/doc/lw-sockets.txt usocket/trunk/notes/openmcl-sockets.txt - copied unchanged from r82, usocket/trunk/doc/openmcl-sockets.txt usocket/trunk/notes/sb-bsd-sockets.txt - copied unchanged from r82, usocket/trunk/doc/sb-bsd-sockets.txt usocket/trunk/notes/usock-sockets.txt - copied unchanged from r82, usocket/trunk/doc/usock-sockets.txt Removed: usocket/trunk/doc/abcl-socket.txt usocket/trunk/doc/active-sockets-apis.txt usocket/trunk/doc/allegro-socket.txt usocket/trunk/doc/clisp-sockets.txt usocket/trunk/doc/cmucl-sockets.txt usocket/trunk/doc/errors.txt usocket/trunk/doc/lw-sockets.txt usocket/trunk/doc/openmcl-sockets.txt usocket/trunk/doc/sb-bsd-sockets.txt usocket/trunk/doc/usock-sockets.txt Log: Reorganise the tree. From ehuelsmann at common-lisp.net Mon Feb 13 20:45:58 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 13 Feb 2006 14:45:58 -0600 (CST) Subject: [usocket-cvs] r92 - usocket/trunk/backend Message-ID: <20060213204558.EB94E47013@common-lisp.net> Author: ehuelsmann Date: Mon Feb 13 14:45:58 2006 New Revision: 92 Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/backend/clisp.lisp usocket/trunk/backend/cmucl.lisp usocket/trunk/backend/lispworks.lisp usocket/trunk/backend/sbcl.lisp Log: Remove unused TYPE argument to SOCKET-CONNECT. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Mon Feb 13 14:45:58 2006 @@ -5,6 +5,9 @@ (in-package :usocket) +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :sock)) + (defparameter +allegro-identifier-error-map+ '((:address-in-use . address-in-use-error) (:address-not-available . address-not-available-error) @@ -33,8 +36,7 @@ :real-error condition :socket socket)))))) -(defun socket-connect (host port &optional (type :stream)) - (declare (ignore type)) +(defun socket-connect (host port) (let ((socket)) (setf socket (with-mapped-conditions (socket) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Mon Feb 13 14:45:58 2006 @@ -38,8 +38,7 @@ :socket socket :real-error condition)))))) -(defun socket-connect (host port &optional (type :stream)) - (declare (ignore type)) +(defun socket-connect (host port) (let ((socket) (hostname (host-to-hostname host))) (with-mapped-conditions (socket) Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Mon Feb 13 14:45:58 2006 @@ -53,7 +53,7 @@ :real-condition condition :socket socket)))) -(defun socket-connect (host port &optional (type :stream)) +(defun socket-connect (host port) (let* ((socket)) (setf socket (with-mapped-conditions (socket) Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Mon Feb 13 14:45:58 2006 @@ -47,8 +47,7 @@ ;; :real-condition condition ;; :socket socket)))) -(defun socket-connect (host port &optional (type :stream)) - (declare (ignore type)) +(defun socket-connect (host port) (let ((hostname (host-to-hostname host)) (stream)) (setf stream Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Mon Feb 13 14:45:58 2006 @@ -59,7 +59,7 @@ :real-condition condition)))))) -(defun socket-connect (host port &optional (type :stream)) +(defun socket-connect (host port) (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket :type type :protocol :tcp)) (stream (sb-bsd-sockets:socket-make-stream socket From ehuelsmann at common-lisp.net Mon Feb 13 20:48:39 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 13 Feb 2006 14:48:39 -0600 (CST) Subject: [usocket-cvs] r93 - in usocket/trunk: . backend doc Message-ID: <20060213204839.B155F48002@common-lisp.net> Author: ehuelsmann Date: Mon Feb 13 14:48:39 2006 New Revision: 93 Modified: usocket/trunk/TODO usocket/trunk/backend/armedbear.lisp usocket/trunk/doc/backends.txt Log: Expand TODO. Modified: usocket/trunk/TODO ============================================================================== --- usocket/trunk/TODO (original) +++ usocket/trunk/TODO Mon Feb 13 14:48:39 2006 @@ -2,10 +2,13 @@ - Check consistency of error translation for each of the backends with the design document. +- check stream creation arguments such as element-type and external-format + for availability in the different lisps. + - Move all function documentation from the backends to (setf documentation) forms in usocket.lisp. -- Extend ABCL socket support with the 4 java errors in java.net +- Extend ABCL socket support with the 4 java errors in java.net.* so that they can map to our usocket errors instead of mapping all errors to unknown-error. Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Mon Feb 13 14:48:39 2006 @@ -22,3 +22,33 @@ (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) (ext:socket-close (socket usocket)))) + + +#.(if (find-symbol "SOCKET-LOCAL-ADDRESS" :ext) + ;; abcl 0.0.9 compat code + '(progn + (declaim (inline %socket-address %socket-port)) + (defun %socket-address (socket addressName) + (java:jcall "getHostAddress" (java:jcall-raw addressName socket))) + + (defun %socket-port (socket portName) + (java:jcall portName socket)) + + + + (defun socket-local-address (socket) + "Returns the local address of the given socket as a dotted quad string." + (%socket-address socket "getLocalAddress")) + + (defun socket-peer-address (socket) + "Returns the peer address of the given socket as a dotted quad string." + (%socket-address socket "getInetAddress")) + + (defun socket-local-port (socket) + "Returns the local port number of the given socket." + (%socket-port socket "getLocalPort")) + + (defun socket-peer-port (socket) + "Returns the peer port number of the given socket." + (%socket-port socket "getPort"))) + '(progn)) Modified: usocket/trunk/doc/backends.txt ============================================================================== --- usocket/trunk/doc/backends.txt (original) +++ usocket/trunk/doc/backends.txt Mon Feb 13 14:48:39 2006 @@ -7,16 +7,21 @@ Each backend should implement: -Sockets functions: +Functions: + - handle-condition - socket-connect + - get-hosts-by-name [ optional ] + - get-host-by-address [ optional ] -Sockets methods: +Methods: - socket-close + + An error-handling function, resolving implementation specific errors to this list of errors: From ehuelsmann at common-lisp.net Mon Feb 13 20:52:11 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 13 Feb 2006 14:52:11 -0600 (CST) Subject: [usocket-cvs] r94 - usocket/trunk/notes Message-ID: <20060213205211.4E4B44B010@common-lisp.net> Author: ehuelsmann Date: Mon Feb 13 14:52:11 2006 New Revision: 94 Added: usocket/trunk/notes/address-apis.txt Log: Start preparation of step 2. Added: usocket/trunk/notes/address-apis.txt ============================================================================== --- (empty file) +++ usocket/trunk/notes/address-apis.txt Mon Feb 13 14:52:11 2006 @@ -0,0 +1,71 @@ + + -*- text -*- + +Step 2 of the master plan: Implementing (get-local-address sock) and +(get-peer-address sock). + + +Step 2 is about implementing: + + (get-local-address sock) -> ip + (get-peer-address sock) -> ip + (get-local-port sock) -> port + (get-peer-port sock) -> port + + +ABCL +==== + + FFI / J-calls to "getLocalAddress"+"getAddress", "getLocalPort" (local) + FFI / J-calls to "getInetAddress"+"getAddress", "getPort" (peer) + + (see SLIME / swank-abcl.lisp for an example on how to do that) + + +Allegro +======= + + (values (socket:remote-host sock) + (socket:remote-port)) -> 32bit ip, port + + (values (socket:local-host sock) + (socket:local-port sock)) -> 32bit ip, port + +CLISP +===== + + (socket:socket-stream-local sock nil) -> address (as dotted quad), port + (socket:socket-stream-peer sock nil) -> address (as dotted quad), port + + +CMUCL +===== + + (ext:get-peer-host-and-port sock-fd) -> 32-bit-addr, port (peer) + (ext:get-socket-host-and-port sock-fd) -> 32-bit-addr, port (local) + + +LispWorks +========= + + (comm:socket-stream-address sock-stream) -> 32-bit-addr, port + or: (comm:get-socket-address sock) -> 32-bit-addr, port + + (comm:socket-stream-peer-address sock-stream) -> 32-bit-addr, port + or: (comm:get-socket-peer-address sock) -> 32-bit-addr, port + + +OpenMCL +======= + + (values (ccl:local-host sock) (ccl:local-port sock)) -> 32-bit ip, port + (values (ccl:remote-host sock) (ccl:remote-port sock)) -> 32-bit ip, port + + +SBCL +==== + + (sb-bsd-sockets:socket-name sock) -> vector-quad, port + (sb-bsd-sockets:socket-peer-name sock) -> vector-quad, port + + From ehuelsmann at common-lisp.net Mon Feb 13 20:59:34 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 13 Feb 2006 14:59:34 -0600 (CST) Subject: [usocket-cvs] r95 - usocket/trunk/notes Message-ID: <20060213205934.37C6350010@common-lisp.net> Author: ehuelsmann Date: Mon Feb 13 14:59:33 2006 New Revision: 95 Modified: usocket/trunk/notes/address-apis.txt Log: Finalize step 2 inventarization document. Modified: usocket/trunk/notes/address-apis.txt ============================================================================== --- usocket/trunk/notes/address-apis.txt (original) +++ usocket/trunk/notes/address-apis.txt Mon Feb 13 14:59:33 2006 @@ -11,6 +11,8 @@ (get-peer-address sock) -> ip (get-local-port sock) -> port (get-peer-port sock) -> port + (get-local-name sock) -> ip, port + (get-peer-name sock) -> ip, port ABCL From ehuelsmann at common-lisp.net Mon Feb 13 21:01:59 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 13 Feb 2006 15:01:59 -0600 (CST) Subject: [usocket-cvs] r96 - usocket/tags/0.1.0 Message-ID: <20060213210159.7D40251012@common-lisp.net> Author: ehuelsmann Date: Mon Feb 13 15:01:59 2006 New Revision: 96 Added: usocket/tags/0.1.0/ - copied from r92, usocket/trunk/ Log: Create first release tag! :-) From ehuelsmann at common-lisp.net Tue Feb 14 18:28:43 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 14 Feb 2006 12:28:43 -0600 (CST) Subject: [usocket-cvs] r97 - usocket/trunk Message-ID: <20060214182843.C30EF6A010@common-lisp.net> Author: ehuelsmann Date: Tue Feb 14 12:28:43 2006 New Revision: 97 Modified: usocket/trunk/TODO usocket/trunk/usocket.asd Log: Add releases to the website. Modified: usocket/trunk/TODO ============================================================================== --- usocket/trunk/TODO (original) +++ usocket/trunk/TODO Tue Feb 14 12:28:43 2006 @@ -5,9 +5,6 @@ - check stream creation arguments such as element-type and external-format for availability in the different lisps. -- Move all function documentation from the backends to - (setf documentation) forms in usocket.lisp. - - Extend ABCL socket support with the 4 java errors in java.net.* so that they can map to our usocket errors instead of mapping all errors to unknown-error. Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Tue Feb 14 12:28:43 2006 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.1.0" + :version "0.2.0-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Tue Feb 14 18:29:07 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 14 Feb 2006 12:29:07 -0600 (CST) Subject: [usocket-cvs] r98 - in public_html: . releases Message-ID: <20060214182907.4B4826B001@common-lisp.net> Author: ehuelsmann Date: Tue Feb 14 12:29:06 2006 New Revision: 98 Added: public_html/releases/ public_html/releases/usocket-0.1.0.tar.gz (contents, props changed) public_html/releases/usocket-0.1.0.tar.gz.asc Modified: public_html/index.shtml Log: Add releases to the website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Feb 14 12:29:06 2006 @@ -223,6 +223,15 @@
Status for the currently targeted backendsStatus for the currently targeted backends
Major steps
Identify socket errors generated. DONEWIPDONE TODO DONE DONE
Minimal active sockets support + Minimal active sockets support at the same level as provided by trivial-sockets.
(Meaning streamed tcp traffic on connected sockets.)
Investigate interfaces provided.WIP WIP DONE DONE WIP WIP WIP TODO TODO DONE DONE WIP DONE
Identify socket errors generated. DONE DONETODOWIP DONE DONETODOWIP TODO
Implement active socket support.DONEDONETODODONE WIP WIP TODO
Implement remapping of implementation defined errors. WIP WIP TODOWIPDONEWIP TODO
Implementation test-suite statusPASS??????
Add functions to retrieve socket properties.
Such as local and remote IP address and port.
Investigate interfaces provided
Implementation test-suite status PASS?PASS ? ? ?PASS PASS ??PASS ? ? ?PASS ? PASS?PASS ? ?
? PASS PASS?PASS ?
WIP DONE DONEWIPDONE TODO
DONE TODO DONEWIPWIPDONEDONE TODO
Investigate interfaces provided. DONE DONE WIP DONE DONE DONE WIP DONE DONE
Identify socket errors generated. DONE DONEWIPDONEDONE DONE DONE DONETODO
Implement active socket support. DONE DONETODO DONE DONE DONETODODONEWIP
Implement remapping of implementation defined errors. WIPWIPTODOWIPDONEDONEDONEDONE DONE WIPTODO
Implementation test-suite status PASS PASS?PASS PASS PASS PASSTODO
Implement passive socket support.Implement more uncommon api calls such as send, sendto and read + for tcp streams.TODOTODOTODOTODOTODOTODOTODO
Implement udp socket support.Investigate API's provided and build on top of that + (or custom ffi). TODO TODO TODO PASS PASS PASS?FAIL
Add functions to retrieve socket properties.
- Such as local and remote IP address and port.
Add functions to retrieve socket properties:
+ Local and remote IP address and port.
Investigate interfaces provided TODO TODOTODO
Implement more uncommon api calls such as send, sendto and read + Implement more uncommon api calls such as send and recv for tcp streams. TODO TODOPASS PASS PASSFAILPASS
Add functions to retrieve socket properties:
From ehuelsmann at common-lisp.net Sun Feb 12 22:12:45 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 12 Feb 2006 16:12:45 -0600 (CST) Subject: [usocket-cvs] r88 - public_html Message-ID: <20060212221245.4DC137000B@common-lisp.net> Author: ehuelsmann Date: Sun Feb 12 16:12:44 2006 New Revision: 88 Modified: public_html/index.shtml public_html/style.css Log: Update status page. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sun Feb 12 16:12:44 2006 @@ -118,17 +118,17 @@
DONE DONE DONEWIPDONE
Implement remapping of implementation defined errors.WIP DONE DONE DONE DONE DONEWIPDONEDONE
Implementation test-suite statusTODO
Implement more uncommon api calls such as send and recv + Implement api calls get- and setsockopt.TODOTODOTODOTODOTODOTODOTODO
Implement more uncommon api calls for tcp streams.send, recvTODOTODOTODOTODOTODOTODOTODO
shutdown TODO TODO TODO
+

Releases

+ +

Releases are uploaded to the releases/ + directory.

+ +

The latest release is version 0.1.0.

+ +

Project history

Long ago the project was conceived and started by Erik Enge in an Added: public_html/releases/usocket-0.1.0.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.1.0.tar.gz.asc ============================================================================== --- (empty file) +++ public_html/releases/usocket-0.1.0.tar.gz.asc Tue Feb 14 12:29:06 2006 @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) + +iD8DBQBD8PcOi5O0Epaz9TkRAhmZAJ4sfZNXVXuGsn+U7UHHQTy4lSFeYACcCLdZ +tcbSBUaIwyQg+16uapMbUjo= +=2H1Q +-----END PGP SIGNATURE----- From ehuelsmann at common-lisp.net Thu Feb 16 19:46:03 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 16 Feb 2006 13:46:03 -0600 (CST) Subject: [usocket-cvs] r99 - public_html Message-ID: <20060216194603.4B1332A018@common-lisp.net> Author: ehuelsmann Date: Thu Feb 16 13:46:01 2006 New Revision: 99 Modified: public_html/index.shtml Log: Update website with changed repository structure. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Feb 16 13:46:01 2006 @@ -75,13 +75,13 @@ Minor steps - SBCL - CMUCL - ABCL - clisp - Allegro - LispWorks - OpenMCL + SBCL + CMUCL + ABCL + clisp + Allegro + LispWorks + OpenMCL @@ -90,7 +90,8 @@ at the same level as provided by trivial-sockets.
(Meaning streamed tcp traffic on connected sockets.) - Investigate interfaces provided. + Investigate interfaces provided. DONE DONE DONE @@ -143,7 +144,8 @@ Add functions to retrieve socket properties:
Local and remote IP address and port. - Investigate interfaces provided + Investigate interfaces provided TODO TODO TODO From ehuelsmann at common-lisp.net Thu Feb 16 19:47:50 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 16 Feb 2006 13:47:50 -0600 (CST) Subject: [usocket-cvs] r100 - public_html Message-ID: <20060216194750.468552A018@common-lisp.net> Author: ehuelsmann Date: Thu Feb 16 13:47:49 2006 New Revision: 100 Modified: public_html/index.shtml Log: Fix xhtml conformance issue. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Feb 16 13:47:49 2006 @@ -145,7 +145,7 @@ Add functions to retrieve socket properties:
Local and remote IP address and port.
Investigate interfaces provided + >Investigate interfaces provided TODO TODO TODO From ehuelsmann at common-lisp.net Thu Feb 16 23:36:47 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 16 Feb 2006 17:36:47 -0600 (CST) Subject: [usocket-cvs] r101 - public_html usocket/trunk usocket/trunk/backend Message-ID: <20060216233647.819D22A018@common-lisp.net> Author: ehuelsmann Date: Thu Feb 16 17:36:45 2006 New Revision: 101 Modified: public_html/index.shtml usocket/trunk/backend/allegro.lisp usocket/trunk/backend/armedbear.lisp usocket/trunk/backend/clisp.lisp usocket/trunk/backend/cmucl.lisp usocket/trunk/backend/lispworks.lisp usocket/trunk/backend/openmcl.lisp usocket/trunk/backend/sbcl.lisp usocket/trunk/usocket.lisp Log: First step at implementing socket addresses. Also update site. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Feb 16 17:36:45 2006 @@ -142,27 +142,37 @@ PASS - Add functions to retrieve socket properties:
+ Add functions to retrieve socket properties:
Local and remote IP address and port. Investigate interfaces provided - TODO - TODO - TODO - TODO - TODO - TODO - TODO + DONE + DONE + DONE + DONE + DONE + DONE + DONE Implement it. - TODO - TODO - TODO - TODO - TODO - TODO - TODO + WIP + WIP + WIP + WIP + WIP + WIP + WIP + + + Implementation test-suite status + ? + ? + ? + ? + ? + ? + ? Add support for passive (connection-accepting/server) Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Thu Feb 16 17:36:45 2006 @@ -50,6 +50,26 @@ (close (socket usocket)))) +(defmethod get-local-address ((usocket usocket)) + (hbo-to-vector-quad (socket:local-host (socket usocket)))) + +(defmethod get-peer-address ((usocket usocket)) + (hbo-to-vector-quad (socket:remote-host (socket usocket)))) + +(defmethod get-local-port ((usocket usocket)) + (socket:local-port (socket usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (socket:remote-port (socket usocket))) + +(defmethod get-local-name ((usocket usocket)) + (values (get-local-address usocket) + (get-local-port usocket))) + +(defmethod get-peer-name ((usocket usocket)) + (values (get-peer-address usocket) + (get-peer-port usocket))) + (defun get-host-by-address (address) (with-mapped-conditions () Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Thu Feb 16 17:36:45 2006 @@ -24,7 +24,7 @@ (ext:socket-close (socket usocket)))) -#.(if (find-symbol "SOCKET-LOCAL-ADDRESS" :ext) +#.(if (null (find-symbol "SOCKET-LOCAL-ADDRESS" :ext)) ;; abcl 0.0.9 compat code '(progn (declaim (inline %socket-address %socket-port)) @@ -51,4 +51,26 @@ (defun socket-peer-port (socket) "Returns the peer port number of the given socket." (%socket-port socket "getPort"))) - '(progn)) + '(progn + (import (:socket-peer-port :socket-peer-address + :socket-local-port :socket-local-address) :ext))) + +(defmethod get-local-address ((usocket usocket)) + (dotted-quad-to-vector-quad (socket-local-address (socket usocket)))) + +(defmethod get-peer-address ((usocket usocket)) + (dotted-quad-to-vector-quad (socket-peer-address (socket usocket)))) + +(defmethod get-local-port ((usocket usocket)) + (socket-local-port (socket usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (socket-peer-port (socket usocket))) + +(defmethod get-local-name ((usocket usocket)) + (values (get-local-address usocket) + (get-local-port usocket))) + +(defmethod get-peer-name ((usocket usocket)) + (values (get-peer-address usocket) + (get-peer-port usocket))) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Thu Feb 16 17:36:45 2006 @@ -56,3 +56,27 @@ (with-mapped-conditions (usocket) (close (socket usocket)))) +(defmethod get-local-name ((usocket usocket)) + (multiple-value-bind + (address port) + (socket:socket-stream-local (socket usocket) nil) + (values (dotted-quad-to-vector-quad address) port))) + +(defmethod get-peer-name ((usocket usocket)) + (multiple-value-bind + (address port) + (socket:socket-stream-peer (socket usocket) nil) + (values (dotted-quad-to-vector-quad address) port))) + +(defmethod get-local-address ((usocket usocket)) + (nth-value 1 (get-local-name usocket))) + +(defmethod get-peer-address ((usocket usocket)) + (nth-value 1 (get-peer-name usocket))) + +(defmethod get-local-port ((usocket usocket)) + (nth-value 2 (get-local-name usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (nth-value 2 (get-peer-name usocket))) + Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Thu Feb 16 17:36:45 2006 @@ -74,6 +74,29 @@ (with-mapped-conditions (usocket) (ext:close-socket (socket usocket)))) +(defmethod get-local-name ((usocket usocket)) + (multiple-value-bind + (address port) + (ext:get-socket-host-and-port (socket usocket)) + (values (hbo-to-vector-quad address) port))) + +(defmethod get-peer-name ((usocket usocket)) + (multiple-value-bind + (address port) + (ext:get-peer-host-and-port (socket usocket)) + (values (hbo-to-vector-quad address) port))) + +(defmethod get-local-address ((usocket usocket)) + (nth-value 1 (get-local-name usocket))) + +(defmethod get-peer-address ((usocket usocket)) + (nth-value 1 (get-peer-name usocket))) + +(defmethod get-local-port ((usocket usocket)) + (nth-value 2 (get-local-name usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (nth-value 2 (get-peer-name usocket))) (defun get-host-by-address (address) Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Thu Feb 16 17:36:45 2006 @@ -64,3 +64,26 @@ "Close socket." (close (socket-stream usocket))) +(defmethod get-local-name ((usocket usocket)) + (multiple-value-bind + (address port) + (comm:get-socket-address (socket usocket)) + (values (hbo-to-vector-quad address) port))) + +(defmethod get-peer-name ((usocket usocket)) + (multiple-value-bind + (address port) + (comm:get-socket-peer-address (socket usocket)) + (values (hbo-to-vector-quad address) port))) + +(defmethod get-local-address ((usocket usocket)) + (nth-value 1 (get-local-name usocket))) + +(defmethod get-peer-address ((usocket usocket)) + (nth-value 1 (get-peer-name usocket))) + +(defmethod get-local-port ((usocket usocket)) + (nth-value 2 (get-local-name usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (nth-value 2 (get-peer-name usocket))) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Thu Feb 16 17:36:45 2006 @@ -51,3 +51,23 @@ (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) (close (socket usocket)))) + +(defmethod get-local-address ((usocket usocket)) + (hbo-to-vector-quad (openmcl-socket:local-host (socket usocket)))) + +(defmethod get-peer-address ((usocket usocket)) + (hbo-to-vector-quad (openmcl-socket:remote-host (socket usocket)))) + +(defmethod get-local-port ((usocket usocket)) + (openmcl-socket:local-port (socket usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (openmcl-socket:remote-port (socket usocket))) + +(defmethod get-local-name ((usocket usocket)) + (values (get-local-address usocket) + (get-local-port usocket))) + +(defmethod get-peer-name ((usocket usocket)) + (values (get-peer-address usocket) + (get-peer-port usocket))) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Thu Feb 16 17:36:45 2006 @@ -61,7 +61,7 @@ (defun socket-connect (host port) (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket - :type type :protocol :tcp)) + :type :stream :protocol :tcp)) (stream (sb-bsd-sockets:socket-make-stream socket :input t :output t @@ -78,6 +78,23 @@ (with-mapped-conditions (usocket) (sb-bsd-sockets:socket-close (socket usocket)))) +(defmethod get-local-name ((usocket usocket)) + (sb-bsd-sockets:socket-name (socket usocket))) + +(defmethod get-peer-name ((usocket usocket)) + (sb-bsd-sockets:socket-peername (socket usocket))) + +(defmethod get-local-address ((usocket usocket)) + (nth-value 1 (get-local-name usocket))) + +(defmethod get-peer-address ((usocket usocket)) + (nth-value 1 (get-peer-name usocket))) + +(defmethod get-local-port ((usocket usocket)) + (nth-value 2 (get-local-name usocket))) + +(defmethod get-peer-port ((usocket usocket)) + (nth-value 2 (get-peer-name usocket))) (defun get-host-by-address (address) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Thu Feb 16 17:36:45 2006 @@ -30,6 +30,27 @@ (defgeneric socket-close (usocket) (:documentation "Close a previously opened `usocket'.")) +(defgeneric get-local-address (socket) + (:documentation "Returns the IP address of the socket.")) + +(defgeneric get-peer-address (socket) + (:documentation + "Returns the IP address of the peer the socket is connected to.")) + +(defgeneric get-local-port (socket) + (:documentation "Returns the IP port of the socket.")) + +(defgeneric get-peer-port (socket) + (:documentation "Returns the IP port of the peer the socket to.")) + +(defgeneric get-local-name (socket) + (:documentation "Returns the IP address and port of the socket as values.")) + +(defgeneric get-peer-name (socket) + (:documentation + "Returns the IP address and port of the peer +the socket is connected to as values.")) + (defmacro with-connected-socket ((var socket) &body body) "Bind `socket' to `var', ensuring socket destruction on exit. From ehuelsmann at common-lisp.net Fri Feb 17 07:20:42 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 01:20:42 -0600 (CST) Subject: [usocket-cvs] r102 - usocket/trunk/backend Message-ID: <20060217072042.7FB1466010@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 01:20:41 2006 New Revision: 102 Modified: usocket/trunk/backend/cmucl.lisp Log: Make tests pass again. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Fri Feb 17 01:20:41 2006 @@ -57,7 +57,7 @@ (let* ((socket)) (setf socket (with-mapped-conditions (socket) - (ext:connect-to-inet-socket (host-to-hbo host) port type))) + (ext:connect-to-inet-socket (host-to-hbo host) port :stream))) (if socket (let* ((stream (sys:make-fd-stream socket :input t :output t :element-type 'character From ehuelsmann at common-lisp.net Fri Feb 17 07:49:40 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 01:49:40 -0600 (CST) Subject: [usocket-cvs] r103 - usocket/trunk/backend Message-ID: <20060217074940.7B9992A018@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 01:49:40 2006 New Revision: 103 Modified: usocket/trunk/backend/clisp.lisp usocket/trunk/backend/cmucl.lisp usocket/trunk/backend/lispworks.lisp usocket/trunk/backend/sbcl.lisp Log: nth-value is zero based ... Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Fri Feb 17 01:49:40 2006 @@ -69,14 +69,14 @@ (values (dotted-quad-to-vector-quad address) port))) (defmethod get-local-address ((usocket usocket)) - (nth-value 1 (get-local-name usocket))) + (nth-value 0 (get-local-name usocket))) (defmethod get-peer-address ((usocket usocket)) - (nth-value 1 (get-peer-name usocket))) + (nth-value 0 (get-peer-name usocket))) (defmethod get-local-port ((usocket usocket)) - (nth-value 2 (get-local-name usocket))) + (nth-value 1 (get-local-name usocket))) (defmethod get-peer-port ((usocket usocket)) - (nth-value 2 (get-peer-name usocket))) + (nth-value 1 (get-peer-name usocket))) Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Fri Feb 17 01:49:40 2006 @@ -87,16 +87,16 @@ (values (hbo-to-vector-quad address) port))) (defmethod get-local-address ((usocket usocket)) - (nth-value 1 (get-local-name usocket))) + (nth-value 0 (get-local-name usocket))) (defmethod get-peer-address ((usocket usocket)) - (nth-value 1 (get-peer-name usocket))) + (nth-value 0 (get-peer-name usocket))) (defmethod get-local-port ((usocket usocket)) - (nth-value 2 (get-local-name usocket))) + (nth-value 1 (get-local-name usocket))) (defmethod get-peer-port ((usocket usocket)) - (nth-value 2 (get-peer-name usocket))) + (nth-value 1 (get-peer-name usocket))) (defun get-host-by-address (address) Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Fri Feb 17 01:49:40 2006 @@ -77,13 +77,13 @@ (values (hbo-to-vector-quad address) port))) (defmethod get-local-address ((usocket usocket)) - (nth-value 1 (get-local-name usocket))) + (nth-value 0 (get-local-name usocket))) (defmethod get-peer-address ((usocket usocket)) - (nth-value 1 (get-peer-name usocket))) + (nth-value 0 (get-peer-name usocket))) (defmethod get-local-port ((usocket usocket)) - (nth-value 2 (get-local-name usocket))) + (nth-value 1 (get-local-name usocket))) (defmethod get-peer-port ((usocket usocket)) - (nth-value 2 (get-peer-name usocket))) + (nth-value 1 (get-peer-name usocket))) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Fri Feb 17 01:49:40 2006 @@ -85,16 +85,16 @@ (sb-bsd-sockets:socket-peername (socket usocket))) (defmethod get-local-address ((usocket usocket)) - (nth-value 1 (get-local-name usocket))) + (nth-value 0 (get-local-name usocket))) (defmethod get-peer-address ((usocket usocket)) - (nth-value 1 (get-peer-name usocket))) + (nth-value 0 (get-peer-name usocket))) (defmethod get-local-port ((usocket usocket)) - (nth-value 2 (get-local-name usocket))) + (nth-value 1 (get-local-name usocket))) (defmethod get-peer-port ((usocket usocket)) - (nth-value 2 (get-peer-name usocket))) + (nth-value 1 (get-peer-name usocket))) (defun get-host-by-address (address) From ehuelsmann at common-lisp.net Fri Feb 17 07:49:58 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 01:49:58 -0600 (CST) Subject: [usocket-cvs] r104 - usocket/trunk/test Message-ID: <20060217074958.0D70670017@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 01:49:57 2006 New Revision: 104 Modified: usocket/trunk/test/test-usocket.lisp Log: Add more tests. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Fri Feb 17 01:49:57 2006 @@ -122,6 +122,28 @@ #+clisp "HTTP/1.1 200 OK" #-clisp #.(format nil "HTTP/1.1 200 OK~A" #\Return) nil) +(deftest socket-name.1 + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (unwind-protect + (usocket::get-peer-address sock) + (usocket:socket-close sock)))) + #(65 110 12 237)) +(deftest socket-name.2 + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (unwind-protect + (usocket::get-peer-port sock) + (usocket:socket-close sock)))) + 80) +(deftest socket-name.2 + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (unwind-protect + (usocket::get-peer-name sock) + (usocket:socket-close sock)))) + #(65 110 12 237) 80) + (defun run-usocket-tests () (do-tests)) From ehuelsmann at common-lisp.net Fri Feb 17 20:26:47 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 14:26:47 -0600 (CST) Subject: [usocket-cvs] r105 - usocket/trunk/test Message-ID: <20060217202647.C93762A018@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 14:26:47 2006 New Revision: 105 Modified: usocket/trunk/test/test-usocket.lisp Log: More tests. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Fri Feb 17 14:26:47 2006 @@ -136,13 +136,20 @@ (usocket::get-peer-port sock) (usocket:socket-close sock)))) 80) -(deftest socket-name.2 +(deftest socket-name.3 (with-caught-conditions (nil nil) (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) (unwind-protect (usocket::get-peer-name sock) (usocket:socket-close sock)))) #(65 110 12 237) 80) +(deftest socket-name.4 + (with-caught-conditions (nil nil) + (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (unwind-protect + (usocket::get-local-address sock) + (usocket:socket-close sock)))) + #(10 0 0 252)) (defun run-usocket-tests () From ehuelsmann at common-lisp.net Fri Feb 17 20:27:51 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 14:27:51 -0600 (CST) Subject: [usocket-cvs] r106 - usocket/trunk/backend Message-ID: <20060217202751.D30292A018@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 14:27:51 2006 New Revision: 106 Modified: usocket/trunk/backend/armedbear.lisp Log: Remove non-working 0.0.9 compat code. Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Fri Feb 17 14:27:51 2006 @@ -24,48 +24,18 @@ (ext:socket-close (socket usocket)))) -#.(if (null (find-symbol "SOCKET-LOCAL-ADDRESS" :ext)) - ;; abcl 0.0.9 compat code - '(progn - (declaim (inline %socket-address %socket-port)) - (defun %socket-address (socket addressName) - (java:jcall "getHostAddress" (java:jcall-raw addressName socket))) - - (defun %socket-port (socket portName) - (java:jcall portName socket)) - - - - (defun socket-local-address (socket) - "Returns the local address of the given socket as a dotted quad string." - (%socket-address socket "getLocalAddress")) - - (defun socket-peer-address (socket) - "Returns the peer address of the given socket as a dotted quad string." - (%socket-address socket "getInetAddress")) - - (defun socket-local-port (socket) - "Returns the local port number of the given socket." - (%socket-port socket "getLocalPort")) - - (defun socket-peer-port (socket) - "Returns the peer port number of the given socket." - (%socket-port socket "getPort"))) - '(progn - (import (:socket-peer-port :socket-peer-address - :socket-local-port :socket-local-address) :ext))) (defmethod get-local-address ((usocket usocket)) - (dotted-quad-to-vector-quad (socket-local-address (socket usocket)))) + (dotted-quad-to-vector-quad (ext:socket-local-address (socket usocket)))) (defmethod get-peer-address ((usocket usocket)) - (dotted-quad-to-vector-quad (socket-peer-address (socket usocket)))) + (dotted-quad-to-vector-quad (ext:socket-peer-address (socket usocket)))) (defmethod get-local-port ((usocket usocket)) - (socket-local-port (socket usocket))) + (ext:socket-local-port (socket usocket))) (defmethod get-peer-port ((usocket usocket)) - (socket-peer-port (socket usocket))) + (ext:socket-peer-port (socket usocket))) (defmethod get-local-name ((usocket usocket)) (values (get-local-address usocket) From ehuelsmann at common-lisp.net Fri Feb 17 20:37:41 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 14:37:41 -0600 (CST) Subject: [usocket-cvs] r107 - public_html Message-ID: <20060217203741.44F122A018@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 14:37:40 2006 New Revision: 107 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 17 14:37:40 2006 @@ -156,21 +156,21 @@ Implement it. - WIP - WIP - WIP - WIP - WIP + DONE + DONE + DONE + DONE + DONE WIP WIP Implementation test-suite status - ? - ? - ? - ? - ? + PASS + PASS + PASS + PASS + PASS ? ? From ehuelsmann at common-lisp.net Fri Feb 17 20:51:30 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 14:51:30 -0600 (CST) Subject: [usocket-cvs] r108 - public_html Message-ID: <20060217205130.46B0D2A018@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 14:51:29 2006 New Revision: 108 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 17 14:51:29 2006 @@ -161,7 +161,7 @@ DONE DONE DONE - WIP + DONE WIP @@ -171,7 +171,7 @@ PASS PASS PASS - ? + PASS ? From ehuelsmann at common-lisp.net Fri Feb 17 20:53:53 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 14:53:53 -0600 (CST) Subject: [usocket-cvs] r109 - usocket/trunk Message-ID: <20060217205353.F40CF2A018@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 14:53:53 2006 New Revision: 109 Modified: usocket/trunk/package.lisp Log: Export new interfaces. Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Fri Feb 17 14:53:53 2006 @@ -10,23 +10,29 @@ (eval-when (:execute :load-toplevel :compile-toplevel) (defpackage :usocket (:use :cl) - (:export :socket-connect ; socket constructors and methods - :socket-close + (:export #:socket-connect ; socket constructors and methods + #:socket-close + #:get-local-address + #:get-peer-address + #:get-local-port + #:get-peer-port + #:get-local-name + #:get-peer-name - :with-connected-socket ; macros + #:with-connected-socket ; macros - :usocket ; socket object and accessors - :socket - :socket-stream + #:usocket ; socket object and accessors + #:socket + #:socket-stream - :host-byte-order ; IPv4 utility functions - :hbo-to-dotted-quad - :hbo-to-vector-quad - :vector-quad-to-dotted-quad - :dotted-quad-to-vector-quad + #:host-byte-order ; IPv4 utility functions + #:hbo-to-dotted-quad + #:hbo-to-vector-quad + #:vector-quad-to-dotted-quad + #:dotted-quad-to-vector-quad - :socket-condition ; conditions - :socket-error ; errors - :unknown-condition - :unknown-error))) + #:socket-condition ; conditions + #:socket-error ; errors + #:unknown-condition + #:unknown-error))) From ehuelsmann at common-lisp.net Fri Feb 17 22:41:11 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 17 Feb 2006 16:41:11 -0600 (CST) Subject: [usocket-cvs] r110 - public_html Message-ID: <20060217224111.4915A6100D@common-lisp.net> Author: ehuelsmann Date: Fri Feb 17 16:41:10 2006 New Revision: 110 Modified: public_html/index.shtml Log: Update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Feb 17 16:41:10 2006 @@ -162,7 +162,7 @@ DONE DONE DONE - WIP + DONE Implementation test-suite status @@ -172,7 +172,7 @@ PASS PASS PASS - ? + PASS Add support for passive (connection-accepting/server) From ehuelsmann at common-lisp.net Tue Feb 21 14:02:07 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 21 Feb 2006 08:02:07 -0600 (CST) Subject: [usocket-cvs] r111 - public_html Message-ID: <20060221140207.53A5655009@common-lisp.net> Author: ehuelsmann Date: Tue Feb 21 08:02:06 2006 New Revision: 111 Modified: public_html/index.shtml Log: Update website Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Feb 21 08:02:06 2006 @@ -20,9 +20,23 @@ possible, while keeping the abstraction and portability layer as thin as possible.

-

If your lisp isn't mentioned in the table below, please feel free to +

If your lisp isn't mentioned in the list below, please feel free to submit a request for it at the mailing list mentioned below.

+

Supported implementations

+ +

Currently these implementations are supported:

+ + +

Community

This project has recently started. There isn't much of a community @@ -168,7 +182,7 @@ Implementation test-suite status PASS PASS - PASS + pass PASS PASS PASS From ehuelsmann at common-lisp.net Tue Feb 21 14:16:01 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 21 Feb 2006 08:16:01 -0600 (CST) Subject: [usocket-cvs] r112 - usocket/trunk/notes Message-ID: <20060221141601.6AD3F2A018@common-lisp.net> Author: ehuelsmann Date: Tue Feb 21 08:16:01 2006 New Revision: 112 Modified: usocket/trunk/notes/abcl-socket.txt Log: Update documentation. Modified: usocket/trunk/notes/abcl-socket.txt ============================================================================== --- usocket/trunk/notes/abcl-socket.txt (original) +++ usocket/trunk/notes/abcl-socket.txt Tue Feb 21 08:16:01 2006 @@ -1,9 +1,10 @@ ABCL provides a callback interface to java objects, next to these calls: - - make-socket - - socket-close - - make-server-socket + - ext:make-socket + - ext:socket-close + - ext:make-server-socket + - ext:socket-accept - ext:get-socket-stream (returning an io-stream) abcl-swank (see SLIME) shows how to call directly into java. From ehuelsmann at common-lisp.net Tue Feb 21 14:17:51 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 21 Feb 2006 08:17:51 -0600 (CST) Subject: [usocket-cvs] r113 - usocket/trunk Message-ID: <20060221141751.2D19D2A018@common-lisp.net> Author: ehuelsmann Date: Tue Feb 21 08:17:50 2006 New Revision: 113 Modified: usocket/trunk/TODO Log: Update TODO. Modified: usocket/trunk/TODO ============================================================================== --- usocket/trunk/TODO (original) +++ usocket/trunk/TODO Tue Feb 21 08:17:50 2006 @@ -18,3 +18,5 @@ Don't send host names into connect-to-inet-socket, but use gethostbyname, binding the return value and the error code. Raise an error if gethostbyname returns one. + +- Add INET6 support. From ehuelsmann at common-lisp.net Tue Feb 21 19:35:33 2006 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 21 Feb 2006 13:35:33 -0600 (CST) Subject: [usocket-cvs] r114 - usocket/trunk/doc Message-ID: <20060221193533.3007777015@common-lisp.net> Author: ehuelsmann Date: Tue Feb 21 13:35:32 2006 New Revision: 114 Modified: usocket/trunk/doc/backends.txt Log: Update docs. Modified: usocket/trunk/doc/backends.txt ============================================================================== --- usocket/trunk/doc/backends.txt (original) +++ usocket/trunk/doc/backends.txt Tue Feb 21 13:35:32 2006 @@ -18,8 +18,15 @@ Methods: - socket-close + - get-local-name + - get-peer-name + and - for ip sockets - these methods: + - get-local-address + - get-local-port + - get-peer-address + - get-peer-port An error-handling function, resolving implementation specific errors