protected virtual List <Packet> ProcessJoinRequestPacket(JoinRequestPacket packet) { var entry = RoutingTable.Find(x => x.MulticastGroup == packet.MulticastGroup); if (entry == null) { RoutingTable.Add(new TableEntry(packet.MulticastGroup, packet.PreviousHop)); } else { entry.NextHop = packet.PreviousHop; } ++packet.HopCount; packet.PreviousHop = Address; if (--packet.TimeToLive > 0) { return(SendPacket(packet)); } else { return(null); } }
protected override List <Packet> ProcessJoinRequestPacket(JoinRequestPacket packet) { if (packet.MulticastGroup == SubscribedGroup) { JoinReplyPacket newPacket = new JoinReplyPacket(Address * 10000 + SequenceNumber++, SubscribedGroup, packet.Source, packet.PreviousHop, Address); return(SendPacket(newPacket)); } else { return(null); } }
static JoinRequestPacket CloneJoinRequestPacket(JoinRequestPacket packet) { return(new JoinRequestPacket(packet.SequenceNumber, packet.MulticastGroup, packet.Source, packet.PreviousHop, packet.TimeToLive, packet.HopCount)); }
protected override List <Packet> ProcessJoinRequestPacket(JoinRequestPacket packet) { return(null); }