diff options
author | Colin Walters <walters@verbum.org> | 2013-11-06 14:11:52 -0500 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-11-09 12:26:19 +0100 |
commit | 4cc7f4ad036b75d7a3cd9f0d39d8978ccb399b96 (patch) | |
tree | 2fe7e3d53e688c41558b7fb01efea6b40908e677 /src/session.c | |
parent | a8dc67ded863716c3b8cfa02739a73acecaea41c (diff) | |
download | libssh-4cc7f4ad036b75d7a3cd9f0d39d8978ccb399b96.tar.gz libssh-4cc7f4ad036b75d7a3cd9f0d39d8978ccb399b96.tar.xz libssh-4cc7f4ad036b75d7a3cd9f0d39d8978ccb399b96.zip |
Add ssh_get_poll_flags()
For integration with an external mainloop, we need to know how to
replicate libssh's internal poll() calls. We originally through
ssh_get_status() was that API, but it's not really - those flags only
get updated from the *result* of a poll(), where what we really need
is to know how libssh would *start* a poll().
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c index d4b3643f..06e7567f 100644 --- a/src/session.c +++ b/src/session.c @@ -608,6 +608,25 @@ int ssh_get_status(ssh_session session) { } /** + * @brief Get poll flags for an external mainloop + * + * @param session The ssh session to use. + * + * @returns A bitmask including SSH_READ_PENDING or SSH_WRITE_PENDING. + * For SSH_READ_PENDING, your invocation of poll() should include + * POLLIN. For SSH_WRITE_PENDING, your invocation of poll() should + * include POLLOUT. + */ +int ssh_get_poll_flags(ssh_session session) +{ + if (session == NULL) { + return 0; + } + + return ssh_socket_get_poll_flags (session->socket); +} + +/** * @brief Get the disconnect message from the server. * * @param[in] session The ssh session to use. |