Import IP options into ip4.options instead of a new HexDump protocol

ip4.options was not supported earlier, so we used to import into a new
hexdump protocol. Now that IPv4 options field is supported, use that
instead
This commit is contained in:
Srivats P 2018-10-04 18:33:38 +05:30
parent 6cac41ab40
commit 48721cece4
2 changed files with 5 additions and 19 deletions

View File

@ -63,8 +63,11 @@ void PdmlIp4Protocol::unknownFieldHandler(QString name, int /*pos*/,
else if ((name == "ip.options") ||
attributes.value("show").toString().startsWith("Options"))
{
options_ = QByteArray::fromHex(
OstProto::Ip4 *ip4 = pbProto->MutableExtension(OstProto::ip4);
QByteArray options = QByteArray::fromHex(
attributes.value("value").toString().toUtf8());
ip4->set_options(options.constData(), options.size());
}
else if (name == "ip.flags")
{
@ -75,7 +78,7 @@ void PdmlIp4Protocol::unknownFieldHandler(QString name, int /*pos*/,
}
void PdmlIp4Protocol::postProtocolHandler(OstProto::Protocol *pbProto,
OstProto::Stream *stream)
OstProto::Stream* /*stream*/)
{
OstProto::Ip4 *ip4 = pbProto->MutableExtension(OstProto::ip4);
@ -84,20 +87,5 @@ void PdmlIp4Protocol::postProtocolHandler(OstProto::Protocol *pbProto,
ip4->set_is_override_totlen(true);
ip4->set_is_override_proto(true);
ip4->set_is_override_cksum(true);
if (options_.size())
{
OstProto::Protocol *proto = stream->add_protocol();
proto->mutable_protocol_id()->set_id(
OstProto::Protocol::kHexDumpFieldNumber);
OstProto::HexDump *hexDump = proto->MutableExtension(OstProto::hexDump);
hexDump->mutable_content()->append(options_.constData(),
options_.size());
hexDump->set_pad_until_end(false);
options_.resize(0);
}
}

View File

@ -34,8 +34,6 @@ public:
OstProto::Stream *stream);
protected:
PdmlIp4Protocol();
private:
QByteArray options_;
};
#endif