From ehuelsmann at common-lisp.net Tue Jan 2 23:11:42 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 2 Jan 2007 18:11:42 -0500 (EST) Subject: [usocket-cvs] r132 - usocket/trunk/backend Message-ID: <20070102231142.42250690DA@common-lisp.net> Author: ehuelsmann Date: Tue Jan 2 18:11:39 2007 New Revision: 132 Modified: usocket/trunk/backend/sbcl.lisp Log: Fix typo found by emarsden. Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Tue Jan 2 18:11:39 2007 @@ -55,7 +55,7 @@ usock-cond))) (if usock-cond (signal usock-cond :socket socket) - (signal 'unkown-condition + (signal 'unknown-condition :real-condition condition)))))) From ehuelsmann at common-lisp.net Wed Jan 3 20:22:12 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 15:22:12 -0500 (EST) Subject: [usocket-cvs] r133 - in usocket/trunk: . backend Message-ID: <20070103202212.3C7A54C005@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 15:22:12 2007 New Revision: 133 Modified: usocket/trunk/backend/sbcl.lisp usocket/trunk/usocket.asd Log: Add ECL support. Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Wed Jan 3 15:22:12 2007 @@ -5,6 +5,14 @@ (in-package :usocket) +;; There's no way to preload the sockets library other than by requiring it +;; +;; ECL sockets has been forked off sb-bsd-sockets and implements the +;; same interface. We use the same file for now. +#+ecl +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :sockets)) + (defun map-socket-error (sock-err) (map-errno-error (sb-bsd-sockets::socket-error-errno sock-err))) Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Wed Jan 3 15:22:12 2007 @@ -30,8 +30,8 @@ :depends-on ("condition")) #+scl (:file "scl" :pathname "backend/scl" :depends-on ("condition")) - #+sbcl (:file "sbcl" :pathname "backend/sbcl" - :depends-on ("condition")) + #+(or sbcl ecl) (:file "sbcl" :pathname "backend/sbcl" + :depends-on ("condition")) #+lispworks (:file "lispworks" :pathname "backend/lispworks" :depends-on ("condition")) #+openmcl (:file "openmcl" :pathname "backend/openmcl" From ehuelsmann at common-lisp.net Wed Jan 3 20:29:34 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 15:29:34 -0500 (EST) Subject: [usocket-cvs] r134 - usocket/trunk Message-ID: <20070103202934.973504C0CA@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 15:29:34 2007 New Revision: 134 Modified: usocket/trunk/README Log: Update README and explain non-support for external-format. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Wed Jan 3 15:29:34 2007 @@ -2,7 +2,16 @@ $Id$ +Content +======= + * Introduction + * Non-support for :external-format + * API definition + * Known problems + +Introduction +============ This is the usocket Common Lisp sockets library: a library to bring sockets access to the broadest of common lisp implementations as possible. @@ -13,9 +22,10 @@ - CMUCL - ArmedBear - clisp - - Allegro + - Allegro Common Lisp - LispWorks - OpenMCL + - Scieneer Common Lisp - If your favorite common lisp misses in the list above, please contact @@ -28,11 +38,28 @@ tricks to use the checkout directly.) -usocket interface: +Non-support of :external-format +=============================== + +Because of its definition in the hyperspec, there's no common +external-format between lisp implementations: every vendor has chosen +a different way to solve the problem of newline translation or +character set recoding. + +Because there's no way to avoid platform specific code in the application +when using external-format, the purpose of a portability layer gets +defeated. So, for now, usocket doesn't support external-format. + +The workaround to get reasonably portable external-format support is to +layer a flexi-stream (from flexi-streams) on top of a usocket stream. + + +API definition +============== - usocket (class) - socket-connect (function) [ to create an active/connected socket ] - socket-connect host port + socket-connect host port &key element-type where `host' is a vectorized ip or a string representation of a dotted ip address or a hostname for lookup in the DNS system @@ -73,7 +100,8 @@ -KNOWN PROBLEMS +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 Wed Jan 3 20:32:25 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 15:32:25 -0500 (EST) Subject: [usocket-cvs] r135 - usocket/branches/0.2.x Message-ID: <20070103203225.BBE3A4C0CA@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 15:32:25 2007 New Revision: 135 Added: usocket/branches/0.2.x/ - copied from r130, usocket/tags/0.2.1/ Log: Branch 0.2.x from 0.2.1 tag. From ehuelsmann at common-lisp.net Wed Jan 3 20:34:46 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 15:34:46 -0500 (EST) Subject: [usocket-cvs] r136 - in usocket/branches/0.2.x: . backend Message-ID: <20070103203446.A75B94D004@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 15:34:46 2007 New Revision: 136 Modified: usocket/branches/0.2.x/backend/sbcl.lisp usocket/branches/0.2.x/usocket.asd Log: Backport ECL support. Modified: usocket/branches/0.2.x/backend/sbcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/sbcl.lisp (original) +++ usocket/branches/0.2.x/backend/sbcl.lisp Wed Jan 3 15:34:46 2007 @@ -5,6 +5,14 @@ (in-package :usocket) +;; There's no way to preload the sockets library other than by requiring it +;; +;; ECL sockets has been forked off sb-bsd-sockets and implements the +;; same interface. We use the same file for now. +#+ecl +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :sockets)) + (defun map-socket-error (sock-err) (map-errno-error (sb-bsd-sockets::socket-error-errno sock-err))) Modified: usocket/branches/0.2.x/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/branches/0.2.x/usocket.asd Wed Jan 3 15:34:46 2007 @@ -30,8 +30,8 @@ :depends-on ("condition")) #+scl (:file "scl" :pathname "backend/scl" :depends-on ("condition")) - #+sbcl (:file "sbcl" :pathname "backend/sbcl" - :depends-on ("condition")) + #+(or sbcl ecl) (:file "sbcl" :pathname "backend/sbcl" + :depends-on ("condition")) #+lispworks (:file "lispworks" :pathname "backend/lispworks" :depends-on ("condition")) #+openmcl (:file "openmcl" :pathname "backend/openmcl" From ehuelsmann at common-lisp.net Wed Jan 3 20:35:28 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 15:35:28 -0500 (EST) Subject: [usocket-cvs] r137 - usocket/branches/0.2.x/backend Message-ID: <20070103203528.ED11D4E009@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 15:35:28 2007 New Revision: 137 Modified: usocket/branches/0.2.x/backend/sbcl.lisp Log: Backport r132 SBCL fix. Modified: usocket/branches/0.2.x/backend/sbcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/sbcl.lisp (original) +++ usocket/branches/0.2.x/backend/sbcl.lisp Wed Jan 3 15:35:28 2007 @@ -63,7 +63,7 @@ usock-cond))) (if usock-cond (signal usock-cond :socket socket) - (signal 'unkown-condition + (signal 'unknown-condition :real-condition condition)))))) From ehuelsmann at common-lisp.net Wed Jan 3 20:43:40 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 15:43:40 -0500 (EST) Subject: [usocket-cvs] r138 - in usocket: branches/0.2.x trunk Message-ID: <20070103204340.381F955397@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 15:43:39 2007 New Revision: 138 Modified: usocket/branches/0.2.x/README usocket/trunk/README Log: Update README's with supported implementations. Modified: usocket/branches/0.2.x/README ============================================================================== --- usocket/branches/0.2.x/README (original) +++ usocket/branches/0.2.x/README Wed Jan 3 15:43:39 2007 @@ -16,6 +16,8 @@ - Allegro - LispWorks - OpenMCL + - ECL + - Scieneer Common Lisp - If your favorite common lisp misses in the list above, please contact Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Wed Jan 3 15:43:39 2007 @@ -25,6 +25,7 @@ - Allegro Common Lisp - LispWorks - OpenMCL + - ECL - Scieneer Common Lisp - From ehuelsmann at common-lisp.net Wed Jan 3 21:48:22 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Wed, 3 Jan 2007 16:48:22 -0500 (EST) Subject: [usocket-cvs] r139 - public_html public_html/releases usocket/branches/0.2.x usocket/tags/0.2.2 Message-ID: <20070103214822.734DD4D004@common-lisp.net> Author: ehuelsmann Date: Wed Jan 3 16:48:19 2007 New Revision: 139 Added: public_html/releases/usocket-0.2.2.tar.gz (contents, props changed) public_html/releases/usocket-0.2.2.tar.gz.asc usocket/tags/0.2.2/ - copied from r137, usocket/branches/0.2.x/ usocket/tags/0.2.2/README - copied unchanged from r138, usocket/branches/0.2.x/README Modified: public_html/index.shtml usocket/branches/0.2.x/usocket.asd usocket/tags/0.2.2/usocket.asd Log: Do a 0.2.2 release, updating the whole shebang. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Wed Jan 3 16:48:19 2007 @@ -41,6 +41,7 @@
  • Allegro
  • LispWorks
  • OpenMCL
  • +
  • ECL
  • Scieneer
  • @@ -100,7 +101,7 @@ Major steps - Socket implementations + Socket implementations @@ -112,6 +113,7 @@ Allegro LispWorks OpenMCL + ECL Scieneer @@ -130,6 +132,7 @@ DONE DONE DONE + DONE DONE @@ -143,6 +146,7 @@ DONE DONE DONE + DONE Implement active socket support. @@ -154,6 +158,7 @@ DONE DONE DONE + DONE Implement remapping of implementation defined errors. @@ -165,6 +170,7 @@ DONE DONE DONE + DONE Implementation test-suite status @@ -176,6 +182,7 @@ PASS PASS PASS + PASS Add functions to retrieve socket properties:
    @@ -189,6 +196,7 @@ DONE DONE DONE + DONE DONE @@ -201,6 +209,7 @@ DONE DONE DONE + DONE Implementation test-suite status @@ -212,6 +221,7 @@ PASS PASS PASS + PASS Add support for passive (connection-accepting/server) @@ -225,6 +235,7 @@ TODO TODO TODO + TODO Implement api calls get- and setsockopt. @@ -236,6 +247,7 @@ TODO TODO TODO + TODO Implement more uncommon api calls @@ -250,6 +262,7 @@ TODO TODO TODO + TODO shutdown @@ -261,6 +274,7 @@ TODO TODO TODO + TODO Implement udp socket support. @@ -274,6 +288,7 @@ TODO TODO TODO + TODO @@ -295,6 +310,8 @@ + + Added: public_html/releases/usocket-0.2.2.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.2.2.tar.gz.asc ============================================================================== --- (empty file) +++ public_html/releases/usocket-0.2.2.tar.gz.asc Wed Jan 3 16:48:19 2007 @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) + +iD8DBQBFnB+gi5O0Epaz9TkRAlIrAJ9e6XwodTubYWV0hpCjKL/29FCeYgCfZAC5 +BYBM+uVx8eDp6JP8W0x93VI= +=9X4P +-----END PGP SIGNATURE----- Modified: usocket/branches/0.2.x/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/branches/0.2.x/usocket.asd Wed Jan 3 16:48:19 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.3.0-dev" + :version "0.2.3-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence Modified: usocket/tags/0.2.2/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/tags/0.2.2/usocket.asd Wed Jan 3 16:48:19 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.3.0-dev" + :version "0.2.2" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Thu Jan 4 20:03:59 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 4 Jan 2007 15:03:59 -0500 (EST) Subject: [usocket-cvs] r140 - usocket/branches/0.2.x/backend Message-ID: <20070104200359.A06D73C006@common-lisp.net> Author: ehuelsmann Date: Thu Jan 4 15:03:59 2007 New Revision: 140 Modified: usocket/branches/0.2.x/backend/allegro.lisp usocket/branches/0.2.x/backend/armedbear.lisp usocket/branches/0.2.x/backend/clisp.lisp usocket/branches/0.2.x/backend/cmucl.lisp usocket/branches/0.2.x/backend/lispworks.lisp usocket/branches/0.2.x/backend/openmcl.lisp usocket/branches/0.2.x/backend/sbcl.lisp usocket/branches/0.2.x/backend/scl.lisp Log: Backport r131 :element-type support. Modified: usocket/branches/0.2.x/backend/allegro.lisp ============================================================================== --- usocket/branches/0.2.x/backend/allegro.lisp (original) +++ usocket/branches/0.2.x/backend/allegro.lisp Thu Jan 4 15:03:59 2007 @@ -36,12 +36,14 @@ :real-error condition :socket socket)))))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character) (let ((socket)) (setf socket (with-mapped-conditions (socket) (socket:make-socket :remote-host (host-to-hostname host) - :remote-port port))) + :remote-port port + :format (if (subtypep element-type 'character) + :text :binary)))) (make-stream-socket :socket socket :stream socket))) (defmethod socket-close ((usocket usocket)) Modified: usocket/branches/0.2.x/backend/armedbear.lisp ============================================================================== --- usocket/branches/0.2.x/backend/armedbear.lisp (original) +++ usocket/branches/0.2.x/backend/armedbear.lisp Thu Jan 4 15:03:59 2007 @@ -11,13 +11,15 @@ (typecase condition (error (error 'unknown-error :socket socket :real-error condition)))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (let ((usock)) (with-mapped-conditions (usock) (let ((sock (ext:make-socket (host-to-hostname host) port))) (setf usock - (make-stream-socket :socket sock - :stream (ext:get-socket-stream sock))))))) + (make-stream-socket + :socket sock + :stream (ext:get-socket-stream sock + :element-type element-type))))))) (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) Modified: usocket/branches/0.2.x/backend/clisp.lisp ============================================================================== --- usocket/branches/0.2.x/backend/clisp.lisp (original) +++ usocket/branches/0.2.x/backend/clisp.lisp Thu Jan 4 15:03:59 2007 @@ -38,13 +38,13 @@ :socket socket :real-error condition)))))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (let ((socket) (hostname (host-to-hostname host))) (with-mapped-conditions (socket) (setf socket (socket:socket-connect port hostname - :element-type 'character + :element-type element-type :buffered t))) (make-stream-socket :socket socket :stream socket))) ;; the socket is a stream too Modified: usocket/branches/0.2.x/backend/cmucl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/cmucl.lisp (original) +++ usocket/branches/0.2.x/backend/cmucl.lisp Thu Jan 4 15:03:59 2007 @@ -53,14 +53,14 @@ :real-condition condition :socket socket)))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (let* ((socket)) (setf socket (with-mapped-conditions (socket) (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 + :element-type element-type :buffering :full)) ;;###FIXME the above line probably needs an :external-format (usocket (make-stream-socket :socket socket Modified: usocket/branches/0.2.x/backend/lispworks.lisp ============================================================================== --- usocket/branches/0.2.x/backend/lispworks.lisp (original) +++ usocket/branches/0.2.x/backend/lispworks.lisp Thu Jan 4 15:03:59 2007 @@ -47,12 +47,13 @@ ;; :real-condition condition ;; :socket socket)))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (let ((hostname (host-to-hostname host)) (stream)) (setf stream (with-mapped-conditions () - (comm:open-tcp-stream hostname port))) + (comm:open-tcp-stream hostname port + :element-type element-type))) (if stream (make-stream-socket :socket (comm:socket-stream-socket stream) :stream stream) Modified: usocket/branches/0.2.x/backend/openmcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/openmcl.lisp (original) +++ usocket/branches/0.2.x/backend/openmcl.lisp Thu Jan 4 15:03:59 2007 @@ -40,12 +40,15 @@ (error (error 'unknown-error :socket socket :real-error condition)) (condition (signal 'unknown-condition :real-condition condition)))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (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) + (openmcl-socket:socket-connect mcl-sock + :element-type (if (subtypep element-type + 'character) + :text :binary)) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) (defmethod socket-close ((usocket usocket)) Modified: usocket/branches/0.2.x/backend/sbcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/sbcl.lisp (original) +++ usocket/branches/0.2.x/backend/sbcl.lisp Thu Jan 4 15:03:59 2007 @@ -67,14 +67,14 @@ :real-condition condition)))))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (let* ((socket (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp)) (stream (sb-bsd-sockets:socket-make-stream socket :input t :output t :buffering :full - :element-type 'character)) + :element-type element-type)) ;;###FIXME: The above line probably needs an :external-format (usocket (make-stream-socket :stream stream :socket socket)) (ip (host-to-vector-quad host))) Modified: usocket/branches/0.2.x/backend/scl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/scl.lisp (original) +++ usocket/branches/0.2.x/backend/scl.lisp Thu Jan 4 15:03:59 2007 @@ -33,12 +33,12 @@ :real-condition condition :socket socket)))) -(defun socket-connect (host port) +(defun socket-connect (host port &key (element-type 'character)) (let* ((socket (with-mapped-conditions (nil) (ext:connect-to-inet-socket (host-to-hbo host) port :kind :stream))) (stream (sys:make-fd-stream socket :input t :output t - :element-type 'character + :element-type element-type :buffering :full))) ;;###FIXME the above line probably needs an :external-format (make-stream-socket :socket socket :stream stream))) From ehuelsmann at common-lisp.net Thu Jan 4 22:07:16 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 4 Jan 2007 17:07:16 -0500 (EST) Subject: [usocket-cvs] r141 - usocket/tags/0.2.3 Message-ID: <20070104220716.9FBFF2B20F@common-lisp.net> Author: ehuelsmann Date: Thu Jan 4 17:07:16 2007 New Revision: 141 Added: usocket/tags/0.2.3/ - copied from r140, usocket/branches/0.2.x/ Modified: usocket/tags/0.2.3/usocket.asd Log: Tag 0.2.3. Modified: usocket/tags/0.2.3/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/tags/0.2.3/usocket.asd Thu Jan 4 17:07:16 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.2.3-dev" + :version "0.2.3" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Thu Jan 4 22:08:10 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 4 Jan 2007 17:08:10 -0500 (EST) Subject: [usocket-cvs] r142 - usocket/branches/0.2.x Message-ID: <20070104220810.C64B02B20F@common-lisp.net> Author: ehuelsmann Date: Thu Jan 4 17:08:10 2007 New Revision: 142 Modified: usocket/branches/0.2.x/usocket.asd Log: Advance development version number. Modified: usocket/branches/0.2.x/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/branches/0.2.x/usocket.asd Thu Jan 4 17:08:10 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.2.3-dev" + :version "0.2.4-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Thu Jan 4 22:09:39 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 4 Jan 2007 17:09:39 -0500 (EST) Subject: [usocket-cvs] r143 - in public_html: . releases Message-ID: <20070104220939.403F62B20F@common-lisp.net> Author: ehuelsmann Date: Thu Jan 4 17:09:37 2007 New Revision: 143 Added: public_html/releases/usocket-0.2.3.tar.gz (contents, props changed) public_html/releases/usocket-0.2.3.tar.gz.asc Modified: public_html/index.shtml Log: Update website and upload 0.2.3 release. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Jan 4 17:09:37 2007 @@ -310,6 +310,10 @@
    Release history
    DateReleaseSummary
    Jan 03, 20070.2.2Add ECL support and a small SBCL bugfix.
    Dec 21, 2006 0.2.1Remove 'open-stream' interface which is supposed to be provided by the 'trivial-usocket' package.
    + + Added: public_html/releases/usocket-0.2.3.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.2.3.tar.gz.asc ============================================================================== --- (empty file) +++ public_html/releases/usocket-0.2.3.tar.gz.asc Thu Jan 4 17:09:37 2007 @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) + +iD8DBQBFnXkki5O0Epaz9TkRAvgVAJ9F+ePx8eHz45ISrpKHChMy1fkiYACeMDCO +G9ofUHXmyZ6yITQbb1LDAhk= +=vOas +-----END PGP SIGNATURE----- From ehuelsmann at common-lisp.net Thu Jan 11 07:54:04 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 11 Jan 2007 02:54:04 -0500 (EST) Subject: [usocket-cvs] r144 - usocket/trunk/test Message-ID: <20070111075404.9D53372086@common-lisp.net> Author: ehuelsmann Date: Thu Jan 11 02:54:04 2007 New Revision: 144 Modified: usocket/trunk/test/test-usocket.lisp Log: Update test package with latest function signatures. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Thu Jan 11 02:54:04 2007 @@ -35,8 +35,8 @@ c)))))) (defparameter +non-existing-host+ "10.0.0.13") -(defparameter *soc1* (usocket::make-socket :socket :my-socket - :stream :my-stream)) +(defparameter *soc1* (usocket::make-stream-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) From ehuelsmann at common-lisp.net Thu Jan 11 20:05:58 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 11 Jan 2007 15:05:58 -0500 (EST) Subject: [usocket-cvs] r145 - usocket/trunk/test Message-ID: <20070111200558.B841B1C009@common-lisp.net> Author: ehuelsmann Date: Thu Jan 11 15:05:58 2007 New Revision: 145 Modified: usocket/trunk/test/test-usocket.lisp Log: Update tests. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Thu Jan 11 15:05:58 2007 @@ -37,6 +37,8 @@ (defparameter +non-existing-host+ "10.0.0.13") (defparameter *soc1* (usocket::make-stream-socket :socket :my-socket :stream :my-stream)) +(eval-when (:compile-toplevel :load-toplevel :execute) + (defparameter +common-lisp-net+ #(80 68 86 115))) (deftest make-socket.1 (usocket:socket *soc1*) :my-socket) (deftest make-socket.2 (usocket:socket-stream *soc1*) :my-stream) @@ -78,7 +80,7 @@ #-(or lispworks armedbear cmu openmcl) 'usocket:host-unreachable-error nil) - (usocket:socket-connect +non-existing-host+ 80) ;; == #(127 0 0 0) + (usocket:socket-connect "192.168.1.1" 80) ;; == #(127 0 0 0) :unreach) nil) @@ -94,14 +96,14 @@ t) (deftest socket-connect.2 (with-caught-conditions (nil nil) - (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (let ((sock (usocket:socket-connect +common-lisp-net+ 80))) (unwind-protect (typep sock 'usocket:usocket) (usocket:socket-close sock)))) t) (deftest socket-connect.3 (with-caught-conditions (nil nil) - (let ((sock (usocket:socket-connect 1097731309 80))) + (let ((sock (usocket:socket-connect (usocket::host-byte-order +common-lisp-net+) 80))) (unwind-protect (typep sock 'usocket:usocket) (usocket:socket-close sock)))) @@ -124,32 +126,32 @@ (deftest socket-name.1 (with-caught-conditions (nil nil) - (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (let ((sock (usocket:socket-connect +common-lisp-net+ 80))) (unwind-protect (usocket::get-peer-address sock) (usocket:socket-close sock)))) - #(65 110 12 237)) + #.+common-lisp-net+) (deftest socket-name.2 (with-caught-conditions (nil nil) - (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (let ((sock (usocket:socket-connect +common-lisp-net+ 80))) (unwind-protect (usocket::get-peer-port sock) (usocket:socket-close sock)))) 80) (deftest socket-name.3 (with-caught-conditions (nil nil) - (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (let ((sock (usocket:socket-connect +common-lisp-net+ 80))) (unwind-protect (usocket::get-peer-name sock) (usocket:socket-close sock)))) - #(65 110 12 237) 80) + #.+common-lisp-net+ 80) (deftest socket-name.4 (with-caught-conditions (nil nil) - (let ((sock (usocket:socket-connect #(65 110 12 237) 80))) + (let ((sock (usocket:socket-connect +common-lisp-net+ 80))) (unwind-protect (usocket::get-local-address sock) (usocket:socket-close sock)))) - #(10 0 0 252)) + #(192 168 1 65)) (defun run-usocket-tests () From ehuelsmann at common-lisp.net Thu Jan 11 21:06:38 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 11 Jan 2007 16:06:38 -0500 (EST) Subject: [usocket-cvs] r146 - usocket/trunk/test Message-ID: <20070111210638.BF0247B01C@common-lisp.net> Author: ehuelsmann Date: Thu Jan 11 16:06:38 2007 New Revision: 146 Modified: usocket/trunk/test/test-usocket.lisp Log: More tests updates. Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Thu Jan 11 16:06:38 2007 @@ -34,7 +34,8 @@ (describe c) c)))))) -(defparameter +non-existing-host+ "10.0.0.13") +(defparameter +non-existing-host+ "192.168.1.1") +(defparameter +unused-local-port+ 15213) (defparameter *soc1* (usocket::make-stream-socket :socket :my-socket :stream :my-stream)) (eval-when (:compile-toplevel :load-toplevel :execute) @@ -45,17 +46,17 @@ (deftest socket-no-connect.1 (with-caught-conditions ('usocket:socket-error nil) - (usocket:socket-connect "127.0.0.0" 80) + (usocket:socket-connect "127.0.0.0" +unused-local-port+) t) nil) (deftest socket-no-connect.2 (with-caught-conditions ('usocket:socket-error nil) - (usocket:socket-connect #(127 0 0 0) 80) + (usocket:socket-connect #(127 0 0 0) +unused-local-port+) t) nil) (deftest socket-no-connect.3 (with-caught-conditions ('usocket:socket-error nil) - (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) + (usocket:socket-connect 2130706432 +unused-local-port+) ;; == #(127 0 0 0) t) nil) @@ -67,7 +68,7 @@ #+openmcl 'usocket:timeout-error nil) - (usocket:socket-connect 2130706432 80) ;; == #(127 0 0 0) + (usocket:socket-connect 2130706432 +unused-local-port+) ;; == #(127 0 0 0) :unreach) nil) (deftest socket-failure.2 @@ -80,7 +81,7 @@ #-(or lispworks armedbear cmu openmcl) 'usocket:host-unreachable-error nil) - (usocket:socket-connect "192.168.1.1" 80) ;; == #(127 0 0 0) + (usocket:socket-connect +non-existing-host+ 80) ;; 80 = just a port :unreach) nil) From ehuelsmann at common-lisp.net Sat Jan 13 16:07:11 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 13 Jan 2007 11:07:11 -0500 (EST) Subject: [usocket-cvs] r147 - usocket/trunk/backend Message-ID: <20070113160711.72F50F@common-lisp.net> Author: ehuelsmann Date: Sat Jan 13 11:07:10 2007 New Revision: 147 Modified: usocket/trunk/backend/openmcl.lisp Log: Fix OpenMCL bug. Patch by: Kevin Montuori (montuori at igvanus dot info) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sat Jan 13 11:07:10 2007 @@ -45,10 +45,7 @@ (let ((mcl-sock (openmcl-socket:make-socket :remote-host (host-to-hostname host) :remote-port port))) - (openmcl-socket:socket-connect mcl-sock - :element-type (if (subtypep element-type - 'character) - :text :binary)) + (openmcl-socket:socket-connect mcl-sock) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) (defmethod socket-close ((usocket usocket)) From ehuelsmann at common-lisp.net Sat Jan 13 16:08:47 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 13 Jan 2007 11:08:47 -0500 (EST) Subject: [usocket-cvs] r148 - usocket/branches/0.2.x/backend Message-ID: <20070113160847.25F94F@common-lisp.net> Author: ehuelsmann Date: Sat Jan 13 11:08:44 2007 New Revision: 148 Modified: usocket/branches/0.2.x/backend/openmcl.lisp Log: Backport r147 to the 0.2.x release branch. Modified: usocket/branches/0.2.x/backend/openmcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/openmcl.lisp (original) +++ usocket/branches/0.2.x/backend/openmcl.lisp Sat Jan 13 11:08:44 2007 @@ -45,10 +45,7 @@ (let ((mcl-sock (openmcl-socket:make-socket :remote-host (host-to-hostname host) :remote-port port))) - (openmcl-socket:socket-connect mcl-sock - :element-type (if (subtypep element-type - 'character) - :text :binary)) + (openmcl-socket:socket-connect mcl-sock) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) (defmethod socket-close ((usocket usocket)) From ehuelsmann at common-lisp.net Sun Jan 14 23:18:05 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 14 Jan 2007 18:18:05 -0500 (EST) Subject: [usocket-cvs] r149 - usocket/trunk/backend Message-ID: <20070114231805.801EA2F0C6@common-lisp.net> Author: ehuelsmann Date: Sun Jan 14 18:18:04 2007 New Revision: 149 Modified: usocket/trunk/backend/cmucl.lisp Log: Fix unflushed streams upon socket close in CMUCL. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Sun Jan 14 18:18:04 2007 @@ -72,7 +72,7 @@ (defmethod socket-close ((usocket usocket)) "Close socket." (with-mapped-conditions (usocket) - (ext:close-socket (socket usocket)))) + (close (socket-stream usocket)))) (defmethod get-local-name ((usocket usocket)) (multiple-value-bind From ehuelsmann at common-lisp.net Sun Jan 14 23:19:17 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 14 Jan 2007 18:19:17 -0500 (EST) Subject: [usocket-cvs] r150 - usocket/branches/0.2.x/backend Message-ID: <20070114231917.B581036009@common-lisp.net> Author: ehuelsmann Date: Sun Jan 14 18:19:17 2007 New Revision: 150 Modified: usocket/branches/0.2.x/backend/cmucl.lisp Log: Merge r149 (CMUCL unflushed socket close fix). Modified: usocket/branches/0.2.x/backend/cmucl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/cmucl.lisp (original) +++ usocket/branches/0.2.x/backend/cmucl.lisp Sun Jan 14 18:19:17 2007 @@ -72,7 +72,7 @@ (defmethod socket-close ((usocket usocket)) "Close socket." (with-mapped-conditions (usocket) - (ext:close-socket (socket usocket)))) + (close (socket-stream usocket)))) (defmethod get-local-name ((usocket usocket)) (multiple-value-bind From ehuelsmann at common-lisp.net Sun Jan 14 23:28:29 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 14 Jan 2007 18:28:29 -0500 (EST) Subject: [usocket-cvs] r151 - in usocket/trunk: . backend Message-ID: <20070114232829.5974038015@common-lisp.net> Author: ehuelsmann Date: Sun Jan 14 18:28:28 2007 New Revision: 151 Modified: usocket/trunk/backend/clisp.lisp usocket/trunk/backend/cmucl.lisp usocket/trunk/backend/sbcl.lisp usocket/trunk/package.lisp usocket/trunk/usocket.lisp Log: Server socket support (after basic testing) for - CLISP - CMUCL - SBCL (and probably ECL) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Sun Jan 14 18:28:28 2007 @@ -48,14 +48,30 @@ :buffered t))) (make-stream-socket :socket socket :stream socket))) ;; the socket is a stream too -;; :host host -;; :port port)) + +(defun socket-listen (host port &key reuseaddress (backlog 5)) + ;; clisp 2.39 sets SO_REUSEADDRESS to 1 by default; no need to + ;; to explicitly turn it on. + (let ((sock (apply #'socket:socket-server + (append (list port + :backlog backlog) + (when (not (eql host *wildcard-host*)) + (list :interface host)))))) + (make-stream-server-socket sock))) + +(defmethod socket-accept ((socket stream-server-usocket)) + (let ((stream (socket:socket-accept (socket socket)))) + (make-stream-socket :socket stream + :stream stream))) (defmethod socket-close ((usocket usocket)) "Close socket." (with-mapped-conditions (usocket) (close (socket usocket)))) +(defmethod socket-close ((usocket stream-server-usocket)) + (socket:socket-server-close (socket usocket))) + (defmethod get-local-name ((usocket usocket)) (multiple-value-bind (address port) Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Sun Jan 14 18:28:28 2007 @@ -69,6 +69,23 @@ (let ((err (unix:unix-errno))) (when err (cmucl-map-socket-error err)))))) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + (let ((server-sock (apply #'ext:create-inet-listener + (append (list port :stream + :backlog backlog + :reuse-address reuseaddress) + (when (not (eql host *wildcard-host*)) + (list :host + (host-to-hbo host))))))) + (make-stream-server-socket server-sock))) + +(defmethod socket-accept ((usocket stream-server-usocket)) + (let* ((sock (ext:accept-tcp-connection (socket usocket))) + (stream (sys:make-fd-stream sock :input t :output t + :element-type (element-type usocket) + :buffering :full))) + (make-stream-socket :socket sock :stream stream))) + (defmethod socket-close ((usocket usocket)) "Close socket." (with-mapped-conditions (usocket) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Sun Jan 14 18:28:28 2007 @@ -82,6 +82,22 @@ (sb-bsd-sockets:socket-connect socket ip port)) usocket)) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + (let* ((ip (host-to-vector-quad host)) + (sock (make-instance 'sb-bsd-sockets:inet-socket + :type :stream :protocol :tcp))) + (setf (sb-bsd-sockets:sockopt-reuse-address sock) reuseaddress) + (sb-bsd-sockets:socket-bind sock ip port) + (sb-bsd-sockets:socket-listen sock backlog) + (make-stream-server-socket sock))) + +(defmethod socket-accept ((socket stream-server-usocket)) + (let ((sock (sb-bsd-sockets:socket-accept (socket socket)))) + (make-stream-socket :socket sock + :stream (sb-bsd-sockets:socket-make-stream sock + :input t :output t :buffering :full + :element-type (element-type socket))))) + (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) (sb-bsd-sockets:socket-close (socket usocket)))) Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Sun Jan 14 18:28:28 2007 @@ -11,6 +11,8 @@ (defpackage :usocket (:use :cl) (:export #:socket-connect ; socket constructors and methods + #:socket-listen + #:socket-accept #:socket-close #:get-local-address #:get-peer-address @@ -22,6 +24,8 @@ #:with-connected-socket ; macros #:usocket ; socket object and accessors + #:stream-usocket + #:stream-server-usocket #:socket #:socket-stream Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Sun Jan 14 18:28:28 2007 @@ -5,7 +5,11 @@ (in-package :usocket) +(defparameter *wildcard-host* #(0 0 0 0) + "Hostname to pass when all interfaces in the current system are to be bound.") +(defparameter *auto-port* 0 + "Port number to pass when an auto-assigned port number is wanted.") (defclass usocket () ((socket @@ -17,9 +21,9 @@ (defclass stream-usocket (usocket) ((stream - :initarg :stream - :accessor socket-stream - :documentation "Stream instance associated with the socket. + :initarg :stream + :accessor socket-stream + :documentation "Stream instance associated with the socket. Iff an external-format was passed to `socket-connect' or `socket-listen' the stream is a flexi-stream. Otherwise the stream is implementation @@ -27,8 +31,14 @@ (:documentation "")) (defclass stream-server-usocket (usocket) - () - (:documentation "")) + ((element-type + :initarg :element-type + :initform 'character + :reader element-type + :documentation "Default element type for streams created by +`socket-accept'.")) + (:documentation "Socket which listens for stream connections to +be initiated from remote sockets.")) ;;Not in use yet: ;;(defclass datagram-usocket (usocket) @@ -46,10 +56,14 @@ :socket socket :stream stream)) -(defun make-stream-server-socket (socket) - "Create a usocket-server socket type from an implementation-specific socket -object." - (make-instance 'stream-server-usocket :socket socket)) +(defun make-stream-server-socket (socket &key (element-type 'character)) + "Create a usocket-server socket type from an +implementation-specific socket object. + +The returned value is a subtype of `stream-server-usocket'." + (make-instance 'stream-server-usocket + :socket socket + :element-type element-type)) (defgeneric socket-close (usocket) (:documentation "Close a previously opened `usocket'.")) @@ -62,13 +76,19 @@ "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.")) + (:documentation "Returns the IP port of the socket. + +This function applies to both `stream-usocket' and `server-stream-usocket' +type objects.")) (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.")) + (:documentation "Returns the IP address and port of the socket as values. + +This function applies to both `stream-usocket' and `server-stream-usocket' +type objects.")) (defgeneric get-peer-name (socket) (:documentation @@ -78,14 +98,25 @@ (defmacro with-connected-socket ((var socket) &body body) "Bind `socket' to `var', ensuring socket destruction on exit. +`body' is only evaluated when `var' is bound to a non-null value. + The `body' is an implied progn form." `(let ((,var ,socket)) (unwind-protect - (progn + (when ,var , at body) (when ,var (socket-close ,var))))) +(defmacro with-server-socket ((var server-socket) &body body) + "Bind `server-socket' to `var', ensuring socket destruction on exit. + +`body' is only evaluated when `var' is bound to a non-null value. + +The `body' is an implied progn form." + `(with-connected-socket (var server-socket) + , at body)) + ;; ;; IPv4 utility functions ;; @@ -201,11 +232,26 @@ ;; Documentation for the function ;; -;; (defun SOCKET-LISTEN (host port &key local-ip local-port -;; reuseaddress backlog) ..) - +;; (defun SOCKET-LISTEN (host port &key reuseaddress backlog) ..) +;;###FIXME: extend with default-element-type +(setf (documentation 'socket-listen 'function) + "Bind to interface `host' on `port'. `host' should be the +representation of an interface address. The implementation is not +required to do an address lookup, making no guarantees that hostnames +will be correctly resolved. If `*wildcard-host*' is passed for `host', +the socket will be bound to all available interfaces for the IPv4 +protocol in the system. `port' can be selected by the IP stack by +passing `*auto-port*'. + +Returns an object of type `stream-server-usocket'. + +`reuseaddress' and `backlog' are advisory parameters for setting socket +options at creation time. +") ;; Documentation for the function ;; -;; (defun SOCKET-ACCEPT (socket &key element-type external-format +;; (defun SOCKET-ACCEPT (socket &key element-type ;; buffered timeout) ..) +(setf (documentation 'socket-accept 'function) + "") From ehuelsmann at common-lisp.net Mon Jan 15 20:07:42 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 15 Jan 2007 15:07:42 -0500 (EST) Subject: [usocket-cvs] r152 - usocket/trunk/backend Message-ID: <20070115200742.2C15B5832A@common-lisp.net> Author: ehuelsmann Date: Mon Jan 15 15:07:41 2007 New Revision: 152 Modified: usocket/trunk/backend/armedbear.lisp Log: Server socket support for ArmedBear (abcl). Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Mon Jan 15 15:07:41 2007 @@ -6,6 +6,16 @@ (in-package :usocket) +(defmacro jmethod-call (instance (method &rest arg-spec) &rest args) + (let ((isym (gensym))) + `(let* ((,isym ,instance) + (class-name (java:jclass-name (java:jclass-of ,isym)))) + (java:jcall (java:jmethod class-name ,method , at arg-spec) + ,isym , at args)))) + +(defmacro jnew-call ((class &rest arg-spec) &rest args) + `(java:jnew (java:jconstructor ,class , at arg-spec) + , at args)) (defun handle-condition (condition &optional socket) (typecase condition @@ -21,28 +31,54 @@ :stream (ext:get-socket-stream sock :element-type element-type))))))) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + (let* ((sock-addr (jnew-call ("java.net.InetSocketAddress" + "java.lang.String" "int") + (host-to-hostname host) port)) + (sock (jnew-call ("java.net.ServerSocket")))) + (when reuseaddress + (jmethod-call sock + ("setReuseAddress" "boolean") + (java:make-immediate-object reuseaddress :boolean))) + (jmethod-call sock + ("bind" "java.net.SocketAddress" "int") + sock-addr backlog) + (make-stream-server-socket sock))) + +(defmethod socket-accept ((socket stream-server-usocket)) + (let* ((jsock (socket socket)) + (jacc-sock (jmethod-call jsock ("accept"))) + (jacc-stream + (ext:get-socket-stream jacc-sock + :element-type (element-type socket)))) + (make-stream-socket :socket jacc-sock + :stream jacc-stream))) + +;;(defun print-java-exception (e) +;; (let* ((native-exception (java-exception-cause e))) +;; (print (jcall (jmethod "java.net.BindException" "getMessage") native-exception)))) + (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) (ext:socket-close (socket usocket)))) - (defmethod get-local-address ((usocket usocket)) (dotted-quad-to-vector-quad (ext:socket-local-address (socket usocket)))) -(defmethod get-peer-address ((usocket usocket)) +(defmethod get-peer-address ((usocket stream-usocket)) (dotted-quad-to-vector-quad (ext:socket-peer-address (socket usocket)))) (defmethod get-local-port ((usocket usocket)) (ext:socket-local-port (socket usocket))) -(defmethod get-peer-port ((usocket usocket)) +(defmethod get-peer-port ((usocket stream-usocket)) (ext: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)) +(defmethod get-peer-name ((usocket stream-usocket)) (values (get-peer-address usocket) (get-peer-port usocket))) From ehuelsmann at common-lisp.net Tue Jan 16 08:20:00 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 03:20:00 -0500 (EST) Subject: [usocket-cvs] r153 - usocket/trunk/backend Message-ID: <20070116082000.C01DD50009@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 03:20:00 2007 New Revision: 153 Modified: usocket/trunk/backend/lispworks.lisp Log: Fix LispWorks character :element-type. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Jan 16 03:20:00 2007 @@ -47,7 +47,7 @@ ;; :real-condition condition ;; :socket socket)))) -(defun socket-connect (host port &key (element-type 'character)) +(defun socket-connect (host port &key (element-type 'base-char)) (let ((hostname (host-to-hostname host)) (stream)) (setf stream From ehuelsmann at common-lisp.net Tue Jan 16 08:22:17 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 03:22:17 -0500 (EST) Subject: [usocket-cvs] r154 - usocket/branches/0.2.x/backend Message-ID: <20070116082217.1017453014@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 03:22:16 2007 New Revision: 154 Modified: usocket/branches/0.2.x/backend/lispworks.lisp Log: Backport r153 (character :element-type fix). Modified: usocket/branches/0.2.x/backend/lispworks.lisp ============================================================================== --- usocket/branches/0.2.x/backend/lispworks.lisp (original) +++ usocket/branches/0.2.x/backend/lispworks.lisp Tue Jan 16 03:22:16 2007 @@ -47,7 +47,7 @@ ;; :real-condition condition ;; :socket socket)))) -(defun socket-connect (host port &key (element-type 'character)) +(defun socket-connect (host port &key (element-type 'base-char)) (let ((hostname (host-to-hostname host)) (stream)) (setf stream From ehuelsmann at common-lisp.net Tue Jan 16 20:01:05 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 15:01:05 -0500 (EST) Subject: [usocket-cvs] r155 - in usocket/trunk: . backend Message-ID: <20070116200105.BBE2E1A0A8@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 15:01:04 2007 New Revision: 155 Modified: usocket/trunk/backend/lispworks.lisp usocket/trunk/usocket.lisp Log: Server socket support for LispWorks. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Jan 16 15:01:04 2007 @@ -61,10 +61,30 @@ ;; :host host ;; :port port)) -(defmethod socket-close ((usocket usocket)) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + ;; backlog ignored; I've mailed LispWorks support, but + ;; don't have an answer yet + (let* ((comm::*use_so_reuseaddr* reuseaddress) + (sock #-lispworks4.1 (comm::create-tcp-socket-for-service + port :address host :backlog backlog) + #+lispworks4.1 (comm::create-tcp-socket-for-service port))) + (make-stream-server-socket sock))) + +(defmethod socket-accept ((usocket stream-server-usocket)) + (let* ((sock (comm::get-fd-from-socket (socket usocket))) + (stream (make-instance 'comm:socket-stream + :socket sock + :direction :io + :element-type (element-type usocket)))) + (make-stream-socket :socket sock :stream stream))) + +(defmethod socket-close ((usocket stream-usocket)) "Close socket." (close (socket-stream usocket))) +(defmethod socket-close ((usocket stream-server-usocket)) + (comm::close-socket (socket usocket))) + (defmethod get-local-name ((usocket usocket)) (multiple-value-bind (address port) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Tue Jan 16 15:01:04 2007 @@ -33,7 +33,8 @@ (defclass stream-server-usocket (usocket) ((element-type :initarg :element-type - :initform 'character + :initform #-lispworks 'character + #+lispworks 'base-char :reader element-type :documentation "Default element type for streams created by `socket-accept'.")) @@ -56,7 +57,9 @@ :socket socket :stream stream)) -(defun make-stream-server-socket (socket &key (element-type 'character)) +(defun make-stream-server-socket (socket &key (element-type + #-lispworks 'character + #+lispworks 'base-char)) "Create a usocket-server socket type from an implementation-specific socket object. From ehuelsmann at common-lisp.net Tue Jan 16 20:55:55 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 15:55:55 -0500 (EST) Subject: [usocket-cvs] r156 - usocket/trunk/backend Message-ID: <20070116205555.717F853039@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 15:55:53 2007 New Revision: 156 Modified: usocket/trunk/backend/lispworks.lisp Log: Add missing function get-hosts-by-name (LispWorks). Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Jan 16 15:55:53 2007 @@ -108,3 +108,7 @@ (defmethod get-peer-port ((usocket usocket)) (nth-value 1 (get-peer-name usocket))) + +(defun get-hosts-by-name (name) + (with-mapped-conditions () + (comm:get-host-entry name :fields '(:addresses)))) From ehuelsmann at common-lisp.net Tue Jan 16 20:56:57 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 15:56:57 -0500 (EST) Subject: [usocket-cvs] r157 - usocket/branches/0.2.x/backend Message-ID: <20070116205657.6B77653039@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 15:56:57 2007 New Revision: 157 Modified: usocket/branches/0.2.x/backend/lispworks.lisp Log: Backport r156 (missing get-hosts-by-name). Modified: usocket/branches/0.2.x/backend/lispworks.lisp ============================================================================== --- usocket/branches/0.2.x/backend/lispworks.lisp (original) +++ usocket/branches/0.2.x/backend/lispworks.lisp Tue Jan 16 15:56:57 2007 @@ -88,3 +88,7 @@ (defmethod get-peer-port ((usocket usocket)) (nth-value 1 (get-peer-name usocket))) + +(defun get-hosts-by-name (name) + (with-mapped-conditions () + (comm:get-host-entry name :fields '(:addresses)))) From ehuelsmann at common-lisp.net Tue Jan 16 21:41:58 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 16:41:58 -0500 (EST) Subject: [usocket-cvs] r158 - usocket/trunk/backend Message-ID: <20070116214158.A08FCA167@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 16:41:58 2007 New Revision: 158 Modified: usocket/trunk/backend/lispworks.lisp Log: Add condition mapping (LispWorks). Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Jan 16 16:41:58 2007 @@ -65,9 +65,10 @@ ;; backlog ignored; I've mailed LispWorks support, but ;; don't have an answer yet (let* ((comm::*use_so_reuseaddr* reuseaddress) - (sock #-lispworks4.1 (comm::create-tcp-socket-for-service - port :address host :backlog backlog) - #+lispworks4.1 (comm::create-tcp-socket-for-service port))) + (sock (with-mapped-conditions () + #-lispworks4.1 (comm::create-tcp-socket-for-service + port :address host :backlog backlog) + #+lispworks4.1 (comm::create-tcp-socket-for-service port)))) (make-stream-server-socket sock))) (defmethod socket-accept ((usocket stream-server-usocket)) @@ -83,7 +84,8 @@ (close (socket-stream usocket))) (defmethod socket-close ((usocket stream-server-usocket)) - (comm::close-socket (socket usocket))) + (with-mapped-conditions (usocket) + (comm::close-socket (socket usocket)))) (defmethod get-local-name ((usocket usocket)) (multiple-value-bind From ehuelsmann at common-lisp.net Tue Jan 16 21:45:57 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 16:45:57 -0500 (EST) Subject: [usocket-cvs] r159 - usocket/trunk/backend Message-ID: <20070116214557.99E8F111DB@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 16:45:57 2007 New Revision: 159 Modified: usocket/trunk/backend/lispworks.lisp Log: Remove (partially stale) comments. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Jan 16 16:45:57 2007 @@ -43,9 +43,6 @@ (error 'unknown-error :socket socket :real-error condition))))))) -;; (condition (error 'usocket-error -;; :real-condition condition -;; :socket socket)))) (defun socket-connect (host port &key (element-type 'base-char)) (let ((hostname (host-to-hostname host)) @@ -58,12 +55,8 @@ (make-stream-socket :socket (comm:socket-stream-socket stream) :stream stream) (error 'unknown-error)))) -;; :host host -;; :port port)) (defun socket-listen (host port &key reuseaddress (backlog 5)) - ;; backlog ignored; I've mailed LispWorks support, but - ;; don't have an answer yet (let* ((comm::*use_so_reuseaddr* reuseaddress) (sock (with-mapped-conditions () #-lispworks4.1 (comm::create-tcp-socket-for-service From ehuelsmann at common-lisp.net Tue Jan 16 22:23:20 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 17:23:20 -0500 (EST) Subject: [usocket-cvs] r160 - usocket/trunk/backend Message-ID: <20070116222320.C96957D1A5@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 17:23:20 2007 New Revision: 160 Modified: usocket/trunk/backend/openmcl.lisp Log: Implement element-type support for OpenMCL. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Tue Jan 16 17:23:20 2007 @@ -42,9 +42,12 @@ (defun socket-connect (host port &key (element-type 'character)) (with-mapped-conditions () - (let ((mcl-sock (openmcl-socket:make-socket :remote-host - (host-to-hostname host) - :remote-port port))) + (let ((mcl-sock + (openmcl-socket:make-socket :remote-host (host-to-hostname host) + :remote-port port + :format (if (subtypep element-type + 'character) + :text :binary)))) (openmcl-socket:socket-connect mcl-sock) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) From ehuelsmann at common-lisp.net Tue Jan 16 22:24:39 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 17:24:39 -0500 (EST) Subject: [usocket-cvs] r161 - usocket/branches/0.2.x/backend Message-ID: <20070116222439.A03637D1A6@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 17:24:39 2007 New Revision: 161 Modified: usocket/branches/0.2.x/backend/openmcl.lisp Log: Backport r160 (element-type support for OpenMCL). Modified: usocket/branches/0.2.x/backend/openmcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/openmcl.lisp (original) +++ usocket/branches/0.2.x/backend/openmcl.lisp Tue Jan 16 17:24:39 2007 @@ -42,9 +42,12 @@ (defun socket-connect (host port &key (element-type 'character)) (with-mapped-conditions () - (let ((mcl-sock (openmcl-socket:make-socket :remote-host - (host-to-hostname host) - :remote-port port))) + (let ((mcl-sock + (openmcl-socket:make-socket :remote-host (host-to-hostname host) + :remote-port port + :format (if (subtypep element-type + 'character) + :text :binary)))) (openmcl-socket:socket-connect mcl-sock) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) From ehuelsmann at common-lisp.net Tue Jan 16 22:59:50 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 17:59:50 -0500 (EST) Subject: [usocket-cvs] r162 - usocket/trunk/backend Message-ID: <20070116225950.1E59C5D0E6@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 17:59:49 2007 New Revision: 162 Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/backend/openmcl.lisp Log: Add OpenMCL and Allegro server sockets. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Tue Jan 16 17:59:49 2007 @@ -51,24 +51,43 @@ (with-mapped-conditions (usocket) (close (socket usocket)))) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + ;; Allegro and OpenMCL socket interfaces bear very strong resemblence + ;; whatever you change here, change it also for OpenMCL + (let ((sock (with-mapped-conditions () + (apply #'socket:make-socket + (append (list :connect :passive + :reuse-address reuseaddress + :local-port port + :backlog backlog + :format :bivalent + ;; allegro now ignores :format + ) + (when (not (eql host *wildcard-host*)) + (list :local-host host))))))) + (make-stream-server-socket :socket socket))) + +(defmethod socket-accept ((socket stream-server-usocket)) + (let ((stream-sock (socket:accept-connection (socket socket)))) + (make-stream-socket :socket stream-sock :stream stream-sock))) (defmethod get-local-address ((usocket usocket)) (hbo-to-vector-quad (socket:local-host (socket usocket)))) -(defmethod get-peer-address ((usocket usocket)) +(defmethod get-peer-address ((usocket stream-server-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)) +(defmethod get-peer-port ((usocket stream-server-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)) +(defmethod get-peer-name ((usocket stream-server-usocket)) (values (get-peer-address usocket) (get-peer-port usocket))) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Tue Jan 16 17:59:49 2007 @@ -51,6 +51,21 @@ (openmcl-socket:socket-connect mcl-sock) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + (let* ((sock (apply #'openmcl-socket:make-socket + (append (list :connect :passive + :reuse-address reuseaddress + :local-port port + :backlog backlog + :format :bivalent) + (when (not (eql host *wildcard-host*)) + (list :local-host host)))))) + (make-stream-server-socket sock))) + +(defmethod socket-accept ((usocket stream-server-usocket)) + (let ((sock (openmcl-socket:accept-connection (socket usocket)))) + (make-stream-socket :socket sock :stream sock))) + (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) (close (socket usocket)))) From ehuelsmann at common-lisp.net Tue Jan 16 23:05:30 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:05:30 -0500 (EST) Subject: [usocket-cvs] r163 - in usocket/trunk: . backend Message-ID: <20070116230530.32799751AF@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:05:29 2007 New Revision: 163 Modified: usocket/trunk/backend/openmcl.lisp usocket/trunk/usocket.lisp Log: Implement DNS query functions for OpenMCL. Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Tue Jan 16 18:05:29 2007 @@ -89,3 +89,12 @@ (defmethod get-peer-name ((usocket usocket)) (values (get-peer-address usocket) (get-peer-port usocket))) + +(defun get-host-by-address (address) + (with-mapped-conditions () + (openmcl-socket:ipaddr-to-hostname (host-to-hbo address)))) + +(defun get-hosts-by-name (name) + (with-mapped-conditions () + (list (hbo-to-vector-quad (openmcl-socket:lookup-hostname + (host-to-hostname name)))))) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Tue Jan 16 18:05:29 2007 @@ -177,7 +177,7 @@ ;; DNS helper functions ;; -#-(or clisp openmcl armedbear) +#-(or clisp armedbear) (progn (defun get-host-by-name (name) (let ((hosts (get-hosts-by-name name))) From ehuelsmann at common-lisp.net Tue Jan 16 23:07:40 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:07:40 -0500 (EST) Subject: [usocket-cvs] r164 - usocket/trunk/backend Message-ID: <20070116230740.51B1C751AF@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:07:39 2007 New Revision: 164 Modified: usocket/trunk/backend/allegro.lisp Log: Ensure correct argument type for DNS query functions. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Tue Jan 16 18:07:39 2007 @@ -94,11 +94,12 @@ (defun get-host-by-address (address) (with-mapped-conditions () - (socket:ipaddr-to-hostname address))) + (socket:ipaddr-to-hostname (host-to-hbo 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 (socket:lookup-hostname name))))) + (list (hbo-to-vector-quad (socket:lookup-hostname + (host-to-hostname name))))) From ehuelsmann at common-lisp.net Tue Jan 16 23:11:09 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:11:09 -0500 (EST) Subject: [usocket-cvs] r165 - usocket/trunk/backend Message-ID: <20070116231109.E0DB0D002@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:11:09 2007 New Revision: 165 Modified: usocket/trunk/backend/lispworks.lisp Log: Ensure correct return type for DNS query function. Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Tue Jan 16 18:11:09 2007 @@ -106,4 +106,5 @@ (defun get-hosts-by-name (name) (with-mapped-conditions () - (comm:get-host-entry name :fields '(:addresses)))) + (mapcar #'hbo-to-vector-quad + (comm:get-host-entry name :fields '(:addresses))))) From ehuelsmann at common-lisp.net Tue Jan 16 23:14:51 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:14:51 -0500 (EST) Subject: [usocket-cvs] r166 - in usocket/branches/0.2.x: . backend Message-ID: <20070116231451.C5FD5111CC@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:14:50 2007 New Revision: 166 Modified: usocket/branches/0.2.x/backend/allegro.lisp usocket/branches/0.2.x/backend/lispworks.lisp usocket/branches/0.2.x/backend/openmcl.lisp usocket/branches/0.2.x/usocket.lisp Log: Backport r 162:165 (DNS query function fixes). Modified: usocket/branches/0.2.x/backend/allegro.lisp ============================================================================== --- usocket/branches/0.2.x/backend/allegro.lisp (original) +++ usocket/branches/0.2.x/backend/allegro.lisp Tue Jan 16 18:14:50 2007 @@ -75,11 +75,12 @@ (defun get-host-by-address (address) (with-mapped-conditions () - (socket:ipaddr-to-hostname address))) + (socket:ipaddr-to-hostname (host-to-hbo 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 (socket:lookup-hostname name))))) + (list (hbo-to-vector-quad (socket:lookup-hostname + (host-to-hostname name))))) Modified: usocket/branches/0.2.x/backend/lispworks.lisp ============================================================================== --- usocket/branches/0.2.x/backend/lispworks.lisp (original) +++ usocket/branches/0.2.x/backend/lispworks.lisp Tue Jan 16 18:14:50 2007 @@ -91,4 +91,5 @@ (defun get-hosts-by-name (name) (with-mapped-conditions () - (comm:get-host-entry name :fields '(:addresses)))) + (mapcar #'hbo-to-vector-quad + (comm:get-host-entry name :fields '(:addresses))))) Modified: usocket/branches/0.2.x/backend/openmcl.lisp ============================================================================== --- usocket/branches/0.2.x/backend/openmcl.lisp (original) +++ usocket/branches/0.2.x/backend/openmcl.lisp Tue Jan 16 18:14:50 2007 @@ -74,3 +74,12 @@ (defmethod get-peer-name ((usocket usocket)) (values (get-peer-address usocket) (get-peer-port usocket))) + +(defun get-host-by-address (address) + (with-mapped-conditions () + (openmcl-socket:ipaddr-to-hostname (host-to-hbo address)))) + +(defun get-hosts-by-name (name) + (with-mapped-conditions () + (list (hbo-to-vector-quad (openmcl-socket:lookup-hostname + (host-to-hostname name)))))) Modified: usocket/branches/0.2.x/usocket.lisp ============================================================================== --- usocket/branches/0.2.x/usocket.lisp (original) +++ usocket/branches/0.2.x/usocket.lisp Tue Jan 16 18:14:50 2007 @@ -143,7 +143,7 @@ ;; DNS helper functions ;; -#-(or clisp openmcl armedbear) +#-(or clisp armedbear) (progn (defun get-host-by-name (name) (let ((hosts (get-hosts-by-name name))) From ehuelsmann at common-lisp.net Tue Jan 16 23:39:15 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:39:15 -0500 (EST) Subject: [usocket-cvs] r167 - usocket/branches/0.2.4 Message-ID: <20070116233915.CD0F43909A@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:39:15 2007 New Revision: 167 Added: usocket/branches/0.2.4/ - copied from r166, usocket/branches/0.2.x/ Modified: usocket/branches/0.2.4/usocket.asd Log: Tag 0.2.4 release. Modified: usocket/branches/0.2.4/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/branches/0.2.4/usocket.asd Tue Jan 16 18:39:15 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.2.4-dev" + :version "0.2.4" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Tue Jan 16 23:40:05 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:40:05 -0500 (EST) Subject: [usocket-cvs] r168 - usocket/branches/0.2.x Message-ID: <20070116234005.957CC3C006@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:40:05 2007 New Revision: 168 Modified: usocket/branches/0.2.x/usocket.asd Log: Advance branch version number. Modified: usocket/branches/0.2.x/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/branches/0.2.x/usocket.asd Tue Jan 16 18:40:05 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.2.4-dev" + :version "0.2.5-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Tue Jan 16 23:40:50 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Tue, 16 Jan 2007 18:40:50 -0500 (EST) Subject: [usocket-cvs] r169 - in public_html: . releases Message-ID: <20070116234050.5FEAF3E100@common-lisp.net> Author: ehuelsmann Date: Tue Jan 16 18:40:48 2007 New Revision: 169 Added: public_html/releases/usocket-0.2.4.tar.gz (contents, props changed) public_html/releases/usocket-0.2.4.tar.gz.asc Modified: public_html/index.shtml Log: Publish version 0.2.4. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Tue Jan 16 18:40:48 2007 @@ -310,6 +310,9 @@
    Release history
    DateReleaseSummary
    Jan 04, 20070.2.3Add :element-type support to support stacking + flexi-streams on socket streams for portable :external-format + support.
    Jan 03, 2007 0.2.2Add ECL support and a small SBCL bugfix.
    Dec 21, 2006
    + +
    Release history
    DateReleaseSummary
    Jan 17, 20070.2.4Various fixes for CMUCL, OpenMCL, Allegro and LispWorks. +
    Jan 04, 2007 0.2.3Add :element-type support to support stacking flexi-streams on socket streams for portable :external-format Added: public_html/releases/usocket-0.2.4.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.2.4.tar.gz.asc ============================================================================== --- (empty file) +++ public_html/releases/usocket-0.2.4.tar.gz.asc Tue Jan 16 18:40:48 2007 @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQBFrWHqi5O0Epaz9TkRAoCgAJ9nWSwbIHNBGq/G6dHK8KxhjAK2PwCeKaXQ +Iu4Cla9BiCX5GejGtAw1Xg4= +=fr3+ +-----END PGP SIGNATURE----- From ehuelsmann at common-lisp.net Thu Jan 18 06:54:00 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 01:54:00 -0500 (EST) Subject: [usocket-cvs] r170 - usocket/trunk/backend Message-ID: <20070118065400.4A26D47002@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 01:53:59 2007 New Revision: 170 Modified: usocket/trunk/backend/allegro.lisp Log: Fix Allegro backend syntax. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Thu Jan 18 01:53:59 2007 @@ -36,7 +36,7 @@ :real-error condition :socket socket)))))) -(defun socket-connect (host port &key (element-type 'character) +(defun socket-connect (host port &key (element-type 'character)) (let ((socket)) (setf socket (with-mapped-conditions (socket) @@ -102,4 +102,4 @@ ;; structure is too long. (with-mapped-conditions () (list (hbo-to-vector-quad (socket:lookup-hostname - (host-to-hostname name))))) + (host-to-hostname name)))))) From ehuelsmann at common-lisp.net Thu Jan 18 19:12:29 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 14:12:29 -0500 (EST) Subject: [usocket-cvs] r171 - usocket/branches/0.2.x/backend Message-ID: <20070118191229.E01826011C@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 14:12:29 2007 New Revision: 171 Modified: usocket/branches/0.2.x/backend/allegro.lisp Log: Fix semantic bugs: add 2 closing parens. Modified: usocket/branches/0.2.x/backend/allegro.lisp ============================================================================== --- usocket/branches/0.2.x/backend/allegro.lisp (original) +++ usocket/branches/0.2.x/backend/allegro.lisp Thu Jan 18 14:12:29 2007 @@ -36,7 +36,7 @@ :real-error condition :socket socket)))))) -(defun socket-connect (host port &key (element-type 'character) +(defun socket-connect (host port &key (element-type 'character)) (let ((socket)) (setf socket (with-mapped-conditions (socket) @@ -83,4 +83,4 @@ ;; structure is too long. (with-mapped-conditions () (list (hbo-to-vector-quad (socket:lookup-hostname - (host-to-hostname name))))) + (host-to-hostname name)))))) From ehuelsmann at common-lisp.net Thu Jan 18 21:15:13 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 16:15:13 -0500 (EST) Subject: [usocket-cvs] r172 - usocket/trunk/backend Message-ID: <20070118211513.E24671202C@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 16:15:13 2007 New Revision: 172 Modified: usocket/trunk/backend/allegro.lisp Log: Fix variable naming error (Allegro). Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Thu Jan 18 16:15:13 2007 @@ -65,7 +65,7 @@ ) (when (not (eql host *wildcard-host*)) (list :local-host host))))))) - (make-stream-server-socket :socket socket))) + (make-stream-server-socket :socket sock))) (defmethod socket-accept ((socket stream-server-usocket)) (let ((stream-sock (socket:accept-connection (socket socket)))) From ehuelsmann at common-lisp.net Thu Jan 18 21:24:25 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 16:24:25 -0500 (EST) Subject: [usocket-cvs] r173 - in usocket/trunk: backend test Message-ID: <20070118212425.E6C7828068@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 16:24:25 2007 New Revision: 173 Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/test/test-usocket.lisp Log: Fix argument number problem (Allegro). Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Thu Jan 18 16:24:25 2007 @@ -65,7 +65,7 @@ ) (when (not (eql host *wildcard-host*)) (list :local-host host))))))) - (make-stream-server-socket :socket sock))) + (make-stream-server-socket sock))) (defmethod socket-accept ((socket stream-server-usocket)) (let ((stream-sock (socket:accept-connection (socket socket)))) Modified: usocket/trunk/test/test-usocket.lisp ============================================================================== --- usocket/trunk/test/test-usocket.lisp (original) +++ usocket/trunk/test/test-usocket.lisp Thu Jan 18 16:24:25 2007 @@ -39,7 +39,7 @@ (defparameter *soc1* (usocket::make-stream-socket :socket :my-socket :stream :my-stream)) (eval-when (:compile-toplevel :load-toplevel :execute) - (defparameter +common-lisp-net+ #(80 68 86 115))) + (defparameter +common-lisp-net+ #(80 68 86 115))) ;; common-lisp.net IP (deftest make-socket.1 (usocket:socket *soc1*) :my-socket) (deftest make-socket.2 (usocket:socket-stream *soc1*) :my-stream) From ehuelsmann at common-lisp.net Thu Jan 18 23:48:53 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 18:48:53 -0500 (EST) Subject: [usocket-cvs] r174 - usocket/tags/0.2.5 Message-ID: <20070118234853.C82F35301E@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 18:48:53 2007 New Revision: 174 Added: usocket/tags/0.2.5/ - copied from r173, usocket/branches/0.2.x/ Modified: usocket/tags/0.2.5/usocket.asd Log: Create 0.2.5 tag. Modified: usocket/tags/0.2.5/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/tags/0.2.5/usocket.asd Thu Jan 18 18:48:53 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.2.5-dev" + :version "0.2.5" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Thu Jan 18 23:51:30 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 18:51:30 -0500 (EST) Subject: [usocket-cvs] r175 - usocket/branches/0.2.x Message-ID: <20070118235130.2458B56006@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 18:51:29 2007 New Revision: 175 Modified: usocket/branches/0.2.x/usocket.asd Log: Advance version number. Modified: usocket/branches/0.2.x/usocket.asd ============================================================================== --- usocket/branches/0.2.x/usocket.asd (original) +++ usocket/branches/0.2.x/usocket.asd Thu Jan 18 18:51:29 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.2.5-dev" + :version "0.2.6-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Thu Jan 18 23:52:01 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Thu, 18 Jan 2007 18:52:01 -0500 (EST) Subject: [usocket-cvs] r176 - in public_html: . releases Message-ID: <20070118235201.44B3F56006@common-lisp.net> Author: ehuelsmann Date: Thu Jan 18 18:51:59 2007 New Revision: 176 Added: public_html/releases/usocket-0.2.5.tar.gz (contents, props changed) public_html/releases/usocket-0.2.5.tar.gz.asc Modified: public_html/index.shtml Log: Upload 0.2.5 release and update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Thu Jan 18 18:51:59 2007 @@ -310,6 +310,8 @@ + + Added: public_html/releases/usocket-0.2.5.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.2.5.tar.gz.asc ============================================================================== --- (empty file) +++ public_html/releases/usocket-0.2.5.tar.gz.asc Thu Jan 18 18:51:59 2007 @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQBFsBWIi5O0Epaz9TkRAuz/AJ96VAuMnlQOmdwLxAinab0LdxKm1QCfS5bi +7de82Dbrf7/ajzmaEZvtQvc= +=S7mg +-----END PGP SIGNATURE----- From ehuelsmann at common-lisp.net Fri Jan 19 19:38:42 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 14:38:42 -0500 (EST) Subject: [usocket-cvs] r177 - usocket/trunk/backend Message-ID: <20070119193842.C59B76B565@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 14:38:40 2007 New Revision: 177 Modified: usocket/trunk/backend/scl.lisp Log: Server side socket support for Scieneer (and re-indenting). Modified: usocket/trunk/backend/scl.lisp ============================================================================== --- usocket/trunk/backend/scl.lisp (original) +++ usocket/trunk/backend/scl.lisp Fri Jan 19 14:38:40 2007 @@ -24,7 +24,6 @@ "Dispatch correct usocket condition." (etypecase condition (ext::socket-error - (format t "erron: ~D~%" (ext::socket-errno condition)) (scl-map-socket-error (ext::socket-errno condition) :socket socket :condition condition)) @@ -34,15 +33,31 @@ :socket socket)))) (defun socket-connect (host port &key (element-type 'character)) - (let* ((socket - (with-mapped-conditions (nil) - (ext:connect-to-inet-socket (host-to-hbo host) port :kind :stream))) - (stream (sys:make-fd-stream socket :input t :output t - :element-type element-type - :buffering :full))) - ;;###FIXME the above line probably needs an :external-format + (let* ((socket (with-mapped-conditions () + (ext:connect-to-inet-socket (host-to-hbo host) port + :kind :stream))) + (stream (sys:make-fd-stream socket :input t :output t + :element-type element-type + :buffering :full))) (make-stream-socket :socket socket :stream stream))) +(defun socket-listen (host port &key reuseaddress (backlog 5)) + (let* ((host (if (eql host *wildcard-host*) + 0 + (host-to-hbo host))) + (server-sock (ext:create-inet-listener port :stream + :host host + :reuse-address reuseaddress + :backlog backlog))) + (make-stream-server-socket server-sock))) + +(defmethod socket-accept ((usocket stream-server-usocket)) + (let* ((sock (ext:accept-tcp-connection (socket usocket))) + (stream (sys:make-fd-stream sock :input t :output t + :element-type (element-type usocket) + :buffering :full))) + (make-stream-socket :socket sock :stream stream))) + (defmethod socket-close ((usocket usocket)) "Close socket." (with-mapped-conditions (usocket) @@ -51,13 +66,13 @@ (defmethod get-local-name ((usocket usocket)) (multiple-value-bind (address port) (with-mapped-conditions (usocket) - (ext:get-socket-host-and-port (socket usocket))) + (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) (with-mapped-conditions (usocket) - (ext:get-peer-host-and-port (socket usocket))) + (ext:get-peer-host-and-port (socket usocket))) (values (hbo-to-vector-quad address) port))) (defmethod get-local-address ((usocket usocket)) @@ -77,25 +92,25 @@ (multiple-value-bind (host errno) (ext:lookup-host-entry (host-byte-order address)) (cond (host - (ext:host-entry-name host)) - (t - (let ((condition (cdr (assoc errno +unix-ns-error-map+)))) - (cond (condition - (error condition :host-or-ip address)) - (t - (error 'ns-unknown-error :host-or-ip address - :real-error errno)))))))) + (ext:host-entry-name host)) + (t + (let ((condition (cdr (assoc errno +unix-ns-error-map+)))) + (cond (condition + (error condition :host-or-ip address)) + (t + (error 'ns-unknown-error :host-or-ip address + :real-error errno)))))))) (defun get-hosts-by-name (name) (multiple-value-bind (host errno) (ext:lookup-host-entry name) (cond (host - (mapcar #'hbo-to-vector-quad - (ext:host-entry-addr-list host))) - (t - (let ((condition (cdr (assoc errno +unix-ns-error-map+)))) - (cond (condition - (error condition :host-or-ip name)) - (t - (error 'ns-unknown-error :host-or-ip name - :real-error errno)))))))) + (mapcar #'hbo-to-vector-quad + (ext:host-entry-addr-list host))) + (t + (let ((condition (cdr (assoc errno +unix-ns-error-map+)))) + (cond (condition + (error condition :host-or-ip name)) + (t + (error 'ns-unknown-error :host-or-ip name + :real-error errno)))))))) From ehuelsmann at common-lisp.net Fri Jan 19 20:34:50 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 15:34:50 -0500 (EST) Subject: [usocket-cvs] r178 - in usocket/trunk: . backend Message-ID: <20070119203450.81C2B5832B@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 15:34:50 2007 New Revision: 178 Modified: 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/backend/scl.lisp usocket/trunk/usocket.lisp Log: Add :element-type support for server sockets. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Fri Jan 19 15:34:50 2007 @@ -36,14 +36,18 @@ :real-error condition :socket socket)))))) +(defun to-format (element-type) + (if (subtypep element-type 'character) + :text + :binary)) + (defun socket-connect (host port &key (element-type 'character)) (let ((socket)) (setf socket (with-mapped-conditions (socket) (socket:make-socket :remote-host (host-to-hostname host) :remote-port port - :format (if (subtypep element-type 'character) - :text :binary)))) + :format (to-format element-type)))) (make-stream-socket :socket socket :stream socket))) (defmethod socket-close ((usocket usocket)) @@ -51,7 +55,10 @@ (with-mapped-conditions (usocket) (close (socket usocket)))) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) ;; Allegro and OpenMCL socket interfaces bear very strong resemblence ;; whatever you change here, change it also for OpenMCL (let ((sock (with-mapped-conditions () @@ -60,12 +67,12 @@ :reuse-address reuseaddress :local-port port :backlog backlog - :format :bivalent + :format (to-format element-type) ;; allegro now ignores :format ) (when (not (eql host *wildcard-host*)) (list :local-host host))))))) - (make-stream-server-socket sock))) + (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((socket stream-server-usocket)) (let ((stream-sock (socket:accept-connection (socket socket)))) Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Fri Jan 19 15:34:50 2007 @@ -31,7 +31,10 @@ :stream (ext:get-socket-stream sock :element-type element-type))))))) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) (let* ((sock-addr (jnew-call ("java.net.InetSocketAddress" "java.lang.String" "int") (host-to-hostname host) port)) @@ -43,7 +46,7 @@ (jmethod-call sock ("bind" "java.net.SocketAddress" "int") sock-addr backlog) - (make-stream-server-socket sock))) + (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((socket stream-server-usocket)) (let* ((jsock (socket socket)) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Fri Jan 19 15:34:50 2007 @@ -49,7 +49,10 @@ (make-stream-socket :socket socket :stream socket))) ;; the socket is a stream too -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) ;; clisp 2.39 sets SO_REUSEADDRESS to 1 by default; no need to ;; to explicitly turn it on. (let ((sock (apply #'socket:socket-server @@ -57,10 +60,11 @@ :backlog backlog) (when (not (eql host *wildcard-host*)) (list :interface host)))))) - (make-stream-server-socket sock))) + (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((socket stream-server-usocket)) - (let ((stream (socket:socket-accept (socket socket)))) + (let ((stream (socket:socket-accept (socket socket) + :element-type (element-type socket)))) (make-stream-socket :socket stream :stream stream))) Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Fri Jan 19 15:34:50 2007 @@ -69,7 +69,10 @@ (let ((err (unix:unix-errno))) (when err (cmucl-map-socket-error err)))))) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) (let ((server-sock (apply #'ext:create-inet-listener (append (list port :stream :backlog backlog @@ -77,7 +80,7 @@ (when (not (eql host *wildcard-host*)) (list :host (host-to-hbo host))))))) - (make-stream-server-socket server-sock))) + (make-stream-server-socket server-sock :element-type element-type))) (defmethod socket-accept ((usocket stream-server-usocket)) (let* ((sock (ext:accept-tcp-connection (socket usocket))) Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Fri Jan 19 15:34:50 2007 @@ -56,13 +56,16 @@ :stream stream) (error 'unknown-error)))) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'base-char)) (let* ((comm::*use_so_reuseaddr* reuseaddress) (sock (with-mapped-conditions () #-lispworks4.1 (comm::create-tcp-socket-for-service port :address host :backlog backlog) #+lispworks4.1 (comm::create-tcp-socket-for-service port)))) - (make-stream-server-socket sock))) + (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((usocket stream-server-usocket)) (let* ((sock (comm::get-fd-from-socket (socket usocket))) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Fri Jan 19 15:34:50 2007 @@ -40,27 +40,33 @@ (error (error 'unknown-error :socket socket :real-error condition)) (condition (signal 'unknown-condition :real-condition condition)))) +(defun to-format (element-type) + (if (subtypep element-type 'character) + :text + :binary)) + (defun socket-connect (host port &key (element-type 'character)) (with-mapped-conditions () (let ((mcl-sock (openmcl-socket:make-socket :remote-host (host-to-hostname host) :remote-port port - :format (if (subtypep element-type - 'character) - :text :binary)))) + :format (to-format element-type)))) (openmcl-socket:socket-connect mcl-sock) (make-stream-socket :stream mcl-sock :socket mcl-sock)))) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) (let* ((sock (apply #'openmcl-socket:make-socket (append (list :connect :passive :reuse-address reuseaddress :local-port port :backlog backlog - :format :bivalent) + :format (to-format element-type)) (when (not (eql host *wildcard-host*)) (list :local-host host)))))) - (make-stream-server-socket sock))) + (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((usocket stream-server-usocket)) (let ((sock (openmcl-socket:accept-connection (socket usocket)))) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Fri Jan 19 15:34:50 2007 @@ -82,14 +82,17 @@ (sb-bsd-sockets:socket-connect socket ip port)) usocket)) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) (let* ((ip (host-to-vector-quad host)) (sock (make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp))) (setf (sb-bsd-sockets:sockopt-reuse-address sock) reuseaddress) (sb-bsd-sockets:socket-bind sock ip port) (sb-bsd-sockets:socket-listen sock backlog) - (make-stream-server-socket sock))) + (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((socket stream-server-usocket)) (let ((sock (sb-bsd-sockets:socket-accept (socket socket)))) Modified: usocket/trunk/backend/scl.lisp ============================================================================== --- usocket/trunk/backend/scl.lisp (original) +++ usocket/trunk/backend/scl.lisp Fri Jan 19 15:34:50 2007 @@ -41,7 +41,10 @@ :buffering :full))) (make-stream-socket :socket socket :stream stream))) -(defun socket-listen (host port &key reuseaddress (backlog 5)) +(defun socket-listen (host port + &key reuseaddress + (backlog 5) + (element-type 'character)) (let* ((host (if (eql host *wildcard-host*) 0 (host-to-hbo host))) @@ -49,7 +52,7 @@ :host host :reuse-address reuseaddress :backlog backlog))) - (make-stream-server-socket server-sock))) + (make-stream-server-socket server-sock :element-type element-type))) (defmethod socket-accept ((usocket stream-server-usocket)) (let* ((sock (ext:accept-tcp-connection (socket usocket))) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Fri Jan 19 15:34:50 2007 @@ -249,7 +249,8 @@ Returns an object of type `stream-server-usocket'. `reuseaddress' and `backlog' are advisory parameters for setting socket -options at creation time. +options at creation time. `element-type' is the element type of the +streams to be created by `socket-accept'. ") ;; Documentation for the function From ehuelsmann at common-lisp.net Fri Jan 19 20:56:15 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 15:56:15 -0500 (EST) Subject: [usocket-cvs] r179 - usocket/trunk Message-ID: <20070119205615.1446A2F054@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 15:56:14 2007 New Revision: 179 Modified: usocket/trunk/package.lisp Log: Add the 'with-server-socket' macro to the list of exported symbols. Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Fri Jan 19 15:56:14 2007 @@ -22,6 +22,7 @@ #:get-peer-name #:with-connected-socket ; macros + #:with-server-socket #:usocket ; socket object and accessors #:stream-usocket From ehuelsmann at common-lisp.net Fri Jan 19 21:06:43 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 16:06:43 -0500 (EST) Subject: [usocket-cvs] r180 - public_html Message-ID: <20070119210643.744853C006@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 16:06:41 2007 New Revision: 180 Modified: public_html/index.shtml Log: Update project status. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Fri Jan 19 16:06:41 2007 @@ -224,21 +224,33 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + From ehuelsmann at common-lisp.net Fri Jan 19 23:37:46 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 18:37:46 -0500 (EST) Subject: [usocket-cvs] r181 - usocket/trunk/backend Message-ID: <20070119233746.15867D012@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 18:37:45 2007 New Revision: 181 Modified: usocket/trunk/backend/cmucl.lisp Log: Implement error handling for host name resolution. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Fri Jan 19 18:37:45 2007 @@ -51,7 +51,8 @@ :condition condition)) (simple-error (error 'unknown-error :real-condition condition - :socket socket)))) + :socket socket)) + (condition (error condition)))) (defun socket-connect (host port &key (element-type 'character)) (let* ((socket)) @@ -119,14 +120,29 @@ (nth-value 1 (get-peer-name usocket))) +(defun lookup-host-entry (host) + (multiple-value-bind + (entry errno) + (ext:lookup-host-entry host) + (if entry + entry + ;;###The constants below work on *most* OSes, but are defined as the + ;; constants mentioned in C + (error + (second (assoc errno '((1 ns-host-not-found-error) ;; HOST_NOT_FOUND + (2 ns-no-recovery-error) ;; NO_DATA + (3 ns-no-recovery-error) ;; NO_RECOVERY + (4 ns-try-again)))))))) ;; TRY_AGAIN + + (defun get-host-by-address (address) (handler-case (ext:host-entry-name - (ext::lookup-host-entry (host-byte-order address))) + (lookup-host-entry (host-byte-order address))) (condition (condition) (handle-condition condition)))) (defun get-hosts-by-name (name) (handler-case (mapcar #'hbo-to-vector-quad (ext:host-entry-addr-list - (ext:lookup-host-entry name))) + (lookup-host-entry name))) (condition (condition) (handle-condition condition)))) From ehuelsmann at common-lisp.net Fri Jan 19 23:43:12 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 18:43:12 -0500 (EST) Subject: [usocket-cvs] r182 - usocket/trunk/doc Message-ID: <20070119234312.1CDD01A09F@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 18:43:12 2007 New Revision: 182 Modified: usocket/trunk/doc/backends.txt Log: Document new backend requirements. Modified: usocket/trunk/doc/backends.txt ============================================================================== --- usocket/trunk/doc/backends.txt (original) +++ usocket/trunk/doc/backends.txt Fri Jan 19 18:43:12 2007 @@ -11,6 +11,7 @@ - handle-condition - socket-connect + - socket-listen - get-hosts-by-name [ optional ] - get-host-by-address [ optional ] @@ -18,6 +19,7 @@ Methods: - socket-close + - socket-accept - get-local-name - get-peer-name From ehuelsmann at common-lisp.net Fri Jan 19 23:43:51 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 18:43:51 -0500 (EST) Subject: [usocket-cvs] r183 - usocket/trunk Message-ID: <20070119234351.1E4871A09F@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 18:43:50 2007 New Revision: 183 Modified: usocket/trunk/README usocket/trunk/TODO Log: Update project description files README and TODO. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Fri Jan 19 18:43:50 2007 @@ -20,7 +20,7 @@ - SBCL - CMUCL - - ArmedBear + - ArmedBear (post feb 11th, 2006 versions) - clisp - Allegro Common Lisp - LispWorks @@ -59,19 +59,32 @@ ============== - usocket (class) + - stream-usocket (class; usocket derivative) + - stream-server-usocket (class; usocket derivative) - socket-connect (function) [ to create an active/connected socket ] socket-connect host port &key element-type 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-listen (function) [ to create a passive/listening socket ] + socket-listen host port &key reuseaddress backlog element-type + where `host' has the same definition as above + - socket-accept (method) [ to create an active/connected socket ] + socket-accept socket + returns (server side) a connected socket derived from a + listening/passive socket. - socket-close (method) socket-close socket where socket a previously returned socket + - socket (usocket slot accessor), + the internal/implementation defined socket representation - socket-stream (usocket slot accessor), socket-stream socket the return value of which satisfies the normal stream interface + + Errors: - address-in-use-error - address-not-available-error @@ -110,4 +123,14 @@ - 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. + release version for the script to work correctly. + +- The ArmedBear backend doesn't do any error mapping (yet). Java + defines exceptions at the wrong level (IMO), since the exception + reported bares a relation to the function failing, not the actual + error that occurred: for example 'Address already in use' (when + creating a passive socket) is reported as a BindException with + an error text of 'Address already in use'. There's no way to sanely + map 'BindException' to a meaningfull error in usocket. [This does not + mean the backend should not at least map to 'unknown-error'!] + Modified: usocket/trunk/TODO ============================================================================== --- usocket/trunk/TODO (original) +++ usocket/trunk/TODO Fri Jan 19 18:43:50 2007 @@ -1,22 +1,8 @@ -- 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. - - 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!) - -- 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. - - Add INET6 support. + +For more TODO items, see http://trac.common-lisp.net/usocket/report. From ehuelsmann at common-lisp.net Fri Jan 19 23:53:45 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 18:53:45 -0500 (EST) Subject: [usocket-cvs] r184 - usocket/trunk Message-ID: <20070119235345.C07167B019@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 18:53:45 2007 New Revision: 184 Modified: usocket/trunk/package.lisp usocket/trunk/usocket.lisp Log: Add ip comparison functions ip= and ip/=. Modified: usocket/trunk/package.lisp ============================================================================== --- usocket/trunk/package.lisp (original) +++ usocket/trunk/package.lisp Fri Jan 19 18:53:45 2007 @@ -30,11 +30,13 @@ #:socket #:socket-stream - #:host-byte-order ; IPv4 utility functions + #:host-byte-order ; IP(v4) utility functions #:hbo-to-dotted-quad #:hbo-to-vector-quad #:vector-quad-to-dotted-quad #:dotted-quad-to-vector-quad + #:ip= + #:ip/= #:socket-condition ; conditions #:socket-error ; errors Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Fri Jan 19 18:53:45 2007 @@ -121,7 +121,7 @@ , at body)) ;; -;; IPv4 utility functions +;; IP(v4) utility functions ;; (defun list-of-strings-to-integers (list) @@ -173,6 +173,29 @@ (+ (* (aref vector 0) 256 256 256) (* (aref vector 1) 256 256) (* (aref vector 2) 256) (aref vector 3))) +(defmethod host-byte-order ((int integer)) + int) + +(defun host-to-hostname (host) + "Translate a string or vector quad to a stringified hostname." + (etypecase host + (string host) + ((vector t 4) (vector-quad-to-dotted-quad host)) + (integer (hbo-to-dotted-quad host)))) + +(defun ip= (ip1 ip2) + (etypecase ip1 + (string (string= ip1 (host-to-hostname ip2))) + ((vector t 4) (or (eq ip1 ip2) + (and (= (aref ip1 0) (aref ip2 0)) + (= (aref ip1 1) (aref ip2 1)) + (= (aref ip1 2) (aref ip2 2)) + (= (aref ip1 3) (aref ip2 3))))) + (integer (= ip1 (host-byte-order ip2))))) + +(defun ip/= (ip1 ip2) + (not (ip= ip1 ip2))) + ;; ;; DNS helper functions ;; @@ -210,13 +233,6 @@ ((vector t 4) (host-byte-order host)) (integer host)))) -(defun host-to-hostname (host) - "Translate a string or vector quad to a stringified hostname." - (etypecase host - (string host) - ((vector t 4) (vector-quad-to-dotted-quad host)) - (integer (hbo-to-dotted-quad host)))) - ;; ;; Setting of documentation for backend defined functions ;; From ehuelsmann at common-lisp.net Fri Jan 19 23:58:51 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 18:58:51 -0500 (EST) Subject: [usocket-cvs] r185 - usocket/trunk/backend Message-ID: <20070119235851.87E267B01B@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 18:58:50 2007 New Revision: 185 Modified: usocket/trunk/backend/allegro.lisp usocket/trunk/backend/clisp.lisp usocket/trunk/backend/cmucl.lisp usocket/trunk/backend/openmcl.lisp usocket/trunk/backend/scl.lisp Log: Use new ip comparison functions when determining ip (in)equality. Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Fri Jan 19 18:58:50 2007 @@ -70,8 +70,8 @@ :format (to-format element-type) ;; allegro now ignores :format ) - (when (not (eql host *wildcard-host*)) - (list :local-host host))))))) + (when (ip/= host *wildcard-host*) + (list :local-host host))))))) (make-stream-server-socket sock :element-type element-type))) (defmethod socket-accept ((socket stream-server-usocket)) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Fri Jan 19 18:58:50 2007 @@ -58,7 +58,7 @@ (let ((sock (apply #'socket:socket-server (append (list port :backlog backlog) - (when (not (eql host *wildcard-host*)) + (when (ip/= host *wildcard-host*) (list :interface host)))))) (make-stream-server-socket sock :element-type element-type))) Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Fri Jan 19 18:58:50 2007 @@ -78,7 +78,7 @@ (append (list port :stream :backlog backlog :reuse-address reuseaddress) - (when (not (eql host *wildcard-host*)) + (when (ip/= host *wildcard-host*) (list :host (host-to-hbo host))))))) (make-stream-server-socket server-sock :element-type element-type))) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Fri Jan 19 18:58:50 2007 @@ -64,7 +64,7 @@ :local-port port :backlog backlog :format (to-format element-type)) - (when (not (eql host *wildcard-host*)) + (when (ip/= host *wildcard-host*) (list :local-host host)))))) (make-stream-server-socket sock :element-type element-type))) Modified: usocket/trunk/backend/scl.lisp ============================================================================== --- usocket/trunk/backend/scl.lisp (original) +++ usocket/trunk/backend/scl.lisp Fri Jan 19 18:58:50 2007 @@ -45,7 +45,7 @@ &key reuseaddress (backlog 5) (element-type 'character)) - (let* ((host (if (eql host *wildcard-host*) + (let* ((host (if (ip= host *wildcard-host*) 0 (host-to-hbo host))) (server-sock (ext:create-inet-listener port :stream From ehuelsmann at common-lisp.net Sat Jan 20 00:19:32 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Fri, 19 Jan 2007 19:19:32 -0500 (EST) Subject: [usocket-cvs] r186 - usocket/trunk/backend Message-ID: <20070120001932.4C4D32823B@common-lisp.net> Author: ehuelsmann Date: Fri Jan 19 19:19:32 2007 New Revision: 186 Modified: usocket/trunk/backend/cmucl.lisp Log: Don't raise NIL as an error, return it instead. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Fri Jan 19 19:19:32 2007 @@ -128,11 +128,14 @@ entry ;;###The constants below work on *most* OSes, but are defined as the ;; constants mentioned in C - (error - (second (assoc errno '((1 ns-host-not-found-error) ;; HOST_NOT_FOUND + (let ((exception + (second (assoc errno + '((1 ns-host-not-found-error) ;; HOST_NOT_FOUND (2 ns-no-recovery-error) ;; NO_DATA (3 ns-no-recovery-error) ;; NO_RECOVERY - (4 ns-try-again)))))))) ;; TRY_AGAIN + (4 ns-try-again)))))) ;; TRY_AGAIN + (when exception + (error exception)))))) (defun get-host-by-address (address) From ehuelsmann at common-lisp.net Sat Jan 20 12:45:21 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 20 Jan 2007 07:45:21 -0500 (EST) Subject: [usocket-cvs] r187 - in usocket/trunk: . backend Message-ID: <20070120124521.B0E7F15145@common-lisp.net> Author: ehuelsmann Date: Sat Jan 20 07:45:20 2007 New Revision: 187 Modified: usocket/trunk/README usocket/trunk/backend/allegro.lisp usocket/trunk/backend/armedbear.lisp usocket/trunk/backend/clisp.lisp usocket/trunk/backend/lispworks.lisp usocket/trunk/backend/openmcl.lisp usocket/trunk/backend/sbcl.lisp usocket/trunk/backend/scl.lisp usocket/trunk/usocket.lisp Log: Add last-minute :element-type specification for trivial-sockets compatibility. Modified: usocket/trunk/README ============================================================================== --- usocket/trunk/README (original) +++ usocket/trunk/README Sat Jan 20 07:45:20 2007 @@ -70,7 +70,7 @@ socket-listen host port &key reuseaddress backlog element-type where `host' has the same definition as above - socket-accept (method) [ to create an active/connected socket ] - socket-accept socket + socket-accept socket &key element-type returns (server side) a connected socket derived from a listening/passive socket. - socket-close (method) Modified: usocket/trunk/backend/allegro.lisp ============================================================================== --- usocket/trunk/backend/allegro.lisp (original) +++ usocket/trunk/backend/allegro.lisp Sat Jan 20 07:45:20 2007 @@ -74,7 +74,8 @@ (list :local-host host))))))) (make-stream-server-socket sock :element-type element-type))) -(defmethod socket-accept ((socket stream-server-usocket)) +(defmethod socket-accept ((socket stream-server-usocket) &key element-type) + (declare (ignore element-type)) ;; allegro streams are multivalent (let ((stream-sock (socket:accept-connection (socket socket)))) (make-stream-socket :socket stream-sock :stream stream-sock))) Modified: usocket/trunk/backend/armedbear.lisp ============================================================================== --- usocket/trunk/backend/armedbear.lisp (original) +++ usocket/trunk/backend/armedbear.lisp Sat Jan 20 07:45:20 2007 @@ -48,12 +48,13 @@ sock-addr backlog) (make-stream-server-socket sock :element-type element-type))) -(defmethod socket-accept ((socket stream-server-usocket)) +(defmethod socket-accept ((socket stream-server-usocket) &key element-type) (let* ((jsock (socket socket)) (jacc-sock (jmethod-call jsock ("accept"))) (jacc-stream (ext:get-socket-stream jacc-sock - :element-type (element-type socket)))) + :element-type (or element-type + (element-type socket))))) (make-stream-socket :socket jacc-sock :stream jacc-stream))) Modified: usocket/trunk/backend/clisp.lisp ============================================================================== --- usocket/trunk/backend/clisp.lisp (original) +++ usocket/trunk/backend/clisp.lisp Sat Jan 20 07:45:20 2007 @@ -62,9 +62,11 @@ (list :interface host)))))) (make-stream-server-socket sock :element-type element-type))) -(defmethod socket-accept ((socket stream-server-usocket)) - (let ((stream (socket:socket-accept (socket socket) - :element-type (element-type socket)))) +(defmethod socket-accept ((socket stream-server-usocket) &key element-type) + (let ((stream + (socket:socket-accept (socket socket) + :element-type (or element-type + (element-type socket))))) (make-stream-socket :socket stream :stream stream))) Modified: usocket/trunk/backend/lispworks.lisp ============================================================================== --- usocket/trunk/backend/lispworks.lisp (original) +++ usocket/trunk/backend/lispworks.lisp Sat Jan 20 07:45:20 2007 @@ -67,12 +67,13 @@ #+lispworks4.1 (comm::create-tcp-socket-for-service port)))) (make-stream-server-socket sock :element-type element-type))) -(defmethod socket-accept ((usocket stream-server-usocket)) +(defmethod socket-accept ((usocket stream-server-usocket) &key element-type) (let* ((sock (comm::get-fd-from-socket (socket usocket))) (stream (make-instance 'comm:socket-stream :socket sock :direction :io - :element-type (element-type usocket)))) + :element-type (or element-type + (element-type usocket))))) (make-stream-socket :socket sock :stream stream))) (defmethod socket-close ((usocket stream-usocket)) Modified: usocket/trunk/backend/openmcl.lisp ============================================================================== --- usocket/trunk/backend/openmcl.lisp (original) +++ usocket/trunk/backend/openmcl.lisp Sat Jan 20 07:45:20 2007 @@ -68,7 +68,8 @@ (list :local-host host)))))) (make-stream-server-socket sock :element-type element-type))) -(defmethod socket-accept ((usocket stream-server-usocket)) +(defmethod socket-accept ((usocket stream-server-usocket) &key element-type) + (declare (ignore element-type)) ;; openmcl streams are bi/multivalent (let ((sock (openmcl-socket:accept-connection (socket usocket)))) (make-stream-socket :socket sock :stream sock))) Modified: usocket/trunk/backend/sbcl.lisp ============================================================================== --- usocket/trunk/backend/sbcl.lisp (original) +++ usocket/trunk/backend/sbcl.lisp Sat Jan 20 07:45:20 2007 @@ -94,12 +94,13 @@ (sb-bsd-sockets:socket-listen sock backlog) (make-stream-server-socket sock :element-type element-type))) -(defmethod socket-accept ((socket stream-server-usocket)) +(defmethod socket-accept ((socket stream-server-usocket) &key element-type) (let ((sock (sb-bsd-sockets:socket-accept (socket socket)))) (make-stream-socket :socket sock :stream (sb-bsd-sockets:socket-make-stream sock :input t :output t :buffering :full - :element-type (element-type socket))))) + :element-type (or element-type + (element-type socket)))))) (defmethod socket-close ((usocket usocket)) (with-mapped-conditions (usocket) Modified: usocket/trunk/backend/scl.lisp ============================================================================== --- usocket/trunk/backend/scl.lisp (original) +++ usocket/trunk/backend/scl.lisp Sat Jan 20 07:45:20 2007 @@ -54,10 +54,11 @@ :backlog backlog))) (make-stream-server-socket server-sock :element-type element-type))) -(defmethod socket-accept ((usocket stream-server-usocket)) +(defmethod socket-accept ((usocket stream-server-usocket) &key element-type) (let* ((sock (ext:accept-tcp-connection (socket usocket))) (stream (sys:make-fd-stream sock :input t :output t - :element-type (element-type usocket) + :element-type (or element-type + (element-type usocket)) :buffering :full))) (make-stream-socket :socket sock :stream stream))) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Sat Jan 20 07:45:20 2007 @@ -271,7 +271,9 @@ ;; Documentation for the function ;; -;; (defun SOCKET-ACCEPT (socket &key element-type -;; buffered timeout) ..) +;; (defun SOCKET-ACCEPT (socket &key element-type) (setf (documentation 'socket-accept 'function) - "") + "Accepts a connection from `socket', returning a `stream-socket'. + +The stream associated with the socket returned has `element-type' when +explicitly specified, or the element-type passed to `socket-listen' otherwise.") From ehuelsmann at common-lisp.net Sat Jan 20 12:48:04 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 20 Jan 2007 07:48:04 -0500 (EST) Subject: [usocket-cvs] r188 - usocket/trunk/backend Message-ID: <20070120124804.0EEC319001@common-lisp.net> Author: ehuelsmann Date: Sat Jan 20 07:48:03 2007 New Revision: 188 Modified: usocket/trunk/backend/cmucl.lisp Log: Add last-minute :element-type specification for trivial-sockets compatibility. Modified: usocket/trunk/backend/cmucl.lisp ============================================================================== --- usocket/trunk/backend/cmucl.lisp (original) +++ usocket/trunk/backend/cmucl.lisp Sat Jan 20 07:48:03 2007 @@ -83,10 +83,11 @@ (host-to-hbo host))))))) (make-stream-server-socket server-sock :element-type element-type))) -(defmethod socket-accept ((usocket stream-server-usocket)) +(defmethod socket-accept ((usocket stream-server-usocket) &key element-type) (let* ((sock (ext:accept-tcp-connection (socket usocket))) (stream (sys:make-fd-stream sock :input t :output t - :element-type (element-type usocket) + :element-type (or element-type + (element-type usocket)) :buffering :full))) (make-stream-socket :socket sock :stream stream))) From ehuelsmann at common-lisp.net Sat Jan 20 12:57:28 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 20 Jan 2007 07:57:28 -0500 (EST) Subject: [usocket-cvs] r189 - in usocket: branches/0.3.x branches/0.3.x/backend branches/0.3.x/doc trunk Message-ID: <20070120125728.1482719001@common-lisp.net> Author: ehuelsmann Date: Sat Jan 20 07:57:27 2007 New Revision: 189 Added: usocket/branches/0.3.x/ - copied from r176, usocket/trunk/ usocket/branches/0.3.x/README - copied unchanged from r188, usocket/trunk/README usocket/branches/0.3.x/TODO - copied unchanged from r188, usocket/trunk/TODO usocket/branches/0.3.x/backend/ - copied from r188, usocket/trunk/backend/ usocket/branches/0.3.x/doc/ - copied from r188, usocket/trunk/doc/ usocket/branches/0.3.x/package.lisp - copied unchanged from r188, usocket/trunk/package.lisp usocket/branches/0.3.x/usocket.lisp - copied unchanged from r188, usocket/trunk/usocket.lisp Modified: usocket/trunk/usocket.asd Log: Branch for 0.3.x: server sockets. Modified: usocket/trunk/usocket.asd ============================================================================== --- usocket/trunk/usocket.asd (original) +++ usocket/trunk/usocket.asd Sat Jan 20 07:57:27 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.3.0-dev" + :version "0.4.0-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Sat Jan 20 15:33:43 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sat, 20 Jan 2007 10:33:43 -0500 (EST) Subject: [usocket-cvs] r190 - public_html Message-ID: <20070120153343.199D6232BC@common-lisp.net> Author: ehuelsmann Date: Sat Jan 20 10:33:40 2007 New Revision: 190 Added: public_html/feature-comparison.shtml Modified: public_html/index.shtml Log: Add comparison chart. Added: public_html/feature-comparison.shtml ============================================================================== --- (empty file) +++ public_html/feature-comparison.shtml Sat Jan 20 10:33:40 2007 @@ -0,0 +1,143 @@ + + + + + <!--#include virtual="project-name" --> + + + + + +
    +

    +
    + +

    Comparison to "trivial-sockets"

    + +

    usocket supports more backends than trivial-sockets. + The latter implements different feature-sets for different backends while + the former supplies consistent functionality for all backends.

    + +
    Release history
    DateReleaseSummary
    Jan 19, 20070.2.5Allegro compilation fix.
    Jan 17, 2007 0.2.4Various fixes for CMUCL, OpenMCL, Allegro and LispWorks.
    PASS
    Add support for passive (connection-accepting/server) + Add support for passive (connection-accepting/server) sockets. Investigate interfaces providedTODOTODOTODOTODOTODOTODOTODOTODOTODOWIPWIPWIPWIPWIPWIPWIPWIPWIP
    Implement api calls listen and acceptDONEDONEDONEDONEDONEDONEDONEDONEDONE
    Implement api calls get- and setsockopt.Implement api calls get- and setsockopt (or equivalent). TODO TODO TODO
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FeatureIn trivial-sockets?In usocket?
    ABCLACLclispCMUCLLispWorksOpenMCLSBCL(all)
    Client side tcp streams:element-typeYes Yes*YesYesYesYes*YesYesYes
    :external-formatNoNoYesNoNoNoNoNoNo
    binding local interface/portNoYesNoNoNoYesYesNoNo
    Server socket creationBinding specific local portYes
    Binding specific local interfaceNoYesNoYesNoYesYesNoYes
    Selectable backlog lengthNoYesNoYesNoYesYesNoYes
    reuse-addressYesYesNo*YesYesYesYesNo*Yes*
    :element-type for created connectionsNoYes
    Accepting connections:element-type for created streamYesYes*YesYesYesYes*YesYesYes*
    :external-format for created streamNoNoYesNoNoNoNoNoNo
    + +

    In summary: there are only a very limited number of features you can depend +on to work on all platforms supported by trivial-sockets. While usocket +doesn't support all features, you can depend on the features to be available. +

    + + + Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sat Jan 20 10:33:40 2007 @@ -29,6 +29,9 @@

    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.

    +

    See the feature comparison with + trivial-sockets in order to find out which one you should use.

    +

    Supported implementations

    Currently these implementations are supported:

    From ehuelsmann at common-lisp.net Sun Jan 21 10:03:36 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 21 Jan 2007 05:03:36 -0500 (EST) Subject: [usocket-cvs] r191 - usocket/tags/0.3.0 Message-ID: <20070121100336.894D775024@common-lisp.net> Author: ehuelsmann Date: Sun Jan 21 05:03:35 2007 New Revision: 191 Added: usocket/tags/0.3.0/ - copied from r190, usocket/branches/0.3.x/ Modified: usocket/tags/0.3.0/usocket.asd Log: Create 0.3.0 tag. Modified: usocket/tags/0.3.0/usocket.asd ============================================================================== --- usocket/branches/0.3.x/usocket.asd (original) +++ usocket/tags/0.3.0/usocket.asd Sun Jan 21 05:03:35 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.3.0-dev" + :version "0.3.0" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Sun Jan 21 10:08:27 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 21 Jan 2007 05:08:27 -0500 (EST) Subject: [usocket-cvs] r192 - usocket/branches/0.3.x Message-ID: <20070121100827.6053016@common-lisp.net> Author: ehuelsmann Date: Sun Jan 21 05:08:25 2007 New Revision: 192 Modified: usocket/branches/0.3.x/usocket.asd Log: Advance version number. Modified: usocket/branches/0.3.x/usocket.asd ============================================================================== --- usocket/branches/0.3.x/usocket.asd (original) +++ usocket/branches/0.3.x/usocket.asd Sun Jan 21 05:08:25 2007 @@ -14,7 +14,7 @@ (defsystem usocket :name "usocket" :author "Erik Enge & Erik Huelsmann" - :version "0.3.0-dev" + :version "0.3.1-dev" :licence "MIT" :description "Universal socket library for Common Lisp" :depends-on (:split-sequence From ehuelsmann at common-lisp.net Sun Jan 21 10:09:28 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 21 Jan 2007 05:09:28 -0500 (EST) Subject: [usocket-cvs] r193 - in public_html: . releases Message-ID: <20070121100928.5DC6E3141@common-lisp.net> Author: ehuelsmann Date: Sun Jan 21 05:09:22 2007 New Revision: 193 Added: public_html/releases/usocket-0.3.0.tar.gz (contents, props changed) public_html/releases/usocket-0.3.0.tar.gz.asc Modified: public_html/index.shtml Log: Upload 0.3.0 and update website. Modified: public_html/index.shtml ============================================================================== --- public_html/index.shtml (original) +++ public_html/index.shtml Sun Jan 21 05:09:22 2007 @@ -325,6 +325,8 @@ + + Added: public_html/releases/usocket-0.3.0.tar.gz ============================================================================== Binary file. No diff available. Added: public_html/releases/usocket-0.3.0.tar.gz.asc ============================================================================== --- (empty file) +++ public_html/releases/usocket-0.3.0.tar.gz.asc Sun Jan 21 05:09:22 2007 @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQBFs0i0i5O0Epaz9TkRArGIAJ4+XspIcQJu/pqUl/ilDxIrHFxypQCfbAL9 +g1ATAMyna4k9NmW/KUdO/i8= +=o5+Z +-----END PGP SIGNATURE----- From ehuelsmann at common-lisp.net Sun Jan 21 13:17:08 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 21 Jan 2007 08:17:08 -0500 (EST) Subject: [usocket-cvs] r194 - trivial-usocket/trunk Message-ID: <20070121131708.B2BB712@common-lisp.net> Author: ehuelsmann Date: Sun Jan 21 08:17:08 2007 New Revision: 194 Modified: trivial-usocket/trunk/trivial-usocket.asd (props changed) trivial-usocket/trunk/trivial-usocket.lisp (contents, props changed) Log: Complete trivial-sockets compat (by implementing server sockets). Modified: trivial-usocket/trunk/trivial-usocket.lisp ============================================================================== --- trivial-usocket/trunk/trivial-usocket.lisp (original) +++ trivial-usocket/trunk/trivial-usocket.lisp Sun Jan 21 08:17:08 2007 @@ -10,7 +10,10 @@ #:usocket) (:export #:open-stream #:usocket - #:unsupported)) + #:unsupported + #:open-server + #:with-server + #:accept-connection)) (in-package :trivial-usocket) @@ -151,11 +154,15 @@ :usocket usocket rest))) +;; +;; The actual compat functions + (defun open-stream (peer-host peer-port &key (local-host :any) (local-port 0) (external-format :default) - (element-type 'character) + (element-type #-lispworks 'character + #+lispworks 'base-char) (protocol :tcp)) (unless (eq protocol :tcp) (error 'unsupported :feature `(:protocol ,protocol))) @@ -163,6 +170,48 @@ (error 'unsupported :feature :bind)) (unless (eql external-format :default) (error 'unsupported :feature :external-format)) - (let ((socket (socket-connect peer-host peer-port))) + (let ((socket (socket-connect peer-host peer-port + :element-type element-type))) (wrap-usocket-stream socket))) + +(defun open-server (&key (host :any) + (port 0) + (reuse-address t) + (backlog 1) + (protocol :tcp)) + (unless (eq protocol :tcp) + (error 'unsupported :feature `(:protocol ,protocol))) + (socket-listen (if (eq host :any) *wildcard-host* host) + port + :reuseaddress reuse-address + :backlog backlog)) + +(defun close-server (server) + (socket-close server)) + +(defun accept-connection (server &key (external-format :default) + (element-type #-lispworks 'character + #+lispworks 'base-char)) + (unless (eql external-format :default) + (error 'unsupported :feature :external-format)) + (wrap-usocket-stream (socket-accept server :element-type element-type))) + +(defmacro with-server ((server args) &body forms) + (let ((hostsym (gensym)) + (portsym (gensym)) + (newargs (gensym))) + `(let* ((,hostsym (or (getf ,args :host) + *wildcard-host*)) + (,portsym (or (getf ,args :port) + *wildcard-port*)) + (,newargs (copy-list ,args))) + (remf ,newargs :host) + (remf ,newargs :port) + (let ((,server (apply #'socket-listen ,hostsym ,portsym ,newargs))) + (when ,server + (unwind-protect + (progn + , at forms) + (when ,server + (socket-close ,server)))))))) From ehuelsmann at common-lisp.net Sun Jan 21 13:31:46 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Sun, 21 Jan 2007 08:31:46 -0500 (EST) Subject: [usocket-cvs] r195 - trivial-usocket/trunk usocket/trunk Message-ID: <20070121133146.8B4BE1C008@common-lisp.net> Author: ehuelsmann Date: Sun Jan 21 08:31:46 2007 New Revision: 195 Added: trivial-usocket/trunk/LICENSE - copied, changed from r188, usocket/trunk/LICENSE Modified: usocket/trunk/LICENSE Log: Update LICENSE information. Copied: trivial-usocket/trunk/LICENSE (from r188, usocket/trunk/LICENSE) ============================================================================== --- usocket/trunk/LICENSE (original) +++ trivial-usocket/trunk/LICENSE Sun Jan 21 08:31:46 2007 @@ -1,7 +1,7 @@ (This is the MIT / X Consortium license as taken from http://www.opensource.org/licenses/mit-license.html) -Copyright (c) 2003 Erik Enge +Copyright (c) 2006-2007 Erik Huelsmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Modified: usocket/trunk/LICENSE ============================================================================== --- usocket/trunk/LICENSE (original) +++ usocket/trunk/LICENSE Sun Jan 21 08:31:46 2007 @@ -2,6 +2,7 @@ http://www.opensource.org/licenses/mit-license.html) Copyright (c) 2003 Erik Enge +Copyright (c) 2006-2007 Erik Huelsmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the From ehuelsmann at common-lisp.net Mon Jan 22 19:39:13 2007 From: ehuelsmann at common-lisp.net (ehuelsmann at common-lisp.net) Date: Mon, 22 Jan 2007 14:39:13 -0500 (EST) Subject: [usocket-cvs] r196 - usocket/trunk Message-ID: <20070122193913.926314F010@common-lisp.net> Author: ehuelsmann Date: Mon Jan 22 14:39:13 2007 New Revision: 196 Modified: usocket/trunk/condition.lisp usocket/trunk/usocket.lisp Log: Raise an error on invalid parameters for a socket. Modified: usocket/trunk/condition.lisp ============================================================================== --- usocket/trunk/condition.lisp (original) +++ usocket/trunk/condition.lisp Mon Jan 22 14:39:13 2007 @@ -77,7 +77,9 @@ host-down-error host-unreachable-error shutdown-error - timeout-error) + timeout-error + invalid-socket-error + invalid-socket-stream-error) (socket-error)) (define-condition unknown-error (socket-error) Modified: usocket/trunk/usocket.lisp ============================================================================== --- usocket/trunk/usocket.lisp (original) +++ usocket/trunk/usocket.lisp Mon Jan 22 14:39:13 2007 @@ -48,11 +48,17 @@ (defun make-socket (&key socket) "Create a usocket socket type from implementation specific socket." + (unless socket + (error 'invalid-socket)) (make-stream-socket :socket socket)) (defun make-stream-socket (&key socket stream) "Create a usocket socket type from implementation specific socket and stream objects." + (unless socket + (error 'invalid-socket-error)) + (unless stream + (error 'invalid-socket-stream-error)) (make-instance 'stream-usocket :socket socket :stream stream))
    Release history
    DateReleaseSummary
    Jan 21, 20070.3.0Server sockets
    Jan 19, 2007 0.2.5Allegro compilation fix.
    Jan 17, 2007