LCOV - code coverage report
Current view: top level - lib/dnssd/minimal_mdns - AddressPolicy.h (source / functions) Hit Total Coverage
Test: lcov_final.info Lines: 1 1 100.0 %
Date: 2024-02-15 08:20:41 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /*
       2             :  *
       3             :  *    Copyright (c) 2022 Project CHIP Authors
       4             :  *
       5             :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6             :  *    you may not use this file except in compliance with the License.
       7             :  *    You may obtain a copy of the License at
       8             :  *
       9             :  *        http://www.apache.org/licenses/LICENSE-2.0
      10             :  *
      11             :  *    Unless required by applicable law or agreed to in writing, software
      12             :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13             :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14             :  *    See the License for the specific language governing permissions and
      15             :  *    limitations under the License.
      16             :  */
      17             : #pragma once
      18             : 
      19             : #include <lib/dnssd/minimal_mdns/ListenIterator.h>
      20             : #include <lib/dnssd/minimal_mdns/ServerIPAddresses.h>
      21             : #include <lib/support/CHIPMem.h>
      22             : 
      23             : namespace mdns {
      24             : namespace Minimal {
      25             : 
      26             : /// Describes a policy of endpoints and IP addresses to use for
      27             : /// MinMDNS listening and advertisement.
      28             : class AddressPolicy
      29             : {
      30             : public:
      31          31 :     virtual ~AddressPolicy() = default;
      32             : 
      33             :     /// Get all endpoints on which minimal MDNS should listen on.
      34             :     virtual chip::Platform::UniquePtr<ListenIterator> GetListenEndpoints() = 0;
      35             : 
      36             :     /// Fetch all the IP addresses for the given interface which are valid
      37             :     /// for DNSSD server advertisement.
      38             :     ///
      39             :     /// Generally this should skip invalid addresses even if reported by the
      40             :     /// underlying operating system (e.g. linux could skip deprecated/temporary/dad-failed ones).
      41             :     virtual chip::Platform::UniquePtr<IpAddressIterator> GetIpAddressesForEndpoint(chip::Inet::InterfaceId interfaceId,
      42             :                                                                                    chip::Inet::IPAddressType type) = 0;
      43             : };
      44             : 
      45             : /// Fetch the globally used MinMDNS address policy
      46             : AddressPolicy * GetAddressPolicy();
      47             : 
      48             : /// Update the global address policy.
      49             : ///
      50             : /// MUST be called before any minmdns functionality is used (e.g. server
      51             : /// startup)
      52             : void SetAddressPolicy(AddressPolicy * policy);
      53             : 
      54             : } // namespace Minimal
      55             : } // namespace mdns

Generated by: LCOV version 1.14