prt_api_get_req

Name

prt_api_get_req

Purpose

Get request from external process.

Description

This routine provides a mechanism for an application to receive requests from the PRT Data Collector Resident Process (PRT_DC). For example, a PRT_DC can make a request to an external process for Item Tracking Data related to a specific Serialized Item. This API allows the application process to access the request issued by the PRT process.

There are currently two requests a process may receive from PRT:

  • Request for Item Tracking Data - the manifest constant for this request type is PRT_ITEM_REQ .
  • Request for instructions on placing a HOLD status on a list of serialized Items - the manifest constant for this request type is PRT_ITEM_HOLD_REQ .

If a Data Collector process which the application is configured to receive requests from terminates (or some other error occurs) the application will be notified by receiving a message with a request type of PRT_ERROR_RESP . In this case the service id of the associated Data Collector process will be placed in the prt_svc_id field of the PRT_REQ_INFO structure.

When prt_api_get_req is called, it empties the datagram receive buffer of all messages that have arrived since the last call to prt_api_get_req (or since the process registered as an external process) via successive reads, until a read is posted and the event flag remains low. The messages which are read are placed into one of two lists, one containing errors messages, and the other containing valid requests. If there are any messages in the error message list, these are always returned before the valid requests.

Syntax

int prt_api_get_req (req_type, req_info, retstat)
COR_U2            *req_type;
PRT_REQ_INFO_PTR  req_info;
COR_STATUS        *retstat;

Data Structures

typedef struct
{
  char        prt_svc_id[SERVICE_ID_LEN + 1] - PRT service id
  char        group_id[PRT_REGION_ID_LEN + 1] - group id
  char        item_id[PRT_ITEM_ID_LEN + 1] - item id
  char        reference_id[PRT_ITEM_ID_LEN + 1] - reference id
  COR_BOOLEAN ext_hold_active - TRUE if HOLD active
} PRT_REQ_INFO, *PRT_REQ_INFO_PTR;

Arguments

Argument Description
Input
None
Output
*req_type Request type
req_info Information contained in request
*retstat Pointer to COR_STATUS structure

Return Value

Either COR_SUCCESS, COR_FAILURE or COR_WARNING.

If the function returns COR_WARNING or COR_FAILURE, additional error information can be found in the COR_STATUS structure.

If there are no requests pending, the function returns COR_WARNING with the COR_STATUS err_code set to PRTI_NOTHING_PENDING.

Error Codes

PRTI_NOTHING_PENDING No requests pending (Warning)
IPC_ERR_PARTDEAD Partner Dead (Warning)
PRTI_UNKNOWN_INIT_SRC MF_INIT segment received from unknown service (Warning)
PRTI_INIT_MSG_RCVD Init segment received from Data Collector (Warning)
PRTI_UNEXPECTED_SEG Unexpected segment type (Warning)
PRTI_EF_CHECK_ERR Error checking event flag (Failure)
PRTI_BAD_MSG_MSG Error in segment (Failure)
PRTI_READ_PORT_ERR Error in ipc_read_port (Failure)