50 identity =
blob_t (static_cast <const unsigned char*> (id_ptr), id_size);
63 user_id =
blob_t (static_cast <const unsigned char*> (data_), size_);
65 metadata_t::dict_t::value_type (
66 "User-Id", std::string ((
char *) data_, size_)));
76 static const char *names [] = {
"PAIR",
"PUB",
"SUB",
"REQ",
"REP",
77 "DEALER",
"ROUTER",
"PULL",
"PUSH",
78 "XPUB",
"XSUB",
"STREAM",
82 zmq_assert (socket_type >= 0 && socket_type <= 17);
83 return names [socket_type];
87 const void *value,
size_t value_len)
const 89 const size_t name_len = strlen (name);
91 *ptr++ = static_cast <
unsigned char> (name_len);
92 memcpy (ptr, name, name_len);
95 put_uint32 (ptr, static_cast <uint32_t> (value_len));
97 memcpy (ptr, value, value_len);
99 return 1 + name_len + 4 + value_len;
103 size_t length_,
bool zap_flag)
105 size_t bytes_left = length_;
107 while (bytes_left > 1) {
108 const size_t name_length = static_cast <
size_t> (*ptr_);
111 if (bytes_left < name_length)
114 const std::string name = std::string ((
char *) ptr_, name_length);
116 bytes_left -= name_length;
120 const size_t value_length = static_cast <
size_t> (
get_uint32 (ptr_));
123 if (bytes_left < value_length)
126 const uint8_t *value = ptr_;
127 ptr_ += value_length;
128 bytes_left -= value_length;
133 if (name ==
"Socket-Type") {
134 const std::string socket_type ((
char *) value, value_length);
141 const int rc =
property (name, value, value_length);
147 metadata_t::dict_t::value_type (
148 name, std::string ((
char *) value, value_length)));
151 metadata_t::dict_t::value_type (
152 name, std::string ((
char *) value, value_length)));
154 if (bytes_left > 0) {
162 const void * ,
size_t )
173 return type_ ==
"REP" || type_ ==
"ROUTER";
175 return type_ ==
"REQ" || type_ ==
"DEALER";
177 return type_ ==
"REP" || type_ ==
"DEALER" || type_ ==
"ROUTER";
179 return type_ ==
"REQ" || type_ ==
"DEALER" || type_ ==
"ROUTER";
181 return type_ ==
"PULL";
183 return type_ ==
"PUSH";
185 return type_ ==
"SUB" || type_ ==
"XSUB";
187 return type_ ==
"PUB" || type_ ==
"XPUB";
189 return type_ ==
"SUB" || type_ ==
"XSUB";
191 return type_ ==
"PUB" || type_ ==
"XPUB";
193 return type_ ==
"PAIR";
195 return type_ ==
"CLIENT";
197 return type_ ==
"SERVER";
199 return type_ ==
"DISH";
201 return type_ ==
"RADIO";
203 return type_ ==
"SCATTER";
205 return type_ ==
"GATHER";
void set_peer_identity(const void *id_ptr, size_t id_size)
mechanism_t(const options_t &options_)
void put_uint32(unsigned char *buffer_, uint32_t value)
uint32_t get_uint32(const unsigned char *buffer_)
bool check_socket_type(const std::string &type_) const
int init_size(size_t size_)
metadata_t::dict_t zmtp_properties
metadata_t::dict_t zap_properties
int parse_metadata(const unsigned char *ptr_, size_t length, bool zap_flag=false)
std::basic_string< unsigned char > blob_t
void peer_identity(msg_t *msg_)
const char * socket_type_string(int socket_type) const
void set_flags(unsigned char flags_)
virtual int property(const std::string &name_, const void *value_, size_t length_)
unsigned char data[max_vsm_size]
size_t add_property(unsigned char *ptr, const char *name, const void *value, size_t value_len) const
void set_user_id(const void *user_id, size_t size)
blob_t get_user_id() const