Beispiel #1
0
        /* Komutacja - nagłówek komórki jest wyjmowany i na podstawie wpisu z tablicy routingu komórka jest przekazywana na port wyj*/
        /* port wej ---> komutator ---> port wyjściowy */
        public void Commutation(Cell cell)
        {
            HalfEntryMapping source = new HalfEntryMapping(cell.portID, cell.VPI, cell.VCI);

            switchElement.Log.Queue.Enqueue("Matrix {src}: " + "port=" + cell.portID + " VPI=" + cell.VPI + " VCI=" + cell.VCI);
            if (mappingTable.ContainsKey(source))
            {
                HalfEntryMapping target = mappingTable[source]; // znalezienie w tablicy wezla docelowego

                /* Mapowanie VPI, VCI lub tylko VPI */
                cell.VPI = target.VPI;
                if (target.VCI > 0)
                {
                    cell.VCI = target.VCI;
                }
                cell.portID = target.Port;

                /* informacja o danych na wyjście */
                switchElement.Log.Queue.Enqueue("Matrix {dest}: " + "port=" + cell.portID + " VPI=" + cell.VPI + " VCI=" + cell.VCI);

                switchElement.PortsOut.sendDone.Reset();
                switchElement.PortsOut.Send(cell); // wysłanie komórki na dany port
                switchElement.PortsOut.sendDone.WaitOne();

                switchElement.Log.Queue.Enqueue("Commutate to (port=" + cell.portID + ", VPI= " + cell.VPI + " VCI=" + cell.VCI + "): " + Encoding.UTF8.GetString(cell.Data));
            }
        }