op_pk_nfd_exists()

Abstract

Determines whether a packet contains a specified field.

Syntax

op_pk_nfd_exists (pkptr, fd_name)
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_fmt(), op_pk_copy(), op_pk_get(), op_subq_pk_access(), and op_subq_pk_remove().]
fd_name const char* name of the field-of-interest

Return Type

OpT_Boolean

OPC_TRUE if the field is present in the packet; OPC_FALSE otherwise.

Example

/* variable declarations */
Packet    *pkptr;

/* obtain an arriving packet */
pkptr = op_pk_get (0);

/* process the payload, if any */
if (op_pk_nfd_exists (pkptr, "payload"))
	{
	/* do something */
	}

Details

If the specified packet is unformatted (in which case there are no named fields), a recoverable error is generated and the function returns OPC_DBL_UNDEF.

Purpose

Provides a mechanism to determine if a particular field is present in a packet.

Errors

  • Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
  • Program Abort: Packet pointer references unowned packet (<pk_id>).
  • Recoverable Error: Packet (<pk_id>) is of a type that does not contain formatted fields.

Reference

  • None.

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