summaryrefslogtreecommitdiff
path: root/src/decoder.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-09-16 09:29:43 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-09-16 09:29:43 +0200
commit06bdf2c4f96a6324b3fe667cebb03d44cd100a73 (patch)
treee7678e0f861ae538fe03c75484d708042f62659d /src/decoder.hpp
parentf78d9b6bfca13e298c29fadabbbc870b37a0a573 (diff)
Check message syntax in REQ asynchronously
This patch adds support for checking messages as they arrive (as opposed to when they are recv'd by the user) and drop the connection if they are malformed. It also uses this new feature to check for validity of inbound messages in REQ socket. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/decoder.hpp')
-rw-r--r--src/decoder.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/decoder.hpp b/src/decoder.hpp
index 01021c4..de63a09 100644
--- a/src/decoder.hpp
+++ b/src/decoder.hpp
@@ -164,10 +164,18 @@ namespace zmq
private:
+ // Where to store the read data.
unsigned char *read_pos;
+
+ // How much data to read before taking next step.
size_t to_read;
+
+ // Next step. If set to NULL, it means that associated data stream
+ // is dead. Note that there can be still data in the process in such
+ // case.
step_t next;
+ // The duffer for data to decode.
size_t bufsize;
unsigned char *buf;