diff --git a/doc/Makefile.am b/doc/Makefile.am index d02fbb17..b139b2ca 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -4,7 +4,7 @@ MAN3 = zmq_bind.3 zmq_unbind.3 zmq_connect.3 zmq_disconnect.3 zmq_close.3 \ zmq_msg_move.3 zmq_msg_copy.3 zmq_msg_size.3 zmq_msg_data.3 zmq_msg_close.3 \ zmq_msg_send.3 zmq_msg_recv.3 \ zmq_send.3 zmq_recv.3 zmq_send_const.3 \ - zmq_msg_get.3 zmq_msg_set.3 zmq_msg_more.3 \ + zmq_msg_get.3 zmq_msg_set.3 zmq_msg_more.3 zmq_msg_gets.3 \ zmq_getsockopt.3 zmq_setsockopt.3 \ zmq_socket.3 zmq_socket_monitor.3 zmq_poll.3 \ zmq_errno.3 zmq_strerror.3 zmq_version.3 \ diff --git a/doc/zmq_msg_gets.txt b/doc/zmq_msg_gets.txt new file mode 100644 index 00000000..f979d843 --- /dev/null +++ b/doc/zmq_msg_gets.txt @@ -0,0 +1,54 @@ +zmq_msg_gets(3) +=============== + + +NAME +---- +zmq_msg_gets - get message metadata property + + +SYNOPSIS +-------- +*char *zmq_msg_gets (zmq_msg_t '*message', char *'property');* + + +DESCRIPTION +----------- +The _zmq_msg_gets()_ function shall return the string value for the metadata +property specified by the 'property' argument for the message pointed to by +the 'message' argument. + +The following properties can be retrieved with the _zmq_msg_get()_ function: + + +RETURN VALUE +------------ +The _zmq_msg_gets()_ function shall return the string value for the property +if successful. Otherwise it shall return NULL and set 'errno' to one of the +values defined below. The caller shall not modify or free the returned value, +which shall be owned by the message. + + +ERRORS +------ +*EINVAL*:: +The requested _property_ is unknown. + + +EXAMPLE +------- +.To be done +---- +zmq_msg_t frame; +---- + + +SEE ALSO +-------- +linkzmq:zmq[7] + + +AUTHORS +------- +This page was written by the 0MQ community. To make a change please +read the 0MQ Contribution Policy at . diff --git a/include/zmq.h b/include/zmq.h index 408ed469..ea9b8a70 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -216,8 +216,9 @@ ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src); ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg); ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg); ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg); -ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int option); -ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int option, int optval); +ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int property); +ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int property, int optval); +ZMQ_EXPORT char *zmq_msg_gets (zmq_msg_t *msg, char *property); /******************************************************************************/ diff --git a/src/zmq.cpp b/src/zmq.cpp index 2ae59efe..603abed1 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -620,9 +620,9 @@ int zmq_msg_more (zmq_msg_t *msg_) return zmq_msg_get (msg_, ZMQ_MORE); } -int zmq_msg_get (zmq_msg_t *msg_, int option_) +int zmq_msg_get (zmq_msg_t *msg_, int property_) { - switch (option_) { + switch (property_) { case ZMQ_MORE: return (((zmq::msg_t*) msg_)->flags () & zmq::msg_t::more)? 1: 0; case ZMQ_SRCFD: @@ -635,11 +635,20 @@ int zmq_msg_get (zmq_msg_t *msg_, int option_) int zmq_msg_set (zmq_msg_t *, int, int) { - // No options supported at present + // No properties supported at present errno = EINVAL; return -1; } + +// Get message metadata string + +char *zmq_msg_gets (zmq_msg_t *msg_, char *property_) +{ + // All unknown properties return NULL + return NULL; +} + // Polling. int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)