diff --git a/docs/bfh.cls b/docs/bfh.cls index e1ceb72..3673a0d 100644 --- a/docs/bfh.cls +++ b/docs/bfh.cls @@ -1,13 +1,278 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{bfh}[2015/04/21 Class for my BFH reports] +\ProvidesClass{bfh}[2015/04/21 Atricle Class for my BFH reports] + +\DeclareOption{a4paper}{\PassOptionsToClass{\CurrentOption}{scrartcl}} +\DeclareOption{11pt}{\PassOptionsToClass{\CurrentOption}{scrartcl}} +\DeclareOption{oneside}{\PassOptionsToClass{\CurrentOption}{scrartcl}} +\DeclareOption{titlepage}{\PassOptionsToClass{\CurrentOption}{scrartcl}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}} +\ExecuteOptions{a4paper,11pt,oneside} +\ProcessOptions +\LoadClass{scrartcl} +\RequirePackage{remreset} + +\usepackage[utf8]{inputenc} +\usepackage{graphicx} +\usepackage{color} +\usepackage{lmodern} +\usepackage{url} +\usepackage{lastpage} -\LoadClass[12pt]{scrartcl} \usepackage{mathtools} \usepackage{amsfonts} -\usepackage[utf8]{inputenc} -\usepackage{hyperref} -\usepackage{graphicx} -\usepackage{float} -\usepackage{wrapfig} +%\usepackage{float} \usepackage{textgreek} -\usepackage{centernot} \ No newline at end of file +%\usepackage{centernot} +\usepackage{hyphenat} + +\usepackage[T1]{fontenc} +\usepackage[scaled]{helvet} + +\usepackage{textcomp} +\usepackage{eurosym} +\usepackage{fancyhdr} +\usepackage{alltt} +\usepackage{verbatim} +\usepackage{aeguill} +%\usepackage{underscore} +\usepackage{ctable} +\usepackage[english]{babel} + +\usepackage{tabularx} +\usepackage{wrapfig} +\usepackage{ifthen} +\usepackage[usenames,dvipsnames,svgnames]{xcolor} +\usepackage{hyperref} +\usepackage{listings} +\usepackage{attachfile} + +\usepackage{enumitem} +\usepackage{wasysym} + +\usepackage[absolute]{textpos} + +%\usepackage{cite} +%\usepackage[backend=bibtex]{biblatex} +% Literatur- und Bilderquellen trennen +%\defbibheading{lit}{\section*{Literature}} +%\defbibheading{pic}{\section*{Pictures}} + +\definecolor{bfhblue}{rgb}{0.396,0.49,0.56} % Blue +\definecolor{bfhorange}{rgb}{0.961,0.753,0.196} % Orange +\definecolor{bfhorangelight}{RGB}{246,216,136} % Orange Light + +\hypersetup{ + linkcolor=blue, % color of internal links + citecolor=green, % color of links to bibliography + filecolor=blue, % color of file links + urlcolor=blue, % color of external links + colorlinks=true +} +\urlstyle{same} + +\typearea{12} +%\bibliographystyle{alpha} +\setcounter{secnumdepth}{4} +\setlength{\parskip}{12pt} +\setlength{\parindent}{0pt} + +\renewcommand{\familydefault}{\sfdefault} + +\let\oldtoc\tableofcontents +\renewcommand{\tableofcontents} { + \oldtoc + \newpage +} +\newcommand*{\tutor}[1]{\gdef\@tutor{#1}} +\renewcommand{\maketitle} { + \begin{titlepage} + \newlength{\unitlengthtmp} + \setlength{\unitlengthtmp}{\unitlength} + \setlength{\unitlength}{1mm} + \setlength{\TPHorizModule}{\textwidth} + \setlength{\TPVertModule}{\textheight} + % + % BFH Logo + \includegraphics[scale=1.25]{images/logo.pdf} + % + % Linien + \begin{textblock}{1}[0,0](0,0) + \begin{picture}(0,130) + \put(20,0){\color{bfhblue}\rule{\textwidth}{1.2mm}} + \put(20,40){\color{bfhblue}\rule{\textwidth}{1.2mm}} %28.5 + \end{picture} + \end{textblock} + % + %Zentrierte Titel + \begin{flushleft} + \vspace*{4.08cm} + \textsf{\textbf{\noindent{\Huge{\textcolor{bfhblue}{\@title}}}}}\\[0.4cm] + \textsf{\huge{\textcolor{bfhblue}{\@subtitle}}} + % + %Angaben zum Dokument + \begin{vfill} + \begin{tabularx}{\textwidth}{lX} + \textsf{Author} & \@author\\ + \textsf{Tutor} & \@tutor\\ +% \textsf{Expert} & \textsf\DozentA\\ +% \textsf{Studiengang} & \textsf{\Studiengang}\vspace{5pt}\\ +% \textsf{Autoren} & \textsf\AutorA\\ +% & \textsf\AutorB\vspace{5pt}\\ +% \textsf{Betreuer} & \textsf\DozentA\\ +% & \textsf\DozentB\vspace{5pt}\\ +% \textsf{Experten} & \textsf\ExpertA\\ +% & \textsf\ExpertB\vspace{5pt}\\ + \textsf{Date} & \textsf{\@date}\vspace{5pt}\\ +% &\\ +% &\\ +% \multicolumn{2}{p{\columnwidth-\tabcolsep}}{\textsf{\input{titlepage/titlepage_info}}}\\ + \end{tabularx} + \end{vfill} + \end{flushleft} + \setlength{\unitlength}{\unitlengthtmp} + \end{titlepage} +} + +\pagestyle{fancy} +\fancyhf{} +\fancyfoot[R]{\hrule\thepage/\pageref{LastPage}} +\fancyfoot[L]{\hrule\today} +\fancyhead[L]{\@title} + +\fancyhead[R]{ + \includegraphics[height=1.5\baselineskip]{images/logo.png} + } +\addtolength{\headheight}{2\baselineskip} +\addtolength{\headheight}{0.61pt} + +\lstset{ +language=XML, % Code langugage +basicstyle=\ttfamily\scriptsize, +keywordstyle=\color{OliveGreen}, % Keywords font ('*' = uppercase) +stringstyle=\color{blue}, % String font +commentstyle=\color{gray}, % Comments font +numbers=left, % Line nums position +numberstyle=\tiny, % Line-numbers fonts +stepnumber=1, % Step between two line-numbers +numbersep=10pt, % How far are line-numbers from code +backgroundcolor=\color{BackgroundBlue}, % Choose background color +frame=none, % A frame around the code +tabsize=4, % Default tab size +captionpos=b, % Caption-position = bottom +breaklines=true, % Automatic line breaking? +breakatwhitespace=false, % Automatic breaks only at whitespace? +%showspaces=false, % Dont make spaces visible +%showtabs=false, % Dont make tabls visible +columns=fixed, % Column format +morekeywords={Server, Listener, GlobalNamingResources, + Resource, ResourceLink, Service, Connector, Engine, + Host, Context, Environment, + beans, bean, broker, destinationPolicy, policyMap, + policyEntries, policyEntry, dispatchPolicy, + strictOrderDispatchPolicy, subscriptionRecoveryPolicy, + lastImageSubscriptionRecoveryPolicy, managementContext, + persistenceAdapter, systemUsage, memoryUsage, + storeUsage, tempUsage, transportConnectors, + transportConnector, property, jetty, connectors, + nioConnector, handlers, webAppContext}, +} +% Shows a listing and creates an attachment with the source +\newcommand{\attachlisting}[2][]{ + \hspace{0.95\textwidth} + \attachfile[icon=Paperclip]{#2} + \vspace{-5ex} + \lstinputlisting[#1]{#2} +} +% 1 line number(s) +% 2 variable name +% 3 description +% 4 example values +\newcommand{\listinginfo}[4]{ + \colorbox{WhiteSmoke}{ + \parbox[t]{0.25\textwidth}{ + \printifnotempty{#1}{\texttt{#1:}\\} + \textit{#2} + } + \parbox[t]{0.715\textwidth}{ + \printifnotempty{#3}{#3 + } + \printifnotempty{#4}{ + \par + \vspace{1ex} + \colorbox{BackgroundBlue}{ + \parbox{0.69\textwidth}{ + \vspace{-2ex} + \ttfamily + \flushleft{#4} + } + } + \par + \vspace{0.5ex} + } + } + } + \par + \vspace{-1.7ex} +} +\newcommand{\printifnotempty}[2]{ + \ifthenelse{\equal{#1}{}}{}{#2} +} + +% Makes a red box that highlights errors or very important warnings +\newcommand{\errorbox}[1]{ + \fcolorbox{Red}{LightPink}{ + \parbox{0.972\textwidth}{ + \begin{wrapfigure}[2]{l}{0.05\textwidth} + \vspace{-12pt} + \includegraphics[width=0.05\textwidth]{images/error.pdf} + \vspace{12pt} + \end{wrapfigure} + #1 + } + } +} + +% Makes a yellow box that highlights warnings +\newcommand{\warningbox}[1]{ + \fcolorbox{Goldenrod}{LightYellow}{ + \parbox{0.972\textwidth}{ + \begin{wrapfigure}[2]{l}{0.05\textwidth} + \vspace{-12pt} + \includegraphics[width=0.05\textwidth]{images/warning.pdf} + \vspace{12pt} + \end{wrapfigure} + #1 + } + } +} + +% Makes a blue box that highlights special information +\newcommand{\infobox}[1]{ + \fcolorbox{CornflowerBlue}{AliceBlue}{ + \parbox{0.972\textwidth}{ + \begin{wrapfigure}[2]{l}{0.05\textwidth} + \vspace{-12pt} + \includegraphics[width=0.05\textwidth]{images/info.pdf} + \end{wrapfigure} + #1 + } + } +} + +\usepackage{listings} +\definecolor{BackgroundBlue}{cmyk}{0.05,0,0,0} + +\let\olditemize=\itemize +\def\itemize{ + \olditemize + \setlength{\itemsep}{-1.5ex} +} + +\newcommand{\leadingzero}[1]{\ifnum #1<10 0\the#1\else\the#1\fi} +%YYYY-MM-DD +\newcommand{\todayI}{\the\year-\leadingzero{\month}-\leadingzero{\day}} + +\endinput + + + diff --git a/docs/bibliography.bib b/docs/bibliography.bib new file mode 100644 index 0000000..9580082 --- /dev/null +++ b/docs/bibliography.bib @@ -0,0 +1,8 @@ +@ONLINE{wiki:protocol, + url = {https://bitmessage.org/wiki/Protocol_specification}, + title = {Bitmessage Wiki: Protocol Specification}, + publisher = {Bitmessage Wiki}, + urldate = {2015-04-24}, + author = {Atheros and Coe, Jonathan}, + year = {2015}, +} \ No newline at end of file diff --git a/docs/images/logo-de.svg b/docs/images/logo-de.svg new file mode 100644 index 0000000..d771314 --- /dev/null +++ b/docs/images/logo-de.svg @@ -0,0 +1,123 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/docs/images/logo-en.svg b/docs/images/logo-en.svg new file mode 100644 index 0000000..9def4ad --- /dev/null +++ b/docs/images/logo-en.svg @@ -0,0 +1,84 @@ + + + +image/svg+xmlBern Universityof Applied Sciences + \ No newline at end of file diff --git a/docs/images/logo.pdf b/docs/images/logo.pdf new file mode 100644 index 0000000..7e73e5d Binary files /dev/null and b/docs/images/logo.pdf differ diff --git a/docs/images/logo.png b/docs/images/logo.png new file mode 100644 index 0000000..4342156 Binary files /dev/null and b/docs/images/logo.png differ diff --git a/docs/project2.pdf b/docs/project2.pdf index 9ab5655..b0186b0 100644 Binary files a/docs/project2.pdf and b/docs/project2.pdf differ diff --git a/docs/project2.tex b/docs/project2.tex index b15149b..9063647 100644 --- a/docs/project2.tex +++ b/docs/project2.tex @@ -3,20 +3,17 @@ \title{Project 2} \subtitle{Bitmessage -- Communication Without Metadata} \author{Christian Basler} +\tutor{Kai Brünnler} \date{\today} \begin{document} \maketitle -\begin{figure}[h] -\includegraphics[width=0.2\textwidth]{logo.png} -\centering -\end{figure} - \tableofcontents \section{Synopsis} + TODO % Section basics @@ -32,6 +29,13 @@ \section{Issues} + TODO + + + \subsection{Unsigned Numbers} + + Java doesn't support unsigned number types. While Java 8 has some helper classes to address this issue, my goal is to support Java 7, which is needed for Android development, so I wasn't able to leverage them. + \subsection{Proof of Work} Proof of work is needed for a message to be distributed within the Bitmessage network. This is to protect both the network itself from denial of service attacks and the users from spam. @@ -51,6 +55,11 @@ \subsection{Network Management} + \section{Usage} + + TODO + + \section{Discussion} diff --git a/docs/seminar.pdf b/docs/seminar.pdf new file mode 100644 index 0000000..da43892 Binary files /dev/null and b/docs/seminar.pdf differ diff --git a/docs/seminar.tex b/docs/seminar.tex new file mode 100644 index 0000000..7c8142f --- /dev/null +++ b/docs/seminar.tex @@ -0,0 +1,103 @@ +\documentclass{bfh} + +\usepackage[numbers]{natbib} + +\title{Informatikseminar} +\subtitle{Bitmessage -- Communication Without Metadata} +\author{Christian Basler} +\tutor{Kai Brünnler} +\date{\today} + +\newcommand{\msg}[1]{\textit{#1}} +\newcommand{\obj}[1]{\textbf{#1}} +\newcommand{\node}[1]{\textbf{#1}} + +\begin{document} + \maketitle + + \tableofcontents + + \section{Synopsis} + + TODO + + + % Section basics + \input{basics} + + + \section{Protocol} + + \subsection{Nomenclature} + + There are a few terms that are easily mixed up. Here's a list of the most confusing ones: + + \listinginfo{}{message}{is sent from one node to another, i.e. to announce new objects or to initialize the network connection.}{} + \listinginfo{}{msg}{is the object payload containing the actual message written by a user. The term 'message' is never used to describe information exchange between users in this document.}{} + \listinginfo{}{payload}{There are two kinds of payload: message payload for message types, e.g. containing inventory vectors, and object payload, which is distributed throughout the network.}{} + \listinginfo{}{object}{is a kind of message whose payload is distributed among all nodes. Somtimes just the payload is meant.}{} + + \subsection{Process Flow} + + The newly started node \node{A} connects to a random node \node{B} from its node registry and sends a \msg{version} message, announcing the latest supported protocol version. If \node{B} accepts the version\footnote{A version is accepted by default if it is higher or equal to a nodes latest supported version. Nodes supporting experimental protocol versions might accept older versions.}, it responds with a \msg{verack} message, followed by a \msg{version} message announcing its own latest supported protocol version. Node \node{A} then decides whether it supports \node{B}'s version and sends its \msg{verack} mesage. + + If both nodes accept the connection, they both send an \msg{addr} message containing up to 1000 of its known nodes, followed by one or more \msg{inv} messages announcing all valid objects they are aware of. They then send \msg{getobject} request for all objects still missing from their inventory. + + \msg{Getobject} requests are answered by \msg{object} messages containing the requested objects. + + If a user writes a new mail on node \node{A}, it is offered via \msg{inv} to up to eight connected nodes. They will get the object and distribute it to up to eight of their connections, and so on. + + \subsection{Messages} + + The messages and binary format are very well discribed in the Bitmessage wiki \cite{wiki:protocol}, the message description is therefore narrowed down to a description of what they do and when they're used. + + \subsubsection{version / verack} + A \msg{version} message contains the latest protocol version supported by a node, as well as the streams it is interested in and which features it supports. If the other node accepts, it acknowledges with a \msg{verack} message. The connection is initialized when both nodes sent a \msg{verack} message. + + \subsubsection{addr} + Contains up to 1000 known nodes with their IP addresses, ports, streams and supported features. + + \subsubsection{inv} + One \msg{inv} message contains the hashes of up to 50000 valid objects. If your inventory is larger, several messages can be sent. + + \subsubsection{getdata} + Can request up to 50000 objects by sending their hashes. + + \subsubsection{object} + Contains one requested object, which might be one of: + + \listinginfo{}{getpubkey}{A request for a public key, which is needed to encrypt a message to a specific user.}{} + \listinginfo{}{pubkey}{A public key. See \ref{subsec:addrenc} \nameref{subsec:addrenc}}{} + \listinginfo{}{msg}{}{} + \listinginfo{}{broadcast}{}{} + + \subsubsection{ping / pong} + + \subsection{Addresses and Encryption} + \label{subsec:addrenc} + + + \section{Issues} + + \subsection{Scalability} + + TODO + + + \section{Discussion} + + TODO + + + \bibliographystyle{plain} + \bibliography{bibliography} + + \appendix + \addcontentsline{toc}{section}{Appendix} + \section*{Appendix} + \renewcommand{\thesubsection}{\Alph{subsection}} + + \subsection{TODO} + + +\end{document} \ No newline at end of file