This directory contains the source code for the Multicast Router (mcrouter
), a core application that facilitates inter-process communication (IPC) for creating connected networks of Things at the network edge. Applications using the AREG framework require mcrouter
to send and receive messages, making it an essential component of the AREG SDK. The mcrouter
can operate as a console application or an OS-managed service, depending on the configuration.
-
app Contains the source code to initialize and start the
mcrouter
application. On Windows and Linux, it can run as a console application or system service. -
service Implements the communication services for sending and receiving messages between connected applications.
-
resource Contains resource files specific to the
mcrouter
application.
-
Linux: The
mcrouter
runs as a console or OS-managed service application, and can be built with or without thencurses
library:- To enable
ncurses
features, compile the AREG extended static library by defining setting option-DAREG_EXTENDED:BOOL=ON
. - To disable
ncurses
, omitAREG_EXTENDED
option or set it toOFF
, using only the ANSI C API.
- To enable
-
Windows: The
mcrouter
operates as a console application or OS-managed service, and can be built with or without theWin32 API
for extended feature:- To enable
Win32 API
extended features, defineAREG_EXTENDED=1
. - To use only the ANSI C API, omit
AREG_EXTENDED
or set it to0
.
- To enable
Note
It does not make sense to enable extended features if application runs as an OS-managed service, because extended features manage cursor position on console, which is not accessible when application runs as a service. To save resources and linking time, disable extended features in the build by setting option -DAREG_EXTENDED:BOOL=OFF
While the implementation varies between Win32
and POSIX
systems, all components maintain consistent behavior across platforms. Header files in private
subdirectories are for internal use only and should not be included directly in external projects.
To configure and run the mcrouter
application as a Linux-managed service, follow these steps:
-
Copy Service Configuration File:
- Copy the
mcrouter.service
file to the/etc/systemd/system/
directory.
- Copy the
-
Copy the Executable:
- Copy the built
mcrouter.elf
executable to the desired location, such as/usr/local/bin
.
- Copy the built
-
Ensure Library Access (if applicable):
- If the AREG Framework was built as a shared library, ensure that
mcrouter
has access to thelibareg.so
library (e.g., located in/usr/lib
).
- If the AREG Framework was built as a shared library, ensure that
-
Edit the Service Configuration:
- Open the
mcrouter.service
file and verify that theExecStart
path points to the correct location of themcrouter.elf
executable. For example:ExecStart=/usr/local/bin/mcrouter.elf --service
- Ensure the
ExecStart
line includes the--service
(or-s
) as a command line option.
- Open the
-
Enable and Start the Service:
- Enable the service to start automatically at boot:
sudo systemctl enable mcrouter.service
- Start the service
sudo systemctl start mcrouter.service
- Enable the service to start automatically at boot:
-
Stop or Disable the Service:
- To stop the service:
sudo systemctl stop mcrouter.service
- To disable the service from starting at boot:
sudo systemctl disable mcrouter.service
- To stop the service:
To configure and run the mcrouter
application as a Windows-managed service, follow these steps:
-
Copy the Binaries:
- Copy the
mcrouter.exe
andareg.dll
binaries to the desired location.
- Copy the
-
Install the Service:
- Open PowerShell as the Administrator.
- Register the executable as a service by running:
.\mcrouter.exe --install
-
Start the Service:
- Open the Services application (or run
services.msc
in the Command Prompt). - Locate the service named AREG Log Collector Service.
- Start the service by right-clicking it and selecting Start.
- Open the Services application (or run
-
Stop and Uninstall the Service:
- Stop the service using the Services application or the
services.msc
command. - Uninstall the service by running the following command in PowerShell:
.\mcrouter.exe --uninstall
- Stop the service using the Services application or the
The mcrouter
provides flexible command-line and console commands for managing communication and connected instances.
These options configure the startup mode of mcrouter
:
-
--console
or-c
: Runsmcrouter
as a console application (default mode). Example:mcrouter --console
-
--install
or-i
: Installsmcrouter
as a system service (Windows only). Example:mcrouter --install
-
--load
or-l
: Loads configuration from the specified initialization file. Example:mcrouter --load=/path/to/config.file
-
--service
or-s
: Runsmcrouter
as a system service. Example:mcrouter --service
-
--uninstall
or-u
: Uninstallsmcrouter
as a service (Windows only). Example:mcrouter --uninstall
When running as a console application, the following commands are available:
-
--help
or-h
: Displays a help message summarizing available commands. -
--instances
or-n
: Displays a list of connected instances. Example:mcrouter --instances
-
--pause
or-p
: Pauses communication connections. Example:mcrouter --pause
-
--quit
or-q
: Stops the router and exits the application. Example:mcrouter --quit
-
--restart
or-r
: Restarts communication connections. Example:mcrouter --restart
-
--silent
or-t
: Stops displaying data rates in the console. Example:mcrouter --silent
-
--verbose
or-v
: Displays data rates in the console. Example:mcrouter --verbose