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/12/22 07:17:59 UTC
[trafficserver] branch quic-latest updated: Add getUInt8 and
getUInt16 to QUICTransportParameter
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
The following commit(s) were added to refs/heads/quic-latest by this push:
new 74061b1 Add getUInt8 and getUInt16 to QUICTransportParameter
74061b1 is described below
commit 74061b16162994b2518053d7281a6b5e9c5882c4
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Dec 22 16:17:09 2017 +0900
Add getUInt8 and getUInt16 to QUICTransportParameter
---
iocore/net/quic/QUICTransportParameters.cc | 24 ++++++++++++++++++++++++
iocore/net/quic/QUICTransportParameters.h | 2 ++
2 files changed, 26 insertions(+)
diff --git a/iocore/net/quic/QUICTransportParameters.cc b/iocore/net/quic/QUICTransportParameters.cc
index 2e486d7..c81b5f6 100644
--- a/iocore/net/quic/QUICTransportParameters.cc
+++ b/iocore/net/quic/QUICTransportParameters.cc
@@ -200,6 +200,30 @@ QUICTransportParameters::getAsBytes(QUICTransportParameterId tpid, uint16_t &len
return nullptr;
}
+uint8_t
+QUICTransportParameters::getAsUInt8(QUICTransportParameterId tpid) const
+{
+ uint16_t len = 0;
+ const uint8_t *value = this->getAsBytes(tpid, len);
+ if (value) {
+ return QUICTypeUtil::read_nbytes_as_uint(value, 1);
+ } else {
+ return 0;
+ }
+}
+
+uint16_t
+QUICTransportParameters::getAsUInt16(QUICTransportParameterId tpid) const
+{
+ uint16_t len = 0;
+ const uint8_t *value = this->getAsBytes(tpid, len);
+ if (value) {
+ return QUICTypeUtil::read_nbytes_as_uint(value, 2);
+ } else {
+ return 0;
+ }
+}
+
uint32_t
QUICTransportParameters::getAsUInt32(QUICTransportParameterId tpid) const
{
diff --git a/iocore/net/quic/QUICTransportParameters.h b/iocore/net/quic/QUICTransportParameters.h
index 00e08fd..8b34805 100644
--- a/iocore/net/quic/QUICTransportParameters.h
+++ b/iocore/net/quic/QUICTransportParameters.h
@@ -75,6 +75,8 @@ public:
bool is_valid() const;
const uint8_t *getAsBytes(QUICTransportParameterId id, uint16_t &len) const;
+ uint8_t getAsUInt8(QUICTransportParameterId id) const;
+ uint32_t getAsUInt16(QUICTransportParameterId id) const;
uint32_t getAsUInt32(QUICTransportParameterId id) const;
void set(QUICTransportParameterId id, const uint8_t *value, uint16_t value_len);
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].