aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2021-05-05 15:09:23 +0300
committerRoman Arutyunyan <arut@nginx.com>2021-05-05 15:09:23 +0300
commitde75c7e3e21822a909391a4b3ccaac7914c8641d (patch)
tree2f4b303772404825d69aff3bdf7a773f31a88cf6
parent32f98ecbb13acc9c22db4dd7e9bec20eb30b945a (diff)
downloadnginx-de75c7e3e21822a909391a4b3ccaac7914c8641d.tar.gz
nginx-de75c7e3e21822a909391a4b3ccaac7914c8641d.zip
HTTP/3: separate header files for existing source files.
-rw-r--r--auto/modules5
-rw-r--r--src/http/v3/ngx_http_v3.h80
-rw-r--r--src/http/v3/ngx_http_v3_encode.h34
-rw-r--r--src/http/v3/ngx_http_v3_streams.h43
-rw-r--r--src/http/v3/ngx_http_v3_tables.h52
5 files changed, 139 insertions, 75 deletions
diff --git a/auto/modules b/auto/modules
index 95b722d8c..464111263 100644
--- a/auto/modules
+++ b/auto/modules
@@ -427,7 +427,10 @@ if [ $HTTP = YES ]; then
ngx_module_name=ngx_http_v3_module
ngx_module_incs=src/http/v3
ngx_module_deps="src/http/v3/ngx_http_v3.h \
- src/http/v3/ngx_http_v3_parse.h"
+ src/http/v3/ngx_http_v3_encode.h \
+ src/http/v3/ngx_http_v3_parse.h \
+ src/http/v3/ngx_http_v3_tables.h \
+ src/http/v3/ngx_http_v3_streams.h"
ngx_module_srcs="src/http/v3/ngx_http_v3_encode.c \
src/http/v3/ngx_http_v3_parse.c \
src/http/v3/ngx_http_v3_tables.c \
diff --git a/src/http/v3/ngx_http_v3.h b/src/http/v3/ngx_http_v3.h
index 736d448b5..4c25a806a 100644
--- a/src/http/v3/ngx_http_v3.h
+++ b/src/http/v3/ngx_http_v3.h
@@ -12,7 +12,11 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
+
#include <ngx_http_v3_parse.h>
+#include <ngx_http_v3_encode.h>
+#include <ngx_http_v3_streams.h>
+#include <ngx_http_v3_tables.h>
#define NGX_HTTP_V3_ALPN_ADVERTISE "\x02h3"
@@ -112,21 +116,6 @@ struct ngx_http_v3_parse_s {
};
-typedef struct {
- ngx_str_t name;
- ngx_str_t value;
-} ngx_http_v3_header_t;
-
-
-typedef struct {
- ngx_http_v3_header_t **elts;
- ngx_uint_t nelts;
- ngx_uint_t base;
- size_t size;
- size_t capacity;
-} ngx_http_v3_dynamic_table_t;
-
-
struct ngx_http_v3_session_s {
ngx_http_v3_dynamic_table_t table;
@@ -148,68 +137,11 @@ struct ngx_http_v3_session_s {
void ngx_http_v3_init(ngx_connection_t *c);
+ngx_int_t ngx_http_v3_init_session(ngx_connection_t *c);
+
ngx_int_t ngx_http_v3_read_request_body(ngx_http_request_t *r);
ngx_int_t ngx_http_v3_read_unbuffered_request_body(ngx_http_request_t *r);
-uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value);
-uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value,
- ngx_uint_t prefix);
-
-uintptr_t ngx_http_v3_encode_header_block_prefix(u_char *p,
- ngx_uint_t insert_count, ngx_uint_t sign, ngx_uint_t delta_base);
-uintptr_t ngx_http_v3_encode_header_ri(u_char *p, ngx_uint_t dynamic,
- ngx_uint_t index);
-uintptr_t ngx_http_v3_encode_header_lri(u_char *p, ngx_uint_t dynamic,
- ngx_uint_t index, u_char *data, size_t len);
-uintptr_t ngx_http_v3_encode_header_l(u_char *p, ngx_str_t *name,
- ngx_str_t *value);
-uintptr_t ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index);
-uintptr_t ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index,
- u_char *data, size_t len);
-
-ngx_int_t ngx_http_v3_init_session(ngx_connection_t *c);
-void ngx_http_v3_init_uni_stream(ngx_connection_t *c);
-ngx_int_t ngx_http_v3_register_uni_stream(ngx_connection_t *c, uint64_t type);
-ngx_connection_t *ngx_http_v3_create_push_stream(ngx_connection_t *c,
- uint64_t push_id);
-ngx_int_t ngx_http_v3_send_goaway(ngx_connection_t *c, uint64_t id);
-ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
- ngx_uint_t index, ngx_str_t *value);
-ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name,
- ngx_str_t *value);
-ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity);
-ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index);
-ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id);
-ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id);
-ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc);
-ngx_int_t ngx_http_v3_lookup_static(ngx_connection_t *c, ngx_uint_t index,
- ngx_str_t *name, ngx_str_t *value);
-ngx_int_t ngx_http_v3_lookup(ngx_connection_t *c, ngx_uint_t index,
- ngx_str_t *name, ngx_str_t *value);
-ngx_int_t ngx_http_v3_decode_insert_count(ngx_connection_t *c,
- ngx_uint_t *insert_count);
-ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c,
- ngx_uint_t insert_count);
-ngx_int_t ngx_http_v3_set_param(ngx_connection_t *c, uint64_t id,
- uint64_t value);
-ngx_int_t ngx_http_v3_set_max_push_id(ngx_connection_t *c,
- uint64_t max_push_id);
-ngx_int_t ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id);
-
-ngx_int_t ngx_http_v3_send_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
- ngx_uint_t index, ngx_str_t *value);
-ngx_int_t ngx_http_v3_send_insert(ngx_connection_t *c, ngx_str_t *name,
- ngx_str_t *value);
-ngx_int_t ngx_http_v3_send_set_capacity(ngx_connection_t *c,
- ngx_uint_t capacity);
-ngx_int_t ngx_http_v3_send_duplicate(ngx_connection_t *c, ngx_uint_t index);
-ngx_int_t ngx_http_v3_send_ack_header(ngx_connection_t *c,
- ngx_uint_t stream_id);
-ngx_int_t ngx_http_v3_send_cancel_stream(ngx_connection_t *c,
- ngx_uint_t stream_id);
-ngx_int_t ngx_http_v3_send_inc_insert_count(ngx_connection_t *c,
- ngx_uint_t inc);
-
extern ngx_module_t ngx_http_v3_module;
diff --git a/src/http/v3/ngx_http_v3_encode.h b/src/http/v3/ngx_http_v3_encode.h
new file mode 100644
index 000000000..583c5675b
--- /dev/null
+++ b/src/http/v3/ngx_http_v3_encode.h
@@ -0,0 +1,34 @@
+
+/*
+ * Copyright (C) Roman Arutyunyan
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_HTTP_V3_ENCODE_H_INCLUDED_
+#define _NGX_HTTP_V3_ENCODE_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_http.h>
+
+
+uintptr_t ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value);
+uintptr_t ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value,
+ ngx_uint_t prefix);
+
+uintptr_t ngx_http_v3_encode_header_block_prefix(u_char *p,
+ ngx_uint_t insert_count, ngx_uint_t sign, ngx_uint_t delta_base);
+uintptr_t ngx_http_v3_encode_header_ri(u_char *p, ngx_uint_t dynamic,
+ ngx_uint_t index);
+uintptr_t ngx_http_v3_encode_header_lri(u_char *p, ngx_uint_t dynamic,
+ ngx_uint_t index, u_char *data, size_t len);
+uintptr_t ngx_http_v3_encode_header_l(u_char *p, ngx_str_t *name,
+ ngx_str_t *value);
+uintptr_t ngx_http_v3_encode_header_pbi(u_char *p, ngx_uint_t index);
+uintptr_t ngx_http_v3_encode_header_lpbi(u_char *p, ngx_uint_t index,
+ u_char *data, size_t len);
+
+
+#endif /* _NGX_HTTP_V3_ENCODE_H_INCLUDED_ */
diff --git a/src/http/v3/ngx_http_v3_streams.h b/src/http/v3/ngx_http_v3_streams.h
new file mode 100644
index 000000000..c48e6425c
--- /dev/null
+++ b/src/http/v3/ngx_http_v3_streams.h
@@ -0,0 +1,43 @@
+
+/*
+ * Copyright (C) Roman Arutyunyan
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_HTTP_V3_STREAMS_H_INCLUDED_
+#define _NGX_HTTP_V3_STREAMS_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_http.h>
+
+
+void ngx_http_v3_init_uni_stream(ngx_connection_t *c);
+ngx_int_t ngx_http_v3_register_uni_stream(ngx_connection_t *c, uint64_t type);
+
+ngx_connection_t *ngx_http_v3_create_push_stream(ngx_connection_t *c,
+ uint64_t push_id);
+ngx_int_t ngx_http_v3_set_max_push_id(ngx_connection_t *c,
+ uint64_t max_push_id);
+ngx_int_t ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id);
+ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id);
+
+ngx_int_t ngx_http_v3_send_goaway(ngx_connection_t *c, uint64_t id);
+ngx_int_t ngx_http_v3_send_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
+ ngx_uint_t index, ngx_str_t *value);
+ngx_int_t ngx_http_v3_send_insert(ngx_connection_t *c, ngx_str_t *name,
+ ngx_str_t *value);
+ngx_int_t ngx_http_v3_send_set_capacity(ngx_connection_t *c,
+ ngx_uint_t capacity);
+ngx_int_t ngx_http_v3_send_duplicate(ngx_connection_t *c, ngx_uint_t index);
+ngx_int_t ngx_http_v3_send_ack_header(ngx_connection_t *c,
+ ngx_uint_t stream_id);
+ngx_int_t ngx_http_v3_send_cancel_stream(ngx_connection_t *c,
+ ngx_uint_t stream_id);
+ngx_int_t ngx_http_v3_send_inc_insert_count(ngx_connection_t *c,
+ ngx_uint_t inc);
+
+
+#endif /* _NGX_HTTP_V3_STREAMS_H_INCLUDED_ */
diff --git a/src/http/v3/ngx_http_v3_tables.h b/src/http/v3/ngx_http_v3_tables.h
new file mode 100644
index 000000000..6cf247541
--- /dev/null
+++ b/src/http/v3/ngx_http_v3_tables.h
@@ -0,0 +1,52 @@
+
+/*
+ * Copyright (C) Roman Arutyunyan
+ * Copyright (C) Nginx, Inc.
+ */
+
+
+#ifndef _NGX_HTTP_V3_TABLES_H_INCLUDED_
+#define _NGX_HTTP_V3_TABLES_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+#include <ngx_http.h>
+
+
+typedef struct {
+ ngx_str_t name;
+ ngx_str_t value;
+} ngx_http_v3_header_t;
+
+
+typedef struct {
+ ngx_http_v3_header_t **elts;
+ ngx_uint_t nelts;
+ ngx_uint_t base;
+ size_t size;
+ size_t capacity;
+} ngx_http_v3_dynamic_table_t;
+
+
+ngx_int_t ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
+ ngx_uint_t index, ngx_str_t *value);
+ngx_int_t ngx_http_v3_insert(ngx_connection_t *c, ngx_str_t *name,
+ ngx_str_t *value);
+ngx_int_t ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity);
+ngx_int_t ngx_http_v3_duplicate(ngx_connection_t *c, ngx_uint_t index);
+ngx_int_t ngx_http_v3_ack_header(ngx_connection_t *c, ngx_uint_t stream_id);
+ngx_int_t ngx_http_v3_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc);
+ngx_int_t ngx_http_v3_lookup_static(ngx_connection_t *c, ngx_uint_t index,
+ ngx_str_t *name, ngx_str_t *value);
+ngx_int_t ngx_http_v3_lookup(ngx_connection_t *c, ngx_uint_t index,
+ ngx_str_t *name, ngx_str_t *value);
+ngx_int_t ngx_http_v3_decode_insert_count(ngx_connection_t *c,
+ ngx_uint_t *insert_count);
+ngx_int_t ngx_http_v3_check_insert_count(ngx_connection_t *c,
+ ngx_uint_t insert_count);
+ngx_int_t ngx_http_v3_set_param(ngx_connection_t *c, uint64_t id,
+ uint64_t value);
+
+
+#endif /* _NGX_HTTP_V3_TABLES_H_INCLUDED_ */