Project

General

Profile

ControlCommand » History » Revision 3

Revision 2 (Junxiao Shi, 01/23/2014 08:54 PM) → Revision 3/53 (Junxiao Shi, 01/23/2014 11:36 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. 


 ## Request format 

 A request to the command interface is an Interest under `ndn:/localhost/nfd` prefix. 

 A request Interest has at least four Name components. 
 The first four components are: 

 1. "localhost" in UTF-8 
 2. "nfd" in UTF-8 
 3. *verb*, the command verb in UTF-8 
 4. *options*, the arguments to the command 

 ### 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 seven Name components. 

 Certain commands that do not change the forwarder state do not require a signature. 
 An unsigned request Interest has 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 
                           ... 
    
     StatusCode        ::= STATUS-CODE-TYPE TLV-LENGTH 
                           nonNegativeInteger 
    
     StatusText        ::= STATUS-TEXT TLV-LENGTH 
                           string in UTF-8 

 **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 

 Type                                          | Assigned value      | Assigned value (hex) 
 ------------------------------------------- | ----------------- | -------------------- 
 ControlResponse                               StatusResponse                                | 130                 | 0x82 
 StatusCode                                    | 139                 | 0x8b 
 StatusText                                    | 140                 | 0x8c