Skip to content

Commit 9be9023

Browse files
committed
Implement fill functions in icmp
1 parent f7ea4e9 commit 9be9023

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

process/icmp.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252

5353
#include <sstream>
5454

55+
#include <ipfixprobe/utils.hpp>
56+
5557
#include <ipfixprobe/process.hpp>
5658
#include <ipfixprobe/flowifc.hpp>
5759
#include <ipfixprobe/packet.hpp>
@@ -81,6 +83,7 @@ struct RecordExtICMP : public RecordExt {
8183
#ifdef WITH_NEMEA
8284
virtual void fill_unirec(ur_template_t *tmplt, void *record)
8385
{
86+
ur_set(tmplt, record, F_L4_ICMP_TYPE_CODE, type_code);
8487
}
8588

8689
const char *get_unirec_tmplt() const
@@ -91,7 +94,15 @@ struct RecordExtICMP : public RecordExt {
9194

9295
virtual int fill_ipfix(uint8_t *buffer, int size)
9396
{
94-
return 0;
97+
const int LEN = 2;
98+
99+
if (size < LEN) {
100+
return -1;
101+
}
102+
103+
*reinterpret_cast<uint16_t *>(buffer) = ntohs(type_code);
104+
105+
return LEN;
95106
}
96107

97108
const char **get_ipfix_tmplt() const

0 commit comments

Comments
 (0)