Class UDPHeader
Defined in File UDPHeader.h
Class Documentation
-
class UDPHeader
class that provides methods to configure a CBF/PSR UDP header represented by the cbf_psr_header_t structure.
Public Functions
-
UDPHeader()
Construct a new UDPHeader object.
Initialises packet values by calling ska::pst::recv::PacketStructure::configure_packet_defaults(cbf_psr_header_t * header)
-
void configure(const ska::pst::common::AsciiHeader &config, const ska::pst::recv::UDPFormat &format)
Configures private PacketStructure struct cbf_psr_header header using the input parameters config and format.
- Parameters
config – AsciiHeader object containing PacketStructure definitions
format – UDPFormat object packet format definitions.
-
void set_samples_since_ska_epoch(uint64_t samples_since_ska_epoch)
set number samples since SKA Epoch.
This will effectively set the current time of header based on the sample period (TSAMP) and the number of samples since SKA epoch.
-
void set_packet_sequence_number(uint64_t psn)
Set the packet sequence number object.
- Parameters
psn – sequence number assigned to the packet.
-
void set_scan_id(uint64_t scan_id)
Set the scan id object.
- Parameters
scan_id – scan id assigned to the packet.
-
void set_beam_id(uint64_t beam_id)
Set the beam id object.
- Parameters
beam_id – beam id assigned to the packet.
-
void set_validity_flag(ValidityType type)
Adjust the header validity flags.
- Parameters
type – validity type enumeration value to use
-
void encode_header(char *buf)
Copies the contents of the header into the parameter buf.
- Parameters
buf – socket buffer to be encoded using the local header
-
void increment_packet()
increments header packet_sequence number and updates header timestamp.
-
size_t gen_packet(char *buf)
passes param buf to encode_header method and calls increment_packet. Returns packet_size.
- Parameters
buf – socket buffer
- Returns
size_t size of the packet
-
size_t gen_packet_failure(char *buf, FailureType failure_type)
Used for testing. Generates a packet with induced failure.
- Parameters
buf – socket buffer
failure_type – type of error to be induced
- Returns
size_t size of the packet
-
UDPHeader()