/************************************************************************* > File Name: http2_common.h > Author: > Mail: > Created Time: 2018年09月21日 星期五 13时59分12秒 ************************************************************************/ #ifndef _HTTP2_STRING_H #define _HTTP2_STRING_H #include #include #include #include #include typedef struct RTLogInit2Data_ { int run_log_level; char run_log_path[256]; void *handle; } RTLogInit2Data; typedef struct Http2Plugin_{ struct event * event[TFE_THREAD_MAX]; struct tfe_session_info_t session_info[TFE_THREAD_MAX]; } Http2Plugin; typedef enum { NGHTTP2_METHOD_DELETE = 0, NGHTTP2_METHOD_GET = 1, NGHTTP2_METHOD_HEAD = 2, NGHTTP2_METHOD_POST = 3, NGHTTP2_METHOD_PUT = 4, NGHTTP2_METHOD_CONNECT = 5, NGHTTP2_METHOD_OPTIONS = 6, NGHTTP2_METHOD_UNKNOWN, }nghttp2_method; struct value_string { unsigned int value; const char *strptr; }; const char* val_to_str(unsigned int val, const struct value_string *vs); int str_to_val(const char *val, const struct value_string *vs); #define BV(x) (1 << x) #define HTTP2_CONTENT_ENCODING_NONE 0 #define HTTP2_CONTENT_ENCODING_GZIP BV(1) #define HTTP2_CONTENT_ENCODING_DEFLATE BV(2) #define HTTP2_CONTENT_ENCODING_COMPRESS BV(3) #define HTTP2_CONTENT_ENCODING_BZIP2 BV(4) #define HTTP2_CONTENT_ENCODING_X_GZIP BV(5) #define HTTP2_CONTENT_ENCODING_X_BZIP2 BV(6) #define HTTP2_CONTENT_ENCODING_BR BV(7) struct z_stream_st{ int gip; z_stream zst; int8_t finished; BrotliDecoderState *brdec_state; BrotliEncoderState *brenc_state; }; RTLogInit2Data *logger(); Http2Plugin *http2_plugin(); int inflate_read(const uint8_t *source,int len,char **dest, int *outlen, struct z_stream_st **strm, int encode); int deflate_write(struct z_stream_st **strm, const uint8_t *source, int slen, struct evbuffer * evbuf, int gzip, int end); void inflate_finished(struct z_stream_st **strm); void deflate_finished(struct z_stream_st **strm); void frame_display(const uint8_t *payload, uint16_t payload_len); #endif