MOD aaa-12 桥模型代码上传

SOL  桥模型代码上传
修改人:zhangliang
检视人:zhangliang
This commit is contained in:
zhanglianghy 2019-08-02 18:11:34 +08:00
parent 08f496cbc5
commit c1dee62cbc
3 changed files with 17 additions and 30 deletions

View File

@ -30,6 +30,9 @@ struct _br_event {
}; };
typedef struct _br_event br_event_t; typedef struct _br_event br_event_t;
typedef int (*BR_EVENT_FUNC)(BR_EVENT_TYPE event_type,
br_event_t event_arg);
struct _br_event_node { struct _br_event_node {
struct hlist_node list; struct hlist_node list;
BR_EVENT_TYPE br_event; BR_EVENT_TYPE br_event;
@ -107,8 +110,6 @@ struct _br_fdb_status{
}; };
typedef struct _br_fdb_status br_fdb_status_t; typedef struct _br_fdb_status br_fdb_status_t;
typedef int (*BR_EVENT_FUNC)(BR_EVENT_TYPE event_type, br_event_t event_arg);
/* **********************************************************/ /* **********************************************************/
/* 提供给其他模块调用的函数 */ /* 提供给其他模块调用的函数 */
/************************************************************/ /************************************************************/

View File

@ -14,8 +14,8 @@
#include "parsefile.h" #include "parsefile.h"
#include "libbridge.h" #include "libbridge.h"
#ifndef DESC("事件通知函数") /* 事件通知函数 */
struct br_event_head_t br_event_tbl = {.lock = 0, .init = false}; br_event_head_t br_event_tbl = {.head.first = NULL, .lock = 0, .init = false};
int br_invoke_event(BR_EVENT_TYPE event_type, br_event_t event_arg) int br_invoke_event(BR_EVENT_TYPE event_type, br_event_t event_arg)
{ {
@ -38,7 +38,8 @@ int br_event_register(BR_EVENT_TYPE event_type, BR_EVENT_FUNC event_func)
br_event_node_t *hnode = NULL; br_event_node_t *hnode = NULL;
if(br_event_tbl.init == false) if(br_event_tbl.init == false)
{ INIT_HLIST_HEAD(&(br_event_tbl.head); {
INIT_HLIST_HEAD(&(br_event_tbl.head));
pthread_mutex_init(&(br_event_tbl.lock), NULL); pthread_mutex_init(&(br_event_tbl.lock), NULL);
br_event_tbl.init = true; br_event_tbl.init = true;
} }
@ -87,8 +88,7 @@ int br_event_unregister(BR_EVENT_TYPE event_type, BR_EVENT_FUNC event_func)
return 0; return 0;
} }
#endif /* 桥配置辅助函数 */
#ifndef DESC("桥配置辅助函数")
int br_copy_port_name(const char *b, const char *p, void *arg) int br_copy_port_name(const char *b, const char *p, void *arg)
{ {
br_if_temp_t *br_if = (br_if_temp_t *)arg; br_if_temp_t *br_if = (br_if_temp_t *)arg;
@ -342,10 +342,7 @@ ret_code br_bridge_del(char * br_name, int *sys_err)
return RET_OK; return RET_OK;
} }
#endif /* 桥配置json格式转换函数 */
#ifndef DESC("桥配置json格式转换函数")
ret_code br_config_json_parse(pointer input, uint *conf_type, char *br_name) ret_code br_config_json_parse(pointer input, uint *conf_type, char *br_name)
{ {
@ -511,9 +508,7 @@ ret_code br_if_config_json_parse(pointer input, uint *conf_type, br_config_t *br
return RET_OK; return RET_OK;
} }
#endif /* 桥配置钩子函数 */
#ifndef DESC("桥配置钩子函数")
ret_code br_config_chk(uint source,uint *config_type, ret_code br_config_chk(uint source,uint *config_type,
pointer input, int *input_len, pointer input, int *input_len,
pointer output, int *output_len) pointer output, int *output_len)
@ -583,10 +578,7 @@ ret_code br_config_proc(uint source, uint config_type,
return ret; return ret;
} }
#endif /* 桥接口配置钩子函数 */
#ifndef DESC("桥接口配置钩子函数")
ret_code br_if_config_chk(uint source,uint *config_type, ret_code br_if_config_chk(uint source,uint *config_type,
pointer input, int *input_len, pointer input, int *input_len,
pointer output, int *output_len) pointer output, int *output_len)
@ -714,10 +706,7 @@ ret_code br_if_config_get_all(uint source,
return ret; return ret;
} }
/* 桥FDB配置辅助函数 */
#endif
#ifndef DESC("桥FDB配置辅助函数")
void br_format_time(const struct timeval *tv, char *str, int len) void br_format_time(const struct timeval *tv, char *str, int len)
{ {
@ -852,9 +841,7 @@ int br_fdb_cpy(br_fdb_status_t *fdb_status, struct fdb_entry *fdb)
return i; return i;
} }
#endif /* 桥FDB配置json格式转换 */
#ifndef DESC("桥FDB配置json格式转换")
ret_code br_fdb_config_json_parse(pointer input, uint *conf_type, br_fdb_config_t *br_fdb) ret_code br_fdb_config_json_parse(pointer input, uint *conf_type, br_fdb_config_t *br_fdb)
{ {
cJSON *json_obj; cJSON *json_obj;
@ -937,10 +924,7 @@ int br_fdb_to_json_string(br_fdb_status_t *fdb_status, char *output)
return (strlen(output) + 1); return (strlen(output) + 1);
} }
#endif /* 桥FDB表配置钩子函数 */
#ifndef DESC("桥FDB表配置钩子函数")
ret_code br_fdb_config_chk(uint source,uint *config_type, ret_code br_fdb_config_chk(uint source,uint *config_type,
pointer input, int *input_len, pointer input, int *input_len,
pointer output, int *output_len) pointer output, int *output_len)
@ -1007,4 +991,3 @@ ret_code br_fdb_config_get(uint source,
return ret; return ret;
} }
#endif

View File

@ -12,6 +12,9 @@
#include <net/if.h> #include <net/if.h>
#include "brnetlink.h" #include "brnetlink.h"
#include "ipconfig.h"
#include "brconfig.h"
#include "rpc_util.h"
#include "rpc_common.h" #include "rpc_common.h"
#define BR_NLMSG_TAIL(nmsg) \ #define BR_NLMSG_TAIL(nmsg) \