1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
3 ;;; wrappers.lisp --- Wrappers for socket-related C macros.
5 ;;; Copyright (C) 2008, Stelian Ionescu <sionescu@common-lisp.net>
7 ;;; This code is free software; you can redistribute it and/or
8 ;;; modify it under the terms of the version 2.1 of
9 ;;; the GNU Lesser General Public License as published by
10 ;;; the Free Software Foundation, as clarified by the
11 ;;; preamble found here:
12 ;;; http://opensource.franz.com/preamble.html
14 ;;; This program is distributed in the hope that it will be useful,
15 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU Lesser General
20 ;;; Public License along with this library; if not, write to the
21 ;;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22 ;;; Boston, MA 02110-1301, USA
24 (in-package :net.sockets
)
26 (c "#if defined(__linux__)")
27 (define "_XOPEN_SOURCE" 600)
28 (define "_LARGEFILE_SOURCE")
29 (define "_LARGEFILE64_SOURCE")
30 (define "_FILE_OFFSET_BITS" 64)
33 (include "sys/socket.h")
35 (defwrapper* ("cmsg_space" %cmsg-space
) ("unsigned" :unsigned-int
)
36 ((data-size ("unsigned" :unsigned-int
)))
37 "return CMSG_SPACE(data_size);")
39 (defwrapper* ("cmsg_len" %cmsg-len
) ("unsigned" :unsigned-int
)
40 ((data-size ("unsigned" :unsigned-int
)))
41 "return CMSG_LEN(data_size);")
43 (defwrapper* ("cmsg_firsthdr" %cmsg-firsthdr
) ("void*" :pointer
)
44 ((msg ("struct msghdr*" :pointer
)))
45 "return CMSG_FIRSTHDR(msg);")
47 (defwrapper* ("cmsg_data" %cmsg-data
) ("void*" :pointer
)
48 ((cmsg ("struct cmsghdr*" :pointer
)))
49 "return CMSG_DATA(cmsg);")