class SeqNumValidator

Sequence Number Validator. More...

Full nameCoral::SeqNumValidator
Definition#include <seqnumvalidator.h>
Inherited bySourceStateInfo
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods


Detailed Description

This class is a validator for sequence numbers. It is based on the algorithm described in RFC 1889. It can use sequence numbers up to a size of 64 bits. Jitter and fraction loss calculation is also done by this class.

 SeqNumValidator (const cardinal minSequential = 2, const cardinal maxMisorder = 100, const cardinal maxDropout = 3000, const card64 seqMod = (1 << 16))

Constructor for new sequence number validator.

Parameters:
minSequentialMinimum number of packets in sequence for the source to be valid.
maxMisorderMaximum difference for packets to be misordered.
maxDropoutMaximum gap.
seqModSequence number modulo.

inline card64  getPacketsReceived ()

[const]

Get number of packets received.

Returns: Number of packets received.

inline card64  getPacketsLost ()

[const]

Get number of packets lost. The loss is calculated by the number of sequence number cycles and gaps.

Returns: Number of packets lost.

inline card64  getLastSeqNum ()

[const]

Get extended last sequence number. This number is extended by the calculated number of sequence number cycles!

Returns: Last sequence number.

inline double  getFractionLost ()

[const]

Get fraction of packets lost. Note: No calculation of the fraction lost is done here! The fraction lost value is the value of the last call of calculateFractionLost()!

Returns: Fraction of packets lost.

inline double  getJitter ()

[const]

Get jitter.

Returns: Jitter.

enum ValidationResult {Valid = 0, SourceProbation = 1, Jumped = 2, Invalid = 10, DuplicatePacket = Invalid + 0, InvalidSeqNum = Invalid + 1 }

ValidationResult  validate (const card64 sequenceNumber, const card32 packetTimeStamp = 0)

Validate a new sequence number. If the packet is valid, jitter value will be calculated using packetTimeStamp. To disable jitter calculation, set packetTimeStamp to 0.

Parameters:
sequenceNumberSequence number to be validated.
packetTimeStampTime stamp of the packet for jitter calculation.

Returns: ValidationResult containing result of validation.

void  reset ()

Reset SeqNumValidator.

double  calculateFractionLost ()

Calculate and get fraction of packets lost.

Returns: Fraction lost.