1 // Copyright 2018 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 OSP_IMPL_MDNS_PLATFORM_SERVICE_H_
6 #define OSP_IMPL_MDNS_PLATFORM_SERVICE_H_
7 
8 #include <vector>
9 
10 #include "platform/api/network_interface.h"
11 #include "platform/api/udp_socket.h"
12 
13 namespace openscreen {
14 namespace osp {
15 
16 class MdnsPlatformService {
17  public:
18   struct BoundInterface {
19     BoundInterface(const InterfaceInfo& interface_info,
20                    const IPSubnet& subnet,
21                    UdpSocket* socket);
22     ~BoundInterface();
23 
24     bool operator==(const BoundInterface& other) const;
25     bool operator!=(const BoundInterface& other) const;
26 
27     InterfaceInfo interface_info;
28     IPSubnet subnet;
29     UdpSocket* socket;
30   };
31 
32   virtual ~MdnsPlatformService() = default;
33 
34   virtual std::vector<BoundInterface> RegisterInterfaces(
35       const std::vector<NetworkInterfaceIndex>& allowlist) = 0;
36   virtual void DeregisterInterfaces(
37       const std::vector<BoundInterface>& registered_interfaces) = 0;
38 };
39 
40 }  // namespace osp
41 }  // namespace openscreen
42 
43 #endif  // OSP_IMPL_MDNS_PLATFORM_SERVICE_H_
44