op_pk_nfd_get_ptr()
Abstract
Obtains the value of a structure field in the specified packet, changing the status of some field types to unset; the field-of-interest is specified by name.
Syntax
op_pk_nfd_get_ptr (pkptr, fd_name, value_ptr)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
packet-of-interest [A pointer to a packet can be obtained from many KPs, including op_pk_create_fmt(), op_pk_copy(), op_pk_get(), op_subq_pk_access(), and op_subq_pk_remove().] |
fd_name |
const char* |
name of the field-of-interest [This name must be a defined field within the packet's format, or an error will occur.] |
value_ptr |
void** |
variable to be filled with the specified field's value |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the value of the field can be obtained; OPC_COMPCODE_FAILURE otherwise.
Example
{
/* variable declarations */
Packet *pkptr; struct Custom_DS *ds_ptr;
/* obtain an arriving packet */
pkptr = op_pk_get (0);
/* extract a data structure from a packet field */
op_pk_nfd_get_ptr (pkptr, "structure_value", (void**)&ds_ptr);
op_pk_destroy (pkptr);
}
Details
This function removes the specified field from the packet. See the op_pk_nfd_get() Details section for more information.
Purpose
Provides a way to obtain the value of a packet field. This KP works identically to op_pk_nfd_get(), but applies only to packet fields of data type pointer. Refer to op_pk_nfd_get() for full purpose and details.
Errors
- Same as op_pk_nfd_get().
Reference
- Same as op_pk_nfd_get().