diff options
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 |
