1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __HMAC_TRAFFIC_CLASSIFY__ 20 #define __HMAC_TRAFFIC_CLASSIFY__ 21 22 /* **************************************************************************** 23 1头文件包含 24 **************************************************************************** */ 25 #include "oal_net.h" 26 #include "oal_ext_if.h" 27 #include "hmac_tx_data.h" 28 #include "mac_frame.h" 29 #include "mac_data.h" 30 #include "hmac_user.h" 31 #include "hmac_device.h" 32 33 #ifdef __cplusplus 34 #if __cplusplus 35 extern "C" { 36 #endif 37 #endif 38 39 /* **************************************************************************** 40 2宏定义 41 **************************************************************************** */ 42 /* **************************************************************************** 43 3结构体 44 **************************************************************************** */ 45 /* **************************************************************************** 46 用户结构体: 包含了已识别业务、待识别业务序列 47 这里借助hmac_user_stru,在hmac_user_stru结构体中添加宏定义字段: 48 _PRE_WLAN_FEATURE_TX_CLASSIFY_LAN_TO_WLAN 49 **************************************************************************** */ 50 /* **************************************************************************** 51 RTP头结构体:结构体中没有包含最后的CSRC标识符 52 **************************************************************************** */ 53 typedef struct { 54 /* --------------------------------------------------------------------------- 55 RTP头结构 56 ----------------------------------------------------------------------------- 57 |version|P|X| CSRC数 |M| PT | 序号 | 58 | 2bit |1|1| 4bit |1| 7bit | 16bit | 59 ----------------------------------------------------------------------------- 60 | 时间戳 32bit | 61 ----------------------------------------------------------------------------- 62 | SSRC 32bit | 63 ----------------------------------------------------------------------------- 64 | CSRC 每个CSRC标识符32bit 标识符个数由CSRC数决定 | 65 --------------------------------------------------------------------------- */ 66 hi_u8 version_and_csrc; /* 版本号2bit、填充位(P)1bit、扩展位(X)1bit、CSRC数目4bit */ 67 hi_u8 payload_type; /* 标记1bit、有效载荷类型(PT)7bit */ 68 hi_u16 us_rtp_idx; /* RTP发送序号 */ 69 hi_u32 rtp_time_stamp; /* 时间戳 */ 70 hi_u32 ssrc; /* SSRC */ 71 } hmac_tx_rtp_hdr; 72 73 /* **************************************************************************** 74 3 函数实现 75 **************************************************************************** */ 76 hi_void hmac_tx_traffic_classify(const hmac_tx_ctl_stru *tx_ctl, mac_ip_header_stru *ip, hi_u8 *puc_tid); 77 78 #ifdef __cplusplus 79 #if __cplusplus 80 } 81 #endif 82 #endif 83 #endif /* __HMAC_TRAFFIC_CLASSIFY__ */ 84