LibVNCServer/LibVNCClient
Data Structures | Macros | Typedefs | Functions | Variables
rfbclient.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rfb/rfbproto.h>
#include <rfb/keysym.h>
#include <rfb/threading.h>
+ Include dependency graph for rfbclient.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rfbVNCRec
 vncrec More...
 
struct  rfbClientData
 client data More...
 
struct  AppData
 app data (belongs into rfbClient?) More...
 
union  rfbCredential
 For GetCredentialProc callback function to return. More...
 
struct  rfbClient
 
struct  rfbClientProtocolExtension
 

Macros

#define rfbClientSwap16IfLE(s)    (*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
 
#define rfbClientSwap32IfLE(l)
 
#define rfbClientSwap64IfLE(l)
 
#define FLASH_PORT_OFFSET   5400
 
#define LISTEN_PORT_OFFSET   5500
 
#define TUNNEL_PORT_OFFSET   5500
 
#define SERVER_PORT_OFFSET   5900
 
#define DEFAULT_CONNECT_TIMEOUT   60
 
#define DEFAULT_READ_TIMEOUT   0
 
#define DEFAULT_SSH_CMD   "/usr/bin/ssh"
 
#define DEFAULT_TUNNEL_CMD    (DEFAULT_SSH_CMD " -f -L %L:localhost:%R %H sleep 20")
 
#define DEFAULT_VIA_CMD    (DEFAULT_SSH_CMD " -f -L %L:%H:%R %G sleep 20")
 
#define rfbCredentialTypeX509   1
 
#define rfbCredentialTypeUser   2
 
#define rfbX509CrlVerifyNone   0 /* No CRL checking is performed */
 
#define rfbX509CrlVerifyClient   1 /* Only the leaf server certificate is checked */
 
#define rfbX509CrlVerifyAll   2 /* All certificates in the server chain are checked */
 
#define RFB_BUFFER_SIZE   (640*480)
 Note that the CoRRE encoding uses this buffer and assumes it is big enough to hold 255 * 255 * 32 bits -> 260100 bytes. More...
 
#define RFB_BUF_SIZE   8192
 

Typedefs

typedef void(* HandleTextChatProc) (struct _rfbClient *client, int value, char *text)
 Handles a text chat message. More...
 
typedef void(* HandleXvpMsgProc) (struct _rfbClient *client, uint8_t version, uint8_t opcode)
 Handles XVP server messages. More...
 
typedef void(* HandleKeyboardLedStateProc) (struct _rfbClient *client, int value, int pad)
 
typedef rfbBool(* HandleCursorPosProc) (struct _rfbClient *client, int x, int y)
 
typedef void(* SoftCursorLockAreaProc) (struct _rfbClient *client, int x, int y, int w, int h)
 
typedef void(* SoftCursorUnlockScreenProc) (struct _rfbClient *client)
 
typedef void(* GotFrameBufferUpdateProc) (struct _rfbClient *client, int x, int y, int w, int h)
 Callback indicating that a rectangular area of the client's framebuffer was updated. More...
 
typedef void(* FinishedFrameBufferUpdateProc) (struct _rfbClient *client)
 Callback indicating that a client has completely processed an rfbFramebufferUpdate message sent by a server. More...
 
typedef char *(* GetPasswordProc) (struct _rfbClient *client)
 
typedef rfbCredential *(* GetCredentialProc) (struct _rfbClient *client, int credentialType)
 
typedef rfbBool(* MallocFrameBufferProc) (struct _rfbClient *client)
 
typedef void(* GotXCutTextProc) (struct _rfbClient *client, const char *text, int textlen)
 
typedef void(* BellProc) (struct _rfbClient *client)
 
typedef void(* GotCursorShapeProc) (struct _rfbClient *client, int xhot, int yhot, int width, int height, int bytesPerPixel)
 Called when a cursor shape update was received from the server. More...
 
typedef void(* GotCopyRectProc) (struct _rfbClient *client, int src_x, int src_y, int w, int h, int dest_x, int dest_y)
 
typedef void(* GotFillRectProc) (struct _rfbClient *client, int x, int y, int w, int h, uint32_t colour)
 
typedef void(* GotBitmapProc) (struct _rfbClient *client, const uint8_t *buffer, int x, int y, int w, int h)
 
typedef rfbBool(* GotJpegProc) (struct _rfbClient *client, const uint8_t *buffer, int length, int x, int y, int w, int h)
 
typedef rfbBool(* LockWriteToTLSProc) (struct _rfbClient *client)
 
typedef rfbBool(* UnlockWriteToTLSProc) (struct _rfbClient *client)
 
typedef void(* rfbClientLogProc) (const char *format,...)
 

Functions

rfbBool HandleCursorShape (rfbClient *client, int xhot, int yhot, int width, int height, uint32_t enc)
 Handles XCursor and RichCursor shape updates from the server. More...
 
void listenForIncomingConnections (rfbClient *viewer)
 
int listenForIncomingConnectionsNoFork (rfbClient *viewer, int usec_timeout)
 
rfbBool ConnectToRFBServer (rfbClient *client, const char *hostname, int port)
 
rfbBool ConnectToRFBRepeater (rfbClient *client, const char *repeaterHost, int repeaterPort, const char *destHost, int destPort)
 
void SetClientAuthSchemes (rfbClient *client, const uint32_t *authSchemes, int size)
 
rfbBool InitialiseRFBConnection (rfbClient *client)
 
rfbBool SetFormatAndEncodings (rfbClient *client)
 Sends format and encoding parameters to the server. More...
 
rfbBool SendIncrementalFramebufferUpdateRequest (rfbClient *client)
 
rfbBool SendFramebufferUpdateRequest (rfbClient *client, int x, int y, int w, int h, rfbBool incremental)
 Sends a framebuffer update request to the server. More...
 
rfbBool SendScaleSetting (rfbClient *client, int scaleSetting)
 
rfbBool SendPointerEvent (rfbClient *client, int x, int y, int buttonMask)
 Sends a pointer event to the server. More...
 
rfbBool SendExtDesktopSize (rfbClient *client, uint16_t width, uint16_t height)
 Sends a SetDesktopSize event to the server. More...
 
rfbBool SendKeyEvent (rfbClient *client, uint32_t key, rfbBool down)
 Sends a key event to the server. More...
 
rfbBool SendExtendedKeyEvent (rfbClient *client, uint32_t keysym, uint32_t keycode, rfbBool down)
 The same as SendKeyEvent, except a key code will be sent along with the symbol if the server supports extended key events. More...
 
rfbBool SendClientCutText (rfbClient *client, char *str, int len)
 Places a string on the server's clipboard. More...
 
rfbBool HandleRFBServerMessage (rfbClient *client)
 Handles messages from the RFB server. More...
 
rfbBool TextChatSend (rfbClient *client, char *text)
 Sends a text chat message to the server. More...
 
rfbBool TextChatOpen (rfbClient *client)
 Opens a text chat window on the server. More...
 
rfbBool TextChatClose (rfbClient *client)
 Closes the text chat window on the server. More...
 
rfbBool TextChatFinish (rfbClient *client)
 
rfbBool PermitServerInput (rfbClient *client, int enabled)
 
rfbBool SendXvpMsg (rfbClient *client, uint8_t version, uint8_t code)
 
void PrintPixelFormat (rfbPixelFormat *format)
 
rfbBool SupportsClient2Server (rfbClient *client, int messageType)
 
rfbBool SupportsServer2Client (rfbClient *client, int messageType)
 
void rfbClientSetClientData (rfbClient *client, void *tag, void *data)
 Associates a client data tag with the given pointer. More...
 
void * rfbClientGetClientData (rfbClient *client, void *tag)
 Returns a pointer to the client data associated with the given tag. More...
 
void rfbClientRegisterExtension (rfbClientProtocolExtension *e)
 
rfbBool ReadFromRFBServer (rfbClient *client, char *out, unsigned int n)
 
rfbBool WriteToRFBServer (rfbClient *client, const char *buf, unsigned int n)
 
int FindFreeTcpPort (void)
 
rfbSocket ListenAtTcpPort (int port)
 
rfbSocket ListenAtTcpPortAndAddress (int port, const char *address)
 
rfbSocket ConnectClientToTcpAddr (unsigned int host, int port)
 Tries to connect to an IPv4 host. More...
 
rfbSocket ConnectClientToTcpAddr6 (const char *hostname, int port)
 Tries to connect to an IPv4 or IPv6 host. More...
 
rfbSocket ConnectClientToUnixSock (const char *sockFile)
 Tries to connect to a Unix socket. More...
 
rfbSocket ConnectClientToTcpAddrWithTimeout (unsigned int host, int port, unsigned int timeout)
 Tries to connect to an IPv4 host using the given timeout value. More...
 
rfbSocket ConnectClientToTcpAddr6WithTimeout (const char *hostname, int port, unsigned int timeout)
 Tries to connect to an IPv4 or IPv6 host using the given timeout value. More...
 
rfbSocket ConnectClientToUnixSockWithTimeout (const char *sockFile, unsigned int timeout)
 Tries to connect to a Unix socket using the given timeout value. More...
 
rfbSocket AcceptTcpConnection (rfbSocket listenSock)
 
rfbBool SetNonBlocking (rfbSocket sock)
 
rfbBool SetBlocking (rfbSocket sock)
 
rfbBool SetDSCP (rfbSocket sock, int dscp)
 
rfbBool StringToIPAddr (const char *str, unsigned int *addr)
 
rfbBool SameMachine (rfbSocket sock)
 
int WaitForMessage (rfbClient *client, unsigned int usecs)
 Waits for an RFB message to arrive from the server. More...
 
rfbClientrfbGetClient (int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
 Allocates and returns a pointer to an rfbClient structure. More...
 
rfbBool rfbInitClient (rfbClient *client, int *argc, char **argv)
 Initializes the client. More...
 
void rfbClientCleanup (rfbClient *client)
 Cleans up the client structure and releases the memory allocated for it. More...
 

Variables

rfbBool rfbEnableClientLogging
 
rfbClientLogProc rfbClientLog
 
rfbClientLogProc rfbClientErr
 
rfbBool errorMessageOnReadFailure
 

Macro Definition Documentation

◆ RFB_BUF_SIZE

#define RFB_BUF_SIZE   8192
Examples
SDLvncviewer.c.

Definition at line 277 of file rfbclient.h.

◆ RFB_BUFFER_SIZE

#define RFB_BUFFER_SIZE   (640*480)

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. Hextile also assumes it is big enough to hold 16 * 16 * 32 bits. Tight encoding assumes BUFFER_SIZE is at least 16384 bytes.

Definition at line 264 of file rfbclient.h.