diff options
| author | luwenpeng <[email protected]> | 2022-11-18 18:49:41 +0800 |
|---|---|---|
| committer | luwenpeng <[email protected]> | 2022-11-18 18:49:52 +0800 |
| commit | 54375f7139e1585e66ace05184f56080529717c8 (patch) | |
| tree | 30a73f2292a80a1a94cc51663f438515979250ba /src/protocol_decoder/http/session.h | |
| parent | 7aa1710ed0ecb3ed480ae5c02f31d7f7dcbd5c23 (diff) | |
暂存HTTP decoder的代码,代码结构待整合dev-lwp
TSG-11629 stellar protocol decoder支持HTTP decoder
TSG-11932 stellar http decoder支持mutil request/response in one packet
TSG-11933 llhttp解析request时获取精确的http version
TSG-12021 stellar http decoder支持decompress body data
TSG-12022 stellar http decoder支持chunk模式
Diffstat (limited to 'src/protocol_decoder/http/session.h')
| -rw-r--r-- | src/protocol_decoder/http/session.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/protocol_decoder/http/session.h b/src/protocol_decoder/http/session.h new file mode 100644 index 0000000..0714245 --- /dev/null +++ b/src/protocol_decoder/http/session.h @@ -0,0 +1,67 @@ +#ifndef _SESSION_H +#define _SESSION_H + +#ifdef __cpluscplus +extern "C" +{ +#endif + +#include <stdint.h> + +#define SESSION_DIR_C2S 0x01 +#define SESSION_DIR_S2C 0x02 + +#define EX_DATA_MAX_NUM 1024 + +typedef void free_callback(void *ex_data, void *cb_arg); + +struct session_ex_data +{ + void *ex_data; + void *cb_arg; + free_callback *free_cb; +}; + +struct stellar_session +{ + struct stellar_session *father; + struct session_ex_data ex_data[EX_DATA_MAX_NUM]; + const char *session_name; + uint8_t current_packet_dir; // SESSION_DIR_C2S or SESSION_DIR_S2C + const char *l7_payload; + size_t l7_payload_length; +}; + +struct session_event +{ + struct stellar_session *session; + const char *event_name; + size_t event_id; + + struct session_event *next; +}; + +void session_event_push(struct session_event *event); +struct session_event *session_event_pop(); + +struct stellar_session *session_derive(struct stellar_session *session, const char *session_name); +void session_trigger(struct stellar_session *session, const char *event_name); + +size_t session_register_ex_data_index(const char *key); + +void session_set_ex_data(struct stellar_session *session, int idx, void *ex_data, free_callback *free_cb, void *cb_arg); +void *session_get_ex_data(struct stellar_session *session, int idx); +void session_del_ex_data(struct stellar_session *session, int idx); +void session_free_ex_data(struct stellar_session *session); + +const char *session_get_l4_payload(struct stellar_session *session); +size_t session_get_l4_payload_length(struct stellar_session *session); +uint8_t session_get_l4_dir(struct stellar_session *session); + +void pm_session_dettach_me(struct stellar_session *session); + +#ifdef __cpluscplus +} +#endif + +#endif |
