Every backend's iterator must have a pointer to itself as the first element, so the API can talk to it. You'd define your iterator as
struct my_iterator { git_reference_iterator parent; ... }
and assign iter->parent.backend
to your git_refdb_backend
.