From 79a9fdf123cc1dfecf371a20e345c4856eb7b21a Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Fri, 12 Jul 2019 10:30:30 -0700 Subject: [PATCH] hotspot: add API to get a matching roaming consortium This API will attempt to find a matching roaming consortium OI if present in the config file. A single matching OI is returned or NULL if one was not found. --- src/hotspot.c | 18 ++++++++++++++++++ src/hotspot.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/src/hotspot.c b/src/hotspot.c index f4044109..3445ce44 100644 --- a/src/hotspot.c +++ b/src/hotspot.c @@ -271,6 +271,24 @@ try_roaming_consortium: return NULL; } +const uint8_t *hs20_get_roaming_consortium(struct network *network, + size_t *len) +{ + struct hs20_config *config; + const uint8_t *rc_ie = network_get_roaming_consortium(network); + + if (!rc_ie) + return NULL; + + config = l_queue_find(hs20_settings, match_rc, rc_ie); + if (config) { + *len = config->rc_len; + return config->rc; + } + + return NULL; +} + static int hotspot_init(void) { DIR *dir; diff --git a/src/hotspot.h b/src/hotspot.h index 21684d32..7ce95156 100644 --- a/src/hotspot.h +++ b/src/hotspot.h @@ -23,3 +23,6 @@ struct network; const char *hs20_find_settings_file(struct network *network); + +const uint8_t *hs20_get_roaming_consortium(struct network *network, + size_t *len);