sync: dns introduction
[skm-ma-ws1314.git] / xmpp.tex
index 56ed185..c37175a 100644 (file)
--- a/xmpp.tex
+++ b/xmpp.tex
@@ -1,17 +1,87 @@
 \subsection{XMPP}
 \todo
-\cite{rfc6120}
-\begin{itemize}
-       \item architecture: client-server, use of DNS-SD
-       \item addressing: JIDs, resources
-       \item XML-based communication primitives, stanzas and streams
-       \item presence
-       \item publish/subscribe \cite{xep-0060}, roster
-       \item multi-user chats \cite{xep-0045}
-\end{itemize}
-
 \pages{3-4}
 
+The \term{Extensible Messaging and Presence Protocol (XMPP)} is a distributed,
+XML-based protocol for real-time communication. Its core functionalities are
+specified in RFCs~6120~\cite{rfc6120} and RFC~6122~\cite{rfc6121}, while protocol
+extensions are usually defined by the XMPP community in \term{XMPP Extension
+Proposals (XEPs)}.
+
+\subsubsection{Addressing}
+
+Every user account in XMPP is addressed by a globally unique identifier, called
+the \term{Jabber ID (JID)}~\cite{rfc6122}. It has the form
+\code{localpart@domainpart/resource}, where \code{domainpart} is the DNS name of
+an XMPP server, and \code{localpart} is the name of a user account on that
+server. Since a user can be logged in from multiple clients, the \code{resource}
+part is a string chosen by the user to distinguish those clients. Only the part
+\code{localpart@domainpart} (the \term{bare JID}) is needed to identify a user,
+the resource is only needed for routing between client and server.
+
+\subsubsection{Architecture}
+\begin{wrapfigure}{r}{0.4\textwidth}
+%\begin{figure}[htop]
+  \centering
+  \includegraphics[width=0.4\textwidth]{xmpp-architecture-mock.jpg}
+  \caption{XMPP architecture}
+  \label{fig:xmpparch}
+%\end{figure}
+\end{wrapfigure}
+
+The original architecture underlying XMPP strongly leans on the established
+design of Internet Mail, and an example is depicted in Fig.~\ref{fig:xmpparch}.
+The distributed network is formed by \term{XMPP servers} on one hand, which make
+up the always-on backbone of the network used for routing message, and manage
+user accounts and statuses. On the other hand, \term{XMPP clients} represent a
+single logged-in user and are the interface for communication with other users.
+
+Every client communicates only with the server that manages the respective user
+account which is configured in the client, as given in the user's JID. The
+server then routes the messages to their recipients, using the JID to determine
+the correct server for a message to be sent to. Finally, the receiving server
+sends the message to a client where the receiving JID is logged in. If the user
+is not logged in at the time the message is sent, the server can store it for
+the user and deliver it on the next login.
+
+XMPP strongly relies on DNS Service Discovery (see Section~\ref{sec:dnssd}) to
+determine the server being in charge of a domain. For example, the server who
+manages the users for the domain \code{example.org} is given by the SRV record
+\code{\_xmpp-server.\_tcp.example.org}.
+
+\subsubsection{Communication primitives}
+
+All communication over XMPP is based on XML. To minimize communication overhead,
+only fragments of XML, called \term{stanzas}, are sent between hosts. A stanza
+is always well-formed as a whole; it consist of a root element, which also
+includes routing attributes (\code{to} and \code{from}), and its optional child
+elements.
+
+On top of that, living connections between hosts are represented by \term{XML
+streams}. The client initiates a connection by sending an XML declaration
+followed by an opening \code{<stream>} tag. The server then responds also with
+an opening \code{<stream>} tag. The client then performs SASL authentication and
+binds its stream to a resource for proper addressing. If this process succeeded,
+both client and server can send an unlimited number of stanzas, until the
+connection is closed by one side by sending an closing \code{</stream>} tag. The
+other side then has the chance to send all outstanding stanzas and likewise
+closes its stream. If both streams are closed, the underlying TCP connection is
+terminated.
+
+\todo[Example stream]
+
+\subsubsection{Multi-User Chats}
+
+\cite{xep-0045}
+
+\subsubsection{Publish/Subscribe and the Roster}
+
+\cite{xep-0060}
+
+\subsubsection{Presence}
+
+
+\cite{rfc6120}
 
 \subsubsection{XMPP Serverless Messaging}
 \todo
This page took 0.027385 seconds and 4 git commands to generate.