ControlCommand » History » Version 13
Junxiao Shi, 03/18/2014 12: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 | 13 | Junxiao Shi | ControlParameters ::= CONTROL-PARAMETERS-TYPE TLV-LENGTH |
35 | Name? |
||
36 | FaceId? |
||
37 | Uri? |
||
38 | ControlModule? |
||
39 | Cost? |
||
40 | Strategy? |
||
41 | |||
42 | // Name is defined in NDN-TLV spec |
||
43 | |||
44 | FaceId ::= FACEID-TYPE TLV-LENGTH |
||
45 | nonNegativeInteger |
||
46 | |||
47 | Uri ::= URI-TYPE TLV-LENGTH |
||
48 | RFC3986 URI in UTF-8 encoding |
||
49 | |||
50 | ControlModule ::= CONTROL-MODULE-TYPE TLV-LENGTH |
||
51 | nonNegativeInteger |
||
52 | |||
53 | Cost ::= COST-TYPE TLV-LENGTH |
||
54 | nonNegativeInteger |
||
55 | |||
56 | 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 | 13 | Junxiao Shi | <body> ::= zero or more arbitary TLV block |
88 | 1 | Junxiao Shi | |
89 | 13 | Junxiao Shi | ### StatusCode |
90 | 2 | Junxiao Shi | |
91 | 13 | 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 | 2 | Junxiao Shi | StatusCode | Description |
96 | 1 | Junxiao Shi | -----------|------------------------ |
97 | 2 | Junxiao Shi | 200 | OK |
98 | 1 | Junxiao Shi | 400 | Arguments are incorrect |
99 | 6 | Alex Afanasyev | 403 | Signing key is not authorized for this command |
100 | 404 | Resource (e.g. face, prefix, ...) not found |
||
101 | 1 | Junxiao Shi | 501 | Command verb is not supported |
102 | |||
103 | 13 | Junxiao Shi | Each individual command MAY define additional codes. |
104 | 1 | Junxiao Shi | |
105 | 13 | Junxiao Shi | ### \<body> |
106 | 2 | Junxiao Shi | |
107 | 13 | Junxiao Shi | Additional elements are allowed at the end of ControlResponse. |
108 | 1 | Junxiao Shi | |
109 | 13 | Junxiao Shi | Unless defined by an individual command, \<body> is the ControlParameters passed into this command. |
110 | 10 | Anonymous | |
111 | 13 | Junxiao Shi | Each individual command MAY define the type and meaning of \<body>. |
112 | |||
113 | ## TLV-TYPE assignments |
||
114 | |||
115 | 1 | Junxiao Shi | Type | Assigned value | Assigned value (hex) |
116 | ------------------------------------------- | ----------------- | -------------------- |
||
117 | 13 | Junxiao Shi | ControlParameters | 104 | 0x68 |
118 | FaceId | 105 | 0x69 |
||
119 | Uri | 114 | 0x72 |
||
120 | ControlModule | 110 | 0x6e |
||
121 | Cost | 106 | 0x6a |
||
122 | Strategy | 107 | 0x6b |
||
123 | 5 | Alex Afanasyev | ControlResponse | 101 | 0x65 |
124 | StatusCode | 102 | 0x66 |
||
125 | StatusText | 103 | 0x67 |
||
126 | 13 | Junxiao Shi | |
127 | These types are assigned from the range reserved for forwarding daemon. |