summaryrefslogtreecommitdiff
path: root/include/zmq.h
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-04-21 22:27:48 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-04-21 22:27:48 +0200
commite0246e32d79d71f8e73207b43aed8b23648e4fc7 (patch)
tree9952ee6fd39f4e27bbe932f6b6f30f0073009369 /include/zmq.h
parent581697695aac72894f2d3fefac904b9d50b3ba67 (diff)
Message-related functionality factored out into msg_t class.
This patch addresses serveral issues: 1. It gathers message related functionality scattered over whole codebase into a single class. 2. It makes zmq_msg_t an opaque datatype. Internals of the class don't pollute zmq.h header file. 3. zmq_msg_t size decreases from 48 to 32 bytes. That saves ~33% of memory in scenarios with large amount of small messages. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'include/zmq.h')
-rw-r--r--include/zmq.h29
1 files changed, 1 insertions, 28 deletions
diff --git a/include/zmq.h b/include/zmq.h
index 70197c9..2d01e24 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -121,34 +121,7 @@ ZMQ_EXPORT const char *zmq_strerror (int errnum);
/* 0MQ message definition. */
/******************************************************************************/
-/* Maximal size of "Very Small Message". VSMs are passed by value */
-/* to avoid excessive memory allocation/deallocation. */
-/* If VMSs larger than 255 bytes are required, type of 'vsm_size' */
-/* field in zmq_msg_t structure should be modified accordingly. */
-#define ZMQ_MAX_VSM_SIZE 30
-
-/* Message types. These integers may be stored in 'content' member of the */
-/* message instead of regular pointer to the data. */
-#define ZMQ_DELIMITER 31
-#define ZMQ_VSM 32
-
-/* Message flags. ZMQ_MSG_SHARED is strictly speaking not a message flag */
-/* (it has no equivalent in the wire format), however, making it a flag */
-/* allows us to pack the stucture tigher and thus improve performance. */
-#define ZMQ_MSG_MORE 1
-#define ZMQ_MSG_SHARED 128
-#define ZMQ_MSG_MASK 129 /* Merges all the flags */
-
-/* A message. Note that 'content' is not a pointer to the raw data. */
-/* Rather it is pointer to zmq::msg_content_t structure */
-/* (see src/msg_content.hpp for its definition). */
-typedef struct
-{
- void *content;
- unsigned char flags;
- unsigned char vsm_size;
- unsigned char vsm_data [ZMQ_MAX_VSM_SIZE];
-} zmq_msg_t;
+typedef unsigned char zmq_msg_t [32];
typedef void (zmq_free_fn) (void *data, void *hint);