op_pk_fd_info_get()
Abstract
Retrieve information about a packet's fields and their properties; the field-of-interest is specified by a numeric index.
Syntax
op_pk_fd_info_get (pk_ptr, field_index, property, value_ptr)
| Argument | Type | Description |
|---|---|---|
pk_ptr |
Packet* |
pointer to the packet of interest |
field_index |
int |
index of the field of interest |
property |
int |
property of the field to be retrieved (see Details) |
value_ptr |
void* |
pointer to a variable to be filled in with the specified field property's value |
Return Type
void
No return value.
Example
/* Determine the size of this field. */
op_pk_fd_info_get (pkptr, fd_index, OPC_PK_FD_PROPERTY_SIZE,
&defined_fd_size);
Details
This KP provides a way to retrieve information about a packet's fields and their properties. The constants listed below may be passed as the property argument. The KP writes the value of the property into a variable of the type specified.
Table 13: Packet Field Properties
| Constant | Property | Variable type |
|---|---|---|
OPC_PK_FD_PROPERTY_CONV_FROM_VVEC_PROC |
pointer to conversion function | Pk_Fd_From_Vvec_Proc |
OPC_PK_FD_PROPERTY_CONV_NAME |
field conversion method | character array |
OPC_PK_FD_PROPERTY_CONV_ORDER |
field conversion order | integer |
OPC_PK_FD_PROPERTY_CONV_TO_VVEC_PROC |
pointer to conversion function | Pk_Fd_To_Vvec_Proc |
OPC_PK_FD_PROPERTY_DEF_VAL_STR |
default value for field | character array |
OPC_PK_FD_PROPERTY_ENCODING |
value of field attribute encoding | character array |
OPC_PK_FD_PROPERTY_NAME |
name of field | character array |
OPC_PK_FD_PROPERTY_SIZE |
field size (in bits) | 32-bit integer (value_ptr should be int*) |
OPC_PK_FD_PROPERTY_SIZE_INT64 |
field size (in bits) | 64-bit integer (value_ptr should be OpT_Packet_Size*) |
OPC_PK_FD_PROPERTY_TYPE |
datatype of field | integer |
Purpose
Provides a mechanism for retrieving information about packet fields and their properties.
Errors
- Recoverable Error: Property identifier (
<property>) is invalid.
Reference
- Use the KPs op_pk_fd_get() and op_pk_nfd_get() to retrieve the value of a field
- Use the KPs op_pk_fd_set() and op_pk_nfd_set() to set the value of a field
- Use the KP op_pk_format_info_get() to retrieve information about a packet's format