Commit 97299606 authored by dscho's avatar dscho

global structures/functions should have "rfb", "sra" or "zrle" as prefix,

while structure members should not
parent 0d3b958b
......@@ -29,7 +29,7 @@ int main (int argc, char **argv)
server = rfbGetScreen (&argc, argv, maxx, maxy, 8, 3, bpp);
server->desktopName = "Zippy das wundersquirrel\'s VNC server";
server->frameBuffer = (char*)malloc(maxx*maxy*bpp);
server->rfbAlwaysShared = TRUE;
server->alwaysShared = TRUE;
server->kbdAddEvent = on_key_press;
server->ptrAddEvent = on_mouse_event;
......@@ -76,7 +76,7 @@ void draw_primary_colors (char* frame_buffer, int x1, int y1, int x2, int y2)
/* Dscho's versions (slower, but works for bpp != 3 or 4) */
void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
{
rfbPixelFormat f=s->rfbServerFormat;
rfbPixelFormat f=s->serverFormat;
int i,j;
for(j=y1;j<y2;j++)
for(i=x1;i<x2;i++)
......@@ -90,7 +90,7 @@ void draw_primary_colours_generic(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2
void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
{
rfbPixelFormat f=s->rfbServerFormat;
rfbPixelFormat f=s->serverFormat;
int i,j,y3=(y1*2+y2)/3,y4=(y1+y2*2)/3;
/* draw first pixel */
rfbDrawPixel(s,x1,y1,f.redMax<<f.redShift);
......@@ -108,7 +108,7 @@ void draw_primary_colours_generic_fast(rfbScreenInfoPtr s,int x1,int y1,int x2,i
void draw_primary_colours_generic_ultrafast(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2)
{
rfbPixelFormat f=s->rfbServerFormat;
rfbPixelFormat f=s->serverFormat;
int y3=(y1*2+y2)/3,y4=(y1+y2*2)/3;
/* fill rectangles */
rfbFillRect(s,x1,y1,x2,y3,f.redMax<<f.redShift);
......
......@@ -8,7 +8,7 @@ int main(int argc,char** argv)
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,256,256,8,1,1);
server->rfbServerFormat.trueColour=FALSE;
server->serverFormat.trueColour=FALSE;
server->colourMap.count=256;
server->colourMap.is16=FALSE;
for(i=0;i<256;i++) {
......
......@@ -157,7 +157,7 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
cd->oldx=x; cd->oldy=y; cd->oldButton=buttonMask;
}
defaultPtrAddEvent(buttonMask,x,y,cl);
rfbDefaultPtrAddEvent(buttonMask,x,y,cl);
}
/* aux function to draw a character to x, y */
......@@ -277,7 +277,7 @@ int main(int argc,char** argv)
rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp);
rfbScreen->desktopName = "LibVNCServer Example";
rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp);
rfbScreen->rfbAlwaysShared = TRUE;
rfbScreen->alwaysShared = TRUE;
rfbScreen->ptrAddEvent = doptr;
rfbScreen->kbdAddEvent = dokey;
rfbScreen->newClientHook = newclient;
......
......@@ -64,7 +64,7 @@ int main(int argc,char** argv)
rfbScreen->desktopName = argv[1];
else
rfbScreen->desktopName = "Picture";
rfbScreen->rfbAlwaysShared = TRUE;
rfbScreen->alwaysShared = TRUE;
rfbScreen->kbdAddEvent = HandleKey;
/* enable http */
......@@ -76,7 +76,7 @@ int main(int argc,char** argv)
fclose(in);
if(picType!=TRUECOLOUR) {
rfbScreen->rfbServerFormat.trueColour=FALSE;
rfbScreen->serverFormat.trueColour=FALSE;
rfbScreen->colourMap.count=256;
rfbScreen->colourMap.is16=FALSE;
rfbScreen->colourMap.data.bytes=malloc(256*3);
......
......@@ -57,7 +57,7 @@ int main(int argc,char** argv)
rfbScreen->desktopName = argv[1];
else
rfbScreen->desktopName = "Picture";
rfbScreen->rfbAlwaysShared = TRUE;
rfbScreen->alwaysShared = TRUE;
rfbScreen->kbdAddEvent = HandleKey;
/* enable http */
......
......@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
if (argc != 3)
usage();
if (vncEncryptAndStorePasswd(argv[1], argv[2]) != 0) {
if (rfbEncryptAndStorePasswd(argv[1], argv[2]) != 0) {
printf("storing password failed.\n");
return 1;
} else {
......
......@@ -105,7 +105,7 @@ int main(int argc,char** argv)
s->colourMap.is16=FALSE;
s->colourMap.count=2;
s->colourMap.data.bytes=(unsigned char*)"\xd0\xd0\xd0\x30\x01\xe0";
s->rfbServerFormat.trueColour=FALSE;
s->serverFormat.trueColour=FALSE;
s->frameBuffer=f;
s->kbdAddEvent=dokey;
s->ptrAddEvent=doptr;
......
......@@ -246,7 +246,7 @@ ConnectToRFBServer(rfbClient* client,const char *hostname, int port)
return SetNonBlocking(client->sock);
}
static void rfbEncryptBytes(unsigned char *bytes, char *passwd);
extern void rfbClientEncryptBytes(unsigned char* bytes, char* passwd);
/*
* InitialiseRFBConnection.
......@@ -327,7 +327,7 @@ InitialiseRFBConnection(rfbClient* client)
passwd[8] = '\0';
}
rfbEncryptBytes(challenge, passwd);
rfbClientEncryptBytes(challenge, passwd);
/* Lose the password from memory */
for (i = strlen(passwd); i >= 0; i--) {
......@@ -1136,14 +1136,14 @@ JpegSetSrcManager(j_decompress_ptr cinfo, uint8_t *compressedData,
/* avoid name clashes with LibVNCServer */
#define vncEncryptBytes rfbEncryptBytes
#define vncEncryptAndStorePasswd rfbEncryptAndStorePasswdUnused
#define vncDecryptPasswdFromFile rfbDecryptPasswdFromFileUnused
#define vncRandomBytes rfbRandomBytesUnused
#define des rfbDES
#define deskey rfbDESKey
#define usekey rfbUseKey
#define cpkey rfbCPKey
#define rfbEncryptBytes rfbClientEncryptBytes
#define rfbEncryptAndStorePasswd rfbClientEncryptAndStorePasswdUnused
#define rfbDecryptPasswdFromFile rfbClientDecryptPasswdFromFileUnused
#define rfbRandomBytes rfbClientRandomBytesUnused
#define rfbDes rfbClientDes
#define rfbDesKey rfbClientDesKey
#define rfbUseKey rfbClientUseKey
#define rfbCPKey rfbClientCPKey
#include "../libvncserver/vncauth.c"
#include "../libvncserver/d3des.c"
......@@ -43,9 +43,9 @@ rfbAuthNewClient(cl)
cl->state = RFB_AUTHENTICATION;
if (cl->screen->rfbAuthPasswdData && !cl->reverseConnection) {
if (cl->screen->authPasswdData && !cl->reverseConnection) {
*(uint32_t *)buf = Swap32IfLE(rfbVncAuth);
vncRandomBytes(cl->authChallenge);
rfbRandomBytes(cl->authChallenge);
memcpy(&buf[4], (char *)cl->authChallenge, CHALLENGESIZE);
len = 4 + CHALLENGESIZE;
} else {
......@@ -54,7 +54,7 @@ rfbAuthNewClient(cl)
cl->state = RFB_INITIALISATION;
}
if (WriteExact(cl, buf, len) < 0) {
if (rfbWriteExact(cl, buf, len) < 0) {
rfbLogPerror("rfbAuthNewClient: write");
rfbCloseClient(cl);
return;
......@@ -75,7 +75,7 @@ rfbAuthProcessClientMessage(cl)
uint8_t response[CHALLENGESIZE];
uint32_t authResult;
if ((n = ReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
if ((n = rfbReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
if (n != 0)
rfbLogPerror("rfbAuthProcessClientMessage: read");
rfbCloseClient(cl);
......@@ -85,7 +85,7 @@ rfbAuthProcessClientMessage(cl)
if(!cl->screen->passwordCheck(cl,(const char*)response,CHALLENGESIZE)) {
rfbErr("rfbAuthProcessClientMessage: password check failed\n");
authResult = Swap32IfLE(rfbVncAuthFailed);
if (WriteExact(cl, (char *)&authResult, 4) < 0) {
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write");
}
rfbCloseClient(cl);
......@@ -94,7 +94,7 @@ rfbAuthProcessClientMessage(cl)
authResult = Swap32IfLE(rfbVncAuthOK);
if (WriteExact(cl, (char *)&authResult, 4) < 0) {
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write");
rfbCloseClient(cl);
return;
......
......@@ -64,19 +64,19 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
rfbUsage();
return FALSE;
}
rfbScreen->rfbPort = atoi(argv[++i]);
rfbScreen->port = atoi(argv[++i]);
} else if (strcmp(argv[i], "-rfbwait") == 0) { /* -rfbwait ms */
if (i + 1 >= *argc) {
rfbUsage();
return FALSE;
}
rfbScreen->rfbMaxClientWait = atoi(argv[++i]);
rfbScreen->maxClientWait = atoi(argv[++i]);
} else if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */
if (i + 1 >= *argc) {
rfbUsage();
return FALSE;
}
rfbScreen->rfbAuthPasswdData = argv[++i];
rfbScreen->authPasswdData = argv[++i];
} else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */
char **passwds = malloc(sizeof(char**)*2);
if (i + 1 >= *argc) {
......@@ -85,14 +85,14 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
}
passwds[0] = argv[++i];
passwds[1] = 0;
rfbScreen->rfbAuthPasswdData = (void*)passwds;
rfbScreen->authPasswdData = (void*)passwds;
rfbScreen->passwordCheck = rfbCheckPasswordByList;
} else if (strcmp(argv[i], "-deferupdate") == 0) { /* -deferupdate milliseconds */
if (i + 1 >= *argc) {
rfbUsage();
return FALSE;
}
rfbScreen->rfbDeferUpdateTime = atoi(argv[++i]);
rfbScreen->deferUpdateTime = atoi(argv[++i]);
} else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */
if (i + 1 >= *argc) {
rfbUsage();
......@@ -100,11 +100,11 @@ rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
}
rfbScreen->desktopName = argv[++i];
} else if (strcmp(argv[i], "-alwaysshared") == 0) {
rfbScreen->rfbAlwaysShared = TRUE;
rfbScreen->alwaysShared = TRUE;
} else if (strcmp(argv[i], "-nevershared") == 0) {
rfbScreen->rfbNeverShared = TRUE;
rfbScreen->neverShared = TRUE;
} else if (strcmp(argv[i], "-dontdisconnect") == 0) {
rfbScreen->rfbDontDisconnect = TRUE;
rfbScreen->dontDisconnect = TRUE;
} else if (strcmp(argv[i], "-httpdir") == 0) { /* -httpdir directory-path */
if (i + 1 >= *argc) {
rfbUsage();
......
......@@ -115,7 +115,7 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
rreAfterBuf = (char *)realloc(rreAfterBuf, rreAfterBufSize);
}
(*cl->translateFn)(cl->translateLookupTable,&(cl->screen->rfbServerFormat),
(*cl->translateFn)(cl->translateLookupTable,&(cl->screen->serverFormat),
&cl->format, fbptr, rreBeforeBuf,
cl->screen->paddedWidthInBytes, w, h);
......@@ -141,8 +141,8 @@ rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h)
return rfbSendRectEncodingRaw(cl, x, y, w, h);
}
cl->rfbRectanglesSent[rfbEncodingCoRRE]++;
cl->rfbBytesSent[rfbEncodingCoRRE] += (sz_rfbFramebufferUpdateRectHeader
cl->rectanglesSent[rfbEncodingCoRRE]++;
cl->bytesSent[rfbEncodingCoRRE] += (sz_rfbFramebufferUpdateRectHeader
+ sz_rfbRREHeader + rreAfterBufLen);
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader
......
......@@ -46,11 +46,11 @@ rfbSendCursorShape(cl)
if (cl->useRichCursorEncoding) {
if(pCursor && !pCursor->richSource)
MakeRichCursorFromXCursor(cl->screen,pCursor);
rfbMakeRichCursorFromXCursor(cl->screen,pCursor);
rect.encoding = Swap32IfLE(rfbEncodingRichCursor);
} else {
if(pCursor && !pCursor->source)
MakeXCursorFromRichCursor(cl->screen,pCursor);
rfbMakeXCursorFromRichCursor(cl->screen,pCursor);
rect.encoding = Swap32IfLE(rfbEncodingXCursor);
}
......@@ -73,8 +73,8 @@ rfbSendCursorShape(cl)
sz_rfbFramebufferUpdateRectHeader);
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
cl->rfbCursorShapeBytesSent += sz_rfbFramebufferUpdateRectHeader;
cl->rfbCursorShapeUpdatesSent++;
cl->cursorShapeBytesSent += sz_rfbFramebufferUpdateRectHeader;
cl->cursorShapeUpdatesSent++;
if (!rfbSendUpdateBuf(cl))
return FALSE;
......@@ -139,10 +139,10 @@ rfbSendCursorShape(cl)
}
} else {
/* RichCursor encoding. */
int bpp1=cl->screen->rfbServerFormat.bitsPerPixel/8,
int bpp1=cl->screen->serverFormat.bitsPerPixel/8,
bpp2=cl->format.bitsPerPixel/8;
(*cl->translateFn)(cl->translateLookupTable,
&(cl->screen->rfbServerFormat),
&(cl->screen->serverFormat),
&cl->format, (char*)pCursor->richSource,
&cl->updateBuf[cl->ublen],
pCursor->width*bpp1, pCursor->width, pCursor->height);
......@@ -163,8 +163,8 @@ rfbSendCursorShape(cl)
/* Send everything we have prepared in the cl->updateBuf[]. */
cl->rfbCursorShapeBytesSent += (cl->ublen - saved_ublen);
cl->rfbCursorShapeUpdatesSent++;
cl->cursorShapeBytesSent += (cl->ublen - saved_ublen);
cl->cursorShapeUpdatesSent++;
if (!rfbSendUpdateBuf(cl))
return FALSE;
......@@ -196,8 +196,8 @@ rfbSendCursorPos(rfbClientPtr cl)
sz_rfbFramebufferUpdateRectHeader);
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
cl->rfbCursorPosBytesSent += sz_rfbFramebufferUpdateRectHeader;
cl->rfbCursorPosUpdatesSent++;
cl->cursorPosBytesSent += sz_rfbFramebufferUpdateRectHeader;
cl->cursorPosUpdatesSent++;
if (!rfbSendUpdateBuf(cl))
return FALSE;
......@@ -326,9 +326,9 @@ void rfbFreeCursor(rfbCursorPtr cursor)
}
/* background and foregroud colour have to be set beforehand */
void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
{
rfbPixelFormat* format=&rfbScreen->rfbServerFormat;
rfbPixelFormat* format=&rfbScreen->serverFormat;
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8,
width=cursor->width*bpp;
uint32_t background;
......@@ -352,9 +352,9 @@ void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
cursor->source[j*w+i/8]|=bit;
}
void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
{
rfbPixelFormat* format=&rfbScreen->rfbServerFormat;
rfbPixelFormat* format=&rfbScreen->serverFormat;
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8;
uint32_t background,foreground;
char *back=(char*)&background,*fore=(char*)&foreground;
......@@ -387,7 +387,7 @@ void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
void rfbUndrawCursor(rfbScreenInfoPtr s)
{
rfbCursorPtr c=s->cursor;
int j,x1,x2,y1,y2,bpp=s->rfbServerFormat.bitsPerPixel/8,
int j,x1,x2,y1,y2,bpp=s->serverFormat.bitsPerPixel/8,
rowstride=s->paddedWidthInBytes;
LOCK(s->cursorMutex);
if(!s->cursorIsDrawn || !c) {
......@@ -429,7 +429,7 @@ void rfbUndrawCursor(rfbScreenInfoPtr s)
void rfbDrawCursor(rfbScreenInfoPtr s)
{
rfbCursorPtr c=s->cursor;
int i,j,x1,x2,y1,y2,i1,j1,bpp=s->rfbServerFormat.bitsPerPixel/8,
int i,j,x1,x2,y1,y2,i1,j1,bpp=s->serverFormat.bitsPerPixel/8,
rowstride=s->paddedWidthInBytes,
bufSize,w;
rfbBool wasChanged=FALSE;
......@@ -487,7 +487,7 @@ void rfbDrawCursor(rfbScreenInfoPtr s)
}
if(!c->richSource)
MakeRichCursorFromXCursor(s,c);
rfbMakeRichCursorFromXCursor(s,c);
/* now the cursor has to be drawn */
for(j=0;j<y2;j++)
......
......@@ -71,7 +71,7 @@ static unsigned char pc2[48] = {
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
void deskey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
void rfbDesKey(key, edf) /* Thanks to James Gillogly & Phil Karn! */
unsigned char *key;
int edf;
{
......@@ -127,11 +127,11 @@ register unsigned long *raw1;
*cook |= (*raw1 & 0x0003f000L) >> 4;
*cook++ |= (*raw1 & 0x0000003fL);
}
usekey(dough);
rfbUseKey(dough);
return;
}
void cpkey(into)
void rfbCPKey(into)
register unsigned long *into;
{
register unsigned long *from, *endp;
......@@ -141,7 +141,7 @@ register unsigned long *into;
return;
}
void usekey(from)
void rfbUseKey(from)
register unsigned long *from;
{
register unsigned long *to, *endp;
......@@ -151,7 +151,7 @@ register unsigned long *from;
return;
}
void des(inblock, outblock)
void rfbDes(inblock, outblock)
unsigned char *inblock, *outblock;
{
unsigned long work[2];
......
......@@ -25,25 +25,25 @@
#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */
extern void deskey(unsigned char *, int);
extern void rfbDesKey(unsigned char *, int);
/* hexkey[8] MODE
* Sets the internal key register according to the hexadecimal
* key contained in the 8 bytes of hexkey, according to the DES,
* for encryption or decryption according to MODE.
*/
extern void usekey(unsigned long *);
extern void rfbUseKey(unsigned long *);
/* cookedkey[32]
* Loads the internal key register with the data in cookedkey.
*/
extern void cpkey(unsigned long *);
extern void rfbCPKey(unsigned long *);
/* cookedkey[32]
* Copies the contents of the internal key register into the storage
* located at &cookedkey[0].
*/
extern void des(unsigned char *, unsigned char *);
extern void rfbDes(unsigned char *, unsigned char *);
/* from[8] to[8]
* Encrypts/Decrypts (according to the key currently loaded in the
* internal key register) one block of eight bytes at address 'from'
......
......@@ -7,7 +7,7 @@ int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
unsigned char* data=font->data+font->metaData[c*5];
unsigned char d=*data;
int rowstride=rfbScreen->paddedWidthInBytes;
int bpp=rfbScreen->rfbServerFormat.bitsPerPixel/8;
int bpp=rfbScreen->serverFormat.bitsPerPixel/8;
char *colour=(char*)&col;
if(!rfbEndianTest)
......@@ -52,7 +52,7 @@ int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
unsigned char* data=font->data+font->metaData[c*5];
unsigned char d;
int rowstride=rfbScreen->paddedWidthInBytes;
int bpp=rfbScreen->rfbServerFormat.bitsPerPixel/8,extra_bytes=0;
int bpp=rfbScreen->serverFormat.bitsPerPixel/8,extra_bytes=0;
char* colour=(char*)&col;
char* bcolour=(char*)&bcol;
......
......@@ -58,8 +58,8 @@ rfbSendRectEncodingHextile(cl, x, y, w, h)
sz_rfbFramebufferUpdateRectHeader);
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
cl->rfbRectanglesSent[rfbEncodingHextile]++;
cl->rfbBytesSent[rfbEncodingHextile] += sz_rfbFramebufferUpdateRectHeader;
cl->rectanglesSent[rfbEncodingHextile]++;
cl->bytesSent[rfbEncodingHextile] += sz_rfbFramebufferUpdateRectHeader;
switch (cl->format.bitsPerPixel) {
case 8:
......@@ -130,7 +130,7 @@ sendHextiles##bpp(cl, rx, ry, rw, rh)
fbptr = (cl->screen->frameBuffer + (cl->screen->paddedWidthInBytes * y) \
+ (x * (cl->screen->bitsPerPixel / 8))); \
\
(*cl->translateFn)(cl->translateLookupTable, &(cl->screen->rfbServerFormat), \
(*cl->translateFn)(cl->translateLookupTable, &(cl->screen->serverFormat), \
&cl->format, fbptr, (char *)clientPixelData, \
cl->screen->paddedWidthInBytes, w, h); \
\
......@@ -149,7 +149,7 @@ sendHextiles##bpp(cl, rx, ry, rw, rh)
} \
\
if (solid) { \
cl->rfbBytesSent[rfbEncodingHextile] += cl->ublen - startUblen; \
cl->bytesSent[rfbEncodingHextile] += cl->ublen - startUblen; \
continue; \
} \
\
......@@ -174,7 +174,7 @@ sendHextiles##bpp(cl, rx, ry, rw, rh)
cl->ublen = startUblen; \
cl->updateBuf[cl->ublen++] = rfbHextileRaw; \
(*cl->translateFn)(cl->translateLookupTable, \
&(cl->screen->rfbServerFormat), &cl->format, fbptr, \
&(cl->screen->serverFormat), &cl->format, fbptr, \
(char *)clientPixelData, \
cl->screen->paddedWidthInBytes, w, h); \
\
......@@ -184,7 +184,7 @@ sendHextiles##bpp(cl, rx, ry, rw, rh)
cl->ublen += w * h * (bpp/8); \
} \
\
cl->rfbBytesSent[rfbEncodingHextile] += cl->ublen - startUblen; \
cl->bytesSent[rfbEncodingHextile] += cl->ublen - startUblen; \
} \
} \
\
......
......@@ -84,7 +84,7 @@ static size_t buf_filled=0;
*/
void
httpInitSockets(rfbScreenInfoPtr rfbScreen)
rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen)
{
if (rfbScreen->httpInitDone)
return;
......@@ -95,14 +95,14 @@ httpInitSockets(rfbScreenInfoPtr rfbScreen)
return;
if (rfbScreen->httpPort == 0) {
rfbScreen->httpPort = rfbScreen->rfbPort-100;
rfbScreen->httpPort = rfbScreen->port-100;
}
rfbLog("Listening for HTTP connections on TCP port %d\n", rfbScreen->httpPort);
rfbLog(" URL http://%s:%d\n",rfbScreen->rfbThisHost,rfbScreen->httpPort);
rfbLog(" URL http://%s:%d\n",rfbScreen->thisHost,rfbScreen->httpPort);
if ((rfbScreen->httpListenSock = ListenOnTCPPort(rfbScreen->httpPort)) < 0) {
if ((rfbScreen->httpListenSock = rfbListenOnTCPPort(rfbScreen->httpPort)) < 0) {
rfbLogPerror("ListenOnTCPPort");
return;
}
......@@ -117,7 +117,7 @@ httpInitSockets(rfbScreenInfoPtr rfbScreen)
*/
void
httpCheckFds(rfbScreenInfoPtr rfbScreen)
rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
{
int nfds;
fd_set fds;
......@@ -274,15 +274,15 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
if(rfbScreen->httpEnableProxyConnect) {
const static char* PROXY_OK_STR = "HTTP/1.0 200 OK\r\nContent-Type: octet-stream\r\nPragma: no-cache\r\n\r\n";
if(!strncmp(buf, "CONNECT ", 8)) {
if(atoi(strchr(buf, ':')+1)!=rfbScreen->rfbPort) {
if(atoi(strchr(buf, ':')+1)!=rfbScreen->port) {
rfbErr("httpd: CONNECT format invalid.\n");
WriteExact(&cl,INVALID_REQUEST_STR, strlen(INVALID_REQUEST_STR));
rfbWriteExact(&cl,INVALID_REQUEST_STR, strlen(INVALID_REQUEST_STR));
httpCloseSock(rfbScreen);
return;
}
/* proxy connection */
rfbLog("httpd: client asked for CONNECT\n");
WriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR));
rfbWriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR));
rfbNewClientConnection(rfbScreen,rfbScreen->httpSock);
rfbScreen->httpSock = -1;
return;
......@@ -290,7 +290,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
if (!strncmp(buf, "GET ",4) && !strncmp(strchr(buf,'/'),"/proxied.connection HTTP/1.", 27)) {
/* proxy connection */
rfbLog("httpd: client asked for /proxied.connection\n");
WriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR));
rfbWriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR));
rfbNewClientConnection(rfbScreen,rfbScreen->httpSock);
rfbScreen->httpSock = -1;
return;
......@@ -320,14 +320,14 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
if (fname[0] != '/') {
rfbErr("httpd: filename didn't begin with '/'\n");
WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
httpCloseSock(rfbScreen);
return;
}
if (strchr(fname+1, '/') != NULL) {
rfbErr("httpd: asking for file in other directory\n");
WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
httpCloseSock(rfbScreen);
return;
}
......@@ -366,12 +366,12 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
if ((fd = fopen(fullFname, "r")) == 0) {
rfbLogPerror("httpProcessInput: open");
WriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
httpCloseSock(rfbScreen);
return;
}
WriteExact(&cl, OK_STR, strlen(OK_STR));
rfbWriteExact(&cl, OK_STR, strlen(OK_STR));
while (1) {
int n = fread(buf, 1, BUF_SIZE-1, fd);
......@@ -397,74 +397,74 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
buf[n] = 0; /* make sure it's null-terminated */
while ((dollar = strchr(ptr, '$'))!=NULL) {
WriteExact(&cl, ptr, (dollar - ptr));
rfbWriteExact(&cl, ptr, (dollar - ptr));
ptr = dollar;
if (compareAndSkip(&ptr, "$WIDTH")) {
sprintf(str, "%d", rfbScreen->width);
WriteExact(&cl, str, strlen(str));
rfbWriteExact(&cl, str, strlen(str));
} else if (compareAndSkip(&ptr, "$HEIGHT")) {
sprintf(str, "%d", rfbScreen->height);
WriteExact(&cl, str, strlen(str));
rfbWriteExact(&cl, str, strlen(str));
} else if (compareAndSkip(&ptr, "$APPLETWIDTH")) {
sprintf(str, "%d", rfbScreen->width);
WriteExact(&cl, str, strlen(str));
rfbWriteExact(&cl, str, strlen(str));
} else if (compareAndSkip(&ptr, "$APPLETHEIGHT")) {
sprintf(str, "%d", rfbScreen->height + 32);
WriteExact(&cl, str, strlen(str));
rfbWriteExact(&cl, str, strlen(str));
} else if (compareAndSkip(&ptr, "$PORT")) {
sprintf(str, "%d", rfbScreen->rfbPort);
WriteExact(&cl, str, strlen(str));
sprintf(str, "%d", rfbScreen->port);
rfbWriteExact(&cl, str, strlen(str));
} else if (compareAndSkip(&ptr, "$DESKTOP")) {
WriteExact(&cl, rfbScreen->desktopName, strlen(rfbScreen->desktopName));
rfbWriteExact(&cl, rfbScreen->desktopName, strlen(rfbScreen->desktopName));
} else if (compareAndSkip(&ptr, "$DISPLAY")) {
sprintf(str, "%s:%d", rfbScreen->rfbThisHost, rfbScreen->rfbPort-5900);
WriteExact(&cl, str, strlen(str));
sprintf(str, "%s:%d", rfbScreen->thisHost, rfbScreen->port-5900);
rfbWriteExact(&cl, str, strlen(str));
} else if (compareAndSkip(&ptr, "$USER")) {
#ifndef WIN32
if (user) {
WriteExact(&cl, user,
rfbWriteExact(&cl, user,
strlen(user));
} else
#endif
WriteExact(&cl, "?", 1);
rfbWriteExact(&cl, "?", 1);
} else if (compareAndSkip(&ptr, "$PARAMS")) {
if (params[0] != '\0')
WriteExact(&cl, params, strlen(params));
rfbWriteExact(&cl, params, strlen(params));
} else {
if (!compareAndSkip(&ptr, "$$"))
ptr++;
if (WriteExact(&cl, "$", 1) < 0) {
if (rfbWriteExact(&cl, "$", 1) < 0) {
fclose(fd);
httpCloseSock(rfbScreen);
return;
}
}
}
if (WriteExact(&cl, ptr, (&buf[n] - ptr)) < 0)
if (rfbWriteExact(&cl, ptr, (&buf[n] - ptr)) < 0)
break;
} else {
/* For files not ending .vnc, just write out the buffer */
if (WriteExact(&cl, buf, n) < 0)
if (rfbWriteExact(&cl, buf, n) < 0)
break;
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -84,7 +84,7 @@ rfbSendRectEncodingRRE(cl, x, y, w, h)
}
(*cl->translateFn)(cl->translateLookupTable,
&(cl->screen->rfbServerFormat),
&(cl->screen->serverFormat),
&cl->format, fbptr, rreBeforeBuf,
cl->screen->paddedWidthInBytes, w, h);
......@@ -110,8 +110,8 @@ rfbSendRectEncodingRRE(cl, x, y, w, h)
return rfbSendRectEncodingRaw(cl, x, y, w, h);
}
cl->rfbRectanglesSent[rfbEncodingRRE]++;
cl->rfbBytesSent[rfbEncodingRRE] += (sz_rfbFramebufferUpdateRectHeader
cl->rectanglesSent[rfbEncodingRRE]++;
cl->bytesSent[rfbEncodingRRE] += (sz_rfbFramebufferUpdateRectHeader
+ sz_rfbRREHeader + rreAfterBufLen);
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader
......
......@@ -209,10 +209,10 @@ int rfbSelectBox(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
int bpp = rfbScreen->bitsPerPixel/8;
char* frameBufferBackup;
void* screenDataBackup = rfbScreen->screenData;
KbdAddEventProcPtr kbdAddEventBackup = rfbScreen->kbdAddEvent;
PtrAddEventProcPtr ptrAddEventBackup = rfbScreen->ptrAddEvent;
GetCursorProcPtr getCursorPtrBackup = rfbScreen->getCursorPtr;
DisplayHookPtr displayHookBackup = rfbScreen->displayHook;
rfbKbdAddEventProcPtr kbdAddEventBackup = rfbScreen->kbdAddEvent;
rfbPtrAddEventProcPtr ptrAddEventBackup = rfbScreen->ptrAddEvent;
rfbGetCursorProcPtr getCursorPtrBackup = rfbScreen->getCursorPtr;
rfbDisplayHookPtr displayHookBackup = rfbScreen->displayHook;
rfbSelectData selData;
int i,j,k;
int fx1,fy1,fx2,fy2; /* for font bbox */
......
......@@ -139,8 +139,8 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
rfbLog("Autoprobing TCP port \n");
for (i = 5900; i < 6000; i++) {
if ((rfbScreen->rfbListenSock = ListenOnTCPPort(i)) >= 0) {
rfbScreen->rfbPort = i;
if ((rfbScreen->listenSock = rfbListenOnTCPPort(i)) >= 0) {
rfbScreen->port = i;
break;
}
}
......@@ -150,28 +150,28 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen)
return;
}
rfbLog("Autoprobing selected port %d\n", rfbScreen->rfbPort);
rfbLog("Autoprobing selected port %d\n", rfbScreen->port);
FD_ZERO(&(rfbScreen->allFds));
FD_SET(rfbScreen->rfbListenSock, &(rfbScreen->allFds));
rfbScreen->maxFd = rfbScreen->rfbListenSock;
FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds));
rfbScreen->maxFd = rfbScreen->listenSock;
}
else if(rfbScreen->rfbPort>0) {
rfbLog("Listening for VNC connections on TCP port %d\n", rfbScreen->rfbPort);
else if(rfbScreen->port>0) {
rfbLog("Listening for VNC connections on TCP port %d\n", rfbScreen->port);
if ((rfbScreen->rfbListenSock = ListenOnTCPPort(rfbScreen->rfbPort)) < 0) {
if ((rfbScreen->listenSock = rfbListenOnTCPPort(rfbScreen->port)) < 0) {
rfbLogPerror("ListenOnTCPPort");
return;
}
FD_ZERO(&(rfbScreen->allFds));
FD_SET(rfbScreen->rfbListenSock, &(rfbScreen->allFds));
rfbScreen->maxFd = rfbScreen->rfbListenSock;
FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds));
rfbScreen->maxFd = rfbScreen->listenSock;
}
if (rfbScreen->udpPort != 0) {
rfbLog("rfbInitSockets: listening for input on UDP port %d\n",rfbScreen->udpPort);
if ((rfbScreen->udpSock = ListenOnUDPPort(rfbScreen->udpPort)) < 0) {
if ((rfbScreen->udpSock = rfbListenOnUDPPort(rfbScreen->udpPort)) < 0) {
rfbLogPerror("ListenOnUDPPort");
return;
}
......@@ -223,9 +223,9 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
return;
}
if (rfbScreen->rfbListenSock != -1 && FD_ISSET(rfbScreen->rfbListenSock, &fds)) {
if (rfbScreen->listenSock != -1 && FD_ISSET(rfbScreen->listenSock, &fds)) {
if ((sock = accept(rfbScreen->rfbListenSock,
if ((sock = accept(rfbScreen->listenSock,
(struct sockaddr *)&addr, &addrlen)) < 0) {
rfbLogPerror("rfbCheckFds: accept");
return;
......@@ -260,7 +260,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
rfbNewClient(rfbScreen,sock);
FD_CLR(rfbScreen->rfbListenSock, &fds);
FD_CLR(rfbScreen->listenSock, &fds);
if (--nfds == 0)
return;
}
......@@ -359,7 +359,7 @@ rfbConnect(rfbScreen, host, port)
rfbLog("Making connection to client on host %s port %d\n",
host,port);
if ((sock = ConnectToTcpAddr(host, port)) < 0) {
if ((sock = rfbConnectToTcpAddr(host, port)) < 0) {
rfbLogPerror("connection failed");
return -1;
}
......@@ -393,7 +393,7 @@ rfbConnect(rfbScreen, host, port)
*/
int
ReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
{
int sock = cl->sock;
int n;
......@@ -441,9 +441,9 @@ ReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
return 1;
}
int ReadExact(rfbClientPtr cl,char* buf,int len)
int rfbReadExact(rfbClientPtr cl,char* buf,int len)
{
return(ReadExactTimeout(cl,buf,len,rfbMaxClientWait));
return(rfbReadExactTimeout(cl,buf,len,rfbMaxClientWait));
}
/*
......@@ -453,7 +453,7 @@ int ReadExact(rfbClientPtr cl,char* buf,int len)
*/
int
WriteExact(cl, buf, len)
rfbWriteExact(cl, buf, len)
rfbClientPtr cl;
const char *buf;
int len;
......@@ -531,7 +531,7 @@ WriteExact(cl, buf, len)
}
int
ListenOnTCPPort(port)
rfbListenOnTCPPort(port)
int port;
{
struct sockaddr_in addr;
......@@ -565,7 +565,7 @@ ListenOnTCPPort(port)
}
int
ConnectToTcpAddr(host, port)
rfbConnectToTcpAddr(host, port)
char *host;
int port;
{
......@@ -599,7 +599,7 @@ ConnectToTcpAddr(host, port)
}
int
ListenOnUDPPort(port)
rfbListenOnUDPPort(port)
int port;
{
struct sockaddr_in addr;
......
......@@ -44,19 +44,19 @@ rfbResetStats(rfbClientPtr cl)
{
int i;
for (i = 0; i < MAX_ENCODINGS; i++) {
cl->rfbBytesSent[i] = 0;
cl->rfbRectanglesSent[i] = 0;
cl->bytesSent[i] = 0;
cl->rectanglesSent[i] = 0;
}
cl->rfbLastRectMarkersSent = 0;
cl->rfbLastRectBytesSent = 0;
cl->rfbCursorShapeBytesSent = 0;
cl->rfbCursorShapeUpdatesSent = 0;
cl->rfbCursorPosBytesSent = 0;
cl->rfbCursorPosUpdatesSent = 0;
cl->rfbFramebufferUpdateMessagesSent = 0;
cl->rfbRawBytesEquivalent = 0;
cl->rfbKeyEventsRcvd = 0;
cl->rfbPointerEventsRcvd = 0;
cl->lastRectMarkersSent = 0;
cl->lastRectBytesSent = 0;
cl->cursorShapeBytesSent = 0;
cl->cursorShapeUpdatesSent = 0;
cl->cursorPosBytesSent = 0;
cl->cursorPosUpdatesSent = 0;
cl->framebufferUpdateMessagesSent = 0;
cl->rawBytesEquivalent = 0;
cl->keyEventsRcvd = 0;
cl->pointerEventsRcvd = 0;
}
void
......@@ -68,52 +68,52 @@ rfbPrintStats(rfbClientPtr cl)
rfbLog("Statistics:\n");
if ((cl->rfbKeyEventsRcvd != 0) || (cl->rfbPointerEventsRcvd != 0))
if ((cl->keyEventsRcvd != 0) || (cl->pointerEventsRcvd != 0))
rfbLog(" key events received %d, pointer events %d\n",
cl->rfbKeyEventsRcvd, cl->rfbPointerEventsRcvd);
cl->keyEventsRcvd, cl->pointerEventsRcvd);
for (i = 0; i < MAX_ENCODINGS; i++) {
totalRectanglesSent += cl->rfbRectanglesSent[i];
totalBytesSent += cl->rfbBytesSent[i];
totalRectanglesSent += cl->rectanglesSent[i];
totalBytesSent += cl->bytesSent[i];
}
totalRectanglesSent += (cl->rfbCursorShapeUpdatesSent +
cl->rfbCursorPosUpdatesSent +
cl->rfbLastRectMarkersSent);
totalBytesSent += (cl->rfbCursorShapeBytesSent +
cl->rfbCursorPosBytesSent +
cl->rfbLastRectBytesSent);
totalRectanglesSent += (cl->cursorShapeUpdatesSent +
cl->cursorPosUpdatesSent +
cl->lastRectMarkersSent);
totalBytesSent += (cl->cursorShapeBytesSent +
cl->cursorPosBytesSent +
cl->lastRectBytesSent);
rfbLog(" framebuffer updates %d, rectangles %d, bytes %d\n",
cl->rfbFramebufferUpdateMessagesSent, totalRectanglesSent,
cl->framebufferUpdateMessagesSent, totalRectanglesSent,
totalBytesSent);
if (cl->rfbLastRectMarkersSent != 0)
if (cl->lastRectMarkersSent != 0)
rfbLog(" LastRect and NewFBSize markers %d, bytes %d\n",
cl->rfbLastRectMarkersSent, cl->rfbLastRectBytesSent);
cl->lastRectMarkersSent, cl->lastRectBytesSent);
if (cl->rfbCursorShapeUpdatesSent != 0)
if (cl->cursorShapeUpdatesSent != 0)
rfbLog(" cursor shape updates %d, bytes %d\n",
cl->rfbCursorShapeUpdatesSent, cl->rfbCursorShapeBytesSent);
cl->cursorShapeUpdatesSent, cl->cursorShapeBytesSent);
if (cl->rfbCursorPosUpdatesSent != 0)
if (cl->cursorPosUpdatesSent != 0)
rfbLog(" cursor position updates %d, bytes %d\n",
cl->rfbCursorPosUpdatesSent, cl->rfbCursorPosBytesSent);
cl->cursorPosUpdatesSent, cl->cursorPosBytesSent);
for (i = 0; i < MAX_ENCODINGS; i++) {
if (cl->rfbRectanglesSent[i] != 0)
if (cl->rectanglesSent[i] != 0)
rfbLog(" %s rectangles %d, bytes %d\n",
encNames[i], cl->rfbRectanglesSent[i], cl->rfbBytesSent[i]);
encNames[i], cl->rectanglesSent[i], cl->bytesSent[i]);
}
if ((totalBytesSent - cl->rfbBytesSent[rfbEncodingCopyRect]) != 0) {
if ((totalBytesSent - cl->bytesSent[rfbEncodingCopyRect]) != 0) {
rfbLog(" raw bytes equivalent %d, compression ratio %f\n",
cl->rfbRawBytesEquivalent,
(double)cl->rfbRawBytesEquivalent
cl->rawBytesEquivalent,
(double)cl->rawBytesEquivalent
/ (double)(totalBytesSent
- cl->rfbBytesSent[rfbEncodingCopyRect]-
cl->rfbCursorShapeBytesSent -
cl->rfbCursorPosBytesSent -
cl->rfbLastRectBytesSent));
- cl->bytesSent[rfbEncodingCopyRect]-
cl->cursorShapeBytesSent -
cl->cursorPosBytesSent -
cl->lastRectBytesSent));
}
}
This diff is collapsed.
......@@ -252,16 +252,16 @@ rfbSetTranslateFunction(cl)
* Check that bits per pixel values are valid
*/
if ((cl->screen->rfbServerFormat.bitsPerPixel != 8) &&
(cl->screen->rfbServerFormat.bitsPerPixel != 16) &&
if ((cl->screen->serverFormat.bitsPerPixel != 8) &&
(cl->screen->serverFormat.bitsPerPixel != 16) &&
#ifdef LIBVNCSERVER_ALLOW24BPP
(cl->screen->rfbServerFormat.bitsPerPixel != 24) &&
(cl->screen->serverFormat.bitsPerPixel != 24) &&
#endif
(cl->screen->rfbServerFormat.bitsPerPixel != 32))
(cl->screen->serverFormat.bitsPerPixel != 32))
{
rfbErr("%s: server bits per pixel not 8, 16 or 32 (is %d)\n",
"rfbSetTranslateFunction",
cl->screen->rfbServerFormat.bitsPerPixel);
cl->screen->serverFormat.bitsPerPixel);
rfbCloseClient(cl);
return FALSE;
}
......@@ -307,7 +307,7 @@ rfbSetTranslateFunction(cl)
/* truecolour -> truecolour */
if (PF_EQ(cl->format,cl->screen->rfbServerFormat)) {
if (PF_EQ(cl->format,cl->screen->serverFormat)) {
/* client & server the same */
......@@ -316,36 +316,36 @@ rfbSetTranslateFunction(cl)
return TRUE;
}
if ((cl->screen->rfbServerFormat.bitsPerPixel < 16) ||
((!cl->screen->rfbServerFormat.trueColour || !rfbEconomicTranslate) &&
(cl->screen->rfbServerFormat.bitsPerPixel == 16))) {
if ((cl->screen->serverFormat.bitsPerPixel < 16) ||
((!cl->screen->serverFormat.trueColour || !rfbEconomicTranslate) &&
(cl->screen->serverFormat.bitsPerPixel == 16))) {
/* we can use a single lookup table for <= 16 bpp */
cl->translateFn = rfbTranslateWithSingleTableFns
[BPP2OFFSET(cl->screen->rfbServerFormat.bitsPerPixel)]
[BPP2OFFSET(cl->screen->serverFormat.bitsPerPixel)]
[BPP2OFFSET(cl->format.bitsPerPixel)];
if(cl->screen->rfbServerFormat.trueColour)
if(cl->screen->serverFormat.trueColour)
(*rfbInitTrueColourSingleTableFns
[BPP2OFFSET(cl->format.bitsPerPixel)]) (&cl->translateLookupTable,
&(cl->screen->rfbServerFormat), &cl->format);
&(cl->screen->serverFormat), &cl->format);
else
(*rfbInitColourMapSingleTableFns
[BPP2OFFSET(cl->format.bitsPerPixel)]) (&cl->translateLookupTable,
&(cl->screen->rfbServerFormat), &cl->format,&cl->screen->colourMap);
&(cl->screen->serverFormat), &cl->format,&cl->screen->colourMap);
} else {
/* otherwise we use three separate tables for red, green and blue */
cl->translateFn = rfbTranslateWithRGBTablesFns
[BPP2OFFSET(cl->screen->rfbServerFormat.bitsPerPixel)]
[BPP2OFFSET(cl->screen->serverFormat.bitsPerPixel)]
[BPP2OFFSET(cl->format.bitsPerPixel)];
(*rfbInitTrueColourRGBTablesFns
[BPP2OFFSET(cl->format.bitsPerPixel)]) (&cl->translateLookupTable,
&(cl->screen->rfbServerFormat), &cl->format);
&(cl->screen->serverFormat), &cl->format);
}
return TRUE;
......@@ -396,7 +396,7 @@ rfbSetClientColourMapBGR233(cl)
len += 256 * 3 * 2;
if (WriteExact(cl, buf, len) < 0) {
if (rfbWriteExact(cl, buf, len) < 0) {
rfbLogPerror("rfbSetClientColourMapBGR233: write");
rfbCloseClient(cl);
return FALSE;
......@@ -419,7 +419,7 @@ rfbSetClientColourMap(cl, firstColour, nColours)
int firstColour;
int nColours;
{
if (cl->screen->rfbServerFormat.trueColour || !cl->readyForSetColourMapEntries) {
if (cl->screen->serverFormat.trueColour || !cl->readyForSetColourMapEntries) {
return TRUE;
}
......@@ -430,7 +430,7 @@ rfbSetClientColourMap(cl, firstColour, nColours)
if (cl->format.trueColour) {
(*rfbInitColourMapSingleTableFns
[BPP2OFFSET(cl->format.bitsPerPixel)]) (&cl->translateLookupTable,
&cl->screen->rfbServerFormat, &cl->format,&cl->screen->colourMap);
&cl->screen->serverFormat, &cl->format,&cl->screen->colourMap);
sraRgnDestroy(cl->modifiedRegion);
cl->modifiedRegion =
......
......@@ -62,7 +62,7 @@ static unsigned char fixedkey[8] = {23,82,107,6,35,78,88,7};
*/
int
vncEncryptAndStorePasswd(char *passwd, char *fname)
rfbEncryptAndStorePasswd(char *passwd, char *fname)
{
FILE *fp;
unsigned int i;
......@@ -88,8 +88,8 @@ vncEncryptAndStorePasswd(char *passwd, char *fname)
/* Do encryption in-place - this way we overwrite our copy of the plaintext
password */
deskey(fixedkey, EN0);
des(encryptedPasswd, encryptedPasswd);
rfbDesKey(fixedkey, EN0);
rfbDes(encryptedPasswd, encryptedPasswd);
for (i = 0; i < 8; i++) {
putc(encryptedPasswd[i], fp);
......@@ -107,7 +107,7 @@ vncEncryptAndStorePasswd(char *passwd, char *fname)
*/
char *
vncDecryptPasswdFromFile(char *fname)
rfbDecryptPasswdFromFile(char *fname)
{
FILE *fp;
int i, ch;
......@@ -126,8 +126,8 @@ vncDecryptPasswdFromFile(char *fname)
fclose(fp);
deskey(fixedkey, DE1);
des(passwd, passwd);
rfbDesKey(fixedkey, DE1);
rfbDes(passwd, passwd);
passwd[8] = 0;
......@@ -141,7 +141,7 @@ vncDecryptPasswdFromFile(char *fname)
*/
void
vncRandomBytes(unsigned char *bytes)
rfbRandomBytes(unsigned char *bytes)
{
int i;
static rfbBool s_srandom_called = FALSE;
......@@ -162,7 +162,7 @@ vncRandomBytes(unsigned char *bytes)
*/
void
vncEncryptBytes(unsigned char *bytes, char *passwd)
rfbEncryptBytes(unsigned char *bytes, char *passwd)
{
unsigned char key[8];
unsigned int i;
......@@ -177,9 +177,9 @@ vncEncryptBytes(unsigned char *bytes, char *passwd)
}
}
deskey(key, EN0);
rfbDesKey(key, EN0);
for (i = 0; i < CHALLENGESIZE; i += 8) {
des(bytes+i, bytes+i);
rfbDes(bytes+i, bytes+i);
}
}
......@@ -122,7 +122,7 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
/*
* Convert pixel data to client format.
*/
(*cl->translateFn)(cl->translateLookupTable, &cl->screen->rfbServerFormat,
(*cl->translateFn)(cl->translateLookupTable, &cl->screen->serverFormat,
&cl->format, fbptr, zlibBeforeBuf,
cl->screen->paddedWidthInBytes, w, h);
......@@ -174,8 +174,8 @@ rfbSendOneRectEncodingZlib(cl, x, y, w, h)
*/
/* Update statics */
cl->rfbRectanglesSent[rfbEncodingZlib]++;
cl->rfbBytesSent[rfbEncodingZlib] += (sz_rfbFramebufferUpdateRectHeader
cl->rectanglesSent[rfbEncodingZlib]++;
cl->bytesSent[rfbEncodingZlib] += (sz_rfbFramebufferUpdateRectHeader
+ sz_rfbZlibHeader + zlibAfterBufLen);
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbZlibHeader
......
......@@ -33,7 +33,7 @@
+ (cl->screen->paddedWidthInBytes * ty) \
+ (tx * (cl->screen->bitsPerPixel / 8))); \
\
(*cl->translateFn)(cl->translateLookupTable, &cl->screen->rfbServerFormat,\
(*cl->translateFn)(cl->translateLookupTable, &cl->screen->serverFormat,\
&cl->format, fbptr, (char*)buf, \
cl->screen->paddedWidthInBytes, tw, th); }
......@@ -123,8 +123,8 @@ rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w, int h)
break;
}
cl->rfbRectanglesSent[rfbEncodingZRLE]++;
cl->rfbBytesSent[rfbEncodingZRLE] += (sz_rfbFramebufferUpdateRectHeader
cl->rectanglesSent[rfbEncodingZRLE]++;
cl->bytesSent[rfbEncodingZRLE] += (sz_rfbFramebufferUpdateRectHeader
+ sz_rfbZRLEHeader + ZRLE_BUFFER_LENGTH(&zos->out));
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbZRLEHeader
......
......@@ -112,15 +112,15 @@ enum rfbNewClientAction {
RFB_CLIENT_REFUSE
};
typedef void (*KbdAddEventProcPtr) (rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl);
typedef void (*KbdReleaseAllKeysProcPtr) (struct _rfbClientRec* cl);
typedef void (*PtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbClientRec* cl);
typedef void (*SetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl);
typedef struct rfbCursor* (*GetCursorProcPtr) (struct _rfbClientRec* pScreen);
typedef rfbBool (*SetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
typedef rfbBool (*PasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
typedef enum rfbNewClientAction (*NewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*DisplayHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbKbdAddEventProcPtr) (rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl);
typedef void (*rfbKbdReleaseAllKeysProcPtr) (struct _rfbClientRec* cl);
typedef void (*rfbPtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbClientRec* cl);
typedef void (*rfbSetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl);
typedef struct rfbCursor* (*rfbGetCursorProcPtr) (struct _rfbClientRec* pScreen);
typedef rfbBool (*rfbSetTranslateFunctionProcPtr)(struct _rfbClientRec* cl);
typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len);
typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
typedef struct {
uint32_t count;
......@@ -198,14 +198,14 @@ typedef struct _rfbScreenInfo
/* additions by libvncserver */
rfbPixelFormat rfbServerFormat;
rfbPixelFormat serverFormat;
rfbColourMap colourMap; /* set this if rfbServerFormat.trueColour==FALSE */
const char* desktopName;
char rfbThisHost[255];
char thisHost[255];
rfbBool autoPort;
int rfbPort;
SOCKET rfbListenSock;
int port;
SOCKET listenSock;
int maxSock;
int maxFd;
fd_set allFds;
......@@ -220,7 +220,7 @@ typedef struct _rfbScreenInfo
rfbBool udpSockConnected;
struct sockaddr_in udpRemoteAddr;
int rfbMaxClientWait;
int maxClientWait;
/* http stuff */
rfbBool httpInitDone;
......@@ -230,22 +230,24 @@ typedef struct _rfbScreenInfo
SOCKET httpListenSock;
SOCKET httpSock;
PasswordCheckProcPtr passwordCheck;
void* rfbAuthPasswdData;
rfbPasswordCheckProcPtr passwordCheck;
void* authPasswdData;
/* If rfbAuthPasswdData is given a list, this is the first
view only password. */
int rfbAuthPasswdFirstViewOnly;
int authPasswdFirstViewOnly;
/* send only this many rectangles in one update */
int maxRectsPerUpdate;
/* this is the amount of milliseconds to wait at least before sending
* an update. */
int rfbDeferUpdateTime;
char* rfbScreen;
rfbBool rfbAlwaysShared;
rfbBool rfbNeverShared;
rfbBool rfbDontDisconnect;
struct _rfbClientRec* rfbClientHead;
int deferUpdateTime;
#ifdef TODELETE
char* screen;
#endif
rfbBool alwaysShared;
rfbBool neverShared;
rfbBool dontDisconnect;
struct _rfbClientRec* clientHead;
/* cursor */
int cursorX, cursorY,oldCursorX,oldCursorY,underCursorBufferLen;
......@@ -257,17 +259,17 @@ typedef struct _rfbScreenInfo
* The buffer will not be freed by
*/
char* frameBuffer;
KbdAddEventProcPtr kbdAddEvent;
KbdReleaseAllKeysProcPtr kbdReleaseAllKeys;
PtrAddEventProcPtr ptrAddEvent;
SetXCutTextProcPtr setXCutText;
GetCursorProcPtr getCursorPtr;
SetTranslateFunctionProcPtr setTranslateFunction;
rfbKbdAddEventProcPtr kbdAddEvent;
rfbKbdReleaseAllKeysProcPtr kbdReleaseAllKeys;
rfbPtrAddEventProcPtr ptrAddEvent;
rfbSetXCutTextProcPtr setXCutText;
rfbGetCursorProcPtr getCursorPtr;
rfbSetTranslateFunctionProcPtr setTranslateFunction;
/* newClientHook is called just after a new client is created */
NewClientHookPtr newClientHook;
rfbNewClientHookPtr newClientHook;
/* displayHook is called just before a frame buffer update */
DisplayHookPtr displayHook;
rfbDisplayHookPtr displayHook;
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
MUTEX(cursorMutex);
......@@ -409,18 +411,18 @@ typedef struct _rfbClientRec {
/* statistics */
int rfbBytesSent[MAX_ENCODINGS];
int rfbRectanglesSent[MAX_ENCODINGS];
int rfbLastRectMarkersSent;
int rfbLastRectBytesSent;
int rfbCursorShapeBytesSent;
int rfbCursorShapeUpdatesSent;
int rfbCursorPosBytesSent;
int rfbCursorPosUpdatesSent;
int rfbFramebufferUpdateMessagesSent;
int rfbRawBytesEquivalent;
int rfbKeyEventsRcvd;
int rfbPointerEventsRcvd;
int bytesSent[MAX_ENCODINGS];
int rectanglesSent[MAX_ENCODINGS];
int lastRectMarkersSent;
int lastRectBytesSent;
int cursorShapeBytesSent;
int cursorShapeUpdatesSent;
int cursorPosBytesSent;
int cursorPosUpdatesSent;
int framebufferUpdateMessagesSent;
int rawBytesEquivalent;
int keyEventsRcvd;
int pointerEventsRcvd;
#ifdef LIBVNCSERVER_HAVE_LIBZ
/* zlib encoding -- necessary compression state info per client */
......@@ -520,20 +522,17 @@ extern int rfbMaxClientWait;
extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen);
extern void rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen);
extern void rfbCloseClient(rfbClientPtr cl);
extern int ReadExact(rfbClientPtr cl, char *buf, int len);
extern int ReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
extern int WriteExact(rfbClientPtr cl, const char *buf, int len);
extern int rfbReadExact(rfbClientPtr cl, char *buf, int len);
extern int rfbReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout);
extern int rfbWriteExact(rfbClientPtr cl, const char *buf, int len);
extern void rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec);
extern int rfbConnect(rfbScreenInfoPtr rfbScreen, char* host, int port);
extern int ConnectToTcpAddr(char* host, int port);
extern int ListenOnTCPPort(int port);
extern int ListenOnUDPPort(int port);
extern int rfbConnectToTcpAddr(char* host, int port);
extern int rfbListenOnTCPPort(int port);
extern int rfbListenOnUDPPort(int port);
/* rfbserver.c */
extern rfbClientPtr pointerClient;
/* Routines to iterate over the client list in a thread-safe way.
Only a single iterator can be in use at a time process-wide. */
typedef struct rfbClientIterator *rfbClientIteratorPtr;
......@@ -583,8 +582,8 @@ extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour,
/* httpd.c */
extern void httpInitSockets(rfbScreenInfoPtr rfbScreen);
extern void httpCheckFds(rfbScreenInfoPtr rfbScreen);
extern void rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen);
extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen);
......@@ -660,20 +659,20 @@ extern rfbBool rfbSendCursorPos(rfbClientPtr cl);
extern void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap);
extern rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskString);
extern char* rfbMakeMaskForXCursor(int width,int height,char* cursorString);
extern void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
extern void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
extern void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
extern void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor);
extern void rfbFreeCursor(rfbCursorPtr cursor);
extern void rfbDrawCursor(rfbScreenInfoPtr rfbScreen);
extern void rfbUndrawCursor(rfbScreenInfoPtr rfbScreen);
extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c,rfbBool freeOld);
/* cursor handling for the pointer */
extern void defaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
/* zrle.c */
#ifdef LIBVNCSERVER_HAVE_LIBZ
extern rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w,int h);
extern void FreeZrleData(rfbClientPtr cl);
extern void rfbFreeZrleData(rfbClientPtr cl);
#endif
/* stats.c */
......@@ -751,7 +750,7 @@ void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,i
void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2);
void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion);
void doNothingWithClient(rfbClientPtr cl);
void rfbDoNothingWithClient(rfbClientPtr cl);
enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl);
/* to check against plain passwords */
......
......@@ -991,10 +991,10 @@ typedef union {
#define MAXPWLEN 8
#define CHALLENGESIZE 16
extern int vncEncryptAndStorePasswd(char *passwd, char *fname);
extern char *vncDecryptPasswdFromFile(char *fname);
extern void vncRandomBytes(unsigned char *bytes);
extern void vncEncryptBytes(unsigned char *bytes, char *passwd);
extern int rfbEncryptAndStorePasswd(char *passwd, char *fname);
extern char *rfbDecryptPasswdFromFile(char *fname);
extern void rfbRandomBytes(unsigned char *bytes);
extern void rfbEncryptBytes(unsigned char *bytes, char *passwd);
#endif
......@@ -13,9 +13,9 @@ int main(int argc,char** argv)
#define CHECK(a,b) if(screen->a!=b) { fprintf(stderr,#a " is %d (should be " #b ")\n",screen->a); ret=1; }
CHECK(width,1024);
CHECK(height,768);
CHECK(rfbAlwaysShared,TRUE);
CHECK(alwaysShared,TRUE);
CHECK(httpPort,3002);
CHECK(rfbDontDisconnect,TRUE);
CHECK(dontDisconnect,TRUE);
if(fake_argc!=2) {
fprintf(stderr,"fake_argc is %d (should be 2)\n",fake_argc);
ret=1;
......
......@@ -21,7 +21,7 @@ int main(int argc,char** argv)
rfbScreenInfoPtr server=rfbGetScreen(&argc,argv,width,height,8,3,4);
server->frameBuffer=(char*)malloc(width*height*4);
initBackground(server);
server->rfbDeferUpdateTime=0;
server->deferUpdateTime=0;
rfbInitServer(server);
r=0;
......
......@@ -114,12 +114,12 @@ int main(int argc,char **argv)
/* console init */
console=vcGetConsole(&argc,argv,width,height,&vgaFont,TRUE);
for(i=0;i<16;i++) {
console->rfbScreen->colourMap.data.bytes[i*3+0]=default_red[color_table[i]];
console->rfbScreen->colourMap.data.bytes[i*3+1]=default_grn[color_table[i]];
console->rfbScreen->colourMap.data.bytes[i*3+2]=default_blu[color_table[i]];
console->screen->colourMap.data.bytes[i*3+0]=default_red[color_table[i]];
console->screen->colourMap.data.bytes[i*3+1]=default_grn[color_table[i]];
console->screen->colourMap.data.bytes[i*3+2]=default_blu[color_table[i]];
}
console->rfbScreen->desktopName=title;
console->rfbScreen->kbdAddEvent=do_key;
console->screen->desktopName=title;
console->screen->kbdAddEvent=do_key;
console->selectTimeOut=100000;
console->wrapBottomToTop=TRUE;
#ifdef USE_OLD_VCS
......
......@@ -25,24 +25,24 @@ unsigned char colourMap16[16*3]={
void MakeColourMap16(vncConsolePtr c)
{
int i,j;
rfbColourMap* colourMap=&(c->rfbScreen->colourMap);
rfbColourMap* colourMap=&(c->screen->colourMap);
if(colourMap->count)
free(colourMap->data.bytes);
colourMap->data.bytes=malloc(16*3);
memcpy(colourMap->data.bytes,colourMap16,16*3);
colourMap->count=16;
colourMap->is16=FALSE;
c->rfbScreen->rfbServerFormat.trueColour=FALSE;
c->screen->serverFormat.trueColour=FALSE;
}
void vcDrawOrHideCursor(vncConsolePtr c)
{
int i,j,w=c->rfbScreen->paddedWidthInBytes;
char *b=c->rfbScreen->frameBuffer+c->y*c->cHeight*w+c->x*c->cWidth;
int i,j,w=c->screen->paddedWidthInBytes;
char *b=c->screen->frameBuffer+c->y*c->cHeight*w+c->x*c->cWidth;
for(j=c->cy1;j<c->cy2;j++)
for(i=c->cx1;i<c->cx2;i++)
b[j*w+i]^=0x0f;
rfbMarkRectAsModified(c->rfbScreen,
rfbMarkRectAsModified(c->screen,
c->x*c->cWidth+c->cx1,c->y*c->cHeight+c->cy1,
c->x*c->cWidth+c->cx2,c->y*c->cHeight+c->cy2);
c->cursorIsDrawn=c->cursorIsDrawn?FALSE:TRUE;
......@@ -50,7 +50,7 @@ void vcDrawOrHideCursor(vncConsolePtr c)
void vcDrawCursor(vncConsolePtr c)
{
rfbDrawCursor(c->rfbScreen);
rfbDrawCursor(c->screen);
if(c->cursorActive && !c->cursorIsDrawn && c->y<c->height && c->x<c->width) {
/* rfbLog("DrawCursor: %d,%d\n",c->x,c->y); */
vcDrawOrHideCursor(c);
......@@ -59,7 +59,7 @@ void vcDrawCursor(vncConsolePtr c)
void vcHideCursor(vncConsolePtr c)
{
rfbUndrawCursor(c->rfbScreen);
rfbUndrawCursor(c->screen);
if(c->currentlyMarking)
vcUnmark(c);
if(c->cursorIsDrawn) {
......@@ -126,23 +126,23 @@ vncConsolePtr vcGetConsole(int *argc,char **argv,
if(c->cy1<0)
c->cy2=0;
c->rfbScreen=
c->screen=
rfbGetScreen(argc,argv,c->cWidth*c->width,c->cHeight*c->height,8,1,1);
c->rfbScreen->screenData=(void*)c;
c->rfbScreen->displayHook=vcMakeSureCursorIsDrawn;
c->rfbScreen->frameBuffer=
(char*)malloc(c->rfbScreen->width*c->rfbScreen->height);
memset(c->rfbScreen->frameBuffer,c->backColour,
c->rfbScreen->width*c->rfbScreen->height);
c->rfbScreen->kbdAddEvent=vcKbdAddEventProc;
c->rfbScreen->ptrAddEvent=vcPtrAddEventProc;
c->rfbScreen->setXCutText=vcSetXCutTextProc;
c->screen->screenData=(void*)c;
c->screen->displayHook=vcMakeSureCursorIsDrawn;
c->screen->frameBuffer=
(char*)malloc(c->screen->width*c->screen->height);
memset(c->screen->frameBuffer,c->backColour,
c->screen->width*c->screen->height);
c->screen->kbdAddEvent=vcKbdAddEventProc;
c->screen->ptrAddEvent=vcPtrAddEventProc;
c->screen->setXCutText=vcSetXCutTextProc;
MakeColourMap16(c);
c->foreColour=0x7;
c->backColour=0;
rfbInitServer(c->rfbScreen);
rfbInitServer(c->screen);
return(c);
}
......@@ -153,7 +153,7 @@ vncConsolePtr vcGetConsole(int *argc,char **argv,
void vcScroll(vncConsolePtr c,int lineCount)
{
int y1,y2;
rfbScreenInfoPtr s=c->rfbScreen;
rfbScreenInfoPtr s=c->screen;
if(lineCount==0)
return;
......@@ -232,7 +232,7 @@ void vcPutChar(vncConsolePtr c,unsigned char ch)
void vcPutCharColour(vncConsolePtr c,unsigned char ch,unsigned char foreColour,unsigned char backColour)
{
rfbScreenInfoPtr s=c->rfbScreen;
rfbScreenInfoPtr s=c->screen;
int j,x,y;
vcHideCursor(c);
......@@ -394,15 +394,15 @@ void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl)
{
vncConsolePtr c=(vncConsolePtr)cl->screen->screenData;
rfbUndrawCursor(c->rfbScreen);
rfbUndrawCursor(c->screen);
if(c->wasRightButtonDown) {
if((buttonMask&4)==0) {
if(c->selection) {
char* s;
for(s=c->selection;*s;s++) {
c->rfbScreen->kbdAddEvent(1,*s,cl);
c->rfbScreen->kbdAddEvent(0,*s,cl);
c->screen->kbdAddEvent(1,*s,cl);
c->screen->kbdAddEvent(0,*s,cl);
}
}
c->wasRightButtonDown=0;
......@@ -455,9 +455,9 @@ void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl)
memcpy(c->selection,c->screenBuffer+i,j-i);
c->selection[j-i]=0;
vcUnmark(c);
rfbGotXCutText(c->rfbScreen,c->selection,j-i);
rfbGotXCutText(c->screen,c->selection,j-i);
}
defaultPtrAddEvent(buttonMask,x,y,cl);
rfbDefaultPtrAddEvent(buttonMask,x,y,cl);
}
void vcSetXCutTextProc(char* str,int len, struct _rfbClientRec* cl)
......@@ -475,12 +475,12 @@ void vcToggleMarkCell(vncConsolePtr c,int pos)
int x=(pos%c->width)*c->cWidth,
y=(pos/c->width)*c->cHeight;
int i,j;
rfbScreenInfoPtr s=c->rfbScreen;
rfbScreenInfoPtr s=c->screen;
char *b=s->frameBuffer+y*s->width+x;
for(j=0;j<c->cHeight;j++)
for(i=0;i<c->cWidth;i++)
b[j*s->width+i]^=0x0f;
rfbMarkRectAsModified(c->rfbScreen,x,y,x+c->cWidth,y+c->cHeight);
rfbMarkRectAsModified(c->screen,x,y,x+c->cWidth,y+c->cHeight);
}
void vcUnmark(vncConsolePtr c)
......@@ -498,6 +498,6 @@ void vcUnmark(vncConsolePtr c)
void vcProcessEvents(vncConsolePtr c)
{
rfbProcessEvents(c->rfbScreen,c->selectTimeOut);
rfbProcessEvents(c->screen,c->selectTimeOut);
}
......@@ -52,7 +52,7 @@ typedef struct vncConsole {
rfbBool dontDrawCursor; /* for example, while scrolling */
rfbFontDataPtr font;
rfbScreenInfoPtr rfbScreen;
rfbScreenInfoPtr screen;
} vncConsole, *vncConsolePtr;
#ifdef USE_ATTRIBUTE_BUFFER
......
......@@ -1904,7 +1904,7 @@ enum rfbNewClientAction new_client(rfbClientPtr client) {
}
if (connect_once) {
if (screen->rfbDontDisconnect && screen->rfbNeverShared) {
if (screen->dontDisconnect && screen->neverShared) {
if (! shared && accepted_client) {
rfbLog("denying additional client: %s\n",
client->host);
......@@ -4247,7 +4247,7 @@ void check_xevents(void) {
static int first = 1, sent_some_sel = 0;
static time_t last_request = 0;
time_t now = time(0);
int have_clients = screen->rfbClientHead ? 1 : 0;
int have_clients = screen->clientHead ? 1 : 0;
X_LOCK;
if (first && (watch_selection || vnc_connect)) {
......@@ -5161,7 +5161,7 @@ void set_colormap(void) {
if (first) {
screen->colourMap.count = NCOLOR;
screen->rfbServerFormat.trueColour = FALSE;
screen->serverFormat.trueColour = FALSE;
screen->colourMap.is16 = TRUE;
screen->colourMap.data.shorts = (unsigned short*)
malloc(3*sizeof(short) * NCOLOR);
......@@ -5477,15 +5477,15 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
#endif
screen->paddedWidthInBytes = rfb_bytes_per_line;
screen->rfbServerFormat.bitsPerPixel = fb->bits_per_pixel;
screen->rfbServerFormat.depth = fb->depth;
screen->rfbServerFormat.trueColour = (uint8_t) TRUE;
screen->serverFormat.bitsPerPixel = fb->bits_per_pixel;
screen->serverFormat.depth = fb->depth;
screen->serverFormat.trueColour = (uint8_t) TRUE;
have_masks = ((fb->red_mask|fb->green_mask|fb->blue_mask) != 0);
if (force_indexed_color) {
have_masks = 0;
}
if ( ! have_masks && screen->rfbServerFormat.bitsPerPixel == 8
if ( ! have_masks && screen->serverFormat.bitsPerPixel == 8
&& CellsOfScreen(ScreenOfDisplay(dpy,scr)) ) {
/* indexed colour */
if (!quiet) {
......@@ -5513,41 +5513,41 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
}
/* convert masks to bit shifts and max # colors */
screen->rfbServerFormat.redShift = 0;
screen->serverFormat.redShift = 0;
if ( fb->red_mask ) {
while ( ! (fb->red_mask
& (1 << screen->rfbServerFormat.redShift) ) ) {
screen->rfbServerFormat.redShift++;
& (1 << screen->serverFormat.redShift) ) ) {
screen->serverFormat.redShift++;
}
}
screen->rfbServerFormat.greenShift = 0;
screen->serverFormat.greenShift = 0;
if ( fb->green_mask ) {
while ( ! (fb->green_mask
& (1 << screen->rfbServerFormat.greenShift) ) ) {
screen->rfbServerFormat.greenShift++;
& (1 << screen->serverFormat.greenShift) ) ) {
screen->serverFormat.greenShift++;
}
}
screen->rfbServerFormat.blueShift = 0;
screen->serverFormat.blueShift = 0;
if ( fb->blue_mask ) {
while ( ! (fb->blue_mask
& (1 << screen->rfbServerFormat.blueShift) ) ) {
screen->rfbServerFormat.blueShift++;
& (1 << screen->serverFormat.blueShift) ) ) {
screen->serverFormat.blueShift++;
}
}
screen->rfbServerFormat.redMax
= fb->red_mask >> screen->rfbServerFormat.redShift;
screen->rfbServerFormat.greenMax
= fb->green_mask >> screen->rfbServerFormat.greenShift;
screen->rfbServerFormat.blueMax
= fb->blue_mask >> screen->rfbServerFormat.blueShift;
screen->serverFormat.redMax
= fb->red_mask >> screen->serverFormat.redShift;
screen->serverFormat.greenMax
= fb->green_mask >> screen->serverFormat.greenShift;
screen->serverFormat.blueMax
= fb->blue_mask >> screen->serverFormat.blueShift;
main_red_max = screen->rfbServerFormat.redMax;
main_green_max = screen->rfbServerFormat.greenMax;
main_blue_max = screen->rfbServerFormat.blueMax;
main_red_max = screen->serverFormat.redMax;
main_green_max = screen->serverFormat.greenMax;
main_blue_max = screen->serverFormat.blueMax;
main_red_shift = screen->rfbServerFormat.redShift;
main_green_shift = screen->rfbServerFormat.greenShift;
main_blue_shift = screen->rfbServerFormat.blueShift;
main_red_shift = screen->serverFormat.redShift;
main_green_shift = screen->serverFormat.greenShift;
main_blue_shift = screen->serverFormat.blueShift;
}
if (overlay && ! quiet) {
rfbLog("\n");
......@@ -5587,7 +5587,7 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
fclose(stdout);
/* we keep stderr for logging */
screen->inetdSock = fd;
screen->rfbPort = 0;
screen->port = 0;
} else if (! got_rfbport) {
screen->autoPort = TRUE;
......@@ -5595,16 +5595,16 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
if (! got_nevershared && ! got_alwaysshared) {
if (shared) {
screen->rfbAlwaysShared = TRUE;
screen->alwaysShared = TRUE;
} else {
screen->rfbDontDisconnect = TRUE;
screen->rfbNeverShared = TRUE;
screen->dontDisconnect = TRUE;
screen->neverShared = TRUE;
}
}
/* XXX the following is based on libvncserver defaults. */
if (screen->rfbDeferUpdateTime == 5) {
if (screen->deferUpdateTime == 5) {
/* XXX will be fixed someday */
screen->rfbDeferUpdateTime = defer_update;
screen->deferUpdateTime = defer_update;
}
/* event callbacks: */
......@@ -5625,8 +5625,8 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
rfbInitServer(screen);
bpp = screen->rfbServerFormat.bitsPerPixel;
depth = screen->rfbServerFormat.depth;
bpp = screen->serverFormat.bitsPerPixel;
depth = screen->serverFormat.depth;
if (scaling) {
mark_rect_as_modified(0, 0, dpy_x, dpy_y, 0);
......@@ -5635,11 +5635,11 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
if (viewonly_passwd) {
/* append the view only passwd after the normal passwd */
char **passwds_new = malloc(3*sizeof(char**));
char **passwds_old = (char **) screen->rfbAuthPasswdData;
char **passwds_old = (char **) screen->authPasswdData;
passwds_new[0] = passwds_old[0];
passwds_new[1] = viewonly_passwd;
passwds_new[2] = NULL;
screen->rfbAuthPasswdData = (void*) passwds_new;
screen->authPasswdData = (void*) passwds_new;
}
}
......@@ -6564,7 +6564,7 @@ static void scale_and_mark_rect(int X1, int Y1, int X2, int Y2) {
shrink = 0;
}
if (! screen->rfbServerFormat.trueColour) {
if (! screen->serverFormat.trueColour) {
/*
* PseudoColor colormap... blending leads to random colors.
*/
......@@ -8265,7 +8265,7 @@ static void watch_loop(void) {
check_xevents();
check_connect_inputs();
if (! screen->rfbClientHead) { /* waiting for a client */
if (! screen->clientHead) { /* waiting for a client */
usleep(200 * 1000);
continue;
}
......@@ -9176,7 +9176,7 @@ int main(int argc, char* argv[]) {
CHECK_ARGC
passwdfile = argv[++i];
} else if (!strcmp(arg, "-storepasswd")) {
if (i+2 >= argc || vncEncryptAndStorePasswd(argv[i+1],
if (i+2 >= argc || rfbEncryptAndStorePasswd(argv[i+1],
argv[i+2]) != 0) {
fprintf(stderr, "-storepasswd failed\n");
exit(1);
......@@ -10020,7 +10020,7 @@ int main(int argc, char* argv[]) {
}
if (! inetd) {
if (! screen->rfbPort || screen->rfbListenSock < 0) {
if (! screen->port || screen->listenSock < 0) {
rfbLog("Error: could not obtain listening port.\n");
clean_up_exit(1);
}
......@@ -10028,9 +10028,9 @@ int main(int argc, char* argv[]) {
if (! quiet) {
rfbLog("screen setup finished.\n");
}
if (screen->rfbPort) {
if (screen->port) {
char *host = this_host();
int port = screen->rfbPort;
int port = screen->port;
if (host != NULL) {
/* note that vncviewer special cases 5900-5999 */
if (inetd) {
......@@ -10061,7 +10061,7 @@ int main(int argc, char* argv[]) {
if (inetd) {
; /* should not occur (rfbPort) */
} else {
fprintf(stdout, "PORT=%d\n", screen->rfbPort);
fprintf(stdout, "PORT=%d\n", screen->port);
}
fflush(stdout);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment