netmsgs  1.2.2
RoadNarrows Robotics Network Messaging Package
main.doxy
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Network Messages Package
4 //
5 // File: main.doxy
6 //
7 // Description:
8 // This file contains the doxygen directives to generate the main page.
9 //
10 ////////////////////////////////////////////////////////////////////////////////
11 
12 /*! \file */
13 
14 /*! \mainpage RoadNarrows Network Messages Package
15 
16 \section main_intro Introduction
17 The NetMsgs package provides both build-time and run-time support of networked
18 messaging presented in a format that is both machine architecture independent
19 and language independent.
20 The messages can sent between networked nodes over a communication channel.
21 In the OSI Model, the NetMsgs package supports the Presentation Layer.
22 The lower communication levels and the Application Layer are not in the scope
23 of NetMsgs.
24 
25 Each packed transmitted and unpacked received message may have an application-
26 layer header followed by a series of zero or more message fields. The
27 message header semantics are not defined here, may contain
28 fields specifying message length, addressing, transaction ids, sequencing, and
29 synchronization fields.
30 
31 Communicating networked nodes can reside on separate, phyisically distinct
32 hardware, different processor cores on one the physical node,
33 or separate processing threads. The applcation defines the interconnects.
34 
35 The NetMsgs package provides support for various message encodings and byte
36 orderings as described in following sections.
37 
38 The NetMsgs package comprises of of three major subpackages detailed below:
39 \li NetMsgs XML Specification
40 \li Run-Time C Library
41 \li NetMsgs Python Package
42 
43 \subsection main_arch_req Minimum Node Architecture
44 The node architecture may be either a big-endian or little-endian architecture. Other, exotic byte-ordering architectures are not currently supported.
45 It is required that 1, 2, and 4 byte (unsigned) integers and 4 byte floats be
46 supported. For systems that do not support 8 byte (unsigned) integers, 8 byte
47 floating-point numbers, or 8-byte pointers,
48 promotion will be done in software. However,
49 on unpacking, rounding or truncation will occur if the unpacked element exceeds
50 the 4 byte limits.
51 
52 Floats are expected to be in IEEE 754 32-bit or 64-bit format.
53 
54 The implementation of the NetMsgs code is light-weight.
55 Therefore, it can be readily ported to embedded
56 processors that may have only 8, 14, or 16 bit word sizes and may only have
57 floating-point emulation.
58 
59 \section main_msg_enc Messsage Encodings
60 The NetMsgs package provides support for following message encodings.
61 
62 \subsection main_msg_enc_itv Id-Type-Value Messsage Encoding
63 The Id-Type-Value message encoding is a structured, binary message encoding.
64 The ITV encoding provides a message header plus a field header for each packed
65 field. Fields can be in any order and are identified by a 1 byte id. On the
66 message packing node, any deprecated fields will be skipped. On the unpacking
67 node, any unrecognized fields will be ignored. Deprected field ids should not
68 be reused to avoid misidentification, unless the application implements a
69 message versioning protocol (outside the scope of NetMsgs).
70 See \ref man_netmsgs_bnf for more details on the ITV message encoding.
71 
72 Both big and small endian byte orderings are supported.
73 
74 \htmlonly
75 <div style="padding-left: 20px;">
76 <table class="rnr-std">
77 <tr><th colspan="2">ITV Field Format</th></tr>
78 <tr>
79  <td>Identifier</td><td>A 1 byte, (sub)message-unique field id.</td>
80 </tr>
81  <tr>
82  <td>Type</td><td>A 1 byte, field type (see below)</td>
83 </tr>
84  <tr>
85  <td>Value</td><td>An n byte field value. Value may contain a subheader</td>
86 </tr>
87 </table>
88 <br>
89 </div>
90 \endhtmlonly
91 
92 \subsection main_msg_enc_flat Flat Messsage Encoding
93 The Flat message encoding is a binary message encoding with the message fields
94 formatted in a fixed order without any identification or type tagging.
95 The fields are all of fixed length. Flat message encodings are idea for
96 communication with embedded nodes over channels such as \h_i2c and serial.
97 See \ref man_netmsgs_bnf for more details on the Flat message encoding.
98 
99 Both big and small endian byte orderings are supported.
100 
101 \subsection main_msg_enc_cli CLI Messsage Encoding
102 The Command-Line Interface encoding is an ASCII message encoding with messages
103 fields separatated by Inter-Field Separators (usually white space) and
104 terminated by End-Of-Line sequences (usually CR, LF, or CR-LF).
105 
106 The CLI encoding is planned to be supported at some future time.
107 
108 \section main_msg_endian Byte Orderings
109 The NetMsgs package provides support for following message field byte
110 orderings:
111 
112 \htmlonly
113 <div style="padding-left: 20px;">
114 <table class="rnr-std">
115 <tr><th colspan="2">Field Byte Orderings</th></tr>
116 <tr>
117  <td>big endian</td>
118  <td>Field bytes are packed/unpacked Most-Significant Byte first.</td>
119 </tr>
120  <tr>
121  <td>little endian</td>
122  <td>Field bytes are packed/unpacked Least-Significant Byte first.</td>
123 </tr>
124  <tr>
125  <td>native</td>
126  <td>Field bytes are packed/unpacked native node architecture order.</td>
127 </tr>
128 </table>
129 <br>
130 </div>
131 \endhtmlonly
132 
133 \section main_subpkg_xml The NetMsgs XML Specification
134 The application message set is defined from a RoadNarrows NetMsgs XML
135 specification file. NetMsgs XML provides a tight, language-independent mechanism
136 to extend NetMsgs built-in field types and define messsages.
137 Meta-data elements are
138 also available to supply information for language-dependent build-time
139 generation. See \ref nmxml more details.
140 
141 \section main_subpkg_c The Run-Time C library
142 The libnetmsgs library provides run-time support for applications to
143 provide packing, unpacking, and tracing operations for NetMsgs generated
144 messages.
145 
146 The library interface is defined in the rnr/netmsgs.h header file.
147 
148 All libnetmsgs diagnostics logging is at diagnostics level 3.
149 
150 \section main_subpkg_py The NetMsgs Python Package.
151 The NetMsgs python package serves two functions:
152 
153 \subsection main_subpkg_py_bt Source Code Generation
154 From a NetMsgs XML file, language-specific source file(s) can be generated.
155 The executable python script netmsgsgent provides a command-line interface
156 to the NetMsgs modules that generate the source code.
157 See \ref man_netmsgsgen for the NetMsg language generation tool manpage.
158 
159 Typically, the source code dependencies are made in a makefile. An example
160 makefile target:
161 
162 \code
163 # NetMsgs XML pattern rule
164 include/%.h: %.xml
165  netmsgsgen --lang=c --xml=$(<) $(@) $(addsuffix .c,$(basename $(<)))
166 \endcode
167 
168 A summary of the supported and planned language-specific source code generation
169 is listed in the table below.
170 \htmlonly
171 <div style="padding-left: 20px;">
172 <table class="rnr-std">
173 <tr><th colspan="3">Generated Source Code</th></tr>
174 <tr><th>Language</th><th>Supported</th><th>Generated Files</th></tr>
175 <tr>
176  <td>c</td><td>yes</td><td>xmlfile -&gt; hfile,cfile</td>
177 </tr>
178 <tr>
179  <td>python</td><td>yes</td><td>xmlfile -&gt; pyfile</td>
180 </tr>
181 <tr>
182  <td>C++</td><td>future</td><td>xmlfile -&gt; hfile,cppfile</td>
183 </tr>
184 </table>
185 <br>
186 </div>
187 \endhtmlonly
188 
189 \subsection main_subpkg_py_rt Run-Time Support
190 The NetMsgs.NetMsgsLib module supports run-time python packing, unpacking, and
191 tracing operations.
192 See \ref nmPython/modules/NetMsgs/NetMsgsLib.py "NetMsgs.NetMsgsLib".
193 
194 \section man_ftypes Message Built-In Field Types.
195 NetMsgs built-in field types can be divided into two classes:
196 simple and compound. Simple field types have solitary values (e.g. an integer),
197 while compound types have mulitple fields and/or have extended lengths.
198 Compound types can be nested. Messages are compound types.
199 
200 Supported built-in field types are detailed below. Developers may readily extend
201 the types by defining them under the <b><field_types></b> section element in
202 the XML file.
203 
204 \subsection msg_simple Simple Types:
205 <table class="rnr-std">
206 <tr>
207  <th colspan="2">XML Ftype Attr</th>
208  <th colspan="2">ITV Type</th>
209  <th colspan="2">Value</th>
210  <th colspan="2">C Mapped Type</th>
211  <th rowspan="2">Comments</th>
212 </tr>
213 <tr>
214  <th>Value</th><th>Alias</th>
215  <th>Code</th><th>Hex</th>
216  <th>IsA</th><th>Bytes</th>
217  <th>Type Specifier</th><th>RNR Typedef</th>
218 </tr>
219 <tr>
220  <td>pad</td><td></td>
221  <td>x</td><td>0x77</td>
222  <td>0</td><td>1</td>
223  <td>N/A</td><td></td>
224  <td>Message buffer padded with 0's (see \ref NMFVAL_PAD).
225  No field id or type is present in the buffer.
226  No underlining variable is mapped.
227 </tr>
228 <tr>
229  <td>bool</td><td></td>
230  <td>?</td><td>0x3f</td>
231  <td>boolean</td><td>1</td>
232  <td>int</td><td>bool_t</td>
233  <td>0 is false, 1 (non-zero) is true.</td>
234 </tr>
235 <tr>
236  <td>char</td><td></td>
237  <td>c</td><td>0x63</td>
238  <td>character</td><td>1</td>
239  <td>char</td><td></td>
240  <td>8-bit ASCII character.</td>
241 </tr>
242 <tr>
243  <td>s8</td><td>schar</td>
244  <td>b</td><td>0x62</td>
245  <td>integer</td><td>1</td>
246  <td>signed char</td><td></td>
247  <td>8-bit signed integer.</td>
248 </tr>
249 <tr>
250  <td>u8</td><td>byte</td>
251  <td>B</td><td>0x42</td>
252  <td>integer</td><td>1</td>
253  <td>unsigned char</td><td>byte_t</td>
254  <td>8-bit unsigned integer</td>
255 </tr>
256 <tr>
257  <td>s16</td><td>short</td>
258  <td>h</td><td>0x68</td>
259  <td>integer</td><td>2</td>
260  <td>short</td><td></td>
261  <td>16-bit signed integer.</td>
262 </tr>
263 <tr>
264  <td>u16</td><td>ushort</td>
265  <td>H</td><td>0x48</td>
266  <td>integer</td><td>2</td>
267  <td>unsigned short</td><td>ushort_t</td>
268  <td>16-bit unsigned integer.</td>
269 </tr>
270 <tr>
271  <td>s32</td><td>int</td>
272  <td>i</td><td>0x69</td>
273  <td>integer</td><td>4</td>
274  <td>int</td><td></td>
275  <td>32-bit signed integer.</td>
276 </tr>
277 <tr>
278  <td>u32</td><td>uint</td>
279  <td>I</td><td>0x49</td>
280  <td>integer</td><td>4</td>
281  <td>unsigned int</td><td>uint_t</td>
282  <td>32-bit unsigned integer.</td>
283 </tr>
284 <tr>
285  <td>s64</td><td>longlong</td>
286  <td>q</td><td>0x71</td>
287  <td>integer</td><td>8</td>
288  <td>long long</td><td></td>
289  <td>64-bit signed long long integer.
290  On 32-bit long long machines, the 4 MSB's are padded with zero's
291  when packed, and truncated when unpacked.
292  </td>
293 </tr>
294 <tr>
295  <td>u64</td><td>ulonglong</td>
296  <td>Q</td><td>0x51</td>
297  <td>integer</td><td>8</td>
298  <td>unsigned long long</td><td>ulonglong_t</td>
299  <td>64-bit unsigned long long integer.
300  On 32-bit long long machines, the 4 MSB's are padded with zero's
301  when packed, and truncated when unpacked.
302  </td>
303 </tr>
304 <tr>
305  <td>f32</td><td>float</td>
306  <td>f</td><td>0x66</td>
307  <td>floating-point number</td><td>4</td>
308  <td>float</td><td></td>
309  <td>32-bit IEEE 754 floating-point number.
310  On 64-bit FPN machines, the 32-bit FPN is rounded down when packed and
311  converted to IEEE 754 64-bit standard when unpacked.
312  </td>
313 </tr>
314 <tr>
315  <td>f64</td><td>double</td>
316  <td>F</td><td>0x46</td>
317  <td>floating-point number</td><td>8</td>
318  <td>double</td><td></td>
319  <td>64-bit IEEE 754 floating-pointer number.
320  On 32-bit FPN machines, the 32-bit FPN is converted to IEEE 754 64-bit standard
321  when packed and rounded down when unpacked.
322  </td>
323 </tr>
324 <tr>
325  <td>p32</td><td>pointer</td>
326  <td>p</td><td>0x6c</td>
327  <td>pointer</td><td>4</td>
328  <td>(typecasted) void *</td><td></td>
329  <td>32-bit native pointer.
330  On 64-bit pointer machines, the 4 MSB's are truncated when packed and
331  padded with zero's when unpacked.
332  </td>
333 </tr>
334 <tr>
335  <td>p64</td><td>longpointer</td>
336  <td>P</td><td>0x4c</td>
337  <td>pointer</td><td>8</td>
338  <td>(typecasted) void *</td><td></td>
339  <td>64-bit native pointer.
340  On 32-bit pointer machines, the 4 MSB's are padded with zero's
341  when packed, and truncated when unpacked.
342  </td>
343 </tr>
344 </table>
345 
346 \subsection msg_complex Compound Types:
347 <table class="rnr-std">
348 <tr>
349  <th colspan="2">XML Ftype Attr</th>
350  <th colspan="2">ITV Type</th>
351  <th colspan="2">Value</th>
352  <th colspan="2">C Mapped Type</th>
353  <th rowspan="2">Comments</th>
354 </tr>
355 <tr>
356  <th>Value</th><th>Alias</th>
357  <th>Code</th><th>Hex</th>
358  <th>SubHeader</th><th>Bytes</th>
359  <th>Type Specifier</th><th>RNR Typedef</th>
360 </tr>
361 <tr>
362  <td>string</td><td></td>
363  <td>s</td><td>0x73</td>
364  <td>count</td><td>variable</td>
365  <td>char[]</td><td></td>
366  <td>Field of <em>count</em> ASCII bytes. The terminating null is not packed.
367  A terminating null is appended to the unpacked variable.</td>
368 </tr>
369 <tr>
370  <td>struct</td><td></td>
371  <td>{</td><td>0x7b</td>
372  <td>count</td><td>variable</td>
373  <td>struct</td><td></td>
374  <td>Extended or inline structure of <em>count</em> fields.</td>
375 </tr>
376 <tr>
377  <td>vtype[]</td><td></td>
378  <td>[</td><td>0x5b</td>
379  <td>count vtype</td><td>variable</td>
380  <td><em>vtype</em>[]</td><td></td>
381  <td>One-dimensional array of <em>count</em> items of <em>vtype</em> type.</td>
382 </tr>
383 </table>
384 
385 \section req Requirements
386 \termblock
387 \term <b>librnr</b> \termdata RNR standard libray 1. \endterm
388 \term <b>xml</b> \termdata Python XML package. \endterm
389 \term <b>struct</b> \termdata Python packing package. \endterm
390 \endtermblock
391 
392 \section platforms Supported Platforms
393 \termblock
394  \term i386
395  \termdata any Linux Intel (backwards) compatible 32-bit architecures
396  \endterm
397  \term x86_64
398  \termdata any Linux AMD 64-bit architectures
399  \endterm
400  \term armang
401  \termdata Angstrom Linux Intel XScale PXA Arm architecures.
402  \endterm
403  \term armpxa
404  \termdata Familiar Linux Intel XScale PXA Arm architecures.
405  \endterm
406  \term cygwin
407  \termdata Windows systems with installed cygwin.
408  \endterm
409  \term osx
410  \termdata Mac OS-X architectures
411  \endterm
412 \endtermblock
413 
414 \section tested Tested Systems
415 \termblock
416  \term Fedora Core
417  \termdata Fedora Core 5 and 6 Linux for the i386 and x86_64 architectures.
418  \endterm
419  \term Ubuntu
420  \termdata Ubuntus 9.10 Linux for the i386 and x86_64 architectures.
421  \endterm
422  \term Angstrom
423  \termdata Angstrom Linux 2.6 (K-Team KoreBot2 version) for the XScale PXA
424  255 Arm.
425  \endterm
426  \term Familiar
427  \termdata Familiar Linux 2.4 (K-Team KoreBot version) for the XScale PXA
428  255 Arm.
429  \endterm
430  \term Windows
431  \termdata Windows XP with Cygwin for Intel processors.
432  \endterm
433  \term Mac
434  \termdata Mac OS-X 10.x for Intel processors.
435  \endterm
436 \endtermblock
437 
438 \todo Cross-field conditional field packing/unpacking.
439 \todo Support disposition deprecated/active at the fielddef level.
440 \todo Support disposition deprecated/active at the msgdev level.
441 
442 \page page_eula EULA
443 \section eula_txt RoadNarrows Robotics librnr Package End User Licence Agreement
444 
445 \subsection eula_permissions Permissions
446 Permission is hereby granted, without written agreement and without
447 license or royalty fees, to use, copy, modify, and distribute this
448 software and its documentation for any purpose, provided that
449 (1) The above copyright notice and the following two paragraphs
450 appear in all copies of the source code and (2) redistributions
451 including binaries reproduces these notices in the supporting
452 documentation. Substantial modifications to this software may be
453 copyrighted by their authors and need not follow the licensing terms
454 described here, provided that the new terms are clearly indicated in
455 all files where they apply.
456 
457 \subsection eula_warranties Warranties
458 In no event shall the author, RoadNarrows Robotics or any members/employees
459 of RoadNarrows Robotics or distributors of this software be liable to any
460 party for direct, indirect, special, incidental, or consequential
461 damages arising out of the use of this software and its documentation,
462 even if the authors or any of the above parties have been advised of
463 the possibility of such damage.
464 
465 The author and RoadNarrows Robotics specifically disclaim any warranties,
466 including, but not limited to, the implied warranties of merchantability anD
467 fitness for a particular purpose. the software provided hereunder is on an
468 "as is" basis, and the authors and distributors have no obligation tO
469 provide maintenance, support, updates, enhancements, or modifications.
470 
471 \subsection eula_copyright Copyright
472 All Rights Reserved by RoadNarrows Robotics
473 \n (C) 2005-2009
474 \n http://www.roadnarrowsrobotics.com
475 
476 */