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 ActionResult
s 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§
- Authentication
Control - Authenticator (protocol, credentials, etc.) and message buffer used for client authentication.
- Authentication
Event - An authentication event that occurs as part of a
TxArgs
. - Authentication
Tap - 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§
- Action
Result - The result of an action event handler.