Gabriel Biren | 910d5df | 2022-04-08 18:21:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.hardware.wifi; |
| 18 | |
| 19 | import android.hardware.wifi.NanCipherSuiteType; |
| 20 | import android.hardware.wifi.NanRangingIndication; |
| 21 | |
| 22 | /** |
| 23 | * Match indication structure. |
| 24 | */ |
| 25 | @VintfStability |
| 26 | parcelable NanMatchInd { |
| 27 | /** |
| 28 | * Publish or subscribe discovery session ID of an existing discovery session. |
| 29 | * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID |
| 30 | */ |
| 31 | byte discoverySessionId; |
| 32 | /** |
| 33 | * A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| |
| 34 | * or to set up a data-path. |
| 35 | */ |
| 36 | int peerId; |
| 37 | /** |
| 38 | * The NAN Discovery (management) MAC address of the peer. |
| 39 | */ |
| 40 | byte[6] addr; |
| 41 | /** |
| 42 | * The arbitrary information contained in the |NanDiscoveryCommonConfig.serviceSpecificInfo| of |
| 43 | * the peer's discovery session configuration. |
| 44 | * Max length: |NanCapabilities.maxServiceSpecificInfoLen|. |
| 45 | * NAN Spec: Service Descriptor Attribute (SDA) / Service Info |
| 46 | */ |
| 47 | byte[] serviceSpecificInfo; |
| 48 | /** |
| 49 | * Arbitrary information communicated in discovery packets. There is no semantic meaning to |
| 50 | * these bytes. They are passed-through from publisher to subscriber as-is with no parsing. Max |
| 51 | * length: |NanCapabilities.maxExtendedServiceSpecificInfoLen|. Spec: Service Descriptor |
| 52 | * Extension Attribute (SDEA) / Service Info |
| 53 | */ |
| 54 | byte[] extendedServiceSpecificInfo; |
| 55 | /** |
| 56 | * The match filter from the discovery packet (publish or subscribe) which caused service |
| 57 | * discovery. Matches the |NanDiscoveryCommonConfig.txMatchFilter| of the peer's Unsolicited |
| 58 | * publish message or of the local device's Active subscribe message. |
| 59 | * Max length: |NanCapabilities.maxMatchFilterLen|. |
| 60 | * NAN Spec: Service Descriptor Attribute (SDA) / Matching Filter |
| 61 | */ |
| 62 | byte[] matchFilter; |
| 63 | /** |
| 64 | * Indicates the type of discovery: true if match occurred on a Beacon frame, false if the match |
| 65 | * occurred on a Service Discovery Frame (SDF). |
| 66 | */ |
| 67 | boolean matchOccurredInBeaconFlag; |
| 68 | /** |
| 69 | * Flag to indicate firmware is out of resources and that it can no longer track this Service |
| 70 | * Name. Indicates that while |IWifiNanIfaceEventCallback.eventMatch| will be received, the |
| 71 | * |NanDiscoveryCommonConfig.discoveryMatchIndicator| configuration will not be honored. |
| 72 | */ |
| 73 | boolean outOfResourceFlag; |
| 74 | /** |
| 75 | * If RSSI filtering was enabled using |NanDiscoveryCommonConfig.useRssiThreshold| in discovery |
| 76 | * session setup, then this field contains the received RSSI value. It will contain 0 if RSSI |
| 77 | * filtering was not enabled. |
| 78 | * RSSI values are returned without sign, e.g. -70dBm will be returned as 70. |
| 79 | */ |
| 80 | byte rssiValue; |
| 81 | /** |
| 82 | * Cipher type for data-paths constructed in the context of this discovery session. Valid if |
| 83 | * |peerRequiresSecurityEnabledInNdp| is true. |
| 84 | */ |
| 85 | NanCipherSuiteType peerCipherType; |
| 86 | /** |
| 87 | * Indicates whether or not the peer requires security enabled in any data-path (NDP) |
| 88 | * constructed in the context of this discovery session. The |cipherType| specifies the cipher |
| 89 | * type for such data-paths. NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / |
| 90 | * Security Required |
| 91 | */ |
| 92 | boolean peerRequiresSecurityEnabledInNdp; |
| 93 | /** |
| 94 | * Indicates whether or not the peer requires (and hence allows) ranging in the context of this |
| 95 | * discovery session. |
| 96 | * Note that ranging is only performed if all other match criteria with the peer are met. |
| 97 | * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require. |
| 98 | */ |
| 99 | boolean peerRequiresRanging; |
| 100 | /** |
| 101 | * Ranging indication supersedes the NanMatchAlg specification. |
| 102 | * Ex: If NanMatchAlg is MATCH_ONCE, but ranging indication is continuous, then continuous |
| 103 | * match notifications will be received (with ranging information). |
| 104 | * Ranging indication data is provided if Ranging required is enabled in the discovery |
| 105 | * specification and: |
| 106 | * 1) continuous ranging is specified. |
| 107 | * 2) ingress/egress is specified and: |
| 108 | * - notify once for ingress >= ingress_distance and egress <= egress_distance, |
| 109 | * - same for ingress_egress_both |
| 110 | * If the Awake DW intervals are larger than the ranging intervals, then priority is given |
| 111 | * to the device DW intervals. |
| 112 | * |
| 113 | * If ranging was required and executed, this contains the distance to the peer in mm. The |
| 114 | * |rangingIndicationType| field specifies the event which triggered ranging. |
| 115 | */ |
| 116 | int rangingMeasurementInMm; |
| 117 | /** |
| 118 | * The ranging event(s) which triggered the ranging. e.g. can indicate that continuous ranging |
| 119 | * was requested, or else that an ingress event occurred. |
| 120 | */ |
| 121 | NanRangingIndication rangingIndicationType; |
| 122 | /** |
| 123 | * Security Context Identifier attribute contains PMKID. Shall be included in NDP setup and |
| 124 | * response messages. Security Context Identifie identifies the Security Context. For NAN |
| 125 | * Shared Key Cipher Suite, this field contains the 16 octet PMKID identifying the PMK used for |
| 126 | * setting up the Secure Data Path. |
| 127 | */ |
| 128 | byte[] scid; |
| 129 | } |