Exemple #1
0
        /// <summary>
        /// Appends header specific attributes to <paramref name="attributes"/> dictionary.
        /// </summary>
        /// <param name="attributes">Dictionary to append header specific attributes to.</param>
        internal void AppendHeaderAttributes(Dictionary <string, string> attributes)
        {
            attributes.Add("Frame Type", (ushort)TypeID + ": " + TypeID);
            attributes.Add("Frame Length", FrameLength.ToString());
            attributes.Add("Header Length", Length.ToString());
            attributes.Add("Payload Length", DataLength.ToString());
            attributes.Add("Second of Century", SecondOfCentury.ToString());
            attributes.Add("Fraction of Second", FractionOfSecond.ToString());

            uint timeQualityFlags = (uint)TimeQualityFlags;

            attributes.Add("Time Quality Flags", timeQualityFlags.ToString());

            if (timeQualityFlags > 0)
            {
                attributes.Add("Leap Second State", TimeQualityFlags.ToString());
            }
            else
            {
                attributes.Add("Leap Second State", "No leap second is currently pending");
            }

            attributes.Add("Time Quality Indicator Code", (uint)TimeQualityIndicatorCode + ": " + TimeQualityIndicatorCode);
            attributes.Add("Time Base", Timebase + (Timebase != Common.Timebase ? " - NON STANDARD" : ""));

            if (m_frameType != IEC61850_90_5.FrameType.DataFrame)
            {
                attributes.Add("Version", Version.ToString());
            }
            else
            {
                attributes.Add("SPDU Length", m_spduLength.ToString());
                attributes.Add("ASDU Payload Length", m_payloadSize.ToString());
                attributes.Add("Packet Number", PacketNumber.ToString());
                attributes.Add("Key ID", m_keyID.ToString("X").PadLeft(8, '0'));
                attributes.Add("Security Algorithm", (byte)m_securityAlgorithm + ": " + m_securityAlgorithm);
                attributes.Add("Signature Algorithm", (byte)m_signatureAlgorithm + ": " + m_signatureAlgorithm);

                if ((object)m_sourceHash != null && m_sourceHash.Length > 0)
                {
                    attributes.Add("Parsed Signature Hash", ByteEncoding.Hexadecimal.GetString(m_sourceHash, ' '));
                }
                else
                {
                    attributes.Add("Parsed Signature Hash", "null");
                }

                if ((object)m_calculatedHash != null && m_calculatedHash.Length > 0)
                {
                    attributes.Add("Calculated Signature Hash", ByteEncoding.Hexadecimal.GetString(m_calculatedHash, ' '));
                }
                else
                {
                    attributes.Add("Calculated Signature Hash", "null");
                }

                attributes.Add("Ignoring Checksum Validation", IgnoreSignatureValidationFailures.ToString());
                attributes.Add("Number of ASDUs", m_asduCount.ToString());
                attributes.Add("ConfigurationRevision", m_configurationRevision.ToString());
                attributes.Add("Simulated Data", m_simulatedData.ToString());
                attributes.Add("Application ID", m_applicationID.ToString());
                attributes.Add("Using ETR Configuration", UseETRConfiguration.ToString());
                attributes.Add("Configuration Guessing Allowed", GuessConfiguration.ToString());
                attributes.Add("Parsing Redundant ASDUs", ParseRedundantASDUs.ToString());
                attributes.Add("Ignoring Signature Validation Errors", IgnoreSignatureValidationFailures.ToString());
                attributes.Add("Ignoring Sample Size Validation Errors", IgnoreSampleSizeValidationFailures.ToString());
                attributes.Add("Selected Angle Format", m_angleFormat.ToString());
            }
        }
Exemple #2
0
 public override string ToString()
 {
     return(StructureNameHash.ToString() + ": " + DataPointer.ToString() + " (" + DataLength.ToString() + ")");
 }