op_pk_stamp_mod_set()
Abstract
Sets the object ID of the module where the specified packet was last stamped.
Syntax
op_pk_stamp_mod_set (pkptr, objid)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
pointer to the packet-of-interest [A pointer to a packet can be obtained from many KPs, including op_pk_create(), op_pk_create_fmt(), op_pk_copy(), op_pk_get(), op_subq_pk_access(), and op_subq_pk_remove().] |
objid |
Objid |
Module object ID to set |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the change was successful; OPC_COMPCODE_FAILURE otherwise
Example
/* declarations */
Packet *uf_pkptr;
Objid src_id;
/* create an unformatted packet */
uf_pkptr = op_pk_create (64);
/* Set the stamp module for this packet */
op_pk_stamp_mod_set (uf_pkptr, src_id);
Details
A process model invoking this function must own the packet to be changed; non-process model code can use this function for any packet.
Purpose
Provides a way for cosimulations to reset the location at which a packet was last stamped. Typically this KP is used in conjunction with the KP op_pk_stamp_time_set() to set delays in transmission from different source locations.
Errors
- Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
- Program Abort: Packet pointer is NIL.
- Program Abort: Packet pointer references destroyed packet.
- Program Abort: Packet pointer references unowned packet (
<pk_id>). - Program Abort: Only modules can be set as packet creator. Objid (
<objid>) is<type>.
Reference
- Use the KP
op_pk_stamp()to set a packet’s stamp - Use the KP
op_topo_parent()to convert a module object ID to the surrounding node’s object ID - Use the KPs
op_pk_creation_mod_get()andop_pk_creation_time_get()to obtain the module object ID and simulation time associated with a packet’s creation - Use the KP
op_pk_id()to obtain the unique ID of a packet