Callbacks¶
Callbacks methods are optional methods that can be implemented within a scan. These methods are then called by the scan framework at certain points within the life cycle of a scan which allows you to execute code at predefined stages of the scan.
User Callbacks¶
User callbacks can be implemented in any scan that you write. The most commonly used callbacks are
prepare_scan()
,
initialize_devices()
,
set_scan_point()
,
and cleanup()
. These callbacks should allow you to accomplish what
what is needed the majority of the time. Additional callbacks are available for more advanced usage. Below is
a list of all available callbacks listed in order of execution.
- Notes:
Names below wrapped in [] are in fact iterface methods, and not strictly callbacks. They are included here to show the complete order of execution of both interface methods and callback methods. See Methods Available to a Scan for additional information on interface methods.
Callbacks indicated as “Runs On: portable” run on the core device unless
run_on_core
is set toFalse
, or_run_scan_host
is called manually.
In order of execution, all callbacks available to a scan are:
Callback
|
Has Default
Behavior?
|
Runs On
|
Scan Stage
|
Runs When
Scan is Resumed?
|
---|---|---|---|---|
yes |
host |
__init__ |
no |
|
yes |
host |
__init__ |
no |
|
sometimes |
host |
initialization |
no |
|
yes |
host |
initialization |
no |
|
yes |
host |
initialization |
yes |
|
no |
host |
initialization |
yes |
|
no |
host |
initialization |
yes |
|
no |
host |
initialization |
yes |
|
no |
core device |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
no |
|
yes |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
yes |
host |
scan loop |
yes |
|
no |
host (via RPC) |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
yes |
host (via RPC) |
scan loop |
yes |
|
no |
portable |
scan loop |
yes |
|
no |
core device |
scan loop |
yes |
|
no |
core device |
scan loop |
yes |
|
no |
host |
analysis |
yes |
|
yes |
host |
analysis |
yes |
|
no |
host |
analysis |
yes |
|
no |
host |
analysis |
yes |
|
no |
host |
analysis |
yes |
|
yes |
host |
analysis |
yes |
|
no |
host |
analysis |
yes |
Extension Callbacks¶
Extension callbacks are implemented by scan extension class of the scan framework and should not be implmented in user scan classes.
Callback
|
Has Default
Behavior?
|
Runs On
|
Scan Stage
|
Runs When
Scan is Resumed?
|
---|---|---|---|---|
_add_processors |
no |
host |
initialization |
no |
_scan_arguments |
no |
host |
initialization |
no |
_map_arguments |
no |
host |
initialization |
no |
no |
portable |
scan loop |
yes |
|
_after_scan_point |
no |
portable |
scan loop |
yes |
_analyze_data |
no |
portable |
scan loop |
yes |