summaryrefslogtreecommitdiff
path: root/trafgen_conf.h
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-08-13 02:11:10 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-09-21 09:50:06 +0200
commite7dd63060e448bf6667c92a3b774cec0feeff452 (patch)
treec00b4dfe777d74b60cf6c4f6141a45c0a3176f48 /trafgen_conf.h
parent6197f02044e2fe6689b52dad0a0c75bdc0eb185b (diff)
trafgen: proto: Update field value at runtime
Add basic infrastructure for update proto field value at runtime by dynamic field function. Extended 'struct packet_dyn' with proto fields which has dynamically changing values at runtime. Added 'field_changed' callback for proto header which may be used for check if csum updating is needed. This callback is called after field was changed at runtime. Added 'packet_update' callback to let proto header know when to apply final proto header changes at runtime (e.g. - csum update). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_conf.h')
-rw-r--r--trafgen_conf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/trafgen_conf.h b/trafgen_conf.h
index 934f8fe..61da012 100644
--- a/trafgen_conf.h
+++ b/trafgen_conf.h
@@ -49,6 +49,8 @@ struct packet_dyn {
size_t rlen;
struct csum16 *csum;
size_t slen;
+ struct proto_field **fields;
+ size_t flen;
};
static inline bool packet_dyn_has_elems(struct packet_dyn *p)
@@ -61,6 +63,11 @@ static inline bool packet_dyn_has_only_csums(struct packet_dyn *p)
return (p->clen == 0 && p->rlen == 0 && p->slen);
}
+static inline bool packet_dyn_has_fields(struct packet_dyn *p)
+{
+ return p->flen;
+}
+
extern void compile_packets_str(char *str, bool verbose, unsigned int cpu);
extern void compile_packets(char *file, bool verbose, unsigned int cpu,
bool invoke_cpp, char *const cpp_argv[]);