trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From masa...@apache.org
Subject [trafficserver] branch quic-latest updated: draft-08: Support new frame format of CONNECTION_CLOSE, APPLICATION_CLOSE, MAX_DATA, MAX_STREAM_DATA and MAX_STREAM_ID
Date Thu, 14 Dec 2017 03:50:56 GMT
This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
     new 9859e54  draft-08: Support new frame format of CONNECTION_CLOSE, APPLICATION_CLOSE,
MAX_DATA, MAX_STREAM_DATA and MAX_STREAM_ID
9859e54 is described below

commit 9859e54c495023d591d437d90330fb05efd7d541
Author: Masaori Koshiba <masaori@apache.org>
AuthorDate: Thu Dec 14 12:50:41 2017 +0900

    draft-08: Support new frame format of CONNECTION_CLOSE, APPLICATION_CLOSE, MAX_DATA, MAX_STREAM_DATA
and MAX_STREAM_ID
---
 iocore/net/quic/QUICFrame.cc           | 140 ++++++++++++++++++++++++++++-----
 iocore/net/quic/QUICFrame.h            |  35 +++++++--
 iocore/net/quic/QUICTypes.cc           |   9 +++
 iocore/net/quic/QUICTypes.h            |   4 +-
 iocore/net/quic/test/test_QUICFrame.cc |  56 ++++++-------
 5 files changed, 185 insertions(+), 59 deletions(-)

diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 1973f2b..9112d59 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -796,7 +796,7 @@ QUICPaddingFrame::store(uint8_t *buf, size_t *len) const
 //
 // CONNECTION_CLOSE frame
 //
