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

commit 8b852ab59c9a5bb2b74e349f2d0d575248a84d8f
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Jun 18 11:47:39 2018 +0900

    Cleanup: Change QUICTypeUtil::has_long_header(const uint8_t *) to 
QUICInvariants::is_long_header(const uint8_t *)
---
 iocore/net/QUICNet.cc                     | 6 ++++--
 iocore/net/QUICPacketHandler.cc           | 2 +-
 iocore/net/quic/QUICPacket.cc             | 2 +-
 iocore/net/quic/QUICPacketReceiveQueue.cc | 4 ++--
 iocore/net/quic/QUICTypes.cc              | 6 ------
 iocore/net/quic/QUICTypes.h               | 1 -
 6 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/iocore/net/QUICNet.cc b/iocore/net/QUICNet.cc
index 319bbaf..8568280 100644
--- a/iocore/net/QUICNet.cc
+++ b/iocore/net/QUICNet.cc
@@ -143,9 +143,11 @@ QUICPollCont::pollEvent(int, Event *)
 
   while ((e = result.pop())) {
     buf = (uint8_t *)e->packet->getIOBlockChain()->buf();
-    if (QUICTypeUtil::has_long_header(buf)) { // Long Header Packet with 
Connection ID, has a valid type value.
+    if (QUICInvariants::is_long_header(buf)) {
+      // Long Header Packet with Connection ID, has a valid type value.
       this->_process_long_header_packet(e, nh);
-    } else { // Short Header Packet with Connection ID, has a valid type value.
+    } else {
+      // Short Header Packet with Connection ID, has a valid type value.
       this->_process_short_header_packet(e, nh);
     }
   }
diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc
index fe84d23..ab2a573 100644
--- a/iocore/net/QUICPacketHandler.cc
+++ b/iocore/net/QUICPacketHandler.cc
@@ -240,7 +240,7 @@ QUICPacketHandlerIn::_recv_packet(int event, UDPPacket 
*udp_packet)
   // [draft-12] 6.1.2.  Server Packet Handling
   // Servers MUST drop incoming packets under all other circumstances. They 
SHOULD send a Stateless Reset (Section 6.10.4) if a
   // connection ID is present in the header.
-  if ((!vc && !QUICTypeUtil::has_long_header(reinterpret_cast<const uint8_t 
*>(block->buf()))) || (vc && vc->in_closed_queue)) {
+  if ((!vc && !QUICInvariants::is_long_header(buf)) || (vc && 
vc->in_closed_queue)) {
     QUICStatelessResetToken token;
     {
       QUICConfig::scoped_config params;
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 6a8b7e8..1ebed09 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -75,7 +75,7 @@ QUICPacketHeaderUPtr
 QUICPacketHeader::load(const IpEndpoint from, ats_unique_buf buf, size_t len, 
QUICPacketNumber base)
 {
   QUICPacketHeaderUPtr header = QUICPacketHeaderUPtr(nullptr, 
&QUICPacketHeaderDeleter::delete_null_header);
-  if (QUICTypeUtil::has_long_header(buf.get())) {
+  if (QUICInvariants::is_long_header(buf.get())) {
     QUICPacketLongHeader *long_header = quicPacketLongHeaderAllocator.alloc();
     new (long_header) QUICPacketLongHeader(from, std::move(buf), len, base);
     header = QUICPacketHeaderUPtr(long_header, 
&QUICPacketHeaderDeleter::delete_long_header);
diff --git a/iocore/net/quic/QUICPacketReceiveQueue.cc 
b/iocore/net/quic/QUICPacketReceiveQueue.cc
index c742118..3a7f435 100644
--- a/iocore/net/quic/QUICPacketReceiveQueue.cc
+++ b/iocore/net/quic/QUICPacketReceiveQueue.cc
@@ -98,11 +98,11 @@ QUICPacketReceiveQueue::dequeue(QUICPacketCreationResult 
&result)
   ats_unique_buf pkt = {nullptr, [](void *p) { ats_free(p); }};
   size_t pkt_len     = 0;
 
-  if (QUICTypeUtil::has_long_header(this->_payload.get())) {
+  if (QUICInvariants::is_long_header(this->_payload.get())) {
     uint8_t *buf         = this->_payload.get() + this->_offset;
     size_t remaining_len = this->_payload_len - this->_offset;
 
-    if (QUICTypeUtil::has_long_header(buf)) {
+    if (QUICInvariants::is_long_header(buf)) {
       QUICVersion version = QUICTypeUtil::read_QUICVersion(buf + 
LONG_HDR_OFFSET_VERSION);
       if (is_vn(version)) {
         pkt_len = remaining_len;
diff --git a/iocore/net/quic/QUICTypes.cc b/iocore/net/quic/QUICTypes.cc
index acc3130..5fd6336 100644
--- a/iocore/net/quic/QUICTypes.cc
+++ b/iocore/net/quic/QUICTypes.cc
@@ -47,12 +47,6 @@ to_hex_str(char *dst, size_t dst_len, const uint8_t *src, 
size_t src_len)
 }
 
 bool
-QUICTypeUtil::has_long_header(const uint8_t *buf)
-{
-  return (buf[0] & 0x80) != 0;
-}
-
-bool
 QUICTypeUtil::is_supported_version(QUICVersion version)
 {
   for (auto v : QUIC_SUPPORTED_VERSIONS) {
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index 02f9967..41b0efd 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -316,7 +316,6 @@ private:
 class QUICTypeUtil
 {
 public:
-  [[deprecated]] static bool has_long_header(const uint8_t *buf);
   static bool is_supported_version(QUICVersion version);
   static QUICStreamType detect_stream_type(QUICStreamId id);
 

-- 
To stop receiving notification emails like this one, please contact
masa...@apache.org.

Reply via email to