XMPP architecture diagram with TikZ
[skm-ma-ws1314.git] / sec-xmpp.tex
index f1b57b4..a89f414 100644 (file)
@@ -1,5 +1,4 @@
 \subsection{XMPP}
-\todo
 \pages{3-4}
 
 The \term{Extensible Messaging and Presence Protocol (XMPP)} is a distributed,
@@ -20,13 +19,27 @@ part is a string chosen by the user to distinguish those clients. Only the part
 the resource is only needed for routing between client and server.
 
 \subsubsection{Architecture}
-\begin{wrapfigure}{r}{0.4\textwidth}
-%\begin{figure}[htop]
+\begin{wrapfigure}{r}{0.5\textwidth}
+  \tikzstyle{iconlabel}=[text width=3cm, align=center, font=\footnotesize]
+  \begin{tikzpicture}[node distance=0pt,scale=1.5,>=stealth,thick]
+    \def\nodelist{
+      juliet/{(-1,-1)}/XMPP client \code{juliet@example.net}/below/computer,
+      examplenet/{(-1,1)}/XMPP server \code{example.net}/above/server,
+      imexampleorg/{(1,1)}/XMPP server \code{im.example.org}/above/server,
+      romeo/{(1,-1)}/XMPP client \code{romeo@im.example.org}/below/computer%
+    }
+    \foreach \name/\pos/\text/\tpos/\icon in \nodelist {
+      \node (\name) at \pos { \includegraphics[width=1.2cm]{icon-\icon.pdf} };
+      \node[\tpos=of \name,iconlabel] (\name text) { \text };
+    }
+    \draw[<->,dashed] (juliet) -- node[anchor=east]{s2c} (examplenet);
+    \draw[<->] (examplenet) -- node[anchor=south]{s2s} (imexampleorg);
+    \draw[<->,dashed] (imexampleorg) -- node[anchor=west]{s2c} (romeo);
+  \end{tikzpicture}
   \centering
-  \includegraphics[width=0.4\textwidth]{fig-xmpp-architecture-mock.jpg}
-  \caption{XMPP architecture}
+  \caption{XMPP architecture, showing server-to-server (s2s) and
+    server-to-client (s2c, dashed) connection types}
   \label{fig:xmpparch}
-%\end{figure}
 \end{wrapfigure}
 
 The original architecture underlying XMPP strongly leans on the established
@@ -70,22 +83,43 @@ terminated.
 
 \todo[Example stream]
 
-\subsubsection{Multi-User Chats}
+\subsubsection{Publish/Subscribe and Presence}
+
+Typically, a user wants to chat with a more or less fixed set of other users,
+whose JIDs she needs to know, so she needs some kind of ``address book'' that
+remembers the JIDs for her. In XMPP, this is address book is called
+\term{roster}, and it also shows the users' willingness to chat (``presence'').
+In order to see their chat status (which can be  one of ``online'', ``offline'',
+and several ``away'' or ``do not disturb'' states), a user needs to subscribe to
+the other user's status. The mechanism behind this is called
+\term{Publish-Subscribe} and is specified in XEP-0060~\cite{xep0060}. It can
+be used to notify interested users about changes in personal information, and
+implements the classic Observer pattern.
 
-\cite{xep-0045}
+A user publishes information by creating a \term{node} on the XMPP server, which
+acts as a handle for the data. Interested users can then query the server for
+nodes, and request subscription to them. When the owner of the node confirms the
+subscription request, subscribers get notified whenever the owner updates the
+respective node.
 
-\subsubsection{Publish/Subscribe, Presence and the Roster}
+All communication takes place between the client and the server over \code{<iq>}
+(``information query'') stanzas.
 
-\cite{xep-0060}
+\subsubsection{Multi-User Chats}
 
+Besides one-to-one messaging, XMPP also allows users to create multi-user
+chat rooms, which is specified in \cite{xep0045}. Each chat room is given a
+unique JID to which the users send their messages to. Each incoming message is
+then dispatched to all users which have joined the room.
 
-\cite{rfc6121}
+To join a room, the user sends a \code{<presence>} stanza to the room JID, where
+the resource part of the room JID specifies the desired nick name.
 
 \subsubsection{XMPP Serverless Messaging}\label{sec:xsm}
-\todo
+\pages{1}
 
 To overcome the need for a central server and authentication, XMPP Serverless
-Messaging~\cite{xep-0174} allows XMPP clients on a network to build a
+Messaging~\cite{xep0174} allows XMPP clients on a network to build a
 peer-to-peer mesh network and chat directly with each other. This feature was
 first introduced by Apple as part of their \term{Bonjour} project, and nowadays
 it is also available in many other XMPP clients.
@@ -116,6 +150,4 @@ message or IQ stanzas like they would to an XMPP server. Presence is managed
 over the corresponding TXT record in the mDNS. To go offline, a client
 announces the deletion of its mDNS records.
 
-\pages{1}
-
 % vim: set ft=tex et ts=2 sw=2 :
This page took 0.024018 seconds and 4 git commands to generate.