143 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			143 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								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 CVG_APP_SG_H
							 | 
						||
| 
								 | 
							
								#define CVG_APP_SG_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* cvg layer includes */
							 | 
						||
| 
								 | 
							
								#include "iot_plc_msg_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if SUPPORT_SMART_GRID
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief   handle send msdu reqest from app layer this method support both
							 | 
						||
| 
								 | 
							
								 *          CCO & STA/PCO role.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @param pkt:  the pkt which app wants to send
							 | 
						||
| 
								 | 
							
								 * @param req:  meta info about the request
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @return
							 | 
						||
| 
								 | 
							
								 *  1 - packet send out
							 | 
						||
| 
								 | 
							
								 *  0 - packet dropped
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t cvg_app_handle_send_msdu_req_sg(iot_pkt_t *pkt,
							 | 
						||
| 
								 | 
							
								    iot_plc_msdu_send_t* req);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief cvg_app_handle_conn_less_send_msdu_req_sg() - handle send conn less
							 | 
						||
| 
								 | 
							
								 *      data reqest from app layer this method support both CCO & STA/PCO role.
							 | 
						||
| 
								 | 
							
								 * @param pkt:  the pkt which app wants to send
							 | 
						||
| 
								 | 
							
								 * @param req:  meta info about the request
							 | 
						||
| 
								 | 
							
								 * @retval 1:   packet send out
							 | 
						||
| 
								 | 
							
								 * @retval 0:   packet dropped
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t cvg_app_handle_conn_less_send_msdu_req_sg(iot_pkt_t *pkt,
							 | 
						||
| 
								 | 
							
								    iot_plc_msdu_send_t *req);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief   cvg_app_report_msdu_to_app_sg() - report msdu to app layer
							 | 
						||
| 
								 | 
							
								 * @param   buf:    buf containing msdu packet
							 | 
						||
| 
								 | 
							
								 * @param   mac:    mac header of the msdu
							 | 
						||
| 
								 | 
							
								 * @param   app_id: application id of the msdu
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void cvg_app_report_msdu_to_app_sg(iot_pkt_t *buf, mac_header_t *mac,
							 | 
						||
| 
								 | 
							
								    uint8_t app_id);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief cvg_app_handle_ctrl_proto_send_req_sg() - handling the MSDU sending
							 | 
						||
| 
								 | 
							
								 *        of the controller protocol for sg.
							 | 
						||
| 
								 | 
							
								 * @param pkt:  the pkt which app wants to send
							 | 
						||
| 
								 | 
							
								 * @param req:  meta info about the request
							 | 
						||
| 
								 | 
							
								 * @retval: 1 - packet send out, 0 - packet dropped
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint8_t cvg_app_handle_ctrl_proto_send_req_sg(iot_pkt_t *pkt,
							 | 
						||
| 
								 | 
							
								    iot_plc_msdu_send_t *req);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief   cvg_app_report_msdu_capture_to_app_sg() - report captured msdu to
							 | 
						||
| 
								 | 
							
								 *          app layer
							 | 
						||
| 
								 | 
							
								 * @param   mac:    mac header of the msdu
							 | 
						||
| 
								 | 
							
								 * @param   data:   app data of the msdu
							 | 
						||
| 
								 | 
							
								 * @param   len:    app data len of the msdu
							 | 
						||
| 
								 | 
							
								 * @param   app_id: application id of the msdu
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void cvg_app_report_msdu_capture_to_app_sg(mac_header_t *mac, uint8_t *data,
							 | 
						||
| 
								 | 
							
								    uint32_t len, uint8_t app_id);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief   cvg_app_report_app_sniffer_data_sg() - report the sniffed app
							 | 
						||
| 
								 | 
							
								 *          message to the app layer.
							 | 
						||
| 
								 | 
							
								 * @param   buf:     buf containing msdu packet.
							 | 
						||
| 
								 | 
							
								 * @param   mac:     mac header of the msdu
							 | 
						||
| 
								 | 
							
								 * @param   nid:     the network id of the message.
							 | 
						||
| 
								 | 
							
								 * @param   nw_addr: the network addr of the message.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void cvg_app_report_app_sniffer_data_sg(iot_pkt_t *buf, mac_header_t *mac,
							 | 
						||
| 
								 | 
							
								    uint32_t nid, uint8_t *nw_addr);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if HPLC_RF_DEV_SUPPORT
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* @brief   report single hop msdu to app layer
							 | 
						||
| 
								 | 
							
								 * @param buf:      buf containing msdu packet
							 | 
						||
| 
								 | 
							
								 * @param s_mac:    mac header of the msdu
							 | 
						||
| 
								 | 
							
								 * @param app_id    application id of this msdu
							 | 
						||
| 
								 | 
							
								 * @param stei:     source tei come from fc
							 | 
						||
| 
								 | 
							
								 * @param dtei:     destination tei come from fc
							 | 
						||
| 
								 | 
							
								 * @param is_bcast: flag to mark if this packet is broadcast packet
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void cvg_app_report_single_hop_msdu_to_app_sg(iot_pkt_t *buf,
							 | 
						||
| 
								 | 
							
								    mac_short_header_t *s_mac, uint8_t app_id, tei_t stei,
							 | 
						||
| 
								 | 
							
								    tei_t dtei, uint8_t is_bcast);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#else /* HPLC_RF_DEV_SUPPORT */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_report_single_hop_msdu_to_app_sg(buf, s_mac, app_id, stei, \
							 | 
						||
| 
								 | 
							
								    dtei, is_bcast)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* HPLC_RF_DEV_SUPPORT */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_handle_send_msdu_req_sg(pkt, req) (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_report_msdu_to_app_sg(buf, mac, app_id)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_handle_conn_less_send_msdu_req_sg(pkt, req) (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_handle_ctrl_proto_send_req_sg(pkt, req) (0)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_report_msdu_capture_to_app_sg(mac, data, len, app_id)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_report_app_sniffer_data_sg(buf, mac, nid, nw_addr)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define cvg_app_report_single_hop_msdu_to_app_sg(buf, s_mac, app_id, stei, \
							 | 
						||
| 
								 | 
							
								    dtei, is_bcast)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* CVG_APP_SG_H */
							 |