diff --git a/scripts/policy/frameworks/management/request.zeek b/scripts/policy/frameworks/management/request.zeek index 676c65f6bd..f7a798ace6 100644 --- a/scripts/policy/frameworks/management/request.zeek +++ b/scripts/policy/frameworks/management/request.zeek @@ -32,6 +32,14 @@ export { finished: bool &default=F; }; + # To allow a callback to refer to Requests, the Request type must + # exist. So redef to add it: + redef record Request += { + ## A callback to invoke when this request is finished via + ## :zeek:see:`Management::Request::finish`. + finish: function(req: Management::Request::Request) &optional; + }; + ## The timeout interval for request state. Such state (see the ## :zeek:see:`Management::Request` module) ties together request and ## response event pairs. A timeout causes cleanup of request state if @@ -131,6 +139,9 @@ function finish(reqid: string): bool local req = g_requests[reqid]; delete g_requests[reqid]; + if ( req?$finish ) + req$finish(req); + req$finished = T; return T;