[ Previous | Next | Table of Contents | Index | Library Home |
Legal |
Search ]
Technical Reference: Base Operating System and Extensions , Volume 2
Sends a request to a subsystem.
System Resource Controller Library (libsrc.a)
#include <spc.h>
srcsrqt_r(Host, SubsystemName, SubsystemPID, RequestLength,
SubsystemRequest, ReplyLength, ReplyBuffer, StartItAlso,
Continued, SRCHandle)
char * Host, * SubsystemName;
char * SubsystemRequest, * ReplyBuffer;
pid_t SubsystemPID,
int, StartItAlso, * Continued;
short RequestLength, * ReplyLength;
char ** SRCHandle;
The srcsrqt_r subroutine sends a request to a subsystem, waits
for a response and returns one or more replies to the caller. The
format of the request and the reply is determined by the caller and the
subsystem.
Note: For each NEWREQUEST, the
srcsrqt_r subroutine creates its own socket to send a request to
the subsystem. The socket that this function opens remains open until
an error or an end packet is received.
This system is threadsafe and reentrant.
Two types of continuation are returned by the srcsrqt_r
subroutine:
No continuation
| ReplyBuffer->srchdr.continued is set to
the END constant.
|
Reply continuation
| ReplyBuffer->srchdr.continued is not set
to the END constant, but to a positive value agreed upon by the
calling process and the subsystem. The packet is returned to the
caller.
|
SubsystemPID
| The process ID of the subsystem.
|
Host
| Specifies the foreign host on which this subsystem request is to be
sent. If the host is null, the request is sent to the subsystem on the
local host.
|
SubsystemName
| Specifies the name of the subsystem to which this request is to be
sent. You must specify a SubsystemName if you do not specify
a SubsystemPID.
|
RequestLength
| Specifies the length, in bytes, of the request to be sent to the
subsystem. The maximum length is 2000 bytes.
|
SubsystemRequest
| Points to the subsystem request packet.
|
ReplyLength
| Specifies the maximum length, in bytes, of the reply to be received from
the subsystem. On return from the srcsrqt subroutine, the
ReplyLength parameter is set to the actual length of the subsystem
reply packet.
|
ReplyBuffer
| Points to a buffer for the receipt of the reply packet from the
subsystem.
|
StartItAlso
| Specifies whether the subsystem should be started if it is
nonactive. When nonzero, the System Resource Controller (SRC) attempts
to start a nonactive subsystem, and then passes the request to the
subsystem.
|
Continued
| Specifies whether this call to the srcsrqt subroutine is a
continuation of a previous request. If the Continued
parameter is set to NEWREQUEST, a request for it is sent to the
subsystem and the subsystem is notified that a response is expected.
Under normal circumstances, the calling process should never set
Continued to any value other than NEWREQUEST. The
last response from the subsystem will set Continued to
END. The caller must continue to call the
srcsrqt_r subroutine until END is received.
Otherwise, the socket will not be closed and the internal buffers
freed. As an alternative, set Continued=SRC_CLOSE to discard
the remaining data, close the socket, and free the internal buffers.
|
SRCHandle
| Identifies a request and its associated responses. Set to NULL by
the caller for a NEWREQUEST. The srcsrqt_r
subroutine saves a value in SRCHandle to allow srcsrqt_r
continuation calls to use the same socket and internal buffers. The
SRCHandle parameter should not be changed by the caller except for
NEWREQUESTs.
|
If the srcsrqt_r subroutine is successful, the value
SRC_OK is returned.
The srcsrqt_r subroutine fails and returns the corresponding
error code if one of the following error conditions is detected:
SRC_BADSOCK
| The request could not be passed to the subsystem because of a socket
failure.
|
SRC_CONT
| The subsystem uses signals. The request cannot complete.
|
SRC_DMNA
| The SRC daemon is not active.
|
SRC_INET_AUTHORIZED_HOST
| The local host is not in the remote /etc/hosts.equiv
file.
|
SRC_INET_INVALID_HOST
| On the remote host, the local host is not known.
|
SRC_INVALID_USER
| The user is not root or group system.
|
SRC_MMRY
| An SRC component could not allocate the memory it needs.
|
SRC_NOCONTINUE
| The Continued parameter was not set to NEWREQUEST,
and no continuation is currently active.
|
SRC_NORPLY
| The request timed out waiting for a response.
|
SRC_NSVR
| The subsystem is not active.
|
SRC_REQLEN2BIG
| The RequestLength is greater than the maximum 2000
bytes.
|
SRC_SOCK
| There is a problem with SRC socket communications.
|
SRC_STPG
| The request was not passed to the subsystem. The subsystem is
stopping.
|
SRC_UDP
| The SRC port is not defined in the /etc/services file.
|
SRC_UHOST
| The foreign host is not known.
|
- To request long subsystem
status, enter:
int cont=NEWREQUEST;
int rc;
short replen;
short reqlen;
char *handle;
struct
{
struct srchdr srchdr;
struct statcode statcode[20];
} statbuf;
struct subreq subreq;
subreq.action=STATUS;
subreq.object=SUBSYSTEM;
subreq.parm1=LONGSTAT;
strcpy(subreq.objname,"srctest");
replen=sizeof(statbuf);
reqlen=sizeof(subreq);
rc=srcsrqt_r("MaryC", "srctest", 0, reqlen, &subreq, &replen,
&statbuf, SRC_NO, &cont, &handle);
This entry gets long status of the subsystem srctest on the
MaryC machine. The subsystem keeps sending status packets
until statbuf.srchdr.cont=END.
- To start a subserver,
enter:
int cont=NEWREQUEST;
int rc;
short replen;
short reqlen;
struct
char *handle;
struct
{
struct srchdr srchdr;
struct statcode statcode[20];
} statbuf;
struct subreq subreq;
subreq.action=START;
subreq.object=1234;
replen=sizeof(statbuf);
reqlen=sizeof(subreq);
rc=srcsrqt_r("", "", 987, reqlen, &subreq, &replen, &statbuf,
SRC_NO, &cont, &handle);
This entry starts the subserver with the code point of 1234, but
only if the subsystem is already active.
- To start a subserver and a
subsystem, enter:
int cont=NEWREQUEST;
int rc;
short replen;
short reqlen;
char *handle;
struct
{
struct srchdr srchdr;
struct statcode statcode[20];
} statbuf;
struct subreq subreq;
subreq.action=START;
subreq.object=1234;
replen=sizeof(statbuf);
reqlen=sizeof(subreq);
rc=srcsrqt("", "", 987, reqlen, &subreq, &replen, &statbuf, SRC_YES, &cont, &handle);
This entry starts the subserver with the code point of
1234. If the subsystem to which this subserver belongs is
not active, the subsystem is started.
This subroutine is part of Base Operating
System (BOS) Runtime.
/etc/services
| Defines sockets and protocols used for Internet services.
|
/dev/SRC
| Specifies the AF_UNIX socket file.
|
/dev/.SRC-unix
| Specifies the location for temporary socket files.
|
The src_err_msg_r (src_err_msg_r Subroutine), srcsbuf_r (srcsbuf_r Subroutine), srcrrqs_r (srcrrqs_r Subroutine), srcstat_r (srcstat_r Subroutine), and
srcstattxt_r (srcstattxt_r Subroutine) subroutines.
List of SRC Subroutines 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.
System Resource Controller (SRC) Overview for
Programmers in AIX 5L Version 5.1 General Programming
Concepts: Writing and Debugging Programs.
[ Previous | Next | Table of Contents | Index |
Library Home |
Legal |
Search ]