Merge branch 'master' of github.com:FreeRDP/xrdp

ulab-next
Jay Sorg 12 years ago
commit 49c4ee8c8c

@ -20,4 +20,5 @@ SUBDIRS = \
docs \ docs \
instfiles \ instfiles \
genkeymap \ genkeymap \
xrdpapi xrdpapi \
xrdpvr

@ -122,6 +122,7 @@ AC_CONFIG_FILES([Makefile
instfiles/pam.d/Makefile instfiles/pam.d/Makefile
genkeymap/Makefile genkeymap/Makefile
xrdpapi/Makefile xrdpapi/Makefile
xrdpvr/Makefile
]) ])
# fontdump/Makefile # fontdump/Makefile
# xrdp/cursors/Makefile # xrdp/cursors/Makefile

@ -695,7 +695,6 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
int index; int index;
char chan_pri; char chan_pri;
g_writeln("my_api_trans_conn_in:");
if ((trans == 0) || (trans != g_api_lis_trans) || (new_trans == 0)) if ((trans == 0) || (trans != g_api_lis_trans) || (new_trans == 0))
{ {
return 1; return 1;
@ -750,7 +749,8 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
for (index = 0; index < g_num_chan_items; index++) for (index = 0; index < g_num_chan_items; index++)
{ {
LOG(10, (" %s %s", ad->header, g_chan_items[index].name)); LOG(10, ("my_api_trans_conn_in: %s %s", ad->header,
g_chan_items[index].name));
if (g_strcasecmp(ad->header, g_chan_items[index].name) == 0) if (g_strcasecmp(ad->header, g_chan_items[index].name) == 0)
{ {
@ -759,6 +759,10 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
break; break;
} }
} }
if (index == g_num_chan_items)
{
g_writeln("did not find SVC named %s", ad->header);
}
} }
new_trans->callback_data = ad; new_trans->callback_data = ad;

@ -42,8 +42,18 @@ rdpsnd=true
drdynvc=true drdynvc=true
cliprdr=true cliprdr=true
rail=true rail=true
xrdpvr=true
[xrdp1] [xrdp1]
name=sesman-X11rdp
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
xserverbpp=24
[xrdp2]
name=sesman-Xvnc name=sesman-Xvnc
lib=libvnc.so lib=libvnc.so
username=ask username=ask
@ -51,7 +61,7 @@ password=ask
ip=127.0.0.1 ip=127.0.0.1
port=-1 port=-1
[xrdp2] [xrdp3]
name=console name=console
lib=libvnc.so lib=libvnc.so
ip=127.0.0.1 ip=127.0.0.1
@ -59,7 +69,7 @@ port=5900
username=na username=na
password=ask password=ask
[xrdp3] [xrdp4]
name=vnc-any name=vnc-any
lib=libvnc.so lib=libvnc.so
ip=ask ip=ask
@ -70,7 +80,7 @@ password=ask
#pampassword=asksame #pampassword=asksame
#pamsessionmng=127.0.0.1 #pamsessionmng=127.0.0.1
[xrdp4] [xrdp5]
name=sesman-any name=sesman-any
lib=libvnc.so lib=libvnc.so
ip=ask ip=ask
@ -78,13 +88,13 @@ port=-1
username=ask username=ask
password=ask password=ask
[xrdp5] [xrdp6]
name=rdp-any name=rdp-any
lib=librdp.so lib=librdp.so
ip=ask ip=ask
port=ask3389 port=ask3389
[xrdp6] [xrdp7]
name=freerdp-any name=freerdp-any
lib=libxrdpfreerdp1.so lib=libxrdpfreerdp1.so
ip=ask ip=ask
@ -92,11 +102,3 @@ port=ask3389
username=ask username=ask
password=ask password=ask
[xrdp7]
name=sesman-X11rdp
lib=libxup.so
username=ask
password=ask
ip=127.0.0.1
port=-1
xserverbpp=24

