예제 #1
0
        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);
            }
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
 static JoinRequestPacket CloneJoinRequestPacket(JoinRequestPacket packet)
 {
     return(new JoinRequestPacket(packet.SequenceNumber, packet.MulticastGroup, packet.Source, packet.PreviousHop, packet.TimeToLive, packet.HopCount));
 }
예제 #4
0
 protected override List <Packet> ProcessJoinRequestPacket(JoinRequestPacket packet)
 {
     return(null);
 }