summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Simons <jon@jonsimons.org>2014-02-03 22:37:25 -0800
committerAndreas Schneider <asn@cryptomilk.org>2014-02-06 10:21:07 +0100
commit93370d61ba1df61db4d3010f9040ba9c34f57245 (patch)
treeee7b179b1d5620da0dc3808a5e0ca71522d8145b /src
parent22d6c36800f2ade82e030b9f1321c19cb5ce2db9 (diff)
downloadlibssh-93370d61ba1df61db4d3010f9040ba9c34f57245.tar.gz
libssh-93370d61ba1df61db4d3010f9040ba9c34f57245.tar.xz
libssh-93370d61ba1df61db4d3010f9040ba9c34f57245.zip
session: add getters for session cipher names
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/session.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index b26eb969..9256bbc9 100644
--- a/src/session.c
+++ b/src/session.c
@@ -310,6 +310,38 @@ const char* ssh_get_serverbanner(ssh_session session) {
}
/**
+ * @brief get the name of the input for the given session.
+ *
+ * @param[in] session The SSH session.
+ *
+ * @return Returns cipher name or NULL.
+ */
+const char* ssh_get_cipher_in(ssh_session session) {
+ if ((session != NULL) &&
+ (session->current_crypto != NULL) &&
+ (session->current_crypto->in_cipher != NULL)) {
+ return session->current_crypto->in_cipher->name;
+ }
+ return NULL;
+}
+
+/**
+ * @brief get the name of the output cipher for the given session.
+ *
+ * @param[in] session The SSH session.
+ *
+ * @return Returns cipher name or NULL.
+ */
+const char* ssh_get_cipher_out(ssh_session session) {
+ if ((session != NULL) &&
+ (session->current_crypto != NULL) &&
+ (session->current_crypto->out_cipher != NULL)) {
+ return session->current_crypto->out_cipher->name;
+ }
+ return NULL;
+}
+
+/**
* @brief Disconnect impolitely from a remote host by closing the socket.
*
* Suitable if you forked and want to destroy this session.