op_pk_transfer()

Abstract

Replaces the contents of a packet with those of another packet.

Syntax

op_pk_transfer (from_pkptr, to_pkptr)
Argument Type Description
from_pkptr Packet * Source packet for the transfer.
to_pkptr Packet * Destination packet for the transfer.

Return Type

void

No return value.

Example

/* receive a frame from upper layer */
ul_pkptr = op_pk_get (0);

/* transfer contents to messenger packet and send onward */
op_pk_transfer (ul_pkptr, msg_pkptr);
op_pk_send (msg_pkptr, 1);

Details

Any objects contained in to_pkptr are deallocated before the transfer. Some information fields are preserved in to_pkptr; these are:

  • creation time
  • object ID of the creation module
  • packet owner
  • packet ID

Purpose

Provides a way to clone a packet by copying the contents of the packet into another existing packet. This function is faster than copying a packet field-by-field, and is useful when detailed information about the format of the source packet is not known to the code.

Errors

  • Program Abort: Packet pointer references unowned packet (<pk_id>).
  • Program Abort: Segmentation violation. (due to an invalid packet pointer, malformed packet, or malformed structure or packet field within the packet)

Reference

  • Use the KP op_pk_copy() to clone a packet into a newly created packet

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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