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

/* Copyright (C) 2010 The giomm Development Team
 *
 * 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 <giomm/socketcontrolmessage.h>

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

namespace Gio
{

class Credentials;

/** UnixCredentialsMessage - A SocketControlMessage containing credentials.
 * This SocketControlMessage contains a Credentials instance. It may be sent
 * using Gio::Socket::send() and received using Gio::Socket::receive()
 * over UNIX sockets (ie: sockets in the Gio::SOCKET_FAMILY_UNIX family).
 *
 * For an easier way to send and receive credentials over stream-oriented UNIX
 * sockets, see Gio::UnixConnection::send_credentials() and
 * Gio::UnixConnection::receive_credentials(). To receive credentials of a
 * foreign process connected to a socket, use Gio::Socket::get_credentials().
 *
 * @ingroup NetworkIO
 * @newin{2,28}
 */
class UnixCredentialsMessage : public SocketControlMessage
{
  _CLASS_GOBJECT(UnixCredentialsMessage, GUnixCredentialsMessage, G_UNIX_CREDENTIALS_MESSAGE, Gio::SocketControlMessage, GSocketControlMessage)
  _GTKMMPROC_WIN32_NO_WRAP

protected:
  _CTOR_DEFAULT
  _WRAP_CTOR(UnixCredentialsMessage(const Glib::RefPtr<Credentials>& credentials), g_unix_credentials_message_new_with_credentials)

public:
  _WRAP_METHOD_DOCS_ONLY(g_unix_credentials_message_new)
  _WRAP_CREATE()

  _WRAP_METHOD_DOCS_ONLY(g_unix_credentials_message_new_with_credentials)
  _WRAP_CREATE(const Glib::RefPtr<Credentials>& credentials)

  _WRAP_METHOD(Glib::RefPtr<Credentials> get_credentials(), g_unix_credentials_message_get_credentials)
  _WRAP_METHOD(Glib::RefPtr<const Credentials> get_credentials() const, g_unix_credentials_message_get_credentials, constversion)
  _WRAP_METHOD(static bool is_supported(), g_unix_credentials_message_is_supported)

  _WRAP_PROPERTY("credentials", Glib::RefPtr<Credentials>)
};

} // namespace Gio
