+ /** Gets the next frame and returns its size, or returns
+ * zero if there isnt one available yet.
+ * A frame can contain multiple plaintext lines.
+ * - Binary safe.
+ */
+ int GetFrame(unsigned char* frame, int maxsize)
+ {
+ if (amount_expected)
+ {
+ /* We know how much we're expecting...
+ * Do we have enough yet?
+ */
+ if (buffer.length() >= amount_expected)
+ {
+ int j = 0;
+ for (unsigned int i = 0; i < amount_expected; i++, j++)
+ frame[i] = buffer[i];
+
+ buffer = buffer.substr(j);
+ amount_expected = 0;
+ NextFrameSize();
+ return j;
+ }
+ }
+ /* Not enough for a frame yet, COME AGAIN! */
+ return 0;
+ }
+};
+
+/** Represents an zipped connections extra data