# DLG's Inner Workings

### For the technical reader

DLG operates as a number or resident processes that communicate with each other via shared message ports, and which have access ports to external, shell-based programs. The primary modules are the Handler, Resource Manager, Cron Modules, Mail Manager, and shared library.

TPT-Handler is a DOS handler that is designed to interface shell programs to non-shell interfaces. In most cases, it interfaces the shell to the serial port. It can also optionally use console.device as an interface, either as the primary interface (local login) or as an auxilliary (sysop watching user's remote login). The handler is the heart of the BBS -- without the handler, the rest of the BBS will not work at all.

In the process of this interfacing, the handler also handles a lot of low level operations, such as data filtering and translation. This ensures that the data stream from the remote is a clean ANSI compliant data stream, and also ensures that the BBS works in a manner consistent with an ANSI terminal. However, this can have ill effects on binary file transfers. To address this, the handler's translation routines can be turned on and off as needed.

For each port that is open, a copy of TPT-Handler is loaded into memory. All I/O intended for that port goes through the appropriate copy of the handler.

The resource manager, Resman, is a resident program that is tasked with keeping track of various system resources. Each file and message area, each language, each port, named resource -- in short, all trackable resources are tracked through this program, and access to these resources are thus controlled by this program's responses. Communication with the port is performed solely through its message ports.

The cron module, TPTCron, is a time keeper. All time-related functions are handled through this program. It initially reads a predefined series of time events from a file called crontab. Once this is accomplished, it can be further altered by communication through its message port or its Arexx port. In addition to this, a shell-based program is provided to allow access to the message port from a shell or batch file.

The main manager, DLGMail, is a resident program with a multitude of functions, but they can be boiled down to saying that it is the mail dispatcher. It controls when and how outgoing calls are made, it calls appropriate mail programs when needed, and it controls access to most of the FidoNet mail functions. It is communicated to via its message port and an Arexx port. A shell based program is provided to allow shell and batch control of mail processes, as well.

The shared library dlg.library contains a multitude of sub-programs that are used by virtually every DLG executable. It contains functions that interface to all the major parts of DLG, such as the handler and resource manager, as well as a number of specialized and generalized functions.