From: Enlightenment S. <no-...@en...> - 2010-09-15 20:51:51
|
Log: connman: set also gateway when configuring manually Author: lucas Date: 2010-09-15 13:51:43 -0700 (Wed, 15 Sep 2010) New Revision: 52329 Modified: trunk/e_dbus/src/bin/e_dbus_connman_test.c trunk/e_dbus/src/lib/connman/E_Connman.h trunk/e_dbus/src/lib/connman/e_connman_service.c Modified: trunk/e_dbus/src/bin/e_dbus_connman_test.c =================================================================== --- trunk/e_dbus/src/bin/e_dbus_connman_test.c 2010-09-15 20:51:37 UTC (rev 52328) +++ trunk/e_dbus/src/bin/e_dbus_connman_test.c 2010-09-15 20:51:43 UTC (rev 52329) @@ -2046,7 +2046,7 @@ static Eina_Bool _on_cmd_service_ipv4_configure_manual(__UNUSED__ char *cmd, char *args) { - char *path, *next_args, *address, *netmask = NULL; + char *path, *next_args, *address, *netmask = NULL, *gateway = NULL; E_Connman_Element *e; if (!args) @@ -2065,17 +2065,21 @@ address = next_args; next_args = _tok(next_args); if (next_args) + netmask = next_args; + + next_args = _tok(next_args); + if (next_args) { - netmask = next_args; + gateway = next_args; _tok(next_args); } e = e_connman_service_get(path); if (e_connman_service_ipv4_configure_manual - (e, address, netmask, + (e, address, netmask, gateway, _method_success_check, "service_ipv4_configure_manual")) - printf(":::Service %s IPv4 Configuration set to Manual (%s/%s)\n", - path, address, netmask); + printf(":::Service %s IPv4 Configuration set to Manual (%s/%s) gw %s\n", + path, address, netmask, gateway); else fputs("ERROR: can't set service ipv4_configuration manual\n", stderr); return ECORE_CALLBACK_RENEW; Modified: trunk/e_dbus/src/lib/connman/E_Connman.h =================================================================== --- trunk/e_dbus/src/lib/connman/E_Connman.h 2010-09-15 20:51:37 UTC (rev 52328) +++ trunk/e_dbus/src/lib/connman/E_Connman.h 2010-09-15 20:51:43 UTC (rev 52329) @@ -171,7 +171,7 @@ /* Methods to configure IPv4 service */ EAPI bool e_connman_service_ipv4_configure_dhcp(E_Connman_Element *service, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; - EAPI bool e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *address, const char *netmask, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; + EAPI bool e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *address, const char *netmask, const char *gateway, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; /* Technologies methods */ EAPI E_Connman_Element *e_connman_technology_get(const char *path) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT; Modified: trunk/e_dbus/src/lib/connman/e_connman_service.c =================================================================== --- trunk/e_dbus/src/lib/connman/e_connman_service.c 2010-09-15 20:51:37 UTC (rev 52328) +++ trunk/e_dbus/src/lib/connman/e_connman_service.c 2010-09-15 20:51:43 UTC (rev 52329) @@ -1062,14 +1062,15 @@ * * @param service path to set. * @param address IPv4 address. - * @param netmask IPv4 netmask, or @c NULL for "/32" + * @param netmask IPv4 netmask, or @c NULL for "/32". + * @param gateway IPv4 gateway address. * @param cb function to call when server replies or some error happens. * @param data data to give to cb when it is called. * * @return 1 on success, 0 otherwise. */ bool -e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *address, const char *netmask, E_DBus_Method_Return_Cb cb, const void *data) +e_connman_service_ipv4_configure_manual(E_Connman_Element *service, const char *address, const char *netmask, const char *gateway, E_DBus_Method_Return_Cb cb, const void *data) { const char name[] = "SetProperty"; const char *method = "manual"; /* not method[] as gcc screws it with dbus */ @@ -1127,6 +1128,16 @@ dbus_message_iter_close_container(&dict, &entry); } + if (gateway) + { + dbus_message_iter_open_container + (&dict, DBUS_TYPE_DICT_ENTRY, NULL, &entry); + dbus_message_iter_append_basic + (&entry, DBUS_TYPE_STRING, &e_connman_prop_gateway); + dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &gateway); + dbus_message_iter_close_container(&dict, &entry); + } + dbus_message_iter_close_container(&variant, &dict); dbus_message_iter_close_container(&itr, &variant); |