proxygen
folly::AsyncTransportWrapper Class Referenceabstract

#include <AsyncTransport.h>

Inheritance diagram for folly::AsyncTransportWrapper:
folly::AsyncTransport folly::AsyncReader folly::AsyncWriter folly::DelayedDestruction folly::AsyncSocketBase folly::DelayedDestructionBase folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper > fizz::test::LocalTransport folly::AsyncSocket folly::DecoratedAsyncTransportWrapper< T > folly::test::MockAsyncTransport TestAsyncTransport folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper > AsyncSocketImmediateRead folly::AsyncSSLSocket folly::test::MockAsyncSocket folly::WriteChainAsyncTransportWrapper< T > fizz::AsyncFizzBase folly::test::TestWriteChainAsyncTransportWrapper folly::MockAsyncSSLSocket folly::test::MockAsyncSSLSocket fizz::client::AsyncFizzClientT< fizz::client::test::MockClientStateMachineInstance > fizz::server::AsyncFizzServerT< fizz::server::test::MockServerStateMachineInstance > fizz::client::AsyncFizzClientT< SM > fizz::server::AsyncFizzServerT< SM > fizz::test::AsyncFizzBaseTest fizz::test::MockAsyncFizzBase fizz::client::test::MockAsyncFizzClient fizz::server::test::MockAsyncFizzServerT< SM >

Public Types

using UniquePtr = std::unique_ptr< AsyncTransportWrapper, Destructor >
 
using ReadCallback = AsyncReader::ReadCallback
 
using WriteCallback = AsyncWriter::WriteCallback
 
- Public Types inherited from folly::AsyncTransport
typedef std::unique_ptr< AsyncTransport, DestructorUniquePtr
 

Public Member Functions

void setReadCB (ReadCallback *callback) override=0
 
ReadCallbackgetReadCallback () const override=0
 
void write (WriteCallback *callback, const void *buf, size_t bytes, WriteFlags flags=WriteFlags::NONE) override=0
 
void writev (WriteCallback *callback, const iovec *vec, size_t count, WriteFlags flags=WriteFlags::NONE) override=0
 
void writeChain (WriteCallback *callback, std::unique_ptr< IOBuf > &&buf, WriteFlags flags=WriteFlags::NONE) override=0
 
virtual const AsyncTransportWrappergetWrappedTransport () const
 
template<class T >
const TgetUnderlyingTransport () const
 
template<class T >
TgetUnderlyingTransport ()
 
- Public Member Functions inherited from folly::AsyncTransport
virtual void close ()=0
 
virtual void closeNow ()=0
 
virtual void closeWithReset ()
 
virtual void shutdownWrite ()=0
 
virtual void shutdownWriteNow ()=0
 
virtual bool good () const =0
 
virtual bool readable () const =0
 
virtual bool writable () const
 
virtual bool isPending () const
 
virtual bool connecting () const =0
 
virtual bool error () const =0
 
virtual void attachEventBase (EventBase *eventBase)=0
 
virtual void detachEventBase ()=0
 
virtual bool isDetachable () const =0
 
virtual void setSendTimeout (uint32_t milliseconds)=0
 
virtual uint32_t getSendTimeout () const =0
 
virtual void getLocalAddress (SocketAddress *address) const =0
 
SocketAddress getLocalAddress () const
 
void getAddress (SocketAddress *address) const override
 
virtual void getPeerAddress (SocketAddress *address) const =0
 
SocketAddress getPeerAddress () const
 
virtual ssl::X509UniquePtr getPeerCert () const
 
virtual const X509 * getSelfCert () const
 
virtual const AsyncTransportCertificategetPeerCertificate () const
 
virtual const AsyncTransportCertificategetSelfCertificate () const
 
virtual std::string getApplicationProtocol () const noexcept
 
virtual std::string getSecurityProtocol () const
 
virtual bool isEorTrackingEnabled () const =0
 
virtual void setEorTracking (bool track)=0
 
virtual size_t getAppBytesWritten () const =0
 
virtual size_t getRawBytesWritten () const =0
 
virtual size_t getAppBytesReceived () const =0
 
virtual size_t getRawBytesReceived () const =0
 
virtual bool isReplaySafe () const
 
virtual void setReplaySafetyCallback (ReplaySafetyCallback *callback)
 
- Public Member Functions inherited from folly::DelayedDestruction
virtual void destroy ()
 
bool getDestroyPending () const
 
- Public Member Functions inherited from folly::DelayedDestructionBase
virtual ~DelayedDestructionBase ()=default
 
- Public Member Functions inherited from folly::AsyncSocketBase
virtual EventBasegetEventBase () const =0
 
