op_pk_encap_flag_is_set()

Abstract

Checks a flag on a packet to see if it has been set.

Syntax

op_pk_encap_flag_is_set (pkptr, 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().]
index int the flag to check on the packet
[The flag may be an integer from 0 to 31.]

Return Type

Boolean

OPC_TRUE if the flag has been set, OPC_FALSE if it has not been set.

Example

Excerpt from oms_bgutil.ex.c in models/std/utilities/oms.

if (op_pk_encap_flag_is_set (pkptr, OMSC_BGUTIL_ENCAP_FLAG_INDEX))
	{
	/* Drill to get the actual bgutil packet. */
	op_pk_encap_pk_get (pkptr, "bgutil_tracer", &bgutil_pkptr);

	if (bgutil_pkptr == OPC_NIL)
		{
		return_routed_bgutil = 0.0;
		*routed_packets_per_sec_ptr = 0.0;
		FRET (return_routed_bgutil);
		}

	/* Get the src and dest objids. */
	op_pk_nfd_get (bgutil_pkptr, "src_objid", &src_objid);
	op_pk_nfd_get (bgutil_pkptr, "dest_objid", &dest_objid);

	...

	}

Details

The number of the flag indicated by the index argument has no specific meaning; any meaning is determined by the model developer. If the packet has had a flag set using op_pk_encap_flag_set(), or if it contains such a packet, that flag is detectable using op_pk_encap_flag_is_set(). More than one flag may be set on a packet.

Purpose

Provides a mechanism for detecting flagged packets.

Errors

  • Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
  • Recoverable Error: Encap flag index (<index>) is out-of-range for packet (<pk_id>). Legal range is from 0 to (<index>).

Reference

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