ControlCommand » History » Revision 12
Revision 11 (Alex Afanasyev, 02/15/2014 09:07 PM) → Revision 12/53 (Alex Afanasyev, 02/15/2014 09:09 PM)
# NFD Control Command specification NFD management module exposes a command interface as Interest-Data exchange. Commands provided over this interface are useful for querying or changing the state of NFD forwarder. When specified, control command takes form of a [[Command Interests|Signed Command Interest]]. ## Request format A request to the command interface is an Interest under ``ndn:/localhost/nfd/<management-module>/<command-verb>/...`` prefix. /localhost/nfd/<management-module>/<command-verb>/................./............................... \ / \ / ------ ------ -------------- -------------- \/ \/ Control Command options Command Control Interest security (optional) info (optional) A request Interest has at least five Name components. The first five components are: 1. "localhost" in UTF-8 2. "nfd" in UTF-8 3. *management-module* in UTF-8, management module to which the command needs to be dispatched 4. *command-verb* in UTF-8, command to be executed 5. *...*, the arguments to the command, defined for each management module in separate specifications: - [[FibMgmt|FIB Management specification]] - [[FaceMgmt|Face Management specification]] ### Signed request and Unsigned request Most commands require a signature to be included in the Name. The signature format is defined in [[Signed Interests]] spec. A signed request Interest has eight Name components. Certain commands that do not change the forwarder state do not require a signature. An unsigned request Interest has five Name components. Each individual command specification defines whether a request Interest using that command verb should be signed or not. ### Options The *option* component contains arguments to the command as a TLV. This component is required even if the command verb does not need any arguments. In that case, this component would have zero length. Each individual command specification defines the format of the options TLV. 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. ## Response format A response from the command interface is a Data that matches the request Interest. The payload in this Data should be a ControlCommandResponse element. ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH StatusCode StatusText <StatusBody>? StatusCode ::= STATUS-CODE-TYPE TLV-LENGTH nonNegativeInteger StatusText ::= STATUS-TEXT TLV-LENGTH string in UTF-8 <StatusBody> ::= <TLV block defined by the specific control protocol> **StatusCode** generally follows HTTP convention. Common codes include: StatusCode | Description -----------|------------------------ 200 | OK 400 | Arguments are incorrect 401 | Signed request is required for command, but unsigned request is passed 403 | Signing key is not authorized for this command 404 | Resource (e.g. face, prefix, ...) not found 501 | Command verb is not supported Additional elements are allowed at the end of **ControlResponse**. Each individual command specification defines whether and what can present. ## TLV-TYPE assignments (Types are assigned from the range reserved for forwarding daemon.) Type | Assigned value | Assigned value (hex) ------------------------------------------- | ----------------- | -------------------- ControlResponse | 101 | 0x65 StatusCode | 102 | 0x66 StatusText | 103 | 0x67