Using wlog for server now.

This commit is contained in:
Armin Novak
2014-09-12 17:38:12 +02:00
parent 7913a57bc5
commit 5b5791c8d7
31 changed files with 1986 additions and 1958 deletions

View File

@@ -21,12 +21,15 @@
#include "config.h"
#endif
#include <freerdp/utils/debug.h>
#include "sfreerdp.h"
#include "sf_audin.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("sample")
static const AUDIO_FORMAT test_audio_formats[] =
{
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
@@ -35,19 +38,19 @@ static const AUDIO_FORMAT test_audio_formats[] =
static void sf_peer_audin_opening(audin_server_context* context)
{
DEBUG_MSG("AUDIN opening.\n");
WLog_DBG(TAG, "AUDIN opening.");
/* Simply choose the first format supported by the client. */
context->SelectFormat(context, 0);
}
static void sf_peer_audin_open_result(audin_server_context* context, UINT32 result)
{
DEBUG_MSG("AUDIN open result %d.\n", result);
WLog_DBG(TAG, "AUDIN open result %d.", result);
}
static void sf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes)
{
DEBUG_MSG("AUDIN receive %d frames.\n", nframes);
WLog_DBG(TAG, "AUDIN receive %d frames.", nframes);
}
void sf_peer_audin_init(testPeerContext* context)

View File

