// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2010 Jonathon Jongsma
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>
#include <giomm/socketconnection.h>

_DEFS(giomm,gio)
_PINCLUDE(giomm/private/socketconnection_p.h)

namespace Gio
{

/**
 * A Unix domain SocketConnection
 *
 * This is the subclass of SocketConnection that is created
 * for UNIX domain sockets.
 *
 * It contains functions to do some of the unix socket specific
 * functionallity like passing file descriptors.
 *
 * @newin{2,24}
 * @ingroup NetworkIO
 */
class UnixConnection : public Gio::SocketConnection
{
    _CLASS_GOBJECT(UnixConnection, GUnixConnection, G_UNIX_CONNECTION, Gio::SocketConnection, GSocketConnection)
    _GTKMMPROC_WIN32_NO_WRAP

public:
    _WRAP_METHOD(bool send_fd(int fd, const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_send_fd, errthrow)
    _WRAP_METHOD(int receive_fd(const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_receive_fd, errthrow)

    _WRAP_METHOD(Glib::RefPtr<Credentials> receive_credentials(const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_receive_credentials, errthrow)
    _WRAP_METHOD(Glib::RefPtr<const Credentials> receive_credentials(const Glib::RefPtr<Cancellable>& cancellable) const, g_unix_connection_receive_credentials, errthrow, constversion)
    _WRAP_METHOD(bool send_credentials(const Glib::RefPtr<Cancellable>& cancellable), g_unix_connection_send_credentials, errthrow)
};

} // namespace Gio
