Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Add support for RARP
Browse files Browse the repository at this point in the history
  • Loading branch information
pstavirs committed Jan 19, 2024
1 parent f185ceb commit b3ac5f8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 13 additions & 3 deletions common/arp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/*!
Expand Down Expand Up @@ -96,7 +98,7 @@ quint32 ArpProtocol::protocolId(ProtocolIdType type) const
{
switch(type)
{
case ProtocolIdEth: return 0x0806;
case ProtocolIdEth: return isRarp() ? 0x8035 : 0x0806;
default:break;
}

Expand Down Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions common/arp.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ class ArpProtocol : public AbstractProtocol
virtual int protocolFrameVariableCount() const;

private:
bool isRarp() const;

OstProto::Arp data;
};

Expand Down
2 changes: 2 additions & 0 deletions common/arpconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit b3ac5f8

Please sign in to comment.