From bf5726c5afde540bb3fede21745d127b24ce427b Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 16 Dec 2019 13:42:20 +0100 Subject: proto: add proto_desc_id enumeration This allows to uniquely identify the protocol description. Signed-off-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal --- include/proto.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include') diff --git a/include/proto.h b/include/proto.h index fab48c1b..1771ba8e 100644 --- a/include/proto.h +++ b/include/proto.h @@ -63,10 +63,34 @@ struct proto_hdr_template { #define PROTO_UPPER_MAX 16 #define PROTO_HDRS_MAX 20 +enum proto_desc_id { + PROTO_DESC_UNKNOWN = 0, + PROTO_DESC_AH, + PROTO_DESC_ESP, + PROTO_DESC_COMP, + PROTO_DESC_ICMP, + PROTO_DESC_IGMP, + PROTO_DESC_UDP, + PROTO_DESC_UDPLITE, + PROTO_DESC_TCP, + PROTO_DESC_DCCP, + PROTO_DESC_SCTP, + PROTO_DESC_TH, + PROTO_DESC_IP, + PROTO_DESC_IP6, + PROTO_DESC_ICMPV6, + PROTO_DESC_ARP, + PROTO_DESC_VLAN, + PROTO_DESC_ETHER, + __PROTO_DESC_MAX +}; +#define PROTO_DESC_MAX (__PROTO_DESC_MAX - 1) + /** * struct proto_desc - protocol header description * * @name: protocol name + * @id: protocol identifier * @base: header base * @checksum_key: key of template containing checksum * @protocol_key: key of template containing upper layer protocol description @@ -77,6 +101,7 @@ struct proto_hdr_template { */ struct proto_desc { const char *name; + enum proto_desc_id id; enum proto_bases base; unsigned int checksum_key; unsigned int protocol_key; @@ -160,6 +185,8 @@ extern const struct proto_desc *proto_find_upper(const struct proto_desc *base, extern int proto_find_num(const struct proto_desc *base, const struct proto_desc *desc); +extern const struct proto_desc *proto_find_desc(enum proto_desc_id desc_id); + enum eth_hdr_fields { ETHHDR_INVALID, ETHHDR_DADDR, -- cgit v1.2.3