Author: ehuelsmann
Date: Wed Oct 25 15:28:16 2006
New Revision: 123
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:
Prepare for server-side sockets support.
Note: The new socket classes are not used (yet).
Modified: usocket/trunk/backend/allegro.lisp
==============================================================================
--- usocket/trunk/backend/allegro.lisp (original)
+++ usocket/trunk/backend/allegro.lisp Wed Oct 25 15:28:16 2006
@@ -42,7 +42,7 @@
(with-mapped-conditions (socket)
(socket:make-socket :remote-host (host-to-hostname host)
:remote-port port)))
- (make-socket :socket socket :stream socket)))
+ (make-stream-socket :socket socket :stream socket)))
(defmethod socket-close ((usocket usocket))
"Close socket."
Modified: usocket/trunk/backend/armedbear.lisp
==============================================================================
--- usocket/trunk/backend/armedbear.lisp (original)
+++ usocket/trunk/backend/armedbear.lisp Wed Oct 25 15:28:16 2006
@@ -16,8 +16,8 @@
(with-mapped-conditions (usock)
(let ((sock (ext:make-socket (host-to-hostname host) port)))
(setf usock
- (make-socket :socket sock
- :stream (ext:get-socket-stream sock)))))))
+ (make-stream-socket :socket sock
+ :stream (ext:get-socket-stream sock)))))))
(defmethod socket-close ((usocket usocket))
(with-mapped-conditions (usocket)
Modified: usocket/trunk/backend/clisp.lisp
==============================================================================
--- usocket/trunk/backend/clisp.lisp (original)
+++ usocket/trunk/backend/clisp.lisp Wed Oct 25 15:28:16 2006
@@ -46,8 +46,8 @@
(socket:socket-connect port hostname
:element-type 'character
:buffered t)))
- (make-socket :socket socket
- :stream socket))) ;; the socket is a stream too
+ (make-stream-socket :socket socket
+ :stream socket))) ;; the socket is a stream too
;; :host host
;; :port port))
Modified: usocket/trunk/backend/cmucl.lisp
==============================================================================
--- usocket/trunk/backend/cmucl.lisp (original)
+++ usocket/trunk/backend/cmucl.lisp Wed Oct 25 15:28:16 2006
@@ -63,8 +63,8 @@
:element-type 'character
:buffering :full))
;;###FIXME the above line probably needs an :external-format
- (usocket (make-socket :socket socket
- :stream stream)))
+ (usocket (make-stream-socket :socket socket
+ :stream stream)))
usocket)
(let ((err (unix:unix-errno)))
(when err (cmucl-map-socket-error err))))))
Modified: usocket/trunk/backend/lispworks.lisp
==============================================================================
--- usocket/trunk/backend/lispworks.lisp (original)
+++ usocket/trunk/backend/lispworks.lisp Wed Oct 25 15:28:16 2006
@@ -54,8 +54,8 @@
(with-mapped-conditions ()
(comm:open-tcp-stream hostname port)))
(if stream
- (make-socket :socket (comm:socket-stream-socket stream)
- :stream stream)
+ (make-stream-socket :socket (comm:socket-stream-socket stream)
+ :stream stream)
(error 'unknown-error))))
;; :host host
;; :port port))
Modified: usocket/trunk/backend/openmcl.lisp
==============================================================================
--- usocket/trunk/backend/openmcl.lisp (original)
+++ usocket/trunk/backend/openmcl.lisp Wed Oct 25 15:28:16 2006
@@ -46,7 +46,7 @@
(host-to-hostname host)
:remote-port port)))
(openmcl-socket:socket-connect mcl-sock)
- (make-socket :stream mcl-sock :socket mcl-sock))))
+ (make-stream-socket :stream mcl-sock :socket mcl-sock))))
(defmethod socket-close ((usocket usocket))
(with-mapped-conditions (usocket)
Modified: usocket/trunk/backend/sbcl.lisp
==============================================================================
--- usocket/trunk/backend/sbcl.lisp (original)
+++ usocket/trunk/backend/sbcl.lisp Wed Oct 25 15:28:16 2006
@@ -68,7 +68,7 @@
:buffering :full
:element-type 'character))
;;###FIXME: The above line probably needs an :external-format
- (usocket (make-instance 'usocket :stream stream :socket socket))
+ (usocket (make-stream-socket :stream stream :socket socket))
(ip (host-to-vector-quad host)))
(with-mapped-conditions (usocket)
(sb-bsd-sockets:socket-connect socket ip port))
Modified: usocket/trunk/backend/scl.lisp
==============================================================================
--- usocket/trunk/backend/scl.lisp (original)
+++ usocket/trunk/backend/scl.lisp Wed Oct 25 15:28:16 2006
@@ -41,7 +41,7 @@
:element-type 'character
:buffering :full)))
;;###FIXME the above line probably needs an :external-format
- (make-socket :socket socket :stream stream)))
+ (make-stream-socket :socket socket :stream stream)))
(defmethod socket-close ((usocket usocket))
"Close socket."
Modified: usocket/trunk/usocket.lisp
==============================================================================
--- usocket/trunk/usocket.lisp (original)
+++ usocket/trunk/usocket.lisp Wed Oct 25 15:28:16 2006
@@ -11,19 +11,46 @@
((socket
:initarg :socket
:accessor socket
- :documentation "Implementation specific socket object instance.")
- (stream
+ :documentation "Implementation specific socket object instance."))
+ (:documentation
+"The main socket class."))
+
+(defclass stream-usocket (usocket)
+ ((stream
:initarg :stream
:accessor socket-stream
- :documentation "Implementation specific socket stream instance.")))
+ :documentation "Stream instance associated with the socket.
-(defun make-socket (&key socket stream)
+Iff an external-format was passed to `socket-connect' or `socket-listen'
+the stream is a flexi-stream. Otherwise the stream is implementation
+specific."))
+ (:documentation ""))
+
+(defclass stream-server-usocket (usocket)
+ ()
+ (:documentation ""))
+
+;;Not in use yet:
+;;(defclass datagram-usocket (usocket)
+;; ()
+;; (:documentation ""))
+
+(defun make-socket (&key socket)
+ "Create a usocket socket type from implementation specific 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."
- (make-instance 'usocket
+ (make-instance 'stream-usocket
: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 open-stream (peer-host peer-port
&key (local-host :any)
(local-port 0)