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