x11vnc  0.9.13
About: x11vnc is a VNC (Virtual Network Computing) server for real X displays. The last release by the original author Karl Runge (there are now newer community-based releases on https://github.com/LibVNC/x11vnc available.
  Fossies Dox: x11vnc-0.9.13.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

LibVNCClient API Reference

Files

file  rfbclient.h
 

Classes

struct  rfbVNCRec
 
struct  rfbClientData
 
struct  AppData
 
union  _rfbCredential
 
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_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
 

Typedefs

typedef struct rfbClientData rfbClientData
 
typedef union _rfbCredential rfbCredential
 
typedef void(* HandleTextChatProc) (struct _rfbClient *client, int value, char *text)
 
typedef void(* HandleXvpMsgProc) (struct _rfbClient *client, uint8_t version, uint8_t opcode)
 
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)
 
typedef void(* FinishedFrameBufferUpdateProc) (struct _rfbClient *client)
 
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)
 
typedef void(* GotCopyRectProc) (struct _rfbClient *client, int src_x, int src_y, int w, int h, int dest_x, int dest_y)
 
typedef struct _rfbClient rfbClient
 
typedef void(* rfbClientLogProc) (const char *format,...)
 
typedef struct _rfbClientProtocolExtension rfbClientProtocolExtension
 

Functions

rfbBool HandleCursorShape (rfbClient *client, int xhot, int yhot, int width, int height, uint32_t enc)
 
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)
 
rfbBool SendIncrementalFramebufferUpdateRequest (rfbClient *client)
 
rfbBool SendFramebufferUpdateRequest (rfbClient *client, int x, int y, int w, int h, rfbBool incremental)
 
rfbBool SendScaleSetting (rfbClient *client, int scaleSetting)
 
rfbBool SendPointerEvent (rfbClient *client, int x, int y, int buttonMask)
 
rfbBool SendKeyEvent (rfbClient *client, uint32_t key, rfbBool down)
 
rfbBool SendClientCutText (rfbClient *client, char *str, int len)
 
rfbBool HandleRFBServerMessage (rfbClient *client)
 
rfbBool TextChatSend (rfbClient *client, char *text)
 
rfbBool TextChatOpen (rfbClient *client)
 
rfbBool TextChatClose (rfbClient *client)
 
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)
 
void * rfbClientGetClientData (rfbClient *client, void *tag)
 
void rfbClientRegisterExtension (rfbClientProtocolExtension *e)
 
rfbBool ReadFromRFBServer (rfbClient *client, char *out, unsigned int n)
 
rfbBool WriteToRFBServer (rfbClient *client, char *buf, int n)
 
int FindFreeTcpPort (void)
 
int ListenAtTcpPort (int port)
 
int ConnectClientToTcpAddr (unsigned int host, int port)
 
int ConnectClientToTcpAddr6 (const char *hostname, int port)
 
int ConnectClientToUnixSock (const char *sockFile)
 
int AcceptTcpConnection (int listenSock)
 
rfbBool SetNonBlocking (int sock)
 
rfbBool SetDSCP (int sock, int dscp)
 
rfbBool StringToIPAddr (const char *str, unsigned int *addr)
 
rfbBool SameMachine (int sock)
 
int WaitForMessage (rfbClient *client, unsigned int usecs)
 
rfbClientrfbGetClient (int bitsPerSample, int samplesPerPixel, int bytesPerPixel)
 
rfbBool rfbInitClient (rfbClient *client, int *argc, char **argv)
 
void rfbClientCleanup (rfbClient *client)
 

Variables

rfbBool rfbEnableClientLogging
 
rfbClientLogProc rfbClientLog
 
rfbClientLogProc rfbClientErr
 
rfbBool errorMessageOnReadFailure
 

Detailed Description

Macro Definition Documentation

◆ DEFAULT_SSH_CMD

#define DEFAULT_SSH_CMD   "/usr/bin/ssh"

Definition at line 69 of file rfbclient.h.

◆ DEFAULT_TUNNEL_CMD

#define DEFAULT_TUNNEL_CMD   (DEFAULT_SSH_CMD " -f -L %L:localhost:%R %H sleep 20")

Definition at line 70 of file rfbclient.h.

◆ DEFAULT_VIA_CMD

#define DEFAULT_VIA_CMD   (DEFAULT_SSH_CMD " -f -L %L:%H:%R %G sleep 20")

Definition at line 72 of file rfbclient.h.

◆ FLASH_PORT_OFFSET

#define FLASH_PORT_OFFSET   5400

Definition at line 64 of file rfbclient.h.

◆ LISTEN_PORT_OFFSET

#define LISTEN_PORT_OFFSET   5500

Definition at line 65 of file rfbclient.h.

◆ rfbClientSwap16IfLE

#define rfbClientSwap16IfLE (   s)    (*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))

Definition at line 45 of file rfbclient.h.

◆ rfbClientSwap32IfLE

#define rfbClientSwap32IfLE (   l)
Value:
(*(char *)&client->endianTest ? ((((l) & 0xff000000) >> 24) | \
(((l) & 0x00ff0000) >> 8) | \
(((l) & 0x0000ff00) << 8) | \
(((l) & 0x000000ff) << 24)) : (l))
static rfbClient * client
Definition: screen.c:1160
int endianTest
Definition: rfbclient.h:164

Definition at line 48 of file rfbclient.h.

◆ rfbClientSwap64IfLE

#define rfbClientSwap64IfLE (   l)
Value:
(*(char *)&client->endianTest ? ((((l) & 0xff00000000000000ULL) >> 56) | \
(((l) & 0x00ff000000000000ULL) >> 40) | \
(((l) & 0x0000ff0000000000ULL) >> 24) | \
(((l) & 0x000000ff00000000ULL) >> 8) | \
(((l) & 0x00000000ff000000ULL) << 8) | \
(((l) & 0x0000000000ff0000ULL) << 24) | \
(((l) & 0x000000000000ff00ULL) << 40) | \
(((l) & 0x00000000000000ffULL) << 56)) : (l))
static rfbClient * client
Definition: screen.c:1160
int endianTest
Definition: rfbclient.h:164

Definition at line 54 of file rfbclient.h.

◆ rfbCredentialTypeUser

#define rfbCredentialTypeUser   2

Definition at line 139 of file rfbclient.h.

◆ rfbCredentialTypeX509

#define rfbCredentialTypeX509   1

Definition at line 138 of file rfbclient.h.

◆ SERVER_PORT_OFFSET

#define SERVER_PORT_OFFSET   5900

Definition at line 67 of file rfbclient.h.

◆ TUNNEL_PORT_OFFSET

#define TUNNEL_PORT_OFFSET   5500

Definition at line 66 of file rfbclient.h.

Typedef Documentation

◆ BellProc

typedef void(* BellProc) (struct _rfbClient *client)

Definition at line 155 of file rfbclient.h.

◆ FinishedFrameBufferUpdateProc

typedef void(* FinishedFrameBufferUpdateProc) (struct _rfbClient *client)

Definition at line 150 of file rfbclient.h.

◆ GetCredentialProc

typedef rfbCredential*(* GetCredentialProc) (struct _rfbClient *client, int credentialType)

Definition at line 152 of file rfbclient.h.

◆ GetPasswordProc

typedef char*(* GetPasswordProc) (struct _rfbClient *client)

Definition at line 151 of file rfbclient.h.

◆ GotCopyRectProc

typedef void(* GotCopyRectProc) (struct _rfbClient *client, int src_x, int src_y, int w, int h, int dest_x, int dest_y)

Definition at line 158 of file rfbclient.h.

◆ GotCursorShapeProc

typedef void(* GotCursorShapeProc) (struct _rfbClient *client, int xhot, int yhot, int width, int height, int bytesPerPixel)

Definition at line 157 of file rfbclient.h.

◆ GotFrameBufferUpdateProc

typedef void(* GotFrameBufferUpdateProc) (struct _rfbClient *client, int x, int y, int w, int h)

Definition at line 149 of file rfbclient.h.

◆ GotXCutTextProc

typedef void(* GotXCutTextProc) (struct _rfbClient *client, const char *text, int textlen)

Definition at line 154 of file rfbclient.h.

◆ HandleCursorPosProc

typedef rfbBool(* HandleCursorPosProc) (struct _rfbClient *client, int x, int y)

Definition at line 146 of file rfbclient.h.

◆ HandleKeyboardLedStateProc

typedef void(* HandleKeyboardLedStateProc) (struct _rfbClient *client, int value, int pad)

Definition at line 145 of file rfbclient.h.

◆ HandleTextChatProc

typedef void(* HandleTextChatProc) (struct _rfbClient *client, int value, char *text)

Definition at line 143 of file rfbclient.h.

◆ HandleXvpMsgProc

typedef void(* HandleXvpMsgProc) (struct _rfbClient *client, uint8_t version, uint8_t opcode)

Definition at line 144 of file rfbclient.h.

◆ MallocFrameBufferProc

typedef rfbBool(* MallocFrameBufferProc) (struct _rfbClient *client)

Definition at line 153 of file rfbclient.h.

◆ rfbClient

typedef struct _rfbClient rfbClient

◆ rfbClientData

typedef struct rfbClientData rfbClientData

client data

◆ rfbClientLogProc

typedef void(* rfbClientLogProc) (const char *format,...)

Definition at line 342 of file rfbclient.h.

◆ rfbClientProtocolExtension

◆ rfbCredential

For GetCredentialProc callback function to return

◆ SoftCursorLockAreaProc

typedef void(* SoftCursorLockAreaProc) (struct _rfbClient *client, int x, int y, int w, int h)

Definition at line 147 of file rfbclient.h.

◆ SoftCursorUnlockScreenProc

typedef void(* SoftCursorUnlockScreenProc) (struct _rfbClient *client)

Definition at line 148 of file rfbclient.h.

Function Documentation

◆ AcceptTcpConnection()

int AcceptTcpConnection ( int  listenSock)

Definition at line 533 of file sockets.c.

References rfbClientErr.

Referenced by listenForIncomingConnections(), and listenForIncomingConnectionsNoFork().

Here is the caller graph for this function:

◆ ConnectClientToTcpAddr()

int ConnectClientToTcpAddr ( unsigned int  host,
int  port 
)

Definition at line 315 of file sockets.c.

References initSockets(), and rfbClientErr.

Referenced by ConnectToRFBRepeater(), and ConnectToRFBServer().

Here is the caller graph for this function:

◆ ConnectClientToTcpAddr6()

int ConnectClientToTcpAddr6 ( const char *  hostname,
int  port 
)

Definition at line 354 of file sockets.c.

References initSockets(), and rfbClientErr.

Referenced by ConnectToRFBRepeater(), and ConnectToRFBServer().

Here is the caller graph for this function:

◆ ConnectClientToUnixSock()

int ConnectClientToUnixSock ( const char *  sockFile)

Definition at line 416 of file sockets.c.

References rfbClientErr.

Referenced by ConnectToRFBServer().

Here is the caller graph for this function:

◆ ConnectToRFBRepeater()

rfbBool ConnectToRFBRepeater ( rfbClient client,
const char *  repeaterHost,
int  repeaterPort,
const char *  destHost,
int  destPort 
)

◆ ConnectToRFBServer()

◆ FindFreeTcpPort()

int FindFreeTcpPort ( void  )

Definition at line 451 of file sockets.c.

References initSockets(), rfbClientErr, and TUNNEL_PORT_OFFSET.

◆ HandleCursorShape()

rfbBool HandleCursorShape ( rfbClient client,
int  xhot,
int  yhot,
int  width,
int  height,
uint32_t  enc 
)

◆ HandleRFBServerMessage()

rfbBool HandleRFBServerMessage ( rfbClient client)

Definition at line 1495 of file rfbproto.c.

References _rfbClient::appData, _rfbClient::Bell, rfbPixelFormat::bigEndian, rfbPixelFormat::bitsPerPixel, rfbPixelFormat::blueMax, rfbPixelFormat::blueShift, _rfbClient::buffer, client, rfbSupportedMessages::client2server, CopyRectangle(), CopyRectangleFromRectangle(), _rfbClient::CurrentKeyboardLedState, FALSE, _rfbClient::FinishedFrameBufferUpdate, _rfbClient::format, rfbServerInitMsg::format, _rfbClient::GotCopyRect, _rfbClient::GotFrameBufferUpdate, _rfbClient::GotXCutText, rfbPixelFormat::greenMax, rfbPixelFormat::greenShift, _rfbClient::h, HandleCoRRE16(), HandleCoRRE32(), HandleCoRRE8(), _rfbClient::HandleCursorPos, HandleCursorShape(), HandleHextile16(), HandleHextile32(), HandleHextile8(), _rfbClient::HandleKeyboardLedState, HandleRRE16(), HandleRRE32(), HandleRRE8(), _rfbClient::HandleTextChat, HandleUltra16(), HandleUltra32(), HandleUltra8(), HandleUltraZip16(), HandleUltraZip32(), HandleUltraZip8(), _rfbClient::HandleXvpMsg, _rfbClient::height, _rfbClient::KeyboardLedStateEnabled, _rfbClient::MallocFrameBuffer, _rfbClientProtocolExtension::next, AppData::qualityLevel, ReadFromRFBServer(), rfbVNCRec::readTimestamp, rfbPixelFormat::redMax, rfbPixelFormat::redShift, RFB_BUFFER_SIZE, rfbBell, rfbClientExtensions, rfbClientLog, rfbClientSwap16IfLE, rfbClientSwap32IfLE, rfbEncodingCopyRect, rfbEncodingCoRRE, rfbEncodingHextile, rfbEncodingKeyboardLedState, rfbEncodingLastRect, rfbEncodingNewFBSize, rfbEncodingPointerPos, rfbEncodingRaw, rfbEncodingRichCursor, rfbEncodingRRE, rfbEncodingServerIdentity, rfbEncodingSupportedEncodings, rfbEncodingSupportedMessages, rfbEncodingTight, rfbEncodingUltra, rfbEncodingUltraZip, rfbEncodingXCursor, rfbEncodingZlib, rfbEncodingZRLE, rfbEncodingZYWRLE, rfbFramebufferUpdate, rfbPalmVNCReSizeFrameBuffer, rfbResizeFrameBuffer, rfbServerCutText, rfbSetColourMapEntries, rfbTextChat, rfbTextChatClose, rfbTextChatFinished, rfbTextChatOpen, rfbXvp, SendFramebufferUpdateRequest(), SendIncrementalFramebufferUpdateRequest(), rfbSupportedMessages::server2client, _rfbClient::serverPort, SetClient2Server(), SetServer2Client(), _rfbClient::si, _rfbClient::SoftCursorLockArea, _rfbClient::SoftCursorUnlockScreen, _rfbClient::supportedMessages, sz_rfbCopyRect, sz_rfbFramebufferUpdateMsg, sz_rfbFramebufferUpdateRectHeader, sz_rfbPalmVNCReSizeFrameBufferMsg, sz_rfbResizeFrameBufferMsg, sz_rfbServerCutTextMsg, sz_rfbSupportedMessages, sz_rfbTextChatMsg, sz_rfbXvpMsg, TRUE, _rfbClient::updateRect, _rfbClient::vncRec, _rfbClient::w, _rfbClient::width, _rfbClient::x, and _rfbClient::y.

Referenced by vnc_reflect_process_client().

Here is the caller graph for this function:

◆ InitialiseRFBConnection()

◆ ListenAtTcpPort()

int ListenAtTcpPort ( int  port)

Definition at line 486 of file sockets.c.

References initSockets(), and rfbClientErr.

Referenced by listenForIncomingConnections(), and listenForIncomingConnectionsNoFork().

Here is the caller graph for this function:

◆ listenForIncomingConnections()

void listenForIncomingConnections ( rfbClient viewer)

◆ listenForIncomingConnectionsNoFork()

int listenForIncomingConnectionsNoFork ( rfbClient viewer,
int  usec_timeout 
)

◆ PermitServerInput()

◆ PrintPixelFormat()

◆ ReadFromRFBServer()

◆ rfbClientCleanup()

void rfbClientCleanup ( rfbClient client)

rfbClientCleanup() does not touch client->frameBuffer

Definition at line 341 of file vncviewer.c.

References client, _rfbClient::clientAuthSchemes, _rfbClient::desktopName, _rfbClient::destHost, FreeTLS(), _rfbClient::listenSock, rfbClientLog, _rfbClient::serverHost, _rfbClient::sock, and TRUE.

Referenced by rfbInitClient().

Here is the caller graph for this function:

◆ rfbClientGetClientData()

void* rfbClientGetClientData ( rfbClient client,
void *  tag 
)

◆ rfbClientRegisterExtension()

void rfbClientRegisterExtension ( rfbClientProtocolExtension e)

Definition at line 92 of file rfbproto.c.

References _rfbClientProtocolExtension::next, and rfbClientExtensions.

◆ rfbClientSetClientData()

void rfbClientSetClientData ( rfbClient client,
void *  tag,
void *  data 
)

◆ rfbGetClient()

◆ rfbInitClient()

◆ SameMachine()

rfbBool SameMachine ( int  sock)

Definition at line 666 of file sockets.c.

Referenced by SetFormatAndEncodings().

Here is the caller graph for this function:

◆ SendClientCutText()

rfbBool SendClientCutText ( rfbClient client,
char *  str,
int  len 
)

◆ SendFramebufferUpdateRequest()

◆ SendIncrementalFramebufferUpdateRequest()

rfbBool SendIncrementalFramebufferUpdateRequest ( rfbClient client)

Definition at line 1260 of file rfbproto.c.

References client, _rfbClient::h, SendFramebufferUpdateRequest(), TRUE, _rfbClient::updateRect, _rfbClient::w, _rfbClient::x, and _rfbClient::y.

Referenced by HandleRFBServerMessage().

Here is the caller graph for this function:

◆ SendKeyEvent()

rfbBool SendKeyEvent ( rfbClient client,
uint32_t  key,
rfbBool  down 
)

◆ SendPointerEvent()

rfbBool SendPointerEvent ( rfbClient client,
int  x,
int  y,
int  buttonMask 
)

◆ SendScaleSetting()

rfbBool SendScaleSetting ( rfbClient client,
int  scaleSetting 
)

◆ SendXvpMsg()

rfbBool SendXvpMsg ( rfbClient client,
uint8_t  version,
uint8_t  code 
)

◆ SetClientAuthSchemes()

void SetClientAuthSchemes ( rfbClient client,
const uint32_t *  authSchemes,
int  size 
)

Definition at line 803 of file rfbproto.c.

References client, and _rfbClient::clientAuthSchemes.

◆ SetDSCP()

rfbBool SetDSCP ( int  sock,
int  dscp 
)

Definition at line 585 of file sockets.c.

References FALSE, rfbClientErr, and TRUE.

Referenced by ConnectToRFBServer().

Here is the caller graph for this function:

◆ SetFormatAndEncodings()

◆ SetNonBlocking()

rfbBool SetNonBlocking ( int  sock)

Definition at line 562 of file sockets.c.

References FALSE, rfbClientErr, and TRUE.

Referenced by ConnectToRFBRepeater(), ConnectToRFBServer(), listenForIncomingConnections(), and listenForIncomingConnectionsNoFork().

Here is the caller graph for this function:

◆ StringToIPAddr()

rfbBool StringToIPAddr ( const char *  str,
unsigned int addr 
)

Definition at line 633 of file sockets.c.

References FALSE, initSockets(), and TRUE.

Referenced by ConnectToRFBRepeater(), and ConnectToRFBServer().

Here is the caller graph for this function:

◆ SupportsClient2Server()

◆ SupportsServer2Client()

rfbBool SupportsServer2Client ( rfbClient client,
int  messageType 
)

◆ TextChatClose()

◆ TextChatFinish()

◆ TextChatOpen()

◆ TextChatSend()

◆ WaitForMessage()

int WaitForMessage ( rfbClient client,
unsigned int  usecs 
)

Definition at line 721 of file sockets.c.

References client, rfbClientLog, _rfbClient::serverPort, and _rfbClient::sock.

Referenced by vnc_reflect_process_client().

Here is the caller graph for this function:

◆ WriteToRFBServer()

Variable Documentation

◆ errorMessageOnReadFailure

rfbBool errorMessageOnReadFailure

Definition at line 56 of file sockets.c.

Referenced by InitialiseRFBConnection(), and ReadFromRFBServer().

◆ rfbClientErr

◆ rfbClientLog

◆ rfbEnableClientLogging

rfbBool rfbEnableClientLogging

Definition at line 61 of file rfbproto.c.

Referenced by rfbDefaultClientLog().