Project

General

Profile

ControlCommand » History » Version 12

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