Repository navigation
Expand file tree
/
Copy pathmenc.c
More file actions
84 lines (68 loc) · 1.52 KB
/
Copy pathmenc.c
File metadata and controls
84 lines (68 loc) · 1.52 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* @file menc.c Media encryption
*
* Copyright (C) 2010 Alfred E. Heggestad
*/
#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;
}
/**
* Get the name of a media encryption event
*
* @param event Media encryption event
*
* @return String with media encryption event name
*/
const char *menc_event_name(enum menc_event event)
{
switch (event) {
case MENC_EVENT_SECURE: return "Secure";
case MENC_EVENT_VERIFY_REQUEST: return "Verify Request";
case MENC_EVENT_PEER_VERIFIED: return "Peer Verified";
default: return "?";
}
}