1 /* Copyright (C) 2020 Open Information Security Foundation
3 * You can copy, redistribute or modify this Program under the terms of
4 * the GNU General Public License version 2 as published by the Free
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * version 2 along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 use super::ssh::SSHTransaction;
19 use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
23 pub extern "C" fn rs_ssh_tx_get_protocol(
24 tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
26 let tx = cast_pointer!(tx, SSHTransaction);
29 let m = &tx.cli_hdr.protover;
33 *buffer_len = m.len() as u32;
39 let m = &tx.srv_hdr.protover;
43 *buffer_len = m.len() as u32;
51 *buffer = ptr::null();
59 pub extern "C" fn rs_ssh_tx_get_software(
60 tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
62 let tx = cast_pointer!(tx, SSHTransaction);
65 let m = &tx.cli_hdr.swver;
69 *buffer_len = m.len() as u32;
75 let m = &tx.srv_hdr.swver;
79 *buffer_len = m.len() as u32;
87 *buffer = ptr::null();
95 pub extern "C" fn rs_ssh_tx_get_hassh(
96 tx: *mut std::os::raw::c_void,
97 buffer: *mut *const u8,
101 let tx = cast_pointer!(tx, SSHTransaction);
104 let m = &tx.cli_hdr.hassh;
107 *buffer = m.as_ptr();
108 *buffer_len = m.len() as u32;
114 let m = &tx.srv_hdr.hassh;
117 *buffer = m.as_ptr();
118 *buffer_len = m.len() as u32;
126 *buffer = ptr::null();
134 pub extern "C" fn rs_ssh_tx_get_hassh_string(
135 tx: *mut std::os::raw::c_void,
136 buffer: *mut *const u8,
137 buffer_len: *mut u32,
140 let tx = cast_pointer!(tx, SSHTransaction);
143 let m = &tx.cli_hdr.hassh_string;
146 *buffer = m.as_ptr();
147 *buffer_len = m.len() as u32;
153 let m = &tx.srv_hdr.hassh_string;
156 *buffer = m.as_ptr();
157 *buffer_len = m.len() as u32;
165 *buffer = ptr::null();