예제 #1
0
 public OSPFAreaVertex(uint iID, int iDistanceFromRoot, LSAHeader lAssociatedLSA, int iAge, LSType lType)
 {
     this.iID = iID;
     this.iDistanceFromRoot = iDistanceFromRoot;
     this.lsAssociatedLSA   = lAssociatedLSA;
     this.iAge    = iAge;
     lNextHops    = new List <Link>();
     lIPAddresses = new List <IPAddress>();
     lAreas       = new List <OSPFArea>();
     this.lsType  = lType;
 }
예제 #2
0
        private bool LSAEquals(LSAHeader lsaOne, LSAHeader lsaTwo)
        {
            if (lsaOne.LSType != lsaTwo.LSType)
            {
                return(false);
            }
            if (lsaOne.AdvertisingRouter != lsaTwo.AdvertisingRouter)
            {
                return(false);
            }
            if (lsaOne.LinkStateID != lsaTwo.LinkStateID)
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Creates a new instance of this class by parsing the given data.
        /// </summary>
        /// <param name="bData">The data to parse</param>
        public OSPFLSAUpdateMessage(byte[] bData)
        {
            lsaMessages = new List <LSAHeader>();

            byte[]    bLSAHeader;
            LSAHeader lsaHeader;
            int       iC1 = 4;

            int iCount = ((int)bData[0] << 24) + ((int)bData[1] << 16) + ((int)bData[2] << 8) + bData[3];

            while (lsaMessages.Count < iCount)
            {
                bLSAHeader = new byte[bData.Length - iC1];
                for (int iC2 = iC1; iC2 < bData.Length; iC2++)
                {
                    bLSAHeader[iC2 - iC1] = bData[iC2];
                }
                lsaHeader = new LSAHeader(bLSAHeader);
                lsaMessages.Add(lsaHeader);
                iC1 += lsaHeader.Length;
            }
        }
 /// <summary>
 /// Removes a LSAHeader from this instance
 /// </summary>
 /// <param name="lsa">The LSAHeader to remove</param>
 public void RemoveItem(LSAHeader lsa)
 {
     lsaMessages.Remove(lsa);
 }
 /// <summary>
 /// Returns a bool indicating whether a LSAHeader is contained in this LSA update message
 /// </summary>
 /// <param name="lsa">The LSAHeader to search for</param>
 /// <returns>A bool indicating whether a LSAHeader is contained in this LSA update message</returns>
 public bool ContainsItem(LSAHeader lsa)
 {
     return(lsaMessages.Contains(lsa));
 }
 /// <summary>
 /// Adds an LSA header to this update message
 /// </summary>
 /// <param name="lsa">The LSA header to add</param>
 public void AddItem(LSAHeader lsa)
 {
     lsaMessages.Add(lsa);
 }
 /// <summary>
 /// Removes a specific LSA header
 /// </summary>
 /// <param name="lsa">The LSA header to remove</param>
 public void RemoveItem(LSAHeader lsa)
 {
     lLSAHeaders.Remove(lsa);
 }
 /// <summary>
 /// Returns a bool indicating whether a specific LSA header is contained in this frame
 /// </summary>
 /// <param name="lsa">The LSA header to search for</param>
 /// <returns>A bool indicating whether a specific LSA header is contained in this frame</returns>
 public bool ContainsItem(LSAHeader lsa)
 {
     return(lLSAHeaders.Contains(lsa));
 }
 /// <summary>
 /// Adds an LSA header to this frame
 /// </summary>
 /// <param name="lsa">The LSA header to add</param>
 public void AddItem(LSAHeader lsa)
 {
     lLSAHeaders.Add(lsa);
 }