aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilo <milo@r0ot.me>2012-03-02 17:07:14 +0100
committermilo <milo@r0ot.me>2012-05-05 18:04:13 +0200
commitc2fd6341c98393741d1eeb4ae89829e9ccb78451 (patch)
tree91b66f213fa78f1e08ce26f8b3caa2b4ed23827e
parent99f14ec89092d315fbe9909fd0c91a979231fc5e (diff)
downloadlibssh-c2fd6341c98393741d1eeb4ae89829e9ccb78451.tar.gz
libssh-c2fd6341c98393741d1eeb4ae89829e9ccb78451.tar.xz
libssh-c2fd6341c98393741d1eeb4ae89829e9ccb78451.zip
Added a window_grows callback
-rw-r--r--include/libssh/callbacks.h16
-rw-r--r--src/channels.c8
2 files changed, 24 insertions, 0 deletions
diff --git a/include/libssh/callbacks.h b/include/libssh/callbacks.h
index 1bc0f5e..e45121a 100644
--- a/include/libssh/callbacks.h
+++ b/include/libssh/callbacks.h
@@ -339,6 +339,18 @@ typedef void (*ssh_channel_exit_signal_callback) (ssh_session session,
const char *lang,
void *userdata);
+/**
+ * @brief SSH channel window grows callback. Called when the remote window grows
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param len the size of the remote window
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef int (*ssh_channel_window_grows_callback) (ssh_session session,
+ ssh_channel channel,
+ uint32_t remote_window,
+ void *userdata);
+
struct ssh_channel_callbacks_struct {
/** DON'T SET THIS use ssh_callbacks_init() instead. */
size_t size;
@@ -370,6 +382,10 @@ struct ssh_channel_callbacks_struct {
* This functions will be called when an exit signal has been received
*/
ssh_channel_exit_signal_callback channel_exit_signal_function;
+ /**
+ * This functions will be called when the remote window grows.
+ */
+ ssh_channel_window_grows_callback channel_window_grows_function;
};
typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
diff --git a/src/channels.c b/src/channels.c
index be12d0b..c9d9753 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -479,6 +479,14 @@ SSH_PACKET_CALLBACK(channel_rcv_change_window) {
channel->remote_window += bytes;
+ /* call callback here */
+ if(ssh_callbacks_exists(channel->callbacks, channel_window_grows_function)) {
+ channel->callbacks->channel_window_grows_function(channel->session,
+ channel,
+ channel->remote_window,
+ channel->callbacks->userdata);
+ }
+
leave_function();
return SSH_PACKET_USED;
}