You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/08/25 08:32:59 UTC

[trafficserver] branch quic-latest updated (30f32d1 -> 6f1f8ae)

This is an automated email from the ASF dual-hosted git repository.

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


    from 30f32d1  Use constant expressions
     new 0472c9d  Fix transport parameter parser
     new 6f1f8ae  Print transport parameters

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 iocore/net/quic/QUICDebugNames.cc          | 21 ++++++++++++++++++++
 iocore/net/quic/QUICDebugNames.h           |  2 ++
 iocore/net/quic/QUICTransportParameters.cc | 32 +++++++++++++++++++++++++++++-
 iocore/net/quic/QUICTransportParameters.h  |  6 +++---
 4 files changed, 57 insertions(+), 4 deletions(-)

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

[trafficserver] 01/02: Fix transport parameter parser

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0472c9dccae114c68e7642a7390eaceabec46cc1
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Aug 25 17:32:06 2017 +0900

    Fix transport parameter parser
---
 iocore/net/quic/QUICTransportParameters.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/QUICTransportParameters.cc b/iocore/net/quic/QUICTransportParameters.cc
index 3bbe217..97e0427 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -72,16 +72,19 @@ QUICTransportParameters::get(QUICTransportParameterId tpid, uint16_t &len) const
 
     uint16_t n = (p[0] << 8) + p[1];
     p += 2;
-    for (; n > 0; --n) {
+    while (n > 0) {
       uint16_t _id = (p[0] << 8) + p[1];
       p += 2;
+      n -= 2;
       uint16_t _value_len = (p[0] << 8) + p[1];
       p += 2;
+      n -= 2;
       if (tpid == _id) {
         len = _value_len;
         return p;
       }
       p += _value_len;
+      n -= _value_len;
     }
   } else {
     auto p = this->_parameters.find(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA);

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

[trafficserver] 02/02: Print transport parameters

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6f1f8ae58ec06c64b674be0e84025c122ac2847e
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Aug 25 17:32:34 2017 +0900

    Print transport parameters
---
 iocore/net/quic/QUICDebugNames.cc          | 21 +++++++++++++++++++++
 iocore/net/quic/QUICDebugNames.h           |  2 ++
 iocore/net/quic/QUICTransportParameters.cc | 27 +++++++++++++++++++++++++++
 iocore/net/quic/QUICTransportParameters.h  |  6 +++---
 4 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/iocore/net/quic/QUICDebugNames.cc b/iocore/net/quic/QUICDebugNames.cc
index b3c738c..dae5885 100644
--- a/iocore/net/quic/QUICDebugNames.cc
+++ b/iocore/net/quic/QUICDebugNames.cc
@@ -156,3 +156,24 @@ QUICDebugNames::vc_event(int event)
     return "UNKNOWN";
   }
 }
+
+const char *
+QUICDebugNames::transport_parameter_id(QUICTransportParameterId id)
+{
+  switch (id) {
+  case QUICTransportParameterId::INITIAL_MAX_STREAM_DATA:
+    return "INITIAL_MAX_STREAM_DATA";
+  case QUICTransportParameterId::INITIAL_MAX_DATA:
+    return "INITIAL_MAX_DATA";
+  case QUICTransportParameterId::INITIAL_MAX_STREAM_ID:
+    return "INITIAL_MAX_STREAM_ID";
+  case QUICTransportParameterId::IDLE_TIMEOUT:
+    return "IDLE_TIMEOUT";
+  case QUICTransportParameterId::TRUNCATE_CONNECTION_ID:
+    return "TRUNCATE_CONNECTION_ID";
+  case QUICTransportParameterId::MAX_PACKET_SIZE:
+    return "MAX_PACKET_SIZE";
+  default:
+    return "UNKNOWN";
+  }
+}
diff --git a/iocore/net/quic/QUICDebugNames.h b/iocore/net/quic/QUICDebugNames.h
index fabd076..20fcc71 100644
--- a/iocore/net/quic/QUICDebugNames.h
+++ b/iocore/net/quic/QUICDebugNames.h
@@ -24,6 +24,7 @@
 #pragma once
 
 #include "QUICTypes.h"
