trafgen: proto: Allow to set field with variable length
commit906cb247a831e37665a19e2c6b41b7cfd4c6621b
authorVadim Kochan <vadim4j@gmail.com>
Thu, 1 Jun 2017 10:12:26 +0000 (1 13:12 +0300)
committerTobias Klauser <tklauser@distanz.ch>
Fri, 2 Jun 2017 07:15:17 +0000 (2 09:15 +0200)
tree41068841c4b503cc5c7724a4184093e1e0c08834
parent83f11c231626f79433a021c526ffa1ac7521ae36
trafgen: proto: Allow to set field with variable length

It is quite tricky to set field value with a variable length
(i.e. DNS query name), to make it possible the field
needs to be added to header with 'len=0' in that case there
will be no any payload allocation, but only while setting the field
value the packet will be appended with a real length bytes and after
the field needs to be relocated to the right place.

Also add 'len' parameter to *_set_bytes(...) functoins to have better
control over it.

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