diff options
| author | yangwei <[email protected]> | 2024-09-11 16:27:39 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-09-11 16:27:39 +0800 |
| commit | 74cdcad2744904e0c501487c472bd15b0f7bc190 (patch) | |
| tree | 6c796288e1529e59389519b33648845d9bae9fa2 | |
| parent | 2215271156a316647c182f23bb4609d53e2f7e47 (diff) | |
📃 docs(callapp.c): remove deprecated code
| -rw-r--r-- | src/dealpkt/callapp.c | 357 |
1 files changed, 18 insertions, 339 deletions
diff --git a/src/dealpkt/callapp.c b/src/dealpkt/callapp.c index 77c9886..cd194a3 100644 --- a/src/dealpkt/callapp.c +++ b/src/dealpkt/callapp.c @@ -65,7 +65,7 @@ extern int G_TCP_FLOW_STAT_PROJECT_ID; #ifdef IIEFD_DUAL_STACK
static int judge_pure_ipv4_stack(const struct streaminfo *pstream, const void *a_packet);
-/* iiefd�����е��ܻص�����, ֻ�д�IPv4�İ��Ŵ��� */
+/* iiefd�����е��ܻص�����, ֻ�д�IPv4�İ��Ŵ��� */
extern "C" char calltcpApp_old(struct streaminfo *pstream,void **pme, int thread_seq,void *a_packet);
extern "C" char callIpApp_old(struct streaminfo *pstream,int routedir, int thread_seq,void *a_packet);
#endif
@@ -73,7 +73,7 @@ extern "C" char callIpApp_old(struct streaminfo *pstream,int routedir, int threa extern void timestamp_record(enum timestamp_level level, const raw_pkt_t *raw_pkt, int thread_seq);
/* 2014-12-31 lqy add
- TODO, ��Щ���ò��û��destroy�ӿ�.
+ TODO, ��Щ���ò��û��destroy�ӿ�.
*/
int stream_register_funtoArray(enum fun_type_t funtype,char (*x)(void),stFunArray *pArrary,int *pNum, int plug_entry_id)
{
@@ -276,7 +276,7 @@ int stream_register_overlay_udp(STREAM_CB_FUN_T x) /*
lijia 2015-01-12 add this_iphdr,
- �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
+ �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
*/
char plugin_call_streamentry(int type,StreamFunInfo *pFunInfo,struct streaminfo *a_stream,const void *transport_hdr,int thread_seq,const void *a_packet)
{
@@ -366,7 +366,7 @@ static void plug_entry_kick_out_one(StreamFunInfo *node, struct streaminfo *a_st UCHAR saved_pktstate = a_stream->pktstate;
saved_linkstate = ptcpdetail_pr->link_state;
- /* ��ʱ��ΪCLOSE, �ٻָ�ԭ״̬ */
+ /* ��ʱ��ΪCLOSE, �ٻָ�ԭ״̬ */
a_stream->opstate = OP_STATE_CLOSE;
a_stream->pktstate = OP_STATE_CLOSE;
ptcpdetail_pr->link_state = STREAM_FAKE_CLOSE_BY_DEPRIVE;
@@ -388,84 +388,6 @@ static void plug_entry_kick_out_one(StreamFunInfo *node, struct streaminfo *a_st }
-/* ��ʣ����entry��ȫ��CLOSE */
-static void plug_entry_kick_out_tot_list(StreamFunInfo *list_head, struct streaminfo *a_stream)
-{
- UCHAR saved_linkstate;
- StreamFunInfo *tmp_ptr;
- struct tcpdetail_private *ptcpdetail_pr = (struct tcpdetail_private *)a_stream->ptcpdetail;
-
- UCHAR saved_opstate = a_stream->opstate;
- UCHAR saved_pktstate = a_stream->pktstate;
- saved_linkstate = ptcpdetail_pr->link_state;
-
- /* ��ʱ��ΪCLOSE, �ٻָ�ԭ״̬ */
- a_stream->opstate = OP_STATE_CLOSE;
- a_stream->pktstate = OP_STATE_CLOSE;
- ptcpdetail_pr->link_state = STREAM_FAKE_CLOSE_BY_DEPRIVE;
-
- while(list_head){
- if(is_raw_cb(list_head->funtype)){
- plugin_call_streamentry(CALL_FUN_TYPE_RAW, list_head, a_stream, NULL, a_stream->threadnum, NULL);
- }else{
- plugin_call_streamentry(CALL_FUN_TYPE_NORAW, list_head, a_stream, NULL, a_stream->threadnum, NULL);
- }
-
- tmp_ptr = list_head->next;
- sapp_mem_free(SAPP_MEM_DYN_PLUG_CTRL, a_stream->threadnum, list_head);
- list_head = tmp_ptr;
- }
-
- a_stream->opstate = saved_opstate;
- a_stream->pktstate = saved_pktstate;
- ptcpdetail_pr->link_state = saved_linkstate;
-}
-
-static StreamFunInfo *plug_entry_kick_out_tot_list_by_priority(StreamFunInfo *list_head, struct streaminfo *a_stream, int kicker_priority)
-{
- UCHAR saved_linkstate;
- StreamFunInfo *tmp_ptr = NULL, *cur_node = list_head;
- struct tcpdetail_private *ptcpdetail_pr = (struct tcpdetail_private *)a_stream->ptcpdetail;
-
- UCHAR saved_opstate = a_stream->opstate;
- UCHAR saved_pktstate = a_stream->pktstate;
- saved_linkstate = ptcpdetail_pr->link_state;
-
- /* ��ʱ��ΪCLOSE, �ٻָ�ԭ״̬ */
- a_stream->opstate = OP_STATE_CLOSE;
- a_stream->pktstate = OP_STATE_CLOSE;
- ptcpdetail_pr->link_state = STREAM_FAKE_CLOSE_BY_DEPRIVE;
-
- while (cur_node)
- {
- tmp_ptr = cur_node->next;
- if (plug_priority_get(cur_node->entry_id) <= kicker_priority)
- {
- if (is_raw_cb(cur_node->funtype))
- {
- plugin_call_streamentry(CALL_FUN_TYPE_RAW, cur_node, a_stream, NULL, a_stream->threadnum, NULL);
- }
- else
- {
- plugin_call_streamentry(CALL_FUN_TYPE_NORAW, cur_node, a_stream, NULL, a_stream->threadnum, NULL);
- }
- if(cur_node == list_head)
- {
- list_head=tmp_ptr;
- }
- sapp_mem_free(SAPP_MEM_DYN_PLUG_CTRL, a_stream->threadnum, cur_node);
-
- }
- cur_node = tmp_ptr;
-
- }
-
- a_stream->opstate = saved_opstate;
- a_stream->pktstate = saved_pktstate;
- ptcpdetail_pr->link_state = saved_linkstate;
- return list_head;
-}
-
static int stream_set_offload_flag(struct streaminfo *pstream, unsigned char smart_offload_flag)
{
if(STREAM_TYPE_TCP == pstream->type)
@@ -508,7 +430,7 @@ static int copy_funcation_from_entry_to_stream(StreamFunInfo **oneStreamFunInfo, int call_streamentry(struct streaminfo *a_stream, const void *this_iphdr, const void *transport_hdr, const void *raw_pkt, StreamFunInfo *pFunInfo)
{
//add by lqy 20141230
- //ע�����µ�ֻ����stream_raw���͵ĺ������������ò�һ��
+ //ע�����µ�ֻ����stream_raw���͵ĺ������������ò�һ��
if(is_raw_cb(pFunInfo->funtype))
{
pFunInfo->appState=plugin_call_streamentry(CALL_FUN_TYPE_RAW,pFunInfo,a_stream,transport_hdr,a_stream->threadnum,raw_pkt);
@@ -571,7 +493,7 @@ static int stream_state_pending_process(struct streaminfo *a_stream,const void * }
if(entry_ret&APP_STATE_KILL_OTHER || entry_ret&APP_STATE_KILL_FOLLOW)
{
- // ɾ�����ȼ�С�ڵ��ڵ�ǰ�������������ڵ�
+ // ɾ�����ȼ�С�ڵ��ڵ�ǰ�������������ڵ�
StreamFunInfo* current = p_plugin_runtime_list;
StreamFunInfo* prev = NULL;
int kicker_entry_id=(p_plugin_entrys+i)->entry_id;
@@ -592,7 +514,7 @@ static int stream_state_pending_process(struct streaminfo *a_stream,const void * }
}
- // �����������ȼ�С�ڵ��ڵ�ǰ������ȼ�����ڵ���
+ // �����������ȼ�С�ڵ��ڵ�ǰ������ȼ�����ڵ���
while (i + 1 < funnum && plug_priority_get((p_plugin_entrys+i+1)->entry_id) <= kicker_priority)
{
++i;
@@ -731,249 +653,6 @@ static int stream_state_data_process(struct streaminfo *a_stream,const void *thi return ret;
}
-int stream_state_pending(struct streaminfo *a_stream,const void *this_iphdr, const void *transport_hdr, const void *raw_pkt,
- int funnum,stFunArray *pfunAarry,void **apme,unsigned char *opstate, unsigned char smart_offload_flag)
-{
- int i=0;
- int ret=PASS;
- StreamFunInfo *pFunList=NULL;
- StreamFunInfo *pFunInfo=NULL;
- StreamFunInfo *pNext=NULL,*pPrev=NULL;
- UCHAR threadnum = a_stream->threadnum;
- UCHAR local_app_ret;
- int kicker_plugin_priority=-1;
-
- pFunList = (StreamFunInfo*)(*apme);
-
- for(i=0;i<funnum;i++)
- {
- copy_funcation_from_entry_to_stream(&pFunInfo, &pfunAarry[i], threadnum);
- local_app_ret=call_streamentry(a_stream, this_iphdr, transport_hdr, raw_pkt, pFunInfo);
-
- if(local_app_ret&APP_STATE_DROPME)
- {
- /* 2019-11-15 lijia add for plug kill other */
- if(local_app_ret & APP_STATE_KILL_OTHER)
- {
-
- kicker_plugin_priority = plug_priority_get(pfunAarry[i].entry_id);
- if (kicker_plugin_priority >= max_plug_priority_get())
- {
- /* ��ǰ���������DROPME, ��KILL_OTHER, ˵�����в�������� */
- plug_entry_kick_out_tot_list(pFunList, a_stream);
- pFunList = NULL;
- *apme = NULL; /* 2020-05-08 lijia modify */
- break;
- }
- }
- }
- else
- {
- /* 2019-11-15 lijia add for plug kill other */
- if(local_app_ret & APP_STATE_KILL_OTHER)
- {
- plug_entry_kick_out_tot_list(pFunList, a_stream);
- pFunList = NULL; /* ��������ȫ��CLOSE, ֻʣ��ǰ��� */
- }
-
- if(local_app_ret & APP_STATE_GIVESTATE)
- {
- pFunInfo->appState=APP_STATE_GIVESTATE;
- }
-
- if(pFunList==NULL)
- {
- pFunList=pFunInfo;
- }
- else
- {
- pPrev->next=pFunInfo;
- }
-
- pPrev=pFunInfo;
- pFunInfo=NULL;
- }
-
- if(local_app_ret & APP_STATE_DROPPKT)
- {
- ret=DROP;
- break;
- }
-
- /* 2019-11-15 lijia add for plug kill other */
- if(local_app_ret & (APP_STATE_KILL_FOLLOW | APP_STATE_KILL_OTHER))
- {
- /* �����pending��, KILL FOLLOWֱ���˳�ѭ������ */
- break;
- }
- }
-
- //����Ҫ�ٴ��������fun���������ͷ�
- if(pFunInfo!=NULL)
- {
- sapp_mem_free(SAPP_MEM_DYN_PLUG_CTRL, threadnum,pFunInfo);
- pFunInfo = NULL;
- }
-
-
- //����Ҫ�ٴ��Ͱ��Ļص�����
- if(pFunList!=NULL)
- {
- *apme = pFunList;
- *opstate= OP_STATE_DATA;
-
- pNext=pFunList;
- while(pNext) //���в��DROPME�����߾�����GIVESTATE״̬
- {
- if(pNext->appState!=APP_STATE_GIVESTATE)
- {
- return ret;
- }
-
- pNext=pNext->next;
- }
-
- stream_set_offload_flag(a_stream, smart_offload_flag);
- }
- else
- {
- *opstate= OP_STATE_CLOSE;
- stream_set_offload_flag(a_stream, smart_offload_flag);
- }
-
- return ret;
-
-}
-
-static int stream_state_data(struct streaminfo *a_stream,const void *this_iphdr, const void *transport_hdr, const void *raw_pkt,
- int funnum,stFunArray *pfunAarry,void **apme,unsigned char *opstate, unsigned char smart_offload_flag)
-{
- int ret=PASS;
- UCHAR local_app_ret;
- StreamFunInfo *pFunList=NULL;
- StreamFunInfo *pFunInfo=NULL;
- StreamFunInfo *pNext=NULL,*pPrev=NULL;
-
- pFunList = (StreamFunInfo *)*apme;
- pFunInfo=pFunList;
- pPrev=NULL;
- while(pFunInfo)
- {
- if(pFunInfo->appState==APP_STATE_GIVESTATE)
- {
- pFunInfo=pFunInfo->next;
- continue;
- }
-
- local_app_ret=call_streamentry(a_stream, this_iphdr, transport_hdr, raw_pkt, pFunInfo);
- if(pFunInfo->appState&APP_STATE_DROPME)
- {
- if(pPrev==NULL)
- {
- pFunList=pFunInfo->next;
- *apme= pFunList;
- }
- else
- {
- pPrev->next=pFunInfo->next;
- }
- pNext=pFunInfo->next;
- sapp_mem_free(SAPP_MEM_DYN_PLUG_CTRL,a_stream->threadnum,pFunInfo);
- pFunInfo=pNext;
-
- if(local_app_ret & APP_STATE_KILL_FOLLOW)
- {
- plug_entry_kick_out_tot_list(pNext, a_stream);
- if(NULL == pPrev)
- {
- /* ��ǰ����ڵ�һ��, KILL_FOLLOW & APP_STATE_DROPME�൱��ȫ�����DROPME*/
- pFunList = NULL; /* ȫ�����CLOSE */
- *apme = NULL; /* 2020-05-08 lijia modify */
- }
- else
- {
- pPrev->next = NULL;
- }
- /* 2019-11-15 lijia add for plug kill other */
- }
- else if(local_app_ret & APP_STATE_KILL_OTHER)
- {
- plug_entry_kick_out_tot_list(pFunList, a_stream);
- pFunList = NULL; /* ȫ�����CLOSE */
- *apme = NULL; /* 2020-05-08 lijia modify */
- }
- }
- else
- {
- /* 2019-11-15 lijia add for plug kill other */
- if(local_app_ret & APP_STATE_KILL_OTHER){
- /* �ѵ�ǰplug info�����������Ƴ� */
- if(pPrev==NULL)
- {
- pFunList=pFunInfo->next;
- }
- else
- {
- pPrev->next=pFunInfo->next;
- }
- /* ��ʣ���ȫCLOSE */
- plug_entry_kick_out_tot_list(pFunList, a_stream);
-
- pFunList = pFunInfo;
- pFunList->next = NULL;
- *apme= pFunList;
- }
- else if(local_app_ret & APP_STATE_KILL_FOLLOW)
- {
- plug_entry_kick_out_tot_list(pFunInfo->next, a_stream);
- pFunInfo->next = NULL;
- }
-
- if(local_app_ret & APP_STATE_GIVESTATE)
- {
- pFunInfo->appState=APP_STATE_GIVESTATE;
- }
-
- pPrev=pFunInfo;
- pFunInfo=pFunInfo->next;
- }
-
- if(local_app_ret&APP_STATE_DROPPKT)
- {
- ret=DROP;
- break;
- }
-
- /* 2019-11-15 lijia add for plug kill other */
- if(local_app_ret & (APP_STATE_KILL_FOLLOW | APP_STATE_KILL_OTHER))
- {
- break;
- }
- }
-
- //���������д�Ҷ�����Ҫ��
- if(pFunList==NULL)
- {
- *opstate = OP_STATE_CLOSE;
- stream_set_offload_flag(a_stream, smart_offload_flag);
- }
-
- pNext=pFunList;
- while(pNext) //���в��DROPME�����߾�����GIVESTATE״̬
- {
- if(pNext->appState!=APP_STATE_GIVESTATE)
- {
- return ret;
- }
-
- pNext=pNext->next;
- }
-
- //���в��DROPME�����߾�����GIVESTATE״̬
- stream_set_offload_flag(a_stream, smart_offload_flag);
-
- return ret;
-}
//add end
@@ -997,14 +676,14 @@ int stream_process(struct streaminfo *a_stream,const void *this_iphdr, const voi ret = stream_state_pending_process(a_stream, this_iphdr, transport_hdr, raw_pkt, funnum, pfunAarry, apme, opstate, smart_offload_flag);
break;
case OP_STATE_DATA:
- if(*apme==NULL) //����Ѿ�û��Ҫ�����ĺ�����
+ if(*apme==NULL) //����Ѿ�û��Ҫ�����ĺ�����
{
*opstate= OP_STATE_CLOSE;
break;
}
ret = stream_state_data_process(a_stream, this_iphdr, transport_hdr, raw_pkt, funnum, pfunAarry, apme, opstate, smart_offload_flag);
break;
- case OP_STATE_CLOSE: //���ӹر�,���״̬
+ case OP_STATE_CLOSE: //���ӹر�,���״̬
pFunInfo=(StreamFunInfo *)(*apme);
while(pFunInfo)
{
@@ -1047,7 +726,7 @@ int stream_process_udp_single(struct streaminfo *a_udp,const void * a_packet,voi {
funtype=g_StreamUdpFun[i].funtype;
//add by lqy 20141230
- //ע�����µ�ֻ����stream_raw���͵ĺ������������ò�һ��
+ //ע�����µ�ֻ����stream_raw���͵ĺ������������ò�һ��
//if(funtype>FUN_TYPE_IPV6_RAW)
if(is_raw_cb((enum fun_type_t)funtype)){
appState=g_StreamUdpFun[i].sapp_stream_fun(a_udp,a_packet,a_packet,&(pAppInfo));
@@ -1065,7 +744,7 @@ int stream_process_udp_single(struct streaminfo *a_udp,const void * a_packet,voi /*
lijia 2015-01-12 modify, add this_iphdr,
- �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
+ �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
*/
int stream_process_tcp(struct streaminfo *a_tcp, const void *this_iphdr, const void *transport_hdr,
const raw_pkt_t * raw_pkt,void **apme,unsigned char *popstate)
@@ -1078,7 +757,7 @@ int stream_process_tcp(struct streaminfo *a_tcp, const void *this_iphdr, const v if((G_TCP_FLOW_STAT_PROJECT_ID != -1)
&& (a_tcp->ptcpdetail->datalen > 0)
&& (STREAM_TYPE_TCP == a_tcp->type)
- && (raw_pkt != NULL && raw_pkt->is_ctrl_pkt == 0)){ /* ��ʹG_TCP_FLOW_STAT_PROJECT_ID����, a_tcp�����Ǵ�����, ��һ����TCP, �˴�Ҫ�ж������� */
+ && (raw_pkt != NULL && raw_pkt->is_ctrl_pkt == 0)){ /* ��ʹG_TCP_FLOW_STAT_PROJECT_ID����, a_tcp�����Ǵ�����, ��һ����TCP, �˴�Ҫ�ж������� */
struct tcpdetail_private *pdetail_pr = (struct tcpdetail_private *)a_tcp->pdetail;
if(DIR_C2S == a_tcp->curdir){
pdetail_pr->flow_stat->C2S_data_pkt ++;
@@ -1101,7 +780,7 @@ int stream_process_tcp(struct streaminfo *a_tcp, const void *this_iphdr, const v /*
lijia 2015-01-12 modify, add this_iphdr,
- �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
+ �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
*/
int stream_process_udp(struct streaminfo *a_udp, const void *this_iphdr, const void *transport_hdr,
@@ -1147,7 +826,7 @@ int stream_process_overlay_udp(struct streaminfo *a_udp, const void *this_iphdr, /*
lijia 2015-01-12 modify, add this_iphdr,
- �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
+ �����IP��Ƭ����İ�, ������ʽ�Ĵ���IP��ͷ, ����ֻ��raw_hdr, ����ȡ������IP��ͷ.
*/
int stream_process_tcp_allpkt(struct streaminfo *a_tcp,const void *this_iphdr, const void *transport_hdr,
@@ -1357,8 +1036,8 @@ int stream_process_ipv6_frag(struct streaminfo *pstream,const struct ip6_hdr *th /*
2016-09-26 lijia add,
- û�а�ʱ, ���������,
- ����������, �ײ��ղ�����ʱ, Ҳ����ò��, ʹ����ܼ�ʱ���CPU, ��һЩ�ǰ������Ĵ�����.
+ û�а�ʱ, ���������,
+ ����������, �ײ��ղ�����ʱ, Ҳ����ò��, ʹ����ܼ�ʱ���CPU, ��һЩ�ǰ������Ĵ�����.
*/
int stream_process_polling(int thread_seq)
{
@@ -1401,7 +1080,7 @@ extern int g_use_MESA_sleep_sw; extern void MESA_sleep(void);
/*
2016-09-26 lijia add,
- �ײ�����û�а�ʱ, ����ô˺���, ����ƽ̨�����Ƿ������ȴ�, ���ǵ����ϲ���ѯ���.
+ �ײ�����û�а�ʱ, ����ô˺���, ����ƽ̨�����Ƿ������ȴ�, ���ǵ����ϲ���ѯ���.
*/
void idle_polling_call(int thread_seq)
{
@@ -1482,7 +1161,7 @@ int platform_register_action_judge(char (*action_cb_fun)(int net_conn_mode, char }
-/* ��ո��ּ���, ����ȫ�ֱ���!! */
+/* ��ո��ּ���, ����ȫ�ֱ���!! */
void stream_destroy_plugin(void)
{
g_StreamTcpFunNum=0;
|
