public RC(int nr, SubnetworkLogs tmp) { myWindow = tmp; IdRC = nr; XmlReader xmlReader = new XmlReader("RC" + IdRC + ".xml"); IPRC = IPAddress.Parse(xmlReader.GetAttributeValue("dRC", "IP_ADDRESS")); IPCC = IPAddress.Parse(xmlReader.GetAttributeValue("dRC", "IP_ADDRESS_CC")); other_RC = IPAddress.Parse(xmlReader.GetAttributeValue("other_RC", "IP_ADDRESS_OTHER_RC")); EdgeRouter = Int32.Parse(xmlReader.GetAttributeValue("dRC", "EDGE")); int numberofhosts = xmlReader.GetNumberOfItems("host"); for (int a = 0; a < numberofhosts; a++) { IPAddress ip = IPAddress.Parse(xmlReader.GetAttributeValue(a, "host", "IP_ADDRESS")); int id = Int32.Parse(xmlReader.GetAttributeValue(a, "host", "ROUTER")); HostNodes.Add(ip, id); } Topo = new AlgTopology(); DomainRC = new Domain(); DomainList = new List <Domain>(); PortRC = 11000; //???????????????? GetNodes("RC" + IdRC + ".xml"); //czytanie nodesow do topo z xml GetLink("RC" + IdRC + ".xml"); //czytanie linkow do topo z xml //GetRCSNPP("RC" + IdRC + ".xml"); //czytanie par ip;rc do listy z xml ipEndP = new IPEndPoint(IPRC, PortRC); socketMy = new UdpClient(ipEndP); }
public void NewLog(string info, SubnetworkLogs tmp2, string color) { SubnetworkLogs tmp = tmp2; string timeNow = DateTime.Now.ToString("h:mm:ss") + "." + DateTime.Now.Millisecond.ToString(); string restLog = info; string fullLog = timeNow + " " + restLog; tmp.logBox.AppendText(Environment.NewLine); ColorLog(tmp.logBox, fullLog, color); tmp.logBox.ScrollToEnd(); }
public ConnectionController(int numberDomain, SubnetworkLogs tmp) { myWindow = tmp; numberDomainCC = numberDomain; XmlReader reader = new XmlReader("CC" + numberDomain + ".xml"); CCiPAddress = IPAddress.Parse(reader.GetAttributeValue("config", "IP_ADDRESS")); RCiPAddress = IPAddress.Parse(reader.GetAttributeValue("config", "IP_ADDRESS_RC")); NCCiPAddress = IPAddress.Parse(reader.GetAttributeValue("config", "IP_ADDRESS_NCC")); other_cc = reader.GetAttributeValue("config", "OTHER_CC_ADDRESS"); LinksRM = new List <LRM>(); int numberoflrm = reader.GetNumberOfItems("LRM"); for (int a = 0; a < numberoflrm; a++) { LRM lRM = new LRM(CCiPAddress, RCiPAddress, myWindow); lRM.IdLRM = Int32.Parse(reader.GetAttributeValue(a, "LRM", "ID")); lRM.IPAddressLRM = reader.GetAttributeValue(a, "LRM", "IP_ADDRESS"); LinksRM.Add(lRM); Task.Run(() => lRM.ReceiveMessage()); } }
public LRM(IPAddress iPAddress, IPAddress rcip, SubnetworkLogs tmp) { myWindow = tmp; IPAddressCC = iPAddress.ToString(); IPAddressRC = rcip.ToString(); }
public void NewLog(string info, SubnetworkLogs tmp, string color) { myWindow.Dispatcher.Invoke(() => myWindow.NewLog(info, tmp, color)); }
public MainWindow() { InitializeComponent(); this.Hide(); SubnetworkLog1 = new SubnetworkLogs(); SubnetworkLog1.Title = "Domena 1"; SubnetworkLog2 = new SubnetworkLogs(); SubnetworkLog2.Title = "Domena 2"; SubnetworkLog1.Show(); SubnetworkLog2.Show(); ConnectionController cc = new ConnectionController(101, SubnetworkLog1); ConnectionController cc2 = new ConnectionController(202, SubnetworkLog2); RC rc = new RC(101, SubnetworkLog1); RC rc2 = new RC(202, SubnetworkLog2); KillWindow = new KillLinkWindow(); KillWindow.MyRC1 = rc; //KillWindow.MyRC2 = rc2; KillWindow.Show(); Task.Run(() => { cc.ReceivedMessage(); }); Task.Run(() => { rc.Run(); }); Task.Run(() => { cc2.ReceivedMessage(); }); Task.Run(() => { rc2.Run(); }); //var task1 = Task.Run(() => cc.ReceivedMessage()); //var task2 = Task.Run(() => rc.Run()); //Task.WhenAll(task1, task2,task3,task4); //cc.ConnectionRequest(); //Task.Run(() => { //rc.SendMessage("127.0.42.42", "czesc to rc do node"); //}); //testy // string source = "127.0.0.10"; // string destination = "127.0.0.30"; // string demanded = "34"; // int domainflag = 0; // // var message = source + " " + destination + " " + demanded + " " + domainflag; //var message = source + " " + destination + " " + demanded + " " + "END"; // var data = message.Split(' '); // rc.RouteTableQueryReq(data); // CreatePath(int startNodeid, int endNodeid, string dCapacity, int distance, int IdRC) //rc.CreatePath(1, 5, "100", 0, 101); //rc2.CreatePath(6, 8, "100", 0, 202); //string dat = "127.0.0.10 127.0.0.30 34 120"; //var con = dat.Split(' '); //rc2.NetworkTopologyReq(con); //source + " "+destin+ " "+dCapacity+" "+distance; //"NETWORKTOPOLOGY 127.0.0.10 127.0.0.30 34 127.0.10.31" //rc.NetworkTopologyRsp(con); //Connection request do CC o zestawienie połaczenia action source detination demanded czywtejsamejdomenie //testy //string source="127.0.0.10"; //string destination="127.0.0.30"; //string demanded="34"; //int domainflag = 0; //var message = source + " " + destination + " " + demanded + " " + domainflag; //var data = message.Split(' '); //cc.ConnectionRequest(data); }