diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2014-04-09 20:55:38 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2014-08-06 09:04:34 +0200 |
commit | 835e34d1eb407465eac8744ff392d029a117fae3 (patch) | |
tree | c30c8fba20a1c898b9db9f5308339ea6d1975102 /include | |
parent | 13c42bff3f41fac845368e62d9f509ccab94b4c5 (diff) | |
download | libssh-835e34d1eb407465eac8744ff392d029a117fae3.tar.gz libssh-835e34d1eb407465eac8744ff392d029a117fae3.tar.xz libssh-835e34d1eb407465eac8744ff392d029a117fae3.zip |
Buffer: add ssh_buffer_(un)pack()
That function permits chaining of buffer values to minimize buffer handling
in packet sending code.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/libssh/buffer.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/libssh/buffer.h b/include/libssh/buffer.h index 3224af28..942089f0 100644 --- a/include/libssh/buffer.h +++ b/include/libssh/buffer.h @@ -21,6 +21,8 @@ #ifndef BUFFER_H_ #define BUFFER_H_ +#include <stdarg.h> + #include "libssh/libssh.h" /* * Describes a buffer state @@ -46,6 +48,10 @@ int buffer_add_u16(ssh_buffer buffer, uint16_t data); int buffer_add_u32(ssh_buffer buffer, uint32_t data); int buffer_add_u64(ssh_buffer buffer, uint64_t data); int ssh_buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len); +int ssh_buffer_pack_va(struct ssh_buffer_struct *buffer, const char *format, va_list ap); +int ssh_buffer_pack(struct ssh_buffer_struct *buffer, const char *format, ...); +int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer, const char *format, va_list ap); +int ssh_buffer_unpack(struct ssh_buffer_struct *buffer, const char *format, ...); int buffer_prepend_data(ssh_buffer buffer, const void *data, uint32_t len); int buffer_add_buffer(ssh_buffer buffer, ssh_buffer source); int ssh_buffer_reinit(ssh_buffer buffer); |