path: root/include/datatype.h
diff options
authorPatrick McHardy <>2009-03-31 04:14:26 +0200
committerPatrick McHardy <>2009-03-31 04:14:26 +0200
commit4fee12b4b0a837b4d34d21be99cda8185563f784 (patch)
tree129d65c66938c3851be3a3a35eb6523e5fef8791 /include/datatype.h
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 <>
Diffstat (limited to 'include/datatype.h')
1 files changed, 9 insertions, 1 deletions
diff --git a/include/datatype.h b/include/datatype.h
index c3415223..9131d72a 100644
--- a/include/datatype.h
+++ b/include/datatype.h
@@ -58,7 +58,9 @@ enum datatypes {
+#define TYPE_MAX (__TYPE_MAX - 1)
* enum byteorder
@@ -79,7 +81,8 @@ struct expr;
* struct datatype
* @type: numeric identifier
- * @name: type name for diagnostics
+ * @name: type name
+ * @desc: type description
* @basetype: basetype for subtypes, determines type compatibilty
* @basefmt: format string for basetype
* @print: function to print a constant of this type
@@ -89,6 +92,7 @@ struct expr;
struct datatype {
enum datatypes type;
const char *name;
+ const char *desc;
const struct datatype *basetype;
const char *basefmt;
void (*print)(const struct expr *expr);
@@ -97,6 +101,10 @@ struct datatype {
const struct symbol_table *sym_tbl;
+extern void datatype_register(const struct datatype *dtype);
+extern const struct datatype *datatype_lookup(enum datatypes type);
+extern const struct datatype *datatype_lookup_byname(const char *name);
extern struct error_record *symbol_parse(const struct expr *sym,
struct expr **res);
extern void datatype_print(const struct expr *expr);