Skip to content

Commit 2a113a6

Browse files
committed
bindgen: fix include ordering
At some point, bindgen include ordering changed such that AppLayerGetFileState was being bindgen'd as opaque, as the definition of StreamBufferingConfig was not available when bindgen hit AppLayerGetFileState, and bindgen processes in order. Move the util includes before the app-layer includes to fix the ordering problem, but still keep util includes grouped. The sys diff is large as many things have been re-ordered.
1 parent 0eda09f commit 2a113a6

2 files changed

Lines changed: 183 additions & 184 deletions

File tree

rust/sys/src/sys.rs

Lines changed: 179 additions & 179 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,185 @@ extern "C" {
10591059
extern "C" {
10601060
pub fn SCLogGetLogLevel() -> SCLogLevel;
10611061
}
1062+
extern "C" {
1063+
pub fn SCFileFlowFlagsToFlags(flow_file_flags: u16, direction: u8) -> u16;
1064+
}
1065+
#[repr(C)]
1066+
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1067+
pub struct StreamingBufferConfig_ {
1068+
pub buf_size: u32,
1069+
#[doc = "< max concurrent memory regions. 0 means no limit."]
1070+
pub max_regions: u16,
1071+
#[doc = "< max gap size before a new region will be created."]
1072+
pub region_gap: u32,
1073+
pub Calloc: ::std::option::Option<
1074+
unsafe extern "C" fn(n: usize, size: usize) -> *mut ::std::os::raw::c_void,
1075+
>,
1076+
pub Realloc: ::std::option::Option<
1077+
unsafe extern "C" fn(
1078+
ptr: *mut ::std::os::raw::c_void,
1079+
orig_size: usize,
1080+
size: usize,
1081+
) -> *mut ::std::os::raw::c_void,
1082+
>,
1083+
pub Free:
1084+
::std::option::Option<unsafe extern "C" fn(ptr: *mut ::std::os::raw::c_void, size: usize)>,
1085+
}
1086+
pub type StreamingBufferConfig = StreamingBufferConfig_;
1087+
#[repr(C)]
1088+
#[derive(Debug, Copy, Clone)]
1089+
pub struct File_ {
1090+
_unused: [u8; 0],
1091+
}
1092+
pub type File = File_;
1093+
#[repr(C)]
1094+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1095+
pub struct FileContainer_ {
1096+
pub head: *mut File,
1097+
pub tail: *mut File,
1098+
}
1099+
impl Default for FileContainer_ {
1100+
fn default() -> Self {
1101+
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1102+
unsafe {
1103+
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1104+
s.assume_init()
1105+
}
1106+
}
1107+
}
1108+
pub type FileContainer = FileContainer_;
1109+
#[doc = " helper for the GetTxFilesFn. Not meant to be embedded as the config\n pointer is passed around in the API."]
1110+
#[repr(C)]
1111+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1112+
pub struct AppLayerGetFileState {
1113+
pub fc: *mut FileContainer,
1114+
pub cfg: *const StreamingBufferConfig,
1115+
}
1116+
impl Default for AppLayerGetFileState {
1117+
fn default() -> Self {
1118+
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1119+
unsafe {
1120+
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1121+
s.assume_init()
1122+
}
1123+
}
1124+
}
1125+
extern "C" {
1126+
#[doc = " \\brief Store a chunk of file data in the flow. The open \"flowfile\"\n will be used.\n\n \\param ffc the container\n \\param data data chunk\n \\param data_len data chunk len\n\n \\retval 0 ok\n \\retval -1 error"]
1127+
pub fn FileAppendData(
1128+
arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, data: *const u8,
1129+
data_len: u32,
1130+
) -> ::std::os::raw::c_int;
1131+
}
1132+
extern "C" {
1133+
#[doc = " \\brief Open a new File\n\n \\param ffc flow container\n \\param sbcfg buffer config\n \\param name filename character array\n \\param name_len filename len\n \\param data initial data\n \\param data_len initial data len\n \\param flags open flags\n\n \\retval ff flowfile object\n\n \\note filename is not a string, so it's not nul terminated.\n\n If flags contains the FILE_USE_DETECT bit, the pruning code will\n consider not just the content_stored tracker, but also content_inspected.\n It's the responsibility of the API user to make sure this tracker is\n properly updated."]
1134+
pub fn FileOpenFileWithId(
1135+
arg1: *mut FileContainer, arg2: *const StreamingBufferConfig, track_id: u32,
1136+
name: *const u8, name_len: u16, data: *const u8, data_len: u32, flags: u16,
1137+
) -> ::std::os::raw::c_int;
1138+
}
1139+
extern "C" {
1140+
pub fn FileAppendDataById(
1141+
arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1142+
data: *const u8, data_len: u32,
1143+
) -> ::std::os::raw::c_int;
1144+
}
1145+
extern "C" {
1146+
pub fn FileAppendGAPById(
1147+
ffc: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1148+
data: *const u8, data_len: u32,
1149+
) -> ::std::os::raw::c_int;
1150+
}
1151+
extern "C" {
1152+
pub fn FileCloseFileById(
1153+
arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1154+
data: *const u8, data_len: u32, flags: u16,
1155+
) -> ::std::os::raw::c_int;
1156+
}
1157+
extern "C" {
1158+
pub fn FileContainerRecycle(arg1: *mut FileContainer, cfg: *const StreamingBufferConfig);
1159+
}
1160+
#[repr(C)]
1161+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1162+
pub struct MpmPattern_ {
1163+
pub len: u16,
1164+
pub flags: u8,
1165+
pub offset: u16,
1166+
pub depth: u16,
1167+
pub original_pat: *mut u8,
1168+
pub cs: *mut u8,
1169+
pub ci: *mut u8,
1170+
pub id: u32,
1171+
pub sids_size: u32,
1172+
pub sids: *mut u32,
1173+
pub next: *mut MpmPattern_,
1174+
}
1175+
impl Default for MpmPattern_ {
1176+
fn default() -> Self {
1177+
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1178+
unsafe {
1179+
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1180+
s.assume_init()
1181+
}
1182+
}
1183+
}
1184+
pub type MpmPattern = MpmPattern_;
1185+
#[repr(C)]
1186+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1187+
pub struct MpmCtx_ {
1188+
pub ctx: *mut ::std::os::raw::c_void,
1189+
pub mpm_type: u8,
1190+
pub flags: u8,
1191+
pub maxdepth: u16,
1192+
pub pattern_cnt: u32,
1193+
pub minlen: u16,
1194+
pub maxlen: u16,
1195+
pub memory_cnt: u32,
1196+
pub memory_size: u32,
1197+
pub max_pat_id: u32,
1198+
pub init_hash: *mut *mut MpmPattern,
1199+
}
1200+
impl Default for MpmCtx_ {
1201+
fn default() -> Self {
1202+
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1203+
unsafe {
1204+
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1205+
s.assume_init()
1206+
}
1207+
}
1208+
}
1209+
pub type MpmCtx = MpmCtx_;
1210+
extern "C" {
1211+
pub fn SCMpmAddPatternCI(
1212+
mpm_ctx: *mut MpmCtx, pat: *const u8, patlen: u16, offset: u16, depth: u16, pid: u32,
1213+
sid: u32, flags: u8,
1214+
) -> ::std::os::raw::c_int;
1215+
}
1216+
#[repr(C)]
1217+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1218+
pub struct GenericVar_ {
1219+
#[doc = "< variable type, uses detection sm_type"]
1220+
pub type_: u16,
1221+
pub pad: [u8; 2usize],
1222+
pub idx: u32,
1223+
pub next: *mut GenericVar_,
1224+
}
1225+
impl Default for GenericVar_ {
1226+
fn default() -> Self {
1227+
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1228+
unsafe {
1229+
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1230+
s.assume_init()
1231+
}
1232+
}
1233+
}
1234+
pub type GenericVar = GenericVar_;
1235+
extern "C" {
1236+
pub fn SCGenericVarFree(arg1: *mut GenericVar);
1237+
}
1238+
extern "C" {
1239+
pub fn SCBasicSearchNocaseIndex(arg1: *const u8, arg2: u32, arg3: *const u8, arg4: u16) -> u32;
1240+
}
10621241
pub type ProbingParserFPtr = ::std::option::Option<
10631242
unsafe extern "C" fn(
10641243
f: *const Flow,
@@ -1177,12 +1356,6 @@ pub struct AppLayerParserState_ {
11771356
_unused: [u8; 0],
11781357
}
11791358
pub type AppLayerParserState = AppLayerParserState_;
1180-
#[repr(C)]
1181-
#[derive(Debug, Copy, Clone)]
1182-
pub struct File_ {
1183-
_unused: [u8; 0],
1184-
}
1185-
pub type File = File_;
11861359
extern "C" {
11871360
#[doc = " \\brief Given a protocol name, checks if the parser is enabled in\n the conf file.\n\n \\param alproto_name Name of the app layer protocol.\n\n \\retval 1 If enabled.\n \\retval 0 If disabled."]
11881361
pub fn SCAppLayerParserConfParserEnabled(
@@ -1280,7 +1453,6 @@ pub struct AppLayerTxConfig {
12801453
#[doc = " config: log flags"]
12811454
pub log_flags: u8,
12821455
}
1283-
pub type GenericVar = GenericVar_;
12841456
#[repr(C)]
12851457
#[derive(Debug, PartialEq, Eq)]
12861458
pub struct AppLayerTxData {
@@ -1509,98 +1681,6 @@ extern "C" {
15091681
arg1: *mut ::std::os::raw::c_void, arg2: *mut ::std::os::raw::c_void,
15101682
);
15111683
}
1512-
extern "C" {
1513-
pub fn SCFileFlowFlagsToFlags(flow_file_flags: u16, direction: u8) -> u16;
1514-
}
1515-
#[repr(C)]
1516-
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1517-
pub struct StreamingBufferConfig_ {
1518-
pub buf_size: u32,
1519-
#[doc = "< max concurrent memory regions. 0 means no limit."]
1520-
pub max_regions: u16,
1521-
#[doc = "< max gap size before a new region will be created."]
1522-
pub region_gap: u32,
1523-
pub Calloc: ::std::option::Option<
1524-
unsafe extern "C" fn(n: usize, size: usize) -> *mut ::std::os::raw::c_void,
1525-
>,
1526-
pub Realloc: ::std::option::Option<
1527-
unsafe extern "C" fn(
1528-
ptr: *mut ::std::os::raw::c_void,
1529-
orig_size: usize,
1530-
size: usize,
1531-
) -> *mut ::std::os::raw::c_void,
1532-
>,
1533-
pub Free:
1534-
::std::option::Option<unsafe extern "C" fn(ptr: *mut ::std::os::raw::c_void, size: usize)>,
1535-
}
1536-
pub type StreamingBufferConfig = StreamingBufferConfig_;
1537-
#[repr(C)]
1538-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1539-
pub struct FileContainer_ {
1540-
pub head: *mut File,
1541-
pub tail: *mut File,
1542-
}
1543-
impl Default for FileContainer_ {
1544-
fn default() -> Self {
1545-
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1546-
unsafe {
1547-
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1548-
s.assume_init()
1549-
}
1550-
}
1551-
}
1552-
pub type FileContainer = FileContainer_;
1553-
#[doc = " helper for the GetTxFilesFn. Not meant to be embedded as the config\n pointer is passed around in the API."]
1554-
#[repr(C)]
1555-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1556-
pub struct AppLayerGetFileState {
1557-
pub fc: *mut FileContainer,
1558-
pub cfg: *const StreamingBufferConfig,
1559-
}
1560-
impl Default for AppLayerGetFileState {
1561-
fn default() -> Self {
1562-
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1563-
unsafe {
1564-
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1565-
s.assume_init()
1566-
}
1567-
}
1568-
}
1569-
extern "C" {
1570-
#[doc = " \\brief Store a chunk of file data in the flow. The open \"flowfile\"\n will be used.\n\n \\param ffc the container\n \\param data data chunk\n \\param data_len data chunk len\n\n \\retval 0 ok\n \\retval -1 error"]
1571-
pub fn FileAppendData(
1572-
arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, data: *const u8,
1573-
data_len: u32,
1574-
) -> ::std::os::raw::c_int;
1575-
}
1576-
extern "C" {
1577-
#[doc = " \\brief Open a new File\n\n \\param ffc flow container\n \\param sbcfg buffer config\n \\param name filename character array\n \\param name_len filename len\n \\param data initial data\n \\param data_len initial data len\n \\param flags open flags\n\n \\retval ff flowfile object\n\n \\note filename is not a string, so it's not nul terminated.\n\n If flags contains the FILE_USE_DETECT bit, the pruning code will\n consider not just the content_stored tracker, but also content_inspected.\n It's the responsibility of the API user to make sure this tracker is\n properly updated."]
1578-
pub fn FileOpenFileWithId(
1579-
arg1: *mut FileContainer, arg2: *const StreamingBufferConfig, track_id: u32,
1580-
name: *const u8, name_len: u16, data: *const u8, data_len: u32, flags: u16,
1581-
) -> ::std::os::raw::c_int;
1582-
}
1583-
extern "C" {
1584-
pub fn FileAppendDataById(
1585-
arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1586-
data: *const u8, data_len: u32,
1587-
) -> ::std::os::raw::c_int;
1588-
}
1589-
extern "C" {
1590-
pub fn FileAppendGAPById(
1591-
ffc: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1592-
data: *const u8, data_len: u32,
1593-
) -> ::std::os::raw::c_int;
1594-
}
1595-
extern "C" {
1596-
pub fn FileCloseFileById(
1597-
arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1598-
data: *const u8, data_len: u32, flags: u16,
1599-
) -> ::std::os::raw::c_int;
1600-
}
1601-
extern "C" {
1602-
pub fn FileContainerRecycle(arg1: *mut FileContainer, cfg: *const StreamingBufferConfig);
1603-
}
16041684
#[repr(C)]
16051685
#[derive(Debug, Copy, Clone)]
16061686
pub struct HttpRangeContainerBuffer {
@@ -1702,86 +1782,6 @@ extern "C" {
17021782
f: *const Flow, dir: ::std::os::raw::c_int, id: FrameId, tx_id: u64,
17031783
);
17041784
}
1705-
#[repr(C)]
1706-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1707-
pub struct MpmPattern_ {
1708-
pub len: u16,
1709-
pub flags: u8,
1710-
pub offset: u16,
1711-
pub depth: u16,
1712-
pub original_pat: *mut u8,
1713-
pub cs: *mut u8,
1714-
pub ci: *mut u8,
1715-
pub id: u32,
1716-
pub sids_size: u32,
1717-
pub sids: *mut u32,
1718-
pub next: *mut MpmPattern_,
1719-
}
1720-
impl Default for MpmPattern_ {
1721-
fn default() -> Self {
1722-
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1723-
unsafe {
1724-
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1725-
s.assume_init()
1726-
}
1727-
}
1728-
}
1729-
pub type MpmPattern = MpmPattern_;
1730-
#[repr(C)]
1731-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1732-
pub struct MpmCtx_ {
1733-
pub ctx: *mut ::std::os::raw::c_void,
1734-
pub mpm_type: u8,
1735-
pub flags: u8,
1736-
pub maxdepth: u16,
1737-
pub pattern_cnt: u32,
1738-
pub minlen: u16,
1739-
pub maxlen: u16,
1740-
pub memory_cnt: u32,
1741-
pub memory_size: u32,
1742-
pub max_pat_id: u32,
1743-
pub init_hash: *mut *mut MpmPattern,
1744-
}
1745-
impl Default for MpmCtx_ {
1746-
fn default() -> Self {
1747-
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1748-
unsafe {
1749-
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1750-
s.assume_init()
1751-
}
1752-
}
1753-
}
1754-
pub type MpmCtx = MpmCtx_;
1755-
extern "C" {
1756-
pub fn SCMpmAddPatternCI(
1757-
mpm_ctx: *mut MpmCtx, pat: *const u8, patlen: u16, offset: u16, depth: u16, pid: u32,
1758-
sid: u32, flags: u8,
1759-
) -> ::std::os::raw::c_int;
1760-
}
1761-
#[repr(C)]
1762-
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1763-
pub struct GenericVar_ {
1764-
#[doc = "< variable type, uses detection sm_type"]
1765-
pub type_: u16,
1766-
pub pad: [u8; 2usize],
1767-
pub idx: u32,
1768-
pub next: *mut GenericVar_,
1769-
}
1770-
impl Default for GenericVar_ {
1771-
fn default() -> Self {
1772-
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1773-
unsafe {
1774-
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1775-
s.assume_init()
1776-
}
1777-
}
1778-
}
1779-
extern "C" {
1780-
pub fn SCGenericVarFree(arg1: *mut GenericVar);
1781-
}
1782-
extern "C" {
1783-
pub fn SCBasicSearchNocaseIndex(arg1: *const u8, arg2: u32, arg3: *const u8, arg4: u16) -> u32;
1784-
}
17851785
extern "C" {
17861786
pub fn SCFlowGetLastTimeAsParts(flow: *const Flow, secs: *mut u64, usecs: *mut u64);
17871787
}

0 commit comments

Comments
 (0)