session manager add packet_tag: (PKT_TAG_KEY_SESS, PKT_TAG_VAL_SESS_NEW/FREE/CTRL_MSG/TCP_STREAM)
This commit is contained in:
@@ -10,13 +10,9 @@ extern "C"
|
||||
******************************************************************************/
|
||||
|
||||
#define PKT_TAG_KEY_SESS 1 << 0
|
||||
|
||||
#define PKT_TAG_KEY_IPPROTO 1 << 1
|
||||
#define PKT_TAG_KEY_L7PROTO 1 << 2
|
||||
|
||||
#define PKT_TAG_KEY_CTRL_MSG 1 << 3
|
||||
#define PKT_TAG_KEY_TCP_STREAM 1 << 4
|
||||
|
||||
/******************************************************************************
|
||||
* Packet Tag Val
|
||||
******************************************************************************/
|
||||
@@ -24,15 +20,17 @@ extern "C"
|
||||
#define PKT_TAG_VAL_SESS_NEW 1 << 0
|
||||
#define PKT_TAG_VAL_SESS_FREE 1 << 1
|
||||
#define PKT_TAG_VAL_SESS_FLAG 1 << 2
|
||||
#define PKT_TAG_VAL_SESS_TCP_STREAM 1 << 3
|
||||
#define PKT_TAG_VAL_SESS_CTRL_MSG 1 << 4
|
||||
|
||||
#define PKT_TAG_VAL_IPPROTO_TCP 1 << 3
|
||||
#define PKT_TAG_VAL_IPPROTO_UDP 1 << 4
|
||||
#define PKT_TAG_VAL_IPPROTO_ICMP 1 << 5
|
||||
#define PKT_TAG_VAL_IPPROTO_TCP 1 << 5
|
||||
#define PKT_TAG_VAL_IPPROTO_UDP 1 << 6
|
||||
#define PKT_TAG_VAL_IPPROTO_ICMP 1 << 7
|
||||
|
||||
#define PKT_TAG_VAL_L7PROTO_SSL 1 << 6
|
||||
#define PKT_TAG_VAL_L7PROTO_DNS 1 << 7
|
||||
#define PKT_TAG_VAL_L7PROTO_HTTP 1 << 8
|
||||
#define PKT_TAG_VAL_L7PROTO_QUIC 1 << 9
|
||||
#define PKT_TAG_VAL_L7PROTO_SSL 1 << 8
|
||||
#define PKT_TAG_VAL_L7PROTO_DNS 1 << 9
|
||||
#define PKT_TAG_VAL_L7PROTO_HTTP 1 << 10
|
||||
#define PKT_TAG_VAL_L7PROTO_QUIC 1 << 11
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -121,16 +121,12 @@ enum session_timestamp
|
||||
};
|
||||
|
||||
struct session;
|
||||
|
||||
#define SESSION_SEEN_C2S_FLOW (1 << 0)
|
||||
#define SESSION_SEEN_S2C_FLOW (1 << 1)
|
||||
int session_is_symmetric(const struct session *sess, unsigned char *flag);
|
||||
|
||||
int session_has_duplicate_traffic(const struct session *sess);
|
||||
enum session_type session_get_type(const struct session *sess);
|
||||
|
||||
enum session_state session_get_current_state(const struct session *sess);
|
||||
|
||||
enum closing_reason session_get_closing_reason(const struct session *sess);
|
||||
enum session_direction session_get_direction(const struct session *sess);
|
||||
enum flow_type session_get_flow_type(const struct session *sess);
|
||||
@@ -138,11 +134,8 @@ const struct packet *session_get_first_packet(const struct session *sess, enum f
|
||||
uint64_t session_get_id(const struct session *sess);
|
||||
uint64_t session_get_timestamp(const struct session *sess, enum session_timestamp type);
|
||||
uint64_t session_get_stat(const struct session *sess, enum flow_type type, enum session_stat stat);
|
||||
|
||||
const char *session_get_readable_addr(const struct session *sess);
|
||||
|
||||
void session_set_discard(struct session *sess);
|
||||
|
||||
void session_set_exdata(struct session *sess, int idx, void *ex_ptr);
|
||||
void *session_get_exdata(const struct session *sess, int idx);
|
||||
|
||||
@@ -153,7 +146,28 @@ int session_manager_new_session_exdata_index(struct session_manager *sess_mgr, c
|
||||
struct session *session_manager_lookup_session_by_packet(struct session_manager *sess_mgr, uint16_t thread_id, const struct packet *pkt);
|
||||
struct session *session_manager_lookup_session_by_id(struct session_manager *sess_mgr, uint16_t thread_id, uint64_t sess_id);
|
||||
|
||||
struct session *packet_exdata_to_session(struct packet *pkt);
|
||||
void session_manager_on_packet_forward(struct packet *pkt, void *args);
|
||||
void session_manager_on_packet_output(struct packet *pkt, void *args);
|
||||
|
||||
struct tcp_segment
|
||||
{
|
||||
uint32_t len;
|
||||
const void *data;
|
||||
struct tcp_segment *next;
|
||||
};
|
||||
|
||||
struct session *packet_exdata_to_session(const struct session_manager *sess_mgr, const struct packet *pkt);
|
||||
struct tcp_segment *packet_exdata_to_tcp_segment(const struct session_manager *sess_mgr, const struct packet *pkt);
|
||||
/*
|
||||
* example how to use tcp_segment
|
||||
*
|
||||
* struct tcp_segment *seg = packet_exdata_to_tcp_segment(sess_mgr, pkt);
|
||||
* while (seg)
|
||||
* {
|
||||
* do_something(seg->data, seg->len);
|
||||
* seg = seg->next;
|
||||
* }
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user