Commit Graph

335 Commits

Author SHA1 Message Date
Fabrice Fontaine
af345c1d2c Adding --disable-notification-reordering option
Adding a configure flag to disable GENA notification reordering as even
with an imillisleep(1), this mechanism consumes too much CPU on embedded
devices when there is a burst of notifications.
(cherry picked from commit c73d870f46)
2010-10-02 13:55:42 -03:00
Fabrice Fontaine
ee8e52ea4a Bug fix when there is no service in embedded devices
When a device with embedded devices (like IGD) when created and one of
the embedded devices did not have any service, there was a Segmentation
Fault (see SF Tracker [ 2688125 ]).
(cherry picked from commit ab54cb3dc5)
2010-09-30 11:52:33 -03:00
Fabrice Fontaine
fe7a073bc7 Bug fix on burst of GENA notification
When a lot of notifications were generated by a device in a short
period of time then 100% of the CPU was used to reorder those
notifications by pushing back the thread in the job queue. This
mechanism has been modified so now thread sleep 1 ms before being
pushed back into the job queue.

Removing DEFAULT_SCHED_PARAM parameter and use
sched_get_priority_min(DEFAULT_POLICY) instead.
(cherry picked from commit c33b11d09f)
2010-09-28 20:44:06 -03:00
Fabrice Fontaine
6567f7ec0d Bug fix on M-SEARCH response
Devices must respond to M-SEARCH requests for any supported version and the
response should specify the same version as was contained in the search target.
Previously, the device did not answer if the M-SEARCH request did not
contain the same version number than the version number of the device.
(cherry picked from commit 4966423d96)
2010-09-22 15:39:05 -03:00
Fabrice Fontaine
5ead3f6fee Add Content-Language iff Accept-Language
Add Content-Language header in the response if and only if there is an Accept-Language header in the request.

Manually ported from revision d2238615e3.
2010-09-21 16:43:59 -03:00
Fabrice Fontaine
82beb315c2 Addition of WEB_SERVER_CONTENT_LANGUAGE parameter
This patch adds the WEB_SERVER_CONTENT_LANGUAGE parameter so the user can specify
the language used by the device during Description and Presentation steps of UPnP
through the HTTP CONTENT-LANGUAGE header.
By default, the WEB_SERVER_CONTENT_LANGUAGE is an empty string so no
CONTENT-LANGUAGE is added.
(cherry picked from commit 2fcbe6df52)
2010-09-21 08:50:18 -03:00
Fabrice Fontaine
4a8c4f5c50 Customize the stack size of the threads used by pupnp through the new THREAD_STACK_SIZE variable
This patch allows a user to customize the stack size of the threads used by
pupnp through the new THREAD_STACK_SIZE variable. This is especially useful
on embedded systems with limited memory where the user can set THREAD_STACK_SIZE
to ITHREAD_STACK_MIN.

