summaryrefslogtreecommitdiff
path: root/modules/gzrtp/srtp.h
blob: d42f4cff0a0f9a2b9afed503ccabc98d8120660b (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
/**
 * @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