| 1 |
#ifndef AWS_HTTP_H2_DECODER_H |
| 2 |
#define AWS_HTTP_H2_DECODER_H |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#include <aws/http/private/h2_frames.h> |
| 10 |
#include <aws/http/private/http_impl.h> |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
struct aws_h2_decoder_vtable { |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
struct aws_h2err (*on_headers_begin)(uint32_t stream_id, void *userdata); |
| 31 |
struct aws_h2err (*on_headers_i)( |
| 32 |
uint32_t stream_id, |
| 33 |
const struct aws_http_header *header, |
| 34 |
enum aws_http_header_name name_enum, |
| 35 |
enum aws_http_header_block block_type, |
| 36 |
void *userdata); |
| 37 |
struct aws_h2err ( |
| 38 |
*on_headers_end)(uint32_t stream_id, bool malformed, enum aws_http_header_block block_type, void *userdata); |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
struct aws_h2err (*on_push_promise_begin)(uint32_t stream_id, uint32_t promised_stream_id, void *userdata); |
| 44 |
struct aws_h2err (*on_push_promise_i)( |
| 45 |
uint32_t stream_id, |
| 46 |
const struct aws_http_header *header, |
| 47 |
enum aws_http_header_name name_enum, |
| 48 |
void *userdata); |
| 49 |
struct aws_h2err (*on_push_promise_end)(uint32_t stream_id, bool malformed, void *userdata); |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
struct aws_h2err (*on_data_begin)( |
| 54 |
uint32_t stream_id, |
| 55 |
uint32_t payload_len, |
| 56 |
uint32_t total_padding_bytes, |
| 57 |
bool end_stream, |
| 58 |
void *userdata); |
| 59 |
struct aws_h2err (*on_data_i)(uint32_t stream_id, struct aws_byte_cursor data, void *userdata); |
| 60 |
struct aws_h2err (*on_data_end)(uint32_t stream_id, void *userdata); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
struct aws_h2err (*on_end_stream)(uint32_t stream_id, void *userdata); |
| 65 |
|
| 66 |
|
| 67 |
struct aws_h2err (*on_rst_stream)(uint32_t stream_id, uint32_t error_code, void *userdata); |
| 68 |
|
| 69 |
|
| 70 |
struct aws_h2err (*on_ping_ack)(uint8_t opaque_data[AWS_HTTP2_PING_DATA_SIZE], void *userdata); |
| 71 |
|
| 72 |
|
| 73 |
struct aws_h2err (*on_ping)(uint8_t opaque_data[AWS_HTTP2_PING_DATA_SIZE], void *userdata); |
| 74 |
|
| 75 |
|
| 76 |
struct aws_h2err (*on_settings_ack)(void *userdata); |
| 77 |
|
| 78 |
|
| 79 |
struct aws_h2err ( |
| 80 |
*on_settings)(const struct aws_http2_setting *settings_array, size_t num_settings, void *userdata); |
| 81 |
|
| 82 |
|
| 83 |
struct aws_h2err ( |
| 84 |
*on_goaway)(uint32_t last_stream, uint32_t error_code, struct aws_byte_cursor debug_data, void *userdata); |
| 85 |
|
| 86 |
|
| 87 |
struct aws_h2err (*on_window_update)(uint32_t stream_id, uint32_t window_size_increment, void *userdata); |
| 88 |
}; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
struct aws_h2_decoder_params { |
| 94 |
struct aws_allocator *alloc; |
| 95 |
const struct aws_h2_decoder_vtable *vtable; |
| 96 |
void *userdata; |
| 97 |
const void *logging_id; |
| 98 |
bool is_server; |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
bool skip_connection_preface; |
| 103 |
}; |
| 104 |
|
| 105 |
struct aws_h2_decoder; |
| 106 |
|
| 107 |
AWS_EXTERN_C_BEGIN |
| 108 |
|
| 109 |
AWS_HTTP_API struct aws_h2_decoder *aws_h2_decoder_new(struct aws_h2_decoder_params *params); |
| 110 |
AWS_HTTP_API void aws_h2_decoder_destroy(struct aws_h2_decoder *decoder); |
| 111 |
|
| 112 |
|
| 113 |
AWS_HTTP_API struct aws_h2err aws_h2_decode(struct aws_h2_decoder *decoder, struct aws_byte_cursor *data); |
| 114 |
|
| 115 |
AWS_HTTP_API void aws_h2_decoder_set_setting_header_table_size(struct aws_h2_decoder *decoder, uint32_t data); |
| 116 |
AWS_HTTP_API void aws_h2_decoder_set_setting_enable_push(struct aws_h2_decoder *decoder, uint32_t data); |
| 117 |
AWS_HTTP_API void aws_h2_decoder_set_setting_max_frame_size(struct aws_h2_decoder *decoder, uint32_t data); |
| 118 |
|
| 119 |
AWS_EXTERN_C_END |
| 120 |
|
| 121 |
#endif |