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

Function check_value

plugins/experimental/cache_fill/rules.cc:43–66  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////// These are little helper functions for the main rules evaluator.

Source from the content-addressed store, hash-verified

41// These are little helper functions for the main rules evaluator.
42//
43static bool
44check_value(TSHttpTxn txnp, swoc::IPRange const &range)
45{
46 const sockaddr *client_ip = TSHttpTxnClientAddrGet(txnp);
47 if (!client_ip) {
48 return false;
49 }
50
51 if (range.empty()) { // this means "match any address".
52 return true;
53 }
54
55 swoc::IPEndpoint client_addr{client_ip};
56
57 swoc::bwprint(ts::bw_dbg, "cfg_ip {::c}, client_ip {}", range, client_addr);
58 Dbg(dbg_ctl, "%s", ts::bw_dbg.c_str());
59
60 if (client_addr.family() == range.family()) {
61 return (range.is_ip4() && range.ip4().contains(swoc::IP4Addr(client_addr.ip4()))) ||
62 (range.is_ip6() && range.ip6().contains(swoc::IP6Addr(client_addr.ip6())));
63 }
64
65 return false; // Different family, no match.
66}
67
68static bool
69check_value(TSHttpTxn txnp, BgFetchRule::size_cmp_type const &cmp)

Callers 1

Calls 15

TSHttpTxnClientAddrGetFunction · 0.85
TSHttpTxnServerRespGetFunction · 0.85
TSMimeHdrFieldFindFunction · 0.85
TSHandleMLocReleaseFunction · 0.85
TSHttpTxnClientReqGetFunction · 0.85
IP4AddrFunction · 0.50
IP6AddrFunction · 0.50
TSErrorFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected