op_pk_format_info_get()
Abstract
Retrieve information about a packet’s format and its properties.
Syntax
op_pk_format_info_get (pk_ptr, property, value_ptr)
| Argument | Type | Description |
|---|---|---|
pk_ptr |
Packet* |
pointer to a formatted packet |
property |
int |
property of the packet format to be retrieved |
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 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. */
...
}
Details
This KP provides a way to retrieve information about a packet’s formats 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 11: Packet Format Properties
| Constant | Property | Variable type |
|---|---|---|
OPC_PK_PROPERTY_BULK_FILL_PATTERN |
value of attribute bulk fill pattern | character array |
OPC_PK_PROPERTY_CONV_FROM_VVEC_PROC |
pointer to conversion function | Pk_From_Vvec_Proc |
OPC_PK_PROPERTY_CONV_NAME |
packet conversion method | character array |
OPC_PK_PROPERTY_CONV_TO_VVEC_PROC |
pointer to conversion function | Pk_To_Vvec_Proc |
OPC_PK_PROPERTY_FORMAT_NAME |
name of packet format | character array |
OPC_PK_PROPERTY_NUMBER_FIELDS |
number of fields in packet format | integer |
OPC_PK_PROPERTY_SUPPORT_CONVERSION |
packet conversion support | integer |
Purpose
Provides a mechanism for retrieving information about packet formats 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_fd_info_get() to retrieve information about individual fields in a packet