SCDetectU32Free(ctx);
}
-pub unsafe extern "C" fn snmp_detect_usm_setup(
+unsafe extern "C" fn snmp_detect_usm_setup(
de: *mut c_void, s: *mut c_void, _raw: *const std::os::raw::c_char,
) -> c_int {
if DetectSignatureSetAppProto(s, ALPROTO_SNMP) != 0 {
return 0;
}
-pub unsafe extern "C" fn snmp_detect_usm_get(
+unsafe extern "C" fn snmp_detect_usm_get(
tx: *const c_void, _flow_flags: u8, buffer: *mut *const u8, buffer_len: *mut u32,
) -> bool {
let tx = cast_pointer!(tx, SNMPTransaction);
return false;
}
-pub unsafe extern "C" fn snmp_detect_usm_get_data(
+unsafe extern "C" fn snmp_detect_usm_get_data(
de: *mut c_void, transforms: *const c_void, flow: *const c_void, flow_flags: u8,
tx: *const c_void, list_id: c_int,
) -> *mut c_void {
);
}
-pub unsafe extern "C" fn snmp_detect_community_setup(
+unsafe extern "C" fn snmp_detect_community_setup(
de: *mut c_void, s: *mut c_void, _raw: *const std::os::raw::c_char,
) -> c_int {
if DetectSignatureSetAppProto(s, ALPROTO_SNMP) != 0 {
return 0;
}
-pub unsafe extern "C" fn snmp_detect_community_get(
+unsafe extern "C" fn snmp_detect_community_get(
tx: *const c_void, _flow_flags: u8, buffer: *mut *const u8, buffer_len: *mut u32,
) -> bool {
let tx = cast_pointer!(tx, SNMPTransaction);
return false;
}
-pub unsafe extern "C" fn snmp_detect_community_get_data(
+unsafe extern "C" fn snmp_detect_community_get_data(
de: *mut c_void, transforms: *const c_void, flow: *const c_void, flow_flags: u8,
tx: *const c_void, list_id: c_int,
) -> *mut c_void {
snmp_detect_community_get,
);
}
-#[no_mangle]
-pub unsafe extern "C" fn SCDetectSNMPRegister() {
+
+pub(super) unsafe extern "C" fn detect_snmp_register() {
let kw = SCSigTableElmt {
name: b"snmp.version\0".as_ptr() as *const libc::c_char,
desc: b"match SNMP version\0".as_ptr() as *const libc::c_char,
use crate::snmp::snmp_parser::*;
use crate::core::{self, *};
use crate::applayer::{self, *};
-use super::log::SCSnmpLogJsonResponse;
-use super::detect::SCDetectSNMPRegister;
+use super::log::snmp_log_json_response;
+use super::detect::detect_snmp_register;
use std;
use std::ffi::CString;
};
#[derive(AppLayerEvent)]
-pub enum SNMPEvent {
+enum SNMPEvent {
MalformedData,
UnknownSecurityModel,
VersionMismatch,
}
#[derive(Default)]
-pub struct SNMPState<'a> {
+struct SNMPState<'a> {
state_data: AppLayerStateData,
/// SNMP protocol version
- pub version: u32,
+ version: u32,
/// List of transactions for this session
transactions: Vec<SNMPTransaction<'a>>,
tx_id: u64,
}
-pub struct SNMPPduInfo<'a> {
+pub(super) struct SNMPPduInfo<'a> {
pub pdu_type: PduType,
pub err: ErrorStatus,
pub vars: Vec<Oid<'a>>,
}
-pub struct SNMPTransaction<'a> {
+pub(super) struct SNMPTransaction<'a> {
/// PDU version
pub version: u32,
}
impl<'a> SNMPState<'a> {
- pub fn new() -> SNMPState<'a> {
+ fn new() -> SNMPState<'a> {
Default::default()
}
}
}
impl<'a> SNMPTransaction<'a> {
- pub fn new(direction: Direction, version: u32, id: u64) -> SNMPTransaction<'a> {
+ fn new(direction: Direction, version: u32, id: u64) -> SNMPTransaction<'a> {
SNMPTransaction {
version,
info: None,
logname: b"JsonSNMPLog\0".as_ptr() as *const std::os::raw::c_char,
alproto: ALPROTO_SNMP,
dir: SCOutputJsonLogDirection::LOG_DIR_PACKET as u8,
- LogTx: Some(SCSnmpLogJsonResponse),
+ LogTx: Some(snmp_log_json_response),
};
SCOutputEvePreRegisterLogger(reg_data);
- SigTablePreRegister(SCDetectSNMPRegister);
+ SigTablePreRegister(detect_snmp_register);
if AppLayerProtoDetectConfProtoDetectionEnabled(ip_proto_str.as_ptr(), parser.name) != 0 {
// port 161
_ = AppLayerRegisterProtocolDetection(&parser, 1);