proxygen
wangle::TransportInfo Struct Reference

#include <TransportInfo.h>

Public Member Functions

std::chrono::milliseconds getRttMs () const
 
bool initWithSocket (const folly::AsyncSocket *sock)
 

Static Public Member Functions

static int64_t readRTT (const folly::AsyncSocket *sock)
 

Public Attributes

std::chrono::steady_clock::time_point acceptTime {}
 
std::chrono::microseconds rtt {0}
 
int64_t rtt_var {-1}
 
int64_t rtx {-1}
 
int64_t rtx_tm {-1}
 
int64_t rto {-1}
 
int64_t cwnd {-1}
 
int64_t cwndBytes {-1}
 
int64_t mss {-1}
 
int64_t ssthresh {-1}
 
std::chrono::milliseconds setupTime {0}
 
std::chrono::milliseconds sslSetupTime {0}
 
std::shared_ptr< std::stringsslCipher {nullptr}
 
std::shared_ptr< std::stringsslServerName {nullptr}
 
std::shared_ptr< std::stringsslClientCiphers {nullptr}
 
std::shared_ptr< std::stringsslClientCiphersHex {nullptr}
 
std::shared_ptr< std::stringsslClientComprMethods {nullptr}
 
std::shared_ptr< std::stringsslClientExts {nullptr}
 
std::shared_ptr< std::stringsslClientSigAlgs {nullptr}
 
std::shared_ptr< std::stringsslClientSupportedVersions {nullptr}
 
std::shared_ptr< std::stringsslSignature {nullptr}
 
std::shared_ptr< std::stringsslServerCiphers {nullptr}
 
std::shared_ptr< std::stringguessedUserAgent {nullptr}
 
std::shared_ptr< std::stringappProtocol {nullptr}
 
int64_t totalBytes {0}
 
std::shared_ptr< folly::SocketAddressremoteAddr
 
std::shared_ptr< folly::SocketAddresslocalAddr
 
std::shared_ptr< folly::SocketAddressclientAddrOriginal
 
HTTPHeaderSize ingressHeader
 
HTTPHeaderSize egressHeader
 
int32_t timeToFirstHeaderByte {-1}
 
int32_t timeToFirstByte {-1}
 
int32_t timeToLastByte {-1}
 
int32_t timeToLastBodyByteAck {-1}
 
int32_t lastByteAckLatency {-1}
 
int32_t proxyLatency {-1}
 
int32_t clientLatency {-1}
 
int32_t serverLatency {-1}
 
int32_t connectLatency {-1}
 
uint32_t egressBodySize {0}
 
int tcpinfoErrno {0}
 
uint32_t sslSetupBytesWritten {0}
 
uint32_t sslSetupBytesRead {0}
 
std::string sslError
 
uint32_t ingressBodySize {0}
 
uint16_t sslVersion {0}
 
std::shared_ptr< std::stringsslCertSigAlgName {nullptr}
 
uint16_t sslCertSize {0}
 
uint16_t statusCode {0}
 
SSLResumeEnum sslResume {SSLResumeEnum::NA}
 
bool validTcpinfo {false}
 
bool secure {false}
 
std::string securityType
 
std::shared_ptr< ProtocolInfoprotocolInfo {nullptr}
 
std::shared_ptr< std::stringtcpSignature {nullptr}
 
bool tfoSucceded {false}
 
folly::Optional< uint8_tnegotiatedTokenBindingKeyParameters
 

Detailed Description

Definition at line 61 of file TransportInfo.h.

Member Function Documentation

std::chrono::milliseconds wangle::TransportInfo::getRttMs ( ) const
inline

Definition at line 400 of file TransportInfo.h.

References int64_t.

400  {
401  return std::chrono::duration_cast<std::chrono::milliseconds>(rtt);
402  }
std::chrono::microseconds rtt
Definition: TransportInfo.h:70
bool wangle::TransportInfo::initWithSocket ( const folly::AsyncSocket sock)

Definition at line 28 of file TransportInfo.cpp.

References cwnd, cwndBytes, mss, rto, rtt, rtt_var, rtx, rtx_tm, ssthresh, tcpinfoErrno, and validTcpinfo.

Referenced by wangle::Acceptor::connectionReady(), and proxygen::HTTPSession::getCurrentTransportInfoWithoutUpdate().

