gdbus: add and use helpers for table declarations
[framework/connectivity/connman.git] / gdbus / object.c
1 /*
2  *
3  *  D-Bus helper library
4  *
5  *  Copyright (C) 2004-2011  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <stdio.h>
29 #include <string.h>
30
31 #include <glib.h>
32 #include <dbus/dbus.h>
33
34 #include "gdbus.h"
35
36 #define info(fmt...)
37 #define error(fmt...)
38 #define debug(fmt...)
39
40 struct generic_data {
41         unsigned int refcount;
42         GSList *interfaces;
43         char *introspect;
44 };
45
46 struct interface_data {
47         char *name;
48         const GDBusMethodTable *methods;
49         const GDBusSignalTable *signals;
50         const GDBusPropertyTable *properties;
51         void *user_data;
52         GDBusDestroyFunction destroy;
53 };
54
55 struct security_data {
56         GDBusPendingReply pending;
57         DBusMessage *message;
58         const GDBusMethodTable *method;
59         void *iface_user_data;
60 };
61
62 static void print_arguments(GString *gstr, const char *sig,
63                                                 const char *direction)
64 {
65         int i;
66
67         for (i = 0; sig[i]; i++) {
68                 char type[32];
69                 int struct_level, dict_level;
70                 unsigned int len;
71                 gboolean complete;
72
73                 complete = FALSE;
74                 struct_level = dict_level = 0;
75
76                 /* Gather enough data to have a single complete type */
77                 for (len = 0; len < (sizeof(type) - 1) && sig[i]; len++, i++) {
78                         switch (sig[i]) {
79                         case '(':
80                                 struct_level++;
81                                 break;
82                         case ')':
83                                 struct_level--;
84                                 if (struct_level <= 0 && dict_level <= 0)
85                                         complete = TRUE;
86                                 break;
87                         case '{':
88                                 dict_level++;
89                                 break;
90                         case '}':
91                                 dict_level--;
92                                 if (struct_level <= 0 && dict_level <= 0)
93                                         complete = TRUE;
94                                 break;
95                         case 'a':
96                                 break;
97                         default:
98                                 if (struct_level <= 0 && dict_level <= 0)
99                                         complete = TRUE;
100                                 break;
101                         }
102
103                         type[len] = sig[i];
104
105                         if (complete)
106                                 break;
107                 }
108
109                 type[len + 1] = '\0';
110
111                 if (!complete) {
112                         error("Unexpected signature: %s", sig);
113                         return;
114                 }
115
116                 if (direction)
117                         g_string_append_printf(gstr,
118                                         "\t\t\t<arg type=\"%s\" direction=\"%s\"/>\n",
119                                         type, direction);
120                 else
121                         g_string_append_printf(gstr,
122                                         "\t\t\t<arg type=\"%s\"/>\n",
123                                         type);
124         }
125 }
126
127 static void generate_interface_xml(GString *gstr, struct interface_data *iface)
128 {
129         const GDBusMethodTable *method;
130         const GDBusSignalTable *signal;
131
132         for (method = iface->methods; method && method->name; method++) {
133                 if (!strlen(method->signature) && !strlen(method->reply))
134                         g_string_append_printf(gstr, "\t\t<method name=\"%s\"/>\n",
135                                                                 method->name);
136                 else {
137                         g_string_append_printf(gstr, "\t\t<method name=\"%s\">\n",
138                                                                 method->name);
139                         print_arguments(gstr, method->signature, "in");
140                         print_arguments(gstr, method->reply, "out");
141                         g_string_append_printf(gstr, "\t\t</method>\n");
142                 }
143         }
144
145         for (signal = iface->signals; signal && signal->name; signal++) {
146                 if (!strlen(signal->signature))
147                         g_string_append_printf(gstr, "\t\t<signal name=\"%s\"/>\n",
148                                                                 signal->name);
149                 else {
150                         g_string_append_printf(gstr, "\t\t<signal name=\"%s\">\n",
151                                                                 signal->name);
152                         print_arguments(gstr, signal->signature, NULL);
153                         g_string_append_printf(gstr, "\t\t</signal>\n");
154                 }
155         }
156 }
157
158 static void generate_introspection_xml(DBusConnection *conn,
159                                 struct generic_data *data, const char *path)
160 {
161         GSList *list;
162         GString *gstr;
163         char **children;
164         int i;
165
166         g_free(data->introspect);
167
168         gstr = g_string_new(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE);
169
170         g_string_append_printf(gstr, "<node>\n");
171
172         for (list = data->interfaces; list; list = list->next) {
173                 struct interface_data *iface = list->data;
174
175                 g_string_append_printf(gstr, "\t<interface name=\"%s\">\n",
176                                                                 iface->name);
177
178                 generate_interface_xml(gstr, iface);
179
180                 g_string_append_printf(gstr, "\t</interface>\n");
181         }
182
183         if (!dbus_connection_list_registered(conn, path, &children))
184                 goto done;
185
186         for (i = 0; children[i]; i++)
187                 g_string_append_printf(gstr, "\t<node name=\"%s\"/>\n",
188                                                                 children[i]);
189
190         dbus_free_string_array(children);
191
192 done:
193         g_string_append_printf(gstr, "</node>\n");
194
195         data->introspect = g_string_free(gstr, FALSE);
196 }
197
198 static DBusMessage *introspect(DBusConnection *connection,
199                                 DBusMessage *message, void *user_data)
200 {
201         struct generic_data *data = user_data;
202         DBusMessage *reply;
203
204         if (!dbus_message_has_signature(message, DBUS_TYPE_INVALID_AS_STRING)) {
205                 error("Unexpected signature to introspect call");
206                 return NULL;
207         }
208
209         if (data->introspect == NULL)
210                 generate_introspection_xml(connection, data,
211                                                 dbus_message_get_path(message));
212
213         reply = dbus_message_new_method_return(message);
214         if (reply == NULL)
215                 return NULL;
216
217         dbus_message_append_args(reply, DBUS_TYPE_STRING, &data->introspect,
218                                         DBUS_TYPE_INVALID);
219
220         return reply;
221 }
222
223 static DBusHandlerResult process_message(DBusConnection *connection,
224                         DBusMessage *message, const GDBusMethodTable *method,
225                                                         void *iface_user_data)
226 {
227         DBusMessage *reply;
228
229         reply = method->function(connection, message, iface_user_data);
230
231         if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY) {
232                 if (reply != NULL)
233                         dbus_message_unref(reply);
234                 return DBUS_HANDLER_RESULT_HANDLED;
235         }
236
237         if (method->flags & G_DBUS_METHOD_FLAG_ASYNC) {
238                 if (reply == NULL)
239                         return DBUS_HANDLER_RESULT_HANDLED;
240         }
241
242         if (reply == NULL)
243                 return DBUS_HANDLER_RESULT_NEED_MEMORY;
244
245         dbus_connection_send(connection, reply, NULL);
246         dbus_message_unref(reply);
247
248         return DBUS_HANDLER_RESULT_HANDLED;
249 }
250
251 static GDBusPendingReply next_pending = 1;
252 static GSList *pending_security = NULL;
253
254 static const GDBusSecurityTable *security_table = NULL;
255
256 void g_dbus_pending_success(DBusConnection *connection,
257                                         GDBusPendingReply pending)
258 {
259         GSList *list;
260
261         for (list = pending_security; list; list = list->next) {
262                 struct security_data *secdata = list->data;
263
264                 if (secdata->pending != pending)
265                         continue;
266
267                 pending_security = g_slist_remove(pending_security, secdata);
268
269                 process_message(connection, secdata->message,
270                                 secdata->method, secdata->iface_user_data);
271
272                 dbus_message_unref(secdata->message);
273                 g_free(secdata);
274                 return;
275         }
276 }
277
278 void g_dbus_pending_error_valist(DBusConnection *connection,
279                                 GDBusPendingReply pending, const char *name,
280                                         const char *format, va_list args)
281 {
282         GSList *list;
283
284         for (list = pending_security; list; list = list->next) {
285                 struct security_data *secdata = list->data;
286                 DBusMessage *reply;
287
288                 if (secdata->pending != pending)
289                         continue;
290
291                 pending_security = g_slist_remove(pending_security, secdata);
292
293                 reply = g_dbus_create_error_valist(secdata->message,
294                                                         name, format, args);
295                 if (reply != NULL) {
296                         dbus_connection_send(connection, reply, NULL);
297                         dbus_message_unref(reply);
298                 }
299
300                 dbus_message_unref(secdata->message);
301                 g_free(secdata);
302                 return;
303         }
304 }
305
306 void g_dbus_pending_error(DBusConnection *connection,
307                                 GDBusPendingReply pending,
308                                 const char *name, const char *format, ...)
309 {
310         va_list args;
311
312         va_start(args, format);
313
314         g_dbus_pending_error_valist(connection, pending, name, format, args);
315
316         va_end(args);
317 }
318
319 int polkit_check_authorization(DBusConnection *conn,
320                                 const char *action, gboolean interaction,
321                                 void (*function) (dbus_bool_t authorized,
322                                                         void *user_data),
323                                                 void *user_data, int timeout);
324
325 struct builtin_security_data {
326         DBusConnection *conn;
327         GDBusPendingReply pending;
328 };
329
330 static void builtin_security_result(dbus_bool_t authorized, void *user_data)
331 {
332         struct builtin_security_data *data = user_data;
333
334         if (authorized == TRUE)
335                 g_dbus_pending_success(data->conn, data->pending);
336         else
337                 g_dbus_pending_error(data->conn, data->pending,
338                                                 DBUS_ERROR_AUTH_FAILED, NULL);
339
340         g_free(data);
341 }
342
343 static void builtin_security_function(DBusConnection *conn,
344                                                 const char *action,
345                                                 gboolean interaction,
346                                                 GDBusPendingReply pending)
347 {
348         struct builtin_security_data *data;
349
350         data = g_new0(struct builtin_security_data, 1);
351         data->conn = conn;
352         data->pending = pending;
353
354         if (polkit_check_authorization(conn, action, interaction,
355                                 builtin_security_result, data, 30000) < 0)
356                 g_dbus_pending_error(conn, pending, NULL, NULL);
357 }
358
359 static gboolean check_privilege(DBusConnection *conn, DBusMessage *msg,
360                         const GDBusMethodTable *method, void *iface_user_data)
361 {
362         const GDBusSecurityTable *security;
363
364         for (security = security_table; security && security->privilege;
365                                                                 security++) {
366                 struct security_data *secdata;
367                 gboolean interaction;
368
369                 if (security->privilege != method->privilege)
370                         continue;
371
372                 secdata = g_new(struct security_data, 1);
373                 secdata->pending = next_pending++;
374                 secdata->message = dbus_message_ref(msg);
375                 secdata->method = method;
376                 secdata->iface_user_data = iface_user_data;
377
378                 pending_security = g_slist_prepend(pending_security, secdata);
379
380                 if (security->flags & G_DBUS_SECURITY_FLAG_ALLOW_INTERACTION)
381                         interaction = TRUE;
382                 else
383                         interaction = FALSE;
384
385                 if (!(security->flags & G_DBUS_SECURITY_FLAG_BUILTIN) &&
386                                                         security->function)
387                         security->function(conn, security->action,
388                                                 interaction, secdata->pending);
389                 else
390                         builtin_security_function(conn, security->action,
391                                                 interaction, secdata->pending);
392
393                 return TRUE;
394         }
395
396         return FALSE;
397 }
398
399 static void generic_unregister(DBusConnection *connection, void *user_data)
400 {
401         struct generic_data *data = user_data;
402
403         g_free(data->introspect);
404         g_free(data);
405 }
406
407 static struct interface_data *find_interface(GSList *interfaces,
408                                                 const char *name)
409 {
410         GSList *list;
411
412         if (name == NULL)
413                 return NULL;
414
415         for (list = interfaces; list; list = list->next) {
416                 struct interface_data *iface = list->data;
417                 if (!strcmp(name, iface->name))
418                         return iface;
419         }
420
421         return NULL;
422 }
423
424 static DBusHandlerResult generic_message(DBusConnection *connection,
425                                         DBusMessage *message, void *user_data)
426 {
427         struct generic_data *data = user_data;
428         struct interface_data *iface;
429         const GDBusMethodTable *method;
430         const char *interface;
431
432         interface = dbus_message_get_interface(message);
433
434         iface = find_interface(data->interfaces, interface);
435         if (iface == NULL)
436                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
437
438         for (method = iface->methods; method &&
439                         method->name && method->function; method++) {
440                 if (dbus_message_is_method_call(message, iface->name,
441                                                         method->name) == FALSE)
442                         continue;
443
444                 if (dbus_message_has_signature(message,
445                                                 method->signature) == FALSE)
446                         continue;
447
448                 if (check_privilege(connection, message, method,
449                                                 iface->user_data) == TRUE)
450                         return DBUS_HANDLER_RESULT_HANDLED;
451
452                 return process_message(connection, message, method,
453                                                         iface->user_data);
454         }
455
456         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
457 }
458
459 static DBusObjectPathVTable generic_table = {
460         .unregister_function    = generic_unregister,
461         .message_function       = generic_message,
462 };
463
464 static void invalidate_parent_data(DBusConnection *conn, const char *child_path)
465 {
466         struct generic_data *data = NULL;
467         char *parent_path, *slash;
468
469         parent_path = g_strdup(child_path);
470         slash = strrchr(parent_path, '/');
471         if (slash == NULL)
472                 goto done;
473
474         if (slash == parent_path && parent_path[1] != '\0')
475                 parent_path[1] = '\0';
476         else
477                 *slash = '\0';
478
479         if (!strlen(parent_path))
480                 goto done;
481
482         if (dbus_connection_get_object_path_data(conn, parent_path,
483                                                         (void *) &data) == FALSE) {
484                 goto done;
485         }
486
487         invalidate_parent_data(conn, parent_path);
488
489         if (data == NULL)
490                 goto done;
491
492         g_free(data->introspect);
493         data->introspect = NULL;
494
495 done:
496         g_free(parent_path);
497 }
498
499 static const GDBusMethodTable introspect_methods[] = {
500         { _GDBUS_METHOD("Introspect", "", "s", NULL,
501                         GDBUS_ARGS({ "xml", "s" }), introspect) },
502         { }
503 };
504
505 static void add_interface(struct generic_data *data, const char *name,
506                                 const GDBusMethodTable *methods,
507                                 const GDBusSignalTable *signals,
508                                 const GDBusPropertyTable *properties,
509                                 void *user_data,
510                                 GDBusDestroyFunction destroy)
511 {
512         struct interface_data *iface;
513
514         iface = g_new0(struct interface_data, 1);
515         iface->name = g_strdup(name);
516         iface->methods = methods;
517         iface->signals = signals;
518         iface->properties = properties;
519         iface->user_data = user_data;
520         iface->destroy = destroy;
521
522         data->interfaces = g_slist_append(data->interfaces, iface);
523 }
524
525 static struct generic_data *object_path_ref(DBusConnection *connection,
526                                                         const char *path)
527 {
528         struct generic_data *data;
529
530         if (dbus_connection_get_object_path_data(connection, path,
531                                                 (void *) &data) == TRUE) {
532                 if (data != NULL) {
533                         data->refcount++;
534                         return data;
535                 }
536         }
537
538         data = g_new0(struct generic_data, 1);
539         data->refcount = 1;
540
541         data->introspect = g_strdup(DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE "<node></node>");
542
543         if (!dbus_connection_register_object_path(connection, path,
544                                                 &generic_table, data)) {
545                 g_free(data->introspect);
546                 g_free(data);
547                 return NULL;
548         }
549
550         invalidate_parent_data(connection, path);
551
552         add_interface(data, DBUS_INTERFACE_INTROSPECTABLE,
553                         introspect_methods, NULL, NULL, data, NULL);
554
555         return data;
556 }
557
558 static gboolean remove_interface(struct generic_data *data, const char *name)
559 {
560         struct interface_data *iface;
561
562         iface = find_interface(data->interfaces, name);
563         if (iface == NULL)
564                 return FALSE;
565
566         data->interfaces = g_slist_remove(data->interfaces, iface);
567
568         if (iface->destroy)
569                 iface->destroy(iface->user_data);
570
571         g_free(iface->name);
572         g_free(iface);
573
574         return TRUE;
575 }
576
577 static void object_path_unref(DBusConnection *connection, const char *path)
578 {
579         struct generic_data *data = NULL;
580
581         if (dbus_connection_get_object_path_data(connection, path,
582                                                 (void *) &data) == FALSE)
583                 return;
584
585         if (data == NULL)
586                 return;
587
588         data->refcount--;
589
590         if (data->refcount > 0)
591                 return;
592
593         remove_interface(data, DBUS_INTERFACE_INTROSPECTABLE);
594
595         invalidate_parent_data(connection, path);
596
597         dbus_connection_unregister_object_path(connection, path);
598 }
599
600 static gboolean check_signal(DBusConnection *conn, const char *path,
601                                 const char *interface, const char *name,
602                                 const char **args)
603 {
604         struct generic_data *data = NULL;
605         struct interface_data *iface;
606         const GDBusSignalTable *signal;
607
608         *args = NULL;
609         if (!dbus_connection_get_object_path_data(conn, path,
610                                         (void *) &data) || data == NULL) {
611                 error("dbus_connection_emit_signal: path %s isn't registered",
612                                 path);
613                 return FALSE;
614         }
615
616         iface = find_interface(data->interfaces, interface);
617         if (iface == NULL) {
618                 error("dbus_connection_emit_signal: %s does not implement %s",
619                                 path, interface);
620                 return FALSE;
621         }
622
623         for (signal = iface->signals; signal && signal->name; signal++) {
624                 if (!strcmp(signal->name, name)) {
625                         *args = signal->signature;
626                         break;
627                 }
628         }
629
630         if (*args == NULL) {
631                 error("No signal named %s on interface %s", name, interface);
632                 return FALSE;
633         }
634
635         return TRUE;
636 }
637
638 static dbus_bool_t emit_signal_valist(DBusConnection *conn,
639                                                 const char *path,
640                                                 const char *interface,
641                                                 const char *name,
642                                                 int first,
643                                                 va_list var_args)
644 {
645         DBusMessage *signal;
646         dbus_bool_t ret;
647         const char *signature, *args;
648
649         if (!check_signal(conn, path, interface, name, &args))
650                 return FALSE;
651
652         signal = dbus_message_new_signal(path, interface, name);
653         if (signal == NULL) {
654                 error("Unable to allocate new %s.%s signal", interface,  name);
655                 return FALSE;
656         }
657
658         ret = dbus_message_append_args_valist(signal, first, var_args);
659         if (!ret)
660                 goto fail;
661
662         signature = dbus_message_get_signature(signal);
663         if (strcmp(args, signature) != 0) {
664                 error("%s.%s: expected signature'%s' but got '%s'",
665                                 interface, name, args, signature);
666                 ret = FALSE;
667                 goto fail;
668         }
669
670         ret = dbus_connection_send(conn, signal, NULL);
671
672 fail:
673         dbus_message_unref(signal);
674
675         return ret;
676 }
677
678 gboolean g_dbus_register_interface(DBusConnection *connection,
679                                         const char *path, const char *name,
680                                         const GDBusMethodTable *methods,
681                                         const GDBusSignalTable *signals,
682                                         const GDBusPropertyTable *properties,
683                                         void *user_data,
684                                         GDBusDestroyFunction destroy)
685 {
686         struct generic_data *data;
687
688         data = object_path_ref(connection, path);
689         if (data == NULL)
690                 return FALSE;
691
692         if (find_interface(data->interfaces, name)) {
693                 object_path_unref(connection, path);
694                 return FALSE;
695         }
696
697         add_interface(data, name, methods, signals,
698                         properties, user_data, destroy);
699
700         g_free(data->introspect);
701         data->introspect = NULL;
702
703         return TRUE;
704 }
705
706 gboolean g_dbus_unregister_interface(DBusConnection *connection,
707                                         const char *path, const char *name)
708 {
709         struct generic_data *data = NULL;
710
711         if (path == NULL)
712                 return FALSE;
713
714         if (dbus_connection_get_object_path_data(connection, path,
715                                                 (void *) &data) == FALSE)
716                 return FALSE;
717
718         if (data == NULL)
719                 return FALSE;
720
721         if (remove_interface(data, name) == FALSE)
722                 return FALSE;
723
724         g_free(data->introspect);
725         data->introspect = NULL;
726
727         object_path_unref(connection, path);
728
729         return TRUE;
730 }
731
732 gboolean g_dbus_register_security(const GDBusSecurityTable *security)
733 {
734         if (security_table != NULL)
735                 return FALSE;
736
737         security_table = security;
738
739         return TRUE;
740 }
741
742 gboolean g_dbus_unregister_security(const GDBusSecurityTable *security)
743 {
744         security_table = NULL;
745
746         return TRUE;
747 }
748
749 DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name,
750                                         const char *format, va_list args)
751 {
752         char str[1024];
753
754         vsnprintf(str, sizeof(str), format, args);
755
756         return dbus_message_new_error(message, name, str);
757 }
758
759 DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name,
760                                                 const char *format, ...)
761 {
762         va_list args;
763         DBusMessage *reply;
764
765         va_start(args, format);
766
767         reply = g_dbus_create_error_valist(message, name, format, args);
768
769         va_end(args);
770
771         return reply;
772 }
773
774 DBusMessage *g_dbus_create_reply_valist(DBusMessage *message,
775                                                 int type, va_list args)
776 {
777         DBusMessage *reply;
778
779         reply = dbus_message_new_method_return(message);
780         if (reply == NULL)
781                 return NULL;
782
783         if (dbus_message_append_args_valist(reply, type, args) == FALSE) {
784                 dbus_message_unref(reply);
785                 return NULL;
786         }
787
788         return reply;
789 }
790
791 DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...)
792 {
793         va_list args;
794         DBusMessage *reply;
795
796         va_start(args, type);
797
798         reply = g_dbus_create_reply_valist(message, type, args);
799
800         va_end(args);
801
802         return reply;
803 }
804
805 gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
806 {
807         dbus_bool_t result;
808
809         if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_METHOD_CALL)
810                 dbus_message_set_no_reply(message, TRUE);
811
812         result = dbus_connection_send(connection, message, NULL);
813
814         dbus_message_unref(message);
815
816         return result;
817 }
818
819 gboolean g_dbus_send_reply_valist(DBusConnection *connection,
820                                 DBusMessage *message, int type, va_list args)
821 {
822         DBusMessage *reply;
823
824         reply = dbus_message_new_method_return(message);
825         if (reply == NULL)
826                 return FALSE;
827
828         if (dbus_message_append_args_valist(reply, type, args) == FALSE) {
829                 dbus_message_unref(reply);
830                 return FALSE;
831         }
832
833         return g_dbus_send_message(connection, reply);
834 }
835
836 gboolean g_dbus_send_reply(DBusConnection *connection,
837                                 DBusMessage *message, int type, ...)
838 {
839         va_list args;
840         gboolean result;
841
842         va_start(args, type);
843
844         result = g_dbus_send_reply_valist(connection, message, type, args);
845
846         va_end(args);
847
848         return result;
849 }
850
851 gboolean g_dbus_emit_signal(DBusConnection *connection,
852                                 const char *path, const char *interface,
853                                 const char *name, int type, ...)
854 {
855         va_list args;
856         gboolean result;
857
858         va_start(args, type);
859
860         result = emit_signal_valist(connection, path, interface,
861                                                         name, type, args);
862
863         va_end(args);
864
865         return result;
866 }
867
868 gboolean g_dbus_emit_signal_valist(DBusConnection *connection,
869                                 const char *path, const char *interface,
870                                 const char *name, int type, va_list args)
871 {
872         return emit_signal_valist(connection, path, interface,
873                                                         name, type, args);
874 }