open-ameba/sdk/component/common/drivers/wlan/realtek/include/wifi_structures.h

232 lines
7.9 KiB
C
Raw Normal View History

2017-03-18 12:52:14 +00:00
/******************************************************************************
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
*
* 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.
******************************************************************************
* @file wifi_structures.h
* @author
* @version
* @brief This file provides the data structures used for wlan API.
******************************************************************************
*/
2016-11-09 00:56:41 +00:00
#ifndef _WIFI_STRUCTURES_H
#define _WIFI_STRUCTURES_H
//#include <freertos/freertos_service.h>
#include "wifi_constants.h"
#include "dlist.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__IAR_SYSTEMS_ICC__)
2017-04-22 13:44:33 +00:00
#pragma pack(1)
2016-11-09 00:56:41 +00:00
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the SSID.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_ssid {
unsigned char len; /**< SSID length */
unsigned char val[33]; /**< SSID name (AP name) */
} rtw_ssid_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack()
#endif
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack(1)
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the unique 6-byte MAC address.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_mac {
unsigned char octet[6]; /**< Unique 6-byte MAC address */
} rtw_mac_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack()
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the setting about SSID,
* security type, password and default channel, used to start AP mode.
* @note The data length of string pointed by ssid and password should not exceed 32.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_ap_info {
rtw_ssid_t ssid;
rtw_security_t security_type;
unsigned char *password;
int password_len;
int channel;
}rtw_ap_info_t;
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the station mode setting about SSID,
* security type and password, used when connecting to an AP.
* @note The data length of string pointed by ssid and password should not exceed 32.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_network_info {
rtw_ssid_t ssid;
rtw_mac_t bssid;
rtw_security_t security_type;
unsigned char *password;
int password_len;
int key_id;
}rtw_network_info_t;
2017-04-23 15:12:51 +00:00
#if defined(__IAR_SYSTEMS_ICC__)
2016-11-09 00:56:41 +00:00
#pragma pack(1)
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the scan result of the AP.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_scan_result {
2017-04-23 15:12:51 +00:00
rtw_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */
rtw_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
rtw_bss_type_t bss_type; /**< Network type */
rtw_security_t security; /**< Security type */
rtw_wps_type_t wps_type; /**< WPS type */
unsigned int channel; /**< Radio channel that the AP beacon was received on */
rtw_802_11_band_t band; /**< Radio band */
2016-11-09 00:56:41 +00:00
} rtw_scan_result_t;
2017-04-23 15:12:51 +00:00
#if defined(__IAR_SYSTEMS_ICC__)
2016-11-09 00:56:41 +00:00
#pragma pack()
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the data needed by scan result handler function.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_scan_handler_result {
rtw_scan_result_t ap_details;
rtw_bool_t scan_complete;
void* user_data;
} rtw_scan_handler_result_t;
2017-04-23 15:12:51 +00:00
#if defined(__IAR_SYSTEMS_ICC__)
2016-11-09 00:56:41 +00:00
#pragma pack(1)
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to store the WIFI setting gotten from WIFI driver.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_wifi_setting {
2017-04-28 02:00:05 +00:00
rtw_mode_t mode;
2016-11-09 00:56:41 +00:00
unsigned char ssid[33];
unsigned char channel;
rtw_security_t security_type;
unsigned char password[65];
unsigned char key_idx;
2017-03-18 12:52:14 +00:00
}rtw_wifi_setting_t;
2017-04-23 15:12:51 +00:00
#if defined(__IAR_SYSTEMS_ICC__)
2016-11-09 00:56:41 +00:00
#pragma pack()
#endif
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the setting when configure the network.
*/
2016-11-09 00:56:41 +00:00
typedef struct rtw_wifi_config {
unsigned int boot_mode;
unsigned char ssid[32];
unsigned char ssid_len;
unsigned char security_type;
unsigned char password[65];
unsigned char password_len;
unsigned char channel;
} rtw_wifi_config_t;
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the maclist.
*/
2016-11-09 00:56:41 +00:00
typedef struct
{
unsigned int count; /**< Number of MAC addresses in the list */
rtw_mac_t mac_list[1]; /**< Variable length array of MAC addresses */
} rtw_maclist_t;
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to describe the bss info of the network.\n
* It include the version, BSSID, beacon_period, capability, SSID,
* channel, atm_window, dtim_period, RSSI e.g.
*/
2016-11-09 00:56:41 +00:00
typedef struct {
2017-03-18 12:52:14 +00:00
unsigned int version; /**< version field */
unsigned int length; /**< byte length of data in this record, */
2016-11-09 00:56:41 +00:00
/* starting at version and including IEs */
2017-04-22 13:44:33 +00:00
rtw_mac_t BSSID;
2017-03-18 12:52:14 +00:00
unsigned short beacon_period; /**< units are Kusec */
unsigned short capability; /**< Capability information */
2016-11-09 00:56:41 +00:00
unsigned char SSID_len;
unsigned char SSID[32];
unsigned char channel;
// struct {
// uint32_t count; /* # rates in this set */
// uint8_t rates[16]; /* rates in 500kbps units w/hi bit set if basic */
// } rateset; /* supported rates */
// rtw_chanspec_t chanspec; /* chanspec for bss */
2017-03-18 12:52:14 +00:00
unsigned short atim_window; /**< units are Kusec */
unsigned char dtim_period; /**< DTIM period */
signed short RSSI; /**< receive signal strength (in dBm) */
2016-11-09 00:56:41 +00:00
2017-03-18 12:52:14 +00:00
unsigned char n_cap; /**< BSS is 802.11N Capable */
unsigned int nbss_cap; /**< 802.11N BSS Capabilities (based on HT_CAP_*) */
unsigned char basic_mcs[MCSSET_LEN]; /**< 802.11N BSS required MCS set */
2016-11-09 00:56:41 +00:00
2017-03-18 12:52:14 +00:00
unsigned short ie_offset; /**< offset at which IEs start, from beginning */
unsigned int ie_length; /**< byte length of Information Elements */
2016-11-09 00:56:41 +00:00
} rtw_bss_info_t;
2017-03-18 12:52:14 +00:00
/**
* @brief The structure is used to set WIFI packet filter pattern.
*/
2016-11-09 00:56:41 +00:00
typedef struct {
unsigned short offset; /**< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */
unsigned short mask_size; /**< Size of the mask in bytes */
unsigned char* mask; /**< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */
unsigned char* pattern; /**< Pattern bytes used to filter eg. "\x0800" (must be in network byte order) */
} rtw_packet_filter_pattern_t;
typedef struct ieee80211_frame_info{
unsigned short i_fc;
unsigned short i_dur;
unsigned char i_addr1[6];
unsigned char i_addr2[6];
unsigned char i_addr3[6];
unsigned short i_seq;
unsigned char bssid[6];
unsigned char encrypt;
signed char rssi;
}ieee80211_frame_info_t;
typedef struct {
char filter_id;
rtw_packet_filter_pattern_t patt;
rtw_packet_filter_rule_e rule;
unsigned char enable;
}rtw_packet_filter_info_t;
typedef struct rtw_mac_filter_list{
struct list_head node;
unsigned char mac_addr[6];
}rtw_mac_filter_list_t;
#ifdef __cplusplus
}
#endif
#endif /* _WIFI_STRUCTURES_H */