Project

General

Profile

ControlCommand » History » Revision 8

Revision 7 (Alex Afanasyev, 01/30/2014 04:48 PM) → Revision 8/53 (Anonymous, 02/01/2014 11:19 AM)

# 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. 

 


 ## Request format 

 A request to the command interface is an Interest under ``ndn:/localhost/nfd/<management-module>/...`` prefix. 

 A request Interest has at least five four Name components. 
 The first five four 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 seven Name components. 

 Certain commands that do not change the forwarder state do not require a signature. 
 An unsigned request Interest has five four 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          | 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