op_prg_odb_pktrace_active()

Abstract

Determines if the specified packet is affected by tracing commands issued under ODB, the Simulation Debugger.

Syntax

op_prg_odb_pktrace_active (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

Boolean

Boolean value indicating whether the specified packet is being traced. This value is OPC_TRUE if the specified packet is being traced, OPC_FALSE otherwise.

Example

/* obtain a packet from the higher layer input stream */
pkptr = op_pk_get (HIGH_LAYER_INSTRM);

/* determine if the packet is being traced */
if (op_prg_odb_pktrace_active (pkptr) == OPC_TRUE)
	{
	/* tracing is active: print packet info. */
	printf ("---------- Packet %04d ----------\n", op_pk_id (pkptr));
	printf ("* Received by object #%d\n", op_id_self ());
	op_pk_nfd_get (pkptr, "message_class", &mclass);
	printf ("* Message class %s\n", Msg_Class_Table [mclass]);
	printf ("---------------------------------\n");
	}
/* insert the packet into the processing queue */

op_subq_pk_insert (0, pkptr, OPC_QPOS_TAIL);

Details

Traces are a special status of simulations that when activated, permit specific diagnostic information to be printed and related actions to occur. Simulation traces are supported within the ODB simulation debugger (see “Simulation Debugger (ODB)“ on page 39 for information on using ODB). Various types of traces can be activated within ODB, including full, module-oriented, packet-oriented, and labeled traces. Packet-oriented traces are activated via the ODB commands pktrace and pttrace. This KP detects active packet traces, provided that the passed packet exactly matches the packet ID or tree ID passed to the corresponding ODB command.

In addition to specific packet traces, this KP will return OPC_TRUE if a full trace is in effect, as defined by the ODB command fulltrace.

This KP returns OPC_FALSE when used with an optimized simulation kernel.

Purpose

Provides a mechanism for performing special actions if a packet trace has been defined in ODB. The actions usually include diagnostic print statements generated by op_prg_odb_print_major(), op_prg_odb_print_minor(), or printf(). However, the actions can include any KPs, including manipulating the affected packet as shown in the Example section to the left.

Errors

  • Program Abort: Segmentation violation (due to an invalid packet pointer or malformed packet).

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