summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2012-08-08 22:21:32 -0700
committerJay Sorg <jay.sorg@gmail.com>2012-08-08 22:21:32 -0700
commit7539d7271eb6ae2504f8a5e17a837aa453bc8355 (patch)
tree2347cd2d14a172050c406de1d2900ff494cfcd57
parentf43e0eb68f78f5f279f1963224f8e7a2b97c4a4e (diff)
downloadxrdp-proprietary-7539d7271eb6ae2504f8a5e17a837aa453bc8355.tar.gz
xrdp-proprietary-7539d7271eb6ae2504f8a5e17a837aa453bc8355.zip
chansrv: work on dynamic channels
-rw-r--r--sesman/chansrv/chansrv.c25
-rw-r--r--sesman/chansrv/chansrv.h19
-rw-r--r--xrdpapi/simple.c11
-rw-r--r--xrdpapi/xrdpapi.c8
-rw-r--r--xrdpapi/xrdpapi.h6
5 files changed, 58 insertions, 11 deletions
diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c
index 365b285c..7c74bb4f 100644
--- a/sesman/chansrv/chansrv.c
+++ b/sesman/chansrv/chansrv.c
@@ -65,6 +65,7 @@ struct xrdp_api_data
{
int chan_id;
char header[64];
+ int flags;
};
/*****************************************************************************/
@@ -535,16 +536,26 @@ my_api_trans_conn_in(struct trans* trans, struct trans* new_trans)
g_memcpy(ad->header, s->data, 64);
+ ad->flags = GGET_UINT32(ad->header, 16);
+
found = 0;
- for (index = 0; index < g_num_chan_items; index++)
+ if (ad->flags | 1) /* WTS_CHANNEL_OPTION_DYNAMIC */
+ {
+ /* TODO */
+ found = 0;
+ }
+ else
{
- LOG(10, (" %s %s", ad->header, g_chan_items[index].name));
- if (g_strcasecmp(ad->header, g_chan_items[index].name) == 0)
+ for (index = 0; index < g_num_chan_items; index++)
{
- LOG(10, ("my_api_trans_conn_in: found it at %d", index));
- ad->chan_id = g_chan_items[index].id;
- found = 1;
- break;
+ LOG(10, (" %s %s", ad->header, g_chan_items[index].name));
+ if (g_strcasecmp(ad->header, g_chan_items[index].name) == 0)
+ {
+ LOG(10, ("my_api_trans_conn_in: found it at %d", index));
+ ad->chan_id = g_chan_items[index].id;
+ found = 1;
+ break;
+ }
}
}
LOG(10, ("my_api_trans_conn_in: found %d", found));
diff --git a/sesman/chansrv/chansrv.h b/sesman/chansrv/chansrv.h
index 7a84ec94..a7a0f3e7 100644
--- a/sesman/chansrv/chansrv.h
+++ b/sesman/chansrv/chansrv.h
@@ -54,4 +54,23 @@ main_cleanup(void);
#define LOGM(_args)
#endif
+#ifndef GSET_UINT8
+#define GSET_UINT8(_ptr, _offset, _data) \
+ *((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))) = (unsigned char)(_data)
+#define GGET_UINT8(_ptr, _offset) \
+ (*((unsigned char*) (((unsigned char*)(_ptr)) + (_offset))))
+#define GSET_UINT16(_ptr, _offset, _data) \
+ GSET_UINT8(_ptr, _offset, _data); \
+ GSET_UINT8(_ptr, (_offset) + 1, (_data) >> 8)
+#define GGET_UINT16(_ptr, _offset) \
+ (GGET_UINT8(_ptr, _offset)) | \
+ ((GGET_UINT8(_ptr, (_offset) + 1)) << 8)
+#define GSET_UINT32(_ptr, _offset, _data) \
+ GSET_UINT16(_ptr, _offset, _data); \
+ GSET_UINT16(_ptr, (_offset) + 2, (_data) >> 16)
+#define GGET_UINT32(_ptr, _offset) \
+ (GGET_UINT16(_ptr, _offset)) | \
+ ((GGET_UINT16(_ptr, (_offset) + 2)) << 16)
+#endif
+
#endif
diff --git a/xrdpapi/simple.c b/xrdpapi/simple.c
index 7c7ff576..a2c0f875 100644
--- a/xrdpapi/simple.c
+++ b/xrdpapi/simple.c
@@ -16,20 +16,25 @@ int main()
{
// Initialize the data for send/receive
+ void* hFile;
char* data;
char* data1;
data = (char*)malloc(DSIZE);
data1 = (char*)malloc(DSIZE);
+ int ret;
+ void* vcFileHandlePtr = NULL;
memset(data, 0xca, DSIZE);
memset(data1, 0, DSIZE);
+ unsigned int written = 0;
// Open the skel channel in current session
- void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "skel", 0);
+ //void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "skel", 0);
+ void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "TSMF", WTS_CHANNEL_OPTION_DYNAMIC);
+ ret = WTSVirtualChannelQuery(channel, WTSVirtualFileHandle, vcFileHandlePtr, &written);
- unsigned int written = 0;
// Write the data to the channel
- int ret = WTSVirtualChannelWrite(channel, data, DSIZE, &written);
+ ret = WTSVirtualChannelWrite(channel, data, DSIZE, &written);
if (!ret)
{
diff --git a/xrdpapi/xrdpapi.c b/xrdpapi/xrdpapi.c
index 6c4eced0..694b3800 100644
--- a/xrdpapi/xrdpapi.c
+++ b/xrdpapi/xrdpapi.c
@@ -45,6 +45,7 @@ struct wts_obj
char name[8];
char dname[128];
int display_num;
+ int flags;
};
/*****************************************************************************/
@@ -158,6 +159,10 @@ send_init(struct wts_obj* wts)
memset(initmsg, 0, 64);
strncpy(initmsg, wts->name, 8);
+ initmsg[16] = (wts->flags >> 0) & 0xff;
+ initmsg[17] = (wts->flags >> 8) & 0xff;
+ initmsg[18] = (wts->flags >> 16) & 0xff;
+ initmsg[19] = (wts->flags >> 24) & 0xff;
LLOGLN(10, ("send_init: sending %s", initmsg));
if (!can_send(wts->fd, 500))
{
@@ -191,6 +196,7 @@ WTSVirtualChannelOpenEx(unsigned int SessionId,
wts = (struct wts_obj*)malloc(sizeof(struct wts_obj));
memset(wts, 0, sizeof(struct wts_obj));
wts->fd = -1;
+ wts->flags = flags;
display_text = getenv("DISPLAY");
if (display_text != 0)
{
@@ -363,7 +369,7 @@ WTSVirtualChannelQuery(void* hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass,
*ppBuffer = malloc(4);
memcpy(*ppBuffer, &(wts->fd), 4);
}
- return 0;
+ return 1;
}
/*****************************************************************************/
diff --git a/xrdpapi/xrdpapi.h b/xrdpapi/xrdpapi.h
index c39c4f1b..65b6db42 100644
--- a/xrdpapi/xrdpapi.h
+++ b/xrdpapi/xrdpapi.h
@@ -30,6 +30,12 @@ extern "C" {
#define WTS_CURRENT_SERVER_HANDLE 0
#define WTS_CURRENT_SESSION 0xffffffff
+#define WTS_CHANNEL_OPTION_DYNAMIC 0x00000001
+#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_LOW 0x00000000
+#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED 0x00000002
+#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_HIGH 0x00000004
+#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_REAL 0x00000006
+#define WTS_CHANNEL_OPTION_DYNAMIC_PRI_COMPRESS 0x00000008
typedef enum _WTS_VIRTUAL_CLASS
{