virtual ~AsyncSocketBase ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from folly::AsyncTransport
 ~AsyncTransport () override=default
 
- Protected Member Functions inherited from folly::DelayedDestruction
 ~DelayedDestruction () override=default
 
 DelayedDestruction ()
 
- Protected Member Functions inherited from folly::DelayedDestructionBase
 DelayedDestructionBase ()
 
uint32_t getDestructorGuardCount () const
 
- Protected Member Functions inherited from folly::AsyncReader
virtual ~AsyncReader ()=default
 
- Protected Member Functions inherited from folly::AsyncWriter
virtual ~AsyncWriter ()=default
 

Detailed Description

Definition at line 697 of file AsyncTransport.h.

Member Typedef Documentation

Definition at line 701 of file AsyncTransport.h.

Member Function Documentation

template<class T >
const T* folly::AsyncTransportWrapper::getUnderlyingTransport ( ) const
inline

In many cases when we need to set socket properties or otherwise access the underlying transport from a wrapped transport. This method allows access to the derived classes of the underlying transport.

Definition at line 738 of file AsyncTransport.h.

References current, getWrappedTransport(), and folly::T.

Referenced by proxygen::HTTPSession::connCloseByRemote(), proxygen::HTTPSession::getCertAuthSettingVal(), proxygen::HTTPSession::onCertificate(), proxygen::HTTPSession::onCertificateRequest(), folly::TEST(), and proxygen::HTTPSession::verifyCertAuthSetting().

738  {
739  const AsyncTransportWrapper* current = this;
740  while (current) {
741  auto sock = dynamic_cast<const T*>(current);
742  if (sock) {
743  return sock;
744  }
745  current = current->getWrappedTransport();
746  }
747  return nullptr;
748  }
folly::std T
int current
template<class T >
T* folly::AsyncTransportWrapper::getUnderlyingTransport ( )
inline

Definition at line 751 of file AsyncTransport.h.

References folly::T.

751  {
752  return const_cast<T*>(static_cast<const AsyncTransportWrapper*>(this)
753  ->getUnderlyingTransport<T>());
754  }
folly::std T
virtual const AsyncTransportWrapper* folly::AsyncTransportWrapper::getWrappedTransport ( ) const
inlinevirtual

The transport wrapper may wrap another transport. This returns the transport that is wrapped. It returns nullptr if there is no wrapped transport.

Reimplemented in folly::DecoratedAsyncTransportWrapper< T >, and folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >.

Definition at line 728 of file AsyncTransport.h.

Referenced by getUnderlyingTransport(), and folly::test::MockAsyncTransport::writeChain().

728  {
729  return nullptr;
730  }
void folly::AsyncTransportWrapper::write ( WriteCallback callback,
const void *  buf,
size_t  bytes,
WriteFlags  flags = WriteFlags::NONE 
)
overridepure virtual

If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.

Implements folly::AsyncWriter.

Implemented in folly::AsyncSocket, fizz::test::LocalTransport, folly::DecoratedAsyncTransportWrapper< T >, folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >, folly::WriteChainAsyncTransportWrapper< T >, and folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >.

void folly::AsyncTransportWrapper::writeChain ( WriteCallback callback,
std::unique_ptr< IOBuf > &&  buf,
WriteFlags  flags = WriteFlags::NONE 
)
overridepure virtual

If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.

Implements folly::AsyncWriter.

Implemented in folly::AsyncSocket, fizz::test::LocalTransport, fizz::AsyncFizzBase, folly::WriteChainAsyncTransportWrapper< T >, folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >, folly::DecoratedAsyncTransportWrapper< T >, folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >, folly::test::TestWriteChainAsyncTransportWrapper, and folly::test::MockAsyncTransport.

void folly::AsyncTransportWrapper::writev ( WriteCallback callback,
const iovec *  vec,
size_t  count,
WriteFlags  flags = WriteFlags::NONE 
)
overridepure virtual

If you supply a non-null WriteCallback, exactly one of writeSuccess() or writeErr() will be invoked when the write completes. If you supply the same WriteCallback object for multiple write() calls, it will be invoked exactly once per call. The only way to cancel outstanding write requests is to close the socket (e.g., with closeNow() or shutdownWriteNow()). When closing the socket this way, writeErr() will still be invoked once for each outstanding write operation.

Implements folly::AsyncWriter.

Implemented in folly::AsyncSocket, fizz::test::LocalTransport, folly::DecoratedAsyncTransportWrapper< T >, folly::DecoratedAsyncTransportWrapper< folly::AsyncTransportWrapper >, folly::WriteChainAsyncTransportWrapper< T >, and folly::WriteChainAsyncTransportWrapper< folly::AsyncTransportWrapper >.


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