Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8594:ee06a813756c quic
QUIC: teach how to compute only the length of created QUIC headers.
It will be used for precise expansion of UDP datagram payload.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 21 Oct 2020 12:03:23 +0100 |
parents | d8a0bb1e85bf |
children | 38c7dd720774 |
comparison
equal
deleted
inserted
replaced
8593:d8a0bb1e85bf | 8594:ee06a813756c |
---|---|
418 ngx_quic_create_long_header(ngx_quic_header_t *pkt, u_char *out, | 418 ngx_quic_create_long_header(ngx_quic_header_t *pkt, u_char *out, |
419 size_t pkt_len, u_char **pnp) | 419 size_t pkt_len, u_char **pnp) |
420 { | 420 { |
421 u_char *p, *start; | 421 u_char *p, *start; |
422 | 422 |
423 if (out == NULL) { | |
424 return 5 + 2 + pkt->dcid.len + pkt->scid.len | |
425 + ngx_quic_varint_len(pkt_len + pkt->num_len) + pkt->num_len | |
426 + (pkt->level == ssl_encryption_initial ? 1 : 0); | |
427 } | |
428 | |
423 p = start = out; | 429 p = start = out; |
424 | 430 |
425 *p++ = pkt->flags; | 431 *p++ = pkt->flags; |
426 | 432 |
427 p = ngx_quic_write_uint32(p, NGX_QUIC_VERSION); | 433 p = ngx_quic_write_uint32(p, NGX_QUIC_VERSION); |
462 size_t | 468 size_t |
463 ngx_quic_create_short_header(ngx_quic_header_t *pkt, u_char *out, | 469 ngx_quic_create_short_header(ngx_quic_header_t *pkt, u_char *out, |
464 size_t pkt_len, u_char **pnp) | 470 size_t pkt_len, u_char **pnp) |
465 { | 471 { |
466 u_char *p, *start; | 472 u_char *p, *start; |
473 | |
474 if (out == NULL) { | |
475 return 1 + pkt->dcid.len + pkt->num_len; | |
476 } | |
467 | 477 |
468 p = start = out; | 478 p = start = out; |
469 | 479 |
470 *p++ = pkt->flags; | 480 *p++ = pkt->flags; |
471 | 481 |