All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
ignition::transport::Header Class Reference

Header included in each discovery message containing the version of the discovery protocol, the process UUID of the sender node, the type. More...

#include <ignition/transport/Packet.hh>

Public Member Functions

 Header ()=default
 Constructor. More...
 
 Header (const uint16_t _version, const std::string &_pUuid, const uint8_t _type, const uint16_t _flags=0)
 Constructor. More...
 
virtual ~Header ()=default
 Destructor. More...
 
uint16_t Flags () const
 Get the message flags. More...
 
int HeaderLength () const
 Get the header length. More...
 
size_t Pack (char *_buffer) const
 Serialize the header. More...
 
std::string PUuid () const
 Get the process uuid. More...
 
void SetFlags (const uint16_t _flags)
 Set the message flags. More...
 
void SetPUuid (const std::string &_pUuid)
 Set the process uuid. More...
 
void SetType (const uint8_t _type)
 Set the message type. More...
 
void SetVersion (const uint16_t _version)
 Set the discovery protocol version. More...
 
uint8_t Type () const
 Get the message type. More...
 
size_t Unpack (const char *_buffer)
 Unserialize the header. More...
 
uint16_t Version () const
 Get the discovery protocol version. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const Header &_header)
 Stream insertion operator. More...
 

Detailed Description

Header included in each discovery message containing the version of the discovery protocol, the process UUID of the sender node, the type.

Constructor & Destructor Documentation

ignition::transport::Header::Header ( )
default

Constructor.

ignition::transport::Header::Header ( const uint16_t  _version,
const std::string &  _pUuid,
const uint8_t  _type,
const uint16_t  _flags = 0 
)

Constructor.

Parameters
[in]_versionVersion of the discovery protocol.
[in]_pUuidEvery process has a unique UUID.
[in]_typeMessage type (ADVERTISE, SUBSCRIPTION, ...)
[in]_flagsOptional flags included in the header.
virtual ignition::transport::Header::~Header ( )
virtualdefault

Destructor.

Member Function Documentation

uint16_t ignition::transport::Header::Flags ( ) const

Get the message flags.

Returns
Message flags used for compression or other optional features.
See Also
SetFlags.
int ignition::transport::Header::HeaderLength ( ) const

Get the header length.

Returns
The header length in bytes.
size_t ignition::transport::Header::Pack ( char *  _buffer) const

Serialize the header.

The caller has ownership of the buffer and is responsible for its [de]allocation.

Parameters
[out]_bufferDestination buffer in which the header will be serialized.
Returns
Number of bytes serialized.
std::string ignition::transport::Header::PUuid ( ) const

Get the process uuid.

Returns
A unique global identifier for every process.
See Also
SetPUuid.
void ignition::transport::Header::SetFlags ( const uint16_t  _flags)

Set the message flags.

Parameters
[in]_flagsUsed for enable optional features.
See Also
Flags.
void ignition::transport::Header::SetPUuid ( const std::string &  _pUuid)

Set the process uuid.

Parameters
[in]_pUuidA unique global identifier for every process.
See Also
PUuid.
void ignition::transport::Header::SetType ( const uint8_t  _type)

Set the message type.

Parameters
[in]_typeMessage type (ADVERTISE, SUBSCRIPTION, ...).
See Also
Type.
void ignition::transport::Header::SetVersion ( const uint16_t  _version)

Set the discovery protocol version.

Parameters
[in]_versionDiscovery protocol version.
See Also
Version.
uint8_t ignition::transport::Header::Type ( ) const

Get the message type.

Returns
Message type (ADVERTISE, SUBSCRIPTION, ...)
See Also
SetType.
size_t ignition::transport::Header::Unpack ( const char *  _buffer)

Unserialize the header.

Parameters
[in]_bufferInput buffer with the data to be unserialized.
uint16_t ignition::transport::Header::Version ( ) const

Get the discovery protocol version.

Returns
The discovery protocol version.
See Also
SetVersion.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  _out,
const Header _header 
)
friend

Stream insertion operator.

Parameters
[out]_outThe output stream.
[in]_msgHeader to write to the stream.

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