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

Function check_value

plugins/background_fetch/rules.cc:42–65  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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