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<()> { ... }
}
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.

Implementors§