gramods
Public Member Functions | Public Attributes | List of all members
gramods::gmNetwork::Protocol::Message Struct Reference

Data entity communicated by the connection to the designated protocol. More...

#include <Protocol.hh>

Collaboration diagram for gramods::gmNetwork::Protocol::Message:
Collaboration graph
[legend]

Public Member Functions

 Message ()
 Create an empty message. More...
 
 Message (std::vector< char > hdr)
 Create an incoming message initialized with the specified header data. More...
 
 Message (char protocol, std::vector< char > data)
 Create an outgoing message template with protocol id and data. More...
 
std::vector< char > getHeader ()
 Returns a vector filled with header data for this message. More...
 

Public Attributes

size_t from_peer_idx = std::numeric_limits<size_t>::max()
 The index of the peer from which this message originated, or the maximum value of the type if not set. More...
 
size_t to_peer_idx = std::numeric_limits<size_t>::max()
 The index of the peer to which this message is sent, or the maximum value of the type if not set. More...
 
char protocol = 0
 Flag indicating which protocol this message is encoded for. More...
 
size_t length = 0
 Expected length of the message as expressed in the message header. More...
 
std::vector< char > data
 The complete set of data sent by the peer. More...
 

Detailed Description

Data entity communicated by the connection to the designated protocol.

Constructor & Destructor Documentation

◆ Message() [1/3]

gramods::gmNetwork::Protocol::Message::Message ( )
inline

Create an empty message.

◆ Message() [2/3]

gramods::gmNetwork::Protocol::Message::Message ( std::vector< char >  hdr)

Create an incoming message initialized with the specified header data.

◆ Message() [3/3]

gramods::gmNetwork::Protocol::Message::Message ( char  protocol,
std::vector< char >  data 
)

Create an outgoing message template with protocol id and data.

Member Function Documentation

◆ getHeader()

std::vector< char > gramods::gmNetwork::Protocol::Message::getHeader ( )

Returns a vector filled with header data for this message.

The length of the header is HEADER_LENGTH.

Member Data Documentation

◆ data

std::vector<char> gramods::gmNetwork::Protocol::Message::data

The complete set of data sent by the peer.

◆ from_peer_idx

size_t gramods::gmNetwork::Protocol::Message::from_peer_idx = std::numeric_limits<size_t>::max()

The index of the peer from which this message originated, or the maximum value of the type if not set.

◆ length

size_t gramods::gmNetwork::Protocol::Message::length = 0

Expected length of the message as expressed in the message header.

A complete message will satisfy the expression data.length() == message_length.

◆ protocol

char gramods::gmNetwork::Protocol::Message::protocol = 0

Flag indicating which protocol this message is encoded for.

◆ to_peer_idx

size_t gramods::gmNetwork::Protocol::Message::to_peer_idx = std::numeric_limits<size_t>::max()

The index of the peer to which this message is sent, or the maximum value of the type if not set.


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