summaryrefslogtreecommitdiff
path: root/trafgen_conf.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-07-26 22:35:08 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-08-02 17:24:43 +0200
commit820e85f9f29513860092a02599efa529c00a1089 (patch)
tree864ad7a68b1985ba4dd390170091458aa904ed73 /trafgen_conf.h
parent59e69bf9106e6f085f90cb33ac7241e3ded41767 (diff)
trafgen: proto: Move proto headers into packet
Until now headers were used only for packet creation at compile time, which does not allow to handle dynamic field updates at runtime. To support dynamic updates, it is necessary to keep the proto_hdr entries around after packet compilation so we can reference the header fields to dynamically update. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> [tk: Adjust patch description, simplify code] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_conf.h')
-rw-r--r--trafgen_conf.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/trafgen_conf.h b/trafgen_conf.h
index efce29c..934f8fe 100644
--- a/trafgen_conf.h
+++ b/trafgen_conf.h
@@ -5,6 +5,10 @@
#include <stdio.h>
#include <sys/types.h>
+#include "trafgen_proto.h"
+
+#define PROTO_MAX_LAYERS 16
+
#define TYPE_INC 0
#define TYPE_DEC 1
@@ -34,6 +38,8 @@ struct csum16 {
struct packet {
uint8_t *payload;
size_t len;
+ struct proto_hdr *headers[PROTO_MAX_LAYERS];
+ size_t headers_count;
};
struct packet_dyn {