mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
callbacks: Implement list of callbacks for channels
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
5c67530f1e
commit
bbe437dbb1
@@ -867,10 +867,46 @@ typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
||||
* @param cb The callback structure itself.
|
||||
*
|
||||
* @return SSH_OK on success, SSH_ERROR on error.
|
||||
* @warning this function will not replace existing callbacks but set the
|
||||
* new one atop of them.
|
||||
*/
|
||||
LIBSSH_API int ssh_set_channel_callbacks(ssh_channel channel,
|
||||
ssh_channel_callbacks cb);
|
||||
|
||||
/**
|
||||
* @brief Add channel callback functions
|
||||
*
|
||||
* This function will add channel callback functions to the channel callback
|
||||
* list.
|
||||
* Callbacks missing from a callback structure will be probed in the next
|
||||
* on the list.
|
||||
*
|
||||
* @param channel The channel to set the callback structure.
|
||||
*
|
||||
* @param cb The callback structure itself.
|
||||
*
|
||||
* @return SSH_OK on success, SSH_ERROR on error.
|
||||
*
|
||||
* @see ssh_set_channel_callbacks
|
||||
*/
|
||||
LIBSSH_API int ssh_add_channel_callbacks(ssh_channel channel,
|
||||
ssh_channel_callbacks cb);
|
||||
|
||||
/**
|
||||
* @brief Remove a channel callback.
|
||||
*
|
||||
* The channel has been added with ssh_add_channel_callbacks or
|
||||
* ssh_set_channel_callbacks in this case.
|
||||
*
|
||||
* @param channel The channel to remove the callback structure from.
|
||||
*
|
||||
* @param cb The callback structure to remove
|
||||
*
|
||||
* @returns SSH_OK on success, SSH_ERROR on error.
|
||||
*/
|
||||
LIBSSH_API int ssh_remove_channel_callbacks(ssh_channel channel,
|
||||
ssh_channel_callbacks cb);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @group libssh_threads
|
||||
|
||||
@@ -74,7 +74,8 @@ struct ssh_channel_struct {
|
||||
int version;
|
||||
int exit_status;
|
||||
enum ssh_channel_request_state_e request_state;
|
||||
ssh_channel_callbacks callbacks;
|
||||
struct ssh_list *callbacks; /* list of ssh_channel_callbacks */
|
||||
|
||||
/* counters */
|
||||
ssh_counter counter;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user