f7ef5a8abb6ff6af8b820eb40256243419248c3b
[skm-ma-ws1314.git] / sec-chatty-things.tex
1 \section{System Architecture of ``Chatty Things''}
2
3 After the underlying techniques have been explained, we can have a look at the
4 system architecture which Klauck and
5 Kirsche~\cite{Klauck:2012:BCC:2352852.2352881} use to build Chatty Things.
6
7 \pages{3}
8 \subsection{Service Provisioning Sublayer}
9
10 Considering the application in deeply embedded systems and the special needs of
11 the Internet of Things on the one hand, the protocol stack needs to fulfil
12 certain technical requirements.
13
14 First, memory, computing resources and bandwith on embedded systems are limited,
15 which demands for a lightweight protocol stack without too much overhead and
16 predictable memory consumption, while also retaining enough flexibility for
17 future development. The authors therefore provide only the most essential
18 functions of XMPP (presence and message exchange, multi-user chats) to achieve
19 basic communication, grouping of devices, and information filtering to prevent
20 information overflow.
21
22 Their solution builds on the \term{Contiki} operating system on an MSP430 board,
23 and uses the \term{uXMPP} project, which already implements core XMPP features
24 and serves as a starting point for implementing further XEPs. However, as the
25 uXMPP project was still in early development, they first needed to enhance its
26 functionality to comply with the limited resources. In particular, they
27 optimized the message flow and enabled uXMPP to fully use the available payload
28 instead of sending one TCP packet per message and reduced the code footprint
29 through compiler flags and refactoring.
30
31 Furthermore, Klauck and Kirsche implemented new features for uXMPP, which were
32 realized as separate modules to allow enabling and disabling them at runtime,
33 thus further reducing the memory footprint of a running system:
34
35 \todo[minimize space between list items]
36 \begin{itemize}
37 \item support for IPv6
38 \item support for Multi-User Chats (XEP-0045), which are used for information
39 filtering
40 \item support for SASL ANONYMOUS login for XMPP servers \ref{xep-0175}
41 \item a new publish-subscribe mechanism called Temporary Subscription for
42 Presence (see \ref{sec:tsp})
43 \item XMPP Serverless Messaging (XEP-0174), using \term{uBonjour} as
44 underlying mDNS/DNS-SD implementation for Contiki.
45 \end{itemize}
46
47 The resulting implementation (uXMPP and uBonjour) gets by with 12{.}2\ kBytes of
48 ROM and 0{.}63\ kBytes of RAM, which was about the size of the original,
49 unoptimized uXMPP implementation while also implementing new features.
50
51 \todo[figure of example network structure with and without central server]
52
53 In order to react to different network infrastructures, their implementation
54 allows both communication with a central XMPP server as well as peer-to-peer
55 communication over XMPP Serverless Messaging. When a central XMPP server is
56 detected over uBonjour, it is used instead with the ANONYMOUS login method, and the
57 XEP-0174 module is disabled. The ANONYMOUS login method is chosen since TLS
58 encryption is not yet implemented, and it assigns random JID to the client,
59 which do not need to exist on the server. However, a server must exist and must
60 be configured in order to use this method.
61
62 With a server, information filtering is achieved by creating topic-based
63 Multi-User Chats where multiple devices can be grouped. A user can then simply
64 join the chat with a standard XMPP client on her machine and interact with all
65 devices of a topic, or she can also interact with them directly.
66
67 In scenarios without an XMPP server, the XEP-0174 module is activated and
68 devices talk directly with the user or with other devices. This method has the
69 drawback that Multi-User Chats cannot be used for topic filtering, since no
70 method is specified to do XEP-0045 and XEP-0174 at the same time. In this case,
71 a user must have an XEP-0174-compliant chat client, but it also gives her the
72 opportunity to interact with things spontaneously on an ad-hoc basis (e.~g. when
73 entering a room) without need for any additional gateway on the application
74 level.
75
76 %low bandwith in IEEE~802.15.4 (less than 250 kib/s at a maximum of 122 byte per
77 %packet\footnote{according to the maximum MAC payload size in the IEEE~802.15.4-2011
78 %specification}
79
80 \subsection{Bootstrapping}
81
82 In a distributed context like the Internet of Things, devices need to be ready
83 to use out of the box. Users often do not want to set up configurations for each
84 device they use, and when using several of those devices, it is often not
85 reasonable having to configure every single one.
86
87 With the given approach, bootstrapping new Chatty Things is easy and no
88 configuration is neccessary: on the network layer, IP addresses can simply be
89 obtained using IPv4 Link-Local Addressing or IPv6 Stateless Address
90 Autoconfiguration. On the transport layer, all needed ports can be obtained over
91 DNS-Based Service Discovery. Finally, on the application layer, host names can
92 be resolved over Multicast DNS; and for the actual communication between devices
93 it is possible to use auto-generated JIDs with the ANONYMOUS login method on an
94 existing XMPP server, or if no server is found, use peer-to-peer communication
95 over XMPP Serverless Messaging.
96
97 Bootstrapping a Chatty Thing therefore incorporates three steps:
98
99 \begin{enumerate}
100 \item Activate uBonjour and try to discover an XMPP server
101 \item If a server is found, connect to it using ANONYMOUS login, join
102 topic-based Multi-User Chats, deactivate the uBonjour client
103 \term(Infrastructure mode).
104 \item If no server is found, activate the XEP-0174 client \term{Ad-hoc mode}.
105 \end{enumerate}
106
107 During runtime, a device can then react to changes in network infrastructure:
108
109 \begin{itemize}
110 \item In Infrastructure mode: when connection to the server is lost, enable
111 the uBonjour client, try to find a server, and when none is found, enable
112 Serverless Messaging.
113 \item In Ad-hoc mode: if uBonjour detects a new XMPP server joining the
114 network, try to connect to it. If this succeeds, disable Serverless
115 Messaging and uBonjour and join topic-based Multi-User Chats.
116 \end{itemize}
117
118 \todo[short conclusion?]
119
120 \subsection{Temporary Subscription for Presence}\label{sec:tsp}
121
122 To further reduce the message overhead and allow more fine-grained controls over
123 information filtering, \term{Temporary Subscription for Presence} is introduced.
124 This technique builds on top of presence stanzas as defined in core XMPP. These
125 presence stanzas are sent without a \code{to} or \code{from} attribute, and
126 therefore fit into a single TCP/IP packet over IEEE~802.15.4. However, to be
127 able to receive these stanzas, a client must manually subscribe to those
128 information in their roster, which requires further communication between nodes. As the network
129 can change rapidly, subscriptions would be often outdated, and there would be
130 much overhead of subscriptions and unsubscription packets, which would inhibit
131 the flow of the actual information.
132
133 To solve this problem, a dynamic, topic-based roster is implemented on top of
134 Multi-User Chats (XEP-0045). Every topic corresponds with a chat room, and nodes
135 join the chat rooms which they are interested in. This allows nodes to inform
136 only interested nodes about updates. This has the advantage that existing
137 clients supporting Multi-User Chats can be used by a user, but Chatty Things and
138 XMPP servers need to be adapted to the new subscription model. Also, this
139 mechanism does not work with Serverless Messaging.
140
141 % vim: set ft=tex et ts=2 sw=2 :
This page took 0.049734 seconds and 3 git commands to generate.