Subject: [PATCH] API add:libssh2_sftp_get_channel

[PATCH] API add:libssh2_sftp_get_channel

From: liuzl <xieepp_at_gmail.com>
Date: Thu, 8 Sep 2011 14:50:24 +0800

Return the channel of sftp, then caller can
control the channel's behavior.

Signed-off-by: liuzl <xieepp_at_gmail.com>

---
 include/libssh2_sftp.h |    1 +
 src/sftp.c             |   12 ++++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/include/libssh2_sftp.h b/include/libssh2_sftp.h
index c40420d..47b9152 100644
--- a/include/libssh2_sftp.h
+++ b/include/libssh2_sftp.h
@@ -219,6 +219,7 @@ struct _LIBSSH2_SFTP_STATVFS {
 LIBSSH2_API LIBSSH2_SFTP *libssh2_sftp_init(LIBSSH2_SESSION *session);
 LIBSSH2_API int libssh2_sftp_shutdown(LIBSSH2_SFTP *sftp);
 LIBSSH2_API unsigned long libssh2_sftp_last_error(LIBSSH2_SFTP *sftp);
+LIBSSH2_API LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp);
 
 /* File / Directory Ops */
 LIBSSH2_API LIBSSH2_SFTP_HANDLE *libssh2_sftp_open_ex(LIBSSH2_SFTP *sftp,
diff --git a/src/sftp.c b/src/sftp.c
index b540019..0ff8daa 100644
--- a/src/sftp.c
+++ b/src/sftp.c
@@ -2999,3 +2999,15 @@ libssh2_sftp_last_error(LIBSSH2_SFTP *sftp)
 
     return sftp->last_errno;
 }
+
+/* libssh2_sftp_get_channel
+ * Return the channel of sftp, then caller can control the channel's behavior.
+ */
+LIBSSH2_API LIBSSH2_CHANNEL *
+libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp)
+{
+    if (!sftp)
+        return NULL;
+
+    return sftp->channel;
+}
-- 
1.7.4.msysgit.0
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-09-08