wifi: Send MBO-OCE association rejection info.

Parse association response for MBO association
disallowed indication and OCE RSSI based association
rejection info and send it to framework in association
rejection event.

Bug: 162542063
Test: vts test - VtsHalWifiSupplicantV1_4TargetTest

Change-Id: I63ae2c37b816dbe1790647e90541e2d0b6df8401
diff --git a/wifi/supplicant/1.4/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.4/ISupplicantStaIfaceCallback.hal
index efcebda..c6f05fb 100644
--- a/wifi/supplicant/1.4/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.4/ISupplicantStaIfaceCallback.hal
@@ -20,7 +20,9 @@
 import @1.0::ISupplicantStaIfaceCallback.Hs20AnqpData;
 import @1.3::ISupplicantStaIfaceCallback;
 import @1.0::ISupplicantStaIfaceCallback.State;
+import @1.0::ISupplicantStaIfaceCallback.StatusCode;
 import @1.0::Bssid;
+import @1.0::Ssid;
 
 /**
  * Callback Interface exposed by the supplicant service
@@ -32,6 +34,19 @@
  */
 interface ISupplicantStaIfaceCallback extends @1.3::ISupplicantStaIfaceCallback {
     /**
+     *  MBO spec v1.2, 4.2.4 Table 14: MBO Association disallowed reason code attribute
+     *  values.
+     */
+    enum MboAssocDisallowedReasonCode : uint8_t {
+        RESERVED = 0,
+        UNSPECIFIED = 1,
+        MAX_NUM_STA_ASSOCIATED = 2,
+        AIR_INTERFACE_OVERLOADED = 3,
+        AUTH_SERVER_OVERLOADED = 4,
+        INSUFFICIENT_RSSI = 5,
+    };
+
+    /**
      * ANQP data for IEEE Std 802.11-2016.
      * The format of the data within these elements follows the IEEE
      * Std 802.11-2016 standard, section 9.4.5.
@@ -49,6 +64,83 @@
     };
 
     /**
+     * OceRssiBasedAssocRejectAttr is extracted from (Re-)Association response
+     * frame from an OCE AP to indicate that the AP has rejected the
+     * (Re-)Association request on the basis of insufficient RSSI.
+     * Refer OCE spec v1.0 section 4.2.2 Table 7.
+     */
+    struct OceRssiBasedAssocRejectAttr {
+        /*
+         * Delta RSSI - The difference in dB between the minimum RSSI at which
+         * the AP would accept a (Re-)Association request from the STA before
+         * Retry Delay expires and the AP's measurement of the RSSI at which the
+         * (Re-)Association request was received.
+         */
+        uint32_t deltaRssi;
+
+        /*
+         * Retry Delay - The time period in seconds for which the AP will not
+         * accept any subsequent (Re-)Association requests from the STA, unless
+         * the received RSSI has improved by Delta RSSI.
+         */
+        uint32_t retryDelayS;
+    };
+
+    /**
+     * Association Rejection related information.
+     */
+    struct AssociationRejectionData {
+        /**
+         * SSID of the AP that rejected the association.
+         */
+        Ssid ssid;
+
+        /**
+         * BSSID of the AP that rejected the association.
+         */
+        Bssid bssid;
+
+        /*
+         * 802.11 code to indicate the reject reason.
+         * Refer to section 8.4.1.9 of IEEE 802.11 spec.
+         */
+        StatusCode statusCode;
+
+        /*
+         * Flag to indicate that failure is due to timeout rather than
+         * explicit rejection response from the AP.
+         */
+        bool timedOut;
+
+        /**
+         * Flag to indicate that MboAssocDisallowedReasonCode is present
+         * in the (Re-)Association response frame.
+         */
+        bool isMboAssocDisallowedReasonCodePresent;
+
+        /**
+         * mboAssocDisallowedReason is extracted from MBO association disallowed attribute
+         * in (Re-)Association response frame to indicate that the AP is not accepting new
+         * associations.
+         * Refer MBO spec v1.2 section 4.2.4 Table 13 for the details of reason code.
+         * The value is undefined if isMboAssocDisallowedReasonCodePresent is false.
+         */
+        MboAssocDisallowedReasonCode mboAssocDisallowedReason;
+
+        /**
+         * Flag to indicate that OceRssiBasedAssocRejectAttr is present
+         * in the (Re-)Association response frame.
+         */
+        bool isOceRssiBasedAssocRejectAttrPresent;
+
+        /*
+         * OCE RSSI-based (Re-)Association rejection attribute.
+         * The contents are undefined if isOceRssiBasedAssocRejectAttrPresent is false.
+         */
+        OceRssiBasedAssocRejectAttr oceRssiBasedAssocRejectData;
+    };
+
+    /**
      * Used to indicate a Hotspot 2.0 terms and conditions acceptance is requested from the user
      * before allowing the device to get internet access.
      *
@@ -68,4 +160,12 @@
      *        All the fields in this struct must be empty if the query failed.
      */
     oneway onAnqpQueryDone_1_4(Bssid bssid, AnqpData data, Hs20AnqpData hs20Data);
+
+    /**
+     * Used to indicate an association rejection received from the AP
+     * to which the connection is being attempted.
+     *
+     * @param assocRejectData Association Rejection related information.
+     */
+    oneway onAssociationRejected_1_4(AssociationRejectionData assocRejectData);
 };
diff --git a/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp
index ccd469d..1794a39 100644
--- a/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.4/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -232,6 +232,11 @@
         override {
         return Void();
     }
+    Return<void> onAssociationRejected_1_4(
+        const ISupplicantStaIfaceCallback::AssociationRejectionData& /* data */)
+        override {
+        return Void();
+    }
 };
 
 /*