+ i = iter->cur_idx;
+ if (i == iter->keyval->table_size)
+ return; /* no more element */
+
+ if (iter->cur_ref != NULL) {
+ ref = LIST_NEXT(iter->cur_ref, next);
+ if (ref != NULL) {
+ iter->cur_ref = ref;
+ return;
+ }
+ i++;
+ }
+
+ for (; i < iter->keyval->table_size; i++) {
+ LIST_FOREACH(ref, &iter->keyval->table[i], next) {
+ iter->cur_idx = i;
+ iter->cur_ref = LIST_FIRST(&iter->keyval->table[i]);
+ return;
+ }
+ }
+
+ iter->cur_idx = iter->keyval->table_size;
+ iter->cur_ref = NULL;
+}
+
+bool
+ec_keyval_iter_valid(const struct ec_keyval_iter *iter)
+{
+ if (iter == NULL || iter->cur_ref == NULL)
+ return false;
+
+ return true;
+}
+
+const char *
+ec_keyval_iter_get_key(const struct ec_keyval_iter *iter)
+{
+ if (iter == NULL || iter->cur_ref == NULL)
+ return NULL;
+
+ return iter->cur_ref->elt->key;
+}
+
+void *
+ec_keyval_iter_get_val(const struct ec_keyval_iter *iter)
+{
+ if (iter == NULL || iter->cur_ref == NULL)
+ return NULL;
+
+ return iter->cur_ref->elt->val;
+}
+
+void ec_keyval_dump(FILE *out, const struct ec_keyval *keyval)
+{
+ struct ec_keyval_iter *iter;
+