From 7de3122b423487c3f2127f0b0a44ed7c6735fbff Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 22 Sep 2009 12:27:28 +0200 Subject: Added a userdata generic pointer to the log callback function. --- libssh/log.c | 3 ++- libssh/options.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'libssh') diff --git a/libssh/log.c b/libssh/log.c index b2f5f415..4a3b275b 100644 --- a/libssh/log.c +++ b/libssh/log.c @@ -56,7 +56,8 @@ void ssh_log(SSH_SESSION *session, int verbosity, const char *format, ...) { va_end(va); if (session->options->log_function) { - session->options->log_function(buffer, session, verbosity); + session->options->log_function(session, verbosity, buffer, + session->options->log_userdata); } else if (verbosity == SSH_LOG_FUNCTIONS) { if (session->log_indent > 255) { min = 255; diff --git a/libssh/options.c b/libssh/options.c index 755ef505..0fa3e895 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -762,13 +762,14 @@ int ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow) { * * @warning The message string may contain format string characters. */ -int ssh_options_set_log_function(SSH_OPTIONS *opt, - void (*callback)(const char *message, SSH_SESSION *session, int priority)) { - if (opt == NULL || callback == NULL) { +int ssh_options_set_log_function(SSH_OPTIONS *opt, ssh_log_callback cb, + void *userdata) { + if (opt == NULL || cb == NULL) { return -1; } - opt->log_function = callback; + opt->log_function = cb; + opt->log_userdata = userdata; return 0; } -- cgit