snapshot before 2 pass changes

This commit is contained in:
Srivats P. 2011-02-21 22:17:16 +05:30
parent 5ab89bba29
commit 16d85a338a
5 changed files with 60 additions and 3 deletions

View File

@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "fileformat.h"
#include "pcapfileformat.h"
#include "pdmlfileformat.h"
#include <QApplication>
#include <QVariant>
@ -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)

View File

@ -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()

View File

@ -5,4 +5,5 @@ SUBDIRS = \
rpc/pbrpc.pro \
common/ostproto.pro \
server/drone.pro \
client/ostinato.pro
client/ostinato.pro \
test/test.pro

42
test/main.cpp Normal file
View File

@ -0,0 +1,42 @@
#include "pcapfileformat.h"
#include "pdmlfileformat.h"
#include "protocol.pb.h"
#include "protocolmanager.h"
#include <QCoreApplication>
#include <QString>
extern ProtocolManager *OstProtocolManager;
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
QString error;
if (argc != 3)
{
printf("%s <infile> <outfile>\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;
}

13
test/test.pro Normal file
View File

@ -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)