+#include "QUICTransportParameters.h"
 
 class QUICDebugNames
 {
@@ -32,6 +33,7 @@ public:
   static const char *frame_type(QUICFrameType type);
   static const char *error_class(QUICErrorClass cls);
   static const char *error_code(QUICErrorCode code);
+  static const char *transport_parameter_id(QUICTransportParameterId id);
 
   // TODO: move to somewhere
   static const char *vc_event(int event);
diff --git a/iocore/net/quic/QUICTransportParameters.cc b/iocore/net/quic/QUICTransportParameters.cc
index 97e0427..c3ce09c 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -22,9 +22,11 @@
  */
 
 #include <cstdlib>
+#include "ts/Diags.h"
 #include "QUICGlobals.h"
 #include "QUICTransportParameters.h"
 #include "QUICConnection.h"
+#include "QUICDebugNames.h"
 #include "../P_QUICNetVConnection.h"
 
 static constexpr int TRANSPORT_PARAMETERS_MAXIMUM_SIZE = 65535;
@@ -160,6 +162,31 @@ QUICTransportParameters::store(uint8_t *buf, uint16_t *len) const
 // QUICTransportParametersInClientHello
 //
 
+QUICTransportParametersInClientHello::QUICTransportParametersInClientHello(const uint8_t *buf, size_t len) : QUICTransportParameters(buf, len)
+{
+  // Print all parameters
+  const uint8_t *p = this->_buf.get() + this->_parameters_offset();
+  uint16_t n = (p[0] << 8) + p[1];
+  p += 2;
+  while (n > 0) {
+    uint16_t _id = (p[0] << 8) + p[1];
+    p += 2;
+    n -= 2;
+    uint16_t _value_len = (p[0] << 8) + p[1];
+    p += 2;
+    n -= 2;
+    if (_value_len == 0) {
+      Debug("quic_handsahke", "%s: (no value)", QUICDebugNames::transport_parameter_id(_id));
+    } else if (_value_len <= 8) {
+      Debug("quic_handsahke", "%s: 0x%" PRIx64 " (%" PRIu64 ")", QUICDebugNames::transport_parameter_id(_id), QUICTypeUtil::read_nbytes_as_uint(p, _value_len), QUICTypeUtil::read_nbytes_as_uint(p, _value_len));
+    } else {
+      Debug("quic_handsahke", "%s: (long data)", QUICDebugNames::transport_parameter_id(_id));
+    }
+    p += _value_len;
+    n -= _value_len;
+  }
+}
+
 void
 QUICTransportParametersInClientHello::_store(uint8_t *buf, uint16_t *len) const
 {
diff --git a/iocore/net/quic/QUICTransportParameters.h b/iocore/net/quic/QUICTransportParameters.h
index a84aba8..c5239f2 100644
--- a/iocore/net/quic/QUICTransportParameters.h
+++ b/iocore/net/quic/QUICTransportParameters.h
@@ -99,9 +99,9 @@ protected:
 class QUICTransportParametersInClientHello : public QUICTransportParameters
 {
 public:
-  QUICTransportParametersInClientHello(QUICVersion negotiated_version, QUICVersion initial_version)
-    : QUICTransportParameters(), _negotiated_version(negotiated_version), _initial_version(initial_version){};
-  QUICTransportParametersInClientHello(const uint8_t *buf, size_t len) : QUICTransportParameters(buf, len){};
+  QUICTransportParametersInClientHello(QUICVersion negotiated_version, QUICVersion initial_version) : QUICTransportParameters(), _negotiated_version(negotiated_version), _initial_version(initial_version)
+{};
+  QUICTransportParametersInClientHello(const uint8_t *buf, size_t len);
   QUICVersion negotiated_version() const;
   QUICVersion initial_version() const;
 

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