Skip to content

Latest commit

 

History

History
267 lines (205 loc) · 7.78 KB

DHCPServerPlugin.md

File metadata and controls

267 lines (205 loc) · 7.78 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 of its configuration, methods and properties provided.

Case Sensitivity

All identifiers on the interface 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: libWPEFrameworkDHCPServer.so
autostart boolean Determines if the plugin is to 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)

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": 1234567890,
    "method": "DHCPServer.1.activate",
    "params": {
        "interface": "eth0"
    }
}

Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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": 1234567890,
    "method": "DHCPServer.1.deactivate",
    "params": {
        "interface": "eth0"
    }
}

Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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

Name Type Description
(property) array List of configured servers
(property)[#] object
(property)[#].interface string Network interface name
(property)[#].active boolean 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 (optional) Lease description
(property)[#]?.leases[#].name string Client identifier (or client hardware address if identifier is absent)
(property)[#]?.leases[#].ip string Client IP address
(property)[#]?.leases[#]?.expires string (optional) Client IP expiration time (in ISO8601 format, empty: never expires)

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

Errors

Code Message Description
22 ERROR_UNKNOWN_KEY Invalid server name given

Example

Get Request

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

Get Response

{
    "jsonrpc": "2.0",
    "id": 1234567890,
    "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"
                }
            ]
        }
    ]
}