Basic descriptor macros

Reference Documentation

Platform
Intel® PAC
Napatech SmartNIC
Content Type
Reference Information
Napatech Software Suite: Basic descriptor macros

Detailed Description

The following macros are always available.

Macros

#define NT_DESCR_STD_LENGTH
 Constant integer with length of the NT standard descriptor. More...
 
#define NT_DESCR_EXT7_LENGTH
 Length of the NT Extended 7 descriptor. More...
 
#define NT_DESCR_EXT8_LENGTH
 Constant integer with length of the NT Extended 8 descriptor. More...
 
#define NT_DESCR_EXT9_LENGTH
 Constant integer with length of the NT Extended 9 descriptor. More...
 
#define NT_DESCR_DYN1_LENGTH
 Constant integer with length of the NT Dynamic 1 descriptor. More...
 
#define NT_DESCR_DYN2_LENGTH
 Constant integer with length of the NT Dynamic 2 descriptor. More...
 
#define NT_DESCR_DYN3_LENGTH
 Constant integer with length of the NT Dynamic 3 descriptor. More...
 
#define NT_DESCR_DYN4_LENGTH
 Constant integer with length of the NT Dynamic 4 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_STD(_hNetBuf_)
 Clears the STD descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_EXT7(_hNetBuf_)
 Clears the EXT7 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_EXT8(_hNetBuf_)
 Clears the EXT8 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_EXT9(_hNetBuf_)
 Clears the EXT9 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_DYN1(_hNetBuf_)
 Clears the DYN1 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_DYN2(_hNetBuf_)
 Clears the DYN2 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_DYN3(_hNetBuf_)
 Clears the DYN3 descriptor. More...
 
#define NT_NET_SET_PKT_CLEAR_DESCR_DYN4(_hNetBuf_)
 Clears the DYN4 descriptor. More...
 
#define NT_NET_GET_PKT_DESCR_TYPE(_hNetBuf_)
 Get the packet descriptor type. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_STD(_hNetBuf_)
 Sets the packet descriptor type to NT. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_EXT7(_hNetBuf_)
 Sets the packet descriptor type to EXT7. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_EXT8(_hNetBuf_)
 Sets the packet descriptor type to EXT8. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_EXT9(_hNetBuf_)
 Sets the packet descriptor type to EXT9. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_DYN1(_hNetBuf_)
 Sets the packet descriptor type to DYN1. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_DYN2(_hNetBuf_)
 Sets the packet descriptor type to DYN2. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_DYN3(_hNetBuf_)
 Sets the packet descriptor type to DYN3. More...
 
#define NT_NET_SET_PKT_DESCR_TYPE_DYN4(_hNetBuf_)
 Sets the packet descriptor type to DYN4. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_STD(_hNetBuf_)
 Get standard packet descriptor pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_EXT7(_hNetBuf_)
 Get extended packet descriptor 7 pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_EXT8(_hNetBuf_)
 Get extended packet descriptor 8 pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_EXT9(_hNetBuf_)
 Get extended packet descriptor 9 pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_DYN1(_hNetBuf_)
 Get dynamic packet descriptor 1 pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_DYN2(_hNetBuf_)
 Get dynamic packet descriptor 2 pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_DYN3(_hNetBuf_)
 Get dynamic packet descriptor 3 pointer. More...
 
#define NT_NET_GET_PKT_DESCR_PTR_DYN4(_hNetBuf_)
 Get dynamic packet descriptor 4 pointer. More...
 
#define NT_NET_GET_PKT_L2_PTR(_hNetBuf_)
 A pointer to the L2 packet data. If an ISL header is present it will point to the ISL header. More...
 
#define NT_NET_UPDATE_PKT_L2_PTR(_hNetBuf_)
 When creating packets within a segment it is required to update the L2 pointer using this macro after applying the descriptor info. More...
 
#define NT_NET_GET_PKT_DESCR_LENGTH(_hNetBuf_)
 Get the length of the packet descriptor. More...
 
#define NT_NET_GET_PKT_DESCR_FORMAT(_hNetBuf_)
 Indicates if extended packet descriptor 7, 8, or 9 is used, if the standard packet descriptor is used, or what dynamic packet descriptor type is used. More...
 
#define NT_NET_GET_PKT_TIMESTAMP(_hNetBuf_)
 Get the packet timestamp. More...
 
#define NT_NET_SET_PKT_TIMESTAMP(_hNetBuf_, _ts_)
 Sets the packet time stamp - useful when controlling the traffic rate. More...
 
#define NT_NET_GET_PKT_TIMESTAMP_TYPE(_hNetBuf_)
 Get the packet time stamp type. See NtTimestampType_e. More...
 
#define NT_NET_GET_PKT_CAP_LENGTH(_hNetBuf_)
 Returns the total stored length of the received frame including packet descriptors, in bytes, after any slicing. The value is a multiple of 8 if received on 3GA adapters, or if capture length was set with ALIGN macro. Also rounded up for unsliced frames with wire lengths. that are not multiples of 8 bytes. More...
 
#define NT_NET_SET_PKT_CAP_LENGTH_NOALIGN(_hNetBuf_, _Length_)
 Calculates and sets the packet capture length. Input is wire length. Capture length is calculated from the value - no alignment is applied. More...
 

Macro Definition Documentation

#define NT_DESCR_STD_LENGTH

Constant integer with length of the NT standard descriptor.

Definition at line 116 of file pktdescr.h.

#define NT_DESCR_EXT7_LENGTH

Length of the NT Extended 7 descriptor.

Constant integer with length of the NT Extended 7 descriptor

Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 123 of file pktdescr.h.

Referenced by main().

#define NT_DESCR_EXT8_LENGTH

Constant integer with length of the NT Extended 8 descriptor.

Definition at line 129 of file pktdescr.h.

#define NT_DESCR_EXT9_LENGTH

Constant integer with length of the NT Extended 9 descriptor.

Definition at line 135 of file pktdescr.h.

#define NT_DESCR_DYN1_LENGTH

Constant integer with length of the NT Dynamic 1 descriptor.

Definition at line 141 of file pktdescr.h.

#define NT_DESCR_DYN2_LENGTH

Constant integer with length of the NT Dynamic 2 descriptor.

Definition at line 147 of file pktdescr.h.

#define NT_DESCR_DYN3_LENGTH

Constant integer with length of the NT Dynamic 3 descriptor.

Examples:
net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 153 of file pktdescr.h.

Referenced by create_padding_packet_dyn3(), and main().

#define NT_DESCR_DYN4_LENGTH

Constant integer with length of the NT Dynamic 4 descriptor.

Definition at line 159 of file pktdescr.h.

#define NT_NET_SET_PKT_CLEAR_DESCR_STD (   _hNetBuf_)

Clears the STD descriptor.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 166 of file pktdescr.h.

#define NT_NET_SET_PKT_CLEAR_DESCR_EXT7 (   _hNetBuf_)

Clears the EXT7 descriptor.

Parameters
[in]_hNetBuf_Packet container reference
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 173 of file pktdescr.h.

Referenced by main().

#define NT_NET_SET_PKT_CLEAR_DESCR_EXT8 (   _hNetBuf_)

Clears the EXT8 descriptor.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 180 of file pktdescr.h.

#define NT_NET_SET_PKT_CLEAR_DESCR_EXT9 (   _hNetBuf_)

Clears the EXT9 descriptor.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 187 of file pktdescr.h.

#define NT_NET_SET_PKT_CLEAR_DESCR_DYN1 (   _hNetBuf_)

Clears the DYN1 descriptor.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 194 of file pktdescr.h.

#define NT_NET_SET_PKT_CLEAR_DESCR_DYN2 (   _hNetBuf_)

Clears the DYN2 descriptor.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 201 of file pktdescr.h.

#define NT_NET_SET_PKT_CLEAR_DESCR_DYN3 (   _hNetBuf_)

Clears the DYN3 descriptor.

Parameters
[in]_hNetBuf_Packet container reference
Examples:
net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 208 of file pktdescr.h.

Referenced by create_padding_packet_dyn3(), and main().

#define NT_NET_SET_PKT_CLEAR_DESCR_DYN4 (   _hNetBuf_)

Clears the DYN4 descriptor.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 215 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_TYPE (   _hNetBuf_)

Get the packet descriptor type.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns the packet descriptor type. See NtPacketDescriptorType_e for values.

Definition at line 223 of file pktdescr.h.

#define NT_NET_SET_PKT_DESCR_TYPE_STD (   _hNetBuf_)

Sets the packet descriptor type to NT.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 230 of file pktdescr.h.

#define NT_NET_SET_PKT_DESCR_TYPE_EXT7 (   _hNetBuf_)

Sets the packet descriptor type to EXT7.

Parameters
[in]_hNetBuf_Packet container reference
Examples:
net/transmit_multifunction/transmit_multifunction_example.c.

Definition at line 241 of file pktdescr.h.

Referenced by main().

#define NT_NET_SET_PKT_DESCR_TYPE_EXT8 (   _hNetBuf_)

Sets the packet descriptor type to EXT8.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 255 of file pktdescr.h.

#define NT_NET_SET_PKT_DESCR_TYPE_EXT9 (   _hNetBuf_)

Sets the packet descriptor type to EXT9.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 269 of file pktdescr.h.

#define NT_NET_SET_PKT_DESCR_TYPE_DYN1 (   _hNetBuf_)

Sets the packet descriptor type to DYN1.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 283 of file pktdescr.h.

#define NT_NET_SET_PKT_DESCR_TYPE_DYN2 (   _hNetBuf_)

Sets the packet descriptor type to DYN2.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 297 of file pktdescr.h.

#define NT_NET_SET_PKT_DESCR_TYPE_DYN3 (   _hNetBuf_)

Sets the packet descriptor type to DYN3.

Parameters
[in]_hNetBuf_Packet container reference
Examples:
net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 311 of file pktdescr.h.

Referenced by create_padding_packet_dyn3(), and main().

#define NT_NET_SET_PKT_DESCR_TYPE_DYN4 (   _hNetBuf_)

Sets the packet descriptor type to DYN4.

Parameters
[in]_hNetBuf_Packet container reference

Definition at line 325 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_STD (   _hNetBuf_)

Get standard packet descriptor pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 336 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_EXT7 (   _hNetBuf_)

Get extended packet descriptor 7 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 344 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_EXT8 (   _hNetBuf_)

Get extended packet descriptor 8 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 352 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_EXT9 (   _hNetBuf_)

Get extended packet descriptor 9 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 360 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_DYN1 (   _hNetBuf_)

Get dynamic packet descriptor 1 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 368 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_DYN2 (   _hNetBuf_)

Get dynamic packet descriptor 2 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 376 of file pktdescr.h.

#define NT_NET_GET_PKT_DESCR_PTR_DYN3 (   _hNetBuf_)

Get dynamic packet descriptor 3 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor
Examples:
net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 384 of file pktdescr.h.

Referenced by create_padding_packet_dyn3(), main(), and PacketTransmitterThread::txPacket().

#define NT_NET_GET_PKT_DESCR_PTR_DYN4 (   _hNetBuf_)

Get dynamic packet descriptor 4 pointer.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a pointer to the packet descriptor

Definition at line 392 of file pktdescr.h.

#define NT_NET_GET_PKT_L2_PTR (   _hNetBuf_)

A pointer to the L2 packet data. If an ISL header is present it will point to the ISL header.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns a void pointer to L2 packet data.
Examples:
net/analysis/analysis_example.c, net/checksum/checksum_example.cpp, net/timestamp_inject/timestamp_inject_example.cpp, net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_on_timestamp/transmit_on_timestamp_example.c, net/transmit_on_timestamp_setclock/transmit_on_timestamp_setclock_example.c, net/transmit_packet/transmit_packet_example.c, net/transmit_pcap/transmit_pcap_example.c, net/transmit_segment/transmit_segment_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 400 of file pktdescr.h.

Referenced by main(), PacketReaderThread::processPackets(), taskTransmitter(), and PacketTransmitterThread::txPacket().

