summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Xu <martin.xu@intel.com>2010-02-09 10:29:50 +0100
committerMarcel Holtmann <marcel@holtmann.org>2010-02-11 05:28:32 +0100
commit14432bc7808819637ab8170cf9143fdddebf844c (patch)
tree934896a334ac6f2a10c6efb1d2e5bb47ca941672
parente61f21a9e72cf4100c7ecbd80d2a25c84a63b33a (diff)
downloadconnman-14432bc7808819637ab8170cf9143fdddebf844c.tar.gz
connman-14432bc7808819637ab8170cf9143fdddebf844c.tar.bz2
connman-14432bc7808819637ab8170cf9143fdddebf844c.zip
Add get and create ipconfig from service
In some cases (for example the oFono plugin), we will not get the network index before creating the service. We then need a routine that allows us to setup the ipconfig layer once we get the index.
-rw-r--r--src/connman.h4
-rw-r--r--src/service.c18
2 files changed, 22 insertions, 0 deletions
diff --git a/src/connman.h b/src/connman.h
index ff38ad56..fd5afd5b 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -390,6 +390,10 @@ struct connman_service *__connman_service_create_from_network(struct connman_net
void __connman_service_update_from_network(struct connman_network *network);
void __connman_service_remove_from_network(struct connman_network *network);
+void __connman_service_create_ipconfig(struct connman_service *service,
+ int index);
+struct connman_ipconfig *__connman_service_get_ipconfig(
+ struct connman_service *service);
const char *__connman_service_get_path(struct connman_service *service);
unsigned int __connman_service_get_order(struct connman_service *service);
struct connman_network *__connman_service_get_network(struct connman_service *service);
diff --git a/src/service.c b/src/service.c
index 3b5cb9d3..eb1402a7 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1452,6 +1452,15 @@ __connman_service_get_network(struct connman_service *service)
return service->network;
}
+struct connman_ipconfig *
+__connman_service_get_ipconfig(struct connman_service *service)
+{
+ if (service == NULL)
+ return NULL;
+
+ return service->ipconfig;
+}
+
/**
* __connman_service_set_favorite:
* @service: service structure
@@ -2163,6 +2172,15 @@ static void setup_ipconfig(struct connman_service *service, int index)
connman_ipconfig_set_ops(service->ipconfig, &service_ops);
}
+void __connman_service_create_ipconfig(struct connman_service *service,
+ int index)
+{
+ if (service->ipconfig != NULL)
+ return;
+
+ setup_ipconfig(service, index);
+}
+
/**
* __connman_service_lookup_from_network:
* @network: network structure