/*********************************************************************** * * <:copyright-BRCM:2019:DUAL/GPL:standard * * Copyright (c) 2019 Broadcom * All Rights Reserved * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed * to you under the terms of the GNU General Public License version 2 * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, * with the following added to such license: * * As a special exception, the copyright holders of this software give * you permission to link this software with independent modules, and * to copy and distribute the resulting executable under terms of your * choice, provided that you also meet, for each linked independent * module, the terms and conditions of the license of that module. * An independent module is a module which is not derived from this * software. The special exception does not apply to any modifications * of the software. * * Not withstanding the above, under no circumstances may you combine * this software in any way with any other Broadcom software provided * under a license other than the GPL, without Broadcom's express prior * written consent. * * :> * ************************************************************************/ /*!\file wanconf_dbus.c * \brief wanconf specific D-Bus methods. * */ #ifdef MESSAGE_BUS_DBUS #include #include #include #include "bcm_retcodes.h" #include "bcm_ulog.h" #include "wanconf.h" // From bcm_dbus_intf.h: actually takes a ZbusAddr GDBusProxy *dbusIntf_getOutboundHandle(const void *destAddr); void dbusIntf_freeOutboundHandle(GDBusProxy *proxy); void bus_out_wanConf(const void *dest, const char *cmd) { GDBusProxy *outProxy = NULL; GVariant *gresult = NULL; GError *error = NULL; bcmuLog_notice("Entered:"); if (dest == NULL || cmd == NULL) { bcmuLog_error("one or more NULL input args"); return; } outProxy = dbusIntf_getOutboundHandle(dest); if (outProxy == NULL) { // Possible that destination component is not there. Don't complain // too loudly. bcmuLog_error("could not get handle to %s", (char *)dest); return; } bcmuLog_notice("calling wanConf method in %s (cmd=%s)", (char *)dest, cmd); gresult = g_dbus_proxy_call_sync(outProxy, "wanConf", g_variant_new("(s)", cmd), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (error != NULL) { bcmuLog_error("g_dbus_proxy_call_sync error: %s", error->message); g_error_free(error); dbusIntf_freeOutboundHandle(outProxy); return; } { guint32 gret = 0; // The return value is ignored. g_variant_get(gresult, "(u)", &gret); bcmuLog_debug("dbus method returned %d", gret); g_variant_unref(gresult); } // Free the outbound proxy. dbusIntf_freeOutboundHandle(outProxy); bcmuLog_notice("exit."); return; } #endif // MESSAGE_BUS_DBUS