Ticket #9001: upnpdiff.txt

File upnpdiff.txt, 15.8 KB (added by satz@…, 14 years ago)

Patch to allow the backend to use IP addresses instead of hostsnames for UPNP

Line 
1*** ./libs/libmythupnp/Makefile-        2010-09-24 10:13:25.000000000 -0600
2--- ./libs/libmythupnp/Makefile 2010-09-24 13:35:55.000000000 -0600
3***************
4*** 13,19 ****
5  DEFINES       = -DMMX -Di386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
6  CFLAGS        = -pipe -fomit-frame-pointer -O3 -std=c99 -g -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -D_REENTRANT -DPIC -fPIC $(DEFINES)
7  CXXFLAGS      = -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -I/usr/include/directfb -D_REENTRANT -D_REENTRANT -DPIC -fPIC $(DEFINES)
8! INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr/local -I../libmythdb -I.. -I.
9  LINK          = g++
10  LFLAGS        = -Wl,-O1 -shared -Wl,-soname,libmythupnp-0.23.1.so.0
11  LIBS          = $(SUBLIBS)  -L/usr/lib -L../libmythdb -lmythdb-0.23.1 -ldl -lfreetype -lz -L/usr/lib -ldirectfb -lfusion -ldirect -L/usr/X11R6/lib -lXinerama -lX11 -lXext -lXxf86vm -lXv -lXrandr -lXvMCW -lXvMC -lGL -lGLU -lpulse -L/usr/local/lib -lpthread -lQtSql -lQtXml -lQtGui -lQtNetwork -lQtCore
12--- 13,19 ----
13  DEFINES       = -DMMX -Di386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
14  CFLAGS        = -pipe -fomit-frame-pointer -O3 -std=c99 -g -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -D_REENTRANT -DPIC -fPIC $(DEFINES)
15  CXXFLAGS      = -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -I/usr/include/directfb -D_REENTRANT -D_REENTRANT -DPIC -fPIC $(DEFINES)
16! INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr/local -I../libmythdb -I../libmythlivemedia/groupsock/include -I../libmythlivemedia/UsageEnvironment/include -I.. -I.
17  LINK          = g++
18  LFLAGS        = -Wl,-O1 -shared -Wl,-soname,libmythupnp-0.23.1.so.0
19  LIBS          = $(SUBLIBS)  -L/usr/lib -L../libmythdb -lmythdb-0.23.1 -ldl -lfreetype -lz -L/usr/lib -ldirectfb -lfusion -ldirect -L/usr/X11R6/lib -lXinerama -lX11 -lXext -lXxf86vm -lXv -lXrandr -lXvMCW -lXvMC -lGL -lGLU -lpulse -L/usr/local/lib -lpthread -lQtSql -lQtXml -lQtGui -lQtNetwork -lQtCore
20*** ./libs/libmythupnp/upnptasksearch.cpp-      2009-12-30 23:13:25.000000000 -0700
21--- ./libs/libmythupnp/upnptasksearch.cpp       2010-09-24 13:58:07.000000000 -0600
22***************
23*** 30,35 ****
24--- 30,36 ----
25  #include "upnp.h"
26  #include "upnptasksearch.h"
27  #include "compat.h"
28+ #include "GroupsockHelper.hh"
29 
30  /////////////////////////////////////////////////////////////////////////////
31  /////////////////////////////////////////////////////////////////////////////
32***************
33*** 107,115 ****
34                                  it != m_addressList.end();
35                                ++it )
36      {
37          QString sHeader = QString ( "HTTP/1.1 200 OK\r\n"
38                                      "LOCATION: http://%1:%2/getDeviceDesc\r\n" )
39!                             .arg( *it )
40                              .arg( m_nServicePort);
41 
42 
43--- 108,121 ----
44                                  it != m_addressList.end();
45                                ++it )
46      {
47+         char const* str = (*it).toAscii();
48+         NetAddressList addresses( str );
49+       if (addresses.numAddresses() == 0) continue;
50+       struct in_addr anAddress;
51+       anAddress.s_addr = *(in_addr_t*)(addresses.firstAddress()->data());
52          QString sHeader = QString ( "HTTP/1.1 200 OK\r\n"
53                                      "LOCATION: http://%1:%2/getDeviceDesc\r\n" )
54!                           .arg( our_inet_ntoa( anAddress ) )
55                              .arg( m_nServicePort);
56 
57 
58*** ./libs/libmythupnp/upnptasknotify.cpp-      2009-12-30 23:13:25.000000000 -0700
59--- ./libs/libmythupnp/upnptasknotify.cpp       2010-09-24 16:09:12.000000000 -0600
60***************
61*** 36,41 ****
62--- 36,42 ----
63 
64  #include "compat.h"
65  #include "mythverbose.h"
66+ #include "GroupsockHelper.hh"
67 
68  /////////////////////////////////////////////////////////////////////////////
69  /////////////////////////////////////////////////////////////////////////////
70***************
71*** 118,129 ****
72              continue;
73          }
74 
75          QString sHeader = QString( "NOTIFY * HTTP/1.1\r\n"
76                                     "HOST: %1:%2\r\n"   
77                                     "LOCATION: http://%3:%4/getDeviceDesc\r\n" )
78                               .arg( SSDP_GROUP ) // pSocket->address().toString() )
79                               .arg( SSDP_PORT )  // pSocket->port() )
80!                              .arg( *it )
81                               .arg( m_nServicePort);
82 
83          QString  sPacket  = sHeader + sData;
84--- 119,135 ----
85              continue;
86          }
87 
88+         char const* str = (*it).toAscii();
89+         NetAddressList addresses( str );
90+       if (addresses.numAddresses() == 0) continue;
91+       struct in_addr anAddress;
92+       anAddress.s_addr = *(in_addr_t*)(addresses.firstAddress()->data());
93          QString sHeader = QString( "NOTIFY * HTTP/1.1\r\n"
94                                     "HOST: %1:%2\r\n"   
95                                     "LOCATION: http://%3:%4/getDeviceDesc\r\n" )
96                               .arg( SSDP_GROUP ) // pSocket->address().toString() )
97                               .arg( SSDP_PORT )  // pSocket->port() )
98!                            .arg( our_inet_ntoa( anAddress ) )
99                               .arg( m_nServicePort);
100 
101          QString  sPacket  = sHeader + sData;
102*** ./programs/mythbackend/upnpcdsmusic.cpp-    2009-11-17 10:41:55.000000000 -0700
103--- ./programs/mythbackend/upnpcdsmusic.cpp     2010-09-24 18:08:56.000000000 -0600
104***************
105*** 15,20 ****
106--- 15,21 ----
107  #include "upnpcdsmusic.h"
108  #include "httprequest.h"
109  #include "mythcontext.h"
110+ #include "GroupsockHelper.hh"
111 
112  /*
113     Music                            Music
114***************
115*** 288,294 ****
116  //    if (!m_mapBackendPort.contains( sHostName ))
117  //        m_mapBackendPort[ sHostName ] = gContext->GetSettingOnHost("BackendStatusPort", sHostName);
118 
119!     QString sServerIp = gContext->GetSetting( "BackendServerIp"   );
120      QString sPort     = gContext->GetSetting( "BackendStatusPort" );
121 
122      // ----------------------------------------------------------------------
123--- 289,299 ----
124  //    if (!m_mapBackendPort.contains( sHostName ))
125  //        m_mapBackendPort[ sHostName ] = gContext->GetSettingOnHost("BackendStatusPort", sHostName);
126 
127!     char const* str = (gContext->GetSetting( "BackendServerIp" ) ).toAscii();
128!     NetAddressList addresses( str );
129!     struct in_addr anAddress;
130!     anAddress.s_addr = *(in_addr_t*)(addresses.firstAddress()->data());
131!     QString sServerIp = our_inet_ntoa( anAddress );
132      QString sPort     = gContext->GetSetting( "BackendStatusPort" );
133 
134      // ----------------------------------------------------------------------
135*** ./programs/mythbackend/Makefile-    2010-09-24 10:25:53.000000000 -0600
136--- ./programs/mythbackend/Makefile     2010-09-24 17:25:43.000000000 -0600
137***************
138*** 13,19 ****
139  DEFINES       = -DMMX -Di386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DUSING_OSS -DUSING_DVB -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
140  CFLAGS        = -pipe -fomit-frame-pointer -O3 -std=c99 -g -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -D_REENTRANT $(DEFINES)
141  CXXFLAGS      = -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -I/usr/include/directfb -D_REENTRANT -D_REENTRANT $(DEFINES)
142! INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr/local -I../.. -I../../libs -I../../libs/libmyth -I../../libs/libmythtv -I../../libs/libavutil -I../../libs/libavformat -I../../libs/libavcodec -I../../libs/libmythupnp -I../../libs/libmythui -I../../libs/libmythlivemedia -I../../libs/libmythdb -I../../libmythhdhomerun -I../../libs/libmythdvdnav -I/usr/X11R6/include -I.
143  LINK          = g++
144  LFLAGS        = -Wl,-O1
145  LIBS          = $(SUBLIBS)  -L/usr/lib -L../../libs/libmyth -L../../libs/libmythtv -L../../libs/libavutil -L../../libs/libavcodec -L../../libs/libavformat -L../../libs/libswscale -L../../libs/libmythdb -L../../libs/libmythui -L../../libs/libmythupnp -lmythtv-0.23.1 -lmythavformat-0.23.1 -lmythavutil-0.23.1 -lmythavcodec-0.23.1 -lmythswscale-0.23.1 -lmythupnp-0.23.1 -lmythdb-0.23.1 -lmythui-0.23.1 -lmyth-0.23.1 -L../../libs/libmythlivemedia -lmythlivemedia-0.23.1 -L../../libs/libmythfreemheg -lmythfreemheg-0.23.1 -L../../libs/libmythhdhomerun -lmythhdhomerun-0.23.1 -ldl -lfreetype -lz -L/usr/lib -ldirectfb -lfusion -ldirect -L/usr/X11R6/lib -lXinerama -lX11 -lXext -lXxf86vm -lXv -lXrandr -lXvMCW -lXvMC -lpulse -L/usr/local/lib -lpthread -lGLU -lGL -lQtSql -lQtXml -lQtGui -lQtNetwork -lQtCore
146--- 13,19 ----
147  DEFINES       = -DMMX -Di386 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DUSING_OSS -DUSING_DVB -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
148  CFLAGS        = -pipe -fomit-frame-pointer -O3 -std=c99 -g -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wtype-limits -Wundef -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -D_REENTRANT $(DEFINES)
149  CXXFLAGS      = -pipe -fomit-frame-pointer -O3 -g -Wall -Wno-switch -Wpointer-arith -Wredundant-decls -Wno-non-virtual-dtor -funit-at-a-time -D__STDC_CONSTANT_MACROS -I/usr/include/directfb -D_REENTRANT -D_REENTRANT $(DEFINES)
150! INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include -I/usr/local -I../.. -I../../libs -I../../libs/libmyth -I../../libs/libmythtv -I../../libs/libavutil -I../../libs/libavformat -I../../libs/libavcodec -I../../libs/libmythupnp -I../../libs/libmythui -I../../libs/libmythlivemedia -I../../libs/libmythlivemedia/groupsock/include -I../../libs/libmythlivemedia/UsageEnvironment/include -I../../libs/libmythdb -I../../libmythhdhomerun -I../../libs/libmythdvdnav -I/usr/X11R6/include -I.
151  LINK          = g++
152  LFLAGS        = -Wl,-O1
153  LIBS          = $(SUBLIBS)  -L/usr/lib -L../../libs/libmyth -L../../libs/libmythtv -L../../libs/libavutil -L../../libs/libavcodec -L../../libs/libavformat -L../../libs/libswscale -L../../libs/libmythdb -L../../libs/libmythui -L../../libs/libmythupnp -lmythtv-0.23.1 -lmythavformat-0.23.1 -lmythavutil-0.23.1 -lmythavcodec-0.23.1 -lmythswscale-0.23.1 -lmythupnp-0.23.1 -lmythdb-0.23.1 -lmythui-0.23.1 -lmyth-0.23.1 -L../../libs/libmythlivemedia -lmythlivemedia-0.23.1 -L../../libs/libmythfreemheg -lmythfreemheg-0.23.1 -L../../libs/libmythhdhomerun -lmythhdhomerun-0.23.1 -ldl -lfreetype -lz -L/usr/lib -ldirectfb -lfusion -ldirect -L/usr/X11R6/lib -lXinerama -lX11 -lXext -lXxf86vm -lXv -lXrandr -lXvMCW -lXvMC -lpulse -L/usr/local/lib -lpthread -lGLU -lGL -lQtSql -lQtXml -lQtGui -lQtNetwork -lQtCore
154*** ./programs/mythbackend/upnpcdstv.cpp-       2009-12-22 07:16:01.000000000 -0700
155--- ./programs/mythbackend/upnpcdstv.cpp        2010-09-24 21:11:33.000000000 -0600
156***************
157*** 17,22 ****
158--- 17,23 ----
159  #include "storagegroup.h"
160  #include "util.h"
161  #include "mythcontext.h"
162+ #include "GroupsockHelper.hh"
163 
164 
165  /*
166***************
167*** 264,270 ****
168      // ----------------------------------------------------------------------
169 
170      if (!m_mapBackendIp.contains( sHostName ))
171!         m_mapBackendIp[ sHostName ] = gContext->GetSettingOnHost( "BackendServerIp", sHostName);
172 
173      if (!m_mapBackendPort.contains( sHostName ))
174          m_mapBackendPort[ sHostName ] = gContext->GetSettingOnHost("BackendStatusPort", sHostName);
175--- 265,278 ----
176      // ----------------------------------------------------------------------
177 
178      if (!m_mapBackendIp.contains( sHostName ))
179!     {
180!         char const* str = (gContext->GetSettingOnHost( "BackendServerIp", sHostName ) ).toAscii();
181!       cout << "TV BackendServerIp: " << str << endl;
182!         NetAddressList addresses( str );
183!       struct in_addr anAddress;
184!       anAddress.s_addr = *(in_addr_t*)(addresses.firstAddress()->data());
185!         m_mapBackendIp[ sHostName ] = our_inet_ntoa( anAddress );
186!     }
187 
188      if (!m_mapBackendPort.contains( sHostName ))
189          m_mapBackendPort[ sHostName ] = gContext->GetSettingOnHost("BackendStatusPort", sHostName);
190*** ./programs/mythbackend/upnpcdsvideo.cpp-    2009-06-30 14:33:11.000000000 -0600
191--- ./programs/mythbackend/upnpcdsvideo.cpp     2010-09-24 21:41:08.000000000 -0600
192***************
193*** 16,21 ****
194--- 16,22 ----
195  #include "upnpmedia.h"
196  #include "util.h"
197  #include "mythcontext.h"
198+ #include "GroupsockHelper.hh"
199 
200  #define LOC QString("UPnpCDSVideo: ")
201  #define LOC_WARN QString("UPnpCDSVideo, Warning: ")
202***************
203*** 391,398 ****
204      // ----------------------------------------------------------------------
205      // Cache Host ip Address & Port
206      // ----------------------------------------------------------------------
207!     QString sServerIp = gContext->GetSetting("BackendServerIp"   );
208!     QString sPort     = gContext->GetSetting("BackendStatusPort" );
209 
210      // ----------------------------------------------------------------------
211      // Build Support Strings
212--- 392,409 ----
213      // ----------------------------------------------------------------------
214      // Cache Host ip Address & Port
215      // ----------------------------------------------------------------------
216!     if (!m_mapBackendIp.contains( "BackendServerIp" ))
217!     {
218!         char const* str = (gContext->GetSetting( "BackendServerIp" ) ).toAscii();
219!       cout << "Video BackendServerIp: " << str << endl;
220!       NetAddressList addresses( str );
221!       struct in_addr anAddress;
222!       anAddress.s_addr = *(in_addr_t*)(addresses.firstAddress()->data());
223!       m_mapBackendIp[ "BackendServerIp" ] = our_inet_ntoa( anAddress );
224!     }
225!
226!     if (!m_mapBackendPort.contains( "BackendServerIp" ))
227!         m_mapBackendPort[ "BackendServerIp" ] = gContext->GetSetting("BackendStatusPort" );
228 
229      // ----------------------------------------------------------------------
230      // Build Support Strings
231***************
232*** 401,408 ****
233      QString sName      = sTitle;
234 
235      QString sURIBase   = QString( "http://%1:%2/Myth/" )
236!                             .arg( sServerIp )
237!                             .arg( sPort     );
238 
239      QString sURIParams = QString( "/Id%1" ).arg( nVidID );
240      QString sId        = QString( "Videos/0/item%1").arg( sURIParams );
241--- 412,419 ----
242      QString sName      = sTitle;
243 
244      QString sURIBase   = QString( "http://%1:%2/Myth/" )
245!                             .arg( m_mapBackendIp[ "BackendServerIp" ] )
246!                             .arg( m_mapBackendPort[ "BackendServerIp" ]     );
247 
248      QString sURIParams = QString( "/Id%1" ).arg( nVidID );
249      QString sId        = QString( "Videos/0/item%1").arg( sURIParams );