libfreerdp-core: expose opaque HANDLE instead of WTSVirtualChannelManager*

This commit is contained in:
Marc-André Moreau 2014-02-27 13:30:04 -05:00
parent 25259b33b0
commit 6e1cdf1b67
18 changed files with 44 additions and 46 deletions

View File

@ -453,12 +453,11 @@ static BOOL audin_server_close(audin_server_context* context)
return TRUE;
}
audin_server_context* audin_server_context_new(WTSVirtualChannelManager* vcm)
audin_server_context* audin_server_context_new(HANDLE vcm)
{
audin_server* audin;
audin = (audin_server*) malloc(sizeof(audin_server));
ZeroMemory(audin, sizeof(audin_server));
audin = (audin_server*) calloc(1, sizeof(audin_server));
audin->context.vcm = vcm;
audin->context.selected_client_format = -1;

View File

@ -468,7 +468,7 @@ static void* cliprdr_server_thread(void* arg)
static int cliprdr_server_start(CliprdrServerContext* context)
{
context->priv->ChannelHandle = WTSVirtualChannelOpen((HANDLE) context->vcm, WTS_CURRENT_SESSION, "cliprdr");
context->priv->ChannelHandle = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "cliprdr");
if (!context->priv->ChannelHandle)
return -1;
@ -491,7 +491,7 @@ static int cliprdr_server_stop(CliprdrServerContext* context)
return 0;
}
CliprdrServerContext* cliprdr_server_context_new(WTSVirtualChannelManager* vcm)
CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm)
{
CliprdrServerContext* context;

View File

@ -86,7 +86,7 @@ static void* drdynvc_server_thread(void* arg)
static int drdynvc_server_start(DrdynvcServerContext* context)
{
context->priv->ChannelHandle = WTSVirtualChannelOpen((HANDLE) context->vcm, WTS_CURRENT_SESSION, "drdynvc");
context->priv->ChannelHandle = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "drdynvc");
if (!context->priv->ChannelHandle)
return -1;
@ -109,27 +109,20 @@ static int drdynvc_server_stop(DrdynvcServerContext* context)
return 0;
}
DrdynvcServerContext* drdynvc_server_context_new(WTSVirtualChannelManager* vcm)
DrdynvcServerContext* drdynvc_server_context_new(HANDLE vcm)
{
DrdynvcServerContext* context;
context = (DrdynvcServerContext*) malloc(sizeof(DrdynvcServerContext));
context = (DrdynvcServerContext*) calloc(1, sizeof(DrdynvcServerContext));
if (context)
{
ZeroMemory(context, sizeof(DrdynvcServerContext));
context->vcm = vcm;
context->Start = drdynvc_server_start;
context->Stop = drdynvc_server_stop;
context->priv = (DrdynvcServerPrivate*) malloc(sizeof(DrdynvcServerPrivate));
if (context->priv)
{
ZeroMemory(context->priv, sizeof(DrdynvcServerPrivate));
}
context->priv = (DrdynvcServerPrivate*) calloc(1, sizeof(DrdynvcServerPrivate));
}
return context;

View File

@ -630,7 +630,7 @@ static void* rdpdr_server_thread(void* arg)
static int rdpdr_server_start(RdpdrServerContext* context)
{
context->priv->ChannelHandle = WTSVirtualChannelOpen((HANDLE) context->vcm, WTS_CURRENT_SESSION, "rdpdr");
context->priv->ChannelHandle = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "rdpdr");
if (!context->priv->ChannelHandle)
return -1;
@ -653,7 +653,7 @@ static int rdpdr_server_stop(RdpdrServerContext* context)
return 0;
}
RdpdrServerContext* rdpdr_server_context_new(WTSVirtualChannelManager* vcm)
RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm)
{
RdpdrServerContext* context;

View File

@ -488,7 +488,7 @@ static BOOL rdpsnd_server_close(RdpsndServerContext* context)
static int rdpsnd_server_start(RdpsndServerContext* context)
{
context->priv->ChannelHandle = WTSVirtualChannelOpen((HANDLE) context->vcm, WTS_CURRENT_SESSION, "rdpsnd");
context->priv->ChannelHandle = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "rdpsnd");
if (!context->priv->ChannelHandle)
return -1;
@ -513,7 +513,7 @@ static int rdpsnd_server_stop(RdpsndServerContext* context)
return 0;
}
RdpsndServerContext* rdpsnd_server_context_new(WTSVirtualChannelManager* vcm)
RdpsndServerContext* rdpsnd_server_context_new(HANDLE vcm)
{
RdpsndServerContext* context;

View File

@ -43,8 +43,6 @@
#define WTSVirtualEventHandle 3 /* Extended */
#define WTSVirtualChannelReady 4 /* Extended */
typedef struct WTSVirtualChannelManager WTSVirtualChannelManager;
#ifdef __cplusplus
extern "C" {
#endif
@ -53,11 +51,11 @@ extern "C" {
* WTSVirtualChannelManager functions are FreeRDP extensions to the API.
*/
FREERDP_API void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, void** fds, int* fds_count);
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm);
FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(WTSVirtualChannelManager* vcm);
FREERDP_API void WTSVirtualChannelManagerGetFileDescriptor(HANDLE hServer, void** fds, int* fds_count);
FREERDP_API BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer);
FREERDP_API HANDLE WTSVirtualChannelManagerGetEventHandle(HANDLE hServer);
FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(WTSVirtualChannelManager* vcm, const char* name);
FREERDP_API BOOL WTSVirtualChannelManagerIsChannelJoined(HANDLE hServer, const char* name);
#ifdef __cplusplus
}

