PcapPlusPlus
|
#include <TextBasedProtocol.h>
Public Member Functions | |
HeaderField * | getFieldByName (std::string fieldName, int index=0) |
HeaderField * | getFirstField () |
HeaderField * | getNextField (HeaderField *prevField) |
int | getFieldCount () |
virtual HeaderField * | addField (const std::string &fieldName, const std::string &fieldValue) |
virtual HeaderField * | addField (const HeaderField &newField) |
HeaderField * | addEndOfHeader () |
virtual HeaderField * | insertField (HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue) |
virtual HeaderField * | insertField (std::string prevFieldName, const std::string &fieldName, const std::string &fieldValue) |
virtual HeaderField * | insertField (HeaderField *prevField, const HeaderField &newField) |
bool | removeField (HeaderField *fieldToRemove) |
bool | removeField (std::string fieldName, int index=0) |
bool | isHeaderComplete () |
virtual void | parseNextLayer () |
size_t | getHeaderLen () |
virtual void | computeCalculateFields () |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () |
Layer * | getPrevLayer () |
ProtocolType | getProtocol () |
uint8_t * | getData () |
size_t | getDataLen () |
uint8_t * | getLayerPayload () |
size_t | getLayerPayloadSize () |
bool | isAllocatedToPacket () |
void | copyData (uint8_t *toArr) |
uint8_t * | getDataPtr (size_t offset=0) |
virtual std::string | toString ()=0 |
virtual OsiModelLayer | getOsiModelLayer ()=0 |
An abstract base class that wraps text-based-protocol header layers (both requests and responses). It is the base class for all those layers. This class is not meant to be instantiated, hence the protected c'tor
HeaderField* pcpp::TextBasedProtocolMessage::addEndOfHeader | ( | ) |
Add the special end-of-header field (see the explanation in HeaderField)
|
virtual |
Add a new header field to this message. This field will be added last (before the end-of-header field)
[in] | fieldName | The field name |
[in] | fieldValue | The field value |
Reimplemented in pcpp::HttpMessage.
|
virtual |
Add a new header field to this message. This field will be added last (before the end-of-header field)
[in] | newField | The header field to add |
Reimplemented in pcpp::HttpMessage.
|
virtual |
HeaderField* pcpp::TextBasedProtocolMessage::getFieldByName | ( | std::string | fieldName, |
int | index = 0 |
||
) |
Get a pointer to a header field by name. The search is case insensitive, meaning if a field with name "Host" exists and the fieldName parameter is "host" (all letter are lower case), this method will return a pointer to "Host" field
[in] | fieldName | The field name |
[in] | index | Optional parameter. If the field name appears more than once, this parameter will indicate which field to get. The default value is 0 (get the first appearance of the field name as appears on the packet) |
int pcpp::TextBasedProtocolMessage::getFieldCount | ( | ) |
|
inline |
|
virtual |
Implements pcpp::Layer.
|
inline |
Get the field which appears after a certain field
[in] | prevField | A pointer to the field |
|
virtual |
Insert a new field after an existing field
[in] | prevField | A pointer to the existing field. If it's NULL the new field will be added as first field |
[in] | fieldName | The field name |
[in] | fieldValue | The field value |
Reimplemented in pcpp::HttpMessage.
|
virtual |
Insert a new field after an existing field
[in] | prevFieldName | A name of an existing field. If the field doesn't exist NULL will be returned. If field name is empty ('') the new field will be added as first field |
[in] | fieldName | The field name |
[in] | fieldValue | The field value |
|
virtual |
Insert a new field after an existing field
[in] | prevField | A pointer to the existing field |
[in] | newField | The header field to add |
Reimplemented in pcpp::HttpMessage.
bool pcpp::TextBasedProtocolMessage::isHeaderComplete | ( | ) |
Indicate whether the header is complete (ending with end-of-header "\r\n\r\n" or "\n\n") or spread over more packets
|
virtual |
Currently set only PayloadLayer for the rest of the data
Implements pcpp::Layer.
Reimplemented in pcpp::SipLayer.
bool pcpp::TextBasedProtocolMessage::removeField | ( | HeaderField * | fieldToRemove | ) |
Remove a field from the message
[in] | fieldToRemove | A pointer to the field that should be removed |
bool pcpp::TextBasedProtocolMessage::removeField | ( | std::string | fieldName, |
int | index = 0 |
||
) |
Remove a field from the message
[in] | fieldName | The name of the field that should be removed |
[in] | index | Optional parameter. If the field name appears more than once, this parameter will indicate which field to remove. The default value is 0 (remove the first appearance of the field name as appears on the packet) |