Sends a reply to a request from the System Resource Controller (SRC) back to the client process.
System Resource Controller Library (libsrc.a)
#include <spc.h>
int srcsrpy ( SRChdr, PPacket, PPacketSize, Continued)
struct srchdr *SRChdr; char *PPacket; int PPacketSize; ushort Continued;
The srcsrpy subroutine returns a subsystem reply to a System Resource Controller (SRC) subsystem request. The format and content of the reply are determined by the subsystem and the requester, but must start with a srchdr structure. This structure and all others required for subsystem communication with the SRC are defined in the /usr/include/spc.h file. The subsystem must reply with a pre-defined format and content for the following requests: START, STOP, STATUS, REFRESH, and TRACE. The START, STOP, REFRESH, and TRACE requests must be answered with a srcrep structure. The STATUS request must be answered with a reply in the form of a statbuf structure.
SRChdr | Points to the reply address buffer as returned by the srcrrqs subroutine. |
PPacket | Points to the reply packet. The first element of the reply packet is a srchdr structure. The cont element of the PPacket->srchdr structure is modified on returning from the srcsrpy subroutine. The second element of the reply packet should be a svrreply structure, an array of statcode structures, or another format upon which the subsystem and the requester have agreed. |
PPacketSize | Specifies the number of bytes in the reply packet pointed to by the PPacket parameter. The PPacketSize parameter may be the size of a short, or it may be between the size of a srchdr structure and the SRCPKTMAX value, which is defined in the spc.h file. |
Continued | Indicates whether this reply is to be continued. If the Continued parameter is set to the constant END, no more reply packets are sent for this request. If the Continued parameter is set to CONTINUED, the second element of what is indicated by the PPacket parameter must be a svrreply structure, since the rtnmsg element of the svrreply structure is printed to standard output. For a status reply, the Continued parameter is set to STATCONTINUED, and the second element of what is pointed to by the PPacket parameter must be an array of statcode structures. If a STOP subsystem request is received, only one reply packet can be sent and the Continued parameter must be set to END. Other types of continuations, as determined by the subsystem and the requester, must be defined using positive values for the Continued parameter. Values other than the following must be used: |
If the srcsrpy subroutine succeeds, it returns the value SRC_OK.
The srcsrpy subroutine fails if one or both of the following are true:
SRC_SOCK | There is a problem with SRC socket communications. |
SRC_REPLYSZ | SRC reply size is invalid. |
struct srcrep return_packet; struct srchdr *srchdr; bzero(&return_packet,sizeof(return_packet)); return_packet.svrreply.rtncode=SRC_OK; strcpy(return_packet.svrreply,"srctest"); srcsrpy(srchdr,return_packet,sizeof(return_packet),END);
This entry sends a message that the subsystem srctest is stopping successfully.
struct srcrep return_packet; struct srchdr *srchdr; bzero(&return_packet,sizeof(return_packet)); return_packet.svrreply.rtncode=SRC_SUBMSG; strcpy(return_packet.svrreply,objname,"mysubserver"); strcpy(return_packet.svrreply,objtext,"The subserver,\ mysubserver, has been started"); srcsrpy(srchdr,return_packet,sizeof(return_packet),END);
The resulting message indicates that the start subserver request was successful.
int rc; struct sockaddr addr; int addrsz; struct srcreq packet; struct { struct srchdr srchdr; struct statcode statcode[10]; } status; struct srchdr *srchdr; struct srcreq packet; . . . /* grab the reply information from the SRC packet */ srchdr=srcrrqs(&packet); bzero(&status.statcode[0].objname, /* get SRC status header */ srcstathdr(status.statcode[0].objname, status.statcode[0].objtext); . . . /* send status packet(s) */ srcsrpy(srchdr,&status,sizeof(status),STATCONTINUED); . . . srcsrpy(srchdr,&status,sizeof(status),STATCONTINUED); /* send final packet */ srcsrpy(srchdr,&status,sizeof(struct srchdr),END);
This entry sends several status packets.
/dev/.SRC-unix | Specifies the location for temporary socket files. |
The srcrrqs (srcrrqs Subroutine) subroutine, srcsbuf (srcsbuf Subroutine) subroutine, srcsrqt (srcsrqt Subroutine) subroutine, srcstat (srcstat Subroutine) subroutine, srcstathdr (srcstathdr Subroutine) subroutine, srcstattxt (srcstattxt Subroutine) subroutine, srcstop (srcstop Subroutine) subroutine, srcstrt (srcstrt Subroutine) subroutine.
List of SRC Subroutines in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
Programming Subsystem Communication with the SRC in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
System Resource Controller (SRC) Overview for Programmers in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
Understanding SRC Communication Types in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.