From: Michael 'Mickey' Lauer Date: Mon, 1 Feb 2010 23:14:33 +0000 (+0100) Subject: dbus-glib-1: bind more lowlevel (raw) dbus entities from libdbus X-Git-Tag: 0.7.10~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a860b10d5965aa85a40b77e37a116cd103b8cc09;p=thirdparty%2Fvala.git dbus-glib-1: bind more lowlevel (raw) dbus entities from libdbus This allows us to do more advanced things such as constructing or inspecting method calls part by part. --- diff --git a/vapi/dbus-glib-1.vapi b/vapi/dbus-glib-1.vapi index 92704111c..b0de83354 100644 --- a/vapi/dbus-glib-1.vapi +++ b/vapi/dbus-glib-1.vapi @@ -1,6 +1,6 @@ /* dbus-glib-1.vala * - * Copyright (C) 2007-2009 Jürg Billeter + * Copyright (C) 2007-2010 Jürg Billeter * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,6 +18,7 @@ * * Author: * Jürg Billeter + * Michael 'Mickey' Lauer */ [CCode (cheader_filename = "dbus/dbus-glib-lowlevel.h,dbus/dbus-glib.h")] @@ -29,12 +30,12 @@ namespace DBus { STARTER } + [CCode (lower_case_cprefix = "dbus_bus_")] namespace RawBus { - [CCode (cname = "dbus_bus_get")] public static RawConnection get (BusType type, ref RawError error); } - [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection")] + [CCode (ref_function = "dbus_connection_ref", unref_function = "dbus_connection_unref", cname = "DBusConnection", cprefix = "dbus_connection_")] public class RawConnection { [CCode (cname = "dbus_connection_setup_with_g_main")] public void setup_with_main (GLib.MainContext? context = null); @@ -42,6 +43,17 @@ namespace DBus { public Connection get_g_connection (); [CCode (cname = "dbus_connection_register_g_object")] public void register_object (string at_path, GLib.Object object); + + public bool send (RawMessage message, uint32 client_serial); + public RawMessage send_with_reply_and_block (RawMessage message, int timeout_milliseconds, ref RawError error); + + public bool add_filter (RawHandleMessageFunction function, RawFreeFunction? free_data_function = null); + public void remove_filter (RawHandleMessageFunction function); + + [CCode (cname = "dbus_bus_add_match")] + public void add_match (string rule, ref RawError error); + [CCode (cname = "dbus_bus_remove_match")] + public void remove_match (string rule, ref RawError error); } [CCode (cname = "DBusError", cprefix = "dbus_error_", destroy_function = "dbus_error_free")] @@ -54,6 +66,107 @@ namespace DBus { public bool is_set (); } + [CCode (cname = "DBusFreeFunction", has_target = false)] + public delegate void* RawFreeFunction (void* memory); + [CCode (cname = "DBusHandleMessageFunction", instance_pos = -1)] + public delegate RawHandlerResult RawHandleMessageFunction(RawConnection connection, RawMessage message); + + [CCode (cname = "DBusHandlerResult", cprefix = "DBUS_HANDLER_RESULT_")] + public enum RawHandlerResult { + HANDLED, + NOT_YET_HANDLED, + NEED_MEMORY + } + + [CCode (cname = "DBusMessageIter", cprefix = "dbus_message_iter_")] + public struct RawMessageIter { + public bool has_next (); + public bool next (); + public string get_signature (); + public int get_arg_type (); + public int get_element_type (); + public void recurse (RawMessageIter sub); + public void get_basic (void* value); + + [CCode (cname = "dbus_message_type_from_string")] + public static int type_from_string (string type); + [CCode (cname = "dbus_message_type_to_string")] + public static string type_to_string (int type); + } + + [CCode (ref_function = "dbus_message_ref", unref_function = "dbus_message_unref", cname = "DBusMessage", cprefix = "dbus_message_")] + public class RawMessage { + [CCode (cname = "dbus_message_new_method_call")] + public RawMessage.call (string bus_name, string path, string interface, string method); + [CCode (sentinel = "DBUS_TYPE_INVALID")] + public bool append_args (RawType first_arg_type, ...); + [CCode (cname = "dbus_message_iter_init")] + public bool iter_init( RawMessageIter iter ); + + public RawMessageType get_type (); + public bool set_path (string object_path); + public unowned string get_path (); + public bool has_path (string object_path); + public bool set_interface (string iface); + public unowned string get_interface (); + public bool has_interface (string iface); + public bool set_member (string member); + public unowned string get_member (); + public bool has_member (string member); + public bool set_error_name (string name); + public unowned string get_error_name (); + public bool set_destination (string destination); + public unowned string get_destination (); + public bool set_sender (string sender); + public unowned string get_sender (); + public unowned string get_signature (); + public void set_no_reply (bool no_reply); + public bool get_no_reply (); + public bool is_method_call (string iface, string method); + public bool is_signal (string iface, string signal_name); + public bool is_error (string error_name); + public bool has_destination (string bus_name); + public bool has_sender (string unique_bus_name); + public bool has_signature (string signature); + public uint32 get_serial (); + public void set_serial (uint32 serial); + public bool set_reply_serial (uint32 reply_serial); + public uint32 get_reply_serial (); + public void set_auto_start (bool auto_start); + public bool get_auto_start (); + public bool get_path_decomposed (out char[] path ); + } + + [CCode (cprefix = "DBUS_MESSAGE_TYPE_")] + public enum RawMessageType { + INVALID, + METHOD_CALL, + METHOD_RETURN, + ERROR, + SIGNAL + } + + [CCode (cprefix = "DBUS_TYPE_")] + public enum RawType { + INVALID, + BYTE, + BOOLEAN, + INT16, + UINT16, + INT32, + UINT32, + INT64, + UINT64, + DOUBLE, + STRING, + OBJECT_PATH, + SIGNATURE, + ARRAY, + VARIANT, + STRUCT, + DICT_ENTRY, + } + [DBus (name = "org.freedesktop.DBus.Error")] [CCode (cname = "DBusGError", lower_case_csuffix = "gerror", cprefix = "DBUS_GERROR_")] public errordomain Error {