summaryrefslogtreecommitdiff
path: root/gio/src/unixconnection.hg
blob: 3b157ab3ebe26eb2a4be97fab04e024ab73b17ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* 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, see <http://www.gnu.org/licenses/>.
 */

#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 GIOMM_API UnixConnection : public Gio::SocketConnection
{
    _CLASS_GOBJECT(UnixConnection, GUnixConnection, G_UNIX_CONNECTION, Gio::SocketConnection, GSocketConnection, , , GIOMM_API)
    _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)

  /**  Asynchronously receive credentials.
   * For more details, see receive_credentials() which is the synchronous
   * version of this call.
   *
   * When the operation is finished, @a slot will be called. You can then call
   * receive_credentials_finish() to get the result of the operation.
   *
   * @param slot A SlotAsyncReady to call when the request is satisfied.
   * @param cancellable A Cancellable object.
   * @newin{2,36}
   */
  void receive_credentials_async(const SlotAsyncReady& slot,
    const Glib::RefPtr<Cancellable>& cancellable);
  _IGNORE(g_unix_connection_receive_credentials_async)

  /// A non-cancellable version of receive_credentials_async().
  void receive_credentials_async(const SlotAsyncReady& slot);

  _WRAP_METHOD(Glib::RefPtr<Credentials> receive_credentials_finish(const Glib::RefPtr<AsyncResult>& result), g_unix_connection_receive_credentials_finish, errthrow)

    _WRAP_METHOD(bool send_credentials(const Glib::RefPtr<Cancellable>& cancellable{?}), g_unix_connection_send_credentials, errthrow)

  /**  Asynchronously send credentials.
   * For more details, see send_credentials() which is the synchronous version
   * of this call.
   *
   * When the operation is finished, @a slot will be called. You can then call
   * send_credentials_finish() to get the result of the operation.
   *
   * @param slot A SlotAsyncReady to call when the request is satisfied.
   * @param cancellable A Cancellable object.
   * @newin{2,36}
   */
  void send_credentials_async(const SlotAsyncReady& slot,
    const Glib::RefPtr<Cancellable>& cancellable);
  _IGNORE(g_unix_connection_send_credentials_async)

  /// A non-cancellable version of send_credentials_async().
  void send_credentials_async(const SlotAsyncReady& slot);

  _WRAP_METHOD(bool send_credentials_finish(const Glib::RefPtr<AsyncResult>& result), g_unix_connection_send_credentials_finish, errthrow)
};

} // namespace Gio