dodo  0.0.1
A C++ library to create containerized Linux services
dodo::network::protocol::stomp::Frame Class Referenceabstract

A generic STOMP 1.2 frame. More...

#include <stomp.hpp>

Inheritance diagram for dodo::network::protocol::stomp::Frame:
Collaboration diagram for dodo::network::protocol::stomp::Frame:

Public Types

enum  FrameMatch { FrameMatch::NoMatch, FrameMatch::IncompleteMatch, FrameMatch::FullMatch }
 The manner in which frames match the STOMP protocol. More...
 
enum  Version { Version::v1_2 }
 STOMP versions. More...
 

Public Member Functions

virtual void generate (common::Bytes &frame) const =0
 Generate a frame. More...
 
virtual FrameMatch match (const common::Bytes &frame, std::list< std::string > &errors) const =0
 Checks how the data matches a frame specification. More...
 

Data Fields

const common::Bytes command_connect { "STOMP" }
 CONNECT command. More...
 
const common::Bytes command_connected { "CONNECTED" }
 CONNECTED command. More...
 
const common::Bytes eol { "\n" }
 EOL sequence - use only
as the protocl allows it and the extra
serves no purpose. More...
 
const common::Bytes header_accept_version_1_2 { "accept-version:1.2" }
 STOMP 1.2 accept header. More...
 

Protected Member Functions

FrameMatch readCommand (const common::Bytes &frame, size_t &index, const common::Bytes &command) const
 Read a command from a frame. More...
 

Detailed Description

A generic STOMP 1.2 frame.

Definition at line 36 of file stomp.hpp.

Member Enumeration Documentation

◆ FrameMatch

The manner in which frames match the STOMP protocol.

Enumerator
NoMatch 

Mismatch.

IncompleteMatch 

Match, but incomplete.

FullMatch 

Complete match.

Definition at line 54 of file stomp.hpp.

◆ Version

STOMP versions.

Only the latest 1.2 version is supported.

Enumerator
v1_2 

STOMP 1.2.

Definition at line 63 of file stomp.hpp.

Member Function Documentation

◆ generate()

virtual void dodo::network::protocol::stomp::Frame::generate ( common::Bytes frame) const
pure virtual

Generate a frame.

Parameters
frameThe generation destination, which is overwritten.

Implemented in dodo::network::protocol::stomp::Connected, and dodo::network::protocol::stomp::Connect.

◆ match()

virtual FrameMatch dodo::network::protocol::stomp::Frame::match ( const common::Bytes frame,
std::list< std::string > &  errors 
) const
pure virtual

Checks how the data matches a frame specification.

Parameters
frameThe frame / common::Bytes to match against.
errorsIf returning FrameMatch::NoMatch, one or more errors.
Returns
FrameMatch::IncompleteMatch if the frame matches but is incomplete, FrameMatch::FullMatch if it matches completely.

Implemented in dodo::network::protocol::stomp::Connect.

◆ readCommand()

Frame::FrameMatch dodo::network::protocol::stomp::Frame::readCommand ( const common::Bytes frame,
size_t &  index,
const common::Bytes command 
) const
protected

Read a command from a frame.

Parameters
frameThe (incomplete) frame
indexThe index into fame (0 for commands).
commandThe command to read.
Returns
FrameMatch::IncompleteMatch if the frame matches but is incomplete, FrameMatch::FullMatch if it matches completely.

Definition at line 32 of file stomp.cpp.

References FullMatch, dodo::common::Bytes::getOctet(), dodo::common::Bytes::getSize(), IncompleteMatch, and NoMatch.

Referenced by dodo::network::protocol::stomp::Connect::match().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ command_connect

const common::Bytes dodo::network::protocol::stomp::Frame::command_connect { "STOMP" }

◆ command_connected

const common::Bytes dodo::network::protocol::stomp::Frame::command_connected { "CONNECTED" }

CONNECTED command.

Definition at line 46 of file stomp.hpp.

◆ eol

const common::Bytes dodo::network::protocol::stomp::Frame::eol { "\n" }

EOL sequence - use only
as the protocl allows it and the extra
serves no purpose.

Definition at line 40 of file stomp.hpp.

Referenced by dodo::network::protocol::stomp::Connect::generate().

◆ header_accept_version_1_2

const common::Bytes dodo::network::protocol::stomp::Frame::header_accept_version_1_2 { "accept-version:1.2" }

STOMP 1.2 accept header.

Definition at line 49 of file stomp.hpp.

Referenced by dodo::network::protocol::stomp::Connect::generate().


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