changeset 8755:b4e6b7049984 quic

QUIC: normalize header inclusion. Stop including QUIC headers with no user-serviceable parts inside. This allows to provide a much cleaner QUIC interface. To cope with that, ngx_quic_derive_key() is now explicitly exported for v3 and quic modules. Additionally, this completely hides the ngx_quic_keys_t internal type.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 13 Apr 2021 12:38:34 +0300
parents 915c2f7092ed
children e29b7508b8b3
files src/event/quic/ngx_event_quic.h src/event/quic/ngx_event_quic_connection.h src/event/quic/ngx_event_quic_protection.c src/event/quic/ngx_event_quic_protection.h src/event/quic/ngx_event_quic_streams.c src/event/quic/ngx_event_quic_tokens.c src/event/quic/ngx_event_quic_transport.c src/http/modules/ngx_http_quic_module.c src/stream/ngx_stream_quic_module.c
diffstat 9 files changed, 9 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic.h
+++ b/src/event/quic/ngx_event_quic.h
@@ -85,9 +85,6 @@ struct ngx_quic_stream_s {
 };
 
 
-typedef struct ngx_quic_keys_s  ngx_quic_keys_t;
-
-
 void ngx_quic_run(ngx_connection_t *c, ngx_quic_conf_t *conf);
 ngx_connection_t *ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi);
 void ngx_quic_finalize_connection(ngx_connection_t *c, ngx_uint_t err,
@@ -98,5 +95,7 @@ ngx_int_t ngx_quic_reset_stream(ngx_conn
 uint32_t ngx_quic_version(ngx_connection_t *c);
 ngx_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len,
     ngx_str_t *dcid);
+ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label,
+    ngx_str_t *secret, ngx_str_t *salt, u_char *out, size_t len);
 
 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */
--- a/src/event/quic/ngx_event_quic_connection.h
+++ b/src/event/quic/ngx_event_quic_connection.h
@@ -11,12 +11,12 @@
 #include <ngx_core.h>
 #include <ngx_event.h>
 
+typedef struct ngx_quic_connection_s  ngx_quic_connection_t;
+typedef struct ngx_quic_send_ctx_s    ngx_quic_send_ctx_t;
+typedef struct ngx_quic_keys_s        ngx_quic_keys_t;
+
 #include <ngx_event_quic_transport.h>
 #include <ngx_event_quic_protection.h>
-
-typedef struct ngx_quic_connection_s  ngx_quic_connection_t;
-typedef struct ngx_quic_send_ctx_s    ngx_quic_send_ctx_t;
-
 #include <ngx_event_quic_frames.h>
 #include <ngx_event_quic_migration.h>
 #include <ngx_event_quic_connid.h>
--- a/src/event/quic/ngx_event_quic_protection.c
+++ b/src/event/quic/ngx_event_quic_protection.c
@@ -7,8 +7,7 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_event.h>
-#include <ngx_event_quic_transport.h>
-#include <ngx_event_quic_protection.h>
+#include <ngx_event_quic_connection.h>
 
 
 #define NGX_QUIC_IV_LEN               12
--- a/src/event/quic/ngx_event_quic_protection.h
+++ b/src/event/quic/ngx_event_quic_protection.h
@@ -29,8 +29,6 @@ void ngx_quic_keys_discard(ngx_quic_keys
     enum ssl_encryption_level_t level);
 void ngx_quic_keys_switch(ngx_connection_t *c, ngx_quic_keys_t *keys);
 ngx_int_t ngx_quic_keys_update(ngx_connection_t *c, ngx_quic_keys_t *keys);
-ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label,
-    ngx_str_t *secret, ngx_str_t *salt, u_char *out, size_t len);
 ngx_int_t ngx_quic_encrypt(ngx_quic_header_t *pkt, ngx_str_t *res);
 ngx_int_t ngx_quic_decrypt(ngx_quic_header_t *pkt, uint64_t *largest_pn);
 
--- a/src/event/quic/ngx_event_quic_streams.c
+++ b/src/event/quic/ngx_event_quic_streams.c
@@ -7,9 +7,7 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_event.h>
-#include <ngx_event_quic_transport.h>
 #include <ngx_event_quic_connection.h>
-#include <ngx_event_quic_streams.h>
 
 
 #define NGX_QUIC_STREAM_GONE     (void *) -1
--- a/src/event/quic/ngx_event_quic_tokens.c
+++ b/src/event/quic/ngx_event_quic_tokens.c
@@ -8,7 +8,7 @@
 #include <ngx_core.h>
 #include <ngx_event.h>
 #include <ngx_sha1.h>
-#include <ngx_event_quic_protection.h>
+#include <ngx_event_quic_connection.h>
 
 
 #define NGX_QUIC_MAX_TOKEN_SIZE              64
--- a/src/event/quic/ngx_event_quic_transport.c
+++ b/src/event/quic/ngx_event_quic_transport.c
@@ -7,7 +7,7 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_event.h>
-#include <ngx_event_quic_transport.h>
+#include <ngx_event_quic_connection.h>
 
 
 #define NGX_QUIC_LONG_DCID_LEN_OFFSET  5
--- a/src/http/modules/ngx_http_quic_module.c
+++ b/src/http/modules/ngx_http_quic_module.c
@@ -9,8 +9,6 @@
 #include <ngx_core.h>
 #include <ngx_http.h>
 
-#include <ngx_event_quic_protection.h>
-
 
 static ngx_int_t ngx_http_variable_quic(ngx_http_request_t *r,
     ngx_http_variable_value_t *v, uintptr_t data);
--- a/src/stream/ngx_stream_quic_module.c
+++ b/src/stream/ngx_stream_quic_module.c
@@ -9,8 +9,6 @@
 #include <ngx_core.h>
 #include <ngx_stream.h>
 
-#include <ngx_event_quic_protection.h>
-
 
 static ngx_int_t ngx_stream_variable_quic(ngx_stream_session_t *s,
     ngx_stream_variable_value_t *v, uintptr_t data);