op_pk_create_vvec()
摘要
创建一个新的值向量包。
语法
op_pk_create_vvec ()
| 参数 | 类型 | 说明 |
|---|---|---|
| 无参数 |
返回类型
Packet*
指向该内核过程创建的新数据包的指针。
示例
/* A value vector representing an entire packet has been */
/* completely received on an esys interface. */
/* Create a new empty value vector packet */
rcv_pkptr = op_pk_create_vvec ();
/* Set the value vector obtained from the esys interface into the packet */
op_pk_vvec_set (rcv_pkptr, rcv_vvec);
/* Transform, in place, the value vector form of the packet to */
/* the named field form of an "ethernet" packet. */
op_pk_convert_from_vvec (rcv_pkptr, "ethernet");
详情
所创建的值向量包并不包含值向量。创建值向量包之后,可以使用内核过程 op_pk_vvec_set() 将一个已有的值向量放入该数据包中。此外,新创建数据包的 bulk 大小为 0,不过这可以通过 op_pk_bulk_size_set() 修改。
用途
提供一种创建空的值向量包的机制。
错误
- 程序中止:内存分配失败。
参考
- 使用内核过程 op_pk_vvec_set() 将值向量插入值向量包
- 使用内核过程 op_pk_vvec_get() 从值向量包中取出值向量
- 使用内核过程 op_pk_bulk_size_set() 修改数据包的 bulk 大小
- 使用内核过程 op_pk_type() 获取数据包的类型
- 使用内核过程 op_pk_destroy() 销毁数据包并释放其内存