Unify pReceiveChannelData and psPeerReceiveChannelData
Fix definitions of the two function pointers. Use and definition did not match, fix that. Will create warnings in external projects
This commit is contained in:
parent
d5b5088eac
commit
3ba66db99d
@ -50,8 +50,8 @@ extern "C"
|
||||
FREERDP_API HANDLE freerdp_channels_get_event_handle(freerdp* instance);
|
||||
FREERDP_API int freerdp_channels_process_pending_messages(freerdp* instance);
|
||||
|
||||
FREERDP_API int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data,
|
||||
int dataSize, int flags, int totalSize);
|
||||
FREERDP_API BOOL freerdp_channels_data(freerdp* instance, UINT16 channelId, const BYTE* data,
|
||||
size_t dataSize, UINT32 flags, size_t totalSize);
|
||||
|
||||
FREERDP_API UINT16 freerdp_channels_get_id_by_name(freerdp* instance, const char* channel_name);
|
||||
FREERDP_API const char* freerdp_channels_get_name_by_id(freerdp* instance, UINT16 channelId);
|
||||
|
@ -178,8 +178,8 @@ extern "C"
|
||||
|
||||
typedef BOOL (*pSendChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
|
||||
size_t size);
|
||||
typedef int (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, BYTE* data, int size,
|
||||
int flags, int totalSize);
|
||||
typedef BOOL (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data,
|
||||
size_t size, UINT32 flags, size_t totalSize);
|
||||
|
||||
typedef BOOL (*pPresentGatewayMessage)(freerdp* instance, UINT32 type, BOOL isDisplayMandatory,
|
||||
BOOL isConsentMandatory, size_t length,
|
||||
|
@ -53,7 +53,7 @@ typedef BOOL (*psPeerClientCapabilities)(freerdp_peer* peer);
|
||||
|
||||
typedef BOOL (*psPeerSendChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
|
||||
size_t size);
|
||||
typedef int (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
|
||||
typedef BOOL (*psPeerReceiveChannelData)(freerdp_peer* peer, UINT16 channelId, const BYTE* data,
|
||||
size_t size, UINT32 flags, size_t totalSize);
|
||||
|
||||
typedef HANDLE (*psPeerVirtualChannelOpen)(freerdp_peer* peer, const char* name, UINT32 flags);
|
||||
|
@ -124,7 +124,7 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, const BYTE* data, size_
|
||||
|
||||
BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId, size_t packetLength)
|
||||
{
|
||||
int rc = 0;
|
||||
BOOL rc = FALSE;
|
||||
UINT32 length;
|
||||
UINT32 flags;
|
||||
size_t chunkLength;
|
||||
@ -160,7 +160,7 @@ BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId, si
|
||||
}
|
||||
IFCALLRET(instance->ReceiveChannelData, rc, instance, channelId, Stream_Pointer(s), chunkLength,
|
||||
flags, length);
|
||||
if (rc != CHANNEL_RC_OK)
|
||||
if (!rc)
|
||||
{
|
||||
WLog_WARN(TAG, "ReceiveChannelData returned %d", rc);
|
||||
return FALSE;
|
||||
@ -213,9 +213,9 @@ BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 chann
|
||||
}
|
||||
else if (client->ReceiveChannelData)
|
||||
{
|
||||
int rc = client->ReceiveChannelData(client, channelId, Stream_Pointer(s), chunkLength,
|
||||
BOOL rc = client->ReceiveChannelData(client, channelId, Stream_Pointer(s), chunkLength,
|
||||
flags, length);
|
||||
if (rc < 0)
|
||||
if (!rc)
|
||||
return FALSE;
|
||||
}
|
||||
return Stream_SafeSeek(s, chunkLength);
|
||||
|
@ -419,20 +419,25 @@ fail:
|
||||
return error;
|
||||
}
|
||||
|
||||
int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int dataSize, int flags,
|
||||
int totalSize)
|
||||
BOOL freerdp_channels_data(freerdp* instance, UINT16 channelId, const BYTE* cdata, size_t dataSize,
|
||||
UINT32 flags, size_t totalSize)
|
||||
{
|
||||
UINT32 index;
|
||||
rdpMcs* mcs;
|
||||
rdpChannels* channels;
|
||||
rdpMcsChannel* channel = NULL;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
union {
|
||||
const BYTE* pcb;
|
||||
BYTE* pb;
|
||||
} data;
|
||||
|
||||
if (!instance || !data || (dataSize < 0) || (totalSize < 0))
|
||||
data.pcb = cdata;
|
||||
if (!instance || !data.pcb)
|
||||
{
|
||||
WLog_ERR(TAG, "%s(%p, %" PRIu16 ", %p, %d, 0x%08x, %d): Invalid arguments", __FUNCTION__,
|
||||
instance, channelId, data, dataSize, flags, totalSize);
|
||||
return -1;
|
||||
WLog_ERR(TAG, "%s(%p, %" PRIu16 ", %p, 0x%08x): Invalid arguments", __FUNCTION__, instance,
|
||||
channelId, data, flags);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mcs = instance->context->rdp->mcs;
|
||||
@ -440,7 +445,7 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int d
|
||||
|
||||
if (!channels || !mcs)
|
||||
{
|
||||
return 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (index = 0; index < mcs->channelCount; index++)
|
||||
@ -454,30 +459,30 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int d
|
||||
|
||||
if (!channel)
|
||||
{
|
||||
return 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels, channel->Name);
|
||||
|
||||
if (!pChannelOpenData)
|
||||
{
|
||||
return 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pChannelOpenData->pChannelOpenEventProc)
|
||||
{
|
||||
pChannelOpenData->pChannelOpenEventProc(pChannelOpenData->OpenHandle,
|
||||
CHANNEL_EVENT_DATA_RECEIVED, data, dataSize,
|
||||
CHANNEL_EVENT_DATA_RECEIVED, data.pb, dataSize,
|
||||
totalSize, flags);
|
||||
}
|
||||
else if (pChannelOpenData->pChannelOpenEventProcEx)
|
||||
{
|
||||
pChannelOpenData->pChannelOpenEventProcEx(
|
||||
pChannelOpenData->lpUserParam, pChannelOpenData->OpenHandle,
|
||||
CHANNEL_EVENT_DATA_RECEIVED, data, dataSize, totalSize, flags);
|
||||
CHANNEL_EVENT_DATA_RECEIVED, data.pb, dataSize, totalSize, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT16 freerdp_channels_get_id_by_name(freerdp* instance, const char* channel_name)
|
||||
|
@ -400,7 +400,7 @@ static BOOL WTSProcessChannelData(rdpPeerChannel* channel, UINT16 channelId, con
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, const BYTE* data,
|
||||
static BOOL WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, const BYTE* data,
|
||||
size_t size, UINT32 flags, size_t totalSize)
|
||||
{
|
||||
UINT32 i;
|
||||
@ -419,7 +419,7 @@ static int WTSReceiveChannelData(freerdp_peer* client, UINT16 channelId, const B
|
||||
}
|
||||
}
|
||||
|
||||
return status ? 0 : -1;
|
||||
return status;
|
||||
}
|
||||
|
||||
void WTSVirtualChannelManagerGetFileDescriptor(HANDLE hServer, void** fds, int* fds_count)
|
||||
|
@ -197,8 +197,9 @@ static BOOL pf_client_pre_connect(freerdp* instance)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channelId, BYTE* data,
|
||||
int size, int flags, int totalSize)
|
||||
static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channelId,
|
||||
const BYTE* data, size_t size, UINT32 flags,
|
||||
size_t totalSize)
|
||||
{
|
||||
pClientContext* pc = (pClientContext*)instance->context;
|
||||
pServerContext* ps = pc->pdata->ps;
|
||||
@ -221,13 +222,11 @@ static int pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channel
|
||||
ev.data_len = size;
|
||||
|
||||
if (!pf_modules_run_filter(FILTER_TYPE_CLIENT_PASSTHROUGH_CHANNEL_DATA, pdata, &ev))
|
||||
return -1;
|
||||
return FALSE;
|
||||
|
||||
server_channel_id = (UINT64)HashTable_GetItemValue(ps->vc_ids, (void*)channel_name);
|
||||
if (!ps->context.peer->SendChannelData(ps->context.peer, (UINT16)server_channel_id,
|
||||
data, size))
|
||||
return -1;
|
||||
return 0;
|
||||
return ps->context.peer->SendChannelData(ps->context.peer, (UINT16)server_channel_id,
|
||||
data, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static BOOL pf_server_adjust_monitor_layout(freerdp_peer* peer)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 channelId,
|
||||
static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 channelId,
|
||||
const BYTE* data, size_t size, UINT32 flags,
|
||||
size_t totalSize)
|
||||
{
|
||||
@ -222,14 +222,12 @@ static int pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 channe
|
||||
ev.data_len = size;
|
||||
|
||||
if (!pf_modules_run_filter(FILTER_TYPE_SERVER_PASSTHROUGH_CHANNEL_DATA, pdata, &ev))
|
||||
return -1;
|
||||
return FALSE;
|
||||
|
||||
client_channel_id = (UINT64)HashTable_GetItemValue(pc->vc_ids, (void*)channel_name);
|
||||
|
||||
if (!pc->context.instance->SendChannelData(
|
||||
pc->context.instance, (UINT16)client_channel_id, (BYTE*)data, size))
|
||||
return -1;
|
||||
return 0;
|
||||
return pc->context.instance->SendChannelData(pc->context.instance,
|
||||
(UINT16)client_channel_id, data, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user