1.0.22.22: (SETF FIND-CLASSOID) to drop DEFTYPE lambda-lists and source-locations
[sbcl/tcr.git] / contrib / sb-bsd-sockets / win32-sockets.lisp
blob5b20df519c60a99153084103f1270a71df4facf3
1 ;;;; win32 socket operations
2 ;;;; these have all been done by hand since I can't seem
3 ;;;; to get my head around the sb-grovel stuff
5 ;;;; Winsock requires us to convert HANDLES to/from
6 ;;;; file descriptors, so I've added an additional
7 ;;;; package for the actual winsock alien defs, and then
8 ;;;; in the sockint package, we implement wrappers that
9 ;;;; handle the conversion.
11 ;;; these are all of the basic structure alien defs
12 (in-package :sockint)
14 ;;;; we are now going back to the normal sockint
15 ;;;; package where we will redefine all of the above
16 ;;;; functions, converting between HANDLES and fds
18 (defun socket (af type proto)
19 (let* ((handle (wsa-socket af type proto nil 0 0))
20 (fd (handle->fd handle 0)))
21 fd))
23 (defun bind (fd &rest options)
24 (let ((handle (fd->handle fd)))
25 (apply #'win32-bind handle options)))
27 (defun getsockname (fd &rest options)
28 (apply #'win32-getsockname (fd->handle fd) options))
30 (defun listen (fd &rest options)
31 (apply #'win32-listen (fd->handle fd) options))
33 (defun accept (fd &rest options)
34 (handle->fd
35 (apply #'win32-accept (fd->handle fd) options)
36 0))
38 (defun recv (fd &rest options)
39 (apply #'win32-recv (fd->handle fd) options))
41 (defun recvfrom (fd &rest options)
42 (apply #'win32-recvfrom (fd->handle fd) options))
44 (defun send (fd &rest options)
45 (apply #'win32-send (fd->handle fd) options))
47 (defun sendto (fd &rest options)
48 (apply #'win32-sendto (fd->handle fd) options))
50 (defun close (fd &rest options)
51 (apply #'win32-close (fd->handle fd) options))
53 (defun connect (fd &rest options)
54 (apply #'win32-connect (fd->handle fd) options))
56 (defun getpeername (fd &rest options)
57 (apply #'win32-getpeername (fd->handle fd) options))
59 (defun ioctl (fd &rest options)
60 (apply #'win32-ioctl (fd->handle fd) options))
62 (defun setsockopt (fd &rest options)
63 (apply #'win32-setsockopt (fd->handle fd) options))
65 (defun getsockopt (fd &rest options)
66 (apply #'win32-getsockopt (fd->handle fd) options))
68 (defun make-wsa-version (major minor)
69 (dpb minor (byte 8 8) major))
71 (defvar *wsa-startup-call*
72 (wsa-startup (make-wsa-version 2 2)))
74 ;; not implemented on win32
75 (defconstant af-local 0)
76 (defconstant msg-dontwait 0)
77 (defconstant msg-trunc 0)
78 (defconstant msg-eor 0)
79 (defconstant msg-nosignal 0)
80 (defconstant msg-waitall 0)
81 (defconstant msg-eor 0)
82 (defconstant size-of-sockaddr-un 0)
83 (defun (setf sockaddr-un-family) (addr family) ())
84 (defun (setf sockaddr-un-path) (addr family) ())
85 (defun sockaddr-un-path (addr) ())
86 (defun free-sockaddr-un (addr) ())
87 (defun allocate-sockaddr-un () ())