summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/MESA_jump_layer.h33
-rw-r--r--src/MESA_jump_layer.cpp10
2 files changed, 40 insertions, 3 deletions
diff --git a/inc/MESA_jump_layer.h b/inc/MESA_jump_layer.h
index d15578b..d5715fe 100644
--- a/inc/MESA_jump_layer.h
+++ b/inc/MESA_jump_layer.h
@@ -13,18 +13,45 @@ extern "C" {
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
+ CHN : ���ݰ�ͷ��ƫ�ƺ���.
+
+ ����:
+ raw_data: ��ǰ���ͷ��ָ��;
+ raw_layer_type: ��ǰ��ĵ�ַ����, ���: enum addr_type_t ;
+ expect_layer_type: ������ת���ĵ�ַ����, ���: enum addr_type_t ;
+
+ ����ֵ:
+ NULL: �޴˵�ַ;
+ NON-NULL: ��Ӧ���ͷ����ַ.
+
+ ����:
+ ���赱ǰ��ΪEthernet, ��ʼ��ͷ��ַΪthis_layer_hdr, ����ת��IPv6��ͷ��:
+ struct ip6_hdr *ip6_header;
+ ip6_header = MESA_net_jump_to_layer(this_layer_hdr, ADDR_TYPE_MAC, ADDR_TYPE_IPV6);
*/
const void *MESA_jump_layer(const void *raw_data, int raw_layer_type, int expect_layer_type);
+/*
+ MESA_jump_layer_greedy��MESA_jump_layer������:
+ ��������Ƕ��Э����˵,
+ MESA_jump_layer��ת����һ��expect_layer_type;
+ MESA_jump_layer_greedy��ת�����ڲ��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 );
+/* ��ǰ������ǰ�Ľӿ�����, ����ͬ�� */
+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 char *MESA_jump_layer_ipv4_ntop(const struct ip *ip4_hdr, char *out_buf, int buf_len );
const char *MESA_jump_layer_ipv6_ntop(const struct ip6_hdr *ip6_hdr, char *out_buf, int buf_len);
#ifdef __cplusplus
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/MESA_jump_layer.cpp b/src/MESA_jump_layer.cpp
index ebbf164..04016eb 100644
--- a/src/MESA_jump_layer.cpp
+++ b/src/MESA_jump_layer.cpp
@@ -1332,6 +1332,11 @@ const void *MESA_jump_layer(const void *raw_data, int raw_layer_type, int expec
return ((const char *)raw_data + ret);
}
+const void *MESA_net_jump_to_layer(const void *raw_data, int raw_layer_type, int expect_layer_type)
+{
+ return MESA_jump_layer(raw_data, raw_layer_type, expect_layer_type);
+}
+
/*
��MESA_jump_layer()������:
MESA_jump_layer()������㿪ʼ, �ҵ���һ�����������IJ���˳�;
@@ -1425,6 +1430,11 @@ done:
return success_layer;
}
+const void *MESA_net_jump_to_layer_greedy(const void *raw_data, int raw_layer_type, int expect_layer_type)
+{
+ return MESA_jump_layer_greedy(raw_data, raw_layer_type, expect_layer_type);
+}
+
/* ģ��tcpdump��ʽ: 192.168.40.137.22 > 192.168.36.40.49429 */
const char *MESA_jump_layer_ipv4_ntop(const struct ip *ip4_hdr, char *out_buf, int buf_len )
{