From ea1f8757bccdd6c52a9a3000849e1c79e4cb5a9a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 5 Jan 2009 03:16:54 +0100 Subject: [PATCH] Add function to retrieve blob from network --- include/network.h | 2 ++ src/network.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/network.h b/include/network.h index 14e9d87..796c4f8 100644 --- a/include/network.h +++ b/include/network.h @@ -78,6 +78,8 @@ extern int connman_network_set_uint8(struct connman_network *network, const char *key, connman_uint8_t value); extern int connman_network_set_blob(struct connman_network *network, const char *key, const void *data, unsigned int size); +extern const void *connman_network_get_blob(struct connman_network *network, + const char *key, unsigned int *size); extern struct connman_device *connman_network_get_device(struct connman_network *network); diff --git a/src/network.c b/src/network.c index 95122dd..290f588 100644 --- a/src/network.c +++ b/src/network.c @@ -596,6 +596,26 @@ int connman_network_set_blob(struct connman_network *network, return 0; } +/** + * connman_network_get_blob: + * @network: network structure + * @key: unique identifier + * @size: pointer to blob size + * + * Get binary blob value for specific key + */ +const void *connman_network_get_blob(struct connman_network *network, + const char *key, unsigned int *size) +{ + if (g_str_equal(key, "WiFi.SSID") == TRUE) { + if (size != NULL) + *size = network->wifi.ssid_len; + return network->wifi.ssid; + } + + return NULL; +} + void __connman_network_set_device(struct connman_network *network, struct connman_device *device) { -- 2.7.4