aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2021-03-23 11:58:43 +0300
committerVladimir Homutov <vl@nginx.com>2021-03-23 11:58:43 +0300
commit0ad83da4f7ea94976e1d5684a62ed1ad2ff4517c (patch)
treecea98452b9f538d5a276c62086e9493a9641cd15 /src
parent79b66760a19599fa4b2cb3b9aa3c3e7e937df8ae (diff)
downloadnginx-0ad83da4f7ea94976e1d5684a62ed1ad2ff4517c.tar.gz
nginx-0ad83da4f7ea94976e1d5684a62ed1ad2ff4517c.zip
QUIC: PATH_CHALLENGE frame creation.
Diffstat (limited to 'src')
-rw-r--r--src/event/quic/ngx_event_quic_transport.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/event/quic/ngx_event_quic_transport.c b/src/event/quic/ngx_event_quic_transport.c
index 01c245f65..3fcc9fec9 100644
--- a/src/event/quic/ngx_event_quic_transport.c
+++ b/src/event/quic/ngx_event_quic_transport.c
@@ -113,6 +113,8 @@ static size_t ngx_quic_create_max_stream_data(u_char *p,
ngx_quic_max_stream_data_frame_t *ms);
static size_t ngx_quic_create_max_data(u_char *p,
ngx_quic_max_data_frame_t *md);
+static size_t ngx_quic_create_path_challenge(u_char *p,
+ ngx_quic_path_challenge_frame_t *pc);
static size_t ngx_quic_create_path_response(u_char *p,
ngx_quic_path_challenge_frame_t *pc);
static size_t ngx_quic_create_new_connection_id(u_char *p,
@@ -1258,6 +1260,9 @@ ngx_quic_create_frame(u_char *p, ngx_quic_frame_t *f)
case NGX_QUIC_FT_MAX_DATA:
return ngx_quic_create_max_data(p, &f->u.max_data);
+ case NGX_QUIC_FT_PATH_CHALLENGE:
+ return ngx_quic_create_path_challenge(p, &f->u.path_challenge);
+
case NGX_QUIC_FT_PATH_RESPONSE:
return ngx_quic_create_path_response(p, &f->u.path_response);
@@ -1787,6 +1792,27 @@ ngx_quic_create_max_data(u_char *p, ngx_quic_max_data_frame_t *md)
static size_t
+ngx_quic_create_path_challenge(u_char *p, ngx_quic_path_challenge_frame_t *pc)
+{
+ size_t len;
+ u_char *start;
+
+ if (p == NULL) {
+ len = ngx_quic_varint_len(NGX_QUIC_FT_PATH_CHALLENGE);
+ len += sizeof(pc->data);
+ return len;
+ }
+
+ start = p;
+
+ ngx_quic_build_int(&p, NGX_QUIC_FT_PATH_CHALLENGE);
+ p = ngx_cpymem(p, &pc->data, sizeof(pc->data));
+
+ return p - start;
+}
+
+
+static size_t
ngx_quic_create_path_response(u_char *p, ngx_quic_path_challenge_frame_t *pc)
{
size_t len;