ControlCommand » History » Version 37
Junxiao Shi, 02/08/2018 05:38 PM
1 | 34 | Junxiao Shi | |
---|---|---|---|
2 | 13 | Junxiao Shi | # Control Command |
3 | 1 | Junxiao Shi | |
4 | 29 | Davide Pesavento | **Control Command** is a mechanism of [[Management|NFD Management protocol]]. This mechanism is useful for altering the state of the forwarder. |
5 | 28 | Davide Pesavento | This document defines the request and response format of such commands, and how they should be signed and authenticated. |
6 | 1 | Junxiao Shi | |
7 | ## Request format |
||
8 | 9 | Anonymous | |
9 | 26 | Junxiao Shi | Control commands are [[ndn-cxx:CommandInterest|Command Interests]] under a NFD management prefix. |
10 | 1 | Junxiao Shi | |
11 | 22 | Junxiao Shi | The Name for a request Interest has the following form: |
12 | 1 | Junxiao Shi | |
13 | 26 | Junxiao Shi | /<prefix>/<management-module>/<command-verb>/<control-parameters>/<command-interest-components> |
14 | 1 | Junxiao Shi | |
15 | 23 | Junxiao Shi | * *prefix* is a NFD management prefix. |
16 | Unless otherwise noted, all commands use `/localhost/nfd` prefix. |
||
17 | Each individual command MAY specify additional prefixes under which that command could be accepted. |
||
18 | 22 | Junxiao Shi | * *management-module* is the name of management module to which the command needs to be dispatched. |
19 | * *command-verb* is the command to be executed. |
||
20 | 37 | Junxiao Shi | * *control-parameters* is a ControlParameters TLV element wrapped in a NameComponent. |
21 | 26 | Junxiao Shi | * *command-interest-components* are four additional components defined by [[ndn-cxx:CommandInterest|Command Interest]] spec. |
22 | 1 | Junxiao Shi | |
23 | 13 | Junxiao Shi | ### ControlParameters |
24 | 1 | Junxiao Shi | |
25 | 37 | Junxiao Shi | ControlParameters element contains arguments to the command. |
26 | 1 | Junxiao Shi | |
27 | 14 | Junxiao Shi | ControlParameters ::= CONTROL-PARAMETERS-TYPE TLV-LENGTH |
28 | Name? |
||
29 | FaceId? |
||
30 | 1 | Junxiao Shi | Uri? |
31 | 30 | Alex Afanasyev | LocalUri? |
32 | 14 | Junxiao Shi | Origin? |
33 | 1 | Junxiao Shi | Cost? |
34 | 19 | Junxiao Shi | Capacity? |
35 | 37 | Junxiao Shi | NCsEntries? |
36 | 1 | Junxiao Shi | Flags? |
37 | 26 | Junxiao Shi | Mask? |
38 | 17 | Junxiao Shi | Strategy? |
39 | ExpirationPeriod? |
||
40 | 24 | Junxiao Shi | FacePersistency? |
41 | 1 | Junxiao Shi | |
42 | 24 | Junxiao Shi | ; Name is defined in NDN packet format specification |
43 | 13 | Junxiao Shi | |
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 | 30 | Alex Afanasyev | |
50 | LocalUri ::= LOCAL-URI-TYPE TLV-LENGTH |
||
51 | 31 | Alex Afanasyev | RFC3986 URI in UTF-8 encoding |
52 | 13 | Junxiao Shi | |
53 | 19 | Junxiao Shi | Origin ::= ORIGIN-TYPE TLV-LENGTH |
54 | 17 | Junxiao Shi | nonNegativeInteger |
55 | 1 | Junxiao Shi | |
56 | Cost ::= COST-TYPE TLV-LENGTH |
||
57 | nonNegativeInteger |
||
58 | |||
59 | Capacity ::= CAPACITY-TYPE TLV-LENGTH |
||
60 | nonNegativeInteger |
||
61 | 37 | Junxiao Shi | |
62 | NCsEntries ::= N-CS-ENTRIES-TYPE TLV-LENGTH |
||
63 | nonNegativeInteger |
||
64 | |||
65 | 1 | Junxiao Shi | Flags ::= FLAGS-TYPE TLV-LENGTH |
66 | nonNegativeInteger |
||
67 | 37 | Junxiao Shi | |
68 | 26 | Junxiao Shi | Mask ::= MASK-TYPE TLV-LENGTH |
69 | nonNegativeInteger |
||
70 | 37 | Junxiao Shi | |
71 | 17 | Junxiao Shi | Strategy ::= STRATEGY-TYPE TLV-LENGTH |
72 | Name |
||
73 | 37 | Junxiao Shi | |
74 | 17 | Junxiao Shi | ExpirationPeriod ::= EXPIRATION-PERIOD-TYPE TLV-LENGTH |
75 | 1 | Junxiao Shi | nonNegativeInteger |
76 | 24 | Junxiao Shi | |
77 | 26 | Junxiao Shi | ; FacePersistency is defined in FaceMgmt section |
78 | 24 | Junxiao Shi | |
79 | 1 | Junxiao Shi | This definition exhausts all possible fields used in existing commands. |
80 | 13 | Junxiao Shi | |
81 | 1 | Junxiao Shi | Each individual command MUST specify: |
82 | 13 | Junxiao Shi | |
83 | * a list of required fields: those fields MUST be present |
||
84 | * a list of optional fields: those fields MAY be present |
||
85 | 28 | Davide Pesavento | * the semantics of each required and optional field |
86 | 13 | Junxiao Shi | |
87 | 1 | Junxiao Shi | A field that is neither required nor optional for a command MUST NOT be present in a ControlParameter given to that command. |
88 | |||
89 | 17 | Junxiao Shi | Each individual command MAY impose additional constraints on certain fields. |
90 | 1 | Junxiao Shi | |
91 | 35 | Junxiao Shi | ### Flags and Mask |
92 | |||
93 | 36 | Davide Pesavento | Various commands collect multiple boolean attributes into the **Flags** field as an inclusive OR. |
94 | Each individual command that uses the Flags field MUST define the meaning of each bit. In the definition, "bit 0" refers to the least significant bit. |
||
95 | 35 | Junxiao Shi | |
96 | The **Mask** field, if accepted by a command, indicates which attributes are being updated. |
||
97 | 36 | Davide Pesavento | In such cases, Flags field and Mask field must be both present or both omitted in the request. |
98 | Bits in the Mask field are arranged in the same order as the Flags field. |
||
99 | 1 | Junxiao Shi | For example, if a command defines two flags at bit 0 and bit 1 and also accepts a Mask field, a request containing "Flags=0x02 Mask=0x02" specifies bit 1 as "true" and specifies bit 0 as "don't care, leave at default, or keep unchanged"; this request is equivalent to a request containing "Flags=0x03 Mask=0x02". |
100 | 35 | Junxiao Shi | |
101 | 36 | Davide Pesavento | If a command does not accept the **Mask** field, it SHOULD interpret every bit in Flags, and there is no "don't care" bits. |
102 | 35 | Junxiao Shi | |
103 | 1 | Junxiao Shi | ## Response format |
104 | |||
105 | A response from the command interface is a Data that matches the request Interest. |
||
106 | 37 | Junxiao Shi | The payload of this Data is a ControlResponse element. |
107 | 1 | Junxiao Shi | |
108 | ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH |
||
109 | StatusCode |
||
110 | 26 | Junxiao Shi | StatusText |
111 | 1 | Junxiao Shi | <body> |
112 | |||
113 | StatusCode ::= STATUS-CODE-TYPE TLV-LENGTH |
||
114 | nonNegativeInteger |
||
115 | |||
116 | 13 | Junxiao Shi | StatusText ::= STATUS-TEXT-TYPE TLV-LENGTH |
117 | 2 | Junxiao Shi | string in UTF-8 |
118 | 1 | Junxiao Shi | |
119 | 37 | Junxiao Shi | <body> ::= zero or more arbitrary TLV elements |
120 | 1 | Junxiao Shi | |
121 | 13 | Junxiao Shi | ### StatusCode |
122 | 2 | Junxiao Shi | |
123 | 28 | Davide Pesavento | StatusCode loosely follows the HTTP semantics described in [RFC 7231](https://tools.ietf.org/html/rfc7231#section-6). |
124 | 16 | Junxiao Shi | |
125 | 28 | Davide Pesavento | * Codes between 100 and 399 represent a success. |
126 | * Codes between 400 and 499 represent a client error. |
||
127 | * Codes between 500 and 599 represent a server error. |
||
128 | 16 | Junxiao Shi | |
129 | 13 | Junxiao Shi | Common codes include: |
130 | 1 | Junxiao Shi | |
131 | StatusCode | Description |
||
132 | -----------|------------------------ |
||
133 | 13 | Junxiao Shi | 200 | OK |
134 | 2 | Junxiao Shi | 400 | ControlParameters is incorrect |
135 | 16 | Junxiao Shi | 403 | Command Interest is not authorized |
136 | 28 | Davide Pesavento | 404 | Resource (e.g., face, prefix, ...) not found |
137 | 19 | Junxiao Shi | 501 | Module or verb is not supported |
138 | 503 | Service not available |
||
139 | 1 | Junxiao Shi | |
140 | Each individual command MAY define additional codes. |
||
141 | 13 | Junxiao Shi | |
142 | 1 | Junxiao Shi | ### \<body> |
143 | 13 | Junxiao Shi | |
144 | 2 | Junxiao Shi | Additional elements are allowed at the end of ControlResponse. |
145 | 13 | Junxiao Shi | |
146 | 1 | Junxiao Shi | Each individual command MAY define the type and meaning of \<body>. |
147 | 14 | Junxiao Shi | |
148 | 1 | Junxiao Shi | Unless otherwise defined by an individual command, |
149 | 14 | Junxiao Shi | \<body> is the ControlParameters passed into this command for all successful responses, |
150 | and \<body> is empty for all failure responses. |
||
151 | 1 | Junxiao Shi | |
152 | ## TLV-TYPE assignments |
||
153 | 13 | Junxiao Shi | |
154 | 1 | Junxiao Shi | Type | Assigned value | Assigned value (hex) |
155 | ------------------------------------------- | ----------------- | -------------------- |
||
156 | 13 | Junxiao Shi | ControlParameters | 104 | 0x68 |
157 | 1 | Junxiao Shi | FaceId | 105 | 0x69 |
158 | 13 | Junxiao Shi | Uri | 114 | 0x72 |
159 | 1 | Junxiao Shi | LocalUri | 129 | 0x81 |
160 | 33 | Alex Afanasyev | Origin | 111 | 0x6f |
161 | 13 | Junxiao Shi | Cost | 106 | 0x6a |
162 | 19 | Junxiao Shi | Capacity | 131 | 0x83 |
163 | 37 | Junxiao Shi | NCsEntries | 135 | 0x87 |
164 | 1 | Junxiao Shi | Flags | 108 | 0x6c |
165 | 26 | Junxiao Shi | Mask | 112 | 0x70 |
166 | 5 | Alex Afanasyev | Strategy | 107 | 0x6b |
167 | 1 | Junxiao Shi | ExpirationPeriod | 109 | 0x6d |
168 | 24 | Junxiao Shi | ControlResponse | 101 | 0x65 |
169 | 5 | Alex Afanasyev | StatusCode | 102 | 0x66 |
170 | 13 | Junxiao Shi | StatusText | 103 | 0x67 |
171 | 26 | Junxiao Shi | (reserved, formerly LocalControlFeature) | 110 | 0x6e |