Merge branch 'develop' into 'master'

简化函数名称.

See merge request MESA_framework/mesa_jump_layer!1
This commit is contained in:
李佳
2021-09-14 09:36:08 +00:00
4 changed files with 16 additions and 16 deletions

View File

@@ -16,9 +16,9 @@ const char *MESA_jump_layer_get_last_error(void);
/*
The raw_layer_type and expect_layer_type refer to sapp_base.h->enum addr_type_t
*/
const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_jump_layer(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_jump_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type);
const char *MESA_jump_layer_ipv4_ntop(const struct ip *ip4_hdr, char *out_buf, int buf_len );

View File

@@ -500,7 +500,7 @@ static int udp_jump_to_layer(const char *raw_data, int raw_layer_type, int expe
skip_len = l2tp_jump_to_layer(raw_data+sizeof(struct mesa_udp_hdr), ADDR_TYPE_UDP, expect_layer_type);
}else{
/* <20><><EFBFBD><EFBFBD>UDP<44><50><EFBFBD>Ͳ<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת */
snprintf(_g_mesa_jump_layer_last_error, PIPE_BUF, "MESA_net_jump_to_layer_greedy() not support layer type:%d", expect_layer_type);
snprintf(_g_mesa_jump_layer_last_error, PIPE_BUF, "MESA_jump_layer_greedy() not support layer type:%d", expect_layer_type);
return -1;
}
if(skip_len < 0){
@@ -1244,7 +1244,7 @@ extern "C" {
Non-NULL: the pointer to expect layer;
NULL: not found expect layer.
*/
const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, int expect_layer_type)
const void *MESA_jump_layer(const void *raw_data, int raw_layer_type, int expect_layer_type)
{
int ret;
@@ -1321,7 +1321,7 @@ const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, in
break;
default:
snprintf(_g_mesa_jump_layer_last_error, PIPE_BUF, "MESA_net_jump_to_layer(): unsupport raw_layer_type:%d in MESA_net_jump_to_layer()!", raw_layer_type);
snprintf(_g_mesa_jump_layer_last_error, PIPE_BUF, "MESA_jump_layer(): unsupport raw_layer_type:%d in MESA_jump_layer()!", raw_layer_type);
return NULL;
}
@@ -1333,15 +1333,15 @@ const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, in
}
/*
<09><>MESA_net_jump_to_layer()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
MESA_net_jump_to_layer()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ, <20>ҵ<EFBFBD><D2B5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>˳<EFBFBD>;
MESA_net_jump_to_layer_greedy()<29><>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>Э<EFBFBD><D0AD>ͷ, <20>ʺ<EFBFBD><CABA><EFBFBD><EFBFBD><EFBFBD>ģʽ.
<09><>MESA_jump_layer()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
MESA_jump_layer()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ, <20>ҵ<EFBFBD><D2B5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>˳<EFBFBD>;
MESA_jump_layer_greedy()<29><>һֱ<D2BB><D6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>Э<EFBFBD><D0AD>ͷ, <20>ʺ<EFBFBD><CABA><EFBFBD><EFBFBD><EFBFBD>ģʽ.
return value:
Non-NULL: the pointer to expect layer;
NULL: not found expect layer.
*/
const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type)
const void *MESA_jump_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type)
{
int skip_len;
const void *expect_layer;
@@ -1369,7 +1369,7 @@ const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_ty
expect_layer_type = __ADDR_TYPE_IP_PAIR_V6;
}
expect_layer = MESA_net_jump_to_layer(new_next_layer_data, new_raw_layer_type, expect_layer_type);
expect_layer = MESA_jump_layer(new_next_layer_data, new_raw_layer_type, expect_layer_type);
while(expect_layer){
success_layer = expect_layer;
@@ -1414,11 +1414,11 @@ const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_ty
break;
default:
snprintf(_g_mesa_jump_layer_last_error, PIPE_BUF, "MESA_net_jump_to_layer_greedy() not support layer type:%d\n", expect_layer_type);
snprintf(_g_mesa_jump_layer_last_error, PIPE_BUF, "MESA_jump_layer_greedy() not support layer type:%d\n", expect_layer_type);
goto done;
}
expect_layer = MESA_net_jump_to_layer(new_next_layer_data, new_raw_layer_type, expect_layer_type);
expect_layer = MESA_jump_layer(new_next_layer_data, new_raw_layer_type, expect_layer_type);
}
done:

View File

@@ -870,8 +870,8 @@ UINT16 net_layer_to_ethernet_protocol_by_stream(const struct streaminfo *pstream
enum addr_type_t ethernet_protocol_to_net_layer(UINT16 ether_type_host);
int net_common_build_send_mac(unsigned char *buf, const struct mesa_ethernet_hdr *raw_eth_hdr, int addr_type, int dir_reverse, int net_topology_mode);
int net_common_adjust_forward_mac(struct mesa_ethernet_hdr *raw_eth_hdr,int net_topology_mode);
const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_jump_layer(const void *raw_data, int raw_layer_type, int expect_layer_type);
const void *MESA_jump_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type);
char MESA_ascii_to_hex(char ascii);
const char *sapp_raw_ipv4_ntop(const struct mesa_ip4_hdr *ip4_hdr, char *out_buf, int buf_len );
const char *sapp_raw_ipv6_ntop(const struct mesa_ip6_hdr *ip6_hdr, char *out_buf, int buf_len);

View File

@@ -66,8 +66,8 @@ static void _pcap_pkt_handle(u_char *user, const struct pcap_pkthdr *hdr, const
int offset_to_eth;
static int pkt_index = 0;
ip4_hdr = MESA_net_jump_to_layer_greedy(data, ADDR_TYPE_MAC, ADDR_TYPE_IPV4);
ip6_h = MESA_net_jump_to_layer_greedy(data, ADDR_TYPE_MAC, ADDR_TYPE_IPV6);
ip4_hdr = MESA_jump_layer_greedy(data, ADDR_TYPE_MAC, ADDR_TYPE_IPV4);
ip6_h = MESA_jump_layer_greedy(data, ADDR_TYPE_MAC, ADDR_TYPE_IPV6);
printf("-----------------------------packet index:%d------------------------------------------\n", pkt_index++);
if(ip4_hdr){