*/
use super::ssh::SSHTransaction;
-use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
+use crate::core::Direction;
use std::ptr;
#[no_mangle]
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
) -> u8 {
let tx = cast_pointer!(tx, SSHTransaction);
- match direction {
- STREAM_TOSERVER => {
+ match direction.into() {
+ Direction::ToServer => {
let m = &tx.cli_hdr.protover;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- STREAM_TOCLIENT => {
+ Direction::ToClient => {
let m = &tx.srv_hdr.protover;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- _ => {}
}
*buffer = ptr::null();
*buffer_len = 0;
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
) -> u8 {
let tx = cast_pointer!(tx, SSHTransaction);
- match direction {
- STREAM_TOSERVER => {
+ match direction.into() {
+ Direction::ToServer => {
let m = &tx.cli_hdr.swver;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- STREAM_TOCLIENT => {
+ Direction::ToClient => {
let m = &tx.srv_hdr.swver;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- _ => {}
}
*buffer = ptr::null();
*buffer_len = 0;
direction: u8,
) -> u8 {
let tx = cast_pointer!(tx, SSHTransaction);
- match direction {
- STREAM_TOSERVER => {
+ match direction.into() {
+ Direction::ToServer => {
let m = &tx.cli_hdr.hassh;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- STREAM_TOCLIENT => {
+ Direction::ToClient => {
let m = &tx.srv_hdr.hassh;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- _ => {}
}
*buffer = ptr::null();
*buffer_len = 0;
direction: u8,
) -> u8 {
let tx = cast_pointer!(tx, SSHTransaction);
- match direction {
- STREAM_TOSERVER => {
+ match direction.into() {
+ Direction::ToServer => {
let m = &tx.cli_hdr.hassh_string;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- STREAM_TOCLIENT => {
+ Direction::ToClient => {
let m = &tx.srv_hdr.hassh_string;
if m.len() > 0 {
*buffer = m.as_ptr();
return 1;
}
}
- _ => {}
}
*buffer = ptr::null();
*buffer_len = 0;
use super::parser;
use crate::applayer::*;
-use crate::core::STREAM_TOSERVER;
-use crate::core::{self, AppProto, Flow, ALPROTO_UNKNOWN, IPPROTO_TCP};
+use crate::core::{self, *};
use nom7::Err;
use std::ffi::CString;
use std::sync::atomic::{AtomicBool, Ordering};
tx: *mut std::os::raw::c_void, direction: u8,
) -> SSHConnectionState {
let tx = cast_pointer!(tx, SSHTransaction);
- if direction == STREAM_TOSERVER {
+ if direction == Direction::ToServer.into() {
return tx.cli_hdr.flags;
} else {
return tx.srv_hdr.flags;
return SSHConnectionState::SshStateFinished as i32;
}
- if direction == STREAM_TOSERVER {
+ if direction == Direction::ToServer.into() {
if tx.cli_hdr.flags >= SSHConnectionState::SshStateBannerDone {
return SSHConnectionState::SshStateBannerDone as i32;
}