diff options
-rw-r--r-- | include/network.h | 2 | ||||
-rw-r--r-- | src/network.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/network.h b/include/network.h index 14e9d871..796c4f84 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 95122dd0..290f5883 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) { |