Project

General

Profile

ControlCommand » History » Version 14

Junxiao Shi, 03/18/2014 11:03 AM

1 13 Junxiao Shi
# Control Command
2 1 Junxiao Shi
3 13 Junxiao Shi
**Control Command** is a mechanism of [[Management|NFD Management protocol]].
4
This document defines the request and response format of commands that can alter forwarder state, and how these commands should be signed and authenticated.
5
This mechanism is useful for altering forwarder state.
6 1 Junxiao Shi
7
## Request format
8 9 Anonymous
9 13 Junxiao Shi
Control commands are signed [[Command Interests]] under `ndn:/localhost/nfd` prefix.
10 11 Alex Afanasyev
11 13 Junxiao Shi
    /localhost/nfd/<management-module>/<command-verb>/................./...............................
12
                                                      \               / \                             /
13
                                                       ------  ------    -------------- --------------
14
                                                             \/                       \/
15
                                                      ControlParameters    Command Interest security
16 1 Junxiao Shi
17 13 Junxiao Shi
A request Interest has 9 Name components.
18
These components are:
19 1 Junxiao Shi
20
1. "localhost" in UTF-8
21
2. "nfd" in UTF-8
22
3. *management-module* in UTF-8, management module to which the command needs to be dispatched
23
4. *command-verb* in UTF-8, command to be executed
24 13 Junxiao Shi
5. *...*, a ControlParameters TLV block
25
6. timestamp of [[Command Interests]]
26
7. random-value of [[Command Interests]]
27
8. SignatureInfo of [[Command Interests]]
28
9. SignatureValue of [[Command Interests]]
29 1 Junxiao Shi
30 13 Junxiao Shi
### ControlParameters
31 1 Junxiao Shi
32 13 Junxiao Shi
ControlParameters block contains arguments to the command.
33 1 Junxiao Shi
34 14 Junxiao Shi
    ControlParameters   ::= CONTROL-PARAMETERS-TYPE TLV-LENGTH
35
                              Name?
36
                              FaceId?
37
                              Uri?
38
                              LocalControlFeature?
39
                              Cost?
40
                              Strategy?
41 13 Junxiao Shi
    
42
    // Name is defined in NDN-TLV spec
43
    
44 14 Junxiao Shi
    FaceId              ::= FACE-ID-TYPE TLV-LENGTH
45
                              nonNegativeInteger
46 13 Junxiao Shi
    
47 14 Junxiao Shi
    Uri                 ::= URI-TYPE TLV-LENGTH
48
                              RFC3986 URI in UTF-8 encoding
49 13 Junxiao Shi
    
50 14 Junxiao Shi
    LocalControlFeature ::= LOCAL-CONTROL-FEATURE-TYPE TLV-LENGTH
51
                              nonNegativeInteger
52 13 Junxiao Shi
    
53 14 Junxiao Shi
    Cost                ::= COST-TYPE TLV-LENGTH
54
                              nonNegativeInteger
55 13 Junxiao Shi
    
56 14 Junxiao Shi
    Strategy            ::= STRATEGY-TYPE TLV-LENGTH
57
                              Name
58 1 Junxiao Shi
59 13 Junxiao Shi
This definition exhausts all possible fields used in existing commands.
60 1 Junxiao Shi
61 13 Junxiao Shi
Each individual command MUST specify:
62 1 Junxiao Shi
63 13 Junxiao Shi
* a list of required fields: those fields MUST be present
64
* a list of optional fields: those fields MAY be present
65
* the semantics of each required and optional fields
66 1 Junxiao Shi
67 13 Junxiao Shi
A field that is neither required nor optional for a command MUST NOT be present in a ControlParameter given to that command.
68 1 Junxiao Shi
69 13 Junxiao Shi
Each individual command MAY impose additional constraints to certain fields.
70 1 Junxiao Shi
71
## Response format
72
73
A response from the command interface is a Data that matches the request Interest.
74 13 Junxiao Shi
The payload of this Data is a ControlResponse block.
75 1 Junxiao Shi
76
    ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH
77
                          StatusCode
78
                          StatusText
79 13 Junxiao Shi
                          <body>?
80 1 Junxiao Shi
    
81
    StatusCode      ::= STATUS-CODE-TYPE TLV-LENGTH
82
                          nonNegativeInteger
83
    
84 13 Junxiao Shi
    StatusText      ::= STATUS-TEXT-TYPE TLV-LENGTH
85 2 Junxiao Shi
                          string in UTF-8
86 1 Junxiao Shi
    
87 14 Junxiao Shi
    <body>          ::= zero or more arbitary TLV blocks
88 1 Junxiao Shi
89 13 Junxiao Shi
### StatusCode
90 2 Junxiao Shi
91 1 Junxiao Shi
StatusCode generally follows HTTP convention.
92
Codes between 100 and 399 are considered successful; all other codes are considered failure.
93
Common codes include:
94
95 13 Junxiao Shi
StatusCode | Description
96
-----------|------------------------
97 2 Junxiao Shi
200        | OK
98 1 Junxiao Shi
400        | Arguments are incorrect
99 2 Junxiao Shi
403        | Signing key is not authorized for this command
100 6 Alex Afanasyev
404        | Resource (e.g. face, prefix, ...) not found
101 1 Junxiao Shi
501        | Command verb is not supported
102 6 Alex Afanasyev
103 1 Junxiao Shi
Each individual command MAY define additional codes.
104
105 13 Junxiao Shi
### \<body>
106 1 Junxiao Shi
107 13 Junxiao Shi
Additional elements are allowed at the end of ControlResponse.
108 2 Junxiao Shi
109 13 Junxiao Shi
Each individual command MAY define the type and meaning of \<body>.
110 1 Junxiao Shi
111 14 Junxiao Shi
Unless otherwise defined by an individual command,
112
\<body> is the ControlParameters passed into this command for all successful responses,
113
and \<body> is empty for all failure response.
114
115 13 Junxiao Shi
## TLV-TYPE assignments
116
117 1 Junxiao Shi
Type                                        | Assigned value    | Assigned value (hex)
118
------------------------------------------- | ----------------- | --------------------
119 13 Junxiao Shi
ControlParameters                           | 104               | 0x68
120
FaceId                                      | 105               | 0x69
121
Uri                                         | 114               | 0x72
122 14 Junxiao Shi
LocalControlFeature                         | 110               | 0x6e
123 13 Junxiao Shi
Cost                                        | 106               | 0x6a
124
Strategy                                    | 107               | 0x6b
125 5 Alex Afanasyev
ControlResponse                             | 101               | 0x65
126
StatusCode                                  | 102               | 0x66
127
StatusText                                  | 103               | 0x67
128 13 Junxiao Shi
129
These types are assigned from the range reserved for forwarding daemon.