op_pk_create_vvec()
Abstract
Creates a new value vector packet.
Syntax
op_pk_create_vvec ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Packet*
Pointer to the new packet created by this KP.
Example
/* 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");
Details
The value vector packet created does not contain a value vector. After creating the value vector packet, the KP op_pk_vvec_set() can be used to place an existing value vector inside the packet. Also, the newly created packet’s bulk size is 0, although this can be modified by op_pk_bulk_size_set().
Purpose
Provides a mechanism to create empty value vector packets.
Errors
- Program Abort: Allocation of memory failed.
Reference
- Use the KP op_pk_vvec_set() to insert a value vector into a value vector packet
- Use the KP op_pk_vvec_get() to remove a value vector from a value vector packet
- Use the KP op_pk_bulk_size_set() to change the packet’s bulk size
- Use the KP op_pk_type() to obtain a packet’s type
- Use the KP op_pk_destroy() to destroy a packet and deallocate its memory