op_pk_total_size_set()

Abstract

Sets the total size of the specified packet to the specified value (if this value is valid).

Syntax

op_pk_total_size_set (pkptr, total_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().]
total_size OpT_Packet_Size total size (in bits) to assign to the specified packet
[This number must be positive or zero; otherwise an error will occur.]

Return Type

Compcode

Completion code indicating if size modification was successful.

If successful, this KP returns the value OPC_COMPCODE_SUCCESS; OPC_COMPCODE_FAILURE otherwise.

Example

Excerpt from: example model (models/std/fddi); process model (fddi_gen); state (ARRIVAL); enter execs.

/* create a packet to send to mac */
pkptr = op_pk_create_fmt ("fddi_llc_fr");

/* assign its overall size. */
op_pk_total_size_set (pkptr, pklen);

/* assign the time of creation */
op_pk_nfd_set (pkptr, "cr_time", op_sim_time ());

Details

A packet's total size is the sum of the bulk data size and the sizes of each of the set fields. The total size can be modified directly, by modifiying the bulk data size, by setting or unsetting the packet's fields, or by modifying the sizes of the packet's fields. When the total size is directly modified via this KP, the bulk data size is proportionally modified.

The total size of a packet can be modified or accessed at any time. Both unformatted and formatted packets can have their sizes set via this KP.

If the new total size is less than the sum of the field sizes, the bulk data size will be negative. Negative bulk data sizes are useful for representing compression techniques that reduce the amount of transmitted data.You can also use op_pk_bulk_size_set() to set the bulk data size to a negative number.

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 total size, which is typically useful when a packet should have a specific total size independent of the current sizes of its fields.

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: Total packet size (<size>) is negative.

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