summaryrefslogtreecommitdiff
path: root/common/include/packet_io.h
blob: db8a011da1d3e5a55e49ee80bf094d243e8c27c3 (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
#ifndef _PACKET_IO_H
#define _PACKET_IO_H

#ifdef __cpluscplus
extern "C"
{
#endif

#include <marsio.h>

#define MAX_THREAD_NUM 128

enum action
{
    ACTION_BYPASS = 0x1,
    ACTION_DROP = 0x2,
};

struct packet_io;
typedef enum action packet_handle_cb(const char *data, int len, void *args);
void packet_io_set_callback(struct packet_io *handle, packet_handle_cb *cb, void *args);

struct packet_io *packet_io_create(const char *profile);
void packet_io_destory(struct packet_io *handle);

int packet_io_thread_init(struct packet_io *handle, int thread_index);
void packet_io_thread_wait(struct packet_io *handle, int thread_index, int timeout_ms);
int packet_io_thread_polling(struct packet_io *handle, int thread_index);
int packet_io_thread_number(struct packet_io *handle);

#ifdef __cpluscplus
}
#endif

#endif