op_ici_create()
Abstract
Creates a new ICI with a predefined structure described by the specified ICI format.
Syntax
op_ici_create (fmt_name)
| Argument | Type | Description |
|---|---|---|
fmt_name |
const char * |
name of the ICI format to use as the basis for the created ICI [This value must be the name of a defined ICI format, or an error will occur.] |
Return Type
Ici *
Pointer to the newly created ICI. The constant OPC_NIL will be returned if any recoverable errors occur.
Example
Excerpt from: example model (models\std\x25); process model (x25_dce_ch); function block procedure (x25_dce_handle_ack).
/* Loop through saved packets that have been acked, discarding them. */
for (i = send_window_low; i != rcv_seq; INC(i))
{
if (window [i].format & x25C_GFI_D_BIT)
{
/* The D bit was set on this packet when we sent it, so this represents and */
/* end-to-end confirmation; notify the higher layer. */
iciptr = op_ici_create ("x25_data");
op_ici_attr_set (iciptr, "primitive", OSIC_N_DATA_ACK_INDICATION);
op_ici_attr_set (iciptr, "src address", chan_vars->local_addr);
op_ici_attr_set (iciptr, "dest address", chan_vars->remote_addr);
op_ici_attr_set (iciptr, "confirmation request", 1);
op_ici_attr_set (iciptr, "confirmation tag", window[i].tag);
op_ici_install (iciptr);
op_pk_send (op_pk_create (0), chan_vars->application);
x25_dce_trace_msg ("Notifying higher layer of end-to-end confirmation");
window [i].format = 0;
}
}
Details
A new ICI is allocated by the Simulation Kernel, and its pointer is returned by this KP to allow assignment of ICI attributes in the originating process. The ICI has a predetermined and fixed structure based on an ICI format, consisting of an ordered list of attribute names and types. The newly created ICI does not automatically affect future scheduled interrupts; this can only be accomplished via installation using the KP op_ici_install().
Purpose
Provides a mechanism for a process model to introduce new ICIs for communicating with neighboring processes. If a process model varies ICI attributes each time it schedules an interrupt, and it schedules additional interrupts before some of its previously scheduled interrupts are delivered, then it should create a new ICI for each scheduled interrupt. If, on the other hand, two process models communicate using a series of undelayed ICI-bearing interrupts, then only one ICI need be created for unidirectional communication (or two for bidirectional), at the beginning of the simulation.
Errors
- Program Abort: Allocation of memory failed. (due to insufficient memory to hold new ICI or its attributes)
- Program Abort: KP requires process context.
- Recoverable Error: ICI format (
<fmt_name>) is unrecognized.
Reference
- Use the KP op_ici_destroy() to perform the inverse operation and deallocate an ICI
- Use the KPs op_ici_attr_set_dbl(), op_ici_attr_set_int32(), op_ici_attr_set_int64(), and op_ici_attr_set_ptr() to assign the value of an ICI attribute
- Use the KP op_ici_install() to install an ICI for association with outgoing interrupts
- Use the KP op_ici_format_print_proc_set() to specify a custom print procedure for the named structure fields of ICIs with a given format