static char* test_pcap_file = NULL;
static BOOL test_dump_rfx_realtime = TRUE;
-BOOL test_peer_context_new(freerdp_peer* client, testPeerContext* context)
+static BOOL test_peer_context_new(freerdp_peer* client, rdpContext* ctx)
{
+ testPeerContext* context = (testPeerContext*)ctx;
if (!(context->rfx_context = rfx_context_new(TRUE)))
goto fail_rfx_context;
return FALSE;
}
-void test_peer_context_free(freerdp_peer* client, testPeerContext* context)
+static void test_peer_context_free(freerdp_peer* client, rdpContext* ctx)
{
+ testPeerContext* context = (testPeerContext*)ctx;
WINPR_UNUSED(client);
if (context)
if (context->debug_channel)
WTSVirtualChannelClose(context->debug_channel);
- if (context->audin)
- audin_server_context_free(context->audin);
+ sf_peer_audin_uninit(context);
if (context->rdpsnd)
rdpsnd_server_context_free(context->rdpsnd);
static BOOL test_peer_init(freerdp_peer* client)
{
client->ContextSize = sizeof(testPeerContext);
- client->ContextNew = (psPeerContextNew)test_peer_context_new;
- client->ContextFree = (psPeerContextFree)test_peer_context_free;
+ client->ContextNew = test_peer_context_new;
+ client->ContextFree = test_peer_context_free;
return freerdp_peer_context_new(client);
}
sf_peer_rdpsnd_init(context); /* Audio Output */
}
- if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, "encomsp"))
+ if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, ENCOMSP_SVC_CHANNEL_NAME))
{
sf_peer_encomsp_init(context); /* Lync Multiparty */
}
}
else if ((flags & 0x4000) && code == 0x13) /* 'r' key */
{
- if (!context->audin_open)
- {
- context->audin->Open(context->audin);
- context->audin_open = TRUE;
- }
- else
- {
- context->audin->Close(context->audin);
- context->audin_open = FALSE;
- }
+ context->audin_open = !context->audin_open;
}
else if ((flags & 0x4000) && code == 0x1F) /* 's' key */
{
static DWORD WINAPI test_peer_mainloop(LPVOID arg)
{
+ DWORD error = CHANNEL_RC_OK;
HANDLE handles[32];
DWORD count;
DWORD status;
context = (testPeerContext*)client->context;
WLog_INFO(TAG, "We've got a client %s", client->local ? "(local)" : client->hostname);
- while (1)
+ while (error == CHANNEL_RC_OK)
{
count = 0;
{
if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != TRUE)
break;
+
+ /* Handle dynamic virtual channel intializations */
+ if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, "drdynvc"))
+ {
+ switch (WTSVirtualChannelManagerGetDrdynvcState(context->vcm))
+ {
+ case DRDYNVC_STATE_NONE:
+ break;
+
+ case DRDYNVC_STATE_INITIALIZED:
+ break;
+
+ case DRDYNVC_STATE_READY:
+
+ /* Here is the correct state to start dynamic virtual channels */
+ if (sf_peer_audin_running(context) != context->audin_open)
+ {
+ if (!sf_peer_audin_running(context))
+ sf_peer_audin_start(context);
+ else
+ sf_peer_audin_stop(context);
+ }
+
+ break;
+
+ case DRDYNVC_STATE_FAILED:
+ default:
+ break;
+ }
+ }
}
WLog_INFO(TAG, "Client %s disconnected.", client->local ? "(local)" : client->hostname);
client->Disconnect(client);
freerdp_peer_context_free(client);
freerdp_peer_free(client);
- return 0;
+ return error;
}
static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
int main(int argc, char* argv[])
{
+ const char spcap[] = "--";
+ const char sfast[] = "--fast";
+ const char sport[] = "--port=";
+ const char slocal_only[] = "--local_only";
WSADATA wsaData;
freerdp_listener* instance;
char* file;
{
char* arg = argv[i];
- if (strncmp(arg, "--fast", 7) == 0)
+ if (strncmp(arg, sfast, sizeof(sfast)) == 0)
test_dump_rfx_realtime = FALSE;
- else if (strncmp(arg, "--port=", 7) == 0)
+ else if (strncmp(arg, sport, sizeof(sport) - 1) == 0)
{
StrSep(&arg, "=");
if ((port < 1) || (port > 0xFFFF) || (errno != 0))
return -1;
}
- else if (strcmp(arg, "--local-only"))
+ else if (strncmp(arg, slocal_only, sizeof(slocal_only)) == 0)
localOnly = TRUE;
- else if (strncmp(arg, "--", 2))
+ else if (strncmp(arg, spcap, sizeof(spcap)) == 0)
test_pcap_file = arg;
}