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

Side by Side Diff: chrome/common/local_discovery/service_discovery_client.h

Issue 1534583002: Migrate Local Discovery from net::IPAddressNumber to net::IPAddress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_H_ 5 #ifndef CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_H_
6 #define CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_H_ 6 #define CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "net/base/address_family.h" 14 #include "net/base/address_family.h"
15 #include "net/base/host_port_pair.h" 15 #include "net/base/host_port_pair.h"
16 #include "net/base/ip_address_number.h" 16 #include "net/base/ip_address.h"
17 17
18 namespace net { 18 namespace net {
19 class MDnsClient; 19 class MDnsClient;
20 } 20 }
21 21
22 namespace local_discovery { 22 namespace local_discovery {
23 23
24 struct ServiceDescription { 24 struct ServiceDescription {
25 public: 25 public:
26 ServiceDescription(); 26 ServiceDescription();
27 ~ServiceDescription(); 27 ~ServiceDescription();
28 28
29 // Convenience function to get useful parts of the service name. A service 29 // Convenience function to get useful parts of the service name. A service
30 // name follows the format <instance_name>.<service_type>. 30 // name follows the format <instance_name>.<service_type>.
31 std::string instance_name() const; 31 std::string instance_name() const;
32 std::string service_type() const; 32 std::string service_type() const;
33 33
34 // The name of the service. 34 // The name of the service.
35 std::string service_name; 35 std::string service_name;
36 // The address (in host/port format) for the service (from SRV record). 36 // The address (in host/port format) for the service (from SRV record).
37 net::HostPortPair address; 37 net::HostPortPair address;
38 // The metadata (from TXT record) of the service. 38 // The metadata (from TXT record) of the service.
39 std::vector<std::string> metadata; 39 std::vector<std::string> metadata;
40 // IP address of the service, if available from cache. May be empty. 40 // IP address of the service, if available from cache. May be empty.
41 net::IPAddressNumber ip_address; 41 net::IPAddress ip_address;
42 // Last time the service was seen. 42 // Last time the service was seen.
43 base::Time last_seen; 43 base::Time last_seen;
44 }; 44 };
45 45
46 // Lets users browse the network for services of interest or listen for changes 46 // Lets users browse the network for services of interest or listen for changes
47 // in the services they are interested in. See 47 // in the services they are interested in. See
48 // |ServiceDiscoveryClient::CreateServiceWatcher|. 48 // |ServiceDiscoveryClient::CreateServiceWatcher|.
49 class ServiceWatcher { 49 class ServiceWatcher {
50 public: 50 public:
51 enum UpdateType { 51 enum UpdateType {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Start the service reader. 94 // Start the service reader.
95 virtual void StartResolving() = 0; 95 virtual void StartResolving() = 0;
96 96
97 virtual std::string GetName() const = 0; 97 virtual std::string GetName() const = 0;
98 }; 98 };
99 99
100 class LocalDomainResolver { 100 class LocalDomainResolver {
101 public: 101 public:
102 typedef base::Callback<void(bool /*success*/, 102 typedef base::Callback<void(bool /*success*/,
103 const net::IPAddressNumber& /*address_ipv4*/, 103 const net::IPAddress& /*address_ipv4*/,
104 const net::IPAddressNumber& /*address_ipv6*/)> 104 const net::IPAddress& /*address_ipv6*/)>
105 IPAddressCallback; 105 IPAddressCallback;
106 106
107 virtual ~LocalDomainResolver() {} 107 virtual ~LocalDomainResolver() {}
108 108
109 virtual void Start() = 0; 109 virtual void Start() = 0;
110 }; 110 };
111 111
112 class ServiceDiscoveryClient { 112 class ServiceDiscoveryClient {
113 public: 113 public:
114 virtual ~ServiceDiscoveryClient() {} 114 virtual ~ServiceDiscoveryClient() {}
(...skipping 13 matching lines...) Expand all
128 // Create a resolver for local domain, both ipv4 or ipv6. 128 // Create a resolver for local domain, both ipv4 or ipv6.
129 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver( 129 virtual scoped_ptr<LocalDomainResolver> CreateLocalDomainResolver(
130 const std::string& domain, 130 const std::string& domain,
131 net::AddressFamily address_family, 131 net::AddressFamily address_family,
132 const LocalDomainResolver::IPAddressCallback& callback) = 0; 132 const LocalDomainResolver::IPAddressCallback& callback) = 0;
133 }; 133 };
134 134
135 } // namespace local_discovery 135 } // namespace local_discovery
136 136
137 #endif // CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_H_ 137 #endif // CHROME_COMMON_LOCAL_DISCOVERY_SERVICE_DISCOVERY_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698