Permalink
Browse files

asynchronous network library, Lisp wrapper and examples

  • Loading branch information...
FrankBuss committed May 20, 2007
1 parent 18e4842 commit dd5ade49bce130668251bb99ee73ace924df2e47
Showing with 5,190 additions and 0 deletions.
  1. +16 −0 lispbuilder-net/cffi/library.lisp
  2. +72 −0 lispbuilder-net/cffi/net.lisp
  3. +49 −0 lispbuilder-net/cffi/package.lisp
  4. +17 −0 lispbuilder-net/documentation/COPYING
  5. +358 −0 lispbuilder-net/documentation/doxygen.css
  6. BIN lispbuilder-net/documentation/doxygen.png
  7. +12 −0 lispbuilder-net/documentation/index.html
  8. +667 −0 lispbuilder-net/documentation/net_8h.html
  9. BIN lispbuilder-net/documentation/tab_b.gif
  10. BIN lispbuilder-net/documentation/tab_l.gif
  11. BIN lispbuilder-net/documentation/tab_r.gif
  12. +102 −0 lispbuilder-net/documentation/tabs.css
  13. +9 −0 lispbuilder-net/examples/package.lisp
  14. +200 −0 lispbuilder-net/examples/webserver.lisp
  15. +86 −0 lispbuilder-net/examples/wget.lisp
  16. +17 −0 lispbuilder-net/lispbuilder-net-cffi.asd
  17. +13 −0 lispbuilder-net/lispbuilder-net-examples.asd
  18. +14 −0 lispbuilder-net/lispbuilder-net.asd
  19. +8 −0 lispbuilder-net/net/package.lisp
  20. +1,257 −0 net/Doxyfile
  21. +81 −0 net/SConstruct
  22. +6 −0 net/build-doc.cmd
  23. +6 −0 net/build-linux.sh
  24. +6 −0 net/build-macosx.sh
  25. +6 −0 net/build-win32.cmd
  26. +80 −0 net/client.c
  27. +17 −0 net/documentation/COPYING
  28. +358 −0 net/documentation/doxygen.css
  29. BIN net/documentation/doxygen.png
  30. +667 −0 net/documentation/net_8h.html
  31. BIN net/documentation/tab_b.gif
  32. BIN net/documentation/tab_l.gif
  33. BIN net/documentation/tab_r.gif
  34. +102 −0 net/documentation/tabs.css
  35. +115 −0 net/main.c
  36. +4 −0 net/make-linux.sh
  37. +4 −0 net/make-mac.sh
  38. +27 −0 net/net-common.c
  39. +77 −0 net/net-linux.c
  40. +95 −0 net/net-mac.c
  41. +149 −0 net/net-unix.c
  42. +34 −0 net/net-unix.h
  43. +229 −0 net/net-windows.c
  44. +147 −0 net/net.h
  45. +83 −0 net/server.c
