MAX_DATA frame parser/handler.

This commit is contained in:
Sergey Kandaurov 2020-03-18 23:26:26 +03:00
parent 33d8317dd5
commit 31e794f0ad
3 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,7 @@ struct ngx_quic_connection_s {
ngx_quic_frame_t *frames;
ngx_quic_streams_t streams;
ngx_uint_t max_data;
};
@ -823,6 +824,16 @@ ngx_quic_payload_handler(ngx_connection_t *c, ngx_quic_header_t *pkt)
ack_this = 1;
break;
case NGX_QUIC_FT_MAX_DATA:
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
"MAX_DATA frame"
" { Maximum Data %ui }",
frame.u.max_data.max_data);
c->quic->max_data = frame.u.max_data.max_data;
ack_this = 1;
break;
case NGX_QUIC_FT_RESET_STREAM:
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
"RESET STREAM frame"

View File

@ -424,6 +424,10 @@ ngx_quic_parse_frame(u_char *start, u_char *end, ngx_quic_frame_t *frame)
break;
case NGX_QUIC_FT_MAX_DATA:
frame->u.max_data.max_data = ngx_quic_parse_int(&p);
break;
case NGX_QUIC_FT_RESET_STREAM:
frame->u.reset_stream.id = ngx_quic_parse_int(&p);
frame->u.reset_stream.error_code = ngx_quic_parse_int(&p);

View File

@ -109,6 +109,11 @@ typedef struct {
} ngx_quic_stream_frame_t;
typedef struct {
uint64_t max_data;
} ngx_quic_max_data_frame_t;
typedef struct {
uint64_t error_code;
uint64_t frame_type;
@ -146,6 +151,7 @@ struct ngx_quic_frame_s {
ngx_quic_crypto_frame_t crypto;
ngx_quic_new_conn_id_frame_t ncid;
ngx_quic_stream_frame_t stream;
ngx_quic_max_data_frame_t max_data;
ngx_quic_close_frame_t close;
ngx_quic_reset_stream_frame_t reset_stream;
ngx_quic_stop_sending_frame_t stop_sending;