Files
kunlun/plc/halmac/inc/mac_mm_sniffer.h
2024-09-28 14:24:04 +08:00

90 lines
2.7 KiB
C
Executable File

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef MAC_MM_SNIFFER_H
#define MAC_MM_SNIFFER_H
#include "iot_config_api.h"
#include "os_types_api.h"
#include "iot_pkt_api.h"
#include "iot_uart_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/* rsv for sniffer plc data header */
#define MAC_SNIFFER_HDR_RSV_LEN (14)
/* rsv for aes pack 16 byte */
#define MAC_SNIFFER_AES_RSV_LEN (15)
#define MAC_TO_ETH_TYPE_START (0x5566)
#define MAC_TO_ETH_TYPE_PB (0x5566)
#define MAC_TO_ETH_TYPE_MSDU_GW (0x5567)
#define MAC_TO_ETH_TYPE_MSDU_NW (0x5568)
#define MAC_TO_ETH_TYPE_RF_PB (0x5569)
#define MAC_TO_ETH_TYPE_MSDU_1901 (0x556a)
#define MAC_TO_ETH_TYPE_PB_1901 (0x556b)
#define MAC_TO_ETH_TYPE_END (0x556b)
typedef struct _mac_sniffer_eth_header_type {
uint8_t dst_mac[6];
uint8_t src_mac[6];
uint16_t eth_type;
} mac_sniffer_eth_header_t;
typedef struct _mac_mm_sniffer_reorder_ctxt {
uint32_t last_rx_nid;
uint32_t last_rx_stei;
uint32_t last_rx_dtei;
uint32_t last_rx_lid;
void * rx_stream;
void * rf_rx_stream;
} mac_mm_sniffer_reorder_t;
typedef struct _mac_mm_sniffer_ctxt {
void *ref_vdev;
mac_sniffer_eth_header_t mac_to_eth_header;
iot_pkt_ls tx_pkt_ls;
mac_mm_sniffer_reorder_t rx_ctxt;
iot_uart_h uart_handle;
} mac_mm_sniffer_t;
/**
*@brief mac_mm_sniffer_init.
*
*@param vdev [vdev ptr.]
*@exception [none.]
*@return [none.]
*/
void mac_mm_sniffer_init(void *vdev);
/**
*@brief mac_mm_sniffer_rx_msdu.
*
*@param sniffer_ctxt [sniffer_ctxt.]
*@param proto [proto.]
*@param msdu_buf [rx msdu buf]
*@exception [none.]
*@return [err/fail.]
*/
uint32_t mac_mm_sniffer_rx_msdu(uint32_t proto, iot_pkt_t *msdu_buf);
#ifdef __cplusplus
}
#endif
#endif