StrategyChoice » History » Version 2
Alex Afanasyev, 03/03/2014 08:58 AM
1 | 1 | Junxiao Shi | # NFD Strategy Choice Protocol |
---|---|---|---|
2 | |||
3 | The **Strategy Choice protocol** allows an entity to set the forwarding strategy for a namespace. |
||
4 | |||
5 | The Strategy Choice protocol uses [[Command Interests]]-Data exchange. |
||
6 | The command request and response follows [[ControlCommand|NFD Control Command specification]]. |
||
7 | |||
8 | ## Command format |
||
9 | |||
10 | ### Request |
||
11 | |||
12 | Request is a [[Command Interests|Signed Command Interest]] with the following name: |
||
13 | |||
14 | /localhost/nfd/strategy-choice/<command-verb>/<command-options>/............................ |
||
15 | |||
16 | \ / \ / \ / |
||
17 | ------------- ------------- ------------- --------------- ------------ ------------ |
||
18 | \/ \/ \/ |
||
19 | NFD Control Command to StrategyChoiceManager command Command Interest |
||
20 | StrategyChoiceManager and command options related information |
||
21 | |||
22 | Command options is defined as a TLV-encoded `StrategyChoiceOptions` block. |
||
23 | Each individual command defines a subset of required and optional elements in the `StrategyChoiceOptions` block. |
||
24 | Note that `Name` field is required for `StrategyChoiceOptions` block. |
||
25 | |||
26 | StrategyChoiceOptions ::= STRATEGY-CHOICE-OPTIONS-TYPE TLV-LENGTH |
||
27 | Name |
||
28 | Strategy? |
||
29 | |||
30 | // Name defined in NDN-TLV spec |
||
31 | |||
32 | Strategy ::= STRATEGY-TYPE TLV-LENGTH |
||
33 | Name |
||
34 | |||
35 | ### Response |
||
36 | |||
37 | Command response is a Data packet that contains TLV-encoded `ControlResponse` block, defined in [[ControlCommand|NFD Control Command specification]]. |
||
38 | |||
39 | Content of `ControlResponse` on success: |
||
40 | |||
41 | Field in `ControlResponse` block | Value |
||
42 | -------------------------------- | ----- |
||
43 | `StatusCode` | 200 |
||
44 | `StatusText` | "Success" |
||
45 | `<StatusBody>` | `StrategyChoiceOptions` block, echoed |
||
46 | |||
47 | Content of `ControlResponse` on error: |
||
48 | |||
49 | Field in `ControlResponse` block | Value |
||
50 | -------------------------------- | ----- |
||
51 | `StatusCode` | 4xx, 5xx, or other error codes based on RFC2616 |
||
52 | `StatusText` | Human-readable description of the error |
||
53 | `<StatusBody>` | Not present |
||
54 | |||
55 | |||
56 | ### Operations |
||
57 | |||
58 | **Strategy Choice protocol** supports five operations: |
||
59 | |||
60 | * **insert**: set the strategy for a namespace |
||
61 | * **delete**: unset the strategy for a namespace |
||
62 | |||
63 | ## Set the strategy for a namespace |
||
64 | |||
65 | **command-verb:** `insert` |
||
66 | |||
67 | Required fields in `StrategyChoiceOptions` block: |
||
68 | |||
69 | * `Name` |
||
70 | * `Strategy` |
||
71 | |||
72 | **Strategy** must be a `Name` that represents a builtin strategy: |
||
73 | |||
74 | * ndn:/localhost/nfd/strategy/best-route |
||
75 | * ndn:/localhost/nfd/strategy/broadcast |
||
76 | * ndn:/localhost/nfd/strategy/ncc |
||
77 | |||
78 | If the Strategy does not match any builtin strategy, the response has StatusCode 504. |
||
79 | |||
80 | ## Unset the strategy for a namespace |
||
81 | |||
82 | **command-verb:** `delete` |
||
83 | |||
84 | Required fields in `StrategyChoiceOptions` block: |
||
85 | |||
86 | * `Name` |
||
87 | |||
88 | After this operation, the effective strategy at Name is inherited from the parent. |
||
89 | |||
90 | If there is no strategy defined at Name, this command does nothing, but is still considered successful. |
||
91 | |||
92 | Name must not be `ndn:/`, otherwise the operation fails with StatusCode 403. |
||
93 | |||
94 | ## TLV-TYPE assignments |
||
95 | |||
96 | Type | Assigned value | Assigned value (hex) |
||
97 | ------------------------------------------- | ----------------- | -------------------- |
||
98 | 2 | Alex Afanasyev | StrategyChoiceOptions | 109 | 0x6d |
99 | 1 | Junxiao Shi | Strategy | 107 | 0x6b |