1 1.1 christos Wi-Fi Aware unsynchronized service discovery (NAN USD) 2 1.1 christos ====================================================== 3 1.1 christos 4 1.1 christos This document descibes how the unsynchronized service discovery defined 5 1.1 christos in the Wi-Fi Aware specification v4.0 can be used with wpa_spplicant. 6 1.1 christos 7 1.1 christos More information about Wi-Fi Aware is available from this Wi-Fi 8 1.1 christos Alliance web page: 9 1.1 christos https://www.wi-fi.org/discover-wi-fi/wi-fi-aware 10 1.1 christos 11 1.1 christos Build config setup 12 1.1 christos ------------------ 13 1.1 christos 14 1.1 christos The following parameters must be included in the config file used to 15 1.1 christos compile hostapd and wpa_supplicant. 16 1.1 christos 17 1.1 christos wpa_supplicant build config 18 1.1 christos --------------------------- 19 1.1 christos 20 1.1 christos Enable NAN USD in wpa_supplicant build config file 21 1.1 christos 22 1.1 christos CONFIG_NAN_USD=y 23 1.1 christos 24 1.1 christos Control interface commands and events 25 1.1 christos ------------------------------------- 26 1.1 christos 27 1.1 christos Following control interface commands can be used: 28 1.1 christos 29 1.1 christos NAN_PUBLISH service_name=<name> [ttl=<time-to-live-in-sec>] [freq=<in MHz>] [freq_list=<comma separate list of MHz>] [srv_proto_type=<type>] [ssi=<service specific information (hexdump)>] [solicited=0] [unsolicited=0] [fsd=0] 30 1.1 christos 31 1.1 christos If ttl=0 or the parameter is not included, only one Publish message is 32 1.1 christos transmitted. 33 1.1 christos 34 1.1 christos If freq is not included, the default frequency 2437 MHz (channel 6 on 35 1.1 christos the 2.4 GHz band) is used. 36 1.1 christos 37 1.1 christos If freq_list is included, publisher iterates over all the listed 38 1.1 christos channels. A special freq_list=all value can be used to generate the 39 1.1 christos channel list automatically based on the list of allowed 2.4 and 5 GHz 40 1.1 christos channels. 41 1.1 christos 42 1.1 christos srv_proto_type values are defined in the Service Protocol Types table in 43 1.1 christos the Wi-Fi Aware specification. 44 1.1 christos 45 1.1 christos This command returns the assigned publish_id value or FAIL on failure. 46 1.1 christos 47 1.1 christos This command maps to the Publish() method in the NAN Discovery Engine. 48 1.1 christos 49 1.1 christos NAN_CANCEL_PUBLISH publish_id=<id from NAN_PUBLISH> 50 1.1 christos 51 1.1 christos This command maps to the CancelPublish() method in the NAN Discovery 52 1.1 christos Engine. 53 1.1 christos 54 1.1 christos NAN_UPDATE_PUBLISH publish_id=<id from NAN_PUBLISH> [ssi=<service specific information (hexdump)>] 55 1.1 christos 56 1.1 christos This command maps to the UpdatePublish() method in the NAN Discovery 57 1.1 christos Engine. 58 1.1 christos 59 1.1 christos NAN_SUBSCRIBE service_name=<name> [active=1] [ttl=<time-to-live-in-sec>] [freq=<in MHz>] [srv_proto_type=<type>] [ssi=<service specific information (hexdump)>] 60 1.1 christos 61 1.1 christos If ttl=0 or the parameter is not included, operation is terminated once 62 1.1 christos the first matching publisher is found. 63 1.1 christos 64 1.1 christos If freq is not included, the default frequency 2437 MHz (channel 6 on 65 1.1 christos the 2.4 GHz band) is used. 66 1.1 christos 67 1.1 christos srv_proto_type values are defined in the Service Protocol Types table in 68 1.1 christos the Wi-Fi Aware specification. 69 1.1 christos 70 1.1 christos This command returns the assigned subscribe_id value or FAIL on failure. 71 1.1 christos 72 1.1 christos This command maps to the Subscribe() method in the NAN Discovery Engine. 73 1.1 christos 74 1.1 christos NAN_CANCEL_SUBSCRIBE subscribe_id=<id from NAN_SUBSCRIBE> 75 1.1 christos 76 1.1 christos This command maps to the CancelSubscribe() method in the NAN Discovery Engine. 77 1.1 christos 78 1.1 christos NAN_TRANSMIT handle=<id from NAN_PUBLISH or NAN_SUBSCRIBE> req_instance_id=<peer's id> address=<peer's MAC address> [ssi=<service specific information (hexdump)>] 79 1.1 christos 80 1.1 christos This command maps to the Transmit() method in the NAN Discovery Engine. 81 1.1 christos 82 1.1 christos Following control interface events are used: 83 1.1 christos 84 1.1 christos NAN-DISCOVERY-RESULT subscribe_id=<own id> publish_id=<peer's id> address=<peer MAC address> fsd=<0/1> fsd_gas=<0/1> srv_proto_type=<type> ssi=<service specific information (hexdump)> 85 1.1 christos 86 1.1 christos This event maps to the DiscoveryResult() event in the NAN Discovery 87 1.1 christos Engine. 88 1.1 christos 89 1.1 christos NAN-REPLIED publish_id=<own id> address=<peer MAC address> subscribe_id=<peer id> srv_proto_type=<ype> ssi=<service specific information (hexdump)> 90 1.1 christos 91 1.1 christos This event maps to the Replied() event in the NAN Discovery Engine. 92 1.1 christos 93 1.1 christos NAN-PUBLISH-TERMINATED publish_id=<own id> reason=<timeout/user-request/failure> 94 1.1 christos 95 1.1 christos This event maps to the PublishTerminated() event in the NAN Discovery 96 1.1 christos Engine. 97 1.1 christos 98 1.1 christos NAN-SUBSCRIBE-TERMINATED subscribe_id=<own id> reason=<timeout/user-request/failure> 99 1.1 christos 100 1.1 christos This event maps to the SubscribeTerminate() event in the NAN Discovery 101 1.1 christos Engine. 102 1.1 christos 103 1.1 christos NAN-RECEIVE id=<own id> peer_instance_id=<peer id> address=<peer MAC adress> ssi=<service specific information (hexdump)> 104 1.1 christos 105 1.1 christos This event maps to the Receive() event in the NAN Discovery Engine. 106 1.1 christos 107 1.1 christos 108 1.1 christos Example operation 109 1.1 christos ----------------- 110 1.1 christos 111 1.1 christos Start Subscribe and Publish functions: 112 1.1 christos 113 1.1 christos dev0: NAN_SUBSCRIBE service_name=_test srv_proto_type=3 ssi=1122334455 114 1.1 christos --> returns 7 115 1.1 christos 116 1.1 christos dev1: NAN_PUBLISH service_name=_test srv_proto_type=3 ssi=6677 117 1.1 christos --> returns 5 118 1.1 christos 119 1.1 christos Subscriber notification of a discovery: 120 1.1 christos 121 1.1 christos event on dev0: <3>NAN-DISCOVERY-RESULT subscribe_id=7 publish_id=5 address=02:00:00:00:01:00 fsd=1 fsd_gas=0 srv_proto_type=3 ssi=6677 122 1.1 christos 123 1.1 christos Publisher notification of a Follow-up message with no ssi (to enter 124 1.1 christos paused state to continue exchange with the subscriber): 125 1.1 christos 126 1.1 christos event on dev1: <3>NAN-RECEIVE id=5 peer_instance_id=7 address=02:00:00:00:00:00 ssi= 127 1.1 christos 128 1.1 christos Subscriber sending a Follow-up message: 129 1.1 christos 130 1.1 christos dev0: NAN_TRANSMIT handle=7 req_instance_id=5 address=02:00:00:00:01:00 ssi=8899 131 1.1 christos 132 1.1 christos Publisher receiving the Follow-up message: 133 1.1 christos 134 1.1 christos event on dev1: <3>NAN-RECEIVE id=5 peer_instance_id=7 address=02:00:00:00:00:00 ssi=8899 135 1.1 christos 136 1.1 christos Publisher sending a Follow-up message: 137 1.1 christos 138 1.1 christos dev1: NAN_TRANSMIT handle=5 req_instance_id=7 address=02:00:00:00:00:00 ssi=aabbccdd 139 1.1 christos 140 1.1 christos Subscriber receiving the Follow-up message: 141 1.1 christos 142 1.1 christos event on dev0: <3>NAN-RECEIVE id=7 peer_instance_id=5 address=02:00:00:00:01:00 ssi=aabbccdd 143 1.1 christos 144 1.1 christos Stop Subscribe and Publish functions: 145 1.1 christos 146 1.1 christos dev0: NAN_CANCEL_SUBSCRIBE subscribe_id=7 147 1.1 christos dev1: NAN_CANCEL_PUBLIST publish_id=5 148