cyber_effects_cmd_process()

Abstract

Processes and executes an effect at a client module.

Syntax

cyber_effects_cmd_process (mgr_ptr, client_mem_vptr, intrpt_code)

Argument Type Description
mgr_ptr CyberT_Effect_Mgr* Cyber-effects manager of interest. The handle can be obtained by calling cyber_effects_mgr_handle_get().
client_mem_vptr void* Pointer to client data that contains the current module information to be used and possibly modified by the effect. This pointer is passed to the CyberT_Effect_Proc_Ptr effect callback as the model_data_vptr argument.
intrpt_code int Current interrupt code. This is used to determine if the effect is to be executed (positive value) or canceled (negative value).

Return Type

void

no return value

cyber_effects.h

Example

From ip_rte_central_cpu process model:

state variables:

double                one_over_service_rate;  /* Number of packets handled by routing processor per second */
CyberT_Effect_Mgr*   effects_mgr_ptr;       /* Handle to the Cyber-Effects Manager */

header block:

compound_objid = op_topo_child (ip_proc_info_objid, OPC_OBJTYPE_GENERIC, 0);

/* Get assigned value of server processing rate. */
return_status = op_ima_obj_attr_get (compound_objid, "Datagram Forwarding Rate", &service_rate);
if (return_status == OPC_COMPCODE_FAILURE)
   ip_rte_cpu_error ("Unable to get server datagram forwarding rate from attribute.");

/* Store 1/service rate to avoid doing division each time */
one_over_service_rate = 1.0 / service_rate;

effects_mgr_ptr = cyber_effects_mgr_handle_get();

function block:

void ip_rte_central_cpu_cyber_effect_cmd_process (int intrpt_code)
   {
   void* client_mem_ptr = OPC_NIL;

   /** Local function that process interrupts sent by the cyber_effect_mgr, **/
   /** requesting the execution of a Cyber Effect. **/
   FIN (ip_rte_central_cpu_cyber_effect_cmd_process (intrpt_code));

   if (cyber_effects_intrpt_code_eval(CMD_INTRPT_CODE_CHANGE_FWD_RATE,intrpt_code))
      client_mem_ptr = &one_over_service_rate;

   if (client_mem_ptr != OPC_NIL)
      cyber_effects_cmd_process (effects_mgr_ptr, client_mem_ptr, intrpt_code);

   FOUT;
   }

Details

This function is called when a client module that registered an effect receives an interrupt from the cyber-effects manager indicating that the effect is due for execution. The function obtains details about the effect from the event state of the interrupt and calls the corresponding command or cancel procedure for the effect.

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