2014-03-03 13:19:40 +01:00
|
|
|
zmq_msg_gets(3)
|
|
|
|
===============
|
|
|
|
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
zmq_msg_gets - get message metadata property
|
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
2014-04-30 13:11:12 +02:00
|
|
|
*const char *zmq_msg_gets (zmq_msg_t '*message', const char *'property');*
|
2014-03-03 13:19:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2014-07-28 22:23:56 +02:00
|
|
|
the 'message' argument. Both the 'property' argument and the 'value'
|
|
|
|
shall be NULL-terminated UTF8-encoded strings.
|
2014-03-03 13:19:40 +01:00
|
|
|
|
2015-01-16 17:50:04 +01:00
|
|
|
Metadata is defined on a per-connection basis during the ZeroMQ connection
|
|
|
|
handshake as specified in <rfc.zeromq.org/spec:37>.
|
2014-03-03 13:19:40 +01:00
|
|
|
|
2015-01-16 17:50:04 +01:00
|
|
|
The following ZMTP properties can be retrieved with the _zmq_msg_gets()_
|
|
|
|
function:
|
|
|
|
|
|
|
|
Socket-Type
|
|
|
|
Identity
|
|
|
|
Resource
|
2015-01-16 21:52:16 +01:00
|
|
|
Peer-Address
|
2015-01-16 17:50:04 +01:00
|
|
|
|
|
|
|
Other properties may be defined based on the underlying security, see ZAP
|
|
|
|
auththenticated connection sample below.
|
2014-03-03 13:19:40 +01:00
|
|
|
|
|
|
|
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,
|
2014-07-28 22:23:56 +02:00
|
|
|
which shall be owned by the message. The encoding of the property and value
|
|
|
|
shall be UTF8.
|
2014-03-03 13:19:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
ERRORS
|
|
|
|
------
|
|
|
|
*EINVAL*::
|
|
|
|
The requested _property_ is unknown.
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLE
|
|
|
|
-------
|
2014-05-02 22:19:30 +02:00
|
|
|
.Getting the ZAP authenticated user id for a message:
|
2014-03-03 13:19:40 +01:00
|
|
|
----
|
2014-05-02 22:19:30 +02:00
|
|
|
zmq_msg_t msg;
|
|
|
|
zmq_msg_init (&msg);
|
|
|
|
rc = zmq_msg_recv (&msg, dealer, 0);
|
|
|
|
assert (rc != -1);
|
2014-05-02 23:13:11 +02:00
|
|
|
const char *user_id = zmq_msg_gets (&msg, "User-Id");
|
2014-05-02 22:19:30 +02:00
|
|
|
zmq_msg_close (&msg);
|
2014-03-03 13:19:40 +01:00
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
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>.
|