示例#1
0
        /// <summary>
        /// Returns a list of flows
        /// </summary>
        /// <param name="packets"></param>
        /// <returns></returns>
        public static List <PairNode2> GeneratePairNodes(IEnumerable <Flow2> flows)
        {
            //System.Console.WriteLine("flows2/GenerateFlows");
            SortedList <PrimaryConnection2, PairNode2> pairNodes = new SortedList <PrimaryConnection2, PairNode2>();

            int id = 0;

            foreach (Flow2 f in flows)
            {
                PrimaryConnection2 conn    = new PrimaryConnection2(f);
                PrimaryConnection2 revConn = conn.BackwardDirection; // the reverse direction of the flow

                if (!pairNodes.ContainsKey(conn))
                {
                    if (!pairNodes.ContainsKey(revConn))
                    {
                        pairNodes.Add(conn, new PairNode2(id++, conn));
                    }
                    else
                    {
                        conn = revConn;
                    }
                }

                pairNodes[conn].AddFlow(f);
            }

            return(pairNodes.Values.ToList());
        }
示例#2
0
        public PairNode2(int id, PrimaryConnection2 pairConnection)
        {
            this._id = id;

            this._flowList = new List <Flow2>();

            this._pairConn = pairConnection;

            this.ProcessName = default(string);
        }
示例#3
0
        public PairNode2(int id, PrimaryConnection2 connection, IEnumerable <Flow2> flowList)
        {
            this._id = id;

            this._pairConn = connection;

            this._flowList = new List <Flow2>();

            this._flowList.AddRange(flowList);

            this.ProcessName = default(string);
        }
        public override bool Equals(object obj)
        {
            if (!(obj is PrimaryConnection2))
            {
                return(false);
            }

            PrimaryConnection2 cpObj = (PrimaryConnection2)obj;

            if (cpObj.SrcIP.AddressFamily.Equals(this.SrcIP.AddressFamily))
            {
                if (cpObj.SrcIP.Equals(this.SrcIP) &&
                    cpObj.DestIP.Equals(this.DestIP))
                {
                    return(true);
                }
            }

            return(false);
        }
        public int CompareTo(object obj)
        {
            if (obj is PrimaryConnection2)
            {
                PrimaryConnection2 cp = (PrimaryConnection2)obj;

                if (this.Equals(cp))
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                return(-1);
            }
        }
示例#6
0
 public void Dispose()
 {
     this._pairConn = null;
     this._flowList.Clear();
     this._flowList = null;
 }