1 #ifndef PACKETPP_TEXT_BASED_PROTOCOL_LAYER 2 #define PACKETPP_TEXT_BASED_PROTOCOL_LAYER 13 #define PCPP_END_OF_TEXT_BASED_PROTOCOL_HEADER "" 15 class TextBasedProtocolMessage;
74 HeaderField(std::string name, std::string value,
char nameValueSeperator,
bool spacesAllowedBetweenNameAndValue);
77 inline void setNextField(
HeaderField* nextField) { m_NextField = nextField; }
78 inline HeaderField* getNextField() {
return m_NextField; }
79 void initNewField(std::string name, std::string value);
80 void attachToTextBasedProtocolMessage(TextBasedProtocolMessage* message,
int fieldOffsetInMessage);
81 uint8_t* m_NewFieldData;
82 TextBasedProtocolMessage* m_TextBasedProtocolMessage;
83 int m_NameOffsetInMessage;
84 size_t m_FieldNameSize;
85 int m_ValueOffsetInMessage;
86 size_t m_FieldValueSize;
89 bool m_IsEndOfHeaderField;
90 char m_NameValueSeperator;
91 bool m_SpacesAllowedBetweenNameAndValue;
143 virtual HeaderField*
addField(
const std::string& fieldName,
const std::string& fieldValue);
175 virtual HeaderField*
insertField(std::string prevFieldName,
const std::string& fieldName,
const std::string& fieldValue);
200 bool removeField(std::string fieldName,
int index = 0);
230 TextBasedProtocolMessage(
const TextBasedProtocolMessage& other);
231 TextBasedProtocolMessage& operator=(
const TextBasedProtocolMessage& other);
233 void copyDataFrom(
const TextBasedProtocolMessage& other);
236 void shiftFieldsOffset(HeaderField* fromField,
int numOfBytesToShift);
239 virtual char getHeaderFieldNameValueSeparator() = 0;
240 virtual bool spacesAllowedBetweenHeaderFieldNameAndValue() = 0;
242 HeaderField* m_FieldList;
243 HeaderField* m_LastField;
245 std::multimap<std::string, HeaderField*> m_FieldNameToFieldMap;
252 #endif // PACKETPP_TEXT_BASED_PROTOCOL_LAYER virtual void parseNextLayer()
HeaderField * getFirstField()
Definition: TextBasedProtocol.h:123
Definition: TextBasedProtocol.h:104
HeaderField * addEndOfHeader()
The main namespace for the PcapPlusPlus lib.
Definition: TextBasedProtocol.h:31
HeaderField(const HeaderField &other)
std::string getFieldValue() const
HeaderField * getNextField(HeaderField *prevField)
Definition: TextBasedProtocol.h:130
std::string getFieldName() const
HeaderField * getFieldByName(std::string fieldName, int index=0)
virtual HeaderField * insertField(HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
bool isEndOfHeader()
Definition: TextBasedProtocol.h:71
virtual HeaderField * addField(const std::string &fieldName, const std::string &fieldValue)
virtual void computeCalculateFields()
bool setFieldValue(std::string newValue)
bool removeField(HeaderField *fieldToRemove)
size_t getFieldSize()
Definition: TextBasedProtocol.h:49