pub trait UserFilter: Sized {
const METHODS: u8 = 255u8;
const CONTINUE_IF_ERROR: bool = true;
// Required method
fn new(lua: &Lua, args: Table<'_>) -> Result<Self>;
// Provided methods
fn start_analyze(
&mut self,
lua: &Lua,
txn: Txn<'_>,
chn: Channel<'_>,
) -> Result<FilterResult> { ... }
fn end_analyze(
&mut self,
lua: &Lua,
txn: Txn<'_>,
chn: Channel<'_>,
) -> Result<FilterResult> { ... }
fn http_headers(
&mut self,
lua: &Lua,
txn: Txn<'_>,
msg: HttpMessage<'_>,
) -> Result<FilterResult> { ... }
fn http_payload(
&mut self,
lua: &Lua,
txn: Txn<'_>,
msg: HttpMessage<'_>,
) -> Result<Option<usize>> { ... }
fn http_end(
&mut self,
lua: &Lua,
txn: Txn<'_>,
msg: HttpMessage<'_>,
) -> Result<FilterResult> { ... }
fn register_data_filter(
lua: &Lua,
txn: Txn<'_>,
chn: Channel<'_>,
) -> Result<()> { ... }
fn unregister_data_filter(
lua: &Lua,
txn: Txn<'_>,
chn: Channel<'_>,
) -> Result<()> { ... }
fn wake_time(lua: &Lua, milliseconds: u64) -> Result<()> { ... }
}
Expand description
A trait that defines all required callback functions to implement filters.
Provided Associated Constants§
Sourceconst CONTINUE_IF_ERROR: bool = true
const CONTINUE_IF_ERROR: bool = true
Continue execution if a filter callback returns an error.
Required Methods§
Provided Methods§
Sourcefn start_analyze(
&mut self,
lua: &Lua,
txn: Txn<'_>,
chn: Channel<'_>,
) -> Result<FilterResult>
fn start_analyze( &mut self, lua: &Lua, txn: Txn<'_>, chn: Channel<'_>, ) -> Result<FilterResult>
Called when the analysis starts on the channel chn
.
Sourcefn end_analyze(
&mut self,
lua: &Lua,
txn: Txn<'_>,
chn: Channel<'_>,
) -> Result<FilterResult>
fn end_analyze( &mut self, lua: &Lua, txn: Txn<'_>, chn: Channel<'_>, ) -> Result<FilterResult>
Called when the analysis ends on the channel chn
.
Sourcefn http_headers(
&mut self,
lua: &Lua,
txn: Txn<'_>,
msg: HttpMessage<'_>,
) -> Result<FilterResult>
fn http_headers( &mut self, lua: &Lua, txn: Txn<'_>, msg: HttpMessage<'_>, ) -> Result<FilterResult>
Called just before the HTTP payload analysis and after any processing on the HTTP message msg
.
Sourcefn http_payload(
&mut self,
lua: &Lua,
txn: Txn<'_>,
msg: HttpMessage<'_>,
) -> Result<Option<usize>>
fn http_payload( &mut self, lua: &Lua, txn: Txn<'_>, msg: HttpMessage<'_>, ) -> Result<Option<usize>>
Called during the HTTP payload analysis on the HTTP message msg
.
Sourcefn http_end(
&mut self,
lua: &Lua,
txn: Txn<'_>,
msg: HttpMessage<'_>,
) -> Result<FilterResult>
fn http_end( &mut self, lua: &Lua, txn: Txn<'_>, msg: HttpMessage<'_>, ) -> Result<FilterResult>
Called after the HTTP payload analysis on the HTTP message msg
.
Sourcefn register_data_filter(lua: &Lua, txn: Txn<'_>, chn: Channel<'_>) -> Result<()>
fn register_data_filter(lua: &Lua, txn: Txn<'_>, chn: Channel<'_>) -> Result<()>
Enable the data filtering on the channel chn
for the current filter.
It may be called at any time from any callback functions proceeding the data analysis.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.