upnpcontrol
changeset 4:f8fa2e5be7d6
showing fwds and adding fwds works on one of my routers - the other one actually crashes on discovery Oo
| author | Konrad Miller <konrad@miller-online.eu> |
|---|---|
| date | Tue, 02 Dec 2008 18:47:45 +0100 |
| parents | 3dfb7d1950bb |
| children | aee889d46b42 |
| files | upnp.cpp upnp.h upnpdialog.cpp upnpdialog.h upnprouter.cpp upnprouter.h |
| diffstat | 6 files changed, 34 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/upnp.cpp Tue Dec 02 13:35:55 2008 +0100 1.2 +++ b/upnp.cpp Tue Dec 02 18:47:45 2008 +0100 1.3 @@ -118,6 +118,7 @@ 1.4 if( r ) 1.5 { 1.6 connect( r, SIGNAL(newRouterForwarding(QString, int)), this, SLOT(slot_newForwarding(QString, int)) ); 1.7 + connect( r, SIGNAL(clearForwardList(const QString&)), this, SIGNAL(clearForwardList(const QString&)) ); 1.8 m_routers.push_back( r ); 1.9 emit newRouterDiscovered( m_routers.size() - 1 ); 1.10 } 1.11 @@ -138,6 +139,11 @@ 1.12 return NULL; 1.13 } 1.14 1.15 + qDebug() << "\n============ i got this router =============="; 1.16 + qDebug() << msg; 1.17 + qDebug() << "============ over and out ==============\n"; 1.18 + 1.19 + 1.20 if( ! line.contains("HTTP") ) 1.21 if( (! line.contains("NOTIFY")) && (! line.contains("200")) ) // it is either a 200 OK or a NOTIFY 1.22 return NULL; // or useless ;-)
2.1 --- a/upnp.h Tue Dec 02 13:35:55 2008 +0100 2.2 +++ b/upnp.h Tue Dec 02 18:47:45 2008 +0100 2.3 @@ -49,6 +49,7 @@ 2.4 signals: 2.5 void newRouterDiscovered ( int num ); 2.6 void newRouterForwarding ( const QString &ip, int fwdnum ); 2.7 + void clearForwardList( const QString & ); 2.8 2.9 private: 2.10 void join_UPnP_MulticastGroup ();
3.1 --- a/upnpdialog.cpp Tue Dec 02 13:35:55 2008 +0100 3.2 +++ b/upnpdialog.cpp Tue Dec 02 18:47:45 2008 +0100 3.3 @@ -13,6 +13,7 @@ 3.4 3.5 connect( &m_upnp, SIGNAL(newRouterDiscovered(int)), this, SLOT(slot_newRouterDiscovered(int)) ); 3.6 connect( &m_upnp, SIGNAL(newRouterForwarding(QString, int)), this, SLOT(slot_newForwarding(QString, int)) ); 3.7 + connect( &m_upnp, SIGNAL(clearForwardList(const QString&)), this, SLOT(slot_clearForwardList(const QString&)) ); 3.8 connect( button_newEntry, SIGNAL(clicked()), this, SLOT(slot_addClicked()) ); 3.9 3.10 m_treewidgetheaders << "Remote Host" << "External Port" << "Protocol" << "Internal Port" 3.11 @@ -22,6 +23,25 @@ 3.12 } 3.13 3.14 3.15 +void UPnPDialog::slot_clearForwardList ( const QString &ip ) 3.16 +{ 3.17 + int tabnum; 3.18 + for( tabnum = 0; tabnum < routertabs->count(); ++tabnum ) 3.19 + { 3.20 + if( routertabs->tabText(tabnum) == ip ) 3.21 + break; 3.22 + } 3.23 + 3.24 + if( routertabs->tabText(tabnum) != ip ) 3.25 + { 3.26 + qDebug() << "we try to clear a router-forward-list for a non-existant router"; 3.27 + return; 3.28 + } 3.29 + 3.30 + ((QTreeWidget*)routertabs->widget(tabnum))->clear(); 3.31 +} 3.32 + 3.33 + 3.34 void UPnPDialog::slot_newRouterDiscovered ( int num ) 3.35 { 3.36 if( num == 0 )
4.1 --- a/upnpdialog.h Tue Dec 02 13:35:55 2008 +0100 4.2 +++ b/upnpdialog.h Tue Dec 02 18:47:45 2008 +0100 4.3 @@ -15,6 +15,7 @@ 4.4 public slots: 4.5 void slot_newRouterDiscovered ( int num ); 4.6 void slot_newForwarding ( const QString &ip, int n ); 4.7 + void slot_clearForwardList ( const QString &ip ); 4.8 void slot_addClicked (); 4.9 4.10 private:
5.1 --- a/upnprouter.cpp Tue Dec 02 13:35:55 2008 +0100 5.2 +++ b/upnprouter.cpp Tue Dec 02 18:47:45 2008 +0100 5.3 @@ -15,7 +15,7 @@ 5.4 , m_location( xml_location ) 5.5 , m_currentForward( 0 ) 5.6 { 5.7 - downloadXmlFile(); 5.8 +// downloadXmlFile(); 5.9 } 5.10 5.11 5.12 @@ -78,7 +78,7 @@ 5.13 QPointer<MiniGetter> getter = new MiniGetter(); 5.14 qDebug() << "getting XML File for " << m_location; 5.15 5.16 - connect( getter, SIGNAL(finished(QPointer<MiniGetter>)), this, SLOT(downloadedXmlFile(QPointer<MiniGetter>)) ); 5.17 + connect( getter, SIGNAL(finished(QPointer<MiniGetter>)), this, SLOT(slot_downloadedXmlFile(QPointer<MiniGetter>)) ); 5.18 getter->wget( m_location, &m_xmldescription ); 5.19 } 5.20 5.21 @@ -164,7 +164,7 @@ 5.22 5.23 qDebug() << "Getting Forward #" << m_currentForward-1 << " from: " << m_location.host() << ":" << m_location.port(); 5.24 5.25 - connect( getter, SIGNAL(finished(QPointer<MiniGetter>)), this, SLOT(downloadedFwd(QPointer<MiniGetter>)) ); 5.26 + connect( getter, SIGNAL(finished(QPointer<MiniGetter>)), this, SLOT(slot_downloadedFwd(QPointer<MiniGetter>)) ); 5.27 getter->soap( m_location, QUrl(m_controlurl), action, query, &m_forward_result ); 5.28 5.29 } 5.30 @@ -290,6 +290,8 @@ 5.31 5.32 if( getter->status() == 200 ) 5.33 { 5.34 + emit clearForwardList( m_location.host() ); 5.35 + m_currentForward = 0; 5.36 downloadFwds(); 5.37 } 5.38 else
6.1 --- a/upnprouter.h Tue Dec 02 13:35:55 2008 +0100 6.2 +++ b/upnprouter.h Tue Dec 02 18:47:45 2008 +0100 6.3 @@ -48,6 +48,7 @@ 6.4 6.5 signals: 6.6 void newRouterForwarding ( const QString &ip, int i ); 6.7 + void clearForwardList ( const QString& ); 6.8 6.9 private slots: 6.10 void slot_downloadedXmlFile ( QPointer<MiniGetter> getter );
