Gjsify LogoGjsify Logo

Interface DBusMessageFilterFunction

Hierarchy

  • DBusMessageFilterFunction

Callable

  • Signature for function used in g_dbus_connection_add_filter().

    A filter function is passed a #GDBusMessage and expected to return a #GDBusMessage too. Passive filter functions that don't modify the message can simply return the message object: |[ static GDBusMessage * passive_filter (GDBusConnection *connection GDBusMessage *message, gboolean incoming, gpointer user_data) { // inspect message return message; }


    Filter functions that wants to drop a message can simply return %NULL:
    |[
    static GDBusMessage *
    drop_filter (GDBusConnection *connection
    GDBusMessage *message,
    gboolean incoming,
    gpointer user_data)
    {
    if (should_drop_message)
    {
    g_object_unref (message);
    message = NULL;
    }
    return message;
    }

    Finally, a filter function may modify a message by copying it: |[ static GDBusMessage * modifying_filter (GDBusConnection *connection GDBusMessage *message, gboolean incoming, gpointer user_data) { GDBusMessage *copy; GError *error;

    error = NULL; copy = g_dbus_message_copy (message, &error); // handle error being set g_object_unref (message);

    // modify copy

    return copy; }


    If the returned #GDBusMessage is different from `message` and cannot
    be sent on `connection` (it could use features, such as file
    descriptors, not compatible with `connection)`, then a warning is
    logged to standard error. Applications can
    check this ahead of time using g_dbus_message_to_blob() passing a
    #GDBusCapabilityFlags value obtained from `connection`.
    @callback
    @param connection A #GDBusConnection.
    @param message A locked #GDBusMessage that the filter function takes ownership of.
    @param incoming %TRUE if it is a message received from the other peer, %FALSE if it is a message to be sent to the other peer.

    Parameters

    Returns DBusMessage

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method