rename flow_direction to flow_type
This commit is contained in:
@@ -128,7 +128,7 @@ static void http_event_handler(enum http_event event, struct http_decoder_half_d
|
||||
case HTTP_EVENT_REQ_LINE:
|
||||
msg = http_message_new(HTTP_MESSAGE_REQ_LINE, queue, queue_idx, HTTP_REQUEST);
|
||||
session_mq_publish_message(ev_ctx->ref_session, exdata->pub_topic_id, msg);
|
||||
if (httpd_tunnel_identify(httpd_env, FLOW_DIRECTION_C2S, half_data))
|
||||
if (httpd_tunnel_identify(httpd_env, FLOW_TYPE_C2S, half_data))
|
||||
{
|
||||
exdata->tunnel_state = HTTP_TUN_C2S_HDR_START;
|
||||
// http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTPD_STAT_TUNNEL, 1);
|
||||
@@ -259,7 +259,7 @@ static void http_event_handler(enum http_event event, struct http_decoder_half_d
|
||||
case HTTP_EVENT_RES_LINE:
|
||||
msg = http_message_new(HTTP_MESSAGE_RES_LINE, queue, queue_idx, HTTP_RESPONSE);
|
||||
session_mq_publish_message(ev_ctx->ref_session, exdata->pub_topic_id, msg);
|
||||
if (httpd_tunnel_identify(httpd_env, FLOW_DIRECTION_S2C, half_data))
|
||||
if (httpd_tunnel_identify(httpd_env, FLOW_TYPE_S2C, half_data))
|
||||
{
|
||||
exdata->tunnel_state = HTTP_TUN_S2C_START;
|
||||
}
|
||||
@@ -668,8 +668,8 @@ extern "C"
|
||||
|
||||
int thread_id = stellar_get_current_thread_index();
|
||||
struct http_decoder_half *cur_half = NULL;
|
||||
enum flow_direction sess_dir = session_get_current_flow_direction(sess);
|
||||
if (FLOW_DIRECTION_C2S == sess_dir)
|
||||
enum flow_type sess_dir = session_get_flow_type(sess);
|
||||
if (FLOW_TYPE_C2S == sess_dir)
|
||||
{
|
||||
cur_half = exdata->decoder->c2s_half;
|
||||
http_decoder_stat_update(&httpd_env->hd_stat, thread_id, HTTP_C2S_BYTES, payload_len);
|
||||
|
||||
@@ -19,7 +19,7 @@ int httpd_tunnel_identify(struct http_decoder_env *httpd_env, int curdir, struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (FLOW_DIRECTION_C2S == curdir)
|
||||
if (FLOW_TYPE_C2S == curdir)
|
||||
{
|
||||
struct http_request_line reqline = {};
|
||||
http_decoder_half_data_get_request_line(hfdata, &reqline);
|
||||
|
||||
@@ -110,8 +110,8 @@ int http_message_type_is_req(struct session *sess, enum http_message_type msg_ty
|
||||
case HTTP_TRANSACTION_START:
|
||||
case HTTP_TRANSACTION_END:
|
||||
{
|
||||
enum flow_direction cur_dir = session_get_current_flow_direction(sess);
|
||||
if (FLOW_DIRECTION_C2S == cur_dir)
|
||||
enum flow_type cur_dir = session_get_flow_type(sess);
|
||||
if (FLOW_TYPE_C2S == cur_dir)
|
||||
{
|
||||
is_req_msg = 1;
|
||||
}
|
||||
@@ -233,9 +233,9 @@ int httpd_url_is_encoded(const char *url, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void httpd_set_tcp_addr(const struct tcphdr *tcph, struct httpd_session_addr *addr, enum flow_direction fdir)
|
||||
static void httpd_set_tcp_addr(const struct tcphdr *tcph, struct httpd_session_addr *addr, enum flow_type fdir)
|
||||
{
|
||||
if (FLOW_DIRECTION_C2S == fdir)
|
||||
if (FLOW_TYPE_C2S == fdir)
|
||||
{
|
||||
addr->sport = tcph->th_sport;
|
||||
addr->dport = tcph->th_dport;
|
||||
@@ -246,10 +246,10 @@ static void httpd_set_tcp_addr(const struct tcphdr *tcph, struct httpd_session_a
|
||||
addr->dport = tcph->th_sport;
|
||||
}
|
||||
}
|
||||
static void httpd_set_ipv4_addr(const struct ip *ip4h, struct httpd_session_addr *addr, enum flow_direction fdir)
|
||||
static void httpd_set_ipv4_addr(const struct ip *ip4h, struct httpd_session_addr *addr, enum flow_type fdir)
|
||||
{
|
||||
addr->ipver = 4;
|
||||
if (FLOW_DIRECTION_C2S == fdir)
|
||||
if (FLOW_TYPE_C2S == fdir)
|
||||
{
|
||||
addr->saddr4 = ip4h->ip_src.s_addr;
|
||||
addr->daddr4 = ip4h->ip_dst.s_addr;
|
||||
@@ -260,10 +260,10 @@ static void httpd_set_ipv4_addr(const struct ip *ip4h, struct httpd_session_addr
|
||||
addr->daddr4 = ip4h->ip_src.s_addr;
|
||||
}
|
||||
}
|
||||
static void httpd_set_ipv6_addr(const struct ip6_hdr *ip6h, struct httpd_session_addr *addr, enum flow_direction fdir)
|
||||
static void httpd_set_ipv6_addr(const struct ip6_hdr *ip6h, struct httpd_session_addr *addr, enum flow_type fdir)
|
||||
{
|
||||
addr->ipver = 6;
|
||||
if (FLOW_DIRECTION_C2S == fdir)
|
||||
if (FLOW_TYPE_C2S == fdir)
|
||||
{
|
||||
memcpy(&addr->saddr6, &ip6h->ip6_src, sizeof(struct in6_addr));
|
||||
memcpy(&addr->daddr6, &ip6h->ip6_dst, sizeof(struct in6_addr));
|
||||
@@ -281,7 +281,7 @@ void httpd_session_get_addr(const struct session *sess, struct httpd_session_add
|
||||
{
|
||||
return;
|
||||
}
|
||||
enum flow_direction fdir = session_get_current_flow_direction(sess);
|
||||
enum flow_type fdir = session_get_flow_type(sess);
|
||||
const struct packet *raw_pkt = session_get_first_packet(sess, fdir);
|
||||
if (NULL == raw_pkt)
|
||||
{
|
||||
|
||||
@@ -152,8 +152,8 @@ static void get_host_order_port(struct session *sess __unused, unsigned short *s
|
||||
//get host order port from stellar session api
|
||||
|
||||
const struct packet *pkt = session_get0_current_packet(sess);
|
||||
enum flow_direction flow_dir=session_get_current_flow_direction(sess);
|
||||
if(pkt && (flow_dir==FLOW_DIRECTION_C2S || flow_dir==FLOW_DIRECTION_S2C))
|
||||
enum flow_type flow_type=session_get_flow_type(sess);
|
||||
if(pkt && (flow_type==FLOW_TYPE_C2S || flow_type==FLOW_TYPE_S2C))
|
||||
{
|
||||
int layer_cnt=packet_get_layer_count(pkt);
|
||||
const struct layer *layer = packet_get_layer_by_idx(pkt, layer_cnt - 1);
|
||||
@@ -168,7 +168,7 @@ static void get_host_order_port(struct session *sess __unused, unsigned short *s
|
||||
*dport = ntohs(layer->hdr.udp->uh_dport);
|
||||
}
|
||||
//S2C, swap sport and dport
|
||||
if(flow_dir == FLOW_DIRECTION_S2C)
|
||||
if(flow_type == FLOW_TYPE_S2C)
|
||||
{
|
||||
unsigned short tmp = *sport;
|
||||
*sport = *dport;
|
||||
@@ -539,10 +539,10 @@ static int lpi_detector(struct session *sess, struct traffic_context *context, s
|
||||
struct l7_protocol_label *l7_protocol=NULL;
|
||||
//const struct packet *raw_packet=session_get0_current_packet(sess);
|
||||
//int cur_pkt_dir= packet_get_direction(raw_packet);
|
||||
int cur_pkt_dir=session_get_current_flow_direction(sess);
|
||||
int cur_pkt_dir=session_get_flow_type(sess);
|
||||
context->pkt_cnt++;
|
||||
(cur_pkt_dir==FLOW_DIRECTION_C2S) ? (context->c2s_pkt++) : (context->s2c_pkt++);
|
||||
int is_c2s_pkt=((cur_pkt_dir==FLOW_DIRECTION_C2S) ? 1 : 0);
|
||||
(cur_pkt_dir==FLOW_TYPE_C2S) ? (context->c2s_pkt++) : (context->s2c_pkt++);
|
||||
int is_c2s_pkt=((cur_pkt_dir==FLOW_TYPE_C2S) ? 1 : 0);
|
||||
ret=lpi_update_dpkt(&(context->lpi_data), sess, scan_data, scan_data_len, l4_proto, is_c2s_pkt);
|
||||
if(!ret)
|
||||
{
|
||||
@@ -560,7 +560,7 @@ static int lpi_detector(struct session *sess, struct traffic_context *context, s
|
||||
{
|
||||
ret=revise_lpi_result(sess, scan_data, scan_data_len, &modify_lpi_result, context,
|
||||
(l4_proto==6?1:0),
|
||||
(cur_pkt_dir==FLOW_DIRECTION_C2S?1:0));
|
||||
(cur_pkt_dir==FLOW_TYPE_C2S?1:0));
|
||||
if(ret==0)
|
||||
{
|
||||
return 1;
|
||||
@@ -569,7 +569,7 @@ static int lpi_detector(struct session *sess, struct traffic_context *context, s
|
||||
plpi_mod=&modify_lpi_result;
|
||||
}
|
||||
|
||||
if (plpi_mod->protocol == LPI_PROTO_FTP_CONTROL && context->is_first_payload == 1 && cur_pkt_dir == FLOW_DIRECTION_S2C)
|
||||
if (plpi_mod->protocol == LPI_PROTO_FTP_CONTROL && context->is_first_payload == 1 && cur_pkt_dir == FLOW_TYPE_S2C)
|
||||
{
|
||||
if ((((scan_data_len >= 4 && (memcmp(scan_data, "220-", 4) == 0)) || memcmp(scan_data, "220 ", 4) == 0)) &&
|
||||
(((scan_data_len >= 7 && (memmem(scan_data, scan_data_len, " ESMTP ", 7) != NULL)) ||
|
||||
@@ -585,7 +585,7 @@ static int lpi_detector(struct session *sess, struct traffic_context *context, s
|
||||
}
|
||||
}
|
||||
|
||||
if (plpi_mod->protocol == LPI_PROTO_SMTP && context->is_first_payload == 1 && cur_pkt_dir == FLOW_DIRECTION_S2C)
|
||||
if (plpi_mod->protocol == LPI_PROTO_SMTP && context->is_first_payload == 1 && cur_pkt_dir == FLOW_TYPE_S2C)
|
||||
{
|
||||
if (
|
||||
(scan_data_len >= 4) &&
|
||||
|
||||
Reference in New Issue
Block a user