1 /*
2 Copyright (C) 2009 - 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 /*
19 * Authors: Werner Dittmann <Werner.Dittmann@t-online.de>
20 */
21
22 #ifndef _ZRTPCONFIGURE_H_
23 #define _ZRTPCONFIGURE_H_
24
32 #include <stdio.h>
33 #include <stdint.h>
34 #include <list>
35 #include <string>
36 #include <vector>
38
40
47 };
48
49 typedef void(*
encrypt_t)(uint8_t*, int32_t, uint8_t*, uint8_t*, int32_t);
50 typedef void(*
decrypt_t)(uint8_t*, int32_t,
const uint8_t*, uint8_t*, int32_t);
51
63 public:
88
93
102
111
119
134
142
152
160
161 private:
169 };
170
186 public:
197
205
213
222
232
244
245 protected:
248 void insert(
const char* name);
249 void insert(
const char* name, int32_t klen,
251
252 private:
254 std::vector <AlgorithmEnum* >
algos;
255 };
256
261 public:
264 };
265
267 public:
270 };
271
273 public:
276 };
277
279 public:
282 };
283
285 public:
288 };
289
295
313 public:
316
321 static const int maxNoOfAlgos = 7;
334 void setStandardConfig();
335
348 void setMandatoryOnly();
349
355 void clear();
356
373
391
412
422 int32_t getNumConfiguredAlgos(
AlgoTypes algoType);
423
438
452
462 void setTrustedMitM(bool yesNo);
463
470 bool isTrustedMitM();
471
481 void setSasSignature(bool yesNo);
482
489 bool isSasSignature();
490
500 void setParanoidMode(bool yesNo);
501
508 bool isParanoidMode();
509
511 void printConfiguredAlgos(
AlgoTypes algoTyp);
512
513 private:
519
523
524
525 AlgorithmEnum& getAlgoAt(std::vector<AlgorithmEnum* >& a, int32_t index);
526 int32_t addAlgo(std::vector<AlgorithmEnum* >& a,
AlgorithmEnum& algo);
527 int32_t addAlgoAt(std::vector<AlgorithmEnum* >& a,
AlgorithmEnum& algo, int32_t index);
528 int32_t removeAlgo(std::vector<AlgorithmEnum* >& a,
AlgorithmEnum& algo);
529 int32_t getNumConfiguredAlgos(std::vector<AlgorithmEnum* >& a);
530 bool containsAlgo(std::vector<AlgorithmEnum* >& a,
AlgorithmEnum& algo);
531 std::vector<AlgorithmEnum* >& getEnum(
AlgoTypes algoType);
532
533 void printConfiguredAlgos(std::vector<AlgorithmEnum* >& a);
534
535 protected:
536
537 public:
538 };
539
543 #endif
544
int getOrdinal(AlgorithmEnum &algo)
Get the ordinal number of an AlgorithmEnum.
std::vector< AlgorithmEnum * > algos
Common C++ generic string class.
AlgorithmEnum & getByOrdinal(int ord)
Return the AlgorithmEnum by its ordinal number.
The enumaration subclasses that contain the supported algorithm enumerations.
AlgorithmEnum & getByName(const char *name)
Get an AlgorithmEnum by its name.
struct ZrtpConfigure ZrtpConfigure
EnumBase provides methods to store and access algorithm enumerations of a specific algorithm type...
void insert(const char *name)
AlgoTypes getAlgoType()
Get the AlgoTypes to which this EnumBase belongs.
SrtpAlgorithms
The algorihms that we support in SRTP and that ZRTP can negotiate.
Callback interface between ZRTP and the RTP stack implementation.
int getSize()
Get the number of currently stored AlgorithmEnums.
std::list< std::string > * getAllNames()
Return all names of all currently stored AlgorithmEnums.