proxygen
folly::SNIClient Class Reference

#include <AsyncSSLSocketTest.h>

Inheritance diagram for folly::SNIClient:
folly::AsyncSSLSocket::HandshakeCB folly::AsyncWriter::WriteCallback

Public Member Functions

 SNIClient (AsyncSSLSocket::UniquePtr socket)
 

Public Attributes

bool serverNameMatch
 

Private Member Functions

void handshakeSuc (AsyncSSLSocket *) noexceptoverride
 
void handshakeErr (AsyncSSLSocket *, const AsyncSocketException &ex) noexceptoverride
 
void writeSuccess () noexceptoverride
 
void writeErr (size_t bytesWritten, const AsyncSocketException &ex) noexceptoverride
 
- Private Member Functions inherited from folly::AsyncSSLSocket::HandshakeCB
virtual ~HandshakeCB ()=default
 
virtual bool handshakeVer (AsyncSSLSocket *, bool preverifyOk, X509_STORE_CTX *) noexcept
 
- Private Member Functions inherited from folly::AsyncWriter::WriteCallback
virtual ~WriteCallback ()=default
 

Private Attributes

AsyncSSLSocket::UniquePtr socket_
 

Detailed Description

Definition at line 1029 of file AsyncSSLSocketTest.h.

Constructor & Destructor Documentation

folly::SNIClient::SNIClient ( AsyncSSLSocket::UniquePtr  socket)
inlineexplicit

Definition at line 1032 of file AsyncSSLSocketTest.h.

References folly::SendMsgParamsCallbackBase::socket_.

1033  : serverNameMatch(false), socket_(std::move(socket)) {
1034  socket_->sslConn(this);
1035  }
AsyncSSLSocket::UniquePtr socket_
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412

Member Function Documentation

void folly::SNIClient::handshakeErr ( AsyncSSLSocket sock,
const AsyncSocketException ex 
)
inlineoverrideprivatevirtualnoexcept

handshakeErr() is called if an error occurs while establishing the SSL connection.

The HandshakeCB will be uninstalled before handshakeErr() is called.

Parameters
sockSSL socket on which the handshake was initiated
exAn exception representing the error.

Implements folly::AsyncSSLSocket::HandshakeCB.

Definition at line 1043 of file AsyncSSLSocketTest.h.

References ADD_FAILURE.

1045  {
1046  ADD_FAILURE() << "client handshake error: " << ex.what();
1047  }
#define ADD_FAILURE()
Definition: gtest.h:1808
void folly::SNIClient::handshakeSuc ( AsyncSSLSocket sock)
inlineoverrideprivatevirtualnoexcept

handshakeSuc() is called when a new SSL connection is established, i.e., after SSL_accept/connect() returns successfully.

The HandshakeCB will be uninstalled before handshakeSuc() is called.

Parameters
sockSSL socket on which the handshake was initiated

Implements folly::AsyncSSLSocket::HandshakeCB.

Definition at line 1040 of file AsyncSSLSocketTest.h.

References folly::SendMsgParamsCallbackBase::socket_.

1040  {
1041  serverNameMatch = socket_->isServerNameMatch();
1042  }
AsyncSSLSocket::UniquePtr socket_
void folly::SNIClient::writeErr ( size_t  bytesWritten,
const AsyncSocketException ex 
)
inlineoverrideprivatevirtualnoexcept

writeError() will be invoked if an error occurs writing the data.

Parameters
bytesWrittenThe number of bytes that were successfull
exAn exception describing the error that occurred.

Implements folly::AsyncWriter::WriteCallback.

Definition at line 1051 of file AsyncSSLSocketTest.h.

References ADD_FAILURE.

1053  {
1054  ADD_FAILURE() << "client write error after " << bytesWritten
1055  << " bytes: " << ex.what();
1056  }
#define ADD_FAILURE()
Definition: gtest.h:1808
void folly::SNIClient::writeSuccess ( )
inlineoverrideprivatevirtualnoexcept

writeSuccess() will be invoked when all of the data has been successfully written.

Note that this mainly signals that the buffer containing the data to write is no longer needed and may be freed or re-used. It does not guarantee that the data has been fully transmitted to the remote endpoint. For example, on socket-based transports, writeSuccess() only indicates that the data has been given to the kernel for eventual transmission.

Implements folly::AsyncWriter::WriteCallback.

Definition at line 1048 of file AsyncSSLSocketTest.h.

References folly::SendMsgParamsCallbackBase::socket_.

1048  {
1049  socket_->close();
1050  }
AsyncSSLSocket::UniquePtr socket_

Member Data Documentation

bool folly::SNIClient::serverNameMatch

Definition at line 1037 of file AsyncSSLSocketTest.h.

Referenced by folly::TEST().

AsyncSSLSocket::UniquePtr folly::SNIClient::socket_
private

Definition at line 1058 of file AsyncSSLSocketTest.h.


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