summaryrefslogtreecommitdiffstats
path: root/common/collection/collection.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-09-04 20:28:06 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-09-09 09:12:53 -0400
commit191b97b118b0c357209166c3c374dec33560ed3a (patch)
tree18073a7b1d471c0cf752c1d89e4d41537cf5b1c0 /common/collection/collection.h
parent717f368f86f160744e27a430d3b4ec2fd4c3bd64 (diff)
downloadsssd-191b97b118b0c357209166c3c374dec33560ed3a.tar.gz
sssd-191b97b118b0c357209166c3c374dec33560ed3a.tar.xz
sssd-191b97b118b0c357209166c3c374dec33560ed3a.zip
COLLECTION Copy collection flat with concatenated names
This patch addresses several issues: a) Adds capability to add or copy the collections in flattened mode but construct names of attributes in dotted notation. For example when you append collection "sub" with items "foo" and "bar" previously you could add them as "foo" and "bar" not you can flatten them and the names will be "sub.foo" and "sub.bar" this allows better processing of the attributes in the elapi message. b) Removes old implemntation of the copy collection function. c) Removes the col_set_timestamp, this functionality has been moved to ELAPI long ago. d) Updates collection unit test. e) Updates elapi to use new functionality f) Updates elapi unit test Have run under valgrind with no problems.
Diffstat (limited to 'common/collection/collection.h')
-rw-r--r--common/collection/collection.h56
1 files changed, 37 insertions, 19 deletions
diff --git a/common/collection/collection.h b/common/collection/collection.h
index e9533a456..710e33ba1 100644
--- a/common/collection/collection.h
+++ b/common/collection/collection.h
@@ -70,10 +70,18 @@
* fail. */
#define COL_ADD_MODE_CLONE 2 /* Creates a deep copy of a collection with
* its sub collections */
-
#define COL_ADD_MODE_FLAT 3 /* Creates a deep copy of a collection with
- * its sub collections flattening and resolving
- * duplicates.
+ * its sub collections flattening and NOT
+ * resolving duplicates.
+ */
+#define COL_ADD_MODE_FLATDOT 4 /* Creates a deep copy of a collection with
+ * its sub collections flattening and NOT
+ * resolving duplicates. Names are contructed
+ * in dotted notation.
+ * For example the subcollection
+ * named "sub" containing "foo" and
+ * "bar" will be flattened as:
+ * "sub.foo", "sub.bar".
*/
/* Modes how the collection is traversed */
@@ -89,6 +97,14 @@
#define COL_TRAVERSE_IGNORE 0x00000004 /* Ignore sub collections as if none
* is present */
#define COL_TRAVERSE_FLAT 0x00000008 /* Flatten the collection. */
+#define COL_TRAVERSE_FLATDOT 0x00000010 /* Flatten the collection but use
+ * dotted notation for property names
+ * For example the subcollection
+ * named "sub" containing "foo" and
+ * "bar" will be flattened as:
+ * "sub.foo", "sub.bar".
+ */
+
/* Additional iterator flags
* NOTE: ignored by traverse functions */
@@ -112,11 +128,21 @@
* DO NOT MIX THEM IN ONE ITERATOR.
*/
-/* FIXME: move to event level - this does not belong to collection */
-/* Time stamp property name */
-#define TS_NAME "stamp"
-/* Time property name */
-#define T_NAME "time"
+
+/* Modes accepted by copy collection function */
+#define COL_COPY_NORMAL 0 /* Deep copy. Referenced collections
+ * of the donor are copied as sub
+ * collections.
+ */
+#define COL_COPY_FLAT 1 /* Deep copy. Collection is flattend. */
+#define COL_COPY_FLATDOT 2 /* Deep copy. Collection is flattend.
+ * Names are concatenated with dot.
+ */
+#define COL_COPY_KEEPREF 3 /* Deep copy but leave references
+ * as references.
+ */
+#define COL_COPY_TOP 4 /* Copy only top level
+ */
/* Match values */
#define COL_NOMATCH 0
@@ -315,15 +341,6 @@ int col_add_any_property_with_ref(struct collection_item *ci,
int type, void *data, int length,
struct collection_item **ret_ref);
-/* FIXME - does not belong here - move to other place */
-/* Function to create a timestamp */
-/* Automatically adds/updates time and timestamp properties in the
- * collection returning references */
-int col_set_timestamp(struct collection_item *ci,
- struct collection_item **timestr_ref,
- struct collection_item **timeint_ref);
-
-
/* Update functions */
/* All update functions search the property using the search algorithm
* described at the top of the header file.
@@ -398,10 +415,11 @@ int col_add_collection_to_collection(struct collection_item *ci, /* C
int mode); /* How this collection needs to be added */
/* Create a deep copy of the current collection. */
-/* Referenced collections of the donor are copied as sub collections. */
+/* The acceptable modes are defined at the top */
int col_copy_collection(struct collection_item **collection_copy,
struct collection_item *collection_to_copy,
- const char *name_to_use);
+ const char *name_to_use,
+ int copy_mode);
/* Signature of the callback that needs to be used when
traversing a collection or looking for a specific item */