xorg driver, add xrdp connection

ulab-next
Jay Sorg 11 years ago
parent 635e2dba38
commit f0a91c444d

@ -5,7 +5,7 @@ rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \
rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \
rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \
rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \
rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o
rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o
CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1

@ -33,6 +33,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define PixelDPI 100
#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10))
#define RDPMIN(_val1, _val2) ((_val1) < (_val2) ? (_val1) : (_val2))
#define RDPMAX(_val1, _val2) ((_val1) < (_val2) ? (_val2) : (_val1))
/* defined in rdpClientCon.h */
typedef struct _rdpClientCon rdpClientCon;
/* move this to common header */
struct _rdpRec
{
@ -73,6 +79,8 @@ struct _rdpRec
RRGetPanningProcPtr rrGetPanning;
RRSetPanningProcPtr rrSetPanning;
int listen_sck;
rdpClientCon *clientCon;
};
typedef struct _rdpRec rdpRec;
typedef struct _rdpRec * rdpPtr;

@ -0,0 +1,175 @@
/*
Copyright 2005-2013 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Client connection to xrdp
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* this should be before all X11 .h files */
#include <xorg-server.h>
/* all driver need this */
#include <xf86.h>
#include <xf86_OSproc.h>
#include "rdp.h"
#include "rdpDraw.h"
#include "rdpClientCon.h"
#include "rdpMisc.h"
#define LOG_LEVEL 1
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
#define LTOUI32(_in) ((unsigned int)(_in))
/******************************************************************************/
static int
rdpClientConGotConnection(ScreenPtr pScreen, rdpPtr dev)
{
LLOGLN(0, ("rdpClientConGotConnection:"));
return 0;
}
/******************************************************************************/
static int
rdpClientConGotData(ScreenPtr pScreen, rdpPtr dev, rdpClientCon *clientCon)
{
LLOGLN(0, ("rdpClientConGotData:"));
return 0;
}
/******************************************************************************/
static int
rdpClientConGotControlConnection(ScreenPtr pScreen, rdpPtr dev,
rdpClientCon *clientCon)
{
LLOGLN(0, ("rdpClientConGotControlConnection:"));
return 0;
}
/******************************************************************************/
static int
rdpClientConGotControlData(ScreenPtr pScreen, rdpPtr dev,
rdpClientCon *clientCon)
{
LLOGLN(0, ("rdpClientConGotControlData:"));
return 0;
}
/******************************************************************************/
int
rdpClientConCheck(ScreenPtr pScreen)
{
rdpPtr dev;
rdpClientCon *clientCon;
fd_set rfds;
struct timeval time;
int max;
int sel;
int count;
LLOGLN(10, ("rdpClientConCheck:"));
dev = rdpGetDevFromScreen(pScreen);
time.tv_sec = 0;
time.tv_usec = 0;
FD_ZERO(&rfds);
count = 0;
max = 0;
if (dev->listen_sck > 0)
{
count++;
FD_SET(LTOUI32(dev->listen_sck), &rfds);
max = RDPMAX(dev->listen_sck, max);
}
clientCon = dev->clientCon;
while (clientCon != NULL)
{
if (clientCon->sck > 0)
{
count++;
FD_SET(LTOUI32(clientCon->sck), &rfds);
max = RDPMAX(clientCon->sck, max);
}
if (clientCon->sckControl > 0)
{
count++;
FD_SET(LTOUI32(clientCon->sckControl), &rfds);
max = RDPMAX(clientCon->sckControl, max);
}
if (clientCon->sckControlListener > 0)
{
count++;
FD_SET(LTOUI32(clientCon->sckControlListener), &rfds);
max = RDPMAX(clientCon->sckControlListener, max);
}
clientCon = clientCon->next;
}
if (count < 1)
{
sel = 0;
}
else
{
sel = select(max + 1, &rfds, 0, 0, &time);
}
if (sel < 1)
{
LLOGLN(10, ("rdpClientConCheck: no select"));
return 0;
}
if (dev->listen_sck > 0)
{
if (FD_ISSET(LTOUI32(dev->listen_sck), &rfds))
{
rdpClientConGotConnection(pScreen, dev);
}
}
clientCon = dev->clientCon;
while (clientCon != NULL)
{
if (clientCon->sck > 0)
{
if (FD_ISSET(LTOUI32(clientCon->sck), &rfds))
{
rdpClientConGotData(pScreen, dev, clientCon);
}
}
if (clientCon->sckControlListener > 0)
{
if (FD_ISSET(LTOUI32(clientCon->sckControlListener), &rfds))
{
rdpClientConGotControlConnection(pScreen, dev, clientCon);
}
}
if (clientCon->sckControl > 0)
{
if (FD_ISSET(LTOUI32(clientCon->sckControl), &rfds))
{
rdpClientConGotControlData(pScreen, dev, clientCon);
}
}
clientCon = clientCon->next;
}
return 0;
}

@ -0,0 +1,38 @@
/*
Copyright 2005-2013 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Client connection to xrdp
*/
#ifndef _RDPCLIENTCON_H
#define _RDPCLIENTCON_H
struct _rdpClientCon
{
int sck;
int sckControlListener;
int sckControl;
struct _rdpClientCon *next;
};
int
rdpClientConCheck(ScreenPtr pScreen);
#endif

@ -48,6 +48,7 @@ This is the main driver file
#include "rdpComposite.h"
#include "rdpGlyphs.h"
#include "rdpPixmap.h"
#include "rdpClientCon.h"
#define XRDP_DRIVER_NAME "XRDPDEV"
#define XRDP_NAME "XRDPDEV"
@ -393,6 +394,19 @@ rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg)
return 0;
}
/******************************************************************************/
static void
rdpBlockHandler1(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
{
}
/******************************************************************************/
static void
rdpWakeupHandler1(pointer blockData, int result, pointer pReadmask)
{
rdpClientConCheck((ScreenPtr)blockData);
}
/*****************************************************************************/
static Bool
rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
@ -518,6 +532,8 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ps->Glyphs = rdpGlyphs;
}
RegisterBlockAndWakeupHandlers(rdpBlockHandler1, rdpWakeupHandler1, pScreen);
g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen);
LLOGLN(0, ("rdpScreenInit: out"));

Loading…
Cancel
Save