VNCviewGS/vncsession.h
Stephen Heumann e1288f7e1b Small refactoring to reduce boilerplate code
DoReadTCP automatically disposes the old read buffer handle before doing the read, and then locks the new read buffer handle before returning. This removes the need for most explicit locking/unlocking of the handle. A macro is provided to dispose of the handle earlier (useful in a few cases where it may be big, and another read isn't immediately performed).

Also, set displayInProgress to FALSE in NextRect, rather than in code for each encoding.
2016-05-28 21:59:35 -05:00

36 lines
1.2 KiB
C

/********************************************************************
* vncsession.h - functions for establishing connection to VNC server
* and communicating with it
********************************************************************/
#include <types.h>
#define RFBVERSIONSTR "RFB 003.003\n"
#define RFBMAJORVERSIONSTR "003"
#define SwapBytes2(x) (((unsigned int)x << 8) | ((unsigned int)x >> 8))
#define SwapBytes4(x) (((unsigned long)x << 24) | \
((unsigned long)x >> 24) | \
(((unsigned long)x & 0x0000FF00) << 8) | \
(((unsigned long)x & 0x00FF0000) >> 8))
extern GrafPortPtr connectStatusWindowPtr;
extern void ** readBufferHndl;
extern unsigned int hostIpid;
extern void DisplayConnectStatus(char *, BOOLEAN);
extern void DoConnect (void);
#define DoneWithReadBuffer() do \
if (readBufferHndl) { \
DisposeHandle(readBufferHndl); \
readBufferHndl = NULL; \
} while (0) \
extern BOOLEAN DoReadTCP (unsigned long);
extern BOOLEAN DoWaitingReadTCP(unsigned long);
extern void CloseTCPConnection (void);