Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cellframe/cellframe-sdk
  • MIKA83/cellframe-sdk
2 results
Show changes
Commits on Source (1)
...@@ -114,7 +114,9 @@ static bool s_debug_more=false; ...@@ -114,7 +114,9 @@ static bool s_debug_more=false;
static uint_fast16_t s_update_pack_size=100; // Number of hashes packed into the one packet static uint_fast16_t s_update_pack_size=100; // Number of hashes packed into the one packet
static uint_fast16_t s_skip_in_reactor_count=50; // Number of hashes packed to skip in one reactor loop callback out packet static uint_fast16_t s_skip_in_reactor_count=50; // Number of hashes packed to skip in one reactor loop callback out packet
static char **s_list_ban_groups = NULL; static char **s_list_ban_groups = NULL;
static char **s_list_white_groups = NULL;
static uint16_t s_size_ban_groups = 0; static uint16_t s_size_ban_groups = 0;
static uint16_t s_size_white_groups = 0;
/** /**
* @brief dap_stream_ch_chain_init * @brief dap_stream_ch_chain_init
...@@ -128,6 +130,7 @@ int dap_stream_ch_chain_init() ...@@ -128,6 +130,7 @@ int dap_stream_ch_chain_init()
s_debug_more = dap_config_get_item_bool_default(g_config,"stream_ch_chain","debug_more",false); s_debug_more = dap_config_get_item_bool_default(g_config,"stream_ch_chain","debug_more",false);
s_update_pack_size = dap_config_get_item_int16_default(g_config,"stream_ch_chain","update_pack_size",100); s_update_pack_size = dap_config_get_item_int16_default(g_config,"stream_ch_chain","update_pack_size",100);
s_list_ban_groups = dap_config_get_array_str(g_config, "stream_ch_chain", "ban_list_sync_groups", &s_size_ban_groups); s_list_ban_groups = dap_config_get_array_str(g_config, "stream_ch_chain", "ban_list_sync_groups", &s_size_ban_groups);
s_list_white_groups = dap_config_get_array_str(g_config, "stream_ch_chain", "white_list_sync_groups", &s_size_white_groups);
return 0; return 0;
} }
...@@ -661,7 +664,16 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg) ...@@ -661,7 +664,16 @@ static bool s_gdb_in_pkt_proc_callback(dap_proc_thread_t *a_thread, void *a_arg)
// obj to add // obj to add
dap_store_obj_t *l_obj = l_store_obj + i; dap_store_obj_t *l_obj = l_store_obj + i;
if (s_list_ban_groups) { if (s_list_white_groups) {
int l_ret = -1;
for (int i = 0; i < s_size_white_groups; i++) {
if (!dap_fnmatch(s_list_white_groups[i], l_obj->group, FNM_NOESCAPE)) {
l_ret = 0;
break;
}
}
if (l_ret == -1) continue;
} else if (s_list_ban_groups) {
int l_ret = 0; int l_ret = 0;
for (int i = 0; i < s_size_ban_groups; i++) { for (int i = 0; i < s_size_ban_groups; i++) {
if (!dap_fnmatch(s_list_ban_groups[i], l_obj->group, FNM_NOESCAPE)) { if (!dap_fnmatch(s_list_ban_groups[i], l_obj->group, FNM_NOESCAPE)) {
......
...@@ -28,8 +28,12 @@ typedef struct dap_tx_data{ ...@@ -28,8 +28,12 @@ typedef struct dap_tx_data{
#define LOG_TAG "dap_chain_global_db_hist" #define LOG_TAG "dap_chain_global_db_hist"
#if 0
static char **s_ban_list = NULL; static char **s_ban_list = NULL;
static uint16_t s_size_ban_list = 0; static uint16_t s_size_ban_list = 0;
static char **s_white_list = NULL;
static uint16_t s_size_white_list = 0;
#endif
/** /**
* @brief Packs members of a_rec structure into a single string. * @brief Packs members of a_rec structure into a single string.
...@@ -279,15 +283,40 @@ dap_db_log_list_t* dap_db_log_list_start(dap_chain_node_addr_t a_addr, int a_fla ...@@ -279,15 +283,40 @@ dap_db_log_list_t* dap_db_log_list_start(dap_chain_node_addr_t a_addr, int a_fla
static uint16_t s_size_ban_list = 0; static uint16_t s_size_ban_list = 0;
static char **s_ban_list = NULL; static char **s_ban_list = NULL;
static uint16_t s_size_white_list = 0;
static char **s_white_list = NULL;
static bool l_try_read_ban_list = false; static bool l_try_read_ban_list = false;
static bool l_try_read_white_list = false;
if (!l_try_read_ban_list) { if (!l_try_read_ban_list) {
s_ban_list = dap_config_get_array_str(g_config, "stream_ch_chain", "ban_list_sync_groups", &s_size_ban_list); s_ban_list = dap_config_get_array_str(g_config, "stream_ch_chain", "ban_list_sync_groups", &s_size_ban_list);
l_try_read_ban_list = true; l_try_read_ban_list = true;
} }
if (!l_try_read_white_list) {
s_white_list = dap_config_get_array_str(g_config, "stream_ch_chain", "white_list_sync_groups", &s_size_white_list);
l_try_read_white_list = true;
}
/* delete groups from ban list */ /* delete if not condition */
if (s_size_ban_list > 0) { if (s_size_white_list > 0) {
for (dap_list_t *l_groups = l_dap_db_log_list->groups; l_groups; ) {
bool l_found = false;
for (int i = 0; i < s_size_white_list; i++) {
if (!dap_fnmatch(s_white_list[i], l_groups->data, FNM_NOESCAPE)) {
l_found = true;
break;
}
}
if (!l_found) {
dap_list_t *l_tmp = l_groups->next;
l_dap_db_log_list->groups = dap_list_delete_link(l_dap_db_log_list->groups, l_groups);
l_groups = l_tmp;
}
l_groups = dap_list_next(l_groups);
}
} else if (s_size_ban_list > 0) {
for (dap_list_t *l_groups = l_dap_db_log_list->groups; l_groups; ) { for (dap_list_t *l_groups = l_dap_db_log_list->groups; l_groups; ) {
bool l_found = false; bool l_found = false;
for (int i = 0; i < s_size_ban_list; i++) { for (int i = 0; i < s_size_ban_list; i++) {
......