/* * The current file is private to the plugin, and pulgin can only use session.h * The current file can only be used by session.cpp/session_pool.cpp/session_table.cpp */ #ifndef _SESSION_PRIVATE_H #define _SESSION_PRIVATE_H #ifdef __cpluscplus extern "C" { #endif #include "timeout.h" #include "uthash.h" #include "session.h" #define EX_DATA_MAX_COUNT 128 #define SESSION_EVENT_QUEUE_SIZE 256 struct event_queue { uint32_t head_idx; uint32_t tail_idx; uint32_t events[SESSION_EVENT_QUEUE_SIZE]; }; struct session { // session id uint64_t id; // session state enum session_state state; // session type enum session_type type; // session metrics uint64_t c2s_bytes; uint64_t s2c_bytes; uint64_t c2s_packets; uint64_t s2c_packets; // session metadata struct metadata c2s_1st_md; struct metadata s2c_1st_md; // session timestamp uint64_t create_time; uint64_t last_time; /****************************** * Session Current Packet ******************************/ // session current packet struct packet *cur_pkt; enum session_dir cur_dir; /****************************** * Session Ev Queue Zone ******************************/ struct event_queue events; /****************************** * Session Ex Data Zone ******************************/ void *ex_data[EX_DATA_MAX_COUNT]; /****************************** * Session Timer Zone ******************************/ // session timer struct timeout timeout; session_expire_cb expire_cb; void *expire_arg; uint64_t expire_abs_ts; /****************************** * Session Pool Zone ******************************/ // session pool recycle handle struct session *next_free_ptr; /****************************** * Session Table Zone ******************************/ // session table key struct session_key key; struct session *next_ptr; struct session *prev_ptr; // session table handle UT_hash_handle hh; /****************************** * Session Manager Zone ******************************/ struct session *next_ready_ptr; }; #ifdef __cpluscplus } #endif #endif