Trait UserFilter

Source
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§

Source

const METHODS: u8 = 255u8

Sets methods available for this filter. By default ALL

Source

const CONTINUE_IF_ERROR: bool = true

Continue execution if a filter callback returns an error.

Required Methods§

Source

fn new(lua: &Lua, args: Table<'_>) -> Result<Self>

Creates a new instance of filter.

Provided Methods§

Source

fn start_analyze( &mut self, lua: &Lua, txn: Txn<'_>, chn: Channel<'_>, ) -> Result<FilterResult>

Called when the analysis starts on the channel chn.

Source

fn end_analyze( &mut self, lua: &Lua, txn: Txn<'_>, chn: Channel<'_>, ) -> Result<FilterResult>

Called when the analysis ends on the channel chn.

Source

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.

Source

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.

Source

fn http_end( &mut self, lua: &Lua, txn: Txn<'_>, msg: HttpMessage<'_>, ) -> Result<FilterResult>

Called after the HTTP payload analysis on the HTTP message msg.

Source

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.

Source

fn unregister_data_filter( lua: &Lua, txn: Txn<'_>, chn: Channel<'_>, ) -> Result<()>

Disable the data filtering on the channel chn for the current filter. It may be called at any time from any callback functions.

Source

fn wake_time(lua: &Lua, milliseconds: u64) -> Result<()>

Set the pause timeout to the specified time, defined in milliseconds.

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.

Implementors§