@@ -22,10 +22,13 @@
#endif
#include <freerdp/server/audin.h>
#include <freerdp/utils/debug.h>
#include "sf_rdpsnd.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("sample")
static const AUDIO_FORMAT test_audio_formats[] =
{
{ WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0, NULL },
@@ -34,7 +37,7 @@ static const AUDIO_FORMAT test_audio_formats[] =
static void sf_peer_rdpsnd_activated(RdpsndServerContext* context)
{
DEBUG_MSG("RDPSND Activated\n");
WLog_DBG(TAG, "RDPSND Activated");
}
BOOL sf_peer_rdpsnd_init(testPeerContext* context)

View File

@@ -33,7 +33,7 @@
#include <freerdp/channels/wtsvc.h>
#include <freerdp/channels/channels.h>
#include <freerdp/utils/debug.h>
#include <freerdp/constants.h>
#include <freerdp/utils/tcp.h>
@@ -45,6 +45,9 @@
#include "sfreerdp.h"
#include <freerdp/log.h>
#define TAG SERVER_TAG("sample")
#define SAMPLE_SERVER_USE_CLIENT_RESOLUTION 1
#define SAMPLE_SERVER_DEFAULT_WIDTH 1024
#define SAMPLE_SERVER_DEFAULT_HEIGHT 768
@@ -342,7 +345,7 @@ static BOOL test_sleep_tsdiff(UINT32 *old_sec, UINT32 *old_usec, UINT32 new_sec,
if ((sec < 0) || ((sec == 0) && (usec < 0)))
{
DEBUG_MSG("Invalid time stamp detected.\n");
WLog_ERR(TAG, "Invalid time stamp detected.");
return FALSE;
}
@@ -451,8 +454,7 @@ static void* tf_debug_channel_thread_func(void* arg)
}
Stream_SetPosition(s, BytesReturned);
DEBUG_MSG("got %lu bytes\n", BytesReturned);
WLog_DBG(TAG, "got %lu bytes", BytesReturned);
}
Stream_Free(s, TRUE);
@@ -470,31 +472,28 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
* The server may start sending graphics output and receiving keyboard/mouse input after this
* callback returns.
*/
DEBUG_MSG("Client %s is activated (osMajorType %d osMinorType %d)", client->local ? "(local)" : client->hostname,
client->settings->OsMajorType, client->settings->OsMinorType);
WLog_DBG(TAG, "Client %s is activated (osMajorType %d osMinorType %d)", client->local ? "(local)" : client->hostname,
client->settings->OsMajorType, client->settings->OsMinorType);
if (client->settings->AutoLogonEnabled)
{
DEBUG_MSG(" and wants to login automatically as %s\\%s",
client->settings->Domain ? client->settings->Domain : "",
client->settings->Username);
WLog_DBG(TAG, " and wants to login automatically as %s\\%s",
client->settings->Domain ? client->settings->Domain : "",
client->settings->Username);
/* A real server may perform OS login here if NLA is not executed previously. */
}
DEBUG_MSG("\n");
DEBUG_MSG("Client requested desktop: %dx%dx%d\n",
client->settings->DesktopWidth, client->settings->DesktopHeight, client->settings->ColorDepth);
WLog_DBG(TAG, "");
WLog_DBG(TAG, "Client requested desktop: %dx%dx%d",
client->settings->DesktopWidth, client->settings->DesktopHeight, client->settings->ColorDepth);
#if (SAMPLE_SERVER_USE_CLIENT_RESOLUTION == 1)
context->rfx_context->width = client->settings->DesktopWidth;
context->rfx_context->height = client->settings->DesktopHeight;
DEBUG_MSG("Using resolution requested by client.\n");
WLog_DBG(TAG, "Using resolution requested by client.");
#else
client->settings->DesktopWidth = context->rfx_context->width;
client->settings->DesktopHeight = context->rfx_context->height;
DEBUG_MSG("Resizing client to %dx%d\n", client->settings->DesktopWidth, client->settings->DesktopHeight);
WLog_DBG(TAG, "Resizing client to %dx%d", client->settings->DesktopWidth, client->settings->DesktopHeight);
client->update->DesktopResize(client->update->context);
#endif
@@ -507,8 +506,7 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
if (context->debug_channel != NULL)
{
DEBUG_MSG("Open channel rdpdbg.\n");
WLog_DBG(TAG, "Open channel rdpdbg.");
context->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
context->debug_channel_thread = CreateThread(NULL, 0,
@@ -562,7 +560,7 @@ BOOL tf_peer_activate(freerdp_peer* client)
void tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
DEBUG_MSG("Client sent a synchronize event (flags:0x%X)\n", flags);
WLog_DBG(TAG, "Client sent a synchronize event (flags:0x%X)", flags);
}
void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
@@ -570,8 +568,7 @@ void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
freerdp_peer* client = input->context->peer;
rdpUpdate* update = client->update;
testPeerContext* context = (testPeerContext*) input->context;
DEBUG_MSG("Client sent a keyboard event (flags:0x%X code:0x%X)\n", flags, code);
WLog_DBG(TAG, "Client sent a keyboard event (flags:0x%X code:0x%X)", flags, code);
if ((flags & 0x4000) && code == 0x22) /* 'g' key */
{
@@ -623,30 +620,28 @@ void tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
void tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
DEBUG_MSG("Client sent a unicode keyboard event (flags:0x%X code:0x%X)\n", flags, code);
WLog_DBG(TAG, "Client sent a unicode keyboard event (flags:0x%X code:0x%X)", flags, code);
}
void tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//printf("Client sent a mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y);
//WLog_DBG(TAG, "Client sent a mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
test_peer_draw_icon(input->context->peer, x + 10, y);
}
void tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//printf("Client sent an extended mouse event (flags:0x%X pos:%d,%d)\n", flags, x, y);
//WLog_DBG(TAG, "Client sent an extended mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
}
static void tf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
BYTE i;
DEBUG_MSG("Client requested to refresh:\n");
WLog_DBG(TAG, "Client requested to refresh:");
for (i = 0; i < count; i++)
{
DEBUG_MSG(" (%d, %d) (%d, %d)\n", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
WLog_DBG(TAG, " (%d, %d) (%d, %d)", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
}
}
@@ -654,11 +649,11 @@ static void tf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_1
{
if (allow > 0)
{
DEBUG_MSG("Client restore output (%d, %d) (%d, %d).\n", area->left, area->top, area->right, area->bottom);
WLog_DBG(TAG, "Client restore output (%d, %d) (%d, %d).", area->left, area->top, area->right, area->bottom);
}
else
{
DEBUG_MSG("Client minimized and suppress output.\n");
WLog_DBG(TAG, "Client minimized and suppress output.");
}
}
@@ -700,8 +695,7 @@ static void* test_peer_mainloop(void* arg)
client->Initialize(client);
context = (testPeerContext*) client->context;
DEBUG_MSG("We've got a client %s\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "We've got a client %s", client->local ? "(local)" : client->hostname);
while (1)
{
@@ -710,7 +704,7 @@ static void* test_peer_mainloop(void* arg)
memset(rfds, 0, sizeof(rfds));
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
{
DEBUG_MSG("Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@@ -744,7 +738,7 @@ static void* test_peer_mainloop(void* arg)
(wsa_error == WSAEINPROGRESS) ||
(wsa_error == WSAEINTR)))
{
DEBUG_MSG("select failed (WSAGetLastError: %d)\n", wsa_error);
WLog_ERR(TAG, "select failed (WSAGetLastError: %d)", wsa_error);
break;
}
#else
@@ -754,7 +748,7 @@ static void* test_peer_mainloop(void* arg)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_MSG("select failed (errno: %d)\n", errno);
WLog_ERR(TAG, "select failed (errno: %d)", errno);
break;
}
#endif
@@ -767,8 +761,7 @@ static void* test_peer_mainloop(void* arg)
break;
}
DEBUG_MSG("Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
WLog_INFO(TAG, "Client %s disconnected.", client->local ? "(local)" : client->hostname);
client->Disconnect(client);
freerdp_peer_context_free(client);
freerdp_peer_free(client);
@@ -800,7 +793,7 @@ static void test_server_mainloop(freerdp_listener* instance)
memset(rfds, 0, sizeof(rfds));
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
{
DEBUG_MSG("Failed to get FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
break;
}
@@ -828,14 +821,14 @@ static void test_server_mainloop(freerdp_listener* instance)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_MSG("select failed\n");
WLog_ERR(TAG, "select failed");
break;
}
}
if (instance->CheckFileDescriptor(instance) != TRUE)
{
DEBUG_MSG("Failed to check FreeRDP file descriptor\n");
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break;
}
}