Пример #1
0
  public void FindParentClusters(TrafficCluster TCluster) {
    Iterator<Entry<Long, TrafficCluster>> ClusterIterator = BaseClusters.entrySet().iterator();
    TrafficCluster TempBaseCluster;
    while (ClusterIterator.hasNext()) {
      boolean IsParent = false;
      Map.Entry<Long, TrafficCluster> BaseClusterEntry =
          (Map.Entry<Long, TrafficCluster>) ClusterIterator.next();
      TempBaseCluster = BaseClusterEntry.getValue();
      IsParent =
          TrafficCluster.CompareTwoNwAddr(
                  TempBaseCluster.MatchOnSrcIP,
                  TempBaseCluster.SrcIPMatch,
                  TempBaseCluster.SrcMask,
                  TCluster.SrcIPMatch)
              && TrafficCluster.CompareTwoNwAddr(
                  TempBaseCluster.MatchOnDstIP,
                  TempBaseCluster.DstIPMatch,
                  TempBaseCluster.DstMask,
                  TCluster.DstIPMatch)
              && TrafficCluster.CheckPortMatches(
                  TempBaseCluster, TCluster.SrcPort, TCluster.DstPort)
              && TrafficCluster.CheckProtocolMatches(
                  TempBaseCluster.MatchOnProtocol, TempBaseCluster.Protocol, TCluster.Protocol);

      if (IsParent == true) {
        TCluster.ParentClusterIDs.add(TempBaseCluster.ClusterID);
      }
    }
  }
Пример #2
0
 public void CopyFromCluster(TrafficCluster TCluster) {
   if (TCluster.AddedToBase == false) {
     TrafficCluster NewBase =
         new TrafficCluster(
             new int[] {TCluster.SrcIPMatch, 4},
             new int[] {TCluster.DstIPMatch, 4},
             new short[] {TCluster.SrcPort},
             new short[] {TCluster.DstPort},
             TCluster.Protocol,
             this.BaseID);
     BaseClusters.put(NewBase.ClusterID, NewBase);
     TCluster.AddedToBase = true;
     TCluster.ParentClusterIDs.add(NewBase.ClusterID);
     this.BaseID++;
   }
 }