Пример #1
0
 def update(self):
     if self.timer == 0:
         packet = Packet(self.screen, self.pos[0], self.pos[1])
         packet.color = (128, 255, 128)
         packet.payload = {}
         packet.protocol = "OSPF"
         for link in self.links:
             packetCopy = copy(packet)
             interface = self.interfaces[link]
             packetCopy.source = interface
             packetCopy.destination = interface.broadcast()
             packetCopy.payload[DNSIP()] = (0, link)
             link.send(packetCopy, self)
         self.timer = 250
     else:
         self.timer -= 1
Пример #2
0
 def update(self):
     if self.timer == 0:
         packet = Packet(self.screen, self.pos[0], self.pos[1])
         packet.color = self.packetColor
         packet.payload = {}
         packet.protocol = "OSPF"
         for link in self.links:
             packetCopy = copy(packet)
             for subnetIP in self.table:
                 if self.table[subnetIP][1] != link: #poisoned reverse
                     interface = self.interfaces[link]
                     packetCopy.source = interface
                     packetCopy.destination = interface.broadcast()
                     packetCopy.payload[subnetIP] = (self.table[subnetIP][0], link)
             link.send(packetCopy, self)
         self.timer = 250
     else:
         self.timer -= 1