WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hmac_wapi.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2020-2023. All rights reserved.
3 * Description: hmac_wapi.c的头文件.
4 */
5
6#ifndef __HMAC_WAPI_H__
7#define __HMAC_WAPI_H__
8
9/*****************************************************************************
10 1 头文件包含
11*****************************************************************************/
12#include "oal_netbuf_ext.h"
13#include "mac_resource_ext.h"
14#include "hmac_vap.h"
15#include "hmac_user.h"
16
17#ifdef __cplusplus
18#if __cplusplus
19extern "C" {
20#endif
21#endif
22
23#undef THIS_FILE_ID
24#define THIS_FILE_ID OAM_FILE_ID_HMAC_WAPI_H
25/*****************************************************************************/
26/*****************************************************************************
27 2 宏定义
28*****************************************************************************/
29#define WAPI_UCAST_INC 2 /* 发送或者接收单播帧,pn的步进值 */
30#define WAPI_BCAST_INC 1 /* 发送或者接收组播帧,pn的步进值 */
31#define WAPI_WAI_TYPE (osal_u16)0x88B4 /* wapi的以太类型 */
32
33#define WAPI_BCAST_KEY_TYPE 1
34#define WAPI_UCAST_KEY_TYPE 0
35
36#define SMS4_MIC_LEN (osal_u8)16 /* SMS4封包MIC的长度 */
37
38#define SMS4_PN_LEN 16 /* wapi pn的长度 */
39#define SMS4_KEY_IDX 1 /* WAPI头中 keyidx占1个字节 */
40#define SMS4_WAPI_HDR_RESERVE 1 /* WAPI头中保留字段 */
41#define HMAC_WAPI_HDR_LEN (osal_u8)(SMS4_PN_LEN + SMS4_KEY_IDX + SMS4_WAPI_HDR_RESERVE)
42#define WAPI_PDU_LEN 2 /* wapi头中,wapi pdu len字段所占字节数 */
43#define SMS4_PADDING_LEN 16 /* mic data按照16字节对齐 */
44
45#define SMS4_MIC_PART1_QOS_LEN 48 /* 按照协议,如果有qos字段,mic第一部分16字节对齐后的长度 */
46#define SMS4_MIC_PART1_NO_QOS_LEN 32 /* 按照协议,如果没有qos字段,mic第一部分16字节对齐后的长度 */
47
48#define WAPI_IE_VERSION 1 /* wapi的version */
49#define WAPI_IE_VER_SIZE 2 /* wapi ver-ie 所占字节数 */
50#define WAPI_IE_SUIT_TYPE_SIZE 1 /* suit type size */
51#define WAPI_IE_WAPICAP_SIZE 2 /* wapi cap字段所占字节数 */
52#define WAPI_IE_BKIDCNT_SIZE 2 /* wapi bkid数字段所占字节数 */
53#define WAPI_IE_BKID_SIZE 16 /* 一个bkid所占字节数 */
54#define WAPI_IE_OUI_SIZE 3 /* wapi oui字节数 */
55#define WAPI_IE_SMS4 1 /* wapi加密类型为sms4 */
56#define WAPI_IE_SUITCNT_SIZE 2 /* wapi suit count所占字节数 */
57/* wapi key len */
58#define WAPI_KEY_LEN 16
59#define WAPI_PN_LEN 16
60#define HMAC_WAPI_MAX_KEYID 2
61
62/*****************************************************************************
63 3 枚举定义
64*****************************************************************************/
65
66
67/*****************************************************************************
68 4 全局变量声明
69*****************************************************************************/
70
71
72/*****************************************************************************
73 5 消息头定义
74*****************************************************************************/
75
76
77/*****************************************************************************
78 6 消息定义
79*****************************************************************************/
80
81
82/*****************************************************************************
83 7 STRUCT定义
84*****************************************************************************/
85typedef struct {
86 osal_u8 framectl[2]; /* 帧控制 */
87 osal_u8 adress1[OAL_MAC_ADDR_LEN]; /* 地址1 */
88 osal_u8 adress2[OAL_MAC_ADDR_LEN]; /* 地址2 */
89 osal_u8 seqctl[2]; /* 序列控制 */
90 osal_u8 adress3[OAL_MAC_ADDR_LEN]; /* 地址3 */
91 osal_u8 adress4[OAL_MAC_ADDR_LEN]; /* 地址4 */
93
102
103typedef struct tag_hmac_wapi_stru {
104 osal_u8 port_valid; /* wapi控制端口 */
106 osal_u8 keyupdate_flg; /* key更新标志 */
107 osal_u8 pn_inc; /* pn步进值 */
108
110
112 oal_bool_enum_uint8(*wapi_is_pn_odd)(const osal_u8 *pn); /* 判断pn是否为奇数 */
115 oal_netbuf_stru *(*wapi_netbuff_txhandle)(struct tag_hmac_wapi_stru *wapi, oal_netbuf_stru *pst_netbuf);
116 oal_netbuf_stru *(*wapi_netbuff_rxhandle)(struct tag_hmac_wapi_stru *wapi, oal_netbuf_stru *pst_netbuf);
118
119/*****************************************************************************
120 8 UNION定义
121*****************************************************************************/
122
123/*****************************************************************************
124 9 OTHERS定义
125*****************************************************************************/
126
127/*****************************************************************************
128 10 函数声明
129*****************************************************************************/
131typedef osal_u32 (*hmac_wapi_init_etc_cb)(osal_u16 user_idx, osal_u8 pairwise);
132typedef oal_netbuf_stru* (*hmac_rx_frame_wapi_cb)(hmac_vap_stru *hmac_vap, oal_netbuf_stru *netbuf,
133 mac_ieee80211_frame_stru *frame_hdr, hmac_user_stru *hmac_user, mac_rx_ctl_stru **rx_ctrl);
135 mac_tx_ctl_stru *tx_ctl, osal_u8 *tid);
139 mac_addkey_param_stru *payload_addkey_param);
143 hmac_vap_stru *hmac_vap, mac_conn_param_stru *connect_param);
145typedef osal_s32 (*hmac_wapi_update_roam_cb)(hmac_vap_stru *hmac_vap, osal_u8 *roming_now);
150
151static osal_u32 hmac_wapi_init_weakref(osal_void) __attribute__ ((weakref("hmac_wapi_init"), used));
152static osal_void hmac_wapi_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_wapi_deinit"), used));
153
154#ifdef __cplusplus
155#if __cplusplus
156}
157#endif
158#endif
159
160#endif /* end of hmac_wapi.h */
struct tag_hmac_wapi_stru hmac_wapi_stru
osal_bool(* hmac_wapi_ether_type_check_cb)(osal_u16 ether_type)
Definition hmac_wapi.h:141
osal_u32(* hmac_wapi_connect_check_bss_dscr_cb)(mac_bss_dscr_stru *bss_dscr, hmac_vap_stru *hmac_vap, mac_conn_param_stru *connect_param)
Definition hmac_wapi.h:142
osal_u8(* hmac_wapi_update_connect_param_cb)(osal_u32 wpa_versions)
Definition hmac_wapi.h:149
osal_u32(* hmac_11i_reset_wapi_cb)(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user)
Definition hmac_wapi.h:137
osal_bool(* hmac_wapi_get_ether_type_cb)(osal_u16 ether_type)
Definition hmac_wapi.h:147
osal_u8(* hmac_wapi_connected_etc_cb)(osal_u8 device_id)
Definition hmac_wapi.h:148
osal_u32(* hmac_wapi_init_etc_cb)(osal_u16 user_idx, osal_u8 pairwise)
Definition hmac_wapi.h:131
osal_u32(* hmac_wapi_add_key_and_sync_etc_cb)(hmac_vap_stru *hmac_vap, osal_u32 type, mac_addkey_param_stru *payload_addkey_param)
Definition hmac_wapi.h:138
osal_u32(* hmac_wapi_tx_classify_special_cb)(hmac_vap_stru *hmac_vap, osal_u16 type, mac_tx_ctl_stru *tx_ctl, osal_u8 *tid)
Definition hmac_wapi.h:134
osal_u32(* hmac_wapi_user_add_check_cb)(osal_u8 device_id)
Definition hmac_wapi.h:146
#define HMAC_WAPI_MAX_KEYID
Definition hmac_wapi.h:60
static osal_u32 used
Definition hmac_wapi.h:151
#define WAPI_KEY_LEN
Definition hmac_wapi.h:58
osal_s32(* hmac_wapi_update_roam_cb)(hmac_vap_stru *hmac_vap, osal_u8 *roming_now)
Definition hmac_wapi.h:145
osal_void(* hmac_wapi_deinit_etc_cb)(osal_u16 user_idx)
Definition hmac_wapi.h:130
osal_bool(* hmac_wapi_disable_cb)(osal_u8 wapi)
Definition hmac_wapi.h:144
osal_u32(* hmac_tx_lan_to_wlan_wapi_cb)(hmac_vap_stru *hmac_vap, oal_netbuf_stru **netbuf)
Definition hmac_wapi.h:136
osal_void(* hmac_wapi_update_legcy_only_cb)(mac_bss_dscr_stru *bss_dscr, oal_bool_enum_uint8 *legcy_only)
Definition hmac_wapi.h:140
#define WAPI_PN_LEN
Definition hmac_wapi.h:59
osal_u8 type
Definition oal_net.h:0
osal_u8 rsv[3]
Definition oal_net.h:2
#define OAL_MAC_ADDR_LEN
Definition oal_net_rom.h:28
osal_u8 oal_bool_enum_uint8
Definition oal_types_device_rom.h:45
int osal_s32
Definition osal_types.h:19
unsigned char osal_u8
Definition osal_types.h:11
osal_u8 osal_bool
Definition osal_types.h:27
void osal_void
Definition osal_types.h:29
unsigned int osal_u32
Definition osal_types.h:13
unsigned short osal_u16
Definition osal_types.h:12
Log message information header.
Definition log_oam_logger.h:564
Definition mac_user_ext.h:519
Definition mac_vap_ext.h:2019
Definition hmac_wapi.h:94
osal_u8 key_en
Definition hmac_wapi.h:99
Definition mac_vap_ext.h:1469
Definition mac_device_ext.h:596
Definition mac_vap_ext.h:1289
Definition mac_frame_common_rom.h:575
Definition hal_common_ops_device_rom.h:978
Definition dmac_ext_if_device_rom.h:98
Definition oal_skbuff.h:82
Definition hmac_wapi.h:103
osal_u32(* wapi_encrypt)(struct tag_hmac_wapi_stru *wapi, oal_netbuf_stru *pst_netbuf)
Definition hmac_wapi.h:114
osal_u32(* wapi_decrypt)(struct tag_hmac_wapi_stru *wapi, oal_netbuf_stru *netbuff)
Definition hmac_wapi.h:113
hmac_wapi_key_stru wapi_key[2]
Definition hmac_wapi.h:109
osal_u8 port_valid
Definition hmac_wapi.h:104
osal_u8 pn_inc
Definition hmac_wapi.h:107
osal_u8(* wapi_filter_frame)(struct tag_hmac_wapi_stru *wapi, oal_netbuf_stru *netbuff)
Definition hmac_wapi.h:111
oal_bool_enum_uint8(* wapi_is_pn_odd)(const osal_u8 *pn)
Definition hmac_wapi.h:112
osal_u8 keyupdate_flg
Definition hmac_wapi.h:106
osal_u8 keyidx
Definition hmac_wapi.h:105
Definition hmac_wapi.h:85