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
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#include "sapp_api.h"
#include "sapp_private_api.h"
#ifdef __cplusplus
extern "C" {
#endif
#if SAPP_AS_TARGET_SO
extern int MESA_platform_init(int argc, char *argv[]);
extern int ipv4_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_data, int thread_num,
unsigned char routedir, const raw_pkt_t *raw_pkt, int offset_to_raw_pkt_hdr);
extern void packet_io_clean_thread_context(int thread_seq);
extern void MESA_platform_run(void);
extern int sapp_parse_config(void);
#define DUMPFILE_EOF_FLAG (void*)0xF1E2D3C4B5A6 /* ��һ�����ر�����ʾ��ǰdumpfileģʽ�ѽ���, �����ڴ� */
char MESA_IP_PLUG_ENTRY(const struct streaminfo *pstream,unsigned char routedir,int thread_seq, const struct mesa_ip4_hdr *ipv4_hdr)
{
char ret = PASS;
raw_pkt_t raw_pkt;
if(DUMPFILE_EOF_FLAG == pstream){
packet_io_clean_thread_context(thread_seq);
sleep(3);
return PASS;
}
raw_pkt.magic_num = RAW_PKT_MAGIC_NUM;
raw_pkt.offset_to_raw_pkt_hdr = 0;
raw_pkt.low_layer_type = (enum addr_type_t)CAP_LEVEL_IPV4;
raw_pkt.raw_pkt_len = ntohs(ipv4_hdr->ip_len);
raw_pkt.raw_pkt_data = ipv4_hdr;
raw_pkt.hd_hash = 0;
ret = ipv4_entry(NULL, ipv4_hdr, thread_seq, 0, &raw_pkt, 0);
return ret;
}
int MESA_PLUG_INIT(void)
{
int i;
pthread_t pid;
sapp_gval_init();
sapp_set_current_state(SAPP_STATE_JUST_START);
sapp_set_current_state(SAPP_STATE_CONFIG_PARSE);
sapp_parse_config();
if(MESA_platform_init(0, NULL) < 0){
sapp_runtime_log(30, "IIE plug init error!\n");
return -1;
}
g_packet_io_cap_level = CAP_LEVEL_IPV4; /* ���ص�IP����, ǿ��ָ��ΪIPv4 */
MESA_platform_run();
return 1;
}
#endif
#ifdef __cplusplus
}
#endif
|