private ConcurrentQueue <Cell> CellsQueue; // kolejka Cell /* Tworzy węzeł kliencki o danejkonfiguracji */ public Client(Configuration.NetworkElement networkElement) { this.AAL = new AAL(); this.id = networkElement.Info.ID; this.name = networkElement.Info.Name; this.Log = new Log(); this.messages = new ConcurrentQueue <string>(); Log.Queue.Enqueue(this.id.ToString()); CellsQueue = new ConcurrentQueue <Cell>(); List <Configuration.PortInput> inputPorts = networkElement.PortsIn; List <int> inputPortsIds = new List <int>(); foreach (Configuration.PortInput port in inputPorts) { inputPortsIds.Add(port.Id); } portsIn = new PortsIn(Receive, this.Log, id, inputPortsIds); List <Configuration.PortOutput> outputPorts = networkElement.PortsOut; List <int> outputPortsIds = new List <int>(); foreach (Configuration.PortOutput port in outputPorts) { outputPortsIds.Add(port.Id); } portsOut = new PortsOut(this.Log, id, outputPortsIds); }
public Switch(Configuration.NetworkElement networkElement) { id = networkElement.Info.ID; name = networkElement.Info.Name; Log = new Log(); matrix = new Matrix(this, networkElement); List <Configuration.PortInput> inputPorts = networkElement.PortsIn; List <int> inputPortsIds = new List <int>(); foreach (Configuration.PortInput port in inputPorts) { inputPortsIds.Add(port.Id); } portsIn = new PortsIn(Commutation, Log, id, inputPortsIds); List <Configuration.PortOutput> outputPorts = networkElement.PortsOut; List <int> outputPortsIds = new List <int>(); foreach (Configuration.PortOutput port in outputPorts) { outputPortsIds.Add(port.Id); } portsOut = new PortsOut(Log, id, outputPortsIds); }
public Matrix(Switch switchElement, Configuration.NetworkElement networkElement) { this.switchElement = switchElement; mappingTable = new MappingTable(); foreach (Configuration.RoutingEntry entry in networkElement.RoutingTable) { mappingTable.Add(new HalfEntryMapping(entry.PortIn, entry.VpiIN, entry.VciIN), new HalfEntryMapping(entry.PortOut, entry.VpiOUT, entry.VciOUT)); } }
// Naciśnięcie przycisku "Dołącz do sieci" private void connectButton_Click(object sender, EventArgs e) { try { string dirPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); networkElement = Configuration.NetworkElement.deserialize(dirPath + "\\" + xmlPathNode); network = Configuration.Network.deserialize(dirPath + "\\" + xmlPathNetwork); Switch = new Switch(networkElement); Switch.StartWorking(network.Info.CloudHost, network.Info.CloudPort1, network.Info.CloudPort2); } catch (Exception ex) { MessageBox.Show("Błąd połączenia: " + ex.Message, "Switch", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void NodeWindow_Load(object sender, EventArgs e) { try { string dirPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); networkElement = Configuration.NetworkElement.deserialize(dirPath + "\\" + xmlPathNode); network = Configuration.Network.deserialize(dirPath + "\\" + xmlPathNetwork); switchNameBox.Text = networkElement.Info.Name; managerIPBox.Text = network.Info.ManagerHost; managerPortBox.Text = network.Info.ManagerPort1.ToString(); cloudIPBox.Text = network.Info.CloudHost; cloudPort1Box.Text = network.Info.CloudPort1.ToString(); cloudPort2Box.Text = network.Info.CloudPort2.ToString(); Switch = new Switch(networkElement); } catch (Exception) { } }
private void ClientWindow_Load(object sender, EventArgs e) { try { string dirPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); networkElement = Configuration.NetworkElement.deserialize(dirPath + "\\" + xmlPathNode); network = Configuration.Network.deserialize(dirPath + "\\" + xmlPathNetwork); clientNameBox.Text = networkElement.Info.Name; cloudIPBox.Text = network.Info.CloudHost; cloudPort1Box.Text = network.Info.CloudPort1.ToString(); cloudPort2Box.Text = network.Info.CloudPort2.ToString(); for (int i = 0; i < networkElement.PortsOut.Count; i++) { outPortComboBox.Items.Add(networkElement.PortsOut.ElementAt(i).Id); } Client = new Client(networkElement); } catch (Exception) { } }