@@ -0,0 +1,16 @@
(in-package #:lispbuilder-net-cffi)
(eval-when (:compile-toplevel :load-toplevel :execute)
(defun get-library-path (suffix)
(merge-pathnames (concatenate 'string "../bin-" suffix)
(directory-namestring (or *load-truename* *default-pathname-defaults*))))
#+darwin(pushnew (get-library-path "macosx/") cffi:*foreign-library-directories* :test #'equal)
#+win32(pushnew (get-library-path "win32/") cffi:*foreign-library-directories* :test #'equal)
#+unix(pushnew (get-library-path "linux/") cffi:*foreign-library-directories* :test #'equal))
(cffi:define-foreign-library net
(:darwin "libnet.dylib")
(:windows "net.dll")
(:unix "libnet.so"))
(cffi:use-foreign-library net)
@@ -0,0 +1,72 @@
(in-package #:lispbuilder-net-cffi)
(defconstant NET_STARTUP_FAILED -1)
(defconstant NET_CLEANUP_FAILED -2)
(defconstant NET_BIND_FAILED -3)
(defconstant NET_CREATE_SOCKET_FAILED -4)
(defconstant NET_GET_HOST_BY_NAME_FAILED -5)
(defconstant NET_LISTEN_FAILED -6)
(defconstant NET_ACCEPT_FAILED -7)
(defconstant NET_CLOSE_SOCKET_FAILED -8)
(defconstant NET_CONNECT_FAILED -9)
(defconstant NET_WOULD_BLOCK -10)
(defconstant NET_WRITE_FAILED -11)
(defconstant NET_READ_FAILED -12)
(defconstant NET_LOOP_FAILED -13)
(defcfun ("netRegisterReadCallback" netRegisterReadCallback) :void
(callback :pointer))
(defcfun ("netRegisterWriteCallback" netRegisterWriteCallback) :void
(callback :pointer))
(defcfun ("netRegisterErrorCallback" netRegisterErrorCallback) :void
(callback :pointer))
(defcfun ("netStartup" netStartup) :int)
(defcfun ("netCleanup" netCleanup) :int)
(defcfun ("netCreateSocket" netCreateSocket) :int
(socketHandle :pointer))
(defcfun ("netCreateServerSocket" netCreateServerSocket) :int
(address :string)
(port :int)
(socketHandle :pointer))
(defcfun ("netListen" netListen) :int
(serverSocket :int)
(backlog :int))
(defcfun ("netConnect" netConnect) :int
(socket :int)
(address :string)
(port :int))
(defcfun ("netAccept" netAccept) :int
(serverSocket :int)
(ipAddress :pointer)
(socketHandle :pointer))
(defcfun ("netCloseSocket" netCloseSocket) :int
(socket :int))
(defcfun ("netWait" netWait) :void
(millisecondsTimeout :int))
(defcfun ("netWrite" netWrite) :int
(socket :int)
(data :pointer)
(size :int))
(defcfun ("netRead" netRead) :int
(socket :int)
(data :pointer)
(size :int))
(defcfun ("netSleep" netSleep) :void
(milliseconds :int))
(defcfun ("netFree" netFree) :void
(pointer :pointer))
@@ -0,0 +1,49 @@
;;;; lispbuilder-net
;;;; (C) 2007 Frank Buss <fb@frank-buss.de>
(in-package #:cl-user)
(defpackage #:lispbuilder-net-cffi
(:use #:cl #:cffi)
(:nicknames #:net-cffi)
(:documentation "The basic wrapper package of `lispbuilder-net'.")
(:export
#:*default-surface*
#:*default-display*
#:NET_STARTUP_FAILED
#:NET_CLEANUP_FAILED
#:NET_BIND_FAILED
#:NET_CREATE_SOCKET_FAILED
#:NET_GET_HOST_BY_NAME_FAILED
#:NET_LISTEN_FAILED
#:NET_ACCEPT_FAILED
#:NET_CLOSE_SOCKET_FAILED
#:NET_CONNECT_FAILED
#:NET_WOULD_BLOCK
#:NET_WRITE_FAILED
#:NET_READ_FAILED
#:NET_LOOP_FAILED
#:NET_STARTUP_FAILED
#:NET_STARTUP_FAILED
#:NET_STARTUP_FAILED
#:NET_STARTUP_FAILED
#:NET_STARTUP_FAILED
#:NET_STARTUP_FAILED
#:NET_STARTUP_FAILED
#:netRegisterReadCallback
#:netRegisterWriteCallback
#:netRegisterErrorCallback
#:netStartup
#:netCleanup
#:netCreateSocket
#:netCreateServerSocket
#:netListen
#:netConnect
#:netAccept
#:netCloseSocket
#:netWait
#:netWrite
#:netRead
#:netSleep
#:netFree))
@@ -0,0 +1,17 @@
Asynchronous sockets library and sample code
(C) 2007 Frank Buss
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the .Software.), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED .AS IS., WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Oops, something went wrong.

0 comments on commit dd5ade4

Please sign in to comment.