This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/plugin/protocol/http2/include/internal/http2_common.h

84 lines
2.2 KiB
C
Raw Normal View History

/*************************************************************************
> File Name: http2_common.h
> Author:
> Mail:
> Created Time: 20180921 135912
************************************************************************/
#ifndef _HTTP2_STRING_H
#define _HTTP2_STRING_H
#include <zlib.h>
#include <sys/queue.h>
#include <brotli/encode.h>
#include <brotli/decode.h>
#include <http2_stream.h>
typedef struct RTLogInit2Data_ {
void *handle;
} RTLogInit2Data;
typedef struct Http2Plugin_{
struct event * event[TFE_THREAD_MAX];
struct tfe_h2_stream h2_stream[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);
const char*
http2_header_val_to_str(unsigned int val, const char * map[], unsigned int map_size);
int
http2_header_str_to_val(const char *str, size_t slen, const char * map[], unsigned int map_size);
#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{
z_stream zst;
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);
#endif