0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-30 01:06:55 +08:00

Rename parse_properties to parse_metadata

This commit is contained in:
Martin Hurton 2013-06-23 08:52:27 +02:00
parent ec943ac5de
commit b12be41736
6 changed files with 15 additions and 13 deletions

View File

@ -399,8 +399,8 @@ int zmq::curve_client_t::process_ready (msg_t *msg_)
return -1; return -1;
} }
rc = parse_properties (ready_plaintext + crypto_box_ZEROBYTES, rc = parse_metadata (ready_plaintext + crypto_box_ZEROBYTES,
clen - crypto_box_ZEROBYTES); clen - crypto_box_ZEROBYTES);
return rc; return rc;
} }

View File

@ -441,8 +441,8 @@ int zmq::curve_server_t::process_initiate (msg_t *msg_)
} }
} }
return parse_properties (initiate_plaintext + crypto_box_ZEROBYTES + 96, return parse_metadata (initiate_plaintext + crypto_box_ZEROBYTES + 96,
clen - crypto_box_ZEROBYTES - 96); clen - crypto_box_ZEROBYTES - 96);
} }
int zmq::curve_server_t::ready_msg (msg_t *msg_) int zmq::curve_server_t::ready_msg (msg_t *msg_)

View File

@ -72,8 +72,8 @@ size_t zmq::mechanism_t::add_property (unsigned char *ptr, const char *name,
return 1 + name_len + 4 + value_len; return 1 + name_len + 4 + value_len;
} }
int zmq::mechanism_t::parse_properties (const unsigned char *ptr_, int zmq::mechanism_t::parse_metadata (const unsigned char *ptr_,
size_t length_) size_t length_)
{ {
size_t bytes_left = length_; size_t bytes_left = length_;

View File

@ -69,14 +69,16 @@ namespace zmq
size_t add_property (unsigned char *ptr, const char *name, size_t add_property (unsigned char *ptr, const char *name,
const void *value, size_t value_len) const; const void *value, size_t value_len) const;
// Parse a list of properties. Returns 0 on success // Parses a metadata.
// and -1 on error, in which case errno is set. // Metadata consists of a list of properties consisting of
int parse_properties (const unsigned char *ptr_, size_t length); // name and value as size-specified strings.
// Returns 0 on success and -1 on error, in which case errno is set.
int parse_metadata (const unsigned char *ptr_, size_t length);
// This is called by parse_property method whenever it // This is called by parse_property method whenever it
// parses a new property. The function should return 0 // parses a new property. The function should return 0
// on success and -1 on error, in which case it should // on success and -1 on error, in which case it should
// set errno. Signaling error prevetns parser from // set errno. Signaling error prevents parser from
// parsing remaining data. // parsing remaining data.
// Derived classes are supposed to override this // Derived classes are supposed to override this
// method to handle custom processing. // method to handle custom processing.

View File

@ -99,7 +99,7 @@ int zmq::null_mechanism_t::process_handshake_message (msg_t *msg_)
ptr += 8; ptr += 8;
bytes_left -= 8; bytes_left -= 8;
int rc = parse_properties (ptr, bytes_left); int rc = parse_metadata (ptr, bytes_left);
if (rc == 0) { if (rc == 0) {
int rc = msg_->close (); int rc = msg_->close ();
errno_assert (rc == 0); errno_assert (rc == 0);

View File

@ -285,7 +285,7 @@ int zmq::plain_mechanism_t::process_initiate_command (msg_t *msg_)
errno = EPROTO; errno = EPROTO;
return -1; return -1;
} }
return parse_properties (ptr + 8, bytes_left - 8); return parse_metadata (ptr + 8, bytes_left - 8);
} }
int zmq::plain_mechanism_t::ready_command (msg_t *msg_) const int zmq::plain_mechanism_t::ready_command (msg_t *msg_) const
@ -329,7 +329,7 @@ int zmq::plain_mechanism_t::process_ready_command (msg_t *msg_)
errno = EPROTO; errno = EPROTO;
return -1; return -1;
} }
return parse_properties (ptr + 8, bytes_left - 8); return parse_metadata (ptr + 8, bytes_left - 8);
} }
void zmq::plain_mechanism_t::send_zap_request (const std::string &username, void zmq::plain_mechanism_t::send_zap_request (const std::string &username,