1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ 4 /* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */ 5 /* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */ 6 /* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */ 7 /* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/ 8 /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ 9 /* */ 10 /* NXCOMP, NX protocol compression and NX extensions to this software */ 11 /* are copyright of the aforementioned persons and companies. */ 12 /* */ 13 /* Redistribution and use of the present software is allowed according */ 14 /* to terms specified in the file LICENSE.nxcomp which comes in the */ 15 /* source distribution. */ 16 /* */ 17 /* All rights reserved. */ 18 /* */ 19 /* NOTE: This software has received contributions from various other */ 20 /* contributors, only the core maintainers and supporters are listed as */ 21 /* copyright holders. Please contact us, if you feel you should be listed */ 22 /* as copyright holder, as well. */ 23 /* */ 24 /**************************************************************************/ 25 26 #ifndef PolyFillArc_H 27 #define PolyFillArc_H 28 29 #include "Message.h" 30 31 // 32 // Set the verbosity level. 33 // 34 35 #define PANIC 36 #define WARNING 37 #undef TEST 38 #undef DEBUG 39 #undef DUMP 40 41 // 42 // Set default values. 43 // 44 45 #define POLYFILLARC_ENABLE_CACHE 1 46 #define POLYFILLARC_ENABLE_DATA 0 47 #define POLYFILLARC_ENABLE_SPLIT 0 48 #define POLYFILLARC_ENABLE_COMPRESS 0 49 50 #define POLYFILLARC_DATA_LIMIT 6144 51 #define POLYFILLARC_DATA_OFFSET 12 52 53 #define POLYFILLARC_CACHE_SLOTS 2000 54 #define POLYFILLARC_CACHE_THRESHOLD 2 55 #define POLYFILLARC_CACHE_LOWER_THRESHOLD 1 56 57 // 58 // The message class. 59 // 60 61 class PolyFillArcMessage : public Message 62 { 63 friend class PolyFillArcStore; 64 65 public: 66 PolyFillArcMessage()67 PolyFillArcMessage() 68 { 69 } 70 ~PolyFillArcMessage()71 ~PolyFillArcMessage() 72 { 73 } 74 75 // 76 // Put here the fields which constitute 77 // the 'identity' part of the message. 78 // 79 80 private: 81 82 unsigned int drawable; 83 unsigned int gcontext; 84 }; 85 86 class PolyFillArcStore : public MessageStore 87 { 88 // 89 // Constructors and destructors. 90 // 91 92 public: 93 PolyFillArcStore()94 PolyFillArcStore() : MessageStore() 95 { 96 enableCache = POLYFILLARC_ENABLE_CACHE; 97 enableData = POLYFILLARC_ENABLE_DATA; 98 enableSplit = POLYFILLARC_ENABLE_SPLIT; 99 enableCompress = POLYFILLARC_ENABLE_COMPRESS; 100 101 dataLimit = POLYFILLARC_DATA_LIMIT; 102 dataOffset = POLYFILLARC_DATA_OFFSET; 103 104 cacheSlots = POLYFILLARC_CACHE_SLOTS; 105 cacheThreshold = POLYFILLARC_CACHE_THRESHOLD; 106 cacheLowerThreshold = POLYFILLARC_CACHE_LOWER_THRESHOLD; 107 108 messages_ -> resize(cacheSlots); 109 110 for (T_messages::iterator i = messages_ -> begin(); 111 i < messages_ -> end(); i++) 112 { 113 *i = NULL; 114 } 115 116 temporary_ = NULL; 117 } 118 ~PolyFillArcStore()119 virtual ~PolyFillArcStore() 120 { 121 for (T_messages::iterator i = messages_ -> begin(); 122 i < messages_ -> end(); i++) 123 { 124 destroy(*i); 125 } 126 127 destroy(temporary_); 128 } 129 name()130 virtual const char *name() const 131 { 132 return "PolyFillArc"; 133 } 134 opcode()135 virtual unsigned char opcode() const 136 { 137 return X_PolyFillArc; 138 } 139 storage()140 virtual unsigned int storage() const 141 { 142 return sizeof(PolyFillArcMessage); 143 } 144 145 // 146 // Message handling methods. 147 // 148 149 public: 150 create()151 virtual Message *create() const 152 { 153 return new PolyFillArcMessage(); 154 } 155 create(const Message & message)156 virtual Message *create(const Message &message) const 157 { 158 return new PolyFillArcMessage((const PolyFillArcMessage &) message); 159 } 160 destroy(Message * message)161 virtual void destroy(Message *message) const 162 { 163 delete (PolyFillArcMessage *) message; 164 } 165 166 virtual int parseIdentity(Message *message, const unsigned char *buffer, 167 unsigned int size, int bigEndian) const; 168 169 virtual int unparseIdentity(const Message *message, unsigned char *buffer, 170 unsigned int size, int bigEndian) const; 171 172 virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, 173 const Message *cachedMessage, 174 ChannelCache *channelCache) const; 175 176 virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, 177 ChannelCache *channelCache) const; 178 179 virtual void identityChecksum(const Message *message, const unsigned char *buffer, 180 unsigned int size, int bigEndian) const; 181 182 virtual void dumpIdentity(const Message *message) const; 183 }; 184 185 #endif /* PolyFillArc_H */ 186