Commit 571ffa15 authored by Chun Tian (binghe)'s avatar Chun Tian (binghe)

Initial support (template code) for IOlib

parent 186034cb
0.7.0:
0.8.0:
* New feature: IOlib backend (all usocket features are supported when IOlib is available in your platform).
0.7.0: (Oct 25, 2016)
* General: Separated USOCKET and USOCKET-SERVER systems (only the server part depends on Portable-threads)
* General: USOCKET now depends on SPLIT-SEQUENCE (the exactly same vendor code is removed from usocket code base)
......@@ -9,7 +13,7 @@
* Bugfix: [LW] fixed loading in version <= 6.0 (actually 0.6.5 only fixed loading in LW 6.1)
* Bugfix: [ECL] all compilation warnings were checked and fixed.
0.6.5:
0.6.5: (Oct 19, 2016)
* New feature: SOCKET-OPTION and (setf SOCKET-OPTION) for :SEND-TIMEOUT (thanks to John Pallister)
* Bugfix: Let (WAIT-FOR-INPUT NIL &TIMEOUT) return NIL with respect to TIMEOUT.
......@@ -17,7 +21,7 @@
* Bugfix: [LW] fixed SOCKET-SHUTDOWN in all versions.
* Bugfix: [ABCL] Fixed incorrect IPv6 addresses (#26), patch from Elias Mårtenson (lokedhs)
0.6.4:
0.6.4: (Mar 17, 2016)
* New feature: [SBCL] IPv6 support (patch from Guillaume LE VAILLANT, #15)
* New feature: [API] SOCKET-SHUTDOWN added (patch from Thayne McCombs #9)
......@@ -26,19 +30,19 @@
* Bugfix: [ECL] included unistd.h for gethostname() (patch from Daniel Kochmanski, #7)
* Bugfix: [LispWorks] SOCKET-RECEIVE now updates %READ-P (patch from Frank James)
0.6.3:
0.6.3: (May 23, 2015)
* Bugfix: [CCL] Further fixed CCL-1.11 compatibility and a typo in SOCKET-CONNECT for CCL-1.10.
* Bugfix: [ECL] Fixed build in some versions.
* Bugfix: [LispWorks] SOCKET-SEND and SOCKET-RECEIVE now throw conditions if something goes wrong.
0.6.2:
0.6.2: (Apr 20, 2015)
* Bugfix: [CCL] Fixed CCL-1.11 compatibility.
* Bugfix: [ECL] Fixed compatibility on recent versions.
* Bugfix: [LispWorks] Added support address-in-use-error condition on LW/Win32. (patch from Sergey Katrevich).
0.6.1:
0.6.1: (Jun 21, 2013)
* New feature: [MOCL] Initial MOCL support (TCP only, no W-F-I, patch from github.com/Wukix/usocket).
* New feature: [MCL] Initial UDP support for Macintosh Common Lisp (MCL/RMCL).
......@@ -46,7 +50,7 @@
* Bugfix: [CCL] Added (:external-format ccl:*default-external-format*) to SOCKET-CONNECT, to prevent it fallback to ISO-8859-1 on NIL. (Patch from Vsevolod Dyomkin)
* Bugfix: [CCL] Performance improved WAIT-FOR-INPUT and other fixes. (patch from Faré <fahree@gmail.com>)
0.6.0:
0.6.0: (Dec 26, 2012)
* New feature: SOCKET-OPTION and (setf SOCKET-OPTION) for seting and geting various socket options.
* New feature: SOCKET-SEND now support an CCL-like OFFSET keyword for sending only parts of the whole buffer.
......@@ -56,7 +60,7 @@
* Bugfix: [LispWorks] remove redundant call to hcl:flag-special-free-action. (reported by Kamil Shakirov)
* Bugfix: [CLISP] improved HANDLE-CONDITION for more CLISP environments.
0.5.5:
0.5.5: (Feb 27, 2012)
* Enhancement: SOCKET-CONNECT argument :nodelay can now set to :if-supported (patch from Anton Vodonosov).
* Enhancement: [Server] adding *remote-host* *remote-port* to socket-server stream handler functions (suggested by Matthew Curry)
......@@ -64,20 +68,20 @@
* Bugfix: [LispWorks] Stop using hcl:add-special-free-action for reclaiming unused UDP socket fds to improve multi-threading stablity (suggested by Camille Troillard).
* Bugfix: [LispWorks] Fixed SOCKET-CONNECT on Windows, now LOCAL-PORT never have *auto-port* (0) as default value.
0.5.4:
0.5.4: (Oct 1, 2011)
* Bugfix: [ECL] Fixed for ECL's MAKE-BUILD by removing some unecessary code (reported by Juan Jose Garcia-Ripoll, the ECL maintainer)
* Bugfix: [ACL] Fixed for Allegro CL modern mode.
* Bugfix: [SBCL] SOCKET-CONNECT on TCP won't call bind() when keyword arguments LOCAL-HOST or LOCAL-PORT is not set. (reported by Robert Brown)
0.5.3:
0.5.3: (Aug 13, 2011)
* Bugfix: [MCL] Fixed SOCKET-LISTEN on vector addresses like #(0 0 0 0)
* Bugfix: [MCL] Fixed WAIT-FOR-INPUT on passive sockets (stream-server-usocket)
* Bugfix: [LispWorks] Fixed using OPEN-UDP-SOCKET in delivered applications (thanks to Camille Troillard and Martin Simmons, this fix is from LispWorks-UDP project).
* Bugfix: [SBCL] Fixed for "SBCL data flush problem", reported by Robert Brown and confirmed by Nikodemus Siivola.
0.5.2:
0.5.2: (May 11, 2011)
* General: [SBCL] SOCKET-CONNECT's TIMEOUT argument was limited on non-Windows platforms.
* Bugfix: [CLISP] WAIT-FOR-INPUT now functions right (with/without READY-ONLY), this made Hunchentoot working on CLISP. (Thanks to Anton Vodonosov <avodonosov@yandex.ru>)
......@@ -88,7 +92,7 @@
* Enhancement: [ABCL] GET-ADDRESS now works with underlying IP6 addresses.
* Enhancement: [CLISP] missing GET-LOCAL-* methods for STREAM-SERVER-USOCKET was now added.
0.5.1:
0.5.1: (Apr 2, 2011)
* New feature: [CLISP] UDP (Datagram) support based on FFI (Win/Mac/Linux), no RAWSOCK needed.
* Enhancement: SOCKET-SERVER return a second value (socket) when calling in new-thread mode.
......@@ -103,7 +107,7 @@
* Bugfix: [CMUCL] Fixed SOCKET-SEND on unconnected usockets under Unicode version of CMUCL.
* Bugfix: [CLISP] Fixed and confirmed UDP (Datagram) support (RAWSOCK version).
0.5.0:
0.5.0: (Mar 12, 2011)
* New supported platform: Macintosh Common Lisp (5.0 and up, plus RMCL)
* Support for UDP (datagram-usocket) was added (for all supported platform except MCL)
......@@ -112,6 +116,66 @@
* Completely rewritten full-feature ABCL backends using latest Java interfaces
* Lots of bug fixed since 0.4.1
[TODO]
0.4.1: (Dec 27, 2008)
* fixes for ECL, LispWorks, SBCL, SCL
0.4.0: (Oct 28, 2008)
* select()-like api: make a single thread wait for multiple sockets.
* various socket options for socket-creation with SOCKET-CONNECT.
0.3.6: (Jun 21, 2008)
* Code fixups based on advice from the ECL and OpenMCL maintainers.
* New exported symbols: WITH-MAPPED-CONDITIONS, NS-CONDITION, NS-ERROR, NS-UNKNOWN-ERROR and NS-UNKNOWN-CONDITION.
0.3.4: (Jul 25, 2007)
* Fix clisp get-host-name, multiple ECL fixes.
0.3.3: (Jun 05, 2007)
* Fix where host resolution routine was unable to resolve would return NIL instead of erroring.
0.3.2: (Mar 04, 2007)
* Fixes for many backends related to closing sockets.
* LispWorks fix for broken server sockets.
* API guarantee adjustments in preparation of porting Drakma.
0.3.1: (Feb 28, 2007)
* fixed with-server-socket; prevent creation of invalid sockets; 2 more convenience macros.
0.3.0: (Jan 21, 2007)
* Server sockets
0.2.5: (Jan 19, 2007)
* Allegro compilation fix.
0.2.4: (Jan 17, 2007)
* Various fixes for CMUCL, OpenMCL, Allegro and LispWorks.
0.2.3: (Jan 04, 2007)
* Add :element-type support to support stacking flexi-streams on socket streams for portable :external-format support.
0.2.2: (Jan 03, 2007)
* Add ECL support and a small SBCL bugfix.
0.2.1: (Dec 21, 2006)
* Remove 'open-stream' interface which is supposed to be provided by the 'trivial-usocket' package.
0.2.0: (Dec 18, 2006)
* Add support for Scieneer Common Lisp, fix issue #6 and API preparation for server side sockets (not in this release)
0.1.0: (Feb 13, 2006)
* New feature: CLISP support some advanced TCP features which CLISP's SOCKET interface not provide
* Initial release
;;;; $Id$
;;;; $URL$
;;;; New ABCL networking support (replacement to old armedbear.lisp)
;;;; Author: Chun Tian (binghe)
......@@ -8,6 +5,9 @@
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
;;; Java Classes ($*...)
(defvar $*boolean (jclass "boolean"))
(defvar $*byte (jclass "byte"))
......
......@@ -2,6 +2,9 @@
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
#+cormanlisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(require :acl-socket))
......
;;;; $Id$
;;;; $URL$
;;;; See LICENSE for licensing information.
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
(eval-when (:compile-toplevel :load-toplevel :execute)
#-ffi
(warn "This image doesn't contain FFI package, GET-HOST-NAME won't work.")
......
;;;; -*- Mode: Lisp -*-
;;;; $Id$
;;;; $URL$
;;;; Foreign functions defined by ECL's DFFI, used for #+ecl-bytecmp only.
;;;; See LICENSE for licensing information.
......
;;;; See LICENSE for licensing information.
(in-package :usocket)
;; all SOCKET-OPTIONs shuold be implemented here
(defgeneric socket-option (socket option &key)
(:documentation
"Get a socket's internal options"))
(defgeneric (setf socket-option) (new-value socket option &key)
(:documentation
"Set a socket's internal options"))
;;; Handling of wrong type of arguments
(defmethod socket-option ((socket usocket) (option t) &key)
(error 'type-error :datum option :expected-type 'keyword))
(defmethod (setf socket-option) (new-value (socket usocket) (option t) &key)
(declare (ignore new-value))
(socket-option socket option))
(defmethod socket-option ((socket usocket) (option symbol) &key)
(if (keywordp option)
(error 'unimplemented :feature option :context 'socket-option)
(error 'type-error :datum option :expected-type 'keyword)))
(defmethod (setf socket-option) (new-value (socket usocket) (option symbol) &key)
(declare (ignore new-value))
(if (keywordp option)
(error 'unimplemented :feature option :context 'socket-option)
(error 'type-error :datum option :expected-type 'keyword)))
;;; Socket option: RECEIVE-TIMEOUT (SO_RCVTIMEO)
(defmethod socket-option ((usocket stream-usocket)
(option (eql :receive-timeout)) &key)
(declare (ignorable option))
(let ((socket (socket usocket)))
))
(defmethod (setf socket-option) (new-value (usocket stream-usocket)
(option (eql :receive-timeout)) &key)
(declare (type number new-value) (ignorable new-value option))
(let ((socket (socket usocket))
(timeout new-value))
timeout))
;;; Socket option: SEND-TIMEOUT (SO_SNDTIMEO)
(defmethod socket-option ((usocket stream-usocket)
(option (eql :send-timeout)) &key)
(declare (ignorable option))
(let ((socket (socket usocket)))
))
(defmethod (setf socket-option) (new-value (usocket stream-usocket)
(option (eql :send-timeout)) &key)
(declare (type number new-value) (ignorable new-value option))
(let ((socket (socket usocket))
(timeout new-value))
timeout))
;;; Socket option: REUSE-ADDRESS (SO_REUSEADDR), for TCP server
(defmethod socket-option ((usocket stream-server-usocket)
(option (eql :reuse-address)) &key)
(declare (ignorable option))
(let ((socket (socket usocket)))
))
(defmethod (setf socket-option) (new-value (usocket stream-server-usocket)
(option (eql :reuse-address)) &key)
(declare (type boolean new-value) (ignorable new-value option))
(let ((socket (socket usocket)))
new-value))
;;; Socket option: BROADCAST (SO_BROADCAST), for UDP client
(defmethod socket-option ((usocket datagram-usocket)
(option (eql :broadcast)) &key)
(declare (ignorable option))
(let ((socket (socket usocket)))
))
(defmethod (setf socket-option) (new-value (usocket datagram-usocket)
(option (eql :broadcast)) &key)
(declare (type boolean new-value) (ignorable new-value option))
(let ((socket (socket usocket)))
new-value))
;;; Socket option: TCP-NODELAY (TCP_NODELAY), for TCP client
(defmethod socket-option ((usocket stream-usocket)
(option (eql :tcp-no-delay)) &key)
(declare (ignore option))
(socket-option usocket :tcp-nodelay))
(defmethod socket-option ((usocket stream-usocket)
(option (eql :tcp-nodelay)) &key)
(declare (ignorable option))
(let ((socket (socket usocket)))
))
(defmethod (setf socket-option) (new-value (usocket stream-usocket)
(option (eql :tcp-no-delay)) &key)
(declare (ignore option))
(setf (socket-option usocket :tcp-nodelay) new-value))
(defmethod (setf socket-option) (new-value (usocket stream-usocket)
(option (eql :tcp-nodelay)) &key)
(declare (type boolean new-value) (ignorable new-value option))
(let ((socket (socket usocket)))
new-value))
;;;; See LICENSE for licensing information.
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :iolib))
(defun get-host-name ()
)
(defparameter +iolib-error-map+
'((:address-in-use . address-in-use-error)
(:address-not-available . address-not-available-error)
(:network-down . network-down-error)
(:network-reset . network-reset-error)
(:network-unreachable . network-unreachable-error)
(:connection-aborted . connection-aborted-error)
(:connection-reset . connection-reset-error)
(:no-buffer-space . no-buffers-error)
(:shutdown . shutdown-error)
(:connection-timed-out . timeout-error)
(:connection-refused . connection-refused-error)
(:host-down . host-down-error)
(:host-unreachable . host-unreachable-error)))
(defun handle-condition (condition &optional (socket nil))
)
(defun socket-connect (host port &key (protocol :stream) (element-type 'character)
timeout deadline
(nodelay t) ;; nodelay == t is the ACL default
local-host local-port)
)
(defmethod socket-close ((usocket usocket))
)
(defmethod socket-shutdown ((usocket stream-usocket) direction)
)
(defun socket-listen (host port
&key reuseaddress
(reuse-address nil reuse-address-supplied-p)
(backlog 5)
(element-type 'character))
)
(defmethod socket-accept ((socket stream-server-usocket) &key element-type)
)
(defmethod get-local-address ((usocket usocket))
)
(defmethod get-peer-address ((usocket stream-usocket))
)
(defmethod get-local-port ((usocket usocket))
)
(defmethod get-peer-port ((usocket stream-usocket))
)
(defmethod get-local-name ((usocket usocket))
(values (get-local-address usocket)
(get-local-port usocket)))
(defmethod get-peer-name ((usocket stream-usocket))
(values (get-peer-address usocket)
(get-peer-port usocket)))
(defmethod socket-send ((usocket datagram-usocket) buffer size &key host port (offset 0))
)
(defmethod socket-receive ((socket datagram-usocket) buffer length &key)
)
(defun get-host-by-address (address)
)
(defun get-hosts-by-name (name)
)
(defun %setup-wait-list (wait-list)
)
(defun %add-waiter (wait-list waiter)
)
(defun %remove-waiter (wait-list waiter)
)
(defun wait-for-input-internal (wait-list &key timeout)
)
......@@ -2,6 +2,9 @@
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
(eval-when (:compile-toplevel :load-toplevel :execute)
(require "comm")
......
;;;; $Id$
;;;; $URL$
;; MCL backend for USOCKET 0.4.1
;; Terje Norderhaug <terje@in-progress.com>, January 1, 2009
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
(defun handle-condition (condition &optional socket)
; incomplete, needs to handle additional conditions
(flet ((raise-error (&optional socket-condition)
......
;;;; $Id$
;;;; $URL$
;;;; See LICENSE for licensing information.
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
(defun handle-condition (condition &optional (socket nil))
"Dispatch correct usocket condition."
(declare (ignore socket))
......
......@@ -2,6 +2,9 @@
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
(defun get-host-name ()
(ccl::%stack-block ((resultbuf 256))
(when (zerop (#_gethostname resultbuf 256))
......
......@@ -4,6 +4,9 @@
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
#+sbcl
(progn
#-win32
......
;;;; $Id$
;;;; $URL$
;;;; See LICENSE for licensing information.
(in-package :usocket)
(eval-when (:load-toplevel :execute)
(setq *backend* :native))
(defparameter +scl-error-map+
(append +unix-errno-condition-map+
+unix-errno-error-map+))
......
;;;; $Id$
;;;; $URL$
;;;; See LICENSE for licensing information.
(in-package :usocket)
......
;;;; See the LICENSE file for licensing information.
(unless (find-package :usocket) ; do not redefine packages
(defpackage :usocket
(:use :common-lisp #+abcl :java
:split-sequence)
(:use :common-lisp :split-sequence #+abcl :java)
(:export #:*version*
#:*backend*
#:*wildcard-host*
#:*auto-port*
......@@ -84,3 +85,4 @@
#:insufficient-implementation ; conditions regarding usocket support level
#:unsupported
#:unimplemented))
) ; unless
......@@ -4,10 +4,10 @@
(in-package :asdf)
(defsystem usocket-server
(defsystem #:usocket-server
:name "usocket (server)"
:author "Chun Tian (binghe)"
:version "0.7.0"
:version "0.8.0-dev"
:licence "MIT"
:description "Universal socket library for Common Lisp (server side)"
:depends-on (:usocket :portable-threads)
......
......@@ -4,36 +4,52 @@
(in-package :asdf)
(defsystem usocket
;;; NOTE: the key "art" here is, no need to recompile any file when switching
;;; between a native backend and IOlib backend. -- Chun Tian (binghe)
#+sample
(pushnew :usocket-iolib *features*)
(defsystem #:usocket
:name "usocket (client)"
:author "Erik Enge & Erik Huelsmann"
:maintainer "Chun Tian (binghe) & Hans Huebner"
:version "0.7.0"
:version "0.8.0-dev"
:licence "MIT"
:description "Universal socket library for Common Lisp"
:depends-on (#+(or sbcl ecl) :sb-bsd-sockets
:split-sequence)
:depends-on (:split-sequence
#+(and (or sbcl ecl) (not usocket-iolib)) :sb-bsd-sockets
#+usocket-iolib :iolib)
:components ((:file "package")
(:module "vendor" :depends-on ("package")
:components (#+mcl (:file "kqueue")
#+mcl (:file "OpenTransportUDP")))
(:file "usocket" :depends-on ("vendor"))
(:file "condition" :depends-on ("usocket"))
#-usocket-iolib
(:module "backend" :depends-on ("condition")
:components (#+abcl (:file "abcl")
#+(or allegro cormanlisp)
(:file "allegro")
#+clisp (:file "clisp")
#+(or openmcl clozure)
(:file "openmcl")
#+clozure (:file "clozure" :depends-on ("openmcl"))
#+cmu (:file "cmucl")
#+(or sbcl ecl) (:file "sbcl")
#+ecl (:file "ecl" :depends-on ("sbcl"))
#+lispworks (:file "lispworks")
#+mcl (:file "mcl")
#+mocl (:file "mocl")
#+openmcl (:file "openmcl")
#+(or ecl sbcl) (:file "sbcl")
#+scl (:file "scl")))
(:file "option" :depends-on ("backend"))))
#+scl (:file "scl")
#+usocket-iolib (:file "iolib")))
#-usocket-iolib
(:file "option" :depends-on ("backend"))
#+usocket-iolib
(:module "backend" :depends-on ("condition")
:components ((:file "iolib" :depends-on ("iolib-sockopt"))
(:file "iolib-sockopt")))
))
(defmethod perform ((op test-op) (c (eql (find-system :usocket))))
(oos 'load-op :usocket-server)
......
......@@ -2,6 +2,8 @@
(in-package :usocket)
(defvar *backend*) ; either :native or :iolib
(defparameter *wildcard-host* #(0 0 0 0)
"Hostname to pass when all interfaces in the current system are to
be bound. If this variable is passed to socket-listen, IPv6 capable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment