-
Notifications
You must be signed in to change notification settings - Fork 7
/
XrdpUlalacaPrivate.hpp
133 lines (102 loc) · 3.32 KB
/
XrdpUlalacaPrivate.hpp
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#ifndef XRDP_XRDPULALACAPRIVATE_HPP
#define XRDP_XRDPULALACAPRIVATE_HPP
#include <queue>
#include <mutex>
#if defined(HAVE_CONFIG_H)
#include <config_ac.h>
#endif
extern "C" {
#include "arch.h"
#include "parse.h"
#include "os_calls.h"
#include "defines.h"
#include "guid.h"
#include "xrdp_client_info.h"
};
#include "XrdpEvent.hpp"
#include "XrdpTransport.hpp"
#include "XrdpStream.hpp"
#include "UnixSocket.hpp"
#include "ProjectionTarget.hpp"
struct XrdpUlalaca;
class ProjectorClient;
namespace ulalaca {
class ULSurfaceTransaction;
class ULSurface;
}
class XrdpUlalacaPrivate: public ProjectionTarget {
public:
// FIXME: is there TWO VERSION FIELDS??? (see ulalaca.hpp)
static const std::string XRDP_ULALACA_VERSION;
constexpr static const int NO_ERROR = 0;
explicit XrdpUlalacaPrivate(XrdpUlalaca *mod);
XrdpUlalacaPrivate(XrdpUlalacaPrivate &) = delete;
~XrdpUlalacaPrivate();
public:
/* lib_mod_* */
int libModStart(int width, int height, int bpp);
int libModConnect();
int libModEvent(int type, long arg1, long arg2, long arg3, long arg4);
int libModSignal();
int libModEnd();
int libModSetParam(const char *cstrName, const char *cstrValue);
int libModSessionChange(int, int);
int libModGetWaitObjs(tbus *readObjs, int *rcount,
tbus *writeObjs, int *wcount, int *timeout);
int libModCheckWaitObjs();
int libModFrameAck(int flags, int frameId);
int libModSuppressOutput(int suppress,
int left, int top, int right, int bottom);
int libModServerMonitorResize(int width, int height);
int libModServerMonitorFullInvalidate(int width, int height);
int libModServerVersionMessage();
public:
/* utility methods / lib_server_* wrappers */
void serverMessage(const char *message, int code);
/**
* attach to projector session
*/
void attachToSession(std::string sessionPath);
int decideCopyRectSize() const;
void addDirtyRect(ULIPCRect &rect) override;
void commitUpdate(const uint8_t *image, size_t size, int32_t width, int32_t height) override;
void ipcDisconnected() override;
void updateThreadLoop();
/**
* TODO: add support for multiple displays
*/
void setSessionSize(int width, int height);
void calculateSessionSize();
inline bool isNSCodec() const;
inline bool isRFXCodec() const;
inline bool isJPEGCodec() const;
inline bool isH264Codec() const;
inline bool isGFXH264Codec() const;
inline bool isRawBitmap() const;
private:
XrdpUlalaca *_mod;
int _error = 0;
bool _isUpdateThreadRunning;
ULIPCRect _sessionSize;
std::vector<ULIPCRect> _screenLayouts;
int _bpp;
std::string _username;
std::string _password;
std::string _ip;
std::string _port;
int _keyLayout;
int _delayMs;
guid _guid;
int _encodingsMask;
xrdp_client_info _clientInfo;
std::unique_ptr<UnixSocket> _socket;
std::unique_ptr<ProjectorClient> _projectorClient;
std::unique_ptr<ulalaca::ULSurface> _surface;
std::vector<ULIPCRect> _dirtyRects;
std::unique_ptr<std::thread> _updateThread;
tintptr _updateWaitObj;
std::mutex _updateQueueMutex;
std::condition_variable _updateQueueCondvar;
std::queue<std::unique_ptr<ulalaca::ULSurfaceTransaction>> _updateQueue;
};
#endif