Robust applications framework in C++. Includes a static analysis tool and two applications.
This repository contains
The framework for robust C++ applications is referred to as the Robust
Services Core (RSC). RSC will put your project on the right path and jump-start
it if you’re developing or reengineering a system whose requirements can be
characterized as
The design patterns used in RSC make developers more productive. They have
been proven in flagship telecom products, including (from the author’s
experience as its chief software architect) the core network server that
handles all of the calls in AT&T’s cellular network. A pattern language that
summarizes the patterns appears in the
second chapter of Robust Communications Software.
The document RSC Software Overview
describes which of them are currently available in this repository and points
to the primary code files that implement them, and this
tutorial provides more information about some of
them.
The development of RSC has been somewhat sidetracked by the development of C++
static analysis tools. These tools detect violations of various C++ design
guidelines, such as those found in Scott Meyers’ Effective C++. They also
analyze #include
directives to determine which ones to add or delete. Their
editor then allows you to easily and interactively fix many of the warnings
that the tool generates. Even if you’re not developing applications with
RSC, you might find these tools useful. An overview of them is provided
here.
Including an application with a framework serves to test it and illustrate its
use. This repository therefore includes a POTS (Plain Ordinary Telephone
Service) application. POTS was chosen for several reasons. For one thing, the
author had extensive experience with similar applications while working in the
telecom industry. But more importantly, POTS is a non-trivial application, yet
everyone has a reasonable understanding of what it does. You should therefore
be able to figure out what the POTS code is doing without reading a large
specification. An overview of the POTS application is provided
here.
In 2002, a group in the UK began to design a protocol that allows software
bots to play the board game
Diplomacy). Their
website has various useful links and downloads,
amongst which is the executable for a Diplomacy server. Bots log into this
server, which sends them the state of the game, allows them to communicate with
one another using the protocol, and adjudicates the moves that they submit.
Their website also provides software for developing bots. I decided to
refactor this software, decouple it from
Windows, and bring it more in line with C++11. This helped RSC evolve
to better support standalone clients that use IP (TCP, in this case). The
resulting software is available in the dip directory and is
described in some further detail here.
This page provides an overview of RSC. Another page lists
documents that go into far more depth on many topics.
Download one of the
releases.
Code committed since the latest release is work in progress and may be unstable
or incomplete, so downloading from the Code▾ dropdown menu on the
main page is not recommended.
Warning
For proper operation, RSC must be launched from a directory below
its src directory. See the installation guide.
RSC
If you don’t want to build RSC, debug and release
executables are provided with each release.
The directories that contain RSC’s source code, and the dependencies between
them, are listed in the comments that precede the implementation ofmain
. Each of these directories is built as a separate
static library, with main
residing in its own directory.
RSC is developed using Visual Studio 2022 and built using CMake, as described
here. Windows build options for RSC
are described here. Visual
Studio’s .vcxproj files are no longer used during builds, so
they were removed from the repository.
During initialization, RSC displays each module as it is initialized.
(A module is equivalent to a static library.) After all modules
have initialized, the CLI prompt nb>
appears to indicate that CLI commands
in the nb directory are available. What is written to the console
during startup is shown here, and a list of all
CLI commands is provided here.
If you enter >read saveinit
as the first CLI command, a function trace of
the initialization, which starts even before the invocation of main
, is
generated. This trace will look a lot like this.
Each function that appears in such a trace invoked Debug::ft
, which records
the following:
All output appears in the directory ../
The numeric string yymmdd-hhmmss is appended to the names of these files
to record the time when the system initialized (for the console file and
initial log file) or the time of the most recent restart (for a subsequent
log file).
The easiest way to use RSC as a framework is to create a static library below
RSC’s src directory. The app directory is provided for
this purpose. Simply use whatever subset of RSC that your application
needs. This will always include the namespace NodeBase
(the nb
directory). It might also include NetworkBase
(the nw
directory) and SessionBase
(the sb directory). Using a new
namespace for your application is recommended.
If you put your code elsewhere, RSC will be unable to find important
directories when you launch it, as described in the
installation guide. You will then need
to modify the function Element::RscPath
so that it
can find the directory that contains the input directory. You
should also add RSC’s help directory to that directory.
To initialize your application, derive from Module
.
For an example, see NbModule
, which initializesNodeBase
. Change CreateModules
so that it also
instantiates your module, as well as the other modules that you need in
your build.
To interact with your application, derive fromCliIncrement
.
For an example, see NbIncrement
, the increment
for NodeBase
. Instantiate your CLI increment in your module’s Startup
function. When you launch RSC, you can then access the commands in your
increment through the CLI by entering >incr
, where incr
is the
abbreviation that your increment’s constructor passed to CliIncrement
‘s
constructor.
Most of the files in the input directory are test scripts. The
document that describes the POTS application
also discusses its tests, which exercise a considerable portion of RSC’s
software. Some other tests are more tactical in nature:
A set of scripts tests the Safety Net capability of the Thread
class.
A dedicated page describes these tests and the
current status of each one.
Entering >nt
in the CLI accesses the “nt” increment (a set of CLI
commands). It provides commands for testing functions in theBuddyHeap
,SlabHeap
,LeakyBucketCounter
,Q1Way
, Q2Way
, andRegistry
interfaces.
RSC is freely available under the terms of the Lesser GNU General Public
License, version 3, which basically says that you must also
publish your changes to RSC, such as bug fixes and enhancements. If you
are developing commercial software that you want to keep proprietary, the
LGPLv3 license allows applications built on RSC to be proprietary.
How to contribute to RSC is described here.
GitHub now lets you sponsor projects. A “Sponsor” button is located at the top
of this page.