diff --git a/client/port.cpp b/client/port.cpp index e3c873b..5ed914d 100644 --- a/client/port.cpp +++ b/client/port.cpp @@ -21,6 +21,7 @@ along with this program. If not, see #include "fileformat.h" #include "pcapfileformat.h" +#include "pdmlfileformat.h" #include #include @@ -229,7 +230,7 @@ bool Port::openStreams(QString fileName, bool append, QString &error) OstProto::StreamConfigList streams; //if (!fileFormat.openStreams(fileName, streams, error)) - if (!pcapFileFormat.openStreams(fileName, streams, error)) + if (!pdmlFileFormat.openStreams(fileName, streams, error)) goto _fail; if (!append) diff --git a/common/pdml_p.cpp b/common/pdml_p.cpp index fbc4a0e..e51d7c2 100644 --- a/common/pdml_p.cpp +++ b/common/pdml_p.cpp @@ -354,11 +354,11 @@ PdmlReader::PdmlReader(OstProto::StreamConfigList *streams) #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); factory_.insert("tcp",PdmlTcpProtocol::createInstance); +#endif } PdmlReader::~PdmlReader() diff --git a/ost.pro b/ost.pro index 0f9d987..c5d4369 100644 --- a/ost.pro +++ b/ost.pro @@ -5,4 +5,5 @@ SUBDIRS = \ rpc/pbrpc.pro \ common/ostproto.pro \ server/drone.pro \ - client/ostinato.pro + client/ostinato.pro \ + test/test.pro diff --git a/test/main.cpp b/test/main.cpp new file mode 100644 index 0000000..0b98cfd --- /dev/null +++ b/test/main.cpp @@ -0,0 +1,42 @@ + +#include "pcapfileformat.h" +#include "pdmlfileformat.h" +#include "protocol.pb.h" +#include "protocolmanager.h" + +#include +#include + +extern ProtocolManager *OstProtocolManager; + +int main(int argc, char* argv[]) +{ + QCoreApplication app(argc, argv); + QString error; + + if (argc != 3) + { + printf("%s \n", argv[0]); + exit(255); + } + + OstProtocolManager = new ProtocolManager(); + + OstProto::StreamConfigList streams; + QString inFile(argv[1]); + QString outFile(argv[2]); + + if (!pdmlFileFormat.openStreams(inFile, streams, error)) + { + fprintf(stdout, "failed reading streams from %s\n", inFile.toAscii().constData()); + exit(1); + } + + if (!pcapFileFormat.saveStreams(streams, outFile, error)) + { + fprintf(stdout, "failed writing streams to %s\n", outFile.toAscii().constData()); + exit(1); + } + + return 0; +} diff --git a/test/test.pro b/test/test.pro new file mode 100644 index 0000000..2875525 --- /dev/null +++ b/test/test.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +CONFIG += qt console +QT += xml network script +INCLUDEPATH += "../rpc/" "../common/" +LIBS += -L"../common/debug" -lostproto +LIBS += -lprotobuf +LIBS += -L"../extra/qhexedit2/$(OBJECTS_DIR)/" -lqhexedit2 +HEADERS += +SOURCES += main.cpp + +QMAKE_DISTCLEAN += object_script.* + +include(../install.pri)