1ZMQ_MSG_GETS(3)                   0MQ Manual                   ZMQ_MSG_GETS(3)
2
3
4

NAME

6       zmq_msg_gets - get message metadata property
7

SYNOPSIS

9       const char *zmq_msg_gets (zmq_msg_t *message, const char *property);
10

DESCRIPTION

12       The zmq_msg_gets() function shall return the string value for the
13       metadata property specified by the property argument for the message
14       pointed to by the message argument. Both the property argument and the
15       value shall be NULL-terminated UTF8-encoded strings.
16
17       Metadata is defined on a per-connection basis during the ZeroMQ
18       connection handshake as specified in <rfc.zeromq.org/spec:37>.
19       Applications can set metadata properties using zmq_setsockopt(3) option
20       ZMQ_METADATA. Application metadata properties must be prefixed with X-.
21
22       In addition to application metadata, the following ZMTP properties can
23       be retrieved with the zmq_msg_gets() function:
24
25           Socket-Type
26           Routing-Id
27
28       Note: Identity is a deprecated alias for Routing-Id.
29
30       Additionally, when available for the underlying transport, the
31       Peer-Address property will return the IP address of the remote endpoint
32       as returned by getnameinfo(2).
33
34       The names of these properties are also defined in zmq.h as
35       ZMQ_MSG_PROPERTY_SOCKET_TYPE ZMQ_MSG_PROPERTY_ROUTING_ID, and
36       ZMQ_MSG_PROPERTY_PEER_ADDRESS. Currently, these definitions are only
37       available as a DRAFT API.
38
39       Other properties may be defined based on the underlying security
40       mechanism, see ZAP authenticated connection sample below.
41

RETURN VALUE

43       The zmq_msg_gets() function shall return the string value for the
44       property if successful. Otherwise it shall return NULL and set errno to
45       one of the values defined below. The caller shall not modify or free
46       the returned value, which shall be owned by the message. The encoding
47       of the property and value shall be UTF8.
48

ERRORS

50       EINVAL
51           The requested property is unknown.
52

EXAMPLE

54       Getting the ZAP authenticated user id for a message:.
55
56           zmq_msg_t msg;
57           zmq_msg_init (&msg);
58           rc = zmq_msg_recv (&msg, dealer, 0);
59           assert (rc != -1);
60           const char *user_id = zmq_msg_gets (&msg, ZMQ_MSG_PROPERTY_USER_ID);
61           zmq_msg_close (&msg);
62
63

SEE ALSO

65       zmq(7) zmq_setsockopt(3)
66

AUTHORS

68       This page was written by the 0MQ community. To make a change please
69       read the 0MQ Contribution Policy at
70       http://www.zeromq.org/docs:contributing.
71
72
73
740MQ 4.3.4                         07/23/2021                   ZMQ_MSG_GETS(3)
Impressum