diff options
Diffstat (limited to 'demo5')
| -rw-r--r-- | demo5/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | demo5/main.c | 137 | ||||
| -rw-r--r-- | demo5/sample_test.log | 0 | ||||
| -rw-r--r-- | demo5/sample_test.log.2024-04-29 | 88 | ||||
| -rw-r--r-- | demo5/table_info_wgw_scan.conf | 103 | ||||
| -rw-r--r-- | demo5/wgw_scan.json | 106 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/GROUP2GROUP.local | 1 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/WANNAT_COMPILE.local | 3 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local | 3 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/WANNAT_GROUP_COMPILE_RELATION.local | 4 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local | 3 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_UE_ID.local | 2 | ||||
| -rw-r--r-- | demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 | 6 |
13 files changed, 464 insertions, 0 deletions
diff --git a/demo5/CMakeLists.txt b/demo5/CMakeLists.txt new file mode 100644 index 0000000..7da1e49 --- /dev/null +++ b/demo5/CMakeLists.txt @@ -0,0 +1,8 @@ +# Set the minimum version of CMake that can be used +cmake_minimum_required(VERSION 3.10) + +# Define a new project +project(Demo5) + +# Add an executable +add_executable(Demo5 main.c)
\ No newline at end of file diff --git a/demo5/main.c b/demo5/main.c new file mode 100644 index 0000000..64aac7b --- /dev/null +++ b/demo5/main.c @@ -0,0 +1,137 @@ +#include "maat.h" +#include "stdio.h" +#include <arpa/inet.h> +#include <assert.h> +#include <stddef.h> +#include <string.h> +#include <stdlib.h> // Include the header file for 'calloc' + +#define ARRAY_SIZE 16 +#define ALLOC(type, number) ((type *)calloc(sizeof(type), number)) + +const char *json_filename = "/root/Git/demo/demo5/wgw_scan.json"; +const char *table_info_path = "/root/Git/demo/demo5/table_info_wgw_scan.conf"; + +struct dyn_ue_id_ip +{ + int id; + int addr_type; + char ip[40]; + char ue_id[11]; + int is_valid; +}; + +void ip_plugin_ex_new_cb(const char *table_name, int table_id, const char *key, const char *table_line, void **ad, + long argl, void *argp) +{ + int *counter = (int *)argp; + + char op_time[20] = {0}; + + struct dyn_ue_id_ip *ud = ALLOC(struct dyn_ue_id_ip, 1); + + int ret = sscanf(table_line, "%d\t%d\t%10s\t%39s\t%d\t%20s", &(ud->id), &(ud->addr_type), ud->ip, ud->ue_id, + &(ud->is_valid), &op_time); + + *ad = ud; + (*counter)++; +} + +void ip_plugin_ex_free_cb(int table_id, void **ad, long argl, void *argp) +{ + struct dyn_ue_id_ip *ud = (struct dyn_ue_id_ip *)(*ad); + + memset(ud, 0, sizeof(struct dyn_ue_id_ip)); + free(ud); + *ad = NULL; +} + +void ip_plugin_ex_dup_cb(int table_id, void **to, void **from, long argl, void *argp) +{ + struct dyn_ue_id_ip *ud = (struct dyn_ue_id_ip *)(*from); + + *to = ud; +} + +int main() +{ + /* initialize maat options which will be used by maat_new() */ + struct maat_options *opts = maat_options_new(); + maat_options_set_json_file(opts, json_filename); + maat_options_set_logger(opts, "/root/Git/demo/demo5/sample_test.log", LOG_LEVEL_TRACE); + + /* create maat instance, rules in table_info.conf will be loaded. */ + struct maat *maat_instance = maat_new(opts, table_info_path); + assert(maat_instance != NULL); + maat_options_free(opts); + + const char *table_name = "UE_ID"; // ่ๆ่กจ 5 + int table_id = maat_get_table_id(maat_instance, table_name); + assert(table_id == 5); /* defined in table_info.conf */ + + int thread_id = 0; + long long results[ARRAY_SIZE] = {0}; + size_t n_hit_result = 0; + int ret = 0; + + /* store scanning intermediate state */ + struct maat_state *state = maat_state_new(maat_instance, thread_id); + assert(state != NULL); + + const char *ue_id = "abcdefghij"; + + ret = maat_scan_string(maat_instance, table_id, ue_id, strlen(ue_id), results, ARRAY_SIZE, &n_hit_result, state); + assert(ret == MAAT_SCAN_HIT); + assert(n_hit_result == 1); + assert(results[0] == 301); + + maat_state_free(state); + + struct ip_addr ipv4_src; + ipv4_src.ip_type = 4; + ret = inet_pton(AF_INET, "20.20.20.20", &ipv4_src.ipv4); + + struct maat_state *state2 = maat_state_new(maat_instance, thread_id); + assert(state2 != NULL); + + uint32_t a = ipv4_src.ipv4; + ret = maat_scan_ipv4_port(maat_instance, 6, a, 443, results, ARRAY_SIZE, &n_hit_result, state2); + assert(ret == MAAT_SCAN_HALF_HIT); + assert(n_hit_result == 0); + + struct ip_addr ipv4_dst; + ipv4_dst.ip_type = 4; + ret = inet_pton(AF_INET, "8.8.8.8", &ipv4_dst.ipv4); + + uint32_t b = ipv4_dst.ipv4; + ret = maat_scan_ipv4_port(maat_instance, 7, b, 443, results, ARRAY_SIZE, &n_hit_result, state2); + assert(ret == MAAT_SCAN_HIT); + assert(n_hit_result == 1); + assert(results[0] == 302); + + maat_state_free(state2); + + const char *table_name_ueidip = "WANNAT_DYN_UE_ID_IP"; /* maat_json.json has TEST_IP_PLUGIN_WITH_EXDATA rule */ + int table_id_ueidip = maat_get_table_id(maat_instance, table_name_ueidip); + assert(table_id_ueidip == 8); /* defined in table_info.conf */ + + int plugin_ex_data_counter = 0; + ret = maat_plugin_table_ex_schema_register(maat_instance, table_name_ueidip, ip_plugin_ex_new_cb, ip_plugin_ex_free_cb, + ip_plugin_ex_dup_cb, 0, &plugin_ex_data_counter); + + assert(ret == 0); + assert(plugin_ex_data_counter == 2); + + uint32_t ipv4_addr1; + ret = inet_pton(AF_INET, "10.0.0.1", &ipv4_addr1); + assert(ret == 1); + + struct dyn_ue_id_ip *ud = NULL; + ud = (struct dyn_ue_id_ip *)maat_plugin_table_get_ex_data(maat_instance, table_id_ueidip, (char *)&ipv4_addr1, + sizeof(ipv4_addr1)); + + assert(ud != NULL); + assert(ud->id == 1); + + return 0; +} diff --git a/demo5/sample_test.log b/demo5/sample_test.log new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/demo5/sample_test.log diff --git a/demo5/sample_test.log.2024-04-29 b/demo5/sample_test.log.2024-04-29 new file mode 100644 index 0000000..265ad3e --- /dev/null +++ b/demo5/sample_test.log.2024-04-29 @@ -0,0 +1,88 @@ +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register physical table[WANNAT_COMPILE]->table_id:0 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register physical table[WANNAT_GROUP_COMPILE_RELATION]->table_id:1 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register physical table[GROUP2GROUP]->table_id:2 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register physical table[WANNAT_OBJ_UE_ID]->table_id:3 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register physical table[WANNAT_OBJ_IP_ADDR]->table_id:4 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register virtual table[UE_ID]->vtable_id:5, physical_table_id:3 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register virtual table[SOURCE_IP]->vtable_id:6, physical_table_id:4 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register virtual table[DESTINATION_IP]->vtable_id:7, physical_table_id:4 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), successfully register physical table[WANNAT_DYN_UE_ID_IP]->table_id:8 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), default compile table id: 0 +Mon Apr 29 23:01:30 2024, INFO, maat.table(111869), group2group table id: 2 +Mon Apr 29 23:01:30 2024, INFO, maat.config_monitor(111869), Maat initial with JSON file /root/Git/demo/demo5/wgw_scan.json, formating... +Mon Apr 29 23:01:30 2024, INFO, maat.config_monitor(111869), JSON file /root/Git/demo/demo5/wgw_scan.json md5: 366c62cc81ffbc832120d84efacbd202, generate index file /root/Git/demo/demo5/wgw_scan.json_iris_tmp/index OK +Mon Apr 29 23:01:30 2024, INFO, maat.config_monitor(111869), load /root/Git/demo/demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 +Mon Apr 29 23:01:30 2024, DEBUG, maat.plugin(111869), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.1, key_len:8, is_valid:1 +Mon Apr 29 23:01:30 2024, DEBUG, maat.plugin(111869), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.2, key_len:8, is_valid:1 +Mon Apr 29 23:01:30 2024, INFO, maat.compile(111869), Build bool matcher of 2 expressions with 16777436 bytes memory. +Mon Apr 29 23:01:30 2024, INFO, maat.compile(111869), table[WANNAT_COMPILE] commit 2 compile rules and rebuild compile bool_matcher completed, version:1, consume:2ms +Mon Apr 29 23:01:30 2024, INFO, maat.expr_matcher(111869), expr_matcher module: build bool matcher of 1 expressions with 16777356 bytes memory +Mon Apr 29 23:01:30 2024, INFO, maat.expr(111869), table[WANNAT_OBJ_UE_ID] has 1 rules, commit 1 expr rules(literal_rules:1 regex_rules:0) and rebuild expr_matcher(hyperscan) completed, version:1, consume:3ms +Mon Apr 29 23:01:30 2024, INFO, maat.ip(111869), table[WANNAT_OBJ_IP_ADDR] commit 2 ip rules and rebuild ip_matcher completed, version:1, consume:0ms +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111869), table:<WANNAT_COMPILE> rule_count:2 +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111869), table:<WANNAT_GROUP_COMPILE_RELATION> rule_count:3 +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111869), table:<WANNAT_OBJ_UE_ID> rule_count:1 +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111869), table:<WANNAT_OBJ_IP_ADDR> rule_count:2 +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111869), table:<WANNAT_DYN_UE_ID_IP> rule_count:2 +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111869), Full config version 1 load 10 entries complete +Mon Apr 29 23:01:30 2024, INFO, maat.rule(111895), rule_monitor_loop thread still alive......... +Mon Apr 29 23:01:59 2024, DEBUG, maat.plugin(111869), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.1, key_len:8, is_valid:1 +Mon Apr 29 23:02:05 2024, DEBUG, maat.plugin(111869), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.2, key_len:8, is_valid:1 +Mon Apr 29 23:02:05 2024, INFO, maat.plugin(111869), table[WANNAT_DYN_UE_ID_IP] commit 2 plugin rules, version:0 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register physical table[WANNAT_COMPILE]->table_id:0 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register physical table[WANNAT_GROUP_COMPILE_RELATION]->table_id:1 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register physical table[GROUP2GROUP]->table_id:2 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register physical table[WANNAT_OBJ_UE_ID]->table_id:3 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register physical table[WANNAT_OBJ_IP_ADDR]->table_id:4 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register virtual table[UE_ID]->vtable_id:5, physical_table_id:3 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register virtual table[SOURCE_IP]->vtable_id:6, physical_table_id:4 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register virtual table[DESTINATION_IP]->vtable_id:7, physical_table_id:4 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), successfully register physical table[WANNAT_DYN_UE_ID_IP]->table_id:8 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), default compile table id: 0 +Mon Apr 29 23:04:37 2024, INFO, maat.table(112022), group2group table id: 2 +Mon Apr 29 23:04:37 2024, INFO, maat.config_monitor(112022), Maat initial with JSON file /root/Git/demo/demo5/wgw_scan.json, formating... +Mon Apr 29 23:04:37 2024, INFO, maat.config_monitor(112022), JSON file /root/Git/demo/demo5/wgw_scan.json md5: 366c62cc81ffbc832120d84efacbd202, generate index file /root/Git/demo/demo5/wgw_scan.json_iris_tmp/index OK +Mon Apr 29 23:04:37 2024, INFO, maat.config_monitor(112022), load /root/Git/demo/demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 +Mon Apr 29 23:04:37 2024, DEBUG, maat.plugin(112022), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.1, key_len:8, is_valid:1 +Mon Apr 29 23:04:37 2024, DEBUG, maat.plugin(112022), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.2, key_len:8, is_valid:1 +Mon Apr 29 23:04:37 2024, INFO, maat.compile(112022), Build bool matcher of 2 expressions with 16777436 bytes memory. +Mon Apr 29 23:04:37 2024, INFO, maat.compile(112022), table[WANNAT_COMPILE] commit 2 compile rules and rebuild compile bool_matcher completed, version:1, consume:2ms +Mon Apr 29 23:04:37 2024, INFO, maat.expr_matcher(112022), expr_matcher module: build bool matcher of 1 expressions with 16777356 bytes memory +Mon Apr 29 23:04:37 2024, INFO, maat.expr(112022), table[WANNAT_OBJ_UE_ID] has 1 rules, commit 1 expr rules(literal_rules:1 regex_rules:0) and rebuild expr_matcher(hyperscan) completed, version:1, consume:5ms +Mon Apr 29 23:04:37 2024, INFO, maat.ip(112022), table[WANNAT_OBJ_IP_ADDR] commit 2 ip rules and rebuild ip_matcher completed, version:1, consume:0ms +Mon Apr 29 23:04:37 2024, INFO, maat.rule(112022), table:<WANNAT_COMPILE> rule_count:2 +Mon Apr 29 23:04:37 2024, INFO, maat.rule(112022), table:<WANNAT_GROUP_COMPILE_RELATION> rule_count:3 +Mon Apr 29 23:04:37 2024, INFO, maat.rule(112022), table:<WANNAT_OBJ_UE_ID> rule_count:1 +Mon Apr 29 23:04:37 2024, INFO, maat.rule(112022), table:<WANNAT_OBJ_IP_ADDR> rule_count:2 +Mon Apr 29 23:04:37 2024, INFO, maat.rule(112022), table:<WANNAT_DYN_UE_ID_IP> rule_count:2 +Mon Apr 29 23:04:37 2024, INFO, maat.rule(112022), Full config version 1 load 10 entries complete +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register physical table[WANNAT_COMPILE]->table_id:0 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register physical table[WANNAT_GROUP_COMPILE_RELATION]->table_id:1 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register physical table[GROUP2GROUP]->table_id:2 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register physical table[WANNAT_OBJ_UE_ID]->table_id:3 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register physical table[WANNAT_OBJ_IP_ADDR]->table_id:4 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register virtual table[UE_ID]->vtable_id:5, physical_table_id:3 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register virtual table[SOURCE_IP]->vtable_id:6, physical_table_id:4 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register virtual table[DESTINATION_IP]->vtable_id:7, physical_table_id:4 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), successfully register physical table[WANNAT_DYN_UE_ID_IP]->table_id:8 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), default compile table id: 0 +Mon Apr 29 23:05:07 2024, INFO, maat.table(112249), group2group table id: 2 +Mon Apr 29 23:05:07 2024, INFO, maat.config_monitor(112249), Maat initial with JSON file /root/Git/demo/demo5/wgw_scan.json, formating... +Mon Apr 29 23:05:07 2024, INFO, maat.config_monitor(112249), JSON file /root/Git/demo/demo5/wgw_scan.json md5: 366c62cc81ffbc832120d84efacbd202, generate index file /root/Git/demo/demo5/wgw_scan.json_iris_tmp/index OK +Mon Apr 29 23:05:07 2024, INFO, maat.config_monitor(112249), load /root/Git/demo/demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 +Mon Apr 29 23:05:07 2024, DEBUG, maat.plugin(112249), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.1, key_len:8, is_valid:1 +Mon Apr 29 23:05:07 2024, DEBUG, maat.plugin(112249), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.2, key_len:8, is_valid:1 +Mon Apr 29 23:05:07 2024, INFO, maat.compile(112249), Build bool matcher of 2 expressions with 16777436 bytes memory. +Mon Apr 29 23:05:07 2024, INFO, maat.compile(112249), table[WANNAT_COMPILE] commit 2 compile rules and rebuild compile bool_matcher completed, version:1, consume:2ms +Mon Apr 29 23:05:07 2024, INFO, maat.expr_matcher(112249), expr_matcher module: build bool matcher of 1 expressions with 16777356 bytes memory +Mon Apr 29 23:05:07 2024, INFO, maat.expr(112249), table[WANNAT_OBJ_UE_ID] has 1 rules, commit 1 expr rules(literal_rules:1 regex_rules:0) and rebuild expr_matcher(hyperscan) completed, version:1, consume:6ms +Mon Apr 29 23:05:07 2024, INFO, maat.ip(112249), table[WANNAT_OBJ_IP_ADDR] commit 2 ip rules and rebuild ip_matcher completed, version:1, consume:0ms +Mon Apr 29 23:05:07 2024, INFO, maat.rule(112249), table:<WANNAT_COMPILE> rule_count:2 +Mon Apr 29 23:05:07 2024, INFO, maat.rule(112249), table:<WANNAT_GROUP_COMPILE_RELATION> rule_count:3 +Mon Apr 29 23:05:07 2024, INFO, maat.rule(112249), table:<WANNAT_OBJ_UE_ID> rule_count:1 +Mon Apr 29 23:05:07 2024, INFO, maat.rule(112249), table:<WANNAT_OBJ_IP_ADDR> rule_count:2 +Mon Apr 29 23:05:07 2024, INFO, maat.rule(112249), table:<WANNAT_DYN_UE_ID_IP> rule_count:2 +Mon Apr 29 23:05:07 2024, INFO, maat.rule(112249), Full config version 1 load 10 entries complete +Mon Apr 29 23:05:07 2024, DEBUG, maat.plugin(112249), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.1, key_len:8, is_valid:1 +Mon Apr 29 23:05:07 2024, DEBUG, maat.plugin(112249), plugin table:<WANNAT_DYN_UE_ID_IP> update one line, key:10.0.0.2, key_len:8, is_valid:1 +Mon Apr 29 23:05:07 2024, INFO, maat.plugin(112249), table[WANNAT_DYN_UE_ID_IP] commit 2 plugin rules, version:0 diff --git a/demo5/table_info_wgw_scan.conf b/demo5/table_info_wgw_scan.conf new file mode 100644 index 0000000..1314b3d --- /dev/null +++ b/demo5/table_info_wgw_scan.conf @@ -0,0 +1,103 @@ +[ + { + "table_id":0, + "table_name":"WANNAT_COMPILE", + "table_type":"compile", + "default_compile_table":0, + "user_region_encoded":"escape", + "valid_column":9, + "custom": { + "compile_id":1, + "service":2, + "action":3, + "do_blacklist":4, + "do_log":5, + "tags":6, + "user_region":7, + "clause_num":8 + } + }, + { + "table_id":1, + "table_name":"WANNAT_GROUP_COMPILE_RELATION", + "table_type":"group2compile", + "associated_compile_table_id":0, + "valid_column":6, + "custom": { + "group_id":1, + "compile_id":2, + "not_flag":3, + "virtual_table_name":4, + "clause_index":5 + } + }, + { + "table_id":2, + "table_name":"GROUP2GROUP", + "table_type":"group2group", + "valid_column":4, + "custom": { + "group_id":1, + "included_sub_group_ids":2, + "excluded_sub_group_ids":3 + } + }, + { + "table_id":3, + "table_name":"WANNAT_OBJ_UE_ID", + "table_type":"expr", + "valid_column":7, + "custom": { + "item_id":1, + "group_id":2, + "keywords":3, + "expr_type":4, + "match_method":5, + "is_hexbin":6 + } + }, + { + "table_id":4, + "table_name":"WANNAT_OBJ_IP_ADDR", + "table_type":"ip", + "valid_column":8, + "custom": { + "item_id":1, + "group_id":2, + "addr_type":3, + "addr_format":4, + "ip1":5, + "ip2":6, + "port":7 + } + }, + { + "table_id":5, + "table_name": "UE_ID", + "table_type": "virtual", + "physical_table": "WANNAT_OBJ_UE_ID" + }, + { + "table_id":6, + "table_name": "SOURCE_IP", + "table_type": "virtual", + "physical_table": "WANNAT_OBJ_IP_ADDR" + }, + { + "table_id":7, + "table_name": "DESTINATION_IP", + "table_type": "virtual", + "physical_table": "WANNAT_OBJ_IP_ADDR" + }, + { + "table_id":8, + "table_name":"WANNAT_DYN_UE_ID_IP", + "table_type":"plugin", + "valid_column":5, + "custom": { + "key_type":"ip_addr", + "addr_type":2, + "key":3 + } + } +]
\ No newline at end of file diff --git a/demo5/wgw_scan.json b/demo5/wgw_scan.json new file mode 100644 index 0000000..976bd82 --- /dev/null +++ b/demo5/wgw_scan.json @@ -0,0 +1,106 @@ +{ + "compile_table": "WANNAT_COMPILE", + "group2compile_table": "WANNAT_GROUP_COMPILE_RELATION", + "group2group_table": "GROUP2GROUP", + "rules": [ + { + "compile_id": 301, + "service": 0, + "action": 1, + "do_blacklist": 0, + "do_log": 2, + "effective_range": "{}", + "user_region": "{\"ip_object_ids\":[203,204], \"translate_type\":\"never\", \"time_interval\":123, \"connection_count\":1243}", + "group_num": 8, + "is_valid": "yes", + "modified_time": "100", + "groups": [ + { + "virtual_table": "UE_ID", + "group_name": "SNAT", + "group_id": 1, + "not_flag": 0, + "nth_clause": 1, + "regions": [ + { + "table_name": "WANNAT_OBJ_UE_ID", + "table_type": "expr", + "table_content": { + "region_id": 101, + "keywords": "abcdefghij", + "expr_type": "none", + "match_method": "exact", + "is_hexbin": "no", + "format": "uncase plain" + } + } + ] + } + ] + }, + { + "compile_id": 302, + "service": 0, + "action": 2, + "do_blacklist": 0, + "do_log": 2, + "effect_range": "{}", + "user_region": "{\"ue_object_ids\":[102], \"failover\":\"drop\"}", + "is_valid": "yes", + "modified_time": "200", + "groups": [ + { + "group_name": "DNAT_SRC", + "group_id": 2, + "not_flag": 0, + "virtual_table": "SOURCE_IP", + "nth_clause": 1, + "regions": [ + { + "table_name": "WANNAT_OBJ_IP_ADDR", + "table_type": "ip", + "table_content": { + "region_id": 201, + "addr_type": "ipv4", + "addr_format": "CIDR", + "ip1": "20.20.20.20", + "ip2": "32", + "port": "0-65535" + } + } + ] + }, + { + "group_name": "DNAT_DST", + "group_id": 3, + "not_flag": 0, + "virtual_table": "DESTINATION_IP", + "nth_clause": 1, + "regions": [ + { + "table_name": "WANNAT_OBJ_IP_ADDR", + "table_type": "ip", + "table_content": { + "region_id": 202, + "addr_type": "ipv4", + "addr_format": "CIDR", + "ip1": "8.8.8.8", + "ip2": "32", + "port": "0-65535" + } + } + ] + } + ] + } + ], + "plugin_table": [ + { + "table_name": "WANNAT_DYN_UE_ID_IP", + "table_content": [ + "1\t4\t10.0.0.1\tabcdefghij\t1\t0", + "2\t4\t10.0.0.2\tbbcdefghij\t1\t0" + ] + } + ] +}
\ No newline at end of file diff --git a/demo5/wgw_scan.json_iris_tmp/GROUP2GROUP.local b/demo5/wgw_scan.json_iris_tmp/GROUP2GROUP.local new file mode 100644 index 0000000..62580c9 --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/GROUP2GROUP.local @@ -0,0 +1 @@ +0000000000 diff --git a/demo5/wgw_scan.json_iris_tmp/WANNAT_COMPILE.local b/demo5/wgw_scan.json_iris_tmp/WANNAT_COMPILE.local new file mode 100644 index 0000000..9e4cb50 --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/WANNAT_COMPILE.local @@ -0,0 +1,3 @@ +0000000002 +301 0 1 0 2 {} {"ip_object_ids":[203,204], "translate_type":"never", "time_interval":123, "connection_count":1243} 1 1 +302 0 2 0 2 {} {"ue_object_ids":[102], "failover":"drop"} 2 1 diff --git a/demo5/wgw_scan.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local b/demo5/wgw_scan.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local new file mode 100644 index 0000000..50a21a1 --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local @@ -0,0 +1,3 @@ +0000000002 +1 4 10.0.0.1 abcdefghij 1 0 +2 4 10.0.0.2 bbcdefghij 1 0 diff --git a/demo5/wgw_scan.json_iris_tmp/WANNAT_GROUP_COMPILE_RELATION.local b/demo5/wgw_scan.json_iris_tmp/WANNAT_GROUP_COMPILE_RELATION.local new file mode 100644 index 0000000..8ec983d --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/WANNAT_GROUP_COMPILE_RELATION.local @@ -0,0 +1,4 @@ +0000000003 +1 301 0 UE_ID 0 1 +2 302 0 SOURCE_IP 0 1 +3 302 0 DESTINATION_IP 1 1 diff --git a/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local b/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local new file mode 100644 index 0000000..f8e0618 --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local @@ -0,0 +1,3 @@ +0000000002 +201 2 4 CIDR 20.20.20.20 32 0-65535 1 +202 3 4 CIDR 8.8.8.8 32 0-65535 1 diff --git a/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_UE_ID.local b/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_UE_ID.local new file mode 100644 index 0000000..6d0104a --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_UE_ID.local @@ -0,0 +1,2 @@ +0000000001 +101 1 abcdefghij 0 3 0 1 diff --git a/demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 b/demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 new file mode 100644 index 0000000..67c734a --- /dev/null +++ b/demo5/wgw_scan.json_iris_tmp/index/full_config_index.0000000001 @@ -0,0 +1,6 @@ +WANNAT_COMPILE 2 /root/Git/demo/demo5/wgw_scan.json_iris_tmp/WANNAT_COMPILE.local +WANNAT_GROUP_COMPILE_RELATION 3 /root/Git/demo/demo5/wgw_scan.json_iris_tmp/WANNAT_GROUP_COMPILE_RELATION.local +GROUP2GROUP 0 /root/Git/demo/demo5/wgw_scan.json_iris_tmp/GROUP2GROUP.local +WANNAT_DYN_UE_ID_IP 2 /root/Git/demo/demo5/wgw_scan.json_iris_tmp/WANNAT_DYN_UE_ID_IP.local +WANNAT_OBJ_UE_ID 1 /root/Git/demo/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_UE_ID.local +WANNAT_OBJ_IP_ADDR 2 /root/Git/demo/demo5/wgw_scan.json_iris_tmp/WANNAT_OBJ_IP_ADDR.local |
