Kea: isc::class_cmds::ClassCmds Class Reference

| Kea 3.0.3-git

isc::class_cmds::ClassCmds Class Reference

Implements the logic for processing commands pertaining to client classes manipulation. More...

`#include <class_cmds.h>`

## Public Member Functions
| ClassCmds ()
| Constructor.
void | addClass (hooks::CalloutHandle &callout_handle)
| Returns a response to a 'class-add' command.
void | delClass (hooks::CalloutHandle &callout_handle)
| Processes and returns a response to 'class-del' command.
void | getClass (hooks::CalloutHandle &callout_handle) const
| Returns a response to a 'class-get' command.
void | getClassList (hooks::CalloutHandle &callout_handle) const
| Returns a response to a 'class-list' command.
void | updateClass (hooks::CalloutHandle &callout_handle)
| Returns a response to a 'class-update' command.

## Detailed Description

Implements the logic for processing commands pertaining to client classes manipulation.

This class is used by the callouts implementing command handlers for client classes manipulations.

Commands which add and update client classes enclose the classes in a JSON list, even though we currently allow only one class to be added or updated per command. In the future we may allow more classes to be added or updated with a single command, but this will require implementation of some sort of transaction mechanism, so as an error in processing one of the classes would cause the rollback of other changes. Allowing partial update could cause inconsistency in the server configuration.

Meanwhile, we allow only one class to be added or updated but the command structure is already prepared for possible future extension.

Definition at line 60 of file class_cmds.h.

## Constructor & Destructor Documentation

## ◆ ClassCmds()

isc::class_cmds::ClassCmds::ClassCmds | ( |  | ) |

Constructor.

It creates an instance of the `ClassCmdsImpl`.

Definition at line 496 of file class_cmds.cc.

## Member Function Documentation

## ◆ addClass()

void isc::class_cmds::ClassCmds::addClass | ( | hooks::CalloutHandle & | callout_handle | ) |

Returns a response to a 'class-add' command.

This function processes 'class-add' command by adding it to the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "class-add",
"arguments": {
"client-classes": [
{
"name": "my-class",
...
}
]
}
}

Before adding the class to the current configuration this method will check for duplicated class, i.e. having the same name, and expressions referring to unspecified (i.e. not builtin nor configured) classes.

The successful response has the following structure:

{
"result": 0,
"text": "Class 'my-class' added."
}

Parameters

  callout_handle | Reference to the callout handle holding command to be processed and where result should be stored.

Definition at line 513 of file class_cmds.cc.

## ◆ delClass()

void isc::class_cmds::ClassCmds::delClass | ( | hooks::CalloutHandle & | callout_handle | ) |

Processes and returns a response to 'class-del' command.

This function processes the 'class-del' command by searching for a class by specified name and deleting this class from the server configuration. The command has the following structure:

{
"command": "class-del",
"arguments": {
{
"name": "my-class"
}
}
}

If the class exists and is referred by another class an error is returned with the name of this class.

Parameters

  callout_handle | Reference to the callout handle holding command to be processed and where result should be stored.

Definition at line 525 of file class_cmds.cc.

## ◆ getClass()

void isc::class_cmds::ClassCmds::getClass | ( | hooks::CalloutHandle & | callout_handle | ) | const

Returns a response to a 'class-get' command.

This function returns a client class by a name.

The successful response has the following structure:

{
"result": 0,
"text": "Class 'my-class' definition returned",
"arguments": {
"client-classes": [
{
"name": "my-class",
...
}
]
}
}

Parameters

  callout_handle | Reference to the callout handle holding command to be processed and where result should be stored.

Definition at line 501 of file class_cmds.cc.

## ◆ getClassList()

void isc::class_cmds::ClassCmds::getClassList | ( | hooks::CalloutHandle & | callout_handle | ) | const

Returns a response to a 'class-list' command.

This method retrieves configured client classes and returns the list of their names.

The successful response has the following structure:

{
"result": 0,
"text": "2 classes found",
"arguments": {
"client-classes": [
{
"name": "classA"
},
{
"name": "classB"
}
]
}
}

Parameters

  callout_handle | Reference to the callout handle holding command to be processed and where result should be stored.

Definition at line 506 of file class_cmds.cc.

## ◆ updateClass()

void isc::class_cmds::ClassCmds::updateClass | ( | hooks::CalloutHandle & | callout_handle | ) |

Returns a response to a 'class-update' command.

This function processes 'class-update' command by updating it to the current server configuration and returns a response to the client.

The command has the following structure:

{
"command": "class-update",
"arguments": {
"client-classes": [
{
"name": "my-class",
...
}
]
}
}

Before updating the class to the current configuration this method will check for duplicated class, i.e. having the same name, and expressions referring to unspecified (i.e. not builtin nor configured) and forward (i.e. configured after) classes. Dependency to KNOWN and UNKNOWN builtin classes must not change.

The successful response has the following structure:

{
"result": 0,
"text": "Class 'my-class' updated."
}

Parameters

  callout_handle | Reference to the callout handle holding command to be processed and where result should be stored.

Definition at line 519 of file class_cmds.cc.

The documentation for this class was generated from the following files:

- class_cmds.h
- class_cmds.cc