From d55874b960a8663cc86284fad4d0472ff37b7a7e Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Sat, 29 Jul 2017 12:46:07 +0300 Subject: trafgen: Get packet from proto_hdr if possible Replace using current_packet() by new proto_hdr_packet(hdr) function to obtain packet directly from header. This is more generic and flexible way, because it guarantees that packet really belongs to the header, which in case in current_packet() is not right because it means getting of last allocated packet. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_proto.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'trafgen_proto.h') diff --git a/trafgen_proto.h b/trafgen_proto.h index d3da963..36b8f2b 100644 --- a/trafgen_proto.h +++ b/trafgen_proto.h @@ -7,6 +7,8 @@ #include "trafgen_dev.h" +struct packet; + enum proto_id { PROTO_NONE = 0, PROTO_ETH, @@ -104,6 +106,7 @@ extern void proto_header_finish(struct proto_hdr *hdr); extern void proto_packet_finish(void); extern void proto_packet_update(uint32_t idx); +extern struct packet *proto_hdr_packet(struct proto_hdr *hdr); extern struct proto_hdr *proto_hdr_push_sub_header(struct proto_hdr *hdr, int id); extern void proto_hdr_move_sub_header(struct proto_hdr *hdr, struct proto_hdr *from, struct proto_hdr *to); -- cgit v1.2.3-54-g00ecf