28  {
29 #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
30  if (!TransportInfo::readTcpInfo(&tcpinfo, sock)) {
31  tcpinfoErrno = errno;
32  return false;
33  }
34 #ifdef __APPLE__
35  rtt = microseconds(tcpinfo.tcpi_srtt * 1000);
36  rtt_var = tcpinfo.tcpi_rttvar * 1000;
37  rto = tcpinfo.tcpi_rto * 1000;
38  rtx_tm = -1;
39  mss = tcpinfo.tcpi_maxseg;
40  cwndBytes = tcpinfo.tcpi_snd_cwnd;
41  if (mss > 0) {
42  cwnd = (cwndBytes + mss - 1) / mss;
43  }
44 #else
45  rtt = microseconds(tcpinfo.tcpi_rtt);
46  rtt_var = tcpinfo.tcpi_rttvar;
47  rto = tcpinfo.tcpi_rto;
48  rtx_tm = tcpinfo.tcpi_retransmits;
49  mss = tcpinfo.tcpi_snd_mss;
50  cwnd = tcpinfo.tcpi_snd_cwnd;
51  cwndBytes = cwnd * mss;
52 #endif // __APPLE__
53  ssthresh = tcpinfo.tcpi_snd_ssthresh;
54 #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 17
55  rtx = tcpinfo.tcpi_total_retrans;
56 #else
57  rtx = -1;
58 #endif // __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 17
59  validTcpinfo = true;
60 #else
61  tcpinfoErrno = EINVAL;
62  rtt = microseconds(-1);
63  rtt_var = -1;
64  rtx = -1;
65  rtx_tm = -1;
66  rto = -1;
67  cwnd = -1;
68  mss = -1;
69  ssthresh = -1;
70 #endif
71  return true;
72 }
std::chrono::microseconds rtt
Definition: TransportInfo.h:70
int64_t wangle::TransportInfo::readRTT ( const folly::AsyncSocket sock)
static

Definition at line 74 of file TransportInfo.cpp.

References folly::AsyncSocket::getFd(), and folly::netops::getsockopt().

74  {
75 #if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
76  tcp_info tcpinfo;
77  if (!TransportInfo::readTcpInfo(&tcpinfo, sock)) {
78  return -1;
79  }
80 #endif
81 #if defined(__linux__) || defined(__FreeBSD__)
82  return tcpinfo.tcpi_rtt;
83 #elif defined(__APPLE__)
84  return tcpinfo.tcpi_srtt;
85 #else
86  return -1;
87 #endif
88 }

Member Data Documentation

std::chrono::steady_clock::time_point wangle::TransportInfo::acceptTime {}

Definition at line 65 of file TransportInfo.h.

Referenced by proxygen::HTTPConnector::connectSuccess().

std::shared_ptr<std::string> wangle::TransportInfo::appProtocol {nullptr}
std::shared_ptr<folly::SocketAddress> wangle::TransportInfo::clientAddrOriginal

If the client passed through one of our L4 proxies (using PROXY Protocol), then this will contain the IP address of the proxy host.

Definition at line 222 of file TransportInfo.h.

int32_t wangle::TransportInfo::clientLatency {-1}

Definition at line 292 of file TransportInfo.h.

int32_t wangle::TransportInfo::connectLatency {-1}

Definition at line 302 of file TransportInfo.h.

int64_t wangle::TransportInfo::cwnd {-1}

Definition at line 95 of file TransportInfo.h.

Referenced by initWithSocket().

int64_t wangle::TransportInfo::cwndBytes {-1}

Definition at line 100 of file TransportInfo.h.

Referenced by initWithSocket().

uint32_t wangle::TransportInfo::egressBodySize {0}

Definition at line 307 of file TransportInfo.h.

HTTPHeaderSize wangle::TransportInfo::egressHeader

Definition at line 232 of file TransportInfo.h.

std::shared_ptr<std::string> wangle::TransportInfo::guessedUserAgent {nullptr}

Definition at line 194 of file TransportInfo.h.

uint32_t wangle::TransportInfo::ingressBodySize {0}

body bytes read

Definition at line 328 of file TransportInfo.h.

HTTPHeaderSize wangle::TransportInfo::ingressHeader

header bytes read

Definition at line 227 of file TransportInfo.h.

int32_t wangle::TransportInfo::lastByteAckLatency {-1}

Definition at line 282 of file TransportInfo.h.

std::shared_ptr<folly::SocketAddress> wangle::TransportInfo::localAddr

the address of the local side. If the TransportInfo is associated with the downstream transport in a proxy server, this is an VIP address.

