Skip to content
Tom Barbette edited this page Oct 3, 2018 · 2 revisions

DriverManager Element Documentation

NAME

DriverManager — Click element; a Script that manages driver stop events

SYNOPSIS

DriverManager(INSTRUCTIONS...)

Ports: any number of inputs, any number of outputs

DESCRIPTION

DriverManager is simply a Script element whose default TYPE is "DRIVER".

Click driver stop events suggest that the driver should stop processing. Any element can register a driver stop event; for instance, trace processing elements can stop the driver when they finish a trace file. You generally request this functionality by supplying a 'STOP true' keyword argument.

Driver stop events normally stop the driver: the user-level driver calls exit(0), or the kernel driver kills the relevant kernel threads. The DriverManager element changes this behavior. When a driver stop event occurs, the router steps through the DriverManager's script by calling its step handler. The driver exits only when the script ends or a stop instruction is executed.

For example, the following DriverManager element ensures that an element, k, has time to clean itself up before the driver is stopped. It waits for the first driver stop event, then calls k's cleanup handler, waits for a tenth of a second, and stops the driver.

  DriverManager(pause, write k.cleanup, wait 0.1s, stop);

Use this idiom when one of your elements must emit a last packet or two before the router configuration is destroyed.

SEE ALSO

Script

Generated by click-elem2man from ../elements/standard/drivermanager.hh:7 on 2018/10/03.

Clone this wiki locally