From 8dc8dc3a05b18751082504bbeaedd94fb9128208 Mon Sep 17 00:00:00 2001 From: Vadim Kurland Date: Sat, 25 Dec 2010 22:12:33 -0800 Subject: [PATCH] removed unused files; switched to var FWBUILDER_XML_VERSION for data file version everywhere; removed unused libfwbuilder version vars from configure and .h files --- VERSION | 5 - configure.in | 14 +- src/libfwbuilder/qmake.inc.in | 1 - src/libfwbuilder/src/fwbuilder/Constants.cpp | 9 +- .../src/fwbuilder/FWObjectDatabase.cpp | 6 +- src/libfwbuilder/src/fwbuilder/XMLTools.h | 4 +- src/libfwbuilder/src/fwbuilder/fwbuilder.pro | 1 - .../src/fwbuilder/libfwbuilder-config.h.in | 3 +- .../src/fwbuilder/libfwbuilder-version.h | 2 - src/libfwbuilder/src/test/ipAddressTest.cpp | 139 --------- src/libfwbuilder/src/test/main.cpp | 160 ----------- .../src/test/removeObjectTest.cpp | 93 ------ src/libfwbuilder/src/test/test.pro | 37 --- src/libfwbuilder/src/test/test.xml | 271 ------------------ 14 files changed, 12 insertions(+), 733 deletions(-) delete mode 100644 src/libfwbuilder/src/fwbuilder/libfwbuilder-version.h delete mode 100644 src/libfwbuilder/src/test/ipAddressTest.cpp delete mode 100644 src/libfwbuilder/src/test/main.cpp delete mode 100644 src/libfwbuilder/src/test/removeObjectTest.cpp delete mode 100644 src/libfwbuilder/src/test/test.pro delete mode 100644 src/libfwbuilder/src/test/test.xml diff --git a/VERSION b/VERSION index f27d0a954..26c5c6b4a 100644 --- a/VERSION +++ b/VERSION @@ -29,11 +29,6 @@ LIBFWBUILDER_CURRENT=9 LIBFWBUILDER_REVISION=1 LIBFWBUILDER_AGE=0 -LIBFWBUILDER_SO_VERSION=${LIBFWBUILDER_CURRENT}:${LIBFWBUILDER_REVISION}:${LIBFWBUILDER_AGE} -LIBFWBUILDER_SOLIB_VERSION=${LIBFWBUILDER_CURRENT}.${LIBFWBUILDER_REVISION}.${LIBFWBUILDER_AGE} -LIBFWBUILDER_SOLIB_SYMLINK1_VERSION=${LIBFWBUILDER_CURRENT}.${LIBFWBUILDER_REVISION} -LIBFWBUILDER_SOLIB_SYMLINK2_VERSION=${LIBFWBUILDER_CURRENT} - # Data format version FWBUILDER_XML_VERSION=17 diff --git a/configure.in b/configure.in index cab37ac5d..504446d95 100644 --- a/configure.in +++ b/configure.in @@ -38,30 +38,18 @@ AC_SUBST(FWB_MICRO_VERSION) AC_SUBST(FWB_VERSION) # libfwbuilder versions -AC_SUBST(LIBMAJOR) -AC_SUBST(LIBFWBUILDER_SO_VERSION) -AC_SUBST(LIBFWBUILDER_SOLIB_VERSION) AC_SUBST(LIBFWBUILDER_VERSION) -#AC_SUBST(LIBFWBUILDER_LIB_VER) -AC_SUBST(LIBFWBUILDER_SOLIB_SYMLINK1_VERSION) -AC_SUBST(LIBFWBUILDER_SOLIB_SYMLINK2_VERSION) AC_SUBST(FWBUILDER_XML_VERSION) SHORTVERSION=${FWB_MAJOR_VERSION}${FWB_MINOR_VERSION}${FWB_MICRO_VERSION} AC_SUBST(SHORTVERSION) -LIBFWBUILDER_FORMAT_VERSION="${LIBFWBUILDER_VERSION}" -AC_DEFINE_UNQUOTED(LIBFWBUILDER_FORMAT_VERSION, "${LIBFWBUILDER_FORMAT_VERSION}") +AC_DEFINE_UNQUOTED(FWBUILDER_XML_VERSION, "$FWBUILDER_XML_VERSION") echo "Creating VERSION.h file..." echo "#define VERSION \"$VERSION\"" > VERSION.h -echo "Creating libfwbuilder-version.h file..." - -echo "#define LIBFWBUILDER_VERSION \"$LIBFWBUILDER_VERSION\"" > src/libfwbuilder/src/fwbuilder/libfwbuilder-version.h -echo "#define LIBFWBUILDER_FORMAT_VERSION \"$FWBUILDER_XML_VERSION\"" >> src/libfwbuilder/src/fwbuilder/libfwbuilder-version.h - dnl try to find QT dnl AC_ARG_WITH(qtdir,[ --with-qtdir=DIR Specify directory path for QT ]) diff --git a/src/libfwbuilder/qmake.inc.in b/src/libfwbuilder/qmake.inc.in index 641871713..5181c1994 100644 --- a/src/libfwbuilder/qmake.inc.in +++ b/src/libfwbuilder/qmake.inc.in @@ -4,7 +4,6 @@ # QTDIR = $$(QTDIR) TEMPLATE = lib -SO_VERSION = @LIBFWBUILDER_SOLIB_VERSION@ DEFINES += $$(DEFINES) INCLUDEPATH += .. ../.. $$(INCLUDEPATH) LANGUAGE = C++ diff --git a/src/libfwbuilder/src/fwbuilder/Constants.cpp b/src/libfwbuilder/src/fwbuilder/Constants.cpp index 1d7bd065a..a405276f2 100644 --- a/src/libfwbuilder/src/fwbuilder/Constants.cpp +++ b/src/libfwbuilder/src/fwbuilder/Constants.cpp @@ -24,8 +24,9 @@ */ -#include -#include +#include "../../config.h" +#include "fwbuilder/Constants.h" +#include "fwbuilder/libfwbuilder-config.h" using namespace std; using namespace libfwbuilder; @@ -37,12 +38,12 @@ const string Constants::getLibraryDescription() const string Constants::getLibraryVersion() { - return string(LIBFWBUILDER_VERSION); + return string(VERSION); } const string Constants::getDataFormatVersion() { - return string(LIBFWBUILDER_FORMAT_VERSION); + return string(FWBUILDER_XML_VERSION); } const string Constants::getTemplateDirectory() diff --git a/src/libfwbuilder/src/fwbuilder/FWObjectDatabase.cpp b/src/libfwbuilder/src/fwbuilder/FWObjectDatabase.cpp index c4a1ce389..ab441b5b2 100644 --- a/src/libfwbuilder/src/fwbuilder/FWObjectDatabase.cpp +++ b/src/libfwbuilder/src/fwbuilder/FWObjectDatabase.cpp @@ -433,7 +433,7 @@ xmlNodePtr FWObjectDatabase::toXML(xmlNodePtr parent) throw(FWException) xmlNewProp(parent, TOXMLCAST("version") , - TOXMLCAST(LIBFWBUILDER_FORMAT_VERSION)); + TOXMLCAST(FWBUILDER_XML_VERSION)); if (lastModified!=0) { @@ -448,8 +448,8 @@ xmlNodePtr FWObjectDatabase::toXML(xmlNodePtr parent) throw(FWException) //NOTUSED xmlAttrPtr pr = xmlNewProp(parent, - TOXMLCAST("id") , - STRTOXMLCAST(id_dict[rootid])); + TOXMLCAST("id") , + STRTOXMLCAST(id_dict[rootid])); //xmlAddID(NULL, parent->doc, STRTOXMLCAST(id_dict[rootid]), pr); diff --git a/src/libfwbuilder/src/fwbuilder/XMLTools.h b/src/libfwbuilder/src/fwbuilder/XMLTools.h index b6af1b57e..de4234aa7 100644 --- a/src/libfwbuilder/src/fwbuilder/XMLTools.h +++ b/src/libfwbuilder/src/fwbuilder/XMLTools.h @@ -89,7 +89,7 @@ class XMLTools const std::string &dtd_file, const UpgradePredicate *upgrade, const std::string &template_dir, - const std::string ¤t_version = std::string(LIBFWBUILDER_FORMAT_VERSION) + const std::string ¤t_version = std::string(FWBUILDER_XML_VERSION) ) throw(FWException); static void setDTD(xmlDocPtr doc, @@ -192,7 +192,7 @@ class XMLTools const std::string &file_name, const std::string &type_name, const std::string &template_dir, - const std::string ¤t_version = std::string(LIBFWBUILDER_FORMAT_VERSION) + const std::string ¤t_version = std::string(FWBUILDER_XML_VERSION) ) throw(FWException); /** diff --git a/src/libfwbuilder/src/fwbuilder/fwbuilder.pro b/src/libfwbuilder/src/fwbuilder/fwbuilder.pro index b43bf65c9..f1b3b9462 100644 --- a/src/libfwbuilder/src/fwbuilder/fwbuilder.pro +++ b/src/libfwbuilder/src/fwbuilder/fwbuilder.pro @@ -5,7 +5,6 @@ include(../../qmake.inc) TEMPLATE = lib CONFIG += staticlib -VERSION = $$SO_VERSION # SOURCES = InetAddr.cpp \ InetAddrMask.cpp \ diff --git a/src/libfwbuilder/src/fwbuilder/libfwbuilder-config.h.in b/src/libfwbuilder/src/fwbuilder/libfwbuilder-config.h.in index ddf3aa501..6c8cbc902 100644 --- a/src/libfwbuilder/src/fwbuilder/libfwbuilder-config.h.in +++ b/src/libfwbuilder/src/fwbuilder/libfwbuilder-config.h.in @@ -1,10 +1,9 @@ -#include "libfwbuilder-version.h" - #ifdef _WIN32 # pragma warning(disable:4786) #endif +#undef FWBUILDER_XML_VERSION /* * Template files directory dir diff --git a/src/libfwbuilder/src/fwbuilder/libfwbuilder-version.h b/src/libfwbuilder/src/fwbuilder/libfwbuilder-version.h deleted file mode 100644 index 8fb1877c4..000000000 --- a/src/libfwbuilder/src/fwbuilder/libfwbuilder-version.h +++ /dev/null @@ -1,2 +0,0 @@ -#define LIBFWBUILDER_VERSION "" -#define LIBFWBUILDER_FORMAT_VERSION "17" diff --git a/src/libfwbuilder/src/test/ipAddressTest.cpp b/src/libfwbuilder/src/test/ipAddressTest.cpp deleted file mode 100644 index a0d3c7652..000000000 --- a/src/libfwbuilder/src/test/ipAddressTest.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - - Firewall Builder - - Copyright (C) 2000 NetCitadel, LLC - - Author: Vadim Kurland vadim@vk.crocodile.org - - $Id: ipAddressTest.cpp 918 2006-03-05 06:07:10Z vkurland $ - - - This program is free software which we release under the GNU General Public - License. You may redistribute and/or modify this program under the terms - of that license as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program 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 General Public License for more details. - - To get a copy of the GNU General Public License, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#include "fwbuilder/libfwbuilder-config.h" - -#include "fwbuilder/FWObjectDatabase.h" -#include "fwbuilder/FWException.h" -#include "fwbuilder/IPAddress.h" -#include "fwbuilder/AddressRange.h" - -#include -#include - -using namespace libfwbuilder; -using namespace std; - - - - - -void IPAddressTest(FWObjectDatabase *objdb) -{ - cout << endl; - cout << "*** Testing IP address arithmetics" << endl; - - IPAddress *a=new IPAddress("192.168.1.127"); - - cout << "created IPAddress object: " << a->toString() << endl; - cout << " trying address arithmetics:\n"; - cout << " testing address increment by 1: a1+1=" << (*a+1).toString() << endl; - cout << " testing address decrement by 1: a1-1=" << (*a-1).toString() << endl; - - IPAddress *b=new IPAddress("192.168.1.254"); - cout << "created IPAddress object: " << b->toString() << endl; - cout << " testing address increments by 1:" << endl; - - *b=*b+1; - cout << " " << b->toString() << endl; - *b=*b+1; - cout << " " << b->toString() << endl; - *b=*b+1; - cout << " " << b->toString() << endl; - - b=new IPAddress("255.255.255.254"); - cout << "created IPAddress object: " << b->toString() << endl; - - *b=*b+1; - cout << " " << b->toString() << endl; - *b=*b+1; - cout << " " << b->toString() << endl; - *b=*b+1; - cout << " " << b->toString() << endl; - - Netmask *m=new Netmask("255.255.252.0"); - cout << "created Netmask object: " << m->toString() << endl; - cout << " testing getLength: length of this netmask is " << m->getLength() << " bits" << endl; - - AddressRange *range1=AddressRange::cast( - objdb->create(AddressRange::TYPENAME) ); - - range1->setRangeStart( IPAddress("192.168.1.1") ); - range1->setRangeEnd( IPAddress("192.168.1.11")); - - cout << "Created address range : " << range1->getRangeStart().toString() - << "-" << range1->getRangeEnd().toString() << endl; - - cout << " converting addresses to guint32\n"; - cout << " a1=" << range1->getRangeStart().to32BitInt() << endl; - cout << " a2=" << range1->getRangeEnd().to32BitInt() << endl; - - - cout << " Range dimension is " << range1->dimension() << endl; - - cout << endl; - - cout << " Testing conversion of address range to a set of networks." << endl; - cout << " Need two addresses that define address range start and end:" << endl; - string s; - cout << " Enter address range start address: "; - cin >> s; - IPAddress *a1=new IPAddress(s); - - cout << " Enter address range end address: "; - cin >> s; - IPAddress *a2=new IPAddress(s); - - guint32 size = htonl(a2->to32BitInt())-htonl(a1->to32BitInt()) + 1; - - cout << "Trying to convert range " - << a1->toString() << "-" << a2->toString() - << " (" << size << " addresses) " - << " to networks" << endl; - - vector vn=libfwbuilder::convertAddressRange(*a1,*a2); - - for (vector::iterator i=vn.begin(); i!=vn.end(); i++) - { - IPAddress bcast=i->getBroadcastAddress(); - - size=ntohl(bcast.to32BitInt()) - ntohl(i->getAddress().to32BitInt()) + 1; - - cout << i->getAddress().toString() - << "/" - << i->getNetmask().toString() - << endl; - cout << " " - << " broadcast: " - << bcast.toString() - << ", " - << size - << " addresses" - << endl; - } -} - diff --git a/src/libfwbuilder/src/test/main.cpp b/src/libfwbuilder/src/test/main.cpp deleted file mode 100644 index 1b26b40d3..000000000 --- a/src/libfwbuilder/src/test/main.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - - Firewall Builder - - Copyright (C) 2000 NetCitadel, LLC - - Author: Vadim Kurland vadim@vk.crocodile.org - - $Id: main.cpp 918 2006-03-05 06:07:10Z vkurland $ - - - This program is free software which we release under the GNU General Public - License. You may redistribute and/or modify this program under the terms - of that license as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program 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 General Public License for more details. - - To get a copy of the GNU General Public License, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#include "fwbuilder/libfwbuilder-config.h" - -// #include -#include -#include -#include -#include - -#include "fwbuilder/FWObjectDatabase.h" -#include "fwbuilder/XMLTools.h" -#include "fwbuilder/FWException.h" -#include "fwbuilder/IPAddress.h" -#include "fwbuilder/AddressRange.h" -#include "fwbuilder/Host.h" -#include "fwbuilder/ObjectGroup.h" - -#include -#include -#include -#include - -#ifndef _WIN32 -# include -# include -#else -# include -#endif - -#include - - -using namespace libfwbuilder; -using namespace std; - - -extern void removeObjectTest(FWObjectDatabase* db); -extern void IPAddressTest(FWObjectDatabase* db); - - -char *filename="test.xml"; - -FWObjectDatabase *objdb = NULL; - - -void usage() -{ - cout << " test [-h] [-f testfile.xml] " << endl; -} - -class UpgradePredicate: public XMLTools::UpgradePredicate -{ - public: - virtual bool operator()(const string &msg) const - { - cout << "Data file has been created in the old version of Firewall Builder. Use fwbuilder GUI to convert it." << endl; - return false; - } -}; - - -void initAll() -{ - libfwbuilder::init(); - - /* create database */ - objdb = new FWObjectDatabase(); - - /* load the data file */ - UpgradePredicate upgrade_predicate; - -// cout << " *** Loading test file " << filename << " ..\n"; -// FWObjectDatabase::db->load(filename, &upgrade_predicate, LIBFWBUILDER_TEMPLATE_DIR); -// cout << "done\n"; -} - -int main(int argc, char * const *argv) -{ -#if defined(WORDS_LITTLEENDIAN) - cout << "Byte order: WORDS_LITTLEENDIAN" << endl; -#elif defined(WORDS_BIGENDIAN) - cout << "Byte order: WORDS_BIGENDIAN" << endl; -#else - cout << "Byte order: undefined" << endl; -#endif - - cout << "Program executable: " << argv[0] << endl; - - int c; - while ((c = getopt (argc , argv , "?hf:")) != EOF ) - switch (c) { - case '?': - case 'h': - usage(); - return(0); - - case 'f': - filename=strdup(optarg); - break; - } - - try { - initAll(); - - IPAddressTest(objdb); - removeObjectTest(objdb); - - return 0; - - } catch(FWException &ex) { - cerr << ex.toString() << endl; - return 1; - } catch (std::string s) { - cerr << s; - return 1; - } catch (std::exception ex) { - cerr << ex.what(); - return 1; - } catch (...) { - cerr << "Unsupported exception"; - return 1; - } - - return 0; -} - - - - - - - - - diff --git a/src/libfwbuilder/src/test/removeObjectTest.cpp b/src/libfwbuilder/src/test/removeObjectTest.cpp deleted file mode 100644 index 73fa80dd4..000000000 --- a/src/libfwbuilder/src/test/removeObjectTest.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - - Firewall Builder - - Copyright (C) 2000 NetCitadel, LLC - - Author: Vadim Kurland vadim@vk.crocodile.org - - $Id: removeObjectTest.cpp 918 2006-03-05 06:07:10Z vkurland $ - - - This program is free software which we release under the GNU General Public - License. You may redistribute and/or modify this program under the terms - of that license as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This program 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 General Public License for more details. - - To get a copy of the GNU General Public License, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -*/ - - -#include "fwbuilder/libfwbuilder-config.h" - -#include "fwbuilder/FWObjectDatabase.h" -#include "fwbuilder/FWException.h" -#include "fwbuilder/Host.h" -#include "fwbuilder/ObjectGroup.h" - -#include -#include - -using namespace libfwbuilder; -using namespace std; - - -string generateHostName(int n) -{ - char s[32]; - sprintf(s,"Host_%d",n); - return string(s); -} - - -/* - * adds host with the name "Host_N" and ID = "ID_host_N" - */ -FWObject* createHost( FWObjectDatabase *db , int N) -{ - Host *h=Host::cast( db->create(Host::TYPENAME, true) ); - h->setName( generateHostName(N) ); - return h; -} - -void deleteObject( FWObjectDatabase *db,FWObject *obj) -{ - db->removeAllInstances(obj); -} - -void removeObjectTest(FWObjectDatabase *objdb) -{ - cout << endl; - cout << "*** Testing object search and removal" << endl; - - string id50; - int N=2000; - - cout << " *** Create " << N << " Host objects ..\n"; - for (int i=0; iadd(h); - - if (i==50) id50=h->getId(); - } - cout << "done\n"; - - cout << " *** Find host #50 ( id=" << id50 << " )..." << endl; - FWObject *obj=objdb->getById( id50 , true ); - cout << "done. Obj=" << obj << endl; - - - /* delete host number 50 */ - cout << " *** Delete host #50 ..." << endl; - deleteObject( objdb , obj ); - cout << "done\n"; -} - diff --git a/src/libfwbuilder/src/test/test.pro b/src/libfwbuilder/src/test/test.pro deleted file mode 100644 index 6a4cd0633..000000000 --- a/src/libfwbuilder/src/test/test.pro +++ /dev/null @@ -1,37 +0,0 @@ -#-*- mode: makefile; tab-width: 4; -*- -# -include(../../qmake.inc) -# -TEMPLATE= app -# -VERSION = $$SO_VERSION -# -SOURCES = ipAddressTest.cpp \ - main.cpp \ - removeObjectTest.cpp -# -TARGET = test - -win32:target.path =$$prefix/ -unix:target.path =$$prefix/usr/bin -macx:target.path =$$prefix/ - -unix { - CONFIG -= qt - CONFIG += warn_on debug - INCLUDEPATH += ../ - - LIBS += -L../fwbuilder -lfwbuilder -pthread -lxslt -lxml2 -lz -lm -lssl -lcrypto /usr/lib/libresolv.a -} - -win32 { - CONFIG -= qt - CONFIG += thread rtti stl warn_on release - DEFINES += LIBXML_STATIC LIBXSLT_STATIC LIBEXSLT_STATIC XMLSEC_STATIC - INCLUDEPATH += Z:\include C:\local\include - LIBS += -LZ: -LC:\local\lib - LIBS += fwbuilder.lib ws2_32.lib pthreadVC.lib getopt.lib - LIBS += libxml2.lib libxslt.lib zlib.lib ssleay32.lib libeay32.lib -} - -INSTALLS -= target diff --git a/src/libfwbuilder/src/test/test.xml b/src/libfwbuilder/src/test/test.xml deleted file mode 100644 index 8ac8549c5..000000000 --- a/src/libfwbuilder/src/test/test.xml +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - established - -m state --state ESTABLISHED,RELATED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -