+/* Status of a connection */
+enum izip_status { IZIP_OPEN, IZIP_CLOSED };
+
+/* Maximum transfer size per read operation */
+const unsigned int CHUNK = 128 * 1024;
+
+/* This class manages a compressed chunk of data preceeded by
+ * a length count.
+ *
+ * It can handle having multiple chunks of data in the buffer
+ * at any time.
+ */
+class CountedBuffer : public classbase
+{
+ std::string buffer; /* Current buffer contents */
+ unsigned int amount_expected; /* Amount of data expected */
+ public:
+ CountedBuffer()
+ {
+ amount_expected = 0;
+ }
+
+ /** Adds arbitrary compressed data to the buffer.
+ * - Binsry safe, of course.
+ */
+ void AddData(unsigned char* data, int data_length)
+ {
+ buffer.append((const char*)data, data_length);
+ this->NextFrameSize();
+ }