SMDFGetFields

Separates an SIDF section into its various components.

Syntax

  #include <smsutapi.h> 
   
  CCODE SMDFGetFields ( 
     UINT32                     headFID, 
     NWSM_GET_FIELDS_TABLE   table[ ], 
     BUFFERPTR                 *buffer, 
     UINT32                    *bufferSize);
  

Parameters

headFID

(IN) Specifies the FID value of the first field in the section that the engine expects to find in buffer.

table

(IN/OUT) Points to the table to receive the parsed section.

buffer

(IN/OUT) Points to the beginning of the section to be parsed in the buffer on input. Points to the next section on output.

bufferSize

(IN/OUT) Points to the size of buffer on input. Points to the buffer’s size minus the size of the returned section on ouput.

Return Values

The following table lists the return values associated with the function.

0x00000000

Successful

0xFFFBFFFA

NWSMUT_BUFFER_OVERFLOW: buffer is to small to contain the fields of table.

0xFFFBFFF0

NWSMUT_BUFFER_UNDERFLOW: A field's data spans buffer.

0xFFFBFFF9

NWSMUT_INVALID_FIELD_ID: headFid does not match the section FID in buffer.

Remarks

Before you call SMDFGetFields, set found to FALSE and fid to the field to look for.

SMDFGetFields parses a section into a table by calling SMDFGetNextField repetitively. SMDFGetFields does not handle buffer overflow or buffer underflow, but returns a completion code indicating the condition.

If SMDFGetFields returns an error, buffer and bufferSize may not contain their original values.

Each element in the table array represents one field in the section. The order of the elements, except the first and last elements (and where noted by SIDF), is not important to SMDFGetFields. If SMDFGetFields encounters a field that is not defined in table, the field is ignored.

See Also

SMDFGetNextField

SMDFGetFields Example

  #define SECTION_FID 0 
  #define NAME_INDEX 1 
  UINT16 syncData; 
  /* buffer and bufferSize are set elsewhere in the program. */ 
  BUFFERPTR origBufferPtr = buffer; 
  UINT32 origBufferSize = bufferSize; 
   
  NWSM_GET_FIELDS_TABLE table[] = 
  { 
     /* Section FID is FAKE_FID */ 
     { FAKE_FID, NULL, sizeof(UINT16), FALSE }, 
     { NWSM_SOURCE_NAME, NULL, NWSM_MAX_TARGET_SRVC_NAME_LEN, FALSE }, 
     /* End of table */ 
     { NWSM_END } 
  }; 
   
  /* Link the data fields to the variables */ 
  table[SECTION_FID].data = &syncData; 
  table[NAME_INDEX].data = calloc(1, NWSM_MAX_TARGET_SRVC_NAME_LEN); 
   
  if (SMDFGetFields(FAKE_FID, table, &buffer, &bufferSize) != 0) 
  { 
     /* Error occurred, reset buffer information to known values. */ 
     buffer = origBufferPtr; 
     bufferSize = origBufferSize; 
  }