-
Notifications
You must be signed in to change notification settings - Fork 0
/
rfb_client.h
70 lines (45 loc) · 1.54 KB
/
rfb_client.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef _WDL_RFBCLIENT_H_
#define _WDL_RFBCLIENT_H_
#include "wdlstring.h"
#include "queue.h"
#include "jnetlib/jnetlib.h"
#include "lice/lice.h"
class WDL_RFB_Client
{
public:
WDL_RFB_Client(JNL_IConnection *con, const char *password);
~WDL_RFB_Client();
int GetScreenWidth() { return m_screen_w; }
int GetScreenHeight() { return m_screen_h; }
int Run(); // <0 on disconnect,
const char *GetError() { return m_errstr; }
void Invalidate() { m_needref=2; } // tell server to re-send
void SetUpdateRegion(int x, int y, int w, int h) // if w or h are 0 then whole screen is used
{
m_req_x=x;
m_req_y=y;
m_req_w=w;
m_req_h=h;
}
void RequestUpdate() { m_needref|=1; }
void *instance_data;
void (*DrawRectangleCallback)(WDL_RFB_Client *_this, LICE_IBitmap *drawimg, int dest_x, int dest_y, int dest_w, int dest_h);
private:
enum { ErrorState=-1, InitialState=0, AuthWaitState, AuthWaitState2, ServerInitState, RunState, RunState_GettingRects};
int m_remote_ver; // xxxyyy
int m_state;
time_t m_lastt;
const char *m_errstr;
WDL_String m_password;
JNL_IConnection *m_con;
int m_screen_w, m_screen_h;
int m_req_x,m_req_y,m_req_w,m_req_h, m_needref;
WDL_TypedBuf<char> m_namebuf;
WDL_TypedQueue<unsigned char> m_msg_buf;
int m_skipdata;
int m_msg_state; // state specific value / data
unsigned int GetBE(int nb=4, int queueoffs=0, bool advance=true);
LICE_MemBitmap m_bm;
char tmperrbuf[128];
};
#endif//_WDL_RFBCLIENT_H_