| #ifndef __CHL_AGT_UCI__ | 
 | #define __CHL_AGT_UCI__ | 
 |  | 
 | #include <chl.h> | 
 |  | 
 | #define UCI_PKG_AGT		"chl_agent" | 
 |  | 
 | #define UCI_PDP_SEC		"pdp_cfg" | 
 | #define UCI_GLOBAL_SEC	"global_cfg" | 
 |  | 
 | #define UCI_OPT_PDP_ENABLE	"pdp_enable" | 
 | #define UCI_OPT_APN			"apn" | 
 | #define UCI_OPT_IP			"ip_type" | 
 | #define UCI_OPT_LTEDFLT		"lte_default" | 
 | #define UCI_OPT_DFLTGW		"default_gw" | 
 | #define UCI_OPT_ROUTE		"route_dst" | 
 |  | 
 | #define UCI_OPT_AGT_ACTIVE	"agent_active" | 
 | #define UCI_OPT_DATA_ENABLE	"data_enable" | 
 | #define UCI_OPT_HOST_IP		"host_ip" | 
 | #define UCI_OPT_DWNLNK		"downlink_only" | 
 | #define UCI_OPT_WIFI		"wifi_enable" | 
 |  | 
 | #define MAX_APN_STR 30 | 
 | #define MAX_IPV4_STR 16 | 
 | #define MAX_ROUTE_STR 16 | 
 | #define MAX_ROUTES 8 | 
 | #define MAX_PDPS 8 | 
 |  | 
 | #ifndef __maybe_unused | 
 | #define __maybe_unused __attribute__((unused)) | 
 | #endif | 
 |  | 
 |  | 
 | enum pdp_action { | 
 | 	ERR_VAL, | 
 | 	DO_NOTHING, | 
 | 	CLOSE_PDP, | 
 | 	OPEN_PDP, | 
 | 	CHECK_ROUTE, | 
 | 	CLOSE_OPEN_PDP | 
 | }; | 
 |  | 
 | /****************************************************************************** | 
 |  *  Structs | 
 |  ******************************************************************************/ | 
 |  | 
 | struct agent_pdp { | 
 | 	/*parsed variables*/ | 
 | 	bool pdp_enable; | 
 | 	char apn[MAX_APN_STR]; | 
 | 	enum ip_type ip_type; | 
 | 	bool is_lte_default; | 
 | 	bool is_default_gw; | 
 | 	char route_dst[MAX_ROUTES][MAX_ROUTE_STR]; | 
 | 	/*internal variables*/ | 
 | 	int id; | 
 | 	enum chl_nw_status pdp_state; | 
 | 	enum pdp_action action; | 
 | }; | 
 |  | 
 | struct global_conf { | 
 | 	bool agent_active; | 
 | 	bool data_enable; | 
 | 	char host_ip[MAX_IPV4_STR]; | 
 | 	bool downlink_only; | 
 | 	bool wifi_enable; | 
 | }; | 
 |  | 
 | struct agent_conf { | 
 | 	struct global_conf global_conf; | 
 | 	struct agent_pdp agent_pdps[MAX_PDPS]; | 
 | }; | 
 |  | 
 | /****************************************************************************** | 
 |  *  Methods | 
 |  ******************************************************************************/ | 
 |  | 
 | int agt_uci_init(struct uci_context **c, char *pname); | 
 | void agt_uci_done(struct uci_context *c, bool commit, char *pname); | 
 | int uci_SetPtr(struct uci_context * pCtx, | 
 | 						 struct uci_package * p, | 
 | 						 struct uci_section * uci_sec, | 
 | 						 char	* option, | 
 | 						 void   * pValue); | 
 | int uci_DelPtr(struct uci_context * pCtx, | 
 | 						 struct uci_package * p, | 
 | 						 struct uci_section * uci_sec, | 
 | 						 char	* option, | 
 | 						 void   * pValue); | 
 | int uci_AddListPtr(struct uci_context * pCtx, | 
 | 						 struct uci_package * p, | 
 | 						 struct uci_section * uci_sec, | 
 | 						 char	* option, | 
 | 						 void   * pValue); | 
 | int uci_RenamePtr(struct uci_context * pCtx, | 
 | 						 struct uci_package * p, | 
 | 						 struct uci_section * uci_sec, | 
 | 						 char	* option, | 
 | 						 void   * pValue); | 
 | int parse_ucifile(struct agent_conf *agent_conf); | 
 |  | 
 | #endif |