]> git.kaiwu.me - nginx.git/commitdiff
QUIC: headers cleanup.
authorVladimir Homutov <vl@nginx.com>
Wed, 14 Apr 2021 11:47:37 +0000 (14:47 +0300)
committerVladimir Homutov <vl@nginx.com>
Wed, 14 Apr 2021 11:47:37 +0000 (14:47 +0300)
The "ngx_event_quic.h" header file now contains only public definitions,
used by modules.  All internal definitions are moved into
the "ngx_event_quic_connection.h" header file.

README
src/event/quic/ngx_event_quic.c
src/event/quic/ngx_event_quic.h
src/event/quic/ngx_event_quic_connection.h
src/event/quic/ngx_event_quic_migration.c
src/event/quic/ngx_event_quic_migration.h
src/event/quic/ngx_event_quic_transport.h

diff --git a/README b/README
index 8804638362504e9f0cb9a206fabccb2aa6d0bb24..e82bb9a825ecd90e42883dd98d202d94cb9732e9 100644 (file)
--- a/README
+++ b/README
@@ -229,7 +229,7 @@ Example configuration:
       be easily filtered out.
 
     + If you want to investigate deeper, you may want to enable
-      additional debugging in src/event/ngx_event_quic.h:
+      additional debugging in src/event/ngx_event_quic_connection.h:
 
         #define NGX_QUIC_DEBUG_PACKETS
         #define NGX_QUIC_DEBUG_FRAMES
index 771837a57889991722fd05df76378392741316e3..ae16fe16649826a43d6ca8551a5cab87d3435fcb 100644 (file)
@@ -7,11 +7,8 @@
 #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>
-#include <ngx_event_quic_migration.h>
 #include <ngx_sha1.h>
+#include <ngx_event_quic_connection.h>
 
 
 #define ngx_quic_lost_threshold(qc)                                           \
index 865e5f08c44a0d1c6728e56499f8f84a6e018c9c..0066c96e6a8de4a2a20adbe0ee8b29485079af03 100644 (file)
 #define NGX_QUIC_DRAFT_VERSION               29
 #endif
 
-#define NGX_QUIC_MAX_SHORT_HEADER            25 /* 1 flags + 20 dcid + 4 pn */
-#define NGX_QUIC_MAX_LONG_HEADER             56
-    /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */
-
 #define NGX_QUIC_MAX_UDP_PAYLOAD_SIZE        65527
-#define NGX_QUIC_MAX_UDP_PAYLOAD_OUT         1252
-#define NGX_QUIC_MAX_UDP_PAYLOAD_OUT6        1232
 
 #define NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT  3
 #define NGX_QUIC_DEFAULT_MAX_ACK_DELAY       25
 #define NGX_QUIC_SR_KEY_LEN                  32
 #define NGX_QUIC_AV_KEY_LEN                  32
 
-#define NGX_QUIC_RETRY_TOKEN_LIFETIME          3 /* seconds */
-#define NGX_QUIC_NEW_TOKEN_LIFETIME          600 /* seconds */
-#define NGX_QUIC_RETRY_BUFFER_SIZE           256
-    /* 1 flags + 4 version + 3 x (1 + 20) s/o/dcid + itag + token(64) */
-#define NGX_QUIC_MAX_TOKEN_SIZE              64
-    /* SHA-1(addr)=20 + sizeof(time_t) + retry(1) + odcid.len(1) + odcid */
-
-/* quic-recovery, section 6.2.2, kInitialRtt */
-#define NGX_QUIC_INITIAL_RTT                 333 /* ms */
-
-/* quic-recovery, section 6.1.1, Packet Threshold */
-#define NGX_QUIC_PKT_THR                     3 /* packets */
-/* quic-recovery, section 6.1.2, Time Threshold */
-#define NGX_QUIC_TIME_THR                    1.125
-#define NGX_QUIC_TIME_GRANULARITY            1 /* ms */
-
-#define NGX_QUIC_CC_MIN_INTERVAL             1000 /* 1s */
+#define NGX_QUIC_SR_TOKEN_LEN                16
 
 #define NGX_QUIC_MIN_INITIAL_SIZE            1200
 
 
 #define NGX_QUIC_STREAM_BUFSIZE              65536
 
-#define NGX_QUIC_MAX_CID_LEN                 20
-#define NGX_QUIC_SERVER_CID_LEN              NGX_QUIC_MAX_CID_LEN
-
-#define NGX_QUIC_SR_TOKEN_LEN                16
-
-#define NGX_QUIC_MAX_SERVER_IDS              8
-
-#define NGX_QUIC_BUFFER_SIZE                 4096
-
-#define ngx_quic_get_connection(c)                                            \
-    (((c)->udp) ? (((ngx_quic_server_id_t *)((c)->udp))->quic) : NULL)
-
 
 typedef struct {
     /* configurable */
@@ -139,12 +105,4 @@ 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);
 
-
-/********************************* DEBUG *************************************/
-
-/* #define NGX_QUIC_DEBUG_PACKETS */      /* dump packet contents */
-/* #define NGX_QUIC_DEBUG_FRAMES */       /* dump frames contents */
-/* #define NGX_QUIC_DEBUG_ALLOC */        /* log frames and bufs alloc */
-/* #define NGX_QUIC_DEBUG_CRYPTO */
-
 #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */
