op_pk_transfer_to_vvec()

Abstract

Creates a bit sequence based on the user-defined fields of a formatted packet and then places the bit sequence into a specified value vector.

Syntax

op_pk_transfer_to_vvec (pk_ptr, vvec, vvec_index)
Argument Type Description
pk_ptr Packet* pointer to a formatted packet
[The packet’s fields are written to a value vector using the conversion method specified in the packet’s format.]
vvec Vvec_Vector allocated value vector
[This value vector receives the bit sequence generated by the conversion method. The value vector must already exist.]
vvec_index int index number of position to receive first bit of bit sequence
[The conversion method used by this KP generates a bit sequence based on the contents of the formatted packet’s user-defined fields. This argument specifies the position in the value vector at which to insert this bit sequence.]

Return Type

Compcode

Completion code indicating whether the bit sequence was successfully placed in the value vector.

[This value can be compared to the two symbolic constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE.]

Example

if (op_npk_field_type (pkptr, "payload") == OPC_FIELD_TYPE_PACKET)
	{
	/* Extract the encapsulated packet */
	op_pk_nfd_get (pkptr, "payload", &encap_pkptr);

	/* Have a bit representation of the encapsulated packet */
	/* written into our value vector. */
	op_pk_transfer_to_vvec (encap_pkptr, vvec, vvec_pos);

	/* Install the encapsulated packet back into the original packet */
	op_pk_nfd_set (pkptr, "payload", encap_pkptr);
	}

Details

This function creates a bit representation of the contents of a formatted packet and places the resulting bit sequence in a value vector.

WARNING: The packet conversion routine of a newly created packet format is set to “NONE”, which does nothing. Before calling this function, the required conversion routine must be set to either a user-supplied routine or one of the default routines provided with Riverbed Modeler (these are applicable only to a small subset of packet formats; see Chapter 5 “Packet Conversion” on page 29).

When called, this function calls the conversion method for the target packet’s format, passing it three arguments:

  • a pointer to a value vector of type bit (Vvec_Vector)
  • a pointer to the target packet
  • the index of the position in the value vector that is to contain the first bit generated by the conversion function

Typically, the conversion method uses the contents of the target packet’s user-defined fields to insert values into the value vector and then returns success or failure to the KP. The original packet is not affected by this KP.

Note: If a Sar segment is passed as an argument to op_pk_transfer_to_vvec() and the Sar segment is also a value vector packet, the value vector inside the packet is copied to the destination value vector. If the packet is a Sar segment but is not a value vector packet, a bit representation of the bit-range for the segment is transferred to the destination value vector.

Purpose

Provides a mechanism for creating a bit representation of the contents of a formatted packet and placing the resulting bit sequence in a value vector.

Errors

  • Program Abort: Packet pointer references unowned packet (<pk_id>).
  • Program Abort: Packet format (<format_name>) does not support converison.
  • Program Abort: Packet ID (<pk_id>) can not be converted.
  • Recoverable Error: Value vector is not owned by client
  • Recoverable Error: Value vector is invalid.

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