Module action

Source
Expand description

Configurable and common handlers that act on PHYs in response to events.

This module provides recipes for event handlers in hardware simulator tests. Handlers are constructed using functions and always emit ActionResults as output. These recipes can be composed to form complex event handlers using terse and declarative syntax.

§Examples

Actions are exposed as functions that construct event handlers. The following example demonstrates constructing a client event handler that scans and transmits packets to an AP.

let advertisements = [ProbeResponse { /* ... */ }];
let mut handler = branch::or((
    event::on_scan(action::send_advertisements_and_scan_completion(&client, advertisements)),
    event::on_transmit(action::send_packet(&ap, rx_info_with_default_ap())),
));

A more complex action handles client association with an authentication tap for controlling the authentication process. The following example constructs such a handler.

let beacons = [Beacon { /* ... */ }];
let control = AuthenticationControl {
    updates: UpdateSink::new(),
    authenticator: /* ... */,
};
let tap = AuthenticationTap {
    control: &mut control,
    // This event handler reacts to `AuthenticationEvent`s and is passed the
    // `AuthenticationControl` as state.
    handler: action::authenticate_with_control_state(),
};
let mut handler = branch::or((
    event::on_scan(action::send_advertisements_and_scan_completion(&client, beacons)),
    event::on_transmit(action::connect_with_authentication_tap(
        &client, &ssid, &bssid, &channel, &protection, tap,
    )),
));

Structs§

AuthenticationControl
Authenticator (protocol, credentials, etc.) and message buffer used for client authentication.
AuthenticationEvent
An authentication event that occurs as part of a TxArgs.
AuthenticationTap
Authentication state and handler used to tap into the client authentication process in an event handler.

Functions§

authenticate_with_control_state
connect_with_authentication_tap
connect_with_open_authentication
send_advertisements
send_advertisements_and_scan_completion
send_association_response
send_open_authentication
send_packet
send_probe_response
send_scan_completion

Type Aliases§

ActionResult
The result of an action event handler.