From 5c3a0d9666ea8f61e893791a115304819a816fd0 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 18 Jan 2017 09:23:18 -0800 Subject: [PATCH] wifi(interface): Use the "bitfield" type for masks Change all the variables representing masks to the new bitfield type in all the Wifi HIDL interfaces. The generated code will still produce the underlying type of enum as param. So, no changes are needed in the implementation. Bug: 33358724 Test: Compiles Change-Id: Id2e5dee2ce1f1ec8e744aa1c81d3cb9c66e7fc39 --- wifi/1.0/IWifiChip.hal | 3 +- wifi/1.0/IWifiStaIface.hal | 4 +- wifi/1.0/types.hal | 62 +++++++++---------- wifi/supplicant/1.0/ISupplicantP2pIface.hal | 5 +- wifi/supplicant/1.0/ISupplicantStaNetwork.hal | 22 ++++--- 5 files changed, 51 insertions(+), 45 deletions(-) diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal index d790404325..b0598a4f60 100644 --- a/wifi/1.0/IWifiChip.hal +++ b/wifi/1.0/IWifiChip.hal @@ -205,7 +205,8 @@ interface IWifiChip { * |WifiStatusCode.ERROR_UNKNOWN| * @return capabilities Bitset of |ChipCapabilityMask| values. */ - getCapabilities() generates (WifiStatus status, uint32_t capabilities); + getCapabilities() + generates (WifiStatus status, bitfield capabilities); /** * Get the set of operation modes that the chip supports. diff --git a/wifi/1.0/IWifiStaIface.hal b/wifi/1.0/IWifiStaIface.hal index 7dad8aff5a..6a738a9092 100644 --- a/wifi/1.0/IWifiStaIface.hal +++ b/wifi/1.0/IWifiStaIface.hal @@ -120,7 +120,9 @@ interface IWifiStaIface extends IWifiIface { * |WifiStatusCode.ERROR_UNKNOWN| * @return capabilities Bitset of |StaIfaceCapabilityMask| values. */ - getCapabilities() generates (WifiStatus status, uint32_t capabilities); + getCapabilities() + generates (WifiStatus status, + bitfield capabilities); /** * Used to query additional information about the chip's APF capabilities. diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal index 1e86be437a..edf306d4c4 100644 --- a/wifi/1.0/types.hal +++ b/wifi/1.0/types.hal @@ -254,7 +254,7 @@ struct StaBackgroundScanCapabilities { * Bands that can be specified in Background scan requests. */ enum StaBackgroundScanBand : uint32_t { - BAND_UNSPECIFIED, + BAND_UNSPECIFIED = 0, /** * 2.4 GHz. */ @@ -325,10 +325,10 @@ struct StaBackgroundScanBucketParameters { */ uint32_t periodInMs; /** - * Bitset of |BackgroundScanBucketEventReportSchemeMask| values controlling + * Bitset of |StaBackgroundScanBucketEventReportSchemeMask| values controlling * when events for this bucket must be reported. */ - uint32_t eventReportScheme; + bitfield eventReportScheme; /** * For exponential back off. If |exponentialMaxPeriodInMs| is non zero or * different than period, then this bucket is an exponential backoff bucket @@ -503,7 +503,7 @@ struct StaScanData { /** * Bitset containing |ScanDataFlagMask| values. */ - uint32_t flags; + bitfield flags; /** * Bitset where each bit indicates if the bucket with that index was * scanned. @@ -842,6 +842,23 @@ struct NanEnableRequest { NanDebugConfig debugConfigs; }; +/** + * Cipher suite flags - to be used as a bitmask. + */ +enum NanCipherSuiteType : uint32_t { + SHARED_KEY_128_MASK = 1 << 0, + SHARED_KEY_256_MASK = 1 << 1 +}; + +/** + * Ranging in the context of discovery sessions indication controls - to be used as a bitmask. + */ +enum NanRangingIndication : uint32_t { + CONTINUOUS_INDICATION_MASK = 1 << 0, + INGRESS_MET_MASK = 1 << 1, + EGRESS_MET_MASK = 1 << 2 +}; + /** * Configurations of NAN discovery sessions: common to publish and subscribe discovery. */ @@ -921,7 +938,7 @@ struct NanDiscoveryCommonConfig { * Cipher types supported in data-paths constructed in the context of this discovery session. The * |NanCipherSuiteType| bit fields are used to set this value. */ - uint32_t supportedCipherTypes; + bitfield supportedCipherTypes; /** * Optional PMK for data-paths constructed in the context of this discovery session. A PMK could * also be provided during the actual construction of the data-path (which allows unique PMKs for @@ -949,7 +966,7 @@ struct NanDiscoveryCommonConfig { * The type of ranging indication feedback to be provided by discovery session matches. Use * bit-fields from |NanRangingIndication|. */ - uint32_t configRangingIndications; + bitfield configRangingIndications; /** * The ingress and egress distance in cm. If ranging is eanbled (|rangingEnabled| is true) then * \configRangingIndications\ is used to determine whether ingress and/or egress (or neither) @@ -959,23 +976,6 @@ struct NanDiscoveryCommonConfig { uint32_t distanceEgressCm; }; -/** - * Cipher suite flags - to be used as a bitmask. - */ -enum NanCipherSuiteType : uint32_t { - SHARED_KEY_128_MASK = 1 << 0, - SHARED_KEY_256_MASK = 1 << 1 -}; - -/** - * Ranging in the context of discovery sessions indication controls - to be used as a bitmask. - */ -enum NanRangingIndication : uint32_t { - CONTINUOUS_INDICATION_MASK = 1 << 0, - INGRESS_MET_MASK = 1 << 1, - EGRESS_MET_MASK = 1 << 2 -}; - /** * Publish request: specifies a publish discovery operation. */ @@ -1111,7 +1111,7 @@ struct NanInitiateDataPathRequest { * Cipher types supported in data-paths constructed in the context of this discovery session. The * |NanCipherSuiteType| bit fields are used to set this value. */ - uint32_t supportedCipherTypes; + bitfield supportedCipherTypes; /** * PMK of the data-path being requested (if |securityRequired| is true). * Max length: 32 @@ -1150,7 +1150,7 @@ struct NanRespondToDataPathIndicationRequest { * Cipher types supported in data-paths constructed in the context of this discovery session. The * |NanCipherSuiteType| bit fields are used to set this value. */ - uint32_t supportedCipherTypes; + bitfield supportedCipherTypes; /** * PMK of the data-path being requested (if |securityRequired| is true). * Max length: 32 @@ -1243,7 +1243,7 @@ struct NanCapabilities { /** * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used. */ - uint32_t supportedCipherSuites; + bitfield supportedCipherSuites; }; /** @@ -1294,7 +1294,7 @@ struct NanMatchInd { * Cipher types supported by the peer for data-paths constructed in the context of this discovery * session. The |NanCipherSuiteType| bit fields are used to set this value. */ - uint32_t peerSupportedCipherTypes; + bitfield peerSupportedCipherTypes; /** * Indicates whether or not the peer requires security enabled in any data-path (NDP) constructed * in the context of this discovery session. @@ -1327,7 +1327,7 @@ struct NanMatchInd { * The ranging event(s) which triggered the ranging. Uses bit-fields from |NanRangingIndication|. * E.g. can indicate that continuous ranging is required, or else that an ingress event occurred. */ - uint32_t rangingIndicationType; + bitfield rangingIndicationType; }; /** @@ -1421,7 +1421,7 @@ struct NanBeaconSdfPayloadInd { * Frames on which this vendor specific attribute was received. * Mask |NanVsaRxFrameMask| defined above. */ - uint8_t vsaReceivedOnFrames; + bitfield vsaReceivedOnFrames; /** * Organizationally Unique Identifier (OUI) of the vendor-specific attribute. */ @@ -1811,12 +1811,12 @@ struct RttCapabilities { * Bit mask indicates what preamble is supported by initiator. * Combination of |RttPreamble| values. */ - uint8_t preambleSupport; + bitfield preambleSupport; /** * Bit mask indicates what BW is supported by initiator. * Combination of |RttBw| values. */ - uint8_t bwSupport; + bitfield bwSupport; /** * Draft 11mc spec version supported by chip. * For instance, version 4.0 must be 40 and version 4.3 must be 43 etc. diff --git a/wifi/supplicant/1.0/ISupplicantP2pIface.hal b/wifi/supplicant/1.0/ISupplicantP2pIface.hal index ed0b49faa6..45e90f3104 100644 --- a/wifi/supplicant/1.0/ISupplicantP2pIface.hal +++ b/wifi/supplicant/1.0/ISupplicantP2pIface.hal @@ -410,10 +410,11 @@ interface ISupplicantP2pIface extends ISupplicantIface { * |SupplicantStatusCode.SUCCESS|, * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_IFACE_INVALID| - * @return capabilityMask Combination of |GroupCapabilityMask| values. + * @return capabilityMask Combination of |P2pGroupCapabilityMask| values. */ getGroupCapability(MacAddress peerAddress) - generates (SupplicantStatus status, uint32_t capabilities); + generates (SupplicantStatus status, + bitfield capabilities); /** * This command can be used to add a bonjour service. diff --git a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal index 7d86f42e7e..b347c1dce9 100644 --- a/wifi/supplicant/1.0/ISupplicantStaNetwork.hal +++ b/wifi/supplicant/1.0/ISupplicantStaNetwork.hal @@ -197,7 +197,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ - setKeyMgmt(uint32_t keyMgmtMask) generates (SupplicantStatus status); + setKeyMgmt(bitfield keyMgmtMask) generates (SupplicantStatus status); /** * Set proto mask for the network. @@ -211,7 +211,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ - setProto(uint32_t protoMask) generates (SupplicantStatus status); + setProto(bitfield protoMask) generates (SupplicantStatus status); /** * Set auth alg mask for the network. @@ -225,7 +225,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ - setAuthAlg(uint32_t authAlgMask) generates (SupplicantStatus status); + setAuthAlg(bitfield authAlgMask) generates (SupplicantStatus status); /** * Set group cipher mask for the network. @@ -239,7 +239,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ - setGroupCipher(uint32_t groupCipherMask) + setGroupCipher(bitfield groupCipherMask) generates (SupplicantStatus status); /** @@ -254,7 +254,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * |SupplicantStatusCode.FAILURE_UNKNOWN|, * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ - setPairwiseCipher(uint32_t pairwiseCipherMask) + setPairwiseCipher(bitfield pairwiseCipherMask) generates (SupplicantStatus status); /** @@ -568,7 +568,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * @return keyMgmtMask Combination of |KeyMgmtMask| values. */ getKeyMgmt() - generates (SupplicantStatus status, uint32_t keyMgmtMask); + generates (SupplicantStatus status, bitfield keyMgmtMask); /** * Get the proto mask set for the network. @@ -579,7 +579,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| * @return protoMask Combination of |ProtoMask| values. */ - getProto() generates (SupplicantStatus status, uint32_t protoMask); + getProto() generates (SupplicantStatus status, bitfield protoMask); /** * Get the auth alg mask set for the network. @@ -591,7 +591,7 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * @return authAlgMask Combination of |AuthAlgMask| values. */ getAuthAlg() - generates (SupplicantStatus status, uint32_t authAlgMask); + generates (SupplicantStatus status, bitfield authAlgMask); /** * Get the group cipher mask set for the network. @@ -603,7 +603,8 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * @return groupCipherMask Combination of |GroupCipherMask| values. */ getGroupCipher() - generates (SupplicantStatus status, uint32_t groupCipherMask); + generates (SupplicantStatus status, + bitfield groupCipherMask); /** * Get the pairwise cipher mask set for the network. @@ -615,7 +616,8 @@ interface ISupplicantStaNetwork extends ISupplicantNetwork { * @return pairwiseCipherMask Combination of |PairwiseCipherMask| values. */ getPairwiseCipher() - generates (SupplicantStatus status, uint32_t pairwiseCipherMask); + generates (SupplicantStatus status, + bitfield pairwiseCipherMask); /** * Get passphrase for WPA_PSK network.