-QUICConnectionCloseFrame::QUICConnectionCloseFrame(QUICTransErrorCode error_code, uint16_t
reason_phrase_length,
+QUICConnectionCloseFrame::QUICConnectionCloseFrame(QUICTransErrorCode error_code, uint64_t
reason_phrase_length,
                                                    const char *reason_phrase)
 {
   this->_error_code           = error_code;
@@ -813,7 +813,8 @@ QUICConnectionCloseFrame::type() const
 size_t
 QUICConnectionCloseFrame::size() const
 {
-  return 5 + this->reason_phrase_length();
+  return sizeof(QUICFrameType) + sizeof(QUICTransErrorCode) + this->_get_reason_phrase_length_field_length()
+
+         this->reason_phrase_length();
 }
 
 void
@@ -825,7 +826,7 @@ QUICConnectionCloseFrame::store(uint8_t *buf, size_t *len) const
   ++p;
   QUICTypeUtil::write_QUICTransErrorCode(this->_error_code, p, &n);
   p += n;
-  QUICTypeUtil::write_uint_as_nbytes(this->_reason_phrase_length, 2, p, &n);
+  QUICTypeUtil::write_QUICVariableInt(this->_reason_phrase_length, p, &n);
   p += n;
   if (this->_reason_phrase_length > 0) {
     memcpy(p, this->_reason_phrase, this->_reason_phrase_length);
@@ -845,11 +846,11 @@ QUICConnectionCloseFrame::error_code() const
   }
 }
 
-uint16_t
+uint64_t
 QUICConnectionCloseFrame::reason_phrase_length() const
 {
   if (this->_buf) {
-    return QUICTypeUtil::read_nbytes_as_uint(this->_buf + 3, 2);
+    return QUICTypeUtil::read_QUICVariableInt(this->_buf + this->_get_reason_phrase_length_field_offset());
   } else {
     return this->_reason_phrase_length;
   }
@@ -859,16 +860,38 @@ const char *
 QUICConnectionCloseFrame::reason_phrase() const
 {
   if (this->_buf) {
-    return reinterpret_cast<const char *>(this->_buf + 5);
+    return reinterpret_cast<const char *>(this->_buf + this->_get_reason_phrase_field_offset());
   } else {
     return this->_reason_phrase;
   }
 }
 
+size_t
+QUICConnectionCloseFrame::_get_reason_phrase_length_field_offset() const
+{
+  return sizeof(QUICFrameType) + sizeof(QUICTransErrorCode);
+}
+
+size_t
+QUICConnectionCloseFrame::_get_reason_phrase_length_field_length() const
+{
+  if (this->_buf) {
+    return QUICVariableInt::size(this->_buf + this->_get_reason_phrase_length_field_offset());
+  } else {
+    return QUICVariableInt::size(this->_reason_phrase_length);
+  }
+}
+
+size_t
+QUICConnectionCloseFrame::_get_reason_phrase_field_offset() const
+{
+  return this->_get_reason_phrase_length_field_offset() + this->_get_reason_phrase_length_field_length();
+}
+
 //
 // APPLICATION_CLOSE frame
 //
-QUICApplicationCloseFrame::QUICApplicationCloseFrame(QUICAppErrorCode error_code, uint16_t
reason_phrase_length,
+QUICApplicationCloseFrame::QUICApplicationCloseFrame(QUICAppErrorCode error_code, uint64_t
reason_phrase_length,
                                                      const char *reason_phrase)
 {
   this->_error_code           = error_code;
@@ -885,7 +908,8 @@ QUICApplicationCloseFrame::type() const
 size_t
 QUICApplicationCloseFrame::size() const
 {
-  return 5 + this->reason_phrase_length();
+  return sizeof(QUICFrameType) + sizeof(QUICAppErrorCode) + this->_get_reason_phrase_length_field_length()
+
+         this->reason_phrase_length();
 }
 
 void
@@ -897,7 +921,7 @@ QUICApplicationCloseFrame::store(uint8_t *buf, size_t *len) const
   ++p;
   QUICTypeUtil::write_QUICAppErrorCode(this->_error_code, p, &n);
   p += n;
-  QUICTypeUtil::write_uint_as_nbytes(this->_reason_phrase_length, 2, p, &n);
+  QUICTypeUtil::write_QUICVariableInt(this->_reason_phrase_length, p, &n);
   p += n;
   if (this->_reason_phrase_length > 0) {
     memcpy(p, this->_reason_phrase, this->_reason_phrase_length);
@@ -917,11 +941,11 @@ QUICApplicationCloseFrame::error_code() const
   }
 }
 
-uint16_t
+uint64_t
 QUICApplicationCloseFrame::reason_phrase_length() const
 {
   if (this->_buf) {
-    return QUICTypeUtil::read_nbytes_as_uint(this->_buf + 3, 2);
+    return QUICTypeUtil::read_QUICVariableInt(this->_buf + this->_get_reason_phrase_length_field_offset());
   } else {
     return this->_reason_phrase_length;
   }
@@ -931,12 +955,34 @@ const char *
 QUICApplicationCloseFrame::reason_phrase() const
 {
   if (this->_buf) {
-    return reinterpret_cast<const char *>(this->_buf + 5);
+    return reinterpret_cast<const char *>(this->_buf + this->_get_reason_phrase_field_offset());
   } else {
     return this->_reason_phrase;
   }
 }
 
+size_t
+QUICApplicationCloseFrame::_get_reason_phrase_length_field_offset() const
+{
+  return sizeof(QUICFrameType) + sizeof(QUICTransErrorCode);
+}
+
+size_t
+QUICApplicationCloseFrame::_get_reason_phrase_length_field_length() const
+{
+  if (this->_buf) {
+    return QUICVariableInt::size(this->_buf + this->_get_reason_phrase_length_field_offset());
+  } else {
+    return QUICVariableInt::size(this->_reason_phrase_length);
+  }
+}
+
+size_t
+QUICApplicationCloseFrame::_get_reason_phrase_field_offset() const
+{
+  return this->_get_reason_phrase_length_field_offset() + this->_get_reason_phrase_length_field_length();
+}
+
 //
 // MAX_DATA frame
 //
@@ -954,7 +1000,7 @@ QUICMaxDataFrame::type() const
 size_t
 QUICMaxDataFrame::size() const
 {
-  return 9;
+  return sizeof(QUICFrameType) + this->_get_max_data_field_length();
 }
 
 void
@@ -964,7 +1010,7 @@ QUICMaxDataFrame::store(uint8_t *buf, size_t *len) const
   uint8_t *p = buf;
   *p         = static_cast<uint8_t>(QUICFrameType::MAX_DATA);
   ++p;
-  QUICTypeUtil::write_uint_as_nbytes(this->_maximum_data, 8, p, &n);
+  QUICTypeUtil::write_QUICMaxData(this->_maximum_data, p, &n);
   p += n;
 
   *len = p - buf;
@@ -974,12 +1020,22 @@ uint64_t
 QUICMaxDataFrame::maximum_data() const
 {
   if (this->_buf) {
-    return QUICTypeUtil::read_nbytes_as_uint(this->_buf + 1, 8);
+    return QUICTypeUtil::read_QUICMaxData(this->_buf + sizeof(QUICFrameType));
   } else {
     return this->_maximum_data;
   }
 }
 
+size_t
+QUICMaxDataFrame::_get_max_data_field_length() const
+{
+  if (this->_buf) {
+    return QUICVariableInt::size(this->_buf + sizeof(QUICFrameType));
+  } else {
+    return QUICVariableInt::size(this->_maximum_data);
+  }
+}
+
 //
 // MAX_STREAM_DATA
 //
@@ -998,7 +1054,7 @@ QUICMaxStreamDataFrame::type() const
 size_t
 QUICMaxStreamDataFrame::size() const
 {
-  return 13;
+  return sizeof(QUICFrameType) + this->_get_stream_id_field_length() + this->_get_max_stream_data_field_length();
 }
 
 void
@@ -1020,7 +1076,7 @@ QUICStreamId
 QUICMaxStreamDataFrame::stream_id() const
 {
   if (this->_buf) {
-    return QUICTypeUtil::read_nbytes_as_uint(this->_buf + 1, 4);
+    return QUICTypeUtil::read_QUICStreamId(this->_buf + sizeof(QUICFrameType));
   } else {
     return this->_stream_id;
   }
@@ -1030,12 +1086,44 @@ uint64_t
 QUICMaxStreamDataFrame::maximum_stream_data() const
 {
   if (this->_buf) {
-    return QUICTypeUtil::read_nbytes_as_uint(this->_buf + 5, 8);
+    return QUICTypeUtil::read_QUICMaxData(this->_buf + this->_get_max_stream_data_field_offset());
   } else {
     return this->_maximum_stream_data;
   }
 }
 
+size_t
+QUICMaxStreamDataFrame::_get_stream_id_field_offset() const
+{
+  return sizeof(QUICFrameType);
+}
+
+size_t
+QUICMaxStreamDataFrame::_get_stream_id_field_length() const
+{
+  if (this->_buf) {
+    return QUICVariableInt::size(this->_buf + this->_get_stream_id_field_offset());
+  } else {
+    return QUICVariableInt::size(this->_stream_id);
+  }
+}
+
+size_t
+QUICMaxStreamDataFrame::_get_max_stream_data_field_offset() const
+{
+  return sizeof(QUICFrameType) + this->_get_stream_id_field_length();
+}
+
+size_t
+QUICMaxStreamDataFrame::_get_max_stream_data_field_length() const
+{
+  if (this->_buf) {
+    return QUICVariableInt::size(this->_buf + this->_get_max_stream_data_field_offset());
+  } else {
+    return QUICVariableInt::size(this->_stream_id);
+  }
+}
+
 //
 // MAX_STREAM_ID
 //
@@ -1053,7 +1141,7 @@ QUICMaxStreamIdFrame::type() const
 size_t
 QUICMaxStreamIdFrame::size() const
 {
-  return 5;
+  return sizeof(QUICFrameType) + this->_get_max_stream_id_field_length();
 }
 
 void
@@ -1063,7 +1151,7 @@ QUICMaxStreamIdFrame::store(uint8_t *buf, size_t *len) const
   uint8_t *p = buf;
   *p         = static_cast<uint8_t>(QUICFrameType::MAX_STREAM_ID);
   ++p;
-  QUICTypeUtil::write_uint_as_nbytes(this->_maximum_stream_id, 4, p, &n);
+  QUICTypeUtil::write_QUICStreamId(this->_maximum_stream_id, p, &n);
   p += n;
 
   *len = p - buf;
@@ -1073,12 +1161,22 @@ QUICStreamId
 QUICMaxStreamIdFrame::maximum_stream_id() const
 {
   if (this->_buf) {
-    return QUICTypeUtil::read_nbytes_as_uint(this->_buf + 1, 4);
+    return QUICTypeUtil::read_QUICStreamId(this->_buf + sizeof(QUICFrameType));
   } else {
     return this->_maximum_stream_id;
   }
 }
 
+size_t
+QUICMaxStreamIdFrame::_get_max_stream_id_field_length() const
+{
+  if (this->_buf) {
+    return QUICVariableInt::size(this->_buf + sizeof(QUICFrameType));
+  } else {
+    return QUICVariableInt::size(this->_maximum_stream_id);
+  }
+}
+
 //
 // BLOCKED frame
 //
diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h
index 9420ffc..6da2a94 100644
--- a/iocore/net/quic/QUICFrame.h
+++ b/iocore/net/quic/QUICFrame.h
@@ -36,7 +36,7 @@ class QUICFrame
 public:
   QUICFrame(const uint8_t *buf, size_t len) : _buf(buf), _len(len){};
   virtual QUICFrameType type() const;
-  virtual size_t size() const = 0;
+  virtual size_t size() const                         = 0;
   virtual void store(uint8_t *buf, size_t *len) const = 0;
   virtual void reset(const uint8_t *buf, size_t len);
   static QUICFrameType type(const uint8_t *buf);
@@ -228,7 +228,7 @@ private:
   size_t _get_error_code_field_offset() const;
   size_t _get_final_offset_field_offset() const;
   size_t _get_final_offset_field_length() const;
-
+  
   QUICStreamId _stream_id      = 0;
   QUICAppErrorCode _error_code = 0;
   QUICOffset _final_offset     = 0;
@@ -269,17 +269,21 @@ class QUICConnectionCloseFrame : public QUICFrame
 public:
   QUICConnectionCloseFrame() : QUICFrame() {}
   QUICConnectionCloseFrame(const uint8_t *buf, size_t len) : QUICFrame(buf, len) {}
-  QUICConnectionCloseFrame(QUICTransErrorCode error_code, uint16_t reason_phrase_length,
const char *reason_phrase);
+  QUICConnectionCloseFrame(QUICTransErrorCode error_code, uint64_t reason_phrase_length,
const char *reason_phrase);
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual void store(uint8_t *buf, size_t *len) const override;
   QUICTransErrorCode error_code() const;
-  uint16_t reason_phrase_length() const;
+  uint64_t reason_phrase_length() const;
   const char *reason_phrase() const;
 
 private:
+  size_t _get_reason_phrase_length_field_offset() const;
+  size_t _get_reason_phrase_length_field_length() const;
+  size_t _get_reason_phrase_field_offset() const;
+  
   QUICTransErrorCode _error_code;
-  uint16_t _reason_phrase_length = 0;
+  uint64_t _reason_phrase_length = 0;
   const char *_reason_phrase     = nullptr;
 };
 
@@ -292,17 +296,21 @@ class QUICApplicationCloseFrame : public QUICFrame
 public:
   QUICApplicationCloseFrame() : QUICFrame() {}
   QUICApplicationCloseFrame(const uint8_t *buf, size_t len) : QUICFrame(buf, len) {}
-  QUICApplicationCloseFrame(QUICAppErrorCode error_code, uint16_t reason_phrase_length, const
char *reason_phrase);
+  QUICApplicationCloseFrame(QUICAppErrorCode error_code, uint64_t reason_phrase_length, const
char *reason_phrase);
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual void store(uint8_t *buf, size_t *len) const override;
   QUICAppErrorCode error_code() const;
-  uint16_t reason_phrase_length() const;
+  uint64_t reason_phrase_length() const;
   const char *reason_phrase() const;
 
 private:
+  size_t _get_reason_phrase_length_field_offset() const;
+  size_t _get_reason_phrase_length_field_length() const;
+  size_t _get_reason_phrase_field_offset() const;
+
   QUICAppErrorCode _error_code   = 0;
-  uint16_t _reason_phrase_length = 0;
+  uint64_t _reason_phrase_length = 0;
   const char *_reason_phrase     = nullptr;
 };
 
@@ -322,6 +330,8 @@ public:
   uint64_t maximum_data() const;
 
 private:
+  size_t _get_max_data_field_length() const;
+
   uint64_t _maximum_data = 0;
 };
 
@@ -342,6 +352,11 @@ public:
   uint64_t maximum_stream_data() const;
 
 private:
+  size_t _get_stream_id_field_offset() const;
+  size_t _get_stream_id_field_length() const;
+  size_t _get_max_stream_data_field_offset() const;
+  size_t _get_max_stream_data_field_length() const;
+
   QUICStreamId _stream_id       = 0;
   uint64_t _maximum_stream_data = 0;
 };
@@ -362,6 +377,8 @@ public:
   QUICStreamId maximum_stream_id() const;
 
 private:
+  size_t _get_max_stream_id_field_length() const;
+
   QUICStreamId _maximum_stream_id = 0;
 };
 
