Browse code

core:zrtp: make ZRTP debug logging configurable

Stefan Sayer authored on 03/11/2014 16:46:54
Showing 5 changed files
... ...
@@ -106,6 +106,7 @@ int          AmConfig::UnhandledReplyLoglevel  = 0;
106 106
 
107 107
 #ifdef WITH_ZRTP
108 108
 bool         AmConfig::enable_zrtp             = true;
109
+bool         AmConfig::enable_zrtp_debuglog    = true;
109 110
 #endif
110 111
 
111 112
 unsigned int AmConfig::SessionLimit            = 0;
... ...
@@ -595,6 +596,9 @@ int AmConfig::readConfiguration()
595 595
 #ifdef WITH_ZRTP
596 596
   enable_zrtp = cfg.getParameter("enable_zrtp", "yes") == "yes";
597 597
   INFO("ZRTP %sabled\n", enable_zrtp ? "en":"dis");
598
+
599
+  enable_zrtp_debuglog = cfg.getParameter("enable_zrtp_debuglog", "yes") == "yes";
600
+  INFO("ZRTP debug log %sabled\n", enable_zrtp_debuglog ? "en":"dis");
598 601
 #endif
599 602
 
600 603
   if(cfg.hasParameter("session_limit")){ 
... ...
@@ -222,6 +222,7 @@ struct AmConfig
222 222
 
223 223
 #ifdef WITH_ZRTP
224 224
   static bool enable_zrtp;
225
+  static bool enable_zrtp_debuglog;
225 226
 #endif
226 227
 
227 228
   static unsigned int SessionLimit;
... ...
@@ -54,6 +54,9 @@ void zrtp_log(int level, char *data, int len, int offset) {
54 54
   else if (level==1)
55 55
     sems_lvl = L_INFO; // ??
56 56
   
57
+  if (sems_lvl==L_DBG && !AmConfig::enable_zrtp_debuglog)
58
+    return;
59
+
57 60
   _LOG(sems_lvl, "%.*s", len, data);
58 61
 }
59 62
 
... ...
@@ -379,6 +379,10 @@ loglevel=2
379 379
 # if build with ZRTP support (see Makefile.defs)
380 380
 # enable ZRTP support in endpoint calls:
381 381
 #enable_zrtp=yes (default: yes)
382
+#
383
+
384
+# enable ZRTP debug log? (prints lots of info)
385
+#enable_zrtp_debuglog=no (default: yes)
382 386
 
383 387
 ############################################################
384 388
 # tuning
... ...
@@ -36,13 +36,25 @@
36 36
  *   <pre> $ make WITH_ZRTP=yes</pre>
37 37
  *  </p>
38 38
  * 
39
+  <p>ZRTP can be enabled in sems.conf by the enable_zrtp config parameter, e.g. enable_zrtp=yes.</p>
40
+
41
+  <p>ZRTP debug logging (lots of info in the log) can be disabled in sems.conf by setting enable_zrtp_debuglog=no</p>
42
+
43
+  <p>ZRTP is NOT supported by the sbc application. I.e. if you want to transcrypt cleartext calls into ZRTP encrypted calls,
44
+     you need to use an endpoint application like the webconference module, the conference module, or better yet a
45
+     DSM application. If you want to make a plain-RTP to ZRTP gateway, have a look at the b2b_connect_audio DSM example,
46
+    which can be found in doc/dsm/examples/b2b_connect_audio.
47
+  </p>
48
+
49
+  <p> There is support for some utility functions in a DSM module (see \ref dsm_mod_zrtp). </p>
50
+
39 51
  *  <p>The <em>conference</em> application is enabled to tell the caller the SAS phrase
40 52
  *  if it is compiled with WITH_SAS_TTS option, set in apps/conference/Makefile. For this to work,
41 53
  *  the <a href="http://cmuflite.org">flite text-to-speech synthesizer</a> version 1.2 or 1.3 is needed.</p>
42 54
  *  
43 55
  *  \section zinyourapp How to use ZRTP in your application 
44 56
  *
45
- *  Have a look at the conference application on how to add ZRTP support in your application. There is a 
57
+ *  Have a look at the dsm or the conference application on how to add ZRTP support in your application. There is a 
46 58
  *  <code>void AmSession::onZRTPEvent(zrtp_event_t event, zrtp_stream_ctx_t *stream_ctx)</code> 
47 59
  *  event that is called with the appropriate ZRTP event type and the zrtp stream context, if the state
48 60
  *  of the ZRTP encryption changes. The zrtp_event are defined in the Zfone SDK, e.g. ZRTP_EVENT_IS_SECURE.