aboutsummaryrefslogtreecommitdiff
path: root/osp/impl/mdns_platform_service.h
blob: aca4ffd7d6e5be05209904553456a57e734334b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef OSP_IMPL_MDNS_PLATFORM_SERVICE_H_
#define OSP_IMPL_MDNS_PLATFORM_SERVICE_H_

#include <vector>

#include "platform/api/network_interface.h"
#include "platform/api/udp_socket.h"

namespace openscreen {
namespace osp {

class MdnsPlatformService {
 public:
  struct BoundInterface {
    BoundInterface(const InterfaceInfo& interface_info,
                   const IPSubnet& subnet,
                   UdpSocket* socket);
    ~BoundInterface();

    bool operator==(const BoundInterface& other) const;
    bool operator!=(const BoundInterface& other) const;

    InterfaceInfo interface_info;
    IPSubnet subnet;
    UdpSocket* socket;
  };

  virtual ~MdnsPlatformService() = default;

  virtual std::vector<BoundInterface> RegisterInterfaces(
      const std::vector<NetworkInterfaceIndex>& allowlist) = 0;
  virtual void DeregisterInterfaces(
      const std::vector<BoundInterface>& registered_interfaces) = 0;
};

}  // namespace osp
}  // namespace openscreen

#endif  // OSP_IMPL_MDNS_PLATFORM_SERVICE_H_