From 02cd3aa871416575d72ccdbceb55abac45bb21f4 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Sun, 24 Mar 2019 19:18:29 +0900
Subject: [PATCH] Start draft-19 development

---
 examples/client.cc           |  8 ++++----
 examples/server.cc           | 12 ++++++------
 lib/includes/ngtcp2/ngtcp2.h |  8 ++++----
 lib/ngtcp2_conn.c            |  2 +-
 tests/ngtcp2_pkt_test.c      |  2 +-
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/examples/client.cc b/examples/client.cc
index 6b55190e..6f6f5fad 100644
--- a/examples/client.cc
+++ b/examples/client.cc
@@ -832,9 +832,9 @@ int Client::init_ssl() {
   size_t alpnlen;
 
   switch (version_) {
-  case NGTCP2_PROTO_VER_D18:
-    alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_D18);
-    alpnlen = str_size(NGTCP2_ALPN_D18);
+  case NGTCP2_PROTO_VER_D19:
+    alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_D19);
+    alpnlen = str_size(NGTCP2_ALPN_D19);
     break;
   }
   if (alpn) {
@@ -2526,7 +2526,7 @@ void config_set_default(Config &config) {
   config.nstreams = 1;
   config.data = nullptr;
   config.datalen = 0;
-  config.version = NGTCP2_PROTO_VER_D18;
+  config.version = NGTCP2_PROTO_VER_D19;
   config.timeout = 30;
 }
 } // namespace
diff --git a/examples/server.cc b/examples/server.cc
index b3998f0f..67aa4dae 100644
--- a/examples/server.cc
+++ b/examples/server.cc
@@ -2469,7 +2469,7 @@ int Server::send_version_negotiation(const ngtcp2_pkt_hd *chd, Endpoint &ep,
   std::array<uint32_t, 2> sv;
 
   sv[0] = generate_reserved_version(sa, salen, chd->version);
-  sv[1] = NGTCP2_PROTO_VER_D18;
+  sv[1] = NGTCP2_PROTO_VER_D19;
 
   auto nwrite = ngtcp2_pkt_write_version_negotiation(
       buf.wpos(), buf.left(),
@@ -2830,9 +2830,9 @@ int alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
   auto version = ngtcp2_conn_get_negotiated_version(h->conn());
 
   switch (version) {
-  case NGTCP2_PROTO_VER_D18:
-    alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_D18);
-    alpnlen = str_size(NGTCP2_ALPN_D18);
+  case NGTCP2_PROTO_VER_D19:
+    alpn = reinterpret_cast<const uint8_t *>(NGTCP2_ALPN_D19);
+    alpnlen = str_size(NGTCP2_ALPN_D19);
     break;
   default:
     if (!config.quiet) {
@@ -2854,7 +2854,7 @@ int alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
   *outlen = alpn[0];
 
   if (!config.quiet) {
-    std::cerr << "Client did not present ALPN " << NGTCP2_ALPN_D18 + 1
+    std::cerr << "Client did not present ALPN " << NGTCP2_ALPN_D19 + 1
               << std::endl;
   }
 
@@ -2881,7 +2881,7 @@ int transport_params_add_cb(SSL *ssl, unsigned int ext_type,
   }
 
   params.v.ee.len = 1;
-  params.v.ee.supported_versions[0] = NGTCP2_PROTO_VER_D18;
+  params.v.ee.supported_versions[0] = NGTCP2_PROTO_VER_D19;
 
   constexpr size_t bufsize = 512;
   auto buf = std::make_unique<uint8_t[]>(bufsize);
diff --git a/lib/includes/ngtcp2/ngtcp2.h b/lib/includes/ngtcp2/ngtcp2.h
index c364577a..8fe27627 100644
--- a/lib/includes/ngtcp2/ngtcp2.h
+++ b/lib/includes/ngtcp2/ngtcp2.h
@@ -155,16 +155,16 @@ typedef struct {
   ngtcp2_realloc realloc;
 } ngtcp2_mem;
 
-/* NGTCP2_PROTO_VER_D18 is the supported QUIC protocol version. */
-#define NGTCP2_PROTO_VER_D18 0xff000012u
+/* NGTCP2_PROTO_VER_D19 is the supported QUIC protocol version. */
+#define NGTCP2_PROTO_VER_D19 0xff000013u
 /* NGTCP2_PROTO_VER_MAX is the highest QUIC version the library
    supports. */
-#define NGTCP2_PROTO_VER_MAX NGTCP2_PROTO_VER_D18
+#define NGTCP2_PROTO_VER_MAX NGTCP2_PROTO_VER_D19
 
 /* NGTCP2_ALPN_* is a serialized form of ALPN protocol identifier this
    library supports.  Notice that the first byte is the length of the
    following protocol identifier. */
-#define NGTCP2_ALPN_D18 "\x5hq-18"
+#define NGTCP2_ALPN_D19 "\x5hq-19"
 
 #define NGTCP2_MAX_PKTLEN_IPV4 1252
 #define NGTCP2_MAX_PKTLEN_IPV6 1232
diff --git a/lib/ngtcp2_conn.c b/lib/ngtcp2_conn.c
index 2b348d17..2367f754 100644
--- a/lib/ngtcp2_conn.c
+++ b/lib/ngtcp2_conn.c
@@ -7246,7 +7246,7 @@ int ngtcp2_accept(ngtcp2_pkt_hd *dest, const uint8_t *pkt, size_t pktlen) {
   }
 
   switch (p->version) {
-  case NGTCP2_PROTO_VER_D18:
+  case NGTCP2_PROTO_VER_D19:
     break;
   default:
     return 1;
diff --git a/tests/ngtcp2_pkt_test.c b/tests/ngtcp2_pkt_test.c
index 4882b00b..2215d818 100644
--- a/tests/ngtcp2_pkt_test.c
+++ b/tests/ngtcp2_pkt_test.c
@@ -1068,7 +1068,7 @@ void test_ngtcp2_pkt_write_retry(void) {
   }
 
   ngtcp2_pkt_hd_init(&hd, NGTCP2_PKT_FLAG_LONG_FORM, NGTCP2_PKT_RETRY, &dcid,
-                     &scid, 0, 0, NGTCP2_PROTO_VER_D18, 0);
+                     &scid, 0, 0, NGTCP2_PROTO_VER_D19, 0);
 
   spktlen = ngtcp2_pkt_write_retry(buf, sizeof(buf), &hd, &odcid, token,
                                    sizeof(token));
-- 
GitLab