op_strm_max_index_in()

Abstract

Obtains the maximum index of any input stream connected to the surrounding processor or queue.

Syntax

op_strm_max_index_in ()
Argument Type Description
no arguments

Return Type

int

Maximum index of any connected input stream. The value -1 will be returned if the module has no connected input streams, since input stream numbering begins at zero.

Example

/** loop through all input streams, generating an access interrupt for each **/

/* determine the number of allocated input streams */
alloc_instrms = op_strm_max_index_in ();

/* loop through each allocated stream */
for (i = 0; i <= alloc_instrms; i++)
	{
	/* if an input stream is connected, and... */
	if (op_strm_connected (OPC_STRM_IN, i) == OPC_TRUE)
		{
		/* if an input stream is connected, access a packet from the source module. */
		op_strm_access (i);

		/* Collect and forward the packet onto the bus, if one was obtained. */
		if (op_strm_empty (i) == OPC_FALSE)
			op_pk_send (op_pk_get (i), OUTSTRM_BUS);
		}
	}

Details

The value returned by this KP is the highest physical index of all the connected input streams (i.e., the maximum value of the packet stream objects' dest stream attributes). If input streams are sparsely connected, then the returned value is not necessarily related to the number of connected input streams. If on the other hand all connected inputs are contiguous, then the returned value is one less than the number of connected streams, since numbering begins at zero. It is always the case however, that the maximum index (returned by this KP) plus one is an upper bound for the number of connected input streams.

Purpose

Provides a mechanism for upper-bounding the number of input streams that are connected to other objects. This is useful when an operation is to be performed on all connected input streams and the process has no built-in knowledge of which streams are connected. In this case, the process can test all input streams up to and including the maximum index, which is returned by this KP, and determine if they are connected by calling the KP op_strm_connected().

Errors

  • Program Abort: KP requires process context.

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