Kea  2.1.2-git
The Hooks API for the Control Agent

Introduction

The Kea Control Agent features "Hooks" API that allows the user-written code to be integrated with the Control Agent and handle some of the control commands. The hooks library can be either used to provide support for the new commands (not supported natively by the Control Agent) or "override" implementation of the existing handlers. The hooks library signals to the Control Agent that it has processed the given command by setting "next step status" value to SKIP.

The hooks library can also be used to perform some additional tasks related to reception of the control command instead of handling it, e.g. logging or notifying some external service about reception of the command.

Hooks in the Control Agent

auth

  • Arguments:
  • Description: this callout is executed when Control Agent receives a control command over the RESTful interface (HTTP). The "request" argument is a pointer to the request, in fact a PostHttpRequestJsonPtr. The "response" argument is the response in case of errors. The purpose of this callout is to implement authentication and authorization. It is called after basic HTTP authentication. The next step status is ignored: if the response is set the processing will stop and the response is returned. In particular the command is not forwarded.

response

  • Arguments:
  • Description: this callout is executed when Control Agent executed a control command over the RESTful interface (HTTP). The "request" argument is a pointer to the request. It is used as a reference and for callout contexts. The "response" argument is the response which will be sent back to the requesting client. It is called after command processing. The next step status is ignored: the response possibly modified will be sent back.