ControlCommand » History » Version 11
Alex Afanasyev, 02/15/2014 09:07 PM
| 1 | 1 | Junxiao Shi | # NFD Control Command specification |
|---|---|---|---|
| 2 | |||
| 3 | NFD management module exposes a command interface as Interest-Data exchange. |
||
| 4 | Commands provided over this interface are useful for querying or changing the state of NFD forwarder. |
||
| 5 | |||
| 6 | ## Request format |
||
| 7 | |||
| 8 | 9 | Anonymous | A request to the command interface is an Interest under ``ndn:/localhost/nfd/<management-module>/<command-verb>/...`` prefix. |
| 9 | 1 | Junxiao Shi | |
| 10 | 11 | Alex Afanasyev | /localhost/nfd/<management-module>/<command-verb>/................./............................... |
| 11 | \ / \ / |
||
| 12 | ------ ------ -------------- -------------- |
||
| 13 | \/ \/ |
||
| 14 | Control Command options Control Interest security |
||
| 15 | (optional) info (optional) |
||
| 16 | |||
| 17 | 8 | Anonymous | A request Interest has at least five Name components. |
| 18 | The first five components are: |
||
| 19 | 1 | Junxiao Shi | |
| 20 | 1. "localhost" in UTF-8 |
||
| 21 | 2 | Junxiao Shi | 2. "nfd" in UTF-8 |
| 22 | 1 | Junxiao Shi | 3. *management-module* in UTF-8, management module to which the command needs to be dispatched |
| 23 | 8 | Anonymous | 4. *command-verb* in UTF-8, command to be executed |
| 24 | 5. *...*, the arguments to the command, defined for each management module in separate specifications: |
||
| 25 | 4 | Alex Afanasyev | |
| 26 | - [[FibMgmt|FIB Management specification]] |
||
| 27 | 7 | Alex Afanasyev | - [[FaceMgmt|Face Management specification]] |
| 28 | 1 | Junxiao Shi | |
| 29 | ### Signed request and Unsigned request |
||
| 30 | |||
| 31 | Most commands require a signature to be included in the Name. |
||
| 32 | The signature format is defined in [[Signed Interests]] spec. |
||
| 33 | 8 | Anonymous | A signed request Interest has eight Name components. |
| 34 | 1 | Junxiao Shi | |
| 35 | Certain commands that do not change the forwarder state do not require a signature. |
||
| 36 | 8 | Anonymous | An unsigned request Interest has five Name components. |
| 37 | 1 | Junxiao Shi | |
| 38 | Each individual command specification defines whether a request Interest using that command verb should be signed or not. |
||
| 39 | |||
| 40 | ### Options |
||
| 41 | |||
| 42 | The *option* component contains arguments to the command as a TLV. |
||
| 43 | |||
| 44 | This component is required even if the command verb does not need any arguments. |
||
| 45 | In that case, this component would have zero length. |
||
| 46 | |||
| 47 | Each individual command specification defines the format of the options TLV. |
||
| 48 | The TLV-TYPE numbers used in this TLV should be allocated from application range, and are not required to be unique across different command verbs. |
||
| 49 | |||
| 50 | ## Response format |
||
| 51 | |||
| 52 | A response from the command interface is a Data that matches the request Interest. |
||
| 53 | 2 | Junxiao Shi | The payload in this Data should be a ControlCommandResponse element. |
| 54 | 1 | Junxiao Shi | |
| 55 | 2 | Junxiao Shi | ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH |
| 56 | StatusCode |
||
| 57 | StatusText |
||
| 58 | 6 | Alex Afanasyev | <StatusBody>? |
| 59 | 1 | Junxiao Shi | |
| 60 | 2 | Junxiao Shi | StatusCode ::= STATUS-CODE-TYPE TLV-LENGTH |
| 61 | nonNegativeInteger |
||
| 62 | 1 | Junxiao Shi | |
| 63 | 2 | Junxiao Shi | StatusText ::= STATUS-TEXT TLV-LENGTH |
| 64 | 1 | Junxiao Shi | string in UTF-8 |
| 65 | 6 | Alex Afanasyev | |
| 66 | <StatusBody> ::= <TLV block defined by the specific control protocol> |
||
| 67 | 1 | Junxiao Shi | |
| 68 | **StatusCode** generally follows HTTP convention. Common codes include: |
||
| 69 | |||
| 70 | StatusCode | Description |
||
| 71 | -----------|------------------------ |
||
| 72 | 2 | Junxiao Shi | 200 | OK |
| 73 | 1 | Junxiao Shi | 400 | Arguments are incorrect |
| 74 | 401 | Signed request is required for command, but unsigned request is passed |
||
| 75 | 403 | Signing key is not authorized for this command |
||
| 76 | 10 | Anonymous | 404 | Resource (e.g. face, prefix, ...) not found |
| 77 | 501 | Command verb is not supported |
||
| 78 | 1 | Junxiao Shi | |
| 79 | 2 | Junxiao Shi | Additional elements are allowed at the end of **ControlResponse**. |
| 80 | 1 | Junxiao Shi | Each individual command specification defines whether and what can present. |
| 81 | |||
| 82 | |||
| 83 | ## TLV-TYPE assignments |
||
| 84 | |||
| 85 | 5 | Alex Afanasyev | (Types are assigned from the range reserved for forwarding daemon.) |
| 86 | |||
| 87 | 1 | Junxiao Shi | Type | Assigned value | Assigned value (hex) |
| 88 | ------------------------------------------- | ----------------- | -------------------- |
||
| 89 | 5 | Alex Afanasyev | ControlResponse | 101 | 0x65 |
| 90 | StatusCode | 102 | 0x66 |
||
| 91 | StatusText | 103 | 0x67 |