0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Hypertable::CommHeader Class Reference

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
 

Detailed Description

Header for messages transmitted via AsyncComm.

Definition at line 40 of file CommHeader.h.

Constructor & Destructor Documentation

Hypertable::CommHeader::CommHeader ( )
inline

Default constructor.

Definition at line 72 of file CommHeader.h.

Hypertable::CommHeader::CommHeader ( uint64_t  cmd,
uint32_t  timeout = 0 
)
inline

Constructor taking command number and optional timeout.

Parameters
cmdCommand number
timeoutRequest timeout

Definition at line 81 of file CommHeader.h.

Member Function Documentation

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.

Parameters
bufpAddress of memory pointer to where header is to be encoded.
remainpPointer to valid bytes remaining in buffer (decremented by call)
Exceptions
Error::COMM_BAD_HEADERIf fixed header size is less than *remainp.
Error::COMM_HEADER_CHECKSUM_MISMATCHIf 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.

Parameters
bufpAddress of memory pointer to where header is to be encoded.

Definition at line 39 of file CommHeader.cc.

size_t Hypertable::CommHeader::encoded_length ( ) const
inline

Returns encoded length of header.

Returns
Encoded length of header

Definition at line 95 of file CommHeader.h.

size_t Hypertable::CommHeader::fixed_length ( ) const
inline

Returns fixed length of header.

Returns
Fixed length of header

Definition at line 90 of file CommHeader.h.

void Hypertable::CommHeader::initialize_from_request_header ( CommHeader req_header)
inline

Initializes header from req_header.

This method is typically used to initialize a response header from a corresponding request header.

Parameters
req_headerRequest header from which to initialize

Definition at line 128 of file CommHeader.h.

void Hypertable::CommHeader::set_total_length ( uint32_t  len)
inline

Set total length of message (header + payload).

Parameters
lenTotal length of message (header + payload)

Definition at line 121 of file CommHeader.h.

Member Data Documentation

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.

const size_t Hypertable::CommHeader::FIXED_LENGTH = 38
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.

const uint8_t Hypertable::CommHeader::PROTOCOL_VERSION = 1
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.


The documentation for this class was generated from the following files: