Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: src/manager.c

Issue 6659006: flimflam: add support for multiple profiles (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/flimflam.git@master
Patch Set: more ers comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/main.c ('k') | src/profile.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/manager.c
diff --git a/src/manager.c b/src/manager.c
index e0801ab097f1c77aebd3c8ed284f614ff9b65852..e14701ad14b78a2577c8a285353e48cedf0cf19e 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -173,12 +173,6 @@ static DBusMessage *set_property(DBusConnection *conn,
__connman_profile_set_offlinemode(offlinemode);
__connman_profile_save_default();
- } else if (g_str_equal(name, "ActiveProfile") == TRUE) {
- const char *str;
-
- dbus_message_iter_get_basic(&value, &str);
-
- return __connman_error_not_supported(msg);
} else
return __connman_error_invalid_property(msg);
@@ -227,25 +221,84 @@ static DBusMessage *create_profile(DBusConnection *conn,
static DBusMessage *remove_profile(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- const char *path;
+ const char *ident;
int err;
_DBG_MANAGER("conn %p", conn);
- dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path,
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
+ DBUS_TYPE_INVALID);
+
+ if (__connman_security_check_privilege(msg,
+ CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
+ return __connman_error_permission_denied(msg);
+
+ err = __connman_profile_remove(ident);
+ if (err < 0)
+ return __connman_error_failed(msg, -err);
+
+ return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *push_profile(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ const char *ident, *path;
+ int err;
+
+ _DBG_MANAGER("conn %p", conn);
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
+ DBUS_TYPE_INVALID);
+
+ if (__connman_security_check_privilege(msg,
+ CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
+ return __connman_error_permission_denied(msg);
+
+ err = __connman_profile_push(ident, NULL, &path);
+ if (err < 0)
+ return __connman_error_failed(msg, -err);
+
+ return g_dbus_create_reply(msg, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
+}
+
+static DBusMessage *__pop_profile(DBusMessage *msg, const char *ident)
+{
+ int err;
if (__connman_security_check_privilege(msg,
CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0)
return __connman_error_permission_denied(msg);
- err = __connman_profile_remove(path);
+ err = __connman_profile_pop(ident);
if (err < 0)
return __connman_error_failed(msg, -err);
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}
+static DBusMessage *pop_profile(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ const char *ident;
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &ident,
+ DBUS_TYPE_INVALID);
+
+ _DBG_MANAGER("ident %s", ident);
+
+ return __pop_profile(msg, ident);
+}
+
+static DBusMessage *pop_any_profile(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ _DBG_MANAGER("");
+
+ return __pop_profile(msg, NULL);
+}
+
static DBusMessage *request_scan(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -658,7 +711,10 @@ static GDBusMethodTable manager_methods[] = {
{ "SetProperty", "sv", "", set_property },
{ "GetState", "", "s", get_state },
{ "CreateProfile", "s", "o", create_profile },
- { "RemoveProfile", "o", "", remove_profile },
+ { "RemoveProfile", "s", "", remove_profile },
+ { "PushProfile", "s", "o", push_profile },
+ { "PopProfile", "s", "", pop_profile },
+ { "PopAnyProfile", "", "", pop_any_profile },
{ "RequestScan", "s", "", request_scan },
{ "EnableTechnology", "s", "", enable_technology,
G_DBUS_METHOD_FLAG_ASYNC },
« no previous file with comments | « src/main.c ('k') | src/profile.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698