diff --git a/daemon/ssrc.c b/daemon/ssrc.c index 2c3874dca..535e8c957 100644 --- a/daemon/ssrc.c +++ b/daemon/ssrc.c @@ -178,6 +178,16 @@ void free_ssrc_hash(struct ssrc_hash **ht) { g_slice_free1(sizeof(**ht), *ht); *ht = NULL; } +void ssrc_hash_foreach(struct ssrc_hash *sh, void (*f)(void *)) { + rwlock_lock_w(&sh->lock); + + for (GList *k = sh->q.head; k; k = k->next) + f(k->data); + if (sh->precreat) + f(sh->precreat); + + rwlock_unlock_w(&sh->lock); +} struct ssrc_hash *create_ssrc_hash_full(ssrc_create_func_t cfunc, void *uptr) { diff --git a/include/ssrc.h b/include/ssrc.h index 29c2b6fe4..e3d34e1b9 100644 --- a/include/ssrc.h +++ b/include/ssrc.h @@ -183,6 +183,7 @@ struct ssrc_xr_voip_metrics { void free_ssrc_hash(struct ssrc_hash **); +void ssrc_hash_foreach(struct ssrc_hash *, void (*)(void *)); struct ssrc_hash *create_ssrc_hash_full(ssrc_create_func_t, void *uptr); struct ssrc_hash *create_ssrc_hash_call(void);