summaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-09-27 18:24:50 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-09-30 08:32:01 +0200
commite6c700c9f1627cf25657d07472f07d8980d6f0ae (patch)
treeeab9bef5f1c3060204009acde0d840cbe99d3241 /src/session.c
parent6971ff9c80f7155f0d119ccbbb7cf19a93a3cc26 (diff)
downloadconnman-e6c700c9f1627cf25657d07472f07d8980d6f0ae.tar.gz
connman-e6c700c9f1627cf25657d07472f07d8980d6f0ae.tar.bz2
connman-e6c700c9f1627cf25657d07472f07d8980d6f0ae.zip
session: Move update_allowed_bearers() up
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c150
1 files changed, 75 insertions, 75 deletions
diff --git a/src/session.c b/src/session.c
index 88998f6c..c59dfdcc 100644
--- a/src/session.c
+++ b/src/session.c
@@ -891,6 +891,81 @@ static void select_and_connect(struct connman_session *session,
}
}
+static struct service_entry *create_service_entry(struct connman_service *service,
+ const char *name,
+ enum connman_service_state state)
+{
+ struct service_entry *entry;
+ enum connman_service_type type;
+ int idx;
+
+ entry = g_try_new0(struct service_entry, 1);
+ if (entry == NULL)
+ return entry;
+
+ entry->reason = CONNMAN_SESSION_REASON_UNKNOWN;
+ entry->state = state;
+ if (name != NULL)
+ entry->name = name;
+ else
+ entry->name = "";
+ entry->service = service;
+
+ idx = __connman_service_get_index(entry->service);
+ entry->ifname = connman_inet_ifname(idx);
+ if (entry->ifname == NULL)
+ entry->ifname = g_strdup("");
+
+ type = connman_service_get_type(entry->service);
+ entry->bearer = service2bearer(type);
+
+ return entry;
+}
+
+static void destroy_service_entry(gpointer data)
+{
+ struct service_entry *entry = data;
+
+ g_free(entry->ifname);
+
+ g_free(entry);
+}
+
+static void update_allowed_bearers(struct connman_session *session)
+{
+ struct service_entry *entry;
+ GSequenceIter *iter;
+
+ if (session->service_list != NULL) {
+ g_hash_table_remove_all(session->service_hash);
+ g_sequence_free(session->service_list);
+ }
+
+ session->service_list = __connman_service_get_list(session,
+ service_match,
+ create_service_entry,
+ destroy_service_entry);
+
+ g_sequence_sort(session->service_list, sort_services, session);
+
+ iter = g_sequence_get_begin_iter(session->service_list);
+
+ while (g_sequence_iter_is_end(iter) == FALSE) {
+ entry = g_sequence_get(iter);
+
+ DBG("service %p type %s name %s", entry->service,
+ service2bearer(connman_service_get_type(entry->service)),
+ entry->name);
+
+ g_hash_table_replace(session->service_hash,
+ entry->service, iter);
+
+ iter = g_sequence_iter_next(iter);
+ }
+
+ session->info_dirty = TRUE;
+}
+
static void session_changed(struct connman_session *session,
enum connman_session_trigger trigger)
{
@@ -1026,81 +1101,6 @@ static DBusMessage *disconnect_session(DBusConnection *conn,
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}
-static struct service_entry *create_service_entry(struct connman_service *service,
- const char *name,
- enum connman_service_state state)
-{
- struct service_entry *entry;
- enum connman_service_type type;
- int idx;
-
- entry = g_try_new0(struct service_entry, 1);
- if (entry == NULL)
- return entry;
-
- entry->reason = CONNMAN_SESSION_REASON_UNKNOWN;
- entry->state = state;
- if (name != NULL)
- entry->name = name;
- else
- entry->name = "";
- entry->service = service;
-
- idx = __connman_service_get_index(entry->service);
- entry->ifname = connman_inet_ifname(idx);
- if (entry->ifname == NULL)
- entry->ifname = g_strdup("");
-
- type = connman_service_get_type(entry->service);
- entry->bearer = service2bearer(type);
-
- return entry;
-}
-
-static void destroy_service_entry(gpointer data)
-{
- struct service_entry *entry = data;
-
- g_free(entry->ifname);
-
- g_free(entry);
-}
-
-static void update_allowed_bearers(struct connman_session *session)
-{
- struct service_entry *entry;
- GSequenceIter *iter;
-
- if (session->service_list != NULL) {
- g_hash_table_remove_all(session->service_hash);
- g_sequence_free(session->service_list);
- }
-
- session->service_list = __connman_service_get_list(session,
- service_match,
- create_service_entry,
- destroy_service_entry);
-
- g_sequence_sort(session->service_list, sort_services, session);
-
- iter = g_sequence_get_begin_iter(session->service_list);
-
- while (g_sequence_iter_is_end(iter) == FALSE) {
- entry = g_sequence_get(iter);
-
- DBG("service %p type %s name %s", entry->service,
- service2bearer(connman_service_get_type(entry->service)),
- entry->name);
-
- g_hash_table_replace(session->service_hash,
- entry->service, iter);
-
- iter = g_sequence_iter_next(iter);
- }
-
- session->info_dirty = TRUE;
-}
-
static void update_ecall_sessions(struct connman_session *session)
{
struct session_info *info = session->info;