Esempio n. 1
0
        private void FlagRouters(string routerData)
        {
            string[] indices = routerData.Split('=')[1].Split(',');
            foreach (string indexWithSpace in indices)
            {
                int  index;
                bool working;

                if (indexWithSpace[1] == '!')
                {
                    index   = Convert.ToInt32(indexWithSpace.Substring(2));
                    working = false;
                }
                else
                {
                    index   = Convert.ToInt32(indexWithSpace.Substring(1));
                    working = true;
                }

                Router router = ConfigLoader.FindRouterAmongAll(index);
                if (router != null)
                {
                    router.working = working;
                }
            }
        }
Esempio n. 2
0
        public void HandleClient(TcpClient client)
        {
            TcpClient     MyClient = client;
            NetworkStream stream   = MyClient.GetStream();
            StreamReader  reader   = new StreamReader(stream);
            StreamWriter  writer   = new StreamWriter(stream);

            try {
                string   request = reader.ReadLine();
                string[] cut     = request.Split(':');

                if (cut[0].Equals("REGISTRATION") && cut[1].Equals("HOST"))
                {
                    numOfHosts++;

                    foreach (Host h in ConfigLoader.GetHosts())
                    {
                        if (h.getIP() == cut[2])
                        {
                            lock (hostConnections) {
                                hostConnections.AddLast(new HostConnection(h, client, Convert.ToInt32(cut[3]), this, ncc));
                            }
                            writer.WriteLine("component:NONE;name:RegistrationResponse;succeeded:true");
                            writer.Flush();
                            GUIWindow.PrintLog("Host #" + cut[3] + "|" + cut[2] + "| has been registered");
                            break;
                        }
                    }
                }
                else if (cut[0].Equals("REGISTRATION") && cut[1].Equals("ROUTER"))
                {
                    numOfRouters++;

                    foreach (Router r in ConfigLoader.GetRouters())
                    {
                        if (r.getIP() == cut[2])
                        {
                            lock (routerConnections) {
                                routerConnections.AddLast(new RouterConnection(r, client, Convert.ToInt32(cut[3]), this));
                            }
                            writer.WriteLine("REGISTRATION:OK");
                            writer.Flush();

                            GUIWindow.PrintLog("Router #" + cut[3] + "|" + cut[2] + "| has been registered");

                            break;
                        }
                    }
                }
            } catch (IOException) {
                GUIWindow.PrintLog("One of the network nodes has been disconected");
            }
        }
Esempio n. 3
0
        static void Main(String[] args)
        {
            try {
                args = Environment.GetCommandLineArgs();

                new Thread(() => {
                    Thread.Sleep(1000);
                    try {
                        String config = String.Concat(File.ReadAllLines(args[1]));
                        ConfigLoader.loadConfig(config, args[2]);

                        //String config = String.Concat(File.ReadAllLines("./../../../../sharedResources/tsst_config.xml"));
                        //ConfigLoader.loadConfig(config, "1");


                        //String config = String.Concat(File.ReadAllLines("./../../../../sharedResources/tsst_config.xml"));
                        //ConfigLoader.loadConfig(config);
                        //String config = String.Concat(File.ReadAllLines(args[1]));
                        //ConfigLoader.LoadConfig(config, args[2]);
                        ncc    = new NCC();
                        server = new Server(ncc);

                        if (ConfigLoader.ccID == 2)
                        {
                            interCCServer = new InterCcCommunicationServer(ncc);
                        }
                        else if (ConfigLoader.ccID == 1)
                        {
                            peerConnection = new PeerConnection(new TcpClient("localhost", 12500), true, ncc);
                        }
                        else
                        {
                            childConnection = new ChildConnection(new TcpClient("localhost", 12500), ncc);
                        }
                        GUIWindow.UpdateChannelTable();
                    }
                    catch (Exception e) {
                        GUIWindow.PrintLog(e.StackTrace);
                    }
                }).Start();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new GUIWindow());
            }
            catch (Exception ex) {
                GUIWindow.PrintLog(ex.StackTrace);
            }
        }
