Example #1
0
 def send(self, packet):
     packet.encode()
     if self.debug:
         print_arp(">>>>>>>>")
         print_arp(packet)
     mac_packet = mac.MACPacket(packet)
     mac_packet.target_mac = packet.target_mac
     mac_packet.sender_mac = packet.sender_mac
     mac_packet.ethernet_type = ethernet_type_arp
     self.mac.send(mac_packet)
Example #2
0
File: ip.py Project: zsipos/liteeth
 def send(self, packet):
     packet.encode()
     packet.insert_checksum()
     if self.debug:
         print_ip(">>>>>>>>")
         print_ip(packet)
     mac_packet = mac.MACPacket(packet)
     mac_packet.target_mac    = 0x12345678abcd  # XXX
     mac_packet.sender_mac    = self.mac_address
     mac_packet.ethernet_type = ethernet_type_ip
     self.mac.send(mac_packet)
Example #3
0
def main_generator(dut):
    for i in range(2):
        packet = mac.MACPacket([i for i in range(64)])
        packet.target_mac = 0x010203040506
        packet.sender_mac = 0x090A0B0C0C0D
        packet.ethernet_type = 0x0800
        packet.encode_header()
        dut.streamer.send(packet)
        yield from dut.logger.receive()

        # check results
        s, l, e = check(packet, dut.logger.packet)
        print("shift " + str(s) + " / length " + str(l) + " / errors " + str(e))