@ -101,6 +101,7 @@ run_echo_test()
/* open a virtual channel named ECHO */ /* open a virtual channel named ECHO */
channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "ECHO", WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW); channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "ECHO", WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW);
if (channel == NULL) if (channel == NULL)
{ {
printf("### WTSVirtualChannelOpenEx() failed!\n"); printf("### WTSVirtualChannelOpenEx() failed!\n");
@ -117,6 +118,7 @@ run_echo_test()
/* write data to virtual channel */ /* write data to virtual channel */
count = (bytes_left > 1700) ? 1700 : bytes_left; count = (bytes_left > 1700) ? 1700 : bytes_left;
rv = WTSVirtualChannelWrite(channel, wr_ptr, count, &bytes_written); rv = WTSVirtualChannelWrite(channel, wr_ptr, count, &bytes_written);
if ((rv == 0) || (bytes_written == 0)) if ((rv == 0) || (bytes_written == 0))
{ {
printf("### WTSVirtualChannelWrite() failed\n"); printf("### WTSVirtualChannelWrite() failed\n");
@ -129,6 +131,7 @@ run_echo_test()
{ {
/* read back the echo */ /* read back the echo */
rv = WTSVirtualChannelRead(channel, 5000, in_buf, count, &bytes_read); rv = WTSVirtualChannelRead(channel, 5000, in_buf, count, &bytes_read);
if ((rv == 0) || (bytes_read == 0)) if ((rv == 0) || (bytes_read == 0))
{ {
printf("### WTSVirtualChannelRead() failed\n"); printf("### WTSVirtualChannelRead() failed\n");
@ -145,6 +148,7 @@ run_echo_test()
return -1; return -1;
} }
} }
count -= bytes_read; count -= bytes_read;
} }
@ -153,26 +157,27 @@ run_echo_test()
printf("### pkt %d passed echo test\n", pkt_count++); printf("### pkt %d passed echo test\n", pkt_count++);
} }
WTSVirtualChannelClose(channel); WTSVirtualChannelClose(channel);
return 0; return 0;
} }
int int
run_tsmf_test() run_tsmf_test()
{ {
void *channel; void *channel;
printf("this test not yet implemented!\n"); printf("this test not yet implemented!\n");
return 1; return 1;
/* open virtual channel */ /* open virtual channel */
channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "TSMF", WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW); channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "TSMF", WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW);
if (channel == NULL) if (channel == NULL)
{ {
printf("### WTSVirtualChannelOpenEx() failed!\n"); printf("### WTSVirtualChannelOpenEx() failed!\n");
return 1; return 1;
} }
WTSVirtualChannelClose(channel); WTSVirtualChannelClose(channel);
return 0; return 0;
} }

@ -0,0 +1,95 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Laxmikant Rashinkar 2012 LK.Rashinkar@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.
*
* a program that uses xrdpapi and ffmpeg to redirect media streams
* to a FreeRDP client where it is decompressed and played locally
*
*/
/******************************************************************************
* build instructions: make -f vrplayer.mk
* setup environment: export LD_LIBRARY_PATH=".libs:../xrdpvr/.libs"
* run vrplayer: vrplayer <media file>
*****************************************************************************/
#ifdef __WIN32__
#include <mstsapi.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include "xrdpapi.h"
#include "xrdpvr.h"
void
extract_32(uint32_t *value, char *buf)
{
*value = ((buf[3] << 24) & 0xff000000)
| ((buf[2] << 16) & 0x00ff0000)
| ((buf[1] << 8) & 0x0000ff00)
| (buf[0] & 0x000000ff);
}
int
main(int argc, char **argv)
{
char *data;
char *data1;
void *channel;
int written = 0;
int rv;
int first_time = 1;
int length;
int bytes_read;
if (argc < 2)
{
printf("usage: vrplayer <media filename> >\n");
return 1;
}
/* open a virtual channel and connect to remote client */
channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "xrdpvr", 0);
if (channel == NULL)
{
fprintf(stderr, "WTSVirtualChannelOpenEx() failed\n");
return 1;
}
/* initialize the player */
if (xrdpvr_init_player(channel, 101, argv[1]))
{
fprintf(stderr, "failed to initialize the player\n");
return 1;
}
/* send compressed media data to client; client will decompress */
/* the media and play it locally */
xrdpvr_play_media(channel, 101, argv[1]);
/* perform clean up */
xrdpvr_deinit_player(channel, 101);
WTSVirtualChannelClose(channel);
return 0;
}

@ -0,0 +1,5 @@
CFLAGS = -I../xrdpvr
LIBS = -L./.libs -L../xrdpvr/.libs -lxrdpapi -lxrdpvr -lavformat
vrplayer: vrplayer.o
gcc $(CFLAGS) vrplayer.c -o vrplayer $(LIBS)

