9177cd34564ad297979172483c5a00840547784a
[ric-plt/lib/rmr.git] / doc / src / rtd / developer-guide.xfm
1 .** vim: ts=4 noet sw=4:
2 .if false
3 ==================================================================================
4         Copyright (c) 2019 Nokia
5         Copyright (c) 2018-2019 AT&T Intellectual Property.
6
7    Licensed under the Apache License, Version 2.0 (the "License");
8    you may not use this file except in compliance with the License.
9    You may obtain a copy of the License at
10
11        http://www.apache.org/licenses/LICENSE-2.0
12
13    Unless required by applicable law or agreed to in writing, software
14    distributed under the License is distributed on an "AS IS" BASIS,
15    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16    See the License for the specific language governing permissions and
17    limitations under the License.
18 ==================================================================================
19 .fi
20
21
22 .if false
23         Mnemonic:       config-deploy.xfm
24         Abstract:       Source to generate a configuration deployment guide.
25         Date:           6 November 2019
26         Author:         E. Scott Daniels
27 .fi
28
29 .im setup.im
30
31 &h1(RMR Developer Guide)
32
33 The RIC Message Router (RMR) is a library for peer-to-peer
34 communication.  Applications use the library to send and receive
35 messages where the message routing and endpoint selection is based on
36 the message type rather than DNS host name-IP port combinations.
37 &space
38 This document contains information that developers need to know to
39 contribute to the RMR project.
40
41 &h2(Language)
42 RMR is written in C, and thus a contributing developer to the core
43 library should have an excellent working knowledge of C.  There
44 currently is one set of cross-languages bindings supporting Python,
45 and a developer wishing to contribute to the bindings source should be
46 familiar with Python (version 3.7+) and with the Python &ital(ctypes)
47 library.
48
49 &h2(Code Structure)
50 RMR is designed to provide an insulation layer between user
51 applications and the actual transport mechanism.  Initially RMR was
52 built on top of the third-party library Nanosmg, shortly after was
53 ported to the third-party library NNG (Nanomsg Next Generation), and
54 then was ported to an internally developed socket library called SI95.
55 RMR presents the same API to the user application regardless of the
56 underlying transport library, but the resulting output when compiling
57 RMR is always a transport-specific library.  As an example,
58 &cw(librmr_nng.a) is the library generated for use with the NNG
59 transport.  &space
60
61 As such the library source is organised into multiple components:
62
63 &beg_dlist(.75i : ^&bold_font )
64
65 &di(common) Source in the common directory is agnostic to the
66         underlying transport mechanism (Nanomsg, NNG, SI95, ..), and
67         thus can be used when generating either library.
68
69 &di(nano) Source which is tightly coupled with the underlying Nanomsg library.
70         (Nanomsg has been deprecated, but the RMR source remains as an example.)
71
72 &di(nng) Source which is tightly coupled with the underlying NNG library.
73         (NNG has been deprecated, but the RMR source remains as an example.)
74
75 &di(si) Source which is tightly coupled with the underlying SI95 library.
76
77 &end_dlist
78
79 &space
80 &h3(Internal Function Exposure)
81 The decision to limit as much as practical the exposure of truly
82 internal RMR functions was made, and as a result most of the RMR
83 functions carry a &cw(static) label.  In order to modularise the code
84 as much as possible, this means that the primary module
85 (e.g. rmr_nng.c) directly includes other RMR modules, rather than
86 depending on referencing the internal functions during linking.  While
87 this is an infrequently used approach, it does mean that there are
88 very few functions visible for the user application to reference, all
89 of them having the prefix &cw(rmr&{esc}_). This allows internal
90 functions to have shorter names while still being meaningful.
91
92 &h2(Coding Style)
93 There is a list of coding style guidelines in the top level directory,
94 and as such they are not expanded upon here.  The general practice is
95 to follow the style when editing an existing module, respect the
96 author's choice where style alternatives are not frowned upon.  When
97 creating new modules, select a style that fits the guidelines and is
98 easy for you to work with.  There are a few things that the RMR
99 maintainers insist on, but for the most part style is up to the
100 creator of a module.
101
102 &h2(Building)
103 RMR is constructed using CMake.  While CMake's project description can
104 be more cumbersome than most typical Makefiles, the tool provides
105 convenience especially when it comes to creating DEB/RPM packages.