mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-02 01:17:52 +03:00
Improve ssh_options_set_timeout().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@364 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -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_host(SSH_OPTIONS *opt, const char *host);
|
||||||
int ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd);
|
int ssh_options_set_fd(SSH_OPTIONS *opt, socket_t fd);
|
||||||
int ssh_options_set_bind(SSH_OPTIONS *opt, const char *bindaddr, int port);
|
int ssh_options_set_bind(SSH_OPTIONS *opt, const char *bindaddr, int port);
|
||||||
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_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_known_hosts_file(SSH_OPTIONS *opt, const char *dir);
|
||||||
int ssh_options_set_identity(SSH_OPTIONS *opt, const char *identity);
|
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_banner(SSH_OPTIONS *opt, const char *banner);
|
||||||
int ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
|
int ssh_options_set_status_callback(SSH_OPTIONS *opt, void (*callback)
|
||||||
(void *arg, float status), void *arg);
|
(void *arg, float status), void *arg);
|
||||||
|
int ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec);
|
||||||
void ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
|
void ssh_options_allow_ssh1(SSH_OPTIONS *opt, int allow);
|
||||||
void ssh_options_allow_ssh2(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);
|
void ssh_options_set_dsa_server_key(SSH_OPTIONS *opt, const char *dsakey);
|
||||||
|
|||||||
@@ -641,16 +641,29 @@ int ssh_options_set_status_callback(SSH_OPTIONS *opt,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \bug currently it only timeouts the socket connection, not the
|
/**
|
||||||
* complete exchange
|
* @brief Set a timeout for the connection.
|
||||||
* \brief set a timeout for the connection
|
*
|
||||||
* \param opt options structure
|
* @param opt The options structure to use.
|
||||||
* \param seconds number of seconds
|
*
|
||||||
* \param usec number of micro seconds
|
* @param seconds Number of seconds.
|
||||||
|
*
|
||||||
|
* @param usec Number of micro seconds.
|
||||||
|
*
|
||||||
|
* @return 0 on success, < 0 on error.
|
||||||
|
*
|
||||||
|
* @bug Currently it only timeouts the socket connection, not the
|
||||||
|
* complete exchange.
|
||||||
*/
|
*/
|
||||||
void ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds,long usec){
|
int ssh_options_set_timeout(SSH_OPTIONS *opt, long seconds, long usec) {
|
||||||
opt->timeout=seconds;
|
if (opts == NULL) {
|
||||||
opt->timeout_usec=usec;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
opt->timeout=seconds;
|
||||||
|
opt->timeout_usec=usec;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Default value is 0 (no connection to SSH1 servers)
|
/** Default value is 0 (no connection to SSH1 servers)
|
||||||
|
|||||||
Reference in New Issue
Block a user