GNU [u]Common C++
Contents
Introduction
GNU Common C++ is a class framework that was specifically designed for telephony applications. The original library was refactored into a different codebase which is better suited for embedded applications, GNU uCommon C++ (uCommon for short). The uCommon library, as currently packaged, also includes the original Common C++ class framework for legacy application support. All development of Common C++ now happens as part of uCommon, but we will continue to fix bugs in the original Common C++ codebase, which has long been considered stable.
General description
GNU uCommon and the original GNU Common C++ are both lightweight, portable and highly optimized class frameworks for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, serialization, config files, thread-optimized string and data structure classes, etc.
Either framework offers a class foundation that hides platform differences from your C++ application so that you need not write platform-specific code. uCommon has been ported to compile natively on most platforms which support either POSIX threads, or may be used with Debian-hosted mingw32 and mingw64 to build native threading applications for Microsoft Windows users.
These frameworks are used to construct application services like GNU Bayonne, with additional libraries such as the GNU Common C++ RTP Stack and the GNU ccScript engine. Other related libraries include the standalone GNU ccAudio2 framework.
Special features of GNU uCommon
GNU uCommon is meant as a very light-weight C++ library to facilitate using C++ design patterns even for very deeply embedded applications, such as for systems using uClibc along with POSIX threading support. For this reason, uCommon disables language features that consume memory or introduce runtime overhead, such as RTTI and exception handling, and assumes one will mostly be linking applications with other pure C-based libraries rather than using the overhead of the standard C++ library and other similar class frameworks.
UCommon introduces some Objective-C-based design patterns, such as reference-counted objects, memory pools and smart pointers, and offers dynamic typing through very light use of inline templates for pure type translation, which are then tied to concrete base classes to avoid template instantiation issues. C++ auto-variable automation is also used to enable deletion of referenced objects and release of threading locks when methods return, without requiring one to explicitly code for these things.
This library depends on, and when necessary will introduce, some portable
C replacement functions, especially for sockets, such as adding
getaddrinfo
for platforms which do not have it, or when threadsafe
versions of existing C library functions are needed. Basic socket support for
connecting to named destinations and multicast addresses, and binding to
interfaces with IPV4 and IPV6 addresses is directly supported. Support for
high-resolution timing and POSIX realtime clocks are also used when
available.
While uCommon has been influenced by Common C++, it introduces some new concepts for handling thread locking and synchronization. It also builds all higher-level thread synchronization objects directly from conditionals. Hence, on platforms which, for example, do not have reader-writer locks (rwlocks), barriers, or semaphores, these are still found in uCommon. A common and consistent call methodology is used for all locks, whether mutex, rw, or semaphore, based on whether used for exclusive or “shared“ locking.
UCommon requires some knowledge of compiler switches and options to disable language features, the C++ runtime and stdlibs, and associated C++ headers. The current version supports compiling with GCC, which is commonly found on GNU/Linux, OS X, BSD-based systems, and many other platforms; and the Sun Workshop compiler, which is offered as an example of how to adapt uCommon for additional compilers. UCommon may also be built with GCC cross-compiling for mingw32 for Microsoft Windows targets, using the Redhat w32 pthread library.
The minimum platform support for uCommon is a modern and working POSIX pthread threading library. uCommon does not support other non-POSIX threading models such as Microsoft Windows threads or non-preemtive threading libraries like GNU Pth, so that we could optimize development efforts around POSIX pthread exclusively. I further use a subset of POSIX threads to assure wider portability by avoiding more specialized features like process-shared synchronization objects, pthread rwlocks and pthread semaphores, as these are not implemented on all platforms that I have found.
Development
[2017] – The latest release of GNU uCommon is 7.0.0.
[2014] – The current release set, 6.1.0, of GNU uCommon is considered stable. This release corrected a long-standing issue with default exception models and completed legacy support. There are no immediate plans to introduce further features into the legacy library, though we may make changes to improve performance and/or support additional target platforms. There had been some separate work on a new version of the Serial I/O classes, and this may also get migrated into a future release.
[2010] – Current goals for GNU uCommon are in clarifying object naming and the current ABI.
[2007] – The first three releases of GNU uCommon were introduced in 1999-2000 as a pure “C” library for embedded targets, and had not seen an update in 7 years. Hence I have had the package name in use for a very long time. Work on what became GNU uCommon C++ 0.4 was originally intended as a refactoring effort for GNU Common C++ to better support IPV6, and became something different as entirely new code was written in 2006. I originally hoped to release uCommon in March of 2007 as a new package under the GNU GPLv3, but the license was unavoidably delayed. I may use uCommon to offer guidelines and code for further improving GNU Common C++ releases, I may merge the two packages, or I may make GNU Common C++ an extension library for uCommon. This has not been decided yet.
Downloading
GNU Common C++ and uCommon may be found at ftp.gnu.org or one of its mirrors. Please use a nearby mirror if you can.
Licensing
GNU Common C++ "2" and uCommon 1.* releases are licensed under the GNU General Public License, Version 2 or later, with runtime exception. Since release 2.0, GNU uCommon has been licensed under the GNU Lesser General Public License, Version 3 or later.
Documentation
Reference manuals
Class documentation can be generated from sources by Doxygen. Several versions are also available online:
- uCommon (7.0.0), at fossies.org; this manual documents source as well as header files, for the latest release of uCommon and Common C++;
- Common C++ 2 / Bayonne 2 Framework, generated from the header files of Common C++ 2 (1.3.11), Bayonne2 (2.3.2), ccScript3 (1.1.7), ccAudio2 (2.2.0), ccRTP (1.7.2) and libzrtpcpp (2.3.4);
- GNU Telephony class framework — 2010, based on uCommon (archived);
- uCommon class framework — 2007 (archived);
- GNU Bayonne / Common C++ class framework — 2007 (archived).
RPM and Debian documentation packages are also available for several versions of uCommon and Common C++ 2 (search for “ucommon-doc” or “commoncpp2-doc”).
User manuals
- Common Libraries FAQ gives a brief overview of the functionalities offered by GNU [u]Common C++, ccAudio, ccRTP and ccScript;
- Man page: Ucommon-config(1) at mankier.com.
- How to read installed documentation;
Support and Other Resources
The source code repositories can be accessed anonymously through the GNU Commoncpp project at Savannah.
The Common C++ mailing list is <bug-commoncpp@gnu.org>. It has a web interface for subscribing, modifying subscription options and searching the list archives. Feel free to send any bug reports, patches, and questions to this list.
To simplify management and bug tracking for the different packages I currently maintain, I have consolidated management of GNU Common C++, related GNU Common C++ packages, and GNU Telephony projects including GNU Bayonne and GNU SIP Witch. These are being managed through the GNU Telecom subsystem.
Related Projects
The following projects are known to use (or have used) GNU [u]Common C++:
- ARK Linux (archived) for some elements of their distro;
- GNU Telephony as a foundation library;
- GNU ccRTP-based projects such as Twinkle and SFLPhone client (replaced by Jami);
- Soxy (archived), a SIP security proxy server.
Contact information
The current maintainer for this package is <dyfet at gnu dot org>.
Info about GNU uCommon and GNU Common C++ was retrieved from the Wayback Machine archive of the GNU Telephony website (licensed under the Free Documentation License 1.3), and included into the existing page.