proxygen
TransportFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
15 
16 namespace proxygen {
17 
18 typedef GenericFilter<
22  true,
24 
31 class PassThroughTransportFilter: public TransportFilter {
32  public:
36  explicit PassThroughTransportFilter(bool calls = true,
37  bool callbacks = true):
38  TransportFilter(calls, callbacks) {}
39 
40  // AsyncTransportWrapper::ReadCallback methods
41 
42  void getReadBuffer(void** bufReturn, size_t* lenReturn) override;
43 
44  void readDataAvailable(size_t len) noexcept override;
45 
46  void readEOF() noexcept override;
47 
48  void readErr(const folly::AsyncSocketException& ex)
49  noexcept override;
50 
51  // AsyncTransport methods
52 
53  void setReadCB(
54  folly::AsyncTransportWrapper::ReadCallback* callback) override;
55 
56  folly::AsyncTransportWrapper::ReadCallback* getReadCallback()
57  const override;
58 
60  const void* buf, size_t bytes,
61  folly::WriteFlags flags) override;
62 
64  const iovec* vec, size_t count,
65  folly::WriteFlags flags) override;
66 
67  void writeChain(
69  std::unique_ptr<folly::IOBuf>&& iob,
70  folly::WriteFlags flags) override;
71 
72  void close() override;
73 
74  void closeNow() override;
75 
76  void closeWithReset() override;
77 
78  void shutdownWrite() override;
79 
80  void shutdownWriteNow() override;
81 
82  bool good() const override;
83 
84  bool readable() const override;
85 
86  bool connecting() const override;
87 
88  bool error() const override;
89 
90  void attachEventBase(folly::EventBase* eventBase) override;
91 
92  void detachEventBase() override;
93 
94  bool isDetachable() const override;
95 
96  folly::EventBase* getEventBase() const override;
97 
98  void setSendTimeout(uint32_t milliseconds) override;
99 
100  uint32_t getSendTimeout() const override;
101 
102  void getLocalAddress(
103  folly::SocketAddress* address) const override;
104 
105  void getPeerAddress(
106  folly::SocketAddress* address) const override;
107 
108  void setEorTracking(bool track) override;
109 
110  size_t getAppBytesWritten() const override;
111  size_t getRawBytesWritten() const override;
112  size_t getAppBytesReceived() const override;
113  size_t getRawBytesReceived() const override;
114 };
115 
116 typedef FilterChain<
117  folly::AsyncTransportWrapper,
122 
123 }
void getPeerAddress(folly::SocketAddress *address) const override
flags
Definition: http_parser.h:127
FilterChain< folly::AsyncTransportWrapper, folly::AsyncTransportWrapper::ReadCallback, PassThroughTransportFilter,&folly::AsyncTransportWrapper::setReadCB, false > TransportFilterChain
void attachEventBase(folly::EventBase *eventBase) override
size_t getRawBytesWritten() const override
PassThroughTransportFilter(bool calls=true, bool callbacks=true)
void setSendTimeout(uint32_t milliseconds) override
void setEorTracking(bool track) override
requires E e noexcept(noexcept(s.error(std::move(e))))
void writev(folly::AsyncTransportWrapper::WriteCallback *callback, const iovec *vec, size_t count, folly::WriteFlags flags) override
void setReadCB(ReadCallback *callback) override=0
void write(folly::AsyncTransportWrapper::WriteCallback *callback, const void *buf, size_t bytes, folly::WriteFlags flags) override
folly::EventBase * getEventBase() const override
uint32_t getSendTimeout() const override
size_t getRawBytesReceived() const override
void readErr(const folly::AsyncSocketException &ex) noexceptoverride
size_t getAppBytesReceived() const override
void setReadCB(folly::AsyncTransportWrapper::ReadCallback *callback) override
Definition: Traits.h:588
GenericFilter< folly::AsyncTransportWrapper, folly::AsyncTransportWrapper::ReadCallback,&folly::AsyncTransportWrapper::setReadCB, true, folly::AsyncTransportWrapper::Destructor > TransportFilter
void readDataAvailable(size_t len) noexceptoverride
void writeChain(folly::AsyncTransportWrapper::WriteCallback *callback, std::unique_ptr< folly::IOBuf > &&iob, folly::WriteFlags flags) override
int * count
size_t getAppBytesWritten() const override
void getLocalAddress(folly::SocketAddress *address) const override
AsyncReader::ReadCallback ReadCallback
folly::AsyncTransportWrapper::ReadCallback * getReadCallback() const override
void getReadBuffer(void **bufReturn, size_t *lenReturn) override