0.9.7.11:
[sbcl/tcr.git] / contrib / sb-bsd-sockets / local.lisp
blob53a7f85b5dbee0efbea0096882c065d8eef2f8e2
1 (in-package :sb-bsd-sockets)
3 (defclass local-socket (socket)
4 ((family :initform sockint::af-local))
5 (:documentation "Class representing local domain (AF_LOCAL) sockets,
6 also known as unix-domain sockets."))
8 (defmethod make-sockaddr-for ((socket local-socket)
9 &optional sockaddr &rest address &aux (filename (first address)))
10 (let ((sockaddr (or sockaddr (sockint::allocate-sockaddr-un))))
11 (setf (sockint::sockaddr-un-family sockaddr) sockint::af-local)
12 (when filename
13 (setf (sockint::sockaddr-un-path sockaddr) filename))
14 sockaddr))
16 (defmethod free-sockaddr-for ((socket local-socket) sockaddr)
17 (sockint::free-sockaddr-un sockaddr))
19 (defmethod size-of-sockaddr ((socket local-socket))
20 sockint::size-of-sockaddr-un)
22 (defmethod bits-of-sockaddr ((socket local-socket) sockaddr)
23 "Return the file name of the local socket address SOCKADDR."
24 (let ((name (sockint::sockaddr-un-path sockaddr)))
25 (if (zerop (length name)) nil name)))