op_ima_obj_command()

Abstract

Executes a command supported by the specified object.

Syntax

op_ima_obj_command (objid, cmd_name)
Argument Type Description
objid Objid object ID of the object-of-interest
[An object ID of a channel object can be obtained via a KP in the Topo package (op_topo_child()), which is applied to the object ID of a receiver or transmitter object; transceiver object ID’s can be obtained via the KP op_id_from_name().]
cmd_name const char* name of the command to be executed
[This is a character string which must be one of the valid commands accepted by the specified object (see Table 64 "Object Command String Symbolic Constants" on page 17); supported object commands are also listed in the Details section.]

Return Type

Compcode

Completion code indicating whether the operation completed successfully.

This code can be compared to the two symbolic constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE.

Example

Excerpt from: example model (models/std/eth_net); process model (eth_mac); state (TX_ABORT); enter execs.

/* jamming bit sequence has been transmitted. */
/* stop the remainder of the packet from being */
/* transmitted */
op_ima_obj_command (tx_channel_objid, "abort");

/* if the length of the fragment is greater */
/* than a slot time, this is termed a late collision */
if (frag_time > SLOT_TIME)
	tx_comp_status = STATUS_ERR_LATE_COLL;

Details

Commands are named internal functions that an object supports, and which can be remotely invoked by a process. The commands supported by objects are limited to a few special purposes, as listed below:

Table 10-1: Object Commands by Object Type

Object Type Supported Command
point-to-point link
bus link
radio transmitter channel
abort—immediately aborts the current packet transmission
radio receiver channel flush—immediately removes all packets in the process of being received

Purpose

Provides a mechanism for a process to remotely control an object in a specialized way (i.e., by executing an accepted command). Commands are not supported by modules which run processes (i.e., processors and queues), since these objects can be remotely controlled using the general remote interrupt facility provided by op_intrpt_schedule_remote(). The currently supported set of object commands are limited to transmission and reception issues, and the objects which support commands are limited to broadcast transceiver channels.

Errors

  • Program Abort: Segmentation violation. (due to a malformed cmd_name argument)
  • Recoverable Error: Object ID (<objid>) is out-of-range.
  • Recoverable Error: Object (<objid>) does not support use of commands.
  • Recoverable Error: Execution of command (<cmd_name>) failed for object (<objid>). (due to an incorrect command name or a logical error encountered in executing the command)
  • Recoverable Error: Object ID (<objid>) refers to a restricted object.

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