/usr/include/giomm-2.4/giomm/dbusserver.h is in libglibmm-2.4-dev 2.46.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | // -*- c++ -*-
// Generated by gmmproc 2.46.3 -- DO NOT MODIFY!
#ifndef _GIOMM_DBUSSERVER_H
#define _GIOMM_DBUSSERVER_H
#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>
// -*- 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 <glibmm/object.h>
#include <giomm/dbusconnection.h>
#include <giomm/dbusauthobserver.h>
#include <giomm/initable.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GDBusServer GDBusServer;
typedef struct _GDBusServerClass GDBusServerClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gio
{
namespace DBus
{ class Server_Class; } // namespace DBus
} // namespace Gio
#endif //DOXYGEN_SHOULD_SKIP_THIS
namespace Gio
{
namespace DBus
{
/** @addtogroup giommEnums giomm Enums and Flags */
/**
* @var ServerFlags SERVER_FLAGS_NONE
* No flags set.
*
* @var ServerFlags SERVER_FLAGS_RUN_IN_THREAD
* All DBusServer::signal_new_connection()
* signals will run in separated dedicated threads (see signal for
* details).
*
* @var ServerFlags SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS
* Allow the anonymous
* authentication method.
*
* @enum ServerFlags
*
* Flags used when creating a DBusServer.
*
* @newin{2,26}
*
* @ingroup giommEnums
* @par Bitwise operators:
* <tt>%ServerFlags operator|(ServerFlags, ServerFlags)</tt><br>
* <tt>%ServerFlags operator&(ServerFlags, ServerFlags)</tt><br>
* <tt>%ServerFlags operator^(ServerFlags, ServerFlags)</tt><br>
* <tt>%ServerFlags operator~(ServerFlags)</tt><br>
* <tt>%ServerFlags& operator|=(ServerFlags&, ServerFlags)</tt><br>
* <tt>%ServerFlags& operator&=(ServerFlags&, ServerFlags)</tt><br>
* <tt>%ServerFlags& operator^=(ServerFlags&, ServerFlags)</tt><br>
*/
enum ServerFlags
{
SERVER_FLAGS_NONE = 0x0,
SERVER_FLAGS_RUN_IN_THREAD = (1<<0),
SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1)
};
/** @ingroup giommEnums */
inline ServerFlags operator|(ServerFlags lhs, ServerFlags rhs)
{ return static_cast<ServerFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
/** @ingroup giommEnums */
inline ServerFlags operator&(ServerFlags lhs, ServerFlags rhs)
{ return static_cast<ServerFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
/** @ingroup giommEnums */
inline ServerFlags operator^(ServerFlags lhs, ServerFlags rhs)
{ return static_cast<ServerFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
/** @ingroup giommEnums */
inline ServerFlags operator~(ServerFlags flags)
{ return static_cast<ServerFlags>(~static_cast<unsigned>(flags)); }
/** @ingroup giommEnums */
inline ServerFlags& operator|=(ServerFlags& lhs, ServerFlags rhs)
{ return (lhs = static_cast<ServerFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
/** @ingroup giommEnums */
inline ServerFlags& operator&=(ServerFlags& lhs, ServerFlags rhs)
{ return (lhs = static_cast<ServerFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
/** @ingroup giommEnums */
inline ServerFlags& operator^=(ServerFlags& lhs, ServerFlags rhs)
{ return (lhs = static_cast<ServerFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
//TODO: Add example from the C API in class docs.
/** This is a helper for listening to and accepting D-Bus connections.
* Since Server derives from Initiable, its constructors can
* throw an exception if construction fails.
*
* This can be used to create a new D-Bus server, allowing two
* peers to use the D-Bus protocol for their own specialized communication.
* A server instance provided in this way will not perform message routing or
* implement the org.freedesktop.DBus interface.
*
* To just export an object on a well-known name on a message bus, such as the
* session or system bus, you should instead use Gio::DBus::own_name().
*
* @newin{2,28}
* @ingroup DBus
*/
class Server : public Glib::Object, public Initable
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef Server CppObjectType;
typedef Server_Class CppClassType;
typedef GDBusServer BaseObjectType;
typedef GDBusServerClass BaseClassType;
// noncopyable
Server(const Server&) = delete;
Server& operator=(const Server&) = delete;
private: friend class Server_Class;
static CppClassType server_class_;
protected:
explicit Server(const Glib::ConstructParams& construct_params);
explicit Server(GDBusServer* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
Server(Server&& src) noexcept;
Server& operator=(Server&& src) noexcept;
virtual ~Server() noexcept;
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
GDBusServer* gobj() { return reinterpret_cast<GDBusServer*>(gobject_); }
///Provides access to the underlying C GObject.
const GDBusServer* gobj() const { return reinterpret_cast<GDBusServer*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GDBusServer* gobj_copy();
private:
protected:
Server(const std::string& address,
const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer,
const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags);
Server(const std::string& address,
const std::string& guid,
const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags);
Server(const std::string& address,
const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer,
ServerFlags flags);
Server(const std::string& address,
const std::string& guid,
ServerFlags flags);
public:
/** Creates a new D-Bus server that listens on the first address in
* @a address that works.
*
* Once constructed, you can use g_dbus_server_get_client_address() to
* get a D-Bus address string that clients can use to connect.
*
* Connect to the DBusServer::signal_new_connection() signal to handle
* incoming connections.
*
* The returned DBusServer isn't active - you have to start it with
* g_dbus_server_start().
*
* DBusServer is used in this [example][gdbus-peer-to-peer].
*
* This is a synchronous failable constructor. See
* Glib::dbus_server_new() for the asynchronous version.
*
* @newin{2,26}
*
* @param address A D-Bus address.
* @param flags Flags from the DBusServerFlags enumeration.
* @param guid A D-Bus GUID.
* @param observer A DBusAuthObserver or <tt>0</tt>.
* @param cancellable A Cancellable or <tt>0</tt>.
* @return A DBusServer or <tt>0</tt> if @a error is set. Free with
* Glib::object_unref().
*/
/// @throw Glib::Error.
static Glib::RefPtr<Server> create_sync(const std::string& address,
const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer,
const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE);
/** Creates a new D-Bus server that listens on the first address in
* @a address that works.
*
* Once constructed, you can use g_dbus_server_get_client_address() to
* get a D-Bus address string that clients can use to connect.
*
* Connect to the DBusServer::signal_new_connection() signal to handle
* incoming connections.
*
* The returned DBusServer isn't active - you have to start it with
* g_dbus_server_start().
*
* DBusServer is used in this [example][gdbus-peer-to-peer].
*
* This is a synchronous failable constructor. See
* Glib::dbus_server_new() for the asynchronous version.
*
* @newin{2,26}
*
* @param address A D-Bus address.
* @param flags Flags from the DBusServerFlags enumeration.
* @param guid A D-Bus GUID.
* @param observer A DBusAuthObserver or <tt>0</tt>.
* @param cancellable A Cancellable or <tt>0</tt>.
* @return A DBusServer or <tt>0</tt> if @a error is set. Free with
* Glib::object_unref().
*/
/// @throw Glib::Error.
static Glib::RefPtr<Server> create_sync(const std::string& address,
const std::string& guid,
const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE);
/// Non-cancellable version of create_sync().
static Glib::RefPtr<Server> create_sync(const std::string& address,
const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer,
ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE);
/// Non-cancellable version of create_sync().
static Glib::RefPtr<Server> create_sync(const std::string& address,
const std::string& guid,
ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE);
/** Starts @a server.
*
* @newin{2,26}
*/
void start();
/** Stops @a server.
*
* @newin{2,26}
*/
void stop();
/** Gets whether @a server is active.
*
* @newin{2,26}
*
* @return <tt>true</tt> if server is active, <tt>false</tt> otherwise.
*/
bool is_active() const;
/** Gets the GUID for @a server.
*
* @newin{2,26}
*
* @return A D-Bus GUID. Do not free this string, it is owned by @a server.
*/
std::string get_guid() const;
/** Gets the flags for @a server.
*
* @newin{2,26}
*
* @return A set of flags from the DBusServerFlags enumeration.
*/
ServerFlags get_flags() const;
/** Gets a D-Bus address string that can be used by clients to connect
* to @a server.
*
* @newin{2,26}
*
* @return A D-Bus address string. Do not free, the string is owned
* by @a server.
*/
std::string get_client_address() const;
/** Whether the server is currently active.
*
* @newin{2,26}
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< bool > property_active() const;
/** The D-Bus address to listen on.
*
* @newin{2,26}
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< std::string > property_address() const;
/** A DBusAuthObserver object to assist in the authentication process or <tt>0</tt>.
*
* @newin{2,26}
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<AuthObserver> > property_authentication_observer() const;
/** The D-Bus address that clients can use.
*
* @newin{2,26}
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< std::string > property_client_address() const;
/** Flags from the DBusServerFlags enumeration.
*
* @newin{2,26}
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< ServerFlags > property_flags() const;
/** The guid of the server.
*
* @newin{2,26}
*
* @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
* or receive notification when the value of the property changes.
*/
Glib::PropertyProxy_ReadOnly< std::string > property_guid() const;
/**
* @par Slot Prototype:
* <tt>bool on_my_%new_connection(const Glib::RefPtr<Connection>& connection)</tt>
*
* Emitted when a new authenticated connection has been made. Use
* g_dbus_connection_get_peer_credentials() to figure out what
* identity (if any), was authenticated.
*
* If you want to accept the connection, take a reference to the
* @a connection object and return <tt>true</tt>. When you are done with the
* connection call g_dbus_connection_close() and give up your
* reference. Note that the other peer may disconnect at any time -
* a typical thing to do when accepting a connection is to listen to
* the DBusConnection::signal_closed() signal.
*
* If DBusServer::property_flags() contains DBUS_SERVER_FLAGS_RUN_IN_THREAD
* then the signal is emitted in a new thread dedicated to the
* connection. Otherwise the signal is emitted in the
* [thread-default main context][g-main-context-push-thread-default]
* of the thread that @a server was constructed in.
*
* You are guaranteed that signal handlers for this signal runs
* before incoming messages on @a connection are processed. This means
* that it's suitable to call g_dbus_connection_register_object() or
* similar from the signal handler.
*
* @newin{2,26}
*
* @param connection A DBusConnection for the new connection.
* @return <tt>true</tt> to claim @a connection, <tt>false</tt> to let other handlers
* run.
*/
Glib::SignalProxy1< bool,const Glib::RefPtr<Connection>& > signal_new_connection();
public:
public:
//C++ methods used to invoke GTK+ virtual functions:
protected:
//GTK+ Virtual Functions (override these to change behaviour):
//Default Signal Handlers::
};
} //namespace DBus
} // namespace Gio
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates Gio::DBus::Server
*/
Glib::RefPtr<Gio::DBus::Server> wrap(GDBusServer* object, bool take_copy = false);
}
#endif /* _GIOMM_DBUSSERVER_H */
|