* Copyright (c) 2020-2021 Huawei Device Co., Ltd.
*
* HDF is dual licensed: you can use it either under the terms of
* the GPL, or the BSD license, at your option.
* See the LICENSE file in the root of this repository for complete details.
*/
* @addtogroup WLAN
* @{
*
* @brief Provides cross-OS migration, component adaptation, and modular assembly and compilation.
*
* Based on the unified APIs provided by the WLAN module, developers of the Hardware Driver Interface
* (HDI) are capable of creating, disabling, scanning for, and connecting to WLAN hotspots, managing WLAN chips,
* network devices, and power, and applying for, releasing, and moving network data buffers.
*
* @since 1.0
* @version 1.0
*/
* @file hdf_wifi_event.h
*
* @brief Declares WLAN driver events.
*
* The functions in this file are used to report events such as scanning results, scanning completion, and station
* disconnection to the WPA interface.
*
* @since 1.0
* @version 1.0
*/
#ifndef HDF_WIFI_EVENT_H
#define HDF_WIFI_EVENT_H
#include "hdf_wifi_cmd.h"
#include "wifi_mac80211_ops.h"
#include "net_device.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
* @brief Defines the rate information received or sent over WLAN.
*
* @since 1.0
* @version 1.0
*/
struct RateInfo {
uint8_t flags;
uint8_t mcs;
uint16_t legacy;
uint8_t nss;
uint8_t resv;
};
* @brief Defines parameters related to the WLAN module that works in station mode.
*
* @since 1.0
* @version 1.0
*/
struct StaBssParameters {
uint8_t flags;
uint8_t dtimPeriod;
uint16_t beaconInterval;
};
* @brief Defines the update of the <b>Sta</b> flag.
*
* @since 1.0
* @version 1.0
*/
struct StaFlagUpdate {
uint32_t mask;
uint32_t set;
};
* @brief Defines station information.
*
* @since 1.0
* @version 1.0
*/
struct StationInfo {
uint32_t filled;
uint32_t connectedTime;
uint32_t inactiveTime;
* activity
*/
uint16_t llid;
uint16_t plid;
uint64_t rxBytes;
uint64_t txBytes;
struct RateInfo txRate;
struct RateInfo rxRate;
uint32_t rxPackets;
uint32_t txPackets;
uint32_t txPetries;
uint32_t txFailed;
uint32_t rxDroppedMisc;
int32_t generation;
struct StaBssParameters bssParam;
struct StaFlagUpdate staFlags;
int64_t offset;
const uint8_t *assocReqIes;
uint32_t assocReqIesLen;
uint32_t beaconLossCount;
uint8_t plinkState;
int8_t signal;
int8_t signalAvg;
uint8_t resv1;
};
* @brief Defines authentication information.
*
* @since 1.0
* @version 1.0
*/
struct Auth {
uint16_t authAlg;
uint16_t authTransaction;
uint16_t statusCode;
uint8_t variable[0];
};
* @brief Defines deauthentication information.
*
* @since 1.0
* @version 1.0
*/
struct Deauth {
uint16_t reasonCode;
};
* @brief Defines station association request.
*
* @since 1.0
* @version 1.0
*/
struct AssocReq {
uint16_t capabInfo;
uint16_t listenInterval;
uint8_t variable[0];
};
* @brief Defines station association response.
*
* @since 1.0
* @version 1.0
*/
struct AssocResp {
uint16_t capabInfo;
uint16_t statusCode;
uint16_t aid;
uint8_t variable[0];
};
* @brief Defines station reassociation request.
*
* @since 1.0
* @version 1.0
*/
struct ReassocReq {
uint16_t capabInfo;
uint16_t listenInterval;
uint8_t currentAp[6];
uint8_t variable[0];
};
* @brief Defines station reassociation response.
*
* @since 1.0
* @version 1.0
*/
struct ReassocResp {
uint16_t capabInfo;
uint16_t statusCode;
uint16_t aid;
uint8_t variable[0];
};
* @brief Defines station disconnection.
*
* @since 1.0
* @version 1.0
*/
struct Disassoc {
uint16_t reasonCode;
};
* @brief Defines the update of the <b>Sta</b> flag.
*
* @since 1.0
* @version 1.0
*/
struct Beacon {
uint64_t timestamp;
uint16_t beaconInt;
uint16_t capabInfo;
uint8_t variable[0];
};
* @brief Defines scanning response.
*
* @since 1.0
* @version 1.0
*/
struct ProbeResp {
uint64_t timestamp;
uint16_t beaconInt;
uint16_t capabInfo;
uint8_t variable[0];
};
* @brief Defines management frame information.
*
* @since 1.0
* @version 1.0
*/
struct Ieee80211Mgmt {
uint16_t frameControl;
uint16_t duration;
uint8_t dstAddr[6];
uint8_t srcAddr[6];
uint8_t bssid[6];
uint16_t seqCtrl;
union {
struct Auth auth;
struct Deauth deauth;
struct AssocReq assocReq;
struct AssocResp assocResp;
struct ReassocReq reassocReq;
struct ReassocResp reassocResp;
struct Disassoc disassoc;
struct Beacon beacon;
struct ProbeResp probeResp;
} u;
};
* @brief Represents the scanned BSS information.
*
* @since 1.0
* @version 1.0
*/
struct ScannedBssInfo {
int32_t signal;
int16_t freq;
uint8_t array[2];
uint32_t mgmtLen;
struct Ieee80211Mgmt *mgmt;
};
* @brief Defines association results.
*
* @since 1.0
* @version 1.0
*/
struct ConnetResult {
uint8_t bssid[ETH_ADDR_LEN];
uint16_t statusCode;
uint8_t *rspIe;
uint8_t *reqIe;
uint32_t reqIeLen;
uint32_t rspIeLen;
uint16_t connectStatus;
uint16_t freq;
};
* @brief Enumerates MLME management statuses, indicating whether a device is successfully associated or
* fails to be associated.
*
* @since 1.0
* @version 1.0
*/
enum WifiHmacMgmtStatus {
WIFI_HMAC_MGMT_SUCCESS = 0,
WIFI_HMAC_MGMT_INVALID = 1,
WIFI_HMAC_MGMT_TIMEOUT = 2,
WIFI_HMAC_MGMT_REFUSED = 3,
WIFI_HMAC_MGMT_TOMANY_REQ = 4,
WIFI_HMAC_MGMT_ALREADY_BSS = 5
};
* @brief Reports a new STA event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param macAddr Indicates the pointer to the MAC address of the station. This parameter cannot be null.
* @param addrLen Indicates the length of the MAC address of the station. The length is fixed to six bytes.
* @param info Indicates the pointer to the station information.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventNewSta(const struct NetDevice *netDev, const uint8_t *macAddr, uint8_t addrLen,
const struct StationInfo *info);
* @brief Reports a station deletion event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param macAddr Indicates the pointer to the MAC address of the station. This parameter cannot be null.
* @param addrLen Indicates the length of the MAC address of the station. The length is fixed to six bytes.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventDelSta(struct NetDevice *netDev, const uint8_t *macAddr, uint8_t addrLen);
* @brief Reports a scanned BSS event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param channel Indicates the pointer to the channel information. This parameter cannot be null.
* @param bssInfo Indicates the pointer to the BSS information. This parameter cannot be null.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventInformBssFrame(const struct NetDevice *netDev, const struct WlanChannel *channel,
const struct ScannedBssInfo *bssInfo);
* @brief Reports a scanning completion event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param status Indicates the scanning completion status. Value <b>0</b> indicates that the scanning is successful,
* and other values indicate that the scanning fails.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventScanDone(const struct NetDevice *netDev, WifiScanStatus status);
* @brief Reports a connection result event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param result Indicates the pointer to the connection result. This parameter cannot be null.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventConnectResult(const struct NetDevice *netDev, const struct ConnetResult *result);
* @brief Reports a disconnection event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param reason Indicates the reason for disconnection.
* @param ie Indicates the pointer to the deauth/disassoc frame IE.
* @param len Indicates the length of the deauth/disassoc IE.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventDisconnected(const struct NetDevice *netDev, uint16_t reason, const uint8_t *ie, uint32_t len);
* @brief Reports a transmission management status event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param buf Indicates the pointer to the transmission management frame. This parameter cannot be null.
* @param len Indicates the length of the transmission management frame.
* @param ack Indicates whether the transmission management frame is acknowledged.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventMgmtTxStatus(const struct NetDevice *netDev, const uint8_t *buf, size_t len, uint8_t ack);
* @brief Reports a receive management status event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param freq Indicates the frequency of receiving management frame.
* @param sigMbm Indicates the signal strength (in dBm).
* @param buf Indicates the pointer to the receive management frame. This parameter cannot be null.
* @param len Indicates the length of the receive management frame.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventRxMgmt(const struct NetDevice *netDev, int32_t freq, int32_t sigMbm,
const uint8_t *buf, size_t len);
* @brief Reports a CSA channel switching event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
* @param freq Indicates the frequency of the channel.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventCsaChannelSwitch(const struct NetDevice *netDev, int32_t freq);
* @brief Reports a timeout disconnection event.
*
* @param netDev Indicates the pointer to the network device. This parameter cannot be null.
*
* @return Returns <b>0</b> if the event is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventTimeoutDisconnected(const struct NetDevice *netDev);
* @brief Reports the event of receiving the EAPOL frame and notifies WPA to read the EAPOL frame.
*
* @param name Indicates the pointer to the network port name, for example, <b>wlan0</b>.
* @param context Indicates the pointer to the context. This parameter is reserved.
*
* @return Returns <b>0</b> if the operation is successful; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventEapolRecv(const char *name, void *context);
* @brief Reports the WLAN driver reset result.
*
* @param chipId Indicates the chip ID. This parameter cannot be null.
* @param resetStatus Indicates the WLAN driver reset result.
*
* @return Returns <b>0</b> if the result is reported successfully; returns <b>-1</b> otherwise.
*
* @since 1.0
* @version 1.0
*/
int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus, const char *ifName);
int32_t HdfWifiEventRemainOnChannel(const struct NetDevice *netDev, uint32_t freq, uint32_t duration);
int32_t HdfWifiEventCancelRemainOnChannel(const struct NetDevice *netDev, uint32_t freq);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif