Named Field Sub-Package

In formatted packets, fields are predefined in a template that has been created using the Packet Format Editor. Fields in formatted packets are specified via an alphanumeric field name. All of the KPs in the Named Field sub-package have the prefix “op_pk_nfd_”. These KPs are designed for use with formatted packets, and applying them to unformatted packets may cause errors or unpredictable results.

All of the basic field operations described in the Field sub-package have peer KPs in this sub-package, including op_pk_nfd_set(), op_pk_nfd_get(), op_pk_nfd_strip(), op_pk_nfd_size(), op_pk_nfd_type(), op_pk_nfd_is_set(), and the type-specific KPs listed in Table 10. (The type-specific KPs are more efficient and allow the compiler to catch argument errors that are missed with the corresponding generic KPs.)

Table 10: Typed Packet Named Field Get/Set KPs

op_pk_nfd_get_dbl() op_pk_nfd_set_dbl()
op_pk_nfd_get_int32() op_pk_nfd_set_int32()
op_pk_nfd_get_int64() op_pk_nfd_set_int64()
op_pk_nfd_get_objid() op_pk_nfd_set_objid()
op_pk_nfd_get_pkid() op_pk_nfd_set_pkid()
op_pk_nfd_get_pkt() op_pk_nfd_set_pkt()
op_pk_nfd_get_ptr() op_pk_nfd_set_ptr()
op_pk_nfd_set_info()

When a formatted packet is being processed, it is sometimes useful to determine the index of a named field. This name-to-index conversion service is provided by the KPs op_pk_name_to_index() and op_pk_nfd_name_to_index().

The KP op_pk_nfd_default() returns the default value of the field-of-interest, as originally specified in the packet format. The KP op_pk_nfd_exists() determines if a particular field is present in a packet. The KP op_pk_nfd_size_set() sets the size of a named field.