Refactor the session manager using session transformation 2D array & Update test case
This commit is contained in:
41
src/session/session_transition.h
Normal file
41
src/session/session_transition.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _SESSION_TRANSITION_H
|
||||
#define _SESSION_TRANSITION_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
#include "session.h"
|
||||
|
||||
#define SESSION_TRANSITION_LOG_DEBUG(format, ...) LOG_DEBUG("session transition", format, ##__VA_ARGS__)
|
||||
|
||||
enum session_inputs
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
// packet
|
||||
TCP_SYN = 1 << 0,
|
||||
TCP_SYN_ACK = 1 << 1,
|
||||
TCP_FIN = 1 << 2, // Only Fist FIN
|
||||
TCP_RST = 1 << 3,
|
||||
TCP_DATA = 1 << 4,
|
||||
UDP_DATA = 1 << 5,
|
||||
|
||||
// session timeout
|
||||
TIMEOUT = 1 << 6,
|
||||
|
||||
// session table full evict
|
||||
LRU_EVICT = 1 << 7,
|
||||
};
|
||||
|
||||
void session_transition_init();
|
||||
enum session_state session_transition_run(enum session_state curr_state, int inputs);
|
||||
void session_transition_log(struct session *sess, enum session_state curr_state, enum session_state next_state, int inputs);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user