proxygen
proxygen::PassThroughTransportFilter Class Reference

#include <TransportFilter.h>

Inheritance diagram for proxygen::PassThroughTransportFilter:
proxygen::GenericFilter< T1, T2, set_callback, TakeOwnership, Dp > T1 T2

Public Member Functions

 PassThroughTransportFilter (bool calls=true, bool callbacks=true)
 
void getReadBuffer (void **bufReturn, size_t *lenReturn) override
 
void readDataAvailable (size_t len) noexceptoverride
 
void readEOF () noexceptoverride
 
void readErr (const folly::AsyncSocketException &ex) noexceptoverride
 
void setReadCB (folly::AsyncTransportWrapper::ReadCallback *callback) override
 
folly::AsyncTransportWrapper::ReadCallbackgetReadCallback () const override
 
void write (folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags) override
 
void writev (folly::AsyncTransportWrapper::WriteCallback *callback, const iovec *vec, size_t count, folly::WriteFlags flags) override
 
void writeChain (folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&iob, folly::WriteFlags flags) override
 
void close () override
 
void closeNow () override
 
void closeWithReset () override
 
void shutdownWrite () override
 
void shutdownWriteNow () override
 
bool good () const override
 
bool readable () const override
 
bool connecting () const override
 
bool error () const override
 
void attachEventBase (folly::EventBase *eventBase) override
 
void detachEventBase () override
 
bool isDetachable () const override
 
folly::EventBasegetEventBase () const override
 
void setSendTimeout (uint32_t milliseconds) override
 
uint32_t getSendTimeout () const override
 
void getLocalAddress (folly::SocketAddress *address) const override
 
void getPeerAddress (folly::SocketAddress *address) const override
 
void setEorTracking (bool track) override
 
size_t getAppBytesWritten () const override
 
size_t getRawBytesWritten () const override
 
size_t getAppBytesReceived () const override
 
size_t getRawBytesReceived () const override
 
- Public Member Functions inherited from proxygen::GenericFilter< T1, T2, set_callback, TakeOwnership, Dp >
 GenericFilter (bool calls, bool callbacks)
 
 ~GenericFilter () override
 
void append (Filter *nextFilter)
 

Additional Inherited Members

- Public Types inherited from proxygen::GenericFilter< T1, T2, set_callback, TakeOwnership, Dp >
using Filter = GenericFilter< T1, T2, set_callback, TakeOwnership, Dp >
 
- Public Attributes inherited from proxygen::GenericFilter< T1, T2, set_callback, TakeOwnership, Dp >
const bool kWantsCalls_
 
const bool kWantsCallbacks_
 
- Protected Member Functions inherited from proxygen::GenericFilter< T1, T2, set_callback, TakeOwnership, Dp >
void setCallbackInternal (T2 *cb)
 
void drop ()
 
- Protected Attributes inherited from proxygen::GenericFilter< T1, T2, set_callback, TakeOwnership, Dp >
T1call_ {nullptr}
 
T2callback_ {nullptr}
 

Detailed Description

An implementation of Transport that passes through all calls and also properly calls setCallback(). This is useful to subclass if you aren't interested in intercepting every function. See AsyncTransport.h for documentation on these methods

Definition at line 31 of file TransportFilter.h.

Constructor & Destructor Documentation

proxygen::PassThroughTransportFilter::PassThroughTransportFilter ( bool  calls = true,
bool  callbacks = true 
)
inlineexplicit

By default, the filter gets both calls and callbacks

Definition at line 36 of file TransportFilter.h.

References attachEventBase(), close(), closeNow(), closeWithReset(), connecting(), count, detachEventBase(), error(), getAppBytesReceived(), getAppBytesWritten(), getEventBase(), getLocalAddress(), getPeerAddress(), getRawBytesReceived(), getRawBytesWritten(), getReadBuffer(), getReadCallback(), getSendTimeout(), good(), isDetachable(), folly::pushmi::__adl::noexcept(), readable(), readDataAvailable(), readEOF(), readErr(), setEorTracking(), setReadCB(), folly::AsyncTransportWrapper::setReadCB(), setSendTimeout(), shutdownWrite(), shutdownWriteNow(), uint32_t, write(), writeChain(), and writev().

