[netsniff-ng] Re: [PATCH 0/7] trafgen: Allow set proto field value at specific offset

2016-12-18 Thread Vadim Kochan
On Sat, Dec 17, 2016 at 4:37 PM, Vadim Kochan wrote: > 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

[netsniff-ng] [PATCH v2 4/7] trafgen: proto: Add proto field only setters/getters

2016-12-18 Thread Vadim Kochan
Add proto_field_xxx functions to set/get value via specified proto_field only. It is good to have such API in case if application needs to set/get value for some custom proto_field instance. Signed-off-by: Vadim Kochan --- trafgen_proto.c | 46

[netsniff-ng] [PATCH v2 2/7] trafgen: proto: Change __proto_field_set_bytes(...) to take field

2016-12-18 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 5/7] trafgen: parser: Parse IPv6 address by strict match pattern

2016-12-18 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 7/7] man: trafgen: Add short description about field offset using

2016-12-18 Thread Vadim Kochan
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..d669c2a 100644 --- a/trafgen.8 +++ b/trafgen.8 @@ -329,6

[netsniff-ng] [PATCH v2 3/7] trafgen: proto: Rename proto_field_xxx -> proto_hdr_field_xxx

2016-12-18 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 0/7] trafgen: Allow set proto field function at specific offset

2016-12-18 Thread Vadim Kochan
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

[netsniff-ng] [PATCH v2 1/7] trafgen: parser: Rename field_expr -> field_value_expr rule

2016-12-18 Thread Vadim Kochan
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 describe field expression syntax. Signed-off-by: Vadim Kochan --- trafgen_parser.y | 30 +++--- 1 file