-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic alprotos : make SNMP totally dynamic #12402
Changes from all commits
82f1fa8
65b4410
7930614
1b56f90
4957c6d
46616b4
ea87712
9da6f98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -472,12 +472,49 @@ pub type ApplyTxConfigFn = unsafe extern "C" fn (*mut c_void, *mut c_void, c_int | |
pub type GetFrameIdByName = unsafe extern "C" fn(*const c_char) -> c_int; | ||
pub type GetFrameNameById = unsafe extern "C" fn(u8) -> *const c_char; | ||
|
||
// Also defined in output-json.h | ||
/// cbindgen:ignore | ||
#[repr(u8)] | ||
#[derive(Debug, PartialEq, Eq, Clone, Copy)] | ||
#[allow(non_camel_case_types)] | ||
pub enum OutputJsonLogDirection { | ||
LOG_DIR_PACKET = 0, | ||
LOG_DIR_FLOW = 1, | ||
} | ||
|
||
// Also defined in output.h | ||
// canot use JsonBuilder as it is not #[repr(C)] | ||
pub type EveJsonSimpleTxLogFunc = unsafe extern "C" fn(*const c_void, *mut c_void) -> bool; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should cbindgen export types that are function prototypes ? |
||
|
||
// Also defined in output.h | ||
#[repr(C)] | ||
#[allow(non_snake_case)] | ||
pub struct EveJsonTxLoggerRegistrationData { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not like to see it defined twice neither |
||
pub confname: *const c_char, | ||
pub logname: *const c_char, | ||
pub alproto: AppProto, | ||
pub dir: u8, | ||
pub LogTx: EveJsonSimpleTxLogFunc, | ||
} | ||
|
||
// Defined in output.h | ||
/// cbindgen:ignore | ||
extern { | ||
pub fn OutputPreRegisterLogger(reg_data: EveJsonTxLoggerRegistrationData) -> c_int; | ||
} | ||
|
||
// Defined in detect-engine-register.h | ||
/// cbindgen:ignore | ||
extern { | ||
pub fn SigTablePreRegister(cb: unsafe extern "C" fn ()); | ||
} | ||
|
||
// Defined in app-layer-register.h | ||
/// cbindgen:ignore | ||
extern { | ||
pub fn AppLayerRegisterProtocolDetection(parser: *const RustParser, enable_default: c_int) -> AppProto; | ||
pub fn AppLayerRegisterParserAlias(parser_name: *const c_char, alias_name: *const c_char); | ||
pub fn AppProtoNewProtoFromString(name: *const c_char) -> AppProto; | ||
} | ||
|
||
#[allow(non_snake_case)] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
use crate::jsonbuilder::{JsonBuilder, JsonError}; | ||
use crate::tftp::tftp::TFTPTransaction; | ||
|
||
fn tftp_log_request(tx: &mut TFTPTransaction, | ||
fn tftp_log_request(tx: &TFTPTransaction, | ||
jb: &mut JsonBuilder) | ||
-> Result<(), JsonError> | ||
{ | ||
|
@@ -37,7 +37,7 @@ fn tftp_log_request(tx: &mut TFTPTransaction, | |
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn rs_tftp_log_json_request(tx: &mut TFTPTransaction, | ||
pub extern "C" fn rs_tftp_log_json_request(tx: &TFTPTransaction, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jasonish thoughts about this ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks OK. |
||
jb: &mut JsonBuilder) | ||
-> bool | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasonish what do you think about this ?
I do not like to see this defined twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you get the C to use this? In some cases there will be no way around it, at least not without bindgen to output C types, and cbindgen to output Rust types. But currently some things just can't include "rust.h" to get the types as rust.h might have a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not manage
Indeed the problem
I will try again a bit more