However, as this modification can have side effects, I set 0 as the default
value, so threads will continue to use the default stack size of the system
(which varies greatly as stated in
https://computing.llnl.gov/tutorials/pthreads/).
(cherry picked from commit 467f9987a1)
2010-09-18 06:47:34 -03:00
Chandra Penke
ba4ea3bc9b Export upnp/inc/Template*.h 2010-09-18 06:47:06 -03:00
Fabrice Fontaine
935f5af066 Broken IPv6.
IPv6 is currently broken in latest release of branch-1.6.x, so find
a patch attached that correct the issue (small fixes on define,
undef and retVal).
(cherry picked from commit 55d581481f)
2010-09-16 08:23:31 -03:00
Marcelo Roberto Jimenez
123af5a67e Get rid of evil CLIENTONLY macro. 2010-09-15 06:05:02 -03:00
Marcelo Roberto Jimenez
8b801fe1dc White spaces. 2010-09-15 05:59:21 -03:00
Chandra Penke
48985cb81b Fix win32 compilation errors in visual studio
(cherry picked from commit ea00f0f222)
2010-09-15 05:52:57 -03:00
Marcelo Roberto Jimenez
fe778cfd00 Template object for SubscriptionRequest. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
c90d6492e8 Template object for StateVarRequest. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
942e0ec809 Template object for StateVarComplete. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
2616d4c76a Template object for FileInfo. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
86a7ec499a Template object for EventSubscribe. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
43621874e9 Template object for Event. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
9c7bdcffb4 Template object for Discovery. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
5e6b9c119a Template object for ActionRequest. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
c7475fab70 Template object for ActionComplete. 2010-09-12 00:28:35 -03:00
Marcelo Roberto Jimenez
cf79479b2b Introducing template object methods. 2010-09-12 00:28:22 -03:00
Marcelo Roberto Jimenez
81b28fbb90 Added UpnpString_cmp() and UpnpString_casecmp() methods to UpnpString.
UpnpString_set_String() and UpnpString_set_StringN now return error values.
String lenghts are size_t.
2010-09-11 17:53:49 -03:00
David Hoeung
c55eeccb67 Timeout for TCP connect
Hi,

I've made some modification to the libupnp v1.6.5
I've add a timeout for each TCP connect.

It is very useful when an UPnP device stop working and do not accept
connection for an UPnP action.

Modifications are only located in
upnp/src/genlib/net/http/httpreadwrite.c

For every TCP connection, I set the socket to non-blocking, perform
connect,
check result and wait during a timeout if necessary, then reset the
socket to blocking.

Please see this patch in attached file.

I hope it helps.

Regards,

David Hoeung
Consultant Extia
Orange Labs R&D

----
(cherry picked from commit 67009170d1)
2010-09-11 00:20:11 -03:00
Marcelo Roberto Jimenez
fdfcf75690 Remove some unused code plus some coding style in httpparser.c
(cherry picked from commit 0bec9ec1ae)
2010-09-10 19:51:54 -03:00
Marcelo Roberto Jimenez
6604d0a974 SF Patch Tracker [ 2854711 ] Patch for Solaris10 compilation and usage
Submitted By: zephyrus ( zephyrus00jp )

Patch for Solaris10 compilation and usage.
(cherry picked from commit 5755ac022f)
2010-09-10 19:04:35 -03:00
Marcelo Roberto Jimenez
30ee3c0cbb One setp further to stop the CLIENTONLY() mess.
(cherry picked from commit 0158f52ee2)
2010-09-10 19:04:35 -03:00
Chandra Penke
7f1e164a5a SUMMARY: Minor change in comment for SetMaxContentLenght in upnp.h
This is a follow up from issue 6 in tracker id 3056713: calling UpnpSetMaxContentLength() by passing '0' disables the content length checking. This is useful for developing some prototype applications that deal with a lot of XML/SOAP data, and for debugging.

The corresponding c file change is already in the pupnp tree. Copy/pasting the relevant block of code here for clarity:

In upnp/src/genlib/net/http/httpreadwrite.c:

if (g_maxContentLength > 0 && parser->content_length > (unsigned int)g_maxContentLength) {
	*http_error_code = HTTP_REQ_ENTITY_TOO_LARGE;
	line = __LINE__;
	ret = UPNP_E_OUTOF_BOUNDS;
	goto ExitFunction;
}

This block of code checks only does the bounds check if g_maxContentLength > 0, and it's only place g_maxContentLength is checked.

Attached is a patch against the latest sources.
2010-09-10 00:41:17 -03:00
Marcelo Roberto Jimenez
82a6e9f0cc Fix for coding style and compiler warning message:
src/genlib/miniserver/miniserver.c: In function ‘get_miniserver_sockets’:
src/genlib/miniserver/miniserver.c:592: warning: unused variable ‘actual_port6’
src/genlib/miniserver/miniserver.c:582: warning: unused variable ‘__ss_v6’
2010-09-10 00:18:24 -03:00
Chandra Penke
6b0d84fc95 Add support for conditionally enabling ipv6 2010-09-10 00:08:16 -03:00
Chandra Penke
15fb28c622 Fix for compilation in debug builds.
Ensure internal methods are declared as static since debug builds don't inline.
2010-09-10 00:00:00 -03:00
Marcelo Roberto Jimenez
0833b880d4 Fix for UpnpPrintf() in Chandra Penke's last commit.
src/ssdp/ssdp_ctrlpt.c: In function ‘SearchByTarget’:
src/ssdp/ssdp_ctrlpt.c:634: warning: format ‘%s’ expects type ‘char *’, but argument 6 has type ‘int’
(cherry picked from commit 92b241b560)
2010-09-09 23:01:09 -03:00
Chandra Penke
019c57eee0 Fix for regression in SSDP code to send/receive messages over UDP
Sending messages over UDP is broken in some Apple OSes
such as OS X and iOS. This might be broken in other OSes to but didn't
verify.

The fix is to modify the socket lenght argument of sendto to use the correct
sockaddr lenght dependng on whether the socket is IPV4 or IPV6.

Also added some error checks and debugging related to the issue
(cherry picked from commit 2b3ab1799b)
2010-09-09 23:01:09 -03:00
Marcelo Roberto Jimenez
64dedf72a8 Using UpnpReadHttpGet to download large files causes the application to
crash. This happens when the file being downloaded exceeds the device
memory - entirely possible when transferring video files.
The programmatic cause is that the logic implemented in the function
http_ReadHttpGet (which UpnpReadHttpGet calls) reads the entire file
into memory. The fix modifies the existing logic to discard data after
it's been read; there's no reason to keep it around since the caller
of UpnpReadHttpGet already has a copy of it.

This issue exists in 1.6.6 as well as the latest sources.

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 4657e57766)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
a3efd63c5f In the latest sources, http_RequestAndResponse and other methods that
use connect() are broken. More specifically, connect() in these methods
is returning with an EINVAL. The programatic cause is that the address_len
argument passed to connect() is different in IPV4 vs IPV6 (as described in:
http://www.opengroup.org/onlinepubs/009695399/functions/connect.html).
The current code always uses the IPV6 size. The fix modifies each use of
connect() to use the correct size based on the address family being used.

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 21660334e4)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
cf40abd922 Fix compilation error in upnp/src/gena/gena_ctrlpt.c (this is most
likely an error on all platforms).

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 97af8b6fdb)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
4661334870 Fix compilation error in upnp/src/inc/ssdplib.h when compiling in OS X
(the netinet/* headers are not available).

Patch submitted by Chandra (inactiveneurons).
(cherry picked from commit 934bd2682f)
2010-09-07 22:49:34 -03:00
Marcelo Roberto Jimenez
f97315f778 White spaces.
(cherry picked from commit b3b7a91a64)
2010-09-07 11:45:59 -03:00
Marcelo Roberto Jimenez
947599710d Issue regarding the GENA notifications. A string termination indicator was added
at the end of the notification ("\r\n") in notify_send_and_recv() in
upnp/src/gena/gena_device.c.

Patch by Fabrice Fontaine.
(cherry picked from commit ebc941f265)
2010-09-07 11:45:59 -03:00
Marcelo Roberto Jimenez
a15e0c99d7 * upnp/src/api/Discovery.c: Fix a serious bug and memory leak in
UpnpDiscovery_strcpy_DeviceType(). Thanks to David Blanchet for the
patch.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@584 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 11:32:09 +00:00
Marcelo Roberto Jimenez
93a3016df1 Forward port of svn rev. 581: White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@583 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 02:13:34 +00:00
Marcelo Roberto Jimenez
36d6a34f5d Forward port of svn rev. 580:
The last part of Ronan Menard's patch.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@582 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 02:11:44 +00:00
Marcelo Roberto Jimenez
9763158d69 Forward port of svn rev. 578:
* upnp/src/ssdp/ssdp_device.c: Fix for IPV6 ULA/GUA issues.
* upnp/src/ssdp/ssdp_ctrlpt.c: Fix for IPV6 ULA/GUA issues.
* upnp/src/ssdp/ssdp_server.c: Fix for IPV6 ULA/GUA issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@579 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 01:44:25 +00:00
Marcelo Roberto Jimenez
2963919081 Forward port of svn rev. 576:
* upnp/src/genlib/miniserver/miniserver.c: Fix for IPV6 ULA/GUA issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@577 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 22:16:24 +00:00
Marcelo Roberto Jimenez
9f7936781e Forward port of svn rev. 574:
* gena_subscribe(): Fix for IPV6 ULA/GUA issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@575 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:57:40 +00:00
Marcelo Roberto Jimenez
bc724a8073 Forward port of svn rev. 572:
* SOCKET ssdpSock6UlaGua: created variable for later use.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@573 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:43:54 +00:00
Marcelo Roberto Jimenez
7ff1d56906 Forward port of svn rev. 569:
* SSDP_IPV6_SITELOCAL: new macro.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@571 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:36:22 +00:00
Marcelo Roberto Jimenez
2150bdc5b6 Forward port of svn rev. 568:
The scope of the macro NUM_HANDLE is now restricted to upnpapi.c.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@570 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:34:17 +00:00
Marcelo Roberto Jimenez
5bb3621626 Forward port of svn rev. 566:
* InitHandleList() has never been implemented, I guess no one has ever
called it, so remove it.
* GetFreeHandle() and FreeHandle() are now static as they should.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@567 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:15:39 +00:00
Marcelo Roberto Jimenez
b895fce678 Forward port of svn rev. 564:
* New internal buffer added to store global/ula IPV6 address.
* Macros to test whether an IPV6 address is global or ula.
* UpnpGetServerUlaGuaIp6Address(): added interface.
* IN6_IS_ADDR_GLOBAL, IN6_IS_ADDR_ULA: new macros.
* gIF_IPV6_ULA_GUA: new buffer.
* UpnpRegisterRootDevice3(): Change to the test of already registered
devices for IPV6.
* UpnpGetIfInfo(): gua/ula issues.

Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@565 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 20:51:29 +00:00
Marcelo Roberto Jimenez
03c858af51 Backport of svn rev. 558: HTTP version equal to 1.0 should failed as required
by the UPnP certification tool.

Patch submitted by Ronan Menard.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@559 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:39:44 +00:00
Marcelo Roberto Jimenez
b2e38b2fca SF Bug Tracker [ 3022490 ] String declaration fix for patch applied in 3007407
Hello,

	When my patch for tracker ID 3007407 was accepted, the definition of the
	serviceList string was changed from

	#define SERVICELIST_STR "serviceList"

	to

	static const char *SERVICELIST_STR = "serviceList";

	During internal code review of the final patch, it was pointed out that 
	sizeof(SERVICELIST_STR) == 4 since SERVICELIST_STR is now declared as
	a pointer instead of an array.

	If you wish to use a variable instead of a define, I suggest the
	following instead:

	static const char SERVICELIST_STR[] = "serviceList";

	Thanks,
	Chuck Thomason



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@556 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-28 20:36:30 +00:00
Marcelo Roberto Jimenez
fab22807c0 Remove excessive 'dnl's from libupnp.m4.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@554 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-26 11:09:06 +00:00
Marcelo Roberto Jimenez
338b22b754 SF Bug Tracker [ 3007407 ] Service traversal issue in AdvertiseAndReply()
Submitted: Chuck Thomason ( cyt4 ) - 2010-05-26 15:07:39 UTC

	When the UPnP server is started, one alive message is broadcast for each
	service in each device. It appears that libupnp's implementation of the
	alive message generation does not correctly navigate the XML description
	document when locating the services. This can result in the wrong UDN
	being used in the alive message sent for a service.

	In my specific case (see attached XML), the root EchoSTB device contains
	no services, but its embedded MediaServer device contains 2 services.
	When the existing libupnp code traverses the EchoSTB device in the XML,
	it searches the global list of serviceLists within the document instead
	of searching for a serviceList that is its direct child node. The
	ContentDirectory and ConnectionManager services are then announced with
	the UDN of EchoSTB1 (the root device) instead of with the UDN of
	MediaServer, which is actually their parent device.

	I discovered this behavior using libupnp-1.6.6. I have generated a patch
	against branch-1.6.x that corrects the XML navigation such that all
	services are traversed from their parent device, which results in the
	correct UDN being sent in the alive message for each service. I built
	from branch-1.6.x without this patch, tested, and confirmed that the
	issue still exists as I observed it in libupnp-1.6.6. I then built
	from branch-1.6.x with this patch, tested, and confirmed that the
	issue was resolved.

	Thanks,
	Chuck Thomason



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@552 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-17 17:02:03 +00:00
Marcelo Roberto Jimenez
54727b2a9e Forward port of svn revision 548:
[svn] SF Bug Tracker [ 2995758 ] libupnp 1.6.6, wrong bind when reuseaddr is 1.
Submitted: viallard anthony ( homer242 )
When trying to use reuseaddr option in miniserver/miniserver.c, there
isn't a affectation of the port chosen (serverAddr.sin_port isn't
receive listen_port variable value).


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@549 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-07 11:20:00 +00:00
Marcelo Roberto Jimenez
71ec18a3a9 Remove ifdef's code from upnp.h.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@547 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-01 02:25:06 +00:00
Marcelo Roberto Jimenez
3772ad4595 Define PROTOTYPES to be one by default in global.h. This affects the
RSA MD5 code.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@544 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 14:51:57 +00:00
Marcelo Roberto Jimenez
d33ad5c03e Separation of the ClientSubscription object.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@543 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 13:57:25 +00:00
Marcelo Roberto Jimenez
ad9bcc9100 Comment.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@542 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 12:07:36 +00:00
Marcelo Roberto Jimenez
da5cf568e6 Recasting away constness.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@540 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 11:42:32 +00:00
Marcelo Roberto Jimenez
7f1be91e76 Mostly whitespaces and code convergence.
client_table has been totaly rewritten, so remove the old license.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@536 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:29:52 +00:00
Marcelo Roberto Jimenez
01039a1d9a Protect the object destructors agains null pointers on deletion, which
should be something valid. Missed this one.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@535 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:25:41 +00:00
Marcelo Roberto Jimenez
472cc5a993 Protect the object destructors agains null pointers on deletion, which
should be something valid.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@534 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:18:43 +00:00
Marcelo Roberto Jimenez
a627df4d10 SF Patch Tracker [ 2987390 ] upnp_debug vs. ixml_debug
Thanks for the load of updates, I'm still assimilating them ! Could I make
	a suggestion though? The addition of printNodes(IXML_Node) to upnpdebug a
	dds a new dependency on ixml.h for anything using upnpdebug.h. I'm making
	quite a bit of use of upnpdebug in porting things to version 1.8.0, and I'd
	prefer it if printNodes could be added to ixmldebug.h instead. I'm attach
	ing a patch, what do you think ?

	Nick



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@532 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-16 13:38:06 +00:00
Marcelo Roberto Jimenez
8f852b1ee9 Code base convergence.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@531 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-01 20:36:35 +00:00
Marcelo Roberto Jimenez
59ec1fd641 White spaces and code reorganization.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@528 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-31 17:47:55 +00:00
Marcelo Roberto Jimenez
3fb182aa95 * Added API to ithread, created the following functions:
- int ithread_initialize_library(void);
	- int ithread_cleanup_library(void);
	- int ithread_initialize_thread(void);
	- int ithread_cleanup_thread(void);
	* SF Bug Tracker [ 2876374 ] Access Violation when compiling with Visual Studio 2008
	Submitted: Stulle ( stulleamgym ) - 2009-10-10 19:05

	Hi,

	I am one of the devs of the MorphXT project and I use this lib in some
	other of my projects, too. When I tried to upgrade the lib earlier for one
	of my projects I had to realise that something did not work at first and
	while most of the things were reasonably ease to be fixed. Now, the last
	thing I encountered was not so easy to fix and I am uncertain if my fix is
	any good so I'll just post it here and wait for some comments.

	The problem was that I got an Access Violation when calling "UpnpInit". It
	would call "ithread_rwlock_init(&GlobalHndRWLock, NULL)" which eventually
	led to calling "pthread_cond_init" and I got the error notice at
	"EnterCriticalSection (&ptw32_cond_list_lock);". It appeared that
	"ptw32_cond_list_lock" was NULL. Now, I found two ways to fix this. Firstly
	moving the whole block after at least one of the "ThreadPoolInit" calls
	will fix the issue. Secondly, you could add:
	#ifdef WIN32
	#ifdef PTW32_STATIC_LIB
	// to get the following working we need this... is it a good patch or
	not... I do not know!
	pthread_win32_process_attach_np();
	#endif
	#endif
	right before "ithread_rwlock_init(&GlobalHndRWLock, NULL)".

	Just so you know, I am using libupnp 1.6.6 and libpthreads 2.8.0 and both
	are linked static into the binaries. I am currently using Visual Studio
	2008 for development with Windows being the target OS. Any comment at your
	end?

	Regards, Stulle



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@527 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-27 19:46:16 +00:00
Marcelo Roberto Jimenez
c434f275ef White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@522 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-22 09:07:44 +00:00
Marcelo Roberto Jimenez
35392132af Forward port of svn revision 520:
* SF Bug Tracker [ 2392166 ] ithread_detach not called for finished worker thread
	Submitted: Ulrik ( ulsv_enea ) - 2008-12-05 08:24

	Valgrind reports a memory leak due to that the function ithread_detach is
	not called for finished worker threads in ThreadPool.c.

	==21137== 2,176 bytes in 8 blocks are possibly lost in loss record 5 of 5
	==21137== at 0x4C20F3F: calloc (vg_replace_malloc.c:279)
	==21137== by 0x4010F58: _dl_allocate_tls (in /lib/ld-2.6.1.so)
	==21137== by 0x544BA92: pthread_create@@GLIBC_2.2.5 (in
	/lib/libpthread-2.6.1.so)
	==21137== by 0x5F94592: CreateWorker (ThreadPool.c:639)
	==21137== by 0x5F95079: ThreadPoolInit (ThreadPool.c:784)

	I'm using libupnp 1.6.6

	For more info on pthread_detach, see:
	http://gelorakan.wordpress.com/2007/11/26/pthead_create-valgrind-memory-lea
	k-solved/



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@521 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 23:10:44 +00:00
Marcelo Roberto Jimenez
5eccaf4b64 Forward port of svn revision 518:
* SF Bug Tracker [ 2392304 ] Memory leak in SSDP AdvertiseAndReply
	Submitted: Ulrik ( ulsv_enea ) - 2008-12-05 08:24

	Valgrind reports a memory leak function in AdvertiseAndReply
	(ssdp/ssdp_server.c) in libupnp 1.6.6

	There are continue statements in many places in AdvertiseAndReply. In some
	of those error handling cases the variable nodelist is not free'ed before
	continuing to the next iteration. The next iteration will take care of
	free'ing the nodelist from the previous iteration in most cases, but not
	when breaking out of the for loop after the last element.

	I belive this memory leak can be solved by makeing sure that the rows

	ixmlNodeList_free( nodeList );
	nodeList = NULL;

	are always executed, also in the beginning of the last iteration when we
	found out that there are not more elements.

	==29110== at 0x4C21C16: malloc (vg_replace_malloc.c:149)
	==29110== by 0x5D8DE0E: ixmlNodeList_addToNodeList (nodeList.c:106)
	==29110== by 0x5D8B7E2: ixmlNode_getElementsByTagNameRecursive
	(node.c:1438)
	==29110== by 0x5D8E587: ixmlElement_getElementsByTagName
	(element.c:491)
	==29110== by 0x5B6C0F1: AdvertiseAndReply (ssdp_server.c:201)
	==29110== by 0x5B7AB74: UpnpSendAdvertisement (upnpapi.c:1495)



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@519 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 21:32:44 +00:00
Marcelo Roberto Jimenez
1e6c3331ed SF Patch Tracker [ 2964973 ] install: will not overwrite just-created
...blah... with...
	Submitted: Nick Leverton ( leveret ) - 2010-03-07 05:18

	Full error:
	/usr/bin/install: will not overwrite just-created
	`/tmp/buildd/libupnp-1.6.6/debian/tmp/usr/share/doc/libupnp3-dev/examples/s
	ample_util.c' with `common/sample_util.c'

	This seems to be from Automake 1.11 which doesn't like having duplicate
	files in a Makefile.am. Patch attached, kindly provided by Stefan Potyra
	for Debian (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=543068)

	This fix will be needed for both 1.6.x and 1.8.x branches.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@510 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 16:13:16 +00:00
Marcelo Roberto Jimenez
c56ab5613e Cosmetic change to uri.c
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@507 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 15:12:28 +00:00
Marcelo Roberto Jimenez
f6a30b842c Forward port of svn revision 505:
SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
	Submitted By: zephyrus ( zephyrus00jp )



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@506 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 11:50:26 +00:00
Marcelo Roberto Jimenez
cbbbb14e21 SF Patch Tracker [ 2969188 ] 1.8.0: patch for FreeBSD compilation
Submitted By: Nick Leverton (leveret)
	Fix the order of header inclusion for FreeBSD.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@504 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-20 22:09:23 +00:00
Marcelo Roberto Jimenez
0c578f7962 Forward port of svn revision 502:
SF Patch Tracker [ 2836704 ] Search for nested serviceList (not
	stopping at the first lis
	Submitted By: zephyrus ( zephyrus00jp )
	
	Internet Gateway Device description contains nested serviceList (rootdevice
	-> servicelist, subdevice
	and subdevice has the lower-level serviceList, etc..)

	Unfrotunately, the sample code sample_util.c used by tv_device sample,
	etc.
	has a code that looks for only the first top-level serviceList.
	This results in the failure to read all the services of an IGD xml
	description.

	Attached patch modifies this behavior and looks for the service by
	visiting all the serviceList in xml document in turn.

	With the modified patch (ad additional modification), I could
	simulate an IGD device and created a modified control program for that.

	Patch against 1.6.6

	TIA.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@503 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-20 21:35:04 +00:00
Marcelo Roberto Jimenez
8eac74ee50 SF Patch Tracker [ 2973319 ] Problem in commit 499
Submitted By: Nick Leverton (leveret)
	Afraid that this doesn't compile, it seems retval should be retVal in two
	places.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@500 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-20 21:27:51 +00:00
Marcelo Roberto Jimenez
b80e888ae2 Fix for the ithread_mutex_unlock() logic in UpnpInit().
Thanks for Nicholas Kraft.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@499 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-17 01:00:47 +00:00
Marcelo Roberto Jimenez
218d4bf5dd * SF Patch Tracker [ 2970872 ] Update ErrorMessages for latest return
code list
	Submitted By: Nick Leverton ( leveret )
	
	ErrorMessage[] in upnptools.c has got a bit out of sync, the attached
	patch (generated from grep 'define UPNP_E_') should bring it up to date.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@495 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 23:38:33 +00:00
Marcelo Roberto Jimenez
6b0272d66b SF Patch Tracker [ 2857611 ] Declare a few functions to have proper
(void) argument list.
	Submitted By: zephyrus ( zephyrus00jp )
	
	In a publicly installed headers, a few functions are declared without any
	arguments at all, a la "()".
	When I used gcc's -Wimplict and -Wstrict-prototypes to check for the
	mismatch of
	function prototype declarations and their usage in my own program,
	some headers from libupnp-1.6.6 produced warnings.

	They are not strictly bugs, but pretty much annoying. This is 2009, and
	almost all the important compilers
	understand ISO-C.

	So the offending functions are declared as "(void") to show that they have
	no arguments at all.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@493 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 15:33:40 +00:00
Marcelo Roberto Jimenez
aca89457ae SF Patch Tracker [ 2962606 ] Autorenewal errors: invalid SID,
too-short renewal interval
	Submitted By: Nick Leverton (leveret)
	
	Auto-renewals send an invalid SID due to a missing UpnpString_get_String
	call. They also send a renewal interval of 0 instead of copying it from
	the original subscription.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@492 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 03:30:11 +00:00
Marcelo Roberto Jimenez
b77fead68a SF Patch Tracker [ 2964685 ] patch for avoiding inet_ntoa (1.8.0)
Seems like SF's tracker won't let me add a patch to someone else's issue ?!
	This refers to https://sourceforge.net/support/tracker.php?aid=2724578
	
	The calls to inet_ntoa are in getlocalhostname(), which is called from
	UpnpInit when it is returning the bound IP address. 
	UpnpInit/getlocalhostname hasn't been updated to IPv6, I presume this is
	deliberate so that it doesn't start returning IPv6 addresses and
	overwriting the caller's IPv4-sized allocation.
	
	The attached patch just updates getlocalhostname to use inet_ntop instead
	of inet_ntoa, and also documents the fact that UpnpInit is IPv4 only whilst
	UpnpInnit2 is both IPv4 and IPv6.
	
	A fuller solution might be to change UpnpInit to use some variant on
	UpnpGetIfInfo. UpnpInit could still be left as IPv4 only if desired -
	perhaps UpnpGetIfInfo could take an option for the desired address family.
	getlocalhostname and its own copy of the interface scanning code would then
	be redundant. I don't have IPv6 capability here though so I'm reluctant to
	change the IPv6 code, as I have no way to test it.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@491 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 03:19:08 +00:00
Marcelo Roberto Jimenez
da3ce95628 Fix for const warning.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@490 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 03:07:34 +00:00
Marcelo Roberto Jimenez
44cb915b1b SF Patch Tracker [ 2724578 ] patch for avoiding memory leaks when
add devices.

	each time a device been added, UpnpInit() is called, on exit, UpnpFinish()
	is called, but the memories allocated by ThreadPoolInit() may lost because
	there's no code to call ThreadPoolShutdown() to release the memories. And
	inet_ntoa() is not thread safe, so in my patch, I substitute inet_ntoa()
	with inet_ntop().



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@489 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 03:05:16 +00:00
Marcelo Roberto Jimenez
bb55b1ed9c * SF Patch Tracker [ 2964687 ] Add new string based accessors to upnp
object API

	As per email to pupnp-devel, this is the patch to add the _strget_
	accessors for string-like objects in the interface.
	
	Will add a further patch shortly to udpate the sample programs.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@488 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 01:48:24 +00:00
Marcelo Roberto Jimenez
285f6a2a72 SF Patch Tracker [ 2546532 ] Missing carriage return between
SOAPACTION and User-Agent headers.

	There is something going wrong in soap_ctrlpt.c at line 931 (based on
	version 1.6.6 release).
	
	The http_Makemessage call looks as follows:
	
	if (http_MakeMessage(
	&request, 1, 1,
	"Q" "sbc" "N" "s" "s" "Ucc" "sss",
	SOAPMETHOD_POST, path.buf, path.length,
	"HOST: ", host.buf, host.length,
	content_length,
	ContentTypeHeader,
	"SOAPACTION:
	\"urn:schemas-upnp-org:control-1-0#QueryStateVariable\"",
	xml_start, var_name, xml_end ) != 0 ) {
	return UPNP_E_OUTOF_MEMORY;
	}
	
	This will result in the SOAPACTION header to be immediately followed by the
	User-Agent header, while a cr-lf should separate the two. I propose to fix
	this by changing the second "s" to "sc" to force the addition of a cr-lf
	after the SOAPACTION. This looks consistent to the other Makemessage calls.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@484 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-14 17:39:30 +00:00
Oxy
34b5a5ce90 wrong order in parameters corrected
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@482 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2009-03-06 09:38:24 +00:00
Marcelo Roberto Jimenez
78f5e5004f Fix for application compiler warning: "PRId64" redefined.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@479 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-08-14 12:00:01 +00:00
Marcelo Roberto Jimenez
54ab392bbd Comment using UTF-8.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@474 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 03:04:40 +00:00
Marcelo Roberto Jimenez
13a771367d Removing unused file src/inc/http_client.h.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@473 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 02:33:39 +00:00
Marcelo Roberto Jimenez
7847d15171 Removing header of unused and no longer function parse_port().
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@472 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 02:33:01 +00:00
Marcelo Roberto Jimenez
8ab8265fd2 Added upnp/m4/libupnp.m4 to the distribution tarball.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@468 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 03:52:31 +00:00
Marcelo Roberto Jimenez
cd6d5822fb Fixed a missing HandleUnlock() in upnp/src/gena/gena_device.c plus several
white space changes.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@464 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 03:27:42 +00:00
Marcelo Roberto Jimenez
1548c9044d Update of the build/inc/*.h files. They have not been updated since 1.4.7.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@456 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-23 18:43:02 +00:00
Marcelo Roberto Jimenez
943483e8b7 UpnpInet.h is now the only place where winsock2.h and Ws2tcpip.h are included.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@455 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-21 22:42:54 +00:00
Marcelo Roberto Jimenez
d991fbe26c ifdef is more clear than ifndef here.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@454 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-17 21:31:42 +00:00
Marcelo Roberto Jimenez
654363468a Debug code for http_RecvMessage().
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@448 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-10 03:55:07 +00:00
Marcelo Roberto Jimenez
b0f782f9c2 Update of libupnp.m4.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@447 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-07 01:07:46 +00:00
Marcelo Roberto Jimenez
cb6dfa2824 Small fixes for libupnp.m4.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@446 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-02 02:32:52 +00:00
Marcelo Roberto Jimenez
40b43458f1 Added an m4 macro to deal with finding libupnp in the users' configure script.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@445 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-06-30 05:53:55 +00:00
Marcelo Roberto Jimenez
3182593c01 Nicholas Kraft's patch to fix some IPv6 copy/paste issues. He
reported to be getting infinite loops with the svn code.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@444 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-06-27 11:38:03 +00:00