4 * Copyright (C) 2008 Juuso Alasuutari <juuso.alasuutari@gmail.com>
5 * Copyright (C) 2008 Nedko Arnaudov
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "common/debug.h"
26 #include "dbus/interface.h"
27 #include "dbus/error.h"
30 * Execute a method's function if the method specified in the method call
31 * object exists in the method array. Return true if the method was found,
33 * TODO: rewrite description ^
36 interface_default_handler(const interface_t
*interface
,
41 for (ptr
= (const method_t
*) interface
->methods
;
44 if (strcmp(call
->method_name
, ptr
->name
) == 0) {
46 call
->interface
= interface
;
49 /* If the method handler didn't construct a return
50 message create a void one here */
51 // TODO: Also handle cases where the sender doesn't need a reply
53 && !(call
->reply
= dbus_message_new_method_return(call
->message
))) {
54 lash_error("Failed to construct void method return");
57 lash_dbus_error(call
, LASH_DBUS_ERROR_GENERIC
,
58 "Handler for method \"%s\" is NULL", ptr
->name
);
66 /* Didn't find method */