op_pk_send()

Abstract

Forwards the specified packet through an output packet stream, schedules the packet's arrival at a destination module for the current simulation time, and releases ownership of the packet by the invoking process.

Syntax

op_pk_send (pkptr, outstrm_index)
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

Return Type

void

No return value.

Example

Excerpt from: example model (models/std/eth_net); process model (eth_mac); state (TX_START); enter execs.

/* increment the number of attempts made so far */
/* on the current frame */
attempts ++;

/* the frame is no longer waiting; notify */
/* the deference process of this transition */
frame_waiting = 0;
op_stat_write (FRAME_WAITING_OUTSTAT, frame_waiting);

/* record the start time for the transmission attempt */
/* in order to determine if late collisions occur */
/* (these are collisions occurring beyond one slot time) */
frame_start_time = op_sim_time ();

/* send frame to bus transmitter */
op_pk_send (tx_frame, LOW_LAYER_OUTPUT_STREAM);

Details

This KP schedules the specified packet's arrival at the destination module. The arrival is scheduled for the current simulation time, and the corresponding event is added to the simulation event list. The event will take place before any simulation time elapses, but not before the execution of other events already scheduled for the current simulation time. Upon execution of the event, the destination module will be invoked with a stream interrupt. If the destination module is a processor or a queue, its associated process may determine that the interrupt is due to an input stream via the KP op_intrpt_type(). Packets which arrive on input packet streams may be obtained by the destination process via the KP op_pk_get().

Once a packet is passed to this KP, the invoking process loses ownership of the packet, and the ownership is transferred to the destination module. This precludes further use of the packet by the current process.

This KP requires a process context, so it must only be invoked from a process model, or a function that has been invoked by a process model. Both formatted and unformatted packets are supported by this KP.

Purpose

Provides a mechanism for transferring packets within a node between modules that are connected by packet streams. This KP is the fundamental means of packet forwarding used in simulations. Variants of this KP provide delayed, forced, or quiet arrivals at the destination module, and the alternative op_pk_deliver…() KPs provide transport of packets without relying on the existence of a physical connection between modules.

op_pk_send() 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.

Reference

  • Use the KP op_pk_send_delayed() to send a packet with a delayed arrival
  • 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

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com