ControlCommand » History » Version 2
Junxiao Shi, 01/23/2014 08:54 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 | |||
7 | ## Request format |
||
8 | |||
9 | 2 | Junxiao Shi | A request to the command interface is an Interest under `ndn:/localhost/nfd` prefix. |
10 | 1 | Junxiao Shi | |
11 | A request Interest has at least four Name components. |
||
12 | The first four components are: |
||
13 | |||
14 | 2 | Junxiao Shi | 1. "localhost" in UTF-8 |
15 | 2. "nfd" in UTF-8 |
||
16 | 1 | Junxiao Shi | 3. *verb*, the command verb in UTF-8 |
17 | 4. *options*, the arguments to the command |
||
18 | |||
19 | ### Signed request and Unsigned request |
||
20 | |||
21 | Most commands require a signature to be included in the Name. |
||
22 | The signature format is defined in [[Signed Interests]] spec. |
||
23 | A signed request Interest has seven Name components. |
||
24 | |||
25 | Certain commands that do not change the forwarder state do not require a signature. |
||
26 | An unsigned request Interest has four Name components. |
||
27 | |||
28 | Each individual command specification defines whether a request Interest using that command verb should be signed or not. |
||
29 | |||
30 | ### Options |
||
31 | |||
32 | The *option* component contains arguments to the command as a TLV. |
||
33 | |||
34 | This component is required even if the command verb does not need any arguments. |
||
35 | In that case, this component would have zero length. |
||
36 | |||
37 | Each individual command specification defines the format of the options TLV. |
||
38 | 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. |
||
39 | |||
40 | |||
41 | ## Response format |
||
42 | |||
43 | A response from the command interface is a Data that matches the request Interest. |
||
44 | 2 | Junxiao Shi | The payload in this Data should be a ControlCommandResponse element. |
45 | 1 | Junxiao Shi | |
46 | 2 | Junxiao Shi | ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH |
47 | StatusCode |
||
48 | StatusText |
||
49 | ... |
||
50 | 1 | Junxiao Shi | |
51 | 2 | Junxiao Shi | StatusCode ::= STATUS-CODE-TYPE TLV-LENGTH |
52 | nonNegativeInteger |
||
53 | 1 | Junxiao Shi | |
54 | 2 | Junxiao Shi | StatusText ::= STATUS-TEXT TLV-LENGTH |
55 | string in UTF-8 |
||
56 | 1 | Junxiao Shi | |
57 | **StatusCode** generally follows HTTP convention. Common codes include: |
||
58 | |||
59 | StatusCode | Description |
||
60 | -----------|------------------------ |
||
61 | 2 | Junxiao Shi | 200 | OK |
62 | 1 | Junxiao Shi | 400 | Arguments are incorrect |
63 | 401 | Signed request is required for command, but unsigned request is passed |
||
64 | 403 | Signing key is not authorized for this command |
||
65 | 404 | Command verb is not supported |
||
66 | |||
67 | 2 | Junxiao Shi | Additional elements are allowed at the end of **ControlResponse**. |
68 | 1 | Junxiao Shi | Each individual command specification defines whether and what can present. |
69 | |||
70 | |||
71 | ## TLV-TYPE assignments |
||
72 | |||
73 | Type | Assigned value | Assigned value (hex) |
||
74 | ------------------------------------------- | ----------------- | -------------------- |
||
75 | StatusResponse | 130 | 0x82 |
||
76 | StatusCode | 139 | 0x8b |
||
77 | StatusText | 140 | 0x8c |