op_pk_bulk_size_get()

Abstract

Obtains the bulk data size of the specified packet.

Syntax

op_pk_bulk_size_get (pkptr)
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().]

Return Type

OpT_Packet_Size

Bulk data size (in bits) of the specified packet.

Example

/* obtain the arriving packet */
pkptr = op_pk_get (INPUT_STRM);

/* determine the bulk size of the packet */
bulk_size = op_pk_bulk_size_get (pkptr);

/* Compute the total time required to service the packet based on its size. */
/* Keep track of the service time as a global statistic. */
svc_time = bulk_size / svc_rate;
op_stat_global_write (svc_time_glob_stat, svc_time);

/* Enqueue the packet in subqueue zero */
op_subq_pk_insert (0, pkptr, OPC_QPOS_TAIL);

/* Compute the time at which the packet shall be extracted from the queue; */
/* this is the last time where the server is active, plus the service time. */
last_busy_time = (extract_time = (last_busy_time > op_sim_time() ? 
	last_busy_time: op_sim_time ()) + svc_time);

/* Schedule the interrupt that will cause the packet to be extracted. */
op_intrpt_schedule_self (last_busy_time, 0);

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 obtained 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.

Purpose

Provides a mechanism to determine a packet’s bulk data size, which is useful for statistics gathering, resource allocation, or categorization of packets by size.

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.

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