1
\chapter{Answers}\label{chap:answers}
2
3
\section*{Chapter~\ref{chap:introduction}}
4
\begin{enumerate}
5
\item NoTA is a framework for communication within and between devices. NoTA
6
  is also a specific implementation of this framework (the reference
7
  implementation). NoTA can be used to connect hardware and software
8
  in a standardized way;
9
\item A good working knowledge of the C programming language is very useful,
10
  as is some experience with UNIX/Linux-based systems;
11
\item No, not necessarily. You could start with chapter~\ref{chap:stubgen}
12
  (about the stub-generator) and later on read chapters~\ref{chap:h-in}
13
  and~\ref{chap:h-in-example} (about the {\tt h\_in});
14
\item Left as an exercise to the reader.
15
\end{enumerate}
16
17
\section*{Chapter~\ref{chap:overview}}
18
\begin{enumerate}
19
\item NoTA nodes come in two flavors: {\em application nodes} and {\em
20
    service nodes}. Application nodes are the 'clients' in the system, that
21
  request services from {\em service nodes}. The application nodes initiates
22
  the initial contact with the service node; after that, communications may
23
  flow in either way;
24
\item Message passing (in NoTA) is asynchronous communication between nodes,
25
  where response can come at any time; function calls are synchronous, and
26
  return their results to the caller; the former are more general, but also
27
  harder to program;
28
\item Message passing is useful for sending control messages such as '{\tt
29
    send\_sms()}' or notifications '{\tt received\_sms()'}, while streaming is
30
  better for sending/receiving bulk data (such as sending a picture to another
31
  node);
32
\item The {\tt l\_in} (low-level interconnect) takes care of network-level
33
  issues and abstracts away the transport details, while the {\tt h\_in}
34
  (high-level interconnect) provides ways for the nodes to communicate;
35
\item You can use the resource manager to resolve (= find) service
36
  addresses. The stub-generator can generate a lot of the 'plumbing' code from
37
  the service definitions, saving you a lot of work;
38
\item No - there's nothing Linux/UNIX-specific in the NoTA-standards. The
39
  reference implementation has been ported to non-UNIX platforms (Symbian,
40
  Tron).
41
\end{enumerate}
42
43
\section*{Chapter~\ref{chap:h-in}}
44
\begin{enumerate}
45
\item NoTA functions have and 'H'-prefix. FIXME
46
\item {\tt Hsend()} 
47
\end{enumerate}
48
49
\section*{Chapter~\ref{chap:messages}}
50
\begin{enumerate}
51
\item The mapping from number to message has to be agreed upon by AN and SN --
52
  there is no inherent way to know what message corresponds to, say, signal-id
53
  \texttt{0x0100}. You can \texttt{\#define} the values in a shared header file
54
  for client and server, or you can let the stub-generator
55
  (chapter~\ref{chap:stubgen}) do that for you;
56
\item {\tt 0xa2, 0x01, 0x00, 0x60, 0x11, 0x05, 0x11, 0x07, 0x11, 0x17, 0x61};
57
\item {\tt ``XXXV''} and 35.
58
\item Even though many of the mainstream platform use little-endian encoding,
59
  there are big-endian platforms out there as well. Unless you are sure that
60
  your code will never need to run on anything \emph{but} little-endian
61
  machines, you should take this into account.
62
\end{enumerate}
63
64
\section*{Chapter~\ref{chap:h-in-example}}
65
\begin{enumerate}
66
\item We got the socket with the {\tt SOCK\_SEQPACKET} option, so NoTA
67
  guarantees that the whole message will available at the receiving
68
  side. However, blocking {\em could} occur with the first {\tt Hrecv}, if the
69
  message has not been received at all yet;
70
\item The example implementation is {\em not} asynchronous, so the response
71
  always directly follows the request. If they {\em were} asynchronous, indeed
72
  there could be problems to figure out which request and response belong
73
  together. A common solution to that is the use of {\em cookies}, i.e. in the
74
  request you pass some unique number, and the same number is returned with
75
  the response;
76
\item Left as an exercise for the reader...
77
\item 'ravine'.
78
\end{enumerate}
79
80
\section*{Chapter~\ref{chap:stubgen}}
81
\begin{enumerate}
82
    \item Advantage: with the stub-generator you can focus on your the service
83
  you would like to define, instead of implementation details. The service
84
  definitions allow easy communication with other parties. There are
85
  significant advantages in programmer productivity. Disadvantages: when there
86
  is some problem in the stub-generator-generated code, it may be hard to
87
  debug;
88
    \item No, the NoTA service definitions are not fully compatible; for
89
  example, some parts of WSDL are ignored, such as {\em Operations}, {\em Port
90
  Types}, {\em Bindings}, {\em Ports} and {\em Services}; the same is true for
91
  many of the attributes of {\tt definition} and {\tt element}-elements. 
92
  NoTA service definitions support a {\em subset} of WSDL 1.1.
93
\end{enumerate}
94
95
\section*{Chapter~\ref{chap:stubgen-example}}
96
97
\section*{Chapter~\ref{chap:rm}}
98
\begin{enumerate}
99
\item Resolving services; similar to what a Domain Name Server does for
100
  internet services;
101
\item An ontology is a sort-of namespace in which a number of related NoTA
102
  services live. A service description is a structured string uniquely
103
  describing one particular service in an ontology;
104
\item The resource manager has a fixed address: \texttt{NOTA\_RM\_ADDRESS = {
105
      0, 0, 0 };};  
106
\item Use the \texttt{ResolveService}-messages;
107
\item Use the \texttt{NewEvent}-messages.
108
\end{enumerate}
109
110
\section*{Chapter~\ref{chap:development}}
111
\begin{enumerate}
112
\item {\tt \_req} is AN$\to$SN-requests, {\tt \_cnf} is for
113
  SN$\to$AN-confirmations, {\tt \_ind} is for SN$\to$AN-indications
114
  (unsolicited messages) and finally, {\tt \_rsp} is for AN$\to$SN-responses
115
  to {\tt \_ind}-messages. Messages are sent by the node on the left side of
116
  the arrow, and must be handled (implemented) by the right side.
117
\end{enumerate}