diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-11-08 23:42:41 +0100 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2009-11-08 23:42:41 +0100 |
commit | 10b625e18030144f30a68556321a4c3d11fa7e25 (patch) | |
tree | bc06f5a5386ace21a90d3ea4dad74be460042afd /include/libssh | |
parent | 10f27457d36fd39eee5c317d59e6ecfbc898db58 (diff) | |
download | libssh-10b625e18030144f30a68556321a4c3d11fa7e25.tar.gz libssh-10b625e18030144f30a68556321a4c3d11fa7e25.tar.xz libssh-10b625e18030144f30a68556321a4c3d11fa7e25.zip |
First lines of experimental pcap output support
This will serve to debug packets right under wireshark !
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/buffer.h | 1 | ||||
-rw-r--r-- | include/libssh/pcap.h | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/libssh/buffer.h b/include/libssh/buffer.h index d8055fd7..1219cead 100644 --- a/include/libssh/buffer.h +++ b/include/libssh/buffer.h @@ -33,6 +33,7 @@ struct ssh_buffer_struct { int buffer_add_ssh_string(ssh_buffer buffer, ssh_string string); int buffer_add_u8(ssh_buffer buffer, uint8_t data); +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 buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len); diff --git a/include/libssh/pcap.h b/include/libssh/pcap.h new file mode 100644 index 00000000..c0ef73fe --- /dev/null +++ b/include/libssh/pcap.h @@ -0,0 +1,30 @@ +#ifndef PCAP_H_ +#define PCAP_H_ + +#include "config.h" + +#ifdef WITH_PCAP +typedef struct ssh_pcap_context_struct* ssh_pcap_context; +typedef struct ssh_pcap_file_struct* ssh_pcap_file; + +ssh_pcap_file ssh_pcap_file_new(void); +int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename); +int ssh_pcap_file_close(ssh_pcap_file pcap); +void ssh_pcap_free(ssh_pcap_file pcap); + +/* to be removed from here after tests */ +int ssh_pcap_file_write_packet(ssh_pcap_file pcap, ssh_buffer packet, u_int32_t original_len); + +ssh_pcap_context ssh_pcap_context_new(ssh_session session); + +enum ssh_pcap_direction{ + SSH_PCAP_DIR_IN, + SSH_PCAP_DIR_OUT +}; +void ssh_pcap_context_set_file(ssh_pcap_context, ssh_pcap_file); +int ssh_pcap_context_write(ssh_pcap_context,enum ssh_pcap_direction direction, void *data, + u_int32_t len, u_int32_t origlen); + +#endif /* WITH_PCAP */ +#endif /* PCAP_H_ */ +/* vim: set ts=2 sw=2 et cindent: */ |