90 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			90 lines
		
	
	
		
			3.2 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 PLC_MME_ROUTE_H
							 | 
						||
| 
								 | 
							
								#define PLC_MME_ROUTE_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "plc_mme.h"
							 | 
						||
| 
								 | 
							
								#include "plc_utils.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* pack for the structures in the whole file */
							 | 
						||
| 
								 | 
							
								#pragma pack(push)                  // save the pack status
							 | 
						||
| 
								 | 
							
								#pragma pack(1)                     // 1 byte align
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* no data in the path info array */
							 | 
						||
| 
								 | 
							
								#define MME_RT_NO_DATA          0
							 | 
						||
| 
								 | 
							
								/* path list data exist */
							 | 
						||
| 
								 | 
							
								#define MME_RT_PATH_LIST        1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _path_info_t {
							 | 
						||
| 
								 | 
							
								    tei_t       sta;
							 | 
						||
| 
								 | 
							
								    uint8_t     tf_sr;              // traffic sr between STA and previous STA
							 | 
						||
| 
								 | 
							
								    int8_t      ch_quality;         // channel quality in signal noise ratio
							 | 
						||
| 
								 | 
							
								} path_info_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _mme_route_req {
							 | 
						||
| 
								 | 
							
								    uint8_t     version;            // version of route fixing algorithm
							 | 
						||
| 
								 | 
							
								    uint32_t    rt_req_sn;          // route request sequence number
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    uint8_t     reserved      : 3;  // reserved according to spec
							 | 
						||
| 
								 | 
							
								    uint8_t     path_opt_flag : 1;  // path optimize flag
							 | 
						||
| 
								 | 
							
								    uint8_t     data_type     : 4;  // if path_info containted in this packet
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    uint8_t     data_len;           // length of path_info
							 | 
						||
| 
								 | 
							
								    path_info_t path_info[0];       // path info
							 | 
						||
| 
								 | 
							
								} mme_route_req_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _mme_route_reply {
							 | 
						||
| 
								 | 
							
								    uint8_t     version;            // version of route fixing algorithm
							 | 
						||
| 
								 | 
							
								    uint32_t    rt_req_sn;          // route request sequence number
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    uint8_t     reserved    : 4;    // reserved according to spec
							 | 
						||
| 
								 | 
							
								    uint8_t     data_type   : 4;    // if path_info containted in this packet
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    uint8_t     data_len;           // length of path_info
							 | 
						||
| 
								 | 
							
								    path_info_t path_info[0];       // path info
							 | 
						||
| 
								 | 
							
								} mme_route_reply_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _mme_route_err {
							 | 
						||
| 
								 | 
							
								    uint8_t     version;            // version of route fixing algorithm
							 | 
						||
| 
								 | 
							
								    uint32_t    rt_req_sn;          // route request sequence number
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    uint8_t     reserved;           // reserved according to spec
							 | 
						||
| 
								 | 
							
								    uint8_t     err_sta_cnt;        // unreachable STA count
							 | 
						||
| 
								 | 
							
								    tei_t       sta[0];             // teis of unreachable STAs
							 | 
						||
| 
								 | 
							
								} mme_route_err_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _mme_route_ack {
							 | 
						||
| 
								 | 
							
								    uint8_t     version;            // version of route fixing algorithm
							 | 
						||
| 
								 | 
							
								    uint8_t     reserved[3];
							 | 
						||
| 
								 | 
							
								    uint32_t    rt_req_sn;          // route request sequence number
							 | 
						||
| 
								 | 
							
								} mme_route_ack_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(pop)               // restore the pack status
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // PLC_MME_ROUTE_H
							 |