Add doxygen documentation support.

Adds automagically generating libvncserver/libvncclient API
    documentation using doxygen. This gives a nice overview on both APIs,
    include dependencies and function call/caller dependencies.

    TODO: Modify all the explaining comments in the .c files for use with
          doxygen as well.

    This patch only changes comments, no functional changes at all!

Signed-off-by: Christian Beier <dontmind@freeshell.org>
pull/1/head
Christian Beier 14 years ago
parent a5f8d3a310
commit 705a5d46e6

@ -1,3 +1,7 @@
/**
* @example SDLvncviewer.c
*/
#include <SDL.h> #include <SDL.h>
#include <signal.h> #include <signal.h>
#include <rfb/rfbclient.h> #include <rfb/rfbclient.h>

@ -1,4 +1,7 @@
/* A simple example of an RFB client */ /**
* @example backchannel-client.c
* A simple example of an RFB client
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

@ -1,4 +1,7 @@
/* A simple example of an RFB client */ /**
* @example ppmtest.c
* A simple example of an RFB client
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

@ -1,4 +1,5 @@
/* /**
* @example vnc2mpg.c
* Simple movie writer for vnc; based on Libavformat API example from FFMPEG * Simple movie writer for vnc; based on Libavformat API example from FFMPEG
* *
* Copyright (c) 2003 Fabrice Bellard, 2004 Johannes E. Schindelin * Copyright (c) 2003 Fabrice Bellard, 2004 Johannes E. Schindelin

@ -1,6 +1,7 @@
#include <rfb/rfb.h> #include <rfb/rfb.h>
/* /**
* @example backchannel.c
* This is a simple example demonstrating a protocol extension. * This is a simple example demonstrating a protocol extension.
* *
* The "back channel" permits sending commands between client and server. * The "back channel" permits sending commands between client and server.

@ -1,5 +1,6 @@
/* /**
* @example camera.c
* Question: I need to display a live camera image via VNC. Until now I just * Question: I need to display a live camera image via VNC. Until now I just
* grab an image, set the rect to modified and do a 0.1 s sleep to give the * grab an image, set the rect to modified and do a 0.1 s sleep to give the
* system time to transfer the data. * system time to transfer the data.

@ -1,5 +1,5 @@
/* /**
* * @example example.c
* This is an example of how to use libvncserver. * This is an example of how to use libvncserver.
* *
* libvncserver example * libvncserver example

@ -1,3 +1,7 @@
/**
* @example filetransfer.c
*/
#include <rfb/rfb.h> #include <rfb/rfb.h>
int main(int argc,char** argv) int main(int argc,char** argv)

@ -1,3 +1,6 @@
/**
* @example pnmshow.c
*/
#include <stdio.h> #include <stdio.h>
#include <rfb/rfb.h> #include <rfb/rfb.h>
#include <rfb/keysym.h> #include <rfb/keysym.h>

@ -1,3 +1,7 @@
/**
* @example pnmshow24.c
*/
#include <stdio.h> #include <stdio.h>
#include <rfb/rfb.h> #include <rfb/rfb.h>
#include <rfb/keysym.h> #include <rfb/keysym.h>

@ -1,4 +1,7 @@
/* This program is a simple server to show events coming from the client */ /**
* @example vncev.c
* This program is a simple server to show events coming from the client
*/
#ifdef __STRICT_ANSI__ #ifdef __STRICT_ANSI__
#define _BSD_SOURCE #define _BSD_SOURCE
#endif #endif

