1
1

Improve ssh_options_set_status_callback().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@363 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
Andreas Schneider 2009-04-02 12:32:03 +00:00
родитель cfea89fb7c
Коммит eb461d1dbe
2 изменённых файлов: 28 добавлений и 11 удалений

Просмотреть файл

@ -314,13 +314,13 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv);
int ssh_options_set_host(SSH_OPTIONS *opt, const char *host);
int ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd);
int ssh_options_set_bind(SSH_OPTIONS *opt, const char *bindaddr, int port);
void ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
(void *arg, float status), void *arg);
void ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec);
int ssh_options_set_ssh_dir(SSH_OPTIONS *opt, const char *dir);
int ssh_options_set_known_hosts_file(SSH_OPTIONS *opt, const char *dir);
int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity);
int ssh_options_set_banner(SSH_OPTIONS *opt, const char *banner);
int ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
(void *arg, float status), void *arg);
void ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
void ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow);
void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);

Просмотреть файл

@ -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