Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: net/base/ip_pattern.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/ip_endpoint_unittest.cc ('k') | net/base/ip_pattern.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/ip_pattern.h
diff --git a/net/base/ip_pattern.h b/net/base/ip_pattern.h
deleted file mode 100644
index bf1d45583d3582738b9c637898cbfa014b4c2546..0000000000000000000000000000000000000000
--- a/net/base/ip_pattern.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_BASE_IP_PATTERN_H_
-#define NET_BASE_IP_PATTERN_H_
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/strings/string_piece.h"
-#include "net/base/net_export.h"
-#include "net/base/net_util.h"
-
-namespace net {
-
-// IPPatterns are used to match IP address resolutions for possible augmentation
-// by a MappedIPResolver, which uses IPMappingRules.
-class NET_EXPORT IPPattern {
- public:
- IPPattern();
- ~IPPattern();
-
- // Parse a textual pattern (IP_PATTERN as defined in ip_mapping_rules.h) into
- // |this| and return true if the parsing was successful.
- bool ParsePattern(const std::string& ip_pattern);
- // Test to see if the current pattern in |this| matches the given |address|
- // and return true if it matches.
- bool Match(const IPAddressNumber& address) const;
-
- bool is_ipv4() const { return is_ipv4_; }
-
- private:
- class ComponentPattern;
- typedef std::vector<std::string> Strings;
- typedef std::vector<ComponentPattern*> ComponentPatternList;
-
- // IPv6 addresses have 8 components, while IPv4 addresses have 4 components.
- // ComponentPattern is used to define patterns to match individual components.
- bool ParseComponentPattern(const base::StringPiece& text,
- ComponentPattern* pattern) const;
- // Convert IP component to an int. Assume hex vs decimal for IPV6 vs V4.
- bool ValueTextToInt(const base::StringPiece& input, uint32* output) const;
-
- bool is_ipv4_;
- // The |ip_mask_| indicates, for each component, if this pattern requires an
- // exact match (OCTET in IPv4, or 4 hex digits in IPv6).
- // For each true element there is an entry in |component_values_|, and false
- // means that an entry from our list of ComponentPattern instances must be
- // applied.
- std::vector<bool> ip_mask_;
- // The vector of fixed values that are requried.
- // Other values may be restricted by the component_patterns_;
- // The class invariant is:
- // ip_mask_.size() == component_patterns_.size()
- // + size(our ComponentPattern list)
- std::vector<uint32> component_values_;
- // If only one component position was specified using a range, then this
- // list will only have 1 element (i.e., we only have patterns for each element
- // of ip_mask_ that is false.)
- // We own these elements, and need to destroy them all when we are destroyed.
- ComponentPatternList component_patterns_;
-
- DISALLOW_COPY_AND_ASSIGN(IPPattern);
-};
-
-} // namespace net
-
-#endif // NET_BASE_IP_PATTERN_H_
« no previous file with comments | « net/base/ip_endpoint_unittest.cc ('k') | net/base/ip_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698