Rename all proto_field_xxx(...) functions to proto_hdr_field(...).
It is good for 2 reasons:
1) proto_hdr_field_xxx naming is more consistent as
it is related to proto_hdr API.
2) It makes possible to introduce proto_field_xxx API
which will operate only with struct
Change __proto_field_set_bytes(...) function to take struct proto_field
instead of do looup by hdr & fid.
It is needed to able use this function with some custom
modified struct proto_field (len, pkt_offset).
Signed-off-by: Vadim Kochan
---
trafgen_proto.c | 50
Extend field expression with the following syntax:
[] | [:]
which allows to specify value or function at specified offset relative to the
field's offset within a header.
The trick to implement this was to use copies of proto_field instances
in the packet_dyn->fields array which allows to
Rename field_expr rule to field_value_expr to indicate the rule
relates to field value part in case if there will be added field_expr
rule to indicate field expression syntax.
Signed-off-by: Vadim Kochan
---
trafgen_parser.y | 30 +++---
1 file
Extend proto field expression to:
proto_field[{index}:{len}] = {func}
which allows to specify function/value on the part of the field via index
and value length (default is 1 - 1 byte). This rule is optional.
It was needed to keep of proto_field's copies in packet_dyn->fields
instead of
Used IPv6 pattern from nftables project to match valid only IPv6
address to do not mess with MAC or other syntax patterns with ':' symbol.
Signed-off-by: Vadim Kochan
---
trafgen_lexer.l | 51 +++
trafgen_parser.y | 2 +-
2
Add short note about field offset syntax with an example.
Signed-off-by: Vadim Kochan
---
trafgen.8 | 25 +
1 file changed, 25 insertions(+)
diff --git a/trafgen.8 b/trafgen.8
index 62716bb..c58d429 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -329,6