summaryrefslogtreecommitdiff
path: root/src/menc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/menc.c')
-rw-r--r--src/menc.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/menc.c b/src/menc.c
new file mode 100644
index 0000000..a99a94a
--- /dev/null
+++ b/src/menc.c
@@ -0,0 +1,63 @@
+/**
+ * @file menc.c Media encryption
+ *
+ * Copyright (C) 2010 Creytiv.com
+ */
+#include <re.h>
+#include <baresip.h>
+#include "core.h"
+
+
+static struct list mencl = LIST_INIT;
+
+
+/**
+ * Register a new Media encryption module
+ *
+ * @param menc Media encryption module
+ */
+void menc_register(struct menc *menc)
+{
+ if (!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 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)
+{
+ struct le *le;
+
+ for (le = mencl.head; le; le = le->next) {
+ struct menc *me = le->data;
+
+ if (0 == str_casecmp(id, me->id))
+ return me;
+ }
+
+ return NULL;
+}