PcapPlusPlus
22.11
|
#include <TextBasedProtocol.h>
Public Member Functions | |
HeaderField * | getFieldByName (std::string fieldName, int index=0) const |
HeaderField * | getFirstField () const |
HeaderField * | getNextField (HeaderField *prevField) const |
int | getFieldCount () const |
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 () const |
virtual void | parseNextLayer () |
size_t | getHeaderLen () const |
virtual void | computeCalculateFields () |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const |
virtual std::string | toString () const =0 |
virtual OsiModelLayer | getOsiModelLayer () const =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 |
||
) | const |
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 | ( | ) | const |
|
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 | ( | ) | const |
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) |