op_pk_print()

Abstract

Prints information about a packet to an output device.

Syntax

op_pk_print (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

void

No return value.

Example

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

/* determine if the packet is of the appropriate type; */
/* if so, print its contents onto the terminal */
op_pk_format (pkptr, pk_format);
if (strcmp ("hssb_packet", pk_format) == 0)
	op_pk_print (pkptr);

example output (horizontally compressed):

packet contents:

id               :  (14)
tree_id	          :  (2)
address          :  (112768)
format           :  (hssb_packet)
creation_module  :  (sb_subnet,node0,application))
creation_time    :  (2.46388e-07)
creation_event   :  (457
stamp_module     :  ((sb_subnet,node0,application))
stamp_time	       :  (2.46388e-07)
bulk_size	        :  (128)
total_size       :  (128)
owner            :  (sim. kernel)
priority         :  (0)

Index       Name                    Type          Value	      Size

0           source_address          integer       0          0
1           destination_address     integer       3          0
2           type                    integer       3          0
3           command                 integer       1          0
4           subcommand              integer       -          0
5           response_code           integer       -          0
6           data_length             integer       4          0
7           transaction_label       double        0.0        0
8           delay_offset            double        -          0

Details

This KP prints to the Windows console or the Linux standard output device. To redirect output to a file, use the “>” I/O redirection operator on the simulation command line.

By default, the Linux standard output device for a simulation is the command shell that spawned the simulation process. If the simulation process was spun off by the application GUI, the standard output device is the command shell that spawned the application process. If the simulation process was spawned from a shell window, the default standard output device will be associated with that window.

The format of the packet information generated by this KP is shown in the Example section. Note the following display conventions:

  • packet addresses are displayed as hexadecimal numbers
  • if a packet is unformatted, its format property will be displayed as “NONE”
  • packets that are not associated with a specific object display their owner property as “simulation kernel”
  • optional lines are printed if the specified packet has an assigned priority, or if it is stored in a subqueue
  • unset fields have their values represented with a dash (“-”)
  • fields that inherit their size have “(inherited)” after the size

Purpose

Provides a mechanism for a user to monitor the contents of packets from a terminal, or to log the packet contents into a file for later investigation. Printing out packet contents can be very useful in the simulation debugger, when the arriving packets contain values which are used in process computations or which influence the flow of process logic. Statements to print out packets can be added to state executives (for event-driven printing), or to the diagnostic block (for user-driven printing of packet information using the ODB “prodiag“ command). Packets also can be directly printed from the simulation debugger using the “pkprint“ command, which takes a packet ID as an argument.

Errors

  • Program Abort: Segmentation violation. (due to an invalid packet pointer or a 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