Add support for RARP

This commit is contained in:
Srivats P 2024-01-19 15:53:00 +05:30
parent f185ceb206
commit b3ac5f8d5d
3 changed files with 17 additions and 3 deletions

View File

@ -62,12 +62,14 @@ void ArpProtocol::protoDataCopyFrom(const OstProto::Protocol &protocol)
QString ArpProtocol::name() const
{
return QString("Address Resolution Protocol");
return isRarp() ?
QString("Reverse Address Resolution Protocol") :
QString("Address Resolution Protocol");
}
QString ArpProtocol::shortName() const
{
return QString("ARP");
return isRarp() ? QString("RARP") : QString("ARP");
}
/*!
@ -96,7 +98,7 @@ quint32 ArpProtocol::protocolId(ProtocolIdType type) const
{
switch(type)
{
case ProtocolIdEth: return 0x0806;
case ProtocolIdEth: return isRarp() ? 0x8035 : 0x0806;
default:break;
}
@ -808,3 +810,11 @@ int ArpProtocol::protocolFrameVariableCount() const
return count;
}
bool ArpProtocol::isRarp() const
{
if ((data.op_code() == 3)
|| (data.op_code() ==4))
return true;
return false;
}

View File

@ -96,6 +96,8 @@ public:
virtual int protocolFrameVariableCount() const;
private:
bool isRarp() const;
OstProto::Arp data;
};

View File

@ -30,6 +30,8 @@ ArpConfigForm::ArpConfigForm(QWidget *parent)
opCodeCombo->setValidator(new QIntValidator(0, 0xFFFF, this));
opCodeCombo->addItem(1, "ARP Request");
opCodeCombo->addItem(2, "ARP Reply");
opCodeCombo->addItem(3, "Reverse ARP Request");
opCodeCombo->addItem(4, "Reverse ARP Reply");
connect(senderHwAddrMode, SIGNAL(currentIndexChanged(int)),
SLOT(on_senderHwAddrMode_currentIndexChanged(int)));