Tries to connect to an IPv4 host.
@param host Binary IPv4 address
@param port Port
@return A blocking socket or RFB_INVALID_SOCKET if the connection failed
Tries to connect to an IPv4 or IPv6 host.
@param hostname A hostname or IP address
@param port Port
@return A blocking socket or RFB_INVALID_SOCKET if the connection failed
Tries to connect to an IPv4 or IPv6 host using the given timeout value.
@param hostname A hostname or IP address
@param port Port
@param timeout The time in seconds to wait for a connection
@return A nonblocking socket or RFB_INVALID_SOCKET if the connection failed
Tries to connect to an IPv4 host using the given timeout value.
@param host Binary IPv4 address
@param port Port
@param timeout The time in seconds to wait for a connection
@return A nonblocking socket or RFB_INVALID_SOCKET if the connection failed
Tries to connect to a Unix socket.
@param sockFile Path of the socket file
@return A blocking socket or RFB_INVALID_SOCKET if the connection failed
Tries to connect to a Unix socket using the given timeout value.
@param sockFile Path of the socket file
@param timeout The time in seconds to wait for a connection
@return A nonblocking socket or RFB_INVALID_SOCKET if the connection failed
Handles XCursor and RichCursor shape updates from the server.
We emulate cursor operating on the frame buffer (that is
why we call it “software cursor”). This decodes the received cursor
shape and hands it over to GotCursorShapeProc, if set.
Handles messages from the RFB server. You must call this function
intermittently so LibVNCClient can parse messages from the server. For
example, if your app has a draw loop, you could place a call to this
function within that draw loop.
@note You must call WaitForMessage() before you call this function.
@param client The client which will handle the RFB server messages
@return true if the client was able to handle the RFB server messages, false
otherwise
Places a string on the server’s clipboard. Use this function if you want to
be able to copy and paste between the server and your application. For
instance, when your application is notified that the user copied some text
onto the clipboard, you would call this function to synchronize the server’s
clipboard with your local clipboard.
@param client The client structure through which to send the client cut text
message
@param str The string to send (doesn’t need to be NULL terminated)
@param len The length of the string
@return true if the client cut message was sent successfully, false otherwise
Sends a framebuffer update request to the server. A VNC client may request an
update from the server at any time. You can also specify which portions of
the screen you want updated. This can be handy if a pointer is at certain
location and the user pressed a mouse button, for instance. Then you can
immediately request an update of the region around the pointer from the
server.
@note The coordinate system is a left-handed Cartesian coordinate system with
the Z axis (unused) pointing out of the screen. Alternately you can think of
it as a right-handed Cartesian coordinate system with the Z axis pointing
into the screen. The origin is at the upper left corner of the framebuffer.
@param client The client through which to send the request
@param x The horizontal position of the update request rectangle
@param y The vertical position of the update request rectangle
@param w The width of the update request rectangle
@param h The height of the update request rectangle
@param incremental false: server sends rectangle even if nothing changed.
true: server only sends changed parts of rectangle.
@return true if the update request was sent successfully, false otherwise
Sends a key event to the server. If your application is not merely a VNC
viewer (i.e. it controls the server), you’ll want to send the keys that the
user presses to the server. Use this function to do that.
@param client The client through which to send the key event
@param key An rfbKeySym defined in rfb/keysym.h
@param down true if this was a key down event, false otherwise
@return true if the key event was send successfully, false otherwise
Sends a pointer event to the server. A pointer event includes a cursor
location and a button mask. The button mask indicates which buttons on the
pointing device are pressed. Each button is represented by a bit in the
button mask. A 1 indicates the button is pressed while a 0 indicates that it
is not pressed. You may use these pre-defined button masks by ORing them
together: rfbButton1Mask, rfbButton2Mask, rfbButton3Mask, rfbButton4Mask
rfbButton5Mask
@note The cursor location is relative to the client’s framebuffer, not the
client’s screen itself.
@note The coordinate system is a left-handed Cartesian coordinate system with
the Z axis (unused) pointing out of the screen. Alternately you can think of
it as a right-handed Cartesian coordinate system with the Z axis pointing
into the screen. The origin is at the upper left corner of the screen.
@param client The client through which to send the pointer event
@param x the horizontal location of the cursor
@param y the vertical location of the cursor
@param buttonMask the button mask indicating which buttons are pressed
@return true if the pointer event was sent successfully, false otherwise
Sends format and encoding parameters to the server. Your application can
modify the ‘client’ data structure directly. However some changes to this
structure must be communicated back to the server. For instance, if you
change the encoding to hextile, the server needs to know that it should send
framebuffer updates in hextile format. Likewise if you change the pixel
format of the framebuffer, the server must be notified about this as well.
Call this function to propagate your changes of the local ‘client’ structure
over to the server.
@li Encoding type
@li RFB protocol extensions announced via pseudo-encodings
@li Framebuffer pixel format (like RGB vs ARGB)
@li Remote cursor support
@param client The client in which the format or encodings have been changed
@return true if the format or encodings were sent to the server successfully,
false otherwise
Closes the text chat window on the server.
@param client The client through which to send the message
@return true if the window was closed successfully, false otherwise
Opens a text chat window on the server.
@param client The client through which to send the message
@return true if the window was opened successfully, false otherwise
Sends a text chat message to the server.
@param client The client through which to send the message
@param text The text to send
@return true if the text was sent successfully, false otherwise
Waits for an RFB message to arrive from the server. Before handling a message
with HandleRFBServerMessage(), you must wait for your client to receive one.
This function blocks until a message is received. You may specify a timeout
in microseconds. Once this number of microseconds have elapsed, the function
will return.
@param client The client to cause to wait until a message is received
@param usecs The timeout in microseconds
@return the return value of the underlying select() call
to check against plain passwords
Cleans up the client structure and releases the memory allocated for it. You
should call this when you’re done with the rfbClient structure that you
allocated with rfbGetClient().
@note rfbClientCleanup() does not touch client->frameBuffer.
@param client The client to clean up
Returns a pointer to the client data associated with the given tag. See the
the documentation for rfbClientSetClientData() for a discussion of how you
can use client data.
@param client The client from which to get the client data
@param tag The tag which identifies the client data
@return a pointer to the client data
Associates a client data tag with the given pointer. LibVNCClient has
several events to which you can associate your own handlers. These handlers
have the client structure as one of their parameters. Sometimes, you may want
to make data from elsewhere in your application available to these handlers
without using a global variable. To do this, you call
rfbClientSetClientData() and associate the data with a tag. Then, your
handler can call rfbClientGetClientData() and get the a pointer to the data
associated with that tag.
@param client The client in which to set the client data
@param tag A unique tag which identifies the data
@param data A pointer to the data to associate with the tag
cursor handling for the pointer
if colour==backColour, background is transparent
free a dynamically loaded font
Allocates and returns a pointer to an rfbClient structure. This will probably
be the first LibVNCClient function your client code calls. Most libVNCClient
functions operate on an rfbClient structure, and this function allocates
memory for that structure. When you’re done with the rfbClient structure
pointer this function returns, you should free the memory rfbGetClient()
allocated by calling rfbClientCleanup().
Initializes the client. The format is {PROGRAM_NAME, [OPTIONS]…, HOST}. This
function does not initialize the program name if the rfbClient’s program
name is set already. The options are as follows:
dynamically load a linux console font (4096 bytes, 256 glyphs a 8x16
send a TextChat message to a client
Set which version you want to advertise 3.3, 3.6, 3.7 and 3.8 are currently supported
this returns the smallest box enclosing any character of font.
Callback indicating that a client has completely processed an rfbFramebufferUpdate
message sent by a server.
This is called exactly once per each handled rfbFramebufferUpdate message.
@param client The client which finished processing an rfbFramebufferUpdate
Called when a cursor shape update was received from the server. The decoded cursor shape
will be in client->rcSource. It’s up to the application to do something with this, e.g. draw
into a viewer’s window. If you want the server to draw the cursor into the framebuffer, be
careful not to announce remote cursor support, i.e. not include rfbEncodingXCursor or
rfbEncodingRichCursor in SetFormatAndEncodings().
Callback indicating that a rectangular area of the client’s framebuffer was updated.
As a server will usually send several rects per rfbFramebufferUpdate message, this
callback is usually called multiple times per rfbFramebufferUpdate message.
@param client The client whose framebuffer was (partially) updated
@param x The x-coordinate of the upper left corner of the updated rectangle
@param y The y-coordinate of the upper left corner of the updated rectangle
@param w The width of the updated rectangle
@param h The heigth of the updated rectangle
Handles a text chat message. If your application should accept text messages
from the server, define a function with this prototype and set
client->HandleTextChat to a pointer to that function subsequent to your
rfbGetClient() call.
@param client The client which called the text chat handler
@param value text length if text != NULL, or one of rfbTextChatOpen,
rfbTextChatClose, rfbTextChatFinished if text == NULL
@param text The text message from the server
Handles XVP server messages. If your application sends XVP messages to the
server, you’ll want to handle the server’s XVP_FAIL and XVP_INIT responses.
Define a function with this prototype and set client->HandleXvpMsg to a
pointer to that function subsequent to your rfbGetClient() call.
@param client The client which called the XVP message handler
@param version The highest XVP extension version that the server supports
@param opcode The opcode. 0 is XVP_FAIL, 1 is XVP_INIT
this opens a modal select box. list is an array of strings, the end marked
with a NULL.
It returns the index in the list or -1 if cancelled or something else
wasn’t kosher.
@deprecated
Possible client states:
For GetCredentialProc callback function to return
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.
support the capability to view the caps/num/scroll states of the X server
Protocol extension handling.
Per-screen (framebuffer) structure. There can be as many as you wish,
each serving different clients. However, you have to call
rfbProcessEvents for each of these.
Per-screen (framebuffer) structure. There can be as many as you wish,
each serving different clients. However, you have to call
rfbProcessEvents for each of these.
Security handling (RFB protocol version 3.7)
Status determines if the X11 server permits input from the local user
status==0 or 1
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
of that window
Handle the textchat messages
rfbTranslateFnType is the type of translation functions.