Function Common::extract_correlation_id

Function Documentation

bool Common::extract_correlation_id(const std::string &input, std::string &id_out, std::string &payload_out)

detect and strip a correlation ID prefix from an inter-daemon message

The wire format for a tagged message is: “#cid:HHHHHHHH <payload>” where HHHHHHHH is exactly CID_HEX_LEN lowercase hex digits and is followed by a single space. Untagged messages (e.g. CLI users) are left untouched and the function returns false.

Parameters:
  • input[in] full message as received from the wire

  • id_out[out] extracted ID on success; unchanged otherwise

  • payload_out[out] message with the prefix stripped on success; copy of input otherwise

Returns:

true if a well-formed correlation ID prefix was found, false otherwise