libfreerdp-core: add channel data sending/receiving for server.
This commit is contained in:
parent
2ee03f035a
commit
703e253e9f
@ -36,6 +36,9 @@ typedef void (*psPeerDisconnect)(freerdp_peer* client);
|
||||
typedef boolean (*psPeerPostConnect)(freerdp_peer* client);
|
||||
typedef boolean (*psPeerActivate)(freerdp_peer* client);
|
||||
|
||||
typedef int (*psPeerSendChannelData)(freerdp_peer* client, int channelId, uint8* data, int size);
|
||||
typedef int (*psPeerReceiveChannelData)(freerdp_peer* client, int channelId, uint8* data, int size, int flags, int total_size);
|
||||
|
||||
struct rdp_freerdp_peer
|
||||
{
|
||||
rdpContext* context;
|
||||
@ -57,6 +60,9 @@ struct rdp_freerdp_peer
|
||||
|
||||
psPeerPostConnect PostConnect;
|
||||
psPeerActivate Activate;
|
||||
|
||||
psPeerSendChannelData SendChannelData;
|
||||
psPeerReceiveChannelData ReceiveChannelData;
|
||||
};
|
||||
|
||||
FREERDP_API void freerdp_peer_context_new(freerdp_peer* client);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/peer.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
@ -100,3 +101,16 @@ void freerdp_channel_process(freerdp* instance, STREAM* s, uint16 channel_id)
|
||||
channel_id, stream_get_tail(s), chunk_length, flags, length);
|
||||
}
|
||||
|
||||
void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, uint16 channel_id)
|
||||
{
|
||||
uint32 length;
|
||||
uint32 flags;
|
||||
int chunk_length;
|
||||
|
||||
stream_read_uint32(s, length);
|
||||
stream_read_uint32(s, flags);
|
||||
chunk_length = stream_get_left(s);
|
||||
|
||||
IFCALL(client->ReceiveChannelData, client,
|
||||
channel_id, stream_get_tail(s), chunk_length, flags, length);
|
||||
}
|
||||
|
@ -22,5 +22,6 @@
|
||||
|
||||
boolean freerdp_channel_send(rdpRdp* rdp, uint16 channel_id, uint8* data, int size);
|
||||
void freerdp_channel_process(freerdp* instance, STREAM* s, uint16 channel_id);
|
||||
void freerdp_channel_peer_process(freerdp_peer* client, STREAM* s, uint16 channel_id);
|
||||
|
||||
#endif /* __CHANNEL_H */
|
||||
|
@ -126,7 +126,7 @@ static boolean peer_recv_tpkt_pdu(freerdp_peer* client, STREAM* s)
|
||||
|
||||
if (channelId != MCS_GLOBAL_CHANNEL_ID)
|
||||
{
|
||||
/* TODO: process channel data from client */
|
||||
freerdp_channel_peer_process(client, s, channelId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -242,6 +242,11 @@ static void freerdp_peer_disconnect(freerdp_peer* client)
|
||||
transport_disconnect(client->context->rdp->transport);
|
||||
}
|
||||
|
||||
static int freerdp_peer_send_channel_data(freerdp_peer* client, int channelId, uint8* data, int size)
|
||||
{
|
||||
return rdp_send_channel_data(client->context->rdp, channelId, data, size);
|
||||
}
|
||||
|
||||
void freerdp_peer_context_new(freerdp_peer* client)
|
||||
{
|
||||
rdpRdp* rdp;
|
||||
@ -288,6 +293,7 @@ freerdp_peer* freerdp_peer_new(int sockfd)
|
||||
client->GetFileDescriptor = freerdp_peer_get_fds;
|
||||
client->CheckFileDescriptor = freerdp_peer_check_fds;
|
||||
client->Disconnect = freerdp_peer_disconnect;
|
||||
client->SendChannelData = freerdp_peer_send_channel_data;
|
||||
}
|
||||
|
||||
return client;
|
||||
|
Loading…
Reference in New Issue
Block a user