summaryrefslogtreecommitdiff
path: root/gio/src/unixsocketaddress.hg
blob: 5fe8010df62ba1117e8a8aae61416c2b63e1589d (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
/* 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/socketaddress.h>

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

namespace Gio
{

_WRAP_ENUM(UnixSocketAddressType, GUnixSocketAddressType)

class ByteArray;

/** UnixSocketAddress - UNIX SocketAddress.
 * Support for UNIX-domain (also known as local) sockets.
 *
 * UNIX domain sockets are generally visible in the filesystem. However, some
 * systems support abstract socket names which are not visible in the
 * filesystem and not affected by the filesystem permissions, visibility, etc.
 * Currently this is only supported under Linux. If you attempt to use
 * abstract sockets on other systems, function calls may return
 * Gio::IO_ERROR_NOT_SUPPORTED errors. You can use
 * Gio::UnixSocketAddress::abstract_names_supported() to see if abstract names
 * are supported.
 *
 * Note that @c <giomm/unixsocketaddress.h> belongs to the UNIX-specific GIO
 * interfaces.
 * @newin{2,28}
 * @ingroup NetworkIO
 */
class UnixSocketAddress
: public SocketAddress
{
  _CLASS_GOBJECT(UnixSocketAddress, GUnixSocketAddress, G_UNIX_SOCKET_ADDRESS, SocketAddress, GSocketAddress)
  _GTKMMPROC_WIN32_NO_WRAP

protected:
 _WRAP_CTOR(UnixSocketAddress(const std::string& path), g_unix_socket_address_new)

 //TODO: Possibly add when g_unix_socket_address_new_with_type() does not do
 //more than call g_object_new() (maybe file a bug).
 //_WRAP_CTOR(UnixSocketAddress(const std::string& path, int path_len = -1, UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_PATH), g_unix_socket_address_new_with_type)

public:
 _WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new)
 _WRAP_CREATE(const std::string& path)

 //TODO: Add when the above constructor is included, removing the handwritten
 //create() method for it below.
 //_WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new_with_type)
 //_WRAP_CREATE(const std::string& path, int path_len = -1, UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_PATH)

 _WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new_with_type)
 static Glib::RefPtr<UnixSocketAddress> create(const std::string& path,
   UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_ABSTRACT,
   int path_len = -1);

 // Deprecated.
 _IGNORE(g_unix_socket_address_get_is_abstract)

 _WRAP_METHOD(UnixSocketAddressType get_address_type() const, g_unix_socket_address_get_address_type)
 _WRAP_METHOD(std::string get_path() const, g_unix_socket_address_get_path)
 _IGNORE(g_unix_socket_address_get_path_len)

 _WRAP_METHOD(static bool abstract_names_supported(), g_unix_socket_address_abstract_names_supported)

  _WRAP_PROPERTY("abstract", bool, deprecated "Use property_address_type() instead, which distinguishes between zero-padded and non-zero-padded abstract addresses.")
  _WRAP_PROPERTY("address-type", UnixSocketAddressType)
  _WRAP_PROPERTY("path", std::string)
  _WRAP_PROPERTY("path-as-array", Glib::RefPtr<ByteArray>)
};

} // namespace Gio