DECEDI_ADD_ITEM_LIST(3) — Subroutines
Name
DECEDI_ADD_ITEM_LIST − Adds an optional item to the item list. This is used to build up a request, which is then sent using DECEDI_POST, DECEDI_FETCH, or DECEDI_TRACK.
C Binding
#include <decedi_api_def.h>
unsigned long int DECEDI_ADD_ITEM_LIST (item_list,
item,
value_type,
value_length,
value,
flags)
decedi_t_item_list ∗item_list;
unsigned long int item;
unsigned long int value_type;
unsigned long int value_length;
char ∗value;
unsigned long int flags;
Arguments
item_list
The address of the item list into which the item is to be added.
For a new list, set the item list to NULL before this call.
item
The identifier of the item that is being added. Lists of valid identifier types are given in the routine definitions that use the constructed item lists (DECEDI_FETCH, DECEDI_POST, DECEDI_TRACK).
value_type
The type of the value being given. The possible values for this flag are shown in Table 1.
When using the DECEDI_UINTEGER type, it is important to pass the actual value using the pre-defined type ’decedi_t_ulong’ rather than use the independent.
Table 1: Values for Value Type
| Value | Description |
| ----- | ----------- |
| DECEDI_STRING | Value is a null terminated string. |
| DECEDI_UINTEGER | Value is an unsigned 32 bit integer. |
value_length
The length of the value being given.
value
The address of the value.
flags
Optional flags controlling what is done with the value. The possible values for this flag are shown in Table 2.
Table 2: Values for Add Item
| Value | Description |
| ----- | ----------- |
| DECEDI_READ_ONLY | Data cannot be modified by any subsequent call. This is the default. |
| DECEDI_WRITEABLE | Data placed on the list can be modified by a subsequent DEC/EDI call. |
Description
This routine adds an item to the item list and either copies or references the data associated with it. If it is a new item list then the item list will be allocated.
The item list must be disposed of when finished with by calling DECEDI_FREE_ITEM_LIST.
Return Values
DECEDI_BADPARAM
The request was rejected because the call had invalid, or missing, parameters, or the decedi_t_ulong type wasn’t being used for values passed as DECEDI_UINTEGER types.
DECEDI_INSUFVMThere was insufficient virtual memory available to carry out the request.
DECEDI_SUCCESSThe item was successfully added to the list.
Example
#include <decedi_api_def.h>
unsigned int status;
decedi_t_item_list item_list = (decedi_t_item_list) NULL;
decedi_t_ulong priority = DECEDI_HIGH_PRIORITY;
status = DECEDI_ADD_ITEM_LIST (&item_list,
(unsigned long int) DECEDI_ITM_PRIORITY,
(unsigned long int) DECEDI_UINTEGER,
(unsigned long int) sizeof (priority),
(char ∗) &priority,
(unsigned long int) DECEDI_READ_ONLY);
if (status == DECEDI_SUCCESS)
{
....