implementation session manager

This commit is contained in:
luwenpeng
2023-12-19 10:47:26 +08:00
parent 2e56bd810c
commit 2c26879182
15 changed files with 2269 additions and 193 deletions

View File

@@ -17,6 +17,29 @@ extern "C"
#define EX_DATA_MAX_COUNT 128
#define SESSION_EVENT_QUEUE_SIZE 256
enum tcp_ex_data
{
// HANDSHAKE
TCP_SYN_RECVED = 1 << 0,
TCP_SYNACK_RECVED = 1 << 1,
TCP_ACK_RECVED = 1 << 2,
// ESTABLISHED
TCP_C2S_PAYLOAD_RECVED = 1 << 3,
TCP_S2C_PAYLOAD_RECVED = 1 << 4,
// FIN
TCP_C2S_FIN_RECVED = 1 << 5,
TCP_S2C_FIN_RECVED = 1 << 6,
// RST
TCP_C2S_RST_RECVED = 1 << 7,
TCP_S2C_RST_RECVED = 1 << 8,
};
enum udp_ex_data
{
UDP_C2S_RECVED = 1 << 0,
UDP_S2C_RECVED = 1 << 1,
};
struct event_queue
{
uint32_t head_idx;
@@ -92,6 +115,7 @@ struct session
// session table key
struct tuple6 tuple;
enum session_dir tuple_dir;
struct session *next_ptr;
struct session *prev_ptr;
@@ -100,12 +124,17 @@ struct session
UT_hash_handle hh;
/******************************
* Session Manager Zone
* Session Queue Zone
******************************/
struct session *next_ready_ptr;
};
// tcp_builtin_ex = session_get_ex_new_index("tcp_builtin_ex", NULL, NULL);
// udp_builtin_ex = session_get_ex_new_index("udp_builtin_ex", NULL, NULL);
extern uint8_t tcp_builtin_ex;
extern uint8_t udp_builtin_ex;
#ifdef __cpluscplus
}
#endif