text: /* Copyright 2021 The libwifi Authors
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  #ifndef LIBWIFI_CORE_TYPES_H
  #define LIBWIFI_CORE_TYPES_H
  
  #include "../../core/misc/byteswap.h"
  
  /* 802.11 Management Frame "reason code" fixed parameter values */
  enum libwifi_reason_codes {
      REASON_UNSPECIFIED_FAILURE = 1,
      REASON_PREVIOUS_AUTH_INVALID = 2,
      REASON_STA_LEAVING_ESS = 3,
      REASON_INACTIVE = 4,
      REASON_TOO_MANY_STAS = 5,
      REASON_CLASS_2_FRAME = 6,
      REASON_CLASS_3_FRAME = 7,
      REASON_STA_LEAVING_BSS = 8,
      REASON_STA_REQUESTING_REASSOC_NOT_AUTHED = 9,
      REASON_UNNACCEPTABLE_POWER_CAPABILITY = 10,
      REASON_UNNACCEPTABLE_CHANNELS = 11,
      REASON_BSS_TRANSITION_MGMT = 12,
      REASON_INVALID_ELEMENT = 13,
      REASON_MIC_FAILURE = 14,
      REASON_FOURWAY_HANDSHAKE_TIMEOUT = 15,
      REASON_GROUPKEY_HANDSHAKE_TIMEOUT = 16,
      REASON_INVALID_FOURWAY = 17,
      REASON_INVALID_GROUP_CIPHER = 18,
      REASON_INVALID_PAIRWISE_CIPHER = 19,
      REASON_INVALID_AKMP = 20,
      REASON_UNSUPPORTED_RSNE_VERSION = 21,
      REASON_INVALID_RSNE_CAPABILITIES = 22,
      REASON_INVALID_8021X_AUTH = 23,
      REASON_CIPHER_SUITE_REJECTED = 24,
      REASON_TDLS_DIRECT_LINK_TEARDOWN_UNREACHABLE = 25,
      REASON_TDLS_DIRECT_LINK_TEARDOWN_UNSPECIFIED = 26,
      REASON_SSP_REQUEST = 27,
      REASON_LACKS_SSP_ROAMING = 28,
      REASON_CIPHER_OR_AKM_REQUIRED = 29,
      REASON_SERVICE_NOT_AUTHORIZED = 30,
      REASON_SERVICE_CHANGE_PRECLUDES_TS = 31,
      REASON_UNSPECIFIED_QOS = 32,
      REASON_INSUFFICIENT_BANDWIDTH = 33,
      REASON_EXCESSIVE_ACKS_REQUIRED = 34,
      REASON_TXOPS_EXCEEDED = 35,
      REASON_STA_LEAVING = 36,
      REASON_END_TS = 37,
      REASON_UNKNOWN_TS_OR_BA = 38,
      REASON_TIMEOUT = 39,
      REASON_PEERKEY_MISMATCH = 45,
      REASON_PEER_INITIATED = 46,
      REASON_AP_INITIATED = 47,
      REASON_INVALID_FT_ACTION_FRAMECOUNT = 48,
      REASON_INVALID_PMKI = 49,
      REASON_INVALID_MDE = 50,
      REASON_INVALID_FTE = 51,
      REASON_MESH_PEERING_CANCELED = 52,
      REASON_MESH_MAX_PEERS = 53,
      REASON_MESH_CONFIGURATION_POLICY_VIOLATION = 54,
      REASON_MESH_CLOSE_RCVD = 55,
      REASON_MESH_MAX_RETRIES = 56,
      REASON_MESH_CONFIRM_TIMEOUT = 57,
      REASON_MESH_INVALID_GTK = 58,
      REASON_MESH_INCONSISTENT_PARAMETERS = 59,
      REASON_MESH_INVALID_SECURITY_CAPABILITY = 60,
      REASON_MESH_PATH_ERROR_NO_PROXY_INFORMATION = 61,
      REASON_MESH_PATH_ERROR_NO_FORWARDING_INFORMATION = 62,
      REASON_MESH_PATH_ERROR_DESTINATION_UNREACHABLE = 63,
      REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64,
      REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQUIREMENTS = 65,
      REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED = 66,
  };
  
  /* 802.11 Management Frame "status code" fixed parameter values */
  enum libwifi_status_codes {
      STATUS_SUCCESS = 0,
      STATUS_REFUSED = 1,
      STATUS_TDLS_REJECTED_ALTERNATIVE_PROVIDED = 2,
      // Reserved = 4,
      STATUS_SECURITY_DISABLED = 5,
      STATUS_UNACCEPTABLE_LIFETIME = 6,
      STATUS_NOT_IN_SAME_BSS = 7,
      // Reserved = 8,
      // Reserved = 9,
      STATUS_REFUSED_CAPABILITIES_MISMATCH = 10,
      STATUS_DENIED_NO_ASSOCIATION_EXISTS = 11,
      STATUS_DENIED_OTHER_REASON = 12,
      STATUS_UNSUPPORTED_AUTH_ALGORITHM = 13,
      STATUS_TRANSACTION_SEQUENCE_ERROR = 14,
      STATUS_CHALLENGE_FAILURE = 15,
      STATUS_REJECTED_SEQUENCE_TIMEOUT = 16,
      STATUS_DENIED_NO_MORE_STAS = 17,
      STATUS_REFUSED_BASIC_RATES_MISMATCH = 18,
      STATUS_DENIED_NO_SHORT_PREAMBLE_SUPPORT = 19,
      // Reserved = 20,
      // Reserved = 21,
      STATUS_REJECTED_SPECTRUM_MANAGEMENT_REQUIRED = 22,
      STATUS_REJECTED_BAD_POWER_CAPABILITY = 23,
      STATUS_REJECTED_BAD_SUPPORTED_CHANNELS = 24,
      STATUS_DENIED_NO_SHORT_SLOT_TIME_SUPPORT = 25,
      // Reserved = 26,
      STATUS_DENIED_NO_HT_SUPPORT = 27,
      STATUS_R0KH_UNREACHABLE = 28,
      STATUS_DENIED_PCO_TIME_NOT_SUPPORTED = 29,
      STATUS_REFUSED_TEMPORARILY = 30,
      STATUS_ROBUST_MANAGEMENT_POLICY_VIOLATION = 31,
      STATUS_UNSPECIFIED_QOS_FAILURE = 32,
      STATUS_DENIED_INSUFFICIENT_BANDWIDTH = 33,
      STATUS_DENIED_POOR_CHANNEL_CONDITIONS = 34,
      STATUS_DENIED_QOS_NOT_SUPPORTED = 35,
      // Reserved = 36,
      STATUS_REQUEST_DECLINED = 37,
      STATUS_INVALID_PARAMETERS = 38,
      STATUS_REJECTED_WITH_SUGGESTED_CHANGES = 39,
      STATUS_STATUS_INVALID_ELEMENT = 40,
      STATUS_STATUS_INVALID_GROUP_CIPHER = 41,
      STATUS_STATUS_INVALID_PAIRWISE_CIPHER = 42,
      STATUS_STATUS_INVALID_AKMP = 43,
      STATUS_UNSUPPORTED_RSNE_VERSION = 44,
      STATUS_INVALID_RSNE_CAPABILITIES = 45,
      STATUS_STATUS_CIPHER_OUT_OF_POLICY = 46,
      STATUS_REJECTED_FOR_DELAY_PERIOD = 47,
      STATUS_DLS_NOT_ALLOWED = 48,
      STATUS_NOT_PRESENT = 49,
      STATUS_NOT_QOS_STA = 50,
      STATUS_DENIED_LISTEN_INTERVAL_TOO_LARGE = 51,
      STATUS_STATUS_INVALID_FT_ACTION_FRAME_COUNT = 52,
      STATUS_STATUS_INVALID_PMKID = 53,
      STATUS_STATUS_INVALID_MDE = 54,
      STATUS_STATUS_INVALID_FTE = 55,
      STATUS_REQUESTED_TCLAS_NOT_SUPPORTED = 56,
      STATUS_INSUFFICIENT_TCLAS_PROCESSING_RESOURCES = 57,
      STATUS_TRY_ANOTHER_BSS = 58,
      STATUS_GAS_ADVERTISEMENT_PROTOCOL_NOT_SUPPORTED = 59,
      STATUS_NO_OUTSTANDING_GAS_REQUEST = 60,
      STATUS_GAS_RESPONSE_NOT_RECEIVED_FROM = 61,
      STATUS_GAS_QUERY_TIMEOUT = 62,
      STATUS_GAS_QUERY_RESPONSE_TOO_ = 63,
      STATUS_REJECTED_HOME_WITH_SUGGESTED_CHANGES = 64,
      STATUS_SERVER_UNREACHABLE = 65,
      // Reserved = 66,
      STATUS_REJECTED_FOR_SSP_PERMISSIONS = 67,
      STATUS_REFUSED_UNAUTHENTICATED_ACCESS_NOT_SUPPORTED = 68,
      // Reserved = 69,
      // Reserved = 70,
      // Reserved = 71,
      STATUS_INVALID_RSNE = 72,
      STATUS_U_APSD_COEXISTANCE_NOT_SUPPORTED = 73,
      STATUS_U_APSD_COEX_MODE_NOT_SUPPORTED = 74,
      STATUS_BAD_INTERVAL_WITH_U_APSD_COEX = 75,
      STATUS_ANTI_CLOGGING_TOKEN_REQUIRED = 76,
      STATUS_UNSUPPORTED_FINITE_CYCLIC_GROUP = 77,
      STATUS_CANNOT_FIND_ALTERNATIVE_TBTT = 78,
      STATUS_TRANSMISSION_FAILURE = 79,
      STATUS_REQUESTED_TCLAS_NOT_SUPPORTED_2 = 80,
      STATUS_TCLAS_RESOURCES_EXHAUSTED = 81,
      STATUS_REJECTED_WITH_SUGGESTED_BSS_TRANSITION = 82,
      STATUS_REJECT_WITH_SCHEDULE = 83,
      STATUS_REJECT_NO_WAKEUP_SPECIFIED = 84,
      STATUS_SUCCESS_POWER_SAVE_MODE = 85,
      STATUS_PENDING_ADMITTING_FST_SESSION = 86,
      STATUS_PERFORMING_FST_NOW = 87,
      STATUS_PENDING_GAP_IN_BA_WINDOW = 88,
      STATUS_REJECT_U_PID_SETTING = 89,
      // Reserved = 90,
      // Reserved = 91,
      STATUS_REFUSED_EXTERNAL_REASON = 92,
      STATUS_REFUSED_AP_OUT_OF_MEMORY = 93,
      STATUS_REJECTED_EMERGENCY_SERVICES_NOT_SUPPORTED = 94,
      STATUS_QUERY_RESPONSE_OUTSTANDING = 95,
      STATUS_REJECT_DSE_BAND = 96,
      STATUS_TCLAS_PROCESSING_TERMINATED = 97,
      STATUS_TS_SCHEDULE_CONFLICT = 98,
      STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99,
      STATUS_MCCAOP_RESERVATION_CONFLICT = 100,
      STATUS_MAF_LIMIT_EXCEEDED = 101,
      STATUS_MCCA_TRACK_LIMIT_EXCEEDED = 102,
      STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103,
      STATUS_DENIED_VHT_NOT_SUPPORTED = 104,
      STATUS_ENABLEMENT_DENIED = 105,
      STATUS_RESTRICTION_FROM_AUTHORIZED_GDB = 106,
      STATUS_AUTHORIZATION_DEENABLED = 107,
      // Reserved = 108–65535
  };
  
  /* Defined capabilities_information fixed parameter values */
  #define libwifi_check_capabilities(x, cap) (BYTESWAP16(x) & (1 << cap))
  enum libwifi_capabilities {
      CAPABILITIES_ESS = 0,
      CAPABILITIES_IBSS = 1,
      CAPABILITIES_POLL = 2,
      CAPABILITIES_POLL_REQ = 3,
      CAPABILITIES_PRIVACY = 4,
      CAPABILITIES_SHORT_PREAMBLE = 5,
      CAPABILITIES_PBCC = 6,
      CAPABILITIES_CHAN_AGILITY = 7,
      CAPABILITIES_SPECTRUM_AGILITY = 8 & (8 >> 1),
      CAPABILITIES_SHORT_SLOT = 10,
      CAPABILITIES_POWER_SAVE = 11,
      CAPABILITIES_MEASUREMENT = 12,
      CAPABILITIES_DSSS_OFDM = 13,
      CAPABILITIES_DELAYED_ACK = 14,
      CAPABILITIES_IMMEDIATE_ACK = 15,
  };
  
  #endif /* LIBWIFI_CORE_TYPES_H */
  