Mercurial > hg > nginx-quic
comparison src/event/ngx_event_quic.c @ 8069:4ff2a0b747d1 quic
QUIC: handle PATH_CHALLENGE frame.
A PATH_RESPONSE frame with the same data is sent in response.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 28 Aug 2020 12:01:35 +0300 |
parents | f882b1784f30 |
children | 62b58f0a4711 |
comparison
equal
deleted
inserted
replaced
8068:f882b1784f30 | 8069:4ff2a0b747d1 |
---|---|
249 ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f); | 249 ngx_quic_header_t *pkt, ngx_quic_reset_stream_frame_t *f); |
250 static ngx_int_t ngx_quic_handle_stop_sending_frame(ngx_connection_t *c, | 250 static ngx_int_t ngx_quic_handle_stop_sending_frame(ngx_connection_t *c, |
251 ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f); | 251 ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f); |
252 static ngx_int_t ngx_quic_handle_max_streams_frame(ngx_connection_t *c, | 252 static ngx_int_t ngx_quic_handle_max_streams_frame(ngx_connection_t *c, |
253 ngx_quic_header_t *pkt, ngx_quic_max_streams_frame_t *f); | 253 ngx_quic_header_t *pkt, ngx_quic_max_streams_frame_t *f); |
254 static ngx_int_t ngx_quic_handle_path_challenge_frame(ngx_connection_t *c, | |
255 ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f); | |
254 | 256 |
255 static void ngx_quic_queue_frame(ngx_quic_connection_t *qc, | 257 static void ngx_quic_queue_frame(ngx_quic_connection_t *qc, |
256 ngx_quic_frame_t *frame); | 258 ngx_quic_frame_t *frame); |
257 | 259 |
258 static ngx_int_t ngx_quic_output(ngx_connection_t *c); | 260 static ngx_int_t ngx_quic_output(ngx_connection_t *c); |
2200 return NGX_ERROR; | 2202 return NGX_ERROR; |
2201 } | 2203 } |
2202 | 2204 |
2203 break; | 2205 break; |
2204 | 2206 |
2207 case NGX_QUIC_FT_PATH_CHALLENGE: | |
2208 | |
2209 if (ngx_quic_handle_path_challenge_frame(c, pkt, | |
2210 &frame.u.path_challenge) | |
2211 != NGX_OK) | |
2212 { | |
2213 return NGX_ERROR; | |
2214 } | |
2215 | |
2216 break; | |
2217 | |
2205 case NGX_QUIC_FT_NEW_CONNECTION_ID: | 2218 case NGX_QUIC_FT_NEW_CONNECTION_ID: |
2206 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: | 2219 case NGX_QUIC_FT_RETIRE_CONNECTION_ID: |
2207 case NGX_QUIC_FT_PATH_CHALLENGE: | |
2208 case NGX_QUIC_FT_PATH_RESPONSE: | 2220 case NGX_QUIC_FT_PATH_RESPONSE: |
2209 | 2221 |
2210 /* TODO: handle */ | 2222 /* TODO: handle */ |
2211 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, | 2223 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, |
2212 "quic frame handler not implemented"); | 2224 "quic frame handler not implemented"); |
3415 | 3427 |
3416 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | 3428 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
3417 "quic max_streams_uni:%uL", f->limit); | 3429 "quic max_streams_uni:%uL", f->limit); |
3418 } | 3430 } |
3419 } | 3431 } |
3432 | |
3433 return NGX_OK; | |
3434 } | |
3435 | |
3436 | |
3437 static ngx_int_t | |
3438 ngx_quic_handle_path_challenge_frame(ngx_connection_t *c, | |
3439 ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f) | |
3440 { | |
3441 ngx_quic_frame_t *frame; | |
3442 | |
3443 frame = ngx_quic_alloc_frame(c, 0); | |
3444 if (frame == NULL) { | |
3445 return NGX_ERROR; | |
3446 } | |
3447 | |
3448 frame->level = pkt->level; | |
3449 frame->type = NGX_QUIC_FT_PATH_RESPONSE; | |
3450 frame->u.path_response = *f; | |
3451 | |
3452 ngx_sprintf(frame->info, "PATH_RESPONSE data:0x%xL level:%d", | |
3453 *(uint64_t *) &f->data, frame->level); | |
3454 | |
3455 ngx_quic_queue_frame(c->quic, frame); | |
3420 | 3456 |
3421 return NGX_OK; | 3457 return NGX_OK; |
3422 } | 3458 } |
3423 | 3459 |
3424 | 3460 |