Coverage Report

Created: 2026-02-14 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata/rust/sys/src/sys.rs
Line
Count
Source
1
// This file is automatically generated. Do not edit.
2
3
pub const SC_PACKAGE_VERSION: &[u8; 10] = b"9.0.0-dev\0";
4
pub type __intmax_t = ::std::os::raw::c_long;
5
pub type intmax_t = __intmax_t;
6
#[repr(u32)]
7
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
8
pub enum AppProtoEnum {
9
    ALPROTO_UNKNOWN = 0,
10
    ALPROTO_FAILED = 1,
11
    ALPROTO_HTTP1 = 2,
12
    ALPROTO_FTP = 3,
13
    ALPROTO_SMTP = 4,
14
    ALPROTO_TLS = 5,
15
    ALPROTO_SSH = 6,
16
    ALPROTO_IMAP = 7,
17
    ALPROTO_JABBER = 8,
18
    ALPROTO_SMB = 9,
19
    ALPROTO_DCERPC = 10,
20
    ALPROTO_IRC = 11,
21
    ALPROTO_DNS = 12,
22
    ALPROTO_MODBUS = 13,
23
    ALPROTO_ENIP = 14,
24
    ALPROTO_DNP3 = 15,
25
    ALPROTO_NFS = 16,
26
    ALPROTO_NTP = 17,
27
    ALPROTO_FTPDATA = 18,
28
    ALPROTO_TFTP = 19,
29
    ALPROTO_IKE = 20,
30
    ALPROTO_KRB5 = 21,
31
    ALPROTO_QUIC = 22,
32
    ALPROTO_DHCP = 23,
33
    ALPROTO_SIP = 24,
34
    ALPROTO_RFB = 25,
35
    ALPROTO_MQTT = 26,
36
    ALPROTO_PGSQL = 27,
37
    ALPROTO_TELNET = 28,
38
    ALPROTO_WEBSOCKET = 29,
39
    ALPROTO_LDAP = 30,
40
    ALPROTO_DOH2 = 31,
41
    ALPROTO_TEMPLATE = 32,
42
    ALPROTO_RDP = 33,
43
    ALPROTO_HTTP2 = 34,
44
    ALPROTO_BITTORRENT_DHT = 35,
45
    ALPROTO_POP3 = 36,
46
    ALPROTO_MDNS = 37,
47
    ALPROTO_HTTP = 38,
48
    ALPROTO_MAX_STATIC = 39,
49
}
50
pub type AppProto = u16;
51
extern "C" {
52
    #[doc = " \\brief Maps the ALPROTO_*, to its string equivalent.\n\n \\param alproto App layer protocol id.\n\n \\retval String equivalent for the alproto."]
53
    pub fn AppProtoToString(alproto: AppProto) -> *const ::std::os::raw::c_char;
54
}
55
extern "C" {
56
    pub fn AppProtoNewProtoFromString(proto_name: *const ::std::os::raw::c_char) -> AppProto;
57
}
58
extern "C" {
59
    pub fn AppProtoRegisterProtoString(
60
        alproto: AppProto, proto_name: *const ::std::os::raw::c_char,
61
    );
62
}
63
pub const SC_API_VERSION: u64 = 2304;
64
#[doc = " Structure to define a Suricata plugin."]
65
#[repr(C)]
66
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
67
pub struct SCPlugin_ {
68
    pub version: u64,
69
    pub suricata_version: *const ::std::os::raw::c_char,
70
    pub name: *const ::std::os::raw::c_char,
71
    pub plugin_version: *const ::std::os::raw::c_char,
72
    pub license: *const ::std::os::raw::c_char,
73
    pub author: *const ::std::os::raw::c_char,
74
    pub Init: ::std::option::Option<unsafe extern "C" fn()>,
75
}
76
impl Default for SCPlugin_ {
77
0
    fn default() -> Self {
78
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
79
        unsafe {
80
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
81
0
            s.assume_init()
82
        }
83
0
    }
84
}
85
#[doc = " Structure to define a Suricata plugin."]
86
pub type SCPlugin = SCPlugin_;
87
pub type SCPluginRegisterFunc = ::std::option::Option<unsafe extern "C" fn() -> *mut SCPlugin>;
88
#[repr(C)]
89
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
90
pub struct SCCapturePlugin_ {
91
    pub name: *mut ::std::os::raw::c_char,
92
    pub Init: ::std::option::Option<
93
        unsafe extern "C" fn(
94
            args: *const ::std::os::raw::c_char,
95
            plugin_slot: ::std::os::raw::c_int,
96
            receive_slot: ::std::os::raw::c_int,
97
            decode_slot: ::std::os::raw::c_int,
98
        ),
99
    >,
100
    pub ThreadInit: ::std::option::Option<
101
        unsafe extern "C" fn(
102
            ctx: *mut ::std::os::raw::c_void,
103
            thread_id: ::std::os::raw::c_int,
104
            thread_ctx: *mut *mut ::std::os::raw::c_void,
105
        ) -> ::std::os::raw::c_int,
106
    >,
107
    pub ThreadDeinit: ::std::option::Option<
108
        unsafe extern "C" fn(
109
            ctx: *mut ::std::os::raw::c_void,
110
            thread_ctx: *mut ::std::os::raw::c_void,
111
        ) -> ::std::os::raw::c_int,
112
    >,
113
    pub GetDefaultMode:
114
        ::std::option::Option<unsafe extern "C" fn() -> *const ::std::os::raw::c_char>,
115
    pub entries: SCCapturePlugin___bindgen_ty_1,
116
}
117
#[repr(C)]
118
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
119
pub struct SCCapturePlugin___bindgen_ty_1 {
120
    pub tqe_next: *mut SCCapturePlugin_,
121
    pub tqe_prev: *mut *mut SCCapturePlugin_,
122
}
123
impl Default for SCCapturePlugin___bindgen_ty_1 {
124
0
    fn default() -> Self {
125
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
126
        unsafe {
127
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
128
0
            s.assume_init()
129
        }
130
0
    }
131
}
132
impl Default for SCCapturePlugin_ {
133
0
    fn default() -> Self {
134
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
135
        unsafe {
136
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
137
0
            s.assume_init()
138
        }
139
0
    }
140
}
141
pub type SCCapturePlugin = SCCapturePlugin_;
142
extern "C" {
143
    pub fn SCPluginRegisterCapture(arg1: *mut SCCapturePlugin) -> ::std::os::raw::c_int;
144
}
145
#[repr(C)]
146
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
147
pub struct SCAppLayerPlugin_ {
148
    pub name: *const ::std::os::raw::c_char,
149
    pub Register: ::std::option::Option<unsafe extern "C" fn()>,
150
    pub KeywordsRegister: ::std::option::Option<unsafe extern "C" fn()>,
151
    pub logname: *const ::std::os::raw::c_char,
152
    pub confname: *const ::std::os::raw::c_char,
153
    pub dir: u8,
154
    pub Logger: ::std::option::Option<
155
        unsafe extern "C" fn(
156
            tx: *const ::std::os::raw::c_void,
157
            jb: *mut ::std::os::raw::c_void,
158
        ) -> bool,
159
    >,
160
}
161
impl Default for SCAppLayerPlugin_ {
162
0
    fn default() -> Self {
163
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
164
        unsafe {
165
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
166
0
            s.assume_init()
167
        }
168
0
    }
169
}
170
pub type SCAppLayerPlugin = SCAppLayerPlugin_;
171
extern "C" {
172
    pub fn SCPluginRegisterAppLayer(arg1: *mut SCAppLayerPlugin) -> ::std::os::raw::c_int;
173
}
174
#[doc = " Structure of a configuration parameter."]
175
#[repr(C)]
176
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
177
pub struct SCConfNode_ {
178
    pub name: *mut ::std::os::raw::c_char,
179
    pub val: *mut ::std::os::raw::c_char,
180
    pub is_seq: ::std::os::raw::c_int,
181
    pub final_: ::std::os::raw::c_int,
182
    pub parent: *mut SCConfNode_,
183
    pub head: SCConfNode___bindgen_ty_1,
184
    pub next: SCConfNode___bindgen_ty_2,
185
}
186
#[repr(C)]
187
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
188
pub struct SCConfNode___bindgen_ty_1 {
189
    pub tqh_first: *mut SCConfNode_,
190
    pub tqh_last: *mut *mut SCConfNode_,
191
}
192
impl Default for SCConfNode___bindgen_ty_1 {
193
0
    fn default() -> Self {
194
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
195
        unsafe {
196
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
197
0
            s.assume_init()
198
        }
199
0
    }
200
}
201
#[repr(C)]
202
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
203
pub struct SCConfNode___bindgen_ty_2 {
204
    pub tqe_next: *mut SCConfNode_,
205
    pub tqe_prev: *mut *mut SCConfNode_,
206
}
207
impl Default for SCConfNode___bindgen_ty_2 {
208
0
    fn default() -> Self {
209
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
210
        unsafe {
211
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
212
0
            s.assume_init()
213
        }
214
0
    }
215
}
216
impl Default for SCConfNode_ {
217
0
    fn default() -> Self {
218
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
219
        unsafe {
220
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
221
0
            s.assume_init()
222
        }
223
0
    }
224
}
225
#[doc = " Structure of a configuration parameter."]
226
pub type SCConfNode = [u64; 8usize];
227
extern "C" {
228
    pub fn SCConfInit();
229
}
230
extern "C" {
231
    pub fn SCConfDeInit();
232
}
233
extern "C" {
234
    pub fn SCConfGetRootNode() -> *mut SCConfNode;
235
}
236
extern "C" {
237
    pub fn SCConfGet(
238
        name: *const ::std::os::raw::c_char, vptr: *mut *const ::std::os::raw::c_char,
239
    ) -> ::std::os::raw::c_int;
240
}
241
extern "C" {
242
    pub fn SCConfGetInt(
243
        name: *const ::std::os::raw::c_char, val: *mut intmax_t,
244
    ) -> ::std::os::raw::c_int;
245
}
246
extern "C" {
247
    pub fn SCConfGetBool(
248
        name: *const ::std::os::raw::c_char, val: *mut ::std::os::raw::c_int,
249
    ) -> ::std::os::raw::c_int;
250
}
251
extern "C" {
252
    pub fn SCConfGetDouble(
253
        name: *const ::std::os::raw::c_char, val: *mut f64,
254
    ) -> ::std::os::raw::c_int;
255
}
256
extern "C" {
257
    pub fn SCConfGetFloat(
258
        name: *const ::std::os::raw::c_char, val: *mut f32,
259
    ) -> ::std::os::raw::c_int;
260
}
261
extern "C" {
262
    pub fn SCConfGetTime(
263
        name: *const ::std::os::raw::c_char, val: *mut u64,
264
    ) -> ::std::os::raw::c_int;
265
}
266
extern "C" {
267
    pub fn SCConfSet(
268
        name: *const ::std::os::raw::c_char, val: *const ::std::os::raw::c_char,
269
    ) -> ::std::os::raw::c_int;
270
}
271
extern "C" {
272
    pub fn SCConfSetFromString(
273
        input: *const ::std::os::raw::c_char, final_: ::std::os::raw::c_int,
274
    ) -> ::std::os::raw::c_int;
275
}
276
extern "C" {
277
    pub fn SCConfSetFinal(
278
        name: *const ::std::os::raw::c_char, val: *const ::std::os::raw::c_char,
279
    ) -> ::std::os::raw::c_int;
280
}
281
extern "C" {
282
    pub fn SCConfDump();
283
}
284
extern "C" {
285
    pub fn SCConfNodeDump(node: *const SCConfNode, prefix: *const ::std::os::raw::c_char);
286
}
287
extern "C" {
288
    pub fn SCConfNodeNew() -> *mut SCConfNode;
289
}
290
extern "C" {
291
    pub fn SCConfNodeFree(arg1: *mut SCConfNode);
292
}
293
extern "C" {
294
    pub fn SCConfGetNode(key: *const ::std::os::raw::c_char) -> *mut SCConfNode;
295
}
296
extern "C" {
297
    pub fn SCConfCreateContextBackup();
298
}
299
extern "C" {
300
    pub fn SCConfRestoreContextBackup();
301
}
302
extern "C" {
303
    pub fn SCConfNodeLookupChild(
304
        node: *const SCConfNode, key: *const ::std::os::raw::c_char,
305
    ) -> *mut SCConfNode;
306
}
307
extern "C" {
308
    pub fn SCConfNodeLookupChildValue(
309
        node: *const SCConfNode, key: *const ::std::os::raw::c_char,
310
    ) -> *const ::std::os::raw::c_char;
311
}
312
extern "C" {
313
    pub fn SCConfNodeRemove(arg1: *mut SCConfNode);
314
}
315
extern "C" {
316
    pub fn SCConfRegisterTests();
317
}
318
extern "C" {
319
    pub fn SCConfNodeChildValueIsTrue(
320
        node: *const SCConfNode, key: *const ::std::os::raw::c_char,
321
    ) -> ::std::os::raw::c_int;
322
}
323
extern "C" {
324
    pub fn SCConfNodeChildValueIsFalse(
325
        node: *const SCConfNode, key: *const ::std::os::raw::c_char,
326
    ) -> ::std::os::raw::c_int;
327
}
328
extern "C" {
329
    pub fn SCConfValIsTrue(val: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
330
}
331
extern "C" {
332
    pub fn SCConfValIsFalse(val: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
333
}
334
extern "C" {
335
    pub fn SCConfNodePrune(node: *mut SCConfNode);
336
}
337
extern "C" {
338
    pub fn SCConfRemove(name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
339
}
340
extern "C" {
341
    pub fn SCConfNodeHasChildren(node: *const SCConfNode) -> bool;
342
}
343
extern "C" {
344
    pub fn SCConfGetChildWithDefault(
345
        base: *const SCConfNode, dflt: *const SCConfNode, name: *const ::std::os::raw::c_char,
346
    ) -> *mut SCConfNode;
347
}
348
extern "C" {
349
    pub fn SCConfNodeLookupKeyValue(
350
        base: *const SCConfNode, key: *const ::std::os::raw::c_char,
351
        value: *const ::std::os::raw::c_char,
352
    ) -> *mut SCConfNode;
353
}
354
extern "C" {
355
    pub fn SCConfGetChildValue(
356
        base: *const SCConfNode, name: *const ::std::os::raw::c_char,
357
        vptr: *mut *const ::std::os::raw::c_char,
358
    ) -> ::std::os::raw::c_int;
359
}
360
extern "C" {
361
    pub fn SCConfGetChildValueInt(
362
        base: *const SCConfNode, name: *const ::std::os::raw::c_char, val: *mut intmax_t,
363
    ) -> ::std::os::raw::c_int;
364
}
365
extern "C" {
366
    pub fn SCConfGetChildValueBool(
367
        base: *const SCConfNode, name: *const ::std::os::raw::c_char,
368
        val: *mut ::std::os::raw::c_int,
369
    ) -> ::std::os::raw::c_int;
370
}
371
extern "C" {
372
    pub fn SCConfGetChildValueWithDefault(
373
        base: *const SCConfNode, dflt: *const SCConfNode, name: *const ::std::os::raw::c_char,
374
        vptr: *mut *const ::std::os::raw::c_char,
375
    ) -> ::std::os::raw::c_int;
376
}
377
extern "C" {
378
    pub fn SCConfGetChildValueIntWithDefault(
379
        base: *const SCConfNode, dflt: *const SCConfNode, name: *const ::std::os::raw::c_char,
380
        val: *mut intmax_t,
381
    ) -> ::std::os::raw::c_int;
382
}
383
extern "C" {
384
    pub fn SCConfGetChildValueBoolWithDefault(
385
        base: *const SCConfNode, dflt: *const SCConfNode, name: *const ::std::os::raw::c_char,
386
        val: *mut ::std::os::raw::c_int,
387
    ) -> ::std::os::raw::c_int;
388
}
389
extern "C" {
390
    pub fn SCConfNodeIsSequence(node: *const SCConfNode) -> ::std::os::raw::c_int;
391
}
392
extern "C" {
393
    pub fn SCConfSetIfaceNode(
394
        ifaces_node_name: *const ::std::os::raw::c_char, iface: *const ::std::os::raw::c_char,
395
    ) -> *mut SCConfNode;
396
}
397
extern "C" {
398
    pub fn SCConfSetRootAndDefaultNodes(
399
        ifaces_node_name: *const ::std::os::raw::c_char, iface: *const ::std::os::raw::c_char,
400
        if_root: *mut *mut SCConfNode, if_default: *mut *mut SCConfNode,
401
    ) -> ::std::os::raw::c_int;
402
}
403
extern "C" {
404
    pub fn SCConfNodeGetNodeOrCreate(
405
        parent: *mut SCConfNode, name: *const ::std::os::raw::c_char, final_: ::std::os::raw::c_int,
406
    ) -> *mut SCConfNode;
407
}
408
extern "C" {
409
    pub fn SCConfGetFirstNode(parent: *const SCConfNode) -> *mut SCConfNode;
410
}
411
extern "C" {
412
    pub fn SCConfGetNextNode(node: *const SCConfNode) -> *mut SCConfNode;
413
}
414
extern "C" {
415
    pub fn SCConfGetValueNode(node: *const SCConfNode) -> *const ::std::os::raw::c_char;
416
}
417
#[repr(C)]
418
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
419
pub struct ThreadVars_ {
420
    _unused: [u8; 0],
421
}
422
pub type ThreadVars = u8;
423
#[repr(C)]
424
#[derive(Debug, Copy, Clone)]
425
pub struct Flow_ {
426
    _unused: [u8; 0],
427
}
428
pub type Flow = Flow_;
429
#[repr(C)]
430
#[derive(Debug, Copy, Clone)]
431
pub struct SCJsonBuilder {
432
    _unused: [u8; 0],
433
}
434
#[repr(C)]
435
#[derive(Debug, Copy, Clone)]
436
pub struct Packet_ {
437
    _unused: [u8; 0],
438
}
439
pub type Packet = Packet_;
440
pub type ThreadId = u32;
441
#[repr(u32)]
442
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
443
pub enum SCOutputJsonLogDirection {
444
    LOG_DIR_PACKET = 0,
445
    LOG_DIR_FLOW = 1,
446
    LOG_DIR_FLOW_TOCLIENT = 2,
447
    LOG_DIR_FLOW_TOSERVER = 3,
448
}
449
pub type EveJsonSimpleTxLogFunc = ::std::option::Option<
450
    unsafe extern "C" fn(
451
        arg1: *const ::std::os::raw::c_void,
452
        arg2: *mut ::std::os::raw::c_void,
453
    ) -> bool,
454
>;
455
#[repr(C)]
456
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
457
pub struct EveJsonSimpleAppLayerLogger {
458
    pub LogTx: EveJsonSimpleTxLogFunc,
459
    pub name: *const ::std::os::raw::c_char,
460
}
461
impl Default for EveJsonSimpleAppLayerLogger {
462
0
    fn default() -> Self {
463
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
464
        unsafe {
465
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
466
0
            s.assume_init()
467
        }
468
0
    }
469
}
470
extern "C" {
471
    pub fn SCEveJsonSimpleGetLogger(alproto: AppProto) -> *mut EveJsonSimpleAppLayerLogger;
472
}
473
#[repr(C)]
474
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
475
pub struct EveJsonTxLoggerRegistrationData {
476
    pub confname: *const ::std::os::raw::c_char,
477
    pub logname: *const ::std::os::raw::c_char,
478
    pub alproto: AppProto,
479
    pub dir: u8,
480
    pub LogTx: EveJsonSimpleTxLogFunc,
481
}
482
impl Default for EveJsonTxLoggerRegistrationData {
483
0
    fn default() -> Self {
484
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
485
        unsafe {
486
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
487
0
            s.assume_init()
488
        }
489
0
    }
490
}
491
extern "C" {
492
    pub fn SCOutputEvePreRegisterLogger(
493
        reg_data: EveJsonTxLoggerRegistrationData,
494
    ) -> ::std::os::raw::c_int;
495
}
496
#[doc = " \\brief Function type for EVE file-type initialization."]
497
pub type SCEveFileTypeInitFunc = ::std::option::Option<
498
    unsafe extern "C" fn(
499
        conf: *const SCConfNode,
500
        threaded: bool,
501
        init_data: *mut *mut ::std::os::raw::c_void,
502
    ) -> ::std::os::raw::c_int,
503
>;
504
#[doc = " \\brief Function type for EVE file-type thread initialization."]
505
pub type SCEveFileTypeThreadInitFunc = ::std::option::Option<
506
    unsafe extern "C" fn(
507
        init_data: *const ::std::os::raw::c_void,
508
        thread_id: ThreadId,
509
        thread_data: *mut *mut ::std::os::raw::c_void,
510
    ) -> ::std::os::raw::c_int,
511
>;
512
#[doc = " \\brief Function type for EVE file-type writes."]
513
pub type SCEveFileTypeWriteFunc = ::std::option::Option<
514
    unsafe extern "C" fn(
515
        buffer: *const ::std::os::raw::c_char,
516
        buffer_len: ::std::os::raw::c_int,
517
        init_data: *const ::std::os::raw::c_void,
518
        thread_data: *mut ::std::os::raw::c_void,
519
    ) -> ::std::os::raw::c_int,
520
>;
521
#[doc = " \\brief Function type for EVE file-type thread deinitialization."]
522
pub type SCEveFileTypeThreadDeinitFunc = ::std::option::Option<
523
    unsafe extern "C" fn(
524
        init_data: *const ::std::os::raw::c_void,
525
        thread_data: *mut ::std::os::raw::c_void,
526
    ),
527
>;
528
#[doc = " \\brief Function type for EVE file-type deinitialization."]
529
pub type SCEveFileTypeDeinitFunc =
530
    ::std::option::Option<unsafe extern "C" fn(init_data: *mut ::std::os::raw::c_void)>;
531
#[doc = " \\brief Structure used to define an EVE output file type.\n\n EVE filetypes implement an object with a file-like interface and\n are used to output EVE log records to files, syslog, or\n database. They can be built-in such as the syslog (see\n SyslogInitialize()) and nullsink (see NullLogInitialize()) outputs,\n registered by a library user or dynamically loaded as a plugin.\n\n The life cycle of an EVE filetype is:\n   - Init: called once for each EVE instance using this filetype\n   - ThreadInit: called once for each output thread\n   - Write: called for each log record\n   - ThreadDeinit: called once for each output thread on exit\n   - Deinit: called once for each EVE instance using this filetype on exit\n\n Examples:\n - built-in syslog: \\ref src/output-eve-syslog.c\n - built-in nullsink: \\ref src/output-eve-null.c\n - example plugin: \\ref examples/plugins/c-json-filetype/filetype.c\n\n ### Multi-Threaded Note:\n\n The EVE logging system can be configured by the Suricata user to\n run in threaded or non-threaded modes. In the default non-threaded\n mode, ThreadInit will only be called once and the filetype does not\n need to be concerned with threads.\n\n However, in **threaded** mode, ThreadInit will be called multiple\n times and the filetype needs to be thread aware and thread-safe. If\n utilizing a unique resource such as a file for each thread then you\n may be naturally thread safe. However, if sharing a single file\n handle across all threads then your filetype will have to take care\n of locking, etc."]
532
#[repr(C)]
533
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
534
pub struct SCEveFileType_ {
535
    #[doc = " \\brief The name of the output, used in the configuration.\n\n This name is used by the configuration file to specify the EVE\n filetype used.\n\n For example:\n\n \\code{.yaml}\n outputs:\n   - eve-log:\n       filetype: my-output-name\n \\endcode"]
536
    pub name: *const ::std::os::raw::c_char,
537
    #[doc = " \\brief Function to initialize this filetype.\n\n \\param conf The ConfNode of the `eve-log` configuration\n     section this filetype is being initialized for\n\n \\param threaded Flag to specify if the EVE sub-systems is in\n     threaded mode or not\n\n \\param init_data An output pointer for filetype specific data\n\n \\retval 0 on success, -1 on failure"]
538
    pub Init: SCEveFileTypeInitFunc,
539
    #[doc = " \\brief Initialize thread specific data.\n\n Initialize any thread specific data. For example, if\n implementing a file output you might open the files here, so\n you have one output file per thread.\n\n \\param init_data Data setup during Init\n\n \\param thread_id A unique ID to differentiate this thread from\n     others. If EVE is not in threaded mode this will be called\n     once with a ThreadId of 0. In threaded mode the ThreadId of\n     0 correlates to the main Suricata thread.\n\n \\param thread_data Output pointer for any data required by this\n     thread.\n\n \\retval 0 on success, -1 on failure"]
540
    pub ThreadInit: SCEveFileTypeThreadInitFunc,
541
    #[doc = " \\brief Called for each EVE log record.\n\n The Write function is called for each log EVE log record. The\n provided buffer contains a fully formatted EVE record in JSON\n format.\n\n \\param buffer The fully formatted JSON EVE log record\n\n \\param buffer_len The length of the buffer\n\n \\param init_data The data setup in the call to Init\n\n \\param thread_data The data setup in the call to ThreadInit\n\n \\retval 0 on success, -1 on failure"]
542
    pub Write: SCEveFileTypeWriteFunc,
543
    #[doc = " \\brief Called to deinitialize each thread.\n\n This function will be called for each thread. It is where any\n resources allocated in ThreadInit should be released.\n\n \\param init_data The data setup in Init\n\n \\param thread_data The data setup in ThreadInit"]
544
    pub ThreadDeinit: SCEveFileTypeThreadDeinitFunc,
545
    #[doc = " \\brief Final call to deinitialize this filetype.\n\n Called, usually on exit to deinitialize and free any resources\n allocated during Init.\n\n \\param init_data Data setup in the call to Init."]
546
    pub Deinit: SCEveFileTypeDeinitFunc,
547
    pub entries: SCEveFileType___bindgen_ty_1,
548
}
549
#[repr(C)]
550
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
551
pub struct SCEveFileType___bindgen_ty_1 {
552
    pub tqe_next: *mut SCEveFileType_,
553
    pub tqe_prev: *mut *mut SCEveFileType_,
554
}
555
impl Default for SCEveFileType___bindgen_ty_1 {
556
0
    fn default() -> Self {
557
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
558
        unsafe {
559
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
560
0
            s.assume_init()
561
        }
562
0
    }
563
}
564
impl Default for SCEveFileType_ {
565
0
    fn default() -> Self {
566
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
567
        unsafe {
568
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
569
0
            s.assume_init()
570
        }
571
0
    }
572
}
573
#[doc = " \\brief Structure used to define an EVE output file type.\n\n EVE filetypes implement an object with a file-like interface and\n are used to output EVE log records to files, syslog, or\n database. They can be built-in such as the syslog (see\n SyslogInitialize()) and nullsink (see NullLogInitialize()) outputs,\n registered by a library user or dynamically loaded as a plugin.\n\n The life cycle of an EVE filetype is:\n   - Init: called once for each EVE instance using this filetype\n   - ThreadInit: called once for each output thread\n   - Write: called for each log record\n   - ThreadDeinit: called once for each output thread on exit\n   - Deinit: called once for each EVE instance using this filetype on exit\n\n Examples:\n - built-in syslog: \\ref src/output-eve-syslog.c\n - built-in nullsink: \\ref src/output-eve-null.c\n - example plugin: \\ref examples/plugins/c-json-filetype/filetype.c\n\n ### Multi-Threaded Note:\n\n The EVE logging system can be configured by the Suricata user to\n run in threaded or non-threaded modes. In the default non-threaded\n mode, ThreadInit will only be called once and the filetype does not\n need to be concerned with threads.\n\n However, in **threaded** mode, ThreadInit will be called multiple\n times and the filetype needs to be thread aware and thread-safe. If\n utilizing a unique resource such as a file for each thread then you\n may be naturally thread safe. However, if sharing a single file\n handle across all threads then your filetype will have to take care\n of locking, etc."]
574
pub type SCEveFileType = SCEveFileType_;
575
extern "C" {
576
    pub fn SCRegisterEveFileType(arg1: *mut SCEveFileType) -> bool;
577
}
578
extern "C" {
579
    pub fn SCEveFindFileType(name: *const ::std::os::raw::c_char) -> *mut SCEveFileType;
580
}
581
#[doc = " \\brief Function type for EVE callbacks.\n\n The function type for callbacks registered with\n SCEveRegisterCallback. This function will be called with the\n SCJsonBuilder just prior to the top-level object being closed. New\n fields may be added, however, there is no way to alter existing\n objects already added to the SCJsonBuilder.\n\n \\param tv The ThreadVars for the thread performing the logging.\n \\param p Packet if available.\n \\param f Flow if available.\n \\param user User data provided during callback registration."]
582
pub type SCEveUserCallbackFn = ::std::option::Option<
583
    unsafe extern "C" fn(
584
        tv: *mut ThreadVars,
585
        p: *const Packet,
586
        f: *mut Flow,
587
        jb: *mut SCJsonBuilder,
588
        user: *mut ::std::os::raw::c_void,
589
    ),
590
>;
591
extern "C" {
592
    #[doc = " \\brief Register a callback for adding extra information to EVE logs.\n\n Allow users to register a callback for each EVE log. The callback\n is called just before the root object on the SCJsonBuilder is to be\n closed.\n\n New objects and fields can be appended, but existing entries cannot be modified.\n\n Packet and Flow will be provided if available, but will otherwise be\n NULL.\n\n Limitations: At this time the callbacks will only be called for EVE\n loggers that use SCJsonBuilder, notably this means it won't be called\n for stats records at this time.\n\n \\returns true if callback is registered, false is not due to memory\n     allocation error."]
593
    pub fn SCEveRegisterCallback(
594
        fn_: SCEveUserCallbackFn, user: *mut ::std::os::raw::c_void,
595
    ) -> bool;
596
}
597
extern "C" {
598
    #[doc = " \\internal\n\n Run EVE callbacks."]
599
    pub fn SCEveRunCallbacks(
600
        tv: *mut ThreadVars, p: *const Packet, f: *mut Flow, jb: *mut SCJsonBuilder,
601
    );
602
}
603
extern "C" {
604
    pub fn SCSigTablePreRegister(
605
        KeywordsRegister: ::std::option::Option<unsafe extern "C" fn()>,
606
    ) -> ::std::os::raw::c_int;
607
}
608
extern "C" {
609
    pub fn SCSigTableHasKeyword(keyword: *const ::std::os::raw::c_char) -> bool;
610
}
611
extern "C" {
612
    pub fn SCDetectHelperKeywordSetCleanCString(id: u16);
613
}
614
#[repr(C)]
615
#[derive(Debug, Copy, Clone)]
616
pub struct DetectEngineCtx_ {
617
    _unused: [u8; 0],
618
}
619
pub type DetectEngineCtx = DetectEngineCtx_;
620
#[repr(C)]
621
#[derive(Debug, Copy, Clone)]
622
pub struct Signature_ {
623
    _unused: [u8; 0],
624
}
625
pub type Signature = Signature_;
626
#[repr(C)]
627
#[derive(Debug, Copy, Clone)]
628
pub struct SigMatch_ {
629
    _unused: [u8; 0],
630
}
631
pub type SigMatch = SigMatch_;
632
extern "C" {
633
    pub fn SCDetectBufferSetActiveList(
634
        de_ctx: *mut DetectEngineCtx, s: *mut Signature, list: ::std::os::raw::c_int,
635
    ) -> ::std::os::raw::c_int;
636
}
637
extern "C" {
638
    pub fn SCDetectSignatureAddTransform(
639
        s: *mut Signature, transform: ::std::os::raw::c_int, options: *mut ::std::os::raw::c_void,
640
    ) -> ::std::os::raw::c_int;
641
}
642
#[repr(C)]
643
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
644
pub struct InspectionBuffer {
645
    #[doc = "< active pointer, points either to ::buf or ::orig"]
646
    pub inspect: *const u8,
647
    pub inspect_offset: u64,
648
    #[doc = "< size of active data. See to ::len or ::orig_len"]
649
    pub inspect_len: u32,
650
    #[doc = "< is initialized. ::inspect might be NULL if transform lead to 0 size"]
651
    pub initialized: bool,
652
    #[doc = "< DETECT_CI_FLAGS_* for use with DetectEngineContentInspection"]
653
    pub flags: u8,
654
    #[doc = "< how much is in use"]
655
    pub len: u32,
656
    pub buf: *mut u8,
657
    #[doc = "< size of the memory allocation"]
658
    pub size: u32,
659
    pub orig_len: u32,
660
    pub orig: *const u8,
661
}
662
impl Default for InspectionBuffer {
663
0
    fn default() -> Self {
664
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
665
        unsafe {
666
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
667
0
            s.assume_init()
668
        }
669
0
    }
670
}
671
#[repr(C)]
672
#[derive(Debug, Copy, Clone)]
673
pub struct DetectEngineThreadCtx_ {
674
    _unused: [u8; 0],
675
}
676
pub type DetectEngineThreadCtx = DetectEngineThreadCtx_;
677
extern "C" {
678
    pub fn SCInspectionBufferCheckAndExpand(
679
        buffer: *mut InspectionBuffer, min_size: u32,
680
    ) -> *mut u8;
681
}
682
extern "C" {
683
    pub fn SCInspectionBufferTruncate(buffer: *mut InspectionBuffer, buf_len: u32);
684
}
685
#[repr(C)]
686
#[derive(Debug, Copy, Clone)]
687
pub struct SigMatchCtx_ {
688
    _unused: [u8; 0],
689
}
690
pub type SigMatchCtx = SigMatchCtx_;
691
pub type InspectionMultiBufferGetDataPtr = ::std::option::Option<
692
    unsafe extern "C" fn(
693
        det_ctx: *mut DetectEngineThreadCtx_,
694
        txv: *const ::std::os::raw::c_void,
695
        flow_flags: u8,
696
        local_id: u32,
697
        buf: *mut *const u8,
698
        buf_len: *mut u32,
699
    ) -> bool,
700
>;
701
pub type InspectionSingleBufferGetDataPtr = ::std::option::Option<
702
    unsafe extern "C" fn(
703
        txv: *const ::std::os::raw::c_void,
704
        flow_flags: u8,
705
        buf: *mut *const u8,
706
        buf_len: *mut u32,
707
    ) -> bool,
708
>;
709
#[doc = " App-layer light version of SigTableElmt"]
710
#[repr(C)]
711
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
712
pub struct SCSigTableAppLiteElmt {
713
    #[doc = " keyword name"]
714
    pub name: *const ::std::os::raw::c_char,
715
    #[doc = " keyword description"]
716
    pub desc: *const ::std::os::raw::c_char,
717
    #[doc = " keyword documentation url"]
718
    pub url: *const ::std::os::raw::c_char,
719
    #[doc = " flags SIGMATCH_*"]
720
    pub flags: u32,
721
    #[doc = " function callback to parse and setup keyword in rule"]
722
    pub Setup: ::std::option::Option<
723
        unsafe extern "C" fn(
724
            arg1: *mut DetectEngineCtx,
725
            arg2: *mut Signature,
726
            arg3: *const ::std::os::raw::c_char,
727
        ) -> ::std::os::raw::c_int,
728
    >,
729
    #[doc = " function callback to free structure allocated by setup if any"]
730
    pub Free: ::std::option::Option<
731
        unsafe extern "C" fn(arg1: *mut DetectEngineCtx, arg2: *mut ::std::os::raw::c_void),
732
    >,
733
    #[doc = " function callback to match on an app-layer transaction"]
734
    pub AppLayerTxMatch: ::std::option::Option<
735
        unsafe extern "C" fn(
736
            arg1: *mut DetectEngineThreadCtx,
737
            arg2: *mut Flow,
738
            flags: u8,
739
            alstate: *mut ::std::os::raw::c_void,
740
            txv: *mut ::std::os::raw::c_void,
741
            arg3: *const Signature,
742
            arg4: *const SigMatchCtx,
743
        ) -> ::std::os::raw::c_int,
744
    >,
745
}
746
impl Default for SCSigTableAppLiteElmt {
747
0
    fn default() -> Self {
748
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
749
        unsafe {
750
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
751
0
            s.assume_init()
752
        }
753
0
    }
754
}
755
#[repr(C)]
756
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
757
pub struct SCTransformTableElmt {
758
    pub name: *const ::std::os::raw::c_char,
759
    pub desc: *const ::std::os::raw::c_char,
760
    pub url: *const ::std::os::raw::c_char,
761
    pub flags: u32,
762
    pub Setup: ::std::option::Option<
763
        unsafe extern "C" fn(
764
            arg1: *mut DetectEngineCtx,
765
            arg2: *mut Signature,
766
            arg3: *const ::std::os::raw::c_char,
767
        ) -> ::std::os::raw::c_int,
768
    >,
769
    pub Free: ::std::option::Option<
770
        unsafe extern "C" fn(arg1: *mut DetectEngineCtx, arg2: *mut ::std::os::raw::c_void),
771
    >,
772
    pub Transform: ::std::option::Option<
773
        unsafe extern "C" fn(
774
            arg1: *mut DetectEngineThreadCtx,
775
            arg2: *mut InspectionBuffer,
776
            context: *mut ::std::os::raw::c_void,
777
        ),
778
    >,
779
    pub TransformValidate: ::std::option::Option<
780
        unsafe extern "C" fn(
781
            content: *const u8,
782
            content_len: u16,
783
            context: *mut ::std::os::raw::c_void,
784
        ) -> bool,
785
    >,
786
    pub TransformId: ::std::option::Option<
787
        unsafe extern "C" fn(
788
            id_data: *mut *const u8,
789
            id_length: *mut u32,
790
            context: *mut ::std::os::raw::c_void,
791
        ),
792
    >,
793
}
794
impl Default for SCTransformTableElmt {
795
0
    fn default() -> Self {
796
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
797
        unsafe {
798
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
799
0
            s.assume_init()
800
        }
801
0
    }
802
}
803
extern "C" {
804
    pub fn SCDetectHelperNewKeywordId() -> ::std::os::raw::c_int;
805
}
806
extern "C" {
807
    pub fn SCDetectHelperKeywordRegister(kw: *const SCSigTableAppLiteElmt) -> u16;
808
}
809
extern "C" {
810
    pub fn SCDetectHelperKeywordAliasRegister(kwid: u16, alias: *const ::std::os::raw::c_char);
811
}
812
extern "C" {
813
    pub fn SCDetectHelperBufferRegister(
814
        name: *const ::std::os::raw::c_char, alproto: AppProto, direction: u8,
815
    ) -> ::std::os::raw::c_int;
816
}
817
extern "C" {
818
    pub fn SCDetectHelperBufferMpmRegister(
819
        name: *const ::std::os::raw::c_char, desc: *const ::std::os::raw::c_char,
820
        alproto: AppProto, direction: u8, GetData: InspectionSingleBufferGetDataPtr,
821
    ) -> ::std::os::raw::c_int;
822
}
823
extern "C" {
824
    pub fn SCDetectHelperBufferProgressMpmRegister(
825
        name: *const ::std::os::raw::c_char, desc: *const ::std::os::raw::c_char,
826
        alproto: AppProto, direction: u8, GetData: InspectionSingleBufferGetDataPtr,
827
        progress: ::std::os::raw::c_int,
828
    ) -> ::std::os::raw::c_int;
829
}
830
extern "C" {
831
    pub fn SCDetectHelperMultiBufferMpmRegister(
832
        name: *const ::std::os::raw::c_char, desc: *const ::std::os::raw::c_char,
833
        alproto: AppProto, direction: u8, GetData: InspectionMultiBufferGetDataPtr,
834
    ) -> ::std::os::raw::c_int;
835
}
836
extern "C" {
837
    pub fn SCDetectHelperMultiBufferProgressMpmRegister(
838
        name: *const ::std::os::raw::c_char, desc: *const ::std::os::raw::c_char,
839
        alproto: AppProto, direction: u8, GetData: InspectionMultiBufferGetDataPtr,
840
        progress: ::std::os::raw::c_int,
841
    ) -> ::std::os::raw::c_int;
842
}
843
extern "C" {
844
    pub fn SCDetectHelperTransformRegister(
845
        kw: *const SCTransformTableElmt,
846
    ) -> ::std::os::raw::c_int;
847
}
848
extern "C" {
849
    pub fn SCDetectRegisterBufferLowerMd5Callbacks(name: *const ::std::os::raw::c_char);
850
}
851
#[repr(C)]
852
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
853
pub struct DeStateStoreItem_ {
854
    pub flags: u32,
855
    pub sid: u32,
856
}
857
pub type DeStateStoreItem = DeStateStoreItem_;
858
#[repr(C)]
859
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
860
pub struct DeStateStore_ {
861
    pub store: [DeStateStoreItem; 15usize],
862
    pub next: *mut DeStateStore_,
863
}
864
impl Default for DeStateStore_ {
865
0
    fn default() -> Self {
866
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
867
        unsafe {
868
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
869
0
            s.assume_init()
870
        }
871
0
    }
872
}
873
pub type DeStateStore = DeStateStore_;
874
#[repr(C)]
875
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
876
pub struct DetectEngineStateDirection_ {
877
    #[doc = "< head of the list"]
878
    pub head: *mut DeStateStore,
879
    #[doc = "< current active store"]
880
    pub cur: *mut DeStateStore,
881
    #[doc = "< tail of the list"]
882
    pub tail: *mut DeStateStore,
883
    pub cnt: u32,
884
    pub filestore_cnt: u16,
885
    pub flags: u8,
886
}
887
impl Default for DetectEngineStateDirection_ {
888
0
    fn default() -> Self {
889
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
890
        unsafe {
891
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
892
0
            s.assume_init()
893
        }
894
0
    }
895
}
896
pub type DetectEngineStateDirection = DetectEngineStateDirection_;
897
#[repr(C)]
898
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
899
pub struct DetectEngineState_ {
900
    pub dir_state: [DetectEngineStateDirection; 2usize],
901
}
902
impl Default for DetectEngineState_ {
903
0
    fn default() -> Self {
904
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
905
        unsafe {
906
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
907
0
            s.assume_init()
908
        }
909
0
    }
910
}
911
pub type DetectEngineState = DetectEngineState_;
912
extern "C" {
913
    #[doc = " \\brief Frees a DetectEngineState object.\n\n \\param state DetectEngineState instance to free."]
914
    pub fn SCDetectEngineStateFree(state: *mut DetectEngineState);
915
}
916
extern "C" {
917
    pub fn SCSigMatchAppendSMToList(
918
        arg1: *mut DetectEngineCtx, arg2: *mut Signature, arg3: u16, arg4: *mut SigMatchCtx,
919
        arg5: ::std::os::raw::c_int,
920
    ) -> *mut SigMatch;
921
}
922
extern "C" {
923
    pub fn SCSigMatchSilentErrorEnabled(de_ctx: *const DetectEngineCtx, id: u16) -> bool;
924
}
925
extern "C" {
926
    pub fn SCDetectGetLastSMFromLists(s: *const Signature, ...) -> *mut SigMatch;
927
}
928
extern "C" {
929
    pub fn SCDetectSignatureSetAppProto(
930
        s: *mut Signature, alproto: AppProto,
931
    ) -> ::std::os::raw::c_int;
932
}
933
#[repr(u32)]
934
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
935
pub enum SCError {
936
    SC_OK = 0,
937
    SC_ENOMEM = 1,
938
    SC_EINVAL = 2,
939
    SC_ELIMIT = 3,
940
    SC_EEXIST = 4,
941
    SC_ENOENT = 5,
942
    SC_ERR_MAX = 6,
943
}
944
#[repr(C)]
945
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
946
pub struct SCEnumCharMap_ {
947
    pub enum_name: *const ::std::os::raw::c_char,
948
    pub enum_value: ::std::os::raw::c_int,
949
}
950
impl Default for SCEnumCharMap_ {
951
0
    fn default() -> Self {
952
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
953
        unsafe {
954
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
955
0
            s.assume_init()
956
        }
957
0
    }
958
}
959
pub type SCEnumCharMap = SCEnumCharMap_;
960
extern "C" {
961
    pub fn SCMapEnumNameToValue(
962
        arg1: *const ::std::os::raw::c_char, arg2: *mut SCEnumCharMap,
963
    ) -> ::std::os::raw::c_int;
964
}
965
extern "C" {
966
    pub fn SCMapEnumValueToName(
967
        arg1: ::std::os::raw::c_int, arg2: *mut SCEnumCharMap,
968
    ) -> *const ::std::os::raw::c_char;
969
}
970
#[repr(i32)]
971
#[doc = " \\brief The various log levels\n NOTE: when adding new level, don't forget to update SCLogMapLogLevelToSyslogLevel()\n      or it may result in logging to syslog with LOG_EMERG priority."]
972
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
973
pub enum SCLogLevel {
974
    SC_LOG_NOTSET = -1,
975
    SC_LOG_NONE = 0,
976
    SC_LOG_ERROR = 1,
977
    SC_LOG_WARNING = 2,
978
    SC_LOG_NOTICE = 3,
979
    SC_LOG_INFO = 4,
980
    SC_LOG_PERF = 5,
981
    SC_LOG_CONFIG = 6,
982
    SC_LOG_DEBUG = 7,
983
    SC_LOG_LEVEL_MAX = 8,
984
}
985
extern "C" {
986
    pub fn SCLogLevel2Name(lvl: SCLogLevel) -> *const ::std::os::raw::c_char;
987
}
988
extern "C" {
989
    pub fn SCLogMessage(
990
        arg1: SCLogLevel, arg2: *const ::std::os::raw::c_char, arg3: ::std::os::raw::c_uint,
991
        arg4: *const ::std::os::raw::c_char, arg5: *const ::std::os::raw::c_char,
992
        message: *const ::std::os::raw::c_char,
993
    ) -> SCError;
994
}
995
extern "C" {
996
    pub fn SCFatalErrorOnInitStatic(arg1: *const ::std::os::raw::c_char);
997
}
998
extern "C" {
999
    pub fn SCLogGetLogLevel() -> SCLogLevel;
1000
}
1001
pub type ProbingParserFPtr = ::std::option::Option<
1002
    unsafe extern "C" fn(
1003
        f: *const Flow,
1004
        flags: u8,
1005
        input: *const u8,
1006
        input_len: u32,
1007
        rdir: *mut u8,
1008
    ) -> AppProto,
1009
>;
1010
extern "C" {
1011
    #[doc = " PP registration"]
1012
    pub fn SCAppLayerProtoDetectPPRegister(
1013
        ipproto: u8, portstr: *const ::std::os::raw::c_char, alproto: AppProto, min_depth: u16,
1014
        max_depth: u16, direction: u8, ProbingParser1: ProbingParserFPtr,
1015
        ProbingParser2: ProbingParserFPtr,
1016
    );
1017
}
1018
extern "C" {
1019
    #[doc = "  \\retval bool 0 if no config was found, 1 if config was found"]
1020
    pub fn SCAppLayerProtoDetectPPParseConfPorts(
1021
        ipproto_name: *const ::std::os::raw::c_char, ipproto: u8,
1022
        alproto_name: *const ::std::os::raw::c_char, alproto: AppProto, min_depth: u16,
1023
        max_depth: u16, ProbingParserTs: ProbingParserFPtr, ProbingParserTc: ProbingParserFPtr,
1024
    ) -> ::std::os::raw::c_int;
1025
}
1026
extern "C" {
1027
    #[doc = " \\brief Registers a case-sensitive pattern for protocol detection."]
1028
    pub fn SCAppLayerProtoDetectPMRegisterPatternCS(
1029
        ipproto: u8, alproto: AppProto, pattern: *const ::std::os::raw::c_char, depth: u16,
1030
        offset: u16, direction: u8,
1031
    ) -> ::std::os::raw::c_int;
1032
}
1033
extern "C" {
1034
    pub fn SCAppLayerProtoDetectPMRegisterPatternCSwPP(
1035
        ipproto: u8, alproto: AppProto, pattern: *const ::std::os::raw::c_char, depth: u16,
1036
        offset: u16, direction: u8, PPFunc: ProbingParserFPtr, pp_min_depth: u16,
1037
        pp_max_depth: u16,
1038
    ) -> ::std::os::raw::c_int;
1039
}
1040
extern "C" {
1041
    #[doc = " \\brief Registers a case-insensitive pattern for protocol detection."]
1042
    pub fn SCAppLayerProtoDetectPMRegisterPatternCI(
1043
        ipproto: u8, alproto: AppProto, pattern: *const ::std::os::raw::c_char, depth: u16,
1044
        offset: u16, direction: u8,
1045
    ) -> ::std::os::raw::c_int;
1046
}
1047
extern "C" {
1048
    pub fn SCAppLayerProtoDetectPMRegisterPatternCIwPP(
1049
        ipproto: u8, alproto: AppProto, pattern: *const ::std::os::raw::c_char, depth: u16,
1050
        offset: u16, direction: u8, PPFunc: ProbingParserFPtr, pp_min_depth: u16,
1051
        pp_max_depth: u16,
1052
    ) -> ::std::os::raw::c_int;
1053
}
1054
extern "C" {
1055
    pub fn SCAppLayerRequestProtocolTLSUpgrade(f: *mut Flow) -> bool;
1056
}
1057
extern "C" {
1058
    pub fn SCAppLayerForceProtocolChange(f: *mut Flow, new_proto: AppProto);
1059
}
1060
extern "C" {
1061
    #[doc = " \\brief Given a protocol name, checks if proto detection is enabled in\n        the conf file.\n\n \\param alproto Name of the app layer protocol.\n\n \\retval 1 If enabled.\n \\retval 0 If disabled."]
1062
    pub fn SCAppLayerProtoDetectConfProtoDetectionEnabled(
1063
        ipproto: *const ::std::os::raw::c_char, alproto: *const ::std::os::raw::c_char,
1064
    ) -> ::std::os::raw::c_int;
1065
}
1066
extern "C" {
1067
    #[doc = " \\brief Given a protocol name, checks if proto detection is enabled in\n        the conf file.\n\n \\param alproto Name of the app layer protocol.\n \\param default_enabled enable by default if not in the configuration file\n\n \\retval 1 If enabled.\n \\retval 0 If disabled."]
1068
    pub fn SCAppLayerProtoDetectConfProtoDetectionEnabledDefault(
1069
        ipproto: *const ::std::os::raw::c_char, alproto: *const ::std::os::raw::c_char,
1070
        default_enabled: bool,
1071
    ) -> ::std::os::raw::c_int;
1072
}
1073
extern "C" {
1074
    pub fn AppProtoDetectListNames();
1075
}
1076
#[doc = " \\brief Data structure to store app layer decoder events."]
1077
#[repr(C)]
1078
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1079
pub struct AppLayerDecoderEvents_ {
1080
    pub events: *mut u8,
1081
    pub cnt: u8,
1082
    pub events_buffer_size: u8,
1083
    pub event_last_logged: u8,
1084
}
1085
impl Default for AppLayerDecoderEvents_ {
1086
0
    fn default() -> Self {
1087
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1088
        unsafe {
1089
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1090
0
            s.assume_init()
1091
        }
1092
0
    }
1093
}
1094
#[doc = " \\brief Data structure to store app layer decoder events."]
1095
pub type AppLayerDecoderEvents = AppLayerDecoderEvents_;
1096
#[repr(u32)]
1097
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1098
pub enum AppLayerEventType {
1099
    APP_LAYER_EVENT_TYPE_TRANSACTION = 1,
1100
    APP_LAYER_EVENT_TYPE_PACKET = 2,
1101
}
1102
extern "C" {
1103
    pub fn SCAppLayerDecoderEventsSetEventRaw(sevents: *mut *mut AppLayerDecoderEvents, event: u8);
1104
}
1105
extern "C" {
1106
    pub fn SCAppLayerDecoderEventsFreeEvents(events: *mut *mut AppLayerDecoderEvents);
1107
}
1108
extern "C" {
1109
    pub fn SCAppLayerGetEventIdByName(
1110
        event_name: *const ::std::os::raw::c_char, table: *mut SCEnumCharMap, event_id: *mut u8,
1111
    ) -> ::std::os::raw::c_int;
1112
}
1113
#[repr(C)]
1114
#[derive(Debug, Copy, Clone)]
1115
pub struct AppLayerParserState_ {
1116
    _unused: [u8; 0],
1117
}
1118
pub type AppLayerParserState = AppLayerParserState_;
1119
#[repr(C)]
1120
#[derive(Debug, Copy, Clone)]
1121
pub struct File_ {
1122
    _unused: [u8; 0],
1123
}
1124
pub type File = File_;
1125
extern "C" {
1126
    #[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."]
1127
    pub fn SCAppLayerParserConfParserEnabled(
1128
        ipproto: *const ::std::os::raw::c_char, alproto_name: *const ::std::os::raw::c_char,
1129
    ) -> ::std::os::raw::c_int;
1130
}
1131
#[repr(C)]
1132
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1133
pub struct AppLayerResult {
1134
    pub status: i32,
1135
    pub consumed: u32,
1136
    pub needed: u32,
1137
}
1138
#[repr(C)]
1139
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1140
pub struct StreamSlice {
1141
    pub input: *const u8,
1142
    pub input_len: u32,
1143
    #[doc = " STREAM_* flags"]
1144
    pub flags: u8,
1145
    pub offset: u64,
1146
}
1147
impl Default for StreamSlice {
1148
0
    fn default() -> Self {
1149
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1150
        unsafe {
1151
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1152
0
            s.assume_init()
1153
        }
1154
0
    }
1155
}
1156
#[doc = " \\brief Prototype for parsing functions"]
1157
pub type AppLayerParserFPtr = ::std::option::Option<
1158
    unsafe extern "C" fn(
1159
        f: *mut Flow,
1160
        protocol_state: *mut ::std::os::raw::c_void,
1161
        pstate: *mut AppLayerParserState,
1162
        stream_slice: StreamSlice,
1163
        local_storage: *mut ::std::os::raw::c_void,
1164
    ) -> AppLayerResult,
1165
>;
1166
#[repr(C)]
1167
#[derive(Copy, Clone)]
1168
pub struct AppLayerGetTxIterState {
1169
    pub un: AppLayerGetTxIterState__bindgen_ty_1,
1170
}
1171
#[repr(C)]
1172
#[derive(Copy, Clone)]
1173
pub union AppLayerGetTxIterState__bindgen_ty_1 {
1174
    pub ptr: *mut ::std::os::raw::c_void,
1175
    pub u64_: u64,
1176
}
1177
impl Default for AppLayerGetTxIterState__bindgen_ty_1 {
1178
0
    fn default() -> Self {
1179
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1180
        unsafe {
1181
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1182
0
            s.assume_init()
1183
        }
1184
0
    }
1185
}
1186
impl Default for AppLayerGetTxIterState {
1187
0
    fn default() -> Self {
1188
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1189
        unsafe {
1190
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1191
0
            s.assume_init()
1192
        }
1193
0
    }
1194
}
1195
#[repr(C)]
1196
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1197
pub struct AppLayerStateData {
1198
    pub file_flags: u16,
1199
}
1200
#[repr(C)]
1201
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1202
pub struct AppLayerGetTxIterTuple {
1203
    pub tx_ptr: *mut ::std::os::raw::c_void,
1204
    pub tx_id: u64,
1205
    pub has_next: bool,
1206
}
1207
impl Default for AppLayerGetTxIterTuple {
1208
0
    fn default() -> Self {
1209
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1210
        unsafe {
1211
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1212
0
            s.assume_init()
1213
        }
1214
0
    }
1215
}
1216
#[repr(C)]
1217
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1218
pub struct AppLayerTxConfig {
1219
    #[doc = " config: log flags"]
1220
    pub log_flags: u8,
1221
}
1222
pub type GenericVar = GenericVar_;
1223
#[repr(C)]
1224
#[derive(Debug, PartialEq, Eq)]
1225
pub struct AppLayerTxData {
1226
    #[doc = " config: log flags"]
1227
    pub config: AppLayerTxConfig,
1228
    #[doc = " The tx has been updated and needs to be processed : detection, logging, cleaning\n It can then be skipped until new data arrives.\n There is a boolean for both directions : to server and to client"]
1229
    pub updated_tc: bool,
1230
    pub updated_ts: bool,
1231
    pub flags: u8,
1232
    #[doc = " logger flags for tx logging api"]
1233
    pub logged: u32,
1234
    #[doc = " track file open/logs so we can know how long to keep the tx"]
1235
    pub files_opened: u32,
1236
    pub files_logged: u32,
1237
    pub files_stored: u32,
1238
    pub file_flags: u16,
1239
    #[doc = " Indicated if a file tracking tx, and if so in which direction:\n  0: not a file tx\n STREAM_TOSERVER: file tx, files only in toserver dir\n STREAM_TOCLIENT: file tx , files only in toclient dir\n STREAM_TOSERVER|STREAM_TOCLIENT: files possible in both dirs"]
1240
    pub file_tx: u8,
1241
    #[doc = " Number of times this tx data has already been logged for signatures\n not using application layer keywords"]
1242
    pub guessed_applayer_logged: u8,
1243
    #[doc = " detection engine progress tracking for use by detection engine\n Reflects the \"progress\" of prefilter engines into this TX, where\n the value is offset by 1. So if for progress state 0 the engines\n are done, the value here will be 1. So a value of 0 means, no\n progress tracked yet.\n"]
1244
    pub detect_progress_ts: u8,
1245
    pub detect_progress_tc: u8,
1246
    pub de_state: *mut DetectEngineState,
1247
    pub events: *mut AppLayerDecoderEvents,
1248
    pub txbits: *mut GenericVar,
1249
}
1250
impl Default for AppLayerTxData {
1251
74.2M
    fn default() -> Self {
1252
74.2M
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1253
        unsafe {
1254
74.2M
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1255
74.2M
            s.assume_init()
1256
        }
1257
74.2M
    }
1258
}
1259
extern "C" {
1260
    pub fn SCAppLayerTxDataCleanup(txd: *mut AppLayerTxData);
1261
}
1262
#[doc = "  \\param name progress name to get the id for\n  \\param direction STREAM_TOSERVER/STREAM_TOCLIENT"]
1263
pub type AppLayerParserGetStateIdByNameFn = ::std::option::Option<
1264
    unsafe extern "C" fn(
1265
        name: *const ::std::os::raw::c_char,
1266
        direction: u8,
1267
    ) -> ::std::os::raw::c_int,
1268
>;
1269
#[doc = "  \\param id progress value id to get the name for\n  \\param direction STREAM_TOSERVER/STREAM_TOCLIENT"]
1270
pub type AppLayerParserGetStateNameByIdFn = ::std::option::Option<
1271
    unsafe extern "C" fn(id: ::std::os::raw::c_int, direction: u8) -> *const ::std::os::raw::c_char,
1272
>;
1273
pub type AppLayerParserGetFrameIdByNameFn = ::std::option::Option<
1274
    unsafe extern "C" fn(frame_name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int,
1275
>;
1276
pub type AppLayerParserGetFrameNameByIdFn =
1277
    ::std::option::Option<unsafe extern "C" fn(id: u8) -> *const ::std::os::raw::c_char>;
1278
extern "C" {
1279
    pub fn SCAppLayerParserReallocCtx(alproto: AppProto) -> ::std::os::raw::c_int;
1280
}
1281
extern "C" {
1282
    pub fn SCAppLayerParserRegisterParserAcceptableDataDirection(
1283
        ipproto: u8, alproto: AppProto, direction: u8,
1284
    );
1285
}
1286
extern "C" {
1287
    pub fn SCAppLayerParserRegisterLogger(ipproto: u8, alproto: AppProto);
1288
}
1289
extern "C" {
1290
    pub fn SCAppLayerParserTriggerRawStreamInspection(
1291
        f: *mut Flow, direction: ::std::os::raw::c_int,
1292
    );
1293
}
1294
extern "C" {
1295
    pub fn SCAppLayerParserSetStreamDepth(ipproto: u8, alproto: AppProto, stream_depth: u32);
1296
}
1297
extern "C" {
1298
    pub fn SCAppLayerParserStateSetFlag(pstate: *mut AppLayerParserState, flag: u16);
1299
}
1300
extern "C" {
1301
    pub fn SCAppLayerParserStateIssetFlag(pstate: *mut AppLayerParserState, flag: u16) -> u16;
1302
}
1303
extern "C" {
1304
    pub fn FileApplyTxFlags(txd: *const AppLayerTxData, direction: u8, file: *mut File);
1305
}
1306
#[repr(C)]
1307
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1308
pub struct AppLayerParser {
1309
    pub name: *const ::std::os::raw::c_char,
1310
    pub default_port: *const ::std::os::raw::c_char,
1311
    pub ip_proto: u8,
1312
    pub ProbeTS: ProbingParserFPtr,
1313
    pub ProbeTC: ProbingParserFPtr,
1314
    pub min_depth: u16,
1315
    pub max_depth: u16,
1316
    pub StateAlloc: ::std::option::Option<
1317
        unsafe extern "C" fn(
1318
            arg1: *mut ::std::os::raw::c_void,
1319
            arg2: AppProto,
1320
        ) -> *mut ::std::os::raw::c_void,
1321
    >,
1322
    pub StateFree: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
1323
    pub ParseTS: AppLayerParserFPtr,
1324
    pub ParseTC: AppLayerParserFPtr,
1325
    pub StateGetTxCnt:
1326
        ::std::option::Option<unsafe extern "C" fn(alstate: *mut ::std::os::raw::c_void) -> u64>,
1327
    pub StateGetTx: ::std::option::Option<
1328
        unsafe extern "C" fn(
1329
            alstate: *mut ::std::os::raw::c_void,
1330
            tx_id: u64,
1331
        ) -> *mut ::std::os::raw::c_void,
1332
    >,
1333
    pub StateTransactionFree:
1334
        ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void, arg2: u64)>,
1335
    pub complete_ts: ::std::os::raw::c_int,
1336
    pub complete_tc: ::std::os::raw::c_int,
1337
    pub StateGetProgress: ::std::option::Option<
1338
        unsafe extern "C" fn(
1339
            alstate: *mut ::std::os::raw::c_void,
1340
            direction: u8,
1341
        ) -> ::std::os::raw::c_int,
1342
    >,
1343
    pub StateGetEventInfo: ::std::option::Option<
1344
        unsafe extern "C" fn(
1345
            event_name: *const ::std::os::raw::c_char,
1346
            event_id: *mut u8,
1347
            event_type: *mut AppLayerEventType,
1348
        ) -> ::std::os::raw::c_int,
1349
    >,
1350
    pub StateGetEventInfoById: ::std::option::Option<
1351
        unsafe extern "C" fn(
1352
            event_id: u8,
1353
            event_name: *mut *const ::std::os::raw::c_char,
1354
            event_type: *mut AppLayerEventType,
1355
        ) -> ::std::os::raw::c_int,
1356
    >,
1357
    pub LocalStorageAlloc:
1358
        ::std::option::Option<unsafe extern "C" fn() -> *mut ::std::os::raw::c_void>,
1359
    pub LocalStorageFree:
1360
        ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
1361
    pub GetTxFiles: ::std::option::Option<
1362
        unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void, arg2: u8) -> AppLayerGetFileState,
1363
    >,
1364
    pub GetTxIterator: ::std::option::Option<
1365
        unsafe extern "C" fn(
1366
            ipproto: u8,
1367
            alproto: AppProto,
1368
            alstate: *mut ::std::os::raw::c_void,
1369
            min_tx_id: u64,
1370
            max_tx_id: u64,
1371
            istate: *mut AppLayerGetTxIterState,
1372
        ) -> AppLayerGetTxIterTuple,
1373
    >,
1374
    pub GetStateData: ::std::option::Option<
1375
        unsafe extern "C" fn(state: *mut ::std::os::raw::c_void) -> *mut AppLayerStateData,
1376
    >,
1377
    pub GetTxData: ::std::option::Option<
1378
        unsafe extern "C" fn(tx: *mut ::std::os::raw::c_void) -> *mut AppLayerTxData,
1379
    >,
1380
    pub ApplyTxConfig: ::std::option::Option<
1381
        unsafe extern "C" fn(
1382
            state: *mut ::std::os::raw::c_void,
1383
            tx: *mut ::std::os::raw::c_void,
1384
            mode: ::std::os::raw::c_int,
1385
            arg1: AppLayerTxConfig,
1386
        ),
1387
    >,
1388
    pub flags: u32,
1389
    pub GetFrameIdByName: AppLayerParserGetFrameIdByNameFn,
1390
    pub GetFrameNameById: AppLayerParserGetFrameNameByIdFn,
1391
    pub GetStateIdByName: AppLayerParserGetStateIdByNameFn,
1392
    pub GetStateNameById: AppLayerParserGetStateNameByIdFn,
1393
}
1394
impl Default for AppLayerParser {
1395
0
    fn default() -> Self {
1396
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1397
        unsafe {
1398
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1399
0
            s.assume_init()
1400
        }
1401
0
    }
1402
}
1403
#[doc = " First part of AppLayerParser, needed only for protocol detection"]
1404
#[repr(C)]
1405
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1406
pub struct AppLayerProtocolDetect {
1407
    #[doc = " name of the app-layer"]
1408
    pub name: *const ::std::os::raw::c_char,
1409
    #[doc = " default port(s)"]
1410
    pub default_port: *const ::std::os::raw::c_char,
1411
    #[doc = " ip protocol : TCP or UDP"]
1412
    pub ip_proto: u8,
1413
    #[doc = " probing parser to server"]
1414
    pub ProbeTS: ProbingParserFPtr,
1415
    #[doc = " probing parser to client"]
1416
    pub ProbeTC: ProbingParserFPtr,
1417
    pub min_depth: u16,
1418
    pub max_depth: u16,
1419
}
1420
impl Default for AppLayerProtocolDetect {
1421
0
    fn default() -> Self {
1422
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1423
        unsafe {
1424
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1425
0
            s.assume_init()
1426
        }
1427
0
    }
1428
}
1429
extern "C" {
1430
    #[doc = " \\brief App layer protocol detection function.\n\n \\param parser The parser declaration structure.\n \\param enable_default A boolean to indicate if default port configuration should be used if none given\n\n \\retval The AppProto constant if successful. On error, this function never returns."]
1431
    pub fn SCAppLayerRegisterProtocolDetection(
1432
        parser: *const AppLayerProtocolDetect, enable_default: ::std::os::raw::c_int,
1433
    ) -> AppProto;
1434
}
1435
extern "C" {
1436
    #[doc = " \\brief App layer protocol registration function.\n\n \\param parser The parser declaration structure.\n \\param alproto The application layer protocol identifier.\n\n \\retval 0 if successful. On error, this function never returns."]
1437
    pub fn SCAppLayerRegisterParser(
1438
        p: *const AppLayerParser, alproto: AppProto,
1439
    ) -> ::std::os::raw::c_int;
1440
}
1441
extern "C" {
1442
    pub fn SCAppLayerRegisterParserAlias(
1443
        proto_name: *const ::std::os::raw::c_char, proto_alias: *const ::std::os::raw::c_char,
1444
    ) -> ::std::os::raw::c_int;
1445
}
1446
extern "C" {
1447
    pub fn SCHTTP2MimicHttp1Request(
1448
        arg1: *mut ::std::os::raw::c_void, arg2: *mut ::std::os::raw::c_void,
1449
    );
1450
}
1451
extern "C" {
1452
    pub fn SCFileFlowFlagsToFlags(flow_file_flags: u16, direction: u8) -> u16;
1453
}
1454
#[repr(C)]
1455
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1456
pub struct StreamingBufferConfig_ {
1457
    pub buf_size: u32,
1458
    #[doc = "< max concurrent memory regions. 0 means no limit."]
1459
    pub max_regions: u16,
1460
    #[doc = "< max gap size before a new region will be created."]
1461
    pub region_gap: u32,
1462
    pub Calloc: ::std::option::Option<
1463
        unsafe extern "C" fn(n: usize, size: usize) -> *mut ::std::os::raw::c_void,
1464
    >,
1465
    pub Realloc: ::std::option::Option<
1466
        unsafe extern "C" fn(
1467
            ptr: *mut ::std::os::raw::c_void,
1468
            orig_size: usize,
1469
            size: usize,
1470
        ) -> *mut ::std::os::raw::c_void,
1471
    >,
1472
    pub Free:
1473
        ::std::option::Option<unsafe extern "C" fn(ptr: *mut ::std::os::raw::c_void, size: usize)>,
1474
}
1475
pub type StreamingBufferConfig = StreamingBufferConfig_;
1476
#[repr(C)]
1477
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1478
pub struct FileContainer_ {
1479
    pub head: *mut File,
1480
    pub tail: *mut File,
1481
}
1482
impl Default for FileContainer_ {
1483
3.82M
    fn default() -> Self {
1484
3.82M
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1485
        unsafe {
1486
3.82M
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1487
3.82M
            s.assume_init()
1488
        }
1489
3.82M
    }
1490
}
1491
pub type FileContainer = FileContainer_;
1492
#[doc = " helper for the GetTxFilesFn. Not meant to be embedded as the config\n pointer is passed around in the API."]
1493
#[repr(C)]
1494
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1495
pub struct AppLayerGetFileState {
1496
    pub fc: *mut FileContainer,
1497
    pub cfg: *const StreamingBufferConfig,
1498
}
1499
impl Default for AppLayerGetFileState {
1500
0
    fn default() -> Self {
1501
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1502
        unsafe {
1503
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1504
0
            s.assume_init()
1505
        }
1506
0
    }
1507
}
1508
extern "C" {
1509
    #[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"]
1510
    pub fn FileAppendData(
1511
        arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, data: *const u8,
1512
        data_len: u32,
1513
    ) -> ::std::os::raw::c_int;
1514
}
1515
extern "C" {
1516
    #[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."]
1517
    pub fn FileOpenFileWithId(
1518
        arg1: *mut FileContainer, arg2: *const StreamingBufferConfig, track_id: u32,
1519
        name: *const u8, name_len: u16, data: *const u8, data_len: u32, flags: u16,
1520
    ) -> ::std::os::raw::c_int;
1521
}
1522
extern "C" {
1523
    pub fn FileAppendDataById(
1524
        arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1525
        data: *const u8, data_len: u32,
1526
    ) -> ::std::os::raw::c_int;
1527
}
1528
extern "C" {
1529
    pub fn FileAppendGAPById(
1530
        ffc: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1531
        data: *const u8, data_len: u32,
1532
    ) -> ::std::os::raw::c_int;
1533
}
1534
extern "C" {
1535
    pub fn FileCloseFileById(
1536
        arg1: *mut FileContainer, sbcfg: *const StreamingBufferConfig, track_id: u32,
1537
        data: *const u8, data_len: u32, flags: u16,
1538
    ) -> ::std::os::raw::c_int;
1539
}
1540
extern "C" {
1541
    pub fn FileContainerRecycle(arg1: *mut FileContainer, cfg: *const StreamingBufferConfig);
1542
}
1543
#[repr(C)]
1544
#[derive(Debug, Copy, Clone)]
1545
pub struct HttpRangeContainerBuffer {
1546
    _unused: [u8; 0],
1547
}
1548
#[repr(C)]
1549
#[derive(Debug, Copy, Clone)]
1550
pub struct HttpRangeContainerFile {
1551
    _unused: [u8; 0],
1552
}
1553
#[repr(C)]
1554
#[derive(Debug, Copy, Clone)]
1555
pub struct HTTPContentRange {
1556
    _unused: [u8; 0],
1557
}
1558
#[doc = " A structure representing a single range request :\n either skipping, buffering, or appending\n As this belongs to a flow, appending data to it is ensured to be thread-safe\n Only one block per file has the pointer to the container"]
1559
#[repr(C)]
1560
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1561
pub struct HttpRangeContainerBlock {
1562
    #[doc = " state where we skip content"]
1563
    pub toskip: u64,
1564
    #[doc = " current out of order range to write into"]
1565
    pub current: *mut HttpRangeContainerBuffer,
1566
    #[doc = " pointer to the main file container, where to directly append data"]
1567
    pub container: *mut HttpRangeContainerFile,
1568
    #[doc = " file container we are owning for now"]
1569
    pub files: *mut FileContainer,
1570
}
1571
impl Default for HttpRangeContainerBlock {
1572
0
    fn default() -> Self {
1573
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1574
        unsafe {
1575
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1576
0
            s.assume_init()
1577
        }
1578
0
    }
1579
}
1580
extern "C" {
1581
    pub fn SCHttpRangeFreeBlock(b: *mut HttpRangeContainerBlock);
1582
}
1583
extern "C" {
1584
    pub fn SCHttpRangeContainerOpenFile(
1585
        key: *const ::std::os::raw::c_uchar, keylen: u32, f: *const Flow,
1586
        cr: *const HTTPContentRange, sbcfg: *const StreamingBufferConfig,
1587
        name: *const ::std::os::raw::c_uchar, name_len: u16, flags: u16,
1588
        data: *const ::std::os::raw::c_uchar, data_len: u32,
1589
    ) -> *mut HttpRangeContainerBlock;
1590
}
1591
extern "C" {
1592
    pub fn SCHttpRangeAppendData(
1593
        sbcfg: *const StreamingBufferConfig, c: *mut HttpRangeContainerBlock, data: *const u8,
1594
        len: u32,
1595
    ) -> ::std::os::raw::c_int;
1596
}
1597
extern "C" {
1598
    pub fn SCHTPFileCloseHandleRange(
1599
        sbcfg: *const StreamingBufferConfig, arg1: *mut FileContainer, arg2: u16,
1600
        arg3: *mut HttpRangeContainerBlock, arg4: *const u8, arg5: u32,
1601
    ) -> bool;
1602
}
1603
pub type FrameId = i64;
1604
#[repr(C)]
1605
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1606
pub struct Frame {
1607
    #[doc = "< protocol specific field type. E.g. NBSS.HDR or SMB.DATA"]
1608
    pub type_: u8,
1609
    #[doc = "< frame flags: FRAME_FLAG_*"]
1610
    pub flags: u8,
1611
    pub event_cnt: u8,
1612
    #[doc = "< per frame store for events"]
1613
    pub events: [u8; 4usize],
1614
    #[doc = "< offset from the start of the stream"]
1615
    pub offset: u64,
1616
    pub len: i64,
1617
    pub id: i64,
1618
    #[doc = "< tx_id to match this frame. UINT64T_MAX if not used."]
1619
    pub tx_id: u64,
1620
    #[doc = "< inspection tracker relative to the start of the frame"]
1621
    pub inspect_progress: u64,
1622
}
1623
extern "C" {
1624
    pub fn SCAppLayerFrameNewByRelativeOffset(
1625
        f: *mut Flow, stream_slice: *const ::std::os::raw::c_void, frame_start_rel: u32, len: i64,
1626
        dir: ::std::os::raw::c_int, frame_type: u8,
1627
    ) -> *mut Frame;
1628
}
1629
extern "C" {
1630
    pub fn SCAppLayerFrameAddEventById(
1631
        f: *const Flow, dir: ::std::os::raw::c_int, id: FrameId, e: u8,
1632
    );
1633
}
1634
extern "C" {
1635
    pub fn SCAppLayerFrameSetLengthById(
1636
        f: *const Flow, dir: ::std::os::raw::c_int, id: FrameId, len: i64,
1637
    );
1638
}
1639
extern "C" {
1640
    pub fn SCAppLayerFrameSetTxIdById(
1641
        f: *const Flow, dir: ::std::os::raw::c_int, id: FrameId, tx_id: u64,
1642
    );
1643
}
1644
#[repr(C)]
1645
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1646
pub struct MpmPattern_ {
1647
    pub len: u16,
1648
    pub flags: u8,
1649
    pub offset: u16,
1650
    pub depth: u16,
1651
    pub original_pat: *mut u8,
1652
    pub cs: *mut u8,
1653
    pub ci: *mut u8,
1654
    pub id: u32,
1655
    pub sids_size: u32,
1656
    pub sids: *mut u32,
1657
    pub next: *mut MpmPattern_,
1658
}
1659
impl Default for MpmPattern_ {
1660
0
    fn default() -> Self {
1661
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1662
        unsafe {
1663
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1664
0
            s.assume_init()
1665
        }
1666
0
    }
1667
}
1668
pub type MpmPattern = MpmPattern_;
1669
#[repr(C)]
1670
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1671
pub struct MpmCtx_ {
1672
    pub ctx: *mut ::std::os::raw::c_void,
1673
    pub mpm_type: u8,
1674
    pub flags: u8,
1675
    pub maxdepth: u16,
1676
    pub pattern_cnt: u32,
1677
    pub minlen: u16,
1678
    pub maxlen: u16,
1679
    pub memory_cnt: u32,
1680
    pub memory_size: u32,
1681
    pub max_pat_id: u32,
1682
    pub init_hash: *mut *mut MpmPattern,
1683
}
1684
impl Default for MpmCtx_ {
1685
0
    fn default() -> Self {
1686
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1687
        unsafe {
1688
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1689
0
            s.assume_init()
1690
        }
1691
0
    }
1692
}
1693
pub type MpmCtx = MpmCtx_;
1694
extern "C" {
1695
    pub fn SCMpmAddPatternCI(
1696
        mpm_ctx: *mut MpmCtx, pat: *const u8, patlen: u16, offset: u16, depth: u16, pid: u32,
1697
        sid: u32, flags: u8,
1698
    ) -> ::std::os::raw::c_int;
1699
}
1700
#[repr(C)]
1701
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1702
pub struct GenericVar_ {
1703
    #[doc = "< variable type, uses detection sm_type"]
1704
    pub type_: u16,
1705
    pub pad: [u8; 2usize],
1706
    pub idx: u32,
1707
    pub next: *mut GenericVar_,
1708
}
1709
impl Default for GenericVar_ {
1710
0
    fn default() -> Self {
1711
0
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
1712
        unsafe {
1713
0
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
1714
0
            s.assume_init()
1715
        }
1716
0
    }
1717
}
1718
extern "C" {
1719
    pub fn SCGenericVarFree(arg1: *mut GenericVar);
1720
}
1721
extern "C" {
1722
    pub fn SCBasicSearchNocaseIndex(arg1: *const u8, arg2: u32, arg3: *const u8, arg4: u16) -> u32;
1723
}
1724
extern "C" {
1725
    pub fn SCFlowGetLastTimeAsParts(flow: *const Flow, secs: *mut u64, usecs: *mut u64);
1726
}
1727
extern "C" {
1728
    pub fn SCFlowGetFlags(flow: *const Flow) -> u64;
1729
}
1730
extern "C" {
1731
    pub fn SCFlowGetSourcePort(flow: *const Flow) -> u16;
1732
}
1733
extern "C" {
1734
    pub fn SCFlowGetDestinationPort(flow: *const Flow) -> u16;
1735
}
1736
extern "C" {
1737
    pub fn SCSRepCatGetByShortname(shortname: *const ::std::os::raw::c_char) -> u8;
1738
}
1739
extern "C" {
1740
    pub fn SCRequiresFeature(arg1: *const ::std::os::raw::c_char) -> bool;
1741
}
1742
pub type DataRepType = u16;
1743
#[repr(C)]
1744
#[derive(Debug, Copy, Clone)]
1745
pub struct Dataset {
1746
    _unused: [u8; 0],
1747
}
1748
extern "C" {
1749
    pub fn SCDatasetAdd(set: *mut Dataset, data: *const u8, data_len: u32)
1750
        -> ::std::os::raw::c_int;
1751
}
1752
extern "C" {
1753
    pub fn SCDatasetAddwRep(
1754
        set: *mut Dataset, data: *const u8, data_len: u32, rep: *const DataRepType,
1755
    ) -> ::std::os::raw::c_int;
1756
}
1757
#[doc = " A \"mark\" or saved state for a JsonBuilder object.\n\n The name is full, and the types are u64 as this object is used\n directly in C as well."]
1758
#[repr(C)]
1759
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
1760
pub struct SCJsonBuilderMark {
1761
    pub position: u64,
1762
    pub state_index: u64,
1763
    pub state: u64,
1764
}
1765
extern "C" {
1766
    pub fn SCJbNewObject() -> *mut SCJsonBuilder;
1767
}
1768
extern "C" {
1769
    pub fn SCJbNewArray() -> *mut SCJsonBuilder;
1770
}
1771
extern "C" {
1772
    pub fn SCJbClone(js: *mut SCJsonBuilder) -> *mut SCJsonBuilder;
1773
}
1774
extern "C" {
1775
    pub fn SCJbFree(js: *mut SCJsonBuilder);
1776
}
1777
extern "C" {
1778
    pub fn SCJbCapacity(jb: *mut SCJsonBuilder) -> usize;
1779
}
1780
extern "C" {
1781
    pub fn SCJbReset(jb: *mut SCJsonBuilder);
1782
}
1783
extern "C" {
1784
    pub fn SCJbOpenObject(js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char) -> bool;
1785
}
1786
extern "C" {
1787
    pub fn SCJbStartObject(js: *mut SCJsonBuilder) -> bool;
1788
}
1789
extern "C" {
1790
    pub fn SCJbOpenArray(js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char) -> bool;
1791
}
1792
extern "C" {
1793
    pub fn SCJbSetString(
1794
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char,
1795
        val: *const ::std::os::raw::c_char,
1796
    ) -> bool;
1797
}
1798
extern "C" {
1799
    pub fn SCJbSetStringFromBytes(
1800
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, bytes: *const u8, len: u32,
1801
    ) -> bool;
1802
}
1803
extern "C" {
1804
    pub fn SCJbSetPrintAsciiString(
1805
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, bytes: *const u8, len: u32,
1806
    ) -> bool;
1807
}
1808
extern "C" {
1809
    pub fn SCJbSetBase64(
1810
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, bytes: *const u8, len: u32,
1811
    ) -> bool;
1812
}
1813
extern "C" {
1814
    pub fn SCJbSetHex(
1815
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, bytes: *const u8, len: u32,
1816
    ) -> bool;
1817
}
1818
extern "C" {
1819
    pub fn SCJbSetFormatted(
1820
        js: *mut SCJsonBuilder, formatted: *const ::std::os::raw::c_char,
1821
    ) -> bool;
1822
}
1823
extern "C" {
1824
    pub fn SCJbAppendObject(jb: *mut SCJsonBuilder, obj: *const SCJsonBuilder) -> bool;
1825
}
1826
extern "C" {
1827
    pub fn SCJbSetObject(
1828
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, val: *mut SCJsonBuilder,
1829
    ) -> bool;
1830
}
1831
extern "C" {
1832
    pub fn SCJbAppendString(js: *mut SCJsonBuilder, val: *const ::std::os::raw::c_char) -> bool;
1833
}
1834
extern "C" {
1835
    pub fn SCJbAppendStringFromBytes(js: *mut SCJsonBuilder, bytes: *const u8, len: u32) -> bool;
1836
}
1837
extern "C" {
1838
    pub fn SCJbAppendBase64(js: *mut SCJsonBuilder, bytes: *const u8, len: u32) -> bool;
1839
}
1840
extern "C" {
1841
    pub fn SCJbAppendUint(js: *mut SCJsonBuilder, val: u64) -> bool;
1842
}
1843
extern "C" {
1844
    pub fn SCJbAppendFloat(js: *mut SCJsonBuilder, val: f64) -> bool;
1845
}
1846
extern "C" {
1847
    pub fn SCJbSetUint(
1848
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, val: u64,
1849
    ) -> bool;
1850
}
1851
extern "C" {
1852
    pub fn SCJbSetInt(js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, val: i64)
1853
        -> bool;
1854
}
1855
extern "C" {
1856
    pub fn SCJbSetFloat(
1857
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, val: f64,
1858
    ) -> bool;
1859
}
1860
extern "C" {
1861
    pub fn SCJbSetBool(
1862
        js: *mut SCJsonBuilder, key: *const ::std::os::raw::c_char, val: bool,
1863
    ) -> bool;
1864
}
1865
extern "C" {
1866
    pub fn SCJbClose(js: *mut SCJsonBuilder) -> bool;
1867
}
1868
extern "C" {
1869
    pub fn SCJbLen(js: *const SCJsonBuilder) -> usize;
1870
}
1871
extern "C" {
1872
    pub fn SCJbPtr(js: *mut SCJsonBuilder) -> *const u8;
1873
}
1874
extern "C" {
1875
    pub fn SCJbGetMark(js: *mut SCJsonBuilder, mark: *mut SCJsonBuilderMark);
1876
}
1877
extern "C" {
1878
    pub fn SCJbRestoreMark(js: *mut SCJsonBuilder, mark: *mut SCJsonBuilderMark) -> bool;
1879
}