minput-hop
Tiny client library for Synergy KVM and derivatives.
Loading...
Searching...
No Matches
synproto.h
Go to the documentation of this file.
1
2#ifndef SYNPROTO_H
3#define SYNPROTO_H
4
10#include "minput.h"
11
12#ifndef SYNPROTO_TIMEOUT_MS
14# define SYNPROTO_TIMEOUT_MS 5000
15#endif /* !SYNPROTO_TIMEOUT_MS */
16
17#ifdef SYNPROTO_ENDIAN
18# define swap_32( num ) (num)
19# define swap_16( num ) (num)
20#else
21
25#define swap_32( num ) ((((num)>>24)&0xff) | (((num)<<8)&0xff0000) | (((num)>>8)&0xff00) | (((num)<<24)&0xff000000))
26
30#define swap_16( num ) (((num)>>8) | ((num)<<8))
31
32#endif
33
39#define synproto_exval_32( buffer, offset ) \
40 (swap_32( *((uint32_t*)&(buffer[offset])) ))
41
47#define synproto_exval_16( buffer, offset ) \
48 (swap_16( *((uint16_t*)&(buffer[offset])) ))
49
50#define synproto_exval_8( buffer, offset ) (buffer[offset])
51
56void synproto_dump( const char* buf, size_t buf_sz );
57
74 char* buf, size_t buf_sz, const char* fmt, va_list vargs );
75
85uint32_t synproto_send( int sockfd, uint8_t force_sz, const char* fmt, ... );
86
94 struct NETIO_CFG* config, const char* pkt_buf, uint32_t pkt_buf_sz );
95
96void synproto_reset_calv_deadline( struct NETIO_CFG* config );
97
98#endif /* SYNPROTO_H */
99
uint32_t synproto_send(int sockfd, uint8_t force_sz, const char *fmt,...)
Send a formatted string to the Synergy server with tokens as specified for synproto_vprintf().
int synproto_parse_and_reply(struct NETIO_CFG *config, const char *pkt_buf, uint32_t pkt_buf_sz)
Given a buffer with a string from the Synergy server, parse it and respond or simulate OS activity as...
size_t synproto_vprintf(char *buf, size_t buf_sz, const char *fmt, va_list vargs)
Given a format string and tokens, write those tokens into a buffer using specific tokens listed here.
void synproto_dump(const char *buf, size_t buf_sz)
Given a buffer with a string from the Synergy server, dump it into a more human-readable form.