PcapPlusPlus
20.08
|
#include <TextBasedProtocol.h>
Public Member Functions | |
HeaderField (const HeaderField &other) | |
HeaderField & | operator= (const HeaderField &other) |
size_t | getFieldSize () const |
std::string | getFieldName () const |
std::string | getFieldValue () const |
bool | setFieldValue (std::string newValue) |
bool | isEndOfHeader () const |
A wrapper class for each text-based-protocol header field, e.g "Host", "Cookie", "Content-Length", "Via", "Call-ID", etc. Each field contains a name (e.g "Host") and a value (e.g "www.wikipedia.org"). The user can get and set both of them through dedicated methods. The separator between header fields is either CRLF ("\r\n\") or LF ("\n") in more rare cases, which means every HeaderField instance is responsible for wrapping and parsing a header field from the previous CRLF (not inclusive) until the next CRLF/LF (inclusive) A special case is with the end of a header, meaning 2 consecutive CRLFs ("\r\n\r\n") or consecutive LFs ("\n\n"). PcapPlusPlus treats the first CRLF/LF as part of the last field in the header, and the second CRLF is an HeaderField instance of its own which name and values are an empty string ("") or pcpp::PCPP_END_OF_TEXT_BASED_PROTOCOL_HEADER
pcpp::HeaderField::HeaderField | ( | const HeaderField & | other | ) |
A copy constructor that creates a new instance out of an existing HeaderField instance. The copied instance will not have shared resources with the original instance, meaning all members and properties are copied
[in] | other | The original instance to copy from |
std::string pcpp::HeaderField::getFieldName | ( | ) | const |
|
inline |
std::string pcpp::HeaderField::getFieldValue | ( | ) | const |
|
inline |
Get an indication whether the field is a field that ends the header (meaning contain only CRLF - see class explanation)
HeaderField& pcpp::HeaderField::operator= | ( | const HeaderField & | other | ) |
Assignment operator for this class. This method copies the data from the other instance and will not share any resources with it. Also, if the instance already contains data it will be deleted or zeroed
[in] | other | The instance to assign from |
bool pcpp::HeaderField::setFieldValue | ( | std::string | newValue | ) |
A setter for field value
[in] | newValue | The new value to set to the field. Old value will be deleted |