Exemple #1
0
 public NetworkNode()
 {
     this.commutationTable           = new CommutationTable();
     this.borderNodeCommutationTable = new BorderNodeCommutationTable();
     this.eonTable         = new EONTable();
     this.commutationField = new CommutationField(ref borderNodeCommutationTable, ref commutationTable, ref eonTable, 1);
 }
        /// <summary>
        /// Funkcja słuząca do zamiany nagłówka, uwzgledniajaca "-1" w czestotliwosci
        /// </summary>
        /// <param name="message">Wiadomość odebrana w postaci tablicy bajtów</param>
        /// <returns></returns>
        public byte[] changePackageHeader2(byte[] message, ref CommutationField commutationField)
        {
            byte[] msg = new byte[64];
            msg = message;
            Package p = new Package(msg);

            //Jak czestotliwosc jest rowna -1
            if (p.frequency == -1)
            {
                BorderNodeCommutationTableRow row = new BorderNodeCommutationTableRow();

                row = this.FindRow(p.IP_Source.ToString(), p.portNumber, p.IP_Destination.ToString());

                p.changeBand(row.band);
                p.changeFrequency(row.frequency);
                p.changeModulationPerformance(row.modulationPerformance);
                p.changeBitRate(row.bitRate);
                p.changePort(row.Port);

                msg = p.toBytes();
            }
            //Jak nie bylo -1, to odwolujemy sie do tabeli komutacji, ale nie brzegowej
            else
            {
                msg = commutationField.commutationTable.changePackageHeader(msg);
            }


            return(msg);
        }
Exemple #3
0
        /// <summary>
        /// Funkcja słuząca do zamiany nagłówka, uwzgledniajaca "-1" w czestotliwosci
        /// </summary>
        /// <param name="message">Wiadomość odebrana w postaci tablicy bajtów</param>
        /// <returns></returns>
        public byte[] changePackageHeader2(byte[] message, ref CommutationField commutationField)
        {
            byte[] msg = new byte[64];
            msg = message;
            Package p = new Package(msg);

            //Jak czestotliwosc jest rowna -1
            if (p.frequency == -1)
            {
                BorderNodeCommutationTableRow row = new BorderNodeCommutationTableRow();

                row = this.FindRow(p.IP_Source.ToString(), p.portNumber, p.IP_Destination.ToString());

                //Gdy udalo sie znalezc wpis w tabeli, podmien pola naglowka
                if (row != null)
                {
                    p.changeBand(row.band);
                    p.changeFrequency(row.frequency);
                    p.changeModulationPerformance(row.modulationPerformance);
                    p.changeBitRate(row.bitRate);
                    // p.changePort(row.Port);
                }
                //Jak sie nie udalo, to wpisz -2 do czestotliwosci
                else
                {
                    //-2 oznacza "upusc pakiet"
                    p.changeFrequency(-2);
                }

                msg = p.toBytes();
            }
            //Jak nie bylo -1, to odwolujemy sie do tabeli komutacji, ale nie brzegowej

            msg = commutationField.commutationTable.changePackageHeader(msg);



            return(msg);
        }