X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fdoc%2Fsilcclient_using.html;h=82cf3901704166b8ae394ba1900c08159e6b7dae;hb=fbcba64240f0accf54c44249df6b03652bb86dfc;hp=d31a7f370598a43d7c252997cce278bd88a15e02;hpb=ea35a2214bc62cbdb314cd28f389fd78fe3a31e0;p=silc.git
diff --git a/lib/doc/silcclient_using.html b/lib/doc/silcclient_using.html
index d31a7f37..82cf3901 100644
--- a/lib/doc/silcclient_using.html
+++ b/lib/doc/silcclient_using.html
@@ -303,6 +303,86 @@ silc_client_connect_to_server function, but performed the connecting
process manually.
+
+Debugging
+
+
+Being able to debug what you have coded is important when troubles occurs
+during coding, and they always do. SILC supports extensive debugging
+capabilities which are also available for client library user. You should
+have compiled the Toolkit with --enable-debug option so that run-time
+debugging is enabled.
+
+
+To turn on the run-time debugging set the global variable "silc_debug" to
+TRUE. To see packet hexdumps you can set also "silc_debug_hexdump" to TRUE.
+Hexdumps can create more debug log so not setting it to TRUE by default is
+probably best. To get debug messages out of specific modules you can set
+a debug string with silc_log_set_debug_string function. The function takes
+regex string as argument, for example:
+
+
+
+ silc_debug = TRUE;
+ silc_log_set_debug_string("*");
+
+
+
+This piece of code turns on the debugging and sets "*" as debug string. This
+means that all debug messages are printed. To get debugging out of only
+for example SILC Client Library the debug string could be "silc_client*".
+The debug string matches to function names and filenames so it is possible
+to get debugging out of specific files, and specific functions. Other
+examples could be:
+
+
+
+ silc_log_set_debug_string("silc_client*,*socket*,*ske*");
+
+
+
+By default, all debug messages are printed to standard error output (stderr).
+If you want to redirect the debug messages somewhere else you can set your
+own debug callback with silc_log_set_debug_callbacks function:
+
+
+
+ silc_log_set_debug_callbacks(my_debug_callback, my_context, my_hexdump_callback, my_context);
+
+
+
+See the lib/silcutil/silclog.h for definition of the callbacks. See the
+same file for other logging and debugging information.
+
+
+You can also use SILC debugging capabilities in your own application. To
+produce debug messages you can use SILC_LOG_DEBUG and SILC_LOG_HEXDUMP
+macros in your application. The SILC_LOG_DEBUG can print out normal debug
+messages with variable argument list, for example:
+
+
+
+ SILC_LOG_DEBUG(("Start"));
+ SILC_LOG_DEBUG(("Packet length %d", packet_len));
+ SILC_LOG_DEBUG(("The remote is %s on %d", sock->ip, sock->port));
+
+
+
+The SILC_LOG_HEXDUMP macro can be used dump data which couldn't be printed
+out otherwise, for example binary data.
+
+
+
+ SILC_LOG_HEXDUMP(("Packet"), packet->data, packet->len);
+ SILC_LOG_HEXDUMP(("Packet, size=%d", size), packet->data, packet->len);
+
+
+
+Note that the variable arguments in SILC_LOG_HEXDUMP are before the second
+last parenthesis, and the last two arguments are the data, and its length that
+are hexdumped.
+
+
Example Client
@@ -333,6 +413,8 @@ int main()
silc_ask_passphrase,
silc_failure,
silc_key_agreement,
+ silc_ftp,
+ silc_detach
};
SilcClient client;