Project

General

Profile

StrategyChoice » History » Version 3

Junxiao Shi, 03/04/2014 08:25 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 3 Junxiao Shi
**Strategy Choice protocol** supports two operations:
59 1 Junxiao Shi
60 3 Junxiao Shi
* **set**: set the strategy for a namespace
61
* **unset**: unset the strategy for a namespace
62 1 Junxiao Shi
63
## Set the strategy for a namespace
64
65 3 Junxiao Shi
**command-verb:** `set`
66 1 Junxiao Shi
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 3 Junxiao Shi
* ndn:/localhost/nfd/strategy/client-control
77 1 Junxiao Shi
* ndn:/localhost/nfd/strategy/ncc
78
79
If the Strategy does not match any builtin strategy, the response has StatusCode 504.
80
81
## Unset the strategy for a namespace
82
83 3 Junxiao Shi
**command-verb:** `unset`
84 1 Junxiao Shi
85
Required fields in `StrategyChoiceOptions` block:
86
87
* `Name`
88
89
After this operation, the effective strategy at Name is inherited from the parent.
90
91
If there is no strategy defined at Name, this command does nothing, but is still considered successful.
92
93
Name must not be `ndn:/`, otherwise the operation fails with StatusCode 403.
94
95
## TLV-TYPE assignments
96
97
Type                                        | Assigned value    | Assigned value (hex)
98
------------------------------------------- | ----------------- | --------------------
99 2 Alex Afanasyev
StrategyChoiceOptions                       | 109               | 0x6d
100 1 Junxiao Shi
Strategy                                    | 107               | 0x6b