@@ -376,6 +393,8 @@ public:
   virtual QUICFrameType type() const override;
   virtual size_t size() const override;
   virtual void store(uint8_t *buf, size_t *len) const override;
+private:
+  size_t _get_max_data_field_length() const;
 };
 
 //
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index f7cc842..89d5eca 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -96,6 +96,15 @@ QUICTypeUtil::read_QUICAppErrorCode(const uint8_t *buf)
 }
 
 uint64_t
+QUICTypeUtil::read_QUICMaxData(const uint8_t *buf)
+{
+  uint64_t max_data = 0;
+  size_t len        = 0;
+  QUICVariableInt::decode(max_data, len, buf, 8);
+  return max_data;
+}
+
+uint64_t
 QUICTypeUtil::read_QUICVariableInt(const uint8_t *buf)
 {
   uint64_t dst = 0;
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index 4025ecb..1680820 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -83,7 +83,7 @@ enum class QUICPacketShortHeaderType : int {
 };
 
 // XXX If you add or remove QUICFrameType, you might also need to change QUICFrame::type(const
uint8_t *)
-enum class QUICFrameType : int {
+enum class QUICFrameType : uint8_t {
   PADDING = 0x00,
   RST_STREAM,
   CONNECTION_CLOSE,
@@ -261,7 +261,7 @@ public:
   static QUICOffset read_QUICOffset(const uint8_t *buf);
   static QUICTransErrorCode read_QUICTransErrorCode(const uint8_t *buf);
   static QUICAppErrorCode read_QUICAppErrorCode(const uint8_t *buf);
-
+  static uint64_t read_QUICMaxData(const uint8_t *buf);
   static uint64_t read_QUICVariableInt(const uint8_t *buf);
 
   static void write_QUICConnectionId(QUICConnectionId connection_id, uint8_t n, uint8_t *buf,
size_t *len);
diff --git a/iocore/net/quic/test/test_QUICFrame.cc b/iocore/net/quic/test/test_QUICFrame.cc
index 3b76feb..565bf6e 100644
--- a/iocore/net/quic/test/test_QUICFrame.cc
+++ b/iocore/net/quic/test/test_QUICFrame.cc
@@ -453,28 +453,28 @@ TEST_CASE("Load ConnectionClose Frame", "[quic]")
   uint8_t buf1[] = {
     0x02,                        // Type
     0x00, 0x0A,                  // Error Code
-    0x00, 0x05,                  // Reason Phrase Length
+    0x05,                        // Reason Phrase Length
     0x41, 0x42, 0x43, 0x44, 0x45 // Reason Phrase ("ABCDE");
   };
   std::shared_ptr<const QUICFrame> frame1 = QUICFrameFactory::create(buf1, sizeof(buf1));
   CHECK(frame1->type() == QUICFrameType::CONNECTION_CLOSE);
-  CHECK(frame1->size() == 10);
+  CHECK(frame1->size() == 9);
   std::shared_ptr<const QUICConnectionCloseFrame> connectionCloseFrame1 =
     std::dynamic_pointer_cast<const QUICConnectionCloseFrame>(frame1);
   CHECK(connectionCloseFrame1 != nullptr);
   CHECK(connectionCloseFrame1->error_code() == QUICTransErrorCode::PROTOCOL_VIOLATION);
   CHECK(connectionCloseFrame1->reason_phrase_length() == 5);
-  CHECK(memcmp(connectionCloseFrame1->reason_phrase(), buf1 + 5, 5) == 0);
+  CHECK(memcmp(connectionCloseFrame1->reason_phrase(), buf1 + 4, 5) == 0);
 
   // No reason phrase
   uint8_t buf2[] = {
     0x02,       // Type
     0x00, 0x0A, // Error Code
-    0x00, 0x00, // Reason Phrase Length
+    0x00,       // Reason Phrase Length
   };
   std::shared_ptr<const QUICFrame> frame2 = QUICFrameFactory::create(buf2, sizeof(buf1));
   CHECK(frame2->type() == QUICFrameType::CONNECTION_CLOSE);
-  CHECK(frame2->size() == 5);
+  CHECK(frame2->size() == 4);
   std::shared_ptr<const QUICConnectionCloseFrame> connectionCloseFrame2 =
     std::dynamic_pointer_cast<const QUICConnectionCloseFrame>(frame2);
   CHECK(connectionCloseFrame2 != nullptr);
@@ -490,22 +490,22 @@ TEST_CASE("Store ConnectionClose Frame", "[quic]")
   uint8_t expected1[] = {
     0x02,                        // Type
     0x00, 0x0A,                  // Error Code
-    0x00, 0x05,                  // Reason Phrase Length
+    0x05,                        // Reason Phrase Length
     0x41, 0x42, 0x43, 0x44, 0x45 // Reason Phrase ("ABCDE");
   };
   QUICConnectionCloseFrame connectionCloseFrame1(QUICTransErrorCode::PROTOCOL_VIOLATION,
5, "ABCDE");
   connectionCloseFrame1.store(buf, &len);
-  CHECK(len == 10);
+  CHECK(len == 9);
   CHECK(memcmp(buf, expected1, len) == 0);
 
   uint8_t expected2[] = {
     0x02,       // Type
     0x00, 0x0A, // Error Code
-    0x00, 0x00, // Reason Phrase Length
+    0x00,       // Reason Phrase Length
   };
   QUICConnectionCloseFrame connectionCloseFrame2(QUICTransErrorCode::PROTOCOL_VIOLATION,
0, nullptr);
   connectionCloseFrame2.store(buf, &len);
-  CHECK(len == 5);
+  CHECK(len == 4);
   CHECK(memcmp(buf, expected2, len) == 0);
 }
 
@@ -514,28 +514,28 @@ TEST_CASE("Load ApplicationClose Frame", "[quic]")
   uint8_t buf1[] = {
     0x03,                        // Type
     0x00, 0x01,                  // Error Code
-    0x00, 0x05,                  // Reason Phrase Length
+    0x05,                        // Reason Phrase Length
     0x41, 0x42, 0x43, 0x44, 0x45 // Reason Phrase ("ABCDE");
   };
   std::shared_ptr<const QUICFrame> frame1 = QUICFrameFactory::create(buf1, sizeof(buf1));
   CHECK(frame1->type() == QUICFrameType::APPLICATION_CLOSE);
-  CHECK(frame1->size() == 10);
+  CHECK(frame1->size() == 9);
   std::shared_ptr<const QUICApplicationCloseFrame> applicationCloseFrame1 =
     std::dynamic_pointer_cast<const QUICApplicationCloseFrame>(frame1);
   CHECK(applicationCloseFrame1 != nullptr);
   CHECK(applicationCloseFrame1->error_code() == static_cast<QUICAppErrorCode>(0x01));
   CHECK(applicationCloseFrame1->reason_phrase_length() == 5);
-  CHECK(memcmp(applicationCloseFrame1->reason_phrase(), buf1 + 5, 5) == 0);
+  CHECK(memcmp(applicationCloseFrame1->reason_phrase(), buf1 + 4, 5) == 0);
 
   // No reason phrase
   uint8_t buf2[] = {
     0x03,       // Type
     0x00, 0x01, // Error Code
-    0x00, 0x00, // Reason Phrase Length
+    0x00,       // Reason Phrase Length
   };
   std::shared_ptr<const QUICFrame> frame2 = QUICFrameFactory::create(buf2, sizeof(buf1));
   CHECK(frame2->type() == QUICFrameType::APPLICATION_CLOSE);
-  CHECK(frame2->size() == 5);
+  CHECK(frame2->size() == 4);
   std::shared_ptr<const QUICApplicationCloseFrame> applicationCloseFrame2 =
     std::dynamic_pointer_cast<const QUICApplicationCloseFrame>(frame2);
   CHECK(applicationCloseFrame2 != nullptr);
@@ -551,22 +551,22 @@ TEST_CASE("Store ApplicationClose Frame", "[quic]")
   uint8_t expected1[] = {
     0x03,                        // Type
     0x00, 0x01,                  // Error Code
-    0x00, 0x05,                  // Reason Phrase Length
+    0x05,                        // Reason Phrase Length
     0x41, 0x42, 0x43, 0x44, 0x45 // Reason Phrase ("ABCDE");
   };
   QUICApplicationCloseFrame applicationCloseFrame1(static_cast<QUICAppErrorCode>(0x01),
5, "ABCDE");
   applicationCloseFrame1.store(buf, &len);
-  CHECK(len == 10);
+  CHECK(len == 9);
   CHECK(memcmp(buf, expected1, len) == 0);
 
   uint8_t expected2[] = {
     0x03,       // Type
     0x00, 0x01, // Error Code
-    0x00, 0x00, // Reason Phrase Length
+    0x00,       // Reason Phrase Length
   };
   QUICApplicationCloseFrame applicationCloseFrame2(static_cast<QUICAppErrorCode>(0x01),
0, nullptr);
   applicationCloseFrame2.store(buf, &len);
-  CHECK(len == 5);
+  CHECK(len == 4);
   CHECK(memcmp(buf, expected2, len) == 0);
 }
 
@@ -574,7 +574,7 @@ TEST_CASE("Load MaxData Frame", "[quic]")
 {
   uint8_t buf1[] = {
     0x04,                                          // Type
-    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Data
+    0xd1, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Data
   };
   std::shared_ptr<const QUICFrame> frame1 = QUICFrameFactory::create(buf1, sizeof(buf1));
   CHECK(frame1->type() == QUICFrameType::MAX_DATA);
@@ -591,7 +591,7 @@ TEST_CASE("Store MaxData Frame", "[quic]")
 
   uint8_t expected[] = {
     0x04,                                          // Type
-    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Data
+    0xd1, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Data
   };
   QUICMaxDataFrame maxDataFrame(0x1122334455667788);
   maxDataFrame.store(buf, &len);
@@ -603,8 +603,8 @@ TEST_CASE("Load MaxStreamData Frame", "[quic]")
 {
   uint8_t buf1[] = {
     0x05,                                          // Type
-    0x01, 0x02, 0x03, 0x04,                        // Stream ID
-    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Stream Data
+    0x81, 0x02, 0x03, 0x04,                        // Stream ID
+    0xd1, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Stream Data
   };
   std::shared_ptr<const QUICFrame> frame1 = QUICFrameFactory::create(buf1, sizeof(buf1));
   CHECK(frame1->type() == QUICFrameType::MAX_STREAM_DATA);
@@ -623,8 +623,8 @@ TEST_CASE("Store MaxStreamData Frame", "[quic]")
 
   uint8_t expected[] = {
     0x05,                                          // Type
-    0x01, 0x02, 0x03, 0x04,                        // Stream ID
-    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Stream Data
+    0x81, 0x02, 0x03, 0x04,                        // Stream ID
+    0xd1, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 // Maximum Stream Data
   };
   QUICMaxStreamDataFrame maxStreamDataFrame(0x01020304, 0x1122334455667788ULL);
   maxStreamDataFrame.store(buf, &len);
@@ -636,7 +636,7 @@ TEST_CASE("Load MaxStreamId Frame", "[quic]")
 {
   uint8_t buf1[] = {
     0x06,                   // Type
-    0x01, 0x02, 0x03, 0x04, // Stream ID
+    0x81, 0x02, 0x03, 0x04, // Stream ID
   };
   std::shared_ptr<const QUICFrame> frame1 = QUICFrameFactory::create(buf1, sizeof(buf1));
   CHECK(frame1->type() == QUICFrameType::MAX_STREAM_ID);
@@ -653,7 +653,7 @@ TEST_CASE("Store MaxStreamId Frame", "[quic]")
 
   uint8_t expected[] = {
     0x06,                   // Type
-    0x01, 0x02, 0x03, 0x04, // Stream ID
+    0x81, 0x02, 0x03, 0x04, // Stream ID
   };
   QUICMaxStreamIdFrame maxStreamIdFrame(0x01020304);
   maxStreamIdFrame.store(buf, &len);
@@ -827,11 +827,11 @@ TEST_CASE("QUICFrameFactory Fast Create Frame", "[quic]")
 
   uint8_t buf1[] = {
     0x06,                   // Type
-    0x01, 0x02, 0x03, 0x04, // Stream Data
+    0x81, 0x02, 0x03, 0x04, // Stream Data
   };
   uint8_t buf2[] = {
     0x06,                   // Type
-    0x05, 0x06, 0x07, 0x08, // Stream Data
+    0x85, 0x06, 0x07, 0x08, // Stream Data
   };
   std::shared_ptr<const QUICFrame> frame1 = factory.fast_create(buf1, sizeof(buf1));
   CHECK(frame1 != nullptr);

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message