# FLINT: Flows for the Internet of Things
## 4 Flint Architecture
### Device Configuration  
FLINT device configurations are written in JavaScript Object Notation (JSON), based on the W3C Thing Description (TD) ontology. A standard TD is extended using three keys: IPv6, ioA adapterDefinitions and adapterScheme. ioA adapterDefinitions contain values required for bidirectional communication. The adapterScheme indicates how the different adapters are connected. An example is given in Listing 1. Figure 4: A directed graph constructed using the different types of adapters. Adapter _io-1_ is an I/O adapter. Adapter _p-1_ is a processing adapter and adapter _io-2_ is another I/O adapter. The mapper adapter passes the messages along the vertices. Adapter _d-1_ communicates directly with _io-2_. ```
{ \"id\": \"urn:5f3 cc650-c91a-477f-9726-f5f27097b6c7\", \"@context\": \"[[https://www.w3.org/2019/wot/td/v1](https://www.w3.org/2019/wot/td/v1)]([https://www.w3.org/2019/wot/td/v1](https://www.w3.org/2019/wot/td/v1))\", \"title\": \"SampleDevice\", \"ipv6\": [\"2001:0 db8:85a3:0000:0000:8a2e:0370:7334\"], \"ioAdapterDefinitions\": [{ \"uuid\": \"urn:uuid:cc0c1e3b-ce09-4c44-b9 da-57 ee9871497a\", \"deviceDefinitions\": [ \"interfaceType\": \"continuous\" \"mac\": \"0004a30b0024e96c\" ] }, { \"uuid\": \"urn:uuid:489 edd56-4b1c-4332-a5 ba-cad14994668d\", \"deviceDefinitions\": { \"interfaceType\": \"uplink_triggered\", \"mac\": \"92 BC10\" ] }, { \"uuid\": \"urn:uuid:1323b31a-1 af7-4548-aad7-89f45f7b5713\", \"deviceDefinitions\": { \"id\": \"2\" ] }], \"adapterScheme\": [ [ \"urn:cc0c1e3b-ce09-4c44-b9 da-57 ee9871497a\", \"urn:uuid:489 edd56-4b1c-4332-a5 ba-cad14994668d\"] [\"urn:uuid:8b6092c2-09a4-4 aca-aca2-2948195c10 de\"], [\"urn:uuid:1323b31a-1 af7-4548-aad7-89f45f7b5713\"] ], [ [\"urn:uuid:1323b31a-1 af7-4548-aad7-89f45f7b5713\"], [\"urn:cc0c1e3b-ce09-4c44-b9 da-57 ee9871497a\", \"urn:uuid:489 edd56-4b1c-4332-a5 ba-cad14994668d\"] ] ],... }
```  
**Listing 1**A Thing Description contains a list of adapter definitions. These adapters can be used in a scheme to construct a directed graph. An iod adapterDefinition contains routing information. Every definition can be linked to an adapter using its uuid. The _Mapper_ adapter also requires the MAC address of every I/O interface to uniquely target a device and manage the queue based on the interfaceType. These types can be divided in three groups. A continuous interface can be reached at any given moment. A beacon interface can be interfaced with during predefined intervals and an uplink_triggered interface can be reached only after an uplink transmission. The adapterScheme is a JSON array constructed of _chains_ that contain _shackles_, which on their turn contain a list of adapters. A chain starts with an array of I/O adapters (a shackle). Every adapter in this array can be a possible source of data. The _Mapper_ adapter will therefore keep track of the last active adapter in this shackle. The chain ends with a shackle of I/O adapters. Processing adapters can be added at any level in between them. Every shackle in the chain indicates a hop. An adapter that receives a packet on its input will forward the processed packet to _every_ adapter in the next hop. The example adapterScheme in Listing 1 contains two chains. The first chain is used for traffic flowing in the upward direction and contains three shackles. The first shackle contains two adapters that are used to interface with the device directly. Data from any of these adapters will flow to the adapter in the next shackle that contains a processing adapter (urn:uuid:8b6092c2-09a4-4 aca-aca2-2948195c10 de). The last shackle in the chain will output the processed data to a given destination. The second chain contains the inverted configuration, used for communication in the **downward** direction. In this example, the processing adapter is not required for communication in this direction and is removed from the chain. The last shackle again contains the two adapters that can interface directly with the device. The _Mapper_ adapter keeps track of the last active adapter to forward data to.