comparison src/http/v3/ngx_http_v3_parse.c @ 8666:ab6aaa8e86b0 quic

HTTP/3: staticize internal parsing functions.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 16 Dec 2020 12:47:41 +0000
parents 5a92523e50d3
children ae2e68f206f9
comparison
equal deleted inserted replaced
8665:96eb6915d244 8666:ab6aaa8e86b0
12 12
13 #define ngx_http_v3_is_v2_frame(type) \ 13 #define ngx_http_v3_is_v2_frame(type) \
14 ((type) == 0x02 || (type) == 0x06 || (type) == 0x08 || (type) == 0x09) 14 ((type) == 0x02 || (type) == 0x06 || (type) == 0x08 || (type) == 0x09)
15 15
16 16
17 static ngx_int_t ngx_http_v3_parse_settings(ngx_connection_t *c,
18 ngx_http_v3_parse_settings_t *st, u_char ch);
19
20 static ngx_int_t ngx_http_v3_parse_varlen_int(ngx_connection_t *c,
21 ngx_http_v3_parse_varlen_int_t *st, u_char ch);
22 static ngx_int_t ngx_http_v3_parse_prefix_int(ngx_connection_t *c,
23 ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, u_char ch);
24
25 static ngx_int_t ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c,
26 ngx_http_v3_parse_header_block_prefix_t *st, u_char ch);
27 static ngx_int_t ngx_http_v3_parse_header_rep(ngx_connection_t *c,
28 ngx_http_v3_parse_header_rep_t *st, ngx_uint_t base, u_char ch);
29 static ngx_int_t ngx_http_v3_parse_literal(ngx_connection_t *c,
30 ngx_http_v3_parse_literal_t *st, u_char ch);
31 static ngx_int_t ngx_http_v3_parse_header_ri(ngx_connection_t *c,
32 ngx_http_v3_parse_header_t *st, u_char ch);
33 static ngx_int_t ngx_http_v3_parse_header_lri(ngx_connection_t *c,
34 ngx_http_v3_parse_header_t *st, u_char ch);
35 static ngx_int_t ngx_http_v3_parse_header_l(ngx_connection_t *c,
36 ngx_http_v3_parse_header_t *st, u_char ch);
37 static ngx_int_t ngx_http_v3_parse_header_pbi(ngx_connection_t *c,
38 ngx_http_v3_parse_header_t *st, u_char ch);
39 static ngx_int_t ngx_http_v3_parse_header_lpbi(ngx_connection_t *c,
40 ngx_http_v3_parse_header_t *st, u_char ch);
41
42 static ngx_int_t ngx_http_v3_parse_header_inr(ngx_connection_t *c,
43 ngx_http_v3_parse_header_t *st, u_char ch);
44 static ngx_int_t ngx_http_v3_parse_header_iwnr(ngx_connection_t *c,
45 ngx_http_v3_parse_header_t *st, u_char ch);
46
17 static ngx_int_t ngx_http_v3_parse_lookup(ngx_connection_t *c, 47 static ngx_int_t ngx_http_v3_parse_lookup(ngx_connection_t *c,
18 ngx_uint_t dynamic, ngx_uint_t index, ngx_str_t *name, ngx_str_t *value); 48 ngx_uint_t dynamic, ngx_uint_t index, ngx_str_t *name, ngx_str_t *value);
19 49
20 50
21 ngx_int_t 51 static ngx_int_t
22 ngx_http_v3_parse_varlen_int(ngx_connection_t *c, 52 ngx_http_v3_parse_varlen_int(ngx_connection_t *c,
23 ngx_http_v3_parse_varlen_int_t *st, u_char ch) 53 ngx_http_v3_parse_varlen_int_t *st, u_char ch)
24 { 54 {
25 enum { 55 enum {
26 sw_start = 0, 56 sw_start = 0,
93 st->state = sw_start; 123 st->state = sw_start;
94 return NGX_DONE; 124 return NGX_DONE;
95 } 125 }
96 126
97 127
98 ngx_int_t 128 static ngx_int_t
99 ngx_http_v3_parse_prefix_int(ngx_connection_t *c, 129 ngx_http_v3_parse_prefix_int(ngx_connection_t *c,
100 ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, u_char ch) 130 ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, u_char ch)
101 { 131 {
102 ngx_uint_t mask; 132 ngx_uint_t mask;
103 enum { 133 enum {
287 st->state = sw_start; 317 st->state = sw_start;
288 return NGX_DONE; 318 return NGX_DONE;
289 } 319 }
290 320
291 321
292 ngx_int_t 322 static ngx_int_t
293 ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c, 323 ngx_http_v3_parse_header_block_prefix(ngx_connection_t *c,
294 ngx_http_v3_parse_header_block_prefix_t *st, u_char ch) 324 ngx_http_v3_parse_header_block_prefix_t *st, u_char ch)
295 { 325 {
296 ngx_int_t rc; 326 ngx_int_t rc;
297 enum { 327 enum {
364 st->state = sw_start; 394 st->state = sw_start;
365 return NGX_DONE; 395 return NGX_DONE;
366 } 396 }
367 397
368 398
369 ngx_int_t 399 static ngx_int_t
370 ngx_http_v3_parse_header_rep(ngx_connection_t *c, 400 ngx_http_v3_parse_header_rep(ngx_connection_t *c,
371 ngx_http_v3_parse_header_rep_t *st, ngx_uint_t base, u_char ch) 401 ngx_http_v3_parse_header_rep_t *st, ngx_uint_t base, u_char ch)
372 { 402 {
373 ngx_int_t rc; 403 ngx_int_t rc;
374 enum { 404 enum {
452 st->state = sw_start; 482 st->state = sw_start;
453 return NGX_DONE; 483 return NGX_DONE;
454 } 484 }
455 485
456 486
457 ngx_int_t 487 static ngx_int_t
458 ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st, 488 ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st,
459 u_char ch) 489 u_char ch)
460 { 490 {
461 ngx_uint_t n; 491 ngx_uint_t n;
462 ngx_http_v3_srv_conf_t *h3scf; 492 ngx_http_v3_srv_conf_t *h3scf;
531 st->state = sw_start; 561 st->state = sw_start;
532 return NGX_DONE; 562 return NGX_DONE;
533 } 563 }
534 564
535 565
536 ngx_int_t 566 static ngx_int_t
537 ngx_http_v3_parse_header_ri(ngx_connection_t *c, ngx_http_v3_parse_header_t *st, 567 ngx_http_v3_parse_header_ri(ngx_connection_t *c, ngx_http_v3_parse_header_t *st,
538 u_char ch) 568 u_char ch)
539 { 569 {
540 ngx_int_t rc; 570 ngx_int_t rc;
541 enum { 571 enum {
586 st->state = sw_start; 616 st->state = sw_start;
587 return NGX_DONE; 617 return NGX_DONE;
588 } 618 }
589 619
590 620
591 ngx_int_t 621 static ngx_int_t
592 ngx_http_v3_parse_header_lri(ngx_connection_t *c, 622 ngx_http_v3_parse_header_lri(ngx_connection_t *c,
593 ngx_http_v3_parse_header_t *st, u_char ch) 623 ngx_http_v3_parse_header_t *st, u_char ch)
594 { 624 {
595 ngx_int_t rc; 625 ngx_int_t rc;
596 enum { 626 enum {
677 st->state = sw_start; 707 st->state = sw_start;
678 return NGX_DONE; 708 return NGX_DONE;
679 } 709 }
680 710
681 711
682 ngx_int_t 712 static ngx_int_t
683 ngx_http_v3_parse_header_l(ngx_connection_t *c, 713 ngx_http_v3_parse_header_l(ngx_connection_t *c,
684 ngx_http_v3_parse_header_t *st, u_char ch) 714 ngx_http_v3_parse_header_t *st, u_char ch)
685 { 715 {
686 ngx_int_t rc; 716 ngx_int_t rc;
687 enum { 717 enum {
775 st->state = sw_start; 805 st->state = sw_start;
776 return NGX_DONE; 806 return NGX_DONE;
777 } 807 }
778 808
779 809
780 ngx_int_t 810 static ngx_int_t
781 ngx_http_v3_parse_header_pbi(ngx_connection_t *c, 811 ngx_http_v3_parse_header_pbi(ngx_connection_t *c,
782 ngx_http_v3_parse_header_t *st, u_char ch) 812 ngx_http_v3_parse_header_t *st, u_char ch)
783 { 813 {
784 ngx_int_t rc; 814 ngx_int_t rc;
785 enum { 815 enum {
824 st->state = sw_start; 854 st->state = sw_start;
825 return NGX_DONE; 855 return NGX_DONE;
826 } 856 }
827 857
828 858
829 ngx_int_t 859 static ngx_int_t
830 ngx_http_v3_parse_header_lpbi(ngx_connection_t *c, 860 ngx_http_v3_parse_header_lpbi(ngx_connection_t *c,
831 ngx_http_v3_parse_header_t *st, u_char ch) 861 ngx_http_v3_parse_header_t *st, u_char ch)
832 { 862 {
833 ngx_int_t rc; 863 ngx_int_t rc;
834 enum { 864 enum {
1116 1146
1117 return NGX_AGAIN; 1147 return NGX_AGAIN;
1118 } 1148 }
1119 1149
1120 1150
1121 ngx_int_t 1151 static ngx_int_t
1122 ngx_http_v3_parse_settings(ngx_connection_t *c, 1152 ngx_http_v3_parse_settings(ngx_connection_t *c,
1123 ngx_http_v3_parse_settings_t *st, u_char ch) 1153 ngx_http_v3_parse_settings_t *st, u_char ch)
1124 { 1154 {
1125 ngx_int_t rc; 1155 ngx_int_t rc;
1126 enum { 1156 enum {
1275 st->state = sw_start; 1305 st->state = sw_start;
1276 return NGX_AGAIN; 1306 return NGX_AGAIN;
1277 } 1307 }
1278 1308
1279 1309
1280 ngx_int_t 1310 static ngx_int_t
1281 ngx_http_v3_parse_header_inr(ngx_connection_t *c, 1311 ngx_http_v3_parse_header_inr(ngx_connection_t *c,
1282 ngx_http_v3_parse_header_t *st, u_char ch) 1312 ngx_http_v3_parse_header_t *st, u_char ch)
1283 { 1313 {
1284 ngx_int_t rc; 1314 ngx_int_t rc;
1285 enum { 1315 enum {
1362 st->state = sw_start; 1392 st->state = sw_start;
1363 return NGX_DONE; 1393 return NGX_DONE;
1364 } 1394 }
1365 1395
1366 1396
1367 ngx_int_t 1397 static ngx_int_t
1368 ngx_http_v3_parse_header_iwnr(ngx_connection_t *c, 1398 ngx_http_v3_parse_header_iwnr(ngx_connection_t *c,
1369 ngx_http_v3_parse_header_t *st, u_char ch) 1399 ngx_http_v3_parse_header_t *st, u_char ch)
1370 { 1400 {
1371 ngx_int_t rc; 1401 ngx_int_t rc;
1372 enum { 1402 enum {