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