summaryrefslogtreecommitdiff
path: root/trafgen_parser.y
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-07-26 22:35:07 +0300
committerTobias Klauser <tklauser@distanz.ch>2016-08-02 16:11:19 +0200
commit59e69bf9106e6f085f90cb33ac7241e3ded41767 (patch)
tree95d82ae7f5205972ff8b74f7f1f4b258138d3e88 /trafgen_parser.y
parenta378db32a6e88a04d839bf2c2f27f62d81986186 (diff)
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 <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r--trafgen_parser.y10
1 files changed, 10 insertions, 0 deletions
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];