Add missing header text
[ladish.git] / cdbus / interface.h
blobf31f2ee5320eb82ff09dd9011120548c8c83eebe
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2008,2009,2011 Nedko Arnaudov <nedko@arnaudov.name>
6 * Copyright (C) 2008 Juuso Alasuutari <juuso.alasuutari@gmail.com>
8 **************************************************************************
9 * This file contains declaration of macros used to define D-Bus interfaces
10 **************************************************************************
12 * Licensed under the Academic Free License version 2.1
14 * LADI Session Handler is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * LADI Session Handler is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
26 * or write to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
30 #ifndef __CDBUS_INTERFACE_H__
31 #define __CDBUS_INTERFACE_H__
33 typedef bool (* cdbus_interface_handler)(const struct cdbus_interface_descriptor *, struct cdbus_method_call *);
35 struct cdbus_interface_descriptor
37 const char * name;
38 cdbus_interface_handler handler;
39 const struct cdbus_method_descriptor * methods;
40 const struct cdbus_signal_descriptor * signals;
43 bool cdbus_interface_default_handler(const struct cdbus_interface_descriptor * interface, struct cdbus_method_call * call_ptr);
45 #define CDBUS_INTERFACE_BEGIN(iface_var, iface_name) \
46 const struct cdbus_interface_descriptor iface_var = \
47 { \
48 .name = iface_name,
50 #define CDBUS_INTERFACE_DEFAULT_HANDLER \
51 .handler = cdbus_interface_default_handler,
53 #define CDBUS_INTERFACE_HANDLER(handler_func) \
54 .handler = handler_func,
56 #define CDBUS_INTERFACE_EXPOSE_METHODS \
57 .methods = methods_dtor,
59 #define CDBUS_INTERFACE_EXPOSE_SIGNALS \
60 .signals = signals_dtor,
62 #define CDBUS_INTERFACE_END \
65 #define CDBUS_INTERFACE_DEFAULT_HANDLER_METHODS_ONLY(iface_var, iface_name) \
66 CDBUS_INTERFACE_BEGIN(iface_var, iface_name) \
67 CDBUS_INTERFACE_DEFAULT_HANDLER \
68 CDBUS_INTERFACE_EXPOSE_METHODS \
69 CDBUS_INTERFACE_END
71 #define CDBUS_INTERFACE_DEFAULT_HANDLER_SIGNALS_ONLY(iface_var, iface_name) \
72 CDBUS_INTERFACE_BEGIN(iface_var, iface_name) \
73 CDBUS_INTERFACE_DEFAULT_HANDLER \
74 CDBUS_INTERFACE_EXPOSE_SIGNALS \
75 CDBUS_INTERFACE_END
77 #define CDBUS_INTERFACE_DEFAULT_HANDLER_METHODS_AND_SIGNALS(iface_var, iface_name) \
78 CDBUS_INTERFACE_BEGIN(iface_var, iface_name) \
79 CDBUS_INTERFACE_DEFAULT_HANDLER \
80 CDBUS_INTERFACE_EXPOSE_METHODS \
81 CDBUS_INTERFACE_EXPOSE_SIGNALS \
82 CDBUS_INTERFACE_END
84 #endif /* __CDBUS_INTERFACE_H__ */