1 #ifndef PACKETPP_TLV_DATA 2 #define PACKETPP_TLV_DATA 58 m_Data = other.m_Data;
72 if(recordRawData == NULL)
85 m_Data = other.m_Data;
97 if (m_Data == rhs.m_Data)
106 return (memcmp(m_Data, rhs.m_Data,
getTotalSize()) == 0);
123 bool isNull()
const {
return (m_Data == NULL); }
156 memcpy(&result, m_Data->
recordValue + offset,
sizeof(T));
175 memcpy(m_Data->
recordValue + valueOffset, &newValue,
sizeof(T));
196 template<
typename TLVRecordType>
200 mutable size_t m_RecordCount;
214 m_RecordCount = other.m_RecordCount;
228 m_RecordCount = other.m_RecordCount;
243 TLVRecordType resRec(tlvDataBasePtr);
246 if (tlvDataLen == 0 || resRec.getTotalSize() == 0)
261 TLVRecordType
getNextTLVRecord(TLVRecordType& record, uint8_t* tlvDataBasePtr,
size_t tlvDataLen)
const 263 TLVRecordType resRec(NULL);
269 if ((record.getRecordBasePtr() - tlvDataBasePtr) < 0)
273 if (record.getRecordBasePtr() - tlvDataBasePtr + (int)record.getTotalSize() >= (int)tlvDataLen)
276 resRec.assign(record.getRecordBasePtr() + record.getTotalSize());
277 if (resRec.getTotalSize() == 0)
293 TLVRecordType curRec = getFirstTLVRecord(tlvDataBasePtr, tlvDataLen);
294 while (!curRec.isNull())
299 curRec = getNextTLVRecord(curRec, tlvDataBasePtr, tlvDataLen);
317 if (m_RecordCount != (
size_t)-1)
318 return m_RecordCount;
321 TLVRecordType curRec = getFirstTLVRecord(tlvDataBasePtr, tlvDataLen);
322 while (!curRec.isNull())
325 curRec = getNextTLVRecord(curRec, tlvDataBasePtr, tlvDataLen);
328 return m_RecordCount;
357 TLVRecordBuilder(uint8_t recType,
const uint8_t* recValue, uint8_t recValueLen);
375 void init(uint8_t recType,
const uint8_t* recValue, uint8_t recValueLen);
378 uint8_t m_RecValueLen;
386 #endif // PACKETPP_TLV_DATA The main namespace for the PcapPlusPlus lib.
uint8_t getType() const
Definition: TLVData.h:113
virtual size_t getDataSize() const =0
uint8_t recordType
Definition: TLVData.h:31
void purgeRecordData()
Definition: TLVData.h:138
Definition: TLVData.h:351
uint8_t * getRecordBasePtr() const
Definition: TLVData.h:133
virtual ~TLVRecord()
Definition: TLVData.h:64
virtual size_t getTotalSize() const =0
size_t getTLVRecordCount(uint8_t *tlvDataBasePtr, size_t tlvDataLen) const
Definition: TLVData.h:315
TLVRecordType getFirstTLVRecord(uint8_t *tlvDataBasePtr, size_t tlvDataLen) const
Definition: TLVData.h:240
void changeTLVRecordCount(int changedBy)
Definition: TLVData.h:338
TLVRecord(const TLVRecord &other)
Definition: TLVData.h:56
TLVRecordReader & operator=(const TLVRecordReader &other)
Definition: TLVData.h:226
Definition: TLVData.h:197
TLVRecord & operator=(const TLVRecord &other)
Definition: TLVData.h:83
bool isNotNull() const
Definition: TLVData.h:128
Definition: IpAddress.h:26
T getValueAs(size_t offset=0) const
Definition: TLVData.h:150
TLVRecordReader(const TLVRecordReader &other)
Definition: TLVData.h:212
uint8_t * getValue() const
Definition: TLVData.h:118
virtual ~TLVRecordReader()
Definition: TLVData.h:220
void assign(uint8_t *recordRawData)
Definition: TLVData.h:70
TLVRecordType getNextTLVRecord(TLVRecordType &record, uint8_t *tlvDataBasePtr, size_t tlvDataLen) const
Definition: TLVData.h:261
bool setValue(T newValue, int valueOffset=0)
Definition: TLVData.h:170
TLVRecordType getTLVRecord(uint8_t recordType, uint8_t *tlvDataBasePtr, size_t tlvDataLen) const
Definition: TLVData.h:291
TLVRecordReader()
Definition: TLVData.h:207
bool isNull() const
Definition: TLVData.h:123
TLVRecord(uint8_t *recordRawData)
Definition: TLVData.h:46
uint8_t recordValue[]
Definition: TLVData.h:35
bool operator==(const TLVRecord &rhs) const
Definition: TLVData.h:95
uint8_t recordLen
Definition: TLVData.h:33