File indexing completed on 2024-06-23 05:24:06

0001 // SPDX-FileCopyrightText: 2023 Arjen Hiemstra <ahiemstra@heimr.nl>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0004 
0005 #pragma once
0006 
0007 #include <freerdp/freerdp.h>
0008 
0009 namespace KRdp
0010 {
0011 
0012 class RdpConnection;
0013 class InputHandler;
0014 class VideoStream;
0015 class NetworkDetection;
0016 
0017 /**
0018  * Extension of the FreeRDP Peer Context used to store extra data for KRdp.
0019  */
0020 struct PeerContext {
0021     // The base rdpContext structure.
0022     // Important: This should remain as a plain value as that is how the
0023     // extension mechanism works.
0024     rdpContext _p;
0025 
0026     RdpConnection *connection = nullptr;
0027     InputHandler *inputHandler = nullptr;
0028     VideoStream *stream = nullptr;
0029     NetworkDetection *networkDetection = nullptr;
0030 
0031     HANDLE virtualChannelManager = nullptr;
0032 };
0033 
0034 // Convenience method to get the PeerContext instance for a specific FreeRDP peer.
0035 PeerContext *contextForPeer(freerdp_peer *peer);
0036 }
0037 
0038 // FreeRDP callbacks used to initialize a PeerContext during creation/destruction.
0039 BOOL newPeerContext(freerdp_peer *peer, rdpContext *peer_context);
0040 void freePeerContext(freerdp_peer *peer, rdpContext *peer_context);