Chromium Code Reviews

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

Issue 1705001: Unit tests for HttpAuthHandlerNegotiate (Closed)
Patch Set: Respond to eroman's concerns. Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | net/base/address_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_ADDRESS_LIST_H_ 5 #ifndef NET_BASE_ADDRESS_LIST_H_
6 #define NET_BASE_ADDRESS_LIST_H_ 6 #define NET_BASE_ADDRESS_LIST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
(...skipping 41 matching lines...)
52 // If the canonical name exists, |*canonical_name| is filled in with the 52 // If the canonical name exists, |*canonical_name| is filled in with the
53 // value and true is returned. If it does not exist, |*canonical_name| is 53 // value and true is returned. If it does not exist, |*canonical_name| is
54 // not altered and false is returned. 54 // not altered and false is returned.
55 // |canonical_name| must be a non-null value. 55 // |canonical_name| must be a non-null value.
56 bool GetCanonicalName(std::string* canonical_name) const; 56 bool GetCanonicalName(std::string* canonical_name) const;
57 57
58 // Clears all data from this address list. This leaves the list in the same 58 // Clears all data from this address list. This leaves the list in the same
59 // empty state as when first constructed. 59 // empty state as when first constructed.
60 void Reset(); 60 void Reset();
61 61
62 // Used by unit-tests to manually set the TCP socket address. 62 // Used by unit-tests to manually create an IPv4 AddressList. |data| should
63 static AddressList CreateIPv6Address(unsigned char data[16]); 63 // be an IPv4 address in network order (big endian).
64 // If |canonical_name| is non-empty, it will be duplicated in the
65 // ai_canonname field of the addrinfo struct.
66 static AddressList CreateIPv4Address(unsigned char data[4],
67 const std::string& canonical_name);
68
69 // Used by unit-tests to manually create an IPv6 AddressList. |data| should
70 // be an IPv6 address in network order (big endian).
71 // If |canonical_name| is non-empty, it will be duplicated in the
72 // ai_canonname field of the addrinfo struct.
73 static AddressList CreateIPv6Address(unsigned char data[16],
74 const std::string& canonical_name);
64 75
65 // Get access to the head of the addrinfo list. 76 // Get access to the head of the addrinfo list.
66 const struct addrinfo* head() const { return data_->head; } 77 const struct addrinfo* head() const { return data_->head; }
67 78
68 private: 79 private:
69 struct Data : public base::RefCountedThreadSafe<Data> { 80 struct Data : public base::RefCountedThreadSafe<Data> {
70 Data(struct addrinfo* ai, bool is_system_created); 81 Data(struct addrinfo* ai, bool is_system_created);
71 struct addrinfo* head; 82 struct addrinfo* head;
72 83
73 // Indicates which free function to use for |head|. 84 // Indicates which free function to use for |head|.
74 bool is_system_created; 85 bool is_system_created;
75 86
76 private: 87 private:
77 friend class base::RefCountedThreadSafe<Data>; 88 friend class base::RefCountedThreadSafe<Data>;
78 89
79 ~Data(); 90 ~Data();
80 }; 91 };
81 92
82 explicit AddressList(Data* data) : data_(data) {} 93 explicit AddressList(Data* data) : data_(data) {}
83 94
84 scoped_refptr<Data> data_; 95 scoped_refptr<Data> data_;
85 }; 96 };
86 97
87 } // namespace net 98 } // namespace net
88 99
89 #endif // NET_BASE_ADDRESS_LIST_H_ 100 #endif // NET_BASE_ADDRESS_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | net/base/address_list.cc » ('j') | no next file with comments »

Powered by Google App Engine