From f99774a85128a0adc6a215931386daee27188f07 Mon Sep 17 00:00:00 2001 From: "Srivats P." Date: Mon, 14 Mar 2011 21:08:05 +0530 Subject: [PATCH] Removed FakeFieldWrapper Protocol --- common/pdml_p.cpp | 66 ----------------------------------------------- common/pdml_p.h | 26 ------------------- 2 files changed, 92 deletions(-) diff --git a/common/pdml_p.cpp b/common/pdml_p.cpp index 406c7a5..ae1c7ce 100644 --- a/common/pdml_p.cpp +++ b/common/pdml_p.cpp @@ -118,10 +118,6 @@ PdmlReader::PdmlReader(OstProto::StreamConfigList *streams) factory_.insert("hexdump", PdmlUnknownProtocol::createInstance); factory_.insert("geninfo", PdmlGenInfoProtocol::createInstance); factory_.insert("frame", PdmlFrameProtocol::createInstance); -#if 0 - factory_.insert("fake-field-wrapper", - new PdmlFakeFieldWrapperProtocol()); -#endif factory_.insert("eth",PdmlEthProtocol::createInstance); factory_.insert("ip",PdmlIp4Protocol::createInstance); factory_.insert("ipv6",PdmlIp6Protocol::createInstance); @@ -834,68 +830,6 @@ void PdmlFrameProtocol::unknownFieldHandler(QString name, int pos, } } -#if 1 -// ---------------------------------------------------------- // -// PdmlFakeFieldWrapperProtocol // -// ---------------------------------------------------------- // - -PdmlFakeFieldWrapperProtocol::PdmlFakeFieldWrapperProtocol() -{ - pdmlProtoName_ = "OST:HexDump"; - ostProtoId_ = OstProto::Protocol::kHexDumpFieldNumber; - - expPos_ = -1; -} - -PdmlDefaultProtocol* PdmlFakeFieldWrapperProtocol::createInstance() -{ - return new PdmlFakeFieldWrapperProtocol(); -} - -void PdmlFakeFieldWrapperProtocol::preProtocolHandler(QString name, - const QXmlStreamAttributes &attributes, - int expectedPos, OstProto::Stream *stream) -{ - expPos_ = 0; - OstProto::HexDump *hexDump = stream->mutable_protocol( - stream->protocol_size()-1)->MutableExtension(OstProto::hexDump); - hexDump->set_pad_until_end(false); -} - -void PdmlFakeFieldWrapperProtocol::postProtocolHandler(OstProto::Stream *stream) -{ - OstProto::HexDump *hexDump = stream->mutable_protocol( - stream->protocol_size()-1)->MutableExtension(OstProto::hexDump); - - qDebug("%s: expPos_ = %d\n", __FUNCTION__, expPos_); - - // TODO: if content size is zero, remove protocol? - - hexDump->set_pad_until_end(false); - expPos_ = -1; -} - -void PdmlFakeFieldWrapperProtocol::unknownFieldHandler(QString name, int pos, - int size, const QXmlStreamAttributes &attributes, OstProto::Stream *stream) -{ - OstProto::HexDump *hexDump = stream->mutable_protocol( - stream->protocol_size()-1)->MutableExtension(OstProto::hexDump); - - if ((pos == expPos_) && (size >= 0) && - (!name.startsWith("tcp.segment")) && - (!attributes.value("unmaskedvalue").isEmpty() || - !attributes.value("value").isEmpty())) - { - QByteArray hexVal = attributes.value("unmaskedvalue").isEmpty() ? - QByteArray::fromHex(attributes.value("value").toString().toUtf8()) : - QByteArray::fromHex(attributes.value("unmaskedvalue").toString().toUtf8()); - - hexDump->mutable_content()->append(hexVal.constData(), hexVal.size()); - expPos_ += hexVal.size(); - } -} - -#endif // ---------------------------------------------------------- // // PdmlEthProtocol // // ---------------------------------------------------------- // diff --git a/common/pdml_p.h b/common/pdml_p.h index ca54028..70423ea 100644 --- a/common/pdml_p.h +++ b/common/pdml_p.h @@ -91,13 +91,6 @@ private: typedef PdmlDefaultProtocol* (*FactoryMethod)(); - typedef struct - { - int pos; - int size; - QByteArray value; - } Fragment; - QMap factory_; OstProto::StreamConfigList *streams_; @@ -152,25 +145,6 @@ public: const QXmlStreamAttributes &attributes, OstProto::Stream *stream); }; -#if 1 -class PdmlFakeFieldWrapperProtocol : public PdmlDefaultProtocol -{ -public: - PdmlFakeFieldWrapperProtocol(); - - static PdmlDefaultProtocol* createInstance(); - - virtual void preProtocolHandler(QString name, - const QXmlStreamAttributes &attributes, - int expectedPos, OstProto::Stream *stream); - virtual void postProtocolHandler(OstProto::Stream *stream); - virtual void unknownFieldHandler(QString name, int pos, int size, - const QXmlStreamAttributes &attributes, OstProto::Stream *stream); -private: - int expPos_; -}; -#endif - class PdmlEthProtocol : public PdmlDefaultProtocol { public: