Fabcoin Core
0.16.2
P2P Digital Currency
|
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, WriterState > | m_q |
uint16_t | m_sequenceId = 0 |
Multiplex packets into encrypted RLPX frames.
throw when enqueued packet is invalid
use RLPXFrameInfo
Definition at line 42 of file RLPXFrameWriter.h.
Enumerator | |
---|---|
PriorityLow | |
PriorityHigh |
Definition at line 62 of file RLPXFrameWriter.h.
|
inline |
Definition at line 66 of file RLPXFrameWriter.h.
|
inline |
Definition at line 67 of file RLPXFrameWriter.h.
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.
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.
|
inline |
Definition at line 81 of file RLPXFrameWriter.h.
|
inline |
Returns total number of queued packets. Thread-safe.
Definition at line 70 of file RLPXFrameWriter.h.
|
static |
Definition at line 63 of file RLPXFrameWriter.h.
|
private |
Definition at line 84 of file RLPXFrameWriter.h.
|
private |
Definition at line 85 of file RLPXFrameWriter.h.
|
private |
Definition at line 86 of file RLPXFrameWriter.h.
|
static |
Definition at line 64 of file RLPXFrameWriter.h.