@ -152,57 +152,57 @@ WTSVirtualChannelOpenEx(unsigned int SessionId, const char *pVirtualName,
return wts; return wts;
} }
/*
* write data to client connection
*
* @return 0 on success, -1 on error
/*****************************************************************************/ /*****************************************************************************/
int int
WTSVirtualChannelWrite(void *hChannelHandle, const char *Buffer, WTSVirtualChannelWrite(void *hChannelHandle, const char *Buffer,
unsigned int Length, unsigned int *pBytesWritten) unsigned int Length, unsigned int *pBytesWritten)
{ {
struct wts_obj *wts; struct wts_obj *wts;
int error; int rv;
int lerrno;
wts = (struct wts_obj *)hChannelHandle; wts = (struct wts_obj *) hChannelHandle;
*pBytesWritten = 0;
if (wts == 0) if (wts == 0)
{ {
return 0; LLOGLN(10, ("WTSVirtualChannelWrite: wts is NULL"));
return -1;
} }
if (wts->status != 1) if (wts->status != 1)
{ {
return 0; LLOGLN(10, ("WTSVirtualChannelWrite: wts->status != 1"));
return -1;
} }
if (can_send(wts->fd, 0)) if (!can_send(wts->fd, 0))
{ {
error = send(wts->fd, Buffer, Length, 0); return 0; /* can't write now, ok to try again */
}
if (error == -1) rv = send(wts->fd, Buffer, Length, 0);
{ LLOGLN(10, ("WTSVirtualChannelWrite: send() reted %d", rv));
lerrno = errno;
if ((lerrno == EWOULDBLOCK) || (lerrno == EAGAIN) || if (rv >= 0)
(lerrno == EINPROGRESS)) {
{ /* success, but zero bytes may have been written */
*pBytesWritten = 0; *pBytesWritten = rv;
return 1; return 0;
} }
return 0; /* error, but is it ok to try again? */
} if ((rv == EWOULDBLOCK) || (rv == EAGAIN) || (rv == EINPROGRESS))
else if (error == 0) {
{ return 0; /* failed to send, but should try again */
return 0;
}
else if (error > 0)
{
*pBytesWritten = error;
return 1;
}
} }
*pBytesWritten = 0; /* fatal error */
return 1; return -1;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -241,6 +241,7 @@ WTSVirtualChannelRead(void *hChannelHandle, unsigned int TimeOut,
*pBytesRead = 0; *pBytesRead = 0;
return 1; return 1;
} }
return 0; return 0;
} }
else if (rv == 0) else if (rv == 0)

@ -45,32 +45,33 @@ typedef enum _WTS_VIRTUAL_CLASS
{ {
WTSVirtualClientData, WTSVirtualClientData,
WTSVirtualFileHandle WTSVirtualFileHandle
} WTS_VIRTUAL_CLASS; }
WTS_VIRTUAL_CLASS;
/* /*
* Reference: * Reference:
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464(v=vs.85).aspx * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464(v=vs.85).aspx
*/ */
void* WTSVirtualChannelOpen(void* hServer, unsigned int SessionId, void *WTSVirtualChannelOpen(void *hServer, unsigned int SessionId,
const char* pVirtualName); const char *pVirtualName);
void* WTSVirtualChannelOpenEx(unsigned int SessionId, void *WTSVirtualChannelOpenEx(unsigned int SessionId,
const char* pVirtualName, unsigned int flags); const char *pVirtualName, unsigned int flags);
int WTSVirtualChannelWrite(void* hChannelHandle, const char* Buffer, int WTSVirtualChannelWrite(void *hChannelHandle, const char *Buffer,
unsigned int Length, unsigned int* pBytesWritten); unsigned int Length, unsigned int *pBytesWritten);
int WTSVirtualChannelRead(void* hChannelHandle, unsigned int TimeOut, int WTSVirtualChannelRead(void *hChannelHandle, unsigned int TimeOut,
char* Buffer, unsigned int BufferSize, char *Buffer, unsigned int BufferSize,
unsigned int* pBytesRead); unsigned int *pBytesRead);
int WTSVirtualChannelClose(void* hChannelHandle); int WTSVirtualChannelClose(void *hChannelHandle);
int WTSVirtualChannelQuery(void* hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, int WTSVirtualChannelQuery(void *hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
void** ppBuffer, unsigned int* pBytesReturned); void **ppBuffer, unsigned int *pBytesReturned);
void WTSFreeMemory(void* pMemory); void WTSFreeMemory(void *pMemory);
#ifdef __cplusplus #ifdef __cplusplus
} }

Loading…
Cancel
Save