1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
3 * LADI Session Handler (ladish)
5 * Copyright (C) 2008, 2009 Nedko Arnaudov <nedko@arnaudov.name>
6 * Copyright (C) 2008 Juuso Alasuutari <juuso.alasuutari@gmail.com>
8 **************************************************************************
9 * This file contains D-Bus interface dispatcher
10 **************************************************************************
12 * LADI Session Handler is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * LADI Session Handler is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with LADI Session Handler. If not, see <http://www.gnu.org/licenses/>
24 * or write to the Free Software Foundation, Inc.,
25 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include "../common/debug.h"
32 #include "interface.h"
34 #include "object_path.h"
37 * Execute a method's function if the method specified in the method call
38 * object exists in the method array. Return true if the method was found,
40 * TODO: rewrite description ^
43 interface_default_handler(const interface_t
*interface
,
48 for (ptr
= (const method_t
*) interface
->methods
;
51 if (strcmp(call
->method_name
, ptr
->name
) == 0) {
53 call
->interface
= interface
;
54 call
->context
= ((object_path_t
*)call
->context
)->context
;
57 /* If the method handler didn't construct a return
58 message create a void one here */
59 // TODO: Also handle cases where the sender doesn't need a reply
61 && !(call
->reply
= dbus_message_new_method_return(call
->message
))) {
62 lash_error("Failed to construct void method return");
65 lash_dbus_error(call
, LASH_DBUS_ERROR_GENERIC
,
66 "Handler for method \"%s\" is NULL", ptr
->name
);
74 /* Didn't find method */