![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Public Member Functions | |
cChunkedTEParser (Super::cCallbacks &a_Callbacks) | |
![]() | |
virtual | ~cTransferEncodingParser () |
![]() | |
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 (void) 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... | |
![]() | |
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... | |
![]() | |
cCallbacks & | m_Callbacks |
The callbacks used to report progress. More... | |
Private Types | |
typedef cTransferEncodingParser | Super |
Additional Inherited Members | |
![]() | |
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 34 of file TransferEncodingParser.cpp.
|
inline |
Definition at line 24 of file TransferEncodingParser.cpp.
|
inlineprotected |
Calls the OnError callback and sets parser state to finished.
Definition at line 58 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 294 of file TransferEncodingParser.cpp.
|
inlineoverrideprotectedvirtual |
Called when a full header line is parsed.
Implements cEnvelopeParser::cCallbacks.
Definition at line 305 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 268 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 192 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 209 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 231 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 68 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 166 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 134 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 251 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 51 of file TransferEncodingParser.cpp.
|
protected |
The current state of the parser (parsing chunk length / chunk data).
Definition at line 47 of file TransferEncodingParser.cpp.
|
protected |
The parser used for the last (empty) chunk's trailer data.
Definition at line 54 of file TransferEncodingParser.cpp.