#define NT_NET_UPDATE_PKT_L2_PTR (   _hNetBuf_)

When creating packets within a segment it is required to update the L2 pointer using this macro after applying the descriptor info.

Parameters
[in]_hNetBuf_Packet container reference
Examples:
net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_segment/transmit_segment_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 407 of file pktdescr.h.

Referenced by create_padding_packet_dyn3(), and main().

#define NT_NET_GET_PKT_DESCR_LENGTH (   _hNetBuf_)

Get the length of the packet descriptor.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Return the length of the packet descriptor in bytes
Examples:
net/vlandemo/vlandemo_example.c.

Definition at line 416 of file pktdescr.h.

Referenced by _nt_net_build_pkt_netbuf(), _nt_net_get_next_packet(), and main().

#define NT_NET_GET_PKT_DESCR_FORMAT (   _hNetBuf_)

Indicates if extended packet descriptor 7, 8, or 9 is used, if the standard packet descriptor is used, or what dynamic packet descriptor type is used.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns the packet descriptor format used

Definition at line 425 of file pktdescr.h.

#define NT_NET_GET_PKT_TIMESTAMP (   _hNetBuf_)

Get the packet timestamp.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns the time when the packet was captured as an 64bit unsigned value
Examples:
net/analysis/analysis_example.c, net/inline/inline_example.c, net/ipfdemo/ipfdemo_example.c, net/netflow/netflow_example.c, net/numa/numa_example.c, net/replay4GA/replay4ga_example.c, net/replayGS/replayGS_example.c, net/streamidstatistics/streamidstatistics_example.c, net/timestamp_inject/timestamp_inject_example.cpp, and net/vlandemo/vlandemo_example.c.

Definition at line 433 of file pktdescr.h.

Referenced by GetTimeStamp(), main(), PacketReaderThread::processPackets(), and while().

#define NT_NET_SET_PKT_TIMESTAMP (   _hNetBuf_,
  _ts_ 
)

Sets the packet time stamp - useful when controlling the traffic rate.

Parameters
[in]_hNetBuf_Packet container reference
[in]_ts_The timestamp value in 10ns resolution NATIVE format
Examples:
net/transmit_multifunction/transmit_multifunction_example.c, net/transmit_on_timestamp/transmit_on_timestamp_example.c, and net/transmit_on_timestamp_setclock/transmit_on_timestamp_setclock_example.c.

Definition at line 441 of file pktdescr.h.

Referenced by main().

#define NT_NET_GET_PKT_TIMESTAMP_TYPE (   _hNetBuf_)

Get the packet time stamp type. See NtTimestampType_e.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns the packet time stamp type. See NtTimestampType_e for values

Definition at line 449 of file pktdescr.h.

#define NT_NET_GET_PKT_CAP_LENGTH (   _hNetBuf_)

Returns the total stored length of the received frame including packet descriptors, in bytes, after any slicing. The value is a multiple of 8 if received on 3GA adapters, or if capture length was set with ALIGN macro. Also rounded up for unsliced frames with wire lengths. that are not multiples of 8 bytes.

Parameters
[in]_hNetBuf_Packet container reference
Returns
Returns the total stored length of the received frame
Examples:
net/timestamp_inject/timestamp_inject_example.cpp, and net/vlandemo/vlandemo_example.c.

Definition at line 461 of file pktdescr.h.

Referenced by _nt_net_get_next_packet(), main(), and PacketReaderThread::processPackets().

#define NT_NET_SET_PKT_CAP_LENGTH_NOALIGN (   _hNetBuf_,
  _Length_ 
)

Calculates and sets the packet capture length. Input is wire length. Capture length is calculated from the value - no alignment is applied.

Parameters
[in]_hNetBuf_Packet container reference
[in]_Length_The length value
Examples:
net/transmit_multifunction/transmit_multifunction_example.c, and net/transmit_segment_dyn_descr/transmit_segment_dyn_descr_example.cpp.

Definition at line 469 of file pktdescr.h.

Referenced by create_padding_packet_dyn3(), and main().