op_pk_encap_pk_access()

Abstract

Gets a reference to an encapsulated packet from a specified encapsulating packet.

Syntax

op_pk_encap_pk_access (pkptr, format, encap_pk_pptr)
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().]
format const char* pointer to a string containing either the name of a packet format or one of the symbolic constants described in the Details section
encap_pk_pptr Packet** pointer to a packet pointer
[The pointer specified here will be filled in with a pointer to the encapsulated packet.]

Return Type

Compcode

OPC_COMPCODE_SUCCESS if an encapsulated packet is found; OPC_COMPCODE_FAILURE otherwise.

Example

if (op_pk_encap_flag_is_set (pkptr, OMSC_BGUTIL_ENCAP_FLAG_INDEX))
	{
	/* Drill to get the actual bgutil packet. */
	op_pk_encap_pk_access (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

This function searches a specified packet for any other packets encapsulated within it of a given format. It returns a reference to the first encapsulated packet with the specified format (including SAR segments). If a packet is returned, it and all encapsulating packets are no longer shared.

In addition to a format name, format can be one of the constants described in the following table.

If the constant is… The function retrieves the first…
NONE unformatted or value vector packet
OPC_PK_FORMAT_ANY packet, regardless of format
OPC_PK_FORMAT_ANY_FORMATTED formatted packet
OPC_PK_FORMAT_ANY_UNFORMATTED unformatted packet
OPC_PK_FORMAT_ANY_VVEC value vector packet

If there is no packet of the specified format inside the encapsulating packet, the function returns OPC_FAILURE.

Purpose

Provides a mechanism for quickly retrieving a reference to an encapsulated packet.

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