ICI Content

When an ICI is created using the KP op_ici_create(), the name of an ICI format must be supplied. An ICI format defines the structure of an ICI in terms of the attributes that it contains. Each attribute definition has four components: a name, a datatype, a default value, and an optional description, as shown in the following figure.

Figure 220: ICI Format Specification

ICI Format Specification

Attribute names are used to make references to attributes within an ICI. In other words, the name of an attribute plays the same role as the name of a field in a formatted packet. Operations that expect attribute names to be specified include setting, getting, and testing for the existence of attributes.

An attribute’s data type determines what sort of information it can store. The supported types are integer, double, and structure. Integer and double data types store whole numbers and floating-point decimal numbers, respectively. Structure attributes contain memory addresses to support the communication of arbitrary user-defined data with ICIs. In general, these types of attributes are assigned memory addresses returned by the dynamic memory allocation KP op_prg_mem_alloc(), as shown in the example below. Note that, unlike structure addresses embedded in packet fields, structure addresses in ICI attributes are not automatically subjected to deallocation when their encompassing ICI is destroyed. Instead, deallocation, if appropriate, must be performed by user processes.

Figure 221: Assignment of a Structure-Type ICI Attribute

/* Allocate a structure of type “Command” to pass within an ICI */
command_ptr = (Command*) op_prg_mem_alloc (sizeof (Command));

/* Setup the command structure. */
command_ptr->type = COMMAND_TYPE_A;
command_ptr->priority = COMMAND_PRIORITY_LOW;
command_ptr->request = SET_COMPRESSED_MODE;

/* Install the structure in “command” attribute of a new ICI. */
ici_ptr = op_ici_create (“link_control”);
op_ici_attr_set (ici_ptr, “command”, command_ptr);

When an ICI is initially created, integer and double attributes contain default values as specified in the ICIs format definition. Structure fields cannot be assigned default values because memory addresses cannot be known in advance. ICI attribute values can then be assigned by calling the KP op_ici_attr_set() which is applicable for all three types of attributes. Values for the three attribute types can also be obtained using the KP op_ici_attr_get().