*
* @name: protocol name
* @base: header base
+ * @checksum_key: key of template containing checksum
* @protocol_key: key of template containing upper layer protocol description
* @length: total size of the header, in bits
* @protocols: link to upper layer protocol descriptions indexed by protocol value
struct proto_desc {
const char *name;
enum proto_bases base;
+ unsigned int checksum_key;
unsigned int protocol_key;
unsigned int length;
struct {
const struct proto_desc proto_icmp = {
.name = "icmp",
.base = PROTO_BASE_TRANSPORT_HDR,
+ .checksum_key = ICMPHDR_CHECKSUM,
.templates = {
[ICMPHDR_TYPE] = ICMPHDR_TYPE("type", &icmp_type_type, type),
[ICMPHDR_CODE] = ICMPHDR_FIELD("code", code),
const struct proto_desc proto_udp = {
.name = "udp",
.base = PROTO_BASE_TRANSPORT_HDR,
+ .checksum_key = UDPHDR_CHECKSUM,
.templates = {
[UDPHDR_SPORT] = INET_SERVICE("sport", struct udphdr, source),
[UDPHDR_DPORT] = INET_SERVICE("dport", struct udphdr, dest),
const struct proto_desc proto_tcp = {
.name = "tcp",
.base = PROTO_BASE_TRANSPORT_HDR,
+ .checksum_key = TCPHDR_CHECKSUM,
.templates = {
[TCPHDR_SPORT] = INET_SERVICE("sport", struct tcphdr, source),
[TCPHDR_DPORT] = INET_SERVICE("dport", struct tcphdr, dest),
const struct proto_desc proto_ip = {
.name = "ip",
.base = PROTO_BASE_NETWORK_HDR,
+ .checksum_key = IPHDR_CHECKSUM,
.protocol_key = IPHDR_PROTOCOL,
.protocols = {
PROTO_LINK(IPPROTO_ICMP, &proto_icmp),
const struct proto_desc proto_icmp6 = {
.name = "icmpv6",
.base = PROTO_BASE_TRANSPORT_HDR,
+ .checksum_key = ICMP6HDR_CHECKSUM,
.templates = {
[ICMP6HDR_TYPE] = ICMP6HDR_TYPE("type", &icmp6_type_type, icmp6_type),
[ICMP6HDR_CODE] = ICMP6HDR_FIELD("code", icmp6_code),