diff options
| author | lishu <[email protected]> | 2020-01-09 16:11:01 +0800 |
|---|---|---|
| committer | lishu <[email protected]> | 2020-01-09 16:11:01 +0800 |
| commit | e67b15f189016edf428b7613e123f6733a0ea039 (patch) | |
| tree | e7133b916034145f588e5a44e8658b1bfef0bf99 | |
| parent | 448319950e38ebe7df75d8f08f11548c628f0212 (diff) | |
20200109
增加协议识别标签,配合MESA_proto.so统计协议流量
| -rw-r--r-- | src/HTTP_Analyze.c | 10 | ||||
| -rw-r--r-- | src/HTTP_Message.c | 27 | ||||
| -rw-r--r-- | src/HTTP_Message.h | 9 | ||||
| -rw-r--r-- | src/Makefile | 2 | ||||
| -rw-r--r-- | src/http_update.txt | 2 |
5 files changed, 45 insertions, 5 deletions
diff --git a/src/HTTP_Analyze.c b/src/HTTP_Analyze.c index f4b9a66..5c04962 100644 --- a/src/HTTP_Analyze.c +++ b/src/HTTP_Analyze.c @@ -25,7 +25,7 @@ http_prog_runtime_parameter_t g_http_prog_para; int G_HTTP_H_VERSION_4_20191205 = 0; -int G_HTTP_VERSION_4_20191205 = 0; +int G_HTTP_VERSION_4_20200108 = 0; void history() { //2014-12-09 V3.0 new documentAnalyze lib ; http.h add and delete ; @@ -103,7 +103,7 @@ void history() //2019-01-28 V4.0 //1. support Content-Range: bytes -154100106/154100107 2. bug:http_doWithGzipData 3. assert(session_info.buflen>=0); //2019-11-12 V4.0 //����http_host_parser���� //2019-12-05 V4.0 //����http_line2value���� - + //2020-01-08 V4.0 //add mesa_proto } @@ -1225,7 +1225,11 @@ char HTTP_ENTRY(struct streaminfo *a_tcp, void**pme, int thread_seq, void *a_pac } #endif rec = http_analyseHttpConnection(a_http_stream, a_tcp, thread_seq, a_packet); - a_http_stream->packet_offset = 0; + a_http_stream->packet_offset = 0; + if(HTTP_TRUE==a_http_stream->maybe_http_stream) + { + http_add_proto_tag(g_http_prog_para.proto_tag_id, a_tcp, "HTTP", strlen("HTTP")); + } break; default: break; diff --git a/src/HTTP_Message.c b/src/HTTP_Message.c index 360f03d..e0325a4 100644 --- a/src/HTTP_Message.c +++ b/src/HTTP_Message.c @@ -280,6 +280,30 @@ int http_readMainConf(const char* filename) return 0; } +void http_proto_tag_free(int thread_seq, void *value) +{ + free(value); + return; +} + +int http_add_proto_tag(int projetc_id, struct streaminfo *a_stream, const char* value, int len) +{ + if(projetc_id < 0)return -1; + struct http_proto_tag_t* proto_tag = (struct http_proto_tag_t*)project_req_get_struct(a_stream,projetc_id); + if(proto_tag == NULL) + { + proto_tag = (struct http_proto_tag_t *)calloc(sizeof(struct http_proto_tag_t), 1); + if(0 != project_req_add_struct(a_stream, projetc_id, proto_tag)) + { + free(proto_tag); + return -1; + } + } + memcpy(proto_tag->buf, value, len); + proto_tag->buf[len]='\0'; + return 0; +} + int HTTP_INIT(void) { g_iThreadNum = get_thread_count(); @@ -303,6 +327,9 @@ int HTTP_INIT(void) return -1; } + /*MESA_proto*/ + g_http_prog_para.proto_tag_id = project_producer_register("MESA_PROTO","struct",http_proto_tag_free); + #if HTTP_PROXY_CAPFILE g_http_prog_para.capfile_project_id = project_producer_register("MESA_CAPFILE", "char", NULL); #endif diff --git a/src/HTTP_Message.h b/src/HTTP_Message.h index a585141..2bbf8bb 100644 --- a/src/HTTP_Message.h +++ b/src/HTTP_Message.h @@ -223,8 +223,14 @@ typedef struct _http_prog_runtime_parameter_t #if HTTP_PROXY_CAPFILE int capfile_project_id; #endif - + int proto_tag_id ; }http_prog_runtime_parameter_t; + +struct http_proto_tag_t +{ + char buf[8]; +}; + void http_test(); #ifdef __cplusplus @@ -240,6 +246,7 @@ void HTTP_PROT_FUNSTAT(unsigned long long protflag); void HTTP_GETPLUGID(unsigned short plugid); uchar http_judgeHeaderOver(http_parser_t *a_http, char *data, uint32 data_len, int thread_seq); uchar http_positioningACompleteLine(char del_space, http_parser_t *cur_http_node, struct streaminfo *a_tcp, int thread_seq); +int http_add_proto_tag(int projetc_id, struct streaminfo *a_stream, const char* value, int len); #ifdef __cplusplus } diff --git a/src/Makefile b/src/Makefile index 8e1efd8..b2365d4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ vpath %.a ../lib vpath %.h ./inc -PAPP_PATH=/home/lishu/soq/sapp/ +PAPP_PATH=/home/mesasoft/durain_sapp/ #CFLAGS = -g3 -Wall -fPIC -Werror -O #CFLAGS = -g3 -Wall -fPIC -O diff --git a/src/http_update.txt b/src/http_update.txt index fb5db8f..1755dc8 100644 --- a/src/http_update.txt +++ b/src/http_update.txt @@ -1,3 +1,5 @@ +20200109 +1. ����Э��ʶ���ǩ�����MESA_proto.soͳ��Э������ *************************************************************** 20191205 1.����http http_line2value������֧�ֻ�ȡvalue���� |
