proxygen
fizz::WriteRecordLayer Class Referenceabstract

#include <RecordLayer.h>

Inheritance diagram for fizz::WriteRecordLayer:
fizz::EncryptedWriteRecordLayer fizz::PlaintextWriteRecordLayer fizz::MockEncryptedWriteRecordLayer fizz::MockPlaintextWriteRecordLayer fizz::test::ConcreteWriteRecordLayer testing::StrictMock< fizz::test::ConcreteWriteRecordLayer > testing::StrictMock< fizz::test::ConcreteWriteRecordLayer > testing::StrictMock< fizz::test::ConcreteWriteRecordLayer >

Public Member Functions

virtual ~WriteRecordLayer ()=default
 
virtual TLSContent write (TLSMessage &&msg) const =0
 
TLSContent writeAlert (Alert &&alert) const
 
TLSContent writeAppData (std::unique_ptr< folly::IOBuf > &&appData) const
 
template<typename... Args>
TLSContent writeHandshake (Buf &&encodedHandshakeMsg, Args &&...args) const
 
void setProtocolVersion (ProtocolVersion version) const
 
virtual EncryptionLevel getEncryptionLevel () const =0
 

Protected Attributes

ProtocolVersion recordVersion_ {ProtocolVersion::tls_1_2}
 
bool useAdditionalData_ {true}
 

Static Private Member Functions

template<typename... Args>
static void addMessage (Buf &buf, Buf &&add, Args &&...args)
 
static void addMessage (Buf &)
 

Detailed Description

Definition at line 59 of file RecordLayer.h.

Constructor & Destructor Documentation

virtual fizz::WriteRecordLayer::~WriteRecordLayer ( )
virtualdefault

Member Function Documentation

template<typename... Args>
static void fizz::WriteRecordLayer::addMessage ( Buf buf,
Buf &&  add,
Args &&...  args 
)
inlinestaticprivate

Definition at line 111 of file RecordLayer.h.

References add, and folly::gen::move.

111  {
112  buf->prependChain(std::move(add));
113  addMessage(buf, std::forward<Args>(args)...);
114  }
auto add
Definition: BaseTest.cpp:70
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
static void addMessage(Buf &buf, Buf &&add, Args &&...args)
Definition: RecordLayer.h:111
static void fizz::WriteRecordLayer::addMessage ( Buf )
inlinestaticprivate

Definition at line 116 of file RecordLayer.h.

116 {}
virtual EncryptionLevel fizz::WriteRecordLayer::getEncryptionLevel ( ) const
pure virtual

Returns the current encryption level of the data that the write record layer writes at.

Implemented in fizz::EncryptedWriteRecordLayer, and fizz::PlaintextWriteRecordLayer.

void fizz::WriteRecordLayer::setProtocolVersion ( ProtocolVersion  version) const
inline

Definition at line 80 of file RecordLayer.h.

References fizz::getRealDraftVersion(), fizz::tls_1_0, fizz::tls_1_2, fizz::tls_1_3_20, fizz::tls_1_3_21, fizz::tls_1_3_22, and fizz::tls_1_3_23.

Referenced by fizz::sm::getCertificateRequest().

80  {
81  auto realVersion = getRealDraftVersion(version);
82  if (realVersion == ProtocolVersion::tls_1_3_21 ||
83  realVersion == ProtocolVersion::tls_1_3_20) {
85  } else {
87  }
88 
89  if (realVersion == ProtocolVersion::tls_1_3_23 ||
90  realVersion == ProtocolVersion::tls_1_3_22 ||
91  realVersion == ProtocolVersion::tls_1_3_21 ||
92  realVersion == ProtocolVersion::tls_1_3_20) {
93  useAdditionalData_ = false;
94  } else {
95  useAdditionalData_ = true;
96  }
97  }
ProtocolVersion recordVersion_
Definition: RecordLayer.h:106
ProtocolVersion version
ProtocolVersion getRealDraftVersion(ProtocolVersion version)
Definition: Types.cpp:16
TLSContent fizz::WriteRecordLayer::writeAlert ( Alert &&  alert) const
inline

Definition at line 65 of file RecordLayer.h.

References fizz::alert, fizz::encode(), folly::gen::move, and fizz::detail::write().

Referenced by fizz::server::detail::handleAppClose(), fizz::client::detail::handleAppClose(), fizz::server::detail::handleError(), and fizz::client::detail::handleError().

65  {
66  return write(TLSMessage{ContentType::alert, encode(std::move(alert))});
67  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
virtual TLSContent write(TLSMessage &&msg) const =0
Buf encode(TokenBindingMessage &&message)
Definition: Types.cpp:124
TLSContent fizz::WriteRecordLayer::writeAppData ( std::unique_ptr< folly::IOBuf > &&  appData) const
inline

Definition at line 69 of file RecordLayer.h.

References fizz::application_data, testing::Args(), folly::gen::move, and fizz::detail::write().

Referenced by fizz::sm::generateTicket(), fizz::sm::getCertificateRequest(), fizz::sm::getMaxEarlyDataSize(), and fizz::sm::handleEarlyAppWrite().

69  {
70  return write(TLSMessage{ContentType::application_data, std::move(appData)});
71  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
virtual TLSContent write(TLSMessage &&msg) const =0
template<typename... Args>
TLSContent fizz::WriteRecordLayer::writeHandshake ( Buf &&  encodedHandshakeMsg,
Args &&...  args 
) const
inline

Definition at line 74 of file RecordLayer.h.

References fizz::handshake, folly::gen::move, and fizz::detail::write().

Referenced by fizz::sm::generateTicket(), fizz::sm::getCertificateRequest(), fizz::sm::getHrrKeyExchangers(), fizz::sm::getMaxEarlyDataSize(), fizz::server::AeadCookieCipher< AeadType, HkdfType >::getStatelessResponse(), fizz::sm::handleCertMsg(), and fizz::sm::writeNewSessionTicket().

74  {
75  TLSMessage msg{ContentType::handshake, std::move(encodedHandshakeMsg)};
76  addMessage(msg.fragment, std::forward<Args>(args)...);
77  return write(std::move(msg));
78  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
virtual TLSContent write(TLSMessage &&msg) const =0
static void addMessage(Buf &buf, Buf &&add, Args &&...args)
Definition: RecordLayer.h:111

Member Data Documentation

ProtocolVersion fizz::WriteRecordLayer::recordVersion_ {ProtocolVersion::tls_1_2}
mutableprotected

Definition at line 106 of file RecordLayer.h.

Referenced by fizz::EncryptedWriteRecordLayer::write().

bool fizz::WriteRecordLayer::useAdditionalData_ {true}
mutableprotected

Definition at line 107 of file RecordLayer.h.

Referenced by fizz::EncryptedWriteRecordLayer::write().


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