summaryrefslogtreecommitdiff
path: root/modules/gzrtp/srtp.h
diff options
context:
space:
mode:
authorglenvt18 <glenvt18@gmail.com>2017-11-02 21:36:01 +0300
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-11-02 19:36:01 +0100
commit1174f976113306b1e77736bfe9bd5ac9dab598a8 (patch)
treeb74416742189a2c627e7ce8707687d58e6873331 /modules/gzrtp/srtp.h
parentfb79d1c1712a38af087f610dcdefbd58b67e3769 (diff)
modules/gzrtp: move SRTP processing to a separate class (#319)
Add an option to use libre SRTP processing stuff instead of the one provided by ZRTPCPP (-DGZRTP_USE_RE_SRTP).
Diffstat (limited to 'modules/gzrtp/srtp.h')
-rw-r--r--modules/gzrtp/srtp.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/modules/gzrtp/srtp.h b/modules/gzrtp/srtp.h
new file mode 100644
index 0000000..d42f4cf
--- /dev/null
+++ b/modules/gzrtp/srtp.h
@@ -0,0 +1,46 @@
+/**
+ * @file srtp.h GNU ZRTP: SRTP processing
+ *
+ * Copyright (C) 2010 - 2017 Creytiv.com
+ */
+#ifndef __SRTP_H
+#define __SRTP_H
+
+
+#include <libzrtpcpp/ZrtpCallback.h>
+
+
+#ifdef GZRTP_USE_RE_SRTP
+struct srtp;
+#else
+class CryptoContext;
+class CryptoContextCtrl;
+#endif
+
+
+class Srtp {
+public:
+ Srtp(int& err, const SrtpSecret_t *secrets, EnableSecurity part);
+ ~Srtp();
+
+ int protect(struct mbuf *mb);
+ int protect_ctrl(struct mbuf *mb);
+ int unprotect(struct mbuf *mb);
+ int unprotect_ctrl(struct mbuf *mb);
+
+private:
+ int protect_int(struct mbuf *mb, bool control);
+ int unprotect_int(struct mbuf *mb, bool control);
+
+#ifdef GZRTP_USE_RE_SRTP
+ int32_t m_auth_tag_len;
+ struct srtp *m_srtp;
+#else
+ CryptoContext *m_cc;
+ CryptoContextCtrl *m_cc_ctrl;
+#endif
+};
+
+
+#endif // __SRTP_H
+