A cosmetic change that makes the entries in the int-2-string maps look

more readable. Add some missing entries: ipv6 and icmpv6.
This commit is contained in:
Stefan Berger 2010-03-30 11:42:03 -04:00
parent 0e0f6021ce
commit 062b0aa33b

View File

@ -105,6 +105,9 @@ struct int_map {
const char *val; const char *val;
}; };
#define INTMAP_ENTRY(ATT, VAL) { .attr = ATT, .val = VAL }
#define INTMAP_ENTRY_LAST { .val = NULL }
/* /*
* only one filter update allowed * only one filter update allowed
@ -388,18 +391,10 @@ struct _virXMLAttr2Struct
static const struct int_map macProtoMap[] = { static const struct int_map macProtoMap[] = {
{ INTMAP_ENTRY(ETHERTYPE_ARP , "arp"),
.attr = ETHERTYPE_ARP, INTMAP_ENTRY(ETHERTYPE_IP , "ipv4"),
.val = "arp", INTMAP_ENTRY(ETHERTYPE_IPV6, "ipv6"),
}, { INTMAP_ENTRY_LAST
.attr = ETHERTYPE_IP,
.val = "ipv4",
}, {
.attr = ETHERTYPE_IPV6,
.val = "ipv6",
}, {
.val = NULL,
}
}; };
@ -486,36 +481,16 @@ checkMACMask(enum attrDatatype datatype ATTRIBUTE_UNUSED,
* supported arp opcode -- see 'ebtables -h arp' for the naming * supported arp opcode -- see 'ebtables -h arp' for the naming
*/ */
static const struct int_map arpOpcodeMap[] = { static const struct int_map arpOpcodeMap[] = {
{ INTMAP_ENTRY(1, "Request"),
.attr = 1, INTMAP_ENTRY(2, "Reply"),
.val = "Request", INTMAP_ENTRY(3, "Request_Reverse"),
} , { INTMAP_ENTRY(4, "Reply_Reverse"),
.attr = 2, INTMAP_ENTRY(5, "DRARP_Request"),
.val = "Reply", INTMAP_ENTRY(6, "DRARP_Reply"),
} , { INTMAP_ENTRY(7, "DRARP_Error"),
.attr = 3, INTMAP_ENTRY(8, "InARP_Request"),
.val = "Request_Reverse", INTMAP_ENTRY(9, "ARP_NAK"),
} , { INTMAP_ENTRY_LAST
.attr = 4,
.val = "Reply_Reverse",
} , {
.attr = 5,
.val = "DRARP_Request",
} , {
.attr = 6,
.val = "DRARP_Reply",
} , {
.attr = 7,
.val = "DRARP_Error",
} , {
.attr = 8,
.val = "InARP_Request",
} , {
.attr = 9,
.val = "ARP_NAK",
} , {
.val = NULL,
}
}; };
@ -562,37 +537,21 @@ arpOpcodeFormatter(virBufferPtr buf,
static const struct int_map ipProtoMap[] = { static const struct int_map ipProtoMap[] = {
{ INTMAP_ENTRY(IPPROTO_TCP, "tcp"),
.attr = IPPROTO_TCP, INTMAP_ENTRY(IPPROTO_UDP, "udp"),
.val = "tcp",
} , {
.attr = IPPROTO_UDP,
.val = "udp",
#ifdef IPPROTO_UDPLITE #ifdef IPPROTO_UDPLITE
} , { INTMAP_ENTRY(IPPROTO_UDPLITE, "udplite"),
.attr = IPPROTO_UDPLITE,
.val = "udplite",
#endif #endif
} , { INTMAP_ENTRY(IPPROTO_ESP, "esp"),
.attr = IPPROTO_ESP, INTMAP_ENTRY(IPPROTO_AH, "ah"),
.val = "esp", INTMAP_ENTRY(IPPROTO_ICMP, "icmp"),
} , { INTMAP_ENTRY(IPPROTO_IGMP, "igmp"),
.attr = IPPROTO_AH,
.val = "ah",
} , {
.attr = IPPROTO_ICMP,
.val = "icmp",
} , {
.attr = IPPROTO_IGMP,
.val = "igmp",
#ifdef IPPROTO_SCTP #ifdef IPPROTO_SCTP
} , { INTMAP_ENTRY(IPPROTO_SCTP, "sctp"),
.attr = IPPROTO_SCTP,
.val = "sctp",
#endif #endif
} , { INTMAP_ENTRY(IPPROTO_IPV6, "ipv6"),
.val = NULL, INTMAP_ENTRY(IPPROTO_ICMPV6, "icmpv6"),
} INTMAP_ENTRY_LAST
}; };