ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ZrtpCallback.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006-2010 Werner Dittmann
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef _ZRTPCALLBACK_H_
19 #define _ZRTPCALLBACK_H_
20 
28 #include <string>
29 #include <stdint.h>
30 #include <libzrtpcpp/ZrtpCodes.h>
31 
32 #ifndef __EXPORT
33  #if __GNUC__ >= 4
34  #define __EXPORT __attribute__ ((visibility("default")))
35  #define __LOCAL __attribute__ ((visibility("hidden")))
36  #elif defined _WIN32 || defined __CYGWIN__
37  #define __EXPORT __declspec(dllimport)
38  #define __LOCAL
39  #else
40  #define __EXPORT
41  #define __LOCAL
42  #endif
43 #endif
44 
60 typedef enum {
61  Responder = 1,
63 } Role;
64 
66 typedef enum {
68  Aes = 1,
70  Sha1,
73 
83 typedef struct srtpSecrets {
85  const uint8_t* keyInitiator;
86  int32_t initKeyLen;
87  const uint8_t* saltInitiator;
88  int32_t initSaltLen;
89  const uint8_t* keyResponder;
90  int32_t respKeyLen;
91  const uint8_t* saltResponder;
92  int32_t respSaltLen;
94  int32_t srtpAuthTagLen;
95  std::string sas;
97 } SrtpSecret_t;
98 
102 };
103 
120 
121 protected:
122  friend class ZRtp;
123 
124  virtual ~ZrtpCallback() {};
125 
138  virtual int32_t sendDataZRTP(const uint8_t* data, int32_t length) =0;
139 
148  virtual int32_t activateTimer(int32_t time) =0;
149 
156  virtual int32_t cancelTimer() =0;
157 
172  virtual void sendInfo(GnuZrtpCodes::MessageSeverity severity, int32_t subCode) =0;
173 
203  virtual bool srtpSecretsReady(SrtpSecret_t* secrets, EnableSecurity part) =0;
204 
211  virtual void srtpSecretsOff(EnableSecurity part) =0;
212 
231  virtual void srtpSecretsOn(std::string c, std::string s, bool verified) =0;
232 
243  virtual void handleGoClear() =0;
244 
257  virtual void zrtpNegotiationFailed(GnuZrtpCodes::MessageSeverity severity, int32_t subCode) =0;
258 
266  virtual void zrtpNotSuppOther() =0;
267 
277  virtual void synchEnter() =0;
278 
282  virtual void synchLeave() =0;
283 
296  virtual void zrtpAskEnrollment(GnuZrtpCodes::InfoEnrollment info) =0;
297 
310  virtual void zrtpInformEnrollment(GnuZrtpCodes::InfoEnrollment info) =0;
311 
329  virtual void signSAS(uint8_t* sasHash) =0;
330 
353  virtual bool checkSASSignature(uint8_t* sasHash) =0;
354 };
355 
356 #endif // ZRTPCALLBACK
357 
EnableSecurity
Definition: ZrtpCallback.h:99
SrtpAlgorithms symEncAlgorithm
symmetrical cipher algorithm
Definition: ZrtpCallback.h:84
Enable security for SRTP receiver.
Definition: ZrtpCallback.h:100
The ZRTP info, warning, and error codes.
Use Skein as authentication algorithm.
Definition: ZrtpCallback.h:71
This abstract class defines the callback functions required by GNU ZRTP.
Definition: ZrtpCallback.h:119
This client is in ZRTP Initiator mode.
Definition: ZrtpCallback.h:62
This structure contains pointers to the SRTP secrets and the role info.
Definition: ZrtpCallback.h:83
Enable security for SRTP sender.
Definition: ZrtpCallback.h:101
int32_t initKeyLen
Initiator's key length.
Definition: ZrtpCallback.h:86
InfoEnrollment
Information codes for the Enrollment user callbacks.
Definition: ZrtpCodes.h:152
Role role
ZRTP role of this client.
Definition: ZrtpCallback.h:96
Use TwoFish as symmetrical cipher algorithm.
Definition: ZrtpCallback.h:69
Role
This enum defines which role a ZRTP peer has.
Definition: ZrtpCallback.h:60
int32_t respKeyLen
Responder's key length.
Definition: ZrtpCallback.h:90
const uint8_t * keyInitiator
Initiator's key.
Definition: ZrtpCallback.h:85
#define __EXPORT
Definition: ZrtpCallback.h:40
const uint8_t * saltInitiator
Initiator's salt.
Definition: ZrtpCallback.h:87
int32_t respSaltLen
Responder's salt length.
Definition: ZrtpCallback.h:92
const uint8_t * keyResponder
Responder's key.
Definition: ZrtpCallback.h:89
SrtpAlgorithms
The algorihms that we support in SRTP and that ZRTP can negotiate.
Definition: ZrtpCallback.h:66
struct ZRtp ZRtp
Definition: ZrtpCWrapper.h:260
Use AES as symmetrical cipher algorithm.
Definition: ZrtpCallback.h:68
const uint8_t * saltResponder
Responder's salt.
Definition: ZrtpCallback.h:91
SrtpAlgorithms authAlgorithm
SRTP authentication algorithm.
Definition: ZrtpCallback.h:93
int32_t srtpAuthTagLen
SRTP authentication length.
Definition: ZrtpCallback.h:94
This client is in ZRTP Responder mode.
Definition: ZrtpCallback.h:61
int32_t initSaltLen
Initiator's salt length.
Definition: ZrtpCallback.h:88
virtual ~ZrtpCallback()
Definition: ZrtpCallback.h:124
std::string sas
The SAS string.
Definition: ZrtpCallback.h:95
Use Sha1 as authentication algorithm.
Definition: ZrtpCallback.h:70
struct srtpSecrets SrtpSecret_t
This structure contains pointers to the SRTP secrets and the role info.