libfreerdp-core: add initial vchan module.

This commit is contained in:
Vic Lee
2011-08-03 02:03:02 +08:00
parent 18b947082a
commit 621c349df4
6 changed files with 94 additions and 3 deletions

View File

@@ -80,6 +80,8 @@ set(LIBFREERDP_CORE_SRCS
transport.h
update.c
update.h
vchan.c
vchan.h
)
add_library(freerdp-core SHARED ${LIBFREERDP_CORE_SRCS})

View File

@@ -73,7 +73,7 @@ freerdp* freerdp_new()
if (instance != NULL)
{
rdpRdp* rdp = rdp_new();
rdpRdp* rdp = rdp_new(instance);
instance->rdp = (void*) rdp;
instance->input = rdp->input;
instance->update = rdp->update;

View File

@@ -391,6 +391,10 @@ void rdp_process_pdu(rdpRdp* rdp, STREAM* s)
}
}
}
else if (channelId != MCS_GLOBAL_CHANNEL_ID)
{
vchan_process(rdp->vchan, s, channelId);
}
else
{
rdp_read_share_control_header(s, &pduLength, &pduType, &rdp->settings->pdu_source);
@@ -466,7 +470,7 @@ int rdp_check_fds(rdpRdp* rdp)
* @return new RDP module
*/
rdpRdp* rdp_new()
rdpRdp* rdp_new(freerdp* instance)
{
rdpRdp* rdp;
@@ -483,6 +487,7 @@ rdpRdp* rdp_new()
rdp->update = update_new(rdp);
rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport);
rdp->vchan = vchan_new(instance);
}
return rdp;
@@ -503,6 +508,7 @@ void rdp_free(rdpRdp* rdp)
input_free(rdp->input);
update_free(rdp->update);
mcs_free(rdp->mcs);
vchan_free(rdp->vchan);
xfree(rdp);
}
}

View File

@@ -34,6 +34,7 @@ typedef struct rdp_rdp rdpRdp;
#include "transport.h"
#include "connection.h"
#include "capabilities.h"
#include "vchan.h"
#include <freerdp/freerdp.h>
#include <freerdp/settings.h>
@@ -213,6 +214,7 @@ struct rdp_rdp
struct rdp_settings* settings;
struct rdp_registry* registry;
struct rdp_transport* transport;
struct rdp_vchan* vchan;
};
void rdp_read_security_header(STREAM* s, uint16* flags);
@@ -239,7 +241,7 @@ void rdp_recv(rdpRdp* rdp);
void rdp_set_blocking_mode(rdpRdp* rdp, boolean blocking);
int rdp_check_fds(rdpRdp* rdp);
rdpRdp* rdp_new();
rdpRdp* rdp_new(freerdp* instance);
void rdp_free(rdpRdp* rdp);
#endif /* __RDP_H */

47
libfreerdp-core/vchan.c Normal file
View File

@@ -0,0 +1,47 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Virtual Channels
*
* Copyright 2011 Vic Lee
*
* 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.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <freerdp/freerdp.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/stream.h>
#include "vchan.h"
void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id)
{
printf("vchan_process\n");
}
rdpVchan* vchan_new(freerdp* instance)
{
rdpVchan* vchan;
vchan = xnew(rdpVchan);
vchan->instance = instance;
return vchan;
}
void vchan_free(rdpVchan* vchan)
{
xfree(vchan);
}

34
libfreerdp-core/vchan.h Normal file
View File

@@ -0,0 +1,34 @@
/**
* FreeRDP: A Remote Desktop Protocol Client
* Virtual Channels
*
* Copyright 2011 Vic Lee
*
* 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.
*/
#ifndef __VCHAN_H
#define __VCHAN_H
struct rdp_vchan
{
freerdp* instance;
};
typedef struct rdp_vchan rdpVchan;
void vchan_process(rdpVchan* vchan, STREAM* s, uint16 channel_id);
rdpVchan* vchan_new(freerdp* instance);
void vchan_free(rdpVchan* vchan);
#endif /* __VCHAN_H */