Skip to content

Latest commit

 

History

History
284 lines (212 loc) · 7.96 KB

DHCPServerPlugin.md

File metadata and controls

284 lines (212 loc) · 7.96 KB

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 Description
callsign string Plugin instance name (default: DHCPServer)
classname string Class name: DHCPServer
locator string Library name: libThunderDHCPServer.so
startmode string Determines if the plugin shall be started automatically along with the framework
configuration object Server configuration
configuration.name string Name of the server
configuration.servers array List of configured DHCP servers
configuration.servers[#] object Configuration of a server
configuration.servers[#].interface string Name of the network interface to bind to
configuration.servers[#].poolstart number IP pool start number
configuration.servers[#].poolsize number IP pool size (in IP numbers)
configuration.servers[#]?.router number (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 Description
params object
params.interface string Network interface name

Result

Name Type Description
result null Always null

Errors

Code Message Description
1 ERROR_GENERAL Failed to activate server
22 ERROR_UNKNOWN_KEY Invalid interface name given
5 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 Description
params object
params.interface string Network interface name

Result

Name Type Description
result null Always null

Errors

Code Message Description
1 ERROR_GENERAL Failed to deactivate server
22 ERROR_UNKNOWN_KEY Invalid interface name given
5 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 Description
status RO Server status

status property

Provides access to the server status.

This property is read-only.

Value

The server argument shall be passed as the index to the property, e.g. DHCPServer.1.status@eth0. If omitted, status of all configured servers is returned.

Result

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

Errors

Code Message Description
22 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"
        }
      ]
    }
  ]
}