@ -19,6 +19,7 @@ use std;
use std ::ffi ::CString ;
use std ::ffi ::CString ;
use std ::os ::raw ::{ c_char , c_int , c_void } ;
use std ::os ::raw ::{ c_char , c_int , c_void } ;
use crate ::conf ::{ conf_get , get_memval } ;
use crate ::ftp ::constant ::* ;
use crate ::ftp ::constant ::* ;
use lazy_static ::lazy_static ;
use lazy_static ::lazy_static ;
@ -182,6 +183,49 @@ impl FtpTransferCmd {
}
}
}
}
#[ no_mangle ]
pub unsafe extern "C" fn SCFTPGetConfigValues (
memcap : * mut u64 , max_tx : * mut u32 , max_line_len : * mut u32 ,
) {
if let Some ( val ) = conf_get ( "app-layer.protocols.ftp.memcap" ) {
if let Ok ( v ) = get_memval ( val ) {
* memcap = v ;
SCLogConfig ! ( "FTP memcap: {}" , v ) ;
} else {
SCLogWarning ! (
"Invalid value {} for ftp.memcap; defaulting to {}" ,
val ,
* memcap
) ;
}
}
if let Some ( val ) = conf_get ( "app-layer.protocols.ftp.max-tx" ) {
if let Ok ( v ) = val . parse ::< u32 > ( ) {
* max_tx = v ;
SCLogConfig ! ( "FTP max tx: {}" , v ) ;
} else {
SCLogWarning ! (
"Invalid value {} for ftp.max-tx; defaulting to {}" ,
val ,
* max_tx
) ;
}
}
// This value is often expressed with a unit suffix, e.g., 5kb, hence get_memval
if let Some ( val ) = conf_get ( "app-layer.protocols.ftp.max-line-length" ) {
if let Ok ( v ) = get_memval ( val ) {
* max_line_len = v as u32 ;
SCLogConfig ! ( "FTP max line length: {}" , v ) ;
} else {
SCLogWarning ! (
"Invalid value {} for ftp.max-line-length; defaulting to {}" ,
val ,
* max_line_len
) ;
}
}
}
/// Returns *mut FtpTransferCmd
/// Returns *mut FtpTransferCmd
#[ no_mangle ]
#[ no_mangle ]
pub unsafe extern "C" fn SCFTPTransferCmdNew ( ) -> * mut FtpTransferCmd {
pub unsafe extern "C" fn SCFTPTransferCmdNew ( ) -> * mut FtpTransferCmd {