• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DELEGATE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DELEGATE_H_
7 
8 #include <string>
9 #include <vector>
10 
11 namespace extensions {
12 
13 struct DnsSdService {
14   std::string service_name;
15   std::string service_host_port;
16   std::string ip_address;
17   std::vector<std::string> service_data;
18 
19   DnsSdService();
20   virtual ~DnsSdService();
21 
22   bool operator==(const DnsSdService& other) const {
23     return service_name == other.service_name &&
24            service_host_port == other.service_host_port &&
25            ip_address == other.ip_address &&
26            service_data == other.service_data;
27   }
28 
29   bool operator!=(const DnsSdService& other) const {
30     return !(*this == other);
31   }
32 };
33 
34 // Delegate that is notified when a watched service is added, updated or
35 // removed.
36 class DnsSdDelegate {
37  public:
38   virtual void ServiceChanged(const std::string& service_type,
39                               bool added,
40                               const DnsSdService& service) = 0;
41   virtual void ServiceRemoved(const std::string& service_type,
42                               const std::string& service_name) = 0;
43   virtual void ServicesFlushed(const std::string& service_type) = 0;
44 };
45 
46 }  // namespace extensions
47 
48 #endif  // CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DELEGATE_H_
49