op_pk_send_delayed()
Abstract
Forwards the specified packet through an output packet stream, schedules the packet's arrival at a destination module for a delayed simulation time, and releases ownership of the packet by the invoking process.
Syntax
op_pk_send_delayed (pkptr, outstrm_index, delay)
| 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().] |
outstrm_index |
int |
index of an output packet stream of the surrounding module |
delay |
double |
amount of simulation time to delay arrival of packet [This must be a positive number (or zero).] |
Return Type
void
No return value.
Example
Excerpt from: example model (models/std/fddi); process model (fddi_mac); state (TX_DATA); enter execs.
/* Send the frame once previous transmissions have completed. */
/* Account for propagation delay as well. */
op_pk_send_delayed (pkptr, FDDI_PHY_STRM_OUT, accum_bandwidth + Fddi_Prop_Delay);
/* Increment THT emulation variable, and consumed bandwidth accumulator. */
tht_value += tx_time;
accum_bandwidth += tx_time;
Details
This KP schedules the specified packet's arrival at the destination module. The arrival is scheduled for the current simulation time plus the specified delay, and the corresponding event is added to the simulation event list. As soon as the event is scheduled, this KP returns control to the invoking process. The event will take place at the delayed simulation time, but not before the execution of other higher priority events scheduled for that specific simulation time. During the delay interval, the invoking process is free to pursue any activities; it no longer has any association with the delayed packet. Thus this KP can be used to model the processing delays associated with packet transmission. Upon execution of the scheduled event, the destination module will be interrupted with a stream interrupt, indicating that the packet can be obtained via op_pk_get().
Once a packet is passed to this KP, the invoking process loses ownership of the packet. Any KPs invoked by the sending process which are passed the same packet pointer will result in packet ownership errors. This KP requires a process context, and supports sending of both formatted and unformatted packets.
Purpose
Provides a mechanism to transfer packets within a single node between modules that are connected by packet streams. This KP is a variation of op_pk_send() and is useful for modeling a processing or transmission delay that is due to the invoking process. Other variants of op_pk_send() provide forced or quiet arrivals at the destination module, and the alternative op_pk_deliver…() KPs provide transport of packets without requiring the presence of a physical stream object.
op_pk_send_delayed() allows packets to be forwarded to other processes running in processors or queues, or to transmitter modules.
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: Packet pointer references static packet (
<pk_id>). - Program Abort: Packet delivery failed at object (
<mod_objid>), stream (<instrm_index>) - Program Abort: KP requires process context
- Recoverable Error: Output stream index (
<outstrm_index>) is out-of-range. - Recoverable Error: Output stream index (
<outstrm_index>) is unoccupied. - Recoverable Error: Delay value (
<delay>) is out-of-range.
Reference
- Use the KP op_pk_send() to send a packet without any delay
- Use the KP op_pk_send_forced() to send a packet and begin immediate processing at the destination
- Use the KP op_pk_send_quiet() to send a packet without causing an interrupt at the destination module
- Use the KPs
op_pk_deliver…()to forward packets to modules without using packet streams - Use the KP op_pk_get() to obtain a pointer to an arriving packet