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 char* getData()
const;
80 void initNewField(std::string name, std::string value);
83 uint8_t* m_NewFieldData;
85 int m_NameOffsetInMessage;
86 size_t m_FieldNameSize;
87 int m_ValueOffsetInMessage;
88 size_t m_FieldValueSize;
91 bool m_IsEndOfHeaderField;
92 char m_NameValueSeperator;
93 bool m_SpacesAllowedBetweenNameAndValue;
145 virtual HeaderField*
addField(
const std::string& fieldName,
const std::string& fieldValue);
177 virtual HeaderField*
insertField(std::string prevFieldName,
const std::string& fieldName,
const std::string& fieldValue);
202 bool removeField(std::string fieldName,
int index = 0);
232 TextBasedProtocolMessage(
const TextBasedProtocolMessage& other);
233 TextBasedProtocolMessage& operator=(
const TextBasedProtocolMessage& other);
235 void copyDataFrom(
const TextBasedProtocolMessage& other);
238 void shiftFieldsOffset(HeaderField* fromField,
int numOfBytesToShift);
241 virtual char getHeaderFieldNameValueSeparator()
const = 0;
242 virtual bool spacesAllowedBetweenHeaderFieldNameAndValue()
const = 0;
244 HeaderField* m_FieldList;
245 HeaderField* m_LastField;
247 std::multimap<std::string, HeaderField*> m_FieldNameToFieldMap;
254 #endif // PACKETPP_TEXT_BASED_PROTOCOL_LAYER