From 59e69bf9106e6f085f90cb33ac7241e3ded41767 Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Tue, 26 Jul 2016 22:35:07 +0300 Subject: trafgen: proto: Reference to packet from struct proto_hdr Using of current_packet() is not possible for dynamically updated fields so we need to keep the packet index in proto_hdr struct to reference the correct packet. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_parser.y | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'trafgen_parser.y') diff --git a/trafgen_parser.y b/trafgen_parser.y index 0fe8674..a286e6b 100644 --- a/trafgen_parser.y +++ b/trafgen_parser.y @@ -153,6 +153,16 @@ struct packet *current_packet(void) return &packets[packet_last]; } +uint32_t current_packet_id(void) +{ + return packet_last; +} + +struct packet *packet_get(uint32_t id) +{ + return &packets[id]; +} + static void set_byte(uint8_t val) { struct packet *pkt = &packets[packet_last]; -- cgit v1.2.3-54-g00ecf