FaceMgmt » History » Version 46
  Junxiao Shi, 08/20/2015 02:00 PM 
  
| 1 | 20 | Junxiao Shi | # Face Management | 
|---|---|---|---|
| 2 | 1 | Junxiao Shi | |
| 3 | 38 | Alex Afanasyev | {{toc}} | 
| 4 | |||
| 5 | 20 | Junxiao Shi | **Face Management** is a module of [[Management|NFD Management protocol]]. | 
| 6 | It provides: | ||
| 7 | 1 | Junxiao Shi | |
| 8 | 20 | Junxiao Shi | * commands to create and destroy faces | 
| 9 | * commands to enable and disable [[LocalControlHeader]] features on a face | ||
| 10 | * a dataset of description of all active faces and their counters | ||
| 11 | 33 | Junxiao Shi | * a dataset of description of all active channels | 
| 12 | 20 | Junxiao Shi | * a notification stream for face creating and destroying events | 
| 13 | 1 | Junxiao Shi | |
| 14 | 45 | Junxiao Shi | Face Management commands, datasets, and notifications are available under namespace `ndn:/localhost/nfd/faces`. | 
| 15 | 12 | Alex Afanasyev | |
| 16 | |||
| 17 | 20 | Junxiao Shi | ## FaceUri | 
| 18 | 1 | Junxiao Shi | |
| 19 | 27 | Junxiao Shi | A FaceUri represents the underlying protocol and address used by a Face. | 
| 20 | Every Face has two FaceUris: one for local endpoint, and the other for remote endpoint. | ||
| 21 | 1 | Junxiao Shi | |
| 22 | 27 | Junxiao Shi | ### UDP | 
| 23 | 9 | Junxiao Shi | |
| 24 | 30 | Junxiao Shi | `udp[4|6]://<IP-or-host>[:<port>]` | 
| 25 | 2 | Alex Afanasyev | |
| 26 | 9 | Junxiao Shi | Examples: | 
| 27 | 1 | Junxiao Shi | |
| 28 | 20 | Junxiao Shi | * `udp4://192.0.2.1:6363` (canonical form) | 
| 29 | * `udp6://[2001:db8::1]:6363` (canonical form) | ||
| 30 | 1 | Junxiao Shi | * `udp://192.0.2.1` (remote-port defaults to 6363) | 
| 31 | * `udp://example.net:6363` | ||
| 32 | * `udp4://example.net:6363` (resolve hostname to IPv4 address only) | ||
| 33 | 9 | Junxiao Shi | * `udp6://example.net:6363` (resolve hostname to IPv6 address only) | 
| 34 | 27 | Junxiao Shi | * `udp4://224.0.23.170:56363` (multicast, canonical form) | 
| 35 | 1 | Junxiao Shi | |
| 36 | ### TCP | ||
| 37 | |||
| 38 | 30 | Junxiao Shi | `tcp[4|6]://<IP-or-host>[:<port>]` | 
| 39 | 1 | Junxiao Shi | |
| 40 | Examples: | ||
| 41 | |||
| 42 | 20 | Junxiao Shi | * `tcp4://192.0.2.1:6363` (canonical form) | 
| 43 | * `tcp6://[2001:db8::1]:6363` (canonical form) | ||
| 44 | 1 | Junxiao Shi | * `tcp://192.0.2.1` (remote-port defaults to 6363) | 
| 45 | * `tcp://example.net:6363` | ||
| 46 | 9 | Junxiao Shi | * `tcp4://example.net:6363` (resolve hostname to IPv4 address only) | 
| 47 | 1 | Junxiao Shi | * `tcp6://example.net:6363` (resolve hostname to IPv6 address only) | 
| 48 | |||
| 49 | ### UNIX stream | ||
| 50 | 9 | Junxiao Shi | |
| 51 | 1 | Junxiao Shi | `unix://<path>` | 
| 52 | 9 | Junxiao Shi | |
| 53 | 1 | Junxiao Shi | Examples: | 
| 54 | |||
| 55 | * `unix:///var/run/nfd.sock` (note there are three forward-slashes after 'unix') | ||
| 56 | |||
| 57 | 30 | Junxiao Shi | ### File Descriptor | 
| 58 | |||
| 59 | `fd://<file-descriptor>` | ||
| 60 | |||
| 61 | Examples: | ||
| 62 | |||
| 63 | * `fd://6` | ||
| 64 | |||
| 65 | 1 | Junxiao Shi | ### Ethernet | 
| 66 | 27 | Junxiao Shi | |
| 67 | 42 | Junxiao Shi | `ether://[<MAC>]` | 
| 68 | 1 | Junxiao Shi | |
| 69 | Examples: | ||
| 70 | |||
| 71 | 42 | Junxiao Shi | * `ether://[08:00:27:01:01:01]` | 
| 72 | * `ether://[33:33:01:01:01:01]` (multicast) | ||
| 73 | 1 | Junxiao Shi | |
| 74 | 30 | Junxiao Shi | ### Network Device | 
| 75 | 1 | Junxiao Shi | |
| 76 | 30 | Junxiao Shi | `dev://<ifname>` | 
| 77 | |||
| 78 | Examples: | ||
| 79 | |||
| 80 | * `dev://eth0` | ||
| 81 | |||
| 82 | ### Underlying protocol and FaceUri scheme | ||
| 83 | |||
| 84 | Underlying protocol | remote FaceUri scheme | local FaceUri scheme | ||
| 85 | ------------------- | -------------------------------- | -------------------------- | ||
| 86 | IPv4 UDP unicast | udp4 | udp4 | ||
| 87 | IPv6 UDP unicast | udp6 | udp6 | ||
| 88 | IPv4 UDP multicast | udp4 (multicast IP) | udp4 (local IP, same port) | ||
| 89 | IPv4 TCP | tcp4 | tcp4 | ||
| 90 | IPv6 TCP | tcp6 | tcp6 | ||
| 91 | UNIX stream | fd (file descriptor on NFD side) | unix (socket path) | ||
| 92 | Ethernet multicast | ether | dev | ||
| 93 | |||
| 94 | 46 | Junxiao Shi | ## Static Face Attributes | 
| 95 | |||
| 96 | **FaceScope** indicates whether the face is local for [[ScopeControl|scope control]] purposes. | ||
| 97 | |||
| 98 | * non-local(=0) | ||
| 99 | * local(=1) | ||
| 100 | |||
| 101 | **FacePersistency** indicates whether the face is persistent. | ||
| 102 | |||
| 103 | * on-demand(=1), face closes if it remains idle for some time | ||
| 104 | * persistent(=0), face remains open until it's explicitly destroyed or there's a transport failure | ||
| 105 | * permanent(=2), face remains open until it's explicitly destroyed; transport failures will be recovered internally | ||
| 106 | |||
| 107 | **LinkType** indicates the type of communication link. | ||
| 108 | |||
| 109 | * point-to-point(=0), communication with one peer | ||
| 110 | * multi-access(=1), communication with a multicast group | ||
| 111 | |||
| 112 | 1 | Junxiao Shi | ## Control Commands | 
| 113 | 20 | Junxiao Shi | |
| 114 | 1 | Junxiao Shi | [[ControlCommand]] **management-module**: `faces` | 
| 115 | |||
| 116 | 20 | Junxiao Shi | ### Create a face | 
| 117 | 1 | Junxiao Shi | |
| 118 | 41 | Junxiao Shi | **command-verb**: `create` | 
| 119 | |||
| 120 | 1 | Junxiao Shi | ControlParameters fields: | 
| 121 | |||
| 122 | 46 | Junxiao Shi | * Uri (required): a canonical UDP unicast or TCP FaceUri | 
| 123 | * FacePersistency (optional): either *persistent* or *permanent*; creating on-demand faces is disallowed. | ||
| 124 | See "static face attributes" for more information. | ||
| 125 | 1 | Junxiao Shi | |
| 126 | 20 | Junxiao Shi | This command allows creation of UDP unicast and TCP faces only. | 
| 127 | 46 | Junxiao Shi | If another face with same underlying protocol and remote address exists, the command is considered successful, and FaceId of that face is returned; | 
| 128 | If the existing face has a different FacePersistency property, the transition on the direction of *on-demand* -> *persistent* -> *permanent* is allowed. | ||
| 129 | 1 | Junxiao Shi | |
| 130 | 20 | Junxiao Shi | If the command succeeds, \<Body> in ControlResponse block contains updated ControlParameters: | 
| 131 | 1 | Junxiao Shi | |
| 132 | 20 | Junxiao Shi | * FaceId | 
| 133 | 46 | Junxiao Shi | * FacePersistency | 
| 134 | 1 | Junxiao Shi | |
| 135 | ### Destroy a face | ||
| 136 | |||
| 137 | **command-verb:** `destroy` | ||
| 138 | |||
| 139 | 20 | Junxiao Shi | ControlParameters fields: | 
| 140 | 1 | Junxiao Shi | |
| 141 | 20 | Junxiao Shi | * FaceId (required) | 
| 142 | 1 | Junxiao Shi | |
| 143 | If the specified face does not exist, this command does nothing, but is still considered successful. | ||
| 144 | 20 | Junxiao Shi | |
| 145 | ### Enable a LocalControlHeader feature | ||
| 146 | |||
| 147 | **command-verb**: `enable-local-control` | ||
| 148 | |||
| 149 | ControlParameters fields: | ||
| 150 | |||
| 151 | 43 | Junxiao Shi | * LocalControlFeature (required): 1=IncomingFaceId, 2=NextHopFaceId, 3=CachingPolicy | 
| 152 | 26 | Junxiao Shi | |
| 153 | 20 | Junxiao Shi | This command can only operate on the requesting face. | 
| 154 | |||
| 155 | ### Disable a LocalControlHeader feature | ||
| 156 | |||
| 157 | 1 | Junxiao Shi | **command-verb**: `disable-local-control` | 
| 158 | 20 | Junxiao Shi | |
| 159 | 26 | Junxiao Shi | ControlParameters fields: | 
| 160 | 20 | Junxiao Shi | |
| 161 | 39 | Junxiao Shi | * LocalControlFeature (required): 1=IncomingFaceId, 2=NextHopFaceId, 3=CachingPolicy | 
| 162 | 1 | Junxiao Shi | |
| 163 | 40 | Junxiao Shi | This command can only operate on the requesting face. | 
| 164 | 39 | Junxiao Shi | |
| 165 | 1 | Junxiao Shi | ## Face Dataset | 
| 166 | |||
| 167 | 40 | Junxiao Shi | Description and counters of all active faces are published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/faces/list`. | 
| 168 | 1 | Junxiao Shi | |
| 169 | Each face is represented by a **FaceStatus** block: | ||
| 170 | 39 | Junxiao Shi | |
| 171 | FaceStatus ::= FACE-STATUS-TYPE TLV-LENGTH | ||
| 172 | 1 | Junxiao Shi | FaceId | 
| 173 | 39 | Junxiao Shi | Uri (remote FaceUri) | 
| 174 | LocalUri | ||
| 175 | 37 | Junxiao Shi | ExpirationPeriod? | 
| 176 | 39 | Junxiao Shi | FaceScope | 
| 177 | 1 | Junxiao Shi | FacePersistency | 
| 178 | LinkType | ||
| 179 | NInInterests | ||
| 180 | NInDatas | ||
| 181 | 46 | Junxiao Shi | NInNacks | 
| 182 | 1 | Junxiao Shi | NOutInterests | 
| 183 | 39 | Junxiao Shi | NOutDatas | 
| 184 | 46 | Junxiao Shi | NOutNacks | 
| 185 | |||
| 186 | Uri ::= URI-TYPE TLV-LENGTH | ||
| 187 | FaceUri in UTF-8 encoding | ||
| 188 | |||
| 189 | 39 | Junxiao Shi | LocalUri ::= LOCAL-URI-TYPE TLV-LENGTH | 
| 190 | 46 | Junxiao Shi | FaceUri in UTF-8 encoding | 
| 191 | 1 | Junxiao Shi | |
| 192 | 46 | Junxiao Shi | ; other TLVs have nonNegativeInteger as value | 
| 193 | 1 | Junxiao Shi | |
| 194 | * **Uri** is a FaceUri representing remote endpoint. | ||
| 195 | * **LocalUri** is a FaceUri representing local endpoint. | ||
| 196 | 40 | Junxiao Shi | * **ExpirationPeriod** is the remaining lifetime of this face. | 
| 197 | 39 | Junxiao Shi | If this field is omitted, the face has infinite lifetime. | 
| 198 | Currently, this is applicable to on-demand datagram faces only. | ||
| 199 | 40 | Junxiao Shi | * **FaceScope** indicates whether the face is local for [[ScopeControl|scope control]] purposes. | 
| 200 | 46 | Junxiao Shi | See "static face attributes" for more information. | 
| 201 | 40 | Junxiao Shi | * **FacePersistency** indicates whether the face is persistent. | 
| 202 | 46 | Junxiao Shi | See "static face attributes" for more information. | 
| 203 | 40 | Junxiao Shi | * **LinkType** indicates the type of communication link | 
| 204 | 46 | Junxiao Shi | See "static face attributes" for more information. | 
| 205 | * **NInInterests**: number of incoming Interest packets since the face is established. | ||
| 206 | * **NInDatas** counts the number of incoming Data packets since the face is established. | ||
| 207 | * **NInNacks** counts the number of incoming Nack packets since the face is established. | ||
| 208 | * **NOutInterests** counts the number of outgoing Interest packets since the face is established. | ||
| 209 | * **NOutDatas** counts the number of outgoing Data packets since the face is established. | ||
| 210 | * **NOutNacks** counts the number of outgoing Nack packets since the face is established. | ||
| 211 | 1 | Junxiao Shi | * **NInBytes** counts the number of bytes of link layer packets received via this face. | 
| 212 | This counter is initialized to zero when the face is established, and can wrap around after overflowing unsigned 64-bit integer range. | ||
| 213 | 37 | Junxiao Shi | * **NOutBytes** counts the number of bytes of link layer packets sent via this face. | 
| 214 | This counter is initialized to zero when the face is established, and can wrap around after overflowing unsigned 64-bit integer range. | ||
| 215 | |||
| 216 | ### Query Operation | ||
| 217 | |||
| 218 | The query operation allows one to retrieve a subset of face dataset that contains faces satisfying a filter. | ||
| 219 | |||
| 220 | 1 | Junxiao Shi | To run a query, the consumer should express an Interest with Name: `ndn:/localhost/nfd/faces/query/<filter>`, where `<filter>` is a **FaceQueryFilter** block that specifies zero or more conditions. | 
| 221 | 37 | Junxiao Shi | |
| 222 | FaceQueryFilter ::= FACE-QUERY-FILTER-TYPE TLV-LENGTH | ||
| 223 | FaceId? | ||
| 224 | UriScheme? | ||
| 225 | Uri? | ||
| 226 | 40 | Junxiao Shi | LocalUri? | 
| 227 | FaceScope? | ||
| 228 | FacePersistency? | ||
| 229 | 37 | Junxiao Shi | LinkType? | 
| 230 | |||
| 231 | 1 | Junxiao Shi | UriScheme ::= URI-SCHEME-TYPE TLV-LENGTH | 
| 232 | 37 | Junxiao Shi | string in UTF-8 | 
| 233 | |||
| 234 | * **FaceId** permits a face if its FaceId equals the value | ||
| 235 | * **UriScheme** permits a face if the scheme part of its local FaceUri or remote FaceUri equals the value | ||
| 236 | * **Uri** permits a face if its remote FaceUri equals the value | ||
| 237 | 40 | Junxiao Shi | * **LocalUri** permits a face if its local FaceUri equals the value | 
| 238 | * **FaceScope** permits a face if its *FaceScope* attribute equals the value | ||
| 239 | * **FacePersistency** permits a face if its *FacePersistency* attribute equals the value | ||
| 240 | 1 | Junxiao Shi | * **LinkType** permits a face if its *LinkType* attribute equals the value | 
| 241 | |||
| 242 | 39 | Junxiao Shi | A face must satisfy ALL conditions to satisfy the filter. | 
| 243 | 37 | Junxiao Shi | Faces that satisfy the filter are represented by **FaceStatus** blocks, and published as a [[StatusDataset]] under the Interest Name (a Data packet's Name would be `ndn:/localhost/nfd/faces/query/<filter>/<version>/<segment>`). | 
| 244 | |||
| 245 | Examples of filters: | ||
| 246 | 1 | Junxiao Shi | |
| 247 | 37 | Junxiao Shi | * a specific face: FaceId=260 | 
| 248 | 41 | Junxiao Shi | * a specific TCP tunnel: Uri=tcp4://192.0.2.1:6363 | 
| 249 | 37 | Junxiao Shi | note: FaceUri must precisely match the canonical form: use either "tcp4" or "tcp6" instead of "tcp", use IP address instead of DNS name, include port number | 
| 250 | 33 | Junxiao Shi | * all TCP tunnels: UriScheme=tcp | 
| 251 | 40 | Junxiao Shi | note: "tcp" permits both "tcp4" and "tcp6", "udp" permits both "udp4" and "udp6" | 
| 252 | 33 | Junxiao Shi | * all UDP multicast faces: UriScheme=udp & LinkType=multi-access | 
| 253 | * all Ethernet faces: UriScheme=ether | ||
| 254 | note: UriScheme matches on both local and remote FaceUri, "dev" also works | ||
| 255 | * all faces: no condition | ||
| 256 | note: this is equivalent to face dataset, and face dataset should be preferred for this purpose | ||
| 257 | 1 | Junxiao Shi | |
| 258 | ## Channel Dataset | ||
| 259 | |||
| 260 | 33 | Junxiao Shi | Description of all active channels is published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/faces/channels`. | 
| 261 | |||
| 262 | Each channel is represented by a **ChannelStatus** block: | ||
| 263 | 20 | Junxiao Shi | |
| 264 | 1 | Junxiao Shi | ChannelStatus := CHANNEL-STATUS-TYPE TLV-LENGTH | 
| 265 | LocalUri | ||
| 266 | 20 | Junxiao Shi | |
| 267 | * **LocalUri** is a FaceUri representing local endpoint. | ||
| 268 | 21 | Alex Afanasyev | |
| 269 | 20 | Junxiao Shi | ## Face Status Change Notification | 
| 270 | 1 | Junxiao Shi | |
| 271 | 21 | Alex Afanasyev | Face status change events are published as a [[Notification|Notification Stream]] at `ndn:/localhost/nfd/faces/events`. | 
| 272 | 37 | Junxiao Shi | Notifications of all faces are sent into the same notification stream. | 
| 273 | |||
| 274 | The Content of each notification Data packet is a `FaceEventNotification` block: | ||
| 275 | 1 | Junxiao Shi | |
| 276 | 37 | Junxiao Shi | FaceEventNotification ::= FACE-EVENT-NOTIFICATION-TYPE TLV-LENGTH | 
| 277 | FaceEventKind | ||
| 278 | 23 | Alex Afanasyev | FaceId | 
| 279 | 37 | Junxiao Shi | Uri | 
| 280 | 40 | Junxiao Shi | LocalUri | 
| 281 | FaceScope | ||
| 282 | FacePersistency | ||
| 283 | 25 | Junxiao Shi | LinkType | 
| 284 | 23 | Alex Afanasyev | |
| 285 | FaceEventKind ::= FACE-EVENT-KIND-TYPE TLV-LENGTH | ||
| 286 | 25 | Junxiao Shi | nonNegativeInteger | 
| 287 | 23 | Alex Afanasyev | |
| 288 | 9 | Junxiao Shi | **FaceEventKind** indicates the kind of event. Its possible values are: | 
| 289 | |||
| 290 | * **1**: face is created | ||
| 291 | 1 | Junxiao Shi | * **2**: face is destroyed | 
| 292 | 34 | Junxiao Shi | |
| 293 | 33 | Junxiao Shi | ## TLV-TYPE assignments | 
| 294 | 32 | Junxiao Shi | |
| 295 | 20 | Junxiao Shi | Type | Assigned value | Assigned value (hex) | 
| 296 | ------------------------------------------- | ----------------- | -------------------- | ||
| 297 | FaceStatus | 128 | 0x80 | ||
| 298 | 39 | Junxiao Shi | LocalUri | 129 | 0x81 | 
| 299 | 40 | Junxiao Shi | ChannelStatus | 130 | 0x82 | 
| 300 | FaceScope | 132 | 0x84 | ||
| 301 | FacePersistency | 133 | 0x85 | ||
| 302 | 24 | Alex Afanasyev | LinkType | 134 | 0x86 | 
| 303 | 1 | Junxiao Shi | NInInterests | 144 | 0x90 | 
| 304 | NInDatas | 145 | 0x91 | ||
| 305 | NOutInterests | 146 | 0x92 | ||
| 306 | NOutDatas | 147 | 0x93 | ||
| 307 | NInBytes | 148 | 0x94 | ||
| 308 | 44 | Junxiao Shi | NOutBytes | 149 | 0x95 | 
| 309 | 1 | Junxiao Shi | FaceQueryFilter | 150 | 0x96 | 
| 310 | UriScheme | 131 | 0x83 | ||
| 311 | FaceEventNotification | 192 | 0xc0 | ||
| 312 | 39 | Junxiao Shi | FaceEventKind | 193 | 0xc1 | 
| 313 | 1 | Junxiao Shi | (reserved, formerly FaceFlags) | 194 | 0xc2 |