## EggDBusPeer EggDBusPeer — Minimal peering interface |

## Synopsis

                        EggDBusPeer;
                        EggDBusPeerIface;
    #define             EGG_DBUS_QUERY_INTERFACE_PEER       (object_proxy)
    gboolean            egg_dbus_peer_ping_sync             (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             GCancellable *cancellable,
                                                             GError **error);
    gboolean            egg_dbus_peer_get_machine_id_sync   (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             gchar **out_machine_uuid,
                                                             GCancellable *cancellable,
                                                             GError **error);
    guint               egg_dbus_peer_ping                  (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            egg_dbus_peer_ping_finish           (EggDBusPeer *instance,
                                                             GAsyncResult *res,
                                                             GError **error);
    guint               egg_dbus_peer_get_machine_id        (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            egg_dbus_peer_get_machine_id_finish (EggDBusPeer *instance,
                                                             gchar **out_machine_uuid,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                egg_dbus_peer_handle_ping_finish    (EggDBusMethodInvocation *method_invocation);
    void                egg_dbus_peer_handle_get_machine_id_finish
                                                            (EggDBusMethodInvocation *method_invocation,
                                                             const gchar *out_machine_uuid);

## Object Hierarchy

      GInterface
       +----EggDBusPeer

## Prerequisites

EggDBusPeer requires GObject.

## Description

All D-Bus objects are supposed to implement the EggDBusPeer D-Bus interface. The interface is designed to be a minimal interface for checking whether the other end is reachable and, if so, what machine hosts the object.

## Details

### EggDBusPeer

    typedef struct _EggDBusPeer EggDBusPeer;

### EggDBusPeerIface

    typedef struct {
      EggDBusInterfaceIface g_iface;

      void (* handle_ping) (
          EggDBusPeer *instance,
          EggDBusMethodInvocation *method_invocation);

      void (* handle_get_machine_id) (
          EggDBusPeer *instance,
          EggDBusMethodInvocation *method_invocation);
    } EggDBusPeerIface;

Interface VTable for implementing the org.freedesktop.DBus.Peer D-Bus interface.

EggDBusInterfaceIface `g_iface`; | The parent interface.
`handle_ping` () | A method used to diagnose whether an object is reachable.
`handle_get_machine_id` () | Gets the Machine UUID of the machine hosting the object.

### EGG_DBUS_QUERY_INTERFACE_PEER()

    #define EGG_DBUS_QUERY_INTERFACE_PEER(object_proxy) (EGG_DBUS_PEER (egg_dbus_object_proxy_query_interface (object_proxy, EGG_DBUS_TYPE_PEER)))

Convenience macro to get an interface proxy for the remote object represented by `object_proxy`. See `egg_dbus_object_proxy_query_interface()` for details.

`object_proxy` : | A EggDBusObjectProxy.
Returns : | An instance derived from EggDBusInterfaceProxy that implements the EggDBusPeer interface. This instance can be used to access the org.freedesktop.DBus.Peer D-Bus interface on the remote object represented by `object_proxy`. Do not ref or unref the returned instance, it is owned by `object_proxy`.

### egg_dbus_peer_ping_sync ()

    gboolean            egg_dbus_peer_ping_sync             (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             GCancellable *cancellable,
                                                             GError **error);

A method used to diagnose whether an object is reachable.

This function synchronously invokes the Ping() method on the org.freedesktop.DBus.Peer interface on the object represented by `instance`. See `egg_dbus_peer_ping()` for the asynchronous version of this function.

`instance` : | A EggDBusPeer.
`call_flags` : | Flags from EggDBusCallFlags detailing how the method should be invoked.
`cancellable` : | A GCancellable or `NULL`.
`error` : | Return location for error.
Returns : | `TRUE` if the method call succeeded, `FALSE` if `error` is set.

### egg_dbus_peer_get_machine_id_sync ()

    gboolean            egg_dbus_peer_get_machine_id_sync   (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             gchar **out_machine_uuid,
                                                             GCancellable *cancellable,
                                                             GError **error);

Gets the Machine UUID of the machine hosting the object.

This function synchronously invokes the GetMachineId() method on the org.freedesktop.DBus.Peer interface on the object represented by `instance`. See `egg_dbus_peer_get_machine_id()` for the asynchronous version of this function.

`instance` : | A EggDBusPeer.
`call_flags` : | Flags from EggDBusCallFlags detailing how the method should be invoked.
`out_machine_uuid` : | A Universally Unique Identifier for the machine hosting the object. See the D-Bus specification for more information about D-Bus UUIDs. Free with `g_free()`.
`cancellable` : | A GCancellable or `NULL`.
`error` : | Return location for error.
Returns : | `TRUE` if the method call succeeded, `FALSE` if `error` is set.

### egg_dbus_peer_ping ()

    guint               egg_dbus_peer_ping                  (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

A method used to diagnose whether an object is reachable.

This function asynchronously invokes the Ping() method on the org.freedesktop.DBus.Peer interface on the object represented by `instance`. When the reply is ready, `callback` will be called (on the main thread). You can then call `egg_dbus_peer_ping_finish()` to get the result. See `egg_dbus_peer_ping_sync()` for the synchronous version of this function.

`instance` : | A EggDBusPeer.
`call_flags` : | Flags from EggDBusCallFlags detailing how the method should be invoked.
`cancellable` : | A GCancellable or `NULL`.
`callback` : | Callback to invoke when the reply is ready.
`user_data` : | User data to pass to `callback`.
Returns : | A pending call id (never zero) that can be used with `egg_dbus_connection_pending_call_cancel()` or `egg_dbus_connection_pending_call_block()`.

### egg_dbus_peer_ping_finish ()

    gboolean            egg_dbus_peer_ping_finish           (EggDBusPeer *instance,
                                                             GAsyncResult *res,
                                                             GError **error);

Finishes an asynchronous method invocation started with `egg_dbus_peer_ping()`.

`instance` : | A EggDBusPeer.
`res` : | A GAsyncResult obtained from the GAsyncReadyCallback function passed to `egg_dbus_peer_ping()`.
`error` : | Return location for error.
Returns : | `TRUE` if the method call succeeded, `FALSE` if `error` is set.

### egg_dbus_peer_get_machine_id ()

    guint               egg_dbus_peer_get_machine_id        (EggDBusPeer *instance,
                                                             EggDBusCallFlags call_flags,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Gets the Machine UUID of the machine hosting the object.

This function asynchronously invokes the GetMachineId() method on the org.freedesktop.DBus.Peer interface on the object represented by `instance`. When the reply is ready, `callback` will be called (on the main thread). You can then call `egg_dbus_peer_get_machine_id_finish()` to get the result. See `egg_dbus_peer_get_machine_id_sync()` for the synchronous version of this function.

`instance` : | A EggDBusPeer.
`call_flags` : | Flags from EggDBusCallFlags detailing how the method should be invoked.
`cancellable` : | A GCancellable or `NULL`.
`callback` : | Callback to invoke when the reply is ready.
`user_data` : | User data to pass to `callback`.
Returns : | A pending call id (never zero) that can be used with `egg_dbus_connection_pending_call_cancel()` or `egg_dbus_connection_pending_call_block()`.

### egg_dbus_peer_get_machine_id_finish ()

    gboolean            egg_dbus_peer_get_machine_id_finish (EggDBusPeer *instance,
                                                             gchar **out_machine_uuid,
                                                             GAsyncResult *res,
                                                             GError **error);

Finishes an asynchronous method invocation started with `egg_dbus_peer_get_machine_id()`.

`instance` : | A EggDBusPeer.
`out_machine_uuid` : | A Universally Unique Identifier for the machine hosting the object. See the D-Bus specification for more information about D-Bus UUIDs. Free with `g_free()`.
`res` : | A GAsyncResult obtained from the GAsyncReadyCallback function passed to `egg_dbus_peer_get_machine_id()`.
`error` : | Return location for error.
Returns : | `TRUE` if the method call succeeded, `FALSE` if `error` is set.

### egg_dbus_peer_handle_ping_finish ()

    void                egg_dbus_peer_handle_ping_finish    (EggDBusMethodInvocation *method_invocation);

Function to be called by implementers of the org.freedesktop.DBus.Peer D-Bus interface to finish handling the Ping() method.

`method_invocation` : | A EggDBusMethodInvocation.

### egg_dbus_peer_handle_get_machine_id_finish ()

    void                egg_dbus_peer_handle_get_machine_id_finish
                                                            (EggDBusMethodInvocation *method_invocation,
                                                             const gchar *out_machine_uuid);

Function to be called by implementers of the org.freedesktop.DBus.Peer D-Bus interface to finish handling the GetMachineId() method.

`machine_uuid` : | A Universally Unique Identifier for the machine hosting the object. See the D-Bus specification for more information about D-Bus UUIDs.
`method_invocation` : | A EggDBusMethodInvocation.