TSG-20527 http2解析层支持zstd编解码

This commit is contained in:
fengweihao
2024-04-28 15:56:01 +08:00
parent 93c626de6d
commit 397a6aba93
9 changed files with 824 additions and 264 deletions

View File

@@ -13,6 +13,8 @@
#include <brotli/encode.h>
#include <brotli/decode.h>
#include <http2_stream.h>
#include <zstd.h>
#include <zdict.h>
typedef struct RTLogInit2Data_
{
@@ -72,25 +74,23 @@ http2_header_str_to_val(const char *str, size_t slen, const char * map[], unsign
#define HTTP2_CONTENT_ENCODING_X_GZIP BV(5)
#define HTTP2_CONTENT_ENCODING_X_BZIP2 BV(6)
#define HTTP2_CONTENT_ENCODING_BR BV(7)
#define HTTP2_CONTENT_ENCODING_ZSTD BV(8)
struct z_stream_st{
struct http2_codec_ctx
{
z_stream zst;
BrotliDecoderState *brdec_state;
BrotliEncoderState *brenc_state;
ZSTD_DCtx* dctx;
ZSTD_CCtx* cctx;
};
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);
int http2_decompress_stream(const uint8_t *source, int len, char **dest, int *outlen, struct http2_codec_ctx **codec_ctx, int encode);
int http2_compress_stream(struct http2_codec_ctx **codec_ctx, const uint8_t *source, int slen, struct evbuffer * evbuf, int encode, int mode);
void http2_compress_finished(struct http2_codec_ctx **codec_ctx);
void http2_decompress_finished(struct http2_codec_ctx **codec_ctx);
#endif