summaryrefslogtreecommitdiff
path: root/common/include/packet_io.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/include/packet_io.h')
-rw-r--r--common/include/packet_io.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/common/include/packet_io.h b/common/include/packet_io.h
new file mode 100644
index 0000000..db8a011
--- /dev/null
+++ b/common/include/packet_io.h
@@ -0,0 +1,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