+/**
+ * Enumerator implementation over attributes
+ */
+typedef struct {
+ /** implements enumerator_t */
+ enumerator_t public;
+ /** list of attributes to enumerate */
+ linked_list_t *list;
+ /** currently enumerating attribute */
+ attr_t *current;
+} attribute_enumerator_t;
+
+
+METHOD(enumerator_t, attribute_enumerate, bool,
+ attribute_enumerator_t *this, configuration_attribute_type_t *type,
+ chunk_t *data)
+{
+ if (this->current)
+ {
+ destroy_attr(this->current);
+ this->current = NULL;
+ }
+ if (this->list->remove_first(this->list, (void**)&this->current) == SUCCESS)
+ {
+ *type = this->current->type;
+ *data = this->current->data;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+METHOD(enumerator_t, attribute_destroy, void,
+ attribute_enumerator_t *this)
+{
+ if (this->current)
+ {
+ destroy_attr(this->current);
+ }
+ this->list->destroy_function(this->list, (void*)destroy_attr);
+ free(this);
+}
+