Line data Source code
1 : #pragma once 2 : 3 : #include <vector> 4 : 5 : #include "envoy/matcher/matcher.h" 6 : #include "envoy/network/address.h" 7 : #include "envoy/stats/stats_macros.h" 8 : 9 : #include "source/common/network/lc_trie.h" 10 : 11 : namespace Envoy { 12 : namespace Extensions { 13 : namespace Matching { 14 : namespace InputMatchers { 15 : namespace IP { 16 : 17 0 : #define IP_MATCHER_STATS(COUNTER) COUNTER(ip_parsing_failed) 18 : 19 : struct MatcherStats { 20 : IP_MATCHER_STATS(GENERATE_COUNTER_STRUCT); 21 : }; 22 : 23 : class Matcher : public Envoy::Matcher::InputMatcher, Logger::Loggable<Logger::Id::filter> { 24 : public: 25 : Matcher(std::vector<Network::Address::CidrRange> const& ranges, absl::string_view stat_prefix, 26 : Stats::Scope& stat_scope); 27 : bool match(const Envoy::Matcher::MatchingDataType& input) override; 28 0 : absl::optional<const MatcherStats> stats() const { return stats_; } 29 : 30 : private: 31 : const Network::LcTrie::LcTrie<bool> trie_; 32 : MatcherStats stats_; 33 : }; 34 : 35 : } // namespace IP 36 : } // namespace InputMatchers 37 : } // namespace Matching 38 : } // namespace Extensions 39 : } // namespace Envoy