From 4bdbfbd2464cba8ca37915a95e0fc86e46aa0cf6 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Tue, 15 Mar 2016 11:39:08 +0100
Subject: Start assignment 3

---
 assignment3.tex | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 assignment3.tex

(limited to 'assignment3.tex')

diff --git a/assignment3.tex b/assignment3.tex
new file mode 100644
index 0000000..b779e7e
--- /dev/null
+++ b/assignment3.tex
@@ -0,0 +1,85 @@
+\documentclass[a4paper,9pt]{article}
+
+\author{Camil Staps\\\small{s4498062}}
+\title{Networking\\\large{Assignment 3}}
+
+\usepackage{polyglossia}
+\setmainlanguage{english}
+\usepackage{geometry}
+\usepackage[hidelinks]{hyperref}
+\usepackage{caption}
+\usepackage{enumitem}
+\setenumerate{label=\alph*)}
+
+\usepackage{minted}
+\setminted{fontsize=\scriptsize}
+
+\usepackage{subcaption}
+\usepackage{tikz}
+\usetikzlibrary{arrows,automata,shapes}
+% underline to right side; see http://tex.stackexchange.com/a/137505/23992
+\usepackage[normalem]{ulem}
+
+\begin{document}
+
+\maketitle
+
+\section{SMTP Client}
+\begin{enumerate}
+  \item \inputminted{python}{assignment3/smtpclient.py}
+  \item Encode it using any of the authentication mechanisms defined in RFC4954, that are supported by the server (as the client knows from the response to its \texttt{ehlo}).
+  \item Only the handshake and the \texttt{STARTTLS} request and its response. From then, all communication will be encrypted.
+  \item Most mail servers don't allow any authentication mechanism without first upgrading to an encrypted session. However, telnet cannot handle this encrypted connection.
+\end{enumerate}
+
+\section{Circular DHT}
+\begin{enumerate}
+  \item $1\to3\to8\to11\to13$, so \textbf{4}; $13\to1$, so \textbf{1}; $3\to8\to11$, so \textbf{2}.
+  \item I'm assuming that peer 15 only knows about peer 1's existence. So, 1 is asked for the predecessor and successor of 15. This message is forwarded to peer 13, which realises that it will be 15's predecessor, and that its current successor (1) will be 15's successor. This information is sent to peer 15. This peer then sets its successor to 1, and its predecessor to 13. Furthermore, it notifies peer 13 to update its immediate successor to 15.
+  \item Peer 13 periodically checks if its successors on the first two levels (1 and 3) are still alive. When it cannot reach 1 any more, it will ask its second successor, 3, for its immediate successor (8). 13 then updates its successors to 3 and 8.
+
+    Similarly, peer 11 periodically checks if its successors (13 and 1) are still alive. When it cannot reach 1 any more, it will ask 13 for its immediate successor (3), and set its second successor to that.
+
+    If at that point 13 did not update its successor yet, and returns 1, then peer 11 can ask again after some time. Alternatively, 11 could send to 13 `I know that peer 1 died; if you haven't do so yet update your successors, and then send me your immediate successor.'
+  \item It takes $\mathcal O(n)$ to map a key to a node, where $n$ is the number of peers. An advantage is that it is easy to implement.
+\end{enumerate}
+
+\section{Design a protocol}
+See \autoref{fig:3-fsm}.
+
+\section{Analyse protocols}
+\def\trans#1#2{\footnotesize{\texttt{\uline{#1\hfill\mbox{}}\\#2}}}
+\tikzstyle{trans}=[every trans]
+\begin{figure}[h]
+  \centering
+  \begin{subfigure}{\textwidth}
+    \centering
+    \begin{tikzpicture}[node distance=35mm,->,>=stealth',every trans/.style={text width=4cm},every state/.style={ellipse}]
+      \node[initial,state] (a1) {Wait/Send};
+      \node[state,right of=a1] (a2) {Retry/Wait};
+  
+      \path (a1) edge[bend left] node[trans,above] {\trans{rdt\_send(data)}{packet=make\_pkt(data)\\udt\_send(packet)}} (a2)
+            (a2) edge[loop right,looseness=4.5] node[trans,right] {\trans{rdt\_unable\_to\_send(data)}{packet=make\_pkt(data)\\udt\_send(data)}} (a2)
+                  edge[bend left] node[trans,below] {\trans{rdt\_rcv(packet)}{extract(packet,data)\\deliver\_data(data)}} (a1);
+    \end{tikzpicture}
+    \caption{Entity A}
+  \end{subfigure}
+  \begin{subfigure}{\textwidth}
+    \centering
+    \begin{tikzpicture}[node distance=35mm,->,>=stealth',every trans/.style={text width=4cm},every state/.style={ellipse}]
+      \node[state] (b1) {Retry/Wait};
+      \node[state,right of=b1] (b2) {Wait/Send};
+  
+      \draw[<-] (b1) -- ++(-7mm,7mm) node[above left] {start};
+      \path (b2) edge[bend left] node[trans,below] {\trans{rdt\_send(data)}{packet=make\_pkt(data)\\udt\_send(packet)}} (b1)
+            (b1) edge[loop left,looseness=4.5] node[trans,left] {\trans{rdt\_unable\_to\_send(data)}{packet=make\_pkt(data)\\udt\_send(data)}} (b1)
+                  edge[bend left] node[trans,above] {\trans{rdt\_rcv(packet)}{extract(packet,data)\\deliver\_data(data)}} (b2);
+    \end{tikzpicture}
+    \caption{Entity B}
+  \end{subfigure}
+  \caption{Finite State Machines for our protocol}
+  \label{fig:3-fsm}
+\end{figure}
+
+\end{document}
+
-- 
cgit v1.2.3