Esempio n. 4
0
        public void HandleRequest(Dictionary <string, string> data)
        {
            switch (data["name"])
            {
            case "ConnectionRequest":
                switch (data["layer"])
                {
                case "upper":
                    GUIWindow.PrintLog("CC: Received ConnectionRequest(" + data["routerX"] + ", " + data["routerY"] + ", " + data["speed"] + " Gb/s, InterDomainConnection: " + data["IDC"] + ") from NCC");

                    string networkCase = ConfigLoader.ccID == 3 ? "SN" : "FirstAS";
                    string message420  = "component:RC;name:RouteTableQuery;routerX:" + data["routerX"] + ";routerY:" + data["routerY"] + ";speed:" + data["speed"] + ";IDC:" + data["IDC"] + ";case:" + networkCase;
                    GUIWindow.PrintLog("CC: Sent RouteTableQuery(" + data["routerX"] + ", " + data["routerY"] + ", " + data["speed"] + " Gb/s, InterDomainConnection: " + data["IDC"] + ") to RC");
                    Program.rc.HandleRequest(Util.DecodeRequest(message420));
                    break;

                case "lower":
                    GUIWindow.PrintLog("CC: Received ConnectionRequest(routerX: " + data["routerX"] + ", routerY: " + data["routerY"] + ", path:" + data["path"] + ") from parent CC");
                    List <int> routerID2 = new List <int>();
                    foreach (string id in data["path"].Split('-'))
                    {
                        routerID2.Add(Convert.ToInt32(id));
                    }
                    Host hostX2 = ConfigLoader.FindHostAmongAll(Convert.ToInt32(data["endPoint1"]));
                    Host hostY2 = ConfigLoader.FindHostAmongAll(Convert.ToInt32(data["endPoint2"]));
                    cachedPath = new Path(routerID2, hostX2, hostY2);
                    cachedPath.channelRange = data["channelRange"];
                    Tuple <HostConnection, HostConnection> connections2 = GetHostConnections(cachedPath);
                    Call call2 = new Call(Convert.ToInt32(data["connID"]), true, (ConfigLoader.ccID == 1 ? 2 : 1), cachedPath.throughSN, connections2.Item1, connections2.Item2, cachedPath);
                    NCC.callRegister.Add(Convert.ToInt32(data["connID"]), call2);

                    //GUIWindow.PrintLog("CC: Sent SendConnectionTables(" + data["path"] + ", " + data["connID"] + ") to RC");
                    Program.rc.HandleRequest(Util.DecodeRequest("name:SendConnectionTables;connID:" + data["connID"] + ";path:" + data["path"]));
                    break;
                }
                break;

            case "ConnectionRequestResponse":
                GUIWindow.PrintLog("CC: Received ConnectionRequestResponse() from child CC");
                if (cachedScenario == 1)
                {
                    //scenariusz 1
                    GUIWindow.PrintLog("CC: Sent PeerCoordinationResponse() to peer CC");
                    Program.peerConnection.SendMessage("component:CC;name:PeerCoordinationResponse");
                }
                else
                {
                    //scenariusz 2
                    var decoded = Util.DecodeRequest(cachedMessage);
                    GUIWindow.PrintLog("CC: Sent PeerCoordination(routerX: " + decoded["routerX"] + ", routerY: " + decoded["routerY"] + ", path:" + decoded["path"] + ") to peer CC");
                    Program.peerConnection.SendMessage(cachedMessage);
                }
                break;

            case "RouteTableQueryResponse":
                //GUIWindow.PrintLog("Received RouteTableQueryResponse(" + data["path"] + ") from RC");
                if (data["path"].Equals("null"))
                {
                    GUIWindow.PrintLog("CC: Requested connection could not be established");
                    string message1 = "component:CC;name:ConnectionRequestResponse;succeeded:false";
                    GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse(SUCCEEDED: false) to NCC");
                    Program.ncc.HandleRequest(Util.DecodeRequest(message1), null);
                    break;
                }

                //tutaj wysyłamy LRMom request o alokacje, potem PeerCoordination jeśli to połączenie IDC
                bool throughSN = ConfigLoader.ccID == 1 ? false : RC.currentPath.throughSN;
                Tuple <HostConnection, HostConnection> connections = GetHostConnections(RC.currentPath);
                Call call = new Call(RC.currentConnectionID, Convert.ToBoolean(RC.cachedData["IDC"]), ConfigLoader.ccID, throughSN, connections.Item1, connections.Item2, RC.currentPath);
                NCC.callRegister.Add(RC.currentConnectionID, call);

                //GUIWindow.PrintLog("CC: Sent LinkConnectionRequest(" + RC.cachedData["channelRange"] + ") to internal LRM");
                string message2 = "name:LinkConnectionRequest;type:internal;channelRange:" + RC.cachedData["channelRange"] + ";asType:first";
                Program.lrm.HandleRequest(Util.DecodeRequest(message2));

                break;

            case "LinkConnectionRequestResponse":
                switch (data["type"])
                {
                case "internal":
                    //GUIWindow.PrintLog("CC: Received LinkConnectionRequestResponse() from internal LRM");

                    if (data["asType"].Equals("second"))
                    {
                        if (cachedPath.throughSN && ConfigLoader.ccID == 2)
                        {
                            //tu jeszcze external LinkConnectionRequest
                            string message3 = "name:LinkConnectionRequest;type:external;respond:false;channelRange:" + cachedPath.channelRange;
                            Program.lrm.HandleRequest(Util.DecodeRequest(message3));
                            GUIWindow.PrintLog("External LRM: Sent LinkConnectionRequestResponse() to CC");
                            GUIWindow.PrintLog("CC: Received LinkConnectionRequestResponse() from External LRM");

                            var decoded = Util.DecodeRequest(cachedMessage);
                            cachedScenario = 1;
                            GUIWindow.PrintLog("CC: Sent ConnectionRequest(routerX: " + decoded["routerX"] + ", routerY: " + decoded["routerY"] + ", path:" + decoded["path"] + ") to child CC");
                            Program.parentConnection.SendMessage(cachedMessage);
                        }
                        else
                        {
                            //zwrotka do peera
                            GUIWindow.PrintLog("CC: Sent PeerCoordinationResponse() to peer CC");
                            Program.peerConnection.SendMessage("component:CC;name:PeerCoordinationResponse");
                        }
                        break;
                    }
                    else if (data["asType"].Equals("SN"))
                    {
                        //zwrotka do parent CC
                        GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse() to parent CC");
                        Program.childConnection.SendMessage("component:CC;name:ConnectionRequestResponse");
                        break;
                    }


                    if (Convert.ToBoolean(RC.cachedData["IDC"]))
                    {
                        GUIWindow.PrintLog("CC: Sent LinkConnectionRequest(" + RC.cachedData["channelRange"] + ") to extrenal LRM");
                        string message3 = "name:LinkConnectionRequest;type:external;respond:true;channelRange:" + RC.cachedData["channelRange"];
                        Program.lrm.HandleRequest(Util.DecodeRequest(message3));
                    }
                    else
                    {
                        //connectionRequestResponse
                        string message1 = "component:CC;name:ConnectionRequestResponse;succeeded:true;connID:" + RC.currentConnectionID;
                        GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse(SUCCEEDED: true, connectionID: " + RC.currentConnectionID + ") to NCC");
                        Program.ncc.HandleRequest(Util.DecodeRequest(message1), null);
                    }
                    break;

                case "external":
                    GUIWindow.PrintLog("CC: Received LinkConnectionRequestResponse() from external LRM");

                    try {
                        string listOfRouters = "";
                        foreach (int router in RC.currentPath.routerIDs)
                        {
                            listOfRouters += router + "-";
                        }
                        listOfRouters = listOfRouters.Remove(listOfRouters.Length - 1, 1);

                        string message4 = "component:CC;name:PeerCoordination;connID:" + RC.currentConnectionID + ";routerX:" + RC.cachedData["routerX"] + ";routerY:" + RC.cachedData["routerY"]
                                          + ";routerIDs:" + listOfRouters + ";endPoint1:" + RC.currentPath.endPoints.Item1.GetHostID() + ";" + "endPoint2:" + RC.currentPath.endPoints.Item2.GetHostID()
                                          + ";path:" + listOfRouters + ";channelRange:" + RC.cachedData["channelRange"];

                        if (ConfigLoader.ccID == 1)
                        {
                            //robimy PeerCoordination
                            GUIWindow.PrintLog("CC: Sent PeerCoordination(routerX: " + RC.cachedData["routerX"] + ", routerY: " + RC.cachedData["routerY"] + ", path:" + listOfRouters + ") to peer CC");
                            Program.peerConnection.SendMessage(message4);
                        }
                        else if (ConfigLoader.ccID == 2)
                        {
                            cachedScenario = 2;
                            cachedMessage  = message4;
                            GUIWindow.PrintLog("CC: Sent ConnectionRequest(routerX: " + RC.cachedData["routerX"] + ", routerY: " + RC.cachedData["routerY"] + ", path:" + listOfRouters + ") to child CC");
                            Program.parentConnection.SendMessage(message4 + ";layer:lower;actualName:ConnectionRequest");
                        }
                    }
                    catch (Exception e) {
                        GUIWindow.PrintLog(e.Message);
                        GUIWindow.PrintLog(e.StackTrace);
                    }
                    break;
                }
                break;

            case "PeerCoordination":
                try {
                    GUIWindow.PrintLog("CC: Received " + data["actualName"] + "(routerX: " + data["routerX"] + ", routerY: " + data["routerY"] + ", path:" + data["path"] + ") from parent CC");
                } catch (Exception) {
                    GUIWindow.PrintLog("CC: Received PeerCoordination(routerX: " + data["routerX"] + ", routerY: " + data["routerY"] + ", path:" + data["path"] + ") from peer CC");
                }
                List <int> routerID = new List <int>();
                foreach (string id in data["path"].Split('-'))
                {
                    routerID.Add(Convert.ToInt32(id));
                }
                Host hostX = ConfigLoader.FindHostAmongAll(Convert.ToInt32(data["endPoint1"]));
                Host hostY = ConfigLoader.FindHostAmongAll(Convert.ToInt32(data["endPoint2"]));
                cachedPath = new Path(routerID, hostX, hostY);
                cachedPath.channelRange = data["channelRange"];
                Tuple <HostConnection, HostConnection> connections1 = GetHostConnections(cachedPath);
                //GUIWindow.PrintLog(connections1.Item1.ToString());
                //GUIWindow.PrintLog(connections1.Item2.GetID().ToString());
                Call call1 = new Call(Convert.ToInt32(data["connID"]), true, (ConfigLoader.ccID == 1 ? 2 : 1), cachedPath.throughSN, connections1.Item1, connections1.Item2, cachedPath);
                NCC.callRegister.Add(Convert.ToInt32(data["connID"]), call1);

                cachedMessage = "component:CC;name:ConnectionRequest;layer:lower;connID:" + data["connID"] + ";routerX:" + data["routerX"] + ";routerY:" + data["routerY"]
                                + ";routerIDs:" + data["routerIDs"] + ";endPoint1:" + data["endPoint1"] + ";" + "endPoint2:" + data["endPoint2"] + ";path:"
                                + data["path"] + ";channelRange:" + data["channelRange"];

                //GUIWindow.PrintLog("CC: Sent SendConnectionTables(" + data["path"] + ", " + data["connID"] + ") to RC");
                Program.rc.HandleRequest(Util.DecodeRequest("name:SendConnectionTables;connID:" + data["connID"] + ";path:" + data["path"]));

                break;

            case "PeerCoordinationResponse":
                GUIWindow.PrintLog("CC: Received PeerCoordinationResponse() from peer CC");
                GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse() to NCC");
                Program.ncc.HandleRequest(Util.DecodeRequest("name:ConnectionRequestResponse;succeeded:true;connID:" + RC.currentConnectionID), null);
                break;

            case "SendConnectionTablesResponse":
                //GUIWindow.PrintLog("CC: Received SendConnectionTablesResponse() from RC");
                try {
                    //GUIWindow.PrintLog("CC: Sent LinkConnectionRequest(" + cachedPath.channelRange + ") to internal LRM");
                    string message22 = "name:LinkConnectionRequest;type:internal;channelRange:" + cachedPath.channelRange + ";asType:" + (ConfigLoader.ccID == 3 ? "SN" : "second");
                    Program.lrm.HandleRequest(Util.DecodeRequest(message22));
                } catch (Exception e) {
                    GUIWindow.PrintLog(e.Message);
                    GUIWindow.PrintLog(e.StackTrace);
                }

                break;

            case "ConnectionTeardown":


                if (ConfigLoader.ccID == 3)
                {
                    //CHILD
                    GUIWindow.PrintLog("CC: Received ConnectionRequest(" + data["connectionID"] + ") from Parent CC");
                    Path path = NCC.callRegister[Int32.Parse(data["connectionID"])].GetPath();

                    //GUIWindow.PrintLog("CC: Sent SendConnectionTables(" + data["connectionID"] + ", " + path.ToString() + ", disconnect) to RC");
                    //GUIWindow.PrintLog("RC: Received SendConnectionTables(" + data["connectionID"] + ", " + path.ToString() + ", disconnect) from CC");

                    Program.rc.UpdateRoutingTables(path, Int32.Parse(data["connectionID"]), false, true);
                    //Program.rc.UpdateRoutingTables(path, Int32.Parse(data["connectionID"]), true, true);

                    //GUIWindow.PrintLog("RC: Sent SendConnectionTablesResponse() to CC : OK");
                    //GUIWindow.PrintLog("CC: Received SendConnectionTablesResponse() from RC : OK");
                    //GUIWindow.PrintLog("CC: Sent LinkConnectionInternalDeallocation(" + data["connectionID"] + ") to Internal LRM");
                    string message1 = "component:LRM;name:LinkConnectionInternalDeallocation;connectionID:" + data["connectionID"];
                    Program.lrm.HandleRequest(Util.DecodeRequest(message1));
                }
                else
                {
                    GUIWindow.PrintLog("CC: Received ConnectionRequest(" + data["connectionID"] + ") from NCC");     // InterDomainConnection: " + data["IDC"]
                    Path path = NCC.callRegister[Int32.Parse(data["connectionID"])].GetPath();

                    //GUIWindow.PrintLog("CC: Sent SendConnectionTables(" + data["connectionID"] + ", " + path.ToString() + ", disconnect) to RC");
                    //GUIWindow.PrintLog("RC: Received SendConnectionTables(" + data["connectionID"] + ", " + path.ToString() + ", disconnect) from CC");

                    Program.rc.UpdateRoutingTables(path, Int32.Parse(data["connectionID"]), false, true);
                    //Program.rc.UpdateRoutingTables(path, Int32.Parse(data["connectionID"]), true, true);

                    //GUIWindow.PrintLog("RC: Sent SendConnectionTablesResponse() to CC : OK");
                    //GUIWindow.PrintLog("CC: Received SendConnectionTablesResponse() from RC : OK");
                    var  element = NCC.callRegister[Int32.Parse(data["connectionID"])];
                    bool interDomainConnectionFlag = element.GetInterDomainConnectionFlag();
                    int  asID = element.GetStartAsID();

                    if (interDomainConnectionFlag && asID == ConfigLoader.ccID)
                    {
                        GUIWindow.PrintLog("CC: Sent LinkConnectionExternalDeallocation(" + data["connectionID"] + ") to External LRM");
                        string message3 = "component:LRM;name:LinkConnectionExternalDeallocation;connectionID:" + data["connectionID"] + ";deleteChannels:true";
                        Program.lrm.HandleRequest(Util.DecodeRequest(message3));
                    }
                    else if (!interDomainConnectionFlag)
                    {
                        //GUIWindow.PrintLog("CC: Sent LinkConnectionInternalDeallocation(" + data["connectionID"] + ") to Internal LRM");
                        string message3 = "component:LRM;name:LinkConnectionInternalDeallocation;connectionID:" + data["connectionID"];
                        Program.lrm.HandleRequest(Util.DecodeRequest(message3));
                    }
                    else
                    {
                        GUIWindow.PrintLog("CC: Sent LinkConnectionExternalDeallocation(" + data["connectionID"] + ") to External LRM");
                        string message3 = "component:LRM;name:LinkConnectionExternalDeallocation;connectionID:" + data["connectionID"] + ";deleteChannels:false";
                        Program.lrm.HandleRequest(Util.DecodeRequest(message3));
                    }
                }
                break;

            case "LinkConnectionExternalDeallocationResponse":
                GUIWindow.PrintLog("CC: Received LinkConnectionExternalDeallocation(" + data["connectionID"] + ") from External LRM : OK");
                //GUIWindow.PrintLog("CC: Sent LinkConnectionInternalDeallocation(" + data["connectionID"] + ") to Internal LRM");
                string message = "component:LRM;name:LinkConnectionInternalDeallocation;connectionID:" + data["connectionID"];
                Program.lrm.HandleRequest(Util.DecodeRequest(message));
                break;

            case "LinkConnectionInternalDeallocationResponse":
                //GUIWindow.PrintLog("CC: Received LinkConnectionInternalDeallocationResponse(" + data["connectionID"] + ") from Internal LRM : OK");

                if (NCC.callRegister[Int32.Parse(data["connectionID"])].GetThroughSubnetwork() && ConfigLoader.ccID == 2)
                {
                    // PARENT
                    GUIWindow.PrintLog("CC: Sent ConnectionRequest(" + data["connectionID"] + ") to Child CC");
                    message = "component:CC;name:ConnectionTeardown;connectionID:" + data["connectionID"];
                    Program.parentConnection.SendMessage(message);
                }
                else if (ConfigLoader.ccID == 3)
                {
                    // CHILD
                    GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse(" + data["connectionID"] + ") to Parent CC : OK");
                    message = "component:CC;name:ConnectionTeardownResponse;connectionID:" + data["connectionID"];
                    Program.childConnection.SendMessage(message);
                }
                else
                {
                    GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse(" + data["connectionID"] + ") to NCC : OK");
                    message = "component:NCC;name:ConnectionTeardownResponse;connectionID:" + data["connectionID"];
                    Program.ncc.HandleRequest(Util.DecodeRequest(message), null);
                }
                break;

            case "ConnectionTeardownResponse":
                //Odpowiedz od CHILD
                GUIWindow.PrintLog("CC: Received ConnectionRequestResponse(" + data["connectionID"] + ") from Child CC : OK");
                GUIWindow.PrintLog("CC: Sent ConnectionRequestResponse(" + data["connectionID"] + ") to NCC : OK");
                message = "component:NCC;name:ConnectionTeardownResponse;connectionID:" + data["connectionID"];
                Program.ncc.HandleRequest(Util.DecodeRequest(message), null);
                break;
            }
        }
