Merge branch 'master' of github.com:FreeRDP/xrdp
This commit is contained in:
commit
49c4ee8c8c
@ -20,4 +20,5 @@ SUBDIRS = \
|
||||
docs \
|
||||
instfiles \
|
||||
genkeymap \
|
||||
xrdpapi
|
||||
xrdpapi \
|
||||
xrdpvr
|
||||
|
@ -122,6 +122,7 @@ AC_CONFIG_FILES([Makefile
|
||||
instfiles/pam.d/Makefile
|
||||
genkeymap/Makefile
|
||||
xrdpapi/Makefile
|
||||
xrdpvr/Makefile
|
||||
])
|
||||
# fontdump/Makefile
|
||||
# xrdp/cursors/Makefile
|
||||
|
@ -695,7 +695,6 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
int index;
|
||||
char chan_pri;
|
||||
|
||||
g_writeln("my_api_trans_conn_in:");
|
||||
if ((trans == 0) || (trans != g_api_lis_trans) || (new_trans == 0))
|
||||
{
|
||||
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++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -759,6 +759,10 @@ my_api_trans_conn_in(struct trans *trans, struct trans *new_trans)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == g_num_chan_items)
|
||||
{
|
||||
g_writeln("did not find SVC named %s", ad->header);
|
||||
}
|
||||
}
|
||||
|
||||
new_trans->callback_data = ad;
|
||||
|
@ -42,8 +42,18 @@ rdpsnd=true
|
||||
drdynvc=true
|
||||
cliprdr=true
|
||||
rail=true
|
||||
xrdpvr=true
|
||||
|
||||
[xrdp1]
|
||||
name=sesman-X11rdp
|
||||
lib=libxup.so
|
||||
username=ask
|
||||
password=ask
|
||||
ip=127.0.0.1
|
||||
port=-1
|
||||
xserverbpp=24
|
||||
|
||||
[xrdp2]
|
||||
name=sesman-Xvnc
|
||||
lib=libvnc.so
|
||||
username=ask
|
||||
@ -51,7 +61,7 @@ password=ask
|
||||
ip=127.0.0.1
|
||||
port=-1
|
||||
|
||||
[xrdp2]
|
||||
[xrdp3]
|
||||
name=console
|
||||
lib=libvnc.so
|
||||
ip=127.0.0.1
|
||||
@ -59,7 +69,7 @@ port=5900
|
||||
username=na
|
||||
password=ask
|
||||
|
||||
[xrdp3]
|
||||
[xrdp4]
|
||||
name=vnc-any
|
||||
lib=libvnc.so
|
||||
ip=ask
|
||||
@ -70,7 +80,7 @@ password=ask
|
||||
#pampassword=asksame
|
||||
#pamsessionmng=127.0.0.1
|
||||
|
||||
[xrdp4]
|
||||
[xrdp5]
|
||||
name=sesman-any
|
||||
lib=libvnc.so
|
||||
ip=ask
|
||||
@ -78,13 +88,13 @@ port=-1
|
||||
username=ask
|
||||
password=ask
|
||||
|
||||
[xrdp5]
|
||||
[xrdp6]
|
||||
name=rdp-any
|
||||
lib=librdp.so
|
||||
ip=ask
|
||||
port=ask3389
|
||||
|
||||
[xrdp6]
|
||||
[xrdp7]
|
||||
name=freerdp-any
|
||||
lib=libxrdpfreerdp1.so
|
||||
ip=ask
|
||||
@ -92,11 +102,3 @@ port=ask3389
|
||||
username=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 */
|
||||
channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "ECHO", WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW);
|
||||
|
||||
if (channel == NULL)
|
||||
{
|
||||
printf("### WTSVirtualChannelOpenEx() failed!\n");
|
||||
@ -117,6 +118,7 @@ run_echo_test()
|
||||
/* write data to virtual channel */
|
||||
count = (bytes_left > 1700) ? 1700 : bytes_left;
|
||||
rv = WTSVirtualChannelWrite(channel, wr_ptr, count, &bytes_written);
|
||||
|
||||
if ((rv == 0) || (bytes_written == 0))
|
||||
{
|
||||
printf("### WTSVirtualChannelWrite() failed\n");
|
||||
@ -129,6 +131,7 @@ run_echo_test()
|
||||
{
|
||||
/* read back the echo */
|
||||
rv = WTSVirtualChannelRead(channel, 5000, in_buf, count, &bytes_read);
|
||||
|
||||
if ((rv == 0) || (bytes_read == 0))
|
||||
{
|
||||
printf("### WTSVirtualChannelRead() failed\n");
|
||||
@ -145,6 +148,7 @@ run_echo_test()
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
count -= bytes_read;
|
||||
}
|
||||
|
||||
@ -153,26 +157,27 @@ run_echo_test()
|
||||
printf("### pkt %d passed echo test\n", pkt_count++);
|
||||
}
|
||||
|
||||
WTSVirtualChannelClose(channel);
|
||||
return 0;
|
||||
WTSVirtualChannelClose(channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
run_tsmf_test()
|
||||
{
|
||||
void *channel;
|
||||
void *channel;
|
||||
|
||||
printf("this test not yet implemented!\n");
|
||||
return 1;
|
||||
|
||||
/* open virtual channel */
|
||||
channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "TSMF", WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW);
|
||||
|
||||
if (channel == NULL)
|
||||
{
|
||||
printf("### WTSVirtualChannelOpenEx() failed!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
WTSVirtualChannelClose(channel);
|
||||
return 0;
|
||||
WTSVirtualChannelClose(channel);
|
||||
return 0;
|
||||
}
|
||||
|
95
xrdpapi/vrplayer.c
Normal file
95
xrdpapi/vrplayer.c
Normal file
@ -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;
|
||||
}
|
5
xrdpapi/vrplayer.mk
Normal file
5
xrdpapi/vrplayer.mk
Normal file
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
* write data to client connection
|
||||
*
|
||||
* @return 0 on success, -1 on error
|
||||
/*****************************************************************************/
|
||||
int
|
||||
WTSVirtualChannelWrite(void *hChannelHandle, const char *Buffer,
|
||||
unsigned int Length, unsigned int *pBytesWritten)
|
||||
{
|
||||
struct wts_obj *wts;
|
||||
int error;
|
||||
int lerrno;
|
||||
int rv;
|
||||
|
||||
wts = (struct wts_obj *)hChannelHandle;
|
||||
wts = (struct wts_obj *) hChannelHandle;
|
||||
|
||||
*pBytesWritten = 0;
|
||||
|
||||
if (wts == 0)
|
||||
{
|
||||
return 0;
|
||||
LLOGLN(10, ("WTSVirtualChannelWrite: wts is NULL"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (wts->status != 1)
|
||||
{
|
||||
LLOGLN(10, ("WTSVirtualChannelWrite: wts->status != 1"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!can_send(wts->fd, 0))
|
||||
{
|
||||
return 0; /* can't write now, ok to try again */
|
||||
}
|
||||
|
||||
rv = send(wts->fd, Buffer, Length, 0);
|
||||
LLOGLN(10, ("WTSVirtualChannelWrite: send() reted %d", rv));
|
||||
|
||||
if (rv >= 0)
|
||||
{
|
||||
/* success, but zero bytes may have been written */
|
||||
*pBytesWritten = rv;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (can_send(wts->fd, 0))
|
||||
/* error, but is it ok to try again? */
|
||||
if ((rv == EWOULDBLOCK) || (rv == EAGAIN) || (rv == EINPROGRESS))
|
||||
{
|
||||
error = send(wts->fd, Buffer, Length, 0);
|
||||
|
||||
if (error == -1)
|
||||
{
|
||||
lerrno = errno;
|
||||
|
||||
if ((lerrno == EWOULDBLOCK) || (lerrno == EAGAIN) ||
|
||||
(lerrno == EINPROGRESS))
|
||||
{
|
||||
*pBytesWritten = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (error == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (error > 0)
|
||||
{
|
||||
*pBytesWritten = error;
|
||||
return 1;
|
||||
}
|
||||
return 0; /* failed to send, but should try again */
|
||||
}
|
||||
|
||||
*pBytesWritten = 0;
|
||||
return 1;
|
||||
/* fatal error */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -241,6 +241,7 @@ WTSVirtualChannelRead(void *hChannelHandle, unsigned int TimeOut,
|
||||
*pBytesRead = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (rv == 0)
|
||||
|
@ -45,32 +45,33 @@ typedef enum _WTS_VIRTUAL_CLASS
|
||||
{
|
||||
WTSVirtualClientData,
|
||||
WTSVirtualFileHandle
|
||||
} WTS_VIRTUAL_CLASS;
|
||||
}
|
||||
WTS_VIRTUAL_CLASS;
|
||||
|
||||
/*
|
||||
* Reference:
|
||||
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa383464(v=vs.85).aspx
|
||||
*/
|
||||
|
||||
void* WTSVirtualChannelOpen(void* hServer, unsigned int SessionId,
|
||||
const char* pVirtualName);
|
||||
void *WTSVirtualChannelOpen(void *hServer, unsigned int SessionId,
|
||||
const char *pVirtualName);
|
||||
|
||||
void* WTSVirtualChannelOpenEx(unsigned int SessionId,
|
||||
const char* pVirtualName, unsigned int flags);
|
||||
void *WTSVirtualChannelOpenEx(unsigned int SessionId,
|
||||
const char *pVirtualName, unsigned int flags);
|
||||
|
||||
int WTSVirtualChannelWrite(void* hChannelHandle, const char* Buffer,
|
||||
unsigned int Length, unsigned int* pBytesWritten);
|
||||
int WTSVirtualChannelWrite(void *hChannelHandle, const char *Buffer,
|
||||
unsigned int Length, unsigned int *pBytesWritten);
|
||||
|
||||
int WTSVirtualChannelRead(void* hChannelHandle, unsigned int TimeOut,
|
||||
char* Buffer, unsigned int BufferSize,
|
||||
unsigned int* pBytesRead);
|
||||
int WTSVirtualChannelRead(void *hChannelHandle, unsigned int TimeOut,
|
||||
char *Buffer, unsigned int BufferSize,
|
||||
unsigned int *pBytesRead);
|
||||
|
||||
int WTSVirtualChannelClose(void* hChannelHandle);
|
||||
int WTSVirtualChannelClose(void *hChannelHandle);
|
||||
|
||||
int WTSVirtualChannelQuery(void* hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
|
||||
void** ppBuffer, unsigned int* pBytesReturned);
|
||||
int WTSVirtualChannelQuery(void *hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
|
||||
void **ppBuffer, unsigned int *pBytesReturned);
|
||||
|
||||
void WTSFreeMemory(void* pMemory);
|
||||
void WTSFreeMemory(void *pMemory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user