From 3e924126b56c4d421e8263d25f6b14aa4ceed047 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Sun, 13 Nov 2011 09:27:51 +0100 Subject: Imported nxcomp-3.1.0-4.tar.gz Summary: Imported nxcomp-3.1.0-4.tar.gz Keywords: Imported nxcomp-3.1.0-4.tar.gz into Git repository --- nxcomp/Types.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 255 insertions(+) create mode 100755 nxcomp/Types.h (limited to 'nxcomp/Types.h') diff --git a/nxcomp/Types.h b/nxcomp/Types.h new file mode 100755 index 000000000..4afc93911 --- /dev/null +++ b/nxcomp/Types.h @@ -0,0 +1,255 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of NoMachine. Redistribution and use of the present */ +/* software is allowed according to terms specified in the file LICENSE */ +/* which comes in the source distribution. */ +/* */ +/* Check http://www.nomachine.com/licensing.html for applicability. */ +/* */ +/* NX and NoMachine are trademarks of NoMachine S.r.l. */ +/* */ +/* All rights reserved. */ +/* */ +/**************************************************************************/ + +#ifndef Types_H +#define Types_H + +using namespace std; + +#include +#include +#include +#include + +#include "MD5.h" + +// +// This is MD5 length. +// + +#define MD5_LENGTH 16 + +// +// Types of repositories. Replace the original +// clear() methods from STL in order to actually +// free the unused memory. +// + +class Message; + +class T_data : public vector < unsigned char > +{ + public: + + unsigned char *begin() + { + return &*(vector < unsigned char >::begin()); + } + + const unsigned char *begin() const + { + return &*(vector < unsigned char >::begin()); + } + + void clear() + { + #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) + + #if defined(__GLIBCPP_INTERNAL_VECTOR_H) + + _Destroy(_M_start, _M_finish); + + #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + destroy(_M_start, _M_finish); + + #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + + _M_start = _M_finish = _M_end_of_storage = 0; + + #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + #if defined(_GLIBCXX_VECTOR) + + _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); + + _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); + + this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; + + #else /* #if defined(_GLIBCXX_VECTOR) */ + + destroy(start, finish); + + deallocate(); + + start = finish = end_of_storage = 0; + + #endif /* #if defined(_GLIBCXX_VECTOR) */ + + #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + } +}; + +class T_messages : public vector < Message * > +{ + public: + + void clear() + { + #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) + + #if defined(__GLIBCPP_INTERNAL_VECTOR_H) + + _Destroy(_M_start, _M_finish); + + #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + destroy(_M_start, _M_finish); + + #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + + _M_start = _M_finish = _M_end_of_storage = 0; + + #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + #if defined(_GLIBCXX_VECTOR) + + _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); + + _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); + + this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; + + #else /* #if defined(_GLIBCXX_VECTOR) */ + + destroy(start, finish); + + deallocate(); + + start = finish = end_of_storage = 0; + + #endif /* #if defined(_GLIBCXX_VECTOR) */ + + #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + } +}; + +typedef md5_byte_t * T_checksum; + +struct T_less +{ + bool operator()(T_checksum a, T_checksum b) const + { + return (memcmp(a, b, MD5_LENGTH) < 0); + } +}; + +typedef map < T_checksum, int, T_less > T_checksums; + +class Split; + +typedef list < Split * > T_splits; + +class File; + +struct T_older +{ + bool operator()(File *a, File *b) const; +}; + +typedef set < File *, T_older > T_files; + +typedef list < int > T_list; + +// +// Used to accomodate data to be read and +// written to a socket. +// + +typedef struct +{ + T_data data_; + int length_; + int start_; +} +T_buffer; + +// +// The message store operation that was +// executed for the message. The channels +// use these values to determine how to +// handle the message after it has been +// received at the decoding side. +// + +enum T_store_action +{ + is_hit, + is_added, + is_discarded, + is_removed, + is_added_compat = 0, + is_hit_compat = 1 +}; + +#define IS_HIT (control -> isProtoStep8() == 1 ? is_hit : is_hit_compat) +#define IS_ADDED (control -> isProtoStep8() == 1 ? is_added : is_added_compat) + +enum T_checksum_action +{ + use_checksum, + discard_checksum +}; + +enum T_data_action +{ + use_data, + discard_data +}; + +// +// Message is going to be weighted for +// deletion at insert or cleanup time? +// + +enum T_rating +{ + rating_for_insert, + rating_for_clean +}; + +// +// How to handle the writes to the X +// and proxy connections. +// + +enum T_write +{ + write_immediate, + write_delayed +}; + +enum T_flush +{ + flush_if_needed, + flush_if_any +}; + +// +// This is the value to indicate an +// invalid position in the message +// store. +// + +static const int nothing = -1; + +#endif /* Types_H */ -- cgit v1.2.3 From 799bf672a3588f205bd18ef39d9908069e0cd6d5 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Sun, 13 Nov 2011 09:27:52 +0100 Subject: Imported nxcomp-3.4.0-1.tar.gz Summary: Imported nxcomp-3.4.0-1.tar.gz Keywords: Imported nxcomp-3.4.0-1.tar.gz into Git repository --- nxcomp/Types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 nxcomp/Types.h (limited to 'nxcomp/Types.h') diff --git a/nxcomp/Types.h b/nxcomp/Types.h old mode 100755 new mode 100644 index 4afc93911..162ff78f2 --- a/nxcomp/Types.h +++ b/nxcomp/Types.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2007 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2009 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ @@ -9,7 +9,7 @@ /* */ /* Check http://www.nomachine.com/licensing.html for applicability. */ /* */ -/* NX and NoMachine are trademarks of NoMachine S.r.l. */ +/* NX and NoMachine are trademarks of Medialogic S.p.A. */ /* */ /* All rights reserved. */ /* */ -- cgit v1.2.3 From 477961678194817aaf1aaf3602f1c91d288a539d Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Sun, 13 Nov 2011 09:27:53 +0100 Subject: Imported nxcomp-3.4.0-6.tar.gz Summary: Imported nxcomp-3.4.0-6.tar.gz Keywords: Imported nxcomp-3.4.0-6.tar.gz into Git repository --- nxcomp/Types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nxcomp/Types.h') diff --git a/nxcomp/Types.h b/nxcomp/Types.h index 162ff78f2..05f62bd00 100644 --- a/nxcomp/Types.h +++ b/nxcomp/Types.h @@ -1,6 +1,6 @@ /**************************************************************************/ /* */ -/* Copyright (c) 2001, 2009 NoMachine, http://www.nomachine.com/. */ +/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ /* */ /* NXCOMP, NX protocol compression and NX extensions to this software */ /* are copyright of NoMachine. Redistribution and use of the present */ -- cgit v1.2.3