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 SetUnpackColormap_H 27 #define SetUnpackColormap_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 SETUNPACKCOLORMAP_ENABLE_CACHE 1 46 #define SETUNPACKCOLORMAP_ENABLE_DATA 1 47 48 #define SETUNPACKCOLORMAP_DATA_LIMIT 4096 49 50 #define SETUNPACKCOLORMAP_CACHE_SLOTS 2000 51 #define SETUNPACKCOLORMAP_CACHE_THRESHOLD 5 52 #define SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD 0 53 54 #define SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7 16 55 #define SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 56 57 #define SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8 0 58 59 // 60 // The message class. 61 // 62 63 class SetUnpackColormapMessage : public Message 64 { 65 friend class SetUnpackColormapStore; 66 67 public: 68 SetUnpackColormapMessage()69 SetUnpackColormapMessage() 70 { 71 } 72 ~SetUnpackColormapMessage()73 ~SetUnpackColormapMessage() 74 { 75 } 76 77 // 78 // Put here the fields which constitute 79 // the 'identity' part of the message. 80 // 81 82 private: 83 84 unsigned char client; 85 unsigned char method; 86 87 unsigned int src_length; 88 unsigned int dst_length; 89 }; 90 91 class SetUnpackColormapStore : public MessageStore 92 { 93 public: 94 95 SetUnpackColormapStore(StaticCompressor *compressor); 96 97 virtual ~SetUnpackColormapStore(); 98 name()99 virtual const char *name() const 100 { 101 return "SetUnpackColormap"; 102 } 103 opcode()104 virtual unsigned char opcode() const 105 { 106 return X_NXSetUnpackColormap; 107 } 108 storage()109 virtual unsigned int storage() const 110 { 111 return sizeof(SetUnpackColormapMessage); 112 } 113 114 // 115 // Message handling methods. 116 // 117 118 protected: 119 create()120 virtual Message *create() const 121 { 122 return new SetUnpackColormapMessage(); 123 } 124 create(const Message & message)125 virtual Message *create(const Message &message) const 126 { 127 return new SetUnpackColormapMessage((const SetUnpackColormapMessage &) message); 128 } 129 destroy(Message * message)130 virtual void destroy(Message *message) const 131 { 132 delete (SetUnpackColormapMessage *) message; 133 } 134 135 virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, 136 const unsigned int size, int bigEndian, 137 ChannelCache *channelCache) const; 138 139 virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, 140 unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, 141 ChannelCache *channelCache) const; 142 143 virtual int parseIdentity(Message *message, const unsigned char *buffer, 144 unsigned int size, int bigEndian) const; 145 146 virtual int unparseIdentity(const Message *message, unsigned char *buffer, 147 unsigned int size, int bigEndian) const; 148 149 virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, 150 const Message *cachedMessage, 151 ChannelCache *channelCache) const; 152 153 virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, 154 ChannelCache *channelCache) const; 155 156 virtual void identityChecksum(const Message *message, const unsigned char *buffer, 157 unsigned int size, int bigEndian) const; 158 159 virtual void dumpIdentity(const Message *message) const; 160 }; 161 162 #endif /* SetUnpackColormap_H */ 163