#include "packetinfodialog.h" #include "ui_packetinfodialog.h" PacketInfoDialog::PacketInfoDialog(QWidget *parent) : QDialog(parent), ui(new Ui::PacketInfoDialog) { ui->setupUi(this); packet = new arp_t; } PacketInfoDialog::~PacketInfoDialog() { delete ui; delete packet; } void PacketInfoDialog::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void PacketInfoDialog::setArpPacket(const arp_t &packet) { Arp::copyArp_t(this->packet, packet); /* writes text into textbox */ ui->console->clear(); ui->console->append(tr("Ethernet II:")); ui->console->append(tr(" Destination: %1").arg(this->packet->ether_mac_dst)); ui->console->append(tr(" Source: %1").arg(this->packet->ether_mac_src)); ui->console->append(tr(" Type: ARP (0x806)")); ui->console->append(tr("-------------------------------------")); ui->console->append(tr("Address Resolution Protocol (%1):").arg(Arp::arpOperationtoQString(this->packet->arp_operation))); ui->console->append(tr(" Hardware type: Ethernet (0x0001)")); ui->console->append(tr(" Protocol type: IP (0x0800)")); ui->console->append(tr(" Hardware size: 6")); ui->console->append(tr(" Protocol size: 4")); ui->console->append(tr(" Opcode: %1 (%2)").arg(Arp::arpOperationtoQString(this->packet->arp_operation), QString::number(this->packet->arp_operation, 10))); ui->console->append(tr(" Sender MAC address: %1").arg(this->packet->arp_mac_src)); ui->console->append(tr(" Sender IP address: %1").arg(this->packet->arp_ip_src)); ui->console->append(tr(" Target MAC address: %1").arg(this->packet->arp_mac_dst)); ui->console->append(tr(" Target IP address: %1").arg(this->packet->arp_ip_dst)); } arp_t* PacketInfoDialog::arpPacket() { return packet; }