public void SendPeerMessage(byte snppId, GenericMessage genmsg) { //Log.WriteLine("[TX] PeerMessage: {0}, SNPP {1}", genmsg.messageType, snppId); MPLSPacket packet = new MPLSPacket(new int[] { 0 }, ""); packet.managementObject = genmsg; AggregatePacket aggregatePacket = new AggregatePacket(new MPLSPacket[] { packet }); BinaryWrapper wrappedPacket = MPLSMethods.Serialize(aggregatePacket); MAC.SendData(wrappedPacket, snppId); //Log.WriteLine("[TX {0}] => {1}, iface {2}", snppId, genmsg.messageType, snppId); }
void SendPacketsCallback(object state) { foreach (TELinkEnd iface in routerInterfaces) { MPLSPacket[] queuedPackets = iface.GetPacketsAndEmptyQueue(); // Loads all packets stored in a queue and clears that interface's queue if (queuedPackets.Length > 0) { AggregatePacket finalPacket = new AggregatePacket(queuedPackets); BinaryWrapper wrappedPacket = MPLSMethods.Serialize(finalPacket); MAC.SendData(wrappedPacket, iface.Id); Log.WriteLine("[TX {0}] => {1} MPLS packet(s)", iface.Id, queuedPackets.Length); } } }