1
1

channel: Fix the name scheme of the forward functions.

Этот коммит содержится в:
Andreas Schneider 2014-01-16 09:06:56 +01:00
родитель a1c4fc07d4
Коммит 5229253f86
5 изменённых файлов: 40 добавлений и 24 удалений

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

@ -405,10 +405,19 @@ LIBSSH_API const char *ssh_copyright(void);
LIBSSH_API void ssh_disconnect(ssh_session session);
LIBSSH_API char *ssh_dirname (const char *path);
LIBSSH_API int ssh_finalize(void);
LIBSSH_API ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms);
LIBSSH_API ssh_channel ssh_channel_accept_forward(ssh_session session, int timeout_ms, int *destination_port);
LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
/* REVERSE PORT FORWARDING */
LIBSSH_API ssh_channel ssh_channel_accept_forward(ssh_session session,
int timeout_ms,
int *destination_port);
LIBSSH_API int ssh_channel_cancel_forward(ssh_session session,
const char *address,
int port);
LIBSSH_API int ssh_channel_listen_forward(ssh_session session,
const char *address,
int port,
int *bound_port);
LIBSSH_API void ssh_free(ssh_session session);
LIBSSH_API const char *ssh_get_disconnect_message(ssh_session session);
LIBSSH_API const char *ssh_get_error(void *error);
@ -429,7 +438,12 @@ LIBSSH_API int ssh_get_publickey_hash(const ssh_key key,
unsigned char **hash,
size_t *hlen);
/* DEPRECATED FUNCTIONS */
SSH_DEPRECATED LIBSSH_API int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash);
SSH_DEPRECATED LIBSSH_API ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms);
SSH_DEPRECATED LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
SSH_DEPRECATED LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
LIBSSH_API int ssh_get_random(void *where,int len,int strong);
LIBSSH_API int ssh_get_version(ssh_session session);

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

@ -365,14 +365,14 @@ public:
/* acceptForward is implemented later in this file */
void_throwable cancelForward(const char *address, int port){
int err=ssh_forward_cancel(c_session, address, port);
int err=ssh_channel_cancel_forward(c_session, address, port);
ssh_throw(err);
return_throwable;
}
void_throwable listenForward(const char *address, int port,
int &boundport){
int err=ssh_forward_listen(c_session, address, port, &boundport);
int err=ssh_channel_listen_forward(c_session, address, port, &boundport);
ssh_throw(err);
return_throwable;
}
@ -583,8 +583,8 @@ private:
/* This code cannot be put inline due to references to Channel */
Channel *Session::acceptForward(int timeout_ms){
ssh_channel forward = ssh_forward_accept(c_session,
timeout_ms);
ssh_channel forward =
ssh_channel_accept_forward(c_session, timeout_ms, NULL);
ssh_throw_null(c_session,forward);
Channel *newchan = new Channel(*this,forward);
return newchan;

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

@ -2251,7 +2251,11 @@ error:
* SSH_AGAIN if in nonblocking mode and call has
* to be done again.
**/
int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port) {
int ssh_channel_listen_forward(ssh_session session,
const char *address,
int port,
int *bound_port)
{
ssh_buffer buffer = NULL;
ssh_string addr = NULL;
int rc = SSH_ERROR;
@ -2293,16 +2297,7 @@ error:
return rc;
}
/**
* @brief Accept an incoming TCP/IP forwarding channel.
*
* @param[in] session The ssh session to use.
*
* @param[in] timeout_ms A timeout in milliseconds.
*
* @return Newly created channel, or NULL if no incoming channel request from
* the server
*/
/* DEPRECATED */
ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms) {
return ssh_channel_accept(session, SSH_CHANNEL_FORWARDED_TCPIP, timeout_ms, NULL);
}
@ -2338,7 +2333,10 @@ ssh_channel ssh_channel_accept_forward(ssh_session session, int timeout_ms, int*
* SSH_AGAIN if in nonblocking mode and call has
* to be done again.
*/
int ssh_forward_cancel(ssh_session session, const char *address, int port) {
int ssh_channel_cancel_forward(ssh_session session,
const char *address,
int port)
{
ssh_buffer buffer = NULL;
ssh_string addr = NULL;
int rc = SSH_ERROR;
@ -2372,6 +2370,10 @@ error:
return rc;
}
int ssh_forward_cancel(ssh_session session, const char *address, int port) {
return ssh_channel_cancel_forward(session, address, port);
}
/**
* @brief Set environment variables.
*

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

@ -163,7 +163,7 @@ int channel_change_pty_size(ssh_channel channel,int cols,int rows){
}
ssh_channel channel_forward_accept(ssh_session session, int timeout_ms){
return ssh_forward_accept(session,timeout_ms);
return ssh_channel_accept_forward(session, timeout_ms, NULL);
}
int channel_close(ssh_channel channel){
@ -171,12 +171,12 @@ int channel_close(ssh_channel channel){
}
int channel_forward_cancel(ssh_session session, const char *address, int port){
return ssh_forward_cancel(session, address, port);
return ssh_channel_cancel_forward(session, address, port);
}
int channel_forward_listen(ssh_session session, const char *address,
int port, int *bound_port){
return ssh_forward_listen(session, address, port, bound_port);
return ssh_channel_listen_forward(session, address, port, bound_port);
}
void channel_free(ssh_channel channel){

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

@ -66,7 +66,7 @@ static void torture_ssh_forward(void **state)
int bound_port;
int rc;
rc = ssh_forward_listen(session, "127.0.0.1", 8080, &bound_port);
rc = ssh_channel_listen_forward(session, "127.0.0.1", 8080, &bound_port);
assert_int_equal(rc, SSH_OK);
#if 0