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