MCPcopy Create free account
hub / github.com/apache/trafficserver / TSVConnPPInfoGet

Function TSVConnPPInfoGet

src/api/InkAPI.cc:8427–8462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8425}
8426
8427TSReturnCode
8428TSVConnPPInfoGet(TSVConn vconn, uint16_t key, const char **value, int *length)
8429{
8430 NetVConnection *vc = reinterpret_cast<NetVConnection *>(vconn);
8431
8432 if (key < 0x100) {
8433 auto &tlv = vc->get_proxy_protocol_info().tlv;
8434 if (auto ite = tlv.find(key); ite != tlv.end()) {
8435 *value = ite->second.data();
8436 *length = ite->second.length();
8437 } else {
8438 return TS_ERROR;
8439 }
8440 } else {
8441 switch (key) {
8442 case TS_PP_INFO_SRC_ADDR:
8443 *value = reinterpret_cast<const char *>(vc->get_proxy_protocol_src_addr());
8444 if (*value == nullptr) {
8445 return TS_ERROR;
8446 }
8447 *length = ats_ip_size(reinterpret_cast<const sockaddr *>(*value));
8448 break;
8449 case TS_PP_INFO_DST_ADDR:
8450 *value = reinterpret_cast<const char *>(vc->get_proxy_protocol_dst_addr());
8451 if (*value == nullptr) {
8452 return TS_ERROR;
8453 }
8454 *length = ats_ip_size(reinterpret_cast<const sockaddr *>(*value));
8455 break;
8456 default:
8457 return TS_ERROR;
8458 }
8459 }
8460
8461 return TS_SUCCESS;
8462}
8463
8464TSReturnCode
8465TSVConnPPInfoIntGet(TSVConn vconn, uint16_t key, TSMgmtInt *value)

Callers 2

handle_ssn_startFunction · 0.85
getClientAddrFunction · 0.85

Calls 7

ats_ip_sizeFunction · 0.85
findMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
lengthMethod · 0.45

Tested by 1

handle_ssn_startFunction · 0.68