Header for messages transmitted via AsyncComm. More...
#include <CommHeader.h>
Public Types | |
enum | Flags { FLAGS_BIT_REQUEST = 0x0001, FLAGS_BIT_IGNORE_RESPONSE = 0x0002, FLAGS_BIT_URGENT = 0x0004, FLAGS_BIT_PROFILE = 0x0008, FLAGS_BIT_PROXY_MAP_UPDATE = 0x4000, FLAGS_BIT_PAYLOAD_CHECKSUM = 0x8000 } |
Enumeration constants for bits in flags field. More... | |
enum | FlagMask { FLAGS_MASK_REQUEST = 0xFFFE, FLAGS_MASK_IGNORE_RESPONSE = 0xFFFD, FLAGS_MASK_URGENT = 0xFFFB, FLAGS_MASK_PROFILE = 0xFFF7, FLAGS_MASK_PROXY_MAP_UPDATE = 0xBFFF, FLAGS_MASK_PAYLOAD_CHECKSUM = 0x7FFF } |
Enumeration constants for flags field bitmaks. More... | |
Public Member Functions | |
CommHeader () | |
Default constructor. More... | |
CommHeader (uint64_t cmd, uint32_t timeout=0) | |
Constructor taking command number and optional timeout. More... | |
size_t | fixed_length () const |
Returns fixed length of header. More... | |
size_t | encoded_length () const |
Returns encoded length of header. More... | |
void | encode (uint8_t **bufp) |
Encode header to memory pointed to by *bufp . More... | |
void | decode (const uint8_t **bufp, size_t *remainp) |
Decode serialized header at *bufp The bufp pointer is advanced to the address immediately following the decoded header and remainp is decremented by the length of the serialized header. More... | |
void | set_total_length (uint32_t len) |
Set total length of message (header + payload). More... | |
void | initialize_from_request_header (CommHeader &req_header) |
Initializes header from req_header . More... | |
Public Attributes | |
uint8_t | version |
Protocol version. More... | |
uint8_t | header_len |
Length of header. More... | |
uint16_t | alignment |
Align payload to this byte offset. More... | |
uint16_t | flags |
Flags. More... | |
uint32_t | header_checksum |
Header checksum (computed with this member 0) More... | |
uint32_t | id |
Request ID. More... | |
uint32_t | gid |
Group ID (see ApplicationQueue) More... | |
uint32_t | total_len |
Total length of message including header. More... | |
uint32_t | timeout_ms |
Request timeout. More... | |
uint32_t | payload_checksum |
Payload checksum (currently unused) More... | |
uint64_t | command |
Request command number. More... | |
Static Public Attributes | |
static const uint8_t | PROTOCOL_VERSION = 1 |
static const size_t | FIXED_LENGTH = 38 |
Header for messages transmitted via AsyncComm.
Definition at line 40 of file CommHeader.h.
|
inline |
Default constructor.
Definition at line 72 of file CommHeader.h.
|
inline |
Constructor taking command number and optional timeout.
cmd | Command number |
timeout | Request timeout |
Definition at line 81 of file CommHeader.h.
void CommHeader::decode | ( | const uint8_t ** | bufp, |
size_t * | remainp | ||
) |
Decode serialized header at *bufp
The bufp
pointer is advanced to the address immediately following the decoded header and remainp
is decremented by the length of the serialized header.
bufp | Address of memory pointer to where header is to be encoded. |
remainp | Pointer to valid bytes remaining in buffer (decremented by call) |
Error::COMM_BAD_HEADER | If fixed header size is less than *remainp . |
Error::COMM_HEADER_CHECKSUM_MISMATCH | If computed checksum does not match checksum field |
Definition at line 58 of file CommHeader.cc.
void CommHeader::encode | ( | uint8_t ** | bufp | ) |
Encode header to memory pointed to by *bufp
.
The bufp
pointer is advanced to address immediately following the encoded header.
bufp | Address of memory pointer to where header is to be encoded. |
Definition at line 39 of file CommHeader.cc.
|
inline |
Returns encoded length of header.
Definition at line 95 of file CommHeader.h.
|
inline |
Returns fixed length of header.
Definition at line 90 of file CommHeader.h.
|
inline |
Initializes header from req_header
.
This method is typically used to initialize a response header from a corresponding request header.
req_header | Request header from which to initialize |
Definition at line 128 of file CommHeader.h.
|
inline |
Set total length of message (header + payload).
len | Total length of message (header + payload) |
Definition at line 121 of file CommHeader.h.
uint16_t Hypertable::CommHeader::alignment |
Align payload to this byte offset.
Definition at line 138 of file CommHeader.h.
uint64_t Hypertable::CommHeader::command |
Request command number.
Definition at line 146 of file CommHeader.h.
|
static |
Definition at line 46 of file CommHeader.h.
uint16_t Hypertable::CommHeader::flags |
Flags.
Definition at line 139 of file CommHeader.h.
uint32_t Hypertable::CommHeader::gid |
Group ID (see ApplicationQueue)
Definition at line 142 of file CommHeader.h.
uint32_t Hypertable::CommHeader::header_checksum |
Header checksum (computed with this member 0)
Definition at line 140 of file CommHeader.h.
uint8_t Hypertable::CommHeader::header_len |
Length of header.
Definition at line 137 of file CommHeader.h.
uint32_t Hypertable::CommHeader::id |
Request ID.
Definition at line 141 of file CommHeader.h.
uint32_t Hypertable::CommHeader::payload_checksum |
Payload checksum (currently unused)
Definition at line 145 of file CommHeader.h.
|
static |
Definition at line 44 of file CommHeader.h.
uint32_t Hypertable::CommHeader::timeout_ms |
Request timeout.
Definition at line 144 of file CommHeader.h.
uint32_t Hypertable::CommHeader::total_len |
Total length of message including header.
Definition at line 143 of file CommHeader.h.
uint8_t Hypertable::CommHeader::version |
Protocol version.
Definition at line 136 of file CommHeader.h.