diff --git a/thesis/src/03.manipulate.tex b/thesis/src/03.manipulate.tex index de409f0..289bcf6 100644 --- a/thesis/src/03.manipulate.tex +++ b/thesis/src/03.manipulate.tex @@ -61,10 +61,40 @@ Figure~\ref{fig:control-flow} illustrates the control flow for manipulating func \section{Defining a Protocol}\label{sec:defining-a-protocol} -Lorem Ipsum. +When using a socket to communicate with another process, a protocol definition is needed. +This works defines a text-based protocol in which line breaks denote the end of a message. +The following subsections describe the defined message types. + +\subsection{\textit{Init} Message (Client \textrightarrow{} Server)}\label{subsec:init-message} + +This message is the first message sent in a newly established connection. +The client (\texttt{intercept.so}) uses it to identify the running program to the server (PID, path, \dots). + +\subsection{\textit{Call} Message (Client \textrightarrow{} Server)}\label{subsec:call-message} + +For each function call the client sends this message to the server and waits for a reply (\textit{Action} message). +The contents of this message type correspond to the first line of an intercepted function call (see Section~\ref{sec:automated-testing-on-intercepted-function-calls}). + +\subsection{\textit{Action} Message (Server \textrightarrow{} Client)}\label{subsec:action-message} + +After receiving a \textit{Call} message from the client, the server decides what the client should do with this call. +The server responds in one of four possible ways: + +\begin{description} + \item[\texttt{"ok"}] indicates that the function should be called normally. + \item[\texttt{"modify \textit{ARG...}"}] indicates that the arguments of the function should be changed according to the message before the call to the function. + \item[\texttt{"fail \textit{ERROR}"}] indicates that the function should not be called and instead should fail with the given error code. + \item[\texttt{"return \textit{VALUE}"}] indicates that the function should simply return the provided value without calling the real function. +\end{description} + +\subsection{\textit{Return} Message (Client \textrightarrow{} Server)}\label{subsec:return-message} + +This message informs the server about the resulting return value. +The server does not acknowledge this message. +The contents of this message type correspond the second line of an intercepted function call (see Section~\ref{sec:automated-testing-on-intercepted-function-calls}). -\section{Parsing Responses}\label{sec:parsing-responses} +\section{Creating a Socket Server in Python}\label{sec:creating-a-socket-server-in-python} Lorem Ipsum.