ControlCommand » History » Version 17
Junxiao Shi, 04/17/2014 09:31 PM
| 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 | 15 | Alex Afanasyev | \______ _______/ \_____________ ______________/ |
| 13 | 13 | Junxiao Shi | \/ \/ |
| 14 | ControlParameters Command Interest security |
||
| 15 | 1 | Junxiao Shi | |
| 16 | 13 | Junxiao Shi | A request Interest has 9 Name components. |
| 17 | These components are: |
||
| 18 | 1 | Junxiao Shi | |
| 19 | 1. "localhost" in UTF-8 |
||
| 20 | 2. "nfd" in UTF-8 |
||
| 21 | 3. *management-module* in UTF-8, management module to which the command needs to be dispatched |
||
| 22 | 4. *command-verb* in UTF-8, command to be executed |
||
| 23 | 13 | Junxiao Shi | 5. *...*, a ControlParameters TLV block |
| 24 | 6. timestamp of [[Command Interests]] |
||
| 25 | 7. random-value of [[Command Interests]] |
||
| 26 | 8. SignatureInfo of [[Command Interests]] |
||
| 27 | 9. SignatureValue of [[Command Interests]] |
||
| 28 | 1 | Junxiao Shi | |
| 29 | 13 | Junxiao Shi | ### ControlParameters |
| 30 | 1 | Junxiao Shi | |
| 31 | 13 | Junxiao Shi | ControlParameters block contains arguments to the command. |
| 32 | 1 | Junxiao Shi | |
| 33 | 14 | Junxiao Shi | ControlParameters ::= CONTROL-PARAMETERS-TYPE TLV-LENGTH |
| 34 | Name? |
||
| 35 | FaceId? |
||
| 36 | Uri? |
||
| 37 | LocalControlFeature? |
||
| 38 | 17 | Junxiao Shi | Flags? |
| 39 | 14 | Junxiao Shi | Cost? |
| 40 | Strategy? |
||
| 41 | 17 | Junxiao Shi | ExpirationPeriod? |
| 42 | Procotol? |
||
| 43 | 13 | Junxiao Shi | |
| 44 | // Name is defined in NDN-TLV spec |
||
| 45 | |||
| 46 | 14 | Junxiao Shi | FaceId ::= FACE-ID-TYPE TLV-LENGTH |
| 47 | nonNegativeInteger |
||
| 48 | 13 | Junxiao Shi | |
| 49 | 14 | Junxiao Shi | Uri ::= URI-TYPE TLV-LENGTH |
| 50 | RFC3986 URI in UTF-8 encoding |
||
| 51 | 13 | Junxiao Shi | |
| 52 | 14 | Junxiao Shi | LocalControlFeature ::= LOCAL-CONTROL-FEATURE-TYPE TLV-LENGTH |
| 53 | nonNegativeInteger |
||
| 54 | 13 | Junxiao Shi | |
| 55 | 17 | Junxiao Shi | Flags ::= FLAGS-TYPE TLV-LENGTH |
| 56 | nonNegativeInteger |
||
| 57 | |||
| 58 | 14 | Junxiao Shi | Cost ::= COST-TYPE TLV-LENGTH |
| 59 | nonNegativeInteger |
||
| 60 | 13 | Junxiao Shi | |
| 61 | 14 | Junxiao Shi | Strategy ::= STRATEGY-TYPE TLV-LENGTH |
| 62 | Name |
||
| 63 | 17 | Junxiao Shi | |
| 64 | ExpirationPeriod ::= EXPIRATION-PERIOD-TYPE TLV-LENGTH |
||
| 65 | nonNegativeInteger |
||
| 66 | |||
| 67 | Protocol ::= PROTOCOL-TYPE TLV-LENGTH |
||
| 68 | ASCII string |
||
| 69 | 13 | Junxiao Shi | |
| 70 | 1 | Junxiao Shi | This definition exhausts all possible fields used in existing commands. |
| 71 | 13 | Junxiao Shi | |
| 72 | 1 | Junxiao Shi | Each individual command MUST specify: |
| 73 | 13 | Junxiao Shi | |
| 74 | * a list of required fields: those fields MUST be present |
||
| 75 | * a list of optional fields: those fields MAY be present |
||
| 76 | 1 | Junxiao Shi | * the semantics of each required and optional fields |
| 77 | 13 | Junxiao Shi | |
| 78 | 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. |
| 79 | |||
| 80 | 17 | Junxiao Shi | Each individual command MAY impose additional constraints on certain fields. |
| 81 | 1 | Junxiao Shi | |
| 82 | ## Response format |
||
| 83 | |||
| 84 | A response from the command interface is a Data that matches the request Interest. |
||
| 85 | 13 | Junxiao Shi | The payload of this Data is a ControlResponse block. |
| 86 | 1 | Junxiao Shi | |
| 87 | ControlResponse ::= CONTROL-RESPONSE-TYPE TLV-LENGTH |
||
| 88 | StatusCode |
||
| 89 | StatusText |
||
| 90 | 13 | Junxiao Shi | <body>? |
| 91 | 1 | Junxiao Shi | |
| 92 | StatusCode ::= STATUS-CODE-TYPE TLV-LENGTH |
||
| 93 | nonNegativeInteger |
||
| 94 | |||
| 95 | 13 | Junxiao Shi | StatusText ::= STATUS-TEXT-TYPE TLV-LENGTH |
| 96 | 2 | Junxiao Shi | string in UTF-8 |
| 97 | 1 | Junxiao Shi | |
| 98 | 14 | Junxiao Shi | <body> ::= zero or more arbitary TLV blocks |
| 99 | 1 | Junxiao Shi | |
| 100 | 13 | Junxiao Shi | ### StatusCode |
| 101 | 2 | Junxiao Shi | |
| 102 | 16 | Junxiao Shi | StatusCode generally follows HTTP convention \[[RFC2616](http://tools.ietf.org/html/rfc2616#section-10)\]. |
| 103 | |||
| 104 | * Codes between 100 and 399 represents a success. |
||
| 105 | * Codes between 400 and 499 represents a client error. |
||
| 106 | * Codes between 500 and 599 represents a server error. |
||
| 107 | |||
| 108 | 13 | Junxiao Shi | Common codes include: |
| 109 | 1 | Junxiao Shi | |
| 110 | StatusCode | Description |
||
| 111 | 13 | Junxiao Shi | -----------|------------------------ |
| 112 | 2 | Junxiao Shi | 200 | OK |
| 113 | 16 | Junxiao Shi | 400 | ControlParameters is incorrect |
| 114 | 403 | Command Interest is not authorized |
||
| 115 | 1 | Junxiao Shi | 404 | Resource (e.g. face, prefix, ...) not found |
| 116 | 6 | Alex Afanasyev | 501 | Command verb is not supported |
| 117 | 1 | Junxiao Shi | |
| 118 | Each individual command MAY define additional codes. |
||
| 119 | 13 | Junxiao Shi | |
| 120 | 1 | Junxiao Shi | ### \<body> |
| 121 | 13 | Junxiao Shi | |
| 122 | 2 | Junxiao Shi | Additional elements are allowed at the end of ControlResponse. |
| 123 | 13 | Junxiao Shi | |
| 124 | 1 | Junxiao Shi | Each individual command MAY define the type and meaning of \<body>. |
| 125 | 14 | Junxiao Shi | |
| 126 | 1 | Junxiao Shi | Unless otherwise defined by an individual command, |
| 127 | 14 | Junxiao Shi | \<body> is the ControlParameters passed into this command for all successful responses, |
| 128 | 17 | Junxiao Shi | and \<body> is empty for all failure responses. |
| 129 | 14 | Junxiao Shi | |
| 130 | 13 | Junxiao Shi | ## TLV-TYPE assignments |
| 131 | |||
| 132 | 1 | Junxiao Shi | Type | Assigned value | Assigned value (hex) |
| 133 | ------------------------------------------- | ----------------- | -------------------- |
||
| 134 | 13 | Junxiao Shi | ControlParameters | 104 | 0x68 |
| 135 | FaceId | 105 | 0x69 |
||
| 136 | 1 | Junxiao Shi | Uri | 114 | 0x72 |
| 137 | 13 | Junxiao Shi | LocalControlFeature | 110 | 0x6e |
| 138 | 17 | Junxiao Shi | Flags | 108 | 0x6c |
| 139 | 1 | Junxiao Shi | Cost | 106 | 0x6a |
| 140 | Strategy | 107 | 0x6b |
||
| 141 | 17 | Junxiao Shi | ExpirationPeriod | 109 | 0x6d |
| 142 | Protocol | 111 | 0x6f |
||
| 143 | 5 | Alex Afanasyev | ControlResponse | 101 | 0x65 |
| 144 | StatusCode | 102 | 0x66 |
||
| 145 | StatusText | 103 | 0x67 |
||
| 146 | 13 | Junxiao Shi | |
| 147 | These types are assigned from the range reserved for forwarding daemon. |