38 size_t len = m_range.encoded_length() + 4 + 4;
41 m_range.encode(cbp->get_data_ptr_address());
42 cbp->append_i32(m_fragment);
43 return m_comm->send_response(m_event->addr, cbp);
55 size_t max_msg_size = std::numeric_limits<int16_t>::max();
56 size_t len = 4 + m_range.encoded_length() + 4;
58 if (msg.length() < max_msg_size) {
60 cbp = make_shared<CommBuf>(header, len);
61 cbp->append_i32(error);
62 cbp->append_str16(msg.c_str());
65 String substr = msg.substr(0, max_msg_size);
67 cbp = make_shared<CommBuf>(header, len);
68 cbp->append_i32(error);
69 cbp->append_str16(substr.c_str());
71 m_range.encode(cbp->get_data_ptr_address());
72 cbp->append_i32(m_fragment);
74 return m_comm->send_response(m_event->addr, cbp);
std::string String
A String is simply a typedef to std::string.
size_t encoded_length_str16(const char *str)
Computes the encoded length of a string16 encoding.
std::shared_ptr< CommBuf > CommBufPtr
Smart pointer to CommBuf.
Compatibility Macros for C/C++.
virtual int response_ok()
Sends a a simple success response back to the client which is just the 4-byte error code Error::OK...
virtual int error(int error, const String &msg)
Sends a standard error response back to the client.
Declarations for CommBuf.
Message buffer for holding data to be transmitted over a network.
Error codes, Exception handling, error logging.