Mercurial > hg > nginx
comparison src/event/ngx_event_quic_transport.c @ 8384:52d0c4832570 quic
Address validation using NEW_TOKEN frame.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 14 May 2020 15:47:24 +0300 |
parents | 7ea34e13937f |
children | fb7422074258 |
comparison
equal
deleted
inserted
replaced
8383:7ea34e13937f | 8384:52d0c4832570 |
---|---|
70 ngx_uint_t frame_type); | 70 ngx_uint_t frame_type); |
71 static size_t ngx_quic_create_ack(u_char *p, ngx_quic_ack_frame_t *ack); | 71 static size_t ngx_quic_create_ack(u_char *p, ngx_quic_ack_frame_t *ack); |
72 static size_t ngx_quic_create_crypto(u_char *p, | 72 static size_t ngx_quic_create_crypto(u_char *p, |
73 ngx_quic_crypto_frame_t *crypto); | 73 ngx_quic_crypto_frame_t *crypto); |
74 static size_t ngx_quic_create_hs_done(u_char *p); | 74 static size_t ngx_quic_create_hs_done(u_char *p); |
75 static size_t ngx_quic_create_new_token(u_char *p, | |
76 ngx_quic_new_token_frame_t *token); | |
75 static size_t ngx_quic_create_stream(u_char *p, ngx_quic_stream_frame_t *sf); | 77 static size_t ngx_quic_create_stream(u_char *p, ngx_quic_stream_frame_t *sf); |
76 static size_t ngx_quic_create_max_streams(u_char *p, | 78 static size_t ngx_quic_create_max_streams(u_char *p, |
77 ngx_quic_max_streams_frame_t *ms); | 79 ngx_quic_max_streams_frame_t *ms); |
78 static size_t ngx_quic_create_max_stream_data(u_char *p, | 80 static size_t ngx_quic_create_max_stream_data(u_char *p, |
79 ngx_quic_max_stream_data_frame_t *ms); | 81 ngx_quic_max_stream_data_frame_t *ms); |
1126 return ngx_quic_create_crypto(p, &f->u.crypto); | 1128 return ngx_quic_create_crypto(p, &f->u.crypto); |
1127 | 1129 |
1128 case NGX_QUIC_FT_HANDSHAKE_DONE: | 1130 case NGX_QUIC_FT_HANDSHAKE_DONE: |
1129 return ngx_quic_create_hs_done(p); | 1131 return ngx_quic_create_hs_done(p); |
1130 | 1132 |
1133 case NGX_QUIC_FT_NEW_TOKEN: | |
1134 return ngx_quic_create_new_token(p, &f->u.token); | |
1135 | |
1131 case NGX_QUIC_FT_STREAM0: | 1136 case NGX_QUIC_FT_STREAM0: |
1132 case NGX_QUIC_FT_STREAM1: | 1137 case NGX_QUIC_FT_STREAM1: |
1133 case NGX_QUIC_FT_STREAM2: | 1138 case NGX_QUIC_FT_STREAM2: |
1134 case NGX_QUIC_FT_STREAM3: | 1139 case NGX_QUIC_FT_STREAM3: |
1135 case NGX_QUIC_FT_STREAM4: | 1140 case NGX_QUIC_FT_STREAM4: |
1224 } | 1229 } |
1225 | 1230 |
1226 start = p; | 1231 start = p; |
1227 | 1232 |
1228 ngx_quic_build_int(&p, NGX_QUIC_FT_HANDSHAKE_DONE); | 1233 ngx_quic_build_int(&p, NGX_QUIC_FT_HANDSHAKE_DONE); |
1234 | |
1235 return p - start; | |
1236 } | |
1237 | |
1238 | |
1239 static size_t | |
1240 ngx_quic_create_new_token(u_char *p, ngx_quic_new_token_frame_t *token) | |
1241 { | |
1242 size_t len; | |
1243 u_char *start; | |
1244 | |
1245 if (p == NULL) { | |
1246 len = ngx_quic_varint_len(NGX_QUIC_FT_NEW_TOKEN); | |
1247 len += ngx_quic_varint_len(token->length); | |
1248 len += token->length; | |
1249 | |
1250 return len; | |
1251 } | |
1252 | |
1253 start = p; | |
1254 | |
1255 ngx_quic_build_int(&p, NGX_QUIC_FT_NEW_TOKEN); | |
1256 ngx_quic_build_int(&p, token->length); | |
1257 p = ngx_cpymem(p, token->data, token->length); | |
1229 | 1258 |
1230 return p - start; | 1259 return p - start; |
1231 } | 1260 } |
1232 | 1261 |
1233 | 1262 |