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/http_entry.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/http_entry.h')
| -rw-r--r-- | src/protocol_decoder/http/http_entry.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/protocol_decoder/http/http_entry.h b/src/protocol_decoder/http/http_entry.h new file mode 100644 index 0000000..7d3b384 --- /dev/null +++ b/src/protocol_decoder/http/http_entry.h @@ -0,0 +1,72 @@ +#ifndef _HTTP_ENTRY_H +#define _HTTP_ENTRY_H + +#ifdef __cpluscplus +extern "C" +{ +#endif + +#include "session.h" + +struct http_string +{ + char *str; + size_t len; +}; + +struct http_request_line +{ + struct http_string method; + struct http_string uri; + struct http_string version; + + int major_version; + int minor_version; +}; + +struct http_response_line +{ + struct http_string version; + struct http_string status; + + int major_version; + int minor_version; + int status_code; +}; + +struct http_decoder; + +/****************************************************************************** + * For HTTP consumer + ******************************************************************************/ + +void http_session_get_request_line(struct stellar_session *http_session, struct http_request_line *line); +void http_session_get_response_line(struct stellar_session *http_session, struct http_response_line *line); + +void http_session_get_request_raw_body(struct stellar_session *http_session, struct http_string *body); +void http_session_get_response_raw_body(struct stellar_session *http_session, struct http_string *body); + +void http_session_get_request_decompress_body(struct stellar_session *http_session, struct http_string *body); +void http_session_get_response_decompress_body(struct stellar_session *http_session, struct http_string *body); + +size_t http_session_get_request_header(struct stellar_session *http_session, struct http_string *header_key, struct http_string header_val[], size_t val_size); +size_t http_session_get_response_header(struct stellar_session *http_session, struct http_string *header_key, struct http_string header_val[], size_t val_size); + +void http_session_iter_request_header(struct stellar_session *http_session, size_t *iter_index, struct http_string *header_key, struct http_string *header_val); +void http_session_iter_response_header(struct stellar_session *http_session, size_t *iter_index, struct http_string *header_key, struct http_string *header_val); + +/****************************************************************************** + * For HTTP decoder + ******************************************************************************/ + +void http_entry(struct stellar_session *tcp_session, const char *tcp_event, int thread_id); + +/****************************************************************************** + * For gtest + ******************************************************************************/ + +#ifdef __cpluscplus +} +#endif + +#endif |
