telemetry.h (3158B)
1/** 2 * FreeRDP: A Remote Desktop Protocol Implementation 3 * Telemetry Virtual Channel Extension 4 * 5 * Copyright 2022 Pascal Nowack <Pascal.Nowack@gmx.de> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H 21#define FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H 22 23#include <freerdp/channels/telemetry.h> 24#include <freerdp/channels/wtsvc.h> 25 26typedef struct _telemetry_server_context TelemetryServerContext; 27 28typedef UINT (*psTelemetryServerOpen)(TelemetryServerContext* context); 29typedef UINT (*psTelemetryServerClose)(TelemetryServerContext* context); 30 31typedef BOOL (*psTelemetryServerChannelIdAssigned)(TelemetryServerContext* context, 32 UINT32 channelId); 33 34typedef UINT (*psTelemetryServerInitialize)(TelemetryServerContext* context, BOOL externalThread); 35typedef UINT (*psTelemetryServerPoll)(TelemetryServerContext* context); 36typedef BOOL (*psTelemetryServerChannelHandle)(TelemetryServerContext* context, HANDLE* handle); 37 38typedef UINT (*psTelemetryServerRdpTelemetry)(TelemetryServerContext* context, 39 const TELEMETRY_RDP_TELEMETRY_PDU* rdpTelemetry); 40 41struct _telemetry_server_context 42{ 43 HANDLE vcm; 44 45 /* Server self-defined pointer. */ 46 void* userdata; 47 48 /*** APIs called by the server. ***/ 49 50 /** 51 * Optional: Set thread handling. 52 * When externalThread=TRUE, the application is responsible to call 53 * Poll() periodically to process channel events. 54 * 55 * Defaults to externalThread=FALSE 56 */ 57 psTelemetryServerInitialize Initialize; 58 59 /** 60 * Open the telemetry channel. 61 */ 62 psTelemetryServerOpen Open; 63 64 /** 65 * Close the telemetry channel. 66 */ 67 psTelemetryServerClose Close; 68 69 /** 70 * Poll 71 * When externalThread=TRUE, call Poll() periodically from your main loop. 72 * If externalThread=FALSE do not call. 73 */ 74 psTelemetryServerPoll Poll; 75 76 /** 77 * Retrieve the channel handle for use in conjunction with Poll(). 78 * If externalThread=FALSE do not call. 79 */ 80 psTelemetryServerChannelHandle ChannelHandle; 81 82 /*** Callbacks registered by the server. ***/ 83 84 /** 85 * Callback, when the channel got its id assigned 86 */ 87 psTelemetryServerChannelIdAssigned ChannelIdAssigned; 88 /** 89 * Callback for the RDP Telemetry PDU. 90 */ 91 psTelemetryServerRdpTelemetry RdpTelemetry; 92 93 rdpContext* rdpcontext; 94}; 95 96#ifdef __cplusplus 97extern "C" 98{ 99#endif 100 101 FREERDP_API TelemetryServerContext* telemetry_server_context_new(HANDLE vcm); 102 FREERDP_API void telemetry_server_context_free(TelemetryServerContext* context); 103 104#ifdef __cplusplus 105} 106#endif 107 108#endif /* FREERDP_CHANNEL_TELEMETRY_SERVER_TELEMETRY_H */