op_ici_format()
摘要
获取与指定 ICI 关联的 ICI 格式名称。
语法
op_ici_format (iciptr, format_name)
| 参数 | 类型 | 说明 |
|---|---|---|
iciptr |
Ici * |
指向目标 ICI 的指针 [指向 ICI 的指针可以从两个内核过程获得: op_ici_create() 返回指向新分配 ICI 的指针(在 ICI 发送进程中),以及 op_intrpt_ici() 返回与传入中断关联的 ICI 的指针(在 ICI 接收进程中)。] |
format_name |
char * |
指定 ICI 所基于的 ICI 格式名称 [该值应为静态声明的字符数组,或指向动态分配内存的字符指针;无论哪种方式,它都必须指向一个足够大的字符串,以容纳指定数据包的格式名称。] |
返回类型
void
无返回值。
示例
改编摘自:示例模型(models\std\x25);进程(cloud_encap);状态(ENCAP);进入执行(enter execs)。
/* Get the ICI associated with the new arrival. */
iciptr = op_intrpt_ici ();
/* Extract the addressing information from the ICI and insert it into the */
/* network packet. */
op_ici_attr_get (iciptr, "primitive", &primitive);
/* Obtain the ICI format name and interpret its contents accordingly. */
op_ici_format (iciptr, format_name);
if (strcmp (name, "X25_connect") == 0)
{
/* ... */
}
else
{
/* ... */
}
详情
该内核过程将指定 ICI 的格式名称放入 format_name 所指向的字符串中。调用该内核过程不会影响 ICI 的内容或安装状态。
用途
为确定与 ICI 关联的格式提供了一种机制。这对于接收多种不同类型 ICI 的进程模型非常有用:借助该内核过程,它们可以区分不同的 ICI,进而执行相应的 ICI 操作。
错误
- 程序中止:Segmentation violation(由于无效的 ICI 指针,或无效或尺寸不足的
fmt_name参数)。 - 可恢复错误:ICI 指针为 NIL。
参考
- 使用内核过程 op_ici_is_format() 测试 ICI 格式的名称
- 使用内核过程 op_intrpt_ici() 获取与传入中断关联的 ICI 指针
- 使用内核过程 op_ici_attr_get_dbl()、op_ici_attr_get_int32()、op_ici_attr_get_int64() 和 op_ici_attr_get_ptr() 获取 ICI 属性的值
- 使用内核过程 op_pk_format() 获取数据包的格式