trafgen: parser: Allow to set function at field offset
commit647b7b76d63f8c847b17495e6ad24dc3b256899f
authorVadim Kochan <vadim4j@gmail.com>
Sun, 18 Dec 2016 09:52:49 +0000 (18 11:52 +0200)
committerTobias Klauser <tklauser@distanz.ch>
Wed, 21 Dec 2016 15:57:53 +0000 (21 16:57 +0100)
tree4d4d488a0f65118cdaf45f381277408b9797364a
parent44e97b2009dc2bee93f25684b274f458f50ea667
trafgen: parser: Allow to set function at field offset

Extend proto field expression to:

    proto_field[{index}:{len}] = {func}

which allows to specify function on the field offset 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 original fields which allows to scpecify different functions
on the different parts of same field, also the copy of original
proto_field allows to set custom length/pkt_offset which makes such
field behave as virtual sub-field of the original one with different
length/pkt_offset but point to the same piece of header.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
trafgen_parser.y
trafgen_proto.c
trafgen_proto.h