[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


srcrrqs_r Subroutine

Purpose

Copies the System Resource Controller (SRC) request header to the specified buffer. The SRC request header contains the return address where the caller sends responses for this request.

Library

System Resource Controller (libsrc.a)

Syntax


#include <spc.h>


struct srchdr *srcrrqs_r (Packet, SRChdr)
char * Packet;
struct srchdr * SRChdr;

Description

The srcrrqs_r subroutine saves the SRC request header (srchdr) information contained in the packet the subsystem received from the Source Resource Controller. The srchdr structure is defined in the spc.h file. This routine must be called by the subsystem to complete the reception process of any packet received from the SRC. The subsystem requires this information to reply to any request that the subsystem receives from the SRC.

This subroutine is threadsafe and reentrant.

Parameters


Packet Points to the SRC request packet received by the subsystem. If the subsystem received the packet on a message queue, the Packet parameter must point past the message type of the packet to the start of the request information. If the subsystem received the information on a socket, the Packet parameter points to the start of the packet received on the socket.
SRChdr Points to a caller-supplied buffer. The srcrrqs_r subroutine copies the request header to this buffer.

Examples

The following will obtain the subsystem reply information:

int rc;
struct sockaddr addr;
int addrsz;
struct srcreq packet;
struct srchdr *header;
struct srchdr *rtn_addr;
 
/*wait to receive packet from SRC daemon */
rc=recvfrom(0, &packet, sizeof(packet), 0, &addr, &addrsz;
/* grab the reply information from the SRC packet */
if (rc>0)
{
  header = (struct srchdr *)malloc(sizeof(struct srchdr));
  rtn_addr = srcrrqs_r(&packet,header);
  if (rtn_addr == NULL)
 {
    /* handle error */
    .
    .
  }

Return Values

Upon successful completion, the srcrrq_r subroutine returns the address of the caller-supplied buffer.

Error Codes

If either of the input addresses is NULL, the srcrrqs_r subroutine fails and returns a value of NULL.

SRC_PARM One of the input addresses is NULL.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The src_err_msg_r (src_err_msg_r Subroutine), srcsbuf_r (srcsbuf_r Subroutine), srcsrqt_r (srcsrqt_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 ]