summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2009-03-31 04:14:26 +0200
committerPatrick McHardy <kaber@trash.net>2009-03-31 04:14:26 +0200
commit4fee12b4b0a837b4d34d21be99cda8185563f784 (patch)
tree129d65c66938c3851be3a3a35eb6523e5fef8791 /src/payload.c
parent53fc2c7a799877c5859298bd16b578711af9cca2 (diff)
datatype: maintain table of all datatypes and add registration/lookup function
Add a table containing all available datatypes and registration/lookup functions. This will be used to associate a stand-alone set in the kernel with the correct type without parsing the entire ruleset. Additionally it would now be possible to remove the global declarations for the core types. Not done yet though. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/payload.c b/src/payload.c
index f76586e3..feb6c551 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -580,7 +580,8 @@ static const struct symbol_table icmp_type_tbl = {
static const struct datatype icmp_type_type = {
.type = TYPE_ICMP_TYPE,
- .name = "ICMP type",
+ .name = "icmp_type",
+ .desc = "ICMP type",
.basetype = &integer_type,
.sym_tbl = &icmp_type_tbl,
};
@@ -658,7 +659,8 @@ static const struct symbol_table tcp_flag_tbl = {
static const struct datatype tcp_flag_type = {
.type = TYPE_TCP_FLAG,
- .name = "TCP flag",
+ .name = "tcp_flag",
+ .desc = "TCP flag",
.basetype = &bitmask_type,
.sym_tbl = &tcp_flag_tbl,
};
@@ -818,7 +820,8 @@ static const struct symbol_table arpop_tbl = {
static const struct datatype arpop_type = {
.type = TYPE_ARPOP,
- .name = "ARP operation",
+ .name = "arp_op",
+ .desc = "ARP operation",
.basetype = &integer_type,
.sym_tbl = &arpop_tbl,
};
@@ -888,7 +891,8 @@ static const struct symbol_table ethertype_tbl = {
const struct datatype ethertype_type = {
.type = TYPE_ETHERTYPE,
- .name = "Ethernet protocol",
+ .name = "ethertype",
+ .desc = "Ethernet protocol",
.basetype = &integer_type,
.sym_tbl = &ethertype_tbl,
};
@@ -916,3 +920,11 @@ const struct payload_desc payload_eth = {
[ETHHDR_TYPE] = ETHHDR_TYPE("type", ether_type),
},
};
+
+static void __init payload_init(void)
+{
+ datatype_register(&icmp_type_type);
+ datatype_register(&tcp_flag_type);
+ datatype_register(&arpop_type);
+ datatype_register(&ethertype_type);
+}