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

Side by Side Diff: net/base/ip_pattern.h

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_IP_PATTERN_H_ 5 #ifndef NET_BASE_IP_PATTERN_H_
6 #define NET_BASE_IP_PATTERN_H_ 6 #define NET_BASE_IP_PATTERN_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 23 matching lines...) Expand all
34 private: 34 private:
35 class ComponentPattern; 35 class ComponentPattern;
36 typedef std::vector<std::string> Strings; 36 typedef std::vector<std::string> Strings;
37 typedef std::vector<ComponentPattern*> ComponentPatternList; 37 typedef std::vector<ComponentPattern*> ComponentPatternList;
38 38
39 // IPv6 addresses have 8 components, while IPv4 addresses have 4 components. 39 // IPv6 addresses have 8 components, while IPv4 addresses have 4 components.
40 // ComponentPattern is used to define patterns to match individual components. 40 // ComponentPattern is used to define patterns to match individual components.
41 bool ParseComponentPattern(const base::StringPiece& text, 41 bool ParseComponentPattern(const base::StringPiece& text,
42 ComponentPattern* pattern) const; 42 ComponentPattern* pattern) const;
43 // Convert IP component to an int. Assume hex vs decimal for IPV6 vs V4. 43 // Convert IP component to an int. Assume hex vs decimal for IPV6 vs V4.
44 bool ValueTextToInt(const base::StringPiece& input, uint32* output) const; 44 bool ValueTextToInt(const base::StringPiece& input, uint32_t* output) const;
45 45
46 bool is_ipv4_; 46 bool is_ipv4_;
47 // The |ip_mask_| indicates, for each component, if this pattern requires an 47 // The |ip_mask_| indicates, for each component, if this pattern requires an
48 // exact match (OCTET in IPv4, or 4 hex digits in IPv6). 48 // exact match (OCTET in IPv4, or 4 hex digits in IPv6).
49 // For each true element there is an entry in |component_values_|, and false 49 // For each true element there is an entry in |component_values_|, and false
50 // means that an entry from our list of ComponentPattern instances must be 50 // means that an entry from our list of ComponentPattern instances must be
51 // applied. 51 // applied.
52 std::vector<bool> ip_mask_; 52 std::vector<bool> ip_mask_;
53 // The vector of fixed values that are requried. 53 // The vector of fixed values that are requried.
54 // Other values may be restricted by the component_patterns_; 54 // Other values may be restricted by the component_patterns_;
55 // The class invariant is: 55 // The class invariant is:
56 // ip_mask_.size() == component_patterns_.size() 56 // ip_mask_.size() == component_patterns_.size()
57 // + size(our ComponentPattern list) 57 // + size(our ComponentPattern list)
58 std::vector<uint32> component_values_; 58 std::vector<uint32_t> component_values_;
59 // If only one component position was specified using a range, then this 59 // If only one component position was specified using a range, then this
60 // list will only have 1 element (i.e., we only have patterns for each element 60 // list will only have 1 element (i.e., we only have patterns for each element
61 // of ip_mask_ that is false.) 61 // of ip_mask_ that is false.)
62 // We own these elements, and need to destroy them all when we are destroyed. 62 // We own these elements, and need to destroy them all when we are destroyed.
63 ComponentPatternList component_patterns_; 63 ComponentPatternList component_patterns_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(IPPattern); 65 DISALLOW_COPY_AND_ASSIGN(IPPattern);
66 }; 66 };
67 67
68 } // namespace net 68 } // namespace net
69 69
70 #endif // NET_BASE_IP_PATTERN_H_ 70 #endif // NET_BASE_IP_PATTERN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698