op_strm_max_index_out()

Abstract

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

Syntax

op_strm_max_index_out ()
Argument Type Description
no arguments

Return Type

int

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

Example

/* determine the number of output streams */
num_out_strms = op_strm_max_index_out ();

/* loop through each output stream, dealing out packets in round-robin fashion. */
for (i = 0; i <= num_out_strms; i++)
	{
	/* Skip the stream if it is not connected. */
	if (op_strm_connected (OPC_STRM_OUT, i) == OPC_FALSE)
		continue;

	/* Obtain a packet from the source buffer. */
	op_strm_access (IN_STREAM_SRCBUF);

	/* If a packet was made available, forward it to the i_th destination. */
	if (op_strm_empty (IN_STREAM_SRCBUF) == OPC_FALSE)
		{
		pkptr = op_pk_get (IN_STREAM_SRCBUF);
		op_pk_send (pkptr, i);
		}
	}

Details

The value returned by this KP is the highest physical index of all the connected output streams (i.e., the maximum value of the packet stream objects' src stream attributes). If output streams are sparsely connected, then the returned value is not necessarily related to the number of connected output streams. If on the other hand all connected outputs 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 output streams.

Purpose

Provides a mechanism for upper-bounding the number of output streams that are connected to other objects. This is useful when an operation is to be performed on all connected output streams and the process has no built-in knowledge of which streams are connected. In this case, the process can test all output 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