View File

@ -94,7 +94,7 @@ struct _audin_server_context
extern "C" {
#endif
FREERDP_API audin_server_context* audin_server_context_new(WTSVirtualChannelManager* vcm);
FREERDP_API audin_server_context* audin_server_context_new(HANDLE vcm);
FREERDP_API void audin_server_context_free(audin_server_context* context);
#ifdef __cplusplus

View File

@ -39,7 +39,7 @@ typedef int (*psCliprdrStop)(CliprdrServerContext* context);
struct _cliprdr_server_context
{
WTSVirtualChannelManager* vcm;
HANDLE vcm;
psCliprdrStart Start;
psCliprdrStop Stop;
@ -47,7 +47,7 @@ struct _cliprdr_server_context
CliprdrServerPrivate* priv;
};
FREERDP_API CliprdrServerContext* cliprdr_server_context_new(WTSVirtualChannelManager* vcm);
FREERDP_API CliprdrServerContext* cliprdr_server_context_new(HANDLE vcm);
FREERDP_API void cliprdr_server_context_free(CliprdrServerContext* context);
#endif /* FREERDP_CHANNEL_SERVER_CLIPRDR_H */

View File

@ -36,7 +36,7 @@ typedef int (*psDrdynvcStop)(DrdynvcServerContext* context);
struct _drdynvc_client_context
{
WTSVirtualChannelManager* vcm;
HANDLE vcm;
psDrdynvcStart Start;
psDrdynvcStop Stop;
@ -44,7 +44,7 @@ struct _drdynvc_client_context
DrdynvcServerPrivate* priv;
};
FREERDP_API DrdynvcServerContext* drdynvc_server_context_new(WTSVirtualChannelManager* vcm);
FREERDP_API DrdynvcServerContext* drdynvc_server_context_new(HANDLE vcm);
FREERDP_API void drdynvc_server_context_free(DrdynvcServerContext* context);
#endif /* FREERDP_CHANNEL_SERVER_DRDYNVC_H */

View File

@ -37,7 +37,7 @@ typedef int (*psRdpdrStop)(RdpdrServerContext* context);
struct _rdpdr_server_context
{
WTSVirtualChannelManager* vcm;
HANDLE vcm;
psRdpdrStart Start;
psRdpdrStop Stop;
@ -45,7 +45,7 @@ struct _rdpdr_server_context
RdpdrServerPrivate* priv;
};
FREERDP_API RdpdrServerContext* rdpdr_server_context_new(WTSVirtualChannelManager* vcm);
FREERDP_API RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm);
FREERDP_API void rdpdr_server_context_free(RdpdrServerContext* context);
#endif /* FREERDP_CHANNEL_SERVER_RDPDR_H */

View File

