Part four: Modules

To make the server program easier to build and program, the program will be split into almost independent modules. All of these modules will be built at the same time and statically linked into the resulting executable program file.

Some of these modules will be in separated directories (e.g. the network module), and will be built as static libraries. Other modules will already be in the main source directory, and will only be using a separate namespace. Also, some modules, specially those in sub-directories (again, e.g.  the network module), will have their own sub-modules.

API

All modules have only three common API functions: An init function, a boot function, and a clean function.

  • init() is called on initialization of the server program.
  • boot() is called after all initialization is done.
  • clean() is called at shutdown for cleanup.

All other functions and classes in the modules is specific to that module.

Some modules, most notably the configuration module,  will have a custom standard function (the configuration modules init() needs the command line argument parameters.)

Module list

Here is a list of all modules, in the order they are initialized:

  1. Configuration (namespace raven::config)
  2. Logging (namespace raven::log)
  3. Host (namespace raven::host)
  4. Network (namespace raven::net, directory net)
  5. Database (namespace raven::db, directory db)

Design of the configuration module here.

Design of the network module here.

Design of the database module is not done yet. This module will also include sub-modules to parse and execute the library code.

The calling of the boot function will be the same as the initialization order. The calling of the clean function will be in reversed order.

Leave a comment