\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{graphicx} %BIlder einbinden
\usepackage{amsmath} %erweiterte Mathe-Zeichen
\usepackage{amsfonts} %weitere fonts
\usepackage[utf8]{inputenc} %Umlaute & Co
\usepackage{hyperref} %Links
\usepackage{ifthen} %ifthenelse
\usepackage{enumerate}
\usepackage{stmaryrd}

\usepackage{color}
\usepackage{algpseudocode} %Pseudocode
\usepackage{dsfont} % schöne Zahlenräumezeichen
\usepackage{amssymb, amsthm} %noch stärker erweiterte Mathe-Zeichen
\usepackage{tikz} %TikZ ist kein Zeichenprogramm
\usetikzlibrary{trees,automata,arrows,shapes}
\usepackage{pgfplots}

\pagestyle{empty}


\topmargin-50pt


\newcounter{aufgabe}
\def\tand{&}

\newcommand{\makeTableLine}[2][0]{%
  \setcounter{aufgabe}{1}%
  \whiledo{\value{aufgabe} < #1}%
  {%
    #2\tand\stepcounter{aufgabe}%
  }
}

\newcommand{\aufgTable}[1]{
  \def\spalten{\numexpr #1 + 1 \relax}
  \begin{tabular}{|*{\spalten}{p{1cm}|}}
    \makeTableLine[\spalten]{E\theaufgabe}$\Sigma$~~\\ \hline
    \rule{0pt}{15pt}\makeTableLine[\spalten]{}\\
  \end{tabular}
}

\def\header#1#2#3#4#5#6#7{\pagestyle{empty}
\begin{minipage}[t]{0.47\textwidth}
\begin{flushleft}
{\bf #4}\\
#5
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{flushright}
#6 \vspace{0.5cm}\\
%                 Number of Columns    Definition of Columns      second empty line
% \begin{tabular}{|*{5}{C{1cm}|}}\hline A1&A2&A3&A4&$\Sigma$\\\hline&&&&\\\hline\end{tabular}\\\vspace*{0.1cm}
\aufgTable{#7}
\end{flushright}
\end{minipage}
\vspace{1cm}
\begin{center}
{\Large\bf Sheet #1}

{(Hand in #3)}
\end{center}
}



%counts the exercisenumber
\newcounter{n}

%Kommando für Aufgaben
%\Aufgabe{AufgTitel}{Punktezahl}
\newcommand{\Aufgabe}[2]{\stepcounter{n}
    \textbf{Exercise \arabic{n}: #1} (#2 Points)}

\newcommand{\textcorr}[1]{\textcolor{red}{#1}}
\newenvironment{corr}{\color{red}}{\color{black}\newline}
\newcommand{\ok}{\begin{corr}
            $\checkmark$
        \end{corr}}

\newcommand{\enot}[2]{#1 \cdot 10^{#2}}

\begin{document}
%\header{BlattNr}{Tutor}{Abgabedatum}{Vorlesungsname}{Namen}{Semester}{Anzahl Aufgaben}
\header{9}{}{2015-12-16}{Kommunikationsnetze}{\textit{Jonas Jaszkowic, 3592719}\\\textit{Jan-Peter Hohloch, 3908712}}{WS 15/16}{4}
\vspace{1cm}
\Aufgabe{Bridges, Ports and Spanning Trees}{5+5+5+5+10+10+10+10}
\begin{enumerate}
	\item Network:\\
    \begin{tikzpicture}[auto,node distance=2.0cm]
        \node[state] (A) {A};
        \node[state] (B) [right of=A] {B};
        \node[state] (S) [right of=B] {$B_4$};
        \node[state] (C) [right of=S] {C};
        \node[state] (D) [right of=C] {D};
        \node[state] (E) [below of=S] {E};
        \node[state] (F) [right of=E] {F};
        \path (A) edge (B)
            (B) edge node[above right]{\tiny{1}} (S)
            (S) edge node[above left]{\tiny{2}} (C)
            (C) edge (D)
            (S) edge node[above right]{\tiny{3}}(E)
            (E) edge (F);
    \end{tikzpicture}\vspace*{-2cm}
    \item $B_4$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1\\
    C&2\\
    D&2\\
    E&3\\
    F&3
    \end{tabular}
    \item Brides and LANs are involved as nodes. The bridge-IDs have to be configured, which port to use and which to block is learned. The bridges broadcast their ID each bridge determines if it is the root bridge and which ports have to be used and which are blocked. The port nearest to the root and the designated ports (shortest connection for segment to root) are used, others blocked.
    \item Network:\\
    \begin{tikzpicture}[auto,node distance=2.0cm]
        \node[state] (A) {A};
        \node[state] (B) [right of=A] {B};
        \node[state] (B4) [right of=B] {$B_4$};
        \node[state] (B1) [above of=B4] {$B_1$};
        \node[state] (C) [right of=S] {C};
        \node[state] (D) [right of=C] {D};
        \node[state] (E) [below of=S] {E};
        \node[state] (F) [right of=E] {F};
        \node[state] (B2) [right of=F] {$B_2$};
        \node[state] (B3) [left of=E] {$B_3$};
        \path (A) edge (B)
            (B) edge node[above right]{\tiny{1}} (B4)
            (B4) edge node[above left]{\tiny{2}} (C)
            (C) edge (D)
            (B4) edge node[above right]{\tiny{3}}(E)
            (E) edge (F);
        \path (B) edge node[above left]{\tiny{1}} (B1)
            (B1) edge node[above right]{\tiny{2}} (C)
            (D) edge node[below right]{\tiny{1}} (B2)
            (B2) edge node[above right]{\tiny{2}} (F)
            (E) edge node[above left]{\tiny{2}} (B3)
            (B3) edge node[below]{\tiny{1}} (A);
    \end{tikzpicture}
    \item After STP (f: forwarding, b: blocking):\\
    \begin{tikzpicture}[auto,node distance=2.0cm]
        \node[state] (A) {A};
        \node[state] (B) [right of=A] {B};
        \node[state] (B4) [right of=B] {$B_4$};
        \node[state] (B1) [above of=B4] {$B_1$};
        \node[state] (C) [right of=S] {C};
        \node[state] (D) [right of=C] {D};
        \node[state] (E) [below of=S] {E};
        \node[state] (F) [right of=E] {F};
        \node[state] (B2) [right of=F] {$B_2$};
        \node[state] (B3) [left of=E] {$B_3$};
        \path (A) edge (B)
            (B) edge node[above right]{\tiny{f:1}} (B4)
            (B4) edge[dotted] node[above left]{\tiny{b:2}} (C)
            (C) edge (D)
            (B4) edge[dotted] node[above right]{\tiny{b:3}}(E)
            (E) edge (F);
        \path (B) edge node[above left]{\tiny{f:1}} (B1)
            (B1) edge node[above right]{\tiny{f:2}} (C)
            (D) edge node[below right]{\tiny{f:1}} (B2)
            (B2) edge node[above right]{\tiny{f:2}} (F)
            (E) edge[dotted] node[above left]{\tiny{b:2}} (B3)
            (B3) edge node[below]{\tiny{f:1}} (A);
    \end{tikzpicture}
    \item $B_1$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1\\
    C&2\\
    D&2\\
    E&2\\
    F&2
    \end{tabular}, $B_2$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1\\
    C&1\\
    D&1\\
    E&2\\
    F&2
    \end{tabular}, $B_3$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1
    \end{tabular}, $B_4$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1
    \end{tabular}
    \item \begin{tikzpicture}[auto,node distance=2.0cm]
        \node[state] (A) {A};
        \node[state] (B) [right of=A] {B};
        \node[state] (B4) [right of=B] {$B_4$};
        \node[state] (C) [right of=S] {C};
        \node[state] (D) [right of=C] {D};
        \node[state] (E) [below of=S] {E};
        \node[state] (F) [right of=E] {F};
        \node[state] (B2) [right of=F] {$B_2$};
        \node[state] (B3) [left of=E] {$B_3$};
        \path (A) edge (B)
            (B) edge node[above right]{\tiny{f:1}} (B4)
            (B4) edge[dotted] node[above left]{\tiny{b:2}} (C)
            (C) edge (D)
            (B4) edge[dotted] node[above right]{\tiny{b:3}}(E)
            (E) edge (F);
        \path (D) edge node[below right]{\tiny{f:1}} (B2)
            (B2) edge node[above right]{\tiny{f:2}} (F)
            (E) edge node[above left]{\tiny{f:2}} (B3)
            (B3) edge node[below]{\tiny{f:1}} (A);
    \end{tikzpicture}
    \item $B_2$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 2\\
    B&2\\
    C&1\\
    D&1\\
    E&2\\
    F&2
    \end{tabular}, $B_3$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1\\
    C & 2\\
    D&2\\
    E&2\\
    F&2
    \end{tabular}, $B_4$: \begin{tabular}{c|c}
    adr  & port \\\hline
    A & 1\\
    B&1
    \end{tabular}
\end{enumerate}
\Aufgabe{Optical Networks - SONET}{5+10+5+5}
\begin{enumerate}
	\item A STS multiplexer is the start and end point of an SONET network and combines multiple STS-signals into an STS-n signal. An add/drop multiplexer however, adds or drops single STS-1 signals to or from a multiplexed STS-n signal.
	\item
	\begin{enumerate}
		\item \textbf{Photonic layer}: physical specification of optical fiber channel. Encoding with unipolar NRZ, 1 is presence of light, 0 is absence of light.
		\item \textbf{Section layer}: handles framing, scrambling and error control.
		\item \textbf{Line layer}: provides access to STS-1 signals for adding or dropping individual multiplexed signals on a line.
		\item \textbf{Path layer}: combines n STS-1 signals to an STS-n signal. Combines lower bit rate signals into synchronous payload envelopes.
	\end{enumerate}
	\item A SONET regenerator is something like a repeater for optical signals. Whereas a repeater is level one, a regenerator acts on level two because it is also responsible for framing, scrambling and error control. The frame is regenerated, management information is added. A repeater would only recover every single bit.
	\item SONET is called a synchronous network because it uses STS (\textbf{synchronous} transport signal) multiplexing and demultiplexing. That means the receiver has to be synchronized with the sender to interpret the signal correctly.
\end{enumerate}
\Aufgabe{ATM}{10+5}
\begin{enumerate}
    \item One cell has 53byte. So at most we have to wait for he transmission of 53byte at each switch. With a transmission rate of 43 Mbit/s we get:\\
    $\frac{5\cdot2\cdot(53\cdot8)}{43 Mbit/s}=9.86\cdot 10^{-5}s$\\
    Minimal is half of the time (no waiting but only transmission at each switch):\\
    $\frac{5\cdot(53\cdot8)}{43 Mbit/s}=4.93\cdot 10^{-5}s$
    \item $20byte+20byte+8byte=48byte$ which is exactly the payload of an ATM cell, so we need one cell.
\end{enumerate}
\end{document}
