Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Public Member Functions | |
cChunkedTEParser (Super::cCallbacks &a_Callbacks) | |
Public Member Functions inherited from cTransferEncodingParser | |
virtual | ~cTransferEncodingParser () |
Public Member Functions inherited from cEnvelopeParser::cCallbacks | |
virtual | ~cCallbacks () |
Protected Types | |
enum | eState { psChunkLength , psChunkLengthTrailer , psChunkLengthLF , psChunkData , psChunkDataCR , psChunkDataLF , psTrailer , psFinished } |
Protected Member Functions | |
void | Error (const AString &a_ErrorMsg) |
Calls the OnError callback and sets parser state to finished. More... | |
virtual void | Finish () override |
To be called when the stream is terminated from the source (connection closed). More... | |
virtual void | OnHeaderLine (const AString &a_Key, const AString &a_Value) override |
Called when a full header line is parsed. More... | |
virtual size_t | Parse (const char *a_Data, size_t a_Size) override |
Parses the incoming data and calls the appropriate callbacks. More... | |
size_t | ParseChunkData (const char *a_Data, size_t a_Size) |
Consumes as much chunk data from the input as possible. More... | |
size_t | ParseChunkDataCR (const char *a_Data, size_t a_Size) |
Parses the incoming data, the current state is psChunkDataCR. More... | |
size_t | ParseChunkDataLF (const char *a_Data, size_t a_Size) |
Parses the incoming data, the current state is psChunkDataCR. More... | |
size_t | ParseChunkLength (const char *a_Data, size_t a_Size) |
Parses the incoming data, the current state is psChunkLength. More... | |
size_t | ParseChunkLengthLF (const char *a_Data, size_t a_Size) |
Parses the incoming data, the current state is psChunkLengthLF. More... | |
size_t | ParseChunkLengthTrailer (const char *a_Data, size_t a_Size) |
Parses the incoming data, the current state is psChunkLengthTrailer. More... | |
size_t | ParseTrailer (const char *a_Data, size_t a_Size) |
Parses the incoming data, the current state is psChunkDataCR. More... | |
Protected Member Functions inherited from cTransferEncodingParser | |
cTransferEncodingParser (cCallbacks &a_Callbacks) | |
Protected Attributes | |
size_t | m_ChunkDataLengthLeft |
Number of bytes that still belong to the chunk currently being parsed. More... | |
eState | m_State |
The current state of the parser (parsing chunk length / chunk data). More... | |
cEnvelopeParser | m_TrailerParser |
The parser used for the last (empty) chunk's trailer data. More... | |
Protected Attributes inherited from cTransferEncodingParser | |
cCallbacks & | m_Callbacks |
The callbacks used to report progress. More... | |
Private Types | |
using | Super = cTransferEncodingParser |
Additional Inherited Members | |
Static Public Member Functions inherited from cTransferEncodingParser | |
static cTransferEncodingParserPtr | Create (cCallbacks &a_Callbacks, const AString &a_TransferEncoding, size_t a_ContentLength) |
Creates a new parser for the specified encoding. More... | |
Definition at line 17 of file TransferEncodingParser.cpp.
|
private |
Definition at line 21 of file TransferEncodingParser.cpp.
|
protected |
Definition at line 35 of file TransferEncodingParser.cpp.
|
inline |
Definition at line 25 of file TransferEncodingParser.cpp.
|
inlineprotected |
Calls the OnError callback and sets parser state to finished.
Definition at line 59 of file TransferEncodingParser.cpp.
|
inlineoverrideprotectedvirtual |
To be called when the stream is terminated from the source (connection closed).
Flushes any buffers and calls appropriate callbacks.
Implements cTransferEncodingParser.
Definition at line 295 of file TransferEncodingParser.cpp.
|
inlineoverrideprotectedvirtual |
Called when a full header line is parsed.
Implements cEnvelopeParser::cCallbacks.
Definition at line 306 of file TransferEncodingParser.cpp.
|
inlineoverrideprotectedvirtual |
Parses the incoming data and calls the appropriate callbacks.
Returns the number of bytes from the end of a_Data that is already not part of this message (if the parser can detect it). Returns AString::npos on an error.
Implements cTransferEncodingParser.
Definition at line 269 of file TransferEncodingParser.cpp.
|
inlineprotected |
Consumes as much chunk data from the input as possible.
Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error() handler).
Definition at line 193 of file TransferEncodingParser.cpp.
|
inlineprotected |
Parses the incoming data, the current state is psChunkDataCR.
Only the CR character is expected, if found, moves to psChunkDataLF, otherwise issues an error. Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error handler).
Definition at line 210 of file TransferEncodingParser.cpp.
|
inlineprotected |
Parses the incoming data, the current state is psChunkDataCR.
Only the CR character is expected, if found, moves to psChunkDataLF, otherwise issues an error. Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error handler).
Definition at line 232 of file TransferEncodingParser.cpp.
|
inlineprotected |
Parses the incoming data, the current state is psChunkLength.
Stops parsing when either the chunk length has been read, or there is no more data in the input. Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error handler).
Definition at line 69 of file TransferEncodingParser.cpp.
|
inlineprotected |
Parses the incoming data, the current state is psChunkLengthLF.
Only the LF character is expected, if found, moves to psChunkData, otherwise issues an error. If the chunk length that just finished reading is equal to 0, signals the end of stream (via psTrailer). Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error handler).
Definition at line 167 of file TransferEncodingParser.cpp.
|
inlineprotected |
Parses the incoming data, the current state is psChunkLengthTrailer.
Stops parsing when either the chunk length trailer has been read, or there is no more data in the input. Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error handler).
Definition at line 135 of file TransferEncodingParser.cpp.
|
inlineprotected |
Parses the incoming data, the current state is psChunkDataCR.
The trailer is normally a set of "Header: Value" lines, terminated by an empty line. Use the m_TrailerParser for that. Returns the number of bytes consumed from the input, or AString::npos on error (calls the Error handler).
Definition at line 252 of file TransferEncodingParser.cpp.
|
protected |
Number of bytes that still belong to the chunk currently being parsed.
When in psChunkLength, the value is the currently parsed length digits.
Definition at line 52 of file TransferEncodingParser.cpp.
|
protected |
The current state of the parser (parsing chunk length / chunk data).
Definition at line 48 of file TransferEncodingParser.cpp.
|
protected |
The parser used for the last (empty) chunk's trailer data.
Definition at line 55 of file TransferEncodingParser.cpp.