From 48178cd649b48196e16e0481ca44dea206fe04d4 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 9 Aug 2016 12:09:23 +0200 Subject: trafgen: proto: Store registered protocols in an array Protocols are registered early at startup and aren't changed at runtime. In order to speed up lookup while parsing, store the pointers to the protocol definitions (struct proto_hdr) in an array, indexed by protocol id rather than in a linked list. Signed-off-by: Tobias Klauser --- trafgen_proto.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'trafgen_proto.h') diff --git a/trafgen_proto.h b/trafgen_proto.h index f25078a..a66f8d3 100644 --- a/trafgen_proto.h +++ b/trafgen_proto.h @@ -6,7 +6,7 @@ #include enum proto_id { - PROTO_NONE, + PROTO_NONE = 0, PROTO_ETH, PROTO_VLAN, PROTO_ARP, @@ -17,6 +17,7 @@ enum proto_id { PROTO_ICMP6, PROTO_UDP, PROTO_TCP, + __PROTO_MAX, }; enum proto_layer { -- cgit v1.2.3-54-g00ecf