Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
dev::p2p::RLPXFrameWriter Class Reference

Multiplex packets into encrypted RLPX frames. More...

#include <RLPXFrameWriter.h>

Classes

struct  WriterState
 Queue and state for Writer Properties are used independently; only valid packets should be added to q. More...
 

Public Types

enum  PacketPriority { PriorityLow = 0, PriorityHigh }
 

Public Member Functions

 RLPXFrameWriter (uint16_t _protocolType)
 
 RLPXFrameWriter (RLPXFrameWriter const &_s)
 
size_t size () const
 Returns total number of queued packets. Thread-safe. More...
 
void enque (uint8_t _packetType, RLPStream &_payload, PacketPriority _priority=PriorityLow)
 Moves output to queue, to be muxed into frames by mux() when network buffer is ready for writing. Thread-safe. More...
 
size_t mux (RLPXFrameCoder &_coder, unsigned _size, std::deque< bytes > &o_toWrite)
 Returns number of packets framed and outputs frames to o_bytes. Not thread-safe. More...
 
void enque (RLPXPacket &&_p, PacketPriority _priority=PriorityLow)
 Moves to queue, to be muxed into frames by mux() when network buffer is ready for writing. Thread-safe. More...
 
uint16_t protocolId () const
 

Static Public Attributes

static const uint16_t EmptyFrameLength = h128::size * 3
 
static const uint16_t MinFrameDequeLength = h128::size * 4
 

Private Attributes

uint16_t const m_protocolId
 
std::pair< WriterState, WriterStatem_q
 
uint16_t m_sequenceId = 0
 

Detailed Description

Multiplex packets into encrypted RLPX frames.

Todo:

throw when enqueued packet is invalid

use RLPXFrameInfo

Definition at line 42 of file RLPXFrameWriter.h.

Member Enumeration Documentation

Enumerator
PriorityLow 
PriorityHigh 

Definition at line 62 of file RLPXFrameWriter.h.

Constructor & Destructor Documentation

dev::p2p::RLPXFrameWriter::RLPXFrameWriter ( uint16_t  _protocolType)
inline

Definition at line 66 of file RLPXFrameWriter.h.

dev::p2p::RLPXFrameWriter::RLPXFrameWriter ( RLPXFrameWriter const &  _s)
inline

Definition at line 67 of file RLPXFrameWriter.h.

Member Function Documentation

void RLPXFrameWriter::enque ( uint8_t  _packetType,
RLPStream _payload,
PacketPriority  _priority = PriorityLow 
)

Moves output to queue, to be muxed into frames by mux() when network buffer is ready for writing. Thread-safe.

Definition at line 40 of file RLPXFrameWriter.cpp.

Here is the caller graph for this function:

void RLPXFrameWriter::enque ( RLPXPacket &&  _p,
PacketPriority  _priority = PriorityLow 
)

Moves to queue, to be muxed into frames by mux() when network buffer is ready for writing. Thread-safe.

Definition at line 31 of file RLPXFrameWriter.cpp.

size_t RLPXFrameWriter::mux ( RLPXFrameCoder _coder,
unsigned  _size,
std::deque< bytes > &  o_toWrite 
)

Returns number of packets framed and outputs frames to o_bytes. Not thread-safe.

Definition at line 45 of file RLPXFrameWriter.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t dev::p2p::RLPXFrameWriter::protocolId ( ) const
inline

Definition at line 81 of file RLPXFrameWriter.h.

size_t dev::p2p::RLPXFrameWriter::size ( ) const
inline

Returns total number of queued packets. Thread-safe.

Definition at line 70 of file RLPXFrameWriter.h.

Here is the call graph for this function:

Member Data Documentation

const uint16_t RLPXFrameWriter::EmptyFrameLength = h128::size * 3
static

Definition at line 63 of file RLPXFrameWriter.h.

uint16_t const dev::p2p::RLPXFrameWriter::m_protocolId
private

Definition at line 84 of file RLPXFrameWriter.h.

std::pair<WriterState, WriterState> dev::p2p::RLPXFrameWriter::m_q
private

Definition at line 85 of file RLPXFrameWriter.h.

uint16_t dev::p2p::RLPXFrameWriter::m_sequenceId = 0
private

Definition at line 86 of file RLPXFrameWriter.h.

const uint16_t RLPXFrameWriter::MinFrameDequeLength = h128::size * 4
static

Definition at line 64 of file RLPXFrameWriter.h.


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