op_intrpt_port_deregister()

摘要

撤销先前对 op_intrpt_port_register() 的调用所产生的效果;该调用将特定的数据包流或统计量连线中断路由到当前执行模块中的某个特定进程。取消后,到达指定数据包流或统计量连线的中断将改为路由到模块中的默认进程。

语法

op_intrpt_port_deregister (port_type, port_index)
参数 类型 说明
port_type int 要停用中断注册的端口类型。
[这是一个整数符号常量,指定数据包流输入或统计量输入。可能的取值为 OPC_PORT_TYPE_STRM 和 OPC_PORT_TYPE_STAT。]
port_index int 要停用中断注册的端口索引。
[数据包流和统计量连线输入的索引均从零开始计第一个端口。]

返回类型

void

无返回值

示例

/* Obtain the error notification packet that just arrived. */
err_pkptr = op_pk_get (STRM_ERR);

/* Decode the error message contents. */
op_pk_nfd_get (err_pkptr, "cause", &err_level)

/* If the error level is sufficiently serious, shut down */
/* special processing of errors: this involves destroying */
/* the error handling process and deregistering it from */
/* the error port. */
if (err_level > ERR_LEVEL_5)
	{
	/* Once this deregistration occurs, packets arriving on */
	/* error stream (if any) will be routed to the default */
	/* stream handling process if it is installed, or the root */
	/* process otherwise. */
	op_intrpt_port_deregister (OPC_PORT_TYPE_STRM, STRM_ERR);

	/* Destroy the error handling process which is no longer needed. */
	op_pro_destroy (err_pro_handle);
	}

详情

默认情况下,数据包流或统计量中断被路由到其到达的模块的根进程。但是,有两种机制可以改变这一行为,使此类中断改为路由到模块内的另一个进程。第一种机制利用内核过程 op_intrpt_type_register() 指定一个进程来接收所有类型为数据包流或统计量的中断。第二种机制由内核过程 op_intrpt_port_register() 支持,它更为具体,允许当数据包流或统计量中断到达特定输入端口时将中断直接传送给指定进程。当两种注册同时生效时,端口注册优先于类型注册。

内核过程 op_intrpt_port_deregister()“撤销”在某个特定端口上针对数据包流或统计量中断对 op_intrpt_port_register() 的所有先前调用的效果。因此,如果在此调用时数据包流或统计量中断的类型注册正在生效,则中断处理将由通过该机制所做的规定决定;否则,原本会受端口注册影响的后续中断将被路由到模块的根进程。

如果在内核过程被调用的时刻,相应的中断类型和端口的端口注册并未生效,则该内核过程不产生任何效果。

端口类型分为数据包流或统计量两种,分别由符号常量 OPC_PORT_TYPE_STRM 和 OPC_PORT_TYPE_STAT 表示。

用途

该内核过程用于取消对 op_intrpt_port_register() 的先前调用的效果,从而恢复对到达当前执行模块某个特定输入的数据包流或统计量中断的默认处理。如果模块的进程并未使用内核过程 op_intrpt_port_register(),则该内核过程没有用处。

错误

  • 可恢复错误:数据包流索引 (<port_index>) 超出范围。
  • 可恢复错误:统计量索引 (<port_index>) 超出范围。
  • 可恢复错误:端口类型 (<port_type>) 无法识别。
  • 程序中止:内核过程需要进程上下文。(如果在处理器或队列之外调用)

参考

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