Lines Matching +full:multi +full:- +full:instance

54 	/* Publish state - channel iteration */
89 os_memcpy(de->nmi, nmi, ETH_ALEN); in nan_de_init()
90 de->ap = ap; in nan_de_init()
91 os_memcpy(&de->cb, cb, sizeof(*cb)); in nan_de_init()
99 os_free(srv->service_name); in nan_de_service_free()
100 wpabuf_free(srv->ssi); in nan_de_service_free()
101 wpabuf_free(srv->elems); in nan_de_service_free()
102 os_free(srv->freq_list); in nan_de_service_free()
112 if (srv->type == NAN_DE_PUBLISH && de->cb.publish_terminated) in nan_de_service_deinit()
113 de->cb.publish_terminated(de->cb.ctx, srv->id, reason); in nan_de_service_deinit()
114 if (srv->type == NAN_DE_SUBSCRIBE && de->cb.subscribe_terminated) in nan_de_service_deinit()
115 de->cb.subscribe_terminated(de->cb.ctx, srv->id, reason); in nan_de_service_deinit()
122 de->listen_freq = 0; in nan_de_clear_pending()
123 de->tx_wait_status_freq = 0; in nan_de_clear_pending()
124 de->tx_wait_end_freq = 0; in nan_de_clear_pending()
136 nan_de_service_deinit(de, de->service[i], in nan_de_flush()
138 de->service[i] = NULL; in nan_de_flush()
141 de->num_service = 0; in nan_de_flush()
150 os_get_reltime(&srv->pause_state_end); in nan_de_pause_state()
151 srv->pause_state_end.sec += 60; in nan_de_pause_state()
152 os_memcpy(srv->sel_peer_addr, peer_addr, ETH_ALEN); in nan_de_pause_state()
153 srv->sel_peer_id = peer_id; in nan_de_pause_state()
160 srv->pause_state_end.sec = 0; in nan_de_unpause_state()
161 srv->pause_state_end.usec = 0; in nan_de_unpause_state()
162 os_memset(srv->sel_peer_addr, 0, ETH_ALEN); in nan_de_unpause_state()
163 srv->sel_peer_id = 0; in nan_de_unpause_state()
189 if (!de->cb.tx) in nan_de_tx()
190 return -1; in nan_de_tx()
192 res = de->cb.tx(de->cb.ctx, freq, wait_time, dst, src, bssid, buf); in nan_de_tx()
196 de->tx_wait_status_freq = freq; in nan_de_tx()
197 de->tx_wait_end_freq = wait_time ? freq : 0; in nan_de_tx()
225 if (srv->elems) in nan_de_tx_sdf()
226 len += NAN_ATTR_HDR_LEN + 1 + wpabuf_len(srv->elems); in nan_de_tx_sdf()
235 wpabuf_put_data(buf, srv->service_id, NAN_SERVICE_ID_LEN); in nan_de_tx_sdf()
236 wpabuf_put_u8(buf, srv->id); /* Instance ID */ in nan_de_tx_sdf()
237 wpabuf_put_u8(buf, req_instance_id); /* Requestor Instance ID */ in nan_de_tx_sdf()
241 if (srv->type == NAN_DE_PUBLISH || ssi) { in nan_de_tx_sdf()
244 wpabuf_put_u8(buf, srv->id); /* Instance ID */ in nan_de_tx_sdf()
245 if (srv->type == NAN_DE_PUBLISH) { in nan_de_tx_sdf()
246 if (srv->publish.fsd) in nan_de_tx_sdf()
248 if (srv->publish.fsd_gas) in nan_de_tx_sdf()
255 wpabuf_put_u8(buf, srv->srv_proto_type); in nan_de_tx_sdf()
261 if (srv->elems) { in nan_de_tx_sdf()
263 wpabuf_put_le16(buf, 1 + wpabuf_len(srv->elems)); in nan_de_tx_sdf()
265 wpabuf_put_buf(buf, srv->elems); in nan_de_tx_sdf()
268 /* Wi-Fi Aware specification v4.0 uses NAN Cluster ID as A3 for USD, in nan_de_tx_sdf()
271 nan_de_tx(de, srv->freq, wait_time, dst, de->nmi, wildcard_bssid, buf); in nan_de_tx_sdf()
280 if (os_reltime_before(&srv->next_publish_state, in nan_de_time_to_next_chan_change()
281 &srv->next_publish_chan)) in nan_de_time_to_next_chan_change()
282 tmp = srv->next_publish_state; in nan_de_time_to_next_chan_change()
283 else if (srv->in_multi_chan) in nan_de_time_to_next_chan_change()
284 tmp = srv->next_publish_chan; in nan_de_time_to_next_chan_change()
286 tmp = srv->next_publish_state; in nan_de_time_to_next_chan_change()
296 os_get_reltime(&srv->next_publish_state); in nan_de_set_publish_times()
297 srv->next_publish_chan = srv->next_publish_state; in nan_de_set_publish_times()
298 /* Swap single/multi channel state in N * 100 TU */ in nan_de_set_publish_times()
299 os_reltime_add_ms(&srv->next_publish_state, in nan_de_set_publish_times()
300 srv->next_publish_duration * 1024 / 1000); in nan_de_set_publish_times()
302 /* Swap channel in multi channel state after 150 ms */ in nan_de_set_publish_times()
303 os_reltime_add_ms(&srv->next_publish_chan, 150); in nan_de_set_publish_times()
309 if (srv->next_publish_duration) { in nan_de_check_chan_change()
313 srv->next_publish_duration = 0; in nan_de_check_chan_change()
314 } else if (srv->in_multi_chan) { in nan_de_check_chan_change()
315 if (!os_reltime_initialized(&srv->pause_state_end)) { in nan_de_check_chan_change()
316 srv->multi_chan_idx++; in nan_de_check_chan_change()
317 if (srv->freq_list[srv->multi_chan_idx] == 0) in nan_de_check_chan_change()
318 srv->multi_chan_idx = 0; in nan_de_check_chan_change()
319 srv->freq = srv->freq_list[srv->multi_chan_idx]; in nan_de_check_chan_change()
321 "NAN: Publish multi-channel change to %u MHz", in nan_de_check_chan_change()
322 srv->freq); in nan_de_check_chan_change()
324 os_get_reltime(&srv->next_publish_chan); in nan_de_check_chan_change()
325 os_reltime_add_ms(&srv->next_publish_chan, 150); in nan_de_check_chan_change()
336 if (srv->type == NAN_DE_PUBLISH) { in nan_de_tx_multicast()
346 } else if (srv->type == NAN_DE_SUBSCRIBE) { in nan_de_tx_multicast()
353 req_instance_id, srv->ssi); in nan_de_tx_multicast()
354 os_get_reltime(&srv->last_multicast); in nan_de_tx_multicast()
362 os_get_reltime(&srv->time_started); in nan_de_add_srv()
363 ttl = srv->type == NAN_DE_PUBLISH ? srv->publish.ttl : in nan_de_add_srv()
364 srv->subscribe.ttl; in nan_de_add_srv()
366 srv->end_time = srv->time_started; in nan_de_add_srv()
367 srv->end_time.sec += ttl; in nan_de_add_srv()
370 de->service[srv->id - 1] = srv; in nan_de_add_srv()
371 de->num_service++; in nan_de_add_srv()
378 de->service[srv->id - 1] = NULL; in nan_de_del_srv()
380 de->num_service--; in nan_de_del_srv()
381 if (de->num_service == 0) in nan_de_del_srv()
389 if (os_reltime_initialized(&srv->end_time)) in nan_de_srv_expired()
390 return os_reltime_before(&srv->end_time, now); in nan_de_srv_expired()
392 if (srv->type == NAN_DE_PUBLISH) { in nan_de_srv_expired()
394 if (!os_reltime_initialized(&srv->last_multicast)) in nan_de_srv_expired()
396 if (!srv->publish.fsd) in nan_de_srv_expired()
398 if (os_reltime_initialized(&srv->last_followup) && in nan_de_srv_expired()
399 !os_reltime_expired(now, &srv->last_followup, 1)) in nan_de_srv_expired()
401 if (os_reltime_expired(now, &srv->last_multicast, 1)) in nan_de_srv_expired()
405 if (srv->type == NAN_DE_SUBSCRIBE) { in nan_de_srv_expired()
408 if (!os_reltime_initialized(&srv->first_discovered)) in nan_de_srv_expired()
410 if (!srv->needs_fsd) in nan_de_srv_expired()
412 if (os_reltime_initialized(&srv->last_followup) && in nan_de_srv_expired()
413 !os_reltime_expired(now, &srv->last_followup, 1)) in nan_de_srv_expired()
415 if (os_reltime_expired(now, &srv->first_discovered, 1)) in nan_de_srv_expired()
429 if (srv->type == NAN_DE_PUBLISH && !srv->publish.unsolicited) in nan_de_next_multicast()
430 return -1; in nan_de_next_multicast()
431 if (srv->type == NAN_DE_SUBSCRIBE && !srv->subscribe.active) in nan_de_next_multicast()
432 return -1; in nan_de_next_multicast()
434 if (!os_reltime_initialized(&srv->last_multicast)) in nan_de_next_multicast()
437 if (srv->type == NAN_DE_PUBLISH && srv->publish.ttl == 0) in nan_de_next_multicast()
438 return -1; in nan_de_next_multicast()
440 if (srv->type == NAN_DE_PUBLISH && in nan_de_next_multicast()
441 os_reltime_initialized(&srv->pause_state_end)) in nan_de_next_multicast()
442 return -1; in nan_de_next_multicast()
444 period = srv->type == NAN_DE_PUBLISH ? in nan_de_next_multicast()
445 srv->publish.announcement_period : in nan_de_next_multicast()
446 srv->subscribe.query_period; in nan_de_next_multicast()
449 next = srv->last_multicast; in nan_de_next_multicast()
452 if (srv->type == NAN_DE_PUBLISH) { in nan_de_next_multicast()
453 if (!de->tx_wait_end_freq && srv->publish.unsolicited && in nan_de_next_multicast()
456 next = srv->next_publish_state; in nan_de_next_multicast()
472 int next = -1, tmp; in nan_de_srv_time_to_next()
474 if (os_reltime_initialized(&srv->end_time)) { in nan_de_srv_time_to_next()
475 os_reltime_sub(&srv->end_time, now, &diff); in nan_de_srv_time_to_next()
477 if (next == -1 || tmp < next) in nan_de_srv_time_to_next()
482 if (tmp >= 0 && (next == -1 || tmp < next)) in nan_de_srv_time_to_next()
485 if (srv->type == NAN_DE_PUBLISH && in nan_de_srv_time_to_next()
486 os_reltime_initialized(&srv->last_multicast)) { in nan_de_srv_time_to_next()
488 tmp = srv->publish.fsd ? 1000 : 100; in nan_de_srv_time_to_next()
489 if (next == -1 || tmp < next) in nan_de_srv_time_to_next()
493 if (srv->type == NAN_DE_SUBSCRIBE && in nan_de_srv_time_to_next()
494 os_reltime_initialized(&srv->first_discovered)) { in nan_de_srv_time_to_next()
497 tmp = srv->needs_fsd ? 1000 : 100; in nan_de_srv_time_to_next()
498 if (next == -1 || tmp < next) in nan_de_srv_time_to_next()
502 if (os_reltime_initialized(&srv->next_publish_state)) { in nan_de_srv_time_to_next()
503 os_reltime_sub(&srv->next_publish_state, now, &diff); in nan_de_srv_time_to_next()
508 if (next == -1 || tmp < next) in nan_de_srv_time_to_next()
521 if (force_single || !srv->freq_list || srv->freq_list[0] == 0) in nan_de_start_new_publish_state()
522 srv->in_multi_chan = false; in nan_de_start_new_publish_state()
524 srv->in_multi_chan = !srv->in_multi_chan; in nan_de_start_new_publish_state()
529 srv->next_publish_duration = n * 100; in nan_de_start_new_publish_state()
533 if (os_reltime_initialized(&srv->pause_state_end)) in nan_de_start_new_publish_state()
536 if (srv->in_multi_chan && srv->freq_list && srv->freq_list[0]) { in nan_de_start_new_publish_state()
537 if (!srv->first_multi_chan) in nan_de_start_new_publish_state()
538 srv->multi_chan_idx++; in nan_de_start_new_publish_state()
539 if (srv->freq_list[srv->multi_chan_idx] == 0) in nan_de_start_new_publish_state()
540 srv->multi_chan_idx = 0; in nan_de_start_new_publish_state()
541 srv->first_multi_chan = false; in nan_de_start_new_publish_state()
542 srv->freq = srv->freq_list[srv->multi_chan_idx]; in nan_de_start_new_publish_state()
544 srv->freq = srv->default_freq; in nan_de_start_new_publish_state()
549 srv->in_multi_chan ? "multi" : "single", n * 100, srv->freq); in nan_de_start_new_publish_state()
557 int next = -1; in nan_de_timer()
564 struct nan_de_service *srv = de->service[i]; in nan_de_timer()
572 srv->id); in nan_de_timer()
577 if (os_reltime_initialized(&srv->next_publish_state) && in nan_de_timer()
578 os_reltime_before(&srv->next_publish_state, &now)) in nan_de_timer()
581 if (srv->type == NAN_DE_PUBLISH && in nan_de_timer()
582 os_reltime_initialized(&srv->pause_state_end) && in nan_de_timer()
583 (os_reltime_before(&srv->pause_state_end, &now) || in nan_de_timer()
584 (srv->publish.fsd && in nan_de_timer()
585 os_reltime_initialized(&srv->last_followup) && in nan_de_timer()
586 os_reltime_expired(&now, &srv->last_followup, 1)))) in nan_de_timer()
590 if (srv_next >= 0 && (next == -1 || srv_next < next)) in nan_de_timer()
594 de->listen_freq == 0 && de->ext_listen_freq == 0 && in nan_de_timer()
595 de->tx_wait_end_freq == 0 && in nan_de_timer()
601 if (!started && de->cb.listen && in nan_de_timer()
602 de->listen_freq == 0 && de->ext_listen_freq == 0 && in nan_de_timer()
603 de->tx_wait_end_freq == 0 && in nan_de_timer()
604 ((srv->type == NAN_DE_PUBLISH && in nan_de_timer()
605 !srv->publish.unsolicited && srv->publish.solicited) || in nan_de_timer()
606 (srv->type == NAN_DE_SUBSCRIBE && in nan_de_timer()
607 !srv->subscribe.active))) { in nan_de_timer()
610 if (srv->type == NAN_DE_PUBLISH) { in nan_de_timer()
618 if (de->cb.listen(de->cb.ctx, srv->freq, duration) == 0) in nan_de_timer()
619 de->listen_freq = srv->freq; in nan_de_timer()
653 if (freq != de->listen_freq) in nan_de_listen_started()
654 de->ext_listen_freq = freq; in nan_de_listen_started()
660 if (freq == de->ext_listen_freq) in nan_de_listen_ended()
661 de->ext_listen_freq = 0; in nan_de_listen_ended()
663 if (freq == de->listen_freq) { in nan_de_listen_ended()
664 de->listen_freq = 0; in nan_de_listen_ended()
672 if (freq == de->tx_wait_status_freq) in nan_de_tx_status()
673 de->tx_wait_status_freq = 0; in nan_de_tx_status()
679 de->tx_wait_end_freq = 0; in nan_de_tx_wait_ended()
690 while (end - pos >= NAN_ATTR_HDR_LEN) { in nan_de_get_attr()
698 if (attr_len > end - pos) { in nan_de_get_attr()
701 attr_id, attr_len, end - pos); in nan_de_get_attr()
708 skip--; in nan_de_get_attr()
740 continue; /* Mismatching Instance ID */ in nan_de_get_sdea()
746 if (end - sdea < 4) in nan_de_get_sdea()
752 if (end - sdea < 1) in nan_de_get_sdea()
757 if (end - sdea >= 2) { in nan_de_get_sdea()
763 if (srv_info_len > end - sdea) in nan_de_get_sdea()
770 *ssi_len = srv_info_len - 4; in nan_de_get_sdea()
784 if (!os_reltime_initialized(&srv->first_discovered)) { in nan_de_rx_publish()
785 os_get_reltime(&srv->first_discovered); in nan_de_rx_publish()
786 srv->needs_fsd = sdea_control & NAN_SDEA_CTRL_FSD_REQ; in nan_de_rx_publish()
790 if (srv->subscribe.active && req_instance_id == 0) { in nan_de_rx_publish()
796 if (!srv->subscribe.active && req_instance_id == 0) { in nan_de_rx_publish()
797 /* Passive subscriber replies with a Follow-up message without in nan_de_rx_publish()
800 nan_de_transmit(de, srv->id, NULL, NULL, peer_addr, in nan_de_rx_publish()
804 if (de->cb.discovery_result) in nan_de_rx_publish()
805 de->cb.discovery_result( in nan_de_rx_publish()
806 de->cb.ctx, srv->id, srv_proto_type, in nan_de_rx_publish()
835 if (len > end - pos) in nan_de_filter_match()
838 /* A non-empty Matching Filter entry: no match since in nan_de_filter_match()
865 if (!srv->publish.solicited) in nan_de_rx_subscribe()
868 if (os_reltime_initialized(&srv->pause_state_end) && in nan_de_rx_subscribe()
869 (!ether_addr_equal(peer_addr, srv->sel_peer_addr) || in nan_de_rx_subscribe()
870 instance_id != srv->sel_peer_id)) { in nan_de_rx_subscribe()
872 "NAN: In pauseState - ignore Subscribe message from another subscriber"); in nan_de_rx_subscribe()
883 if (srv->ssi) in nan_de_rx_subscribe()
884 sdea_len += 2 + 4 + wpabuf_len(srv->ssi); in nan_de_rx_subscribe()
888 if (srv->elems) in nan_de_rx_subscribe()
889 len += NAN_ATTR_HDR_LEN + 1 + wpabuf_len(srv->elems); in nan_de_rx_subscribe()
898 wpabuf_put_data(buf, srv->service_id, NAN_SERVICE_ID_LEN); in nan_de_rx_subscribe()
899 wpabuf_put_u8(buf, srv->id); /* Instance ID */ in nan_de_rx_subscribe()
900 wpabuf_put_u8(buf, instance_id); /* Requestor Instance ID */ in nan_de_rx_subscribe()
905 if (srv->type == NAN_DE_PUBLISH || srv->ssi) { in nan_de_rx_subscribe()
908 wpabuf_put_u8(buf, srv->id); /* Instance ID */ in nan_de_rx_subscribe()
909 if (srv->type == NAN_DE_PUBLISH) { in nan_de_rx_subscribe()
910 if (srv->publish.fsd) in nan_de_rx_subscribe()
912 if (srv->publish.fsd_gas) in nan_de_rx_subscribe()
916 if (srv->ssi) { in nan_de_rx_subscribe()
917 wpabuf_put_le16(buf, 4 + wpabuf_len(srv->ssi)); in nan_de_rx_subscribe()
919 wpabuf_put_u8(buf, srv->srv_proto_type); in nan_de_rx_subscribe()
920 wpabuf_put_buf(buf, srv->ssi); in nan_de_rx_subscribe()
925 if (srv->elems) { in nan_de_rx_subscribe()
927 wpabuf_put_le16(buf, 1 + wpabuf_len(srv->elems)); in nan_de_rx_subscribe()
929 wpabuf_put_buf(buf, srv->elems); in nan_de_rx_subscribe()
932 /* Wi-Fi Aware specification v4.0 uses NAN Cluster ID as A3 for USD, in nan_de_rx_subscribe()
935 nan_de_tx(de, srv->freq, 100, in nan_de_rx_subscribe()
936 srv->publish.solicited_multicast ? nan_network_id : peer_addr, in nan_de_rx_subscribe()
937 de->nmi, wildcard_bssid, buf); in nan_de_rx_subscribe()
942 if (!srv->publish.disable_events && de->cb.replied) in nan_de_rx_subscribe()
943 de->cb.replied(de->cb.ctx, srv->id, peer_addr, instance_id, in nan_de_rx_subscribe()
952 /* Follow-up function processing of a receive Follow-up message for a in nan_de_rx_follow_up()
953 * Subscribe or Publish instance */ in nan_de_rx_follow_up()
955 if (srv->type == NAN_DE_PUBLISH && in nan_de_rx_follow_up()
956 os_reltime_initialized(&srv->pause_state_end) && in nan_de_rx_follow_up()
957 (!ether_addr_equal(peer_addr, srv->sel_peer_addr) || in nan_de_rx_follow_up()
958 instance_id != srv->sel_peer_id || in nan_de_rx_follow_up()
961 "NAN: In pauseState - ignore Follow-up message from another subscriber or without ssi"); in nan_de_rx_follow_up()
965 os_get_reltime(&srv->last_followup); in nan_de_rx_follow_up()
967 if (srv->type == NAN_DE_PUBLISH && !ssi) in nan_de_rx_follow_up()
970 if (de->cb.receive) in nan_de_rx_follow_up()
971 de->cb.receive(de->cb.ctx, srv->id, instance_id, ssi, ssi_len, in nan_de_rx_follow_up()
1004 …"NAN: SDA - Service ID %02x%02x%02x%02x%02x%02x Instance ID %u Requestor Instance ID %u Service Co… in nan_de_rx_sda()
1017 if (end - sda < 2) in nan_de_rx_sda()
1025 if (end - sda < 1) in nan_de_rx_sda()
1028 if (end - sda < flen) in nan_de_rx_sda()
1038 if (end - sda < 1) in nan_de_rx_sda()
1041 if (end - sda < flen) in nan_de_rx_sda()
1049 if (end - sda < 1) in nan_de_rx_sda()
1052 if (end - sda < flen) in nan_de_rx_sda()
1057 ssi_len = flen - 4; in nan_de_rx_sda()
1066 struct nan_de_service *srv = de->service[i]; in nan_de_rx_sda()
1070 if (os_memcmp(srv->service_id, service_id, in nan_de_rx_sda()
1074 if (srv->type == NAN_DE_PUBLISH) in nan_de_rx_sda()
1076 if (req_instance_id && srv->id != req_instance_id) in nan_de_rx_sda()
1080 srv->type == NAN_DE_SUBSCRIBE) in nan_de_rx_sda()
1129 if (!de->num_service) in nan_de_rx_sdf()
1152 int i = de->next_handle; in nan_de_get_handle()
1154 if (de->num_service >= NAN_DE_MAX_SERVICE) in nan_de_get_handle()
1158 if (!de->service[i]) { in nan_de_get_handle()
1159 de->next_handle = (i + 1) % NAN_DE_MAX_SERVICE; in nan_de_get_handle()
1163 } while (i != de->next_handle); in nan_de_get_handle()
1167 return -1; in nan_de_get_handle()
1179 name = os_strdup(srv->service_name); in nan_de_derive_service_id()
1181 return -1; in nan_de_derive_service_id()
1193 os_memcpy(srv->service_id, hash, NAN_SERVICE_ID_LEN); in nan_de_derive_service_id()
1208 wpa_printf(MSG_DEBUG, "NAN: Publish() - no service_name"); in nan_de_publish()
1209 return -1; in nan_de_publish()
1212 if (!params->unsolicited && !params->solicited) { in nan_de_publish()
1214 "NAN: Publish() - both unsolicited and solicited disabled is invalid"); in nan_de_publish()
1215 return -1; in nan_de_publish()
1220 return -1; in nan_de_publish()
1224 return -1; in nan_de_publish()
1225 srv->type = NAN_DE_PUBLISH; in nan_de_publish()
1226 srv->freq = srv->default_freq = params->freq; in nan_de_publish()
1227 srv->service_name = os_strdup(service_name); in nan_de_publish()
1228 if (!srv->service_name) in nan_de_publish()
1232 os_memcpy(&srv->publish, params, sizeof(*params)); in nan_de_publish()
1234 if (params->freq_list) { in nan_de_publish()
1237 len = (int_array_len(params->freq_list) + 1) * sizeof(int); in nan_de_publish()
1238 srv->freq_list = os_memdup(params->freq_list, len); in nan_de_publish()
1239 if (!srv->freq_list) in nan_de_publish()
1242 srv->publish.freq_list = NULL; in nan_de_publish()
1244 srv->srv_proto_type = srv_proto_type; in nan_de_publish()
1246 srv->ssi = wpabuf_dup(ssi); in nan_de_publish()
1247 if (!srv->ssi) in nan_de_publish()
1251 srv->elems = wpabuf_dup(elems); in nan_de_publish()
1252 if (!srv->elems) in nan_de_publish()
1256 /* Prepare for single and multi-channel states; starting with in nan_de_publish()
1258 srv->first_multi_chan = true; in nan_de_publish()
1263 srv->id = publish_id; in nan_de_publish()
1269 return -1; in nan_de_publish()
1281 srv = de->service[publish_id - 1]; in nan_de_cancel_publish()
1282 if (!srv || srv->type != NAN_DE_PUBLISH) in nan_de_cancel_publish()
1296 return -1; in nan_de_update_publish()
1297 srv = de->service[publish_id - 1]; in nan_de_update_publish()
1298 if (!srv || srv->type != NAN_DE_PUBLISH) in nan_de_update_publish()
1299 return -1; in nan_de_update_publish()
1301 wpabuf_free(srv->ssi); in nan_de_update_publish()
1302 srv->ssi = NULL; in nan_de_update_publish()
1305 srv->ssi = wpabuf_dup(ssi); in nan_de_update_publish()
1306 if (!srv->ssi) in nan_de_update_publish()
1307 return -1; in nan_de_update_publish()
1321 wpa_printf(MSG_DEBUG, "NAN: Subscribe() - no service_name"); in nan_de_subscribe()
1322 return -1; in nan_de_subscribe()
1327 return -1; in nan_de_subscribe()
1331 return -1; in nan_de_subscribe()
1332 srv->type = NAN_DE_SUBSCRIBE; in nan_de_subscribe()
1333 srv->freq = params->freq; in nan_de_subscribe()
1334 srv->service_name = os_strdup(service_name); in nan_de_subscribe()
1335 if (!srv->service_name) in nan_de_subscribe()
1339 os_memcpy(&srv->subscribe, params, sizeof(*params)); in nan_de_subscribe()
1340 srv->srv_proto_type = srv_proto_type; in nan_de_subscribe()
1342 srv->ssi = wpabuf_dup(ssi); in nan_de_subscribe()
1343 if (!srv->ssi) in nan_de_subscribe()
1347 srv->elems = wpabuf_dup(elems); in nan_de_subscribe()
1348 if (!srv->elems) in nan_de_subscribe()
1354 srv->id = subscribe_id; in nan_de_subscribe()
1360 return -1; in nan_de_subscribe()
1370 srv = de->service[subscribe_id - 1]; in nan_de_cancel_subscribe()
1371 if (!srv || srv->type != NAN_DE_SUBSCRIBE) in nan_de_cancel_subscribe()
1384 return -1; in nan_de_transmit()
1386 srv = de->service[handle - 1]; in nan_de_transmit()
1388 return -1; in nan_de_transmit()
1393 os_get_reltime(&srv->last_followup); in nan_de_transmit()