op_pk_priority_get()

Abstract

Obtains the value of the specified packet’s priority property.

Syntax

op_pk_priority_get (pkptr)
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().]

Return Type

double

Priority value of the specified packet.

This is a user-defined value which can take on any value permitted by the double data type. In cases where a packet has not had its priority property set, it has a special default value which is the symbolic constant OPC_PRIO_NOT_SET.

Example

Excerpt from: example model (models/std/base); process model (acb_fifo_ms); state (svc_compl); enter execs.

/* all contiguous packets which have completed service */
/* and are at the head of the queue may be removed and */
/* forwarded. Count how many such packets there are. */
for (j = 1; j < num_pks; j++)
	{
	pkptr = op_subq_pk_access (0, j);
	if (op_pk_priority_get (pkptr) != PK_STATUS_DONESVC)
		break;
	}

Details

The priority property of a packet can be modified or accessed at any time. Both unformatted and formatted packets can be operated on via this KP.

Purpose

Provides a mechanism to determine a packet’s priority value. Typically, this priority value is used as a guide for sorting subqueues or for inserting new packets into a presorted subqueue and maintaining the sorted ordering. These operations are supported by KPs in the Subq package, as discussed in the Reference section. However, because the priority property has a user-defined meaning, and because KPs exist to set and get this property, it can be used for many identification and discrimination applications in processes.

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.

Reference

  • Use the KP op_pk_priority_set() to assign a packet’s priority property
  • Use the KP op_subq_pk_insert(), with the pos_index argument set to the symbolic constant OPC_QPOS_PRIO, to insert a packet into a subqueue using the priority property as a guide for determining the insertion point (this requires the subqueue to be presorted according to packet priorities)
  • Use the KP op_subq_sort() to sort a queue according to the priority property of packets it contains

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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