summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2012-02-15 10:19:50 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-02-28 13:17:55 +0200
commit886e2579853ae0a6fdbe107bbaee73e2ec28ec84 (patch)
tree36336fed55b8209116cae3ef3c48e7512dc3164f
parentb8a01fb8696b315efeccb19b0668bcc4025e0511 (diff)
downloadconnman-886e2579853ae0a6fdbe107bbaee73e2ec28ec84.tar.gz
connman-886e2579853ae0a6fdbe107bbaee73e2ec28ec84.tar.bz2
connman-886e2579853ae0a6fdbe107bbaee73e2ec28ec84.zip
unit: handling type of connection into session api
-rw-r--r--unit/session-api.c16
-rw-r--r--unit/test-connman.h7
2 files changed, 23 insertions, 0 deletions
diff --git a/unit/session-api.c b/unit/session-api.c
index 7e3a3b1c..ce07d147 100644
--- a/unit/session-api.c
+++ b/unit/session-api.c
@@ -39,6 +39,16 @@ static enum connman_session_state string2state(const char *state)
return CONNMAN_SESSION_STATE_DISCONNECTED;
}
+static enum connman_session_state string2type(const char *type)
+{
+ if (g_strcmp0(type, "local") == 0)
+ return CONNMAN_SESSION_TYPE_LOCAL;
+ if (g_strcmp0(type, "internet") == 0)
+ return CONNMAN_SESSION_TYPE_INTERNET;
+
+ return CONNMAN_SESSION_TYPE_ANY;
+}
+
static const char *roamingpolicy2string(enum connman_session_roaming_policy policy)
{
switch (policy) {
@@ -251,6 +261,12 @@ static DBusMessage *notify_update(DBusConnection *conn,
info->interface = g_strdup(val);
+ } else if (g_str_equal(key, "ConnectionType")
+ == TRUE) {
+ const char *val;
+ dbus_message_iter_get_basic(&value, &val);
+
+ info->type = string2type(val);
} else {
g_assert(FALSE);
return __connman_error_invalid_arguments(msg);
diff --git a/unit/test-connman.h b/unit/test-connman.h
index d04e230d..01b39bf6 100644
--- a/unit/test-connman.h
+++ b/unit/test-connman.h
@@ -77,6 +77,12 @@ enum connman_session_state {
CONNMAN_SESSION_STATE_ONLINE = 2,
};
+enum connman_session_type {
+ CONNMAN_SESSION_TYPE_ANY = 0,
+ CONNMAN_SESSION_TYPE_LOCAL = 1,
+ CONNMAN_SESSION_TYPE_INTERNET = 2,
+};
+
enum connman_session_roaming_policy {
CONNMAN_SESSION_ROAMING_POLICY_UNKNOWN = 0,
CONNMAN_SESSION_ROAMING_POLICY_DEFAULT = 1,
@@ -89,6 +95,7 @@ enum connman_session_roaming_policy {
struct test_session_info {
char *bearer;
enum connman_session_state state;
+ enum connman_session_type type;
char *name;
/* ipv4, ipv6 dicts */
GSList *allowed_bearers;