diff options
| author | liuxueli <[email protected]> | 2023-07-10 14:58:10 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2023-07-10 14:58:10 +0800 |
| commit | 2665555f069c5ecc6e875ffd64fe188aa277b217 (patch) | |
| tree | 2ce56f092f9c231081d37a1030c1e2a79275855e /test/src/gtest_master.cpp | |
| parent | 94c07e1f085571d92f10b4450b2df10edd7526e4 (diff) | |
修正识别结果,quic.ssl修正为quic
Diffstat (limited to 'test/src/gtest_master.cpp')
| -rw-r--r-- | test/src/gtest_master.cpp | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/test/src/gtest_master.cpp b/test/src/gtest_master.cpp index 24abc1a..91a59a9 100644 --- a/test/src/gtest_master.cpp +++ b/test/src/gtest_master.cpp @@ -1035,7 +1035,6 @@ TEST(TSGMaster, SessionApplicationFullPathTSG15999) gather_result->qm_engine[1].packet_sequence=4; session_gather_app_results_async(&a_stream, (void *)gather_result); - session_application_full_path_update(&a_stream, out_full_path, out_full_path_len); EXPECT_STREQ("ssl.https", out_full_path); @@ -1045,6 +1044,37 @@ TEST(TSGMaster, SessionApplicationFullPathTSG15999) session_gather_app_results_async(&a_stream, NULL); } +int session_app_gather_results_update(struct app_attributes **update_result, char update_result_num, struct app_identify_result *identify_result, int packet_sequence, int thread_seq); + +TEST(TSGMaster, SessionApplicationFullPathTSG13811) +{ + const struct streaminfo a_stream={0}; + char out_full_path[256]={0}; + int out_full_path_len=sizeof(out_full_path); + struct gather_app_result *gather_result=(struct gather_app_result *)calloc(1, sizeof(struct gather_app_result)); + + gather_result->l7_protocol_num=1; + gather_result->l7_protocol=(struct app_attributes *)calloc(1, sizeof(struct app_attributes)); + gather_result->l7_protocol->app_id=2521; + gather_result->l7_protocol->surrogate_id=0; + gather_result->l7_protocol->packet_sequence=1; + + struct app_identify_result identify_result={ORIGIN_QM_ENGINE, 3, {2521, 199, 240}, {0, 0, 0}}; + gather_result->qm_engine_num=session_app_gather_results_update(&(gather_result->qm_engine), gather_result->qm_engine_num, &identify_result, 1, 0); + EXPECT_EQ(2, gather_result->qm_engine_num); + EXPECT_EQ(2521, gather_result->qm_engine[0].app_id); + EXPECT_EQ(240, gather_result->qm_engine[1].app_id); + + session_gather_app_results_async(&a_stream, (void *)gather_result); + session_application_full_path_update(&a_stream, out_full_path, out_full_path_len); + EXPECT_STREQ("quic.youtube", out_full_path); + + free(gather_result->l7_protocol); + free(gather_result->qm_engine); + free(gather_result); + session_gather_app_results_async(&a_stream, NULL); +} + extern int session_application_full_path_combine(struct gather_app_result * gather_result, char * out_full_path, int out_full_path_len); TEST(TSGMaster, SessionApplicationFullPath) @@ -1198,39 +1228,6 @@ TEST(TSGMaster, SessionQuicIdentify) g_test_quic_info=NULL; } -TEST(TSGMaster, SessionApplicationFullPathTSG13811) -{ - char out_full_path[256]={0}; - int out_full_path_len=sizeof(out_full_path); - struct gather_app_result gather_result={0}; - - gather_result.l7_protocol_num=1; - struct app_attributes l7_protocol={68, 0, 4}; - gather_result.l7_protocol=&l7_protocol; - - gather_result.qm_engine_num=3; - gather_result.l7_qm_engine_num=2; - struct app_attributes qm_engine[3]={{199, 0, 6}, {68, 0, 4}, {240, 0, 6}}; - gather_result.qm_engine=qm_engine; - - int offset=session_application_full_path_combine(&gather_result, out_full_path, out_full_path_len); - EXPECT_NE(0, offset); - EXPECT_STREQ("ssl.https.youtube", out_full_path); - - // l7 protocol is empty - gather_result.l7_protocol_num=0; - gather_result.l7_protocol=NULL; - - gather_result.qm_engine_num=3; - gather_result.l7_qm_engine_num=0; - struct app_attributes qm_engine2[3]={{199, 0, 6}, {68, 0, 4}, {240, 0, 6}}; - gather_result.qm_engine=qm_engine2; - - offset=session_application_full_path_combine(&gather_result, out_full_path, out_full_path_len); - EXPECT_NE(0, offset); - EXPECT_STREQ("ssl.https.youtube", out_full_path); -} - int main(int argc, char *argv[]) { TSG_MASTER_INIT(); |
