WAN Manager SPI Programming Guide

Communicating With the WAN Manager Process
WAN Manager SPI Programming Guide540013-001
2-5
Processing a Response Message
5. After the tokens are inserted into the SPI command buffer:
a. Call the SPI procedure SSGETTKN to get the used buffer length:
short usedlen;
if (SSGETTKN(spi_buffer, ZSPI_TKN_USEDLEN, (char *)
&usedlen))
{
return FAILURE;
}
b. Call the WRITEREAD procedure to send the SPI command buffer to the WAN
manager:
if (WRITEREADX(filenum, (char *) &spi_buffer,
usedlen, max_bufsize) != CCE)
? CCE indicates that WRITEREAD is successful
{
FILE_CLOSE_(filenum);
return FAILURE; .
}
Processing a Response Message
To process an SPI response from the WAN manager, first retrieve the tokens that are
calling the SPI procedure SSGET. This procedure retrieves only one token. Therefore,
to retrieve more tokens, call this procedure as many times as the number of tokens to
retrieve. After retrieving the tokens, check for error tokens and decode the response.
Example
1. Define a temporary response buffer (spi_resp):
spi_token spi_resp[20];
2. Add the ZSPI_TKN_DATALIST token:
spi_resp[0].tkn_name = ZSPI_TKN_DATALIST;
spi_resp[0].tkn_type = SPI_NONE;
3. Retrieve the ZSPI_TKN_DATALIST token from the SPI response buffer:
if (SSGETTKN(spi_buffer, spi_resp[0].tkn_name))
{
return FAILURE;
}