Add aaa-12 添加VLAN转发模块功能代码
SOL 添加VLAN转发模块功能代码 修改人:yinbin 检视人:yinbin Signed-off-by: yinbin <yinbin@cmhi.chinamobile.com>
This commit is contained in:
parent
ebc8d47cf0
commit
2b7698bc26
|
@ -23,14 +23,15 @@
|
|||
|
||||
#define LOG_CONFIG_MODULE 0x00000004
|
||||
|
||||
/*vlan config */
|
||||
#define VLAN_CONFIG_MODULE 0x00000005
|
||||
|
||||
/*DHCP CONFIG*/
|
||||
#define DHCP_CONFIG_MODULE 0x00000006
|
||||
|
||||
/*nat config */
|
||||
#define NAT_CONFIG_MODULE 0x00000008
|
||||
|
||||
/*vlan config */
|
||||
#define VLAN_CONFIG_MODULE 0x00000005
|
||||
|
||||
/*DHCP CONFIG*/
|
||||
#define DHCP_CONFIG_MODULE 0x00000006
|
||||
/************************* 模块定义结束 **********************/
|
||||
|
||||
/************************ config id定义 **********************/
|
||||
|
@ -55,14 +56,17 @@
|
|||
#define LOG_CONFIG_REMOTE_LEVEL (uint64)((uint64)LOG_CONFIG_MODULE<<32|5)
|
||||
#define LOG_CONFIG_FILE (uint64)((uint64)LOG_CONFIG_MODULE<<32|6)
|
||||
|
||||
#define VLAN_CONFIG (uint64)((uint64)VLAN_CONFIG_MODULE<<32|1)
|
||||
|
||||
#define DHCP_SUBNET_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|1)
|
||||
#define DHCP_HOST_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|2)
|
||||
#define DHCP_SHARED_NETWORK_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|3)
|
||||
#define DHCP_RELAY_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|4)
|
||||
#define DHCP_CLIENT_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|5)
|
||||
#define DHCP_DHCPD_LEASE (uint64)((uint64)DHCP_CONFIG_MODULE<<32|6)
|
||||
|
||||
#define NAT4_CONFIG (uint64)((uint64)NAT_CONFIG_MODULE<<32|1)
|
||||
|
||||
#define DHCP_SUBNET_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|1)
|
||||
#define DHCP_HOST_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|2)
|
||||
#define DHCP_SHARED_NETWORK_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|3)
|
||||
#define DHCP_RELAY_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|4)
|
||||
#define DHCP_CLIENT_CONFIG (uint64)((uint64)DHCP_CONFIG_MODULE<<32|5)
|
||||
#define DHCP_DHCPD_LEASE (uint64)((uint64)DHCP_CONFIG_MODULE<<32|6)
|
||||
|
||||
|
||||
/************************ config id定义 end**********************/
|
||||
|
|
|
@ -37,8 +37,8 @@ COMMON_SRCS = configserver.c \
|
|||
user_manager_config/user_recover_config.c user_manager_config/user_group_config.c user_manager_config/user_account_config.c user_manager_config/usermanager-server/array_index.c \
|
||||
user_manager_config/usermanager-server/user_group.c user_manager_config/usermanager-server/user_mod.c user_manager_config/usermanager-server/user.c \
|
||||
log_config/log_config_console.c log_config/log_config_init.c log_config/log_config_cm.c log_config/log_config_monitor.c log_config/log_config_remote.c log_config/log_config_file.c \
|
||||
nat_config/natconfig.c
|
||||
|
||||
nat_config/natconfig.c \
|
||||
vlan_config/vlan_config.c \
|
||||
|
||||
# MRS Board Source Files
|
||||
PLAT_LINUX_SRCS = $(COMMON_SRCS)
|
||||
|
|
|
@ -1,228 +1,241 @@
|
|||
#ifndef CONFIGM_H_
|
||||
#define CONFIGM_H_
|
||||
#include "config_manager.h"
|
||||
#include "s2j/s2j.h"
|
||||
#include "../../../../common/rpc/rpc_common.h"
|
||||
#include "../../../../../Common/commuapinl.h"
|
||||
#include "../user_manager_config/user_group_config.h"
|
||||
#include "../user_manager_config/user_account_config.h"
|
||||
#include "../user_manager_config/user_recover_config.h"
|
||||
#include "netconfig.h"
|
||||
#include "log_config.h"
|
||||
#include "../web_config/authfree.h"
|
||||
#include "../web_config/auth_parameters.h"
|
||||
#include "natconfig.h"
|
||||
|
||||
|
||||
|
||||
#define CONFIG_INIT_ARRAY \
|
||||
{\
|
||||
{ \
|
||||
NETCONFIG_MODULE, \
|
||||
net_main \
|
||||
}, \
|
||||
{ \
|
||||
LOG_CONFIG_MODULE, \
|
||||
log_config_init \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
1、配置ID,全局唯一,用于寻找对应的配置业务
|
||||
2、配置源检查,全局唯一,用于寻找对应的配置业务,
|
||||
从低位到高位,第一位表示WEB,后续配置扩展
|
||||
3、是否配置恢复
|
||||
4、是否是多实例
|
||||
5、配置校验回调函数
|
||||
6、配置处理接口
|
||||
7、配置获取接口
|
||||
8、配置全部获取接口
|
||||
*/
|
||||
#define CONFIG_SERVICE_ARRAY \
|
||||
{ \
|
||||
{\
|
||||
IPCONFIG_V4, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
ip_config_chk, \
|
||||
ip_config_proc, \
|
||||
ip_config_get, \
|
||||
ip_config_get_all \
|
||||
},\
|
||||
{\
|
||||
BR_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
br_config_chk, \
|
||||
br_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
BRIF_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
br_if_config_chk, \
|
||||
br_if_config_proc, \
|
||||
br_if_config_get, \
|
||||
br_if_config_get_all \
|
||||
},\
|
||||
{\
|
||||
BRFDB_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
br_fdb_config_chk, \
|
||||
NULL, \
|
||||
br_fdb_config_get, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
USER_MANAGER_CONFIG_GROUP, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
usergroup_config_chk, \
|
||||
usergroup_config_proc, \
|
||||
usergroup_config_get, \
|
||||
usergroup_config_get_all \
|
||||
},\
|
||||
{\
|
||||
USER_MANAGER_CONFIG_RECOVER, \
|
||||
CONFIG_FROM_RECOVER1, \
|
||||
TRUE, \
|
||||
userecover_config_chk, \
|
||||
userecover_config_proc, \
|
||||
userecover_config_get, \
|
||||
userecover_config_get_all \
|
||||
},\
|
||||
{ \
|
||||
AUTHFREE_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
freeauth_config_chk, \
|
||||
freeauth_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
FREEPARAMETERS_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
authpara_config_chk, \
|
||||
authpara_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
USER_MANAGER_CONFIG_USER, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
user_config_chk, \
|
||||
user_config_proc, \
|
||||
user_config_get, \
|
||||
user_config_get_all \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_CONSOLE, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_console_config_chk, \
|
||||
log_console_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_MONITOR, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_monitor_config_chk, \
|
||||
log_monitor_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_REMOTE_ADD_HOST, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_remote_host_config_chk, \
|
||||
log_remote_add_host_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_REMOTE_DEL_HOST, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_remote_host_config_chk, \
|
||||
log_remote_del_host_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_REMOTE_LEVEL, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_remote_level_config_chk, \
|
||||
log_remote_level_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_FILE, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_file_config_chk, \
|
||||
log_file_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
NAT4_CONFIG, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
nat_config_chk, \
|
||||
nat_config_proc, \
|
||||
NULL, \
|
||||
nat_config_get_all \
|
||||
}\
|
||||
}
|
||||
|
||||
typedef ret_code (*cm_config_init)();
|
||||
|
||||
typedef ret_code (*cm_config_chk)(uint source, uint *config_type,
|
||||
pointer input, int *input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_proc)(uint source, uint config_type,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_get)(uint source,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_get_all)(uint source,
|
||||
pointer output, int *output_len);
|
||||
|
||||
/* 配置注册 */
|
||||
struct _config_init {
|
||||
uint config_mudlue;
|
||||
cm_config_init init_callback;
|
||||
};
|
||||
typedef struct _config_init config_init_t;
|
||||
|
||||
|
||||
/* 配置注册 */
|
||||
struct _config_service {
|
||||
uint64 config_id; /* 配置ID,全局唯一,用于寻找对应的配置业务*/
|
||||
uint config_src; /* 配置源检查,全局唯一,用于寻找对应的配置业务,从低位到高位,第一位表示web,后续配置扩展 */
|
||||
boolean recovery; /* 配置恢复处理函数,如果为FALSE则不进行配置恢复 */
|
||||
cm_config_chk chk_callback; /* 配置校验回调函数 */
|
||||
cm_config_proc proc_callback; /* 配置接口 */
|
||||
cm_config_get get_callback; /* 获取配置接口 */
|
||||
cm_config_get_all getall_callback; /* 获取所有配置接口 */
|
||||
};
|
||||
|
||||
typedef struct _config_service config_service_t;
|
||||
|
||||
#endif /* RPC_COMMON_H_ */
|
||||
|
||||
#ifndef CONFIGM_H_
|
||||
#define CONFIGM_H_
|
||||
#include "config_manager.h"
|
||||
#include "s2j/s2j.h"
|
||||
#include "../../../../common/rpc/rpc_common.h"
|
||||
#include "../../../../../Common/commuapinl.h"
|
||||
#include "../user_manager_config/user_group_config.h"
|
||||
#include "../user_manager_config/user_account_config.h"
|
||||
#include "../user_manager_config/user_recover_config.h"
|
||||
#include "netconfig.h"
|
||||
#include "log_config.h"
|
||||
#include "../web_config/authfree.h"
|
||||
#include "../web_config/auth_parameters.h"
|
||||
#include "natconfig.h"
|
||||
|
||||
|
||||
|
||||
#define CONFIG_INIT_ARRAY \
|
||||
{\
|
||||
{ \
|
||||
NETCONFIG_MODULE, \
|
||||
net_main \
|
||||
}, \
|
||||
{ \
|
||||
LOG_CONFIG_MODULE, \
|
||||
log_config_init \
|
||||
}, \
|
||||
{ \
|
||||
VLAN_CONFIG_MODULE, \
|
||||
vlan_config_init \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
1、配置ID,全局唯一,用于寻找对应的配置业务
|
||||
2、配置源检查,全局唯一,用于寻找对应的配置业务,
|
||||
从低位到高位,第一位表示WEB,后续配置扩展
|
||||
3、是否配置恢复
|
||||
4、是否是多实例
|
||||
5、配置校验回调函数
|
||||
6、配置处理接口
|
||||
7、配置获取接口
|
||||
8、配置全部获取接口
|
||||
*/
|
||||
#define CONFIG_SERVICE_ARRAY \
|
||||
{ \
|
||||
{\
|
||||
IPCONFIG_V4, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
ip_config_chk, \
|
||||
ip_config_proc, \
|
||||
ip_config_get, \
|
||||
ip_config_get_all \
|
||||
},\
|
||||
{\
|
||||
BR_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
br_config_chk, \
|
||||
br_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
BRIF_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
br_if_config_chk, \
|
||||
br_if_config_proc, \
|
||||
br_if_config_get, \
|
||||
br_if_config_get_all \
|
||||
},\
|
||||
{\
|
||||
BRFDB_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
br_fdb_config_chk, \
|
||||
NULL, \
|
||||
br_fdb_config_get, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
USER_MANAGER_CONFIG_GROUP, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
usergroup_config_chk, \
|
||||
usergroup_config_proc, \
|
||||
usergroup_config_get, \
|
||||
usergroup_config_get_all \
|
||||
},\
|
||||
{\
|
||||
USER_MANAGER_CONFIG_RECOVER, \
|
||||
CONFIG_FROM_RECOVER1, \
|
||||
TRUE, \
|
||||
userecover_config_chk, \
|
||||
userecover_config_proc, \
|
||||
userecover_config_get, \
|
||||
userecover_config_get_all \
|
||||
},\
|
||||
{ \
|
||||
AUTHFREE_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
freeauth_config_chk, \
|
||||
freeauth_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
FREEPARAMETERS_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
authpara_config_chk, \
|
||||
authpara_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
USER_MANAGER_CONFIG_USER, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
user_config_chk, \
|
||||
user_config_proc, \
|
||||
user_config_get, \
|
||||
user_config_get_all \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_CONSOLE, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_console_config_chk, \
|
||||
log_console_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_MONITOR, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_monitor_config_chk, \
|
||||
log_monitor_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_REMOTE_ADD_HOST, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_remote_host_config_chk, \
|
||||
log_remote_add_host_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_REMOTE_DEL_HOST, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_remote_host_config_chk, \
|
||||
log_remote_del_host_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_REMOTE_LEVEL, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_remote_level_config_chk, \
|
||||
log_remote_level_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
LOG_CONFIG_FILE, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
log_file_config_chk, \
|
||||
log_file_config_proc, \
|
||||
NULL, \
|
||||
NULL \
|
||||
},\
|
||||
{\
|
||||
NAT4_CONFIG, \
|
||||
CONFIG_FROM_WEB, \
|
||||
FALSE, \
|
||||
nat_config_chk, \
|
||||
nat_config_proc, \
|
||||
NULL, \
|
||||
nat_config_get_all \
|
||||
},\
|
||||
{\
|
||||
VLAN_CONFIG, \
|
||||
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
||||
FALSE, \
|
||||
vlan_config_chk, \
|
||||
vlan_config_proc, \
|
||||
vlan_config_get, \
|
||||
vlan_config_get_all \
|
||||
}\
|
||||
}
|
||||
|
||||
typedef ret_code (*cm_config_init)();
|
||||
|
||||
typedef ret_code (*cm_config_chk)(uint source, uint *config_type,
|
||||
pointer input, int *input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_proc)(uint source, uint config_type,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_get)(uint source,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
typedef ret_code (*cm_config_get_all)(uint source,
|
||||
pointer output, int *output_len);
|
||||
|
||||
/* 配置注册 */
|
||||
struct _config_init {
|
||||
uint config_mudlue;
|
||||
cm_config_init init_callback;
|
||||
};
|
||||
typedef struct _config_init config_init_t;
|
||||
|
||||
|
||||
/* 配置注册 */
|
||||
struct _config_service {
|
||||
uint64 config_id; /* 配置ID,全局唯一,用于寻找对应的配置业务*/
|
||||
uint config_src; /* 配置源检查,全局唯一,用于寻找对应的配置业务,从低位到高位,第一位表示web,后续配置扩展 */
|
||||
boolean recovery; /* 配置恢复处理函数,如果为FALSE则不进行配置恢复 */
|
||||
cm_config_chk chk_callback; /* 配置校验回调函数 */
|
||||
cm_config_proc proc_callback; /* 配置接口 */
|
||||
cm_config_get get_callback; /* 获取配置接口 */
|
||||
cm_config_get_all getall_callback; /* 获取所有配置接口 */
|
||||
};
|
||||
|
||||
typedef struct _config_service config_service_t;
|
||||
|
||||
#endif /* RPC_COMMON_H_ */
|
||||
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
#ifndef VLAN_CONFIG_H_
|
||||
#define VLAN_CONFIG_H_
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <cjson/cJSON.h>
|
||||
#include "configm.h"
|
||||
#include "rpc.h"
|
||||
#include "parsefile.h"
|
||||
#include "netconfig.h"
|
||||
|
||||
#define MAX_VLAN 4096/* 0用户识别帧优先级,4095保留,共4094个 */
|
||||
#define VID_MIN 2 /* vid范围2-4094 */
|
||||
#define VID_MAX MAX_VLAN - 2 /* vid范围2-4094 */
|
||||
#define MAX_INTERFACES 20 /* 最大接口数目 */
|
||||
#define IF_NAME_LEN 20 /* 接口名最大长度 */
|
||||
#define BR_VLAN_NAME_LEN 50 /* br-vlan的名字最大长度 */
|
||||
#define SYSCALL_BUF_LEN 100
|
||||
#define BITSPERWORD 32
|
||||
#define SHIFT 5
|
||||
#define MASK 0x1F
|
||||
#define FILE_BUF_LINE 100
|
||||
#define EACH_PORT_MAX_VLAN_NUM 5
|
||||
#define ERR_DATA_LEN 500
|
||||
#define VLAN_TEST_ADD_PATH "/home/eric/code/test/eric/vlan/conf/vlan_test.conf.add"
|
||||
#define VLAN_TEST_DEL_PATH "/home/eric/code/test/eric/vlan/conf/vlan_test.conf.del"
|
||||
#define xfree(X) \
|
||||
do{ \
|
||||
if(X){ \
|
||||
free(X); \
|
||||
X = NULL; \
|
||||
} \
|
||||
}while(0);
|
||||
|
||||
/* 操作类型:ADD、MOD、DEL */
|
||||
typedef enum{
|
||||
OP_NONE,
|
||||
OP_ADD,
|
||||
OP_MOD,
|
||||
OP_DEL,
|
||||
}operation_type;
|
||||
|
||||
/* 链路类型:none、access、trunk */
|
||||
typedef enum{
|
||||
LINK_TYPE_NONE,
|
||||
LINK_TYPE_ACCESS,
|
||||
LINK_TYPE_TRUNK,
|
||||
LINK_TYPE_HYBIRD,
|
||||
LINK_TYPE_UNKNOWN,
|
||||
}interface_link_attr;
|
||||
|
||||
/* 接口模型:1 桥接; 2 路由桥接; 3 路由 */
|
||||
typedef enum{
|
||||
INTERFACE_MODEL_FORWARD,
|
||||
INTERFACE_MODEL_ROUTE_FORWARD,
|
||||
INTERFACE_MODEL_ROUTE,
|
||||
}interface_model;
|
||||
|
||||
/* 接口网络类型:LAN、WAN */
|
||||
typedef enum{
|
||||
IF_TYPE_LAN,
|
||||
IF_TYPE_WAN,
|
||||
}interface_network_type;
|
||||
|
||||
/* 接口VLAN信息 */
|
||||
typedef struct interface_vlan_info_t{
|
||||
|
||||
interface_link_attr attr;
|
||||
operation_type op_type;//操作类型ADD、DEL、MOD
|
||||
interface_model if_model;//接口模型
|
||||
int vidcnt;//vid数量
|
||||
int vlan_bitmap[MAX_VLAN/BITSPERWORD];
|
||||
char if_name[IF_NAME_LEN];
|
||||
}interface_vlan_info;
|
||||
|
||||
|
||||
/* vlan个数100、200、300、400、500、600、700、800、900、1000 */
|
||||
#define ADD_100 "/home/eric/code/test/eric/vlan/conf/conf.add.100"
|
||||
#define ADD_100_200 "/home/eric/code/test/eric/vlan/conf/conf.add.100_200"
|
||||
#define ADD_100_1000 "/home/eric/code/test/eric/vlan/conf/conf.add.100_1000"
|
||||
#define DEL_100 "/home/eric/code/test/eric/vlan/conf/conf.add.100"
|
||||
#define DEL_100_200 "/home/eric/code/test/eric/vlan/conf/conf.add.100_200"
|
||||
#define DEL_100_1000 "/home/eric/code/test/eric/vlan/conf/conf.add.100_1000"
|
||||
|
||||
/* void */
|
||||
void vlan_bitmap_set(int *v, int i);
|
||||
void vlan_bitmap_clear(int *v, int i);
|
||||
void interface_vlan_init(void);
|
||||
void vlan_set_struct_stub(interface_vlan_info *if_vlan_info, operation_type op_type, int *if_vlnum);
|
||||
void vlan_config_stub(operation_type op_type);
|
||||
void vlan_config_format_json_stub(int *interface);
|
||||
void vlan_config_get_all_stub(uint source);
|
||||
void vlan_config_get_stub(void);
|
||||
void vlan_config_proc_test(operation_type op_type);
|
||||
void vlan_config_init(void);
|
||||
void vlan_config_stub1(void);
|
||||
void vlan_config_stub1(void);
|
||||
|
||||
/* int */
|
||||
int vlan_bitmap_check(int *v, int i);
|
||||
int if_vlan2subif(char *if_name, int vid, char *subif);
|
||||
int br_if_num_stub(char *br_name, operation_type op_type);
|
||||
int br_if_num(char *br_name);
|
||||
int create_br_stub(char *br_vlname);
|
||||
int create_br(char *br_vlname);
|
||||
int br_addif_stub(char *br_name, char *if_name);
|
||||
int br_addif(char *br_name, char *if_name);
|
||||
int interface_br_stub(char *if_name, char *br_name);
|
||||
int interface_br(char *if_name, char *br_name);
|
||||
int del_br_stub(char *br_name);
|
||||
int del_br(char *br_name);
|
||||
int add_bridge_vlan_access(char *if_name, int vid);
|
||||
int check_config(char *if_name);
|
||||
int add_interface_vlan_access(char *if_name, int *vlan_bitmap, interface_model if_model);
|
||||
int add_bridge_vlan_trunk(char *if_name, int *vlan_bitmap);
|
||||
int add_bridge_vlan_trunk(char *if_name, int *vlan_bitmap);
|
||||
int del_bridge_vlan_access(char *if_name);
|
||||
int del_bridge_vlan_access(char *if_name);
|
||||
int del_bridge_vlan_trunk(char *if_name);
|
||||
int get_ifnode_from_global(char *if_name);
|
||||
int find_insert_ifnode_from_global(char *if_name);
|
||||
int get_old_interface_attr(char *if_name, interface_link_attr *attr);
|
||||
int if_model_is_change(interface_model old, interface_model new);
|
||||
|
||||
/* typedefine */
|
||||
interface_link_attr get_attr_from_ifname(char *if_name);
|
||||
interface_network_type lan_or_wan_stub(char *if_name);
|
||||
interface_network_type lan_or_wan(char *if_name);
|
||||
interface_model get_old_interface_model(char *if_name, interface_model *if_model);
|
||||
interface_model which_interface_model(char *if_name);
|
||||
|
||||
/* ret_code */
|
||||
ret_code add_interface_vlan_trunk(char *if_name, int *vlan_bitmap, interface_model if_model);
|
||||
ret_code add_interface_vlan(interface_vlan_info *if_vlan_info);
|
||||
ret_code del_vlan_sub_interface(char *if_name, int *vlan_bitmap);
|
||||
ret_code add_vlan_sub_interface(char *if_name, int *vlan_bitmap);
|
||||
ret_code del_interface_vlan_trunk(char *if_name, int *vlan_bitmap, interface_model if_model);
|
||||
ret_code refresh_if_vlan_info_op_add(interface_vlan_info *if_vlan_info);
|
||||
ret_code refresh_if_vlan_info_op_del(interface_vlan_info *if_vlan_info);
|
||||
ret_code vlan_save_conf_file_add(interface_vlan_info *if_vlan_info);
|
||||
ret_code vlan_save_conf_file_del(interface_vlan_info *if_vlan_info);
|
||||
ret_code vlan_save_conf_file(interface_vlan_info *if_vlan_info);
|
||||
ret_code refresh_if_vlan_info(interface_vlan_info *if_vlan_info);
|
||||
ret_code del_interface_vlan(interface_vlan_info *if_vlan_info);
|
||||
ret_code vlan_config_json_parse(pointer input, interface_vlan_info *if_vlan_info, int *if_vlnum);
|
||||
ret_code vlan_config_recovery(void);
|
||||
ret_code vlan_get_json_parse(int *interface, pointer input);
|
||||
ret_code vlan_config_format_json(int *interface, pointer output, int *output_len);
|
||||
ret_code vlan_get_from_conf_file(int *interface);
|
||||
ret_code vlan_config_get_all(uint source, pointer output, int *output_len);
|
||||
ret_code vlan_config_json_parse_test(char *path, interface_vlan_info *if_vlan_info, int *if_vlnum);
|
||||
ret_code vlan_config_json_parse_test1(operation_type op_type, interface_vlan_info *if_vlan_info, int *if_vlnum);
|
||||
ret_code vlan_config_chk_test(operation_type op_type);
|
||||
ret_code interface_vlan_check(interface_vlan_info *if_vlan_info);
|
||||
ret_code if_attr_chk(interface_vlan_info *if_vlan_info);
|
||||
ret_code op_type_chk(interface_vlan_info *if_vlan_info);
|
||||
ret_code op_type_add_chk(interface_vlan_info *if_vlan_info);
|
||||
ret_code op_type_del_chk(interface_vlan_info *if_vlan_info);
|
||||
ret_code vid_value_chk(int vid);
|
||||
ret_code vid_num_chk(char *if_name, operation_type op_type, int num);
|
||||
ret_code if_name_chk(interface_vlan_info *if_vlan_info);
|
||||
ret_code vlan_config_set_chk(uint source, pointer input);
|
||||
ret_code vlan_operate_parse(pointer input, int *operate_type);
|
||||
ret_code vlan_config_get_chk(uint source, pointer input);
|
||||
ret_code vlan_config_get_all_chk(uint source, pointer input);
|
||||
ret_code del_compose_if_vlan_info(char *if_name, interface_vlan_info *if_vlan_info);
|
||||
ret_code interface_vlan_set(interface_vlan_info *if_vlan_info);
|
||||
ret_code vlan_config_proc(uint source, uint config_type,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
ret_code vlan_config_get(uint source,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
ret_code vlan_config_chk(uint source,uint *config_type,
|
||||
pointer input, int *input_len,
|
||||
pointer output, int *output_len);
|
||||
|
||||
int del_interface_vlan_cb(BR_EVENT_TYPE event_type, br_event_t event_arg);
|
||||
|
||||
|
||||
#endif /* VLAN_CONFIG_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue