1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ 4 /* */ 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. */ 9 /* */ 10 /* Check http://www.nomachine.com/licensing.html for applicability. */ 11 /* */ 12 /* NX and NoMachine are trademarks of Medialogic S.p.A. */ 13 /* */ 14 /* All rights reserved. */ 15 /* */ 16 /**************************************************************************/ 17 18 #ifndef SetUnpackGeometry_H 19 #define SetUnpackGeometry_H 20 21 #include "Message.h" 22 23 // 24 // Set the verbosity level. 25 // 26 27 #define PANIC 28 #define WARNING 29 #undef TEST 30 #undef DEBUG 31 #undef DUMP 32 33 // 34 // Set default values. 35 // 36 37 #define SETUNPACKGEOMETRY_ENABLE_CACHE 1 38 #define SETUNPACKGEOMETRY_ENABLE_DATA 0 39 #define SETUNPACKGEOMETRY_ENABLE_SPLIT 0 40 #define SETUNPACKGEOMETRY_ENABLE_COMPRESS 0 41 42 #define SETUNPACKGEOMETRY_DATA_LIMIT 24 43 #define SETUNPACKGEOMETRY_DATA_OFFSET 24 44 45 #define SETUNPACKGEOMETRY_CACHE_SLOTS 20 46 #define SETUNPACKGEOMETRY_CACHE_THRESHOLD 1 47 #define SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD 0 48 49 // 50 // The message class. 51 // 52 53 class SetUnpackGeometryMessage : public Message 54 { 55 friend class SetUnpackGeometryStore; 56 57 public: 58 SetUnpackGeometryMessage()59 SetUnpackGeometryMessage() 60 { 61 } 62 ~SetUnpackGeometryMessage()63 ~SetUnpackGeometryMessage() 64 { 65 } 66 67 // 68 // Put here the fields which constitute 69 // the 'identity' part of the message. 70 // 71 72 private: 73 74 unsigned char client; 75 76 unsigned char depth_1_bpp; 77 unsigned char depth_4_bpp; 78 unsigned char depth_8_bpp; 79 unsigned char depth_16_bpp; 80 unsigned char depth_24_bpp; 81 unsigned char depth_32_bpp; 82 83 unsigned int red_mask; 84 unsigned int green_mask; 85 unsigned int blue_mask; 86 }; 87 88 class SetUnpackGeometryStore : public MessageStore 89 { 90 public: 91 92 SetUnpackGeometryStore(StaticCompressor *compressor); 93 94 virtual ~SetUnpackGeometryStore(); 95 name()96 virtual const char *name() const 97 { 98 return "SetUnpackGeometry"; 99 } 100 opcode()101 virtual unsigned char opcode() const 102 { 103 return X_NXSetUnpackGeometry; 104 } 105 storage()106 virtual unsigned int storage() const 107 { 108 return sizeof(SetUnpackGeometryMessage); 109 } 110 111 // 112 // Message handling methods. 113 // 114 115 protected: 116 create()117 virtual Message *create() const 118 { 119 return new SetUnpackGeometryMessage(); 120 } 121 create(const Message & message)122 virtual Message *create(const Message &message) const 123 { 124 return new SetUnpackGeometryMessage((const SetUnpackGeometryMessage &) message); 125 } 126 destroy(Message * message)127 virtual void destroy(Message *message) const 128 { 129 delete (SetUnpackGeometryMessage *) message; 130 } 131 132 virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, 133 const unsigned int size, int bigEndian, 134 ChannelCache *channelCache) const; 135 136 virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, 137 unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, 138 ChannelCache *channelCache) const; 139 140 virtual int parseIdentity(Message *message, const unsigned char *buffer, 141 unsigned int size, int bigEndian) const; 142 143 virtual int unparseIdentity(const Message *message, unsigned char *buffer, 144 unsigned int size, int bigEndian) const; 145 146 virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, 147 const Message *cachedMessage, 148 ChannelCache *channelCache) const; 149 150 virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, 151 ChannelCache *channelCache) const; 152 153 virtual void identityChecksum(const Message *message, const unsigned char *buffer, 154 unsigned int size, int bigEndian) const; 155 156 virtual void dumpIdentity(const Message *message) const; 157 }; 158 159 #endif /* SetUnpackGeometry_H */ 160