PcapPlusPlus
pcpp::HttpMessage Class Reference

#include <HttpLayer.h>

Inheritance diagram for pcpp::HttpMessage:
pcpp::TextBasedProtocolMessage pcpp::Layer pcpp::IDataContainer pcpp::HttpRequestLayer pcpp::HttpResponseLayer

Public Member Functions

virtual HeaderFieldaddField (const std::string &fieldName, const std::string &fieldValue)
 
virtual HeaderFieldaddField (const HeaderField &newField)
 
virtual HeaderFieldinsertField (HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
 
virtual HeaderFieldinsertField (HeaderField *prevField, const HeaderField &newField)
 
OsiModelLayer getOsiModelLayer ()
 
- Public Member Functions inherited from pcpp::TextBasedProtocolMessage
HeaderFieldgetFieldByName (std::string fieldName, int index=0)
 
HeaderFieldgetFirstField ()
 
HeaderFieldgetNextField (HeaderField *prevField)
 
int getFieldCount ()
 
HeaderFieldaddEndOfHeader ()
 
virtual HeaderFieldinsertField (std::string prevFieldName, const std::string &fieldName, const std::string &fieldValue)
 
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 ()
 
LayergetNextLayer ()
 
LayergetPrevLayer ()
 
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
 

Static Public Member Functions

static const std::map< uint16_t, bool > * getHTTPPortMap ()
 

Detailed Description

Represents a general HTTP message. It's an abstract class and cannot be instantiated. It's inherited by HttpRequestLayer and HttpResponseLayer

Member Function Documentation

◆ addField() [1/2]

virtual HeaderField* pcpp::HttpMessage::addField ( const std::string &  fieldName,
const std::string &  fieldValue 
)
virtual

Add a new header field to this message. This field will be added last (before the end-of-header field)

Parameters
[in]fieldNameThe field name
[in]fieldValueThe field value
Returns
A pointer to the newly created header field, or NULL if the field could not be created

Reimplemented from pcpp::TextBasedProtocolMessage.

◆ addField() [2/2]

virtual HeaderField* pcpp::HttpMessage::addField ( const HeaderField newField)
virtual

Add a new header field to this message. This field will be added last (before the end-of-header field)

Parameters
[in]newFieldThe header field to add
Returns
A pointer to the newly created header field, or NULL if the field could not be created

Reimplemented from pcpp::TextBasedProtocolMessage.

◆ getHTTPPortMap()

static const std::map<uint16_t, bool>* pcpp::HttpMessage::getHTTPPortMap ( )
static
Returns
A pointer to a map containing all TCP ports recognize as HTTP

◆ getOsiModelLayer()

OsiModelLayer pcpp::HttpMessage::getOsiModelLayer ( )
inlinevirtual
Returns
The OSI Model layer this protocol belongs to

Implements pcpp::Layer.

◆ insertField() [1/2]

virtual HeaderField* pcpp::HttpMessage::insertField ( HeaderField prevField,
const std::string &  fieldName,
const std::string &  fieldValue 
)
virtual

Insert a new field after an existing field

Parameters
[in]prevFieldA pointer to the existing field. If it's NULL the new field will be added as first field
[in]fieldNameThe field name
[in]fieldValueThe field value
Returns
A pointer to the newly created header field, or NULL if the field could not be created

Reimplemented from pcpp::TextBasedProtocolMessage.

◆ insertField() [2/2]

virtual HeaderField* pcpp::HttpMessage::insertField ( HeaderField prevField,
const HeaderField newField 
)
virtual

Insert a new field after an existing field

Parameters
[in]prevFieldA pointer to the existing field
[in]newFieldThe header field to add
Returns
A pointer to the newly created header field, or NULL if the field could not be created

Reimplemented from pcpp::TextBasedProtocolMessage.