|
| 1 | +/* |
| 2 | + * |
| 3 | + * Copyright (c) 2024 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 | + |
| 18 | +#pragma once |
| 19 | + |
| 20 | +#include <app-common/zap-generated/cluster-enums.h> |
| 21 | +#include <app-common/zap-generated/cluster-objects.h> |
| 22 | +#include <inet/IPAddress.h> |
| 23 | +#include <lib/core/CHIPError.h> |
| 24 | +#include <lib/core/Optional.h> |
| 25 | +#include <lib/support/ScopedBuffer.h> |
| 26 | +#include <lib/support/Span.h> |
| 27 | +#include <lib/support/ThreadOperationalDataset.h> |
| 28 | + |
| 29 | +namespace chip { |
| 30 | +namespace app { |
| 31 | +namespace Clusters { |
| 32 | +namespace ThreadBorderRouterManagement { |
| 33 | + |
| 34 | +constexpr size_t kBorderRouterNameMaxLength = 63; |
| 35 | +constexpr size_t kBorderAgentIdLength = 16; |
| 36 | + |
| 37 | +class Delegate |
| 38 | +{ |
| 39 | +public: |
| 40 | + Delegate() = default; |
| 41 | + virtual ~Delegate() = default; |
| 42 | + |
| 43 | + using RouteTableEntry = Structs::RouteTableStruct::Type; |
| 44 | + using ChildTableEntry = Structs::ChildTableStruct::Type; |
| 45 | + class ThreadNode : public Structs::ThreadNodeStruct::Type |
| 46 | + { |
| 47 | + public: |
| 48 | + Platform::ScopedMemoryBuffer<chip::Inet::IPAddress> Ipv6Addresses; |
| 49 | + Platform::ScopedMemoryBuffer<chip::ByteSpan> Ipv6AddressesSpans; |
| 50 | + Platform::ScopedMemoryBuffer<RouteTableEntry> Routes; |
| 51 | + Platform::ScopedMemoryBuffer<ChildTableEntry> Children; |
| 52 | + }; |
| 53 | + class Callback |
| 54 | + { |
| 55 | + public: |
| 56 | + virtual void OnTopologyRequestFinished(Protocols::InteractionModel::Status status, uint8_t snapshot, |
| 57 | + const Span<ThreadNode> & threadNodes) = 0; |
| 58 | + |
| 59 | + virtual ~Callback() = default; |
| 60 | + }; |
| 61 | + |
| 62 | + virtual CHIP_ERROR Init() = 0; |
| 63 | + |
| 64 | + virtual CHIP_ERROR GetPanChangeSupported(bool & panChangeSupported) = 0; |
| 65 | + |
| 66 | + virtual CHIP_ERROR GetBorderRouterName(MutableCharSpan & borderRouterName) = 0; |
| 67 | + |
| 68 | + virtual CHIP_ERROR GetBorderAgentId(MutableByteSpan & borderAgentId) = 0; |
| 69 | + |
| 70 | + virtual CHIP_ERROR GetThreadVersion(uint16_t & threadVersion) = 0; |
| 71 | + |
| 72 | + virtual CHIP_ERROR GetInterfaceEnabled(bool & interfaceEnabled) = 0; |
| 73 | + |
| 74 | + virtual CHIP_ERROR GetThreadNode(ThreadNode & threadNode) = 0; |
| 75 | + |
| 76 | + virtual CHIP_ERROR GetActiveDataset(chip::Thread::OperationalDataset & activeDataset) = 0; |
| 77 | + |
| 78 | + virtual CHIP_ERROR GetPendingDataset(chip::Thread::OperationalDataset & pendingDataset) = 0; |
| 79 | + |
| 80 | + virtual CHIP_ERROR SetActiveDataset(const chip::Thread::OperationalDataset & activeDataset) = 0; |
| 81 | + |
| 82 | + virtual CHIP_ERROR SetPendingDataset(const chip::Thread::OperationalDataset & pendingDataset) = 0; |
| 83 | + |
| 84 | + virtual CHIP_ERROR GetTopology(uint8_t snapshot, Callback * callback) = 0; |
| 85 | +}; |
| 86 | + |
| 87 | +} // namespace ThreadBorderRouterManagement |
| 88 | +} // namespace Clusters |
| 89 | +} // namespace app |
| 90 | +} // namespace chip |
0 commit comments