diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-02 12:32:03 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-02 12:32:03 +0000 |
commit | eb461d1dbe21f70d9d33b0d21a6af7d6ff9c9a11 (patch) | |
tree | ca45630c42ba22538bd204e8d3452210d7561bf4 /libssh/options.c | |
parent | cfea89fb7c7fe8482e3a6fadbd6595f2d552ed87 (diff) | |
download | libssh-eb461d1dbe21f70d9d33b0d21a6af7d6ff9c9a11.tar.gz libssh-eb461d1dbe21f70d9d33b0d21a6af7d6ff9c9a11.tar.xz libssh-eb461d1dbe21f70d9d33b0d21a6af7d6ff9c9a11.zip |
Improve ssh_options_set_status_callback().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@363 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r-- | libssh/options.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/libssh/options.c b/libssh/options.c index ede7ebf..8adcc95 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -611,17 +611,34 @@ int ssh_options_default_known_hosts_file(SSH_OPTIONS *opt) { return 0; } -/** During ssh_connect(), libssh will call the callback with status from +/** + * @brief Set a callback to show connection status in realtime. + * + * During ssh_connect(), libssh will call the callback with status from * 0.0 to 1.0 - * \brief set a callback to show connection status in realtime - * \param opt options structure - * \param callback a function pointer to a callback in form f(void *userarg, float status) - * \param arg value to be given as argument to the callback function when it is called - * \see ssh_connect() + * + * @param opt The options structure to use. + * + * @param callback A function pointer to a callback in form + * f(void *userarg, float status). + * + * @param arg The value to be given as argument to the callback + * function when it is called. + * + * @return 0 on success, < 0 on error. + * + * @see ssh_connect() */ -void ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)(void *arg, float status), void *arg ){ - opt->connect_status_function=callback; - opt->connect_status_arg=arg; +int ssh_options_set_status_callback(SSH_OPTIONS *opt, + void (*callback)(void *arg, float status), void *arg) { + if (opt == NULL || callback == NULL) { + return -1; + } + + opt->connect_status_function = callback; + opt->connect_status_arg = arg; + + return 0; } /** \bug currently it only timeouts the socket connection, not the |