Beispiel #1
0
        private bool RemoveRecord(ForwardingRecord record)
        {
            if (!ForwardingTable.ContainsKey(record.InputPort))
            {
                return(false);
            }
            List <ForwardingRecord> scope    = ForwardingTable[record.InputPort];
            ForwardingRecord        toRemove = null;

            foreach (ForwardingRecord scopeRecord in scope)
            {
                if (record.Equals(scopeRecord))
                {
                    toRemove = scopeRecord;
                    break;
                }
            }

            if (toRemove != null)
            {
                ClearCredentials(toRemove);
                ForwardingTable[record.InputPort].Remove(toRemove);
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        private bool ClearCredentials(ForwardingRecord record)
        {
            Frame inputCredential  = (Frame)InputCredentials[record.InputPort];
            Frame outputCredential = (Frame)OutputCredentials[record.OutputPort];
            bool  result           = true;

            result = result && inputCredential.ClearVirtualContainer(record.ContainerLevel, record.HigherPathIn, record.VcNumberIn);
            result = result && outputCredential.ClearVirtualContainer(record.ContainerLevel, record.HigherPathOut, record.VcNumberOut);
            return(result);
        }
Beispiel #3
0
        private bool CheckForwardingRecord(ForwardingRecord record)
        {
            VirtualContainer vc = new VirtualContainer(record.ContainerLevel);

            if (InputCredentials[record.InputPort].SetVirtualContainer(record.ContainerLevel, record.HigherPathIn, record.VcNumberIn == -1 ? null : (int?)record.VcNumberIn, vc))
            {
                if (OutputCredentials[record.OutputPort].SetVirtualContainer(record.ContainerLevel, record.HigherPathOut, record.VcNumberOut == -1 ? null : (int?)record.VcNumberOut, vc))
                {
                    return(true);
                }

                ((Frame)InputCredentials[record.InputPort]).ClearVirtualContainer(record.ContainerLevel, record.HigherPathIn, record.VcNumberIn == -1 ? null : (int?)record.VcNumberIn);
            }

            return(false);
        }