Support application metadata through ZMQ_METADATA

Lets the application set per-connection metadata.
Metadata is specified as "X-key:value" and set using zmq_setsockopt, eg:
zmq_setsockopt (s, ZMQ_METADATA, "X-key:value", 11);

The peer can then obtain the metadata from a received message:
char *data = zmq_msg_gets(msg, "X-key");
This commit is contained in:
Pontus Sköldström
2018-03-12 01:41:33 +01:00
parent c9437ab755
commit dd5eec35be
9 changed files with 226 additions and 5 deletions

View File

@@ -33,6 +33,7 @@
#include <string>
#include <vector>
#include <set>
#include <map>
#include "atomic_ptr.hpp"
#include "stddef.h"
@@ -258,6 +259,9 @@ struct options_t
// Use zero copy strategy for storing message content when decoding.
bool zero_copy;
// Application metadata
std::map<std::string, std::string> app_metadata;
};
int do_getsockopt (void *const optval_,