op_ev_equal()

Abstract

Compares two event handles for equality.

Syntax

op_ev_equal (evhandle_a, evhandle_b)
Argument Type Description
evhandle_a Evhandle event handle
[An event handle can be obtained from several KPs in this package—such as op_ev_current(), op_ev_seek_time(), and op_ev_next()—and others such as op_intrpt_schedule_self().].
evhandle_b Evhandle event handle
[An event handle can be obtained from several KPs in this package—such as op_ev_current(), op_ev_seek_time(), and op_ev_next()—and others such as op_intrpt_schedule_self().].

Return Type

Boolean

Boolean value indicating if two event handles refer to the same event.

OPC_TRUE is returned if the two event handles refer to the same event; OPC_FALSE is returned if they do not or if a recoverable error occurs.

Example

retrans_event = op_intrpt_schedule_self (time, 0)
...

/* if the current event is the retransmit timer, */
/* then retransmit the packet. */
cur_event = op_ev_current ();

if (op_ev_equal (cur_event, retrans_event) == OPC_TRUE)
	{
	op_pk_send (pkptr, 0);
	}

Details

Two event handles are considered equal if both refer to the same event. Note that Evhandles are data-structures (as opposed to scalar variables or pointers) and that they should not be compared directly via the C language == (equals) operator.

This KP performs a test for Evhandle validity prior to returning a result, thus preventing its use for comparisons of event handles that refer to canceled or otherwise invalid events.

Purpose

Provides a mechanism to compare two Evhandles for equality. A typical application of this KP is to verify that the current event, for which an Evhandle can be obtained via op_ev_current(), is an event that is expected by comparing it to an Evhandle obtained earlier from a KP such as op_intrpt_schedule_self().

Errors

  • Program Abort: Segmentation violation. (due to a malformed event handle)
  • Recoverable Error: Event handle refers to an event that is either invalid or not currently scheduled.

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