[brlcad-commits] SF.net SVN: brlcad:[38898]
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <dav...@us...> - 2010-04-29 16:44:51
|
Revision: 38898 http://brlcad.svn.sourceforge.net/brlcad/?rev=38898&view=rev Author: davidloman Date: 2010-04-29 16:44:42 +0000 (Thu, 29 Apr 2010) Log Message: ----------- Modified Paths: -------------- rt^3/trunk/src/GE/CMakeLists.txt rt^3/trunk/src/GS/CMakeLists.txt rt^3/trunk/src/GS/DataManager.h rt^3/trunk/src/GS/DbObjectManifest.h rt^3/trunk/src/GS/GeometryService.h rt^3/trunk/src/GS/gsmain.cxx rt^3/trunk/src/alf/CMakeLists.txt rt^3/trunk/src/libJob/JobWorker.cxx rt^3/trunk/src/libNetwork/CMakeLists.txt rt^3/trunk/src/libNetwork/NetMsgFactory.cxx rt^3/trunk/src/libNetwork/NetPortal.cxx rt^3/trunk/src/libNetwork/NetPortalManager.cxx rt^3/trunk/src/utility/CMakeLists.txt rt^3/trunk/tests/GS/GeometryServiceTest.cxx rt^3/trunk/tests/libJob/BasicJMTest.cxx rt^3/trunk/tests/libNetwork/NetPortalManagerTester.h rt^3/trunk/tests/libNetwork/netMsgFactoryTest.cxx rt^3/trunk/tests/libNetwork/netMsgSerialTest.cxx rt^3/trunk/tests/libNetwork/netPortalManagerTest.cxx rt^3/trunk/tests/utility/configTest.cxx rt^3/trunk/tests/utility/loggerTest.cxx Added Paths: ----------- rt^3/trunk/include/AbstractJob.h rt^3/trunk/include/BaseApp.h rt^3/trunk/include/Config.h rt^3/trunk/include/DataStreamUtils.h rt^3/trunk/include/Exception.h rt^3/trunk/include/FailureMsg.h rt^3/trunk/include/GSException.h rt^3/trunk/include/GenericFourBytesMsg.h rt^3/trunk/include/GenericMultiByteMsg.h rt^3/trunk/include/GenericOneByteMsg.h rt^3/trunk/include/GenericOneStringMsg.h rt^3/trunk/include/GenericTwoBytesMsg.h rt^3/trunk/include/GeometryChunkMsg.h rt^3/trunk/include/GeometryManifestMsg.h rt^3/trunk/include/GeometryReqMsg.h rt^3/trunk/include/INetMsgHandler.h rt^3/trunk/include/IOException.h rt^3/trunk/include/JobManager.h rt^3/trunk/include/JobScheduler.h rt^3/trunk/include/JobWorker.h rt^3/trunk/include/Logger.h rt^3/trunk/include/NetMsg.h rt^3/trunk/include/NetMsgFactory.h rt^3/trunk/include/NetPortal.h rt^3/trunk/include/NetPortalManager.h rt^3/trunk/include/NewHostOnNetMsg.h rt^3/trunk/include/NewSessionReqMsg.h rt^3/trunk/include/RemoteGSHostnameSetMsg.h rt^3/trunk/include/SessionInfoMsg.h rt^3/trunk/include/SuccessMsg.h rt^3/trunk/include/ThreadUtils.h rt^3/trunk/include/Throwable.h rt^3/trunk/src/GS/Account.h rt^3/trunk/src/GS/AccountManager.h rt^3/trunk/src/GS/Session.h rt^3/trunk/src/GS/SessionManager.h rt^3/trunk/src/adminpanel/AdminControlPanel rt^3/trunk/src/adminpanel/AdminControlPanel.h Removed Paths: ------------- rt^3/trunk/src/GE/exception/Exception.h rt^3/trunk/src/GE/exception/IOException.h rt^3/trunk/src/GE/exception/Throwable.h rt^3/trunk/src/GS/Account.h rt^3/trunk/src/GS/AccountManager.h rt^3/trunk/src/GS/GSCommon.h rt^3/trunk/src/GS/Session.h rt^3/trunk/src/GS/SessionManager.h rt^3/trunk/src/adminpanel/AdminControlPanel.h rt^3/trunk/src/alf/BaseApp.h rt^3/trunk/src/libJob/JobManager.h rt^3/trunk/src/libJob/JobScheduler.h rt^3/trunk/src/libJob/JobWorker.h rt^3/trunk/src/libNetwork/FailureMsg.h rt^3/trunk/src/libNetwork/GenericFourBytesMsg.h rt^3/trunk/src/libNetwork/GenericMultiByteMsg.h rt^3/trunk/src/libNetwork/GenericOneByteMsg.h rt^3/trunk/src/libNetwork/GenericOneStringMsg.h rt^3/trunk/src/libNetwork/GenericTwoBytesMsg.h rt^3/trunk/src/libNetwork/GeometryChunkMsg.h rt^3/trunk/src/libNetwork/GeometryManifestMsg.h rt^3/trunk/src/libNetwork/GeometryReqMsg.h rt^3/trunk/src/libNetwork/INetMsgHandler.h rt^3/trunk/src/libNetwork/NetMsg.h rt^3/trunk/src/libNetwork/NetMsgFactory.h rt^3/trunk/src/libNetwork/NetPortal.h rt^3/trunk/src/libNetwork/NetPortalManager.h rt^3/trunk/src/libNetwork/NewHostOnNetMsg.h rt^3/trunk/src/libNetwork/NewSessionReqMsg.h rt^3/trunk/src/libNetwork/RemoteGSHostnameSetMsg.h rt^3/trunk/src/libNetwork/SessionInfoMsg.h rt^3/trunk/src/libNetwork/SuccessMsg.h rt^3/trunk/src/utility/Config.h rt^3/trunk/src/utility/DataStreamUtils.h rt^3/trunk/src/utility/GSException.h rt^3/trunk/src/utility/Logger.h rt^3/trunk/src/utility/ThreadUtils.h Property Changed: ---------------- rt^3/trunk/include/ Property changes on: rt^3/trunk/include ___________________________________________________________________ Modified: svn:ignore - autom4te.cache install.*.log aclocal.m4 .deps Makefile Makefile.in config.* configure libtool ltmain.sh .cproject .project cmake_install.cmake CMakeCache.txt CMakeFiles *.txt~ *.so *.a .libs __ rt3_config.h rt3_config.h.in stamp-h1 + autom4te.cache install.*.log aclocal.m4 .deps Makefile Makefile.in config.* configure libtool ltmain.sh .cproject .project cmake_install.cmake CMakeCache.txt CMakeFiles *.txt~ *.so *.a .libs __ rt3_config.h rt3_config.h.in stamp-h1 gs.h network.h utility.h alf.h ge.h job.h tds.h Copied: rt^3/trunk/include/AbstractJob.h (from rev 38880, rt^3/trunk/src/libJob/AbstractJob.h) =================================================================== --- rt^3/trunk/include/AbstractJob.h (rev 0) +++ rt^3/trunk/include/AbstractJob.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,68 @@ +/* A B S T R A C T J O B . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file AbstractJob.h + * + * Brief description + * + */ + +#ifndef __ABSTRACTJOB_H__ +#define __ABSTRACTJOB_H__ + +#include <Qt> + +enum JobStatus +{ + JOB_NOTSTARTED, JOB_RUNNING, JOB_FINISHED +}; +enum JobResult +{ + JOB_COMPLETED_NO_ERRORS, JOB_COMPLETED_WITH_ERRORS, JOB_FAILED +}; + +class AbstractJob +{ + +public: + + AbstractJob(); + virtual ~AbstractJob(); + + JobResult doJob(); + JobStatus getStatus(); + quint32 getJobId(); + +protected: + virtual JobResult _doJob(); + + quint32 jobID; + JobStatus status; + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/BaseApp.h (from rev 38880, rt^3/trunk/src/alf/BaseApp.h) =================================================================== --- rt^3/trunk/include/BaseApp.h (rev 0) +++ rt^3/trunk/include/BaseApp.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,52 @@ +/* B A S E A P P . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file BaseApp.h + * + * Brief description + * + */ + +#ifndef __BASEAPP_H__ +#define __BASEAPP_H__ + +#include <QCoreApplication> +#include "utility.h" + +class BaseApp: public QCoreApplication +{ +public: + BaseApp(int& argc, char* argv[]); + virtual ~BaseApp(); + +protected: + Logger* log; +}; + +#endif /* __BASEAPP_H__ */ + +/* + * Local Variables: + * tab-width: 8 + * mode: C + * indent-tabs-mode: t + * c-file-style: "stroustrup" + * End: + * ex: shiftwidth=4 tabstop=8 + */ Copied: rt^3/trunk/include/Config.h (from rev 38880, rt^3/trunk/src/utility/Config.h) =================================================================== --- rt^3/trunk/include/Config.h (rev 0) +++ rt^3/trunk/include/Config.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,69 @@ +/* C O N F I G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file Config.h + * + * Brief description + * + */ + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + + +#include "Logger.h" +#include <QMap> +#include <QString> + +class Config +{ + +public: + ~Config(); + static Config* getInstance(); + + bool loadFile(QString pathAndFileName); + QString getConfigValue(QString key); + QList<QString> getAllKeys(); + +private: + Config(); //Turn off Default cstr + Config(const Config& c){}; //Turn off Copy cstr + Config& operator=(const Config& c){}; //Turn off equal oper + void processLine(QString line); + void removeAllOccurances(QString* data, QString search, + QString replace); + + QMutex lock; + Logger* log; + QMap<QString, QString>* configMap; + + static Config* pInstance; + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/DataStreamUtils.h (from rev 38880, rt^3/trunk/src/utility/DataStreamUtils.h) =================================================================== --- rt^3/trunk/include/DataStreamUtils.h (rev 0) +++ rt^3/trunk/include/DataStreamUtils.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,57 @@ +/* D A T A S T R E A M U T I L S . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file DataStreamUtils.h + * + * Brief description + * + */ + +#ifndef __DATASTREAMUTILS_H__ +#define __DATASTREAMUTILS_H__ + +#include <QString> +#include <QDataStream> +#include <QUuid> +#include <iostream> + +class Utils +{ +public: +static QString* getString(QDataStream* ds); +static void putString(QDataStream* ds, QString str); +static QUuid* getQUuid(QDataStream* ds); +static void putQUuid(QDataStream* ds, QUuid str); +static void printQByteArray(QByteArray* ba); + + +private: +Utils(){} + +}; + +#endif /* __DATASTREAMUTILS_H__ */ + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/Exception.h (from rev 38887, rt^3/trunk/src/GE/exception/Exception.h) =================================================================== --- rt^3/trunk/include/Exception.h (rev 0) +++ rt^3/trunk/include/Exception.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,45 @@ +/* E X C E P T I O N . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file Exception.h + * + * Brief description + * + */ + +#ifndef __EXCEPTION_H__ +#define __EXCEPTION_H__ + +#include "Throwable.h" +class Exception : public Throwable +{ +public: + Exception() throw (); + Exception(const std::string& message) throw (); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/FailureMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/FailureMsg.h) =================================================================== --- rt^3/trunk/include/FailureMsg.h (rev 0) +++ rt^3/trunk/include/FailureMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,62 @@ +/* F A I L U R E M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file FailureMsg.h + * + * Brief description + * + */ + +#ifndef __FAILUREMSG_H__ +#define __FAILUREMSG_H__ + + +#include "GenericOneByteMsg.h" + + +class FailureMsg : public GenericOneByteMsg +{ + +public: + + //Normal Constructor + FailureMsg(quint8 failureCode); + + //Reply Constructor + FailureMsg(NetMsg* msg, quint8 failureCode); + + //Deserializing Constructors + FailureMsg(QDataStream* ds, QString origin); + + /* + *Getters n Setters + */ + quint8 getFailureCode(); + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GSException.h (from rev 38880, rt^3/trunk/src/utility/GSException.h) =================================================================== --- rt^3/trunk/include/GSException.h (rev 0) +++ rt^3/trunk/include/GSException.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,55 @@ +/* G S E X C E P T I O N . H + * BRLCAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GSException.h + * GSException.h + * + * Created on: Apr 27, 2010 + */ + +#ifndef __GSEXCEPTION_H__ +#define __GSEXCEPTION_H__ + +#include <exception> +#include <QString> + +class GSException: public std::exception +{ +public: + GSException(QString reason); + ~GSException() throw (); + + QString getReason(); + void log(QString origin); + +private: + QString reason; +}; + +#endif /* __GSEXCEPTION_H__ */ + +/* + * Local Variables: + * tab-width: 8 + * mode: C + * indent-tabs-mode: t + * c-file-style: "stroustrup" + * End: + * ex: shiftwidth=4 tabstop=8 + */ Copied: rt^3/trunk/include/GenericFourBytesMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GenericFourBytesMsg.h) =================================================================== --- rt^3/trunk/include/GenericFourBytesMsg.h (rev 0) +++ rt^3/trunk/include/GenericFourBytesMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,69 @@ +/* G E N E R I C F O U R B Y T E S M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GenericFourBytesMsg.h + * + * Brief description + * + */ + +#ifndef __GENERICFOURBYTESMSG_H__ +#define __GENERICFOURBYTESMSG_H__ + +#include "NetMsg.h" + +class GenericFourBytesMsg: public NetMsg +{ + +public: + + //Normal Constructor + GenericFourBytesMsg(quint32 type, quint32 b); + + //Reply Constructor + GenericFourBytesMsg(quint32 type, NetMsg* msg, quint32 b); + + //Deserializing Constructors + GenericFourBytesMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GenericFourBytesMsg(); + + /* + * Utilities + */ + virtual QString toString(); + +protected: + quint32 getData(); + quint32 data; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GenericMultiByteMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GenericMultiByteMsg.h) =================================================================== --- rt^3/trunk/include/GenericMultiByteMsg.h (rev 0) +++ rt^3/trunk/include/GenericMultiByteMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,73 @@ +/* G E N E R I C M U L T I B Y T E M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GenericMultiByteMsg.h + * + * Brief description + * + */ + +#ifndef __GENERICMULTIBYTEMSG_H__ +#define __GENERICMULTIBYTEMSG_H__ + +#include "NetMsg.h" + +class GenericMultiByteMsg : public NetMsg +{ + +public: + + //Normal Constructor + GenericMultiByteMsg(quint32 type, char* dataIn, quint32 dataInLen); + + //Reply Constructor + GenericMultiByteMsg(quint32 type, NetMsg* msg, char* dataIn, quint32 dataInLen); + + //Deserializing Constructors + GenericMultiByteMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GenericMultiByteMsg(); + + /* + * Utilities + */ + virtual QString toString(); + +protected: + quint32 getDataLen(); + char* getData(); + + quint32 dataLen; + char* data; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GenericOneByteMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GenericOneByteMsg.h) =================================================================== --- rt^3/trunk/include/GenericOneByteMsg.h (rev 0) +++ rt^3/trunk/include/GenericOneByteMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,70 @@ +/* G E N E R I C O N E B Y T E M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GenericOneByteMsg.h + * + * Brief description + * + */ + +#ifndef __GENERICONEBYTEMSG_H__ +#define __GENERICONEBYTEMSG_H__ + + +#include "NetMsg.h" + +class GenericOneByteMsg : public NetMsg +{ + +public: + + //Normal Constructor + GenericOneByteMsg(quint32 type, quint8 b); + + //Reply Constructor + GenericOneByteMsg(quint32 type, NetMsg* msg, quint8 b); + + //Deserializing Constructors + GenericOneByteMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GenericOneByteMsg(); + + /* + * Utilities + */ + virtual QString toString(); + +protected: + quint8 getData(); + quint8 data; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GenericOneStringMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GenericOneStringMsg.h) =================================================================== --- rt^3/trunk/include/GenericOneStringMsg.h (rev 0) +++ rt^3/trunk/include/GenericOneStringMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,71 @@ +/* G E N E R I C O N E S T R I N G M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GenericOneStringMsg.h + * + * Brief description + * + */ + +#ifndef __GENERICONESTRINGMSG_H__ +#define __GENERICONESTRINGMSG_H__ + + +#include "NetMsg.h" + +class GenericOneStringMsg : public NetMsg +{ + +public: + + //Normal Constructor + GenericOneStringMsg(quint32 type, QString s); + + //Reply Constructor + GenericOneStringMsg(quint32 type, NetMsg* msg, QString s); + + //Deserializing Constructors + GenericOneStringMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GenericOneStringMsg(); + + /* + * Utilities + */ + virtual QString toString(); + +protected: + QString getStrData(); + QString strData; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GenericTwoBytesMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GenericTwoBytesMsg.h) =================================================================== --- rt^3/trunk/include/GenericTwoBytesMsg.h (rev 0) +++ rt^3/trunk/include/GenericTwoBytesMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,71 @@ +/* G E N E R I C T W O B Y T E S M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GenericTwoBytesMsg.h + * + * Brief description + * + */ + +#ifndef __GENERICTWOBYTESMSG_H__ +#define __GENERICTWOBYTESMSG_H__ + + +#include "NetMsg.h" + +class GenericTwoBytesMsg : public NetMsg +{ + +public: + + //Normal Constructor + GenericTwoBytesMsg(quint32 type, quint16 b); + + //Reply Constructor + GenericTwoBytesMsg(quint32 type, NetMsg* msg, quint16 b); + + //Deserializing Constructors + GenericTwoBytesMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GenericTwoBytesMsg(); + + /* + * Utilities + */ + virtual QString toString(); + +protected: + quint16 getData(); + quint16 data; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GeometryChunkMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GeometryChunkMsg.h) =================================================================== --- rt^3/trunk/include/GeometryChunkMsg.h (rev 0) +++ rt^3/trunk/include/GeometryChunkMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,56 @@ +/* G E O M E T R Y C H U N K M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GeometryChunkMsg.h + * + * Brief description + * + */ + +#ifndef __GEOMETRYCHUNKMSG_H__ +#define __GEOMETRYCHUCKMSG_H__ + + +#include "GenericMultiByteMsg.h" + +class GeometryChunkMsg : public GenericMultiByteMsg +{ + +public: + + //Normal Constructor + GeometryChunkMsg(char* dataIn, quint32 dataInLen); + + //Reply Constructor + GeometryChunkMsg(NetMsg* msg, char* dataIn, quint32 dataInLen); + + //Deserializing Constructors + GeometryChunkMsg(QDataStream* ds, QString origin); + + }; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GeometryManifestMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GeometryManifestMsg.h) =================================================================== --- rt^3/trunk/include/GeometryManifestMsg.h (rev 0) +++ rt^3/trunk/include/GeometryManifestMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,73 @@ +/* G E O M E T R Y M A N I F E S T M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GeometryManifestMsg.h + * + * Brief description + * + */ + +#ifndef __GEOMETRYMANIFESTMSG_H__ +#define __GEOMETRYMANIFESTMSG_H__ + +#include <vector> + +#include "NetMsg.h" + +class GeometryManifestMsg: public NetMsg +{ + +public: + + //Normal Constructor + GeometryManifestMsg(QList<QString>& items); + + //Reply Constructor + GeometryManifestMsg(NetMsg* msg, QList<QString>& items); + + //Deserializing Constructor + GeometryManifestMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GeometryManifestMsg(); + + virtual QString toString(); + + /* + *Getters n Setters + */ + quint32 getNumOfItems(); + QList<QString>* getItemData(); + +private: + QList<QString>* itemData; + + virtual bool _serialize(QDataStream* ds); + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/GeometryReqMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/GeometryReqMsg.h) =================================================================== --- rt^3/trunk/include/GeometryReqMsg.h (rev 0) +++ rt^3/trunk/include/GeometryReqMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,73 @@ +/* G E O M E T R Y R E Q M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file GeometryReqMsg.h + * + * Brief description + * + */ + +#ifndef __GEOMETRYREQMSG_H__ +#define __GEOMETRYREQMSG_H__ + +#include "GenericOneStringMsg.h" + +class GeometryReqMsg: public GenericOneStringMsg +{ + +public: + + //Only Constructor + GeometryReqMsg(quint8 requestType, QString data); + + //Reply Constructor + GeometryReqMsg(NetMsg* msg, quint8 requestType, QString s); + + //Deserializing Constructors + GeometryReqMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~GeometryReqMsg(); + + virtual QString toString(); + + /* + *Getters n Setters + */ + quint8 getRequestType(); + + QString getData(); + +private: + quint8 reqType; + + bool _serialize(QDataStream* ds); + bool _equals(NetMsg& msg); + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/INetMsgHandler.h (from rev 38880, rt^3/trunk/src/libNetwork/INetMsgHandler.h) =================================================================== --- rt^3/trunk/include/INetMsgHandler.h (rev 0) +++ rt^3/trunk/include/INetMsgHandler.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,48 @@ +/* I N E T M S G H A N D L E R . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file INetMsgHandler.h + * + * Interface. Any class needing to handle incoming + * NetMsgs and be registered to the NetMsgSubscriberRegistry + * must implement this interface. + * + */ + +#ifndef __INETMSGHANDLER_H__ +#define __INETMSGHANDLER_H__ + +#include "NetMsg.h" +#include "NetPortal.h" + +class INetMsgHandler { +public: + virtual void handleNetMsg(NetMsg* msg, NetPortal* origin){}; +}; + +#endif /* __INETMSGHANDLER_H__ */ + + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/IOException.h (from rev 38887, rt^3/trunk/src/GE/exception/IOException.h) =================================================================== --- rt^3/trunk/include/IOException.h (rev 0) +++ rt^3/trunk/include/IOException.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,46 @@ +/* I O E X C E P T I O N . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file IOException.h + * + * Brief description + * + */ + +#ifndef __IOEXCEPTION_H__ +#define __IOEXCEPTION_H__ + +#include "Exception.h" + +class IOException : public Exception +{ +public: + IOException(); + IOException(const std::string& message); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/JobManager.h (from rev 38888, rt^3/trunk/src/libJob/JobManager.h) =================================================================== --- rt^3/trunk/include/JobManager.h (rev 0) +++ rt^3/trunk/include/JobManager.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,68 @@ +/* J O B M A N A G E R . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file JobManager.h + * + * Brief description + * + */ + +#ifndef __JOBMANAGER_H__ +#define __JOBMANAGER_H__ + +#include "AbstractJob.h" +#include "JobWorker.h" +#include "utility.h" +#include <QList> +#include <QMutex> + +class JobManager +{ + +public: + static JobManager* getInstance(); + void submitJob(AbstractJob* aj); + + virtual ~JobManager(); + + AbstractJob* getNextJob(); + bool hasJobsToWork(); + +private: + static JobManager* pInstance; + JobManager(); + + JobManager(JobManager const&){}; + JobManager& operator=(JobManager const&){}; + + QList<JobWorker*>* jobWorkers; + QList<AbstractJob*>* jobQueue; + QMutex* queueLock; + Logger* log; +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/JobScheduler.h (from rev 38880, rt^3/trunk/src/libJob/JobScheduler.h) =================================================================== --- rt^3/trunk/include/JobScheduler.h (rev 0) +++ rt^3/trunk/include/JobScheduler.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,58 @@ +/* J O B S C H E D U L E R . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file JobScheduler.h + * + * Utility for scheduling delayed one-shot, + * repetitive, and delayed repetitive jobs. + * + */ + +#ifndef __JOBSCHEDULER_H__ +#define __JOBSCHEDULER_H__ + +#include <QMutex> + +class JobScheduler +{ + +public: + static JobScheduler* getInstance(); + + virtual ~JobScheduler(); + +private: + static JobScheduler* pInstance; + JobScheduler(); + + //Disable copy cstr and =operator + JobScheduler(JobScheduler const&){}; + JobScheduler& operator=(JobScheduler const&){}; + +}; + +#endif //__JOBSCHEDULER_H__ // + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/JobWorker.h (from rev 38888, rt^3/trunk/src/libJob/JobWorker.h) =================================================================== --- rt^3/trunk/include/JobWorker.h (rev 0) +++ rt^3/trunk/include/JobWorker.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,74 @@ +/* J O B W O R K E R . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file JobWorker.h + * + * Brief description + * + */ + +#ifndef __JOBWORKER_H__ +#define __JOBWORKER_H__ + +#define MAX_JOBWORKERS 5 + +#include "utility.h" +#include <QThread> +#include <QUuid> +#include <string> + +enum JobWorkerStatus +{ + WORKER_NOTREADY, WORKER_READY, WORKER_RUNNING +}; + +class JobWorker: public QThread +{ + +public: + JobWorker(); + virtual ~JobWorker(); + + void run(); + + JobWorkerStatus getStatus(); + void shutdown(); + QUuid getWorkerId(); + QString getWorkerIdAsQString(); + std::string getWorkerIdAsStdString(); + + + + +private: + Logger* log; + JobWorkerStatus status; + bool runCmd; + QUuid workerId; +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/Logger.h (from rev 38880, rt^3/trunk/src/utility/Logger.h) =================================================================== --- rt^3/trunk/include/Logger.h (rev 0) +++ rt^3/trunk/include/Logger.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,78 @@ +/* L O G G E R . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file Logger.h + * + * Brief description + * + */ + +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include <QThread> +#include <QString> +#include <QMutex> +#include <QMutexLocker> + +#include <iostream> + + +class Logger +{ + +public: + static Logger* getInstance(); + + void enableVerbose(){this->verbose = true;} + void disableVerbose(){this->verbose = false;} + + void logDEBUG(QString origin, QString string); + void logINFO(QString origin, QString string); + void logWARNING(QString origin, QString string); + void logERROR(QString origin, QString string); + void logFATAL(QString origin, QString string); + + enum + { + INFO, WARNING, ERROR, FATAL, DEBUG + }; + +protected: + static Logger* instance; + static QMutex* lock; + bool verbose; + + Logger(); + Logger(const Logger& logger){}; + Logger& operator=(const Logger& log){}; + ~Logger(){}; + + void log(quint32 logLevel, QString origin, QString string); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/NetMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/NetMsg.h) =================================================================== --- rt^3/trunk/include/NetMsg.h (rev 0) +++ rt^3/trunk/include/NetMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,137 @@ +/* N E T M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file NetMsg.h + * + * Brief description + * + */ + +#ifndef __NETMSG_H__ +#define __NETMSG_H__ + +/* NetMsg Types */ + +#define FAILURE 0 +#define SUCCESS 5 + +#define REMGSHOSTNAMESET 100 + +#define DISCONNECTREQ 150 + +#define NEWHOSTONNET 200 + +#define FULLHOSTLISTREQ 250 +#define FULLHOSTLIST 255 + +#define NEWSESSIONREQ 300 +#define SESSIONINFO 305 +#define LOGOUTSESSION 310 + +#define GEOMETRYREQ 400 +#define ReqByUUID 10 +#define ReqByFilePath 11 +#define GEOMETRYMANIFEST 405 +#define GEOMETRYCHUNK 410 + +/* Failure Codes */ +#define UUIDNotFoundFailure 10 +#define FileNotFoundFailure 20 + +#define PORTAL_HANDSHAKE_FAILURE 30 +#define UNKNOWN_PORTAL_FAILURE 40 +#define PORTAL_WRITE_FAILURE 50 +#define PORTAL_READ_FAILURE 60 +#define REM_HOST_DISCONNECT 70 +#define LOCAL_DISCONNECT_REQ 80 + +#define AUTHENTICATION_FAILED 90 + + +#include "IOException.h" +#include "utility.h" +#include <QDataStream> +#include <QByteArray> +#include <QUuid> +#include <sstream> + +class NetMsg +{ + +public: + + //Normal Constructor + NetMsg(quint32 mType); + + //Reply Constructor + NetMsg(quint32 mType, NetMsg* msg); + + //Deserializing Constructors + NetMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~NetMsg(); + + + //Serializers + QByteArray* serialize(); + void serialize(QByteArray* ba); + + /* + *Getters n Setters + */ + quint32 getMsgLen(); + quint32 getMsgType(); + QUuid getMsgUUID(); + bool msgHasReUUID(); + QUuid getReUUID(); + + /* + * Utilities + */ + virtual QString toString(); + virtual std::string toStdString(); + virtual bool equals(NetMsg& msg); + void printMe(); + +protected: + quint32 msgLen; + quint32 msgType; + QUuid msgUUID; + bool hasReUUID; + QUuid reUUID; + QString origin; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); + + //Disable Default Constructor + NetMsg(){} + +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/NetMsgFactory.h (from rev 38880, rt^3/trunk/src/libNetwork/NetMsgFactory.h) =================================================================== --- rt^3/trunk/include/NetMsgFactory.h (rev 0) +++ rt^3/trunk/include/NetMsgFactory.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,78 @@ +/* N E T M S G F A C T O R Y. H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file NetMsg.h + * + * Brief description + * + */ + +#ifndef __NETMSGFACTORY_H__ +#define __NETMSGFACTORY_H__ + +#include "utility.h" +#include "NetMsg.h" + +#include <QByteArray> +#include <QQueue> +#include <QBuffer> +#include <QMutex> + +class NetMsgFactory +{ + +public: + + NetMsgFactory(); + virtual ~NetMsgFactory(); + + bool addData(QByteArray& data); + bool hasMsgsAvailable(); + NetMsg* getNextMsg(bool peek = false); + void attemptToMakeMsgs(); + + bool attemptToMakeMsg(); + void printBufferStatus(bool extended); + + quint32 getInboxSize(); + void setPortalName(QString portalName); + QString getPortalName(); +private: + QString portalName; + QMutex* lock; + + QQueue<NetMsg*>* inbox; + + QBuffer* intBuffer; + quint64 limit; + + void compactBuffer(); + static NetMsg* buildMsgByType(quint32 type, QDataStream* qds, + QString portalName); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/NetPortal.h (from rev 38880, rt^3/trunk/src/libNetwork/NetPortal.h) =================================================================== --- rt^3/trunk/include/NetPortal.h (rev 0) +++ rt^3/trunk/include/NetPortal.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,109 @@ +/* N E T P O R T A L . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file NetPortal.h + * + * Brief description + * + */ + +#ifndef __NETPORTAL_H__ +#define __NETPORTAL_H__ + +#include "utility.h" +#include "NetMsg.h" +#include "NetMsgFactory.h" +#include "RemoteGSHostnameSetMsg.h" + +#include <QtNetwork/QTcpServer> +#include <QtNetwork/QTcpSocket> +#include <QString> + +class NetPortalManager; + +class NetPortal : public QObject +{ +Q_OBJECT + +public: + NetPortal(NetPortalManager* parent); + NetPortal(NetPortalManager* parent, int socketDescriptor); + virtual ~NetPortal(); + + void connectToNetHost(QString netHostname, quint16 port); + void connectToNetHost(QHostAddress address, quint16 port); + void disconnectFromNetHost(quint8 reason = LOCAL_DISCONNECT_REQ); + + void attemptToBuildMsg(); + + bool hasMsg(); + NetMsg* getNextMsg(bool peek = false); + + void send(NetMsg& msg); + void quickSend(quint32 opcode); + + QString getRemoteGSHostname(); + + bool isOpen(); + + enum HandshakeStatus + { + NotConnected = 0, Handshaking = 5, Ready = 10, Failed = 15, + }; + +signals: + void msgReady(); + void handshakeStatusUpdate(quint32 current, quint32 old); + void portalHandshakeComplete(NetPortal* portal); + + void portalConnected(); + void portalDisconnected(); + void socketError(QAbstractSocket::SocketError err); + +public slots: + void sendLocalGSHostnameToRemoteGSHost(); + +protected slots: + void moveDataFromSocketBuffer(); + void relaySockConnected(); + void relaySockDisconnected(); + void relaySockError(QAbstractSocket::SocketError err); + +private: + QTcpSocket* sock; + NetPortalManager* nspm; + QString remGSHostname; + NetMsgFactory* factory; + HandshakeStatus handshakeStatus; + Logger* log; + + void constructorCommon(NetPortalManager* nspm); + void updateHandshakeStatus(HandshakeStatus newStatus); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 + Copied: rt^3/trunk/include/NetPortalManager.h (from rev 38880, rt^3/trunk/src/libNetwork/NetPortalManager.h) =================================================================== --- rt^3/trunk/include/NetPortalManager.h (rev 0) +++ rt^3/trunk/include/NetPortalManager.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,89 @@ +/* N E T P O R T A L M A N A G E R . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file NetPortalManager.h + * + * Brief description + * + */ + +#ifndef __NETPORTALMANAGER_H__ +#define __NETPORTALMANAGER_H__ + +#include "utility.h" +#include "NetMsg.h" + +#include <QtNetwork/QTcpServer> +#include <QtNetwork/QHostAddress> +#include <QMap> +#include <QUuid> +#include <QList> +#include <QByteArray> + +class NetPortal; + +class NetPortalManager: public QTcpServer +{ +Q_OBJECT + +public: + NetPortalManager(QString GSHostname, QObject* parent = 0); + ~NetPortalManager(); + + QString getLocalGSHostname(); + NetPortal* getNewPortal(int socketDescriptor = 0); + NetPortal* getPortalByRemoteGSHostname(QString remHostname); + void localLog(QString str); + +protected: + void incomingConnection(int socketDescriptor); + +protected slots: + + void handlePortalDisconnect(); + void mapPortalToGSHostname(NetPortal* portal); + void unmapPortalToGSHostname(QString gsHostname); + +signals: +void newIncomingConnection(NetPortal* nsp); + +private: + void registerPortal(NetPortal* portal); + void unregisterPortal(NetPortal* portal); + + QString localGSHostname; + Logger* log; + + QMap<QString, NetPortal*>* gsHostnameToPortalMap; + QList<NetPortal*>* portalList; + + NetPortal* preparePortal(); +}; + +#endif + +/* + * Local Variables: + * tab-width: 8 + * mode: C + * indent-tabs-mode: t + * c-file-style: "stroustrup" + * End: + * ex: shiftwidth=4 tabstop=8 + */ Copied: rt^3/trunk/include/NewHostOnNetMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/NewHostOnNetMsg.h) =================================================================== --- rt^3/trunk/include/NewHostOnNetMsg.h (rev 0) +++ rt^3/trunk/include/NewHostOnNetMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,60 @@ +/* N E W H O S T O N N E T M S G . H + * BRL-CAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file NewHostOnNetMsg.h + * + * Brief description + * + */ + +#ifndef __NEWHOSTONNETMSG_H__ +#define __NEWHOSTONNETMSG_H__ + + +#include "GenericOneStringMsg.h" + +class NewHostOnNetMsg : public GenericOneStringMsg +{ + +public: + + //Normal Constructor + NewHostOnNetMsg(QString s); + + //Reply Constructor + NewHostOnNetMsg(NewHostOnNetMsg* msg, QString s); + + //Deserializing Constructors + NewHostOnNetMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~NewHostOnNetMsg(); + + QString getNewGSHostname(); +}; + +#endif + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/NewSessionReqMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/NewSessionReqMsg.h) =================================================================== --- rt^3/trunk/include/NewSessionReqMsg.h (rev 0) +++ rt^3/trunk/include/NewSessionReqMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,73 @@ +/* N E W S E S S I O N R E Q M S G . H + * BRLCAD + * + * Copyright (c) 2010 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file NewSessionReqMsg.h + * + * Brief description + * + */ + +#ifndef __NEWSESSIONREQMSG_H__ +#define __NEWSESSIONREQMSG_H__ + + +#include "NetMsg.h" + +class NewSessionReqMsg : public NetMsg +{ + +public: + + //Normal Constructor + NewSessionReqMsg(QString uname, QString passwd); + + //Reply Constructor + NewSessionReqMsg(NetMsg* msg, QString uname, QString passwd); + + //Deserializing Constructors + NewSessionReqMsg(QDataStream* ds, QString origin); + + //Destructor + virtual ~NewSessionReqMsg(); + + /* + * Utilities + */ + virtual QString toString(); + QString getUName(); + QString getPasswd(); + +protected: + QString uname; + QString passwd; + + virtual bool _serialize(QDataStream* ds); + virtual bool _equals(NetMsg& msg); + +}; + +#endif //__NEWSESSIONREQMSG_H__ + +// Local Variables: *** +// mode: C++ *** +// tab-width: 8 *** +// c-basic-offset: 2 *** +// indent-tabs-mode: t *** +// End: *** +// ex: shiftwidth=2 tabstop=8 Copied: rt^3/trunk/include/RemoteGSHostnameSetMsg.h (from rev 38880, rt^3/trunk/src/libNetwork/RemoteGSHostnameSetMsg.h) =================================================================== --- rt^3/trunk/include/RemoteGSHostnameSetMsg.h (rev 0) +++ rt^3/trunk/include/RemoteGSHostnameSetMsg.h 2010-04-29 16:44:42 UTC (rev 38898) @@ -0,0 +1,59 @@ +/* R E M O T E G S H O S T N A M E S E T M S G . H + * BRL-CAD + * + * Copyright (c) 20... [truncated message content] |