コード例 #1
0
def fire_ping_request(dut):
    packet = mac.MACPacket(dumps.ping_request)
    packet.decode_remove_header()
    packet = ip.IPPacket(packet)
    packet.decode()
    packet = icmp.ICMPPacket(packet)
    packet.decode()
    dut.icmp_model.send(packet)
コード例 #2
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)
コード例 #3
0
 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)
コード例 #4
0
ファイル: mac_core_tb.py プロジェクト: Cloudxtreme/liteeth
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))