blob: dd739e01fe02d1365a548f3f4619901f64047afa (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
/*
This class maps the ZRTP C++ callback methods to C callback methods.
Copyright (C) 2010 Werner Dittmann
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ZRTPCALLBACKWRAPPER_H
#define ZRTPCALLBACKWRAPPER_H
#include <stdlib.h>
#include <libzrtpcpp/ZrtpCallback.h>
#include <libzrtpcpp/ZrtpConfigure.h>
#include <libzrtpcpp/ZrtpCWrapper.h>
/**
*
* @file ZrtpCallbackWrapper.h
* @brief C-Wrapper helper
*
* This is a helper class for for the C wrapper and implements
* the GNU ZRTP callback interface. For detailed documentation about
* the callback method refer to file <code>ZrtpCallback</code>
* @ingroup GNU_ZRTP
* @{
*
* @see ZrtpCallback
* @see ZrtpCWrapper
*/
class __EXPORT ZrtpCallbackWrapper : public ZrtpCallback
{
public:
/**
* Construct a class that implements ZrtpCallback and uses a C structure
* to call C functions that implement the callbacks.
*
* @param cb
* The C callback structure that hold the addresses of the C methods
* that implement the actual callback functions.
* @param ctx
* Pointer to the ZrtpContext
*/
ZrtpCallbackWrapper(zrtp_Callbacks* cb, ZrtpContext* ctx);
int32_t sendDataZRTP ( const unsigned char* data, int32_t length );
int32_t activateTimer ( int32_t time );
int32_t cancelTimer();
void sendInfo ( GnuZrtpCodes::MessageSeverity severity, int32_t subCode );
bool srtpSecretsReady ( SrtpSecret_t* secrets, EnableSecurity part );
void srtpSecretsOff ( EnableSecurity part );
void srtpSecretsOn ( std::string c, std::string s, bool verified );
void handleGoClear();
void zrtpNegotiationFailed ( GnuZrtpCodes::MessageSeverity severity, int32_t subCode );
void zrtpNotSuppOther();
void synchEnter();
void synchLeave();
void zrtpAskEnrollment (GnuZrtpCodes::InfoEnrollment info );
void zrtpInformEnrollment (GnuZrtpCodes::InfoEnrollment info );
void signSAS (uint8_t* sasHash );
bool checkSASSignature (uint8_t* sasHash );
private:
void init();
zrtp_Callbacks *c_callbacks;
ZrtpContext* zrtpCtx;
};
/**
* @}
*/
#endif // ZRTPCALLBACKWRAPPER_H
|