]> git.kaiwu.me - nginx.git/commitdiff
HTTP/3: separate header files for existing source files.
authorRoman Arutyunyan <arut@nginx.com>
Wed, 5 May 2021 12:09:23 +0000 (15:09 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Wed, 5 May 2021 12:09:23 +0000 (15:09 +0300)
auto/modules
src/http/v3/ngx_http_v3.h
src/http/v3/ngx_http_v3_encode.h [new file with mode: 0644]
src/http/v3/ngx_http_v3_streams.h [new file with mode: 0644]
src/http/v3/ngx_http_v3_tables.h [new file with mode: 0644]

index 95b722d8cbdda263008fa0ed610081531accddc1..464111263e0b9b793acae137810ee194b9879844 100644 (file)
@@ -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 \
index 736d448b5c3e73120b4059ecc0e14d13c1250257..4c25a806ac95e8decbe6362637a15fb6d2f35f65 100644 (file)
 #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 (file)
index 0000000..583c567
--- /dev/null
@@ -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 (file)
index 0000000..c48e642
--- /dev/null
@@ -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 (file)
index 0000000..6cf2475
--- /dev/null
@@ -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_ */