op_pk_format_info_get()
摘要
检索数据包格式及其属性的信息。
语法
op_pk_format_info_get (pk_ptr, property, value_ptr)
| 参数 | 类型 | 说明 |
|---|---|---|
pk_ptr |
Packet* |
指向有格式数据包的指针 |
property |
int |
要检索的数据包格式属性 |
value_ptr |
void* |
指向某个变量的指针,该变量将被填入指定字段属性的值 |
返回类型
void
无返回值。
示例
/* Determine if there are unformatted fields in this packet, and */
/* return failure if unformatted fields are found. */
/* Determine the total number of set fields in the packet */
max_fd_index = op_pk_fd_max_index (pkptr);
/* Determine the number of formatted fields in the packet’s format */
op_pk_format_info_get (pkptr, OPC_PK_PROPERTY_NUMBER_FIELDS,
&num_formatted_fields);
if (max_fd_index + 1 > num_formatted_fields)
{
/* This packet currently has more fields set than it has */
/* formatted fields, therefore there must be unformatted */
/* fields that have been added. */
...
}
详情
该内核过程提供了一种检索数据包格式及其属性信息的方式。下面列出的常量可以作为 property 参数传入。内核过程会将该属性的值写入指定类型的变量中。
表 11:数据包格式属性
| 常量 | 属性 | 变量类型 |
|---|---|---|
OPC_PK_PROPERTY_BULK_FILL_PATTERN |
bulk fill pattern 属性的值 | 字符数组 |
OPC_PK_PROPERTY_CONV_FROM_VVEC_PROC |
指向转换函数的指针 | Pk_From_Vvec_Proc |
OPC_PK_PROPERTY_CONV_NAME |
数据包转换方法 | 字符数组 |
OPC_PK_PROPERTY_CONV_TO_VVEC_PROC |
指向转换函数的指针 | Pk_To_Vvec_Proc |
OPC_PK_PROPERTY_FORMAT_NAME |
数据包格式的名称 | 字符数组 |
OPC_PK_PROPERTY_NUMBER_FIELDS |
数据包格式中的字段数 | 整数 |
OPC_PK_PROPERTY_SUPPORT_CONVERSION |
数据包转换支持 | 整数 |
用途
提供一种检索数据包格式及其属性信息的机制。
错误
- 可恢复错误:属性标识符 (
<property>) 无效。
参考
- 使用内核过程 op_pk_fd_get() 和 op_pk_nfd_get() 获取字段的值
- 使用内核过程 op_pk_fd_set() 和 op_pk_nfd_set() 设置字段的值
- 使用内核过程 op_pk_fd_info_get() 检索数据包中各个字段的信息