proxygen
|
#include <LineBasedFrameDecoder.h>
Public Types | |
enum | TerminatorType { TerminatorType::BOTH, TerminatorType::NEWLINE, TerminatorType::CARRIAGENEWLINE } |
Public Types inherited from wangle::ByteToMessageDecoder< M > | |
typedef InboundHandler< folly::IOBufQueue &, M >::Context | Context |
Public Types inherited from wangle::InboundHandler< folly::IOBufQueue &, M > | |
typedef folly::IOBufQueue & | rin |
typedef M | rout |
typedef folly::Unit | win |
typedef folly::Unit | wout |
typedef InboundHandlerContext< M > | Context |
Public Member Functions | |
LineBasedFrameDecoder (uint32_t maxLength=UINT_MAX, bool stripDelimiter=true, TerminatorType terminatorType=TerminatorType::BOTH) | |
bool | decode (Context *ctx, folly::IOBufQueue &buf, std::unique_ptr< folly::IOBuf > &result, size_t &) override |
Public Member Functions inherited from wangle::ByteToMessageDecoder< M > | |
virtual bool | decode (Context *ctx, folly::IOBufQueue &buf, M &result, size_t &)=0 |
void | transportActive (Context *ctx) override |
void | transportInactive (Context *ctx) override |
void | read (Context *ctx, folly::IOBufQueue &q) override |
Public Member Functions inherited from wangle::InboundHandler< folly::IOBufQueue &, M > | |
~InboundHandler () override=default | |
virtual void | read (Context *ctx, folly::IOBufQueue &msg)=0 |
virtual void | readEOF (Context *ctx) |
virtual void | readException (Context *ctx, folly::exception_wrapper e) |
virtual void | transportActive (Context *ctx) |
virtual void | transportInactive (Context *ctx) |
Public Member Functions inherited from wangle::HandlerBase< InboundHandlerContext< M > > | |
virtual | ~HandlerBase ()=default |
virtual void | attachPipeline (InboundHandlerContext< M > *) |
virtual void | detachPipeline (InboundHandlerContext< M > *) |
InboundHandlerContext< M > * | getContext () |
Private Member Functions | |
int64_t | findEndOfLine (folly::IOBufQueue &buf) |
void | fail (Context *ctx, std::string len) |
Private Attributes | |
uint32_t | maxLength_ |
bool | stripDelimiter_ |
bool | discarding_ {false} |
uint32_t | discardedBytes_ {0} |
TerminatorType | terminatorType_ |
Additional Inherited Members | |
Static Public Attributes inherited from wangle::InboundHandler< folly::IOBufQueue &, M > | |
static const HandlerDir | dir |
A decoder that splits the received IOBufQueue on line endings.
Both "\n" and "\r\n" are handled, or optionally reqire only one or the other.
Definition at line 30 of file LineBasedFrameDecoder.h.
|
strong |
Enumerator | |
---|---|
BOTH | |
NEWLINE | |
CARRIAGENEWLINE |
Definition at line 32 of file LineBasedFrameDecoder.h.
|
explicit |
Definition at line 25 of file LineBasedFrameDecoder.cpp.
|
override |
Definition at line 32 of file LineBasedFrameDecoder.cpp.
References c, folly::IOBufQueue::chainLength(), discardedBytes_, discarding_, fail(), findEndOfLine(), folly::IOBufQueue::front(), int64_t, maxLength_, folly::IOBufQueue::move(), folly::gen::move, folly::IOBufQueue::split(), stripDelimiter_, and folly::IOBufQueue::trimStart().
|
private |
Definition at line 87 of file LineBasedFrameDecoder.cpp.
References maxLength_.
Referenced by gtest_xml_test_utils.GTestXMLTestCase::_GetChildren(), decode(), and fatal_test.FatalTests::is_debug_build().
|
private |
Definition at line 94 of file LineBasedFrameDecoder.cpp.
References b, c, CARRIAGENEWLINE, folly::IOBufQueue::chainLength(), folly::IOBufQueue::front(), i, maxLength_, NEWLINE, terminatorType_, and uint32_t.
Referenced by decode().
|
private |
Definition at line 58 of file LineBasedFrameDecoder.h.
Referenced by decode().
|
private |
Definition at line 57 of file LineBasedFrameDecoder.h.
Referenced by decode().
|
private |
Definition at line 54 of file LineBasedFrameDecoder.h.
Referenced by decode(), fail(), and findEndOfLine().
|
private |
Definition at line 55 of file LineBasedFrameDecoder.h.
Referenced by decode().
|
private |
Definition at line 60 of file LineBasedFrameDecoder.h.
Referenced by findEndOfLine().