Esempio n. 5
0
        private void CalculateAllPaths()
        {
            Node startingNode = ConfigLoader.GetNodeByIP(cachedData["routerX"]);
            Node endingNode   = ConfigLoader.GetNodeByIP(cachedData["routerY"]);
            int  speed        = Convert.ToInt32(cachedData["speed"]);
            Host startHost    = null;
            Host endingHost   = null;

            foreach (Host h in ConfigLoader.hosts)
            {
                if (startingNode == h.GetNeighborRouter())
                {
                    startHost = h;
                }
                if (endingNode == h.GetNeighborRouter())
                {
                    endingHost = h;
                }
            }

            List <Path> paths = Algorithms.AllPaths(startHost, endingHost);

            if (paths == null || paths.Count == 0)
            {
                //nie istnieje żadna ścieżka
                GUIWindow.PrintLog("RC: Sent RouteTableQueryResponse(null) to CC");
                Program.cc.HandleRequest(Util.DecodeRequest("component:CC;name:RouteTableQueryResponse;path:null"));
                return;
            }

            Path chosenPath = null;

            foreach (Path path in paths)
            {
                int[] pathsID = path.getEdges();
                int   n       = DetermineGapNo(speed, path.GetLength());
                //GUIWindow.PrintLog("Channel count: " + n);
                int[,] LRMarray = GetLRMarray(pathsID);
                int[] indexFromTo = EvaluatePath(n, LRMarray);
                if (indexFromTo[0] != -1 && indexFromTo[1] != -1)
                {
                    //GUIWindow.PrintLog("Test: n: " + n + " index from: " + indexFromTo[0] + " to " + indexFromTo[1]);
                    try {
                        cachedData.Add("channelRange", indexFromTo[0] + "-" + indexFromTo[1]);
                    } catch (Exception) {
                        cachedData["channelRange"] = indexFromTo[0] + "-" + indexFromTo[1];
                    }
                    chosenPath = path;
                    chosenPath.channelRange = indexFromTo[0] + "-" + indexFromTo[1];
                    break;
                }
            }
            currentPath = chosenPath;

            //GUIWindow.PrintLog("Path from Router" + startingNode.GetRouterID() + " to Router" + endingNode.GetRouterID() + " at " + speed + " Gb/s");
            if (chosenPath == null)
            {
                GUIWindow.PrintLog("RC: Sent RouteTableQueryResponse(null) to CC");
                Program.cc.HandleRequest(Util.DecodeRequest("component:CC;name:RouteTableQueryResponse;path:null"));
                return;
            }

            int nextConnectionID = currentConnectionID + 1;

            if (Convert.ToBoolean(cachedData["IDC"]))
            {
                nextConnectionID = Math.Max(nextConnectionID, Convert.ToInt32(cachedData["peerConnID"]) + 1);
            }
            currentConnectionID = nextConnectionID;
            string pathString = (chosenPath == null ? "null" : chosenPath.ToString());

            GUIWindow.PrintLog("RC: Sent RouteTableQueryResponse(" + pathString + ") to CC");
            GUIWindow.PrintLog("CC: Received RouteTableQueryResponse(" + pathString + ") from RC");

            UpdateRoutingTables(chosenPath, currentConnectionID, false, false);
            UpdateRoutingTables(chosenPath, currentConnectionID, true, false);

            string message = "component:CC;name:RouteTableQueryResponse;path:" + pathString;

            Program.cc.HandleRequest(Util.DecodeRequest(message));
        }