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;
81 HeaderField(std::string name, std::string value,
char nameValueSeperator,
bool spacesAllowedBetweenNameAndValue);
84 char* getData()
const;
87 void initNewField(std::string name, std::string value);
90 uint8_t* m_NewFieldData;
92 int m_NameOffsetInMessage;
93 size_t m_FieldNameSize;
94 int m_ValueOffsetInMessage;
95 size_t m_FieldValueSize;
98 bool m_IsEndOfHeaderField;
99 char m_NameValueSeperator;
100 bool m_SpacesAllowedBetweenNameAndValue;
152 virtual HeaderField*
addField(
const std::string& fieldName,
const std::string& fieldValue);
184 virtual HeaderField*
insertField(std::string prevFieldName,
const std::string& fieldName,
const std::string& fieldValue);
209 bool removeField(std::string fieldName,
int index = 0);
239 TextBasedProtocolMessage(
const TextBasedProtocolMessage& other);
240 TextBasedProtocolMessage& operator=(
const TextBasedProtocolMessage& other);
242 void copyDataFrom(
const TextBasedProtocolMessage& other);
245 void shiftFieldsOffset(HeaderField* fromField,
int numOfBytesToShift);
248 virtual char getHeaderFieldNameValueSeparator()
const = 0;
249 virtual bool spacesAllowedBetweenHeaderFieldNameAndValue()
const = 0;
251 HeaderField* m_FieldList;
252 HeaderField* m_LastField;
254 std::multimap<std::string, HeaderField*> m_FieldNameToFieldMap;
261 #endif // PACKETPP_TEXT_BASED_PROTOCOL_LAYER