2
* FreeRDP: A Remote Desktop Protocol Client
3
* Channel Manager Unit Tests
5
* Copyright 2011 Vic Lee
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
23
#include <freerdp/freerdp.h>
24
#include <freerdp/constants.h>
25
#include <freerdp/channels/channels.h>
26
#include <freerdp/utils/event.h>
28
#include "test_channels.h"
30
int init_chanman_suite(void)
32
freerdp_channels_global_init();
36
int clean_chanman_suite(void)
38
freerdp_channels_global_uninit();
42
int add_chanman_suite(void)
44
add_test_suite(chanman);
46
add_test_function(chanman);
51
static int test_rdp_channel_data(freerdp* instance, int chan_id, uint8* data, int data_size)
53
printf("chan_id %d data_size %d\n", chan_id, data_size);
57
void test_chanman(void)
59
rdpChannels* chan_man;
60
rdpSettings settings = { 0 };
61
freerdp instance = { 0 };
64
settings.hostname = "testhost";
65
instance.settings = &settings;
66
instance.SendChannelData = test_rdp_channel_data;
68
chan_man = freerdp_channels_new();
70
freerdp_channels_load_plugin(chan_man, &settings, "../channels/rdpdbg/rdpdbg.so", NULL);
71
freerdp_channels_pre_connect(chan_man, &instance);
72
freerdp_channels_post_connect(chan_man, &instance);
74
freerdp_channels_data(&instance, 0, "testdata", 8, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 8);
75
freerdp_channels_data(&instance, 0, "testdata1", 9, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 9);
76
freerdp_channels_data(&instance, 0, "testdata11", 10, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 10);
77
freerdp_channels_data(&instance, 0, "testdata111", 11, CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST, 11);
79
event = freerdp_event_new(RDP_EVENT_CLASS_DEBUG, 0, NULL, NULL);
80
freerdp_channels_send_event(chan_man, event);
82
while ((event = freerdp_channels_pop_event(chan_man)) == NULL)
84
freerdp_channels_check_fds(chan_man, &instance);
86
printf("responded event_type %d\n", event->event_type);
87
freerdp_event_free(event);
89
freerdp_channels_close(chan_man, &instance);
90
freerdp_channels_free(chan_man);