|
proxygen
|
#include <ByteToMessageDecoder.h>
Public Types | |
| 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 | |
| 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 Attributes | |
| bool | transportActive_ = true |
Additional Inherited Members | |
Static Public Attributes inherited from wangle::InboundHandler< folly::IOBufQueue &, M > | |
| static const HandlerDir | dir |
A Handler which decodes bytes in a stream-like fashion from IOBufQueue to a Message type.
Frame detection
Generally frame detection should be handled earlier in the pipeline by adding a DelimiterBasedFrameDecoder, FixedLengthFrameDecoder, LengthFieldBasedFrameDecoder, LineBasedFrameDecoder.
If a custom frame decoder is required, then one needs to be careful when implementing one with ByteToMessageDecoder. Ensure there are enough bytes in the buffer for a complete frame by checking ByteBuf#readableBytes(). If there are not enough bytes for a complete frame, return without modify the reader index to allow more bytes to arrive.
To check for complete frames without modify the reader index, use IOBufQueue.front(), without split() or pop_front().
Definition at line 44 of file ByteToMessageDecoder.h.
| typedef InboundHandler<folly::IOBufQueue&, M>::Context wangle::ByteToMessageDecoder< M >::Context |
Definition at line 46 of file ByteToMessageDecoder.h.
|
pure virtual |
Decode bytes from buf into result.
Implemented in ByteToStringDecoder.
Referenced by wangle::ByteToMessageDecoder< T >::read().
|
inlineoverride |
Definition at line 66 of file ByteToMessageDecoder.h.
|
inlineoverride |
Definition at line 56 of file ByteToMessageDecoder.h.
|
inlineoverride |
Definition at line 61 of file ByteToMessageDecoder.h.
|
private |
Definition at line 79 of file ByteToMessageDecoder.h.
Referenced by wangle::ByteToMessageDecoder< T >::read(), wangle::ByteToMessageDecoder< T >::transportActive(), and wangle::ByteToMessageDecoder< T >::transportInactive().