TARAXA
|
Encoder/decoder transport for RLPx connection established by RLPXHandshake. More...
#include <RLPXFrameCoder.h>
Public Member Functions | |
RLPXFrameCoder (RLPXHandshake const &_init) | |
RLPXFrameCoder (bool _originated, h512 const &_remoteEphemeral, h256 const &_remoteNonce, KeyPair const &_ecdheLocal, h256 const &_nonce, bytesConstRef _ackCipher, bytesConstRef _authCipher) | |
Construct with external key material. More... | |
~RLPXFrameCoder () | |
void | writeSingleFramePacket (bytesConstRef _packet, bytes &o_bytes) |
Legacy. Encrypt _packet as ill-defined legacy RLPx frame. More... | |
bool | authAndDecryptHeader (bytesRef io_cipherWithMac) |
Authenticate and decrypt header in-place. More... | |
bool | authAndDecryptFrame (bytesRef io_cipherWithMac) |
Authenticate and decrypt frame in-place. More... | |
h128 | egressDigest () |
Return first 16 bytes of current digest from egress mac. More... | |
h128 | ingressDigest () |
Return first 16 bytes of current digest from ingress mac. More... | |
Private Types | |
enum class | ProtocolIdType : uint16_t { Normal = 0 , Compressed } |
Private Member Functions | |
void | writeFrame (uint16_t _seqId, bytesConstRef _payload, bytes &o_bytes) |
Write continuation frame of segmented payload. More... | |
void | writeFrame (bytesConstRef _header, bytesConstRef _payload, bytes &o_bytes) |
uint32_t | decompressFrame (bytesRef payload, bytes &output) const |
Compression. More... | |
void | LZ4compress (bytesConstRef payload, bytes &output) const |
void | writeCompressedFrame (uint16_t _seqId, bytesConstRef _payload, bytes &o_bytes) |
void | writeCompressedFrame (uint16_t _seqId, uint32_t _totalSize, bytesConstRef _payload, bytes &o_bytes) |
void | updateEgressMACWithHeader (bytesConstRef _headerCipher) |
Update state of egress MAC with frame header. More... | |
void | updateEgressMACWithFrame (bytesConstRef _cipher) |
Update state of egress MAC with frame. More... | |
void | updateIngressMACWithHeader (bytesConstRef _headerCipher) |
Update state of ingress MAC with frame header. More... | |
void | updateIngressMACWithFrame (bytesConstRef _cipher) |
Update state of ingress MAC with frame. More... | |
void | setup (bool _originated, h512 const &_remoteEphemeral, h256 const &_remoteNonce, KeyPair const &_ecdheLocal, h256 const &_nonce, bytesConstRef _ackCipher, bytesConstRef _authCipher) |
Establish shared secrets and setup AES and MAC states. More... | |
Private Attributes | |
std::unique_ptr< class RLPXFrameCoderImpl > | m_impl |
Static Private Attributes | |
static constexpr size_t | MAX_PACKET_SIZE = 15 * 1024 * 1024 |
Friends | |
struct | Session |
Encoder/decoder transport for RLPx connection established by RLPXHandshake.
rename to RLPXTranscoder
Remove 'Frame' nomenclature and expect caller to provide RLPXFrame
Remove handshake as friend, remove handshake-based constructor
Thread Safety Distinct Objects: Unsafe. Shared objects: Unsafe.
|
strongprivate |
|
explicit |
Construct; requires instance of RLPXHandshake which has encrypted ECDH key exchange (first two phases of handshake).
RLPXFrameCoder::RLPXFrameCoder | ( | bool | _originated, |
h512 const & | _remoteEphemeral, | ||
h256 const & | _remoteNonce, | ||
KeyPair const & | _ecdheLocal, | ||
h256 const & | _nonce, | ||
bytesConstRef | _ackCipher, | ||
bytesConstRef | _authCipher | ||
) |
Construct with external key material.
RLPXFrameCoder::~RLPXFrameCoder | ( | ) |
bool RLPXFrameCoder::authAndDecryptFrame | ( | bytesRef | io_cipherWithMac | ) |
Authenticate and decrypt frame in-place.
bool RLPXFrameCoder::authAndDecryptHeader | ( | bytesRef | io_cipherWithMac | ) |
Authenticate and decrypt header in-place.
Compression.
dev::h128 RLPXFrameCoder::egressDigest | ( | ) |
Return first 16 bytes of current digest from egress mac.
dev::h128 RLPXFrameCoder::ingressDigest | ( | ) |
Return first 16 bytes of current digest from ingress mac.
|
private |
|
private |
Establish shared secrets and setup AES and MAC states.
|
private |
Update state of egress MAC with frame.
|
private |
Update state of egress MAC with frame header.
|
private |
Update state of ingress MAC with frame.
|
private |
Update state of ingress MAC with frame header.
|
private |
|
private |
|
private |
|
private |
Write continuation frame of segmented payload.
void RLPXFrameCoder::writeSingleFramePacket | ( | bytesConstRef | _packet, |
bytes & | o_bytes | ||
) |
Legacy. Encrypt _packet as ill-defined legacy RLPx frame.
|
friend |
|
private |
|
staticconstexprprivate |