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
fengweihao a22e0ed630 *删除nghttp2中收到ping ack字符会ping
*由于命中匹配规则且返回数据中只有 header,造成数据丢失,在当前流close时添加header注册接口
2019-05-24 18:45:45 +08:00

87 lines
2.2 KiB
C

/*************************************************************************
> File Name: http2_common.h
> Author:
> Mail:
> Created Time: 2018年09月21日 星期五 13时59分12秒
************************************************************************/
#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_ {
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