blob: 8eb454014777202360a744f49eb98895ab7dfb15 [file] [log] [blame]
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -04001#
2#==================================================================================
3# Copyright (c) 2019 Nokia
4# Copyright (c) 2018-2019 AT&T Intellectual Property.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#==================================================================================
18#
19
20
21Source for the RIC Messaging Library -- RMR.
22
23C does not provide the concept of package names, yet we have
24a desire not to maintain all of the static code in a single large
25file, we use the following convention:
26
27 <name>.c -- C code which builds separately and generates an object
28 that is ultimately added to the archive.
29
30 <name>_static.c - File containing nothing but static functions (a.k.a package
31 only functions). These files should be included by other *.c
32 files and should not generate object.
33
34 <name>.h Header file that user applications are expected to include
35 in order to make use of the library
36
37 <name>_inline.h Header files containing inline static functions that the
38 user application is expected to include.
39
40 <name>_private.h Header file meant only to be included by the package.
41
42Further, as this code is used to generate both a Nanomsg and NNG based version,
43there are some modules which are specific to the underlying transport being
44used. The original code was based on Nanomsg, thus any changes resulting from
45the port to NNG, are in files with the same name plus _nng (e.g. rtable_static.c
46is the original module, and rrable_nng_static.c is the NNG version).
47
48
49External Names
50All externally facing function names and constants will start with rmr_ or
51RMR_ repsectively (RIC Message Router). For the time being, there is a
52set of mappings from the old uta_* names to rmr_* names. The user code must
53define UTA_COMPAT to have these ensbled.
54
55Internal Names
56Internal (static) functions have no mandiated convention. There are some
57names which are prefixed with uta_. These are left over from the original
58prototype libray which had the name Uta. The uta_ prefixes were mostly on
59functions which were iniitally external, but were pulled back for this release.
60
61
62
63Requirements
64To build the RMR libraries, both Nanomsg and NNG must be installed, and if not
65installed in the standard places (e.g. /usr/local/include and /usr/local/lib),
66then the proper references must be made in C_INCLUDE_PATH, and LD_LIBRARY_PATH.
67
68To install see the instructions on their html sites:
69 https://github.com/nanomsg/nng
70 https://nanomsg.org/download.html
71
72
73Unit Testing
Lott, Christopher (cl778h)b5f65982019-06-03 16:53:52 -040074The script ../test/unit_test.ksh should be used for running unit tests. With no
Ashwin Sridharanfd9cc7a2019-04-03 16:47:02 -040075parameters it will attempt to build any file in this directory which has the
76name *_test.c. Build is attempted with either mk or make and enables the
77necessary compiler flags to support coverage output (gcov). Once built, the
78test programme is executed and if the return code is success (0), the
79coverage data is interpreted.
80
81The test programmes may make use of ../test/tools.c which provide simple
82validation check functions. These programmes shouild also directly include
83the module(s) under test. This ensures that they are not linked, and are
84compiled with the proper coverage flags. In addition, it allows modules that
85are not under test to be linked from the archive and (most importantly) not
86reported on from a coverage perspective. In cases where two modules depend on
87each other, and are static functions, they will need to be tested from a single
88unit test programme (see the rt_tool test programme).
89
90It might be necessary to write a higher level test driver as some of the modules
91(e.g. route table) have threaded daemons which might not be easy to drive
92completely or at all, and thus the code coverage for a passing test might need
93to be lower for this type of module.
Lott, Christopher (cl778h)b5f65982019-06-03 16:53:52 -040094
95Containerized Build
96The Dockerfile defines an environment to build and test this library. It uses
97a base image with the C toolchain. The Dockerfile is NOT intended to create a
98distributable image.