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