37  :
38  TransportFilter(calls, callbacks) {}
GenericFilter< folly::AsyncTransportWrapper, folly::AsyncTransportWrapper::ReadCallback,&folly::AsyncTransportWrapper::setReadCB, true, folly::AsyncTransportWrapper::Destructor > TransportFilter

Member Function Documentation

void proxygen::PassThroughTransportFilter::attachEventBase ( folly::EventBase eventBase)
override

Definition at line 110 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

110  {
111  call_->attachEventBase(eventBase);
112 }
void proxygen::PassThroughTransportFilter::close ( )
override

Definition at line 71 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

71  {
72  call_->close();
73  // wait for readEOF() to call destroy()
74 }
void proxygen::PassThroughTransportFilter::closeNow ( )
override

Definition at line 76 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

76  {
77  call_->closeNow();
78  // wait for readEOF() to call destroy()
79 }
void proxygen::PassThroughTransportFilter::closeWithReset ( )
override

Definition at line 81 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

81  {
82  call_->closeWithReset();
83  // wait for readEOF() to call destroy()
84 }
bool proxygen::PassThroughTransportFilter::connecting ( ) const
override

Definition at line 102 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

102  {
103  return call_->connecting();
104 }
void proxygen::PassThroughTransportFilter::detachEventBase ( )
override

Definition at line 114 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

114  {
115  call_->detachEventBase();
116 }
bool proxygen::PassThroughTransportFilter::error ( ) const
override

Definition at line 106 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

106  {
107  return call_->error();
108 }
size_t proxygen::PassThroughTransportFilter::getAppBytesReceived ( ) const
override

Definition at line 154 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

154  {
155  return call_->getAppBytesReceived();
156 }
size_t proxygen::PassThroughTransportFilter::getAppBytesWritten ( ) const
override

Definition at line 148 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

148  {
149  return call_->getAppBytesWritten();
150 }
EventBase * proxygen::PassThroughTransportFilter::getEventBase ( ) const
override

Definition at line 122 of file TransportFilter.cpp.

References folly::EventBase::getEventBase().

Referenced by PassThroughTransportFilter().

122  {
123  return call_->getEventBase();
124 }
void proxygen::PassThroughTransportFilter::getLocalAddress ( folly::SocketAddress address) const
override

Definition at line 134 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

135  {
136  call_->getLocalAddress(address);
137 }
void proxygen::PassThroughTransportFilter::getPeerAddress ( folly::SocketAddress address) const
override

Definition at line 139 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

140  {
141  call_->getPeerAddress(address);
142 }
size_t proxygen::PassThroughTransportFilter::getRawBytesReceived ( ) const
override

Definition at line 157 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

157  {
158  //new PassThroughTransportFilter();
159  return call_->getRawBytesReceived();
160 }
size_t proxygen::PassThroughTransportFilter::getRawBytesWritten ( ) const
override

Definition at line 151 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

151  {
152  return call_->getRawBytesWritten();
153 }
void proxygen::PassThroughTransportFilter::getReadBuffer ( void **  bufReturn,
size_t *  lenReturn 
)
override

Definition at line 19 of file TransportFilter.cpp.

References callback_.

Referenced by PassThroughTransportFilter().

20  {
21  callback_->getReadBuffer(bufReturn, lenReturn);
22 }
AsyncTransportWrapper::ReadCallback * proxygen::PassThroughTransportFilter::getReadCallback ( ) const
override

Definition at line 49 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

49  {
50  return call_->getReadCallback();
51 }
uint32_t proxygen::PassThroughTransportFilter::getSendTimeout ( ) const
override

