1 #ifndef RFB_H 2 #define RFB_H 3 4 /* 5 * rfb.h - header file for RFB DDX implementation. 6 */ 7 8 /* 9 * Copyright (C) 2002 RealVNC Ltd. 10 * OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>. 11 * Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge. 12 * All Rights Reserved. 13 * 14 * This is free software; you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation; either version 2 of the License, or 17 * (at your option) any later version. 18 * 19 * This software is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this software; if not, write to the Free Software 26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 27 * USA. 28 */ 29 30 #if(defined __cplusplus) 31 extern "C" 32 { 33 #endif 34 35 #include <stdio.h> 36 #include <stdlib.h> 37 #include <string.h> 38 #include "rfbproto.h" 39 #include "rfbregion.h" 40 #ifdef VINO_HAVE_GNUTLS 41 #include <gnutls/gnutls.h> 42 #endif 43 44 #ifdef HAVE_SYS_TYPES_H 45 #include <sys/types.h> 46 #endif 47 48 #ifdef HAVE_SYS_SOCKET_H 49 #include <sys/socket.h> 50 #endif 51 52 #ifndef HAVE_NETINET_IN_H 53 #include <netinet/in.h> 54 #endif 55 56 #define LOCK(mutex) 57 #define UNLOCK(mutex) 58 59 /* end of stuff for autoconf */ 60 61 #define RFB_MAX_SOCKETLISTEN 8 /* is the max listen by network interface */ 62 63 struct _rfbClientRec; 64 struct _rfbScreenInfo; 65 struct rfbCursor; 66 67 enum rfbNewClientAction { 68 RFB_CLIENT_ACCEPT, 69 RFB_CLIENT_ON_HOLD, 70 RFB_CLIENT_REFUSE 71 }; 72 73 typedef void (*KbdAddEventProcPtr) (rfbBool down, rfbKeySym keySym, struct _rfbClientRec* cl); 74 typedef void (*PtrAddEventProcPtr) (int buttonMask, int x, int y, struct _rfbClientRec* cl); 75 typedef void (*SetXCutTextProcPtr) (char* str,int len, struct _rfbClientRec* cl); 76 typedef enum rfbNewClientAction (*PasswordCheckProcPtr)(struct _rfbClientRec* cl,const char* encryptedPassWord,int len); 77 typedef enum rfbNewClientAction (*NewClientHookPtr)(struct _rfbClientRec* cl); 78 typedef enum rfbNewClientAction (*AuthenticatedClientHookPtr)(struct _rfbClientRec* cl); 79 80 typedef struct { 81 uint32_t count; 82 rfbBool is16; /* is the data format short? */ 83 union { 84 uint8_t* bytes; 85 uint16_t* shorts; 86 } data; /* there have to be count*3 entries */ 87 } rfbColourMap; 88 89 /* 90 * Per-screen (framebuffer) structure. There can be as many as you wish, 91 * each serving different clients. However, you have to call 92 * rfbProcessEvents for each of these. 93 */ 94 95 typedef struct _rfbScreenInfo 96 { 97 int width; 98 int paddedWidthInBytes; 99 int height; 100 int depth; 101 int bitsPerPixel; 102 int sizeInBytes; 103 104 rfbPixel blackPixel; 105 rfbPixel whitePixel; 106 107 /* some screen specific data can be put into a struct where screenData 108 * points to. You need this if you have more than one screen at the 109 * same time while using the same functions. 110 */ 111 void* screenData; 112 113 /* additions by libvncserver */ 114 115 rfbPixelFormat rfbServerFormat; 116 rfbColourMap colourMap; /* set this if rfbServerFormat.trueColour==FALSE */ 117 char* desktopName; 118 char rfbThisHost[255]; 119 120 rfbBool autoPort; 121 rfbBool localOnly; 122 int rfbPort; 123 SOCKET rfbListenSock[RFB_MAX_SOCKETLISTEN]; 124 int rfbListenSockTotal; 125 const char *netIface; 126 int maxSock; 127 int maxFd; 128 fd_set allFds; 129 130 rfbBool socketInitDone; 131 SOCKET inetdSock; 132 rfbBool inetdInitDone; 133 134 int rfbMaxClientWait; 135 136 int securityTypes[RFB_MAX_N_SECURITY_TYPES]; 137 int nSecurityTypes; 138 int authTypes[RFB_MAX_N_AUTH_TYPES]; 139 int nAuthTypes; 140 PasswordCheckProcPtr passwordCheck; 141 #ifdef VINO_HAVE_GNUTLS 142 gnutls_anon_server_credentials anonCredentials; 143 gnutls_dh_params dhParams; 144 #endif 145 146 /* send only this many rectangles in one update */ 147 int maxRectsPerUpdate; 148 /* this is the amount of milliseconds to wait at least before sending 149 * an update. */ 150 int rfbDeferUpdateTime; 151 char* rfbScreen; 152 rfbBool rfbAlwaysShared; 153 rfbBool rfbNeverShared; 154 rfbBool rfbDontDisconnect; 155 struct _rfbClientRec* rfbClientHead; 156 157 /* cursor */ 158 int cursorX, cursorY,underCursorBufferLen; 159 char* underCursorBuffer; 160 struct rfbCursor* cursor; 161 162 /* the frameBufferhas to be supplied by the serving process. 163 * The buffer will not be freed by 164 */ 165 char* frameBuffer; 166 KbdAddEventProcPtr kbdAddEvent; 167 PtrAddEventProcPtr ptrAddEvent; 168 SetXCutTextProcPtr setXCutText; 169 170 /* newClientHook is called just after a new client is created */ 171 NewClientHookPtr newClientHook; 172 173 /* authenticatedClientHook is called just after the client has 174 * been authenticated 175 */ 176 AuthenticatedClientHookPtr authenticatedClientHook; 177 178 } rfbScreenInfo, *rfbScreenInfoPtr; 179 180 181 /* 182 * rfbTranslateFnType is the type of translation functions. 183 */ 184 185 typedef void (*rfbTranslateFnType)(char *table, rfbPixelFormat *in, 186 rfbPixelFormat *out, 187 char *iptr, char *optr, 188 int bytesBetweenInputLines, 189 int width, int height); 190 191 192 /* region stuff */ 193 194 typedef sraRegion* sraRegionPtr; 195 typedef sraRect* sraRectPtr; 196 197 /* 198 * Per-client structure. 199 */ 200 201 typedef void (*ClientGoneHookPtr)(struct _rfbClientRec* cl); 202 203 typedef struct _rfbClientRec { 204 205 /* back pointer to the screen */ 206 rfbScreenInfoPtr screen; 207 208 /* private data. You should put any application client specific data 209 * into a struct and let clientData point to it. Don't forget to 210 * free the struct via clientGoneHook! 211 * 212 * This is useful if the IO functions have to behave client specific. 213 */ 214 void* clientData; 215 ClientGoneHookPtr clientGoneHook; 216 217 SOCKET sock; 218 #ifdef VINO_HAVE_GNUTLS 219 gnutls_session tlsSession; 220 rfbBool useTLS; 221 #endif 222 char *host; 223 /* Possible client states: */ 224 enum { 225 RFB_PROTOCOL_VERSION, /* establishing protocol version */ 226 RFB_SECURITY_TYPE, /* negotiating security type */ 227 #ifdef VINO_HAVE_GNUTLS 228 RFB_TLS_HANDSHAKE, /* completing the TLS handshake */ 229 #endif 230 RFB_AUTH_TYPE, /* negotiating authentication type */ 231 RFB_AUTHENTICATION, /* authenticating */ 232 RFB_AUTH_DEFERRED, /* authentication deferred */ 233 RFB_INITIALISATION, /* sending initialisation messages */ 234 RFB_NORMAL /* normal protocol messages */ 235 } state; 236 237 rfbBool onHold; 238 rfbBool readyForSetColourMapEntries; 239 rfbBool useCopyRect; 240 int minorVersion; 241 int preferredEncoding; 242 int correMaxWidth, correMaxHeight; 243 244 rfbBool viewOnly; 245 246 /* The following member is only used during VNC authentication */ 247 uint8_t authChallenge[CHALLENGESIZE]; 248 249 /* The following members represent the update needed to get the client's 250 framebuffer from its present state to the current state of our 251 framebuffer. 252 253 If the client does not accept CopyRect encoding then the update is 254 simply represented as the region of the screen which has been modified 255 (modifiedRegion). 256 257 If the client does accept CopyRect encoding, then the update consists of 258 two parts. First we have a single copy from one region of the screen to 259 another (the destination of the copy is copyRegion), and second we have 260 the region of the screen which has been modified in some other way 261 (modifiedRegion). 262 263 Although the copy is of a single region, this region may have many 264 rectangles. When sending an update, the copyRegion is always sent 265 before the modifiedRegion. This is because the modifiedRegion may 266 overlap parts of the screen which are in the source of the copy. 267 268 In fact during normal processing, the modifiedRegion may even overlap 269 the destination copyRegion. Just before an update is sent we remove 270 from the copyRegion anything in the modifiedRegion. */ 271 272 sraRegionPtr copyRegion; /* the destination region of the copy */ 273 int copyDX, copyDY; /* the translation by which the copy happens */ 274 275 sraRegionPtr modifiedRegion; 276 277 sraRect lastDrawnCursorBounds; 278 279 /* As part of the FramebufferUpdateRequest, a client can express interest 280 in a subrectangle of the whole framebuffer. This is stored in the 281 requestedRegion member. In the normal case this is the whole 282 framebuffer if the client is ready, empty if it's not. */ 283 284 sraRegionPtr requestedRegion; 285 286 /* The following member represents the state of the "deferred update" timer 287 - when the framebuffer is modified and the client is ready, in most 288 cases it is more efficient to defer sending the update by a few 289 milliseconds so that several changes to the framebuffer can be combined 290 into a single update. */ 291 292 struct timeval startDeferring; 293 294 /* translateFn points to the translation function which is used to copy 295 and translate a rectangle from the framebuffer to an output buffer. */ 296 297 rfbTranslateFnType translateFn; 298 char *translateLookupTable; 299 rfbPixelFormat format; 300 301 /* 302 * UPDATE_BUF_SIZE must be big enough to send at least one whole line of the 303 * framebuffer. So for a max screen width of say 2K with 32-bit pixels this 304 * means 8K minimum. 305 */ 306 307 #define UPDATE_BUF_SIZE 30000 308 309 char updateBuf[UPDATE_BUF_SIZE]; 310 int ublen; 311 312 /* statistics */ 313 314 int rfbBytesSent[MAX_ENCODINGS]; 315 int rfbRectanglesSent[MAX_ENCODINGS]; 316 int rfbLastRectMarkersSent; 317 int rfbLastRectBytesSent; 318 int rfbCursorShapeBytesSent; 319 int rfbCursorShapeUpdatesSent; 320 int rfbCursorPosBytesSent; 321 int rfbCursorPosUpdatesSent; 322 int rfbFramebufferUpdateMessagesSent; 323 int rfbRawBytesEquivalent; 324 int rfbKeyEventsRcvd; 325 int rfbPointerEventsRcvd; 326 327 #ifdef VINO_HAVE_ZLIB 328 /* zlib encoding -- necessary compression state info per client */ 329 330 struct z_stream_s compStream; 331 rfbBool compStreamInited; 332 uint32_t zlibCompressLevel; 333 334 #ifdef VINO_HAVE_JPEG 335 /* tight encoding -- preserve zlib streams' state for each client */ 336 z_stream zsStruct[4]; 337 rfbBool zsActive[4]; 338 int zsLevel[4]; 339 int tightCompressLevel; 340 int tightQualityLevel; 341 #endif 342 #endif 343 344 rfbBool enableLastRectEncoding; /* client supports LastRect encoding */ 345 rfbBool enableCursorUpdates; /* client supports cursor position and shape updates */ 346 rfbBool useRichCursorEncoding; /* rfbEncodingRichCursor is preferred */ 347 rfbBool cursorWasChanged; /* cursor shape update should be sent */ 348 rfbBool cursorWasMoved; /* cursor position update should be sent */ 349 350 rfbBool useNewFBSize; /* client supports NewFBSize encoding */ 351 rfbBool newFBSizePending; /* framebuffer size was changed */ 352 353 struct _rfbClientRec *prev; 354 struct _rfbClientRec *next; 355 356 #ifdef VINO_HAVE_ZLIB 357 void* zrleData; 358 #endif 359 360 } rfbClientRec, *rfbClientPtr; 361 362 /* 363 * This macro is used to test whether there is a framebuffer update needing to 364 * be sent to the client. 365 */ 366 367 #define FB_UPDATE_PENDING(cl) \ 368 (((cl)->enableCursorUpdates && ((cl)->cursorWasMoved || (cl)->cursorWasChanged)) || \ 369 ((cl)->useNewFBSize && (cl)->newFBSizePending) || \ 370 !sraRgnEmpty((cl)->copyRegion) || !sraRgnEmpty((cl)->modifiedRegion)) 371 372 /* 373 * Macros for endian swapping. 374 */ 375 376 #define Swap16(s) ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) 377 378 #define Swap24(l) ((((l) & 0xff) << 16) | (((l) >> 16) & 0xff) | \ 379 (((l) & 0x00ff00))) 380 381 #define Swap32(l) (((l) >> 24) | \ 382 (((l) & 0x00ff0000) >> 8) | \ 383 (((l) & 0x0000ff00) << 8) | \ 384 ((l) << 24)) 385 386 387 extern char rfbEndianTest; 388 389 #define Swap16IfLE(s) (rfbEndianTest ? Swap16(s) : (s)) 390 #define Swap24IfLE(l) (rfbEndianTest ? Swap24(l) : (l)) 391 #define Swap32IfLE(l) (rfbEndianTest ? Swap32(l) : (l)) 392 393 /* sockets.c */ 394 395 extern int rfbMaxClientWait; 396 397 extern void rfbInitSockets(rfbScreenInfoPtr rfbScreen); 398 extern void rfbSetAutoPort(rfbScreenInfoPtr rfbScreen, rfbBool autoPort); 399 extern void rfbSetPort(rfbScreenInfoPtr rfbScreen, int Port); 400 extern void rfbSetLocalOnly(rfbScreenInfoPtr rfbScreen, rfbBool localOnly); 401 extern void rfbCloseClient(rfbClientPtr cl); 402 extern int ReadExact(rfbClientPtr cl, char *buf, int len); 403 extern int ReadExactTimeout(rfbClientPtr cl, char *buf, int len,int timeout); 404 extern int ReadPending(rfbClientPtr cl); 405 extern int WriteExact(rfbClientPtr cl, const char *buf, int len); 406 extern void rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen, int insock); 407 extern void rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec); 408 extern rfbBool ListenOnTCPPort(rfbScreenInfoPtr rfbScreen, int port, const char *netIface); 409 extern rfbBool rfbSetNetworkInterface(rfbScreenInfoPtr rfbScreen, const char *netIface); 410 extern int NewSocketListenTCP(struct sockaddr *addr, socklen_t len); 411 412 /* rfbserver.c */ 413 414 extern rfbClientPtr pointerClient; 415 416 417 /* Routines to iterate over the client list in a thread-safe way. 418 Only a single iterator can be in use at a time process-wide. */ 419 typedef struct rfbClientIterator *rfbClientIteratorPtr; 420 421 extern void rfbClientListInit(rfbScreenInfoPtr rfbScreen); 422 extern rfbClientIteratorPtr rfbGetClientIterator(rfbScreenInfoPtr rfbScreen); 423 extern rfbClientPtr rfbClientIteratorHead(rfbClientIteratorPtr iterator); 424 extern rfbClientPtr rfbClientIteratorNext(rfbClientIteratorPtr iterator); 425 extern void rfbReleaseClientIterator(rfbClientIteratorPtr iterator); 426 427 extern void rfbNewClientConnection(rfbScreenInfoPtr rfbScreen,int sock); 428 extern rfbClientPtr rfbNewClient(rfbScreenInfoPtr rfbScreen,int sock); 429 extern void rfbClientConnectionGone(rfbClientPtr cl); 430 extern void rfbProcessClientMessage(rfbClientPtr cl); 431 extern void rfbProcessClientInitMessage(rfbClientPtr cl); 432 extern void rfbClientConnFailed(rfbClientPtr cl, char *reason); 433 extern rfbBool rfbSendFramebufferUpdate(rfbClientPtr cl, sraRegionPtr updateRegion); 434 extern rfbBool rfbSendRectEncodingRaw(rfbClientPtr cl, int x,int y,int w,int h); 435 extern rfbBool rfbSendUpdateBuf(rfbClientPtr cl); 436 extern void rfbSendServerCutText(rfbScreenInfoPtr rfbScreen,char *str, int len); 437 extern rfbBool rfbSendCopyRegion(rfbClientPtr cl,sraRegionPtr reg,int dx,int dy); 438 extern rfbBool rfbSendLastRectMarker(rfbClientPtr cl); 439 extern rfbBool rfbSendNewFBSize(rfbClientPtr cl, int w, int h); 440 extern rfbBool rfbSendSetColourMapEntries(rfbClientPtr cl, int firstColour, int nColours); 441 extern void rfbSendBell(rfbScreenInfoPtr rfbScreen); 442 443 void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len); 444 445 /* translate.c */ 446 447 extern rfbBool rfbEconomicTranslate; 448 449 extern void rfbTranslateNone(char *table, rfbPixelFormat *in, 450 rfbPixelFormat *out, 451 char *iptr, char *optr, 452 int bytesBetweenInputLines, 453 int width, int height); 454 extern rfbBool rfbSetTranslateFunction(rfbClientPtr cl); 455 extern rfbBool rfbSetClientColourMap(rfbClientPtr cl, int firstColour, int nColours); 456 extern void rfbSetClientColourMaps(rfbScreenInfoPtr rfbScreen, int firstColour, int nColours); 457 458 459 /* auth.c */ 460 461 extern void rfbAuthInitScreen(rfbScreenInfoPtr rfbScreen); 462 extern void rfbAuthCleanupScreen(rfbScreenInfoPtr rfbScreen); 463 extern void rfbAuthNewClient(rfbClientPtr cl); 464 extern void rfbAuthCleanupClient(rfbClientPtr cl); 465 extern void rfbAuthProcessSecurityTypeMessage(rfbClientPtr cl); 466 extern void rfbAuthProcessAuthTypeMessage(rfbClientPtr cl); 467 extern void rfbAuthProcessClientMessage(rfbClientPtr cl); 468 #ifdef VINO_HAVE_GNUTLS 469 extern void rfbAuthProcessTLSHandshake(rfbClientPtr cl); 470 #endif 471 extern void rfbAuthPasswordChecked(rfbClientPtr cl, enum rfbNewClientAction result); 472 473 474 /* rre.c */ 475 476 extern rfbBool rfbSendRectEncodingRRE(rfbClientPtr cl, int x,int y,int w,int h); 477 478 479 /* corre.c */ 480 481 extern rfbBool rfbSendRectEncodingCoRRE(rfbClientPtr cl, int x,int y,int w,int h); 482 483 484 /* hextile.c */ 485 486 extern rfbBool rfbSendRectEncodingHextile(rfbClientPtr cl, int x, int y, int w, 487 int h); 488 489 490 #ifdef VINO_HAVE_ZLIB 491 /* zlib.c */ 492 493 /* Minimum zlib rectangle size in bytes. Anything smaller will 494 * not compress well due to overhead. 495 */ 496 #define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17) 497 498 /* Set maximum zlib rectangle size in pixels. Always allow at least 499 * two scan lines. 500 */ 501 #define ZLIB_MAX_RECT_SIZE (128*256) 502 #define ZLIB_MAX_SIZE(min) ((( min * 2 ) > ZLIB_MAX_RECT_SIZE ) ? \ 503 ( min * 2 ) : ZLIB_MAX_RECT_SIZE ) 504 505 extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, 506 int h); 507 508 #ifdef VINO_HAVE_JPEG 509 /* tight.c */ 510 511 #define TIGHT_DEFAULT_COMPRESSION 6 512 513 extern rfbBool rfbTightDisableGradient; 514 515 extern void rfbTightCleanup(void); 516 517 extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h); 518 extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h); 519 #endif 520 #endif 521 522 523 /* cursor.c */ 524 525 typedef struct rfbCursor { 526 /* set this to true if LibVNCServer has to free this cursor */ 527 rfbBool cleanup, cleanupSource, cleanupMask, cleanupRichSource; 528 unsigned char *source; /* points to bits */ 529 unsigned char *mask; /* points to bits */ 530 unsigned short width, height, xhot, yhot; /* metrics */ 531 unsigned short foreRed, foreGreen, foreBlue; /* device-independent colour */ 532 unsigned short backRed, backGreen, backBlue; /* device-independent colour */ 533 unsigned char *richSource; /* source bytes for a rich cursor */ 534 } rfbCursor, *rfbCursorPtr; 535 extern unsigned char rfbReverseByte[0x100]; 536 537 extern rfbBool rfbSendCursorShape(rfbClientPtr cl/*, rfbScreenInfoPtr pScreen*/); 538 extern rfbBool rfbSendCursorPos(rfbClientPtr cl); 539 extern void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap); 540 extern rfbCursorPtr rfbMakeXCursor(int width,int height,const char* cursorString,const char* maskString); 541 extern char* rfbMakeMaskForXCursor(int width,int height,char* cursorString); 542 extern void MakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor); 543 extern void MakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor); 544 extern void rfbFreeCursor(rfbCursorPtr cursor); 545 extern rfbBool rfbGetCursorBounds(rfbScreenInfoPtr screen, sraRectPtr bounds); 546 extern void rfbDrawCursor(rfbScreenInfoPtr rfbScreen, sraRectPtr bounds); 547 extern void rfbUndrawCursor(rfbScreenInfoPtr rfbScreen, sraRectPtr bounds); 548 extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c,rfbBool freeOld); 549 extern void rfbSetCursorPosition(rfbScreenInfoPtr rfbScreen, rfbClientPtr client, int x, int y); 550 551 /* cursor handling for the pointer */ 552 extern void defaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl); 553 554 /* zrle.c */ 555 #ifdef VINO_HAVE_ZLIB 556 extern rfbBool rfbSendRectEncodingZRLE(rfbClientPtr cl, int x, int y, int w,int h); 557 extern void FreeZrleData(rfbClientPtr cl); 558 #endif 559 560 /* stats.c */ 561 562 extern void rfbResetStats(rfbClientPtr cl); 563 extern void rfbPrintStats(rfbClientPtr cl); 564 565 /* main.c */ 566 567 extern void rfbLogEnable(int enabled); 568 typedef void (*rfbLogProc)(const char *format, ...); 569 extern rfbLogProc rfbLog, rfbErr; 570 extern void rfbLogPerror(const char *str); 571 572 void rfbScheduleCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy); 573 void rfbScheduleCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy); 574 575 void rfbDoCopyRect(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2,int dx,int dy); 576 void rfbDoCopyRegion(rfbScreenInfoPtr rfbScreen,sraRegionPtr copyRegion,int dx,int dy); 577 578 void rfbMarkRectAsModified(rfbScreenInfoPtr rfbScreen,int x1,int y1,int x2,int y2); 579 void rfbMarkRegionAsModified(rfbScreenInfoPtr rfbScreen,sraRegionPtr modRegion); 580 enum rfbNewClientAction defaultNewClientHook(rfbClientPtr cl); 581 582 /* functions to make a vnc server */ 583 extern rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, 584 int width,int height,int bitsPerSample,int samplesPerPixel, 585 int bytesPerPixel); 586 extern void rfbInitServer(rfbScreenInfoPtr rfbScreen); 587 extern void rfbNewFramebuffer(rfbScreenInfoPtr rfbScreen,char *framebuffer, 588 int width,int height); 589 590 extern void rfbSetDesktopName(rfbScreenInfoPtr rfbScreen, const char *name); 591 592 extern void rfbScreenCleanup(rfbScreenInfoPtr screenInfo); 593 594 /* call one of these two functions to service the vnc clients. 595 usec are the microseconds the select on the fds waits. 596 if you are using the event loop, set this to some value > 0, so the 597 server doesn't get a high load just by listening. */ 598 599 extern void rfbRunEventLoop(rfbScreenInfoPtr screenInfo, long usec, rfbBool runInBackground); 600 extern void rfbProcessEvents(rfbScreenInfoPtr screenInfo,long usec); 601 extern void rfbUpdateClient(rfbClientPtr cl); 602 603 extern void rfbAddSecurityType(rfbScreenInfoPtr rfbScreen, int securityType); 604 extern void rfbClearSecurityTypes(rfbScreenInfoPtr rfbScreen); 605 extern void rfbAddAuthType(rfbScreenInfoPtr rfbScreen, int securityType); 606 extern void rfbClearAuthTypes(rfbScreenInfoPtr rfbScreen); 607 608 #endif 609 610 #if(defined __cplusplus) 611 } 612 #endif 613