/// <summary> /// true iff the GroupAddress, IsSuppressRouterSideProcessing, QueryRobustnessVariable and SourceAddresses fields are equal /// and the QueryInterval is similar. /// </summary> private bool EqualFields(IgmpQueryVersion3Layer other) { return(other != null && GroupAddress == other.GroupAddress && IsSuppressRouterSideProcessing == other.IsSuppressRouterSideProcessing && QueryRobustnessVariable == other.QueryRobustnessVariable && QueryInterval.Divide(2) <= other.QueryInterval && QueryInterval.Multiply(2) >= other.QueryInterval && SourceAddresses.SequenceEqual(other.SourceAddresses)); }
/// <summary> /// Two records are equal if the record type, multicast address, source addresses and auxiliary data are equal. /// </summary> public bool Equals(IgmpGroupRecord other) { if (other == null) { return(false); } return(RecordType == other.RecordType && MulticastAddress == other.MulticastAddress && SourceAddresses.SequenceEqual(other.SourceAddresses) && AuxiliaryData.Equals(other.AuxiliaryData)); }
/// <summary> /// The hash code of a record is the xor of the hash code of the record type, multicast address, source addresses and auxiliary data. /// </summary> public override int GetHashCode() { return(Sequence.GetHashCode(RecordType, MulticastAddress) ^ SourceAddresses.SequenceGetHashCode() ^ AuxiliaryData.BytesSequenceGetHashCode()); }
/// <summary> /// A string containing the record type, multicast address, source addresses and the number of bytes in teh auxiliary data. /// </summary> public override string ToString() { return(RecordType + " " + MulticastAddress + " " + SourceAddresses.SequenceToString(", ", "[", "]") + " Aux=" + AuxiliaryData.Length); }
/// <summary> /// Xor of the combination of the IsSuppressRouterSideProcessing and QueryRobustnessVariable fields with /// the hash codes of the layer length, datalink, message type, query version, group address and all the source addresses. /// </summary> public override int GetHashCode() { return(base.GetHashCode() ^ Sequence.GetHashCode(GroupAddress, BitSequence.Merge(IsSuppressRouterSideProcessing.ToByte(), QueryRobustnessVariable)) ^ SourceAddresses.SequenceGetHashCode()); }