Add packet IO module

* support marsio
    * support dumpfile ( 1 thread read dumpfile & N thread handle packet)
This commit is contained in:
luwenpeng
2024-02-28 16:30:03 +08:00
parent 2e748e0821
commit 7952ae7283
32 changed files with 1548 additions and 467 deletions

View File

@@ -14,7 +14,7 @@ extern "C"
#define PACKET_MAX_LAYERS 16
#define PACKET_LOG_ERROR(format, ...) LOG_ERROR("packet", format, ##__VA_ARGS__)
#define PACKET_LOG_DEBUG(format, ...) void(0)
//#define PACKET_LOG_DEBUG(format, ...) LOG_DEBUG("packet", format, ##__VA_ARGS__)
// #define PACKET_LOG_DEBUG(format, ...) LOG_DEBUG("packet", format, ##__VA_ARGS__)
enum layer_type
{
@@ -71,6 +71,9 @@ struct layer_record
uint16_t pld_len; // payload length
};
#define MAX_SID_NUM 8
#define MAX_ROUTE_LEN 64
struct packet
{
struct layer_record layers[PACKET_MAX_LAYERS];
@@ -81,8 +84,21 @@ struct packet
const char *data_ptr;
uint16_t data_len;
uint64_t domain;
bool need_free;
const void *user_data;
// metadata
void *io_ctx;
uint16_t sid_list[MAX_SID_NUM];
uint16_t sid_used;
char route_ctx[MAX_ROUTE_LEN];
uint16_t route_len;
uint64_t session_id;
uint8_t direction;
uint8_t type;
uint8_t action;
};
// return innermost payload