index acbec5133504b173e221b4c7185ad9369fcdd044..0c31aa6a05bf06ab1754eb7a86a29ad7bf6a3615 100644 (file)
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_event.h>
+
 #include <ngx_event_quic_transport.h>
 #include <ngx_event_quic_protection.h>
 
+typedef struct ngx_quic_connection_s  ngx_quic_connection_t;
+
+#include <ngx_event_quic_migration.h>
 
-#define NGX_QUIC_SEND_CTX_LAST  (NGX_QUIC_ENCRYPTION_LAST - 1)
 
+#define NGX_QUIC_MAX_SHORT_HEADER            25 /* 1 flags + 20 dcid + 4 pn */
+#define NGX_QUIC_MAX_LONG_HEADER             56
+    /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */
 
-typedef struct ngx_quic_connection_s  ngx_quic_connection_t;
+#define NGX_QUIC_MAX_UDP_PAYLOAD_OUT         1252
+#define NGX_QUIC_MAX_UDP_PAYLOAD_OUT6        1232
+
+#define NGX_QUIC_RETRY_TOKEN_LIFETIME          3 /* seconds */
+#define NGX_QUIC_NEW_TOKEN_LIFETIME          600 /* seconds */
+#define NGX_QUIC_RETRY_BUFFER_SIZE           256
+    /* 1 flags + 4 version + 3 x (1 + 20) s/o/dcid + itag + token(64) */
+#define NGX_QUIC_MAX_TOKEN_SIZE              64
+    /* SHA-1(addr)=20 + sizeof(time_t) + retry(1) + odcid.len(1) + odcid */
+
+/* quic-recovery, section 6.2.2, kInitialRtt */
+#define NGX_QUIC_INITIAL_RTT                 333 /* ms */
+
+/* quic-recovery, section 6.1.1, Packet Threshold */
+#define NGX_QUIC_PKT_THR                     3 /* packets */
+/* quic-recovery, section 6.1.2, Time Threshold */
+#define NGX_QUIC_TIME_THR                    1.125
+#define NGX_QUIC_TIME_GRANULARITY            1 /* ms */
+
+#define NGX_QUIC_CC_MIN_INTERVAL             1000 /* 1s */
+
+#define NGX_QUIC_MAX_SERVER_IDS              8
+
+#define NGX_QUIC_BUFFER_SIZE                 4096
+
+#define NGX_QUIC_SEND_CTX_LAST               (NGX_QUIC_ENCRYPTION_LAST - 1)
 
 /*  0-RTT and 1-RTT data exist in the same packet number space,
  *  so we have 3 packet number spaces:
@@ -31,6 +62,9 @@ typedef struct ngx_quic_connection_s  ngx_quic_connection_t;
         : (((level) == ssl_encryption_handshake) ? &((qc)->send_ctx[1])       \
                                                  : &((qc)->send_ctx[2]))
 
+#define ngx_quic_get_connection(c)                                            \
+    (((c)->udp) ? (((ngx_quic_server_id_t *)((c)->udp))->quic) : NULL)
+
 
 typedef struct {
     ngx_queue_t                       queue;
@@ -189,4 +223,11 @@ void ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame);
 void ngx_quic_close_connection(ngx_connection_t *c, ngx_int_t rc);
 ngx_msec_t ngx_quic_pto(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx);
 
-#endif
+/********************************* DEBUG *************************************/
+
+/* #define NGX_QUIC_DEBUG_PACKETS */      /* dump packet contents */
+/* #define NGX_QUIC_DEBUG_FRAMES */       /* dump frames contents */
+/* #define NGX_QUIC_DEBUG_ALLOC */        /* log frames and bufs alloc */
+/* #define NGX_QUIC_DEBUG_CRYPTO */
+
+#endif /* _NGX_EVENT_QUIC_CONNECTION_H_INCLUDED_ */
index de3d6885dbe8debe37dd15468838fd9bc6cc73d5..2adf9d4e7aa128b156a7b90342a6bfe39090cb15 100644 (file)
@@ -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_migration.h>
 
 
 ngx_int_t
index 3231b7e3bfa09e0e11ecb1409c47865a39f7fdb8..5f27c278d82713fc066e034e9d6f3edad3df66ec 100644 (file)
@@ -17,4 +17,4 @@ ngx_int_t ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
 ngx_int_t ngx_quic_handle_path_response_frame(ngx_connection_t *c,
     ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f);
 
-#endif
+#endif /* _NGX_EVENT_QUIC_MIGRATION_H_INCLUDED_ */
index 415bbc75cabbd1f4836504bb58dbe7e408552022..2cda8088fabf498a0c14545d732a1ead00c2cfdc 100644 (file)
@@ -47,6 +47,8 @@
         : (lvl == ssl_encryption_initial) ? "init"                            \
             : (lvl == ssl_encryption_handshake) ? "hs" : "early"
 
+#define NGX_QUIC_MAX_CID_LEN                             20
+#define NGX_QUIC_SERVER_CID_LEN                          NGX_QUIC_MAX_CID_LEN
 
 /* 12.4.  Frames and Frame Types */
 #define NGX_QUIC_FT_PADDING                              0x00