111 lines
2.2 KiB
C
111 lines
2.2 KiB
C
/*
|
|
* 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
|
|
|
|
struct session
|
|
{
|
|
// session id
|
|
uint64_t id;
|
|
|
|
// session state
|
|
enum session_state state;
|
|
|
|
// session type
|
|
enum session_type type;
|
|
|
|
// dup traffic flag
|
|
enum dup_traffic_flag dup_flag;
|
|
|
|
// closing reason
|
|
enum closing_reason closing_reason;
|
|
|
|
// session metrics
|
|
uint64_t c2s_bytes;
|
|
uint64_t s2c_bytes;
|
|
uint64_t c2s_packets;
|
|
uint64_t s2c_packets;
|
|
|
|
// session timestamp
|
|
uint64_t create_time;
|
|
uint64_t last_time;
|
|
|
|
// session l4 state
|
|
enum tcp_state tcp_state;
|
|
enum udp_state udp_state;
|
|
|
|
// session packet
|
|
struct packet *c2s_1st_pkt;
|
|
struct packet *s2c_1st_pkt;
|
|
|
|
/******************************
|
|
* Session Current Packet
|
|
******************************/
|
|
|
|
// session current packet
|
|
const struct packet *cur_pkt;
|
|
enum session_dir cur_dir;
|
|
|
|
/******************************
|
|
* 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 tuple6 tuple;
|
|
enum session_dir tuple_dir;
|
|
|
|
struct session *next_ptr;
|
|
struct session *prev_ptr;
|
|
|
|
// session table handle
|
|
UT_hash_handle hh;
|
|
|
|
/******************************
|
|
* Session Queue Zone
|
|
******************************/
|
|
|
|
struct session *next_ready_ptr;
|
|
};
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|