rust/core: add file tx API call

pull/2747/head
Victor Julien 8 years ago
parent 9a1fa5f1f4
commit 71ddc43d49

@ -87,6 +87,9 @@ pub type SCFilePrune = extern "C" fn (
pub type SCFileContainerRecycle = extern "C" fn (
file_container: &FileContainer);
pub type SCFileSetTx = extern "C" fn (
file: &FileContainer,
tx_id: u64);
// A Suricata context that is passed in from C. This is alternative to
// using functions from Suricata directly, so they can be wrapped so
@ -108,6 +111,7 @@ pub struct SuricataContext {
pub FileAppendData: SCFileAppendDataById,
pub FileContainerRecycle: SCFileContainerRecycle,
pub FilePrune: SCFilePrune,
pub FileSetTx: SCFileSetTx,
}
#[allow(non_snake_case)]

@ -35,6 +35,7 @@ typedef struct SuricataContext_ {
const uint8_t *data, uint32_t data_len);
void (*FileContainerRecycle)(FileContainer *ffc);
void (*FilePrune)(FileContainer *ffc);
void (*FileSetTx)(FileContainer *, uint64_t);
} SuricataContext;

@ -2792,6 +2792,7 @@ int main(int argc, char **argv)
context.FileAppendDataById = FileAppendDataById;
context.FileContainerRecycle = FileContainerRecycle;
context.FilePrune = FilePrune;
context.FileSetTx = FileContainerSetTx;
rs_init(&context);
#endif

@ -517,6 +517,13 @@ int FileSetTx(File *ff, uint64_t txid)
SCReturnInt(0);
}
void FileContainerSetTx(FileContainer *ffc, uint64_t tx_id)
{
if (ffc && ffc->tail) {
(void)FileSetTx(ffc->tail, tx_id);
}
}
/**
* \brief check if we have stored enough
*

@ -172,6 +172,7 @@ int FileStore(File *);
* \param txid the tx id
*/
int FileSetTx(File *, uint64_t txid);
void FileContainerSetTx(FileContainer *ffc, uint64_t tx_id);
/**
* \brief disable file storage for a flow

Loading…
Cancel
Save