Skip to content

Commit

Permalink
app-layer: export to SCAppLayerStateGetEventInfoByFn with bindgen
Browse files Browse the repository at this point in the history
Rust will now fail, as the discrepancy between i8 and i32 is picked up.
  • Loading branch information
jasonish committed Oct 23, 2024
1 parent 3ea3afd commit 3e4f196
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions rust/src/applayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub struct RustParser {
/// Function to get an event id from a description
pub get_eventinfo: crate::sys::SCAppLayerStateGetEventInfoFn,
/// Function to get an event description from an event id
pub get_eventinfo_byid: Option<GetEventInfoByIdFn>,
pub get_eventinfo_byid: crate::sys::SCAppLayerStateGetEventInfoByIdFn,

/// Function to allocate local storage
pub localstorage_new: Option<LocalStorageNewFn>,
Expand Down Expand Up @@ -443,7 +443,6 @@ pub type StateFreeFn = unsafe extern "C" fn (*mut c_void);
pub type StateTxFreeFn = unsafe extern "C" fn (*mut c_void, u64);
pub type StateGetTxFn = unsafe extern "C" fn (*mut c_void, u64) -> *mut c_void;
pub type StateGetTxCntFn = unsafe extern "C" fn (*mut c_void) -> u64;
pub type GetEventInfoByIdFn = unsafe extern "C" fn (c_int, *mut *const c_char, *mut AppLayerEventType) -> i8;
pub type LocalStorageNewFn = extern "C" fn () -> *mut c_void;
pub type LocalStorageFreeFn = extern "C" fn (*mut c_void);
pub type GetTxFilesFn = unsafe extern "C" fn (*mut c_void, u8) -> AppLayerGetFileState;
Expand Down
2 changes: 2 additions & 0 deletions src/app-layer-ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ typedef enum AppLayerEventType {
typedef int (*SCAppLayerStateGetProgressFn)(void *alstate, uint8_t direction);
typedef int (*SCAppLayerStateGetEventInfoFn)(
const char *event_name, int *event_id, AppLayerEventType *event_type);
typedef int (*SCAppLayerStateGetEventInfoByIdFn)(
int event_id, const char **event_name, AppLayerEventType *event_type);

#endif /* SURICATA_APP_LAYER_EXT_H */
3 changes: 1 addition & 2 deletions src/app-layer-register.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ typedef struct AppLayerParser {
SCAppLayerStateGetProgressFn StateGetProgress;

SCAppLayerStateGetEventInfoFn StateGetEventInfo;
int (*StateGetEventInfoById)(int event_id, const char **event_name,
AppLayerEventType *event_type);
SCAppLayerStateGetEventInfoByIdFn StateGetEventInfoById;

void *(*LocalStorageAlloc)(void);
void (*LocalStorageFree)(void *);
Expand Down

0 comments on commit 3e4f196

Please sign in to comment.