index 823cd18feea6731da32660130149df1d24588df5..05a963876638854f0bd290c9b454b0815c8b6c37 100644 (file)
--- a/src/core/store-private.h
+++ b/src/core/store-private.h
#define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj))
#define SDB_CONST_STORE_OBJ(obj) ((const sdb_store_obj_t *)(obj))
-enum {
- SDB_HOST = 1,
- SDB_SERVICE,
- SDB_ATTRIBUTE,
-};
-#define TYPE_TO_NAME(t) \
- (((t) == SDB_HOST) ? "host" \
- : ((t) == SDB_SERVICE) ? "service" \
- : ((t) == SDB_ATTRIBUTE) ? "attribute" : "unknown")
-
/* shortcuts for accessing the sdb_store_obj_t attributes
* of inheriting objects */
#define _last_update super.last_update
* matchers
*/
-/* when adding to this, also update 'matchers' in store_lookup.c */
+/* when adding to this, also update 'matchers' and 'matchers_tostring'
+ * in store_lookup.c */
enum {
MATCHER_OR,
MATCHER_AND,
MATCHER_NOT,
+ MATCHER_NAME,
MATCHER_ATTR,
- MATCHER_SERVICE,
MATCHER_HOST,
};
} uop_matcher_t;
#define UOP_M(m) ((uop_matcher_t *)(m))
-/* match any type of object by it's base information */
+/* match any type of object by it's name */
typedef struct {
sdb_store_matcher_t super;
+ int obj_type;
+
/* match by the name of the object */
name_matcher_t name;
} obj_matcher_t;
/* match attributes */
typedef struct {
- obj_matcher_t super;
+ sdb_store_matcher_t super;
+ char *name;
/* XXX: this needs to be more flexible;
* add support for type-specific operators */
name_matcher_t value;
} attr_matcher_t;
#define ATTR_M(m) ((attr_matcher_t *)(m))
-/* match services */
-typedef struct {
- obj_matcher_t super;
- /* match by attributes assigned to the service */
- attr_matcher_t *attr;
-} service_matcher_t;
-#define SERVICE_M(m) ((service_matcher_t *)(m))
-
/* match hosts */
typedef struct {
obj_matcher_t super;
- /* match by services assigned to the host */
- service_matcher_t *service;
/* match by attributes assigned to the host */
attr_matcher_t *attr;
} host_matcher_t;