Skip to content

DHCP Server Plugin

Version: 1.0

Status: ⚫⚫⚫

DHCPServer plugin for Thunder framework.

Table of Contents

Introduction

Scope

This document describes purpose and functionality of the DHCPServer plugin. It includes detailed specification about its configuration, methods and properties provided.

Case Sensitivity

All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.

Acronyms, Abbreviations and Terms

The table below provides and overview of acronyms used in this document and their definitions.

Acronym Description
API Application Programming Interface
DHCP Dynamic Host Configuration Protocol
HTTP Hypertext Transfer Protocol
JSON JavaScript Object Notation; a data interchange format
JSON-RPC A remote procedure call protocol encoded in JSON

The table below provides and overview of terms and abbreviations used in this document and their definitions.

Term Description
callsign The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique.

References

Ref ID Description
DHCP DHCP protocol specification (RFC2131)
HTTP HTTP specification
JSON-RPC JSON-RPC 2.0 specification
JSON JSON specification
Thunder Thunder API Reference

Configuration

The table below lists configuration options of the plugin.

Name Type M/O Description
callsign string mandatory Plugin instance name (default: DHCPServer)
classname string mandatory Class name: DHCPServer
locator string mandatory Library name: libThunderDHCPServer.so
startmode string mandatory Determines in which state the plugin should be moved to at startup of the framework
configuration object mandatory Server configuration
configuration.name string mandatory Name of the server
configuration.servers array mandatory List of configured DHCP servers
configuration.servers[#] object mandatory Configuration of a server
configuration.servers[#].interface string mandatory Name of the network interface to bind to
configuration.servers[#].poolstart integer mandatory IP pool start number
configuration.servers[#].poolsize integer mandatory IP pool size (in IP numbers)
configuration.servers[#]?.router integer optional IP of router

Interfaces

This plugin implements the following interfaces:

Methods

The following methods are provided by the DHCPServer plugin:

DHCPServer interface methods:

Method Description
activate Activates a DHCP server
deactivate Deactivates a DHCP server

activate method

Activates a DHCP server.

Parameters

Name Type M/O Description
params object mandatory ...
params.interface string mandatory Network interface name

Result

Name Type M/O Description
result null mandatory Always null (default: None)

Errors

Message Description
ERROR_GENERAL Failed to activate server
ERROR_UNKNOWN_KEY Invalid interface name given
ERROR_ILLEGAL_STATE Server is already activated

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "DHCPServer.1.activate",
  "params": {
    "interface": "eth0"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

deactivate method

Deactivates a DHCP server.

Parameters

Name Type M/O Description
params object mandatory ...
params.interface string mandatory Network interface name

Result

Name Type M/O Description
result null mandatory Always null (default: None)

Errors

Message Description
ERROR_GENERAL Failed to deactivate server
ERROR_UNKNOWN_KEY Invalid interface name given
ERROR_ILLEGAL_STATE Server is not activated

Example

Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "DHCPServer.1.deactivate",
  "params": {
    "interface": "eth0"
  }
}

Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": null
}

Properties

The following properties are provided by the DHCPServer plugin:

DHCPServer interface properties:

Property R/W Description
status read-only Server status

status property

Provides access to the server status.

This property is read-only.

The server parameter shall be passed as the index to the property, i.e. status@<server>.

Index

Name Type M/O Description
server string mandatory If omitted, status of all configured servers is returned

Value

Name Type M/O Description
(property) array mandatory List of configured servers
(property)[#] object mandatory ...
(property)[#].interface string mandatory Network interface name
(property)[#].active boolean mandatory Denotes if server is currently active
(property)[#]?.begin string optional IP address pool start
(property)[#]?.end string optional IP address pool end
(property)[#]?.router string optional Router IP address
(property)[#]?.leases array optional List of IP address leases
(property)[#]?.leases[#] object mandatory Lease description
(property)[#]?.leases[#].name string mandatory Client identifier (or client hardware address if identifier is absent)
(property)[#]?.leases[#].ip string mandatory Client IP address
(property)[#]?.leases[#]?.expires string optional Client IP expiration time (in ISO8601 format, empty: never expires)

Errors

Message Description
ERROR_UNKNOWN_KEY Invalid server name given

Example

Get Request

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "DHCPServer.1.status@eth0"
}

Get Response

{
  "jsonrpc": "2.0",
  "id": 42,
  "result": [
    {
      "interface": "eth0",
      "active": true,
      "begin": "192.168.0.10",
      "end": "192.168.0.100",
      "router": "192.168.0.1",
      "leases": [
        {
          "name": "00e04c326c56",
          "ip": "192.168.0.10",
          "expires": "2019-05-07T07:20:26Z"
        }
      ]
    }
  ]
}