Network Wizard for VHDL Test Benches
nw_udpv4_pkg Package Body Reference
Package >> nw_udpv4_pkg

Functions

t_slv_arr   f_udpv4_create_pkt (
ipv4_header: in t_ipv4_header
udp_header: in t_udp_header
payload: in t_slv_arr
add_chksum: in boolean true
get_length: in boolean false
)
t_slv_arr   f_udpv4_create_pkt (
ipv4_header: in t_ipv4_header
udp_header: in t_udp_header
payload: in t_slv_arr
add_chksum: in boolean true
)
 Create UDP for IPv4 packet.
t_slv_arr   f_udpv4_create_pkt ( udp_header: in t_udp_header , payload: in t_slv_arr )
 Create UDP for IPv4 packet (no checksum)
natural   f_udpv4_create_pkt_len ( udp_header: in t_udp_header , payload: in t_slv_arr )
 Return length of UDP packet.
natural   f_udpv4_create_pkt_len (
ipv4_header: in t_ipv4_header
udp_header: in t_udp_header
payload: in t_slv_arr
add_chksum: in boolean true
)
 Return length of UDP packet.
t_udp_header   f_udpv4_get_header ( udp_pkt: in t_slv_arr )
 Get UDP header.
t_slv_arr   f_udpv4_get_payload ( udp_pkt: in t_slv_arr , get_length: in boolean false )
t_slv_arr   f_udpv4_get_payload ( udp_pkt: in t_slv_arr )
 Get UDP payload.
natural   f_udpv4_get_payload_len ( udp_pkt: in t_slv_arr )
 Get UDP payload length.
boolean   f_udpv4_chksum_ok ( ipv4_header: in t_ipv4_header , udp_pkt: in t_slv_arr )
 Check UDP checksum.

Member Function Documentation

◆ f_udpv4_create_pkt() [1/2]

t_slv_arr f_udpv4_create_pkt (   ipv4_header in t_ipv4_header ,
  udp_header in t_udp_header ,
  payload in t_slv_arr ,
  add_chksum in boolean true  
)
Function

Create UDP for IPv4 packet.

Parameters
ipv4_headerIPv4 header (required for checksum calculation)
udp_headerUDP header
payloadUDP payload
add_chksumAdd checksum (default true)
Returns
UDP packet (8bit array) or length of UDP packet

Create UDP for IPv4 packet. Payload must be 8bit data array. A pseudo-header is generated from the IPv4 header which is included in the checksum calculation.

Example use

v_ipv4_header := C_DEFAULT_IPV4_HEADER;
v_udp_header := C_DEFAULT_UDP_HEADER;
v_packet_8bit := f_udpv4_create_pkt(v_ipv4_header, v_udp_header, payload);

◆ f_udpv4_create_pkt() [2/2]

t_slv_arr f_udpv4_create_pkt (   udp_header in t_udp_header ,
  payload in t_slv_arr  
)
Function

Create UDP for IPv4 packet (no checksum)

Parameters
udp_headerUDP header
payloadUDP payload
Returns
UDP packet (8bit array) or length of UDP packet

Create UDP packet, set checksum field to x"0000". Payload must be 8bit data array.

Example use

v_udp_header := C_DEFAULT_UDP_HEADER;
v_packet_8bit := f_udpv4_create_pkt(v_udp_header, payload);

◆ f_udpv4_create_pkt_len() [1/2]

natural f_udpv4_create_pkt_len (   udp_header in t_udp_header ,
  payload in t_slv_arr  
)
Function

Return length of UDP packet.

Parameters
udp_headerUDP header
payloadUDP payload
Returns
Length of UDP packet

Return the length of the created UDP packet.

Example use

v_len := f_udpv4_create_pkt_len(v_udp_header, payload);
v_pkt_8bit(0 to v_len - 1) := f_udpv4_create_pkt(v_udp_header, payload);

◆ f_udpv4_create_pkt_len() [2/2]

natural f_udpv4_create_pkt_len (   ipv4_header in t_ipv4_header ,
  udp_header in t_udp_header ,
  payload in t_slv_arr ,
  add_chksum in boolean true  
)
Function

Return length of UDP packet.

Parameters
ipv4_headerIPv4 header (required for checksum calculation)
udp_headerUDP header
payloadUDP payload
add_chksumAdd checksum (default true)
Returns
Length of UDP packet

Return the length of the created UDP packet.

Example use

v_len := f_udpv4_create_pkt_len(v_ipv4_header, v_udp_header, payload);
v_pkt_8bit(0 to v_len - 1) := f_udpv4_create_pkt(_ipv4_header, v_udp_header, payload);

◆ f_udpv4_get_header()

t_udp_header f_udpv4_get_header (   udp_pkt in t_slv_arr  
)
Function

Get UDP header.

Parameters
udp_pktUDP packet (8bit)
Returns
UDP header

Extract UDP header from UDP packet.

Example use

v_udp_header := f_udpv4_get_header(data_array_8bit);

◆ f_udpv4_get_payload()

t_slv_arr f_udpv4_get_payload (   udp_pkt in t_slv_arr  
)
Function

Get UDP payload.

Parameters
udp_pktUDP packet (8bit)
Returns
t_slv_arr

Extract UDP payload from UDP packet.

Example use

v_len := f_udpv4_get_payload_len(data_array_8bit);
v_payload(0 to v_len - 1) := f_udpv4_get_payload(data_array_8bit);

◆ f_udpv4_get_payload_len()

natural f_udpv4_get_payload_len (   udp_pkt in t_slv_arr  
)
Function

Get UDP payload length.

Parameters
udp_pktUDP packet (8bit)
Returns
UDP payload length

Get UDP payload length from UDP packet.

Example use

v_len := f_udpv4_get_payload_len(data_array_8bit); -- determine size of payload

◆ f_udpv4_chksum_ok()

boolean f_udpv4_chksum_ok (   ipv4_header in t_ipv4_header ,
  udp_pkt in t_slv_arr  
)
Function

Check UDP checksum.

Parameters
ipv4_headerIPv4 header
udp_pktUDP packet (8bit)
Returns
Checksum is OK (True), or not (False)

Check checksum of UDP packet. The IPv4 header is required for the pseudo-header fields.

Example use

v_check := f_udpv4_chksum_ok(ipv4_header, data_array_8bit);

The documentation for this class was generated from the following file: