JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
ONC+ Developer's Guide     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information


1.  Introduction to ONC+ Technologies

2.  Introduction to TI-RPC

3.  rpcgen Programming Guide

4.  Programmer's Interface to RPC

5.  Advanced RPC Programming Techniques

6.  Porting From TS-RPC to TI-RPC

7.  Multithreaded RPC Programming

8.  Extensions to the Sun RPC Library

9.  NIS+ Programming Guide

A.  XDR Technical Note

B.  RPC Protocol and Language Specification

C.  XDR Protocol Specification

D.  RPC Code Examples

E.  portmap Utility

F.  Writing a Port Monitor With the Service Access Facility (SAF)

What Is the SAF?

What Is the SAC?

Basic Port Monitor Functions

Port Management

Activity Monitoring

Other Port Monitor Functions

Restricting Access to the System

Creating utmpx Entries

Port Monitor Process IDs and Lock Files

Changing the Service Environment: Running doconfig()

Terminating a Port Monitor

SAF Files

Port Monitor Administrative File

Per-Service Configuration Files

Private Port Monitor Files

SAC/Port Monitor Interface

Message Formats

SAC Messages

Port Monitor Messages

Message Classes

Port Monitor Administrative Interface

SAC Administrative File _sactab

Port Monitor Administrative File _pmtab

SAC Administrative Command sacadm

Port Monitor Administrative Command pmadm

Monitor-Specific Administrative Command

Port Monitor/Service Interface

New Service Invocations

Standing Service Invocations

Port Monitor Requirements

Initial Environment

Important Files

Port Monitor Responsibilities

Configuration Files and Scripts

Interpreting Configuration Scripts With doconfig()

Per-System Configuration File

Per-Port Monitor Configuration Files

Per-Service Configuration Files

Configuration Language

assign Keyword

push Keyword

pop Keyword

runwait Keyword

run Keyword

Printing, Installing, and Replacing Configuration Scripts

Per-System Configuration Scripts

Per-Port Monitor Configuration Scripts

Per-Service Configuration Scripts

Sample Port Monitor Code

Logic Diagram and Directory Structure



SAC/Port Monitor Interface

The SAC creates two environment variables for each port monitor it starts:

The SAC communicates with port monitors through FIFOs. A port monitor should open _pmpipe, in the current directory, to receive messages from the SAC and ../_sacpipe to send return messages to the SAC.

Message Formats

This section describes the messages that can be sent from the SAC to a port monitor (SAC messages), and from a port monitor to the SAC (port monitor messages). These messages are sent through FIFOs and are in the form of C structures. See Example F-2.

SAC Messages

The format of messages from the SAC is defined by the structure sacmsg:

struct sacmsg {
     int sc_size; /* size of optional data portion */
     char sc_type; /* type of message */

The SAC can send four types of messages to port monitors. The type of message is indicated by setting the sc_type field of the sacmsg structure to one of the following:

A port monitor must respond to every message sent by the SAC.

Port Monitor Messages

The format of messages from a port monitor to the SAC is defined by the structure pmmsg.

struct pmmsg {
     char pm_type;                /* type of message */
     unchar pm_state;             /* current state of port monitor */
     char pm_maxclass;            /* maximum message class this port
                                        monitor understands */
     char pm_tag[PMTAGSIZE + 1];  /* port monitor's tag */
     int pm_size;                 /* size of optional data portion */

Port monitors can send two types of messages to the SAC. The type of message is indicated by setting the pm_type field of the pmmsg structure to one of the following values:

For both types of messages, set the pm_tag field to the port monitor's tag and the pm_state field to the port monitor's current state. Valid states are:

The current state reflects any changes caused by the last message from the SAC.

The status message is the normal return message. The negative acknowledgement should be sent only when the message received is not understood.

pm_size indicates the size of the optional-data part of the message. pm_maxclass is used to specify a message class. Both fields are discussed in Message Classes. In the Solaris environment, always set pm_maxclass to 1 and sc_size to 0.

Port monitors can never initiate messages; they can only respond to messages that they receive.

Message Classes

The concept of message class has been included to accommodate possible SAF extensions. The preceding messages are all class 1 messages. None of these messages contains a variable data portion. All pertinent information is contained in the message header.

If new messages are added to the protocol, they are defined as new message classes, for example, class 2. The first message that the SAC sends to a port monitor is always a class 1 message. Because all port monitors by definition understand class 1 messages, the first message that the SAC sends is guaranteed to be understood. In its response to the SAC, the port monitor sets the pm_maxclass field to the maximum message class number for that port monitor. The SAC does not send messages to a port monitor from a class with a larger number than the value of pm_maxclass. Requests fail if they require messages of a higher class than the port monitor can understand. For the Solaris environment, always set pm_maxclass to 1.

For any given port monitor, messages of class pm_maxclass and messages of all classes with values lower than pm_maxclass are valid. Thus, if the pm_maxclass field is set to 3, the port monitor understands messages of classes 1, 2, and 3. Port monitors cannot generate messages; they can only respond to messages. A port monitor's response must be of the same class as the originating message.

Because only the SAC can generate messages, this protocol function – even if the port monitor is capable of dealing with messages of a higher class than the SAC can generate.

pm_size is an element of the pmmsg structure. sc_size is an element of the sacmsg structure. These elements indicate the size of the optional-data part of the message. The format of this part of the message is undefined. Its definition is inherent in the type of message. For the Solaris environment, always set both sc_size and pm_size to 0.