| #ifndef __TR069_H__ | |
| #define __TR069_H__ | |
| #include "soap.h" | |
| #include "rpc.h" | |
| #include "tr069_sys.h" | |
| struct tr069_msg { | |
| struct soap_rpc_node * root; | |
| struct soap_rpc_node * env; | |
| struct soap_rpc_node * body_node; | |
| struct soap_rpc_node * header_node; | |
| struct soap_trace_stack body_stack; | |
| struct soap_trace_stack header_stack; | |
| }; | |
| struct method_get_param_name { | |
| char * parameter_path; | |
| char * next_level; | |
| }; | |
| struct method_get_param_value { | |
| char * string; | |
| struct method_get_param_value * next; | |
| }; | |
| struct method_get_attribute_value { | |
| char * string; | |
| struct method_get_attribute_value * next; | |
| }; | |
| struct method_set_attribute_value { | |
| char * name; | |
| int notification_change; | |
| int notification; | |
| int access_list_change; // Not process, now | |
| int access_list; // Not process, now | |
| struct method_set_attribute_value * next; | |
| }; | |
| struct method_set_param_value_value { | |
| char * name; | |
| char * value; | |
| int type; | |
| struct method_set_param_value_value * next; | |
| }; | |
| struct method_set_param_value { | |
| struct method_set_param_value_value * value; | |
| char * parameter_key; | |
| }; | |
| struct method_reboot { | |
| char * command_key; | |
| }; | |
| struct method_download { | |
| char * command_key; | |
| char * file_type; | |
| char * url; | |
| char * username; | |
| char * password; | |
| unsigned int file_size; | |
| char * target_file_name; | |
| unsigned int delay_seconds; | |
| char * success_url; | |
| char * failure_url; | |
| int status; // Use trace this method result sent count | |
| char * start_time;// data time format | |
| char * complete_time;// data time format | |
| }; | |
| struct method_add_delete_obj { | |
| char * parameter_key; | |
| char * object_name; | |
| }; | |
| struct tr069_rpc_method { | |
| char * id; | |
| int must_understand; | |
| int type; | |
| union { | |
| struct method_get_param_name get_param_name; | |
| struct method_get_param_value * get_param_value; | |
| struct method_set_param_value set_param_value; | |
| struct method_get_attribute_value * get_param_attr; | |
| struct method_set_attribute_value * set_param_attr; | |
| struct method_reboot reboot; | |
| struct method_download download; | |
| struct method_add_delete_obj add_delete; | |
| } body; | |
| }; | |
| struct cpe_struct { | |
| int periodic_inform_enable; | |
| int periodic_inform_interval; | |
| int periodic_inform_time; | |
| char username[32]; | |
| char password[32]; | |
| char conn_req_username[32]; | |
| char conn_req_password[32]; | |
| char conn_url[90]; | |
| char parameter_key[33]; | |
| unsigned int local_address; | |
| unsigned int udp_port; | |
| int stun_enable; | |
| int upgrades_managed; | |
| char stun_server[64]; | |
| unsigned int stun_server_port; | |
| char stun_username[32]; | |
| char stun_password[32]; | |
| unsigned short int stun_max_period; | |
| unsigned short int stun_min_period; | |
| int nat_detect; | |
| const char * connect_request_path; | |
| const char * config_password; | |
| int bootstarp_flag; | |
| int enable; | |
| unsigned int CWMPRetryMiniWaitInterval; | |
| unsigned int CWMPRetryIntervalMultiplier; | |
| }; | |
| struct tr069_task_command { | |
| int command_id; | |
| int (*tsk_cmd_cb)(struct tr069_task_command *, int); | |
| unsigned int msg; | |
| unsigned int payload[0]; | |
| }; | |
| enum { | |
| TR069_COMMAND_IP_CHANGE, | |
| TR069_COMMAND_STUN_CHANGE, | |
| TR069_COMMAND_REQUEST_CONNECT, | |
| TR069_COMMAND_DOWNLOAD_TRIGGER, | |
| TR069_COMMAND_DOWNLOAD_COMPLETE, | |
| TR069_COMMAND_ADDOBJ, | |
| TR069_COMMAND_REBOOT, | |
| TR069_COMMAND_RESET, | |
| TR069_COMMAND_FACTORY_RESET, | |
| TR069_COMMAND_DELAY_FUNC, | |
| TR069_COMMAND_WIFI_DEVICE_ADD, | |
| TR069_COMMAND_WIFI_SSID_CHANGE, | |
| TR069_COMMAND_NEW_IP_ADDRESS, | |
| }; | |
| enum { | |
| TR069_EVENT_BOOTSTRAP, | |
| TR069_EVENT_BOOT, | |
| TR069_EVENT_PERIODIC, | |
| TR069_EVENT_SCHEDULED, | |
| TR069_EVENT_VALUE_CHANGE, | |
| TR069_EVENT_CONNECTION_REQUEST, | |
| TR069_EVENT_TRANSFER_COMPLETE, | |
| TR069_EVENT_REQUEST_DOWNLOAD, | |
| TR069_EVENT_M_REBOOT, | |
| TR069_EVENT_M_SCHEDULE_INFORM, | |
| TR069_EVENT_M_DOWNLOAD, | |
| TR069_EVENT_M_SCHEDULE_DOWNLOAD, | |
| TR069_EVENT_M_UPLOAD, | |
| TR069_EVENT_M_CHANGE_DU_STATE, | |
| TR069_EVENT_MAX, | |
| }; | |
| int is_partial_path(const char * string); | |
| extern struct tr069_msg * tr069_build_msg(const char * id); | |
| extern void tr069_msg_destroy(struct tr069_msg * msg); | |
| extern int tr069_inform_acs(struct tr069_msg * msg); | |
| extern int build_get_rpc_method_response(struct tr069_rpc_method * method, struct tr069_msg * msg); | |
| extern int parameter_name_dup(struct tr069_obj * obj, struct tr069_param * param, struct tr069_instance * instance, struct walk_context * context, int type); | |
| extern int parameter_value_dup(struct tr069_obj * obj, struct tr069_param * param, struct tr069_instance * instance, struct walk_context * context, int type); | |
| extern int parameter_attr_dup(struct tr069_obj * obj, struct tr069_param * param, struct tr069_instance * instance, struct walk_context * context, int type); | |
| extern int walk_obj_and_paramet(struct tr069_obj * root, struct tr069_instance * instance, walk_obj_paramet_cb callback, void * data, int flag); | |
| extern void set_tr069_event(unsigned int event, const char * command_key); | |
| extern int send_tr069_command(struct tr069_task_command * command); | |
| extern const char * fault2string(int fault); | |
| extern void free_download_method(struct tr069_rpc_method * method); | |
| extern int post_system_reboot(void); | |
| struct tr069_helper_run_context { | |
| int (*cb)(struct tr069_helper_run_context *); | |
| int block; | |
| void * sem; | |
| void * result; | |
| }; | |
| extern int post_to_helper(struct tr069_helper_run_context * context); | |
| extern struct tr069_helper_run_context * malloc_helper_context(void); | |
| extern void free_helper_context(struct tr069_helper_run_context * context); | |
| typedef void (*tr069_delay_cb)(void * context); | |
| extern int post_delay_func(tr069_delay_cb cb, void * context); | |
| extern struct cpe_struct cpe; | |
| extern struct soap_rpc_node_table root[]; | |
| struct tr069_parameter_change_list_struct { | |
| char parameter_name[200]; | |
| struct tr069_parameter_change_list_struct * next; | |
| }; | |
| extern struct tr069_parameter_change_list_struct * tr069_parameter_change_list; | |
| extern char * tr069_string_prefix; | |
| #define TR069_PSM_MODULE "tr069" | |
| #define TR069_PSM_TAG_ACSURL "acs_url" | |
| #define TR069_PSM_TAG_ACSUSERNAME "acs_username" | |
| #define TR069_PSM_TAG_ACSUSERPASSWORD "acs_password" | |
| #define TR069_PSM_TAG_CONNECT_REQUEST_NAME "conn_name" | |
| #define TR069_PSM_TAG_CONNECT_REQUEST_PSW "conn_psw" | |
| #define TR069_PSM_TAG_INFORM_ENABLE "inform_enable" | |
| #define TR069_PSM_TAG_INFORM_INTERVAL "inform_interval" | |
| #define TR069_PSM_TAG_BOOT_STATE "boot_state" | |
| #endif |