diff options
Diffstat (limited to 'kmyfirewall/compilers')
10 files changed, 309 insertions, 305 deletions
diff --git a/kmyfirewall/compilers/iptables/kmfiptablescompiler.cpp b/kmyfirewall/compilers/iptables/kmfiptablescompiler.cpp index 8f7348d..6af95c2 100644 --- a/kmyfirewall/compilers/iptables/kmfiptablescompiler.cpp +++ b/kmyfirewall/compilers/iptables/kmfiptablescompiler.cpp @@ -12,9 +12,9 @@ #include "kmfiptablescompiler.h" // QT includes -#include <qptrlist.h> -#include <qmultilineedit.h> -#include <qtabwidget.h> +#include <tqptrlist.h> +#include <tqmultilineedit.h> +#include <tqtabwidget.h> // KDE includes #include <kdebug.h> @@ -43,7 +43,7 @@ #include "kmfiptablesdocumentconverter.h" namespace KMF { -KMFIPTablesCompiler::KMFIPTablesCompiler( QObject* parent, const char* name ) : KMFPlugin( parent, name ) { +KMFIPTablesCompiler::KMFIPTablesCompiler( TQObject* tqparent, const char* name ) : KMFPlugin( tqparent, name ) { m_osName = "linux"; m_osGUIName = "Linux"; m_backendName = "iptables"; @@ -52,11 +52,11 @@ KMFIPTablesCompiler::KMFIPTablesCompiler( QObject* parent, const char* name ) : m_errorHandler = new KMFErrorHandler( "KMFIPTablesCompiler" ); m_iptWidget = 0; new KAction( i18n( "&Export as IPTables (Linux) Script" ), "fileexport", - 0, this, SLOT( slotExportIPT() ), actionCollection(), "compile_iptables" ); + 0, this, TQT_SLOT( slotExportIPT() ), actionCollection(), "compile_iptables" ); if ( genericDoc() ) { new KAction( i18n( "&Convert to IPTables Document and View" ), "fileexport", - 0, this, SLOT( slotConvertToIPTDoc() ), actionCollection(), "convert_to_iptdoc" ); + 0, this, TQT_SLOT( slotConvertToIPTDoc() ), actionCollection(), "convert_to_iptdoc" ); setXMLFile( "kmfiptablescompiler.rc" ); kdDebug() << "KMFIPTablesCompiler: Finished initialisation." << endl; @@ -66,16 +66,16 @@ KMFIPTablesCompiler::KMFIPTablesCompiler( QObject* parent, const char* name ) : KMFIPTablesCompiler::~KMFIPTablesCompiler() {} -const QString& KMFIPTablesCompiler::osName(){ +const TQString& KMFIPTablesCompiler::osName(){ return m_osName; } -const QString& KMFIPTablesCompiler::osGUIName(){ +const TQString& KMFIPTablesCompiler::osGUIName(){ return m_osGUIName; } -const QString& KMFIPTablesCompiler::backendName(){ +const TQString& KMFIPTablesCompiler::backendName(){ return m_backendName; } -const QString& KMFIPTablesCompiler::backendGUIName(){ +const TQString& KMFIPTablesCompiler::backendGUIName(){ return m_backendGUIName; } @@ -96,7 +96,7 @@ void KMFIPTablesCompiler::slotExportIPT() { KURL url = KFileDialog::getSaveURL( ":", "*.sh|Shell Script (*.sh)" ); - QString filename = url.fileName(); + TQString filename = url.fileName(); if ( url.fileName().isEmpty() ) return ; int answer = 0; @@ -107,13 +107,13 @@ void KMFIPTablesCompiler::slotExportIPT() { return ; } else { answer = KMessageBox::warningYesNo( 0, i18n( "<qt>File <b>%1</b> already exists!</p>" - "<p><b>Overwrite the existing file?</b></p></qt>" ).arg( url.url() ) ); + "<p><b>Overwrite the existing file?</b></p></qt>" ).tqarg( url.url() ) ); } } else { answer = 3; } } - QString extension = filename.right( 3 ); + TQString extension = filename.right( 3 ); if ( extension != ".sh" ) filename.append( ".sh" ); url.setFileName( filename ); @@ -129,7 +129,7 @@ void KMFIPTablesCompiler::slotExportIPT() { // statusBar() ->message( i18n( "Wrote file: " ) + url.fileName() , 5000 ); } else { kdDebug() << "Couldn't upload file!!!" << tempfile.name() << endl; - KMessageBox::detailedError( 0, i18n( "<qt><p>Saving file: <b>%1</b> Failed.</p></qt>" ).arg( url.url() ), + KMessageBox::detailedError( 0, i18n( "<qt><p>Saving file: <b>%1</b> Failed.</p></qt>" ).tqarg( url.url() ), i18n( "<qt><p>If you are working with remotely stored files " "make sure that the target host and the directory is reachable. " "</p></qt>" ) ); @@ -140,8 +140,8 @@ void KMFIPTablesCompiler::slotExportIPT() { } // void KMFIPTablesCompiler::slotShowIPTScript() { -// // QString s = compile( genericDoc() ); -// QMultiLineEdit* ed = new QMultiLineEdit( 0, "edit" ); +// // TQString s = compile( genericDoc() ); +// TQMultiLineEdit* ed = new TQMultiLineEdit( 0, "edit" ); // if ( genericDoc() ) { // ed->setText( compile( genericDoc() ) ); // } else if ( iptablesDoc() ) { @@ -151,28 +151,28 @@ void KMFIPTablesCompiler::slotExportIPT() { // showOutput(); // } -const QString& KMFIPTablesCompiler::compile( KMFGenericDoc* doc ) { - kdDebug() << "const QString& KMFIPTablesCompiler::compile( KMFGenericDoc* doc )" << endl; +const TQString& KMFIPTablesCompiler::compile( KMFGenericDoc* doc ) { + kdDebug() << "const TQString& KMFIPTablesCompiler::compile( KMFGenericDoc* doc )" << endl; //kdDebug() << "Doc XLM:\n" << m_genericDoc->getXMLSniplet() << endl; KMFIPTablesDocumentConverter *converter = new KMFIPTablesDocumentConverter(); m_iptdoc = converter->compileToIPTDoc( doc ); delete converter; if ( m_iptdoc ) { - QString ret = m_iptdoc->compile(); + TQString ret = m_iptdoc->compile(); m_iptdoc->deleteLater(); - return *( new QString( ret ) ); + return *( new TQString( ret ) ); } else { - return *( new QString( "ERROR: Couldn't compile document - may be wrong type " ) ); + return *( new TQString( "ERROR: Couldn't compile document - may be wrong type " ) ); } } -const QString& KMFIPTablesCompiler::compile( KMFIPTDoc* doc ) { +const TQString& KMFIPTablesCompiler::compile( KMFIPTDoc* doc ) { KMFIPTablesScriptGenerator *generator = new KMFIPTablesScriptGenerator(); - QString script = generator->compile( doc ); + TQString script = generator->compile( doc ); delete generator; - return *(new QString( script ) ); + return *(new TQString( script ) ); } void KMFIPTablesCompiler::slotConvertToIPTDoc() { @@ -187,7 +187,7 @@ void KMFIPTablesCompiler::slotConvertToIPTDoc() { delete converter; if ( ! m_iptWidget ) { - m_iptWidget = new QTabWidget( 0 , "QTabWidget" ); + m_iptWidget = new TQTabWidget( 0 , TQTABWIDGET_OBJECT_NAME_STRING ); m_iptViewFilter = new KMFListView( 0, "view" ); m_iptViewNat = new KMFListView( 0, "view" ); m_iptViewMangle = new KMFListView( 0, "view" ); @@ -225,14 +225,14 @@ void KMFIPTablesCompiler::slotConvertToIPTDoc() { // KInstance* KMFIPTablesCompilerFactory::s_instance = 0L; // KAboutData* KMFIPTablesCompilerFactory::s_about = 0L; -KMFIPTablesCompilerFactory::KMFIPTablesCompilerFactory( QObject* parent, const char* name ) - : KLibFactory( parent, name ) { +KMFIPTablesCompilerFactory::KMFIPTablesCompilerFactory( TQObject* tqparent, const char* name ) + : KLibFactory( tqparent, name ) { // s_instance = new KInstance( "KMFIPTablesCompilerFactory" ); } -QObject* KMFIPTablesCompilerFactory::createObject( QObject* parent, const char* name, - const char*, const QStringList & ) { - QObject * obj = new KMFIPTablesCompiler( parent, name ); +TQObject* KMFIPTablesCompilerFactory::createObject( TQObject* tqparent, const char* name, + const char*, const TQStringList & ) { + TQObject * obj = new KMFIPTablesCompiler( tqparent, name ); emit objectCreated( obj ); return obj; } diff --git a/kmyfirewall/compilers/iptables/kmfiptablescompiler.h b/kmyfirewall/compilers/iptables/kmfiptablescompiler.h index 376f7be..f02cacb 100644 --- a/kmyfirewall/compilers/iptables/kmfiptablescompiler.h +++ b/kmyfirewall/compilers/iptables/kmfiptablescompiler.h @@ -19,8 +19,8 @@ */ // QT includes -#include <qstring.h> -#include <qobject.h> +#include <tqstring.h> +#include <tqobject.h> // KDE includes #include <kparts/part.h> @@ -32,7 +32,7 @@ #include "../../core/kmfplugin.h" #include "../../core/kmfcompilerinterface.h" -class QTabWidget; +class TQTabWidget; class KInstance; namespace KMF { @@ -43,16 +43,17 @@ class KMFErrorHandler; class KMFIPTablesCompiler : public KMFPlugin, public virtual KMFCompilerInterface { Q_OBJECT + TQ_OBJECT public: - KMFIPTablesCompiler( QObject* parent, const char* name ); + KMFIPTablesCompiler( TQObject* tqparent, const char* name ); ~KMFIPTablesCompiler(); void compile(); - const QString& compile( KMFGenericDoc* ); - const QString& compile( KMFIPTDoc* ); - const QString& osName(); - const QString& osGUIName(); - const QString& backendName(); - const QString& backendGUIName(); + const TQString& compile( KMFGenericDoc* ); + const TQString& compile( KMFIPTDoc* ); + const TQString& osName(); + const TQString& osGUIName(); + const TQString& backendName(); + const TQString& backendGUIName(); private slots: void slotConvertToIPTDoc(); @@ -61,12 +62,12 @@ private slots: private: KMFErrorHandler *m_errorHandler; - QTabWidget *m_iptWidget; + TQTabWidget *m_iptWidget; KMFListView *m_iptViewFilter, *m_iptViewNat, *m_iptViewMangle; - QString m_osName; - QString m_osGUIName; - QString m_backendName; - QString m_backendGUIName; + TQString m_osName; + TQString m_osGUIName; + TQString m_backendName; + TQString m_backendGUIName; KMFIPTDoc *m_iptdoc; }; @@ -75,14 +76,15 @@ private: class KMFIPTablesCompilerFactory : public KLibFactory { Q_OBJECT + TQ_OBJECT public: - KMFIPTablesCompilerFactory( QObject *parent = 0, const char *name = 0 ); + KMFIPTablesCompilerFactory( TQObject *tqparent = 0, const char *name = 0 ); virtual ~KMFIPTablesCompilerFactory() { /* delete s_instance; */ }; - virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, - const char* name = "QObject", - const QStringList &args = QStringList() ); + virtual TQObject* createObject( TQObject* tqparent = 0, const char* pname = 0, + const char* name = TQOBJECT_OBJECT_NAME_STRING, + const TQStringList &args = TQStringList() ); /* static KInstance* instance(); */ /*private: diff --git a/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.cpp b/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.cpp index f7b8c22..680228b 100644 --- a/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.cpp +++ b/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.cpp @@ -49,7 +49,7 @@ KMFIPTablesDocumentConverter::~KMFIPTablesDocumentConverter() {} KMFIPTDoc* KMFIPTablesDocumentConverter::compileToIPTDoc( KMFGenericDoc* doc ) { - kdDebug() << "const QString& KMFIPTablesCompiler::compileToIPTDoc( KMFGenericDoc* doc )" << endl; + kdDebug() << "const TQString& KMFIPTablesCompiler::compileToIPTDoc( KMFGenericDoc* doc )" << endl; if ( ! doc ) { kdDebug() << "No document Available to compile" << endl; return 0; @@ -103,10 +103,10 @@ void KMFIPTablesDocumentConverter::setupConnectionTracking( KMFIPTDoc* doc ) { if ( ! m_errorHandler->showError( m_err ) ) { return; } - QPtrList<QString> args; - args.append( new QString(XML::BoolOn_Value) ); - args.append( new QString("RELATED,ESTABLISHED") ); - QString opt = "state_opt"; + TQPtrList<TQString> args; + args.append( new TQString(XML::BoolOn_Value) ); + args.append( new TQString("RELATED,ESTABLISHED") ); + TQString opt = "state_opt"; rule->addRuleOption( opt, args ); rule->setTarget( "ACCEPT" ); rule->setDescription( i18n( "This rule enables connection tracking\n" @@ -127,17 +127,17 @@ void KMFIPTablesDocumentConverter::setupLocalhostRules( KMFGenericDoc* gendoc, if ( ! m_errorHandler->showError( m_err ) ) { return; } - QPtrList<QString> args; - args.append( new QString( Constants::Localhost_IP ) ); - args.append( new QString( XML::BoolOff_Value ) ); - QString opt = "ip_opt"; + TQPtrList<TQString> args; + args.append( new TQString( Constants::Localhost_IP ) ); + args.append( new TQString( XML::BoolOff_Value ) ); + TQString opt = "ip_opt"; rule->addRuleOption( opt, args ); rule->setTarget( "ACCEPT" ); args.clear(); opt = "interface_opt"; - args.append( new QString( "lo" ) ); - args.append( new QString( XML::BoolOff_Value ) ); + args.append( new TQString( "lo" ) ); + args.append( new TQString( XML::BoolOff_Value ) ); rule->addRuleOption( opt, args ); rule->setDescription( i18n( "Allows all localhost traffic" ) ); @@ -151,8 +151,8 @@ void KMFIPTablesDocumentConverter::setupLocalhostRules( KMFGenericDoc* gendoc, args.clear(); opt = "interface_opt"; - args.append( new QString( XML::BoolOff_Value ) ); - args.append( new QString( "lo" ) ); + args.append( new TQString( XML::BoolOff_Value ) ); + args.append( new TQString( "lo" ) ); rule->addRuleOption( opt, args ); rule->setTarget( "ACCEPT" ); rule->setDescription( i18n( "Allows all localhost traffic" ) ); @@ -174,18 +174,18 @@ void KMFIPTablesDocumentConverter::setupPolicies( KMFGenericDoc* gendoc, KMFIPTD } } -void KMFIPTablesDocumentConverter::addToChains( KMFNetZone* zone, KMFIPTDoc* doc, IPTChain* chain, const QString& root_chain ) { - QPtrList<KMFNetZone>& children = zone->zones(); - QPtrListIterator<KMFNetZone> it( children ); +void KMFIPTablesDocumentConverter::addToChains( KMFNetZone* zone, KMFIPTDoc* doc, IPTChain* chain, const TQString& root_chain ) { + TQPtrList<KMFNetZone>& tqchildren = zone->zones(); + TQPtrListIterator<KMFNetZone> it( tqchildren ); static int i = 0; while( it.current() ) { addToChains( it.current(), doc, chain, root_chain ); ++it; } IPTable *table = doc->table( Constants::FilterTable_Name ); - QString num = ""; + TQString num = ""; num.setNum( i ); - QString name = ""; + TQString name = ""; if ( root_chain == Constants::InputChain_Name ) { name = "IZ_" + num; @@ -194,7 +194,7 @@ void KMFIPTablesDocumentConverter::addToChains( KMFNetZone* zone, KMFIPTDoc* doc } name.stripWhiteSpace(); - QString target = "ACCEPT"; + TQString target = "ACCEPT"; if ( zone->address()->toString() != "0.0.0.0" ) { table->addChain( name, target, false, m_err ); if ( ! m_errorHandler->showError( m_err ) ) @@ -210,7 +210,7 @@ void KMFIPTablesDocumentConverter::addToChains( KMFNetZone* zone, KMFIPTDoc* doc return; rule->setDescription( i18n( "This rule forwards all traffic to\n" "chain: %1 which handles traffic for\n" - "zone: %2.").arg( name ).arg( zone->guiName() ) ); + "zone: %2.").tqarg( name ).tqarg( zone->guiName() ) ); i++; if ( ! rule ) { kdDebug() << "KMFIPTablesCompiler: WARNING Couldn't create rule: Feed in chain: " << chain->name() << endl; @@ -221,17 +221,17 @@ void KMFIPTablesDocumentConverter::addToChains( KMFNetZone* zone, KMFIPTDoc* doc kdDebug() << "KMFIPTablesCompiler: WARNING Couldn't find chain: " << name << endl; return; } - ch->setDescription( i18n("The Chain created to handle\nrules defined in zone %1.").arg( zone->guiName() ) ); + ch->setDescription( i18n("The Chain created to handle\nrules defined in zone %1.").tqarg( zone->guiName() ) ); - QPtrList<QString> args; + TQPtrList<TQString> args; if ( root_chain == Constants::InputChain_Name ) { - args.append( new QString( zone->address()->toString()+"/"+zone->mask()->toString() ) ); - args.append( new QString( XML::BoolOff_Value ) ); + args.append( new TQString( zone->address()->toString()+"/"+zone->tqmask()->toString() ) ); + args.append( new TQString( XML::BoolOff_Value ) ); } else if ( root_chain == Constants::OutputChain_Name ) { - args.append( new QString( XML::BoolOff_Value ) ); - args.append( new QString( zone->address()->toString()+"/"+zone->mask()->toString() ) ); + args.append( new TQString( XML::BoolOff_Value ) ); + args.append( new TQString( zone->address()->toString()+"/"+zone->tqmask()->toString() ) ); } - QString s ="ip_opt"; + TQString s ="ip_opt"; rule->addRuleOption( s , args ); rule->setTarget( name ); createRules( zone, ch, root_chain ); @@ -240,9 +240,9 @@ void KMFIPTablesDocumentConverter::addToChains( KMFNetZone* zone, KMFIPTDoc* doc } } -void KMFIPTablesDocumentConverter::createRules( KMFNetZone* zone, IPTChain* chain, const QString& root_chain ) { - QPtrList<KMFProtocolUsage>& prots = zone->protocols(); - QPtrListIterator<KMFProtocolUsage> it ( prots ); +void KMFIPTablesDocumentConverter::createRules( KMFNetZone* zone, IPTChain* chain, const TQString& root_chain ) { + TQPtrList<KMFProtocolUsage>& prots = zone->protocols(); + TQPtrListIterator<KMFProtocolUsage> it ( prots ); while ( it.current() ) { KMFProtocolUsage* prot = it.current(); if ( ! zone->protocolInherited( prot->protocol()->uuid() ) ) { @@ -253,13 +253,13 @@ void KMFIPTablesDocumentConverter::createRules( KMFNetZone* zone, IPTChain* chai ++it; } - QPtrList<KMFTarget>& hosts = zone->hosts(); - QPtrListIterator<KMFTarget> it2 ( hosts ); + TQPtrList<KMFTarget>& hosts = zone->hosts(); + TQPtrListIterator<KMFTarget> it2 ( hosts ); while ( it2.current() ) { KMFNetHost* host = dynamic_cast<KMFNetHost*> ( it2.current() ); kdDebug() << "Will create rules for host: " << host->guiName() << " in zone:" << zone->guiName() << endl; - QPtrList<KMFProtocolUsage>& prots = host->protocols(); - QPtrListIterator<KMFProtocolUsage> it3 ( prots ); + TQPtrList<KMFProtocolUsage>& prots = host->protocols(); + TQPtrListIterator<KMFProtocolUsage> it3 ( prots ); while ( it3.current() ) { KMFProtocolUsage* protUsage = it3.current(); kdDebug() << "Found Stored Usage" << endl; @@ -278,8 +278,8 @@ void KMFIPTablesDocumentConverter::createRules( KMFNetZone* zone, IPTChain* chai void KMFIPTablesDocumentConverter::createZoneProtocolRules( IPTChain* chain, KMFProtocolUsage* prot ) { kdDebug() << "void KMFIPTablesCompiler::createProtocolRules( ITPChain* chain, KMFProtocol* protocol )" << endl; - const QString& tcpPorts = prot->protocol()->tcpPortsList(); - const QString& udpPorts = prot->protocol()->udpPortsList(); + const TQString& tcpPorts = prot->protocol()->tcpPortsList(); + const TQString& udpPorts = prot->protocol()->udpPortsList(); if ( ! tcpPorts.isEmpty() ) { createZoneProtocol( chain, prot, "tcp", tcpPorts ); } @@ -288,17 +288,17 @@ void KMFIPTablesDocumentConverter::createZoneProtocolRules( IPTChain* chain, KMF } } -void KMFIPTablesDocumentConverter::createZoneProtocol( IPTChain* chain, KMFProtocolUsage* prot, const QString& option, const QString& ports ) { - kdDebug() << "void KMFIPTablesCompiler::createProtocol( IPTChain*, const QString& option, QStringList ports )" << endl; - QString s; - QPtrList<QString> args; +void KMFIPTablesDocumentConverter::createZoneProtocol( IPTChain* chain, KMFProtocolUsage* prot, const TQString& option, const TQString& ports ) { + kdDebug() << "void KMFIPTablesCompiler::createProtocol( IPTChain*, const TQString& option, TQStringList ports )" << endl; + TQString s; + TQPtrList<TQString> args; args.clear(); - args.append( new QString( XML::BoolOn_Value ) ); - args.append( new QString( XML::BoolOff_Value ) ); + args.append( new TQString( XML::BoolOn_Value ) ); + args.append( new TQString( XML::BoolOff_Value ) ); IPTRule* rule; rule = chain->addRule( prot->protocol()->name()+ "_" + option , m_err ); - if ( ports.contains( "," ) > 0 ) { + if ( ports.tqcontains( "," ) > 0 ) { s = option + "_multiport_opt"; } else { s = option + "_opt"; @@ -309,11 +309,11 @@ void KMFIPTablesDocumentConverter::createZoneProtocol( IPTChain* chain, KMFProto rule->addRuleOption( s , args ); rule->setDescription( i18n( "Allow Protocol: %1\n" - "Protocol Description: %2" ).arg( prot->protocol()->name( ) ).arg( prot->protocol()->description() ) ); + "Protocol Description: %2" ).tqarg( prot->protocol()->name( ) ).tqarg( prot->protocol()->description() ) ); rule->setDescription( prot->protocol()->description() ); - args.append( new QString( ports ) ); + args.append( new TQString( ports ) ); rule->addRuleOption( s, args ); if ( prot->logging() ) { @@ -323,22 +323,22 @@ void KMFIPTablesDocumentConverter::createZoneProtocol( IPTChain* chain, KMFProto if ( prot->limit() > 0 ) { s = "limit_opt"; args.clear(); - args.append( new QString(XML::BoolOn_Value) ); - QString limit; + args.append( new TQString(XML::BoolOn_Value) ); + TQString limit; limit.setNum( prot->limit() ); limit += "/" + prot->limitInterval(); kdDebug() << "Setting limit: " << limit << endl; - args.append( new QString( limit ) ); + args.append( new TQString( limit ) ); rule->addRuleOption( s, args ); } rule->setTarget("ACCEPT"); } -void KMFIPTablesDocumentConverter::createHostProtocolRules( IPTChain* chain, KMFNetHost* host, KMFProtocolUsage* prot, const QString& root_chain ) { +void KMFIPTablesDocumentConverter::createHostProtocolRules( IPTChain* chain, KMFNetHost* host, KMFProtocolUsage* prot, const TQString& root_chain ) { kdDebug() << "void KMFIPTablesCompiler::createProtocolRules( ITPChain* chain, KMFProtocol* protocol )" << endl; - const QString& tcpPorts = prot->protocol()->tcpPortsList(); - const QString& udpPorts = prot->protocol()->udpPortsList(); + const TQString& tcpPorts = prot->protocol()->tcpPortsList(); + const TQString& udpPorts = prot->protocol()->udpPortsList(); if ( ! tcpPorts.isEmpty() ) { createHostProtocol( chain, host, prot, "tcp", tcpPorts, root_chain ); } @@ -347,35 +347,35 @@ void KMFIPTablesDocumentConverter::createHostProtocolRules( IPTChain* chain, KMF } } -void KMFIPTablesDocumentConverter::createHostProtocol( IPTChain* chain, KMFNetHost* host, KMFProtocolUsage* prot, const QString& option, const QString& ports, const QString& root_chain ) { - kdDebug() << "void KMFIPTablesCompiler::createProtocol( IPTChain*, const QString& option, QStringList ports )" << endl; - QString s; - QPtrList<QString> args; +void KMFIPTablesDocumentConverter::createHostProtocol( IPTChain* chain, KMFNetHost* host, KMFProtocolUsage* prot, const TQString& option, const TQString& ports, const TQString& root_chain ) { + kdDebug() << "void KMFIPTablesCompiler::createProtocol( IPTChain*, const TQString& option, TQStringList ports )" << endl; + TQString s; + TQPtrList<TQString> args; args.clear(); - args.append( new QString( XML::BoolOn_Value ) ); - args.append( new QString( XML::BoolOff_Value ) ); + args.append( new TQString( XML::BoolOn_Value ) ); + args.append( new TQString( XML::BoolOff_Value ) ); static int i = 0; IPTRule* rule; - QString hn = ""; + TQString hn = ""; hn = hn.setNum( i ); i++; hn = "H" + hn; rule = chain->addRule( hn + "_" + prot->protocol()->name() + "_" + option , m_err ); - if ( ports.contains( "," ) > 0 ) { + if ( ports.tqcontains( "," ) > 0 ) { s = option + "_multiport_opt"; } else { s = option + "_opt"; } rule->setDescription( i18n( "Rule created to apply filters for host: %1\n" "Allow Protocol: %2\n" - "Protocol Description: %3" ).arg( host->guiName() ).arg( prot->protocol()->name( ) ).arg( prot->protocol()->description() ) ); + "Protocol Description: %3" ).tqarg( host->guiName() ).tqarg( prot->protocol()->name( ) ).tqarg( prot->protocol()->description() ) ); if ( ! m_errorHandler->showError( m_err ) ) return; rule->addRuleOption( s , args ); - args.append( new QString( ports ) ); + args.append( new TQString( ports ) ); rule->addRuleOption( s, args ); if ( prot->logging() ) { @@ -385,55 +385,55 @@ void KMFIPTablesDocumentConverter::createHostProtocol( IPTChain* chain, KMFNetHo if ( prot->limit() > 0 ) { s = "limit_opt"; args.clear(); - args.append( new QString(XML::BoolOn_Value) ); - QString limit; + args.append( new TQString(XML::BoolOn_Value) ); + TQString limit; limit.setNum( prot->limit() ); limit += "/" + prot->limitInterval(); kdDebug() << "Setting limit: " << limit << endl; - args.append( new QString( limit ) ); + args.append( new TQString( limit ) ); rule->addRuleOption( s, args ); } args.clear(); if ( root_chain == Constants::OutputChain_Name ) { - args.append( new QString( XML::BoolOff_Value ) ); + args.append( new TQString( XML::BoolOff_Value ) ); } s = "ip_opt"; - args.append( new QString( host->address()->toString() ) ); + args.append( new TQString( host->address()->toString() ) ); rule->addRuleOption( s, args ); rule->setTarget("ACCEPT"); } -void KMFIPTablesDocumentConverter::setupInAndOutHosts( KMFIPTDoc* iptdoc, KMFNetZone* zone, const QString& target ) { +void KMFIPTablesDocumentConverter::setupInAndOutHosts( KMFIPTDoc* iptdoc, KMFNetZone* zone, const TQString& target ) { kdDebug() << "KMFIPTablesCompiler::setupTrustedHosts( KMFNetZone* )" << endl; - QPtrListIterator<KMFTarget> it ( zone->hosts() ); + TQPtrListIterator<KMFTarget> it ( zone->hosts() ); int i = 0; while ( it.current() ) { KMFNetHost *host = dynamic_cast<KMFNetHost*> ( *it ); IPTable *table = iptdoc->table( Constants::FilterTable_Name ); IPTChain *chain; IPTRule *rule; - QString ruleName = ""; + TQString ruleName = ""; ruleName = ruleName.setNum( i ); if ( target == "ACCEPT" ) { ruleName = "Trusted_" + ruleName; } else { ruleName = "Malicious_" + ruleName; } - QString opt = "ip_opt"; - QPtrList<QString> args; + TQString opt = "ip_opt"; + TQPtrList<TQString> args; chain = table->chainForName( Constants::InputChain_Name ); rule = chain->addRule( ruleName, m_err ); if ( ! m_errorHandler->showError( m_err ) ) return; - args.append( new QString( host->address()->toString() ) ); + args.append( new TQString( host->address()->toString() ) ); rule->addRuleOption( opt, args ); if ( target == "ACCEPT" ) { - rule->setDescription( i18n("This rule allows incoming packets from trusted host: %1.").arg( host->guiName() ) ); + rule->setDescription( i18n("This rule allows incoming packets from trusted host: %1.").tqarg( host->guiName() ) ); } else { - rule->setDescription( i18n("This rule drops incoming packets from malicious host: %1.").arg( host->guiName() ) ); + rule->setDescription( i18n("This rule drops incoming packets from malicious host: %1.").tqarg( host->guiName() ) ); } rule->setTarget( target ); @@ -445,16 +445,16 @@ void KMFIPTablesDocumentConverter::setupInAndOutHosts( KMFIPTDoc* iptdoc, KMFNet chain = table->chainForName( Constants::OutputChain_Name ); rule = chain->addRule( ruleName, m_err ); args.clear(); - args.append( new QString( XML::BoolOff_Value ) ); - args.append( new QString( host->address()->toString() ) ); + args.append( new TQString( XML::BoolOff_Value ) ); + args.append( new TQString( host->address()->toString() ) ); rule->addRuleOption( opt, args ); if ( ! m_errorHandler->showError( m_err ) ) return; if ( target == "ACCEPT" ) { - rule->setDescription( i18n("This rule allows outgoing packets to trusted host: %1.").arg( host->guiName() ) ); + rule->setDescription( i18n("This rule allows outgoing packets to trusted host: %1.").tqarg( host->guiName() ) ); } else { - rule->setDescription( i18n("This rule drops outgoing packets to malicious host: %1.").arg( host->guiName() ) ); + rule->setDescription( i18n("This rule drops outgoing packets to malicious host: %1.").tqarg( host->guiName() ) ); } rule->setTarget( target ); @@ -466,23 +466,23 @@ void KMFIPTablesDocumentConverter::setupInAndOutHosts( KMFIPTDoc* iptdoc, KMFNet } } -void KMFIPTablesDocumentConverter::setupForbiddenHosts( KMFIPTDoc* iptdoc , KMFNetZone* zone, const QString& inOut ) { - QPtrListIterator<KMFTarget> it ( zone->hosts() ); +void KMFIPTablesDocumentConverter::setupForbiddenHosts( KMFIPTDoc* iptdoc , KMFNetZone* zone, const TQString& inOut ) { + TQPtrListIterator<KMFTarget> it ( zone->hosts() ); int i = 0; while ( it.current() ) { KMFNetHost *host = dynamic_cast<KMFNetHost*> ( *it ); IPTable *table = iptdoc->table( Constants::FilterTable_Name ); IPTChain *chain; IPTRule *rule; - QString ruleName = ""; + TQString ruleName = ""; ruleName = ruleName.setNum( i ); if ( inOut == "in" ) { ruleName = "ForbiddenClient_" + ruleName; } else { ruleName = "ForbiddenServer_" + ruleName; } - QString opt = "ip_opt"; - QPtrList<QString> args; + TQString opt = "ip_opt"; + TQPtrList<TQString> args; if ( inOut == "in" ) { chain = table->chainForName( Constants::InputChain_Name ); @@ -494,14 +494,14 @@ void KMFIPTablesDocumentConverter::setupForbiddenHosts( KMFIPTDoc* iptdoc , KMFN return; if ( inOut == "out" ) { - args.append( new QString(XML::BoolOff_Value) ); + args.append( new TQString(XML::BoolOff_Value) ); } - args.append( new QString( host->address()->toString() ) ); + args.append( new TQString( host->address()->toString() ) ); rule->addRuleOption( opt, args ); if ( inOut =="in" ) { - rule->setDescription( i18n("This rule drops packets from forbidden client: %1.").arg( host->guiName() ) ); + rule->setDescription( i18n("This rule drops packets from forbidden client: %1.").tqarg( host->guiName() ) ); } else { - rule->setDescription( i18n("This rule drops packets to forbidden server: %1.").arg( host->guiName() ) ); + rule->setDescription( i18n("This rule drops packets to forbidden server: %1.").tqarg( host->guiName() ) ); } rule->setTarget( "DROP" ); if ( inOut =="in" ) { @@ -543,22 +543,22 @@ void KMFIPTablesDocumentConverter::setupNatRules( KMFGenericDoc* doc, KMFIPTDoc* rule->setDescription( i18n("Rule created for setting up\nthe nat router functionality.") ); - QString opt = "interface_opt"; - QPtrList<QString> args; - args.append( new QString( XML::BoolOff_Value ) ); - args.append( new QString( doc->outgoingInterface() ) ); + TQString opt = "interface_opt"; + TQPtrList<TQString> args; + args.append( new TQString( XML::BoolOff_Value ) ); + args.append( new TQString( doc->outgoingInterface() ) ); rule->addRuleOption( opt, args ); setupNatTarget( doc, rule ); } void KMFIPTablesDocumentConverter::setupNatTarget( KMFGenericDoc* doc, IPTRule* rule ) { if ( doc->useMasquerade() ) { - rule->setTarget( "MASQUERADE" ); + rule->setTarget( "MASTQUERADE" ); } else { rule->setTarget( "SNAT" ); - QString opt = "target_snat_opt"; - QPtrList<QString> args; - args.append( new QString( doc->natAddress()->toString() ) ); + TQString opt = "target_snat_opt"; + TQPtrList<TQString> args; + args.append( new TQString( doc->natAddress()->toString() ) ); rule->addRuleOption( opt, args ); } } @@ -592,9 +592,9 @@ void KMFIPTablesDocumentConverter::setupLogging( KMFGenericDoc* doc, KMFIPTDoc* } void KMFIPTablesDocumentConverter::setupLoggingRules( KMFGenericDoc* doc, IPTChain* chain ) { - QString limit = ""; - QString burst = ""; - QString prefix = doc->logPrefix(); + TQString limit = ""; + TQString burst = ""; + TQString prefix = doc->logPrefix(); if ( doc->limitLog() ) { limit = "5/second"; @@ -625,19 +625,19 @@ void KMFIPTablesDocumentConverter::setupICMPRules( KMFGenericDoc* doc, KMFIPTDoc return; } rule->setDescription( i18n("Rule to setup the ICMP Ping policy.") ); - QString opt = "icmp_opt"; - QPtrList<QString> args; - args.append( new QString( XML::BoolOn_Value ) ); - args.append( new QString( "echo-request" ) ); + TQString opt = "icmp_opt"; + TQPtrList<TQString> args; + args.append( new TQString( XML::BoolOn_Value ) ); + args.append( new TQString( "echo-request" ) ); rule->addRuleOption( opt, args ); rule->setTarget( "ACCEPT" ); if ( doc->limitPingReply() ) { args.clear(); - QString opt = "limit_opt"; - args.append( new QString( XML::BoolOn_Value ) ); - args.append( new QString( "5/second" ) ); - args.append( new QString( "5" ) ); + TQString opt = "limit_opt"; + args.append( new TQString( XML::BoolOn_Value ) ); + args.append( new TQString( "5/second" ) ); + args.append( new TQString( "5" ) ); rule->addRuleOption( opt, args ); } @@ -654,10 +654,10 @@ void KMFIPTablesDocumentConverter::setupICMPRules( KMFGenericDoc* doc, KMFIPTDoc return; } rule->setDescription( i18n("Rule to setup the ICMP Ping policy.") ); - QString opt = "icmp_opt"; + TQString opt = "icmp_opt"; args.clear(); - args.append( new QString( XML::BoolOn_Value ) ); - args.append( new QString( "echo-request" ) ); + args.append( new TQString( XML::BoolOn_Value ) ); + args.append( new TQString( "echo-request" ) ); rule->addRuleOption( opt, args ); rule->setTarget( "ACCEPT" ); } diff --git a/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.h b/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.h index 51462b7..41acea0 100644 --- a/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.h +++ b/kmyfirewall/compilers/iptables/kmfiptablesdocumentconverter.h @@ -16,9 +16,9 @@ @author Christian Hubinger */ -#include <qstring.h> -#include <qstringlist.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqvaluelist.h> namespace KMF { @@ -43,17 +43,17 @@ public: KMFIPTDoc* compileToIPTDoc( KMFGenericDoc* doc ); private: - void addToChains( KMFNetZone*, KMFIPTDoc* , IPTChain*, const QString& ); - void createRules( KMFNetZone*, IPTChain*, const QString& ); + void addToChains( KMFNetZone*, KMFIPTDoc* , IPTChain*, const TQString& ); + void createRules( KMFNetZone*, IPTChain*, const TQString& ); void setupLocalhostRules( KMFGenericDoc*, KMFIPTDoc* ); void setupConnectionTracking( KMFIPTDoc* ); void setupPolicies( KMFGenericDoc*, KMFIPTDoc* ); void createZoneProtocolRules( IPTChain*, KMFProtocolUsage* ); - void createZoneProtocol( IPTChain*, KMFProtocolUsage* prot , const QString& option, const QString& ports ); - void createHostProtocolRules( IPTChain*, KMFNetHost*, KMFProtocolUsage*, const QString& ); - void createHostProtocol( IPTChain*, KMFNetHost*, KMFProtocolUsage* prot , const QString& option, const QString&, const QString& ); - void setupInAndOutHosts( KMFIPTDoc*, KMFNetZone*, const QString& ); - void setupForbiddenHosts( KMFIPTDoc*, KMFNetZone*, const QString& ); + void createZoneProtocol( IPTChain*, KMFProtocolUsage* prot , const TQString& option, const TQString& ports ); + void createHostProtocolRules( IPTChain*, KMFNetHost*, KMFProtocolUsage*, const TQString& ); + void createHostProtocol( IPTChain*, KMFNetHost*, KMFProtocolUsage* prot , const TQString& option, const TQString&, const TQString& ); + void setupInAndOutHosts( KMFIPTDoc*, KMFNetZone*, const TQString& ); + void setupForbiddenHosts( KMFIPTDoc*, KMFNetZone*, const TQString& ); void setupICMPRules( KMFGenericDoc*, KMFIPTDoc* ); diff --git a/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.cpp b/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.cpp index 961cbc0..e39d4f1 100644 --- a/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.cpp +++ b/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.cpp @@ -13,10 +13,10 @@ #include "kmfiptablesscriptgenerator.h" // QT includes -#include <qptrlist.h> -#include <qstringlist.h> -#include <qmultilineedit.h> -#include <qtabwidget.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqmultilineedit.h> +#include <tqtabwidget.h> // KDE includes #include <kdebug.h> @@ -59,15 +59,15 @@ KMFIPTablesScriptGenerator::~KMFIPTablesScriptGenerator() { } -const QString& KMFIPTablesScriptGenerator::compile( KMFIPTDoc* doc ) { +const TQString& KMFIPTablesScriptGenerator::compile( KMFIPTDoc* doc ) { m_iptDoc = doc; - QString script; - m_stream = new QTextOStream( &script ); + TQString script; + m_stream = new TQTextOStream( &script ); printScriptHeader(); printScriptStartFunction(); printScriptStopFunction(); printScriptExecLogic(); - return *(new QString( script ) ); + return *(new TQString( script ) ); } @@ -247,7 +247,7 @@ void KMFIPTablesScriptGenerator::printScriptTableChainDefinition( IPTable *tbl ) IPTChain* c = tbl->chains().at( i ); if ( !c->isBuildIn() ) { *m_stream << "\n# Create Chain: " + c->name() << endl; - QString s2 = c->createIPTablesChainDefinition(); + TQString s2 = c->createIPTablesChainDefinition(); if ( !s2.isEmpty() ) { *m_stream << s2 << " || { status=\"1\"; echo \"Setting up Chain: " + c->name() + " FAILED !!!\"; echo \"Ann Error occoured! Clearing rules\"; stopFirewall; exit 1; }\n"; } @@ -261,12 +261,12 @@ void KMFIPTablesScriptGenerator::printScriptTableRules( IPTable *tbl ) { IPTChain* c = tbl->chains().at( i ); *m_stream << "\n# Define Rules for Chain: " + c->name() << endl ; *m_stream << printScriptDebug( "Create Rules for Chain: " + c->name() ) + " " << endl; - QPtrList<QStringList> rules = c->createIPTablesChainRules(); - QStringList* curr_rule; - QString rule_name; + TQPtrList<TQStringList> rules = c->createIPTablesChainRules(); + TQStringList* curr_rule; + TQString rule_name; for ( curr_rule = rules.first(); curr_rule; curr_rule = rules.next() ) { rule_name = *curr_rule->at( 0 ); - QString s = *curr_rule->at( 1 ); + TQString s = *curr_rule->at( 1 ); if ( !s.isEmpty() ) { *m_stream << s << " || { status=\"1\"; echo \" Setting up Rule: " + rule_name + " FAILED! Clearing Rules!\"; stopFirewall; exit 1; }\n" << endl; } @@ -301,10 +301,10 @@ void KMFIPTablesScriptGenerator::printScriptModuleLoad() { void KMFIPTablesScriptGenerator::printScriptHeader() { KMFTarget *tg = m_iptDoc->target(); - QString version = KMYFIREWALL_VERSION; - QString copyright_string = COPYRIGHT_STRING; - QString maintainer = MAINTAINER; - QString license = LICENSE; + TQString version = KMYFIREWALL_VERSION; + TQString copyright_string = COPYRIGHT_STRING; + TQString maintainer = MAINTAINER; + TQString license = LICENSE; *m_stream << "#!/bin/sh\n" "#\n" @@ -321,15 +321,15 @@ void KMFIPTablesScriptGenerator::printScriptHeader() { } -const QString& KMFIPTablesScriptGenerator::printScriptDebug( const QString& msg, bool newLine ) { - QString script; +const TQString& KMFIPTablesScriptGenerator::printScriptDebug( const TQString& msg, bool newLine ) { + TQString script; *m_stream << "if [ \"$verbose\" = \"1\" ]; then\n" ; *m_stream << "echo " ; if ( ! newLine ) *m_stream << "-n " ; *m_stream << "\"" + msg +"\"\n"; *m_stream << "fi\n" << endl; - return *(new QString( script ) ); + return *(new TQString( script ) ); } } diff --git a/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.h b/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.h index de789e2..9c11c4c 100644 --- a/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.h +++ b/kmyfirewall/compilers/iptables/kmfiptablesscriptgenerator.h @@ -16,9 +16,9 @@ @author Christian Hubinger */ // QT includes -#include <qstring.h> -#include <qobject.h> -#include <qtextstream.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqtextstream.h> // KDE includes #include <kparts/part.h> @@ -36,7 +36,7 @@ public: ~KMFIPTablesScriptGenerator(); - const QString& compile( KMFIPTDoc* ); + const TQString& compile( KMFIPTDoc* ); private: @@ -49,12 +49,12 @@ private: void printScriptHeader(); void printScriptExecLogic(); - const QString& printScriptDebug( const QString&, bool newLine = true); + const TQString& printScriptDebug( const TQString&, bool newLine = true); private: // DATA KMFIPTDoc *m_iptDoc; - QTextOStream *m_stream; + TQTextOStream *m_stream; }; } #endif diff --git a/kmyfirewall/compilers/pf/kmfpfcompiler.cpp b/kmyfirewall/compilers/pf/kmfpfcompiler.cpp index cfe4f68..1796705 100644 --- a/kmyfirewall/compilers/pf/kmfpfcompiler.cpp +++ b/kmyfirewall/compilers/pf/kmfpfcompiler.cpp @@ -12,9 +12,9 @@ #include "kmfpfcompiler.h" // QT includes -#include <qptrlist.h> -#include <qstringlist.h> -#include <qmultilineedit.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqmultilineedit.h> // KDE includes #include <kdebug.h> @@ -35,7 +35,7 @@ #include "../../kmfwidgets/kmflistview.h" namespace KMF { -KMFPFCompiler::KMFPFCompiler( QObject* parent, const char* name ) : KMFPlugin( parent, name ) { +KMFPFCompiler::KMFPFCompiler( TQObject* tqparent, const char* name ) : KMFPlugin( tqparent, name ) { m_osName = "openbsd"; m_osGUIName = "OpenBSD"; m_backendName = "pf"; @@ -45,7 +45,7 @@ KMFPFCompiler::KMFPFCompiler( QObject* parent, const char* name ) : KMFPlugin( p if ( genericDoc() ) { new KAction( i18n( "Export as &PF (OpenBSD) Script" ), "fileexport", - 0, this, SLOT( slotExportPF() ), actionCollection(), "compile_pf" ); + 0, this, TQT_SLOT( slotExportPF() ), actionCollection(), "compile_pf" ); setXMLFile( "kmfpfcompiler.rc" ); kdDebug() << "KMFPFCompiler: Finished initialisation." << endl; @@ -55,16 +55,16 @@ KMFPFCompiler::KMFPFCompiler( QObject* parent, const char* name ) : KMFPlugin( p KMFPFCompiler::~KMFPFCompiler() {} -const QString& KMFPFCompiler::osName(){ +const TQString& KMFPFCompiler::osName(){ return m_osName; } -const QString& KMFPFCompiler::osGUIName(){ +const TQString& KMFPFCompiler::osGUIName(){ return m_osGUIName; } -const QString& KMFPFCompiler::backendName(){ +const TQString& KMFPFCompiler::backendName(){ return m_backendName; } -const QString& KMFPFCompiler::backendGUIName(){ +const TQString& KMFPFCompiler::backendGUIName(){ return m_backendGUIName; } @@ -77,12 +77,12 @@ void KMFPFCompiler::compile() { void KMFPFCompiler::slotExportPF() { kdDebug() << "KMFPFCompiler::slotExportIPT()" << endl; - QString s = compile( genericDoc() ); + TQString s = compile( genericDoc() ); kdDebug() << "Generated scrip: " << s << endl; } -const QString& KMFPFCompiler::compile( KMFGenericDoc* gendoc ) { - kdDebug() << "const QString& KMFPFCompiler::compile( KMFGenericDoc* doc )" << endl; +const TQString& KMFPFCompiler::compile( KMFGenericDoc* gendoc ) { + kdDebug() << "const TQString& KMFPFCompiler::compile( KMFGenericDoc* doc )" << endl; if ( gendoc ) { m_compiledScript = ""; @@ -102,17 +102,17 @@ const QString& KMFPFCompiler::compile( KMFGenericDoc* gendoc ) { kdDebug() << "Return compiled pf:\n " << m_compiledScript << endl; return m_compiledScript; } else { - return *( new QString( "ERROR: Couldn't compile document - may be wrong type " ) ); + return *( new TQString( "ERROR: Couldn't compile document - may be wrong type " ) ); } } -void KMFPFCompiler::setupInAndOutHosts( KMFNetZone* zone , const QString& cmd ) { +void KMFPFCompiler::setupInAndOutHosts( KMFNetZone* zone , const TQString& cmd ) { kdDebug() << "KMFPFCompiler::setupInAndOutHosts( KMFNetZone* )" << endl; if ( zone->hosts().count() == 0 ) { return; } - QPtrListIterator<KMFTarget> it ( zone->hosts() ); + TQPtrListIterator<KMFTarget> it ( zone->hosts() ); if ( cmd == "pass" ) { m_compiledScript.append( "\n# Trusted Hosts\n" ); } else { @@ -135,12 +135,12 @@ void KMFPFCompiler::setupInAndOutHosts( KMFNetZone* zone , const QString& cmd ) } } -void KMFPFCompiler::setupForbiddenHosts( KMFNetZone* zone, const QString& inOut ) { +void KMFPFCompiler::setupForbiddenHosts( KMFNetZone* zone, const TQString& inOut ) { if ( zone->hosts().count() == 0 ) { return; } - QPtrListIterator<KMFTarget> it ( zone->hosts() ); + TQPtrListIterator<KMFTarget> it ( zone->hosts() ); if ( inOut == "in" ) { m_compiledScript.append( "\n# Forbidden Clients\n" ); } else { @@ -182,31 +182,31 @@ void KMFPFCompiler::createIncommingACCESSRules( KMFNetZone* zone, KMFGenericDoc* return; } if ( zone == 0 ) { - m_compiledScript.append( QString("\n# Settup Inncomming Connection access rules\n") ); + m_compiledScript.append( TQString("\n# Settup Inncomming Connection access rules\n") ); zone = doc->incomingZone(); } - QPtrList<KMFNetZone>& children = zone->zones(); - QPtrListIterator<KMFNetZone> it( children ); + TQPtrList<KMFNetZone>& tqchildren = zone->zones(); + TQPtrListIterator<KMFNetZone> it( tqchildren ); while( it.current() ) { createIncommingACCESSRules( it.current(), doc ); ++it; } - QPtrList<KMFTarget>& zoneHosts = zone->hosts(); - QPtrListIterator<KMFTarget> itZoneHosts ( zoneHosts ); + TQPtrList<KMFTarget>& zoneHosts = zone->hosts(); + TQPtrListIterator<KMFTarget> itZoneHosts ( zoneHosts ); while ( itZoneHosts.current() ) { KMFNetHost* host = dynamic_cast<KMFNetHost*> ( itZoneHosts.current() ); ++itZoneHosts; - m_compiledScript.append( QString("\n# Settup rules for host %1 [%2]\n").arg( host->guiName() ).arg( zone->address()->toString() ) ); + m_compiledScript.append( TQString("\n# Settup rules for host %1 [%2]\n").tqarg( host->guiName() ).tqarg( zone->address()->toString() ) ); - QPtrList<KMFProtocolUsage>& hostProts = host->protocols(); - QPtrListIterator<KMFProtocolUsage> itHostProtocols ( hostProts ); + TQPtrList<KMFProtocolUsage>& hostProts = host->protocols(); + TQPtrListIterator<KMFProtocolUsage> itHostProtocols ( hostProts ); while ( itHostProtocols.current() ) { KMFProtocolUsage* prot = itHostProtocols.current(); ++itHostProtocols; if ( ! host->protocolInherited( prot->protocol()->uuid() ) ) { - m_compiledScript.append( QString("# Settup rules for protocol %1\n").arg( prot->protocol()->name() ) ); + m_compiledScript.append( TQString("# Settup rules for protocol %1\n").tqarg( prot->protocol()->name() ) ); if ( prot->protocol()->tcpPorts().count() > 0 ) { m_compiledScript.append( "pass in " ); if ( prot->logging() || host->logIncoming() ) { @@ -239,14 +239,14 @@ void KMFPFCompiler::createIncommingACCESSRules( KMFNetZone* zone, KMFGenericDoc* } } - m_compiledScript.append( QString("\n# Settup rules for zone %1 [%2/%3]\n").arg( zone->guiName() ).arg( zone->address()->toString() ).arg( zone->maskLength() ) ); - QPtrList<KMFProtocolUsage>& zoneProts = zone->protocols(); - QPtrListIterator<KMFProtocolUsage> itZoneProtocols ( zoneProts ); + m_compiledScript.append( TQString("\n# Settup rules for zone %1 [%2/%3]\n").tqarg( zone->guiName() ).tqarg( zone->address()->toString() ).tqarg( zone->tqmaskLength() ) ); + TQPtrList<KMFProtocolUsage>& zoneProts = zone->protocols(); + TQPtrListIterator<KMFProtocolUsage> itZoneProtocols ( zoneProts ); while ( itZoneProtocols.current() ) { KMFProtocolUsage* prot = itZoneProtocols.current(); ++itZoneProtocols; if ( ! zone->protocolInherited( prot->protocol()->uuid() ) ) { - m_compiledScript.append( QString("# Settup rules for protocol %1\n").arg( prot->protocol()->name() ) ); + m_compiledScript.append( TQString("# Settup rules for protocol %1\n").tqarg( prot->protocol()->name() ) ); if ( prot->protocol()->tcpPorts().count() > 0 ) { m_compiledScript.append( "pass in " ); if ( prot->logging() ) { @@ -255,7 +255,7 @@ void KMFPFCompiler::createIncommingACCESSRules( KMFNetZone* zone, KMFGenericDoc* m_compiledScript.append( " quick inet proto tcp from " ); m_compiledScript.append( zone->address()->toString() ); m_compiledScript.append( "/" ); - m_compiledScript.append( QString::number( zone->maskLength() ) ); + m_compiledScript.append( TQString::number( zone->tqmaskLength() ) ); m_compiledScript.append( " to any " ); m_compiledScript.append( " port " ); m_compiledScript.append( getPortList( prot->protocol()->tcpPorts() ) ); @@ -269,7 +269,7 @@ void KMFPFCompiler::createIncommingACCESSRules( KMFNetZone* zone, KMFGenericDoc* m_compiledScript.append( " quick inet proto udp from " ); m_compiledScript.append( zone->address()->toString() ); m_compiledScript.append( "/" ); - m_compiledScript.append( QString::number( zone->maskLength() ) ); + m_compiledScript.append( TQString::number( zone->tqmaskLength() ) ); m_compiledScript.append( " to any " ); m_compiledScript.append( " port " ); m_compiledScript.append( getPortList( prot->protocol()->udpPorts() ) ); @@ -287,31 +287,31 @@ void KMFPFCompiler::createOutgoingACCESSRules( KMFNetZone* zone, KMFGenericDoc* return; } if ( zone == 0 ) { - m_compiledScript.append( QString("\n# Settup Outgoing Connection access rules\n") ); + m_compiledScript.append( TQString("\n# Settup Outgoing Connection access rules\n") ); zone = doc->outgoingZone(); } - QPtrList<KMFNetZone>& children = zone->zones(); - QPtrListIterator<KMFNetZone> it( children ); + TQPtrList<KMFNetZone>& tqchildren = zone->zones(); + TQPtrListIterator<KMFNetZone> it( tqchildren ); while( it.current() ) { createIncommingACCESSRules( it.current(), doc ); ++it; } - QPtrList<KMFTarget>& zoneHosts = zone->hosts(); - QPtrListIterator<KMFTarget> itZoneHosts ( zoneHosts ); + TQPtrList<KMFTarget>& zoneHosts = zone->hosts(); + TQPtrListIterator<KMFTarget> itZoneHosts ( zoneHosts ); while ( itZoneHosts.current() ) { KMFNetHost* host = dynamic_cast<KMFNetHost*> ( itZoneHosts.current() ); ++itZoneHosts; - m_compiledScript.append( QString("\n# Settup rules for host %1 [%2]\n").arg( host->guiName() ).arg( zone->address()->toString() ) ); + m_compiledScript.append( TQString("\n# Settup rules for host %1 [%2]\n").tqarg( host->guiName() ).tqarg( zone->address()->toString() ) ); - QPtrList<KMFProtocolUsage>& hostProts = host->protocols(); - QPtrListIterator<KMFProtocolUsage> itHostProtocols ( hostProts ); + TQPtrList<KMFProtocolUsage>& hostProts = host->protocols(); + TQPtrListIterator<KMFProtocolUsage> itHostProtocols ( hostProts ); while ( itHostProtocols.current() ) { KMFProtocolUsage* prot = itHostProtocols.current(); ++itHostProtocols; if ( ! host->protocolInherited( prot->protocol()->uuid() ) ) { - m_compiledScript.append( QString("# Settup rules for protocol %1\n").arg( prot->protocol()->name() ) ); + m_compiledScript.append( TQString("# Settup rules for protocol %1\n").tqarg( prot->protocol()->name() ) ); if ( prot->protocol()->tcpPorts().count() > 0 ) { m_compiledScript.append( "pass out " ); if ( prot->logging() || host->logIncoming() ) { @@ -344,14 +344,14 @@ void KMFPFCompiler::createOutgoingACCESSRules( KMFNetZone* zone, KMFGenericDoc* } } - m_compiledScript.append( QString("\n# Settup rules for zone %1 [%2/%3]\n").arg( zone->guiName() ).arg( zone->address()->toString() ).arg( zone->maskLength() ) ); - QPtrList<KMFProtocolUsage>& zoneProts = zone->protocols(); - QPtrListIterator<KMFProtocolUsage> itZoneProtocols ( zoneProts ); + m_compiledScript.append( TQString("\n# Settup rules for zone %1 [%2/%3]\n").tqarg( zone->guiName() ).tqarg( zone->address()->toString() ).tqarg( zone->tqmaskLength() ) ); + TQPtrList<KMFProtocolUsage>& zoneProts = zone->protocols(); + TQPtrListIterator<KMFProtocolUsage> itZoneProtocols ( zoneProts ); while ( itZoneProtocols.current() ) { KMFProtocolUsage* prot = itZoneProtocols.current(); ++itZoneProtocols; if ( ! zone->protocolInherited( prot->protocol()->uuid() ) ) { - m_compiledScript.append( QString("# Settup rules for protocol %1\n").arg( prot->protocol()->name() ) ); + m_compiledScript.append( TQString("# Settup rules for protocol %1\n").tqarg( prot->protocol()->name() ) ); if ( prot->protocol()->tcpPorts().count() > 0 ) { m_compiledScript.append( "pass out " ); if ( prot->logging() ) { @@ -360,7 +360,7 @@ void KMFPFCompiler::createOutgoingACCESSRules( KMFNetZone* zone, KMFGenericDoc* m_compiledScript.append( " quick inet proto tcp from " ); m_compiledScript.append( zone->address()->toString() ); m_compiledScript.append( "/" ); - m_compiledScript.append( QString::number( zone->maskLength() ) ); + m_compiledScript.append( TQString::number( zone->tqmaskLength() ) ); m_compiledScript.append( " to any " ); m_compiledScript.append( " port " ); m_compiledScript.append( getPortList( prot->protocol()->tcpPorts() ) ); @@ -374,7 +374,7 @@ void KMFPFCompiler::createOutgoingACCESSRules( KMFNetZone* zone, KMFGenericDoc* m_compiledScript.append( " quick inet proto udp from " ); m_compiledScript.append( zone->address()->toString() ); m_compiledScript.append( "/" ); - m_compiledScript.append( QString::number( zone->maskLength() ) ); + m_compiledScript.append( TQString::number( zone->tqmaskLength() ) ); m_compiledScript.append( " to any " ); m_compiledScript.append( " port " ); m_compiledScript.append( getPortList( prot->protocol()->udpPorts() ) ); @@ -388,12 +388,12 @@ void KMFPFCompiler::createOutgoingACCESSRules( KMFNetZone* zone, KMFGenericDoc* -QString KMFPFCompiler::getPortList( QValueList<int>& list ) { - QString ret = "{"; - QValueList<int>::iterator ports; +TQString KMFPFCompiler::getPortList( TQValueList<int>& list ) { + TQString ret = "{"; + TQValueList<int>::iterator ports; uint i = 0; for( ports = list.begin(); ports != list.end(); ++ports ) { - ret.append( QString::number( *ports ) ); + ret.append( TQString::number( *ports ) ); if ( i != list.count() - 1 ) { ret.append( ", " ); } @@ -422,9 +422,9 @@ void KMFPFCompiler::setupNatRules( KMFGenericDoc* doc ) { m_compiledScript.append( "\n# Setup NAT\n" ); if ( doc->useMasquerade() ) { - m_compiledScript.append( QString("nat on %1 from any to any -> (%2)\n").arg( doc->outgoingInterface() ).arg( doc->outgoingInterface() ) ); + m_compiledScript.append( TQString("nat on %1 from any to any -> (%2)\n").tqarg( doc->outgoingInterface() ).tqarg( doc->outgoingInterface() ) ); } else { - m_compiledScript.append( QString("nat on %1 from any to any -> %2\n").arg( doc->outgoingInterface() ).arg( doc->natAddress()->toString() ) ); + m_compiledScript.append( TQString("nat on %1 from any to any -> %2\n").tqarg( doc->outgoingInterface() ).tqarg( doc->natAddress()->toString() ) ); } @@ -433,14 +433,14 @@ void KMFPFCompiler::setupNatRules( KMFGenericDoc* doc ) { // KInstance* KMFPFCompilerFactory::s_instance = 0L; // KAboutData* KMFPFCompilerFactory::s_about = 0L; -KMFPFCompilerFactory::KMFPFCompilerFactory( QObject* parent, const char* name ) - : KLibFactory( parent, name ) { +KMFPFCompilerFactory::KMFPFCompilerFactory( TQObject* tqparent, const char* name ) + : KLibFactory( tqparent, name ) { // s_instance = new KInstance( "KMFPFCompilerFactory" ); } -QObject* KMFPFCompilerFactory::createObject( QObject* parent, const char* name, - const char*, const QStringList & ) { - QObject * obj = new KMFPFCompiler( parent, name ); +TQObject* KMFPFCompilerFactory::createObject( TQObject* tqparent, const char* name, + const char*, const TQStringList & ) { + TQObject * obj = new KMFPFCompiler( tqparent, name ); emit objectCreated( obj ); return obj; } diff --git a/kmyfirewall/compilers/pf/kmfpfcompiler.h b/kmyfirewall/compilers/pf/kmfpfcompiler.h index 0ba9210..190ef6e 100644 --- a/kmyfirewall/compilers/pf/kmfpfcompiler.h +++ b/kmyfirewall/compilers/pf/kmfpfcompiler.h @@ -19,9 +19,9 @@ */ // QT includes -#include <qstring.h> -#include <qobject.h> -#include <qvaluelist.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqvaluelist.h> // KDE includes #include <kparts/part.h> @@ -45,19 +45,20 @@ class IPTChain; class KMFPFCompiler : public KMFPlugin, public virtual KMFCompilerInterface { Q_OBJECT + TQ_OBJECT public: - KMFPFCompiler( QObject* parent, const char* name ); + KMFPFCompiler( TQObject* tqparent, const char* name ); ~KMFPFCompiler(); void compile(); - const QString& compile( KMFGenericDoc* ); - const QString& osName(); - const QString& osGUIName(); - const QString& backendName(); - const QString& backendGUIName(); + const TQString& compile( KMFGenericDoc* ); + const TQString& osName(); + const TQString& osGUIName(); + const TQString& backendName(); + const TQString& backendGUIName(); private: - void setupInAndOutHosts( KMFNetZone*, const QString& ); - void setupForbiddenHosts( KMFNetZone*, const QString& ); + void setupInAndOutHosts( KMFNetZone*, const TQString& ); + void setupForbiddenHosts( KMFNetZone*, const TQString& ); void setupICMPRules( KMFGenericDoc* ); void setupLocalhostRules(); void setupPolicies( KMFGenericDoc* ); @@ -65,20 +66,20 @@ private: void createIncommingACCESSRules( KMFNetZone*, KMFGenericDoc* ); void createOutgoingACCESSRules( KMFNetZone*, KMFGenericDoc* ); - QString getPortList( QValueList<int>& ); + TQString getPortList( TQValueList<int>& ); -// void addToChains( KMFNetZone*, KMFIPTDoc* , IPTChain*, const QString& ); -// void createRules( KMFNetZone*, IPTChain*, const QString& ); +// void addToChains( KMFNetZone*, KMFIPTDoc* , IPTChain*, const TQString& ); +// void createRules( KMFNetZone*, IPTChain*, const TQString& ); // void setupLocalhostRules( KMFGenericDoc*, KMFIPTDoc* ); // void setupConnectionTracking( KMFIPTDoc* ); // void setupPolicies( KMFGenericDoc*, KMFIPTDoc* ); // void createZoneProtocolRules( IPTChain*, KMFProtocolUsage* ); -// void createZoneProtocol( IPTChain*, KMFProtocolUsage* prot , const QString& option, const QString& ports ); -// void createHostProtocolRules( IPTChain*, KMFNetHost*, KMFProtocolUsage*, const QString& ); -// void createHostProtocol( IPTChain*, KMFNetHost*, KMFProtocolUsage* prot , const QString& option, const QString&, const QString& ); +// void createZoneProtocol( IPTChain*, KMFProtocolUsage* prot , const TQString& option, const TQString& ports ); +// void createHostProtocolRules( IPTChain*, KMFNetHost*, KMFProtocolUsage*, const TQString& ); +// void createHostProtocol( IPTChain*, KMFNetHost*, KMFProtocolUsage* prot , const TQString& option, const TQString&, const TQString& ); // -// void setupForbiddenHosts( KMFIPTDoc*, KMFNetZone*, const QString& ); +// void setupForbiddenHosts( KMFIPTDoc*, KMFNetZone*, const TQString& ); // // void setupICMPRules( KMFGenericDoc*, KMFIPTDoc* ); // @@ -90,12 +91,12 @@ private: private: KMFGenericDoc *m_doc; - QString m_compiledScript; + TQString m_compiledScript; - QString m_osName; - QString m_osGUIName; - QString m_backendName; - QString m_backendGUIName; + TQString m_osName; + TQString m_osGUIName; + TQString m_backendName; + TQString m_backendGUIName; private slots: @@ -114,14 +115,15 @@ private slots: class KMFPFCompilerFactory : public KLibFactory { Q_OBJECT + TQ_OBJECT public: - KMFPFCompilerFactory( QObject *parent = 0, const char *name = 0 ); + KMFPFCompilerFactory( TQObject *tqparent = 0, const char *name = 0 ); virtual ~KMFPFCompilerFactory() { /* delete s_instance; */ }; - virtual QObject* createObject( QObject* parent = 0, const char* pname = 0, - const char* name = "QObject", - const QStringList &args = QStringList() ); + virtual TQObject* createObject( TQObject* tqparent = 0, const char* pname = 0, + const char* name = TQOBJECT_OBJECT_NAME_STRING, + const TQStringList &args = TQStringList() ); /* static KInstance* instance(); */ /*private: diff --git a/kmyfirewall/compilers/pf/kmfpfscriptgenerator.cpp b/kmyfirewall/compilers/pf/kmfpfscriptgenerator.cpp index 9aafaca..ce6b748 100644 --- a/kmyfirewall/compilers/pf/kmfpfscriptgenerator.cpp +++ b/kmyfirewall/compilers/pf/kmfpfscriptgenerator.cpp @@ -13,10 +13,10 @@ #include "kmfpfscriptgenerator.h" // QT includes -#include <qptrlist.h> -#include <qstringlist.h> -#include <qmultilineedit.h> -#include <qtabwidget.h> +#include <tqptrlist.h> +#include <tqstringlist.h> +#include <tqmultilineedit.h> +#include <tqtabwidget.h> // KDE includes #include <kdebug.h> @@ -59,15 +59,15 @@ KMFPFScriptGenerator::~KMFPFScriptGenerator() { } -const QString& KMFPFScriptGenerator::compile( KMFIPTDoc* doc ) { +const TQString& KMFPFScriptGenerator::compile( KMFIPTDoc* doc ) { m_iptDoc = doc; - QString script; - m_stream = new QTextOStream( &script ); + TQString script; + m_stream = new TQTextOStream( &script ); printScriptHeader(); printScriptStartFunction(); printScriptStopFunction(); printScriptExecLogic(); - return *(new QString( script ) ); + return *(new TQString( script ) ); } @@ -152,7 +152,7 @@ void KMFPFScriptGenerator::printScriptTableChainDefinition( IPTable *tbl ) { IPTChain* c = tbl->chains().at( i ); if ( !c->isBuildIn() ) { *m_stream << "\n# Create Chain: " + c->name() << endl; - QString s2 = c->createIPTablesChainDefinition(); + TQString s2 = c->createIPTablesChainDefinition(); if ( !s2.isEmpty() ) { *m_stream << s2 << " || { status=\"1\"; print \"Setting up Chain: " + c->name() + " FAILED !!!\"; print \"Ann Error occoured! Clearing rules\"; stopFirewall; exit 1; }\n"; } @@ -166,12 +166,12 @@ void KMFPFScriptGenerator::printScriptTableRules( IPTable *tbl ) { IPTChain* c = tbl->chains().at( i ); *m_stream << "\n# Define Rules for Chain: " + c->name() << endl ; *m_stream << printScriptDebug( "Create Rules for Chain: " + c->name() ) + " " << endl; - QPtrList<QStringList> rules = c->createIPTablesChainRules(); - QStringList* curr_rule; - QString rule_name; + TQPtrList<TQStringList> rules = c->createIPTablesChainRules(); + TQStringList* curr_rule; + TQString rule_name; for ( curr_rule = rules.first(); curr_rule; curr_rule = rules.next() ) { rule_name = *curr_rule->at( 0 ); - QString s = *curr_rule->at( 1 ); + TQString s = *curr_rule->at( 1 ); if ( !s.isEmpty() ) { *m_stream << s << " || { status=\"1\"; print \" Setting up Rule: " + rule_name + " FAILED! Clearing Rules!\"; stopFirewall; exit 1; }\n" << endl; } @@ -206,10 +206,10 @@ void KMFPFScriptGenerator::printScriptModuleLoad() { void KMFPFScriptGenerator::printScriptHeader() { KMFTarget *tg = m_iptDoc->target(); - QString version = KMYFIREWALL_VERSION; - QString copyright_string = COPYRIGHT_STRING; - QString maintainer = MAINTAINER; - QString license = LICENSE; + TQString version = KMYFIREWALL_VERSION; + TQString copyright_string = COPYRIGHT_STRING; + TQString maintainer = MAINTAINER; + TQString license = LICENSE; *m_stream << "#!/bin/ksh\n" "#\n" @@ -226,15 +226,15 @@ void KMFPFScriptGenerator::printScriptHeader() { } -const QString& KMFPFScriptGenerator::printScriptDebug( const QString& msg, bool newLine ) { - QString script; +const TQString& KMFPFScriptGenerator::printScriptDebug( const TQString& msg, bool newLine ) { + TQString script; *m_stream << "if [ \"$verbose\" = \"1\" ]; then\n" ; *m_stream << "print " ; if ( ! newLine ) *m_stream << "-n " ; *m_stream << "\"" + msg +"\"\n"; *m_stream << "fi\n" << endl; - return *(new QString( script ) ); + return *(new TQString( script ) ); } } diff --git a/kmyfirewall/compilers/pf/kmfpfscriptgenerator.h b/kmyfirewall/compilers/pf/kmfpfscriptgenerator.h index c6c1aea..eeae699 100644 --- a/kmyfirewall/compilers/pf/kmfpfscriptgenerator.h +++ b/kmyfirewall/compilers/pf/kmfpfscriptgenerator.h @@ -16,9 +16,9 @@ @author Christian Hubinger */ // QT includes -#include <qstring.h> -#include <qobject.h> -#include <qtextstream.h> +#include <tqstring.h> +#include <tqobject.h> +#include <tqtextstream.h> // KDE includes #include <kparts/part.h> @@ -36,7 +36,7 @@ public: ~KMFPFScriptGenerator(); - const QString& compile( KMFIPTDoc* ); + const TQString& compile( KMFIPTDoc* ); private: @@ -49,12 +49,12 @@ private: void printScriptHeader(); void printScriptExecLogic(); - const QString& printScriptDebug( const QString&, bool newLine = true); + const TQString& printScriptDebug( const TQString&, bool newLine = true); private: // DATA KMFIPTDoc *m_iptDoc; - QTextOStream *m_stream; + TQTextOStream *m_stream; }; } #endif |