diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-04-23 14:37:13 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-04-23 14:37:13 +0100 |
commit | 0dd4cfa689fa50f12d954fd8e5698d66c1e115a6 (patch) | |
tree | 2a6396a93278f970c91d848ca5c9daf178fface6 | |
parent | c999302dcb52b293fb125cfe17ded412787322b7 (diff) | |
download | connman-0dd4cfa689fa50f12d954fd8e5698d66c1e115a6.tar.gz connman-0dd4cfa689fa50f12d954fd8e5698d66c1e115a6.tar.bz2 connman-0dd4cfa689fa50f12d954fd8e5698d66c1e115a6.zip |
Add functions for handling unique device identifiers
-rw-r--r-- | include/device.h | 3 | ||||
-rw-r--r-- | src/connman.h | 2 | ||||
-rw-r--r-- | src/device.c | 21 | ||||
-rw-r--r-- | src/network.c | 8 |
4 files changed, 34 insertions, 0 deletions
diff --git a/include/device.h b/include/device.h index a3a1d4a7..17a2a0ca 100644 --- a/include/device.h +++ b/include/device.h @@ -81,6 +81,9 @@ extern void connman_device_set_interface(struct connman_device *device, const char *interface); extern const char *connman_device_get_interface(struct connman_device *device); +extern void connman_device_set_ident(struct connman_device *device, + const char *ident); + extern void connman_device_set_policy(struct connman_device *device, enum connman_device_policy policy); extern void connman_device_set_mode(struct connman_device *device, diff --git a/src/connman.h b/src/connman.h index f2c26aea..b941185c 100644 --- a/src/connman.h +++ b/src/connman.h @@ -188,6 +188,7 @@ int __connman_device_disconnect(struct connman_device *device); connman_bool_t __connman_device_has_driver(struct connman_device *device); const char *__connman_device_get_type(struct connman_device *device); +const char *__connman_device_get_ident(struct connman_device *device); int __connman_device_set_offlinemode(connman_bool_t offlinemode); @@ -208,6 +209,7 @@ connman_bool_t __connman_network_has_driver(struct connman_network *network); const char *__connman_network_get_type(struct connman_network *network); const char *__connman_network_get_group(struct connman_network *network); +const char *__connman_network_get_ident(struct connman_network *network); int __connman_profile_add_network(struct connman_network *network); int __connman_profile_remove_network(struct connman_network *network); diff --git a/src/device.c b/src/device.c index 13684ee0..df7e7fbf 100644 --- a/src/device.c +++ b/src/device.c @@ -45,6 +45,7 @@ struct connman_device { char *node; char *address; char *interface; + char *ident; unsigned int connections; guint scan_timeout; @@ -933,6 +934,7 @@ static void device_destruct(struct connman_element *element) DBG("element %p name %s", element, element->name); + g_free(device->ident); g_free(device->node); g_free(device->name); g_free(device->address); @@ -1147,6 +1149,25 @@ const char *connman_device_get_interface(struct connman_device *device) } /** + * connman_device_set_ident: + * @device: device structure + * @ident: unique identifier + * + * Set unique identifier of device + */ +void connman_device_set_ident(struct connman_device *device, + const char *ident) +{ + g_free(device->ident); + device->ident = g_strdup(ident); +} + +const char *__connman_device_get_ident(struct connman_device *device) +{ + return device->ident; +} + +/** * connman_device_set_policy: * @device: device structure * @policy: power and connection policy diff --git a/src/network.c b/src/network.c index 7375d7f5..6c37eacd 100644 --- a/src/network.c +++ b/src/network.c @@ -610,6 +610,14 @@ const char *__connman_network_get_group(struct connman_network *network) return network->group; } +const char *__connman_network_get_ident(struct connman_network *network) +{ + if (network->device == NULL) + return NULL; + + return __connman_device_get_ident(network->device); +} + /** * connman_network_set_available: * @network: network structure |