summaryrefslogtreecommitdiff
path: root/inc/MESA_jump_layer.h
blob: d5715fe0789cc35c82640554af813c54f99774d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __MESA_JUMP_LAYER_H_
#define __MESA_JUMP_LAYER_H_ 1
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include "stream.h"
#include <netinet/ip.h>
#include <netinet/ip6.h>


const char *MESA_jump_layer_get_last_error(void);


/*
	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 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