1
/**************************************************************************/
3
/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */
5
/* NXCOMP, NX protocol compression and NX extensions to this software */
6
/* are copyright of NoMachine. Redistribution and use of the present */
7
/* software is allowed according to terms specified in the file LICENSE */
8
/* which comes in the source distribution. */
10
/* Check http://www.nomachine.com/licensing.html for applicability. */
12
/* NX and NoMachine are trademarks of NoMachine S.r.l. */
14
/* All rights reserved. */
16
/**************************************************************************/
24
// Set the verbosity level.
34
// Set default values.
37
#define POLYARC_ENABLE_CACHE 1
38
#define POLYARC_ENABLE_DATA 0
39
#define POLYARC_ENABLE_SPLIT 0
40
#define POLYARC_ENABLE_COMPRESS 0
42
#define POLYARC_DATA_LIMIT 1980
43
#define POLYARC_DATA_OFFSET 12
45
#define POLYARC_CACHE_SLOTS 2000
46
#define POLYARC_CACHE_THRESHOLD 2
47
#define POLYARC_CACHE_LOWER_THRESHOLD 1
53
class PolyArcMessage : public Message
55
friend class PolyArcStore;
68
// Put here the fields which constitute
69
// the 'identity' part of the message.
74
unsigned int drawable;
75
unsigned int gcontext;
78
class PolyArcStore : public MessageStore
81
// Constructors and destructors.
86
PolyArcStore() : MessageStore()
88
enableCache = POLYARC_ENABLE_CACHE;
89
enableData = POLYARC_ENABLE_DATA;
90
enableSplit = POLYARC_ENABLE_SPLIT;
91
enableCompress = POLYARC_ENABLE_COMPRESS;
93
dataLimit = POLYARC_DATA_LIMIT;
94
dataOffset = POLYARC_DATA_OFFSET;
96
cacheSlots = POLYARC_CACHE_SLOTS;
97
cacheThreshold = POLYARC_CACHE_THRESHOLD;
98
cacheLowerThreshold = POLYARC_CACHE_LOWER_THRESHOLD;
100
messages_ -> resize(cacheSlots);
102
for (T_messages::iterator i = messages_ -> begin();
103
i < messages_ -> end(); i++)
111
virtual ~PolyArcStore()
113
for (T_messages::iterator i = messages_ -> begin();
114
i < messages_ -> end(); i++)
122
virtual const char *name() const
127
virtual unsigned char opcode() const
132
virtual unsigned int storage() const
134
return sizeof(PolyArcMessage);
138
// Message handling methods.
143
virtual Message *create() const
145
return new PolyArcMessage();
148
virtual Message *create(const Message &message) const
150
return new PolyArcMessage((const PolyArcMessage &) message);
153
virtual void destroy(Message *message) const
155
delete (PolyArcMessage *) message;
158
virtual int parseIdentity(Message *message, const unsigned char *buffer,
159
unsigned int size, int bigEndian) const;
161
virtual int unparseIdentity(const Message *message, unsigned char *buffer,
162
unsigned int size, int bigEndian) const;
164
virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
165
const Message *cachedMessage,
166
ChannelCache *channelCache) const;
168
virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
169
ChannelCache *channelCache) const;
171
virtual void identityChecksum(const Message *message, const unsigned char *buffer,
172
unsigned int size, int bigEndian) const;
174
virtual void dumpIdentity(const Message *message) const;
177
#endif /* PolyArc_H */