%
% Typographic conventions (already applied)
% * Each \caption{} should end with a dot
% * "Linux traffic control" will be written with lowercase T and C
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[11pt,abstract]{scrreprt}
\usepackage[utf8]{inputenc}
% \usepackage[T1]{fontenc}
\usepackage[right]{lineno}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
% \usepackage{t1enc}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{multirow}
\usepackage{tikz}
\usepackage[draft]{fixme}
\usepackage{vertbars} 
\usepackage{fancyvrb}
\usepackage{appendix}
\usepackage{listings}
\usepackage{color}
\usepackage{caption}

%\usepackage{multicol}
\hypersetup{
	breaklinks = true, %allow links to break over lines
	pdffitwindow = true, %resize document window to fit document size
	colorlinks = true,
% 	linkcolor = darkblue,
% 	citecolor = darkblue,
% 	urlcolor = darkblue,
	linkcolor = black,
	citecolor = black,
	urlcolor = black,
        plainpages=false,
	}
%\urlstyle{same}

\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{frame=single,framesep=4pt}


\setlength{\columnsep}{8mm}
\providecommand{\alert}[1]{\textbf{#1}}

\title{Linux-Based CAN-Ethernet Gateway}
\author{R. Matějka, M. Sojka\\
Czech Technical University in Prague}
\providecommand{\version}{???}
\date{\today\\Version \version}

\newcommand{\superscript}[1]{\ensuremath{^{\mathrm{#1}}}}
\newcommand{\subscript}[1]{\ensuremath{_{\mathrm{#1}}}}
\renewcommand{\th}[0]{\superscript{th}}
\renewcommand{\st}[0]{\superscript{st}}
\newcommand{\nd}[0]{\superscript{nd}}
\newcommand{\rd}[0]{\superscript{rd}}

\newenvironment{todo}
{\begin{vertbar}\begin{itshape}}
    {\end{itshape}\end{vertbar}}
\pagestyle{headings}
\begin{document}
\lstset{language=sh,frame=single,basicstyle=\tt,commentstyle=\itshape\color{gray},columns=flexible}
%\linenumbers
%\onecolumn
\maketitle

% \begin{abstract}
% \end{abstract}

\tableofcontents

\chapter{Assignment}
\label{cha:assignment}

The goal is to implement CAN-Ethernet gateway based on Linux's AF\_CAN
subsystem with the following features:
\begin{enumerate}
\item Both user- and kernel-space implementations will be developed.
  User-space one will contain only the most basic functionality.
\item Ethernet side will use UDP datagrams to carry the CAN messages.
  Later it will be extended to support also TCP.
\item Initial version will route all CAN frames to Ethernet side and
  all received UDP datagrams to CAN messages. Later, filtering
  capabilities will be added.
\item UDP frames will contain timestamps of the time when the CAN
  message was received.
\item For kernel-based gateway, implement a user-space configuration
  tool, similar to \texttt{cangw} tool from \texttt{can-utils}.
\end{enumerate}

\chapter{Solution design}
\label{cha:design}
The canethgw is comprised of CAN and Ethernet interfaces. Both of these
interfaces allow to read and write to realize the gateway functionality.
But there is a difference in these interfaces from kernel point of view.
\section{CAN part}
The CAN part of the gateway is build on can\_rx\_register(...) function, 
therefore it is receiving events from kernel whenever CAN frame is
received on desired netdevice. Sending frames to CAN is implemented
through can\_send.
\section{Ethernet part}
The Ethernet side of the gateway is however implemented using kernel sockets.
Kernel thread is created to listen for UDP/TCP messages. The socket interface
is also used for sending.
\section{Ethernet message format}
As there is no standard on how to carry CAN messages over TCP or UDP,
the UDP/TCP message format has to be defined.
\begin{center}
\includegraphics[scale=0.5]{img/eth_msg.pdf}
\captionof{figure}{UDP/TCP message.}\label{fig:eth_msg}
\end{center}
% \bibliography{can-eth-gw}
% \bibliographystyle{IEEEtran}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% ispell-local-dictionary: american
%%% End:
