blob: 5453cb50561a76d0d7248a141a12b8d92bbb0ae6 [file] [log] [blame]
Alexander Afanasyevca58dc22013-12-28 21:04:59 +00001.. _Face Registration:
2
3Face Management and Registration Protocol
4-----------------------------------------
5
6Face Management Protocol
7^^^^^^^^^^^^^^^^^^^^^^^^
8
9The Face Management Protocol provides a method for an entity such as ndndc to control
10the faces maintained by ndnd, which are subsequently used in the Registration Protocol.
11
12The FMP supports ``newface``, ``destroyface``, and ``queryface`` operations.
13
14A request operation is represented as a NDN Interest with
15a NDN Data in NDN-TLV encoding, while the majority of the request parameters embedded
16as a component of the Interest name.
17A response is represented as a Data for which the name matches the Interest,
18and the content encodes any necessary response data.
19
20For the Face Management Protocol, the content of the Data packet is FaceInstance object
21as defined below.
22
23For example, the following steps necessary to create a new face:
24
25- Create NDN-TLV encoded FaceInstance object, containing action ``newface`` and other
26 necessary fields to set up the face (e.g., ``IPProto``, ``Host``, ``Port``).
27
28- Create NDN-TLV encoded Data packet (``<NFBLOB>``), whose content is the encoded
29 FaceInstance object
30
31- Express an Interest ``/ndnx/<NDNDID>/newface/<NFBLOB>``, where
32
33 * ``<NDNDID>`` is the SHA256 of the public key of the forwarding daemon.
34
35 * ``<NFBLOB>`` is encoded Data packet with encoded FaceInstance object as content.
36
37The verb, ``newface`` occurs redundantly in both the Interest prefix and in the ``NFBLOB``.
38Its presence in the prefix is for dispatching the request.
39It is also in the ``NFBLOB``, so that it is signed.
40
41The forwarding daemon creates the new face and answers with a FaceInstance containing
42at least the ``FaceID``.
43
44FaceInstance
45^^^^^^^^^^^^
46
47::
48
49 FaceInstance ::= FACE-INSTANCE-TYPE TLV-LENGTH
50 Action?
51 FaceID?
52 IPProto?
53 Host?
54 Port?
55 MulticastInterface?
56 MulticastTTL?
57 FreshnessPeriod?
58
59 Action ::= ACTION-TYPE TLV-LENGTH
60 ("newface" | "destroyface" | "queryface")
61
62 FaceID ::= FACEID-TYPE TLV-LENGTH
63 nonNegativeInteger
64
65 IPProto ::= FACEID-TYPE TLV-LENGTH
66 nonNegativeInteger
67 (*IANA protocol number; 6=TCP, 17=UDP*)
68
69 Host ::= HOST-TYPE TLV-LENGTH
70 <textual representation of numeric IPv4 or IPv6 address>
71
72 Port ::= PORT-TYPE TLV-LENGTH
73 nonNegativeInteger
74 (* from the range [1..65535] *)
75
76 MulticastInterface ::= MULTICAST-INTERFACE-TYPE TLV-LENGTH
77 <textual representation of numeric IPv4 or IPv6 address>
78
79 MulticastTTL ::= MULTICAST-TTL-TYPE TLV-LENGTH
80 nonNegativeInteger
81 (* from the range [1..255] *)
82
83See :ref:`Data packet's meta info description <MetaInfo>` for definition of ``FreshnessPeriod``.
84
85Action
86++++++
87
88When FaceInstance is used as a request, the Action must be specified.
89It will not be present in a response.
90
91+-----------------+----------------------------------------------------------------------+
92| Action | Description |
93+=================+======================================================================+
94| ``newface`` | If a face matching the parameters does not already exist, an attempt |
95| | is made to create it. |
96| | |
97| | Then if the face exists (whether new or old) the full description is |
98| | returned as a FaceInstance. |
99+-----------------+----------------------------------------------------------------------+
100| ``destroyface`` | At least the FaceID must be present. |
101| | If permitted, the face is destroyed. |
102+-----------------+----------------------------------------------------------------------+
103| ``queryface`` | TBD |
104+-----------------+----------------------------------------------------------------------+
105
106FaceID
107++++++
108
109FaceID is not present in a `newface` request, but must be specified in
110a `destroyface` or `queryface` request.
111FaceID is always present in a response.
112
113Host
114++++
115
116Identifies the IPv4 or IPv6 numeric address of the remote ndnd for this
117FaceInstance.
118
119Port
120++++
121
122Port identifies the port on the remote ndnd, or the port for the multicast group.
123
124MulticastInterface
125++++++++++++++++++
126
127If the Host is a multicast address, and there are multiple
128interfaces present, MulticastInterface will identify the unicast
129numeric address of the interface to which the multicast address will be
130attached.
131
132MulticastTTL
133++++++++++++
134
135Specifies the TTL to be used for multicast operations. The default value is 1.
136
137FreshnessPeriod
138++++++++++++++++
139
140FreshnessPeriod is optional in a request, but is treated as a hint by the forwarding daemon.
141In a response, FreshnessPeriod specifies the remaining lifetime in milliseconds of the
142face.
143
144Prefix Registration Protocol
145^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146
147The prefix registration protocol uses the ForwardingEntry element type
148to represent both requests and responses.
149
150::
151
152 ForwardingEntry ::= FORWARDING-ENTRY TLV-LENGTH
153 Action?
154 Name?
155 FaceID?
156 ForwardingFlags?
157 FreshnessPeriod?
158
159 Action ::= ACTION-TYPE TLV-LENGTH
160 ("prefixreg" | "selfreg" | "unreg")
161
162 FaceID ::= FACEID-TYPE TLV-LENGTH
163 nonNegativeInteger
164
165 ForwardingFlags ::= FORWARDING-FLAGS TLV-LENGTH
166 nonNegativeInteger
167
168See :ref:`Name section <Name>` for definition of ``Name`` and
169:ref:`Data packet's meta info description <MetaInfo>` for definition of ``FreshnessPeriod``.
170
171
172Action
173++++++
174
175When ForwardingEntry is used as a request, the Action must be specified.
176It will not be present in a response.
177
178- `prefixreg` - Register (or re-register) the prefix on the specified face.
179- `selfreg` - Register (or re-register) the prefix on the current face; the
180 FaceID need not be present in the request, but if present it must match
181 the current face.
182- `unreg` - Remove the prefix registration for the specified face.
183
184FaceID
185++++++
186
187FaceID is required in `prefixreg` and `unreg` requests.
188FaceID is always present in a response.
189
190Name
191++++
192
193This is the name prefix to be acted on.
194
195ForwardingFlags
196+++++++++++++++
197
198This integer holds the inclusive OR of the following bit fields:
199
200+----------------------------+---------------+-----------------------------------------------------------------------------+
201| Flag mnemonic | Bit (decimal) | Description |
202+============================+===============+=============================================================================+
203| ``NDN_FORW_ACTIVE`` | 1 | Indicates that the entry is active; |
204| | | interests will not be sent for inactive entries (but see note below). |
205+----------------------------+---------------+-----------------------------------------------------------------------------+
206| ``NDN_FORW_CHILD_INHERIT`` | 2 | Denotes that this entry may be used even if there is a longer match |
207| | | available. In the absence of this bit, the presence of a longer matching |
208| | | prefix that has an active entry will prevent this entry from being used. |
209+----------------------------+---------------+-----------------------------------------------------------------------------+
210| ``NDN_FORW_ADVERTISE`` | 4 | Indicates that the prefix may be advertised to other nodes. |
211+----------------------------+---------------+-----------------------------------------------------------------------------+
212| ``NDN_FORW_LAST`` | 8 | Indicates that this entry should be used last, if nothing else worked. |
213| | | This is intended to be used by ndndc and similar programs to monitor |
214| | | unanswered interests. |
215| | | |
216| | | The presence of this flag on any entry causes the associated face to be |
217| | | considered non-local, as far as interest forwarding is concerned. |
218| | | Thus it will not receive interests with Scope=1, nor will it receive |
219| | | interests in namespaces that are marked local. However, the ability of |
220| | | the face to change prefix registrations is not affected. |
221+----------------------------+---------------+-----------------------------------------------------------------------------+
222| ``NDN_FORW_CAPTURE`` | 16 | Says that no shorter prefix may be used, overriding child-inherit bits that |
223| | | would otherwise make the shorter entries usable. |
224| | | |
225| | | For a child-inherit bit to be overridden, the ``NDN_FORW_CAPTURE_OK`` must |
226| | | be set in the same forwarding entry that has ``NDN_FORW_CHILD_INHERIT`` |
227| | | set. Note that this means that using ``NDN_FORW_CAPTURE`` will have no |
228| | | effect if the ``NDN_FORW_CAPTURE_OK`` flag is not used. |
229+----------------------------+---------------+-----------------------------------------------------------------------------+
230| ``NDN_FORW_LOCAL`` | 32 | Restricts the namespace to use by applications on the local machine. |
231| | | |
232+----------------------------+---------------+-----------------------------------------------------------------------------+
233| ``NDN_FORW_TAP`` | 64 | Causes the entry to be used right away. This is intended for debugging |
234| | | and monitoring purposes. It is likely that there will be no response as |
235| | | a result, so no intentional delay is added before any further forwarding |
236| | | of this interest. |
237+----------------------------+---------------+-----------------------------------------------------------------------------+
238| ``NDN_FORW_CAPTURE_OK`` | 128 | used in conjunction with ``NDN_FORW_CHILD_INHERIT`` allows a |
239| | | ``NDN_FORW_CAPTURE`` flag on a longer prefix to override the effect of |
240| | | the child-inherit bit. |
241+----------------------------+---------------+-----------------------------------------------------------------------------+
242
243The flags ``NDN_FORW_ADVERTISE``, ``NDN_FORW_CAPTURE`` and ``NDN_FORW_LOCAL`` affect
244the prefix as a whole, rather than the individual registrations.
245Their effects take place whether or not the ``NDN_FORW_ACTIVE`` bit is set.
246
247FreshnessPeriod
248+++++++++++++++
249
250FreshnessPeriod is optional in a request, but is treated as a hint by the forwarding daemon.
251In a response, FreshnessPeriod specifies the remaining lifetime in milliseconds of the registration.
252
253
254Type code assignment
255^^^^^^^^^^^^^^^^^^^^
256
257Face management and registration protocol uses the following type codes, which are assigned
258from the :ref:`application range (128-252) <type reservations>`.
259
260Some codes (e.g., `Name`, `FreshnessPeriod`), re-use code assignment from the NDN-TLV specification.
261
262+---------------------------------------------+-------------------+----------------+
263| Type | Assigned value | Assigned value |
264| | (decimal) | (hexadecimal) |
265+=============================================+===================+================+
266| **Application-specific definitions** |
267+---------------------------------------------+-------------------+----------------+
268| FaceInstance | 128 | 0x80 |
269+---------------------------------------------+-------------------+----------------+
270| ForwardingEntry | 129 | 0x81 |
271+---------------------------------------------+-------------------+----------------+
272| Action | 130 | 0x82 |
273+---------------------------------------------+-------------------+----------------+
274| FaceID | 131 | 0x83 |
275+---------------------------------------------+-------------------+----------------+
276| IPProto | 132 | 0x84 |
277+---------------------------------------------+-------------------+----------------+
278| Host | 133 | 0x85 |
279+---------------------------------------------+-------------------+----------------+
280| Port | 134 | 0x86 |
281+---------------------------------------------+-------------------+----------------+
282| MulticastInterface | 135 | 0x87 |
283+---------------------------------------------+-------------------+----------------+
284| MulticastTTL | 136 | 0x88 |
285+---------------------------------------------+-------------------+----------------+
286| ForwardingFlags | 137 | 0x89 |
287+---------------------------------------------+-------------------+----------------+
288| **Re-used definitions** |
289+---------------------------------------------+-------------------+----------------+
290| FreshnessPeriod | 20 | 0x14 |
291+---------------------------------------------+-------------------+----------------+
292| Name | 2 | 0x02 |
293+---------------------------------------------+-------------------+----------------+