Line data Source code
1 : /* 2 : * 3 : * Copyright (c) 2020-2021 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 : */ 16 : 17 : #pragma once 18 : 19 : #include <lib/support/CodeUtils.h> 20 : #include <system/SystemPacketBuffer.h> 21 : #include <transport/raw/Base.h> 22 : #include <transport/raw/MessageHeader.h> 23 : #include <transport/raw/PeerAddress.h> 24 : 25 : namespace chip { 26 : 27 : namespace Transport { 28 : class Base; 29 : } 30 : 31 : class TransportMgrDelegate; 32 : 33 : class TransportMgrBase : public Transport::RawTransportDelegate 34 : { 35 : public: 36 : CHIP_ERROR Init(Transport::Base * transport); 37 : 38 : CHIP_ERROR SendMessage(const Transport::PeerAddress & address, System::PacketBufferHandle && msgBuf); 39 : 40 : void Close(); 41 : 42 : void Disconnect(const Transport::PeerAddress & address); 43 : 44 269 : void SetSessionManager(TransportMgrDelegate * sessionManager) { mSessionManager = sessionManager; } 45 : 46 : CHIP_ERROR MulticastGroupJoinLeave(const Transport::PeerAddress & address, bool join); 47 : 48 : void HandleMessageReceived(const Transport::PeerAddress & peerAddress, System::PacketBufferHandle && msg) override; 49 : 50 : private: 51 : TransportMgrDelegate * mSessionManager = nullptr; 52 : Transport::Base * mTransport = nullptr; 53 : }; 54 : 55 : } // namespace chip