OLD | NEW |
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_HOST_RESOLVER_PROC_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_PROC_H_ |
6 #define NET_BASE_HOST_RESOLVER_PROC_H_ | 6 #define NET_BASE_HOST_RESOLVER_PROC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 // the HostResolver implementation using them can be multi-threaded. | 23 // the HostResolver implementation using them can be multi-threaded. |
24 class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { | 24 class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { |
25 public: | 25 public: |
26 explicit HostResolverProc(HostResolverProc* previous); | 26 explicit HostResolverProc(HostResolverProc* previous); |
27 | 27 |
28 // Resolves |host| to an address list, restricting the results to addresses | 28 // Resolves |host| to an address list, restricting the results to addresses |
29 // in |address_family|. If successful returns OK and fills |addrlist| with | 29 // in |address_family|. If successful returns OK and fills |addrlist| with |
30 // a list of socket addresses. Otherwise returns a network error code. | 30 // a list of socket addresses. Otherwise returns a network error code. |
31 virtual int Resolve(const std::string& host, | 31 virtual int Resolve(const std::string& host, |
32 AddressFamily address_family, | 32 AddressFamily address_family, |
33 HostResolverFlags host_resolver_flags, | |
34 AddressList* addrlist) = 0; | 33 AddressList* addrlist) = 0; |
35 | 34 |
36 protected: | 35 protected: |
37 friend class base::RefCountedThreadSafe<HostResolverProc>; | 36 friend class base::RefCountedThreadSafe<HostResolverProc>; |
38 | 37 |
39 virtual ~HostResolverProc() {} | 38 virtual ~HostResolverProc() {} |
40 | 39 |
41 // Asks the fallback procedure (if set) to do the resolve. | 40 // Asks the fallback procedure (if set) to do the resolve. |
42 int ResolveUsingPrevious(const std::string& host, | 41 int ResolveUsingPrevious(const std::string& host, |
43 AddressFamily address_family, | 42 AddressFamily address_family, |
44 HostResolverFlags host_resolver_flags, | |
45 AddressList* addrlist); | 43 AddressList* addrlist); |
46 | 44 |
47 private: | 45 private: |
48 friend class HostResolverImpl; | 46 friend class HostResolverImpl; |
49 friend class MockHostResolverBase; | 47 friend class MockHostResolverBase; |
50 friend class ScopedDefaultHostResolverProc; | 48 friend class ScopedDefaultHostResolverProc; |
51 | 49 |
52 // Sets the previous procedure in the chain. Aborts if this would result in a | 50 // Sets the previous procedure in the chain. Aborts if this would result in a |
53 // cycle. | 51 // cycle. |
54 void SetPreviousProc(HostResolverProc* proc); | 52 void SetPreviousProc(HostResolverProc* proc); |
(...skipping 18 matching lines...) Expand all Loading... |
73 | 71 |
74 DISALLOW_COPY_AND_ASSIGN(HostResolverProc); | 72 DISALLOW_COPY_AND_ASSIGN(HostResolverProc); |
75 }; | 73 }; |
76 | 74 |
77 // Resolves |host| to an address list, using the system's default host resolver. | 75 // Resolves |host| to an address list, using the system's default host resolver. |
78 // (i.e. this calls out to getaddrinfo()). If successful returns OK and fills | 76 // (i.e. this calls out to getaddrinfo()). If successful returns OK and fills |
79 // |addrlist| with a list of socket addresses. Otherwise returns a | 77 // |addrlist| with a list of socket addresses. Otherwise returns a |
80 // network error code. | 78 // network error code. |
81 int SystemHostResolverProc(const std::string& host, | 79 int SystemHostResolverProc(const std::string& host, |
82 AddressFamily address_family, | 80 AddressFamily address_family, |
83 HostResolverFlags host_resolver_flags, | |
84 AddressList* addrlist); | 81 AddressList* addrlist); |
85 | 82 |
86 } // namespace net | 83 } // namespace net |
87 | 84 |
88 #endif // NET_BASE_HOST_RESOLVER_PROC_H_ | 85 #endif // NET_BASE_HOST_RESOLVER_PROC_H_ |
OLD | NEW |