#ifndef STATIC_ROUTING_H_ #define STATIC_ROUTING_H_ #include #include #include #include #include #include #include #include #include #include #include #define IP_MAX_LENGTH 128 #define INTERFACE_MAX_LENGTH 20 #define LINE_MAX_LENGTH 128 #define ROUTING_TABLE_MAX_NUMBER 100 #define STRING_LENGTH 128 #define IPV4_GET_STATIC_ROUTING "route -n" #define IPV6_GET_STATIC_ROUTING "route -6" #define IPV4_VERSION 4 #define IPV6_VERSION 6 #define ACTION_LENGTH 10 #define STATIC_ROUTING_PATH "/etc/network/static_routing" struct routing_string{ int version; char destip[IP_MAX_LENGTH]; int netmask; char gateway[IP_MAX_LENGTH]; char dev[INTERFACE_MAX_LENGTH]; int metric; }; typedef struct routing_string routing_t; /*static routing config */ ret_code routing_config_chk(uint source, uint *config_type, pointer input, int *input_len, pointer output, int *output_len); ret_code routing_config_proc(uint source, uint config_type, pointer input, int input_len, pointer output, int *output_len); ret_code routing_config_get_all(uint source, pointer output, int *output_len); /*获取所有路由信息*/ ret_code all_routing_config_chk(uint source, uint *config_type, pointer input, int *input_len, pointer output, int *output_len); ret_code all_routing_get_all(uint source, pointer output, int *output_len); #endif