From 88bb1df0f3917545b0fc95d6a327a2f5926d40c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E4=B8=80=E9=B8=A3?= Date: Tue, 26 Nov 2019 17:45:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/include/kni_utils.h | 6 ++-- conf/sapp/project_list.conf | 22 ------------- entry/CMakeLists.txt | 2 +- entry/include/tsg_rule.h | 61 ------------------------------------ entry/include/tsg_send_log.h | 38 ---------------------- entry/src/kni_entry.cpp | 5 ++- script/run.sh | 4 +-- 7 files changed, 7 insertions(+), 131 deletions(-) delete mode 100644 conf/sapp/project_list.conf delete mode 100644 entry/include/tsg_rule.h delete mode 100644 entry/include/tsg_send_log.h diff --git a/common/include/kni_utils.h b/common/include/kni_utils.h index 9442c75..7b93085 100644 --- a/common/include/kni_utils.h +++ b/common/include/kni_utils.h @@ -11,9 +11,9 @@ #include "MESA/MESA_handle_logger.h" #include "MESA/MESA_htable.h" #include "MESA/MESA_prof_load.h" -#include "field_stat2.h" -#include "Maat_rule.h" -#include "Maat_command.h" +#include "MESA/field_stat2.h" +#include "MESA/Maat_rule.h" +#include "MESA/Maat_command.h" #include "mrtunnat.h" #include #include diff --git a/conf/sapp/project_list.conf b/conf/sapp/project_list.conf deleted file mode 100644 index f03a375..0000000 --- a/conf/sapp/project_list.conf +++ /dev/null @@ -1,22 +0,0 @@ -#project_requirement_name value_type -#current requirement definitions: -# terminal_tag, -# ipv4_frag_list, -# ipv6_frag_list, -# stream_id, -# value type definitions -# char, -# short, -# int, -# long, -# struct - -#terminal_tag struct -#ipv4_frag_list struct -#ipv6_frag_list struct -#stream_id struct -#test_project struct -tcp_flow_stat struct -udp_flow_stat struct -tcp_deduce_flow_stat struct -kni_http_tag struct \ No newline at end of file diff --git a/entry/CMakeLists.txt b/entry/CMakeLists.txt index a0f7709..25b75be 100644 --- a/entry/CMakeLists.txt +++ b/entry/CMakeLists.txt @@ -1,3 +1,3 @@ add_library(kni SHARED src/kni_entry.cpp src/tfe_mgr.cpp src/kni_tun.cpp) target_include_directories(kni PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) -target_link_libraries(kni common MESA_prof_load MESA_htable MESA_field_stat maatframe marsio uuid cjson rdkafka dabloom) \ No newline at end of file +target_link_libraries(kni common MESA_prof_load MESA_htable MESA_field_stat maatframe marsio dabloom) \ No newline at end of file diff --git a/entry/include/tsg_rule.h b/entry/include/tsg_rule.h deleted file mode 100644 index 7fd7a93..0000000 --- a/entry/include/tsg_rule.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __TSG_RULE_H__ -#define __TSG_RULE_H__ - -#include - -typedef enum _tsg_protocol -{ - PROTO_UNKONWN=0, - PROTO_IPv4=1, - PROTO_IPv6, - PROTO_TCP, - PROTO_UDP, - PROTO_HTTP, - PROTO_MAIL, - PROTO_DNS, - PROTO_FTP, - PROTO_SSL, - PROTO_SIP, - PROTO_BGP, - PROTO_STREAMING_MEDIA, - PROTO_MAX -}tsg_protocol_t; - - -#define MAX_RESULT_NUM 8 -#define MAX_DOAMIN_LEN 2048 - -struct _identify_info -{ - tsg_protocol_t proto; //enum _tsg_protocol (tsg_types.h) - int domain_len; - char domain[MAX_DOAMIN_LEN]; -}; - -typedef enum _PULL_RESULT_TYPE -{ - PULL_KNI_RESULT, - PULL_FW_RESULT -}PULL_RESULT_TYPE; - -#define TSG_DOMAIN_MAX 256 - -extern Maat_feather_t g_tsg_maat_feather; - -int tsg_rule_init(const char *conffile, void *logger); - -int tsg_scan_nesting_addr(Maat_feather_t maat_feather, const struct streaminfo *a_stream, tsg_protocol_t proto, scan_status_t *mid, Maat_rule_t*result, int result_num); - -//return 0 if failed, return >0 on success; -int tsg_pull_policy_result(struct streaminfo *a_stream, PULL_RESULT_TYPE pull_result_type, Maat_rule_t *result, int result_num, struct _identify_info *identify_info); - -//return -1 if failed, return 0 on success; -int tsg_shared_table_init(const char *conffile, Maat_feather_t maat_feather, void *logger); - -//return value: -1: failed, 0: not hit, >0: hit count -int tsg_scan_shared_policy(Maat_feather_t maat_feather, void *pkt, int pkt_len, Maat_rule_t *result, int result_num, struct _identify_info *identify_info, scan_status_t *mid, void *logger, int thread_seq); - -//return NULL if none exists, otherwise return one deny rule; -Maat_rule_t *tsg_fetch_deny_rule(Maat_rule_t *result, int result_num); - -#endif diff --git a/entry/include/tsg_send_log.h b/entry/include/tsg_send_log.h deleted file mode 100644 index b3a4b5c..0000000 --- a/entry/include/tsg_send_log.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __TSG_SEND_LOG_H__ -#define __TSG_SEND_LOG_H__ - -#include - - -typedef struct _tsg_log -{ - int result_num; - Maat_rule_t *result; - struct streaminfo *a_stream; -}tsg_log_t; - -typedef enum _tld_type -{ - TLD_TYPE_UNKNOWN=0, - TLD_TYPE_LONG=1, - TLD_TYPE_STRING, - TLD_TYPE_FILE, - TLD_TYPE_MAX -}TLD_TYPE; - - -typedef void* TLD_handle_t; -typedef void* tsg_log_instance_t; - -extern tsg_log_instance_t g_tsg_log_instance; - -TLD_handle_t TLD_create(int thread_id); -int TLD_append(TLD_handle_t handle, char *key, void *value, TLD_TYPE type); -int TLD_cancel(TLD_handle_t handle); - -int tsg_send_log(tsg_log_instance_t instance, TLD_handle_t handle, tsg_log_t *log_msg, int thread_id); - -unsigned long long tsg_get_stream_id(struct streaminfo *a_stream); - - -#endif diff --git a/entry/src/kni_entry.cpp b/entry/src/kni_entry.cpp index f9f449c..b3b37c2 100644 --- a/entry/src/kni_entry.cpp +++ b/entry/src/kni_entry.cpp @@ -17,9 +17,8 @@ bypass: drome: pme_new_fail: destroy_pme #include #include #include "tfe_mgr.h" -#include "tsg_rule.h" -#include "tsg_send_log.h" -//#include "tsg_rule.h" +#include "tsg/tsg_rule.h" +#include "tsg/tsg_send_log.h" #ifdef __cplusplus extern "C" { diff --git a/script/run.sh b/script/run.sh index 945a771..1f51963 100755 --- a/script/run.sh +++ b/script/run.sh @@ -5,6 +5,4 @@ rm -f $SAPP_RUN/plug/business/kni/kni2.so && /bin/cp -f ../build/entry/libkni.so mkdir -p $SAPP_RUN/etc/kni /bin/cp -f ../conf/kni.conf $SAPP_RUN/etc/kni/kni.conf /bin/cp -f ../conf/maat/maat_test.json $SAPP_RUN/etc/kni/maat_test.json -/bin/cp -f ../conf/maat/maat_tableinfo.conf $SAPP_RUN/etc/kni/maat_tableinfo.conf -cat $SAPP_RUN/etc/project_list.conf | grep "kni_http_tag" >/dev/null 2>&1 && exit -echo "kni_http_tag struct" >> $SAPP_RUN/etc/project_list.conf \ No newline at end of file +/bin/cp -f ../conf/maat/maat_tableinfo.conf $SAPP_RUN/etc/kni/maat_tableinfo.conf \ No newline at end of file