op_pk_num_fds()
Abstract
Obtains the number of fields in a packet.
Syntax
op_pk_num_fds (pkptr)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
pointer to the packet-of-interest [A pointer to a packet can be obtained from many KPs, including op_pk_create(), op_pk_create_fmt(), op_pk_copy(), op_pk_get(), op_subq_pk_access(), and op_subq_pk_remove().] |
Return Type
int
Number of fields.
Example
pk_fds = op_pk_num_fds (pkptr);
Details
None.
Purpose
Provides a way to get the number of fields in a packet.
Errors
- Program Abort: Segmentation violation. (due to invalid pkptr or value_ptr arguments)
- Program Abort: Packet pointer is NIL.
- Program Abort: Packet pointer references destroyed packet.
- Recoverable Error: Contents of packet (
<pk_id>) is a value vector. Packet doesn’t allow field operations.
Reference
- Use the KP op_pk_num_fields_get() to obtain the number of formatted and unformatted fields in a packet