36 lines
818 B
C
36 lines
818 B
C
|
|
#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
|