op_pk_fd_get_int32()

Abstract

Obtains the value of a 32-bit integer field in the specified packet; the field-of-interest is specified by a numeric index.

Syntax

op_pk_fd_get_int32 (pkptr, field_index, value_ptr)
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().]
field_index int numeric index of the field-of-interest
[This value must be non-negative.]
value_ptr int* pointer to a variable to be filled in with the specified field’s value

Return Type

Compcode

OPC_COMPCODE_FAILURE if the field is not obtained; OPC_COMPCODE_SUCCESS otherwise.

Example

	{
	/* variable declarations */
	int i; double d; Packet *pkptr;

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

	/* obtain the simple field types */
	op_pk_fd_get_int32 (pkptr, 0, &i);
	op_pk_fd_get_dbl (pkptr, 1, &d);
	printf ("packet contents: integer (%d), double (%g)\n", i, d);

	op_pk_destroy (pkptr);
	}

Details

None.

Purpose

Provides a mechanism to obtain the value of a packet’s field. This KP works identically to op_pk_fd_get(), but applies only to object attributes of data type int (32-bit integer). Refer to op_pk_fd_get() for full purpose and details.

Errors

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