Pathmaker Programming Guide
Coding Custom Services
Creating Services and Servers
067868 Tandem Computers Incorporated 4–23
Custom Source File Contents for a C Service
For each C service it contains, the Custom Source File must contain a section naming
the service and three functions. These portions of a Custom Source File are named as
follows:
?SECTION
service-name
<−− Section for this service
service-name
setup <−− Setup function
service-name
cleanup <−− Cleanup function
service-name
<−− Processing function
where
service-name
is the Pathmaker name of the service associated with this C
code.
service-name
is in lowercase and uses underscore characters rather than
hyphens.
The Pathmaker product places these headings in the Custom Source File for you
unless you are adding a service to the Custom Source File manually.
When a server is first started, the setup function for each service in the server is called
just after the logical files are opened. Before the server is shut down, the cleanup
function for each service is called just before the logical files are closed. The setup and
cleanup functions can be empty but cannot be deleted without altering the
C server skeleton.
The server calls the processing function whenever the server receives a request for the
service. The service’s open logical file descriptors and the request and reply buffers
are passed to the processing function.
In a Custom Source File that you write for C services, you can include calls to any of
the functions contained in the Pathmaker common service utility library as well as
your own functions and data declarations.
You should print out the contents of the Pathmaker common service utility library and
the Pathmaker common service utility library header before you begin to write code.
These files are named PMSVCULC and PMSVCULH and can be found in the project
catalog subvolume. Examine these files to understand what functions the Pathmaker
product already provides for you. Table 4-3 summarizes the functions available in the
Pathmaker common service utility library. More detailed documentation of these
functions appears in the Pathmaker common service utility library itself.