Definition at line 130 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

130  {
131  return call_->getSendTimeout();
132 }
bool proxygen::PassThroughTransportFilter::good ( ) const
override

Definition at line 94 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

94  {
95  return call_->good();
96 }
bool proxygen::PassThroughTransportFilter::isDetachable ( ) const
override

Definition at line 118 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

118  {
119  return call_->isDetachable();
120 }
bool proxygen::PassThroughTransportFilter::readable ( ) const
override

Definition at line 98 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

98  {
99  return call_->readable();
100 }
void proxygen::PassThroughTransportFilter::readDataAvailable ( size_t  len)
overridenoexcept

Definition at line 24 of file TransportFilter.cpp.

References callback_.

Referenced by PassThroughTransportFilter().

24  {
25  callback_->readDataAvailable(len);
26 }
void proxygen::PassThroughTransportFilter::readEOF ( )
overridenoexcept

Definition at line 28 of file TransportFilter.cpp.

References callback_, and destroy().

Referenced by PassThroughTransportFilter().

28  {
29  callback_->readEOF();
30  destroy();
31 }
static void destroy()
void proxygen::PassThroughTransportFilter::readErr ( const folly::AsyncSocketException ex)
overridenoexcept

Definition at line 33 of file TransportFilter.cpp.

References callback_, and destroy().

Referenced by PassThroughTransportFilter().

34  {
35  callback_->readErr(ex);
36  destroy();
37 }
static void destroy()
void proxygen::PassThroughTransportFilter::setEorTracking ( bool  track)
override

Definition at line 144 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

144  {
145  call_->setEorTracking(track);
146 }
void proxygen::PassThroughTransportFilter::setReadCB ( folly::AsyncTransportWrapper::ReadCallback callback)
override

Definition at line 41 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

42  {
43  // Important! The filter must call setCallbackInternal in its base class and
44  // it must not forward the call.
45  setCallbackInternal(callback);
46 }
void setCallbackInternal(T2 *cb)
Definition: FilterChain.h:111
void proxygen::PassThroughTransportFilter::setSendTimeout ( uint32_t  milliseconds)
override

Definition at line 126 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

126  {
127  call_->setSendTimeout(milliseconds);
128 }
void proxygen::PassThroughTransportFilter::shutdownWrite ( )
override

Definition at line 86 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

86  {
87  call_->shutdownWrite();
88 }
void proxygen::PassThroughTransportFilter::shutdownWriteNow ( )
override

Definition at line 90 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

90  {
91  call_->shutdownWriteNow();
92 }
void proxygen::PassThroughTransportFilter::write ( folly::AsyncTransportWrapper::WriteCallback callback,
const void *  buf,
size_t  bytes,
folly::WriteFlags  flags 
)
override

Definition at line 53 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

55  {
56  call_->write(callback, buf, bytes, flags);
57 }
flags
Definition: http_parser.h:127
void proxygen::PassThroughTransportFilter::writeChain ( folly::AsyncTransportWrapper::WriteCallback callback,
std::unique_ptr< folly::IOBuf > &&  iob,
folly::WriteFlags  flags 
)
override

Definition at line 65 of file TransportFilter.cpp.

References folly::gen::move.

Referenced by PassThroughTransportFilter().

67  {
68  call_->writeChain(callback, std::move(iob), flags);
69 }
flags
Definition: http_parser.h:127
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void proxygen::PassThroughTransportFilter::writev ( folly::AsyncTransportWrapper::WriteCallback callback,
const iovec *  vec,
size_t  count,
folly::WriteFlags  flags 
)
override

Definition at line 59 of file TransportFilter.cpp.

Referenced by PassThroughTransportFilter().

61  {
62  call_->writev(callback, vec, count, flags);
63 }
flags
Definition: http_parser.h:127
Definition: Traits.h:588
int * count

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