diff options
author | Audrius Butkevicius <audrius.butkevicius@elastichosts.com> | 2014-02-12 16:53:18 +0000 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2014-02-12 18:21:16 +0100 |
commit | a277dd92776c5c18d4e08a555e169c46cf75ff94 (patch) | |
tree | 5873ed8615e8b0d52ac83337cd4b14d528276d34 /include | |
parent | 370d4b014d22d6ae9229498f75a4f6d28d0d1614 (diff) | |
download | libssh-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 'include')
-rw-r--r-- | include/libssh/channels.h | 2 | ||||
-rw-r--r-- | include/libssh/libssh.h | 11 | ||||
-rw-r--r-- | include/libssh/session.h | 3 |
3 files changed, 16 insertions, 0 deletions
diff --git a/include/libssh/channels.h b/include/libssh/channels.h index 4c726453..b05c4c02 100644 --- a/include/libssh/channels.h +++ b/include/libssh/channels.h @@ -75,6 +75,8 @@ struct ssh_channel_struct { int exit_status; enum ssh_channel_request_state_e request_state; ssh_channel_callbacks callbacks; + /* counters */ + ssh_counter counter; }; SSH_PACKET_CALLBACK(ssh_packet_channel_open_conf); diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index b10dca28..ea63feeb 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -104,6 +104,13 @@ extern "C" { #endif +struct ssh_counter_struct { + uint64_t in_bytes; + uint64_t out_bytes; + uint64_t in_packets; + uint64_t out_packets; +}; +typedef struct ssh_counter_struct *ssh_counter; typedef struct ssh_agent_struct* ssh_agent; typedef struct ssh_buffer_struct* ssh_buffer; @@ -395,6 +402,8 @@ LIBSSH_API int ssh_channel_send_eof(ssh_channel channel); LIBSSH_API int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct timeval * timeout); LIBSSH_API void ssh_channel_set_blocking(ssh_channel channel, int blocking); +LIBSSH_API void ssh_channel_set_counter(ssh_channel channel, + ssh_counter counter); LIBSSH_API int ssh_channel_write(ssh_channel channel, const void *data, uint32_t len); LIBSSH_API uint32_t ssh_channel_window_size(ssh_channel channel); @@ -575,6 +584,8 @@ LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socke LIBSSH_API int ssh_service_request(ssh_session session, const char *service); LIBSSH_API int ssh_set_agent_channel(ssh_session session, ssh_channel channel); LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking); +LIBSSH_API void ssh_set_counters(ssh_session session, ssh_counter scounter, + ssh_counter rcounter); LIBSSH_API void ssh_set_fd_except(ssh_session session); LIBSSH_API void ssh_set_fd_toread(ssh_session session); LIBSSH_API void ssh_set_fd_towrite(ssh_session session); diff --git a/include/libssh/session.h b/include/libssh/session.h index c360a70c..8480135d 100644 --- a/include/libssh/session.h +++ b/include/libssh/session.h @@ -188,6 +188,9 @@ struct ssh_session_struct { char *gss_client_identity; int gss_delegate_creds; } opts; + /* counters */ + ssh_counter socket_counter; + ssh_counter raw_counter; }; /** @internal |