2014-02-12 00:42:28 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
|
|
|
* Client Channels
|
|
|
|
*
|
|
|
|
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef FREERDP_LIB_CORE_CLIENT_H
|
|
|
|
#define FREERDP_LIB_CORE_CLIENT_H
|
2014-02-12 00:42:28 +04:00
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
#include <winpr/stream.h>
|
2021-08-24 15:09:40 +03:00
|
|
|
#include <winpr/wtsapi.h>
|
2014-02-12 00:42:28 +04:00
|
|
|
|
|
|
|
#include <freerdp/freerdp.h>
|
|
|
|
#include <freerdp/constants.h>
|
|
|
|
|
|
|
|
#include <freerdp/svc.h>
|
|
|
|
#include <freerdp/peer.h>
|
|
|
|
#include <freerdp/addin.h>
|
2016-08-10 10:12:55 +03:00
|
|
|
#include <freerdp/api.h>
|
2014-09-12 16:36:29 +04:00
|
|
|
|
2014-02-12 00:42:28 +04:00
|
|
|
#include <freerdp/client/channels.h>
|
|
|
|
#include <freerdp/client/drdynvc.h>
|
|
|
|
#include <freerdp/channels/channels.h>
|
|
|
|
|
2018-11-14 16:59:58 +03:00
|
|
|
#ifndef CHANNEL_MAX_COUNT
|
|
|
|
#define CHANNEL_MAX_COUNT 30
|
|
|
|
#endif
|
2014-02-12 00:42:28 +04:00
|
|
|
|
2022-02-14 16:59:22 +03:00
|
|
|
typedef struct
|
2014-02-12 00:42:28 +04:00
|
|
|
{
|
|
|
|
PVIRTUALCHANNELENTRY entry;
|
2016-11-15 00:44:45 +03:00
|
|
|
PVIRTUALCHANNELENTRYEX entryEx;
|
2014-02-12 00:42:28 +04:00
|
|
|
PCHANNEL_INIT_EVENT_FN pChannelInitEventProc;
|
2016-11-15 00:44:45 +03:00
|
|
|
PCHANNEL_INIT_EVENT_EX_FN pChannelInitEventProcEx;
|
2014-02-12 00:42:28 +04:00
|
|
|
void* pInitHandle;
|
2016-11-15 17:09:30 +03:00
|
|
|
void* lpUserParam;
|
2022-02-14 16:59:22 +03:00
|
|
|
} CHANNEL_CLIENT_DATA;
|
2014-02-12 00:42:28 +04:00
|
|
|
|
2022-02-14 16:59:22 +03:00
|
|
|
typedef struct
|
2014-02-12 00:42:28 +04:00
|
|
|
{
|
2021-08-24 15:09:40 +03:00
|
|
|
char name[CHANNEL_NAME_LEN + 1];
|
2014-02-12 00:42:28 +04:00
|
|
|
int OpenHandle;
|
|
|
|
int options;
|
|
|
|
int flags;
|
|
|
|
void* pInterface;
|
2014-02-15 23:57:10 +04:00
|
|
|
rdpChannels* channels;
|
2016-11-15 00:44:45 +03:00
|
|
|
void* lpUserParam;
|
2014-02-12 00:42:28 +04:00
|
|
|
PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc;
|
2016-11-15 00:44:45 +03:00
|
|
|
PCHANNEL_OPEN_EVENT_EX_FN pChannelOpenEventProcEx;
|
2022-02-14 16:59:22 +03:00
|
|
|
} CHANNEL_OPEN_DATA;
|
2014-02-12 00:42:28 +04:00
|
|
|
|
2022-02-14 16:59:22 +03:00
|
|
|
typedef struct
|
2014-02-12 00:42:28 +04:00
|
|
|
{
|
|
|
|
void* Data;
|
|
|
|
UINT32 DataLength;
|
|
|
|
void* UserData;
|
2014-02-15 23:57:10 +04:00
|
|
|
CHANNEL_OPEN_DATA* pChannelOpenData;
|
2022-02-14 16:59:22 +03:00
|
|
|
} CHANNEL_OPEN_EVENT;
|
2014-02-12 00:42:28 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pInitHandle: handle that identifies the client connection
|
|
|
|
* Obtained by the client with VirtualChannelInit
|
|
|
|
* Used by the client with VirtualChannelOpen
|
|
|
|
*/
|
|
|
|
|
2022-02-14 16:59:22 +03:00
|
|
|
typedef struct
|
2014-02-12 00:42:28 +04:00
|
|
|
{
|
|
|
|
rdpChannels* channels;
|
|
|
|
void* pInterface;
|
2022-02-14 16:59:22 +03:00
|
|
|
} CHANNEL_INIT_DATA;
|
2014-02-12 00:42:28 +04:00
|
|
|
|
|
|
|
struct rdp_channels
|
|
|
|
{
|
|
|
|
int clientDataCount;
|
|
|
|
CHANNEL_CLIENT_DATA clientDataList[CHANNEL_MAX_COUNT];
|
|
|
|
|
|
|
|
int openDataCount;
|
|
|
|
CHANNEL_OPEN_DATA openDataList[CHANNEL_MAX_COUNT];
|
|
|
|
|
|
|
|
int initDataCount;
|
|
|
|
CHANNEL_INIT_DATA initDataList[CHANNEL_MAX_COUNT];
|
|
|
|
|
|
|
|
/* control for entry into MyVirtualChannelInit */
|
|
|
|
int can_call_init;
|
|
|
|
|
|
|
|
/* true once freerdp_channels_post_connect is called */
|
2015-02-07 01:35:14 +03:00
|
|
|
BOOL connected;
|
2014-02-12 00:42:28 +04:00
|
|
|
|
|
|
|
/* used for locating the channels for a given instance */
|
|
|
|
freerdp* instance;
|
|
|
|
|
2014-12-27 23:20:29 +03:00
|
|
|
wMessageQueue* queue;
|
2014-02-12 00:42:28 +04:00
|
|
|
|
|
|
|
DrdynvcClientContext* drdynvc;
|
2016-08-09 13:04:06 +03:00
|
|
|
CRITICAL_SECTION channelsLock;
|
2024-09-20 10:31:44 +03:00
|
|
|
|
|
|
|
wHashTable* channelEvents;
|
2014-02-12 00:42:28 +04:00
|
|
|
};
|
|
|
|
|
2024-01-26 15:09:00 +03:00
|
|
|
FREERDP_LOCAL void freerdp_channels_free(rdpChannels* channels);
|
|
|
|
|
|
|
|
WINPR_ATTR_MALLOC(freerdp_channels_free, 1)
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL rdpChannels* freerdp_channels_new(freerdp* instance);
|
2024-01-26 15:09:00 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL UINT freerdp_channels_disconnect(rdpChannels* channels, freerdp* instance);
|
|
|
|
FREERDP_LOCAL void freerdp_channels_close(rdpChannels* channels, freerdp* instance);
|
2024-01-26 15:09:00 +03:00
|
|
|
|
2020-10-16 10:16:15 +03:00
|
|
|
FREERDP_LOCAL void freerdp_channels_register_instance(rdpChannels* channels, freerdp* instance);
|
2019-11-06 17:24:51 +03:00
|
|
|
FREERDP_LOCAL UINT freerdp_channels_pre_connect(rdpChannels* channels, freerdp* instance);
|
|
|
|
FREERDP_LOCAL UINT freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance);
|
2024-01-26 15:09:00 +03:00
|
|
|
|
2024-09-20 10:31:44 +03:00
|
|
|
/** @since version 3.9.0 */
|
|
|
|
FREERDP_LOCAL SSIZE_T freerdp_client_channel_get_registered_event_handles(rdpChannels* channels,
|
|
|
|
HANDLE* events,
|
|
|
|
DWORD count);
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* FREERDP_LIB_CORE_CLIENT_H */
|