Added scaffolding for zmq_msg_gets

This commit is contained in:
Pieter Hintjens 2014-03-03 13:19:40 +01:00
parent 8de07ad79b
commit 305a1442ae
4 changed files with 70 additions and 6 deletions

View File

@ -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 \

54
doc/zmq_msg_gets.txt Normal file
View File

@ -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 <http://www.zeromq.org/docs:contributing>.

View File

@ -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);
/******************************************************************************/

View File

@ -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_)