Writing a Port Monitor With the Service Access Facility (SAF)
This appendix gives a brief description of the functions a port monitor must perform to run under the service access facility (SAF) and service access controller (SAC).
The appendix covers the following topics:
What Is the SAF?
The service access facility (SAF) generalizes the procedures for service access so that login access on the local system and network access to local services are managed in similar ways. Under the SAF, systems can access services using a variety of port monitors, including ttymon, the listener, and port monitors written expressly for a user's application.
The manner in which a port monitor observes and manages access ports is specific to the port monitor and not to any component of the SAF. Users can therefore extend their systems by developing and installing their own port monitors. This ability to extend the SAF is one of its important features.
Relative to the SAF, a service is a process that is started. No restrictions are on the functions a service can provide.
The SAF consists of a controlling process, the service access controller (SAC), and two administrative levels corresponding to two levels in the supporting directory structure. The top administrative level is concerned with port monitor administration, the lower level with service administration.
From an administrative point of view, the SAF consists of the following components:
The SAC
A per-system configuration script
The SAC administrative file
The SAC administrative command sacadm
Port monitors
Optional per-port monitor configuration scripts
An administrative file for each port monitor
The administrative command pmadm
Optional per-service configuration scripts
What Is the SAC?
The service access controller (SAC) is the SAF's controlling process. The SAC is started by init() by means of an entry in /etc/inittab. Its function is to maintain the port monitors on the system in the state specified by the system administrator.
Use the administrative command sacadm to tell the SAC to change the state of a port monitor. sacadm can also be used to add or remove a port monitor from SAC supervision and to list information about port monitors known to the SAC.
The SAC's administrative file contains a unique tag for each port monitor known to the SAC and the path name of the command used to start each port monitor.
The SAC performs three main functions:
Customizes its own environment
Starts the appropriate port monitors
Polls its port monitors and initiates recovery procedures when necessary
Basic Port Monitor Functions
A port monitor is a process that is responsible for monitoring a set of homogeneous, incoming ports on a machine. A port monitor's major purpose is to detect incoming service requests and to dispatch them appropriately.
A port is an externally seen access point on a system. A port can be an address on a network (TSAP or PSAP), a hardwired terminal line, an incoming phone line, and so on. The definition of what constitutes a port is strictly a function of the port monitor itself.
A port monitor performs certain basic functions. Some of these functions are required to conform to the SAF. Other functions can be specified by the requirements and design of the port monitor itself.
Port monitors have two main functions:
Managing ports
Monitoring ports for indications of activity