summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d362cf3)
raw | patch | inline | side by side (parent: d362cf3)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 23 Oct 2014 19:29:16 +0000 (21:29 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 23 Oct 2014 19:29:16 +0000 (21:29 +0200) |
This function parses an object type name (singular) and returns the type ID.
src/core/store_lookup.c | patch | blob | history | |
src/include/core/store.h | patch | blob | history |
index 9c2a68d21a4acce7a3abecbc6fa9067bd1ef21c7..180d17931d2c603fb0e295b5b06f4c9637d5cb8a 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
return NULL;
} /* sdb_store_parse_matcher_op */
+int
+sdb_store_parse_object_type(const char *name)
+{
+ if (! strcasecmp(name, "host"))
+ return SDB_HOST;
+ else if (! strcasecmp(name, "service"))
+ return SDB_SERVICE;
+ else if (! strcasecmp(name, "metric"))
+ return SDB_METRIC;
+ else if (! strcasecmp(name, "attribute"))
+ return SDB_ATTRIBUTE;
+ return -1;
+} /* sdb_store_parse_object_type */
+
int
sdb_store_parse_object_type_plural(const char *name)
{
index ab12162115b6d9d56d7011ae225871c488fc322f..5d5995f56d6685003b87064a5bbfe2ab7f4a4293 100644 (file)
--- a/src/include/core/store.h
+++ b/src/include/core/store.h
sdb_store_matcher_op_cb
sdb_store_parse_matcher_op(const char *op);
+/*
+ * sdb_store_parse_object_type:
+ * Parse the type name of a stored object.
+ *
+ * Returns:
+ * - the object type on success
+ * - a negative value else
+ */
+int
+sdb_store_parse_object_type(const char *name);
+
/*
* sdb_store_parse_object_type_plural:
* Parse the type name (plural) of a stored object.