summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/zmq.h28
-rw-r--r--include/zmq.hpp11
2 files changed, 20 insertions, 19 deletions
diff --git a/include/zmq.h b/include/zmq.h
index 46d779b..34ce80c 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -94,50 +94,50 @@ typedef void (zmq_free_fn) (void *data);
// is shared, i.e. reference counting is used to manage its lifetime
// rather than straighforward malloc/free. struct zmq_msg_content is
// not declared in the API.
-struct zmq_msg
+struct zmq_msg_t
{
- struct zmq_msg_content *content;
+ void *content;
unsigned char shared;
uint16_t vsm_size;
unsigned char vsm_data [ZMQ_MAX_VSM_SIZE];
};
// Initialise an empty message (zero bytes long).
-ZMQ_EXPORT int zmq_msg_init (zmq_msg *msg);
+ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg);
// Initialise a message 'size' bytes long.
//
// Errors: ENOMEM - the size is too large to allocate.
-ZMQ_EXPORT int zmq_msg_init_size (zmq_msg *msg, size_t size);
+ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size);
// Initialise a message from an existing buffer. Message isn't copied,
// instead 0SOCKETS infrastructure take ownership of the buffer and call
// deallocation functio (ffn) once it's not needed anymore.
-ZMQ_EXPORT int zmq_msg_init_data (zmq_msg *msg, void *data, size_t size,
+ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t size,
zmq_free_fn *ffn);
// Deallocate the message.
-ZMQ_EXPORT int zmq_msg_close (zmq_msg *msg);
+ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg);
// Move the content of the message from 'src' to 'dest'. The content isn't
// copied, just moved. 'src' is an empty message after the call. Original
// content of 'dest' message is deallocated.
-ZMQ_EXPORT int zmq_msg_move (zmq_msg *dest, zmq_msg *src);
+ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
// Copy the 'src' message to 'dest'. The content isn't copied, instead
// reference count is increased. Don't modify the message data after the
// call as they are shared between two messages. Original content of 'dest'
// message is deallocated.
-ZMQ_EXPORT int zmq_msg_copy (zmq_msg *dest, zmq_msg *src);
+ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);
// Returns pointer to message data.
-ZMQ_EXPORT void *zmq_msg_data (zmq_msg *msg);
+ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg);
// Return size of message data (in bytes).
-ZMQ_EXPORT size_t zmq_msg_size (zmq_msg *msg);
+ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg);
// Returns type of the message.
-ZMQ_EXPORT int zmq_msg_type (zmq_msg *msg);
+ZMQ_EXPORT int zmq_msg_type (zmq_msg_t *msg);
// Initialise 0SOCKETS context. 'app_threads' specifies maximal number
// of application threads that can have open sockets at the same time.
@@ -163,7 +163,7 @@ ZMQ_EXPORT int zmq_close (void *s);
// Sets an option on the socket.
// EINVAL - unknown option, a value with incorrect length or an invalid value.
-ZMQ_EXPORT int zmq_setsockopt (void *s, int option_, void *optval_,
+ZMQ_EXPORT int zmq_setsockopt (void *s, int option_, const void *optval_,
size_t optvallen_);
// Bind the socket to a particular address.
@@ -182,7 +182,7 @@ ZMQ_EXPORT int zmq_connect (void *s, const char *addr);
// Errors: EAGAIN - message cannot be sent at the moment (applies only to
// non-blocking send).
// ENOTSUP - function isn't supported by particular socket type.
-ZMQ_EXPORT int zmq_send (void *s, zmq_msg *msg, int flags);
+ZMQ_EXPORT int zmq_send (void *s, zmq_msg_t *msg, int flags);
// Flush the messages that were send using ZMQ_NOFLUSH flag down the stream.
//
@@ -196,7 +196,7 @@ ZMQ_EXPORT int zmq_flush (void *s);
// Errors: EAGAIN - message cannot be received at the moment (applies only to
// non-blocking receive).
// ENOTSUP - function isn't supported by particular socket type.
-ZMQ_EXPORT int zmq_recv (void *s, zmq_msg *msg, int flags);
+ZMQ_EXPORT int zmq_recv (void *s, zmq_msg_t *msg, int flags);
#ifdef __cplusplus
}
diff --git a/include/zmq.hpp b/include/zmq.hpp
index e8e4f15..8397464 100644
--- a/include/zmq.hpp
+++ b/include/zmq.hpp
@@ -74,7 +74,7 @@ namespace zmq
// copied it - the behaviour is undefined. Don't change the body of the
// received message either - other threads may be accessing it in parallel.
- class message_t : private zmq_msg
+ class message_t : private zmq_msg_t
{
friend class socket_t;
@@ -139,7 +139,7 @@ namespace zmq
// of data after the operation.
inline void move_to (message_t *msg_)
{
- int rc = zmq_msg_move (this, (zmq_msg*) msg_);
+ int rc = zmq_msg_move (this, (zmq_msg_t*) msg_);
assert (rc == 0);
}
@@ -148,7 +148,7 @@ namespace zmq
// these get deallocated.
inline void copy_to (message_t *msg_)
{
- int rc = zmq_msg_copy (this, (zmq_msg*) msg_);
+ int rc = zmq_msg_copy (this, (zmq_msg_t*) msg_);
assert (rc == 0);
}
@@ -230,9 +230,10 @@ namespace zmq
assert (rc == 0);
}
- template <typename T> inline void setsockopt (int option_, T &value_)
+ inline void setsockopt (int option_, const void *optval_,
+ size_t optvallen_)
{
- int rc = zmq_setsockopt (ptr, option_, (void*) &value_, sizeof (T));
+ int rc = zmq_setsockopt (ptr, option_, optval_, optvallen_);
assert (rc == 0);
}