StrategyChoice » History » Revision 2
Revision 1 (Junxiao Shi, 03/01/2014 06:42 PM) → Revision 2/16 (Alex Afanasyev, 03/03/2014 08:58 AM)
# NFD Strategy Choice Protocol The **Strategy Choice protocol** allows an entity to set the forwarding strategy for a namespace. The Strategy Choice protocol uses [[Command Interests]]-Data exchange. The command request and response follows [[ControlCommand|NFD Control Command specification]]. ## Command format ### Request Request is a [[Command Interests|Signed Command Interest]] with the following name: /localhost/nfd/strategy-choice/<command-verb>/<command-options>/............................ \ / \ / \ / ------------- ------------- ------------- --------------- ------------ ------------ \/ \/ \/ NFD Control Command to StrategyChoiceManager command Command Interest StrategyChoiceManager and command options related information Command options is defined as a TLV-encoded `StrategyChoiceOptions` block. Each individual command defines a subset of required and optional elements in the `StrategyChoiceOptions` block. Note that `Name` field is required for `StrategyChoiceOptions` block. StrategyChoiceOptions ::= STRATEGY-CHOICE-OPTIONS-TYPE TLV-LENGTH Name Strategy? // Name defined in NDN-TLV spec Strategy ::= STRATEGY-TYPE TLV-LENGTH Name ### Response Command response is a Data packet that contains TLV-encoded `ControlResponse` block, defined in [[ControlCommand|NFD Control Command specification]]. Content of `ControlResponse` on success: Field in `ControlResponse` block | Value -------------------------------- | ----- `StatusCode` | 200 `StatusText` | "Success" `<StatusBody>` | `StrategyChoiceOptions` block, echoed Content of `ControlResponse` on error: Field in `ControlResponse` block | Value -------------------------------- | ----- `StatusCode` | 4xx, 5xx, or other error codes based on RFC2616 `StatusText` | Human-readable description of the error `<StatusBody>` | Not present ### Operations **Strategy Choice protocol** supports five operations: * **insert**: set the strategy for a namespace * **delete**: unset the strategy for a namespace ## Set the strategy for a namespace **command-verb:** `insert` Required fields in `StrategyChoiceOptions` block: * `Name` * `Strategy` **Strategy** must be a `Name` that represents a builtin strategy: * ndn:/localhost/nfd/strategy/best-route * ndn:/localhost/nfd/strategy/broadcast * ndn:/localhost/nfd/strategy/ncc If the Strategy does not match any builtin strategy, the response has StatusCode 504. ## Unset the strategy for a namespace **command-verb:** `delete` Required fields in `StrategyChoiceOptions` block: * `Name` After this operation, the effective strategy at Name is inherited from the parent. If there is no strategy defined at Name, this command does nothing, but is still considered successful. Name must not be `ndn:/`, otherwise the operation fails with StatusCode 403. ## TLV-TYPE assignments Type | Assigned value | Assigned value (hex) ------------------------------------------- | ----------------- | -------------------- StrategyChoiceOptions | 109 | 0x6d Strategy | 107 | 0x6b