NAN USD: Add publishChannelList option for Subscriber
Add frequency list to active NAN USD Subscriber to search for a Publisher on multiple channels. This is the publish channel list used by the Subscriber to periodically search for a service on these channels. publishChannelList was already supported in the Publisher and this commit extends that to the Subscriber. This is needed for a P2P2 seeker that is an active subscriber looking for an advertiser on a list of publish channels. Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
This commit is contained in:
parent
bcab29a78c
commit
25c6598f30
3 changed files with 37 additions and 0 deletions
|
@ -1358,6 +1358,17 @@ int nan_de_subscribe(struct nan_de *de, const char *service_name,
|
|||
if (nan_de_derive_service_id(srv) < 0)
|
||||
goto fail;
|
||||
os_memcpy(&srv->subscribe, params, sizeof(*params));
|
||||
|
||||
if (params->freq_list) {
|
||||
size_t len;
|
||||
|
||||
len = (int_array_len(params->freq_list) + 1) * sizeof(int);
|
||||
srv->freq_list = os_memdup(params->freq_list, len);
|
||||
if (!srv->freq_list)
|
||||
goto fail;
|
||||
}
|
||||
srv->subscribe.freq_list = NULL;
|
||||
|
||||
srv->srv_proto_type = srv_proto_type;
|
||||
if (ssi) {
|
||||
srv->ssi = wpabuf_dup(ssi);
|
||||
|
|
|
@ -125,6 +125,9 @@ struct nan_subscribe_params {
|
|||
/* Selected frequency */
|
||||
unsigned int freq;
|
||||
|
||||
/* Multi-channel frequencies (publishChannelList) */
|
||||
const int *freq_list;
|
||||
|
||||
/* Query period in ms; 0 = use default */
|
||||
unsigned int query_period;
|
||||
};
|
||||
|
|
|
@ -12373,6 +12373,7 @@ static int wpas_ctrl_nan_subscribe(struct wpa_supplicant *wpa_s, char *cmd,
|
|||
struct wpabuf *ssi = NULL;
|
||||
int ret = -1;
|
||||
enum nan_service_protocol_type srv_proto_type = 0;
|
||||
int *freq_list = NULL;
|
||||
bool p2p = false;
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
|
@ -12399,6 +12400,27 @@ static int wpas_ctrl_nan_subscribe(struct wpa_supplicant *wpa_s, char *cmd,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (os_strncmp(token, "freq_list=", 10) == 0) {
|
||||
char *pos = token + 10;
|
||||
|
||||
if (os_strcmp(pos, "all") == 0) {
|
||||
os_free(freq_list);
|
||||
freq_list = wpas_nan_usd_all_freqs(wpa_s);
|
||||
params.freq_list = freq_list;
|
||||
continue;
|
||||
}
|
||||
|
||||
while (pos && pos[0]) {
|
||||
int_array_add_unique(&freq_list, atoi(pos));
|
||||
pos = os_strchr(pos, ',');
|
||||
if (pos)
|
||||
pos++;
|
||||
}
|
||||
|
||||
params.freq_list = freq_list;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (os_strncmp(token, "srv_proto_type=", 15) == 0) {
|
||||
srv_proto_type = atoi(token + 15);
|
||||
continue;
|
||||
|
@ -12431,6 +12453,7 @@ static int wpas_ctrl_nan_subscribe(struct wpa_supplicant *wpa_s, char *cmd,
|
|||
ret = os_snprintf(buf, buflen, "%d", subscribe_id);
|
||||
fail:
|
||||
wpabuf_free(ssi);
|
||||
os_free(freq_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue