diff options
Diffstat (limited to 'src/protocol_decoder/http/http_decoder.h')
| -rw-r--r-- | src/protocol_decoder/http/http_decoder.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/protocol_decoder/http/http_decoder.h b/src/protocol_decoder/http/http_decoder.h deleted file mode 100644 index 5ca43a5..0000000 --- a/src/protocol_decoder/http/http_decoder.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef _HTTP_DECODER_H -#define _HTTP_DECODER_H - -#ifdef __cpluscplus -extern "C" -{ -#endif - -#include <stddef.h> - -/****************************************************************************** - * Manipulate http decoder(Per HTTP Session) - ******************************************************************************/ - -enum http_decoder_status -{ - ON_INIT = 0x1, - ON_MESSAGE_BEGIN = 0x2, - ON_URI = 0x3, - ON_URI_COMPLETE = 0x4, - ON_STATUS = 0x5, - ON_STATUS_COMPLETE = 0x6, - ON_HEADER_FIELD = 0x7, - ON_HEADER_FIELD_COMPLETE = 0x8, - ON_HEADER_VALUE = 0x9, - ON_HEADER_VALUE_COMPLETE = 0xa, - ON_CHUNK_HEADER = 0xb, - ON_CHUNK_HEADER_COMPLETE = 0xc, - ON_HEADERS_COMPLETE = 0xd, - ON_BODY = 0xe, - ON_MESSAGE_COMPLETE = 0xf, -}; - -struct http_decoder; - -struct http_decoder *http_decoder_create(); -void http_decoder_destory(struct http_decoder *decoder); - -void http_decoder_init(struct http_decoder *decoder); -void http_decoder_reset(struct http_decoder *decoder); - -/* - * return 0 : new data that needs to be consumed by upper layers has been parsed - * return -1 : no new data - * return -2 : error or not http protocol - */ -int http_decoder_dispatch(struct http_decoder *decoder, const char *data, size_t len); -// remove the data that has been consumed by the upper layer -void http_decoder_remove(struct http_decoder *decoder); - -void http_decoder_dump(struct http_decoder *decoder); // for debug -enum http_decoder_status http_decoder_status(struct http_decoder *decoder); // for gtest - -/****************************************************************************** - * Consume decoded data - ******************************************************************************/ - -enum http_dir -{ - HTTP_DIR_UNKNOWN = 0x0, - HTTP_DIR_REQUEST = 0x1, - HTTP_DIR_RESPONSE = 0x2, -}; - -enum http_dir http_decoder_fetch_dir(struct http_decoder *decoder); // HTTP_DIR_UNKNOWN: Not Find -int http_decoder_fetch_status_code(struct http_decoder *decoder); // -1 : Not Find -int http_decoder_fetch_major_version(struct http_decoder *decoder); // -1 : Not Find -int http_decoder_fetch_minor_version(struct http_decoder *decoder); // -1 : Not Find - -void http_decoder_fetch_method(struct http_decoder *decoder, char **ptr, size_t *len); // ptr == NULL : Not Find -void http_decoder_fetch_uri(struct http_decoder *decoder, char **ptr, size_t *len); // ptr == NULL : Not Find -void http_decoder_fetch_status(struct http_decoder *decoder, char **ptr, size_t *len); // ptr == NULL : Not Find -void http_decoder_fetch_body(struct http_decoder *decoder, char **ptr, size_t *len); // ptr == NULL : Not Find -void http_decoder_fetch_next_header(struct http_decoder *decoder, int *iter_index, - char **filed_ptr, size_t *filed_len, char **value_ptr, size_t *value_len); // filed_ptr == NULL : Not Find - -#ifdef __cpluscplus -} -#endif - -#endif |
