op_intrpt_source()
Abstract
Obtains the object ID of the node, link, or module that was the source of the current interrupt of the invoking process.
Syntax
op_intrpt_source ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Objid
object ID of the module, node, or link that is the source of the current interrupt.
[This value may be the object ID of a node, link, processor, queue, transmitter, or receiver; for interrupts which do not have objects as sources, the special value represented by the symbolic constant OPC_OBJID_INVALID is returned.]
Example
Excerpt from: example model (models/std/tcp_ip); process model (host_ip); state (PROC_ICI); enter execs.
switch (op_intrpt_code ())
{
/* error from above */
case TRANSPORT_ERROR_INDICATION:
tran_objid = op_intrpt_source ();
/* Find stream number used to get to this transport entity */
for (i = 1; i <= op_strm_max_index_in(); i++)
{
if (tran_objid == op_topo_assoc (op_id_self (), OPC_TOPO_ASSOC_IN,
OPC_OBJMTYPE_MODULE, i))
break;
}
/* ... */
break;
/* ... */
}
Details
This procedure will produce valid results when called after any interrupt; however, the following interrupts have as their source object the Simulation Kernel, identified by the constant OPC_OBJID_KERNEL:
- begin simulation interrupt
- end simulation interrupt
- regular interrupt
Interrupts that are caused by a module source include:
- statistic interrupt
- stream interrupt
- self interrupt
- remote interrupt
- access interrupt
- procedure interrupt
- process interrupt
- multicast interrupt
Failure and recovery interrupts are caused by network-domain source objects (links and nodes).
Purpose
Provides a mechanism for determining the source object of an interrupt. From this object ID more detailed information can be obtained, such as the object’s type and attribute values. This is useful for writing sophisticated process logic which will respond to interrupts differently depending on aspects of the interrupt source object.
Errors
- No errors are trapped.
Reference
- Use the KP op_intrpt_type() to determine the type of the current interrupt
- Use the KP op_intrpt_code() to determine the numeric code associated with the current interrupt
- Use the KP op_intrpt_strm() to determine the stream index associated with a stream interrupt
- Use the KP op_intrpt_stat() to determine the input statistic index associated with a statistic interrupt
- Use the KPs op_ima_obj_attr_get() or op_ima_obj_attr_set() to access or assign values to source object attributes