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 b0df673 Print hq and quic to Via header b0df673 is described below commit b0df673a64bcd9df284f48886ed388272679a1ca Author: Masakazu Kitajo <mas...@apache.org> AuthorDate: Wed Oct 4 13:00:08 2017 -0700 Print hq and quic to Via header --- iocore/net/P_QUICNetVConnection.h | 3 +++ iocore/net/QUICNetVConnection.cc | 29 +++++++++++++++++++++++++++++ lib/ts/ink_inet.cc | 1 + lib/ts/ink_inet.h | 1 + proxy/hq/HQClientSession.cc | 13 +++++++++++++ proxy/hq/HQClientSession.h | 3 +++ 6 files changed, 50 insertions(+) diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h index 82b89fc..4c0ed6a 100644 --- a/iocore/net/P_QUICNetVConnection.h +++ b/iocore/net/P_QUICNetVConnection.h @@ -166,6 +166,9 @@ public: virtual void net_read_io(NetHandler *nh, EThread *lthread) override; virtual int64_t load_buffer_and_write(int64_t towrite, MIOBufferAccessor &buf, int64_t &total_written, int &needs) override; + int populate_protocol(ts::StringView *results, int n) const override; + const char *protocol_contains(ts::StringView tag) const override; + // QUICNetVConnection void registerNextProtocolSet(SSLNextProtocolSet *s); diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 5962e96..5261450 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -576,6 +576,35 @@ QUICNetVConnection::load_buffer_and_write(int64_t towrite, MIOBufferAccessor &bu return 0; } +int +QUICNetVConnection::populate_protocol(ts::StringView *results, int n) const +{ + int retval = 0; + if (n > retval) { + results[retval] = IP_PROTO_TAG_QUIC; + if (results[retval]) { + ++retval; + } + if (n > retval) { + retval += super::populate_protocol(results + retval, n - retval); + } + } + return retval; +} + +const char * +QUICNetVConnection::protocol_contains(ts::StringView prefix) const +{ + const char *retval = nullptr; + ts::StringView tag = IP_PROTO_TAG_QUIC; + if (prefix.size() <= tag.size() && strncmp(tag.ptr(), prefix.ptr(), prefix.size()) == 0) { + retval = tag.ptr(); + } else { + retval = super::protocol_contains(prefix); + } + return retval; +} + void QUICNetVConnection::registerNextProtocolSet(SSLNextProtocolSet *s) { diff --git a/lib/ts/ink_inet.cc b/lib/ts/ink_inet.cc index 2467916..188519a 100644 --- a/lib/ts/ink_inet.cc +++ b/lib/ts/ink_inet.cc @@ -36,6 +36,7 @@ const ts::StringView IP_PROTO_TAG_IPV4("ipv4", ts::StringView::literal); const ts::StringView IP_PROTO_TAG_IPV6("ipv6", ts::StringView::literal); const ts::StringView IP_PROTO_TAG_UDP("udp", ts::StringView::literal); const ts::StringView IP_PROTO_TAG_TCP("tcp", ts::StringView::literal); +const ts::StringView IP_PROTO_TAG_QUIC("quic", ts::StringView::literal); const ts::StringView IP_PROTO_TAG_TLS_1_0("tls/1.0", ts::StringView::literal); const ts::StringView IP_PROTO_TAG_TLS_1_1("tls/1.1", ts::StringView::literal); const ts::StringView IP_PROTO_TAG_TLS_1_2("tls/1.2", ts::StringView::literal); diff --git a/lib/ts/ink_inet.h b/lib/ts/ink_inet.h index bca32a0..585eaca 100644 --- a/lib/ts/ink_inet.h +++ b/lib/ts/ink_inet.h @@ -50,6 +50,7 @@ extern const ts::StringView IP_PROTO_TAG_IPV4; extern const ts::StringView IP_PROTO_TAG_IPV6; extern const ts::StringView IP_PROTO_TAG_UDP; extern const ts::StringView IP_PROTO_TAG_TCP; +extern const ts::StringView IP_PROTO_TAG_QUIC; extern const ts::StringView IP_PROTO_TAG_TLS_1_0; extern const ts::StringView IP_PROTO_TAG_TLS_1_1; extern const ts::StringView IP_PROTO_TAG_TLS_1_2; diff --git a/proxy/hq/HQClientSession.cc b/proxy/hq/HQClientSession.cc index 27d1961..ce4d6cc 100644 --- a/proxy/hq/HQClientSession.cc +++ b/proxy/hq/HQClientSession.cc @@ -124,6 +124,19 @@ HQClientSession::release(ProxyClientTransaction *trans) return; } +int +HQClientSession::populate_protocol(ts::StringView *result, int size) const +{ + int retval = 0; + if (size > retval) { + result[retval++] = IP_PROTO_TAG_HTTP_QUIC; + if (size > retval) { + retval += super::populate_protocol(result + retval, size - retval); + } + } + return retval; +} + void HQClientSession::add_transaction(HQClientTransaction *trans) { diff --git a/proxy/hq/HQClientSession.h b/proxy/hq/HQClientSession.h index b3a4ce4..0eaecc8 100644 --- a/proxy/hq/HQClientSession.h +++ b/proxy/hq/HQClientSession.h @@ -29,6 +29,8 @@ class HQClientSession : public ProxyClientSession { public: + typedef ProxyClientSession super; ///< Parent type. + HQClientSession(NetVConnection *vc); ~HQClientSession(); @@ -48,6 +50,7 @@ public: int get_transact_count() const override; const char *get_protocol_string() const override; void release(ProxyClientTransaction *trans) override; + int populate_protocol(ts::StringView *result, int size) const override; // HQClientSession specific methods void add_transaction(HQClientTransaction *); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].