diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/account.c | 2 | ||||
-rw-r--r-- | src/baresip.c | 8 | ||||
-rw-r--r-- | src/menc.c | 22 |
3 files changed, 21 insertions, 11 deletions
diff --git a/src/account.c b/src/account.c index 3ecf7d8..009fcf1 100644 --- a/src/account.c +++ b/src/account.c @@ -395,7 +395,7 @@ int account_alloc(struct account **accp, const char *sipaddr) } if (acc->mencid) { - acc->menc = menc_find(acc->mencid); + acc->menc = menc_find(baresip_mencl(), acc->mencid); if (!acc->menc) { warning("account: mediaenc not found: `%s'\n", acc->mencid); diff --git a/src/baresip.c b/src/baresip.c index cc4009a..3ef745e 100644 --- a/src/baresip.c +++ b/src/baresip.c @@ -18,6 +18,7 @@ static struct baresip { struct commands commands; struct player *player; struct list mnatl; + struct list mencl; } baresip; @@ -31,6 +32,7 @@ int baresip_init(struct config *cfg, bool prefer_ipv6) baresip.net = mem_deref(baresip.net); list_init(&baresip.mnatl); + list_init(&baresip.mencl); /* Initialise Network */ err = net_alloc(&baresip.net, &cfg->net, @@ -94,3 +96,9 @@ struct list *baresip_mnatl(void) { return &baresip.mnatl; } + + +struct list *baresip_mencl(void) +{ + return &baresip.mencl; +} @@ -8,20 +8,18 @@ #include "core.h" -static struct list mencl = LIST_INIT; - - /** * Register a new Media encryption module * - * @param menc Media encryption module + * @param mencl List of Media-encryption modules + * @param menc Media encryption module */ -void menc_register(struct menc *menc) +void menc_register(struct list *mencl, struct menc *menc) { - if (!menc) + if (!mencl || !menc) return; - list_append(&mencl, &menc->le, menc); + list_append(mencl, &menc->le, menc); info("mediaenc: %s\n", menc->id); } @@ -44,15 +42,19 @@ void menc_unregister(struct menc *menc) /** * Find a Media Encryption module by name * - * @param id Name of the Media Encryption module to find + * @param mencl List of Media-encryption modules + * @param id Name of the Media Encryption module to find * * @return Matching Media Encryption module if found, otherwise NULL */ -const struct menc *menc_find(const char *id) +const struct menc *menc_find(const struct list *mencl, const char *id) { struct le *le; - for (le = mencl.head; le; le = le->next) { + if (!mencl) + return NULL; + + for (le = mencl->head; le; le = le->next) { struct menc *me = le->data; if (0 == str_casecmp(id, me->id)) |