ekg2
plugins/dbus/dbus.h
Idź do dokumentacji tego pliku.
00001 #ifndef __EKG2_DBUS_H
00002 #define __EKG2_DBUS_H
00003 
00004 #define DBUS_API_SUBJECT_TO_CHANGE
00005 #include <dbus/dbus.h>
00006 
00007 #define DBUS_ORG_FREEDESKTOP_IM_INTERFACE "org.freedesktop.im"
00008 
00009 #define EKG2_DBUS_IFACE_HANDLER(x) DBusHandlerResult x(DBusConnection *conn, DBusMessage *msg, void *data)
00010 
00011 struct ekg2_dbus_iface_proto {
00012         char *ifaceline;
00013         char *name;
00014         DBusHandleMessageFunction handler;
00015 };
00016 typedef struct ekg2_dbus_iface_proto ekg2_dbus_iface_proto_t;
00017 
00018 struct ekg2_dbus_iface_function {
00019         char *name;
00020         int type; /* DBUS_MESSAGE_TYPE_METHOD_CALL or DBUS_MESSAGE_TYPE_SIGNAL */
00021         DBusHandleMessageFunction handler;
00022 };
00023 typedef struct ekg2_dbus_iface_function ekg2_dbus_iface_function_t;
00024 
00025 #define EKG2_DBUS_CALL_HANDLER_VARIABLES DBusMessage *reply; \
00026                 DBusMessageIter args; \
00027                 dbus_uint32_t serial = 0;
00028 
00029 #define EKG2_DBUS_INIT_REPLY reply = dbus_message_new_method_return(msg); \
00030                 dbus_message_iter_init_append(reply, &args)
00031 
00032 #define EKG2_DBUS_ADD(type, x) do { \
00033                         if (!dbus_message_iter_append_basic(&args, type, (x) )) { \
00034                                 debug("%s cannot allocate memory?\n", __FUNCTION__); \
00035                                 ekg_oom_handler(); \
00036                         } \
00037                 } while(0)
00038 
00039 #define EKG2_DBUS_ADD_STRING(x) EKG2_DBUS_ADD(DBUS_TYPE_STRING, x)
00040 
00041 #define EKG2_DBUS_SEND_REPLY do {  \
00042                         if (!dbus_connection_send(conn, reply, &serial)) { \
00043                                 debug("Cannot send reply!\n"); \
00044                                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; /* XXX */ \
00045                         } \
00046                         dbus_connection_flush(conn); \
00047                 } while(0)
00048         
00049 #endif /* __EKG2_DBUS_H */
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje