mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-core: fixed MCS connect-initial, added unit test
This commit is contained in:
parent
a05be813be
commit
33bd605a25
|
@ -29,6 +29,8 @@ add_executable(test_freerdp
|
|||
test_ber.h
|
||||
test_gcc.c
|
||||
test_gcc.h
|
||||
test_mcs.c
|
||||
test_mcs.h
|
||||
test_color.c
|
||||
test_color.h
|
||||
test_libgdi.c
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "test_per.h"
|
||||
#include "test_ber.h"
|
||||
#include "test_gcc.h"
|
||||
#include "test_mcs.h"
|
||||
#include "test_color.h"
|
||||
#include "test_libgdi.h"
|
||||
#include "test_list.h"
|
||||
|
@ -109,6 +110,8 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
add_per_suite();
|
||||
add_ber_suite();
|
||||
add_gcc_suite();
|
||||
add_mcs_suite();
|
||||
add_color_suite();
|
||||
add_libgdi_suite();
|
||||
add_list_suite();
|
||||
|
@ -151,6 +154,10 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
add_gcc_suite();
|
||||
}
|
||||
else if (strcmp("mcs", argv[*pindex]) == 0)
|
||||
{
|
||||
add_mcs_suite();
|
||||
}
|
||||
|
||||
*pindex = *pindex + 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* T.125 Multipoint Communication Service (MCS) Protocol Unit Tests
|
||||
*
|
||||
* Copyright 2011 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.
|
||||
*/
|
||||
|
||||
#include "mcs.h"
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/utils/hexdump.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
#include "test_mcs.h"
|
||||
|
||||
int init_mcs_suite(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int clean_mcs_suite(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int add_mcs_suite(void)
|
||||
{
|
||||
add_test_suite(mcs);
|
||||
|
||||
add_test_function(mcs_write_connect_initial);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 gcc_CCrq[307] =
|
||||
"\x00\x05\x00\x14\x7C\x00\x01\x81\x2A\x00\x08\x00\x10\x00\x01\xC0"
|
||||
"\x00\x44\x75\x63\x61\x81\x1c\x01\xc0\xd8\x00\x04\x00\x08\x00\x00"
|
||||
"\x05\x00\x04\x01\xCA\x03\xAA\x09\x04\x00\x00\xCE\x0E\x00\x00\x45"
|
||||
"\x00\x4c\x00\x54\x00\x4f\x00\x4e\x00\x53\x00\x2d\x00\x44\x00\x45"
|
||||
"\x00\x56\x00\x32\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xCA\x01\x00\x00"
|
||||
"\x00\x00\x00\x18\x00\x07\x00\x01\x00\x36\x00\x39\x00\x37\x00\x31"
|
||||
"\x00\x32\x00\x2d\x00\x37\x00\x38\x00\x33\x00\x2d\x00\x30\x00\x33"
|
||||
"\x00\x35\x00\x37\x00\x39\x00\x37\x00\x34\x00\x2d\x00\x34\x00\x32"
|
||||
"\x00\x37\x00\x31\x00\x34\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04"
|
||||
"\xC0\x0C\x00\x0D\x00\x00\x00\x00\x00\x00\x00\x02\xC0\x0C\x00\x1B"
|
||||
"\x00\x00\x00\x00\x00\x00\x00\x03\xC0\x2C\x00\x03\x00\x00\x00\x72"
|
||||
"\x64\x70\x64\x72\x00\x00\x00\x00\x00\x80\x80\x63\x6c\x69\x70\x72"
|
||||
"\x64\x72\x00\x00\x00\xA0\xC0\x72\x64\x70\x73\x6e\x64\x00\x00\x00"
|
||||
"\x00\x00\xc0";
|
||||
|
||||
void test_mcs_write_connect_initial(void)
|
||||
{
|
||||
STREAM* s;
|
||||
rdpMcs* mcs;
|
||||
STREAM* user_data;
|
||||
|
||||
mcs = mcs_new((rdpTransport*) NULL);
|
||||
|
||||
user_data = stream_new(0);
|
||||
user_data->data = gcc_CCrq;
|
||||
user_data->p = user_data->data + sizeof(gcc_CCrq);
|
||||
|
||||
s = stream_new(512);
|
||||
mcs_write_connect_initial(s, mcs, user_data);
|
||||
|
||||
/* get expected value to compare with */
|
||||
CU_ASSERT(1 == 1);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* T.125 Multipoint Communication Service (MCS) Protocol Unit Tests
|
||||
*
|
||||
* Copyright 2011 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.
|
||||
*/
|
||||
|
||||
#include "test_freerdp.h"
|
||||
|
||||
int init_mcs_suite(void);
|
||||
int clean_mcs_suite(void);
|
||||
int add_mcs_suite(void);
|
||||
|
||||
void test_mcs_write_connect_initial(void);
|
|
@ -45,10 +45,9 @@ void ber_write_length(STREAM* s, int length)
|
|||
* @param length length
|
||||
*/
|
||||
|
||||
void ber_write_universal_tag(STREAM* s, uint8 tag, int length)
|
||||
void ber_write_universal_tag(STREAM* s, uint8 tag)
|
||||
{
|
||||
stream_write_uint8(s, (BER_CLASS_UNIV | BER_PRIMITIVE) | (BER_TAG_MASK & tag));
|
||||
ber_write_length(s, length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define BER_TAG_OCTET_STRING 0x04
|
||||
|
||||
void ber_write_length(STREAM* s, int length);
|
||||
void ber_write_universal_tag(STREAM* s, uint8 tag, int length);
|
||||
void ber_write_universal_tag(STREAM* s, uint8 tag);
|
||||
void ber_write_application_tag(STREAM* s, uint8 tag, int length);
|
||||
void ber_write_octet_string(STREAM* s, uint8* oct_str, int length);
|
||||
void ber_write_boolean(STREAM* s, boolean value);
|
||||
|
|
|
@ -81,14 +81,14 @@ static void mcs_init_domain_parameters(DOMAIN_PARAMETERS* domainParameters,
|
|||
|
||||
static void mcs_write_domain_parameters(STREAM* s, DOMAIN_PARAMETERS* domainParameters)
|
||||
{
|
||||
ber_write_integer(domainParameters->maxChannelIds);
|
||||
ber_write_integer(domainParameters->maxUserIds);
|
||||
ber_write_integer(domainParameters->maxTokenIds);
|
||||
ber_write_integer(domainParameters->numPriorities);
|
||||
ber_write_integer(domainParameters->minThroughput);
|
||||
ber_write_integer(domainParameters->maxHeight);
|
||||
ber_write_integer(domainParameters->maxMCSPDUsize);
|
||||
ber_write_integer(domainParameters->protocolVersion);
|
||||
ber_write_integer(s, domainParameters->maxChannelIds);
|
||||
ber_write_integer(s, domainParameters->maxUserIds);
|
||||
ber_write_integer(s, domainParameters->maxTokenIds);
|
||||
ber_write_integer(s, domainParameters->numPriorities);
|
||||
ber_write_integer(s, domainParameters->minThroughput);
|
||||
ber_write_integer(s, domainParameters->maxHeight);
|
||||
ber_write_integer(s, domainParameters->maxMCSPDUsize);
|
||||
ber_write_integer(s, domainParameters->protocolVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "ber.h"
|
||||
#include "transport.h"
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
typedef struct
|
||||
|
@ -32,7 +33,7 @@ typedef struct
|
|||
uint32 maxTokenIds;
|
||||
uint32 numPriorities;
|
||||
uint32 minThroughput;
|
||||
uint32 maxHeight
|
||||
uint32 maxHeight;
|
||||
uint32 maxMCSPDUsize;
|
||||
uint32 protocolVersion;
|
||||
} DOMAIN_PARAMETERS;
|
||||
|
@ -49,7 +50,7 @@ typedef struct rdp_mcs rdpMcs;
|
|||
#define MCS_TYPE_CONNECT_INITIAL 0x65
|
||||
#define MCS_TYPE_CONNECT_RESPONSE 0x66
|
||||
|
||||
void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, int length);
|
||||
void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data);
|
||||
|
||||
rdpMcs* mcs_new(rdpTransport* transport);
|
||||
void mcs_free(rdpMcs* mcs);
|
||||
|
|
Loading…
Reference in New Issue