@ -1,8 +1,12 @@
#ifndef RFB_H #ifndef RFB_H
#define RFB_H #define RFB_H
/**
* @defgroup libvncserver_api LibVNCServer API Reference
* @{
*/
/* /**
* rfb.h - header file for RFB DDX implementation. * @file rfb.h
*/ */
/* /*
@ -137,35 +141,38 @@ typedef rfbBool (*rfbPasswordCheckProcPtr)(struct _rfbClientRec* cl,const char*
typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl); typedef enum rfbNewClientAction (*rfbNewClientHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl); typedef void (*rfbDisplayHookPtr)(struct _rfbClientRec* cl);
typedef void (*rfbDisplayFinishedHookPtr)(struct _rfbClientRec* cl, int result); typedef void (*rfbDisplayFinishedHookPtr)(struct _rfbClientRec* cl, int result);
/* support the capability to view the caps/num/scroll states of the X server */ /** support the capability to view the caps/num/scroll states of the X server */
typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen); typedef int (*rfbGetKeyboardLedStateHookPtr)(struct _rfbScreenInfo* screen);
typedef rfbBool (*rfbXvpHookPtr)(struct _rfbClientRec* cl, uint8_t, uint8_t); typedef rfbBool (*rfbXvpHookPtr)(struct _rfbClientRec* cl, uint8_t, uint8_t);
/* If x==1 and y==1 then set the whole display /**
* If x==1 and y==1 then set the whole display
* else find the window underneath x and y and set the framebuffer to the dimensions * else find the window underneath x and y and set the framebuffer to the dimensions
* of that window * of that window
*/ */
typedef void (*rfbSetSingleWindowProcPtr) (struct _rfbClientRec* cl, int x, int y); typedef void (*rfbSetSingleWindowProcPtr) (struct _rfbClientRec* cl, int x, int y);
/* Status determines if the X11 server permits input from the local user /**
* Status determines if the X11 server permits input from the local user
* status==0 or 1 * status==0 or 1
*/ */
typedef void (*rfbSetServerInputProcPtr) (struct _rfbClientRec* cl, int status); typedef void (*rfbSetServerInputProcPtr) (struct _rfbClientRec* cl, int status);
/* Permit the server to allow or deny filetransfers. This is defaulted to deny /**
* Permit the server to allow or deny filetransfers. This is defaulted to deny
* It is called when a client initiates a connection to determine if it is permitted. * It is called when a client initiates a connection to determine if it is permitted.
*/ */
typedef int (*rfbFileTransferPermitted) (struct _rfbClientRec* cl); typedef int (*rfbFileTransferPermitted) (struct _rfbClientRec* cl);
/* Handle the textchat messages */ /** Handle the textchat messages */
typedef void (*rfbSetTextChat) (struct _rfbClientRec* cl, int length, char *string); typedef void (*rfbSetTextChat) (struct _rfbClientRec* cl, int length, char *string);
typedef struct { typedef struct {
uint32_t count; uint32_t count;
rfbBool is16; /* is the data format short? */ rfbBool is16; /**< is the data format short? */
union { union {
uint8_t* bytes; uint8_t* bytes;
uint16_t* shorts; uint16_t* shorts;
} data; /* there have to be count*3 entries */ } data; /**< there have to be count*3 entries */
} rfbColourMap; } rfbColourMap;
/* /**
* Security handling (RFB protocol version 3.7) * Security handling (RFB protocol version 3.7)
*/ */
@ -175,31 +182,31 @@ typedef struct _rfbSecurity {
struct _rfbSecurity* next; struct _rfbSecurity* next;
} rfbSecurityHandler; } rfbSecurityHandler;
/* /**
* Protocol extension handling. * Protocol extension handling.
*/ */
typedef struct _rfbProtocolExtension { typedef struct _rfbProtocolExtension {
/* returns FALSE if extension should be deactivated for client. /** returns FALSE if extension should be deactivated for client.
if newClient == NULL, it is always deactivated. */ if newClient == NULL, it is always deactivated. */
rfbBool (*newClient)(struct _rfbClientRec* client, void** data); rfbBool (*newClient)(struct _rfbClientRec* client, void** data);
/* returns FALSE if extension should be deactivated for client. /** returns FALSE if extension should be deactivated for client.
if init == NULL, it stays activated. */ if init == NULL, it stays activated. */
rfbBool (*init)(struct _rfbClientRec* client, void* data); rfbBool (*init)(struct _rfbClientRec* client, void* data);
/* if pseudoEncodings is not NULL, it contains a 0 terminated /** if pseudoEncodings is not NULL, it contains a 0 terminated
list of the pseudo encodings handled by this extension. */ list of the pseudo encodings handled by this extension. */
int *pseudoEncodings; int *pseudoEncodings;
/* returns TRUE if that pseudo encoding is handled by the extension. /** returns TRUE if that pseudo encoding is handled by the extension.
encodingNumber==0 means "reset encodings". */ encodingNumber==0 means "reset encodings". */
rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client, rfbBool (*enablePseudoEncoding)(struct _rfbClientRec* client,
void** data, int encodingNumber); void** data, int encodingNumber);
/* returns TRUE if message was handled */ /** returns TRUE if message was handled */
rfbBool (*handleMessage)(struct _rfbClientRec* client, rfbBool (*handleMessage)(struct _rfbClientRec* client,
void* data, void* data,
const rfbClientToServerMsg* message); const rfbClientToServerMsg* message);
void (*close)(struct _rfbClientRec* client, void* data); void (*close)(struct _rfbClientRec* client, void* data);
void (*usage)(void); void (*usage)(void);
/* processArguments returns the number of handled arguments */ /** processArguments returns the number of handled arguments */
int (*processArgument)(int argc, char *argv[]); int (*processArgument)(int argc, char *argv[]);
struct _rfbProtocolExtension* next; struct _rfbProtocolExtension* next;
} rfbProtocolExtension; } rfbProtocolExtension;
@ -210,7 +217,7 @@ typedef struct _rfbExtensionData {
struct _rfbExtensionData* next; struct _rfbExtensionData* next;
} rfbExtensionData; } rfbExtensionData;
/* /**
* Per-screen (framebuffer) structure. There can be as many as you wish, * Per-screen (framebuffer) structure. There can be as many as you wish,
* each serving different clients. However, you have to call * each serving different clients. However, you have to call
* rfbProcessEvents for each of these. * rfbProcessEvents for each of these.
@ -218,7 +225,7 @@ typedef struct _rfbExtensionData {
typedef struct _rfbScreenInfo typedef struct _rfbScreenInfo
{ {
/* this structure has children that are scaled versions of this screen */ /** this structure has children that are scaled versions of this screen */
struct _rfbScreenInfo *scaledScreenNext; struct _rfbScreenInfo *scaledScreenNext;
int scaledScreenRefCount; int scaledScreenRefCount;
@ -232,16 +239,17 @@ typedef struct _rfbScreenInfo
rfbPixel blackPixel; rfbPixel blackPixel;
rfbPixel whitePixel; rfbPixel whitePixel;
/* some screen specific data can be put into a struct where screenData /**
* some screen specific data can be put into a struct where screenData
* points to. You need this if you have more than one screen at the * points to. You need this if you have more than one screen at the
* same time while using the same functions. * same time while using the same functions.
*/ */
void* screenData; void* screenData;
/* additions by libvncserver */ /* additions by libvncserver */
rfbPixelFormat serverFormat; rfbPixelFormat serverFormat;
rfbColourMap colourMap; /* set this if rfbServerFormat.trueColour==FALSE */ rfbColourMap colourMap; /**< set this if rfbServerFormat.trueColour==FALSE */
const char* desktopName; const char* desktopName;
char thisHost[255]; char thisHost[255];
@ -278,13 +286,13 @@ typedef struct _rfbScreenInfo
rfbPasswordCheckProcPtr passwordCheck; rfbPasswordCheckProcPtr passwordCheck;
void* authPasswdData; void* authPasswdData;
/* If rfbAuthPasswdData is given a list, this is the first /** If rfbAuthPasswdData is given a list, this is the first
view only password. */ view only password. */
int authPasswdFirstViewOnly; int authPasswdFirstViewOnly;
/* send only this many rectangles in one update */ /** send only this many rectangles in one update */
int maxRectsPerUpdate; int maxRectsPerUpdate;
/* this is the amount of milliseconds to wait at least before sending /** this is the amount of milliseconds to wait at least before sending
* an update. */ * an update. */
int deferUpdateTime; int deferUpdateTime;
#ifdef TODELETE #ifdef TODELETE
@ -294,7 +302,7 @@ typedef struct _rfbScreenInfo
rfbBool neverShared; rfbBool neverShared;
rfbBool dontDisconnect; rfbBool dontDisconnect;
struct _rfbClientRec* clientHead; struct _rfbClientRec* clientHead;
struct _rfbClientRec* pointerClient; /* "Mutex" for pointer events */ struct _rfbClientRec* pointerClient; /**< "Mutex" for pointer events */
/* cursor */ /* cursor */
@ -303,8 +311,9 @@ typedef struct _rfbScreenInfo
rfbBool dontConvertRichCursorToXCursor; rfbBool dontConvertRichCursorToXCursor;
struct rfbCursor* cursor; struct rfbCursor* cursor;
/* the frameBufferhas to be supplied by the serving process. /**
* The buffer will not be freed by * the frameBuffer has to be supplied by the serving process.
* The buffer will not be freed by
*/ */
char* frameBuffer; char* frameBuffer;
rfbKbdAddEventProcPtr kbdAddEvent; rfbKbdAddEventProcPtr kbdAddEvent;
@ -317,13 +326,13 @@ typedef struct _rfbScreenInfo
rfbSetServerInputProcPtr setServerInput; rfbSetServerInputProcPtr setServerInput;
rfbFileTransferPermitted getFileTransferPermission; rfbFileTransferPermitted getFileTransferPermission;
rfbSetTextChat setTextChat; rfbSetTextChat setTextChat;
/* newClientHook is called just after a new client is created */ /** newClientHook is called just after a new client is created */
rfbNewClientHookPtr newClientHook; rfbNewClientHookPtr newClientHook;
/* displayHook is called just before a frame buffer update */ /** displayHook is called just before a frame buffer update */
rfbDisplayHookPtr displayHook; rfbDisplayHookPtr displayHook;
/* These hooks are called to pass keyboard state back to the client */ /** These hooks are called to pass keyboard state back to the client */
rfbGetKeyboardLedStateHookPtr getKeyboardLedStateHook; rfbGetKeyboardLedStateHookPtr getKeyboardLedStateHook;
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
@ -331,10 +340,10 @@ typedef struct _rfbScreenInfo
rfbBool backgroundLoop; rfbBool backgroundLoop;
#endif #endif
/* if TRUE, an ignoring signal handler is installed for SIGPIPE */ /** if TRUE, an ignoring signal handler is installed for SIGPIPE */
rfbBool ignoreSIGPIPE; rfbBool ignoreSIGPIPE;
/* if not zero, only a slice of this height is processed every time /** if not zero, only a slice of this height is processed every time
* an update should be sent. This should make working on a slow * an update should be sent. This should make working on a slow
* link more interactive. */ * link more interactive. */
int progressiveSliceHeight; int progressiveSliceHeight;
@ -342,27 +351,27 @@ typedef struct _rfbScreenInfo
in_addr_t listenInterface; in_addr_t listenInterface;
int deferPtrUpdateTime; int deferPtrUpdateTime;
/* handle as many input events as possible (default off) */ /** handle as many input events as possible (default off) */
rfbBool handleEventsEagerly; rfbBool handleEventsEagerly;
/* rfbEncodingServerIdentity */ /** rfbEncodingServerIdentity */
char *versionString; char *versionString;
/* What does the server tell the new clients which version it supports */ /** What does the server tell the new clients which version it supports */
int protocolMajorVersion; int protocolMajorVersion;
int protocolMinorVersion; int protocolMinorVersion;
/* command line authorization of file transfers */ /** command line authorization of file transfers */
rfbBool permitFileTransfer; rfbBool permitFileTransfer;
/* displayFinishedHook is called just after a frame buffer update */ /** displayFinishedHook is called just after a frame buffer update */
rfbDisplayFinishedHookPtr displayFinishedHook; rfbDisplayFinishedHookPtr displayFinishedHook;
/* xvpHook is called to handle an xvp client message */ /** xvpHook is called to handle an xvp client message */
rfbXvpHookPtr xvpHook; rfbXvpHookPtr xvpHook;
} rfbScreenInfo, *rfbScreenInfoPtr; } rfbScreenInfo, *rfbScreenInfoPtr;
/* /**
* rfbTranslateFnType is the type of translation functions. * rfbTranslateFnType is the type of translation functions.
*/ */
@ -406,17 +415,17 @@ typedef struct _rfbStatList {
} rfbStatList; } rfbStatList;
typedef struct _rfbClientRec { typedef struct _rfbClientRec {
/* back pointer to the screen */ /** back pointer to the screen */
rfbScreenInfoPtr screen; rfbScreenInfoPtr screen;
/* points to a scaled version of the screen buffer in cl->scaledScreenList */ /** points to a scaled version of the screen buffer in cl->scaledScreenList */
rfbScreenInfoPtr scaledScreen; rfbScreenInfoPtr scaledScreen;
/* how did the client tell us it wanted the screen changed? Ultra style or palm style? */ /** how did the client tell us it wanted the screen changed? Ultra style or palm style? */
rfbBool PalmVNC; rfbBool PalmVNC;
/* private data. You should put any application client specific data /** private data. You should put any application client specific data
* into a struct and let clientData point to it. Don't forget to * into a struct and let clientData point to it. Don't forget to
* free the struct via clientGoneHook! * free the struct via clientGoneHook!
* *
@ -435,13 +444,13 @@ typedef struct _rfbClientRec {
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
pthread_t client_thread; pthread_t client_thread;
#endif #endif
/* Possible client states: */ /** Possible client states: */
enum { enum {
RFB_PROTOCOL_VERSION, /* establishing protocol version */ RFB_PROTOCOL_VERSION, /**< establishing protocol version */
RFB_SECURITY_TYPE, /* negotiating security (RFB v.3.7) */ RFB_SECURITY_TYPE, /**< negotiating security (RFB v.3.7) */
RFB_AUTHENTICATION, /* authenticating */ RFB_AUTHENTICATION, /**< authenticating */
RFB_INITIALISATION, /* sending initialisation messages */ RFB_INITIALISATION, /**< sending initialisation messages */
RFB_NORMAL /* normal protocol messages */ RFB_NORMAL /**< normal protocol messages */
} state; } state;
rfbBool reverseConnection; rfbBool reverseConnection;
@ -479,19 +488,19 @@ typedef struct _rfbClientRec {
the destination copyRegion. Just before an update is sent we remove the destination copyRegion. Just before an update is sent we remove
from the copyRegion anything in the modifiedRegion. */ from the copyRegion anything in the modifiedRegion. */
sraRegionPtr copyRegion; /* the destination region of the copy */ sraRegionPtr copyRegion; /**< the destination region of the copy */
int copyDX, copyDY; /* the translation by which the copy happens */ int copyDX, copyDY; /**< the translation by which the copy happens */
sraRegionPtr modifiedRegion; sraRegionPtr modifiedRegion;
/* As part of the FramebufferUpdateRequest, a client can express interest /** As part of the FramebufferUpdateRequest, a client can express interest
in a subrectangle of the whole framebuffer. This is stored in the in a subrectangle of the whole framebuffer. This is stored in the
requestedRegion member. In the normal case this is the whole requestedRegion member. In the normal case this is the whole
framebuffer if the client is ready, empty if it's not. */ framebuffer if the client is ready, empty if it's not. */
sraRegionPtr requestedRegion; sraRegionPtr requestedRegion;
/* The following member represents the state of the "deferred update" timer /** The following member represents the state of the "deferred update" timer
- when the framebuffer is modified and the client is ready, in most - when the framebuffer is modified and the client is ready, in most
cases it is more efficient to defer sending the update by a few cases it is more efficient to defer sending the update by a few
milliseconds so that several changes to the framebuffer can be combined milliseconds so that several changes to the framebuffer can be combined
@ -503,14 +512,14 @@ typedef struct _rfbClientRec {
int lastPtrY; int lastPtrY;
int lastPtrButtons; int lastPtrButtons;
/* translateFn points to the translation function which is used to copy /** translateFn points to the translation function which is used to copy
and translate a rectangle from the framebuffer to an output buffer. */ and translate a rectangle from the framebuffer to an output buffer. */
rfbTranslateFnType translateFn; rfbTranslateFnType translateFn;
char *translateLookupTable; char *translateLookupTable;
rfbPixelFormat format; rfbPixelFormat format;
/* /**
* UPDATE_BUF_SIZE must be big enough to send at least one whole line of the * UPDATE_BUF_SIZE must be big enough to send at least one whole line of the
* framebuffer. So for a max screen width of say 2K with 32-bit pixels this * framebuffer. So for a max screen width of say 2K with 32-bit pixels this
* means 8K minimum. * means 8K minimum.
@ -526,14 +535,14 @@ typedef struct _rfbClientRec {
struct _rfbStatList *statMsgList; struct _rfbStatList *statMsgList;
int rawBytesEquivalent; int rawBytesEquivalent;
int bytesSent; int bytesSent;
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
/* zlib encoding -- necessary compression state info per client */ /* zlib encoding -- necessary compression state info per client */
struct z_stream_s compStream; struct z_stream_s compStream;
rfbBool compStreamInited; rfbBool compStreamInited;
uint32_t zlibCompressLevel; uint32_t zlibCompressLevel;
/* the quality level is also used by ZYWRLE */ /** the quality level is also used by ZYWRLE */
int tightQualityLevel; int tightQualityLevel;
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
@ -551,28 +560,28 @@ typedef struct _rfbClientRec {
rfbFileTransferData fileTransfer; rfbFileTransferData fileTransfer;
int lastKeyboardLedState; /* keep track of last value so we can send *change* events */ int lastKeyboardLedState; /**< keep track of last value so we can send *change* events */
rfbBool enableSupportedMessages; /* client supports SupportedMessages encoding */ rfbBool enableSupportedMessages; /**< client supports SupportedMessages encoding */
rfbBool enableSupportedEncodings; /* client supports SupportedEncodings encoding */ rfbBool enableSupportedEncodings; /**< client supports SupportedEncodings encoding */
rfbBool enableServerIdentity; /* client supports ServerIdentity encoding */ rfbBool enableServerIdentity; /**< client supports ServerIdentity encoding */
rfbBool enableKeyboardLedState; /* client supports KeyboardState encoding */ rfbBool enableKeyboardLedState; /**< client supports KeyboardState encoding */
rfbBool enableLastRectEncoding; /* client supports LastRect encoding */ rfbBool enableLastRectEncoding; /**< client supports LastRect encoding */
rfbBool enableCursorShapeUpdates; /* client supports cursor shape updates */ rfbBool enableCursorShapeUpdates; /**< client supports cursor shape updates */
rfbBool enableCursorPosUpdates; /* client supports cursor position updates */ rfbBool enableCursorPosUpdates; /**< client supports cursor position updates */
rfbBool useRichCursorEncoding; /* rfbEncodingRichCursor is preferred */ rfbBool useRichCursorEncoding; /**< rfbEncodingRichCursor is preferred */
rfbBool cursorWasChanged; /* cursor shape update should be sent */ rfbBool cursorWasChanged; /**< cursor shape update should be sent */
rfbBool cursorWasMoved; /* cursor position update should be sent */ rfbBool cursorWasMoved; /**< cursor position update should be sent */
int cursorX,cursorY; /* the coordinates of the cursor, int cursorX,cursorY; /**< the coordinates of the cursor,
if enableCursorShapeUpdates = FALSE */ if enableCursorShapeUpdates = FALSE */
rfbBool useNewFBSize; /* client supports NewFBSize encoding */ rfbBool useNewFBSize; /**< client supports NewFBSize encoding */
rfbBool newFBSizePending; /* framebuffer size was changed */ rfbBool newFBSizePending; /**< framebuffer size was changed */
struct _rfbClientRec *prev; struct _rfbClientRec *prev;
struct _rfbClientRec *next; struct _rfbClientRec *next;
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
/* whenever a client is referenced, the refCount has to be incremented /** whenever a client is referenced, the refCount has to be incremented
and afterwards decremented, so that the client is not cleaned up and afterwards decremented, so that the client is not cleaned up
while being referenced. while being referenced.
Use the functions rfbIncrClientRef(cl) and rfbDecrClientRef(cl); Use the functions rfbIncrClientRef(cl) and rfbDecrClientRef(cl);
@ -592,17 +601,17 @@ typedef struct _rfbClientRec {
int zywrleBuf[rfbZRLETileWidth * rfbZRLETileHeight]; int zywrleBuf[rfbZRLETileWidth * rfbZRLETileHeight];
#endif #endif
/* if progressive updating is on, this variable holds the current /** if progressive updating is on, this variable holds the current
* y coordinate of the progressive slice. */ * y coordinate of the progressive slice. */
int progressiveSliceY; int progressiveSliceY;
rfbExtensionData* extensions; rfbExtensionData* extensions;
/* for threaded zrle */ /** for threaded zrle */
char *zrleBeforeBuf; char *zrleBeforeBuf;
void *paletteHelper; void *paletteHelper;
/* for thread safety for rfbSendFBUpdate() */ /** for thread safety for rfbSendFBUpdate() */
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#define LIBVNCSERVER_SEND_MUTEX #define LIBVNCSERVER_SEND_MUTEX
MUTEX(sendMutex); MUTEX(sendMutex);
@ -610,7 +619,7 @@ typedef struct _rfbClientRec {
} rfbClientRec, *rfbClientPtr; } rfbClientRec, *rfbClientPtr;
/* /**
* This macro is used to test whether there is a framebuffer update needing to * This macro is used to test whether there is a framebuffer update needing to
* be sent to the client. * be sent to the client.
*/ */
@ -769,7 +778,7 @@ extern rfbBool rfbSendRectEncodingUltra(rfbClientPtr cl, int x,int y,int w,int h
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
/* zlib.c */ /* zlib.c */
/* Minimum zlib rectangle size in bytes. Anything smaller will /** Minimum zlib rectangle size in bytes. Anything smaller will
* not compress well due to overhead. * not compress well due to overhead.
*/ */
#define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17) #define VNC_ENCODE_ZLIB_MIN_COMP_SIZE (17)
@ -801,16 +810,16 @@ extern rfbBool rfbSendRectEncodingTight(rfbClientPtr cl, int x,int y,int w,int h
/* cursor.c */ /* cursor.c */
typedef struct rfbCursor { typedef struct rfbCursor {
/* set this to true if LibVNCServer has to free this cursor */ /** set this to true if LibVNCServer has to free this cursor */
rfbBool cleanup, cleanupSource, cleanupMask, cleanupRichSource; rfbBool cleanup, cleanupSource, cleanupMask, cleanupRichSource;
unsigned char *source; /* points to bits */ unsigned char *source; /**< points to bits */
unsigned char *mask; /* points to bits */ unsigned char *mask; /**< points to bits */
unsigned short width, height, xhot, yhot; /* metrics */ unsigned short width, height, xhot, yhot; /**< metrics */
unsigned short foreRed, foreGreen, foreBlue; /* device-independent colour */ unsigned short foreRed, foreGreen, foreBlue; /**< device-independent colour */
unsigned short backRed, backGreen, backBlue; /* device-independent colour */ unsigned short backRed, backGreen, backBlue; /**< device-independent colour */
unsigned char *richSource; /* source bytes for a rich cursor */ unsigned char *richSource; /**< source bytes for a rich cursor */
unsigned char *alphaSource; /* source for alpha blending info */ unsigned char *alphaSource; /**< source for alpha blending info */
rfbBool alphaPreMultiplied; /* if richSource already has alpha applied */ rfbBool alphaPreMultiplied; /**< if richSource already has alpha applied */
} rfbCursor, *rfbCursorPtr; } rfbCursor, *rfbCursorPtr;
extern unsigned char rfbReverseByte[0x100]; extern unsigned char rfbReverseByte[0x100];
@ -825,7 +834,7 @@ extern void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr
extern void rfbFreeCursor(rfbCursorPtr cursor); extern void rfbFreeCursor(rfbCursorPtr cursor);
extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c); extern void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c);
/* cursor handling for the pointer */ /** cursor handling for the pointer */
extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl); extern void rfbDefaultPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl);
/* zrle.c */ /* zrle.c */
@ -842,7 +851,7 @@ extern void rfbPrintStats(rfbClientPtr cl);
typedef struct rfbFontData { typedef struct rfbFontData {
unsigned char* data; unsigned char* data;
/* /**
metaData is a 256*5 array: metaData is a 256*5 array:
for each character for each character
(offset,width,height,x,y) (offset,width,height,x,y)
@ -852,18 +861,18 @@ typedef struct rfbFontData {
int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,rfbPixel colour); int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,rfbPixel colour);
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,rfbPixel colour); void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,rfbPixel colour);
/* if colour==backColour, background is transparent */ /** if colour==backColour, background is transparent */
int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour); int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,unsigned char c,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour);
void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour); void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,int x,int y,const char* string,int x1,int y1,int x2,int y2,rfbPixel colour,rfbPixel backColour);
int rfbWidthOfString(rfbFontDataPtr font,const char* string); int rfbWidthOfString(rfbFontDataPtr font,const char* string);
int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c); int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c);
void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2); void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2);
/* this returns the smallest box enclosing any character of font. */ /** this returns the smallest box enclosing any character of font. */
void rfbWholeFontBBox(rfbFontDataPtr font,int *x1, int *y1, int *x2, int *y2); void rfbWholeFontBBox(rfbFontDataPtr font,int *x1, int *y1, int *x2, int *y2);
/* dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16 */ /** dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16 */
rfbFontDataPtr rfbLoadConsoleFont(char *filename); rfbFontDataPtr rfbLoadConsoleFont(char *filename);
/* free a dynamically loaded font */ /** free a dynamically loaded font */
void rfbFreeFont(rfbFontDataPtr font); void rfbFreeFont(rfbFontDataPtr font);
/* draw.c */ /* draw.c */
@ -874,7 +883,7 @@ void rfbDrawLine(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col);
/* selbox.c */ /* selbox.c */
/* this opens a modal select box. list is an array of strings, the end marked /** this opens a modal select box. list is an array of strings, the end marked
with a NULL. with a NULL.
It returns the index in the list or -1 if cancelled or something else It returns the index in the list or -1 if cancelled or something else
wasn't kosher. */ wasn't kosher. */
@ -918,7 +927,7 @@ rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension* extension,
rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension* extension); rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension* extension);
void* rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension* extension); void* rfbGetExtensionClientData(rfbClientPtr cl, rfbProtocolExtension* extension);
/* to check against plain passwords */ /** to check against plain passwords */
rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len); rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len);
/* functions to make a vnc server */ /* functions to make a vnc server */
@ -952,7 +961,7 @@ extern rfbBool rfbIsActive(rfbScreenInfoPtr screenInfo);
/* TightVNC file transfer extension */ /* TightVNC file transfer extension */
void rfbRegisterTightVNCFileTransferExtension(); void rfbRegisterTightVNCFileTransferExtension();
void rfbUnregisterTightVNCFileTransferExtension(); void rfbUnregisterTightVNCFileTransferExtension();
/* Statistics */ /* Statistics */
extern char *messageNameServer2Client(uint32_t type, char *buf, int len); extern char *messageNameServer2Client(uint32_t type, char *buf, int len);
@ -980,10 +989,10 @@ extern int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type);
extern int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type); extern int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type);
extern int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type); extern int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type);
/* Set which version you want to advertise 3.3, 3.6, 3.7 and 3.8 are currently supported*/ /** Set which version you want to advertise 3.3, 3.6, 3.7 and 3.8 are currently supported*/
extern void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_); extern void rfbSetProtocolVersion(rfbScreenInfoPtr rfbScreen, int major_, int minor_);
/* send a TextChat message to a client */ /** send a TextChat message to a client */
extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer); extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *buffer);
@ -993,5 +1002,174 @@ extern rfbBool rfbSendTextChatMessage(rfbClientPtr cl, uint32_t length, char *bu
} }
#endif #endif
#endif /**
* @}
*/
/**
@page libvncserver_doc LibVNCServer Documentation
@section create_server Creating a server instance
To make a server, you just have to initialise a server structure using the
function rfbGetScreen(), like
@code
rfbScreenInfoPtr screen =
rfbGetScreen(argc,argv,screenwidth,screenheight,8,3,bpp);
@endcode
where byte per pixel should be 1, 2 or 4. If performance doesn't matter,
you may try bpp=3 (internally one cannot use native data types in this
case; if you want to use this, look at pnmshow24.c).
You then can set hooks and io functions (see @ref making_it_interactive) or other
options (see @ref server_options).
And you allocate the frame buffer like this:
@code
screen->frameBuffer = (char*)malloc(screenwidth*screenheight*bpp);
@endcode
After that, you initialize the server, like
@code
rfbInitServer(screen);
@endcode
You can use a blocking event loop, a background (pthread based) event loop,
or implement your own using the rfbProcessEvents() function.
@subsection server_options Optional Server Features
These options have to be set between rfbGetScreen() and rfbInitServer().
If you already have a socket to talk to, just set rfbScreenInfo::inetdSock
(originally this is for inetd handling, but why not use it for your purpose?).
To also start an HTTP server (running on port 5800+display_number), you have
to set rfbScreenInfo::httpDir to a directory containing vncviewer.jar and
index.vnc (like the included "classes" directory).
@section making_it_interactive Making it interactive
Whenever you draw something, you have to call
@code
rfbMarkRectAsModified(screen,x1,y1,x2,y2).
@endcode
This tells LibVNCServer to send updates to all connected clients.
There exist the following IO functions as members of rfbScreen:
rfbScreenInfo::kbdAddEvent(), rfbScreenInfo::kbdReleaseAllKeys(), rfbScreenInfo::ptrAddEvent() and rfbScreenInfo::setXCutText()
rfbScreenInfo::kbdAddEvent()
is called when a key is pressed.
rfbScreenInfo::kbdReleaseAllKeys()
is not called at all (maybe in the future).
rfbScreenInfo::ptrAddEvent()
is called when the mouse moves or a button is pressed.
WARNING: if you want to have proper cursor handling, call
rfbDefaultPtrAddEvent()
in your own function. This sets the coordinates of the cursor.
rfbScreenInfo::setXCutText()
is called when the selection changes.
There are only two hooks:
rfbScreenInfo::newClientHook()
is called when a new client has connected.
rfbScreenInfo::displayHook()
is called just before a frame buffer update is sent.
You can also override the following methods:
rfbScreenInfo::getCursorPtr()
This could be used to make an animated cursor (if you really want ...)
rfbScreenInfo::setTranslateFunction()
If you insist on colour maps or something more obscure, you have to
implement this. Default is a trueColour mapping.
@section cursor_handling Cursor handling
The screen holds a pointer
rfbScreenInfo::cursor
to the current cursor. Whenever you set it, remember that any dynamically
created cursor (like return value from rfbMakeXCursor()) is not free'd!
The rfbCursor structure consists mainly of a mask and a source. The rfbCursor::mask
describes, which pixels are drawn for the cursor (a cursor needn't be
rectangular). The rfbCursor::source describes, which colour those pixels should have.
The standard is an XCursor: a cursor with a foreground and a background
colour (stored in backRed,backGreen,backBlue and the same for foreground
in a range from 0-0xffff). Therefore, the arrays "mask" and "source"
contain pixels as single bits stored in bytes in MSB order. The rows are
padded, such that each row begins with a new byte (i.e. a 10x4
cursor's mask has 2x4 bytes, because 2 bytes are needed to hold 10 bits).
It is however very easy to make a cursor like this:
@code
char* cur=" "
" xx "
" x "
" ";
char* mask="xxxx"
"xxxx"
"xxxx"
"xxx ";
rfbCursorPtr c=rfbMakeXCursor(4,4,cur,mask);
@endcode
You can even set rfbCursor::mask to NULL in this call and LibVNCServer will calculate
a mask for you (dynamically, so you have to free it yourself).
There is also an array named rfbCursor::richSource for colourful cursors. They have
the same format as the frameBuffer (i.e. if the server is 32 bit,
a 10x4 cursor has 4x10x4 bytes).
@section screen_client_difference What is the difference between rfbScreenInfoPtr and rfbClientPtr?
The rfbScreenInfoPtr is a pointer to a rfbScreenInfo structure, which
holds information about the server, like pixel format, io functions,
frame buffer etc. The rfbClientPtr is a pointer to an rfbClientRec structure, which holds
information about a client, like pixel format, socket of the
connection, etc. A server can have several clients, but needn't have any. So, if you
have a server and three clients are connected, you have one instance
of a rfbScreenInfo and three instances of rfbClientRec's.
The rfbClientRec structure holds a member rfbClientRec::screen which points to the server.
So, to access the server from the client structure, you use client->screen.
To access all clients from a server be sure to use the provided iterator
rfbGetClientIterator()
with
rfbClientIteratorNext()
and
rfbReleaseClientIterator()
to prevent thread clashes.
@section example_code Example Code
There are two documented examples included:
- example.c, a shared scribble sheet
- pnmshow.c, a program to show PNMs (pictures) over the net.
The examples are not too well documented, but easy straight forward and a
good starting point.
Try example.c: it outputs on which port it listens (default: 5900), so it is
display 0. To view, call @code vncviewer :0 @endcode
You should see a sheet with a gradient and "Hello World!" written on it. Try
to paint something. Note that everytime you click, there is some bigger blot,
whereas when you drag the mouse while clicked you draw a line. The size of the
blot depends on the mouse button you click. Open a second vncviewer with
the same parameters and watch it as you paint in the other window. This also
works over internet. You just have to know either the name or the IP of your
machine. Then it is @code vncviewer machine.where.example.runs.com:0 @endcode
or similar for the remote client. Now you are ready to type something. Be sure
that your mouse sits still, because everytime the mouse moves, the cursor is
reset to the position of the pointer! If you are done with that demo, press
the down or up arrows. If your viewer supports it, then the dimensions of the
sheet change. Just press Escape in the viewer. Note that the server still
runs, even if you closed both windows. When you reconnect now, everything you
painted and wrote is still there. You can press "Page Up" for a blank page.
The demo pnmshow.c is much simpler: you either provide a filename as argument
or pipe a file through stdin. Note that the file has to be a raw pnm/ppm file,
i.e. a truecolour graphics. Only the Escape key is implemented. This may be
the best starting point if you want to learn how to use LibVNCServer. You
are confronted with the fact that the bytes per pixel can only be 8, 16 or 32.
*/
#endif

