Go to the documentation of this file.
43 #ifdef USYNERGY_LITTLE_ENDIAN
57 #ifdef USYNERGY_LITTLE_ENDIAN
83 size_t len = strlen(
string);
106 *reply++ = (uint8_t)(
value >> 8);
107 *reply++ = (uint8_t)
value;
119 *reply++ = (uint8_t)(
value >> 24);
120 *reply++ = (uint8_t)(
value >> 16);
121 *reply++ = (uint8_t)(
value >> 8);
122 *reply++ = (uint8_t)
value;
135 uint32_t reply_len = (uint32_t)(context->
m_replyCur - reply_buf);
136 uint32_t body_len = reply_len - 4;
138 reply_buf[0] = (uint8_t)(body_len >> 24);
139 reply_buf[1] = (uint8_t)(body_len >> 16);
140 reply_buf[2] = (uint8_t)(body_len >> 8);
141 reply_buf[3] = (uint8_t)body_len;
205 #define USYNERGY_IS_PACKET(pkt_id) memcmp(message+4, pkt_id, 4)==0
209 if (memcmp(
message+4,
"Synergy", 7)==0)
222 sTrace(context,
"SendReply failed, trying to reconnect in a second");
241 uint16_t
x = 0,
y = 0, warp = 0;
414 const uint8_t * parse_msg =
message+17;
417 for (; num_formats; num_formats--)
455 #undef USYNERGY_IS_PACKET
480 int num_received = 0;
486 sprintf(
buffer,
"Receive failed (%d bytes asked, %d bytes received), trying to reconnect in a second", receive_size, num_received);
497 if (num_received == 0)
504 if (num_received == 0)
538 while (num_received != packlen)
540 int buffer_left = packlen - num_received;
542 int ditch_received = 0;
546 sTrace(context,
"Receive failed, trying to reconnect in a second");
553 num_received += ditch_received;
606 uint32_t overhead_size = 4 +
617 uint32_t text_length = (uint32_t)strlen(text);
618 if (text_length > max_length)
621 sprintf(
buffer,
"Clipboard buffer too small, clipboard truncated at %d characters", max_length);
623 text_length = max_length;
#define USYNERGY_REPLY_BUFFER_SIZE
static void sTrace(uSynergyContext *context, const char *text)
Trace text to client.
uint8_t m_replyBuffer[USYNERGY_REPLY_BUFFER_SIZE]
const char * m_clientName
uint32_t m_sequenceNumber
#define USYNERGY_IS_PACKET(pkt_id)
Parse a single client message, update state, send callbacks and send replies.
static void sSendMouseCallback(uSynergyContext *context)
Call mouse callback after a mouse event.
static void sSendJoystickCallback(uSynergyContext *context, uint8_t joyNum)
Send joystick callback.
#define USYNERGY_PROTOCOL_MAJOR
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.
#define USYNERGY_IDLE_TIMEOUT
uSynergyTraceFunc m_traceFunc
static void sSetDisconnected(uSynergyContext *context)
Mark context as being disconnected.
static void sProcessMessage(uSynergyContext *context, const uint8_t *message)
uSynergyClipboardCallback m_clipboardCallback
static int16_t sNetToNative16(const unsigned char *value)
Read 16 bit integer in network byte order and convert to native byte order.
@ USYNERGY_CLIPBOARD_FORMAT_TEXT
static int32_t sNetToNative32(const unsigned char *value)
Read 32 bit integer in network byte order and convert to native byte order.
uSynergySendFunc m_sendFunc
uSynergyBool m_mouseButtonMiddle
GLint GLint GLsizei GLint GLenum format
uSynergyBool m_mouseButtonRight
uSynergyJoystickCallback m_joystickCallback
#define USYNERGY_NUM_JOYSTICKS
Constants and limits.
uSynergyBool m_hasReceivedHello
uint32_t m_lastMessageTime
static void sAddString(uSynergyContext *context, const char *string)
Add string to reply packet.
uint8_t m_receiveBuffer[USYNERGY_RECEIVE_BUFFER_SIZE]
uSynergyReceiveFunc m_receiveFunc
static void sAddUInt32(uSynergyContext *context, uint32_t value)
Add uint32 to reply packet.
void uSynergyUpdate(uSynergyContext *context)
Update uSynergy.
const SETUP_TEARDOWN_TESTCONTEXT char * key
void uSynergyInit(uSynergyContext *context)
Initialize uSynergy context.
static void sUpdateContext(uSynergyContext *context)
Update a connected context.
uSynergyConnectFunc m_connectFunc
static void sAddUInt8(uSynergyContext *context, uint8_t value)
Add uint8 to reply packet.
uSynergyGetTimeFunc m_getTimeFunc
uSynergyMouseCallback m_mouseCallback
static uSynergyBool sSendReply(uSynergyContext *context)
Send reply packet.
#define USYNERGY_PROTOCOL_MINOR
uSynergyScreenActiveCallback m_screenActiveCallback
void uSynergySendClipboard(uSynergyContext *context, const char *text)
Send clipboard data.
uSynergyBool m_isCaptured
uSynergyBool m_mouseButtonLeft
uint16_t m_joystickButtons[USYNERGY_NUM_JOYSTICKS]
uSynergyKeyboardCallback m_keyboardCallback
GLsizei const GLfloat * value
static void sAddUInt16(uSynergyContext *context, uint16_t value)
Add uint16 to reply packet.
uSynergySleepFunc m_sleepFunc
#define USYNERGY_RECEIVE_BUFFER_SIZE
GLenum GLuint GLenum GLsizei const GLchar * message
int8_t m_joystickSticks[USYNERGY_NUM_JOYSTICKS][4]
int uSynergyBool
Boolean type.
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:01