op_td_set_int()

Abstract

Assigns a 32-bit integer value to the specified transmission data attribute.

Syntax

op_td_set_int (pkptr, tda_index, value)
Argument Type Description
pkptr Packet* pointer to the packet-of-interest [This KP must be invoked within the context of a Transceiver Pipeline stage. In this context, the packet-of-interest is the packet that is passed into the stage procedure as an argument.]
tda_index int numeric index of the transmission data attribute-of-interest. The TDA must be a 32-bit integer.
[This value is a numeric code which specifies the transmission data attribute to be accessed. Predefined values for this argument appear in “Transmission Data Attribute“ on page 28. User-defined transmission information can be assigned to any attribute index greater than the largest index occupied by a predefined attribute. The largest predefined attribute indices are OPC_TDA_PT_MAX_INDEX (for the point-to-point pipeline), OPC_TDA_BU_MAX_INDEX (for the bus pipeline), and OPC_TDA_RA_MAX_INDEX (for the radio pipeline).]
value int value to assign to the specified transmission data attribute

Return Type

void

No return value.

Example

Excerpt from: example model (models/std/base); pipeline model (dra_chanmatch).

/* Obtain receiving channel attributes. */
rx_freq    = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_FREQ);
rx_bw      = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_BW);

/* For non-overlapping bands, the packet has no	*/
/* effect; such packets are ignored entirely.	*/
if ((tx_freq > rx_freq + rx_bw) || (tx_freq + tx_bw < rx_freq))
	{
	op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_IGNORE);
	FOUT;
	}

Details

Transmission data attributes are used to convey link modeling data between the Simulation Kernel and successive Transceiver Pipeline stages. The Td package KPs provide primitive operations (set and get) for operating on transmission data attributes. The basic format of a Pipeline stage model is a C file which contains a single function with the same name (for instance, the base Pipeline stage model dra_power is stored in the file dra_power.ps.c, and is implemented as the C function dra_power()). In most stages, the single argument of the function is a pointer to the packet on which the stage operates. The statements in the C function generally perform the following sequence of activities:

  1. Extract attributes from the packet’s transmission data (via the KPs op_td_get_dbl(), op_td_get_int(), op_td_get_int64(), and op_td_get_ptr()).
  2. Perform calculations which characterize the corresponding stage of the link model.
  3. Assign newly computed attributes to the packet’s transmission data (via the KPs op_td_set_dbl(), op_td_set_int(), op_td_set_int64(), and op_td_set_ptr()).

Purpose

Provides a mechanism to assign a value to an attribute of the transmission data which is associated with each packet passing through the stages of the Transceiver Pipeline of a link model. This KP is used to assign a single 32-bit integer attribute value within the specified packet’s transmission data block.

Errors

  • Recoverable Error: <type> TDA (<name>) cannot be set using 'op_td_set_int'.
  • Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
  • Program Abort: KP cannot be called from process context.
  • Program Abort: Packet pointer is NIL.
  • Program Abort: Packet pointer references destroyed packet (<pk_id>).
  • Program Abort: Read-only TDA (<tda_name>) cannot be assigned in (<pk_id>).
  • Program Abort: Tda index (<tda_index>) is out-of-range for packet (<pk_id>).
  • Program Abort: Tda (<tda_name>) is unassigned in packet (<pk_id>).

Reference

  • Use the KP op_td_set_int64() to assign the value of a 32-bit integer transmission data attribute
  • Use the KP op_td_set_dbl() to assign the value of a double transmission data attribute
  • Use the KP op_td_set_ptr() to assign the value of a pointer transmission data attribute
  • Use the KP op_td_get_int() or op_td_get_int64() to obtain the value of an integer transmission data attribute
  • Use the KP op_td_get_dbl() to obtain the value of a double transmission data attribute
  • Use the KP op_td_get_ptr() to obtain the value of a pointer transmission data attribute

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