mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-02 01:17:52 +03:00
events: Add functions for poll objects
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
c092101e01
commit
5aaae4cb6b
@@ -155,5 +155,7 @@ int ssh_poll_ctx_add_socket (ssh_poll_ctx ctx, struct ssh_socket_struct *s);
|
|||||||
void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p);
|
void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p);
|
||||||
int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout);
|
int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout);
|
||||||
ssh_poll_ctx ssh_poll_get_default_ctx(ssh_session session);
|
ssh_poll_ctx ssh_poll_get_default_ctx(ssh_session session);
|
||||||
|
int ssh_event_add_poll(ssh_event event, ssh_poll_handle p);
|
||||||
|
void ssh_event_remove_poll(ssh_event event, ssh_poll_handle p);
|
||||||
|
|
||||||
#endif /* POLL_H_ */
|
#endif /* POLL_H_ */
|
||||||
|
|||||||
27
src/poll.c
27
src/poll.c
@@ -774,6 +774,33 @@ int ssh_event_add_fd(ssh_event event, socket_t fd, short events,
|
|||||||
return SSH_OK;
|
return SSH_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add a poll handle to the event.
|
||||||
|
*
|
||||||
|
* @param event the ssh_event
|
||||||
|
*
|
||||||
|
* @param p the poll handle
|
||||||
|
*
|
||||||
|
* @returns SSH_OK on success
|
||||||
|
* SSH_ERROR on failure
|
||||||
|
*/
|
||||||
|
int ssh_event_add_poll(ssh_event event, ssh_poll_handle p)
|
||||||
|
{
|
||||||
|
return ssh_poll_ctx_add(event->ctx, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief remove a poll handle to the event.
|
||||||
|
*
|
||||||
|
* @param event the ssh_event
|
||||||
|
*
|
||||||
|
* @param p the poll handle
|
||||||
|
*/
|
||||||
|
void ssh_event_remove_poll(ssh_event event, ssh_poll_handle p)
|
||||||
|
{
|
||||||
|
ssh_poll_ctx_remove(event->ctx,p);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief remove the poll handle from session and assign them to a event,
|
* @brief remove the poll handle from session and assign them to a event,
|
||||||
* when used in blocking mode.
|
* when used in blocking mode.
|
||||||
|
|||||||
Reference in New Issue
Block a user