@ -1,6 +1,11 @@
#ifndef RFBCLIENT_H #ifndef RFBCLIENT_H
#define RFBCLIENT_H #define RFBCLIENT_H
/**
* @defgroup libvncclient_api LibVNCClient API Reference
* @{
*/
/* /*
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved. * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
@ -22,8 +27,8 @@
* USA. * USA.
*/ */
/* /**
* vncviewer.h * @file rfbclient.h
*/ */
#include <stdio.h> #include <stdio.h>
@ -72,7 +77,7 @@ extern "C"
{ {
#endif #endif
/* vncrec */ /** vncrec */
typedef struct { typedef struct {
FILE* file; FILE* file;
@ -81,7 +86,7 @@ typedef struct {
rfbBool doNotSleep; rfbBool doNotSleep;
} rfbVNCRec; } rfbVNCRec;
/* client data */ /** client data */
typedef struct rfbClientData { typedef struct rfbClientData {
void* tag; void* tag;
@ -89,7 +94,7 @@ typedef struct rfbClientData {
struct rfbClientData* next; struct rfbClientData* next;
} rfbClientData; } rfbClientData;
/* app data (belongs into rfbClient?) */ /** app data (belongs into rfbClient?) */
typedef struct { typedef struct {
rfbBool shareDesktop; rfbBool shareDesktop;
@ -107,14 +112,14 @@ typedef struct {
int qualityLevel; int qualityLevel;
rfbBool enableJPEG; rfbBool enableJPEG;
rfbBool useRemoteCursor; rfbBool useRemoteCursor;
rfbBool palmVNC; /* use palmvnc specific SetScale (vs ultravnc) */ rfbBool palmVNC; /**< use palmvnc specific SetScale (vs ultravnc) */
int scaleSetting; /* 0 means no scale set, else 1/scaleSetting */ int scaleSetting; /**< 0 means no scale set, else 1/scaleSetting */
} AppData; } AppData;
/* For GetCredentialProc callback function to return */ /** For GetCredentialProc callback function to return */
typedef union _rfbCredential typedef union _rfbCredential
{ {
/* X509 (VeNCrypt) */ /** X509 (VeNCrypt) */
struct struct
{ {
char *x509CACertFile; char *x509CACertFile;
@ -122,7 +127,7 @@ typedef union _rfbCredential
char *x509ClientCertFile; char *x509ClientCertFile;
char *x509ClientKeyFile; char *x509ClientKeyFile;
} x509Credential; } x509Credential;
/* Plain (VeNCrypt), MSLogon (UltraVNC) */ /** Plain (VeNCrypt), MSLogon (UltraVNC) */
struct struct
{ {
char *username; char *username;
@ -162,7 +167,7 @@ typedef struct _rfbClient {
const char* programName; const char* programName;
char* serverHost; char* serverHost;
int serverPort; /* if -1, then use file recorded by vncrec */ int serverPort; /**< if -1, then use file recorded by vncrec */
rfbBool listenSpecified; rfbBool listenSpecified;
int listenPort, flashPort; int listenPort, flashPort;
@ -170,7 +175,7 @@ typedef struct _rfbClient {
int x, y, w, h; int x, y, w, h;
} updateRect; } updateRect;
/* Note that the CoRRE encoding uses this buffer and assumes it is big enough /** Note that the CoRRE encoding uses this buffer and assumes it is big enough
to hold 255 * 255 * 32 bits -> 260100 bytes. 640*480 = 307200 bytes. to hold 255 * 255 * 32 bits -> 260100 bytes. 640*480 = 307200 bytes.
Hextile also assumes it is big enough to hold 16 * 16 * 32 bits. Hextile also assumes it is big enough to hold 16 * 16 * 32 bits.
Tight encoding assumes BUFFER_SIZE is at least 16384 bytes. */ Tight encoding assumes BUFFER_SIZE is at least 16384 bytes. */
@ -221,7 +226,7 @@ typedef struct _rfbClient {
* Variables for the ``tight'' encoding implementation. * Variables for the ``tight'' encoding implementation.
*/ */
/* Separate buffer for compressed data. */ /** Separate buffer for compressed data. */
#define ZLIB_BUFFER_SIZE 30000 #define ZLIB_BUFFER_SIZE 30000
char zlib_buffer[ZLIB_BUFFER_SIZE]; char zlib_buffer[ZLIB_BUFFER_SIZE];
@ -236,7 +241,7 @@ typedef struct _rfbClient {
uint8_t tightPrevRow[2048*3*sizeof(uint16_t)]; uint8_t tightPrevRow[2048*3*sizeof(uint16_t)];
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
/* JPEG decoder state. */ /** JPEG decoder state. */
rfbBool jpegError; rfbBool jpegError;
struct jpeg_source_mgr* jpegSrcManager; struct jpeg_source_mgr* jpegSrcManager;
@ -250,7 +255,7 @@ typedef struct _rfbClient {
/* cursor.c */ /* cursor.c */
uint8_t *rcSource, *rcMask; uint8_t *rcSource, *rcMask;
/* private data pointer */ /** private data pointer */
rfbClientData* clientData; rfbClientData* clientData;
rfbVNCRec* vncRec; rfbVNCRec* vncRec;
@ -269,7 +274,7 @@ typedef struct _rfbClient {
SoftCursorUnlockScreenProc SoftCursorUnlockScreen; SoftCursorUnlockScreenProc SoftCursorUnlockScreen;
GotFrameBufferUpdateProc GotFrameBufferUpdate; GotFrameBufferUpdateProc GotFrameBufferUpdate;
FinishedFrameBufferUpdateProc FinishedFrameBufferUpdate; FinishedFrameBufferUpdateProc FinishedFrameBufferUpdate;
/* the pointer returned by GetPassword will be freed after use! */ /** the pointer returned by GetPassword will be freed after use! */
GetPasswordProc GetPassword; GetPasswordProc GetPassword;
MallocFrameBufferProc MallocFrameBuffer; MallocFrameBufferProc MallocFrameBuffer;
GotXCutTextProc GotXCutText; GotXCutTextProc GotXCutText;
@ -278,7 +283,7 @@ typedef struct _rfbClient {
GotCursorShapeProc GotCursorShape; GotCursorShapeProc GotCursorShape;
GotCopyRectProc GotCopyRect; GotCopyRectProc GotCopyRect;
/* Which messages are supported by the server /** Which messages are supported by the server
* This is a *guess* for most servers. * This is a *guess* for most servers.
* (If we can even detect the type of server) * (If we can even detect the type of server)
* *
@ -288,18 +293,18 @@ typedef struct _rfbClient {
*/ */
rfbSupportedMessages supportedMessages; rfbSupportedMessages supportedMessages;
/* negotiated protocol version */ /** negotiated protocol version */
int major, minor; int major, minor;
/* The selected security types */ /** The selected security types */
uint32_t authScheme, subAuthScheme; uint32_t authScheme, subAuthScheme;
#ifdef LIBVNCSERVER_WITH_CLIENT_TLS #ifdef LIBVNCSERVER_WITH_CLIENT_TLS
/* The TLS session for Anonymous TLS and VeNCrypt */ /** The TLS session for Anonymous TLS and VeNCrypt */
gnutls_session_t tlsSession; gnutls_session_t tlsSession;
#endif #endif
/* To support security types that requires user input (except VNC password /** To support security types that requires user input (except VNC password
* authentication), for example VeNCrypt and MSLogon, this callback function * authentication), for example VeNCrypt and MSLogon, this callback function
* must be set before the authentication. Otherwise, it implicates that the * must be set before the authentication. Otherwise, it implicates that the
* caller application does not support it and related security types should * caller application does not support it and related security types should
@ -307,18 +312,18 @@ typedef struct _rfbClient {
*/ */
GetCredentialProc GetCredential; GetCredentialProc GetCredential;
/* The 0-terminated security types supported by the client. /** The 0-terminated security types supported by the client.
* Set by function SetClientAuthSchemes() */ * Set by function SetClientAuthSchemes() */
uint32_t *clientAuthSchemes; uint32_t *clientAuthSchemes;
/* When the server is a repeater, this specifies the final destination */ /** When the server is a repeater, this specifies the final destination */
char *destHost; char *destHost;
int destPort; int destPort;
/* the QoS IP DSCP for this client */ /** the QoS IP DSCP for this client */
int QoS_DSCP; int QoS_DSCP;
/* hook to handle xvp server messages */ /** hook to handle xvp server messages */
HandleXvpMsgProc HandleXvpMsg; HandleXvpMsgProc HandleXvpMsg;
} rfbClient; } rfbClient;
@ -372,10 +377,10 @@ void* rfbClientGetClientData(rfbClient* client, void* tag);
typedef struct _rfbClientProtocolExtension { typedef struct _rfbClientProtocolExtension {
int* encodings; int* encodings;
/* returns TRUE if the encoding was handled */ /** returns TRUE if the encoding was handled */
rfbBool (*handleEncoding)(rfbClient* cl, rfbBool (*handleEncoding)(rfbClient* cl,
rfbFramebufferUpdateRectHeader* rect); rfbFramebufferUpdateRectHeader* rect);
/* returns TRUE if it handled the message */ /** returns TRUE if it handled the message */
rfbBool (*handleMessage)(rfbClient* cl, rfbBool (*handleMessage)(rfbClient* cl,
rfbServerToClientMsg* message); rfbServerToClientMsg* message);
struct _rfbClientProtocolExtension* next; struct _rfbClientProtocolExtension* next;
@ -405,12 +410,21 @@ extern int WaitForMessage(rfbClient* client,unsigned int usecs);
/* vncviewer.c */ /* vncviewer.c */
rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,int bytesPerPixel); rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,int bytesPerPixel);
rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv); rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv);
/* rfbClientCleanup() does not touch client->frameBuffer */ /** rfbClientCleanup() does not touch client->frameBuffer */
void rfbClientCleanup(rfbClient* client); void rfbClientCleanup(rfbClient* client);
#if(defined __cplusplus) #if(defined __cplusplus)
} }
#endif #endif
#endif /**
* @}
*/
/**
@page libvncclient_doc LibVNCClient Documentation
@section example_code Example Code
See SDLvncviewer.c for a rather complete client example.
*/
#endif

@ -1,6 +1,17 @@
#ifndef RFBPROTO_H #ifndef RFBPROTO_H
#define RFBPROTO_H #define RFBPROTO_H
/**
@mainpage
@li @ref libvncserver_api
@li @ref libvncserver_doc
@li @ref libvncclient_api
@li @ref libvncclient_doc
*/
/* /*
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
* Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved.

Loading…
Cancel
Save