13407c0de7bb885d306c2137938b159adc93a652
[skm-ma-ws1314.git] / sec-chatty-things.tex
1 \section{System Architecture of ``Chatty Things''}\label{sec:arch}
2
3 After the underlying techniques have been explained, we can now have a look at
4 the 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 \cite{xep0175}
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
57 the XEP-0174 module is disabled. The ANONYMOUS login method is chosen since TLS
58 encryption is not yet implemented, and with this method, the server assigns a
59 random JID to the client, which does not need to exist on the server. However, a
60 server must exist and must be configured to use this login method in order to
61 use this method.
62
63 With a server, information filtering is achieved by creating topic-based
64 Multi-User Chats where multiple devices can be grouped. A user can then simply
65 join the chat with a standard XMPP client on her machine and interact with all
66 devices of a topic, or she can also interact with them directly.
67
68 In scenarios without an XMPP server, the XEP-0174 module is activated and
69 devices talk directly with the user or with other devices. This method has the
70 drawback that Multi-User Chats cannot be used for topic filtering, since no
71 method is specified to do XEP-0045 and XEP-0174 at the same time. In this case,
72 a user must have an XEP-0174-compliant chat client, but it also gives her the
73 opportunity to interact with things spontaneously on an ad-hoc basis (e.~g. when
74 entering a room) without need for any additional gateway on the application
75 level.
76
77 %low bandwith in IEEE~802.15.4 (less than 250 kib/s at a maximum of 122 byte per
78 %packet\footnote{according to the maximum MAC payload size in the IEEE~802.15.4-2011
79 %specification}
80
81 \subsection{Bootstrapping}
82
83 With the given approach, bootstrapping new Chatty Things is easy and no
84 configuration is neccessary: on the network layer, IP addresses can simply be
85 obtained using IPv4 Link-Local Addressing or IPv6 Stateless Address
86 Autoconfiguration. On the transport layer, all needed ports can be obtained over
87 DNS-Based Service Discovery. Finally, on the application layer, host names can
88 be resolved over Multicast DNS; and for the actual communication between devices
89 it is possible to use auto-generated JIDs with the ANONYMOUS login method on an
90 existing XMPP server, or if no server is found, use peer-to-peer communication
91 over XMPP Serverless Messaging.
92
93 Bootstrapping a Chatty Thing therefore incorporates three steps:
94
95 \begin{enumerate}
96 \item Activate uBonjour and try to discover an XMPP server
97 \item If a server is found, connect to it using ANONYMOUS login, join
98 topic-based Multi-User Chats, deactivate the uBonjour client
99 \term(Infrastructure mode).
100 \item If no server is found, activate the XEP-0174 client \term{Ad-hoc mode}.
101 \end{enumerate}
102
103 During runtime, a device can then react to changes in network infrastructure:
104
105 \begin{itemize}
106 \item In Infrastructure mode: when connection to the server is lost, enable
107 the uBonjour client, try to find a server, and when none is found, enable
108 Serverless Messaging.
109 \item In Ad-hoc mode: if uBonjour detects a new XMPP server joining the
110 network, try to connect to it. If this succeeds, disable Serverless
111 Messaging and uBonjour and join topic-based Multi-User Chats.
112 \end{itemize}
113
114 \todo{short conclusion?}
115
116 \subsection{Temporary Subscription for Presence}\label{sec:tsp}
117
118 To further reduce the message overhead and allow more fine-grained control over
119 information filtering, \term{Temporary Subscription for Presence} is introduced.
120 This technique builds on top of presence stanzas as defined in core XMPP, which
121 are sent by default without a \code{to} or \code{from} attribute, and therefore
122 fit into a single TCP/IP packet over IEEE~802.15.4. However, a drawback of the
123 presence mechanism defined by core XMPP is the fact that a client must manually
124 subscribe to presence information of another client in order to receive it,
125 which requires further communication between the clients. Since the network can
126 change rapidly, and clients can frequently join and leave the network,
127 subscriptions would often be outdated and must be renewed, leading to overhead
128 of subscriptions and unsubscription packets, which would inhibit the flow of the
129 actual information.
130
131 To solve this problem, a dynamic, topic-based roster is implemented on top of
132 Multi-User Chats (XEP-0045). Every topic corresponds with a chat room, and nodes
133 join the chat rooms which they are interested in. This allows nodes to inform
134 only interested nodes about updates. This has the advantage that existing
135 clients supporting Multi-User Chats can be used by a user, but Chatty Things and
136 XMPP servers need to be adapted to the new subscription model. Also, this
137 mechanism does not work with Serverless Messaging.
138
139 % vim: set ft=tex et ts=2 sw=2 :
This page took 0.05681 seconds and 3 git commands to generate.