[usocket-cvs] r431 - in usocket/branches/experimental-udp: . backend
Chun Tian (binghe)
ctian at common-lisp.net
Mon Oct 13 02:05:30 UTC 2008
Author: ctian
Date: Mon Oct 13 02:05:28 2008
New Revision: 431
Log:
[udp] use :datagram instead of :udp, extend HOST-TO-HBO to support NIL
Modified:
usocket/branches/experimental-udp/backend/allegro.lisp
usocket/branches/experimental-udp/backend/cmucl.lisp
usocket/branches/experimental-udp/backend/openmcl.lisp
usocket/branches/experimental-udp/backend/sbcl.lisp
usocket/branches/experimental-udp/package.lisp
usocket/branches/experimental-udp/server.lisp
usocket/branches/experimental-udp/usocket.lisp
Modified: usocket/branches/experimental-udp/backend/allegro.lisp
==============================================================================
--- usocket/branches/experimental-udp/backend/allegro.lisp (original)
+++ usocket/branches/experimental-udp/backend/allegro.lisp Mon Oct 13 02:05:28 2008
@@ -64,7 +64,7 @@
(labels ((make-socket ()
(socket:make-socket :remote-host (host-to-hostname host)
:remote-port port
- :local-host (when local-host (host-to-hostname local-host))
+ :local-host (host-to-hostname local-host)
:local-port local-port
:format (to-format element-type)
:nodelay nodelay)))
@@ -79,13 +79,13 @@
:connect :active
:remote-host (host-to-hostname host)
:remote-port port
- :local-host (when local-host (host-to-hostname local-host))
+ :local-host (host-to-hostname local-host)
:local-port local-port
:format (to-format element-type))
(socket:make-socket :type :datagram
:address-family :internet
:local-host local-host
- :local-port (when local-host (host-to-hostname local-host))
+ :local-port (host-to-hostname local-host)
:format (to-format element-type)))))))
(ecase protocol
(:stream
Modified: usocket/branches/experimental-udp/backend/cmucl.lisp
==============================================================================
--- usocket/branches/experimental-udp/backend/cmucl.lisp (original)
+++ usocket/branches/experimental-udp/backend/cmucl.lisp Mon Oct 13 02:05:28 2008
@@ -67,8 +67,7 @@
(setf socket
(with-mapped-conditions (socket)
(ext:connect-to-inet-socket (host-to-hbo host) port :stream
- :local-host (if local-host
- (host-to-hbo local-host))
+ :local-host (host-to-hbo local-host)
:local-port local-port)))
(if socket
(let* ((stream (sys:make-fd-stream socket :input t :output t
@@ -84,8 +83,7 @@
(if (and host port)
(setf socket (with-mapped-conditions (socket)
(ext:connect-to-inet-socket (host-to-hbo host) port :datagram
- :local-host (if local-host
- (host-to-hbo local-host))
+ :local-host (host-to-hbo local-host)
:local-port local-port)))
(progn
(setf socket (with-mapped-conditions (socket)
Modified: usocket/branches/experimental-udp/backend/openmcl.lisp
==============================================================================
--- usocket/branches/experimental-udp/backend/openmcl.lisp (original)
+++ usocket/branches/experimental-udp/backend/openmcl.lisp Mon Oct 13 02:05:28 2008
@@ -81,9 +81,9 @@
(ecase protocol
(:stream
(let ((mcl-sock
- (openmcl-socket:make-socket :remote-host (host-to-hostname host)
+ (openmcl-socket:make-socket :remote-host (host-to-hbo host)
:remote-port port
- :local-host (when local-host (host-to-hostname local-host))
+ :local-host (host-to-hbo local-host)
:local-port local-port
:format (to-format element-type)
:deadline deadline
@@ -96,8 +96,7 @@
(let ((mcl-sock
(openmcl-socket:make-socket :address-family :internet
:type :datagram
- :local-host (if local-host
- (host-to-hbo local-host))
+ :local-host (host-to-hbo local-host)
:local-port local-port)))
(when (and host port)
(ccl::inet-connect (ccl::socket-device mcl-sock)
@@ -140,7 +139,7 @@
(defmethod socket-send ((usocket datagram-usocket) buffer length &key address port)
(with-mapped-conditions (usocket)
(openmcl-socket:send-to (socket usocket) buffer length
- :remote-host (if address (host-to-hbo address))
+ :remote-host (host-to-hbo address)
:remote-port port)))
(defmethod socket-receive ((usocket datagram-usocket) buffer length)
Modified: usocket/branches/experimental-udp/backend/sbcl.lisp
==============================================================================
--- usocket/branches/experimental-udp/backend/sbcl.lisp (original)
+++ usocket/branches/experimental-udp/backend/sbcl.lisp Mon Oct 13 02:05:28 2008
@@ -240,10 +240,11 @@
(sb-bsd-sockets:socket-connect socket ip port))
usocket))
(:datagram
- (when (and local-host local-port)
+ (when (or local-host local-port)
(sb-bsd-sockets:socket-bind socket
- (host-to-vector-quad local-host)
- local-port))
+ (host-to-vector-quad
+ (or local-host *wildcard-host*))
+ (or local-port *auto-port*)))
(when (and host port)
(sb-bsd-sockets:socket-connect socket (host-to-hbo host) port))
(make-datagram-socket socket)))
Modified: usocket/branches/experimental-udp/package.lisp
==============================================================================
--- usocket/branches/experimental-udp/package.lisp (original)
+++ usocket/branches/experimental-udp/package.lisp Mon Oct 13 02:05:28 2008
@@ -80,25 +80,4 @@
#:insufficient-implementation ; conditions regarding usocket support level
#:unsupported
- #:unimplemented)
-
- #+lispworks
- (:import-from :comm
- #:*socket_af_inet*
- #:*socket_pf_unspec*
- #:*sockopt_sol_socket*
- #:%send
- #:bind
- #:close-socket
- #:connect
- #:getsockopt
- #:in_addr
- #:initialize-sockaddr_in
- #:ntohl
- #:ntohs
- #:s_addr
- #:setsockopt
- #:sin_addr
- #:sin_port
- #:sockaddr
- #:sockaddr_in))
+ #:unimplemented))
Modified: usocket/branches/experimental-udp/server.lisp
==============================================================================
--- usocket/branches/experimental-udp/server.lisp (original)
+++ usocket/branches/experimental-udp/server.lisp Mon Oct 13 02:05:28 2008
@@ -10,7 +10,7 @@
&key (element-type '(unsigned-byte 8)) (timeout 1)
(max-buffer-size +max-datagram-packet-size+))
(let ((socket (socket-connect nil nil
- :protocol :udp
+ :protocol :datagram
:local-host host
:local-port port
:element-type element-type))
Modified: usocket/branches/experimental-udp/usocket.lisp
==============================================================================
--- usocket/branches/experimental-udp/usocket.lisp (original)
+++ usocket/branches/experimental-udp/usocket.lisp Mon Oct 13 02:05:28 2008
@@ -407,6 +407,7 @@
(defun host-to-hostname (host)
"Translate a string or vector quad to a stringified hostname."
(etypecase host
+ (null nil)
(string host)
((or (vector t 4)
(array (unsigned-byte 8) (4)))
@@ -460,6 +461,7 @@
(defun host-to-hbo (host)
(etypecase host
+ (null nil)
(string (let ((ip (ignore-errors
(dotted-quad-to-vector-quad host))))
(if (and ip (= 4 (length ip)))
More information about the usocket-cvs
mailing list