Definition at line 216 of file TransportInfo.h.

int64_t wangle::TransportInfo::mss {-1}

Definition at line 105 of file TransportInfo.h.

Referenced by initWithSocket().

folly::Optional<uint8_t> wangle::TransportInfo::negotiatedTokenBindingKeyParameters

Definition at line 395 of file TransportInfo.h.

std::shared_ptr<ProtocolInfo> wangle::TransportInfo::protocolInfo {nullptr}

Definition at line 376 of file TransportInfo.h.

int32_t wangle::TransportInfo::proxyLatency {-1}

Definition at line 287 of file TransportInfo.h.

std::shared_ptr<folly::SocketAddress> wangle::TransportInfo::remoteAddr

the address of the remote side. If this is associated with a client socket, it is a server side address. Otherwise, it is a client side address.

Definition at line 210 of file TransportInfo.h.

int64_t wangle::TransportInfo::rto {-1}

Definition at line 90 of file TransportInfo.h.

Referenced by initWithSocket().

std::chrono::microseconds wangle::TransportInfo::rtt {0}
int64_t wangle::TransportInfo::rtt_var {-1}

Definition at line 75 of file TransportInfo.h.

Referenced by initWithSocket().

int64_t wangle::TransportInfo::rtx {-1}
int64_t wangle::TransportInfo::rtx_tm {-1}

Definition at line 85 of file TransportInfo.h.

Referenced by initWithSocket().

std::string wangle::TransportInfo::securityType

What is providing the security.

Definition at line 371 of file TransportInfo.h.

Referenced by wangle::SSLAcceptorHandshakeHelper::fillSSLTransportInfoFields().

int32_t wangle::TransportInfo::serverLatency {-1}

Definition at line 297 of file TransportInfo.h.

std::chrono::milliseconds wangle::TransportInfo::setupTime {0}

Definition at line 127 of file TransportInfo.h.

Referenced by proxygen::HTTPSession::getCurrentTransportInfo().

std::shared_ptr<std::string> wangle::TransportInfo::sslCertSigAlgName {nullptr}
uint16_t wangle::TransportInfo::sslCertSize {0}
std::shared_ptr<std::string> wangle::TransportInfo::sslClientCiphers {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslClientCiphersHex {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslClientComprMethods {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslClientExts {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslClientSigAlgs {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslClientSupportedVersions {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslServerCiphers {nullptr}
std::shared_ptr<std::string> wangle::TransportInfo::sslServerName {nullptr}
uint32_t wangle::TransportInfo::sslSetupBytesRead {0}
uint32_t wangle::TransportInfo::sslSetupBytesWritten {0}
std::chrono::milliseconds wangle::TransportInfo::sslSetupTime {0}
std::shared_ptr<std::string> wangle::TransportInfo::sslSignature {nullptr}

Definition at line 184 of file TransportInfo.h.

int64_t wangle::TransportInfo::ssthresh {-1}

Definition at line 110 of file TransportInfo.h.

Referenced by initWithSocket().

uint16_t wangle::TransportInfo::statusCode {0}

response status code

Definition at line 350 of file TransportInfo.h.

int wangle::TransportInfo::tcpinfoErrno {0}

Definition at line 312 of file TransportInfo.h.

Referenced by initWithSocket().

std::shared_ptr<std::string> wangle::TransportInfo::tcpSignature {nullptr}

Definition at line 382 of file TransportInfo.h.

bool wangle::TransportInfo::tfoSucceded {false}

Definition at line 389 of file TransportInfo.h.

int32_t wangle::TransportInfo::timeToFirstByte {-1}

Definition at line 265 of file TransportInfo.h.

int32_t wangle::TransportInfo::timeToFirstHeaderByte {-1}

Definition at line 260 of file TransportInfo.h.

int32_t wangle::TransportInfo::timeToLastBodyByteAck {-1}

Definition at line 275 of file TransportInfo.h.

int32_t wangle::TransportInfo::timeToLastByte {-1}

Definition at line 270 of file TransportInfo.h.

int64_t wangle::TransportInfo::totalBytes {0}

Definition at line 204 of file TransportInfo.h.

Referenced by proxygen::HTTPSession::onWriteSuccess().

bool wangle::TransportInfo::validTcpinfo {false}

Definition at line 361 of file TransportInfo.h.

Referenced by initWithSocket().


The documentation for this struct was generated from the following files: