Go to the source code of this file.
Macros | |
#define | USYNERGY_IS_PACKET(pkt_id) memcmp(message+4, pkt_id, 4)==0 |
Parse a single client message, update state, send callbacks and send replies. More... | |
Functions | |
static void | sAddString (uSynergyContext *context, const char *string) |
Add string to reply packet. More... | |
static void | sAddUInt16 (uSynergyContext *context, uint16_t value) |
Add uint16 to reply packet. More... | |
static void | sAddUInt32 (uSynergyContext *context, uint32_t value) |
Add uint32 to reply packet. More... | |
static void | sAddUInt8 (uSynergyContext *context, uint8_t value) |
Add uint8 to reply packet. More... | |
static int16_t | sNetToNative16 (const unsigned char *value) |
Read 16 bit integer in network byte order and convert to native byte order. More... | |
static int32_t | sNetToNative32 (const unsigned char *value) |
Read 32 bit integer in network byte order and convert to native byte order. More... | |
static void | sProcessMessage (uSynergyContext *context, const uint8_t *message) |
static void | sSendJoystickCallback (uSynergyContext *context, uint8_t joyNum) |
Send joystick callback. More... | |
static void | sSendKeyboardCallback (uSynergyContext *context, uint16_t key, uint16_t modifiers, uSynergyBool down, uSynergyBool repeat) |
Send keyboard callback when a key has been pressed or released. More... | |
static void | sSendMouseCallback (uSynergyContext *context) |
Call mouse callback after a mouse event. More... | |
static uSynergyBool | sSendReply (uSynergyContext *context) |
Send reply packet. More... | |
static void | sSetDisconnected (uSynergyContext *context) |
Mark context as being disconnected. More... | |
static void | sTrace (uSynergyContext *context, const char *text) |
Trace text to client. More... | |
static void | sUpdateContext (uSynergyContext *context) |
Update a connected context. More... | |
void | uSynergyInit (uSynergyContext *context) |
Initialize uSynergy context. More... | |
void | uSynergySendClipboard (uSynergyContext *context, const char *text) |
Send clipboard data. More... | |
void | uSynergyUpdate (uSynergyContext *context) |
Update uSynergy. More... | |
#define USYNERGY_IS_PACKET | ( | pkt_id | ) | memcmp(message+4, pkt_id, 4)==0 |
Parse a single client message, update state, send callbacks and send replies.
Definition at line 205 of file uSynergy.c.
|
static |
Add string to reply packet.
Definition at line 81 of file uSynergy.c.
|
static |
Add uint16 to reply packet.
Definition at line 103 of file uSynergy.c.
|
static |
Add uint32 to reply packet.
Definition at line 116 of file uSynergy.c.
|
static |
Add uint8 to reply packet.
Definition at line 93 of file uSynergy.c.
|
static |
Read 16 bit integer in network byte order and convert to native byte order.
Definition at line 41 of file uSynergy.c.
|
static |
Read 32 bit integer in network byte order and convert to native byte order.
Definition at line 55 of file uSynergy.c.
|
static |
Definition at line 206 of file uSynergy.c.
|
static |
Send joystick callback.
Definition at line 187 of file uSynergy.c.
|
static |
Send keyboard callback when a key has been pressed or released.
Definition at line 172 of file uSynergy.c.
|
static |
Call mouse callback after a mouse event.
Definition at line 156 of file uSynergy.c.
|
static |
Send reply packet.
Definition at line 131 of file uSynergy.c.
|
static |
Mark context as being disconnected.
Definition at line 462 of file uSynergy.c.
|
static |
Trace text to client.
Definition at line 69 of file uSynergy.c.
|
static |
Update a connected context.
Definition at line 476 of file uSynergy.c.
void uSynergyInit | ( | uSynergyContext * | context | ) |
Initialize uSynergy context.
This function initializes context for use. Call this function directly after creating the context, before filling in any configuration data in it. Not calling this function will cause undefined behavior.
context | Context to be initialized |
Definition at line 570 of file uSynergy.c.
void uSynergySendClipboard | ( | uSynergyContext * | context, |
const char * | text | ||
) |
Send clipboard data.
This function sets new clipboard data and sends it to the server. Use this function if your client cuts or copies data onto the clipboard that it needs to share with the server.
Currently there is only support for plaintext, but HTML and image data could be supported with some effort.
context | Context to send clipboard data to |
text | Text to set to the clipboard |
Definition at line 603 of file uSynergy.c.
void uSynergyUpdate | ( | uSynergyContext * | context | ) |
Update uSynergy.
This function updates uSynergy and does the bulk of the work. It does connection management, receiving data, reconnecting after errors or timeouts and so on. It assumes that networking operations are blocking and it can suspend the current thread if it needs to wait. It is best practice to call uSynergyUpdate from a background thread so it is responsive.
Because uSynergy relies mostly on blocking calls it will mostly stay in thread sleep state waiting for system mutexes and won't eat much memory.
uSynergyUpdate doesn't do any memory allocations or have any side effects beyond those of the callbacks it calls.
context | Context to be updated |
Definition at line 583 of file uSynergy.c.