op_pk_nfd_set_dbl()

Abstract

Assigns the value of a double field in the specified packet; the field-of-interest is specified by name.

Syntax

op_pk_nfd_set_dbl (pkptr, fd_name, value)
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
[This name must be a defined field within the packet's format, or an error will occur.]
value double value to be assigned to the field

Return Type

Compcode

OPC_COMPCODE_SUCCESS if the value of the field could be set; OPC_COMPCODE_FAILURE otherwise.

Example

/* create a formatted packet */
f_pkptr = op_pk_create_fmt ("example_pkt");

/* assign double field in the packet */
op_pk_nfd_set_dbl (f_pkptr, "fd_double", 3.1415);

/* send the defined packet out of the processor */
op_pk_send (f_pkptr, OUTSTRM);

Details

If the specified field has not been set before, the size of the new field is determined from the packet's format and added to the total size of the packet.

Purpose

Provides a way to set the value of a double field within a packet. Because the packet is formatted, only the value of the field needs to be specified; the type and size of the field are automatically obtained from the format. This KP should only be applied to formatted packets; otherwise, an error will occur.

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