Defines external interfaces provided by the System Resource Controller (SRC) subroutines.
The /usr/include/spc.h file defines data structures and symbolic constants that are used when calling the SRC subroutines. All subsystems that are controlled by the SRC via sockets or message queues should include this header file.
The scrreq data structure in the spc.h file defines the format of requests sent to a subsystem by the srcmstr daemon. This format is also used by SRC subroutines that send requests to the srcmstr daemon.
The srcreq data
structure contains the following fields:
The srchdr data structure in the srcreq data structure contains the return address that is needed to reply to the request. The srcrrqs subroutine can be used to extract this information from the request. The srchdr data structure is also part of the reply structure returned by a subsystem.
The srchdr data
structure contains the following fields:
The subreq data structure contains the request to be processed by the subsystem. This same structure is used when calling the srcsrqt subroutine to send a request to a subsystem. The srcsrqt subroutine formats the required srchdr structure. The request is processed by the srcmstr daemon and passed on to a subsystem.
The subreq data
structure contains the following fields:
The srcrep and statrep structures in the spc.h file define formats for the replies returned by a subsystem. For more information, see the srcsrpy subroutine.
The srcrep data
structure must be used for replies to start, stop, refresh, and trace
requests. It contains the following fields:
The statrep data
structure is used for replies to status requests. It contains the
following fields:
The spc.h file
also defines the following constants that are useful in communicating with the
srcmstr daemon:
SRCNAMESZ | The maximum length of an SRC object name (30 bytes, including the null terminator). |
SRCPKTMAX | The maximum packet size (8192 bytes). |
There are also SRC subroutines to
manage SRC objects, including subsystems and subservers. The
spc.h file defines certain symbolic constants which are
useful when defining object attributes. The following SRC object
descriptors are defined in the /usr/include/sys/srcobj.h file:
Respawn action: |
Contact options: |
Multiple instances of a subsystem are allowed: |
Display subsystem status under certain conditions: |
Default time limit: |
The spc.h file also includes the /usr/include/srcerrno.h file, which contains symbolic constants for the errors returned by the SRC library subroutines. The src_err_msg subroutine can be used to retrieve the corresponding error message.
The following program excerpt is an example of the SRC request (srcreq) structure.
struct srcreq { long mtype; /*Contains the message type in the IPC buffer*/ /*This field is included if IPC is used and a message queue is expected*/
struct srchdr srchdr; /*src header table entry - defined below*/ struct subreq subreq; /*the request passed to the subsystem*/ };
struct srchdr /*srchdr structure is used by SRC routines*/ /*subsystems are not responsible for setting \ this*/ { struct sockaddr_un retaddr; short dversion; /*the version of the data format*/ short cont; /*used to indicate message is continued*/ };
struct subreq { short object; /*object to act on*/ short action; /*action START, STOP, STATUS,TRACE,REFRESH*/ short parm1; /* */ short parm2; /* */ char objname[SRCNAMES]; /*object name*/ };
The srcobj.h file.
The srcrrqs subroutine, srcsrpy subroutine, srcsrqt subroutine, srcstat subroutine, srcstathdr subroutine, srcsbuf subroutine, srcstattxt subroutine, src_err_msg subroutine.
System Resource Controller (SRC) Overview for Programmers in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.
Programming Subsystem Communication with the SRC in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.