blob: 1e1c78f4ed7899c727b7700fd4764313fa059a7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/**
* @file menc.c Media encryption
*
* Copyright (C) 2010 Creytiv.com
*/
#include <re.h>
#include <baresip.h>
#include "core.h"
/**
* Register a new Media encryption module
*
* @param mencl List of Media-encryption modules
* @param menc Media encryption module
*/
void menc_register(struct list *mencl, struct menc *menc)
{
if (!mencl || !menc)
return;
list_append(mencl, &menc->le, menc);
info("mediaenc: %s\n", menc->id);
}
/**
* Unregister a Media encryption module
*
* @param menc Media encryption module
*/
void menc_unregister(struct menc *menc)
{
if (!menc)
return;
list_unlink(&menc->le);
}
/**
* Find a Media Encryption module by name
*
* @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 struct list *mencl, const char *id)
{
struct le *le;
if (!mencl)
return NULL;
for (le = mencl->head; le; le = le->next) {
struct menc *me = le->data;
if (0 == str_casecmp(id, me->id))
return me;
}
return NULL;
}
|