aboutsummaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorAudrius Butkevicius <audrius.butkevicius@elastichosts.com>2014-02-12 16:53:18 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2014-02-12 18:21:16 +0100
commita277dd92776c5c18d4e08a555e169c46cf75ff94 (patch)
tree5873ed8615e8b0d52ac83337cd4b14d528276d34 /src/session.c
parent370d4b014d22d6ae9229498f75a4f6d28d0d1614 (diff)
downloadlibssh-a277dd92776c5c18d4e08a555e169c46cf75ff94.tar.gz
libssh-a277dd92776c5c18d4e08a555e169c46cf75ff94.tar.xz
libssh-a277dd92776c5c18d4e08a555e169c46cf75ff94.zip
Add session/channel byte/packet counters
Signed-off-by: Audrius Butkevicius <audrius.butkevicius@elastichosts.com>
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index 93c047f9..3f22f111 100644
--- a/src/session.c
+++ b/src/session.c
@@ -831,6 +831,45 @@ error:
return SSH_ERROR;
}
+ /**
+ * @brief Set the session data counters.
+ *
+ * This functions sets the counter structures to be used to calculate data
+ * which comes in and goes out through the session at different levels.
+ *
+ * @code
+ * struct ssh_counter_struct scounter = {
+ * .in_bytes = 0,
+ * .out_bytes = 0,
+ * .in_packets = 0,
+ * .out_packets = 0
+ * };
+ *
+ * struct ssh_counter_struct rcounter = {
+ * .in_bytes = 0,
+ * .out_bytes = 0,
+ * .in_packets = 0,
+ * .out_packets = 0
+ * };
+ *
+ * ssh_set_counters(session, &scounter, &rcounter);
+ * @endcode
+ *
+ * @param[in] session The SSH session.
+ *
+ * @param[in] scounter Counter for byte data handled by the session sockets.
+ *
+ * @param[in] rcounter Counter for byte and packet data handled by the session,
+ * prior compression and SSH overhead.
+ */
+void ssh_set_counters(ssh_session session, ssh_counter scounter,
+ ssh_counter rcounter) {
+ if (session != NULL) {
+ session->socket_counter = scounter;
+ session->raw_counter = rcounter;
+ }
+}
+
/** @} */
/* vim: set ts=4 sw=4 et cindent: */