op_pk_bulk_size_set()

Abstract

Sets the bulk data size of the specified packet to the specified value.

Syntax

op_pk_bulk_size_set (pkptr, bulk_size)
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().]
bulk_size OpT_Packet_Size bulk size (in bits) to assign to the specified packet
[This number may be positive, negative, or zero. If the bulk size is negative, the resulting total packet size must be positive or zero. Otherwise an error will occur.]

Return Type

void

No return value.

Example

Excerpt adapted from: example model (models/std/ip); process model (ip_encap); state ENCAP enter execs.

/* Obtain a packet arriving from a higher protocol layer and its length in bytes*/
pkptr = op_pk_get (IP_ENCAP_INSTRM_TRANSP);
data_len = op_pk_total_size_get (pkptr) / 8;

/* Create an IP packet and encapsulate the new arrival within its data field. */
ip_pkptr = op_pk_create_fmt ("ip_dgram");
op_pk_nfd_set (ip_pkptr, "data", pkptr);

/* The data field has a modeled size of zero in order to allow the packet to be */
/* broken into an arbitrary number of smaller sized packets. The bulk size */
/* attribute of the packet will instead be used to model the size of the */
/* encapsulated data. */
op_pk_bulk_size_set (ip_pkptr, data_len * 8);

/* Obtain the destination address from the accompanying ICI. */
ip_iciptr = op_intrpt_ici ();
if (ip_iciptr == OPC_NIL)
	{
	op_sim_end ("Fatal error in process ip_encap:",
		"Required ICI is missing", "","");

Details

Bulk data size is a property of a packet that is used to model the amount of data that is not explicitly attributed to individual fields. Modifying the bulk data size of a packet proportionally modifies the total size of the packet, which is the sum of the bulk data size and the sizes of the packet’s fields. The bulk data size of a packet can be modified or accessed at any time. Both unformatted and formatted packets can have their bulk data sizes set via this KP. Upon creation, unformatted packets have their bulk data size set to the value specified as an argument to op_pk_create(); newly created formatted packets have their bulk data size set to zero.

You can also use op_pk_bulk_size_set() to set the bulk data size to a negative number. Negative bulk data sizes are useful for representing compression techniques that reduce the amount of transmitted data.

Note: Even if the bulk data size is negative, the total packet size must be positive or zero.

Purpose

Provides a mechanism to modify a packet’s bulk data size. This is typically useful when a packet contains a large quantity of data that does not need to be modeled as explicit contents assigned to specific fields, but instead can be simply modeled as a collection of bits with a specific total size. Examples of this may include packets containing file transfer or telemetry data.

Errors

  • Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
  • Program Abort: Packet pointer is NIL.
  • Program Abort: Packet pointer references destroyed packet.
  • Program Abort: Packet pointer references unowned packet (<pk_id>).
  • Recoverable Error: Bulk packet size (<bulk_size>) is out-of-range.

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