@ -40,7 +40,7 @@ typedef void (*psRdpsndServerActivated)(RdpsndServerContext* context);
struct _rdpsnd_server_context
{
WTSVirtualChannelManager* vcm;
HANDLE vcm;
psRdpsndStart Start;
psRdpsndStop Stop;
@ -105,7 +105,7 @@ struct _rdpsnd_server_context
extern "C" {
#endif
FREERDP_API RdpsndServerContext* rdpsnd_server_context_new(WTSVirtualChannelManager* vcm);
FREERDP_API RdpsndServerContext* rdpsnd_server_context_new(HANDLE vcm);
FREERDP_API void rdpsnd_server_context_free(RdpsndServerContext* context);
#ifdef __cplusplus

View File

@ -383,9 +383,10 @@ static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, BYTE* d
return status;
}
void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, void** fds, int* fds_count)
void WTSVirtualChannelManagerGetFileDescriptor(HANDLE hServer, void** fds, int* fds_count)
{
void* fd;
WTSVirtualChannelManager* vcm = (WTSVirtualChannelManager*) hServer;
fd = GetEventWaitObject(MessageQueue_Event(vcm->queue));
@ -409,12 +410,13 @@ void WTSVirtualChannelManagerGetFileDescriptor(WTSVirtualChannelManager* vcm, vo
#endif
}
BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm)
BOOL WTSVirtualChannelManagerCheckFileDescriptor(HANDLE hServer)
{
wMessage message;
BOOL status = TRUE;
rdpPeerChannel* channel;
UINT32 dynvc_caps;
WTSVirtualChannelManager* vcm = (WTSVirtualChannelManager*) hServer;
if ((vcm->drdynvc_state == DRDYNVC_STATE_NONE) && vcm->client->activated)
{
@ -455,16 +457,20 @@ BOOL WTSVirtualChannelManagerCheckFileDescriptor(WTSVirtualChannelManager* vcm)
return status;
}
HANDLE WTSVirtualChannelManagerGetEventHandle(WTSVirtualChannelManager* vcm)
HANDLE WTSVirtualChannelManagerGetEventHandle(HANDLE hServer)
{
WTSVirtualChannelManager* vcm = (WTSVirtualChannelManager*) hServer;
return MessageQueue_Event(vcm->queue);
}
BOOL WTSVirtualChannelManagerIsChannelJoined(WTSVirtualChannelManager* vcm, const char* name)
BOOL WTSVirtualChannelManagerIsChannelJoined(HANDLE hServer, const char* name)
{
rdpMcs* mcs;
UINT32 index;
BOOL joined = FALSE;
rdpMcs* mcs = vcm->rdp->mcs;
WTSVirtualChannelManager* vcm = (WTSVirtualChannelManager*) hServer;
mcs = vcm->rdp->mcs;
for (index = 0; index < mcs->channelCount; index++)
{

View File

@ -29,6 +29,8 @@
#include <winpr/stream.h>
#include <winpr/collections.h>
typedef struct WTSVirtualChannelManager WTSVirtualChannelManager;
#include "rdp.h"
#define CREATE_REQUEST_PDU 0x01

View File

@ -59,7 +59,7 @@ struct mf_peer_context
NSC_CONTEXT* nsc_context;
//#ifdef WITH_SERVER_CHANNELS
WTSVirtualChannelManager* vcm;
HANDLE vcm;
//#endif
//#ifdef CHANNEL_AUDIN_SERVER
audin_server_context* audin;

View File

@ -187,7 +187,7 @@ int mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
context->s = Stream_New(NULL, 0xFFFF);
//#ifdef WITH_SERVER_CHANNELS
context->vcm = (WTSVirtualChannelManager*) WTSOpenServerA((LPSTR) client->context);
context->vcm = WTSOpenServerA((LPSTR) client->context);
//#endif
mf_info_peer_register(context->info, context);
@ -222,7 +222,7 @@ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context)
//#endif
//#ifdef WITH_SERVER_CHANNELS
WTSCloseServer((HANDLE) context->vcm);
WTSCloseServer(context->vcm);
//#endif
}
}

View File

@ -63,7 +63,7 @@ void test_peer_context_new(freerdp_peer* client, testPeerContext* context)
context->icon_x = -1;
context->icon_y = -1;
context->vcm = (WTSVirtualChannelManager*) WTSOpenServerA((LPSTR) client->context);
context->vcm = WTSOpenServerA((LPSTR) client->context);
}
void test_peer_context_free(freerdp_peer* client, testPeerContext* context)

View File

@ -99,7 +99,7 @@ struct wf_peer_context
HANDLE socketThread;
HANDLE socketSemaphore;
WTSVirtualChannelManager* vcm;
HANDLE vcm;
RdpsndServerContext* rdpsnd;
};

View File

@ -41,7 +41,7 @@
void wf_peer_context_new(freerdp_peer* client, wfPeerContext* context)
{
context->info = wf_info_get_instance();
context->vcm = (WTSVirtualChannelManager*) WTSOpenServerA((LPSTR) client->context);
context->vcm = WTSOpenServerA((LPSTR) client->context);
wf_info_peer_register(context->info, context);
}