Compare commits

..

465 Commits

Author SHA1 Message Date
Marcelo Roberto Jimenez
bc335f5df7 Bug tracker #124 Build fails with --enable-debug
Build environment
Fedora 21
X86-64
gcc 4.9.2

how to repeat
$ ./configure --enable debug
$ make
libtool: compile: gcc -dhave_config_h -i. -i.. -i../upnp/inc -i./inc
-i../threadutil/inc
-i../ixml/inc -i./src/inc -pthread -g -o2 -wall -mt
src/api/libupnp_la-upnpstring.lo
-md -mp -mf src/api/.deps/libupnp_la-upnpstring.tpo -c
src/api/upnpstring.c
-fpic -dpic -o src/api .libs/libupnp_la-upnpstring.o
src/api/UpnpString.c:47:16:
error: expected identifier or '(' before 'extension'
extern char *strndup(const char *string, size_t __n);
^
Makefile:1016: recipe for target 'src/api/libupnp_la-UpnpString.lo'
failed

Reason for failure
Build enables -O2 optimization flags which causes the inclusion of a
macro implementation of strndup from include/bits/string2.h.

Workarounds
Disable optimization when configuring or making:
$ configure CFLAGS='-g -pthread -O0' --enable-debug
$ make
or
$ configure --enable-debug
$ make CFLAGS='-g -pthread -O0' Define NO_STRING_INLINES
$ export CFLAGS="-DNO_STRING_INLINES -O2"
$ ./configure --enagble-debug
$ make

Fix
* Don't declare strndup in src/api/UpnpString.c if it exists
2015-02-04 22:34:08 -02:00
Marcelo Roberto Jimenez
cf31814e55 Looks like I did something wrong two commits ago 2015-02-04 22:25:15 -02:00
Marcelo Roberto Jimenez
3b0fd070fd Update .gitignore 2015-02-04 22:18:23 -02:00
Marcelo Roberto Jimenez
9f69fb1b80 _LARGEFILE_SOURCE definition has changed in the last autotools 2015-02-01 22:31:30 -02:00
Jean-Francois Dockes
c124ae6507 Fix out-of-tree compilation: missing include directive and build
subdirectory

Out-of-tree builds seem to be currently broken, because ixml and
threadutil files need an include path to include UpnpGlobal.h, and
configure tries to copy files into a directory which it does not create.
The patch fixes both issues.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2015-02-01 22:27:39 -02:00
Nick Leverton
51a01cdba1 Adjust NUM_MEDIA_TYPES to allow for the addition of css in commit 72460df7. 2014-10-02 20:34:58 +01:00
Marcelo Jimenez
6905714a7e Update the THANKS file
Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-26 13:59:38 -03:00
Dirk
72460df747 #121 Support css files in webserver
Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-26 13:49:43 -03:00
Philipp Matthias Hahn
a596abfbe3 Add unit test for parse_uri()
Tested through the public function UpnpResolveURL2().

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-22 11:59:04 -03:00
Philipp Matthias Hahn
fbbb24f406 Fix remove_dots()
Rewrite to handle all normal and abnormal examples mentioned in RFC 3986
section 5.4.
The previous implementation failed the following test cases:

'http://www.libupnp.org/path1/path1' | '#frag1' -> 'http://www.libupnp.org/path1/#frag1' != 'http://www.libupnp.org/path1/path1#frag1' (0)
'http://127.0.0.1:6544/getDeviceDesc' | 'CDS_Event' -> 'http://127.0.0.1:6544/CDS_EventDesc' != 'http://127.0.0.1:6544/CDS_Event' (0)
'http://localhost/b/c/d;p?q' | 'g' -> 'http://localhost/b/c/g;p' != 'http://localhost/b/c/g' (0)
'http://localhost/b/c/d;p?q' | 'g/' -> 'http://localhost/b/c/g/p' != 'http://localhost/b/c/g/' (0)
'http://localhost/b/c/d;p?q' | '?y' -> 'http://localhost/b/c/?yp' != 'http://localhost/b/c/d;p?y' (0)
'http://localhost/b/c/d;p?q' | '#s' -> 'http://localhost/b/c/#sp' != 'http://localhost/b/c/d;p?q#s' (0)
'http://localhost/b/c/d;p?q' | ';x' -> 'http://localhost/b/c/;xp' != 'http://localhost/b/c/;x' (0)
'http://localhost/b/c/d;p?q' | '.' -> 'http://localhost/b/c/.;p' != 'http://localhost/b/c/' (0)
'http://localhost/b/c/d;p?q' | './' -> 'http://localhost/b/c/p' != 'http://localhost/b/c/' (0)
'http://localhost/b/c/d;p?q' | '..' -> 'http://localhost/b/c/..p' != 'http://localhost/b/' (0)
'http://localhost/b/c/d;p?q' | '/./g' -> 'http://localhost/./g' != 'http://localhost/g' (0)
'http://localhost/b/c/d;p?q' | '/../g' -> 'http://localhost/../g' != 'http://localhost/g' (0)
'http://localhost/b/c/d;p?q' | 'g.' -> 'http://localhost/b/c/g.p' != 'http://localhost/b/c/g.' (0)
'http://localhost/b/c/d;p?q' | '.g' -> 'http://localhost/b/c/.gp' != 'http://localhost/b/c/.g' (0)

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-22 11:59:04 -03:00
Philipp Matthias Hahn
0508fb0d6e Fix resolve_rel_url()
This reworks commit 0edaf3361d, which
broke resolving relative url, where the relative URL is shorter than the
absolute URL:
    "http://127.0.0.1:6544/getDeviceDesc" + "CDS_Event"
    Wrong: "http://127.0.0.1:6544/CDS_EventDesc"
    Right: "http://127.0.0.1:6544/CDS_Event"

While reviewing that commit, improve code by:
1. Move the simple cases to the beginning of the function.
2. Keep track of the remaining target buffer size.
3. Fix URI concatenation with queries.
4. Fix URI concatenation with fragments.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-22 11:19:25 -03:00
Philipp Matthias Hahn
848d66e69d Fix broken strncat(..., strlen())
commit 0edaf3361d replaced several
malloc()+strcat() sequences with strncat() using strlen() on the
*source* string.
This is still vulnerable to overwrite the *target* buffer.

While reviewing this commit change the code to directly use snprintf()
for concatenating strings and check the length of the target buffer.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-22 11:19:25 -03:00
Philipp Matthias Hahn
04fb684323 Directly use strdup()
commit 0edaf3361d replaced several
malloc()+strcpy() sequences with memset()+strncpy() using strlen().
This doesn't improve security and introduced a bug URI handling.

While reviewing this commit change the code to directly use strdup()
instead of re-implementing it multiple times, as shortens the code and
thus improves readability.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-22 11:19:25 -03:00
Fabrice Fontaine
faaef39a3c Fix getaddrinfo() loop
Commit b116d10f did the following change:
    Use switch, int and sa_family_t with AF_INET in uri.c.

This breaks when getaddrinfo() only returns a single record, as in that
case the "break" only exits the switch statement and the loop-step
"res=res->ai_next" is still executed. After that "res == NULL" is
wrongly interpreted as not having found an AF_INET or AF_INET6 address.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-09-22 11:19:25 -03:00
Peng
a1193f385e rewrite soap_device.c
1) separate HTTP handling from SOAP handling
2) remove repeated validity check, each check is performed exactly once
3) fix HTTP status code per UPnP spec, SOAP spec and RFC 2774

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2014-01-17 10:00:00 -02:00
Marcelo Roberto Jimenez
c20f2bd3a1 Homekeeping for the next release. 2013-11-15 14:16:13 -02:00
Marcelo Roberto Jimenez
3fc0f9ad1d Adjust the library numbers for release. 2013-11-15 14:10:05 -02:00
Marcelo Roberto Jimenez
2211cc14e6 Access violation due to changed usage of pthreads-win32
SF Bug Tracker #119, Creator: Klaus Fischer

Dear libupnp developers,

I have experienced a crash (access violation) when using libupnp on
Windows. The crash is actually located in pthreads-win32 and happens
when repeatedly de-/initializing libupnp on Win32 in the same process
and both libupnp and pthreads-win32 are compiled as static libraries.

So I'm doing this:
- UpnpInit()
- UpnpFinish()
- UpnpInit() <- Crash

I am already in touch with Ross Johnson on the pthreads-win32 mailing
list regarding this issue:

http://sourceware.org/ml/pthreads-win32/2013/msg00020.html

He told me the problem is that the functions
pthread_win32_process_attach/detach_np() should no longer be called
directly, but are invoked automatically now since version 2.9.0 of
pthreads-win32, which has been released approx. 1.5 years ago. Please
refer to above link for in-depth information.

So for proper using of latest pthreads-win32 library, those function
calls should vanish inside libupnp. Could you consider adapting libupnp
in that way? I would really like to use both libraries out-of-the-box
without local modifications, and this issue prevents that.

Best regards,
Klaus
2013-11-14 15:06:31 -02:00
Peng
bf60dc06e0 Fix several minor bugs in soap_device.c
1) remove redundant free
2) avoid user-provided ErrStr being overwritten by the default one
3) eliminated memory leak possiblity in handle_query_variable

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2013-11-08 16:03:09 -02:00
Peng
908785fba7 Fix return value check of parse_uri
Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2013-11-08 11:07:08 -02:00
Yoichi Nakayama
1a28e8ff51 tv_ctrlpt crashes after detecting a later version of tvcontrol service
SF Bug Tracker #118, Creator: T.Iwamoto

	From:  gon3456@users.sf.net
	Steps to reproduce:
	1. Extracts and build libupnp-1.6.18
	$ tar -xjf /path/to/archive/libupnp-1.6.18.tar.bz2
	$ cd libupnp-1.6.18
	$ ./configure
	$ make
	2. Applies the attached patch and remake.
	$ patch -p1 < /path/to/patch/libupnp-1.6.18.patch
	$ make
	3. Run tv_device.
	$ cd upnp/sample
	$ ./tv_device
	4. Run tv_ctrlpt; the tv_ctrlpt crashes soon.
	$ ./tv_ctrlpt
	Segmentation fault (core dumped)
	This is an issue report about the sample program of control point.
	The tv_ctrlpt crashes after detecting a tvdevice that contains tvcontrol:2 or higher version of tvcontrol service.
	tv_ctrlpt should detect correctly such devices due to forward compatibility of control points with device.
	For more information about the compatibility, please refer the following document:
	DLNA Architectures and Protocols Part 1 2011 December - 7.3.2.1.3 (GUN:GZJXU)
	The attached patch changes the sample programs as below:
	- device: changes version of tvcontrol service from 1 to 2. This change may occur in the future.
	- cp: nothing changed: cp knows version 1 of tvcontrol service only.
	I know many vendors implements their control points based on the tv_ctrlpt, so I hope to fix this issue ASAP.

	==

	From: Yoichi NAKAYAMA
	SEGV is caused by strcpy with NULL argument.
	Attached patch will avoid SEGV in strcpy, but there may be other inconsistencies.

	> I know many vendors implements their control points based on the tv_ctrlpt,

	I don't think so. I think tv_ctrlpt is just a sample to be used with tv_device.

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
2013-10-29 17:55:23 -02:00
Pino Toscano
89ad5e6779 Fix compilation on GNU/Hurd 2013-10-28 14:01:11 -02:00
Peng
062ac0c926 Fix return value of http_RecvPostMessage and update httpparser.c's comments 2013-10-28 11:35:23 -02:00
Peng
06aa3b17c4 Fix return value of process_request and related subroutines
1) Only HTTP_XXX should be return
2) Make default return value work for process_request
2013-10-28 11:34:58 -02:00
Peng
9f444a680e Fix Content-Range generation bug 2013-10-28 11:34:52 -02:00
zexian chen
8e3a71905b Fix memory leaks when when calling ThreadPoolAdd() or ThreadPoolAddPersistent()
Hi,

I had found some bugs about memory leak on libupnp-1.6.18.

It may lead to memory leak  when calling ThreadPoolAdd() or
ThreadPoolAddPersistent() which does not return 0.

See the attachment for patch.
2013-09-10 17:27:07 -03:00
Peng
72c29ef1f6 Fix return value of config_description_doc.
UPNP_E_XXX should not be used instead of IXML_XXX
2013-09-04 09:57:33 -03:00
Peng
f6a3102b48 Remove faulty free in GetDescDocumentAndURL.
temp_str, which points to part of description, should not be freed.
2013-09-04 09:57:32 -03:00
Peng
9a9c4e829e Avoid malicious client exploit to exhaust the device's memory
Suppose the UPnP device is listening on 192.168.1.102:49152. Use the following to send
garbage bytes to the device:
while true; do echo "\""; done | netcat 192.168.1.102 49152

The device just keeps receiving these bytes and its memory usage keeps growing.
Malicious client may exploit it to exhaust the device's memory.

The attached patch eliminates this possibility.
2013-09-02 14:56:11 -03:00
Peng
7a571f513e Scanner problems
1) restore the scanner's original cursor position in case of
   insufficient input;
2) free the memories allocated for a new header in case of a failure.
2013-09-02 14:38:04 -03:00
Peng
f10730f616 Patch to fix behaviou when char is signed
it seems to me that there is still something wrong:

	1)  the new is_qdtext_char() is incorrect.
	There is a trap if char is implemented as signed char.
	Suppose that c is '\xFF', it will be -1 when converted to an int.
	By definition, c should be qdtext:
	qdtext = <any TEXT except <">>
	TEXT = <any OCTET except CTLs, but including LWS>
	OCTET = <any 8-bit sequence of data>

	2) the character after '\\' could be either part of a quoted-pair
	(together with '\\'), or a normal qdtext, since '\\' itself can
	be treated as a qdtext. This is equivalent to saying that the
	character after '\\' in a quoted string could be ANY octet.

	A patch based on the above two observations is attached.

	Peng
2013-08-16 14:16:47 -03:00
Marcelo Roberto Jimenez
c70f5ce323 Enforce RFC 2616 and accept "0" after a backslash for quoted-strings.
Reported by Peng <howtofly(at)gmail.com>
2013-08-14 09:51:41 -03:00
Peng
a3c540bc9b scanner_get_token: robustness improvement
Patch to make scanner_get_token more robust (avoid over-reading).
2013-08-14 09:22:43 -03:00
Robert Buckley
7b1aa4c9e3 SF ticket #53 Action Error Response not returned
In soap_ctrlpt.c, in function get_response_value:

upnp_error_code is checked to see if it is less than 400 because that
would indicate a SOAP error code.

However it should be checked to see if it is greater than 400.
2013-07-30 17:07:30 -03:00
Zheng Peng
907c7c2621 SF ticket #116 UpnpRemoveVirtualDir wrong linked list operation
What if pVirtualDirList has two nodes and what we want to delete is the
first one. Patch attached.
2013-07-30 16:02:14 -03:00
Sebastian Brandt
25c27b8af7 Fix for crash in webserver.c by Sebastian Brandt
Dear libupnp-devels,
when POST'ing to the simple web server in libupnp, the application crashes.
This is caused by a missing "..." argument in webserver.c:1533.
Seems it has been there for a long time ... 1.6.9 and 1.6.18 have it.

webserver.c:1533 calls http_MakeMessage
/* Send response. */
http_MakeMessage(&headers, 1, 1,
	 "RTLSXcCc",
	 ret, "text/html", X_USER_AGENT);
The format parameter RTLSXcCc needs four arguments -
R - response code - ret,
T- content type - text/html,
L - struct SendInstruction * - NOT PRESENT
X - user agent - X_USER_AGENT

This results in a crash.

Changing to
http_MakeMessage(&headers, 1, 1,
	 "RTLSXcCc",
	 ret, "text/html", &RespInstr, X_USER_AGENT);
solves the situation.

Yours,
Sebastian Brandt
2013-07-30 11:46:46 -03:00
Marcelo Roberto Jimenez
dcbbc30f5c Fix for portability issue with GNU make extension 'sort'
upnp/sample/Makefile.am:67: warning: sort \
upnp/sample/Makefile.am:67:                     $(tv_ctrlpt_SOURCES: non-POSIX variable name
upnp/sample/Makefile.am:67: (probably a GNU make extension)

Reference:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13771#8
2013-07-30 11:26:09 -03:00
Marcelo Roberto Jimenez
3509991872 Fix for warning issue in libtool
Reference:
http://lists.gnu.org/archive/html/automake/2012-05/msg00014.html

Re: automake 1.12 and AM_PROG_AR

From:	 Nick Bowler
Subject:	 Re: automake 1.12 and AM_PROG_AR
Date:	 Thu, 10 May 2012 17:16:04 -0400
User-agent:	 Mutt/1.5.21 (2010-09-15)
On 2012-05-10 12:52 +0200, Simon Josefsson wrote:
> Hi,
>
> I have received patches similar to the one below for several of my
> projects already, and I'm beginning to think there may be something that
> could be improved in automake.  Why does automake 1.12 need something
> that 1.11 doesn't even recognize?  Perhaps a smoother way to introduce
> this behaviour is to let 1.12 automatically enable it?
>
> Alternatively, is there some other way to address the warnings that is
> better?  Does it indicate a real problem in my projects?
>
> http://lists.gnu.org/archive/html/help-libidn/2012-05/msg00000.html
> http://lists.gnu.org/archive/html/help-libidn/2012-05/txtqAGOGgtPqj.txt

FYI, since the patch is so short it would have been helpful to include
it inline in your email.  I've taken the liberty of reproducing it
below:

> --- libidn-1.24.orig/configure.ac
> +++ libidn-1.24/configure.ac
> @@ -34,6 +34,10 @@ AC_SUBST(LT_CURRENT, 17)
>  AC_SUBST(LT_REVISION, 7)
>  AC_SUBST(LT_AGE, 6)
>
> +# automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
> +m4_pattern_allow([AM_PROG_AR])
> +AM_PROG_AR
> +
>  AC_PROG_CC
>  gl_EARLY
>  lgl_EARLY

First off, this patch seems wrong at a first glance by its use of
m4_pattern_allow: this is saying that "It's ok for AM_PROG_AR to appear
verbatim in the configure script".  This suggests to me that the patch
didn't actually get tested (well) on Automake 1.11, since there will
almost certainly be an error about AM_PROG_AR at configure time.

This one should actually work properly on both old and new Automake
(untested):

  m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

That being said, the new warning is enabled by the -Wextra-portability
option that was added to Automake-1.12.  I'm by no means an export on
this issue, but I think it relates to new support for building with the
Microsoft compiler: in other words, I think that ignoring this warning
will not cause regressions in your package but, instead, your package
will simply not be able to make use of the new feature.

Regardless, I believe that for most packages the new warning is actually
caused by Libtool, and therefore the correct place to add the call to
AM_PROG_AR is in libtool itself, rather than ad-hoc patching of each
package individually.  You can silence the warnings (but not fix them)
by adding -Wno-extra-portability to AM_INIT_AUTOMAKE.

Cheers,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
2013-07-30 10:39:30 -03:00
Marcelo Roberto Jimenez
6279b7fa5f Homekeeping for the next release. 2013-01-29 12:11:56 -02:00
Marcelo Roberto Jimenez
6cd1f11154 Adjust the library numbers for release. 2013-01-29 12:04:00 -02:00
Marcelo Roberto Jimenez
f015a132e8 Security fix for CERT issue VU#922681
This patch addresses three possible buffer overflows in function
unique_service_name(). The three issues have the folowing CVE
numbers:

CVE-2012-5958 Issue #2: Stack buffer overflow of Tempbuf
CVE-2012-5959 Issue #4: Stack buffer overflow of Event->UDN
CVE-2012-5960 Issue #8: Stack buffer overflow of Event->UDN

Notice that the following issues have already been dealt by previous
work:

CVE-2012-5961 Issue #1: Stack buffer overflow of Evt->UDN
CVE-2012-5962 Issue #3: Stack buffer overflow of Evt->DeviceType
CVE-2012-5963 Issue #5: Stack buffer overflow of Event->UDN
CVE-2012-5964 Issue #6: Stack buffer overflow of Event->DeviceType
CVE-2012-5965 Issue #7: Stack buffer overflow of Event->DeviceType
2012-12-06 15:43:15 -02:00
Marcelo Roberto Jimenez
40e90e89fc Remove an unused variable 2012-06-20 21:34:01 -03:00
Marcelo Roberto Jimenez
40ddff1096 Remove an unused variable ifndef INET_IPV6 2012-06-20 21:26:05 -03:00
Marcelo Roberto Jimenez
692813d03e Remove a pointless way to test a return value 2012-06-20 21:15:01 -03:00
Yoichi NAKAYAMA
d9e90499b7 Fix memory leak and access violation in UpnpSendAction(Ex)Async.
Free buffers after malloc or ixmlPrintNode failure.
Free Param->Header before destructing Param.
2012-06-19 19:13:46 +09:00
Anoop Mohan
6db2271ac3 Fixes a bug in non blocking connect call
This patch fixes a bug in non blocking connect call where the sock
option length for SO_ERROR was passed as 0 instead of sizeof(int).
2012-05-25 11:59:21 -03:00
Yoichi NAKAYAMA
4d21d45da7 Disable SetGenaCallback call if device is disabled.
If device is disabled, SetGenaCallback definition is disabled,
but its call remains. A link error will occur in Win32.
2012-04-25 00:29:42 +09:00
Yoichi NAKAYAMA
708ea30806 Fix condition for allocation failure in get_content_type().
At the end of get_content_type() in webserver.c, it should check
return value of ixmlCloneDOMString().
2012-04-21 21:48:55 +09:00
Yoichi NAKAYAMA
39dfad2cba Fix problems detected as dead assignment warning by clang scan-build.
Wrong assignment by shutdown result hides the real error code
of NewRequestHandler() in ssdp_device.c.
Fix return code description of NewRequestHandler().
Handle return code from ithread_create in sample applications.
Remove unused assignments.
2012-04-21 11:38:20 +09:00
Yoichi NAKAYAMA
3d7c1dbd59 Avoid dereference of null pointer in ixmlNode_setNodeProperties.
The problem can occur if one of the arguments is NULL.
Test argument and fix assertion.
2012-04-21 01:48:47 +09:00
Yoichi NAKAYAMA
e52e7e0bd3 Create intermediate directory per project on vc9.
Sample applications share sample_util.c and collisions of
object file can occur in parallel build. Modify project files to
split intermediate directories against it.
Apply similar changes also to library projects, like vc10 projects.
2012-04-17 20:40:51 +09:00
Thijs Schreijer
d5d680d131 Updated the readme regarding the newer visual studio versions and the 'VC runtime dependency hell'
(cherry picked from commit e570b7943d)
2012-04-11 20:17:37 -03:00
Thijs Schreijer
7ee266076d Added pthreads folder back in, put in on the ignore list this time so it won't be included in the repository 2012-04-11 20:16:37 -03:00
Thijs Schreijer
90fad896c4 - Copied the VC9 build directory and renamed to VC10 to prepare for Visual Studio 2010 update - Upgraded build/VC10 dir from VC9 to VC10 (using wizard) - Updated the Debug build configuration to be functional, including references for pthread.dll and the web example folders. Other build configurations still to be fixed. - Added output directory to GIT-ignore list. - Updated the Win32 build configurations to make them all work. x64 remains to be done. - Updated build process, after build events (copying sample files and pthreadVC2.dll to the target directory)
(cherry picked from commit e385d5a27e)
2012-04-11 20:13:00 -03:00
Marcelo Roberto Jimenez
0ea9c438e5 Update THANKS file 2012-04-11 17:42:22 -03:00
Marcelo Roberto Jimenez
c661180d15 Add errno.h inclusion in unixutil.h only in WIN32 2012-04-11 17:41:51 -03:00
Thijs Schreijer
1a98394781 Fixed warning by adding an explicit cast to long; TimerThread.c ..\..\threadutil\src\TimerThread.c(110): warning C4244: '=' : conversion from 'time_t' to 'long', possible loss of data 2012-04-11 17:39:13 -03:00
Thijs Schreijer
89fe655aee Fixed redefinition warnings for EAFNOSUPPORT and EADDRINUSE, Google turned up that they are newly defined in VS2010
unixutil.h, line 41
upnputil.h, line 125

Had a look here; http://bugs.ruby-lang.org/issues/3092 and added the mentioned fixes as found here; http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/win32.h?r1=27222&r2=27236&pathrev=27258&diff_format=h and here http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/win32.h?r1=27236&r2=27258&pathrev=27258&diff_format=h
2012-04-11 17:39:08 -03:00
Yoichi NAKAYAMA
d72bb5cff5 Avoid access violation after parser_parse_chunky_headers call.
In parser_parse_chunky_headers, parser->msg.msg.buf can be changed
by membuffer_delete call. Therefore if we save the pointer to
parser->msg.entity.buf before calling membuffer_delete, it will
induce access to released memory.
2012-04-12 01:51:12 +09:00
Marcelo Roberto Jimenez
e02753736a Update THANKS file. 2012-04-11 12:00:33 -03:00
Gustavo Zacarias
1c21e6e54f ssdp_device: exclude IPv6 stuff when there's no IPv6
Add an additional INET_IPV6 exclusion around IPV6_MULTICAST_HOPS since
the definition isn't guaranteed to exist when the toolchain lacks IPv6
support.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2012-04-11 11:56:40 -03:00
Yoichi NAKAYAMA
a383cbb8e2 Remove possibility of access violation.
1. Test Instr before dereference it in http_RecvPostMessage.
(Though it never becomes NULL because NULL is not passed to
the static method)
2. Avoid strdup(NULL) in ixmlElement_setAttributeNS.
Those are detected by llvm scan-build.
2012-04-06 23:21:18 +09:00
Yoichi NAKAYAMA
34a77cc095 SF Bug Tracker id 3507819 - Use of thread-unsafe gmtime() in httpreadwrite.c
Define http_gmtime_r and web_server_asctime_r and use it.
Those prefix are added since pthread for Win32 already
has macro gmtime_r and asctime_r.
2012-04-06 03:13:43 +09:00
Yoichi NAKAYAMA
e10bc2ec0c Fix type of local variable stopSock in RunMiniServer()
The variable is declared as SOCKET, but it is used to
store return value of int receive_from_stopSock(...).
The type was changed in the commit
4b47e6a51d by mistake.
2012-04-06 00:07:56 +09:00
Fabrice Fontaine
777c936f4c Compilation optimisation
Do not compile the code related to the webserver in http_SendMessage
when --disable-webserver is set
2012-04-03 16:11:31 +02:00
Marcelo Roberto Jimenez
04c1bf3fb0 White space fix. 2012-04-03 09:59:58 -03:00
Marcelo Roberto Jimenez
ab792e4223 Homekeeping for the next release. 2012-04-03 09:25:36 -03:00
Marcelo Roberto Jimenez
d0b16d056e Adjust the library numbers for release. 2012-04-03 09:19:45 -03:00
Fabrice Fontaine
dc4eda529f Memory leak fix in threadutil
Put thread in a detached state when calling pthread_create otherwise in
some circumstances, thread can end before the call to pthread_detach.
2012-04-02 15:51:46 +02:00
Marcelo Roberto Jimenez
c154c63cdc Update of auto-generated file. 2012-03-30 17:34:48 -03:00
Fabrice Fontaine
49af91fe48 Add --enable-unspecified_server
Add --enable-unspecified_server configure option to set to "Unspecified"
the OS name, OS version, product name and product version normally
contained in the SERVER header as this could be used by an attacker.
2012-03-30 21:57:51 +02:00
Fabrice Fontaine
df27ba505f Removing implicit casts in miniserver.c
Removing implicit integer or enum casts in miniserver.c.
2012-03-29 17:10:07 +02:00
Fabrice Fontaine
9a33782ab5 SF Bug Tracker id 3512833 - Miniserver is wrongly disabled
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-29 07:36:34 PDT

Miniserver is disabled if ECXLUDE_GENA, EXCLUDE_SOAP and
EXCLUDE_WEBSERVER are set.
However, SSDP needs the Miniserver to answer to M-SEARCH requests.
So, MiniServer should not be disabled if EXCLUDE_SSDP is not also set.
2012-03-29 16:40:40 +02:00
Yoichi NAKAYAMA
e0e81e6cd2 SF Bug Tracker id 3510693 - build fail with --disable-device
Use INCLUDE_DEVICE_APIS instead of UPNP_HAVE_DEVICE as in other sources.
Don't use soap_device_callback if INCLUDE_DEVICE_APIS is not set,
otherwise link error occur on Windows.
2012-03-27 00:59:50 +09:00
Fabrice Fontaine
02afbb09c9 SF Bug Tracker id 3511149 - --disable-ssdp has no effect
Submitted: Yoichi NAKAYAMA ( yoichi ) - 2012-03-25 18:14:34 PDT

There are typos in upnp/src/inc/config.h "EXCLUDE_SSSDP" (shold be
EXCLUDE_SSDP), therefore EXCLUDE_SSDP is always 0, and --disable-ssdp
has no effect.
2012-03-26 14:07:52 +02:00
Fabrice Fontaine
804088d859 Remove implicit casts
Cast parameters of htonl in uint32_t in IN6_IS_ADDR_GLOBAL and
IN6_IS_ADDR_ULA definitions.
Remove comparison with 0 in while statement of vfmatch,
http_SendMessage and http_MakeMessage.
2012-03-24 22:20:18 +01:00
Yoichi NAKAYAMA
679ebeec48 SF Bug Tracker id 3510693 - build fail with --disable-device
GetDeviceHandleInfo just fail without using undefined member DeviceAf
if UPNP_HAVE_DEVICE is not defined.
Move ContentTypeHeader definition to soap_common.c, since it is
also used in soap_ctrlpt.c.
2012-03-24 13:11:23 +09:00
Marcelo Roberto Jimenez
19ec877b2a Homekeeping for the next release. 2012-03-21 19:58:13 -03:00
Marcelo Roberto Jimenez
01d7c05fb8 Adjust the library numbers for release. 2012-03-21 19:49:49 -03:00
Marcelo Roberto Jimenez
952492b44e Fixes anoying order issue in autoconfig.h
autoconf seems to generate the contents in another order, and it
generates anoying changes to git.
2012-03-21 19:45:07 -03:00
Fabrice Fontaine
a04c36f47e Replace sprintf by snprintf in http_WriteHttpPost
Replace sprintf by snprintf in http_WriteHttpPost to avoid buffer
overflow.
2012-03-18 16:14:41 +01:00
Fabrice Fontaine
e13ffe3bf8 Add infoSize parameter to get_sdk_info
Add infoSize parameter to get_sdk_info function to replace sprintf call
by a snprintf call.
2012-03-18 15:23:59 +01:00
Fabrice Fontaine
d3d17da6e5 Check return code in ixml
Check return code of ixmlDocument_CreateElementEx in
ixmlDocument_CreateElement.
Check return code of ixmlNode_setNodeName and ixmlNode_setNodeValue in
ixmlNode_cloneCDATASect and ixmlNode_cloneTextNode.
2012-03-16 17:30:27 +01:00
Marcelo Roberto Jimenez
e0444b26e6 Don't use // as comments, it breaks some C compilers
Also, really remove the dead code.
2012-03-16 11:51:10 -03:00
Fabrice Fontaine
cb07623dde Add more explicit casts and remove dead code
Comment unused SERVER from DeviceShutdown.
Comment unused max from parse_hostport.
Comment unused nodeptr from ixmlNode_cloneDoc.
Comment unused newNode from Parser_hasDefaultNamespace.
Comment unused Parser_parseReference function
Check return code of shutdown and display an error if needed.
2012-03-16 11:30:42 +01:00
Marcelo Roberto Jimenez
c9f3e26f24 Fix for compiler warning messages
src/genlib/net/http/httpreadwrite.c: In function ‘http_Download’:
src/genlib/net/http/httpreadwrite.c:790:5: warning: format ‘%d’ expects
type ‘int’, but argument 6 has type ‘size_t’
src/genlib/net/http/httpreadwrite.c:790:5: warning: format ‘%d’ expects
type ‘int’, but argument 7 has type ‘size_t’
(cherry picked from commit 5969530dcf)
2012-03-15 11:50:48 -03:00
Fabrice Fontaine
a3d038c885 Fix previous commit
Replace HAVE_UPNP_OPTSSDP by UPNP_HAVE_OPTSSDP in upnpapi.c.
2012-03-15 15:06:51 +01:00
Fabrice Fontaine
731512b0e5 Add --disable-optssdp option
Modify configure.ac to add --disable-optssdp option. This option will
remove OPT, 01-NLS and X_USER_AGENT headers from SSDP messages as those
headers are optional. If --disable-gena and disable-optssdp are both
used, uuid part will not be compiled anymore.
2012-03-15 14:13:27 +01:00
Fabrice Fontaine
76eb3f869b Bug fix in ixmlNode_allowChildren
Commit d48d73720b added a bug in
ixmlNode_allowChildren, this function was returning FALSE instead of
TRUE when newChild->nodeName was eELEMENT_NODE.
2012-03-15 11:07:54 +01:00
Fabrice Fontaine
b116d10f37 Improve upnp/genlib/net
Change ret_code from int to parse_status_t in match.
Set back return code of ReadResponseLineAndHeaders from parse_status_t
to int as this function can return UPNP_E_BAD_HTTPMSG. As a result, do
not cast the result of this function into parse_status_t in
http_OpenHttpGetProxy and http_OpenHttpGetEx.
Use switch with PARSE_OK in parsetools.c.
Add missing explicit casts of integer constants in uri.c and
httpreadwrite.c.
Use switch, int and sa_family_t with AF_INET in uri.c.
Print an error in http_Download if realloc failed.
2012-03-15 09:31:44 +01:00
Fabrice Fontaine
1a083479a9 Use switch instead of if with enums in upnpapi.c
Replace if statements with switch when using HND_DEVICE and HND_CLIENT
enum constants.
Correct also UpnpUnRegisterRootDeviceLowPower and UpnpUnRegisterClient
as those functions were wrongly awaiting an UPNP_E_INVALID_HANDLE
instead of HND_INVALID from GetHandleInfo.
2012-03-14 22:22:43 +01:00
Fabrice Fontaine
850e6b4849 Improve ssdp part
Do not compile CreateClientRequestPacketUlaGua if IPv6 is disable.
Cast DestAddr->sa_family from sa_family_t into int when calling
CreateServicePacket as this function has been set back to accept int in
a692e591de.
Use switch instead of if with AF_INET and AF_INET6.
Add missing casts from AF_INET and AF_INET6 into sa_family_t when using
them to set sin_family and sin6_family.
Add missing explicit casts into size_t or lu when using integer
constants with strlen or unsigned long indexes.
Set SSDP_PAUSE to be unsigned as it is used with usleep.
2012-03-14 21:30:55 +01:00
Fabrice Fontaine
d48d73720b Use switch insted of if with enums in ixml
Replace if statements with switch when using enums in ixml.
Remove uneeded initialization in ixmlAttr_init, Parser_init and
ixmlNode_init which was added by wrongly added in commit
06660b6383.
2012-03-14 20:04:04 +01:00
Fabrice Fontaine
b7f83bb7c6 Use switch insted of if with enums in threadutil
Replace if statements with switch when using enums in threadutil.
2012-03-14 18:52:20 +01:00
Fabrice Fontaine
05fb3f8026 Fix missing break in http_RecvMessage
There was a missing break in PARSE_INCOMPLETE_ENTITY due to commit
2eb3e069ba.
2012-03-14 18:43:14 +01:00
Yoichi NAKAYAMA
7178f300bb Fix parse failure observed with tvdevice sample.
Commit c40d2bc0c9 has a problem
at removing the parentheses in parser_parse_responseline.
Difference of pointers was used with intention, don't cast
them separately.
2012-03-15 01:02:48 +09:00
Yoichi NAKAYAMA
f7a801c3ae Fix compile error on Windows.
Include UpnpStdInt.h for ssize_t.
Define sa_family_t in UpnpInet.h.
2012-03-14 23:40:32 +09:00
Yoichi NAKAYAMA
f299d6597a Avoid ambiguous change of SsdpEvent in unique_service_name.
Handle overflow before changing SsdpEvent.
Because the behavior of "snprintf" is platform dependent in such case.
2012-03-14 23:06:46 +09:00
Yoichi NAKAYAMA
35819a7a44 SF Bug Tracker id 3502958 - The commit 5944960e prevents a pupnp client (amule) from receiving replies from an IGD device.
Previous change broke the feature. The error of unique_service_name
in ssdp_request_type should be ignored.
This reverts commit 5944960e17.
2012-03-14 23:04:51 +09:00
Marcelo Roberto Jimenez
f1c4ffefda Fix for compiler warning
src/genlib/net/sock.c: In function ‘sock_read_write’:
src/genlib/net/sock.c:172:4: warning: conversion to ‘long int’ from
‘size_t’ may change the sign of the result
2012-03-13 14:57:22 -03:00
Marcelo Roberto Jimenez
a692e591de Address family is an int
Reference: "man 2 socket".
2012-03-13 14:32:19 -03:00
Marcelo Roberto Jimenez
ad7272d2b5 SF Bug Tracker id 3175217 - Crash bug in Parser_addNamespace()
(This is a fix to commit 86bef09787)
2012-03-13 10:55:06 -03:00
Marcelo Roberto Jimenez
86bef09787 SF Bug Tracker id 3175217 - Crash bug in Parser_addNamespace()
This is a fix to commit 2fb791c9bb.
2012-03-12 11:48:21 -03:00
Fabrice Fontaine
c40d2bc0c9 Remove more implicit casts in upnp part
Remove more "implicit integer or enum conversions" errors as well as
dead code.
2012-03-11 22:45:10 +01:00
Yoichi NAKAYAMA
8e39b2af85 Suppress compiler warning in CreateClientRequestPacketUlaGua.
It is a static function and is called with AF_INET6,
so there is no real problem.
2012-03-11 21:35:03 +09:00
Fabrice Fontaine
2eb3e069ba Remove more implicit casts in upnp part
Remove more "implicit integer or enum conversions" as well as memset
before snprintf.
2012-03-10 22:52:57 +01:00
Yoichi NAKAYAMA
db532afb9b Avoid out of range access in CheckOtherHTTPHeaders.
There was a problem in HDR_ACCEPT_LANGUAGE case.
It may read from TmpBuf larger amount than allocated,
since condition was always true.
Terminate RespInstr->AcceptLanguageHeader correctly.
Skip allocation if there is already sufficient buffer.
2012-03-11 13:21:40 +09:00
Yoichi NAKAYAMA
1b38cc963a Suppress compiler warning in CreateClientRequestPacket.
It is a static function and is called with AF_INET or AF_INET6,
so there is no real problem.
2012-03-11 12:41:32 +09:00
Fabrice Fontaine
c67187ac94 Remove some of the implicit cast in upnp part
Remove some of the "implicit integer or enum conversions" as well as
some access to NULL reference in upnp part.
2012-03-10 20:44:49 +01:00
Fabrice Fontaine
d45f3c28cf Remove lock in ThreadPoolInit
If ThreadPoolInit returned EAGAIN, tp->lock was not freed.
2012-03-10 18:10:42 +01:00
Fabrice Fontaine
06660b6383 Improve ixml
Remove "implicit integer conversions" and
"dereference NULL return value" errors in ixml part.
2012-03-10 17:58:12 +01:00
Yoichi NAKAYAMA
41412c16ef Exclude IPv6 stuff in SearchByTarget when UPNP_ENABLE_IPV6 is not defined. 2012-03-11 04:00:09 +09:00
Yoichi NAKAYAMA
04e5767ea0 Use strncpy with the standard way in readFromSSDPSocket. 2012-03-11 03:54:41 +09:00
Yoichi NAKAYAMA
5944960e17 Respect unique_service_name error in ssdp_request_type.
Respect unique_service_name error in ssdp_request_type
so as not to touch non-terminated buffer under Evt.
2012-03-11 03:52:37 +09:00
Yoichi NAKAYAMA
d952ebfb44 Handle overflow in http_SendMessage. 2012-03-11 03:33:14 +09:00
Yoichi NAKAYAMA
56b44fee91 Detect overflow in addrToString called from configure_urlbase.
Pass output buffer size to addrToString and detect overflow.
Handle addrToString error in configure_urlbase.
2012-03-11 03:25:41 +09:00
Yoichi NAKAYAMA
ff635f92c0 Detect overflow in CreateClientRequestPacket(UlaGua).
Pass output buffer size to CreateClientRequestPacket(UlaGua)
from SearchByTarget and detect overflow.
Handle SearchByTarget error in UpnpSearchAsync.
2012-03-11 02:47:58 +09:00
Yoichi NAKAYAMA
19a23dafba Clarify the last argument of GetDescDocumentAndURL has size LINE_SIZE. 2012-03-11 02:15:16 +09:00
Yoichi NAKAYAMA
bd7f83feb5 For inet_ntop, use buffer with size INET6_ADDRSTRLEN or INET_ADDRSTRLEN. 2012-03-11 01:57:34 +09:00
Yoichi NAKAYAMA
e4678168fa Treat large argument as error in UpnpAddVirtualDir. 2012-03-11 01:40:48 +09:00
Yoichi NAKAYAMA
a0dc3482dc Do not clear buffer before snprintf.
It had no effect since snprintf can overwrite whole buffer.
2012-03-11 01:16:12 +09:00
Yoichi NAKAYAMA
87d1d3c3ec Add assertion and narrow variable scope in resolve_rel_url().
I've confirmed enough buffer is allocated for output.
2012-03-11 00:42:49 +09:00
Yoichi NAKAYAMA
194397b6d6 Handle allocation error in strndup to avoid access violation.
Return NULL before calling strncpy.
Platforms with HAVE_STRNDUP are not affected.
2012-03-10 23:15:37 +09:00
Yoichi NAKAYAMA
b78eaf4e43 Fix buffer size for strncpy in UpnpAddVirtualDir()
Since 1st argument precedes the beginning of the buffer,
it is necessary to reduce the value of 3rd argument.
2012-03-10 22:29:44 +09:00
Yoichi NAKAYAMA
a54d6e7e83 Synchronize autoconfig.h with upnpconfig.h.
It fixes WIN32 build where configure is not invoked.
2012-03-10 14:37:59 +09:00
Yoichi NAKAYAMA
18bf3b1c9c fix missing assignment in commit e722d8c375 2012-03-10 12:50:11 +09:00
Fabrice Fontaine
bb140000c0 More compilaton optimisation
Do not compile most of service_table.c and client_table.c if
--disable-gena is used.
Do not compile urlconfig.c if --disable-webserver is used.
Adding new UPNP_HAVE_xxx variables in upnpconfig.h and upnpconfig.h.in.
2012-03-10 00:33:17 +01:00
Fabrice Fontaine
7aef73d7eb Optimisation of --disable-webserver
Do not compile webserver.c if --disable-webserver is used.
2012-03-09 23:28:18 +01:00
Fabrice
77c73884b8 Improve threadutil
Remove "dereference NULL return" errors and implicit conversions to
double or enum types.
2012-03-09 22:49:19 +01:00
Fabrice Fontaine
72eecacf56 Optimisation of --disable-webserver
Do not compile miniserver.c if --disable-webserver is used.
2012-03-09 17:09:34 +01:00
Fabrice Fontaine
601332f88f Adding configure options
Adding --disable-ssdp, --disable-soap, --disable-gena options to
configure script.
2012-03-09 17:08:01 +01:00
Raymond Wen
4605314569 fix bug: the project can't compile on windows with vs 2005
- define UPNP_USE_MSVCPP when necessary
- set release build's output directory to be consistent with debug build
- add missing ClientSubscription.c to libupnp project
- reference correct source files in sample project

(backport of commit 0097180ce4)
2012-03-09 11:19:18 -03:00
Fabrice Fontaine
e95b4cc53a Bug fix of last commit
_snprintf was wrongly defined in ssdp_server.c
2012-03-09 16:13:43 +01:00
Fabrice Fontaine
e722d8c375 SF Bug Tracker id 3499781 - msvc doesn't have snprintf
Submitted: Yoichi NAKAYAMA ( yoichi ) - 2012-03-08 10:18:39 PST

97a17ff5ad commit breaks build on
windows/msvc since there is no snprintf.

Note:
* Some existing sources use _snprintf when WIN32 is defined, but its
behavior is a bit different from C99 snprintf.
* snprintf does terminate the buffer, so the commit (use buffer size
minus 1 as argument) changes the behavior at the boundary.
* Truncation might be better than crash in some cases. But it may
result in not good.
2012-03-09 15:02:49 +01:00
Marcelo Roberto Jimenez
29ee36b1ca SF Bug Tracker id 3499878 - UpnpUnSubscribeAsync(): ‘retVal’ may be used uninitialized
Submitted: Marcelo Roberto Jimenez ( mroberto ) - 2012-03-08 12:38:57 PST

src/api/upnpapi.c: In function ‘UpnpUnSubscribeAsync’:
src/api/upnpapi.c:2060:6: warning: ‘retVal’ may be used uninitialized in this function
2012-03-08 17:42:02 -03:00
Marcelo Roberto Jimenez
2fb791c9bb SF Bug Tracker id 3175217 - Crash bug in Parser_addNamespace()
Submitted: Terry Farnham ( tfarnham ) - 2011-02-07 09:25:25 PST

Details: The strcmp(pNode->prefix,pCur->prefix) crashes on pCur->prefix
being NULL. This occurs on invalidly formatted xml where a node uses an
undefined namespace. I would expect to receive IXML_FAILED in this
situation.
2012-03-08 13:51:29 -03:00
Marcelo Roberto Jimenez
d909297aa7 White spaces and coding style 2012-03-08 13:39:31 -03:00
Fabrice Fontaine
9b616a08df Removing access to NULL pointers in node.c and element.c
Check that newNode is not NULL ixmlNode_cloneNodeTree and pass newAttr
as the return node in the ixmlElement_setAttributeNodeNS call of
ixmlElement_setAttributeNS.
2012-03-08 16:09:03 +01:00
Fabrice Fontaine
3ab8d536a0 Memory leaks correction in upnpapi.c
Fix memory leaks in UpnpUnSubscribe, SendActionExAsync and
RenewSubscription.
2012-03-08 15:40:23 +01:00
Fabrice Fontaine
4f34a12a83 SF Bug Tracker id 3496993 - Write after free in ixmlNode_insertBefore
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 04:54:40 PST

If ixmlNode_isParent(nodeptr, newChild) returns TRUE,
ixmlNode_removeChild(nodeptr, newChild, NULL) will free newChild before
the modifications of newChild->nextSibling and newChild->prevSibling.
2012-03-08 14:22:54 +01:00
Fabrice Fontaine
97a17ff5ad Remove most of strcpy, sprintf and strcat
Replace strcpy, sprintf and strcat by strncpy, snprintf and strncat to
avoid buffer overflows.
2012-03-08 14:07:27 +01:00
zephyrus
9965f02727 SF Patches Tracker id 3498437 - a header patch: ixml.h 1.6.15
Submitted: zephyrus ( zephyrus00jp ) - 2012-03-07 02:31:14 PST

Details: a function is declared as
EXPORT_SPEC IXML_Document *ixmlDocument_createDocument();

This should read as follows in order to suppress strict prototype checking by GCC.
EXPORT_SPEC IXML_Document *ixmlDocument_createDocument(void);
2012-03-07 17:15:54 -03:00
Marcelo Roberto Jimenez
861a538cea White spaces, coding style 2012-03-07 15:07:50 -03:00
Marcelo Roberto Jimenez
c12d33aca6 White spaces, coding style 2012-03-07 15:06:26 -03:00
Yoichi NAKAYAMA
4c3532585d SF Bug Tracker id 3497714 - Buffer overflows
Fix compile error on WIN32.

Local variables must be declared first.
Remove outdated comment.
2012-03-08 01:37:03 +09:00
Yoichi NAKAYAMA
71ab707e81 Avoid access violation in assertion.
xmlParser->pCurElement was dereferenced before null check.
Affects debug build only.
2012-03-08 01:22:59 +09:00
Fabrice Fontaine
cec9d55c4c Remove SIZEOF_MISTACH error in notify_send_and_recv
Replace sizeof(CRLF) by strlen(CRLF) as CRLF is a const char*.
2012-03-07 14:30:37 +01:00
Fabrice Fontaine
56c26b5199 SF Bug Tracker id 3498442 - Memory leak in get_file_info
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-07 02:44:30 PST

info->contentType is not freed before being set to NULL.
2012-03-07 12:49:13 +01:00
Fabrice Fontaine
0469388b73 SF Bug Tracker id 3498439 - Memory leak in removeServiceTable
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-07 02:35:46 PST

UDN is not freed.
2012-03-07 12:41:21 +01:00
Fabrice Fontaine
268abf72fb SF Bug Tracker id 3498436 - Memory leak in Parser_processAttributeName
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-07 02:30:57 PST

attr is not freed if ixmlNode_setNodeProperties or
ixmlNode_setAttributeNode return an error in
Parser_processAttributeName.
2012-03-07 12:36:45 +01:00
Fabrice Fontaine
288ef35cee Fixing an error in d6db7c555d commit
Evt.Sid should not be cast into char* when calling sizeof otherwise
size will be 4.
2012-03-07 10:26:42 +01:00
Fabrice Fontaine
7ef089b09a Removing two unused variables in ssdp_server.c
Removing first TempPtr allocation in unique_service_name as well as one
of the dbgStr allocation in AdvertizeAndReply as those values were not
used.
2012-03-06 18:36:48 +01:00
Fabrice Fontaine
c13b1f7e37 SF Bug Tracker id 3497714 - Buffer overflows
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-06 07:36:08 PST

Call to strcpy should be replaced by call to memset and strncpy to
avoid getting buffer overflows.
2012-03-06 17:41:47 +01:00
Fabrice Fontaine
3e7bf14488 Merge branch 'branch-1.6.x' of ssh://pupnp.git.sourceforge.net/gitroot/pupnp/pupnp into branch-1.6.x 2012-03-06 09:58:54 +01:00
Fabrice Fontaine
a8bcbe9491 SF Bug Tracker id 3497159 - Bug fix in Parser_readFileOrBuffer
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 14:20:58 PST

fileSize = ftell( xmlFilePtr ); can return a negative value, in this
case the function should exit (at the moment, the function exits only
if ftell returns 0).
2012-03-06 00:23:54 +01:00
Fabrice Fontaine
1a1570fe0f SF Bug Tracker id 3497140 - Bug fix in http_get_code_text
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 13:07:03 PST

Replace if( statusCode < 100 && statusCode >= 600 ) which can't be true
by if( statusCode < 100 || statusCode >= 600 ).
2012-03-06 00:14:45 +01:00
Fabrice Fontaine
30badb44c7 SF Bug Tracker id 3497126 - Resource leak in http_RecvPostMessage
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 12:33:59 PST

Fp is not closed when an error is raised on membuffer_append or
sock_read.
2012-03-05 22:35:54 +01:00
Nick Leverton
3504b13eae SF Bug Tracker id 2989399 - UpnpSetVirtualDirCallbacks API removal in 1.6.x
Submitted: Nick Leverton ( leveret ) - 2010-04-19 07:44:10 PDT

Details: The recent codebase merge has removed a significant API call
which is used by several pupnp devices such as mediatomb and gmediaserver.
UpnpSetVirtualDirCallbacks() has been replaced by individual routines to
set each callback. Essentially this means that 1.6.7 will in fact be a majo
bump and 1.6.6 devices can no longer link against it. Could we have the call
reinstated please, perhaps as a wrapper around the individual calls ? As
it is, all distros will have to patch their 1.6.x apps, rebuild and re-link them.

The other removed API calls and external variables don't seem to be used
by any of the apps I have copies of, but UpnpSetVirtualDirCallbacks is
important for maintaining compatibility within 1.6.x.
2012-03-05 18:21:49 -03:00
Yoichi NAKAYAMA
d6f1e4112e SF Bug Tracker id 3325246 - Memory Leak in XML Parser
Submitted: Terry Farnham ( tfarnham ) - 2011-06-23 09:45:54 PDT

Details: The following bit of xml results in a memory leak from the xml
parser:

const char *xmlbuffer="<?xml version=\"1.0\" encoding=\"utf-8\"?>
<root xmlns=\"urn:schemas-upnp-org:device-1-0\" xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\">
<dlna:X_DLNADOC xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\">DMS-1.50</dlna:X_DLNADOC></root>";

When I execute the following code:

IXML_Document *doc = ixmlParseBuffer(xmlbuffer);
ixmlDocument_free(doc);

It results in a memory leak in ixmlparser.c line 2107 where it calls
safe_strdup( newElement->namespaceURI ); It's difficult to figure out why.
2012-03-05 16:59:15 -03:00
Yoichi NAKAYAMA
e5887c9036 SF Bug Tracker id 3417134 - Crash seen in UpnpFinish
Submitted: Sunil ( sunilangadi ) - 2011-10-02 08:28:47 PDT

Details: I observed crash in the below mentioned log statement in
function upnpfinish(file: upnpapi.c).
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Exiting UpnpFinish:
	UpnpSdkInit is :%d:\n", UpnpSdkInit);

In particular it was crashing in ithread_self in
UpnpDisplayFileAndLine(file upnpdebug.c) on WIN32.

Moving the call ithread_cleanup_library() below the upnp printf call
mentioned above in function upnpfinish fixed the crash but I couldn't get
to the root of the problem.

The problem was observed on WIN32.
2012-03-05 15:05:20 -03:00
Fabrice Fontaine
eeab71082f SF Bug Tracker id 3497034 - Buffer not null terminated in UpnpGetIfInfo
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 06:43:52 PST

gIF_NAME might be not null terminated.
2012-03-05 17:43:26 +01:00
Fabrice Fontaine
f6e88d5b0a SF Bug Tracker id 3497033 - Buffer not null terminated in UpnpInit
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 06:42:18 PST

gIF_IPV4, gIF_IPV6 and gIF_IPV6_ULA_GUA might be not null terminated.
Moreover, gIF_IPV4 should be 16 characters (INET_ADDRSTRLEN) and not 22
and gIF_IPV6 should be 46 characters (INET6_ADDRSTRLEN) and not 65.
2012-03-05 17:36:41 +01:00
Fabrice Fontaine
add51536fc Bug fix of lastest commit (parse_hostport)
Missing parenthesis in memset.
2012-03-05 17:31:20 +01:00
Fabrice Fontaine
40864da7c1 SF Bug Tracker id 3497027 - Buffer not null terminated in parse_hostport
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 06:28:38 PST

workbuf might be not null terminated.
2012-03-05 17:13:08 +01:00
Fabrice Fontaine
5caaf3ad07 SF Bug Tracker id 3497009 - Resource leak in http_SendMessage
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 05:51:44 PST

Fp is not closed if fseeko(Fp, Instr->RangeOffset, SEEK_CUR) does not return 0.
2012-03-05 17:12:15 +01:00
Fabrice Fontaine
26c3f87eca HInfo->ServiceTable initialization in UpnpRegisterRootDevice2 and UpnpRegisterRootDevice4
Initialize also HInfo->ServiceTable in UpnpRegisterRootDevice2 and
UpnpRegisterRootDevice4 functions
2012-03-05 12:43:07 +01:00
Yoichi NAKAYAMA
20372ccef6 Initialize ServiceTable. 2012-03-05 12:36:29 +01:00
Yoichi NAKAYAMA
47c86542bc Add error handling. 2012-03-05 12:26:41 +01:00
Fabrice Fontaine
da244683cf SF Bug Tracker id 3496942 - Memory leak in config_description_doc
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:55:54 PST

element was not freed if membuffer_append_str(&url_str, "http://") does
not return 0. Moreover addNew was not used.
2012-03-05 11:58:54 +01:00
Fabrice Fontaine
7301f46269 SF Bug Tracker id 3496938 - Missing structures initialisation in some functions
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:31:16 PST

Memsetting to 0 some of the structures: finfo in process_request,
job in readFromSSDPSocket, request in http_OpenHttpGetEx, job in
genaNotifyThread, job in genaNotifyAllExt, job in genaNotifyAll,
job in genaInitNotifyExt, job in genaInitNotify, LocalAddr in
getlocalhostname.
2012-03-05 11:52:22 +01:00
Fabrice Fontaine
bd203e780e SF Bug Tracker id 3496934 - Memory leaks in getlocalhostname and UpnpGetIfInfo
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:25:42 PST

LocalSock is not closed if ioctl(LocalSock, SIOCGIFCONF, &ifConf);
returns an error.
2012-03-05 11:33:12 +01:00
Fabrice Fontaine
69f3fe2330 SF Bug Tracker id 3496933 - Out-of-bounds access in CheckOtherHTTPHeaders
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-05 01:15:34 PST

An out-of-bands access is raised because size of
RespInst->AcceptLanguageHeader is 200 and TmpBuf size is 180.
2012-03-05 11:20:07 +01:00
Fabrice Fontaine
52df3081df Remove unused currentDevice variable in removeServiceTable
currentDevice is not used in this function.
2012-03-05 11:12:37 +01:00
Fabrice Fontaine
71e77a5b27 SF Bug Tracker id 3496581 - Memory leak in getServiceList
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-03-03 08:43:23 PST

serviceNodeList is not freed if
current->next = malloc(sizeof(service_info)); returns NULL.
2012-03-05 10:59:20 +01:00
Fabrice Fontaine
a79a149e6a SF Bug Tracker id 3495616 - Memory leak in ixmlElement_setAttributeNS
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-02-29 02:09:43 PST

newAttrNode is not freed if newAttr->n.nodeValue = strdup(value); returns
NULL or if ixmlElement_setAttributeNodeNS(element, newAttr, NULL) does
not return IXML_SUCCESS.
2012-03-01 14:04:26 +01:00
Fabrice Fontaine
0693adc7dc SF Bug Tracker id 3495286 - Double free in get_action_node
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-02-28 04:27:54 PST

ixmlFreeDOMString(ActNodeName); is called twice if
ixmlParseBufferEx(ActNodeName, RespNode); does not return IXML_SUCCESS.
2012-03-01 14:02:34 +01:00
Fabrice Fontaine
076f8e5be6 SF Bug Tracker id 3495280 - Memory leak in ixmlDocument_createElementEx
Submitted: Fabrice Fontaine ( ffontaine ) - 2012-02-28 04:01:02 PST

There is a memory leak in ixmlDocument_createElementEx:
newElement->tagName is not freed if
newElement->n.nodeName = strdup(tagName); returns NULL.
2012-03-01 10:47:10 +01:00
Fabrice Fontaine
60f9df425b SF Bug Tracker id 3494865 - Use of non-initialized variable in parser_parse_requestline
Submitted: Marcelo Roberto jimenez ( mroberto ) - 2012-02-26 16:50:23 PST

src/genlib/net/http/httpparser.c: In function ‘parser_parse_requestline’:
src/genlib/net/http/httpparser.c:1319:28: warning: ‘index’ may be used uninitialized in this function
(cherry picked from commit 9125d82010)
2012-02-29 15:15:28 -03:00
Marcelo Roberto Jimenez
fa83dd4a00 Update of THANKS file 2012-02-26 21:58:28 -03:00
Marcelo Roberto Jimenez
795de3e077 SF Bug Tracker id 3489999 - UpnpString leaks in genaSubscribe()
Submitted: Yoichi NAKAYAMA ( yoichi ) - 2012-02-21 07:06:35 PST

In genaSubscribe() (defined in upnp/src/gena/gena_ctrlpt.c),
ActualSID and EventURL will not be freed if ScheduleGenaAutoRenew
returns UPNP_E_SUCCESS.

This fixes the an issue introduced by the previous fix.
2012-02-26 21:36:24 -03:00
Yoichi NAKAYAMA
a567576100 Remove files missing in branch-1.6.x. 2012-02-26 01:36:59 -03:00
Marcelo Roberto Jimenez
bc473d5e68 SF Bug Tracker id 3489999 - UpnpString leaks in genaSubscribe()
Submitted: Yoichi NAKAYAMA ( yoichi ) - 2012-02-21 07:06:35 PST

In genaSubscribe() (defined in upnp/src/gena/gena_ctrlpt.c),
ActualSID and EventURL will not be freed if ScheduleGenaAutoRenew
returns UPNP_E_SUCCESS.

This fixes the original issue.
2012-02-26 01:12:59 -03:00
Marcelo Roberto Jimenez
2940cbf94a SF Bug Tracker: UpnpString leaks in genaSubscribe()
In genaSubscribe() (defined in upnp/src/gena/gena_ctrlpt.c),
ActualSID and EventURL will not be freed.
2012-02-23 16:30:19 -02:00
Marcelo Roberto Jimenez
d87c966ec5 SF Bug Tracker: http lib only accepts HTTP/1.1 - ID:3485745
Submitted by Berend Dekens ( Berend Dekens ) - 2012-02-08 06:24:31 PST

In httpparser.c on line 1385 it says that HTTP 1.0 replies are blocked
because the UPnP verfication tool requires this.

I looked in the specs and as far as I can find, one should only be
carefull to send chunked communication to hosts supporting HTTP 1.1.
There is no requirement to support only HTTP 1.1.

The XBMC media server uses the Platinum UPnP library which replies
using HTTP/1.0 messages. As it is now, libupnp returns an error while
trying to parse the response while the response itself is completely
valid.

Is there a requirement in the UPnP 1.0 spec that I missed or is this
restriction self-imposed? And can it be lifted?

-------------------------------------------------------------------

Comment by Fabrice Fontaine:

Hide
Hi,

You're right, this modification should be removed. This version checking
was wrongly added in parser_parse_responseline function.

...
2012-02-23 15:29:45 -02:00
Marcelo Roberto Jimenez
e88d9dbedc White spaces. 2012-02-23 15:20:02 -02:00
Fabrice Fontaine
33fcfeb79f Bug fix for IPv4-mapped IPv6 addresses.
Setting IPv6 sockets with IPV6_V6ONLY flag to avoid getting IP packets
with IPv4-mapped IPv6 addresses on IPv6 sockets.
2012-02-18 16:05:50 -02:00
Edwin Stearns
a9c24fc7f3 Be nice to a server that returns its URL without a trailing slash
Attached is a patch that resolved an issue I found with a server that
gave its device description URI without a trailing slash (e.g.
`http://127.0.0.1:5555`).
2012-02-18 11:35:21 -02:00
Fabrice Fontaine
537581d8ad Bug fix for IPv4-mapped IPv6 addresses.
Setting IPv6 sockets with IPV6_V6ONLY flag to avoid getting IP packets
with IPv4-mapped IPv6 addresses on IPv6 sockets.
2012-02-18 11:22:53 -02:00
Marcelo Roberto Jimenez
66ea2ab11d Homekeeping for the next release. 2012-01-25 10:40:26 -02:00
Marcelo Roberto Jimenez
4ca0b382ea Adjust the library numbers for release. 2012-01-25 10:34:43 -02:00
Fabrice Fontaine
c155d3c68f Bug fix on M-SEARCH for IPv6 CPs.
Small bug fix on IPv6 Control Point: now CP will also send M-SEARCH on
site-scope address (FF05::C) instead of only sending M-SEARCH on
link-scope (FF02::C).
2012-01-25 09:56:02 -02:00
Fabrice Fontaine
03bd7759cd Retrieve IPv6 addresses in Upnp_Discovery.
Changing sockaddr_in into sockaddr_storage in Upnp_Discovery to be able
to retrieve IPv6 addresses of devices in Control Points using pupnp.
2012-01-25 09:54:14 -02:00
Fabrice Fontaine
80a65e5f61 Bug fix for IPv4-mapped IPv6 addresses.
Setting IPv6 sockets with IPV6_V6ONLY flag to avoid getting IP packets
with IPv4-mapped IPv6 addresses on IPv6 sockets.
2012-01-25 09:41:59 -02:00
Marcelo Roberto Jimenez
3b33626e2f Fix for return value of UpnpResolveURL and UpnpResolveURL2
SF Bug tracker, ID: 3469344
	Submitted: dimmman ( dimmman ) - 2012-01-04 01:44:29 PST
	Details: Looking at the code (v1.6.14, upnptools.c) for UpnpResolveURL
	and UpnpResolveURL2 it shows that the ExitFunction: always returns
	UPNP_E_SUCCESS.

	I'm farily sure it's a simple mistake that should have been "return ret;"
	in both cases.

	Br,
	Jonny
2012-01-09 08:58:03 -02:00
Marcelo Roberto Jimenez
b35761e893 Homekeeping for the next release. 2011-11-14 12:54:21 -02:00
Marcelo Roberto Jimenez
631259dcfc Adjust the library numbers for release. 2011-11-14 12:20:20 -02:00
Fabrice Fontaine
98e4f938d6 UPnP Low Power support
Adding two new functions (UpnpSendAdvertisementLowPower and
UpnpUnRegisterRootDeviceLowPower) which can be used to specify values
for the three SSDP headers defined by UPnP Low Power. Those headers are
Powerstate, SleepPeriod and RegistrationState.
2011-11-04 20:21:58 -02:00
Fabrice Fontaine
92c93a8010 Bug fix in IN6_IS_ADDR_GLOBAL.
Changing IN6_IS_ADDR_GLOBAL to accept all IPv6 addresses which have a
2000::/3 prefix.
2011-11-01 18:59:49 -02:00
Nick Leverton
e40e6b49d4 Summary: upnptools.h should #include upnpconfig.h - ID: 3426326
(cherry picked from commit ef7bbc4866)
2011-10-20 12:30:05 +01:00
Marcelo Roberto Jimenez
cec07d641a autoconfig.h for windows builds. 2011-07-20 06:21:32 -03:00
Fabrice Fontaine
6c6fb3707f Bug Fix on M-SEARCH.
Do not answer to M-SEARCH using HTTP version 1.0 as specified by the
UPnP Device Architecture.
2011-07-20 06:10:07 -03:00
Iain Denniston
92ea719804 Fixes for compilation under Windows (specifically MSVC). Also added MSVC supported "_inline", and fixed some WIN32 specific warnings. 2011-04-02 23:47:00 -03:00
Iain Denniston
fed316ff3e Several fixes to correctly use SOCKET (and related) types instead of non-portable variations. 2011-04-02 23:38:53 -03:00
Marcelo Roberto Jimenez
8eb7d1c1a5 Homekeeping for the next release. 2011-03-17 09:27:55 -03:00
Marcelo Roberto Jimenez
2b263b6574 Adjust the library numbers for release. 2011-03-17 09:15:19 -03:00
Marcelo Roberto Jimenez
e16cb4b225 Silence compiler warning message.
warning: unused parameter ‘listen_port6’
2011-03-15 18:27:17 -03:00
Fabrice Fontaine
0996d23318 Putting ssdpReqSocks under compilation flag.
Putting all access to ssdpReqSock4 and ssdpReqSock6 under
INCLUDE_CLIENT_APIS compilation flag to be able to compile when
client part of library is disable.
2011-03-15 18:22:30 -03:00
Fabrice Fontaine
11f9a2bafe New UpnpRegisterRootDevice4 for legacy CPs.
Add a new UpnpRegisterRootDevice4 which allow user to specify a
description URL to be returned for legacy CPs (for example, CPs
searching for a v1 when the device is v2). Most of those CPs does not
work if they found a v2 in the XML description, so this new function is
only used to solve interoperability issues.
2011-03-15 18:17:05 -03:00
Iain Denniston
8aca337de7 Fix for memory leak 2011-03-11 18:33:43 -03:00
Iain Denniston
a78a048577 Fix and Update of MSVC9 solution and project files 2011-03-11 18:07:49 -03:00
Iain Denniston
7338411c08 Partial fix for UpnpGetIfInfo with MSVC 2011-03-11 17:52:07 -03:00
Marcelo Roberto Jimenez
3a9ae348bc Created the macros PRIzd and PRIzx to deal with MSVC lack of C99.
Thanks to Iain Denniston for pointing it out.
2011-03-11 17:20:17 -03:00
Iain Denniston
840669b253 Fixes for headers when compiled under C++ 2011-03-11 16:07:51 -03:00
Marcelo Roberto Jimenez
e30e7bd586 Fix for uuid_unpack incorrect shift precedence. 2011-03-10 16:21:25 -03:00
Marcelo Roberto Jimenez
0d3412bb24 Homekeeping for the next release. 2011-02-08 21:48:46 -02:00
Marcelo Roberto Jimenez
e52dafda3b Adjust the library numbers for release. 2011-02-08 21:44:31 -02:00
Marcelo Roberto Jimenez
bab22c694b Undo the "incorrectly exported include files".
Legacy applications like linux-igd and igd2-for-linux are using those
API to create a thread pool for managing their GENA events.

Leave it to be reworked in 1.8.x.
2011-02-08 21:37:13 -02:00
Marcelo Roberto Jimenez
74665acd57 Homekeeping for the next release. 2011-02-07 22:41:08 -02:00
Marcelo Roberto Jimenez
b1629b8ac8 Adjust the library numbers for release. 2011-02-07 22:35:57 -02:00
Marcelo Roberto Jimenez
32e510b45a Remove PrintThreadPoolStats() from the public API.
This function uses a ThreadPool object as an argument, which is not
supposed to be exported. Also, debug compilation was broken.
2011-02-07 22:33:42 -02:00
Fabrice Fontaine
063d472f80 Major bug fix in IPv6 code.
Major bug fix in miniserver.c for IPv6, bug was introduced when
changing implementation of get_port in November 20th 2010 ("gena:fix
several compiler warnings" commit).
2011-02-07 21:27:41 -02:00
Marcelo Roberto Jimenez
0bbe9f62df Fix for incorrectly exported include files.
The files FreeList.h, LinkedList.h, ThreadPool.h and TimerThread.h
from the threautil library were being installed in the include
directory of the library, incorrectly exposing internal data structure
of the library.
2011-02-06 11:52:47 -02:00
Marcelo Roberto Jimenez
fdb8b9ef2f White spaces and indentation. 2011-01-30 09:40:48 -02:00
Chandra Penke
6c125feea0 Fix for compilation errors
Fix for compilation warnings of unused variables in upnpdebug.c in
release builds.
2011-01-30 09:36:05 -02:00
Chandra Penke
c4e9757bcf Fix for Race condition can hang miniserver thread.
Add 'requiredThreads' field to the ThreadPool structure, to avoid
a race condition when waiting for a new thread to be created. The
race condition occurs when a thread is destroyed while the master
thread is waiting for a new thread to be created.

Thanks to Chuck Thomason for pointing the problem.

Summary: Race condition can hang miniserver thread - ID: 3158591

Details:
Hello,

I have found a race condition in the thread pool handling of
libupnp-1.6.6 that periodically results in the miniserver thread
getting blocked infinitely.

In my setup, I have the miniserver thread pool configured with 1
job per thread, 2 threads minimum, and 50 threads maximum.

Just before the lockup occurs, the miniserver thread pool contains
2 threads: one worker thread hanging around from a previous HTTP
request job (let's call that thread "old_worker") and the
miniserver thread itself.

A new HTTP request comes in. Accordingly, the miniserver enters
schedule_request_job() and then ThreadPoolAdd(). In
ThreadPoolAdd(), the job gets added to the medium-priority queue,
and AddWorker() is called. In AddWorker(), jobs = 1 and threads =
1, so CreateWorker gets called.

When we enter CreateWorker(), tp->totalThreads is 2, so
currentThreads is 3. The function creates a new thread and then
blocks on tp->start_and_shutdown. The miniserver thread expects
the newly created thread to increment tp->totalThreads and then
signal the condition variable to wake up the miniserver thread and
let it proceed.

The newly created thread starts in the WorkerThread() function. It
increments tp->totalThreads to 3, does a broadcast on the
start_and_shutdown condition, and starts running its job. However,
before the miniserver thread wakes up, "old_worker" times out. It
sees that there are no jobs in any queue and that the total number
of threads (3) is more than the minimum (2). As a result, it
reduces tp->totalThreads to 2 and dies.

Now the miniserver thread finally wakes up. It checks
tp->totalThreads and sees that its value is 2, so it blocks on
tp->start_and_shutdown again. It has now "missed" seeing
tp->totalThreads get incremented to 3 and will never be unblocked
again.

When this issue does occur for a server device, the miniserver
port remains open, but becomes unresponsive since the miniserver
thread is stuck. SSDP alive messages keep getting sent out, as
they are handled by a separate thread. Reproducing the issue is
difficult due to the timing coincidence involved, but in my
environment I am presently seeing it at least once a day. I
figured out the sequence described above through addition of my
own debug logs.

The relevant code involved in this bug has not changed
substantially in libupnp-1.6.10, though I am planning to test
against 1.6.10 as well in the near future.

Do you have any input for an elegant fix for this issue?

Thanks,

Chuck Thomason
2011-01-20 04:45:27 -02:00
Marcelo Roberto Jimenez
639d3a5a03 Update the documentation about samples in README.
Thanks to Tom (tomdev2).
2011-01-17 11:36:52 -02:00
Chandra Penke
f46683fd0e Fix for typo in strndup() function definition. 2011-01-17 09:03:34 -02:00
Marcelo Roberto Jimenez
abfa841318 Define _FILE_OFFSET_BITS, _LARGEFILE_SOURCE and _LARGE_FILE_SOURCE in upnpconfig.h.
Make these definitions available to programs using the library.
Thanks to Chandra Penke for pointing the problem.
2011-01-16 22:38:18 -02:00
Chandra Penke
3c4ff99cdb Allow virtual callbacks to use chunked encoding by setting the file length of a UpnpFileInfo object to be UPNP_USING_CHUNKED. 2011-01-16 21:28:13 -02:00
Marcelo Roberto Jimenez
541679d651 Use config.h to test for the availability of strndup() and strnlen(). 2011-01-16 21:05:07 -02:00
Chandra Penke
cb1188d2bc Fixes chunked transfer encoding in HTTP client API 2011-01-15 21:11:24 -02:00
Marcelo Roberto Jimenez
189ce59dbe Null termination of strndup() implementation on systems missing it.
Also, implementation of strnlen() on systems missing it.
2011-01-14 22:05:22 -02:00
Marcelo Roberto Jimenez
4815e52586 Doxygen on membuffer. 2011-01-14 10:26:45 -02:00
Marcelo Roberto Jimenez
9051731a93 Minor change in membuffer.c to include "membuffer.h"
...without looking in the standard header path. This allows pupnp
to build in xcode.
2011-01-14 09:54:59 -02:00
Marcelo Roberto Jimenez
39fd869db8 Leave just one call to gmtime() in http_MakeMessage(). 2011-01-02 22:36:13 -02:00
Marcelo Roberto Jimenez
8997e7fff6 Make sure va_end() is called in http_MakeMessage(). 2011-01-02 22:31:10 -02:00
Marcelo Roberto Jimenez
7e8d1787c9 Fixes many problems in sample code.
In particular, undoes 25c908c558:
SF Patch Tracker [ 2836704 ] Search for nested serviceList (not
stopping at the first lis
Submitted By: zephyrus ( zephyrus00jp )

The original zephyrus' code is still #ifdef'd in the file, if someone
wishes to fix it, check for "#ifdef OLD_FIND_SERVICE_CODE".
2010-12-23 22:22:32 -02:00
Marcelo Roberto Jimenez
70d2a7c9e7 Simplify code in SampleUtil_GetFirstDocumentItem(). 2010-12-23 18:40:53 -02:00
Marcelo Roberto Jimenez
40e6e4503c Doxygen and white spaces in samples. 2010-12-22 11:54:45 -02:00
Marcelo Roberto Jimenez
4b0c8d52b8 Remove unnecessary inclusion of param.h. 2010-12-22 11:02:14 -02:00
Marcelo Roberto Jimenez
c05bbec6ec Fix for segfault in sample code. 2010-12-22 10:52:29 -02:00
Marcelo Roberto Jimenez
d5af7efeb8 Fix debug compilation when CFLAGS is set on the configure line. 2010-12-22 09:58:48 -02:00
Marcelo Roberto Jimenez
c8af5ec806 White spaces and some debugging information. 2010-12-22 09:55:48 -02:00
Marcelo Roberto Jimenez
1ee8cd9e1a Ivan Romanov's system file inclusion patch for WIN32 (mingw). 2010-12-21 08:33:57 -02:00
Marcelo Roberto Jimenez
a0ebf23785 Missed this inline in ssdplib.h. 2010-12-19 22:57:01 -02:00
Marcelo Roberto Jimenez
cdf35baa34 Remove unused enum SsdpCmdType and unused typedef Event. 2010-12-19 22:53:08 -02:00
Marcelo Roberto Jimenez
6d7702d3a7 Syncronize ssdplib in 1.6.x and 1.8.x, part 2. 2010-12-19 21:39:19 -02:00
Marcelo Roberto Jimenez
6af93e6ca6 White spaces. 2010-12-19 21:19:44 -02:00
Marcelo Roberto Jimenez
2ce88f80f0 Syncronize ssdplib in 1.6.x and 1.8.x. 2010-12-19 21:14:39 -02:00
Marcelo Roberto Jimenez
f67ed1949b Less include file mess and doxygenation. 2010-12-19 19:02:42 -02:00
Marcelo Roberto Jimenez
04d64a893b Doxygenation of SSDP library. 2010-12-19 13:41:58 -02:00
Marcelo Roberto Jimenez
704dca3df1 Doxygen. 2010-12-18 20:01:49 -02:00
Marcelo Roberto Jimenez
b2a88aa70b SF Tracker: Patches - Fedora mingw32 compilation - ID: 3138849
Details:
Hello. I trying compile libupnp-1.6.10 on the Fedora 14 MinGW
Environment and get many errors. I create patch to fix it. With this
patch i can get static library. This patch is very raw.

Submitted: Ivan Romanov (ivanromanov) - 2010-12-16 23:29:19 UTC
2010-12-18 19:29:24 -02:00
Marcelo Roberto Jimenez
bb5a80c05b Get rid of useless integer typedefs.
Remove unsigned32, unsigned16 and unsigned8 references in the code.
2010-12-18 18:17:14 -02:00
Marcelo Roberto Jimenez
7e8e5621a8 Remove unnecessary header <sys/utsname.h> from upnpapi.c. 2010-12-18 18:09:35 -02:00
Marcelo Roberto Jimenez
462505ff62 Use the new include files UpnpIntTypes.h, UpnpStdInt.h and UpnpUniStd.h.
Trying to keep platform dependency on the headers and clean the main
code a little bit.
2010-12-18 17:08:36 -02:00
Marcelo Roberto Jimenez
d6418b3e17 White spaces. 2010-12-18 16:00:35 -02:00
Marcelo Roberto Jimenez
e8106e4f05 Doxygen. 2010-12-13 09:33:49 -02:00
Marcelo Roberto Jimenez
3dd133a03c Homekeeping for the next release. 2010-12-11 16:42:20 -02:00
Marcelo Roberto Jimenez
79aa205657 Adjust the library numbers for release. 2010-12-11 16:35:29 -02:00
Marcelo Roberto Jimenez
9a28fcc95b Fixes a bug introduced in a previous commit in http_SendMessage.
The variable num_read was beeing used without beeing initialized.

Also, clean up the function return path and make sure va_end()
is beeing called.
2010-11-24 11:26:00 -02:00
Marcelo Roberto Jimenez
bfbd07cb40 Reformat calls to http_SendMessage(). 2010-11-24 11:12:33 -02:00
Marcelo Roberto Jimenez
255d5ee874 soap_device: Doxygen and code reformat. 2010-11-24 11:10:18 -02:00
Fabrice Fontaine
2c3bce13bd Major bug fix in http_SendMessage.
Currently, http_SendMessage was not able to write to write a buffer
due to a bad use of file_buf instead of buf. This bug was introduced by
the 0197-Doxygen-reformating-compiler-warnings patch.
2010-11-24 08:21:41 -02:00
Fabrice Fontaine
bda942b22a Returning the SID in Upnp_Event_Subscribe.
Currently, Upnp_Event_Subscribe always contains an empty chain in the
Sid parameter. This patch now saves the client Subscription ID in this
parameter so Control Points can see and use the same SID in the
Upnp_Event_Subscribe and in the Upnp_Event structures.
2010-11-24 08:21:33 -02:00
Juergen Lock
ed0ebe1588 Two fixes from Juergen Lock <nox(at)jelal.kn-bremen.de>:
1. varargs:  pass size of CRLF as size_t not as int:

--- upnp/src/gena/gena_device.c.orig
+++ upnp/src/gena/gena_device.c
@@ -225,7 +225,7 @@ static UPNP_INLINE int notify_send_and_r
		"bbb",
		start_msg.buf, start_msg.length,
		propertySet, strlen(propertySet),
-		"\r\n", 2);
+		"\r\n", sizeof "\r\n" - 1);
	if (ret_code) {
		membuffer_destroy(&start_msg);
		sock_destroy(&info, SD_BOTH);

2. Remove "b" arg here, there is no buffer passed:  (this caused a pointer
to be interpreted as a buffer size to be alloc'd/copied, hence the 32 GB.)

--- upnp/src/genlib/net/http/webserver.c.orig
+++ upnp/src/genlib/net/http/webserver.c
@@ -1262,7 +1262,7 @@ static int process_request(
			// Content-Range: bytes 222-3333/4000  HTTP_PARTIAL_CONTENT
			// Transfer-Encoding: chunked
			if (http_MakeMessage(headers, resp_major, resp_minor,
-				"R" "TLD" "s" "tcS" "b" "Xc" "sCc",
+				"R" "TLD" "s" "tcS" "Xc" "sCc",
				HTTP_OK,    // status code
				finfo.content_type, // content type
				RespInstr,  // language info
2010-11-22 23:28:56 -02:00
Marcelo Roberto Jimenez
a39f3a63c3 White spaces. 2010-11-22 13:21:30 -02:00
Marcelo Roberto Jimenez
6e7a2bb2dc Remove the "xboolean" typedef from the code base. 2010-11-22 09:28:17 -02:00
Marcelo Roberto Jimenez
c21a67f2d1 Doxygen, reformating, compiler warnings. 2010-11-21 21:40:07 -02:00
Marcelo Roberto Jimenez
c449fd1521 ssdp, soap, genlib: fix compiler warnings. 2010-11-20 19:08:20 -02:00
Marcelo Roberto Jimenez
594c611a33 gena: fix several compiler warnings. 2010-11-20 13:48:50 -02:00
Marcelo Roberto Jimenez
09f2b6ca30 uuid.c: fix compiler warnings. 2010-11-20 11:30:22 -02:00
Marcelo Roberto Jimenez
9b3a0999a9 upnp: fix for compiler warnings. 2010-11-18 14:57:11 -02:00
Marcelo Roberto Jimenez
d8a27bca96 upnp: fix for compiler warnings and incorrect API. 2010-11-18 14:55:39 -02:00
Marcelo Roberto Jimenez
6bee05a517 samples: One more code reorganization. 2010-11-18 13:59:08 -02:00
Marcelo Roberto Jimenez
2e96edcbc5 samples: fix compiler warnings. 2010-11-18 13:34:04 -02:00
Marcelo Roberto Jimenez
ef0aa38958 samples: More code reorganization. 2010-11-18 12:02:38 -02:00
Marcelo Roberto Jimenez
86159bc2a6 samples: Put more data in common_data.h. 2010-11-18 01:02:27 -02:00
Marcelo Roberto Jimenez
bd8d6cfc8b samples: Unified sample code.
This patch removes duplicated code in samples.
2010-11-18 00:47:45 -02:00
Marcelo Roberto Jimenez
8434e1e936 Update autoconfig.h. 2010-11-17 23:31:07 -02:00
Marcelo Roberto Jimenez
2765bc39c5 Remove "upnp_" prefix from samples. 2010-11-17 23:30:29 -02:00
Marcelo Roberto Jimenez
75695fcaf1 samples: Fix compiler warnings. 2010-11-17 11:54:31 -02:00
Marcelo Roberto Jimenez
5abd1a3b3e Fix some compiler warnings and some Doxygen. 2010-11-17 01:24:38 -02:00
Marcelo Roberto Jimenez
6c31683e29 Some Doxygen in upnp_tv_device.
(cherry picked from commit d5fa48bd37)
2010-11-16 23:22:59 -02:00
Marcelo Roberto Jimenez
d92e26779a Some Doxygen on sample_util.
(cherry picked from commit 0d625bd2e1)
2010-11-16 23:22:51 -02:00
Marcelo Roberto Jimenez
5d6bcabd45 Removes C++ style comments. 2010-11-16 03:14:12 -02:00
Marcelo Roberto Jimenez
7c524df1d9 threadutil: Doxygenation and compiler warnings. 2010-11-16 00:17:44 -02:00
Marcelo Roberto Jimenez
58c694f57d ixml: Fix for compiler warnings for size_t and ptrdiff_t.
ixmlparser.c static functions have been reordered.
2010-11-15 21:29:07 -02:00
Marcelo Roberto Jimenez
da7f3bf1c1 Deal with "inline" when "-ansi" compiler option is active.
This mode can be recognized by the macro __STRICT_ANSI__.

From man gcc:

-ansi
 In C mode, this is equivalent to -std=c89. In C++ mode, it is equivalent to
-std=c++98.

 This turns off certain features of GCC that are incompatible with ISO C90
(when compiling C code), or of standard (when compiling code), such as the
asm and typeof keywords, and predefined macros such as unix and vax that
identify the type of system you are using. It also enables the undesirable
and rarely used ISO trigraph feature. For the C compiler, it disables
recognition of style // comments as well as the inline keyword.

 The alternate keywords _ _asm_ _, _ _extension_ _, _ _inline_ _ and
_ _typeof_ _ continue to work despite -ansi. You would not want to use them
in an ISO C program, of course, but it is useful to put them in header files
that might be included in compilations done with -ansi. Alternate predefined
macros such as _ _unix_ _ and _ _vax_ _ are also available, with or without
-ansi.

 The -ansi option does not cause non-ISO programs to be rejected gratuitously.
For that, -pedantic is required in addition to -ansi.

 The macro _ _STRICT_ANSI_ _ is predefined when the -ansi option is used.
Some header files may notice this macro and refrain from declaring certain
functions or defining certain macros that the ISO standard doesn't call for;
this is to avoid interfering with any programs that might use these names for
other things.

 Functions that would normally be built in but do not have semantics defined
by ISO C (such as alloca and ffs) are not built-in functions when -ansi is
used.
2010-11-15 12:50:38 -02:00
Marcelo Roberto Jimenez
8651174861 Added the convenience function UpnpResolveURL2() to upnptools.c.
This function avoids some unecessary memory allocation.
The memory alloc'd by this function must be freed later by the caller.
2010-11-15 01:01:07 -02:00
Marcelo Roberto Jimenez
2dd19e5894 ReadResponseLineAndHeaders() is static.
(cherry picked from commit eb5db65692)
2010-11-11 22:00:27 -02:00
Fabrice Fontaine
e6c548f57a Add GENA_NOTIFICATION_xxx_TIMEOUT variable.
Currently, in notify_send_and_recv function, pupnp waits for
HTTP_DEFAULT_TIMEOUT seconds when trying to send a GENA notification.
When there is a lot of notifications with CPs which was disconnected
without unsusbcribing, all the pupnp threads are blocked on this
timeout. To correct, this issue, this patch adds a new variable,
GENA_NOTIFICATION_SENDING_TIMEOUT, which can be used to lower the
timeout so GENA threads return quickly when writing is impossible. By
the same mean, pupnp waits the CP's answer to the NOTIFY for
HTTP_DEFAULT_TIMEOUT seconds, so this patch adds a new variable,
GENA_NOTIFICATION_ANSWERING_TIMEOUT, to customize this value.
2010-11-11 21:42:50 -02:00
Fabrice Fontaine
32cffb5bb5 Add --disable-blocking-tcp-connections flag.
Currently, pupnp is using a blocking connect to sends GENA
notifications. As a result, when there is a lot of notifications with
CPs which were disconnected without unsusbcribing, all the pupnp
threads are blocked for 20s (timeout). To correct this issue, this
patch replace the call to connect with a call to private_connect and add
a compilation flag to disable blocking TCP connections, so if we are not
able to connect to the CP, the notification is lost.
2010-11-11 21:40:22 -02:00
Marcelo Roberto Jimenez
2b30575ca5 Remove commented old code from webserver.c. 2010-11-11 21:31:53 -02:00
Marcelo Roberto Jimenez
d32212a6fd Changelog and THANKS update. 2010-11-07 19:20:03 -02:00
Stefan Sommerfeld
508b782c79 Fixed some typos. 2010-11-07 18:42:44 -02:00
Stefan Sommerfeld
38d5e58e22 Add a simple strndup() implementation for win32. 2010-11-07 18:31:48 -02:00
Stefan Sommerfeld
ee5bd670d4 Fix for size_t in UpnpString. 2010-11-07 18:31:48 -02:00
Stefan Sommerfeld
fcb5e7c438 Fix for size_t related warnings. 2010-11-07 18:31:48 -02:00
Stefan Sommerfeld
243cd41974 Fix for inline usage. 2010-11-07 18:31:48 -02:00
Marcelo Roberto Jimenez
853cd32cfe Remove unused parameter bufferLen from GetDescDocumentAndURL(). 2010-11-07 18:31:48 -02:00
Marcelo Roberto Jimenez
f384e54fc6 Consistent usage of win32 INVALID_SOCKET and SOCKET_ERROR.
On win32 socket() returns INVALID_SOCKET, which is unsigned,
on error, not -1.

Also, most network functions return SOCKET_ERROR.

This patch tries to make the usage consistent.
2010-11-07 18:31:47 -02:00
Stefan Sommerfeld
9e12768cdb Fixed server port definition. 2010-11-07 18:31:47 -02:00
Stefan Sommerfeld
4b47e6a51d Fix for mixed usage of SOCKET and int. 2010-11-07 17:52:14 -02:00
Stefan Sommerfeld
a5fb5edfc9 Make notify_send_and_recv() return the appropriate error code.
notify_send_and_recv() was returning the connection fd.
2010-11-07 17:52:14 -02:00
Marcelo Roberto Jimenez
8bd32d330b Proper inclusion of inet_pton.h for win32. 2010-11-07 17:52:14 -02:00
Stefan Sommerfeld
00eb52cc85 fixed wrong declaration of inet_ntop4 2010-11-07 17:52:14 -02:00
Marcelo Roberto Jimenez
ff006272b5 PTHREAD_MUTEX_RECURSIVE on DragonFly is an enum.
SF Bug Tracker - ID: 3104527
Submitted: OBATA Akio ( obache ) - 2010-11-07 07:10:28 BRST

In threadutil/inc/ithread.h, it is expected that
PTHREAD_MUTEX_RECURSIVE is defined as macro. But on DragonFly BSD,
it is defined as enum, so not works as expected.

Attachment patch treat that DragonFly BSD always
have PTHREAD_MUTEX_RECURSIVE.
2010-11-07 11:49:33 -02:00
Marcelo Roberto Jimenez
852c301c5c ftime(3) in -lcompat should not be checked.
SF Bug Tracker - ID: 3104521
Submitted: OBATA Akio ( obache ) - 2010-11-07 07:03:44 BRST

In configure.ac
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])

But since version 1.6.3, ftime(3) is not used, so it should be
removed, or introduce unwanted linkage with -lcompat.
2010-11-07 09:45:05 -02:00
Marcelo Roberto Jimenez
d270499cd8 Homekeeping for the next release. 2010-11-07 01:43:50 -02:00
Marcelo Roberto Jimenez
6ac867bbb1 Fix the library numbers for release. 2010-11-07 01:33:18 -02:00
Marcelo Roberto Jimenez
9052ca95be Fix broken Makefile.am and remove unused file utilall.h. 2010-11-06 19:41:47 -02:00
Marcelo Roberto Jimenez
ef7edf6cf8 Fix for "SampleUtil_Initialize was called multiple times!" bug.
Fix for bug introduced in samples code in svn revision 502, commit
git:25c908c558c8e60eb386c155a6b93add447ffec0

Sample device and combo were aborting with the message:
"***** SampleUtil_Initialize was called multiple times!"
2010-11-06 00:45:24 -02:00
Fabrice Fontaine
c65ec8a720 Make multiple SSDP advertisements faster.
Put the loop to send multiple copies of each SSDP advertisements in
ssdp_server.c instead of ssdp_device.c so we have only one call to
imillisleep ( SSDP_PAUSE ) to speed up advertisements.
2010-11-05 23:52:17 -02:00
Fabrice Fontaine
2d22e997e1 Removing unused NUM_COPY variable.
Previously, NUM_COPY was used in ssdp_device.c to send multiple copies
of each advertisements but also multiple replies to each M-SEARCH
request. As sending multiple replies is not compliant with HTTPU/MU
spec, NUM_COPY has been set to 1 in an older patch. However, as this
variable is not needed and has been replaced with SSDP_COPY, it has
been removed.
2010-11-05 23:52:11 -02:00
Fabrice Fontaine
96dc968f18 Use SSDP_COPY to send multiple SSDP advertisements.
Currently, SSDP_COPY is used only to send multiple M-SEARCH requests (in
ssdp_ctrlpt.c). With this patch, SSDP_COPY is also used to send multiple
copies of each advertisements packets (in ssdp_device.c).
2010-11-05 13:25:40 -02:00
Carl Benson
8e846368e0 patch for taking notice of UPNP_USE_RWLOCK flag in threadutil
By "Carl Benson" <carl.benson@windriver.com>:

I had to do some modifications myself though, because the Android
build system insists on having a file named "util.h" taking precedence
in its include path, libupnp gets confused because of the same filename
in upnp/src/inc/util.h
2010-11-01 01:06:11 -02:00
Marcelo Roberto Jimenez
d6671c464f Bump config to 1.6.9. 2010-11-01 01:03:40 -02:00
Marcelo Roberto Jimenez
699dd3c82e Missed this line in configure.ac in the homekeeping commit. 2010-10-21 09:55:54 -02:00
Marcelo Roberto Jimenez
9be360bcd1 Homekeeping for the next release. 2010-10-20 11:15:23 -02:00
Marcelo Roberto Jimenez
593b8d0a2b Fixes in configure.ac for release. 2010-10-20 11:11:45 -02:00
Marcelo Roberto Jimenez
890c1b6ef8 Disable debug for release. 2010-10-20 10:36:11 -02:00
Marcelo Roberto Jimenez
c127a3a87e Add docs/doxygen to .gitignore. 2010-10-20 10:35:15 -02:00
Marcelo Roberto Jimenez
bd5758186c White spaces. 2010-10-20 10:29:45 -02:00
Marcelo Roberto Jimenez
cc472bc2cd Doxygen and indentation for sock. 2010-10-20 09:05:42 -02:00
Marcelo Roberto Jimenez
6128296e5f Doxygen and indentation for miniserver. 2010-10-20 08:56:06 -02:00
Marcelo Roberto Jimenez
d84c6a7e9f Indent plus Doxygen in webserver. 2010-10-20 01:28:37 -02:00
Marcelo Roberto Jimenez
113ebd1f91 Slightly better implementation for ToUpperCase(). 2010-10-20 00:36:47 -02:00
Marcelo Roberto Jimenez
bf1450bf81 Fix a long date memory leak in webserver.c:StrStr(). 2010-10-20 00:29:08 -02:00
Marcelo Roberto Jimenez
56b9c75056 Changelog fix. 2010-10-19 16:11:39 -02:00
Marcelo Roberto Jimenez
2bdc9e075e Bug fix in select of miniserver.c
Fix a bug in miniserver.c, in which maxMiniSock was wrongly declared as
unsigned int and as a result it was beeng set to ((unsigned int)(-1)).
As a result, after beeing incremented, it became zero, and this value
was beeing used in the select() call.

Thanks to Fabrice Fontaine for helping and testing with this issue.
2010-10-19 15:49:36 -02:00
Marcelo Roberto Jimenez
923eee2393 Don't ask, UTF-8 mess? 2010-10-15 12:54:00 -03:00
Marcelo Roberto Jimenez
f74746ff3f Fix for 100% CPU issue in select() in miniserv.c. I have also removed
the sleep() call, it was just a workaround.

SF Bug Tracker [ 3086852 ] 99% CPU loop in miniserver.c on a non ipv6
system.

Submitted by: Jin ( jin_eld ) - 2010-10-13 19:29:13 UTC

I cross compiled libupnp 1.6.7 for ARM9 using the --disable-ipv6
option, my system is an ipv4 only setup.

I do not know why this problem only appears when running the app in the
background (for instance using nohup &), but then it starts using 99%
CPU.

I traced the problem down to the select() call in miniserver.c in the
RunMiniServer() function. Select returns code 1, but errno is set to
"Socket operation on non-socket", I also see this when running my app
under strace.

I set all ...Sock6 variables to INVALID_SOCKET to make sure that they
do not get added to the FD_SET and the problem is gone.
2010-10-15 12:41:36 -03:00
Marcelo Roberto Jimenez
8401a59ed5 New function, sock_close(). 2010-10-15 12:25:35 -03:00
Marcelo Roberto Jimenez
5b40cfa272 Misplaced declaration of UpnpCloseSocket. 2010-10-15 12:17:15 -03:00
Marcelo Roberto Jimenez
fcda28ba75 Remove of unused file. 2010-10-15 11:53:25 -03:00
Marcelo Roberto Jimenez
7cd434225f White spaces and comments. 2010-10-04 17:05:43 -03:00
Marcelo Roberto Jimenez
78e5ba89fa Merge of similar files. 2010-10-04 15:48:45 -03:00
Marcelo Roberto Jimenez
ebb8f209b0 Merge of similar files. 2010-10-04 15:36:11 -03:00
Marcelo Roberto Jimenez
73afd667e1 Fix for bug introduced in the last commit. 2010-10-04 13:24:38 -03:00
Marcelo Roberto Jimenez
cc294a6cf1 Merge similar code. 2010-10-04 13:03:20 -03:00
Marcelo Roberto Jimenez
458a9416c6 Merge of work from 1.8.x. 2010-10-04 12:04:38 -03:00
Marcelo Roberto Jimenez
b9eeb89250 Bumped Doxyfile version. 2010-10-04 11:44:06 -03:00
Marcelo Roberto Jimenez
a6e68b481d Updated THANKS. 2010-10-04 11:33:37 -03:00
Marcelo Roberto Jimenez
a19a896e88 Updated TODO list. 2010-10-04 11:28:37 -03:00
Marcelo Roberto Jimenez
cdee5b7cde UTF-8. 2010-10-04 11:11:33 -03:00
Marcelo Roberto Jimenez
dec78c8ef1 Echo the copy on configure output. 2010-10-04 11:01:28 -03:00
Marcelo Roberto Jimenez
fb62a5d42a Update files for windows compilation. 2010-10-04 10:51:30 -03:00
Marcelo Roberto Jimenez
a9b5081a08 Update build/inc/autoconfig.h and build/inc/upnpconfig.h at configure
time.
2010-10-04 10:47:39 -03:00
Marcelo Roberto Jimenez
3886a697b5 Remove build/inc/config.h. The right file is upnp/src/inc/config.h. 2010-10-04 10:42:32 -03:00
Marcelo Roberto Jimenez
3dab2bd00a Homekeeping for the next release. 2010-10-04 09:58:15 -03:00
Marcelo Roberto Jimenez
95f7a7eeef Whitespace fix on soaplib.h. 2010-10-02 18:57:35 -03:00
Marcelo Roberto Jimenez
ca50c2153e Remove extra soaplib.h. 2010-10-02 18:57:13 -03:00
Fabrice Fontaine
c73d870f46 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.
2010-10-02 13:44:52 -03:00
Fabrice Fontaine
ab54cb3dc5 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 ]).
2010-09-30 11:51:06 -03:00
Fabrice Fontaine
c33b11d09f 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.
2010-09-28 20:41:28 -03:00
Fabrice Fontaine
4966423d96 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.
2010-09-22 15:34:45 -03:00
Marcelo Roberto Jimenez
2fb55d3874 White space fix. 2010-09-21 16:49:20 -03:00
Fabrice Fontaine
d2238615e3 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.
2010-09-21 13:50:29 -03:00
Fabrice Fontaine
2fcbe6df52 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.
2010-09-21 08:48:40 -03:00
Fabrice Fontaine
467f9987a1 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/).
2010-09-18 06:45:56 -03:00
Marcelo Roberto Jimenez
8fbecaee5e Another fix for Changelog. 2010-09-16 08:42:14 -03:00
Fabrice Fontaine
55d581481f 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).
2010-09-16 08:21:41 -03:00
Marcelo Roberto Jimenez
a0b405f902 White spaces. 2010-09-15 06:07:42 -03:00
Marcelo Roberto Jimenez
b37f9ac64a Get rid of evil CLIENTONLY macro. 2010-09-15 05:46:07 -03:00
Marcelo Roberto Jimenez
2dad42679d White spaces. 2010-09-15 05:44:36 -03:00
Chandra Penke
ea00f0f222 Fix win32 compilation errors in visual studio 2010-09-15 05:23:53 -03:00
Marcelo Roberto Jimenez
f3ae1b4116 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.
(cherry picked from commit 81b28fbb90)
2010-09-12 00:35:31 -03:00
David Hoeung
67009170d1 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

----
2010-09-11 00:17:55 -03:00
Warwick Harvey
2b399b1791 Take notice of UPNP_USE_RWLOCK flag.
Updated threadutil to use mutexes instead of read-write locks if
UPNP_USE_RWLOCK is false (0).
2010-09-10 22:43:30 -03:00
Marcelo Roberto Jimenez
0bec9ec1ae Remove some unused code plus some coding style in httpparser.c 2010-09-10 19:46:18 -03:00
Marcelo Roberto Jimenez
25a4bd6d25 2010-09-10 Jean Sigwald <jean.sigwald(at)orange-ftgroup.com>
I discovered a reliable denial-of-service issue on the last stable
release of libupnp (1.6.6) remotely triggerable by any
unauthenticated user. The issue is related with a bad parsing of
malformed XML.
2010-09-10 19:26:10 -03:00
Marcelo Roberto Jimenez
5755ac022f SF Patch Tracker [ 2854711 ] Patch for Solaris10 compilation and usage
Submitted By: zephyrus ( zephyrus00jp )

Patch for Solaris10 compilation and usage.
2010-09-10 19:02:31 -03:00
Marcelo Roberto Jimenez
0158f52ee2 One setp further to stop the CLIENTONLY() mess. 2010-09-10 18:56:36 -03:00
Marcelo Roberto Jimenez
0db4a6beac Fix an UTF-8 issue in README. 2010-09-10 00:47:53 -03:00
Chandra Penke
575e5fc196 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.
(cherry picked from commit 7f1e164a5a)
2010-09-10 00:42:27 -03:00
Marcelo Roberto Jimenez
0e45dd9b8f 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:32:49 -03:00
Chandra Penke
ae516b6bd3 Add support for conditionally enabling ipv6
(cherry picked from commit 6b0d84fc95)
2010-09-10 00:32:49 -03:00
Chandra Penke
7137f6e261 Fix for compilation in debug builds.
Ensure internal methods are declared as static since debug builds don't inline.
2010-09-10 00:02:04 -03:00
Marcelo Roberto Jimenez
92b241b560 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’
2010-09-09 22:52:27 -03:00
Chandra Penke
2b3ab1799b 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
2010-09-09 22:52:26 -03:00
Marcelo Roberto Jimenez
4657e57766 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).
2010-09-07 22:15:21 -03:00
Marcelo Roberto Jimenez
21660334e4 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).
2010-09-07 21:56:53 -03:00
Marcelo Roberto Jimenez
97af8b6fdb Fix compilation error in upnp/src/gena/gena_ctrlpt.c (this is most
likely an error on all platforms).

Patch submitted by Chandra (inactiveneurons).
2010-09-07 14:57:56 -03:00
Marcelo Roberto Jimenez
934bd2682f 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).
2010-09-07 14:51:38 -03:00
Marcelo Roberto Jimenez
b8e9628140 Fix compilation error in ixml/inc/ixml.h when compiling with an
Objective-C compiler (when cross-compiling for iPhone devices).

Patch submitted by Chandra (inactiveneurons).
2010-09-07 14:47:12 -03:00
Marcelo Roberto Jimenez
b3b7a91a64 White spaces. 2010-09-03 21:51:31 -03:00
Marcelo Roberto Jimenez
ebc941f265 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.
2010-09-03 21:49:49 -03:00
Marcelo Roberto Jimenez
842a6ce5c8 Adding .gitignore. 2010-09-03 21:49:20 -03:00
Marcelo Roberto Jimenez
2d978c32b8 White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@581 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 02:10:50 +00:00
Marcelo Roberto Jimenez
e386dd0d68 The last part of Ronan Menard's patch.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@580 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 02:05:34 +00:00
Marcelo Roberto Jimenez
5a2cc884c1 * 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/branches/branch-1.6.x@578 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-22 01:34:35 +00:00
Marcelo Roberto Jimenez
a362d06dff upnp/src/genlib/miniserver/miniserver.c: Fix for IPV6 ULA/GUA issues.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@576 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 22:13:26 +00:00
Marcelo Roberto Jimenez
0e73448ea8 * gena_subscribe(): Fix for IPV6 ULA/GUA issues.
Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@574 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:53:09 +00:00
Marcelo Roberto Jimenez
a7966b6597 * SOCKET ssdpSock6UlaGua: created variable for later use.
Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@572 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:40:00 +00:00
Marcelo Roberto Jimenez
2d5c6310a9 * SSDP_IPV6_SITELOCAL: new macro.
Patch submitted by Ronan Menard.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@569 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:31:55 +00:00
Marcelo Roberto Jimenez
c9bcee536e The scope of the macro NUM_HANDLE is now restricted to upnpapi.c.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@568 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:22:09 +00:00
Marcelo Roberto Jimenez
1605744278 * 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/branches/branch-1.6.x@566 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 21:10:50 +00:00
Marcelo Roberto Jimenez
ce0d2833a3 * 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/branches/branch-1.6.x@564 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-21 20:42:43 +00:00
Marcelo Roberto Jimenez
74db05ff1e English mispelling.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@562 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:54:44 +00:00
Marcelo Roberto Jimenez
9468e0224a libUPnP does support IPV6 now.
Patch submitted by Ronan Menard.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@560 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:48:17 +00:00
Marcelo Roberto Jimenez
cb89781a55 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/branches/branch-1.6.x@558 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-08-19 13:27:50 +00:00
Marcelo Roberto Jimenez
3de0765893 Backport of svn rev 556:
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/branches/branch-1.6.x@557 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-28 20:40:21 +00:00
Marcelo Roberto Jimenez
ce0e5b664f Backport of svn rev. 554:
Remove excessive 'dnl's from libupnp.m4.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@555 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-26 11:09:49 +00:00
Marcelo Roberto Jimenez
eec36896c3 2010-06-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
Backport of svn revision 552:
	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/branches/branch-1.6.x@553 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-06-17 17:07:41 +00:00
Nick Leverton
00cf8052de Add PTHREAD_CFLAGS to Libs: in libupnp.pc, as assumed by acx_pthread.m4
(fixes binutils-gold link failure)


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@551 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-14 13:09:59 +00:00
Marcelo Roberto Jimenez
74b8730f0f 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/branches/branch-1.6.x@548 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-05-07 11:07:26 +00:00
Marcelo Roberto Jimenez
1b45bec411 Backport of r544:
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/branches/branch-1.6.x@546 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 14:59:32 +00:00
Marcelo Roberto Jimenez
21163f491d Comment.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@541 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 12:04:48 +00:00
Marcelo Roberto Jimenez
a54e07bfb2 Code convergence for client_table (ClientSubscription).
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@539 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 08:47:37 +00:00
Marcelo Roberto Jimenez
0dea692199 Allow null pointer deletions in membuffer.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@538 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:47:37 +00:00
Marcelo Roberto Jimenez
dc457414d1 Adding UpnpString.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@537 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-25 00:44:34 +00:00
Nick Leverton
e1d09004eb Subscription auto-renewals copy the renewal time from old subscription.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@533 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-21 12:28:27 +00:00
Marcelo Roberto Jimenez
640fa8b1be Code base convergence.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@530 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-04-01 20:36:30 +00:00
Marcelo Roberto Jimenez
2bcbdffd89 1 - Ported some of IPV6 code to 1.6.7.
2 - Backport of svn revision 527:
* 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/branches/branch-1.6.x@529 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-31 17:53:16 +00:00
Marcelo Roberto Jimenez
6c8a4dd361 SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
Submitted By: zephyrus ( zephyrus00jp )
This second part covers the issue on linking with -lsocket -lnsl -lrt.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@525 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-27 14:45:47 +00:00
Marcelo Roberto Jimenez
e9941f7ac8 UTF-8 stuff.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@524 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-27 14:41:25 +00:00
Marcelo Roberto Jimenez
5a465a5cf2 White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@523 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-22 09:08:15 +00:00
Marcelo Roberto Jimenez
6aa2419cfd 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/branches/branch-1.6.x@520 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 22:41:49 +00:00
Marcelo Roberto Jimenez
712ed6d2ff 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/branches/branch-1.6.x@518 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 21:19:13 +00:00
Marcelo Roberto Jimenez
53d5e61b33 Thanks update.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@517 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 19:53:20 +00:00
Marcelo Roberto Jimenez
324931ca8f Backport of svn revision 514:
libupnp and multi-flows scenario patch
	Submited by Carlo Parata from STMicroelectronics.
Hi Roberto and Nektarios,
after an analysis of the problem of libupnp with a multi-flows scenario, I
noticed that the only cause of the freezed system is the ThreadPool
management. There are not mutex problems. In practise, if all threads in the
thread pool are busy executing jobs, a new worker thread should be created if
a job is scheduled (I inspired to tombupnp library). So I solved the problem
with a little patch in threadutil library that you can find attached in this
e-mail. I hope to have helped you.



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@515 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 19:51:18 +00:00
Marcelo Roberto Jimenez
edc0638640 Backport of svn revision 512:
Style compatibilization between two similar constructions addressed in two
separate recent patches.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@513 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 17:07:09 +00:00
Marcelo Roberto Jimenez
e1ea72a5fb Backport of svn revision 510:
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/branches/branch-1.6.x@511 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 16:13:59 +00:00
Marcelo Roberto Jimenez
5eb55e0fb2 Backport of svn revision 504:
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/branches/branch-1.6.x@509 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 15:42:40 +00:00
Marcelo Roberto Jimenez
9226dd833b SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
Submitted By: zephyrus ( zephyrus00jp )
	Obs by Marcelo: The issue with linking with -lsocket -lnsl -lrt is not
	covered in this changeset beacuse I don't have solaris to test. I will
	need some help from zephyrus in this regard. The issue will be addressed
	in a future changeset.

	Compilation for solaris

	I have used gcc3.x and gcc4.x under solaris 10 for x86 / 64 bits.

	A couple of Source file fixes were necessary for successful compilation
	and runtime behavior.

	threadutil/src/ThreadPool.c

	POSIX
	sched_setschduler() returns non-negative value for success.

	Without the fix, UpnpInit() fails immediately.

	upnpp/src/api/upnpai.c

	There is a typo of a macro name "__sun" in one of the
	CPP conditional.
	Without the fix, the compilation aborts due to unknown constant
	in socket ioctl call.

	A few structs and an array is not properly initialized.
	Well, I think it may be safe as is, but when I checked it
	using purify evaluation version, it was reported that
	uninitizlied iszBuffer may cause read of uninitialized memory.
	So play it safe.

	Configure issue.
	This has to be more of a configure magic.
	To link a program successfully using network, we need
	-lsocket and -lnsl library specifications on the link line.
	We also need -lrt for programs that use thread scheduling features.

	The sample program under upnp/sample requires
	-lsocket -lnsl -lrt
	for successful linking.
	I added -lsocket -lnsl -lrt to Makefile.in.
	configure probably needs to take care of these.

	I don't know much about configure, automake, etc., so
	I am just raising a flag here.

	TIA



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@505 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-21 11:47:17 +00:00
Marcelo Roberto Jimenez
25c908c558 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/branches/branch-1.6.x@502 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-20 21:32:38 +00:00
Marcelo Roberto Jimenez
16e91b5dcc Backport of svn revision 497:
* SF Patch Tracker [ 2203721 ] timeb.h check obsolete



git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@498 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 23:51:09 +00:00
Marcelo Roberto Jimenez
01d17e5c4b Backport of svn revision 495:
* 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/branches/branch-1.6.x@496 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 23:39:48 +00:00
Marcelo Roberto Jimenez
a1d707ac81 Backport of svn revision 493: Declare a few functions to have proper
(void) argument list.

	* 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/branches/branch-1.6.x@494 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-15 15:34:54 +00:00
Marcelo Roberto Jimenez
4ad6ea3545 Backport of svn revision 484:
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/branches/branch-1.6.x@487 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-14 18:53:12 +00:00
Marcelo Roberto Jimenez
70a0aff4e7 Backport of svn revision 482:
wrong order in parameters corrected


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@486 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2010-03-14 18:38:31 +00:00
Marcelo Roberto Jimenez
aaacf65f41 Do not use C++ like comments. Some compilers don't like it.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@481 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-08-14 12:06:22 +00:00
Marcelo Roberto Jimenez
cd8ce90e19 Backport of svn rev. 479: Fix for application compiler warning: "PRId64" redefined.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@480 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-08-14 12:02:20 +00:00
Marcelo Roberto Jimenez
812d019d12 Backport of ixml from 1.8.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@478 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 05:01:52 +00:00
Marcelo Roberto Jimenez
881b212690 Backport of svn 371: Removing the useless, unused and undocumented function UpnpFree().
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@477 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 03:31:07 +00:00
Marcelo Roberto Jimenez
223c0e8816 Backport of Doxyfile.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@476 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 03:11:28 +00:00
Marcelo Roberto Jimenez
ceca478180 Backport of most of upnp.h with documentation.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@475 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-27 03:06:21 +00:00
Marcelo Roberto Jimenez
7963e97469 Backport of svn 367: Removing dead code.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@471 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-26 12:24:24 +00:00
Marcelo Roberto Jimenez
0080c080cd Update of win32 files.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@470 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 04:21:11 +00:00
Marcelo Roberto Jimenez
405451e34c Backport of svn 468: Added upnp/m4/libupnp.m4 to the distribution tarball.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@469 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 04:11:17 +00:00
Marcelo Roberto Jimenez
a772b1a754 Backport of svn 403: Bob Ciora's patch for "UpnpCreatePropertySet can leak memory".
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@466 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 03:42:30 +00:00
Marcelo Roberto Jimenez
ffc4668e0b Backport of 406: Updating Makefile.am for missing files in the "make dist" tarball.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@465 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 03:35:12 +00:00
Marcelo Roberto Jimenez
56a7f038dc Changelog update for a fixed bug of a missing HandleUnlock() that went in
in one of the latest comitts.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@463 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 03:25:42 +00:00
Marcelo Roberto Jimenez
3ba4e34662 Added ixmldebug and UpnpGlobal.h to the 1.6.x branch.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@462 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 03:22:35 +00:00
Marcelo Roberto Jimenez
515233ca56 Backport of svn 395 and 434:
395: Bob Ciora's patch for lazy UpnpAcceptSubscription().
434: Fixed a buffer overflow due to a bug in the calculation of the
     CONTENT-TYPE header line size, the length was beeing calculated with
     the wrong string, there was a missing colon.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@461 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-25 02:56:04 +00:00
Marcelo Roberto Jimenez
423808a095 Backport of svn 453: Andre Sodermans (wienerschnitzel) patch for building
libupnp under windows systems with VC8/VC9.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@460 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-24 11:40:33 +00:00
Marcelo Roberto Jimenez
f22a69b487 Backport of 457: SF Bug Tracker [ 2026431 ] pupnp does not build on GNU/KfreeBSD.
Submitted By: Nick Leverton - leveret
	Gnu/KFreeBSD is one of the Debian architectures, it includes a FreeBSD
	kernel with GNU userspace (glibc etc). The Gnu/KfreeBSD developers
	provided the attached patch to test the appropriate #define and allow pupnp
	to build in their environment, and asked me to forward it to you.

	Since the test is a simple check for defined(__GLIBC__), this would
	presumably also help with other ports of GNU libc to non-Linux kernels.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@458 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-24 11:30:42 +00:00
Marcelo Roberto Jimenez
bcf5a5c5e0 Backport: Debug code for http_RecvMessage().
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@450 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-10 04:15:36 +00:00
Marcelo Roberto Jimenez
e0c9de0b1d Backport: Added an m4 macro to deal with finding libupnp in the users'
configure script.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@449 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-07-10 04:02:16 +00:00
Marcelo Roberto Jimenez
94e4a3bdda Fix in function SetSeed() in threadutil/src/ThreadPool.c for CYGWIN
compilation. Thanks to Gary Chan.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@355 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-04-29 15:42:18 +00:00
Marcelo Roberto Jimenez
b7b3bb7d05 Homekeeping for the next release.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@354 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-04-29 15:38:35 +00:00
Marcelo Roberto Jimenez
f0161c7274 Merge of trunk into branch 1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@351 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-04-26 00:49:39 +00:00
Marcelo Roberto Jimenez
4b40e94b03 Merge of trunk into branch 1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@339 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-03-25 10:21:08 +00:00
Marcelo Roberto Jimenez
1c9632dcc3 White spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@329 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-03-05 03:55:33 +00:00
Marcelo Roberto Jimenez
cc0c2ffc50 Merge of trunk into branch-1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@327 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-02-22 04:48:10 +00:00
Marcelo Roberto Jimenez
f812b124d7 Merge of trunk into branch-1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@324 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-02-10 02:27:45 +00:00
Marcelo Roberto Jimenez
a785465222 Merge of trunk into branch-1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@322 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-02-08 02:29:26 +00:00
Marcelo Roberto Jimenez
078f3f8faf Merge of trunk into branch 1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@312 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-02-03 01:36:23 +00:00
Marcelo Roberto Jimenez
1eeaf99b83 Merge of trunk into branch-1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@306 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2008-01-27 02:13:08 +00:00
Marcelo Roberto Jimenez
f6dd5062fe Merge of trunk into branch-1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@284 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-12-27 02:14:02 +00:00
Marcelo Roberto Jimenez
7d4a610b93 Merge of head into branch-1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@265 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-12-10 23:18:38 +00:00
Marcelo Roberto Jimenez
0a074d1989 Merge of trunk into branch 1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@263 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-12-10 22:56:56 +00:00
Marcelo Roberto Jimenez
0475a46680 Merge of current trunk to branch 1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@251 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-11-19 14:15:45 +00:00
Marcelo Roberto Jimenez
2a76749682 Creating branch 1.6.x.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@210 119443c7-1b9e-41f8-b6fc-b9c35fce742c
2007-06-23 14:23:29 +00:00
88 changed files with 2177 additions and 4693 deletions

4
.gitignore vendored
View File

@ -118,7 +118,3 @@ docs/doxygen
/build/vc10/out.vc10.Win32
/build/vc10/out.vc10.x64
/pthreads
/build/vc10/ipch
/build/vc10/IUpnpErrFile.txt
/build/vc10/IUpnpInfoFile.txt
/build/vc10/*.opensdf

360
ChangeLog
View File

@ -1,363 +1,3 @@
*******************************************************************************
Version 1.8.0
*******************************************************************************
2014-01-15 Peng <howtofly(at)gmail.com>
Fix memory leaks.
2013-04-27 Thijs Schreijer <thijs(at)thijsschreijer.nl>
Renamed SCRIPTSUPPORT to IXML_HAVE_SCRIPTSUPPORT for consistency. Also
updated autoconfig and automake files, so it also works on non-windows.
Option is enabled by default, because it adds an element to the node
structure. Not using an available field is better than accidentally
using an unavailable field.
2012-07-11 Thijs Schreijer <thijs(at)thijsschreijer.nl>
Changed param to const UpnpAcceptSubscriptionExt() for consistency
2012-06-07 Thijs Schreijer <thijs(at)thijsschreijer.nl>
updated ixmlDocument_createAttributeEx() and ixmlDocument_createAttribute()
to use parameter DOMString instead of char * (same but now consistent)
2012-05-06 Thijs Schreijer <thijs(at)thijsschreijer.nl>
Added script support (directive SCRIPTSUPPORT) for better support of
garbage collected script languages. The node element gets a custom tag
through ixmlNode_setCTag() and ixmlNode_getCTag(). And a callback upon
releasing the node resources can be set using ixmlSetBeforeFree()
See updated readme for usage.
2012-03-24 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
SF Bug Tracker id 3510595 - UpnpDownloadXmlDoc : can't get the file
Submitted: Marco Virgulti ( mvirg83 ) - 2012-03-23 10:08:08 PDT
There is a problem, perhaps, during downloading a document by
UpnpDownloadXmlDoc. During debugging i've found that in an not exported
api (unfortunately i forgot the code line...) where it is setted a
local variable "int timeout" to -1 then passed directly to another
function for sending data through tcp socket. I patched this setting it
to 0 (there is an IF section that exits if timeout < 0). It is normal
behavior or it is a bug?
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Check for NULL pointer in TemplateSource.h
calloc can return NULL so check for NULL pointer in CLASS##_new and
CLASS##_dup.
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Replace strcpy with strncpy in get_hoststr
Replace strcpy with strncpy to avoid buffer overflow.
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Memory leak fix in handle_query_variable
variable was never freed.
2011-02-07 Chandra Penke <chandrapenke(at)mcntech.com>
Add HTTPS support using OpenSSL. HTTPS support is optional and can
be enabled by passing the --enable-open-ssl argument to the
configure script.
The following methods are introduced to the public API:
UpnpInitOpenSslContext
When enabled, HTTPS can be used by using "https://" instead of
"http://" when passing URLs to the HTTP Client API.
2011-02-07 Chandra Penke <chandrapenke(at)mcntech.com>
Refactor HTTP Client API to be more generic.
The following features are added:
- Support for persistent HTTP connections (reusing HTTP
connections). Tthis is still a work in progress and relies on
applications to interpret the 'Connection' header
appropriately.
- Support for specifying request headers when making
requests. Useful for interacting with web services that require
custom headers.
- Support for retrieving response headers (this is a API only
change, some more work needs to be done to implement the actual
functionality. Specifically copy_msg_headers in httpreadwrite.c
needs to be implemented)
- Common API for all HTTP methods.
- Support for PUT, and DELETE methods.
The following methods are introduced to the public HTTP Client API
UpnpOpenHttpConnection, UpnpCloseHttpConnection, UpnpMakeHttpRequest,
UpnpWriteHttpRequest, UpnpEndHttpRequest, UpnpGetHttpResponse,
UpnpReadHttpResponse.
Removed a lot of duplicate code in httpreadwrite.c
2011-01-17 Chandra Penke <chandrapenke(at)mcntech.com>
Include upnpconfig.h in FileInfo.h to automatically include large
file macros
2011-01-17 Chandra Penke <chandrapenke(at)mcntech.com>
Fix for warnings Apple systems related to macros defined in list.h.
In list.h, in apple systems, undefine the macros prior to defining them.
2011-01-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
Fix for UpnpFileInfo_get_LastModified() in http_MakeMessage().
UpnpFileInfo_get_LastModified() returns time_t, and http_MakeMessage()
takes a "time_t *". Thanks to Chandra Penke for pointing the bug.
2010-11-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
Template object for ssdp_ResultData.
2010-11-10 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Support for "polling" select in sock_read_write.
Currently, in sock_read_write function, if the timeout is 0, pupnp
realizes a "blocking" select (with an infinite timeout). With this
patch, if timeout is set to 0, pupnp will realize a "polling" select
and returns immediately if it can not read or write on the socket. This
is very useful for GENA notifications when pupnp is trying to send
events to a disconnected Control Point. "Blocking" select can now be
done by putting a negative timeout value.
2010-09-18 Chandra Penke <chandrapenke(at)mcntech.com>
This is a minor build fix. The new Template*.h files added in the latest
code need to be exported. Patch against the latest sources is attached.
2010-08-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* upnp/src/api/Discovery.c: Fix a serious bug and memory leak in
UpnpDiscovery_strcpy_DeviceType(). Thanks to David Blanchet for the
patch.
2010-04-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
Separation of the ClientSubscription object.
2010-04-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
Protect the object destructors agains null pointers on deletion, which
should be something valid.
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
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
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Forward port of svn revision 505:
SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
Submitted By: zephyrus ( zephyrus00jp )
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Patch Tracker [ 2969188 ] 1.8.0: patch for FreeBSD compilation
Submitted By: Nick Leverton (leveret)
Fix the order of header inclusion for FreeBSD.
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* 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.
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* 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.
2010-03-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Fix for the ithread_mutex_unlock() logic in UpnpInit().
Thanks for Nicholas Kraft.
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* 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.
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Patch Tracker [ 2964685 ] patch for avoiding inet_ntoa (1.8.0)
Submitted By: Nick Leverton (leveret)
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.
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* 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().
2010-03-14 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* 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.
2008-06-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Nicholas Kraft's patch to fix some IPv6 copy/paste issues. He
reported to be getting infinite loops with the svn code.
2008-06-13 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Bug Tracker [ 1984541 ]
ixmlDocumenttoString does not render the namespace tag.
Submitted By: Beliveau - belivo
Undoing the patch that fixed this problem. In fact, there was no
problem and the patch was wrong.
2008-06-11 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Ingo Hofmann's patch for "Content-Type in Subscription responses".
Adds charset="utf-8" attribute to the CONTENT-TYPE header line.
Hi,
I have found an inconsistency regarding the text/xml content-type
returned by libupnp. It looks like only subscription responses send
"text/xml" where all other messages contain "text/xml; charset="utf-8"".
Since I'm working on an DLNA device the latter behaviour is mandatory.
I changed the according lines in gena_device.c (see attached patch).
I'm not sure if it would be ok for other device to have the charset
field but it would help me a lot :)
Best regards,
Ingo
2008-06-04 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Bug Tracker [ 1984541 ]
ixmlDocumenttoString does not render the namespace tag.
Submitted By: Beliveau - belivo
The problem occurs when converting a xml document using
ixmlDocumenttoString containing a namespace tag created with
ixmlDocument_createElementNS. The namespace tag doesn't get rendered.
example: The following code fragment prints:
<?xml version="1.0"?>
<root></root>
instead of:
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0"></root>
Code:
#include <stdlib.h>
#include <upnp/ixml.h>
int main()
{
IXML_Document* wDoc = ixmlDocument_createDocument();
IXML_Element* wRoot = ixmlDocument_createElementNS(wDoc,
"urn:schemas-upnp-org:device-1-0", "root");
ixmlNode_appendChild((IXML_Node *)wDoc,(IXML_Node *)wRoot);
DOMString wString = ixmlDocumenttoString(wDoc);
printf(wString);
free(wString);
ixmlDocument_free(wDoc);
return 0;
}
The problem was in the printing routine, not in the library data
structure.
2008-05-31 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Charles Nepveu's suggestion of not allocating a thread for
MiniServer when it is not compiled.
2008-05-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Ported Peter Hartley's patch to compile with mingw.
2008-05-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Added some debug capability to ixml.
2008-05-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Merged Charles Nepveu's IPv6 work. libupnp now is IPv6 enabled.
2008-02-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Breaking API so that we now hide internal data structures.
2008-02-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Rewrote Peter Hartley's patch to include a new extra header field in
FileInfo.
*******************************************************************************
Version 1.6.20
*******************************************************************************

View File

@ -31,7 +31,7 @@ PROJECT_NAME = libUPnP
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.8.0
PROJECT_NUMBER = 1.6.20
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS SCRIPTSUPPORT EXCLUDE_GENA=0 EXCLUDE_DOM=0
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0 EXCLUDE_DOM=0
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.

52
README
View File

@ -17,7 +17,6 @@ sections:
6. Product Release Notes
7. New Features
8. Support and Contact Information
9. IXML support for scriptinglanguages
1) Release Contents
@ -344,54 +343,3 @@ us know.
* Other brands, names, and trademarks are the property of their respective
owners.
9. IXML support for scriptinglanguages
-------------------------------------------
The treestructure of XML documents created by IXML is hard to maintain when
creating a binding for a scripting language. Even when many elements may
never be used on the script side, it requires copying the entire tree
structure once you start accessing elements several levels deep.
Hence scriptsupport was added. To enable it compile while
IXML_HAVE_SCRIPTSUPPORT has been defined (enabled by default).
This allows control using only a list instead of a tree-like
structure, and only nodes actually accessed need to be created instead of
all the nodes in the tree.
Here's how its supposed to work;
* The scriptsupport allows you to add a callback when a node is freed on
the C side, so appropriate action can be taken on the script side, see
function ixmlSetBeforeFree().
* Instead of recreating the tree structure, an intermediate object should
be created only for the nodes actually accessed. The object should be
containing a pointer to the node and a 'valid flag' which is initially
set to TRUE (the valid flag, can simply be the pointer to the node being
NULL or not). Before creating the intermediate object, the custom tag
'ctag' can be used to check whether one was already created.
* the node object gets an extra 'void* ctag' field, a custom tag to make a
cross reference to the script side intermediate object. It can be set
using ixmlNode_setCTag(), and read using ixmlNode_getCTag(). Whenever
a new intermediate object is created, the ctag of the coirresponding
node should be set to point to this intermediate object.
* The tree structure traversal is done on the C side (looking up parents,
children and siblings)
* Every intermediate object created should be kept in a list (preferably a
key-value list, where the key is the pointer to the node and the value is
the pointer to the intermediate object)
* when the callback is called, the node should be looked up in the list,
the flag set to false, the pointer to the C-side node be cleared and on
the C-side the ctag should be cleared.
* whenever the intermediate object is accessed and its flag is set to False,
an error should be thrown that the XML document has been closed.
Freeing resources can be done in 2 ways, C side by simply calling the free
node methods, or script side by the garbage collector of the scriptengine.
Scriptside steps;
* if the valid flag is set to False (XML document is closed), then the
intermediate object can be destroyed, no further action
* if the node has a parent, then the intermediate object can be destroyed
after the ctag on the corresponding node has been cleared. Nothing needs
to be freed on the C-side.
* if the node has no parent, then the node must be freed on the C side by
calling the corresponding free node methods. This will result in a chain
of callbacks closing the node and all underlying nodes.

8
TODO
View File

@ -4,11 +4,3 @@ To Be Done
- non-regression testing
- Why is NUM_HANDLE defined to 200 when we can register only:
A) One client(1)
B) An IPv4 and IPv6 device (2)
NUM_HANDLE should be 3
- A sane way to implement the virtual directory callback initialization and checking
against NULL pointers.

View File

@ -2,7 +2,7 @@
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 to compile debug code */
#define DEBUG 1
/* #undef DEBUG */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
@ -82,18 +82,15 @@
/* Define to 1 if you have the <ws2tcpip.h> header file. */
/* #undef HAVE_WS2TCPIP_H */
/* see upnpconfig.h */
#define IXML_HAVE_SCRIPTSUPPORT 1
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#define LT_OBJDIR ".libs/"
/* Define to 1 to prevent compilation of assert() */
/* #undef NDEBUG */
#define NDEBUG 1
/* Define to 1 to prevent some debug code */
/* #undef NO_DEBUG */
#define NO_DEBUG 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
@ -108,7 +105,7 @@
#define PACKAGE_NAME "libupnp"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libupnp 1.8.0"
#define PACKAGE_STRING "libupnp 1.6.20"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libupnp"
@ -117,7 +114,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.8.0"
#define PACKAGE_VERSION "1.6.20"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
@ -135,9 +132,6 @@
/* see upnpconfig.h */
#define UPNP_ENABLE_NOTIFICATION_REORDERING 1
/* see upnpconfig.h */
/* #undef UPNP_ENABLE_OPEN_SSL */
/* see upnpconfig.h */
/* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */
@ -145,7 +139,7 @@
#define UPNP_HAVE_CLIENT 1
/* see upnpconfig.h */
#define UPNP_HAVE_DEBUG 1
/* #undef UPNP_HAVE_DEBUG */
/* see upnpconfig.h */
#define UPNP_HAVE_DEVICE 1
@ -175,16 +169,16 @@
#define UPNP_VERSION_MAJOR 1
/* see upnpconfig.h */
#define UPNP_VERSION_MINOR 8
#define UPNP_VERSION_MINOR 6
/* see upnpconfig.h */
#define UPNP_VERSION_PATCH 0
#define UPNP_VERSION_PATCH 20
/* see upnpconfig.h */
#define UPNP_VERSION_STRING "1.8.0"
#define UPNP_VERSION_STRING "1.6.20"
/* Version number of package */
#define VERSION "1.8.0"
#define VERSION "1.6.20"
/* File Offset size */
#define _FILE_OFFSET_BITS 64

View File

@ -40,16 +40,16 @@
***************************************************************************/
/** The library version (string) e.g. "1.3.0" */
#define UPNP_VERSION_STRING "1.8.0"
#define UPNP_VERSION_STRING "1.6.20"
/** Major version of the library */
#define UPNP_VERSION_MAJOR 1
/** Minor version of the library */
#define UPNP_VERSION_MINOR 8
#define UPNP_VERSION_MINOR 6
/** Patch version of the library */
#define UPNP_VERSION_PATCH 0
#define UPNP_VERSION_PATCH 20
/** The library version (numeric) e.g. 10300 means version 1.3.0 */
#define UPNP_VERSION \
@ -82,7 +82,7 @@
/** Defined to 1 if the library has been compiled with DEBUG enabled
* (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */
#define UPNP_HAVE_DEBUG 1
/* #undef UPNP_HAVE_DEBUG */
/** Defined to 1 if the library has been compiled with client API enabled
@ -132,9 +132,5 @@
* header (i.e. configure --enable-unspecified_server) */
/* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */
/** Defined to 1 if the library has been compiled with OpenSSL support
* (i.e. configure --enable-open_ssl) */
/* #undef UPNP_ENABLE_OPEN_SSL */
#endif /* UPNP_CONFIG_H */

View File

@ -1,4 +1,3 @@
*.suo
*.user
*.sdf
*.user

View File

@ -158,7 +158,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;IXML_HAVE_SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -206,7 +206,7 @@
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;RELEASE;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;IXML_HAVE_SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -251,7 +251,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;DEBUG;WIN32;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;WIN32;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -296,7 +296,7 @@
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug Lib|Win32">
@ -174,7 +174,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;NDEBUG;RELEASE;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -292,7 +292,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;DEBUG;WIN32;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -300,6 +300,7 @@
</PrecompiledHeaderOutputFile>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<BrowseInformation>
</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
@ -317,6 +318,7 @@
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\pthreads\;..\..\pthreads\lib;$(OutDir)..\lib\ixml;$(OutDir)..\lib\threadutil;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
@ -404,7 +406,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;DEBUG;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;DEBUG;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -493,7 +495,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@ -572,20 +574,31 @@
<ItemGroup>
<ClCompile Include="..\..\upnp\src\api\ActionComplete.c" />
<ClCompile Include="..\..\upnp\src\api\ActionRequest.c" />
<ClCompile Include="..\..\ixml\src\attr.c" />
<ClCompile Include="..\..\upnp\src\genlib\client_table\client_table.c" />
<ClCompile Include="..\..\upnp\src\genlib\client_table\ClientSubscription.c" />
<ClCompile Include="..\..\upnp\src\api\Discovery.c" />
<ClCompile Include="..\..\ixml\src\document.c" />
<ClCompile Include="..\..\ixml\src\element.c" />
<ClCompile Include="..\..\upnp\src\api\Event.c" />
<ClCompile Include="..\..\upnp\src\api\EventSubscribe.c" />
<ClCompile Include="..\..\upnp\src\api\FileInfo.c" />
<ClCompile Include="..\..\threadutil\src\FreeList.c" />
<ClCompile Include="..\..\upnp\src\gena\gena_callback2.c" />
<ClCompile Include="..\..\upnp\src\gena\gena_ctrlpt.c" />
<ClCompile Include="..\..\upnp\src\gena\gena_device.c" />
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpparser.c" />
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpreadwrite.c" />
<ClCompile Include="..\..\ixml\src\ixml.c" />
<ClCompile Include="..\..\ixml\src\ixmlmembuf.c" />
<ClCompile Include="..\..\ixml\src\ixmlparser.c" />
<ClCompile Include="..\..\threadutil\src\LinkedList.c" />
<ClCompile Include="..\..\upnp\src\uuid\md5.c" />
<ClCompile Include="..\..\upnp\src\genlib\util\membuffer.c" />
<ClCompile Include="..\..\upnp\src\genlib\miniserver\miniserver.c" />
<ClCompile Include="..\..\ixml\src\namedNodeMap.c" />
<ClCompile Include="..\..\ixml\src\node.c" />
<ClCompile Include="..\..\ixml\src\nodeList.c" />
<ClCompile Include="..\..\upnp\src\genlib\net\http\parsetools.c" />
<ClCompile Include="..\..\upnp\src\genlib\service_table\service_table.c" />
<ClCompile Include="..\..\upnp\src\soap\soap_common.c" />
@ -602,6 +615,8 @@
<ClCompile Include="..\..\upnp\src\genlib\util\strintmap.c" />
<ClCompile Include="..\..\upnp\src\api\SubscriptionRequest.c" />
<ClCompile Include="..\..\upnp\src\uuid\sysdep.c" />
<ClCompile Include="..\..\threadutil\src\ThreadPool.c" />
<ClCompile Include="..\..\threadutil\src\TimerThread.c" />
<ClCompile Include="..\..\upnp\src\genlib\util\upnp_timeout.c" />
<ClCompile Include="..\..\upnp\src\api\upnpapi.c" />
<ClCompile Include="..\..\upnp\src\api\upnpdebug.c" />

View File

@ -17,6 +17,9 @@
<ClCompile Include="..\..\upnp\src\api\ActionRequest.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\attr.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\genlib\client_table\client_table.c">
<Filter>sources</Filter>
</ClCompile>
@ -26,6 +29,12 @@
<ClCompile Include="..\..\upnp\src\api\Discovery.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\document.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\element.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\api\Event.c">
<Filter>sources</Filter>
</ClCompile>
@ -35,6 +44,9 @@
<ClCompile Include="..\..\upnp\src\api\FileInfo.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\FreeList.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\gena\gena_callback2.c">
<Filter>sources</Filter>
</ClCompile>
@ -50,6 +62,18 @@
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpreadwrite.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\ixml.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\ixmlmembuf.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\ixmlparser.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\LinkedList.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\uuid\md5.c">
<Filter>sources</Filter>
</ClCompile>
@ -59,6 +83,15 @@
<ClCompile Include="..\..\upnp\src\genlib\miniserver\miniserver.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\namedNodeMap.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\node.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\ixml\src\nodeList.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\genlib\net\http\parsetools.c">
<Filter>sources</Filter>
</ClCompile>
@ -107,6 +140,12 @@
<ClCompile Include="..\..\upnp\src\uuid\sysdep.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\ThreadPool.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\threadutil\src\TimerThread.c">
<Filter>sources</Filter>
</ClCompile>
<ClCompile Include="..\..\upnp\src\genlib\util\upnp_timeout.c">
<Filter>sources</Filter>
</ClCompile>

View File

@ -163,6 +163,7 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs>
@ -171,6 +172,7 @@
<AdditionalDependencies>pthreadVC2.lib;ixml.lib;threadutil.lib;libupnp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\pthreads\;..\..\pthreads\lib;$(OutDir)..\lib\libupnp;$(OutDir)..\lib\threadutil;$(OutDir)..\lib\ixml;$(OutDir)..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>

View File

@ -218,14 +218,6 @@
Name="sources"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\upnp\src\api\ActionComplete.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\ActionRequest.c"
>
</File>
<File
RelativePath="..\..\ixml\src\attr.c"
>
@ -234,14 +226,6 @@
RelativePath="..\..\upnp\src\genlib\client_table\client_table.c"
>
</File>
<File
RelativePath="..\..\upnp\src\genlib\client_table\ClientSubscription.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\Discovery.c"
>
</File>
<File
RelativePath="..\..\ixml\src\document.c"
>
@ -250,18 +234,6 @@
RelativePath="..\..\ixml\src\element.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\Event.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\EventSubscribe.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\FileInfo.c"
>
</File>
<File
RelativePath="..\..\threadutil\src\FreeList.c"
>
@ -362,10 +334,6 @@
RelativePath="..\..\upnp\src\ssdp\ssdp_device.c"
>
</File>
<File
RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.c"
>
</File>
<File
RelativePath="..\..\upnp\src\ssdp\ssdp_server.c"
>
@ -374,22 +342,10 @@
RelativePath="..\..\upnp\src\genlib\net\http\statcodes.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\StateVarComplete.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\StateVarRequest.c"
>
</File>
<File
RelativePath="..\..\upnp\src\genlib\util\strintmap.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\SubscriptionRequest.c"
>
</File>
<File
RelativePath="..\..\upnp\src\uuid\sysdep.c"
>
@ -451,14 +407,6 @@
Name="headers"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\..\upnp\inc\ActionComplete.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\actionrequest.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\client_table.h"
>
@ -467,22 +415,6 @@
RelativePath="..\..\upnp\src\inc\config.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\discovery.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\Event.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\EventSubscribe.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\FileInfo.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\gena.h"
>
@ -567,14 +499,6 @@
RelativePath="..\..\upnp\src\inc\statcodes.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\StateVarComplete.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\statevarrequest.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\statuscodes.h"
>
@ -583,10 +507,6 @@
RelativePath="..\..\upnp\src\inc\strintmap.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\SubscriptionRequest.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\sysdep.h"
>

View File

@ -764,14 +764,6 @@
Name="sources"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\upnp\src\api\ActionComplete.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\ActionRequest.c"
>
</File>
<File
RelativePath="..\..\ixml\src\attr.c"
>
@ -780,14 +772,6 @@
RelativePath="..\..\upnp\src\genlib\client_table\client_table.c"
>
</File>
<File
RelativePath="..\..\upnp\src\genlib\client_table\ClientSubscription.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\Discovery.c"
>
</File>
<File
RelativePath="..\..\ixml\src\document.c"
>
@ -796,18 +780,6 @@
RelativePath="..\..\ixml\src\element.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\Event.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\EventSubscribe.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\FileInfo.c"
>
</File>
<File
RelativePath="..\..\threadutil\src\FreeList.c"
>
@ -904,10 +876,6 @@
RelativePath="..\..\upnp\src\ssdp\ssdp_device.c"
>
</File>
<File
RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.c"
>
</File>
<File
RelativePath="..\..\upnp\src\ssdp\ssdp_server.c"
>
@ -916,22 +884,10 @@
RelativePath="..\..\upnp\src\genlib\net\http\statcodes.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\StateVarComplete.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\StateVarRequest.c"
>
</File>
<File
RelativePath="..\..\upnp\src\genlib\util\strintmap.c"
>
</File>
<File
RelativePath="..\..\upnp\src\api\SubscriptionRequest.c"
>
</File>
<File
RelativePath="..\..\upnp\src\uuid\sysdep.c"
>
@ -993,14 +949,6 @@
Name="headers"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\..\upnp\inc\ActionComplete.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\ActionRequest.h"
>
</File>
<File
RelativePath="..\inc\autoconfig.h"
>
@ -1017,22 +965,6 @@
RelativePath="..\..\upnp\src\inc\config.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\Discovery.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\Event.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\EventSubscribe.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\FileInfo.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\gena.h"
>
@ -1113,14 +1045,6 @@
RelativePath="..\..\upnp\src\inc\statcodes.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\StateVarComplete.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\StateVarRequest.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\statuscodes.h"
>
@ -1133,10 +1057,6 @@
RelativePath="..\..\upnp\src\inc\strintmap.h"
>
</File>
<File
RelativePath="..\..\upnp\inc\SubscriptionRequest.h"
>
</File>
<File
RelativePath="..\..\upnp\src\inc\sysdep.h"
>

View File

@ -9,7 +9,7 @@
AC_PREREQ(2.60)
AC_INIT([libupnp], [1.8.0], [mroberto@users.sourceforge.net])
AC_INIT([libupnp], [1.6.20], [mroberto@users.sourceforge.net])
dnl ############################################################################
dnl # *Independently* of the above libupnp package version, the libtool version
dnl # of the 3 libraries need to be updated whenever there is a change released:
@ -316,26 +316,44 @@ dnl ############################################################################
dnl # Release 1.6.18:
dnl # "current:revision:age"
dnl #
dnl # -
dnl # - Code has changed in ixml
dnl # revision: 7 -> 8
dnl # - Code has changed in threadutil
dnl # revision: 2 -> 3
dnl # - Code has changed in upnp
dnl # revision: 1 -> 2
dnl #
dnl #AC_SUBST([LT_VERSION_IXML], [2:8:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:3:0])
dnl #AC_SUBST([LT_VERSION_UPNP], [9:2:3])
dnl #
dnl ############################################################################
dnl # Release 1.6.19:
dnl # "current:revision:age"
dnl #
dnl # - Code has changed in threadutil
dnl # revision: 3 -> 4
dnl # - Code has changed in upnp
dnl # revision: 2 -> 3
dnl #
dnl #AC_SUBST([LT_VERSION_IXML], [2:8:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:4:0])
dnl #AC_SUBST([LT_VERSION_UPNP], [9:3:3])
dnl #
dnl ############################################################################
dnl # Release 1.6.20:
dnl # "current:revision:age"
dnl #
dnl # -
dnl #
dnl #AC_SUBST([LT_VERSION_IXML], [::])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [::])
dnl #AC_SUBST([LT_VERSION_UPNP], [::])
dnl #
dnl ############################################################################
dnl # Release 1.8.0:
dnl # "current:revision:age"
dnl #
dnl # - Start from a new ground.
dnl #
dnl #AC_SUBST([LT_VERSION_IXML], [10:0:0])
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [10:0:0])
dnl #AC_SUBST([LT_VERSION_UPNP], [10:0:0])
dnl #
dnl ############################################################################
AC_SUBST([LT_VERSION_IXML], [10:0:0])
AC_SUBST([LT_VERSION_THREADUTIL], [10:0:0])
AC_SUBST([LT_VERSION_UPNP], [10:0:0])
AC_SUBST([LT_VERSION_IXML], [2:8:0])
AC_SUBST([LT_VERSION_THREADUTIL], [6:4:0])
AC_SUBST([LT_VERSION_UPNP], [9:3:3])
dnl ############################################################################
dnl # Repeating the algorithm to place it closer to the modificatin place:
dnl # - library code modified: revision++
@ -462,11 +480,6 @@ if test "x$enable_unspecified_server" = xyes ; then
AC_DEFINE(UPNP_ENABLE_UNSPECIFIED_SERVER, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([open_ssl], [no], [open-ssl support])
if test "x$enable_open_ssl" = xyes ; then
AC_DEFINE(UPNP_ENABLE_OPEN_SSL, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([notification_reordering], [yes], [GENA notification reordering in gena_device.c])
if test "x$enable_notification_reordering" = xyes ; then
AC_DEFINE(UPNP_ENABLE_NOTIFICATION_REORDERING, 1, [see upnpconfig.h])
@ -477,11 +490,6 @@ if test "x$enable_blocking_tcp_connections" = xyes ; then
AC_DEFINE(UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([scriptsupport], [yes], [script support for IXML document tree, see ixml.h])
if test "x$enable_scriptsupport" = xyes ; then
AC_DEFINE(IXML_HAVE_SCRIPTSUPPORT, 1, [see upnpconfig.h])
fi
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
@ -706,7 +714,6 @@ AC_CONFIG_FILES([
upnp/Makefile
upnp/doc/Makefile
upnp/sample/Makefile
upnp/unittest/Makefile
docs/dist/Makefile
libupnp.pc
])

View File

@ -19,10 +19,6 @@ else
AM_CPPFLAGS += -DNDEBUG
endif
if ENABLE_SCRIPTSUPPORT
AM_CPPFLAGS += -DIXML_HAVE_SCRIPTSUPPORT
endif
lib_LTLIBRARIES = libixml.la
libixml_la_LDFLAGS = -version-info $(LT_VERSION_IXML) \

View File

@ -158,13 +158,6 @@ typedef struct _IXML_Document *Docptr;
typedef struct _IXML_Node *Nodeptr;
#ifdef IXML_HAVE_SCRIPTSUPPORT
/*!
* \brief Signature for GC support method, called before a node is freed.
*/
typedef void (*IXML_BeforeFreeNode_t) (Nodeptr obj);
#endif
/*!
* \brief Data structure common to all types of nodes.
@ -185,9 +178,6 @@ typedef struct _IXML_Node
Nodeptr nextSibling;
Nodeptr firstAttr;
Docptr ownerDocument;
#ifdef IXML_HAVE_SCRIPTSUPPORT
void* ctag; /* custom tag */
#endif
} IXML_Node;
@ -273,8 +263,6 @@ extern "C" {
* The \b Node interface forms the primary datatype for all other DOM
* objects. Every other interface is derived from this interface, inheriting
* its functionality. For more information, refer to DOM2-Core page 34.
* (Note: within the IXML library the NamedNodeMap and NodeList interfaces are
* the only interfaces that are not DOM objects and hence do not inherit from Node)
*
* @{
*/
@ -326,8 +314,7 @@ EXPORT_SPEC int ixmlNode_setNodeValue(
/*!
* \brief Retrieves the type of a \b Node. Note that not all possible
* return values are actually implemented.
* \brief Retrieves the type of a \b Node.
*
* \return An enum IXML_NODE_TYPE representing the type of the \b Node.
*/
@ -638,29 +625,9 @@ EXPORT_SPEC BOOL ixmlNode_hasAttributes(
* \brief Frees a \b Node and all \b Nodes in its subtree.
*/
EXPORT_SPEC void ixmlNode_free(
/*! [in] The \b Node tree to free. Before it is freed, the handler
* set by \b ixmlSetBeforeFree will be called, the order will be
* top-down.
*/
/*! [in] The \b Node tree to free. */
IXML_Node *nodeptr);
#ifdef IXML_HAVE_SCRIPTSUPPORT
/*!
* \brief Sets the custom tag for the node.
*/
EXPORT_SPEC void ixmlNode_setCTag(
/*! [in] The \b Node to which to attach the tag. */
IXML_Node *nodeptr,
/*! [in] The \b tag to attach. */
void *ctag);
/*!
* \brief Gets the custom tag for the node.
*/
EXPORT_SPEC void* ixmlNode_getCTag(
/*! [in] The \b Node from which to get the tag. */
IXML_Node *nodeptr);
#endif
/* @} Interface Node */
@ -904,7 +871,7 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
/*! [in] The owner \b Document of the new node. */
IXML_Document *doc,
/*! [in] The name of the new attribute. */
const DOMString name);
const char *name);
/*!
@ -925,7 +892,7 @@ EXPORT_SPEC int ixmlDocument_createAttributeEx(
/*! [in] The owner \b Document of the new node. */
IXML_Document *doc,
/*! [in] The name of the new attribute. */
const DOMString name,
const char *name,
/*! [out] A pointer to a \b Attr where the new object will be stored. */
IXML_Attr **attrNode);
@ -1770,18 +1737,6 @@ EXPORT_SPEC void ixmlRelaxParser(
*/
char errorChar);
#ifdef IXML_HAVE_SCRIPTSUPPORT
/*!
* \brief Sets the handler to call before a node is freed.
*/
EXPORT_SPEC void ixmlSetBeforeFree(
/*! [in] If \b hndlr is set to a function, it will be called before any
* node is freed, with the node as its parameter. This allows scripting
* languages to do their garbage collection, without maintaining their
* own tree structure.
*/
IXML_BeforeFreeNode_t hndlr);
#endif
/*!
* \brief Parses an XML text buffer converting it into an IXML DOM representation.

View File

@ -281,7 +281,7 @@ IXML_Node *ixmlDocument_createTextNode(
int ixmlDocument_createAttributeEx(
IXML_Document *doc,
const DOMString name,
const char *name,
IXML_Attr **rtAttr)
{
IXML_Attr *attrNode = NULL;
@ -322,7 +322,7 @@ ErrorHandler:
IXML_Attr *ixmlDocument_createAttribute(
IXML_Document *doc,
const DOMString name)
const char *name)
{
IXML_Attr *attrNode = NULL;

View File

@ -120,25 +120,6 @@ void Parser_setErrorChar(
/*! [in] The character to become the error character. */
char c);
#ifdef IXML_HAVE_SCRIPTSUPPORT
/*!
* \brief Sets the handler to call before a node is freed.
*
* If \b hndlr is set to a function, it will be called before any
* node is freed, with the node as its parameter. This allows scripting
* languages to do their garbage collection, without maintaining their
* own tree structure.
*/
void Parser_setBeforeFree(
/*! [in] The handler callback to call before each node to be freed. */
IXML_BeforeFreeNode_t hndlr);
/*!
* \brief Gets the handler to call before a node is freed.
*/
IXML_BeforeFreeNode_t Parser_getBeforeFree();
#endif
/*!
* \brief Fees a node contents.

View File

@ -417,13 +417,6 @@ void ixmlRelaxParser(char errorChar)
Parser_setErrorChar(errorChar);
}
#ifdef IXML_HAVE_SCRIPTSUPPORT
void ixmlSetBeforeFree(IXML_BeforeFreeNode_t hndlr)
{
Parser_setBeforeFree(hndlr);
}
#endif
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
{

View File

@ -55,9 +55,6 @@
static char g_error_char = '\0';
#ifdef IXML_HAVE_SCRIPTSUPPORT
static IXML_BeforeFreeNode_t Before_Free_callback;
#endif
static const char LESSTHAN = '<';
@ -2501,17 +2498,6 @@ void Parser_setErrorChar(char c)
g_error_char = c;
}
#ifdef IXML_HAVE_SCRIPTSUPPORT
void Parser_setBeforeFree(IXML_BeforeFreeNode_t hndlr)
{
Before_Free_callback = hndlr;
}
IXML_BeforeFreeNode_t Parser_getBeforeFree()
{
return Before_Free_callback;
}
#endif
/*!
* \brief Initializes a xml parser.

View File

@ -107,10 +107,6 @@ static void ixmlNode_freeSingleNode(
void ixmlNode_free(IXML_Node *nodeptr)
{
if (nodeptr != NULL) {
#ifdef IXML_HAVE_SCRIPTSUPPORT
IXML_BeforeFreeNode_t hndlr = Parser_getBeforeFree();
if (hndlr != NULL) hndlr(nodeptr);
#endif
ixmlNode_free(nodeptr->firstChild);
ixmlNode_free(nodeptr->nextSibling);
ixmlNode_free(nodeptr->firstAttr);
@ -1384,17 +1380,3 @@ ErrorHandler:
return IXML_INSUFFICIENT_MEMORY;
}
#ifdef IXML_HAVE_SCRIPTSUPPORT
void ixmlNode_setCTag(IXML_Node *nodeptr, void *ctag)
{
if (nodeptr != NULL) nodeptr->ctag = ctag;
}
void* ixmlNode_getCTag(IXML_Node *nodeptr)
{
if (nodeptr != NULL)
return nodeptr->ctag;
else
return NULL;
}
#endif

View File

@ -1,4 +1,4 @@
Version: 1.8.0
Version: 1.6.20
Summary: Universal Plug and Play (UPnP) SDK
Name: libupnp
Release: 1%{?dist}

View File

@ -29,6 +29,11 @@ libthreadutil_la_SOURCES = \
src/TimerThread.c
upnpincludedir = $(includedir)/upnp
upnpinclude_HEADERS = \
inc/ithread.h
upnpinclude_HEADERS = \
inc/ithread.h \
inc/FreeList.h \
inc/LinkedList.h \
inc/ThreadPool.h \
inc/TimerThread.h

View File

@ -4,7 +4,7 @@
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
#
SUBDIRS = doc . sample unittest
SUBDIRS = doc . sample
AM_CPPFLAGS = \
-I$(srcdir)/inc \
@ -19,21 +19,6 @@ LDADD = \
upnpincludedir = $(includedir)/upnp
upnpinclude_HEADERS = \
inc/ActionComplete.h \
inc/ActionRequest.h \
inc/Callback.h \
inc/Discovery.h \
inc/Event.h \
inc/EventSubscribe.h \
inc/FileInfo.h \
inc/list.h \
inc/poison.h \
inc/StateVarComplete.h \
inc/StateVarRequest.h \
inc/SubscriptionRequest.h \
inc/TemplateInclude.h \
inc/TemplateSource.h \
inc/TemplateUndef.h \
inc/UpnpString.h \
inc/upnp.h \
inc/upnpdebug.h \
@ -62,7 +47,6 @@ libupnp_la_LDFLAGS = \
libupnp_la_SOURCES = \
src/inc/config.h \
src/inc/client_table.h \
src/inc/ClientSubscription.h \
src/inc/gena.h \
src/inc/gena_ctrlpt.h \
src/inc/gena_device.h \
@ -97,8 +81,7 @@ libupnp_la_SOURCES = \
# ssdp
if ENABLE_SSDP
libupnp_la_SOURCES += \
src/ssdp/ssdp_ResultData.c \
src/ssdp/ssdp_ResultData.h \
src/ssdp/ssdp_ResultData.h \
src/ssdp/ssdp_device.c \
src/ssdp/ssdp_ctrlpt.c \
src/ssdp/ssdp_server.c
@ -115,13 +98,12 @@ endif
# genlib
libupnp_la_SOURCES += \
src/genlib/miniserver/miniserver.c \
src/genlib/client_table/client_table.c \
src/genlib/client_table/ClientSubscription.c \
src/genlib/service_table/service_table.c \
src/genlib/util/membuffer.c \
src/genlib/util/strintmap.c \
src/genlib/util/upnp_timeout.c \
src/genlib/util/util.c \
src/genlib/client_table/client_table.c \
src/genlib/net/sock.c \
src/genlib/net/http/httpparser.c \
src/genlib/net/http/httpreadwrite.c \
@ -140,15 +122,6 @@ endif
# api
libupnp_la_SOURCES += \
src/api/ActionComplete.c \
src/api/ActionRequest.c \
src/api/Discovery.c \
src/api/Event.c \
src/api/EventSubscribe.c \
src/api/FileInfo.c \
src/api/StateVarComplete.c \
src/api/StateVarRequest.c \
src/api/SubscriptionRequest.c \
src/api/UpnpString.c \
src/api/upnpapi.c

View File

@ -1,26 +0,0 @@
#ifndef ACTIONCOMPLETE_H
#define ACTIONCOMPLETE_H
/*!
* \file
*
* \brief UpnpActionComplete object declaration.
*
* \author Marcelo Roberto Jimenez
*/
#define CLASS UpnpActionComplete
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, CtrlUrl) \
EXPAND_CLASS_MEMBER_INT(CLASS, ActionRequest, IXML_Document *) \
EXPAND_CLASS_MEMBER_INT(CLASS, ActionResult, IXML_Document *) \
#include "TemplateInclude.h"
#endif /* ACTIONCOMPLETE_H */

View File

@ -1,36 +0,0 @@
#ifndef ACTIONREQUEST_H
#define ACTIONREQUEST_H
/*!
* \file
*
* \brief UpnpActionRequest object declaration.
*
* Returned as part of a \b UPNP_CONTROL_ACTION_COMPLETE callback.
*
* \author Marcelo Roberto Jimenez
*/
#include "UpnpInet.h" /* for struct sockaddr_storage */
#define CLASS UpnpActionRequest
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, Socket, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ErrStr) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ActionName) \
EXPAND_CLASS_MEMBER_STRING(CLASS, DevUDN) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceID) \
EXPAND_CLASS_MEMBER_INT(CLASS, ActionRequest, IXML_Document *) \
EXPAND_CLASS_MEMBER_INT(CLASS, ActionResult, IXML_Document *) \
EXPAND_CLASS_MEMBER_INT(CLASS, SoapHeader, IXML_Document *) \
EXPAND_CLASS_MEMBER_BUFFER(CLASS, CtrlPtIPAddr, struct sockaddr_storage) \
#include "TemplateInclude.h"
#endif /* ACTIONREQUEST_H */

View File

@ -1,153 +0,0 @@
#ifndef CALLBACK_H
#define CALLBACK_H
/*!
* \file
*/
/*!
* \brief The reason code for an event callback.
*
* The \b Event parameter will be different depending on the reason for the
* callback. The descriptions for each event type describe the contents of the
* \b Event parameter.
*/
enum Upnp_EventType_e {
/*
* Control callbacks
*/
/*! Received by a device when a control point issues a control
* request. The \b Event parameter contains a pointer to a \b
* UpnpActionRequest structure containing the action. The application
* stores the results of the action in this structure. */
UPNP_CONTROL_ACTION_REQUEST,
/*! A \b UpnpSendActionAsync call completed. The \b Event
* parameter contains a pointer to a \b UpnpActionComplete structure
* with the results of the action. */
UPNP_CONTROL_ACTION_COMPLETE,
/*! Received by a device when a query for a single service variable
* arrives. The \b Event parameter contains a pointer to a \b
* UpnpStateVarRequest structure containing the name of the variable
* and value. */
UPNP_CONTROL_GET_VAR_REQUEST,
/*! A \b UpnpGetServiceVarStatus call completed. The \b Event
* parameter contains a pointer to a \b UpnpStateVarComplete structure
* containing the value for the variable. */
UPNP_CONTROL_GET_VAR_COMPLETE,
/*
* Discovery callbacks
*/
/*! Received by a control point when a new device or service is available.
* The \b Event parameter contains a pointer to a \b
* UpnpDiscovery structure with the information about the device
* or service. */
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE,
/*! Received by a control point when a device or service shuts down. The \b
* Event parameter contains a pointer to a \b UpnpDiscovery
* structure containing the information about the device or
* service. */
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE,
/*! Received by a control point when a matching device or service responds.
* The \b Event parameter contains a pointer to a \b
* UpnpDiscovery structure containing the information about
* the reply to the search request. */
UPNP_DISCOVERY_SEARCH_RESULT,
/*! Received by a control point when the search timeout expires. The
* SDK generates no more callbacks for this search after this
* event. The \b Event parameter is \c NULL. */
UPNP_DISCOVERY_SEARCH_TIMEOUT,
/*
* Eventing callbacks
*/
/*! Received by a device when a subscription arrives.
* The \b Event parameter contains a pointer to a \b
* UpnpSubscriptionRequest structure. At this point, the
* subscription has already been accepted. \b UpnpAcceptSubscription
* needs to be called to confirm the subscription and transmit the
* initial state table. This can be done during this callback. The SDK
* generates no events for a subscription unless the device
* application calls \b UpnpAcceptSubscription.
*/
UPNP_EVENT_SUBSCRIPTION_REQUEST,
/*! Received by a control point when an event arrives. The \b
* Event parameter contains a \b UpnpEvent structure
* with the information about the event. */
UPNP_EVENT_RECEIVED,
/*! A \b UpnpRenewSubscriptionAsync call completed. The status of
* the renewal is in the \b Event parameter as a \b
* Upnp_Event_Subscription structure. */
UPNP_EVENT_RENEWAL_COMPLETE,
/*! A \b UpnpSubscribeAsync call completed. The status of the
* subscription is in the \b Event parameter as a \b
* Upnp_Event_Subscription structure. */
UPNP_EVENT_SUBSCRIBE_COMPLETE,
/*! A \b UpnpUnSubscribeAsync call completed. The status of the
* subscription is in the \b Event parameter as a \b
* UpnpEventSubscribe structure. */
UPNP_EVENT_UNSUBSCRIBE_COMPLETE,
/*! The auto-renewal of a client subscription failed.
* The \b Event parameter is a \b UpnpEventSubscribe structure
* with the error code set appropriately. The subscription is no longer
* valid. */
UPNP_EVENT_AUTORENEWAL_FAILED,
/*! A client subscription has expired. This will only occur
* if auto-renewal of subscriptions is disabled.
* The \b Event parameter is a \b UpnpEventSubscribe
* structure. The subscription is no longer valid. */
UPNP_EVENT_SUBSCRIPTION_EXPIRED
};
typedef enum Upnp_EventType_e Upnp_EventType;
/*!
* All callback functions share the same prototype, documented below.
* Note that any memory passed to the callback function
* is valid only during the callback and should be copied if it
* needs to persist. This callback function needs to be thread
* safe. The context of the callback is always on a valid thread
* context and standard synchronization methods can be used. Note,
* however, because of this the callback cannot call SDK functions
* unless explicitly noted.
*
* \verbatim
int CallbackFxn(Upnp_EventType EventType, void *Event, void *Cookie);
\endverbatim
*
* where \b EventType is the event that triggered the callback,
* \b Event is a structure that denotes event-specific information for that
* event, and \b Cookie is the user data passed when the callback was
* registered.
*
* See \b Upnp_EventType for more information on the callback values and
* the associated \b Event parameter.
*
* The return value of the callback is currently ignored. It may be used
* in the future to communicate results back to the SDK.
*/
typedef int (*Upnp_FunPtr)(
/*! [in] .*/
Upnp_EventType EventType,
/*! [in] .*/
const void *Event,
/*! [in] .*/
void *Cookie);
#endif /* CALLBACK_H */

View File

@ -1,35 +0,0 @@
#ifndef DISCOVERY_H
#define DISCOVERY_H
/*!
* \file
*
* \brief UpnpDiscovery object declararion.
*
* Returned in a \b UPNP_DISCOVERY_RESULT callback.
*
* \author Marcelo Roberto Jimenez
*/
#include "UpnpInet.h" /* for struct sockaddr_storage */
#define CLASS UpnpDiscovery
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, Expires, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, DeviceID) \
EXPAND_CLASS_MEMBER_STRING(CLASS, DeviceType) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceType) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceVer) \
EXPAND_CLASS_MEMBER_STRING(CLASS, Location) \
EXPAND_CLASS_MEMBER_STRING(CLASS, Os) \
EXPAND_CLASS_MEMBER_STRING(CLASS, Date) \
EXPAND_CLASS_MEMBER_STRING(CLASS, Ext) \
EXPAND_CLASS_MEMBER_BUFFER(CLASS, DestAddr, struct sockaddr_storage) \
#include "TemplateInclude.h"
#endif /* DISCOVERY_H */

View File

@ -1,27 +0,0 @@
#ifndef EVENT_H
#define EVENT_H
/*!
* \file
*
* \brief UpnpEvent object declararion.
*
* Returned along with a \b UPNP_EVENT_RECEIVED callback.
*
* \author Marcelo Roberto Jimenez
*/
#define CLASS UpnpEvent
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, EventKey, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, ChangedVariables, IXML_Document *) \
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
#include "TemplateInclude.h"
#endif /* EVENT_H */

View File

@ -1,29 +0,0 @@
#ifndef EVENTSUBSCRIBE_H
#define EVENTSUBSCRIBE_H
/*!
* \file
*
* \brief UpnpEventSubscribe object declararion.
*
* Returned along with a \b UPNP_EVENT_SUBSCRIBE_COMPLETE or
* \b UPNP_EVENT_UNSUBSCRIBE_COMPLETE callback.
*
* \author Marcelo Roberto Jimenez
*/
#define CLASS UpnpEventSubscribe
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, TimeOut, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
EXPAND_CLASS_MEMBER_STRING(CLASS, PublisherUrl) \
#include "TemplateInclude.h"
#endif /* EVENTSUBSCRIBE_H */

View File

@ -1,35 +0,0 @@
#ifndef FILEINFO_H
#define FILEINFO_H
/*!
* \file
*
* \brief UpnpFileInfo object declararion.
*
* Detailed description of this class should go here
*
* \author Marcelo Roberto Jimenez
*/
#include "upnpconfig.h"
#include <sys/types.h> /* for off_t */
#include <time.h> /* for time_t */
#define CLASS UpnpFileInfo
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, FileLength, off_t) \
EXPAND_CLASS_MEMBER_INT(CLASS, LastModified, time_t) \
EXPAND_CLASS_MEMBER_INT(CLASS, IsDirectory, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, IsReadable, int) \
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, ContentType) \
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, ExtraHeaders) \
#include "TemplateInclude.h"
#endif /* FILEINFO_H */

View File

@ -1,29 +0,0 @@
#ifndef STATEVARCOMPLETE_H
#define STATEVARCOMPLETE_H
/*!
* \file
*
* \brief UpnpStateVarComplete object declararion.
*
* Represents the reply for the current value of a state variable in an
* asynchronous call.
*
* \author Marcelo Roberto Jimenez
*/
#define CLASS UpnpStateVarComplete
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, CtrlUrl) \
EXPAND_CLASS_MEMBER_STRING(CLASS, StateVarName) \
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, CurrentVal) \
#include "TemplateInclude.h"
#endif /* STATEVARCOMPLETE_H */

View File

@ -1,35 +0,0 @@
#ifndef STATEVARREQUEST_H
#define STATEVARREQUEST_H
/*!
* \file
*
* \brief UpnpStateVarRequest object declararion.
*
* Represents the request for current value of a state variable in a service
* state table.
*
* \author Marcelo Roberto Jimenez
*/
#include "UpnpInet.h" /* for struct sockaddr_storage */
#define CLASS UpnpStateVarRequest
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, Socket, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ErrStr) \
EXPAND_CLASS_MEMBER_STRING(CLASS, DevUDN) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceID) \
EXPAND_CLASS_MEMBER_STRING(CLASS, StateVarName) \
EXPAND_CLASS_MEMBER_BUFFER(CLASS, CtrlPtIPAddr, struct sockaddr_storage) \
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, CurrentVal) \
#include "TemplateInclude.h"
#endif /* STATEVARREQUEST_H */

View File

@ -1,28 +0,0 @@
#ifndef SUBSCRIPTIONREQUEST_H
#define SUBSCRIPTIONREQUEST_H
/*!
* \file
*
* \brief UpnpSubscriptionRequest object declararion.
*
* Returned along with a \b UPNP_EVENT_SUBSCRIPTION_REQUEST callback.
*
* \author Marcelo Roberto Jimenez
*/
#define CLASS UpnpSubscriptionRequest
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceId) \
EXPAND_CLASS_MEMBER_STRING(CLASS, UDN) \
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
#include "TemplateInclude.h"
#endif /* SUBSCRIPTIONREQUEST_H */

View File

@ -1,165 +0,0 @@
/*
* C Template objects.
*
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
*/
#ifndef TEMPLATEINCLUDE_H
#define TEMPLATEINCLUDE_H
/*!
* \file
*
* \brief Templates for include files of objects.
*
* Usage:
*
* - In the include file Token.h:
* #include "Token_def.h"
* #include "TemplateInclude.h"
*
* - In the source file Token.c:
* #include "Token.h"
* #include "TemplateSource.h"
*
* \author Marcelo Roberto Jimenez
*/
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_COMMON(CLASS) \
TEMPLATE_PROTOTYPE_COMMON_AUX(CLASS)
#define TEMPLATE_PROTOTYPE_COMMON_AUX(CLASS) \
/*!
* DOC_##CLASS
*/ \
typedef struct s_##CLASS CLASS; \
\
/*! Constructor */ \
EXPORT_SPEC CLASS *CLASS##_new(); \
\
/*! Destructor */ \
EXPORT_SPEC void CLASS##_delete(CLASS *p); \
\
/*! Copy Constructor */ \
EXPORT_SPEC CLASS *CLASS##_dup(const CLASS *p); \
\
/*! Assignment operator */ \
EXPORT_SPEC int CLASS##_assign(CLASS *p, const CLASS *q); \
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_INT(CLASS, MEMBER, TYPE) \
TEMPLATE_PROTOTYPE_INT_AUX(CLASS, MEMBER, TYPE)
#define TEMPLATE_PROTOTYPE_INT_AUX(CLASS, MEMBER, TYPE) \
/*! DOC_##CLASS##_##MEMBER */ \
EXPORT_SPEC TYPE CLASS##_get_##MEMBER(const CLASS *p); \
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, TYPE n); \
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_BUFFER(CLASS, MEMBER, TYPE) \
TEMPLATE_PROTOTYPE_BUFFER_AUX(CLASS, MEMBER, TYPE)
#define TEMPLATE_PROTOTYPE_BUFFER_AUX(CLASS, MEMBER, TYPE) \
/*! DOC_##CLASS_##MEMBER */ \
EXPORT_SPEC const TYPE *CLASS##_get_##MEMBER(const CLASS *p); \
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const TYPE *buf); \
EXPORT_SPEC void CLASS##_clear_##MEMBER(CLASS *p); \
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_LIST(CLASS, MEMBER) \
TEMPLATE_PROTOTYPE_LIST_AUX(CLASS, MEMBER)
#define TEMPLATE_PROTOTYPE_LIST_AUX(CLASS, MEMBER) \
/*! DOC_##CLASS_##MEMBER */ \
EXPORT_SPEC const struct list_head *CLASS##_get_##MEMBER(const CLASS *p); \
EXPORT_SPEC void CLASS##_add_to_list_##MEMBER(CLASS *p, struct list_head *head); \
EXPORT_SPEC void CLASS##_remove_from_list_##MEMBER(CLASS *p); \
EXPORT_SPEC void CLASS##_replace_in_list_##MEMBER(CLASS *p, struct list_head *new); \
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_OBJECT(CLASS, MEMBER, TYPE) \
TEMPLATE_PROTOTYPE_OBJECT_AUX(CLASS, MEMBER, TYPE)
#define TEMPLATE_PROTOTYPE_OBJECT_AUX(CLASS, MEMBER, TYPE) \
/*! DOC_##CLASS##_##MEMBER */ \
EXPORT_SPEC const TYPE *CLASS##_get_##MEMBER(const CLASS *p); \
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const TYPE *n); \
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_STRING(CLASS, MEMBER) \
TEMPLATE_PROTOTYPE_STRING_AUX(CLASS, MEMBER)
#define TEMPLATE_PROTOTYPE_STRING_AUX(CLASS, MEMBER) \
/*! DOC_##CLASS##_##MEMBER */ \
EXPORT_SPEC const UpnpString *CLASS##_get_##MEMBER(const CLASS *p); \
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const UpnpString *s); \
EXPORT_SPEC size_t CLASS##_get_##MEMBER##_Length(const CLASS *p); \
EXPORT_SPEC const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p); \
EXPORT_SPEC int CLASS##_strcpy_##MEMBER(CLASS *p, const char *s); \
EXPORT_SPEC int CLASS##_strncpy_##MEMBER(CLASS *p, const char *s, size_t n); \
EXPORT_SPEC void CLASS##_clear_##MEMBER(CLASS *p); \
/******************************************************************************/
#define TEMPLATE_PROTOTYPE_DOMSTRING(CLASS, MEMBER) \
TEMPLATE_PROTOTYPE_DOMSTRING_AUX(CLASS, MEMBER)
#define TEMPLATE_PROTOTYPE_DOMSTRING_AUX(CLASS, MEMBER) \
/*! DOC_##CLASS_##MEMBER */ \
EXPORT_SPEC const DOMString CLASS##_get_##MEMBER(const CLASS *p); \
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const DOMString s); \
EXPORT_SPEC const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p); \
#endif /* TEMPLATEINCLUDE_H */
/******************************************************************************
*
* Actual source starts here.
*
******************************************************************************/
#include <stdlib.h> /* for size_t */
#include "ixml.h" /* for DOMString, IXML_Document */
#include "list.h" /* for struct list_head */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
TEMPLATE_PROTOTYPE_COMMON(CLASS)
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_PROTOTYPE_INT(CLASS, MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_PROTOTYPE_BUFFER(CLASS, MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_PROTOTYPE_LIST(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_PROTOTYPE_OBJECT(CLASS, MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_PROTOTYPE_STRING(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_PROTOTYPE_DOMSTRING(CLASS, MEMBER)
EXPAND_CLASS_MEMBERS(CLASS)
#include "TemplateUndef.h"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#ifdef TEMPLATE_GENERATE_SOURCE
#include "TemplateSource.h"
#endif /* TEMPLATE_GENERATE_SOURCE */
/* Cleanup the template mess. */
#undef PREFIX
#undef CLASS
#undef EXPAND_CLASS_MEMBERS

View File

@ -1,340 +0,0 @@
/*
* C Template objects.
*
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
*/
#ifndef TEMPLATESOURCE_H
#define TEMPLATESOURCE_H
/*!
* \file
*
* \brief Templates for source files of objects.
*
* Usage:
*
* - In the include file Token.h:
* #include "Token_def.h"
* #include "TemplateInclude.h"
*
* - In the source file Token.c:
* #include "Token.h"
* #include "TemplateSource.h"
*
* \author Marcelo Roberto Jimenez
*/
/******************************************************************************/
#define TEMPLATE_DEFINITION_INT(MEMBER, TYPE) TYPE m_##MEMBER;
#define TEMPLATE_DEFINITION_BUFFER(MEMBER, TYPE) TYPE m_##MEMBER;
#define TEMPLATE_DEFINITION_LIST(MEMBER) struct list_head m_##MEMBER;
#define TEMPLATE_DEFINITION_OBJECT(MEMBER, TYPE) TYPE *m_##MEMBER;
#define TEMPLATE_DEFINITION_STRING(MEMBER) UpnpString *m_##MEMBER;
#define TEMPLATE_DEFINITION_DOMSTRING(MEMBER) DOMString m_##MEMBER;
/******************************************************************************/
#define TEMPLATE_CONSTRUCTOR_INT(MEMBER, TYPE) /* p->m_##MEMBER = 0; */
#define TEMPLATE_CONSTRUCTOR_BUFFER(MEMBER, TYPE) \
/* memset(&p->m_##MEMBER, 0, sizeof (TYPE)); */
#define TEMPLATE_CONSTRUCTOR_LIST(MEMBER, TYPE) INIT_LIST_HEAD(&p->m_##MEMBER);
#define TEMPLATE_CONSTRUCTOR_OBJECT(MEMBER, TYPE) p->m_##MEMBER = TYPE##_new();
#define TEMPLATE_CONSTRUCTOR_STRING(MEMBER) p->m_##MEMBER = UpnpString_new();
#define TEMPLATE_CONSTRUCTOR_DOMSTRING(MEMBER) p->m_##MEMBER = NULL;
/******************************************************************************/
#define TEMPLATE_DESTRUCTOR_INT(MEMBER, TYPE) p->m_##MEMBER = 0;
#define TEMPLATE_DESTRUCTOR_BUFFER(MEMBER, TYPE) memset(&p->m_##MEMBER, 0, sizeof (TYPE));
#define TEMPLATE_DESTRUCTOR_LIST(MEMBER) list_del(&p->m_##MEMBER);
#define TEMPLATE_DESTRUCTOR_OBJECT(MEMBER, TYPE) TYPE##_delete(p->m_##MEMBER); p->m_##MEMBER = NULL;
#define TEMPLATE_DESTRUCTOR_STRING(MEMBER) UpnpString_delete(p->m_##MEMBER); p->m_##MEMBER = NULL;
#define TEMPLATE_DESTRUCTOR_DOMSTRING(MEMBER) ixmlFreeDOMString(p->m_##MEMBER); p->m_##MEMBER = NULL;
/******************************************************************************/
#define TEMPLATE_ASSIGNMENT(CLASS, MEMBER) ok = ok && CLASS##_set_##MEMBER(p, CLASS##_get_##MEMBER(q));
/******************************************************************************/
#define TEMPLATE_METHODS_INT(CLASS, MEMBER, TYPE) \
TEMPLATE_METHODS_INT_AUX(CLASS, MEMBER, TYPE)
#define TEMPLATE_METHODS_INT_AUX(CLASS, MEMBER, TYPE) \
TYPE CLASS##_get_##MEMBER(const CLASS *p) \
{ \
return ((struct S##CLASS *)p)->m_##MEMBER; \
} \
\
int CLASS##_set_##MEMBER(CLASS *p, TYPE n) \
{ \
((struct S##CLASS *)p)->m_##MEMBER = n; \
return 1; \
} \
/******************************************************************************/
#define TEMPLATE_METHODS_BUFFER(CLASS, MEMBER, TYPE) \
TEMPLATE_METHODS_BUFFER_AUX(CLASS, MEMBER, TYPE)
#define TEMPLATE_METHODS_BUFFER_AUX(CLASS, MEMBER, TYPE) \
const TYPE *CLASS##_get_##MEMBER(const CLASS *p) \
{ \
return (TYPE *)&((struct S##CLASS *)p)->m_##MEMBER; \
} \
\
int CLASS##_set_##MEMBER(CLASS *p, const TYPE *buf) \
{ \
((struct S##CLASS *)p)->m_##MEMBER = *(TYPE *)buf; \
return 1; \
} \
\
void CLASS##_clear_##MEMBER(CLASS *p) \
{ \
memset(&((struct S##CLASS *)p)->m_##MEMBER, 0, sizeof(TYPE)); \
} \
/******************************************************************************/
#define TEMPLATE_METHODS_LIST(CLASS, MEMBER) \
TEMPLATE_METHODS_LIST_AUX(CLASS, MEMBER)
#define TEMPLATE_METHODS_LIST_AUX(CLASS, MEMBER) \
const struct list_head *CLASS##_get_##MEMBER(const CLASS *p) \
{ \
return (struct list_head *)&((struct S##CLASS *)p)->m_##MEMBER; \
} \
\
void CLASS##_add_to_list_##MEMBER(CLASS *p, struct list_head *head) \
{ \
list_add(&((struct S##CLASS *)p)->m_##MEMBER, head); \
} \
\
void CLASS##_remove_from_list_##MEMBER(CLASS *p) \
{ \
list_del_init(&((struct S##CLASS *)p)->m_##MEMBER); \
} \
\
void CLASS##_replace_in_list_##MEMBER(CLASS *p, struct list_head *new) \
{ \
list_replace_init(&((struct S##CLASS *)p)->m_##MEMBER, new); \
} \
/******************************************************************************/
#define TEMPLATE_METHODS_OBJECT(CLASS, MEMBER, TYPE) \
TEMPLATE_METHODS_OBJECT_AUX(CLASS, MEMBER, TYPE)
#define TEMPLATE_METHODS_OBJECT_AUX(CLASS, MEMBER, TYPE) \
const TYPE *CLASS##_get_##MEMBER(const CLASS *p) \
{ \
return ((struct S##CLASS *)p)->m_##MEMBER; \
} \
\
int CLASS##_set_##MEMBER(CLASS *p, const TYPE *s) \
{ \
TYPE *q = TYPE##_dup(s); \
if (!q) return 0; \
TYPE##_delete(((struct S##CLASS *)p)->m_##MEMBER); \
((struct S##CLASS *)p)->m_##MEMBER = q; \
return 1; \
} \
/******************************************************************************/
#define TEMPLATE_METHODS_STRING(CLASS, MEMBER) \
TEMPLATE_METHODS_STRING_AUX(CLASS, MEMBER)
#define TEMPLATE_METHODS_STRING_AUX(CLASS, MEMBER) \
const UpnpString *CLASS##_get_##MEMBER(const CLASS *p) \
{ \
return ((struct S##CLASS *)p)->m_##MEMBER; \
} \
\
int CLASS##_set_##MEMBER(CLASS *p, const UpnpString *s) \
{ \
const char *q = UpnpString_get_String(s); \
return UpnpString_set_String(((struct S##CLASS *)p)->m_##MEMBER, q); \
} \
\
size_t CLASS##_get_##MEMBER##_Length(const CLASS *p) \
{ \
return UpnpString_get_Length(CLASS##_get_##MEMBER(p)); \
} \
const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p) \
{ \
return UpnpString_get_String(CLASS##_get_##MEMBER(p)); \
} \
\
int CLASS##_strcpy_##MEMBER(CLASS *p, const char *s) \
{ \
return UpnpString_set_String(((struct S##CLASS *)p)->m_##MEMBER, s); \
} \
\
int CLASS##_strncpy_##MEMBER(CLASS *p, const char *s, size_t n) \
{ \
return UpnpString_set_StringN(((struct S##CLASS *)p)->m_##MEMBER, s, n); \
} \
\
void CLASS##_clear_##MEMBER(CLASS *p) \
{ \
UpnpString_clear(((struct S##CLASS *)p)->m_##MEMBER); \
} \
/******************************************************************************/
#define TEMPLATE_METHODS_DOMSTRING(CLASS, MEMBER) \
TEMPLATE_METHODS_DOMSTRING_AUX(CLASS, MEMBER)
#define TEMPLATE_METHODS_DOMSTRING_AUX(CLASS, MEMBER) \
const DOMString CLASS##_get_##MEMBER(const CLASS *p) \
{ \
return ((struct S##CLASS *)p)->m_##MEMBER; \
} \
\
int CLASS##_set_##MEMBER(CLASS *p, const DOMString s) \
{ \
DOMString q = ixmlCloneDOMString(s); \
if (!q) return 0; \
ixmlFreeDOMString(((struct S##CLASS *)p)->m_##MEMBER); \
((struct S##CLASS *)p)->m_##MEMBER = q; \
return 1; \
} \
\
const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p) \
{ \
return (const char *)CLASS##_get_##MEMBER(p); \
} \
/******************************************************************************
*
* Actual source starts here.
*
******************************************************************************/
#include "config.h"
#include <stdlib.h> /* for calloc(), free() */
#include <string.h> /* for strlen(), strdup() */
/******************************************************************************/
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_DEFINITION_INT(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_DEFINITION_BUFFER(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_DEFINITION_LIST(MEMBER)
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_DEFINITION_OBJECT(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_DEFINITION_STRING(MEMBER)
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_DEFINITION_DOMSTRING(MEMBER)
#define TEMPLATE_DECLARATION_STRUCT(CLASS) \
TEMPLATE_DECLARATION_STRUCT_AUX(CLASS)
#define TEMPLATE_DECLARATION_STRUCT_AUX(CLASS) \
struct S##CLASS { \
EXPAND_CLASS_MEMBERS(CLASS) \
};
TEMPLATE_DECLARATION_STRUCT(CLASS)
#include "TemplateUndef.h"
/******************************************************************************/
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_CONSTRUCTOR_INT(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_CONSTRUCTOR_BUFFER(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_CONSTRUCTOR_LIST(MEMBER, MEMBER)
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_CONSTRUCTOR_OBJECT(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_CONSTRUCTOR_STRING(MEMBER)
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_CONSTRUCTOR_DOMSTRING(MEMBER)
#define TEMPLATE_DEFINITION_CONSTRUCTOR(CLASS) \
TEMPLATE_DEFINITION_CONSTRUCTOR_AUX(CLASS)
#define TEMPLATE_DEFINITION_CONSTRUCTOR_AUX(CLASS) \
CLASS *CLASS##_new() \
{ \
struct S##CLASS *p = calloc(1, sizeof (struct S##CLASS)); \
\
if (!p) return NULL; \
\
EXPAND_CLASS_MEMBERS(CLASS) \
\
return (CLASS *)p; \
}
TEMPLATE_DEFINITION_CONSTRUCTOR(CLASS)
#include "TemplateUndef.h"
/******************************************************************************/
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_DESTRUCTOR_INT(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_DESTRUCTOR_BUFFER(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_DESTRUCTOR_LIST(MEMBER)
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_DESTRUCTOR_OBJECT(MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_DESTRUCTOR_STRING(MEMBER)
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_DESTRUCTOR_DOMSTRING(MEMBER)
#define TEMPLATE_DEFINITION_DESTRUCTOR(CLASS) \
TEMPLATE_DEFINITION_DESTRUCTOR_AUX(CLASS)
#define TEMPLATE_DEFINITION_DESTRUCTOR_AUX(CLASS) \
void CLASS##_delete(CLASS *q) \
{ \
struct S##CLASS *p = (struct S##CLASS *)q; \
\
if (!p) return; \
\
EXPAND_CLASS_MEMBERS(CLASS) \
\
free(p); \
}
TEMPLATE_DEFINITION_DESTRUCTOR(CLASS)
#include "TemplateUndef.h"
/******************************************************************************/
#define TEMPLATE_DEFINITION_COPY_CONSTRUCTOR(CLASS) \
TEMPLATE_DEFINITION_COPY_CONSTRUCTOR_AUX(CLASS)
#define TEMPLATE_DEFINITION_COPY_CONSTRUCTOR_AUX(CLASS) \
CLASS *CLASS##_dup(const CLASS *q) \
{ \
CLASS *p = CLASS##_new(); \
\
if (!p) return NULL; \
\
CLASS##_assign(p, q); \
\
return p; \
}
TEMPLATE_DEFINITION_COPY_CONSTRUCTOR(CLASS)
/******************************************************************************/
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) /* Do not assing. */
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
#define TEMPLATE_DEFINITION_ASSIGNMENT(CLASS) \
TEMPLATE_DEFINITION_ASSIGNMENT_AUX(CLASS)
#define TEMPLATE_DEFINITION_ASSIGNMENT_AUX(CLASS) \
int CLASS##_assign(CLASS *p, const CLASS *q) \
{ \
int ok = 1; \
if (p != q) { \
EXPAND_CLASS_MEMBERS(CLASS) \
} \
return ok; \
}
TEMPLATE_DEFINITION_ASSIGNMENT(CLASS)
#include "TemplateUndef.h"
/******************************************************************************/
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_METHODS_INT(CLASS, MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_METHODS_BUFFER(CLASS, MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_METHODS_LIST(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_METHODS_OBJECT(CLASS, MEMBER, TYPE)
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_METHODS_STRING(CLASS, MEMBER)
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_METHODS_DOMSTRING(CLASS, MEMBER)
EXPAND_CLASS_MEMBERS(CLASS)
#include "TemplateUndef.h"
#endif /* TEMPLATESOURCE_H */

View File

@ -1,17 +0,0 @@
/*
* C Template objects.
*
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
*/
/*!
* \file
*/
#undef EXPAND_CLASS_MEMBER_INT
#undef EXPAND_CLASS_MEMBER_BUFFER
#undef EXPAND_CLASS_MEMBER_LIST
#undef EXPAND_CLASS_MEMBER_OBJECT
#undef EXPAND_CLASS_MEMBER_STRING
#undef EXPAND_CLASS_MEMBER_DOMSTRING

View File

@ -1,720 +0,0 @@
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
#if 0
#include <linux/stddef.h>
#include <linux/poison.h>
#include <linux/prefetch.h>
#include <asm/system.h>
#endif
#include "poison.h"
#ifdef __APPLE__
/* Apple systems define these macros in system headers, so we undef
* them prior to inclusion of this file */
#undef LIST_HEAD
#undef LIST_HEAD_INIT
#undef INIT_LIST_HEAD
#endif
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
static UPNP_INLINE void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
#ifndef CONFIG_DEBUG_LIST
static UPNP_INLINE void __list_add(struct list_head *new_,
struct list_head *prev,
struct list_head *next)
{
next->prev = new_;
new_->next = next;
new_->prev = prev;
prev->next = new_;
}
#else
extern void __list_add(struct list_head *new_,
struct list_head *prev,
struct list_head *next);
#endif
/**
* list_add - add a new entry
* @new_: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static UPNP_INLINE void list_add(struct list_head *new_, struct list_head *head)
{
__list_add(new_, head, head->next);
}
/**
* list_add_tail - add a new entry
* @new_: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static UPNP_INLINE void list_add_tail(struct list_head *new_, struct list_head *head)
{
__list_add(new_, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static UPNP_INLINE void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
/**
* list_del - deletes entry from list.
* @entry: the element to delete from the list.
* Note: list_empty() on entry does not return true after this, the entry is
* in an undefined state.
*/
#ifndef CONFIG_DEBUG_LIST
static UPNP_INLINE void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (struct list_head *)LIST_POISON1;
entry->prev = (struct list_head *)LIST_POISON2;
}
#else
extern void list_del(struct list_head *entry);
#endif
/**
* list_replace - replace old entry by new one
* @old : the element to be replaced
* @new_ : the new element to insert
*
* If @old was empty, it will be overwritten.
*/
static UPNP_INLINE void list_replace(struct list_head *old,
struct list_head *new_)
{
new_->next = old->next;
new_->next->prev = new_;
new_->prev = old->prev;
new_->prev->next = new_;
}
static UPNP_INLINE void list_replace_init(struct list_head *old,
struct list_head *new_)
{
list_replace(old, new_);
INIT_LIST_HEAD(old);
}
/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/
static UPNP_INLINE void list_del_init(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
* @head: the head that will precede our entry
*/
static UPNP_INLINE void list_move(struct list_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
}
/**
* list_move_tail - delete from one list and add as another's tail
* @list: the entry to move
* @head: the head that will follow our entry
*/
static UPNP_INLINE void list_move_tail(struct list_head *list,
struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
/**
* list_is_last - tests whether @list is the last entry in list @head
* @list: the entry to test
* @head: the head of the list
*/
static UPNP_INLINE int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return list->next == head;
}
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
*/
static UPNP_INLINE int list_empty(const struct list_head *head)
{
return head->next == head;
}
/**
* list_empty_careful - tests whether a list is empty and not being modified
* @head: the list to test
*
* Description:
* tests whether a list is empty _and_ checks that no other CPU might be
* in the process of modifying either member (next or prev)
*
* NOTE: using list_empty_careful() without synchronization
* can only be safe if the only activity that can happen
* to the list entry is list_del_init(). Eg. it cannot be used
* if another CPU could re-list_add() it.
*/
static UPNP_INLINE int list_empty_careful(const struct list_head *head)
{
struct list_head *next = head->next;
return (next == head) && (next == head->prev);
}
/**
* list_rotate_left - rotate the list to the left
* @head: the head of the list
*/
static UPNP_INLINE void list_rotate_left(struct list_head *head)
{
struct list_head *first;
if (!list_empty(head)) {
first = head->next;
list_move_tail(first, head);
}
}
/**
* list_is_singular - tests whether a list has just one entry.
* @head: the list to test.
*/
static UPNP_INLINE int list_is_singular(const struct list_head *head)
{
return !list_empty(head) && (head->next == head->prev);
}
static UPNP_INLINE void __list_cut_position(struct list_head *list,
struct list_head *head, struct list_head *entry)
{
struct list_head *new_first = entry->next;
list->next = head->next;
list->next->prev = list;
list->prev = entry;
entry->next = list;
head->next = new_first;
new_first->prev = head;
}
/**
* list_cut_position - cut a list into two
* @list: a new list to add all removed entries
* @head: a list with entries
* @entry: an entry within head, could be the head itself
* and if so we won't cut the list
*
* This helper moves the initial part of @head, up to and
* including @entry, from @head to @list. You should
* pass on @entry an element you know is on @head. @list
* should be an empty list or a list you do not care about
* losing its data.
*
*/
static UPNP_INLINE void list_cut_position(struct list_head *list,
struct list_head *head, struct list_head *entry)
{
if (list_empty(head))
return;
if (list_is_singular(head) &&
(head->next != entry && head != entry))
return;
if (entry == head)
INIT_LIST_HEAD(list);
else
__list_cut_position(list, head, entry);
}
static UPNP_INLINE void __list_splice(const struct list_head *list,
struct list_head *prev,
struct list_head *next)
{
struct list_head *first = list->next;
struct list_head *last = list->prev;
first->prev = prev;
prev->next = first;
last->next = next;
next->prev = last;
}
/**
* list_splice - join two lists, this is designed for stacks
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
static UPNP_INLINE void list_splice(const struct list_head *list,
struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head, head->next);
}
/**
* list_splice_tail - join two lists, each list being a queue
* @list: the new list to add.
* @head: the place to add it in the first list.
*/
static UPNP_INLINE void list_splice_tail(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head->prev, head);
}
/**
* list_splice_init - join two lists and reinitialise the emptied list.
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* The list at @list is reinitialised
*/
static UPNP_INLINE void list_splice_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head, head->next);
INIT_LIST_HEAD(list);
}
}
/**
* list_splice_tail_init - join two lists and reinitialise the emptied list
* @list: the new list to add.
* @head: the place to add it in the first list.
*
* Each of the lists is a queue.
* The list at @list is reinitialised
*/
static UPNP_INLINE void list_splice_tail_init(struct list_head *list,
struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head->prev, head);
INIT_LIST_HEAD(list);
}
}
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
* list_first_entry - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*
* Note, that list is expected to be not empty.
*/
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
for (pos = (head)->next; prefetch(pos->next), pos != (head); \
pos = pos->next)
/**
* __list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*
* This variant differs from list_for_each() in that it's the
* simplest possible list iteration code, no prefetching is done.
* Use this for code that knows the list to be very short (empty
* or 1 entry) most of the time.
*/
#define __list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
pos = pos->prev)
/**
* list_for_each_safe - iterate over a list safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
/**
* list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
* @pos: the &struct list_head to use as a loop cursor.
* @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_prev_safe(pos, n, head) \
for (pos = (head)->prev, n = pos->prev; \
prefetch(pos->prev), pos != (head); \
pos = n, n = pos->prev)
/**
* list_for_each_entry - iterate over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_reverse - iterate backwards over list of given type.
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_reverse(pos, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member); \
prefetch(pos->member.prev), &pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
* @pos: the type * to use as a start point
* @head: the head of the list
* @member: the name of the list_struct within the struct.
*
* Prepares a pos entry for use as a start point in list_for_each_entry_continue().
*/
#define list_prepare_entry(pos, head, member) \
((pos) ? : list_entry(head, typeof(*pos), member))
/**
* list_for_each_entry_continue - continue iteration over list of given type
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Continue to iterate over list of given type, continuing after
* the current position.
*/
#define list_for_each_entry_continue(pos, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_continue_reverse - iterate backwards from the given point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Start to iterate over list of given type backwards, continuing after
* the current position.
*/
#define list_for_each_entry_continue_reverse(pos, head, member) \
for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
prefetch(pos->member.prev), &pos->member != (head); \
pos = list_entry(pos->member.prev, typeof(*pos), member))
/**
* list_for_each_entry_from - iterate over list of given type from the current point
* @pos: the type * to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing from current position.
*/
#define list_for_each_entry_from(pos, head, member) \
for (; prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*/
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_continue - continue list iteration safe against removal
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type, continuing after current point,
* safe against removal of list entry.
*/
#define list_for_each_entry_safe_continue(pos, n, head, member) \
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_from - iterate over list from current point safe against removal
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate over list of given type from current point, safe against
* removal of list entry.
*/
#define list_for_each_entry_safe_from(pos, n, head, member) \
for (n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
/**
* list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
* @pos: the type * to use as a loop cursor.
* @n: another type * to use as temporary storage
* @head: the head for your list.
* @member: the name of the list_struct within the struct.
*
* Iterate backwards over list of given type, safe against removal
* of list entry.
*/
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
for (pos = list_entry((head)->prev, typeof(*pos), member), \
n = list_entry(pos->member.prev, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
/*
* Double linked lists with a single pointer list head.
* Mostly useful for hash tables where the two pointer list head is
* too wasteful.
* You lose the ability to access the tail in O(1).
*/
struct hlist_head {
struct hlist_node *first;
};
struct hlist_node {
struct hlist_node *next, **pprev;
};
#define HLIST_HEAD_INIT { .first = NULL }
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
static UPNP_INLINE void INIT_HLIST_NODE(struct hlist_node *h)
{
h->next = NULL;
h->pprev = NULL;
}
static UPNP_INLINE int hlist_unhashed(const struct hlist_node *h)
{
return !h->pprev;
}
static UPNP_INLINE int hlist_empty(const struct hlist_head *h)
{
return !h->first;
}
static UPNP_INLINE void __hlist_del(struct hlist_node *n)
{
struct hlist_node *next = n->next;
struct hlist_node **pprev = n->pprev;
*pprev = next;
if (next)
next->pprev = pprev;
}
static UPNP_INLINE void hlist_del(struct hlist_node *n)
{
__hlist_del(n);
n->next = (struct hlist_node *)LIST_POISON1;
n->pprev = (struct hlist_node **)LIST_POISON2;
}
static UPNP_INLINE void hlist_del_init(struct hlist_node *n)
{
if (!hlist_unhashed(n)) {
__hlist_del(n);
INIT_HLIST_NODE(n);
}
}
static UPNP_INLINE void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
{
struct hlist_node *first = h->first;
n->next = first;
if (first)
first->pprev = &n->next;
h->first = n;
n->pprev = &h->first;
}
/* next must be != NULL */
static UPNP_INLINE void hlist_add_before(struct hlist_node *n,
struct hlist_node *next)
{
n->pprev = next->pprev;
n->next = next;
next->pprev = &n->next;
*(n->pprev) = n;
}
static UPNP_INLINE void hlist_add_after(struct hlist_node *n,
struct hlist_node *next)
{
next->next = n->next;
n->next = next;
next->pprev = &n->next;
if(next->next)
next->next->pprev = &next->next;
}
/*
* Move a list from one list head to another. Fixup the pprev
* reference of the first entry if it exists.
*/
static UPNP_INLINE void hlist_move_list(struct hlist_head *old,
struct hlist_head *new_)
{
new_->first = old->first;
if (new_->first)
new_->first->pprev = &new_->first;
old->first = NULL;
}
#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
#define hlist_for_each(pos, head) \
for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
pos = pos->next)
#define hlist_for_each_safe(pos, n, head) \
for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
pos = n)
/**
* hlist_for_each_entry - iterate over list of given type
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry(tpos, pos, head, member) \
for (pos = (head)->first; \
pos && ({ prefetch(pos->next); 1;}) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = pos->next)
/**
* hlist_for_each_entry_continue - iterate over a hlist continuing after current point
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_continue(tpos, pos, member) \
for (pos = (pos)->next; \
pos && ({ prefetch(pos->next); 1;}) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = pos->next)
/**
* hlist_for_each_entry_from - iterate over a hlist continuing from current point
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_from(tpos, pos, member) \
for (; pos && ({ prefetch(pos->next); 1;}) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = pos->next)
/**
* hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
* @tpos: the type * to use as a loop cursor.
* @pos: the &struct hlist_node to use as a loop cursor.
* @n: another &struct hlist_node to use as temporary storage
* @head: the head for your list.
* @member: the name of the hlist_node within the struct.
*/
#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
for (pos = (head)->first; \
pos && ({ n = pos->next; 1; }) && \
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
pos = n)
#endif

View File

@ -1,89 +0,0 @@
#ifndef _LINUX_POISON_H
#define _LINUX_POISON_H
/********** include/linux/list.h **********/
/*
* Architectures might want to move the poison pointer offset
* into some well-recognized area such as 0xdead000000000000,
* that is also not mappable by user-space exploits:
*/
#ifdef CONFIG_ILLEGAL_POINTER_VALUE
# define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL)
#else
# define POISON_POINTER_DELTA 0
#endif
/*
* These are non-NULL pointers that will result in page faults
* under normal circumstances, used to verify that nobody uses
* non-initialized list entries.
*/
#define LIST_POISON1 ((void *) (0x00100100 + POISON_POINTER_DELTA))
#define LIST_POISON2 ((void *) (0x00200200 + POISON_POINTER_DELTA))
/********** include/linux/timer.h **********/
/*
* Magic number "tsta" to indicate a static timer initializer
* for the object debugging code.
*/
#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
/********** mm/debug-pagealloc.c **********/
#define PAGE_POISON 0xaa
/********** mm/slab.c **********/
/*
* Magic nums for obj red zoning.
* Placed in the first word before and the first word after an obj.
*/
#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */
#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */
#define SLUB_RED_INACTIVE 0xbb
#define SLUB_RED_ACTIVE 0xcc
/* ...and for poisoning */
#define POISON_INUSE 0x5a /* for use-uninitialised poisoning */
#define POISON_FREE 0x6b /* for use-after-free poisoning */
#define POISON_END 0xa5 /* end-byte of poisoning */
/********** arch/$ARCH/mm/init.c **********/
#define POISON_FREE_INITMEM 0xcc
/********** arch/ia64/hp/common/sba_iommu.c **********/
/*
* arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
* value of "SBAIOMMU POISON\0" for spill-over poisoning.
*/
/********** fs/jbd/journal.c **********/
#define JBD_POISON_FREE 0x5b
#define JBD2_POISON_FREE 0x5c
/********** drivers/base/dmapool.c **********/
#define POOL_POISON_FREED 0xa7 /* !inuse */
#define POOL_POISON_ALLOCATED 0xa9 /* !initted */
/********** drivers/atm/ **********/
#define ATM_POISON_FREE 0x12
#define ATM_POISON 0xdeadbeef
/********** net/ **********/
#define NEIGHBOR_DEAD 0xdeadbeef
#define NETFILTER_LINK_POISON 0xdead57ac
/********** kernel/mutexes **********/
#define MUTEX_DEBUG_INIT 0x11
#define MUTEX_DEBUG_FREE 0x22
/********** lib/flex_array.c **********/
#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */
/********** security/ **********/
#define KEY_DESTROY 0xbd
/********** sound/oss/ **********/
#define OSS_POISON_FREE 0xAB
#endif

View File

@ -61,10 +61,6 @@
/* Other systems ??? */
#endif
#ifdef UPNP_ENABLE_OPEN_SSL
#include <openssl/ssl.h>
#endif
#define LINE_SIZE (size_t)180
#define NAME_SIZE (size_t)256
#define MNFT_NAME_SIZE 64
@ -384,6 +380,7 @@
/* @} ErrorCodes */
#if UPNP_VERSION >= 10800
/*
* Opaque data structures. The following includes are data structures that
* must be externally visible. Since version 1.8.0, only an opaque typedef
@ -403,6 +400,7 @@
#include "StateVarComplete.h"
#include "StateVarRequest.h"
#include "SubscriptionRequest.h"
#endif /* UPNP_VERSION >= 10800 */
/*!
* \name Constants and Types
@ -435,6 +433,117 @@ typedef int UpnpClient_Handle;
*/
typedef int UpnpDevice_Handle;
/*!
* \brief The reason code for an event callback.
*
* The \b Event parameter will be different depending on the reason for the
* callback. The descriptions for each event type describe the contents of the
* \b Event parameter.
*/
enum Upnp_EventType_e {
/*
* Control callbacks
*/
/*! Received by a device when a control point issues a control
* request. The \b Event parameter contains a pointer to a \b
* UpnpActionRequest structure containing the action. The application
* stores the results of the action in this structure. */
UPNP_CONTROL_ACTION_REQUEST,
/*! A \b UpnpSendActionAsync call completed. The \b Event
* parameter contains a pointer to a \b UpnpActionComplete structure
* with the results of the action. */
UPNP_CONTROL_ACTION_COMPLETE,
/*! Received by a device when a query for a single service variable
* arrives. The \b Event parameter contains a pointer to a \b
* UpnpStateVarRequest structure containing the name of the variable
* and value. */
UPNP_CONTROL_GET_VAR_REQUEST,
/*! A \b UpnpGetServiceVarStatus call completed. The \b Event
* parameter contains a pointer to a \b UpnpStateVarComplete structure
* containing the value for the variable. */
UPNP_CONTROL_GET_VAR_COMPLETE,
/*
* Discovery callbacks
*/
/*! Received by a control point when a new device or service is available.
* The \b Event parameter contains a pointer to a \b
* UpnpDiscovery structure with the information about the device
* or service. */
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE,
/*! Received by a control point when a device or service shuts down. The \b
* Event parameter contains a pointer to a \b UpnpDiscovery
* structure containing the information about the device or
* service. */
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE,
/*! Received by a control point when a matching device or service responds.
* The \b Event parameter contains a pointer to a \b
* UpnpDiscovery structure containing the information about
* the reply to the search request. */
UPNP_DISCOVERY_SEARCH_RESULT,
/*! Received by a control point when the search timeout expires. The
* SDK generates no more callbacks for this search after this
* event. The \b Event parameter is \c NULL. */
UPNP_DISCOVERY_SEARCH_TIMEOUT,
/*
* Eventing callbacks
*/
/*! Received by a device when a subscription arrives.
* The \b Event parameter contains a pointer to a \b
* UpnpSubscriptionRequest structure. At this point, the
* subscription has already been accepted. \b UpnpAcceptSubscription
* needs to be called to confirm the subscription and transmit the
* initial state table. This can be done during this callback. The SDK
* generates no events for a subscription unless the device
* application calls \b UpnpAcceptSubscription.
*/
UPNP_EVENT_SUBSCRIPTION_REQUEST,
/*! Received by a control point when an event arrives. The \b
* Event parameter contains a \b UpnpEvent structure
* with the information about the event. */
UPNP_EVENT_RECEIVED,
/*! A \b UpnpRenewSubscriptionAsync call completed. The status of
* the renewal is in the \b Event parameter as a \b
* Upnp_Event_Subscription structure. */
UPNP_EVENT_RENEWAL_COMPLETE,
/*! A \b UpnpSubscribeAsync call completed. The status of the
* subscription is in the \b Event parameter as a \b
* Upnp_Event_Subscription structure. */
UPNP_EVENT_SUBSCRIBE_COMPLETE,
/*! A \b UpnpUnSubscribeAsync call completed. The status of the
* subscription is in the \b Event parameter as a \b
* UpnpEventSubscribe structure. */
UPNP_EVENT_UNSUBSCRIBE_COMPLETE,
/*! The auto-renewal of a client subscription failed.
* The \b Event parameter is a \b UpnpEventSubscribe structure
* with the error code set appropriately. The subscription is no longer
* valid. */
UPNP_EVENT_AUTORENEWAL_FAILED,
/*! A client subscription has expired. This will only occur
* if auto-renewal of subscriptions is disabled.
* The \b Event parameter is a \b UpnpEventSubscribe
* structure. The subscription is no longer valid. */
UPNP_EVENT_SUBSCRIPTION_EXPIRED
};
typedef enum Upnp_EventType_e Upnp_EventType;
/*!
* \brief Holds the subscription identifier for a subscription between a
* client and a device.
@ -490,7 +599,264 @@ enum Upnp_DescType_e {
typedef enum Upnp_DescType_e Upnp_DescType;
#include "Callback.h"
#if UPNP_VERSION < 10800
/** Returned as part of a {\bf UPNP_CONTROL_ACTION_COMPLETE} callback. */
struct Upnp_Action_Request
{
/** The result of the operation. */
int ErrCode;
/** The socket number of the connection to the requestor. */
int Socket;
/** The error string in case of error. */
char ErrStr[LINE_SIZE];
/** The Action Name. */
char ActionName[NAME_SIZE];
/** The unique device ID. */
char DevUDN[NAME_SIZE];
/** The service ID. */
char ServiceID[NAME_SIZE];
/** The DOM document describing the action. */
IXML_Document *ActionRequest;
/** The DOM document describing the result of the action. */
IXML_Document *ActionResult;
/** IP address of the control point requesting this action. */
struct sockaddr_storage CtrlPtIPAddr;
/** The DOM document containing the information from the
the SOAP header. */
IXML_Document *SoapHeader;
};
struct Upnp_Action_Complete
{
/** The result of the operation. */
int ErrCode;
/** The control URL for service. */
char CtrlUrl[NAME_SIZE];
/** The DOM document describing the action. */
IXML_Document *ActionRequest;
/** The DOM document describing the result of the action. */
IXML_Document *ActionResult;
};
/** Represents the request for current value of a state variable in a service
* state table. */
struct Upnp_State_Var_Request
{
/** The result of the operation. */
int ErrCode;
/** The socket number of the connection to the requestor. */
int Socket;
/** The error string in case of error. */
char ErrStr[LINE_SIZE];
/** The unique device ID. */
char DevUDN[NAME_SIZE];
/** The service ID. */
char ServiceID[NAME_SIZE];
/** The name of the variable. */
char StateVarName[NAME_SIZE];
/** IP address of sender requesting the state variable. */
struct sockaddr_storage CtrlPtIPAddr;
/** The current value of the variable. This needs to be allocated by
* the caller. When finished with it, the SDK frees this {\bf DOMString}. */
DOMString CurrentVal;
};
/** Represents the reply for the current value of a state variable in an
asynchronous call. */
struct Upnp_State_Var_Complete
{
/** The result of the operation. */
int ErrCode;
/** The control URL for the service. */
char CtrlUrl[NAME_SIZE];
/** The name of the variable. */
char StateVarName[NAME_SIZE];
/** The current value of the variable or error string in case of error. */
DOMString CurrentVal;
};
/** Returned along with a {\bf UPNP_EVENT_RECEIVED} callback. */
struct Upnp_Event
{
/** The subscription ID for this subscription. */
Upnp_SID Sid;
/** The event sequence number. */
int EventKey;
/** The DOM tree representing the changes generating the event. */
IXML_Document *ChangedVariables;
};
/*
* This typedef is required by Doc++ to parse the last entry of the
* Upnp_Discovery structure correctly.
*/
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
struct Upnp_Discovery
{
/** The result code of the {\bf UpnpSearchAsync} call. */
int ErrCode;
/** The expiration time of the advertisement. */
int Expires;
/** The unique device identifier. */
char DeviceId[LINE_SIZE];
/** The device type. */
char DeviceType[LINE_SIZE];
/** The service type. */
char ServiceType[LINE_SIZE];
/** The service version. */
char ServiceVer[LINE_SIZE];
/** The URL to the UPnP description document for the device. */
char Location[LINE_SIZE];
/** The operating system the device is running. */
char Os[LINE_SIZE];
/** Date when the response was generated. */
char Date[LINE_SIZE];
/** Confirmation that the MAN header was understood by the device. */
char Ext[LINE_SIZE];
/** The host address of the device responding to the search. */
struct sockaddr_storage DestAddr;
};
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf
* UPNP_EVENT_UNSUBSCRIBE_COMPLETE} callback. */
struct Upnp_Event_Subscribe {
/** The SID for this subscription. For subscriptions, this only
* contains a valid SID if the {\bf Upnp_EventSubscribe.result} field
* contains a {\tt UPNP_E_SUCCESS} result code. For unsubscriptions,
* this contains the SID from which the subscription is being
* unsubscribed. */
Upnp_SID Sid;
/** The result of the operation. */
int ErrCode;
/** The event URL being subscribed to or removed from. */
char PublisherUrl[NAME_SIZE];
/** The actual subscription time (for subscriptions only). */
int TimeOut;
};
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIPTION_REQUEST}
* callback. */
struct Upnp_Subscription_Request
{
/** The identifier for the service being subscribed to. */
char *ServiceId;
/** Universal device name. */
char *UDN;
/** The assigned subscription ID for this subscription. */
Upnp_SID Sid;
};
struct File_Info
{
/** The length of the file. A length less than 0 indicates the size
* is unknown, and data will be sent until 0 bytes are returned from
* a read call. */
off_t file_length;
/** The time at which the contents of the file was modified;
* The time system is always local (not GMT). */
time_t last_modified;
/** If the file is a directory, {\bf is_directory} contains
* a non-zero value. For a regular file, it should be 0. */
int is_directory;
/** If the file or directory is readable, this contains
* a non-zero value. If unreadable, it should be set to 0. */
int is_readable;
/** The content type of the file. This string needs to be allocated
* by the caller using {\bf ixmlCloneDOMString}. When finished
* with it, the SDK frees the {\bf DOMString}. */
DOMString content_type;
};
#endif /* UPNP_VERSION < 10800 */
/*!
* All callback functions share the same prototype, documented below.
* Note that any memory passed to the callback function
* is valid only during the callback and should be copied if it
* needs to persist. This callback function needs to be thread
* safe. The context of the callback is always on a valid thread
* context and standard synchronization methods can be used. Note,
* however, because of this the callback cannot call SDK functions
* unless explicitly noted.
*
* \verbatim
int CallbackFxn(Upnp_EventType EventType, void *Event, void *Cookie);
\endverbatim
*
* where \b EventType is the event that triggered the callback,
* \b Event is a structure that denotes event-specific information for that
* event, and \b Cookie is the user data passed when the callback was
* registered.
*
* See \b Upnp_EventType for more information on the callback values and
* the associated \b Event parameter.
*
* The return value of the callback is currently ignored. It may be used
* in the future to communicate results back to the SDK.
*/
typedef int (*Upnp_FunPtr)(
/*! [in] .*/
Upnp_EventType EventType,
/*! [in] .*/
void *Event,
/*! [in] .*/
void *Cookie);
/* @} Constants and Types */
@ -588,29 +954,6 @@ EXPORT_SPEC int UpnpInit2(
unsigned short DestPort);
#endif
/*!
* \brief Initializes the OpenSSL library, and the OpenSSL context for use
* with pupnp
*
* \note This method is only enabled if pupnp is compiled with open-ssl support.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INIT: The SDK is already initialized.
* \li \c UPNP_E_INIT_FAILED: The SDK initialization
* failed for an unknown reason.
*/
#ifdef UPNP_ENABLE_OPEN_SSL
EXPORT_SPEC int UpnpInitSslContext(
/*! If set to 1 initializes the OpenSSL library. Otherwise the application
* is responsible for initializing it. If set to 1, then OpenSSL is intialized
* with all error strings, and all ciphers loaded. */
int initOpenSslLib,
/*! The SSL_METHOD to use to create the context. See OpenSSL docs
* for more info */
const SSL_METHOD *sslMethod);
#endif
/*!
* \brief Terminates the Linux SDK for UPnP Devices.
*
@ -1492,7 +1835,7 @@ EXPORT_SPEC int UpnpAcceptSubscriptionExt(
* Plug and Play Device Architecture specification. */
IXML_Document *PropSet,
/*! [in] The subscription ID of the newly registered control point. */
const Upnp_SID SubsId);
Upnp_SID SubsId);
/*!
* \brief Sends out an event change notification to all control points
@ -1912,19 +2255,6 @@ EXPORT_SPEC int UpnpUnSubscribeAsync(
* @{
*/
/*!
* \brief Different HTTP methods.
*/
enum Upnp_HttpMethod_e {
UPNP_HTTPMETHOD_PUT = 0,
UPNP_HTTPMETHOD_DELETE = 1,
UPNP_HTTPMETHOD_GET = 2,
UPNP_HTTPMETHOD_HEAD = 3,
UPNP_HTTPMETHOD_POST = 4
};
typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
/*!
* \brief Downloads a file specified in a URL.
*
@ -1966,12 +2296,10 @@ EXPORT_SPEC int UpnpDownloadUrlItem(
* The SDK allocates the memory for \b handle and \b contentType, the
* application is responsible for freeing this memory.
*
* \note Memory for \b contentType is freed when freeing the memory
* for handle.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle,
* \b contentType, \b contentLength or \b httpStatus
* is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
@ -2003,7 +2331,7 @@ EXPORT_SPEC int UpnpOpenHttpGet(
int *httpStatus,
/*! [in] The time out value sent with the request during which a response
* is expected from the server, failing which, an error is reported
* back to the user. If value is negative, timeout is infinite. */
* back to the user. */
int timeout);
/*!
@ -2012,12 +2340,10 @@ EXPORT_SPEC int UpnpOpenHttpGet(
* The SDK allocates the memory for \b handle and \b contentType, the
* application is responsible for freeing this memory.
*
* \note Memory for \b contentType is freed when freeing the memory
* for handle.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle,
* \b contentType, \b contentLength or \b httpStatus
* is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
@ -2051,7 +2377,7 @@ EXPORT_SPEC int UpnpOpenHttpGetProxy(
int *httpStatus,
/*! [in] The time out value sent with the request during which a response
* is expected from the server, failing which, an error is reported
* back to the user. If value is negative, timeout is infinite. */
* back to the user. */
int timeout);
/*!
@ -2101,7 +2427,7 @@ EXPORT_SPEC int UpnpOpenHttpGetEx(
int highRange,
/*! [in] A time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported back
* to the user. If value is negative, timeout is infinite. */
* to the user. */
int timeout);
/*!
@ -2130,7 +2456,7 @@ EXPORT_SPEC int UpnpReadHttpGet(
size_t *size,
/*! [in] The time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported back to
* the user. If value is negative, timeout is infinite. */
* the user. */
int timeout);
/*!
@ -2179,7 +2505,7 @@ EXPORT_SPEC int UpnpCloseHttpGet(
* and sends the POST request to the server if the connection to the server
* succeeds.
*
* The SDK allocates the memory for \b handle, the
* The SDK allocates the memory for \b handle and \b contentType, the
* application is responsible for freeing this memory.
*
* \return An integer representing one of the following:
@ -2205,13 +2531,12 @@ EXPORT_SPEC int UpnpOpenHttpPost(
/*! [in,out] A pointer in which to store the handle for this connection. This
* handle is required for futher operations over this connection. */
void **handle,
/*! [in] A buffer to store the media type of content being sent. Can be NULL. */
/*! [in] A buffer to store the media type of content being sent. */
const char *contentType,
/*! [in] The length of the content, in bytes, being posted. */
int contentLength,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
* is expected from the receiver, failing which, an error is reported. */
int timeout);
/*!
@ -2236,8 +2561,7 @@ EXPORT_SPEC int UpnpWriteHttpPost(
/*! [in] The size, in bytes of \b buf. */
size_t *size,
/*! [in] A timeout value sent with the request during which a response is
* expected from the server, failing which, an error is reported. If
* value is negative, timeout is infinite. */
* expected from the server, failing which, an error is reported. */
int timeout);
/*!
@ -2260,238 +2584,9 @@ EXPORT_SPEC int UpnpCloseHttpPost(
/*! [in,out] A pointer to a buffer to store the final status of the connection. */
int *httpStatus,
/*! [in] A time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported. If
* value is negative, timeout is infinite. */
* expected from the server, failing which, an error is reported. */
int timeout);
/*!
* \brief Opens a connection to the server.
*
* The SDK allocates the memory for \b handle, the
* application is responsible for freeing this memory.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b url, or \b handle
* is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
* resources or an error occurred binding a socket.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int UpnpOpenHttpConnection(
/*! [in] The URL which contains the host, and the scheme to make the connection. */
const char *url,
/*! [in,out] A pointer in which to store the handle for this connection. This
* handle is required for futher operations over this connection. */
void **handle,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Makes a HTTP request using a connection previously created by
* \b UpnpOpenHttpConnection.
*
* \note Trying to make another request while a request is already being processed
* results in undefined behavior. It's up to the user to end a previous
* request by calling \b UpnpEndHttpRequest.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle
* or \b contentType is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
* resources or an error occurred binding a socket.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int UpnpMakeHttpRequest(
/* ![in] The method to use to make the request. */
Upnp_HttpMethod method,
/*! [in] The URL to use to make the request. The URL should use the same
* scheme used to create the connection, but the host can be different
* if the request is being proxied. */
const char *url,
/*! [in] The handle to the connection. */
void *handle,
/*! [in] Headers to be used for the request. Each header should be terminated by a CRLF as specified
* in the HTTP specification. If NULL then the default headers will be used. */
UpnpString *headers,
/*! [in] The media type of content being sent. Can be NULL. */
const char *contentType,
/*! [in] The length of the content being sent, in bytes. Set to \b UPNP_USING_CHUNKED to use
* chunked encoding, or \b UPNP_UNTIL_CLOSE to avoid specifying the content length to the server.
* In this case the request is considered unfinished until the connection is closed. */
int contentLength,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Writes the content of a HTTP request initiated by a \b UpnpMakeHttpRequest call.
* The end of the content should be indicated by a call to \b UpnpEndHttpRequest
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
* or \b size is not a valid pointer.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int UpnpWriteHttpRequest(
/*! [in] The handle of the connection created by the call to
* \b UpnpOpenHttpConnection. */
void *handle,
/*! [in] The buffer containing date to be written. */
char *buf,
/*! [in] The size, in bytes of \b buf. */
size_t *size,
/*! [in] A timeout value sent with the request during which a response is
* expected from the server, failing which, an error is reported. If
* value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Indicates the end of a HTTP request previously made by
* \b UpnpMakeHttpRequest.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
* resources or an error occurred binding a socket.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int UpnpEndHttpRequest(
/*! [in] The handle to the connection. */
void *handle,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Gets the response from the server using a connection previously created
* by \b UpnpOpenHttpConnection
*
* \note Memory for \b contentType is only valid until the next call to the HTTP API
* for the same connection.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b handle,
* is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_NETWORK_ERROR: A network error occurred.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
* from a socket.
* \li \c UPNP_E_SOCKET_BIND: An error occurred binding a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
* remote server.
*/
EXPORT_SPEC int UpnpGetHttpResponse(
/*! [in] The handle of the connection created by the call to
* \b UpnpOpenHttpConnection. */
void *handle,
/*! [in] Headers sent by the server for the response. If NULL then the
* headers are not copied. */
UpnpString *headers,
/*! [out] A buffer to store the media type of the item. */
char **contentType,
/*! [out] A pointer to store the length of the item. */
int *contentLength,
/*! [out] The status returned on receiving a response message. */
int *httpStatus,
/*! [in] The time out value sent with the request during which a response
* is expected from the server, failing which, an error is reported
* back to the user. If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Reads the content of a response using a connection previously created
* by \b UpnpOpenHttpConnection.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
* or \b size is not a valid pointer.
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
* remote server.
* \li \c UPNP_E_BAD_HTTPMSG: Either the request or response was in
* the incorrect format.
* \li \c UPNP_E_CANCELED: another thread called UpnpCancelHttpGet.
*
* Note: In case of return values, the status code parameter of the passed
* in handle value may provide additional information on the return
* value.
*/
EXPORT_SPEC int UpnpReadHttpResponse(
/*! [in] The handle of the connection created by the call to
* \b UpnpOpenHttpConnection. */
void *handle,
/*! [in,out] The buffer to store the read item. */
char *buf,
/*! [in,out] The size of the buffer to be read. */
size_t *size,
/*! [in] The time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported back to
* the user. If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Closes the connection created with \b UpnpOpenHttpConnection
* and frees any memory associated with the connection.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: \b handle, or is not a valid pointer.
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
* from a socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int UpnpCloseHttpConnection(
/*! [in] The handle of the connection to close, created by the call to
* \b UpnpOpenHttpPost. */
void *handle);
/*!
* \brief Downloads an XML document specified in a URL.
*
@ -2573,7 +2668,12 @@ typedef int (*VDCallback_GetInfo)(
/*! [in] The name of the file to query. */
const char *filename,
/*! [out] Pointer to a structure to store the information on the file. */
UpnpFileInfo *info);
#if UPNP_VERSION < 10800
struct File_Info *info
#else
UpnpFileInfo *info
#endif /* UPNP_VERSION < 10800 */
);
/*!
* \brief Sets the get_info callback function to be used to access a virtual
@ -2690,6 +2790,21 @@ typedef int (*VDCallback_Close)(
*/
EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback);
/*!
* \brief The {\bf UpnpVirtualDirCallbacks} structure contains the pointers to
* file-related callback functions a device application can register to
* virtualize URLs.
*/
struct UpnpVirtualDirCallbacks
{
VDCallback_GetInfo get_info;
VDCallback_Open open;
VDCallback_Read read;
VDCallback_Write write;
VDCallback_Seek seek;
VDCallback_Close close;
};
/*!
* \brief Enables or disables the webserver.
*
@ -2710,6 +2825,17 @@ EXPORT_SPEC int UpnpEnableWebserver(
*/
EXPORT_SPEC int UpnpIsWebserverEnabled(void);
/*!
* \brief Sets the callback functions to be used to access a virtual directory.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: one of the callbacks is not valid.
*/
EXPORT_SPEC int UpnpSetVirtualDirCallbacks(
/*! [in] A structure that contains the callback functions. */
struct UpnpVirtualDirCallbacks *callbacks );
/*!
* \brief Adds a virtual directory mapping.
*

View File

@ -131,9 +131,5 @@
* header (i.e. configure --enable-unspecified_server) */
#undef UPNP_ENABLE_UNSPECIFIED_SERVER
/** Defined to 1 if the library has been compiled with OpenSSL support
* (i.e. configure --enable-open_ssl) */
#undef UPNP_ENABLE_OPEN_SSL
#endif /* UPNP_CONFIG_H */

View File

@ -314,7 +314,7 @@ void SampleUtil_PrintEventType(Upnp_EventType S)
}
}
int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
int SampleUtil_PrintEvent(Upnp_EventType EventType, void *Event)
{
ithread_mutex_lock(&display_mutex);
@ -327,28 +327,18 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
case UPNP_DISCOVERY_SEARCH_RESULT: {
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
SampleUtil_Print(
"ErrCode = %d\n"
"Expires = %d\n"
"DeviceId = %s\n"
"DeviceType = %s\n"
"ServiceType = %s\n"
"ServiceVer = %s\n"
"Location = %s\n"
"OS = %s\n"
"Date = %s\n"
"Ext = %s\n",
UpnpDiscovery_get_ErrCode(d_event),
UpnpDiscovery_get_Expires(d_event),
UpnpString_get_String(UpnpDiscovery_get_DeviceID(d_event)),
UpnpString_get_String(UpnpDiscovery_get_DeviceType(d_event)),
UpnpString_get_String(UpnpDiscovery_get_ServiceType(d_event)),
UpnpString_get_String(UpnpDiscovery_get_ServiceVer(d_event)),
UpnpString_get_String(UpnpDiscovery_get_Location(d_event)),
UpnpString_get_String(UpnpDiscovery_get_Os(d_event)),
UpnpString_get_String(UpnpDiscovery_get_Date(d_event)),
UpnpString_get_String(UpnpDiscovery_get_Ext(d_event)));
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(d_event->ErrCode), d_event->ErrCode);
SampleUtil_Print("Expires = %d\n", d_event->Expires);
SampleUtil_Print("DeviceId = %s\n", d_event->DeviceId);
SampleUtil_Print("DeviceType = %s\n", d_event->DeviceType);
SampleUtil_Print("ServiceType = %s\n", d_event->ServiceType);
SampleUtil_Print("ServiceVer = %s\n", d_event->ServiceVer);
SampleUtil_Print("Location = %s\n", d_event->Location);
SampleUtil_Print("OS = %s\n", d_event->Os);
SampleUtil_Print("Ext = %s\n", d_event->Ext);
break;
}
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
@ -356,25 +346,18 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
break;
/* SOAP */
case UPNP_CONTROL_ACTION_REQUEST: {
UpnpActionRequest *a_event = (UpnpActionRequest *)Event;
IXML_Document *actionRequestDoc = NULL;
IXML_Document *actionResultDoc = NULL;
struct Upnp_Action_Request *a_event =
(struct Upnp_Action_Request *)Event;
char *xmlbuff = NULL;
SampleUtil_Print(
"ErrCode = %d\n"
"ErrStr = %s\n"
"ActionName = %s\n"
"UDN = %s\n"
"ServiceID = %s\n",
UpnpActionRequest_get_ErrCode(a_event),
UpnpString_get_String(UpnpActionRequest_get_ErrStr(a_event)),
UpnpString_get_String(UpnpActionRequest_get_ActionName(a_event)),
UpnpString_get_String(UpnpActionRequest_get_DevUDN(a_event)),
UpnpString_get_String(UpnpActionRequest_get_ServiceID(a_event)));
actionRequestDoc = UpnpActionRequest_get_ActionRequest(a_event);
if (actionRequestDoc) {
xmlbuff = ixmlPrintNode((IXML_Node *)actionRequestDoc);
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(a_event->ErrCode), a_event->ErrCode);
SampleUtil_Print("ErrStr = %s\n", a_event->ErrStr);
SampleUtil_Print("ActionName = %s\n", a_event->ActionName);
SampleUtil_Print("UDN = %s\n", a_event->DevUDN);
SampleUtil_Print("ServiceID = %s\n", a_event->ServiceID);
if (a_event->ActionRequest) {
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
if (xmlbuff) {
SampleUtil_Print("ActRequest = %s\n", xmlbuff);
ixmlFreeDOMString(xmlbuff);
@ -383,9 +366,8 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
} else {
SampleUtil_Print("ActRequest = (null)\n");
}
actionResultDoc = UpnpActionRequest_get_ActionResult(a_event);
if (actionResultDoc) {
xmlbuff = ixmlPrintNode((IXML_Node *)actionResultDoc);
if (a_event->ActionResult) {
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
if (xmlbuff) {
SampleUtil_Print("ActResult = %s\n", xmlbuff);
ixmlFreeDOMString(xmlbuff);
@ -397,22 +379,15 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
break;
}
case UPNP_CONTROL_ACTION_COMPLETE: {
UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
struct Upnp_Action_Complete *a_event =
(struct Upnp_Action_Complete *)Event;
char *xmlbuff = NULL;
int errCode = UpnpActionComplete_get_ErrCode(a_event);
const char *ctrlURL = UpnpString_get_String(
UpnpActionComplete_get_CtrlUrl(a_event));
IXML_Document *actionRequest =
UpnpActionComplete_get_ActionRequest(a_event);
IXML_Document *actionResult =
UpnpActionComplete_get_ActionResult(a_event);
SampleUtil_Print(
"ErrCode = %d\n"
"CtrlUrl = %s\n",
errCode, ctrlURL);
if (actionRequest) {
xmlbuff = ixmlPrintNode((IXML_Node *)actionRequest);
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(a_event->ErrCode), a_event->ErrCode);
SampleUtil_Print("CtrlUrl = %s\n", a_event->CtrlUrl);
if (a_event->ActionRequest) {
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
if (xmlbuff) {
SampleUtil_Print("ActRequest = %s\n", xmlbuff);
ixmlFreeDOMString(xmlbuff);
@ -421,8 +396,8 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
} else {
SampleUtil_Print("ActRequest = (null)\n");
}
if (actionResult) {
xmlbuff = ixmlPrintNode((IXML_Node *)actionResult);
if (a_event->ActionResult) {
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
if (xmlbuff) {
SampleUtil_Print("ActResult = %s\n", xmlbuff);
ixmlFreeDOMString(xmlbuff);
@ -434,106 +409,83 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
break;
}
case UPNP_CONTROL_GET_VAR_REQUEST: {
UpnpStateVarRequest *sv_event = (UpnpStateVarRequest *)Event;
struct Upnp_State_Var_Request *sv_event =
(struct Upnp_State_Var_Request *)Event;
SampleUtil_Print(
"ErrCode = %d\n"
"ErrStr = %s\n"
"UDN = %s\n"
"ServiceID = %s\n"
"StateVarName= %s\n"
"CurrentVal = %s\n",
UpnpStateVarRequest_get_ErrCode(sv_event),
UpnpString_get_String(UpnpStateVarRequest_get_ErrStr(sv_event)),
UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(sv_event)),
UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(sv_event)),
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(sv_event)),
UpnpStateVarRequest_get_CurrentVal(sv_event));
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(sv_event->ErrCode), sv_event->ErrCode);
SampleUtil_Print("ErrStr = %s\n", sv_event->ErrStr);
SampleUtil_Print("UDN = %s\n", sv_event->DevUDN);
SampleUtil_Print("ServiceID = %s\n", sv_event->ServiceID);
SampleUtil_Print("StateVarName= %s\n", sv_event->StateVarName);
SampleUtil_Print("CurrentVal = %s\n", sv_event->CurrentVal);
break;
}
case UPNP_CONTROL_GET_VAR_COMPLETE: {
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
struct Upnp_State_Var_Complete *sv_event =
(struct Upnp_State_Var_Complete *)Event;
SampleUtil_Print(
"ErrCode = %d\n"
"CtrlUrl = %s\n"
"StateVarName= %s\n"
"CurrentVal = %s\n",
UpnpStateVarComplete_get_ErrCode(sv_event),
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
UpnpStateVarComplete_get_CurrentVal(sv_event));
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(sv_event->ErrCode), sv_event->ErrCode);
SampleUtil_Print("CtrlUrl = %s\n", sv_event->CtrlUrl);
SampleUtil_Print("StateVarName= %s\n", sv_event->StateVarName);
SampleUtil_Print("CurrentVal = %s\n", sv_event->CurrentVal);
break;
}
/* GENA */
case UPNP_EVENT_SUBSCRIPTION_REQUEST: {
UpnpSubscriptionRequest *sr_event = (UpnpSubscriptionRequest *)Event;
struct Upnp_Subscription_Request *sr_event =
(struct Upnp_Subscription_Request *)Event;
SampleUtil_Print(
"ServiceID = %s\n"
"UDN = %s\n"
"SID = %s\n",
UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(sr_event)),
UpnpString_get_String(UpnpSubscriptionRequest_get_UDN(sr_event)),
UpnpString_get_String(UpnpSubscriptionRequest_get_SID(sr_event)));
SampleUtil_Print("ServiceID = %s\n", sr_event->ServiceId);
SampleUtil_Print("UDN = %s\n", sr_event->UDN);
SampleUtil_Print("SID = %s\n", sr_event->Sid);
break;
}
case UPNP_EVENT_RECEIVED: {
UpnpEvent *e_event = (UpnpEvent *)Event;
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
char *xmlbuff = NULL;
xmlbuff = ixmlPrintNode(
(IXML_Node *)UpnpEvent_get_ChangedVariables(e_event));
SampleUtil_Print(
"SID = %s\n"
"EventKey = %d\n"
"ChangedVars = %s\n",
UpnpString_get_String(UpnpEvent_get_SID(e_event)),
UpnpEvent_get_EventKey(e_event),
xmlbuff);
SampleUtil_Print("SID = %s\n", e_event->Sid);
SampleUtil_Print("EventKey = %d\n", e_event->EventKey);
xmlbuff = ixmlPrintNode((IXML_Node *)e_event->ChangedVariables);
SampleUtil_Print("ChangedVars = %s\n", xmlbuff);
ixmlFreeDOMString(xmlbuff);
xmlbuff = NULL;
break;
}
case UPNP_EVENT_RENEWAL_COMPLETE: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
struct Upnp_Event_Subscribe *es_event =
(struct Upnp_Event_Subscribe *)Event;
SampleUtil_Print(
"SID = %s\n"
"ErrCode = %d\n"
"TimeOut = %d\n",
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
UpnpEventSubscribe_get_ErrCode(es_event),
UpnpEventSubscribe_get_TimeOut(es_event));
SampleUtil_Print("SID = %s\n", es_event->Sid);
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
SampleUtil_Print("TimeOut = %d\n", es_event->TimeOut);
break;
}
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
struct Upnp_Event_Subscribe *es_event =
(struct Upnp_Event_Subscribe *)Event;
SampleUtil_Print(
"SID = %s\n"
"ErrCode = %d\n"
"PublisherURL= %s\n"
"TimeOut = %d\n",
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
UpnpEventSubscribe_get_ErrCode(es_event),
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
UpnpEventSubscribe_get_TimeOut(es_event));
SampleUtil_Print("SID = %s\n", es_event->Sid);
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
SampleUtil_Print("PublisherURL= %s\n", es_event->PublisherUrl);
SampleUtil_Print("TimeOut = %d\n", es_event->TimeOut);
break;
}
case UPNP_EVENT_AUTORENEWAL_FAILED:
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
struct Upnp_Event_Subscribe *es_event =
(struct Upnp_Event_Subscribe *)Event;
SampleUtil_Print(
"SID = %s\n"
"ErrCode = %d\n"
"PublisherURL= %s\n"
"TimeOut = %d\n",
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
UpnpEventSubscribe_get_ErrCode(es_event),
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
UpnpEventSubscribe_get_TimeOut(es_event));
SampleUtil_Print("SID = %s\n", es_event->Sid);
SampleUtil_Print("ErrCode = %s(%d)\n",
UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
SampleUtil_Print("PublisherURL= %s\n", es_event->PublisherUrl);
SampleUtil_Print("TimeOut = %d\n", es_event->TimeOut);
break;
}
}

View File

@ -132,7 +132,7 @@ int SampleUtil_PrintEvent(
/*! [in] The type of callback event. */
Upnp_EventType EventType,
/*! [in] The callback event structure. */
const void *Event);
void *Event);
/*!
* \brief This routine finds the first occurance of a service in a DOM

View File

@ -1002,34 +1002,30 @@ void TvCtrlPointHandleGetVar(
* Cookie -- Optional data specified during callback registration
*
********************************************************************************/
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, const void *Event, void *Cookie)
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
{
int errCode = 0;
/*int errCode = 0;*/
SampleUtil_PrintEvent(EventType, Event);
switch ( EventType ) {
/* SSDP Stuff */
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
case UPNP_DISCOVERY_SEARCH_RESULT: {
const UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
IXML_Document *DescDoc = NULL;
const char *location = NULL;
int errCode = UpnpDiscovery_get_ErrCode(d_event);
int ret;
if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print(
"Error in Discovery Callback -- %d\n", errCode);
if (d_event->ErrCode != UPNP_E_SUCCESS) {
SampleUtil_Print("Error in Discovery Callback -- %d\n",
d_event->ErrCode);
}
location = UpnpString_get_String(UpnpDiscovery_get_Location(d_event));
errCode = UpnpDownloadXmlDoc(location, &DescDoc);
if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print(
"Error obtaining device description from %s -- error = %d\n",
location, errCode);
ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc);
if (ret != UPNP_E_SUCCESS) {
SampleUtil_Print("Error obtaining device description from %s -- error = %d\n",
d_event->Location, ret);
} else {
TvCtrlPointAddDevice(
DescDoc, location, UpnpDiscovery_get_Expires(d_event));
DescDoc, d_event->Location, d_event->Expires);
}
if (DescDoc) {
ixmlDocument_free(DescDoc);
@ -1041,92 +1037,90 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, const void *Event,
/* Nothing to do here... */
break;
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
int errCode = UpnpDiscovery_get_ErrCode(d_event);
const char *deviceId = UpnpString_get_String(
UpnpDiscovery_get_DeviceID(d_event));
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print(
"Error in Discovery ByeBye Callback -- %d\n", errCode);
if (d_event->ErrCode != UPNP_E_SUCCESS) {
SampleUtil_Print("Error in Discovery ByeBye Callback -- %d\n",
d_event->ErrCode);
}
SampleUtil_Print("Received ByeBye for Device: %s\n", deviceId);
TvCtrlPointRemoveDevice(deviceId);
SampleUtil_Print("Received ByeBye for Device: %s\n", d_event->DeviceId);
TvCtrlPointRemoveDevice(d_event->DeviceId);
SampleUtil_Print("After byebye:\n");
TvCtrlPointPrintList();
break;
}
/* SOAP Stuff */
case UPNP_CONTROL_ACTION_COMPLETE: {
UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
int errCode = UpnpActionComplete_get_ErrCode(a_event);
if (errCode != UPNP_E_SUCCESS) {
struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)Event;
if (a_event->ErrCode != UPNP_E_SUCCESS) {
SampleUtil_Print("Error in Action Complete Callback -- %d\n",
errCode);
a_event->ErrCode);
}
/* No need for any processing here, just print out results.
* Service state table updates are handled by events. */
break;
}
case UPNP_CONTROL_GET_VAR_COMPLETE: {
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print(
"Error in Get Var Complete Callback -- %d\n", errCode);
struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
if (sv_event->ErrCode != UPNP_E_SUCCESS) {
SampleUtil_Print("Error in Get Var Complete Callback -- %d\n",
sv_event->ErrCode);
} else {
TvCtrlPointHandleGetVar(
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
UpnpStateVarComplete_get_CurrentVal(sv_event));
sv_event->CtrlUrl,
sv_event->StateVarName,
sv_event->CurrentVal);
}
break;
}
/* GENA Stuff */
case UPNP_EVENT_RECEIVED: {
UpnpEvent *e_event = (UpnpEvent *)Event;
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
TvCtrlPointHandleEvent(
UpnpEvent_get_SID_cstr(e_event),
UpnpEvent_get_EventKey(e_event),
UpnpEvent_get_ChangedVariables(e_event));
e_event->Sid,
e_event->EventKey,
e_event->ChangedVariables);
break;
}
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
case UPNP_EVENT_RENEWAL_COMPLETE: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
errCode = UpnpEventSubscribe_get_ErrCode(es_event);
if (errCode != UPNP_E_SUCCESS) {
SampleUtil_Print(
"Error in Event Subscribe Callback -- %d\n", errCode);
if (es_event->ErrCode != UPNP_E_SUCCESS) {
SampleUtil_Print("Error in Event Subscribe Callback -- %d\n",
es_event->ErrCode);
} else {
TvCtrlPointHandleSubscribeUpdate(
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
UpnpEventSubscribe_get_TimeOut(es_event));
es_event->PublisherUrl,
es_event->Sid,
es_event->TimeOut);
}
break;
}
case UPNP_EVENT_AUTORENEWAL_FAILED:
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
int TimeOut = default_timeout;
Upnp_SID newSID;
int ret;
errCode = UpnpSubscribe(
ret = UpnpSubscribe(
ctrlpt_handle,
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
es_event->PublisherUrl,
&TimeOut,
newSID);
if (errCode == UPNP_E_SUCCESS) {
if (ret == UPNP_E_SUCCESS) {
SampleUtil_Print("Subscribed to EventURL with SID=%s\n", newSID);
TvCtrlPointHandleSubscribeUpdate(
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
es_event->PublisherUrl,
newSID,
TimeOut);
} else {
SampleUtil_Print("Error Subscribing to EventURL -- %d\n", errCode);
SampleUtil_Print("Error Subscribing to EventURL -- %d\n", ret);
}
break;
}

View File

@ -165,7 +165,7 @@ void TvStateUpdate(
void TvCtrlPointHandleEvent(const char *, int, IXML_Document *);
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
int TvCtrlPointCallbackEventHandler(Upnp_EventType, const void *, void *);
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
/*!
* \brief Checks the advertisement each device in the global device list.

View File

@ -288,7 +288,7 @@ error_handler:
return (ret);
}
int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *sr_event)
int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *sr_event)
{
unsigned int i = 0;
int cmp1 = 0;
@ -300,9 +300,9 @@ int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *sr_event)
/* lock state mutex */
ithread_mutex_lock(&TVDevMutex);
l_serviceId = UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(sr_event));
l_udn = UpnpSubscriptionRequest_get_UDN_cstr(sr_event);
l_sid = UpnpSubscriptionRequest_get_SID_cstr(sr_event);
l_serviceId = sr_event->ServiceId;
l_udn = sr_event->UDN;
l_sid = sr_event->Sid;
for (i = 0; i < TV_SERVICE_SERVCOUNT; ++i) {
cmp1 = strcmp(l_udn, tv_service_table[i].UDN);
cmp2 = strcmp(l_serviceId, tv_service_table[i].ServiceId);
@ -345,32 +345,30 @@ int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *sr_event)
return 1;
}
int TvDeviceHandleGetVarRequest(UpnpStateVarRequest *cgv_event)
int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *cgv_event)
{
unsigned int i = 0;
int j = 0;
int getvar_succeeded = 0;
UpnpStateVarRequest_set_CurrentVal(cgv_event, NULL);
cgv_event->CurrentVal = NULL;
ithread_mutex_lock(&TVDevMutex);
for (i = 0; i < TV_SERVICE_SERVCOUNT; i++) {
/* check udn and service id */
const char *devUDN =
UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(cgv_event));
const char *serviceID =
UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(cgv_event));
const char *devUDN = cgv_event->DevUDN;
const char *serviceID = cgv_event->ServiceID;
if (strcmp(devUDN, tv_service_table[i].UDN) == 0 &&
strcmp(serviceID, tv_service_table[i].ServiceId) == 0) {
/* check variable name */
for (j = 0; j < tv_service_table[i].VariableCount; j++) {
const char *stateVarName = UpnpString_get_String(
UpnpStateVarRequest_get_StateVarName(cgv_event));
const char *stateVarName =
cgv_event->StateVarName;
if (strcmp(stateVarName,
tv_service_table[i].VariableName[j]) == 0) {
getvar_succeeded = 1;
UpnpStateVarRequest_set_CurrentVal(cgv_event,
cgv_event->CurrentVal = ixmlCloneDOMString(
tv_service_table[i].VariableStrVal[j]);
break;
}
@ -378,21 +376,21 @@ int TvDeviceHandleGetVarRequest(UpnpStateVarRequest *cgv_event)
}
}
if (getvar_succeeded) {
UpnpStateVarRequest_set_ErrCode(cgv_event, UPNP_E_SUCCESS);
cgv_event->ErrCode = UPNP_E_SUCCESS;
} else {
SampleUtil_Print("Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n"
" Unknown variable name = %s\n",
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(cgv_event)));
UpnpStateVarRequest_set_ErrCode(cgv_event, 404);
UpnpStateVarRequest_strcpy_ErrStr(cgv_event, "Invalid Variable");
cgv_event->StateVarName);
cgv_event->ErrCode = 404;
strcpy(cgv_event->ErrStr, "Invalid Variable");
}
ithread_mutex_unlock(&TVDevMutex);
return UpnpStateVarRequest_get_ErrCode(cgv_event) == UPNP_E_SUCCESS;
return cgv_event->ErrCode == UPNP_E_SUCCESS;
}
int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
int TvDeviceHandleActionRequest(struct Upnp_Action_Request *ca_event)
{
/* Defaults if action not found. */
int action_found = 0;
@ -403,14 +401,13 @@ int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
const char *devUDN = NULL;
const char *serviceID = NULL;
const char *actionName = NULL;
IXML_Document *actionResult = NULL;
UpnpActionRequest_set_ErrCode(ca_event, 0);
UpnpActionRequest_set_ActionResult(ca_event, NULL);
ca_event->ErrCode = 0;
ca_event->ActionResult = NULL;
devUDN = UpnpString_get_String(UpnpActionRequest_get_DevUDN( ca_event));
serviceID = UpnpString_get_String(UpnpActionRequest_get_ServiceID( ca_event));
actionName = UpnpString_get_String(UpnpActionRequest_get_ActionName(ca_event));
devUDN = ca_event->DevUDN;
serviceID = ca_event->ServiceID;
actionName = ca_event->ActionName;
if (strcmp(devUDN, tv_service_table[TV_SERVICE_CONTROL].UDN) == 0 &&
strcmp(serviceID, tv_service_table[TV_SERVICE_CONTROL].ServiceId) == 0) {
/* Request for action in the TvDevice Control Service. */
@ -431,10 +428,9 @@ int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
VariableStrVal[TV_CONTROL_POWER], "1") ||
!strcmp(actionName, "PowerOn")) {
retCode = tv_service_table[service].actions[i](
UpnpActionRequest_get_ActionRequest(ca_event),
&actionResult,
ca_event->ActionRequest,
&ca_event->ActionResult,
&errorString);
UpnpActionRequest_set_ActionResult(ca_event, actionResult);
} else {
errorString = "Power is Off";
retCode = UPNP_E_INTERNAL_ERROR;
@ -445,28 +441,28 @@ int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
}
if (!action_found) {
UpnpActionRequest_set_ActionResult(ca_event, NULL);
UpnpActionRequest_strcpy_ErrStr(ca_event, "Invalid Action");
UpnpActionRequest_set_ErrCode(ca_event, 401);
ca_event->ActionResult = NULL;
strcpy(ca_event->ErrStr, "Invalid Action");
ca_event->ErrCode = 401;
} else {
if (retCode == UPNP_E_SUCCESS) {
UpnpActionRequest_set_ErrCode(ca_event, UPNP_E_SUCCESS);
ca_event->ErrCode = UPNP_E_SUCCESS;
} else {
/* copy the error string */
UpnpActionRequest_strcpy_ErrStr(ca_event, errorString);
strcpy(ca_event->ErrStr, errorString);
switch (retCode) {
case UPNP_E_INVALID_PARAM:
UpnpActionRequest_set_ErrCode(ca_event, 402);
ca_event->ErrCode = 402;
break;
case UPNP_E_INTERNAL_ERROR:
default:
UpnpActionRequest_set_ErrCode(ca_event, 501);
ca_event->ErrCode = 501;
break;
}
}
}
return UpnpActionRequest_get_ErrCode(ca_event);
return ca_event->ErrCode;
}
int TvDeviceSetServiceTableVar(unsigned int service, int variable, char *value)
@ -1262,17 +1258,22 @@ int TvDeviceDecreaseBrightness(IXML_Document * in, IXML_Document ** out,
return IncrementBrightness(-1, in, out, errorString);
}
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, const void *Event, void *Cookie)
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event,
void *Cookie)
{
switch (EventType) {
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
TvDeviceHandleSubscriptionRequest((UpnpSubscriptionRequest *)Event);
TvDeviceHandleSubscriptionRequest((struct
Upnp_Subscription_Request *)
Event);
break;
case UPNP_CONTROL_GET_VAR_REQUEST:
TvDeviceHandleGetVarRequest((UpnpStateVarRequest *)Event);
TvDeviceHandleGetVarRequest((struct Upnp_State_Var_Request *)
Event);
break;
case UPNP_CONTROL_ACTION_REQUEST:
TvDeviceHandleActionRequest((UpnpActionRequest *)Event);
TvDeviceHandleActionRequest((struct Upnp_Action_Request *)
Event);
break;
/* ignore these cases, since this is not a control point */
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:

View File

@ -214,7 +214,7 @@ int TvDeviceStateTableInit(
*/
int TvDeviceHandleSubscriptionRequest(
/*! [in] The subscription request event structure. */
const UpnpSubscriptionRequest *sr_event);
struct Upnp_Subscription_Request *sr_event);
/*!
* \brief Called during a get variable request callback.
@ -224,7 +224,7 @@ int TvDeviceHandleSubscriptionRequest(
*/
int TvDeviceHandleGetVarRequest(
/*! [in,out] The control get variable request event structure. */
UpnpStateVarRequest *cgv_event);
struct Upnp_State_Var_Request *cgv_event);
/*!
* \brief Called during an action request callback.
@ -234,7 +234,7 @@ int TvDeviceHandleGetVarRequest(
*/
int TvDeviceHandleActionRequest(
/*! [in,out] The control action request event structure. */
UpnpActionRequest *ca_event);
struct Upnp_Action_Request *ca_event);
/*!
* \brief The callback handler registered with the SDK while registering
@ -251,7 +251,7 @@ int TvDeviceCallbackEventHandler(
/*! [in] The type of callback event. */
Upnp_EventType,
/*! [in] Data structure containing event data. */
const void *Event,
void *Event,
/*! [in] Optional data specified during callback registration. */
void *Cookie);

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpActionComplete object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "ActionComplete.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpActionRequest object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "ActionRequest.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpDiscovery object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "Discovery.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpEvent object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "Event.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpEventSubscribe object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "EventSubscribe.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpFileInfo object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "FileInfo.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpStateVarComplete object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "StateVarComplete.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpStateVarRequest object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "StateVarRequest.h"

View File

@ -1,14 +0,0 @@
/*!
* \file
*
* \brief UpnpSubscriptionRequest object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "SubscriptionRequest.h"

View File

@ -78,10 +78,6 @@
#include <sys/types.h>
#endif
#ifdef UPNP_ENABLE_OPEN_SSL
#include <openssl/ssl.h>
#endif
#ifndef IN6_IS_ADDR_GLOBAL
#define IN6_IS_ADDR_GLOBAL(a) \
((((__const uint32_t *) (a))[0] & htonl((uint32_t)0x70000000)) \
@ -184,12 +180,6 @@ int UpnpSdkDeviceregisteredV6 = 0;
Upnp_SID gUpnpSdkNLSuuid;
#endif /* UPNP_HAVE_OPTSSDP */
/*! Global variable used as to store the OpenSSL context object
* to be used for all SSL/TLS connections
*/
#ifdef UPNP_ENABLE_OPEN_SSL
SSL_CTX *gSslCtx = NULL;
#endif
/*!
* \brief (Windows Only) Initializes the Windows Winsock library.
@ -544,24 +534,6 @@ exit_function:
}
#endif
#ifdef UPNP_ENABLE_OPEN_SSL
int UpnpInitSslContext(int initOpenSslLib, const SSL_METHOD *sslMethod)
{
if (gSslCtx)
return UPNP_E_INIT;
if (initOpenSslLib) {
SSL_load_error_strings();
SSL_library_init();
OpenSSL_add_all_algorithms();
}
gSslCtx = SSL_CTX_new(sslMethod);
if (!gSslCtx) {
return UPNP_E_INIT_FAILED;
}
return UPNP_E_SUCCESS;
}
#endif
#ifdef DEBUG
/*!
* \brief Prints thread pool statistics.
@ -631,12 +603,7 @@ int UpnpFinish(void)
UpnpClient_Handle client_handle;
#endif
struct Handle_Info *temp;
#ifdef UPNP_ENABLE_OPEN_SSL
if (gSslCtx) {
SSL_CTX_free(gSslCtx);
gSslCtx = NULL;
}
#endif
if (UpnpSdkInit != 1)
return UPNP_E_FINISH;
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__,
@ -2527,7 +2494,7 @@ int UpnpAcceptSubscriptionExt(
const char *DevID_const,
const char *ServName_const,
IXML_Document *PropSet,
const Upnp_SID SubsId)
Upnp_SID SubsId)
{
int ret = 0;
int line = 0;
@ -3068,12 +3035,8 @@ int UpnpOpenHttpPost(
int contentLength,
int timeout)
{
int status = http_OpenHttpConnection(url, handle, timeout);
if (status == UPNP_E_SUCCESS) {
return http_MakeHttpRequest(HTTPMETHOD_POST, url, handle, NULL, contentType,
contentLength, timeout);
}
return status;
return http_OpenHttpPost(
url, handle, contentType, contentLength, timeout);
}
@ -3083,7 +3046,7 @@ int UpnpWriteHttpPost(
size_t *size,
int timeout)
{
return http_WriteHttpRequest(handle, buf, size, timeout);
return http_WriteHttpPost(handle, buf, size, timeout);
}
@ -3092,56 +3055,35 @@ int UpnpCloseHttpPost(
int *httpStatus,
int timeout)
{
int status = http_EndHttpRequest(handle, timeout);
if (status == UPNP_E_SUCCESS) {
status = http_GetHttpResponse(handle, NULL, NULL, NULL, httpStatus, timeout);
}
status = http_CloseHttpConnection(handle);
return status;}
return http_CloseHttpPost(handle, httpStatus, timeout);
}
int UpnpOpenHttpGet(
const char *url,
void **handle,
const char *url_str,
void **Handle,
char **contentType,
int *contentLength,
int *httpStatus,
int timeout)
{
int status = UpnpOpenHttpConnection(url, handle, timeout);
if (status == UPNP_E_SUCCESS) {
status = UpnpMakeHttpRequest(HTTPMETHOD_GET, url, *handle, NULL, NULL, 0, timeout);
}
if (status == UPNP_E_SUCCESS) {
status = UpnpEndHttpRequest(*handle, timeout);
}
if (status == UPNP_E_SUCCESS) {
status = UpnpGetHttpResponse(*handle, NULL, contentType, contentLength, httpStatus, timeout);
}
return status;
return http_OpenHttpGet(
url_str, Handle, contentType, contentLength, httpStatus, timeout);
}
int UpnpOpenHttpGetProxy(
const char *url,
const char *url_str,
const char *proxy_str,
void **handle,
void **Handle,
char **contentType,
int *contentLength,
int *httpStatus,
int timeout)
{
int status = UpnpOpenHttpConnection(proxy_str, handle, timeout);
if (status == UPNP_E_SUCCESS) {
status = UpnpMakeHttpRequest(HTTPMETHOD_GET, url, *handle, NULL, NULL, 0, timeout);
}
if (status == UPNP_E_SUCCESS) {
status = UpnpEndHttpRequest(*handle, timeout);
}
if (status == UPNP_E_SUCCESS) {
status = UpnpGetHttpResponse(*handle, NULL, contentType, contentLength, httpStatus, timeout);
}
return status;
return http_OpenHttpGetProxy(
url_str, proxy_str, Handle, contentType, contentLength,
httpStatus, timeout);
}
@ -3169,13 +3111,13 @@ int UpnpCancelHttpGet(void *Handle)
int UpnpCloseHttpGet(void *Handle)
{
return UpnpCloseHttpConnection(Handle);
return http_CloseHttpGet(Handle);
}
int UpnpReadHttpGet(void *Handle, char *buf, size_t *size, int timeout)
{
return http_ReadHttpResponse(Handle, buf, size, timeout);
return http_ReadHttpGet(Handle, buf, size, timeout);
}
@ -3185,57 +3127,6 @@ int UpnpHttpGetProgress(void *Handle, size_t *length, size_t *total)
}
int UpnpOpenHttpConnection(const char *url,
void **handle, int timeout)
{
return http_OpenHttpConnection(url, handle, timeout);
}
int UpnpMakeHttpRequest(Upnp_HttpMethod method, const char *url,
void *handle, UpnpString *headers,
const char *contentType, int contentLength,
int timeout)
{
return http_MakeHttpRequest(method, url, handle, headers, contentType,
contentLength, timeout);
}
int UpnpWriteHttpRequest(void *handle, char *buf,
size_t *size, int timeout)
{
return http_WriteHttpRequest(handle, buf, size, timeout);
}
int UpnpEndHttpRequest(void *handle, int timeout)
{
return http_EndHttpRequest(handle, timeout);
}
int UpnpGetHttpResponse(void *handle, UpnpString *headers,
char **contentType, int *contentLength, int *httpStatus,
int timeout)
{
return http_GetHttpResponse(handle, headers, contentType, contentLength,
httpStatus, timeout);
}
int UpnpReadHttpResponse(void *handle, char *buf,
size_t *size, int timeout)
{
return http_ReadHttpResponse(handle, buf, size, timeout);
}
int UpnpCloseHttpConnection(void *handle)
{
return http_CloseHttpConnection(handle);
}
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
{
int ret_code;
@ -3706,7 +3597,7 @@ int UpnpGetIfInfo(const char *IfName)
#ifdef INCLUDE_CLIENT_APIS
void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
{
int errCode = 0;
/*int errCode = 0;*/
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
"Inside UpnpThreadDistribution \n");
@ -3714,85 +3605,92 @@ void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
switch (Param->FunName) {
#if EXCLUDE_GENA == 0
case SUBSCRIBE: {
UpnpEventSubscribe *evt = UpnpEventSubscribe_new();
struct Upnp_Event_Subscribe Evt;
UpnpString *Sid = UpnpString_new();
UpnpEventSubscribe_strcpy_PublisherUrl(evt, Param->Url);
errCode = genaSubscribe(
UpnpString *Url = UpnpString_new();
UpnpString_set_String(Url, Param->Url);
memset(&Evt, 0, sizeof(Evt));
Evt.ErrCode = genaSubscribe(
Param->Handle,
UpnpEventSubscribe_get_PublisherUrl(evt),
Url,
(int *)&Param->TimeOut,
Sid);
UpnpEventSubscribe_set_ErrCode(evt, errCode);
UpnpEventSubscribe_set_TimeOut(evt, Param->TimeOut);
UpnpEventSubscribe_set_SID(evt, Sid);
Param->Fun(UPNP_EVENT_SUBSCRIBE_COMPLETE, evt, Param->Cookie);
UpnpString_delete(Sid);
UpnpEventSubscribe_delete(evt);
strncpy(Evt.PublisherUrl, Param->Url,
sizeof(Evt.PublisherUrl) - 1);
Evt.TimeOut = Param->TimeOut;
strncpy((char *)Evt.Sid, UpnpString_get_String(Sid),
sizeof(Evt.Sid) - 1);
Param->Fun(UPNP_EVENT_SUBSCRIBE_COMPLETE, &Evt, Param->Cookie);
UpnpString_delete(Sid);
UpnpString_delete(Url);
free(Param);
break;
}
case UNSUBSCRIBE: {
UpnpEventSubscribe *evt = UpnpEventSubscribe_new();
UpnpEventSubscribe_strcpy_SID(evt, Param->SubsId);
errCode = genaUnSubscribe(
struct Upnp_Event_Subscribe Evt;
UpnpString *Sid = UpnpString_new();
UpnpString_set_String(Sid, Param->SubsId);
memset(&Evt, 0, sizeof(Evt));
Evt.ErrCode = genaUnSubscribe(
Param->Handle,
UpnpEventSubscribe_get_SID(evt));
UpnpEventSubscribe_set_ErrCode(evt, errCode);
UpnpEventSubscribe_strcpy_PublisherUrl(evt, "");
UpnpEventSubscribe_set_TimeOut(evt, 0);
Param->Fun(UPNP_EVENT_UNSUBSCRIBE_COMPLETE, evt, Param->Cookie);
UpnpEventSubscribe_delete(evt);
Sid);
strncpy((char *)Evt.Sid, UpnpString_get_String(Sid),
sizeof(Evt.Sid) - 1);
strncpy(Evt.PublisherUrl, "", sizeof(Evt.PublisherUrl) - 1);
Evt.TimeOut = 0;
Param->Fun(UPNP_EVENT_UNSUBSCRIBE_COMPLETE, &Evt, Param->Cookie);
UpnpString_delete(Sid);
free(Param);
break;
}
case RENEW: {
UpnpEventSubscribe *evt = UpnpEventSubscribe_new();
UpnpEventSubscribe_strcpy_SID(evt, Param->SubsId);
errCode = genaRenewSubscription(
struct Upnp_Event_Subscribe Evt;
UpnpString *Sid = UpnpString_new();
UpnpString_set_String(Sid, Param->SubsId);
memset(&Evt, 0, sizeof(Evt));
Evt.ErrCode = genaRenewSubscription(
Param->Handle,
UpnpEventSubscribe_get_SID(evt),
Sid,
&Param->TimeOut);
UpnpEventSubscribe_set_ErrCode(evt, errCode);
UpnpEventSubscribe_set_TimeOut(evt, Param->TimeOut);
Param->Fun(UPNP_EVENT_RENEWAL_COMPLETE, evt, Param->Cookie);
UpnpEventSubscribe_delete(evt);
Evt.TimeOut = Param->TimeOut;
strncpy((char *)Evt.Sid, UpnpString_get_String(Sid),
sizeof(Evt.Sid) - 1);
Param->Fun(UPNP_EVENT_RENEWAL_COMPLETE, &Evt, Param->Cookie);
UpnpString_delete(Sid);
free(Param);
break;
}
#endif /* EXCLUDE_GENA == 0 */
#if EXCLUDE_SOAP == 0
case ACTION: {
UpnpActionComplete *Evt = UpnpActionComplete_new();
IXML_Document *actionResult = NULL;
int errCode = SoapSendAction(
struct Upnp_Action_Complete Evt;
memset(&Evt, 0, sizeof(Evt));
Evt.ActionResult = NULL;
Evt.ErrCode = SoapSendAction(
Param->Url,
Param->ServiceType,
Param->Act,
&actionResult);
UpnpActionComplete_set_ErrCode(Evt, errCode);
UpnpActionComplete_set_ActionRequest(Evt, Param->Act);
UpnpActionComplete_set_ActionResult(Evt, actionResult);
UpnpActionComplete_strcpy_CtrlUrl(Evt, Param->Url);
Param->Fun(UPNP_CONTROL_ACTION_COMPLETE, Evt, Param->Cookie);
Param->Act, &Evt.ActionResult);
Evt.ActionRequest = Param->Act;
strncpy(Evt.CtrlUrl, Param->Url, sizeof(Evt.CtrlUrl) - 1);
Param->Fun(UPNP_CONTROL_ACTION_COMPLETE, &Evt, Param->Cookie);
ixmlDocument_free(Evt.ActionRequest);
ixmlDocument_free(Evt.ActionResult);
free(Param);
UpnpActionComplete_delete(Evt);
break;
}
case STATUS: {
UpnpStateVarComplete *Evt = UpnpStateVarComplete_new();
DOMString currentVal = NULL;
int errCode = SoapGetServiceVarStatus(
struct Upnp_State_Var_Complete Evt;
memset(&Evt, 0, sizeof(Evt));
Evt.ErrCode = SoapGetServiceVarStatus(
Param->Url,
Param->VarName,
&currentVal);
UpnpStateVarComplete_set_ErrCode(Evt, errCode);
UpnpStateVarComplete_strcpy_CtrlUrl(Evt, Param->Url);
UpnpStateVarComplete_strcpy_StateVarName(Evt, Param->VarName);
UpnpStateVarComplete_set_CurrentVal(Evt, currentVal);
Param->Fun(UPNP_CONTROL_GET_VAR_COMPLETE, Evt, Param->Cookie);
&Evt.CurrentVal);
strncpy(Evt.StateVarName, Param->VarName,
sizeof(Evt.StateVarName) - 1);
strncpy(Evt.CtrlUrl, Param->Url, sizeof(Evt.CtrlUrl) - 1);
Param->Fun(UPNP_CONTROL_GET_VAR_COMPLETE, &Evt, Param->Cookie);
free(Evt.CurrentVal);
free(Param);
UpnpStateVarComplete_delete(Evt);
break;
}
#endif /* EXCLUDE_SOAP == 0 */
@ -4297,6 +4195,27 @@ int UpnpIsWebserverEnabled(void)
return bWebServerState == (WebServerState)WEB_SERVER_ENABLED;
}
int UpnpSetVirtualDirCallbacks(struct UpnpVirtualDirCallbacks *callbacks)
{
int ret = 0;
if( UpnpSdkInit != 1 ) {
/* SDK is not initialized */
return UPNP_E_FINISH;
}
if( callbacks == NULL )
return UPNP_E_INVALID_PARAM;
ret = UpnpVirtualDir_set_GetInfoCallback(callbacks->get_info) == UPNP_E_SUCCESS
&& UpnpVirtualDir_set_OpenCallback(callbacks->open) == UPNP_E_SUCCESS
&& UpnpVirtualDir_set_ReadCallback(callbacks->read) == UPNP_E_SUCCESS
&& UpnpVirtualDir_set_WriteCallback(callbacks->write) == UPNP_E_SUCCESS
&& UpnpVirtualDir_set_SeekCallback(callbacks->seek) == UPNP_E_SUCCESS
&& UpnpVirtualDir_set_CloseCallback(callbacks->close) == UPNP_E_SUCCESS;
return ret ? UPNP_E_SUCCESS : UPNP_E_INVALID_PARAM;
}
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
{

View File

@ -2,7 +2,7 @@
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
* Copyright (c) 2012 France Telecom All rights reserved.
* Copyright (c) 2012 France Telecom All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View File

@ -43,7 +43,6 @@
#ifdef INCLUDE_CLIENT_APIS
#include "EventSubscribe.h"
#include "gena.h"
#include "httpparser.h"
#include "httpreadwrite.h"
@ -69,7 +68,7 @@ static void GenaAutoRenewSubscription(
IN void *input)
{
upnp_timeout *event = (upnp_timeout *) input;
UpnpEventSubscribe *sub_struct = (UpnpEventSubscribe *)event->Event;
struct Upnp_Event_Subscribe *sub_struct = (struct Upnp_Event_Subscribe *)event->Event;
void *cookie;
Upnp_FunPtr callback_fun;
struct Handle_Info *handle_info;
@ -77,21 +76,23 @@ static void GenaAutoRenewSubscription(
int eventType = 0;
int timeout = 0;
int errCode = 0;
UpnpString *tmpSID = UpnpString_new();
if (AUTO_RENEW_TIME == 0) {
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, "GENA SUB EXPIRED");
UpnpEventSubscribe_set_ErrCode(sub_struct, UPNP_E_SUCCESS);
sub_struct->ErrCode = UPNP_E_SUCCESS;
send_callback = 1;
eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED;
} else {
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "GENA AUTO RENEW");
timeout = UpnpEventSubscribe_get_TimeOut(sub_struct);
timeout = sub_struct->TimeOut;
UpnpString_set_String(tmpSID, sub_struct->Sid);
errCode = genaRenewSubscription(
event->handle,
UpnpEventSubscribe_get_SID(sub_struct),
tmpSID,
&timeout);
UpnpEventSubscribe_set_ErrCode(sub_struct, errCode);
UpnpEventSubscribe_set_TimeOut(sub_struct, timeout);
sub_struct->ErrCode = errCode;
sub_struct->TimeOut = timeout;
if (errCode != UPNP_E_SUCCESS &&
errCode != GENA_E_BAD_SID &&
errCode != GENA_E_BAD_HANDLE) {
@ -119,6 +120,7 @@ static void GenaAutoRenewSubscription(
free_upnp_timeout(event);
end_function:
UpnpString_delete(tmpSID);
return;
}
@ -135,12 +137,14 @@ static int ScheduleGenaAutoRenew(
/*! [in] The time out value of the subscription. */
IN int TimeOut,
/*! [in] Subscription being renewed. */
IN GenlibClientSubscription *sub)
IN ClientSubscription *sub)
{
UpnpEventSubscribe *RenewEventStruct = NULL;
struct Upnp_Event_Subscribe *RenewEventStruct = NULL;
upnp_timeout *RenewEvent = NULL;
int return_code = GENA_SUCCESS;
ThreadPoolJob job;
const UpnpString *tmpSID = UpnpClientSubscription_get_SID(sub);
const UpnpString *tmpEventURL = UpnpClientSubscription_get_EventURL(sub);
memset(&job, 0, sizeof(job));
@ -149,11 +153,12 @@ static int ScheduleGenaAutoRenew(
goto end_function;
}
RenewEventStruct = UpnpEventSubscribe_new();
RenewEventStruct = (struct Upnp_Event_Subscribe *)malloc(sizeof (struct Upnp_Event_Subscribe));
if (RenewEventStruct == NULL) {
return_code = UPNP_E_OUTOF_MEMORY;
goto end_function;
}
memset(RenewEventStruct, 0, sizeof(struct Upnp_Event_Subscribe));
RenewEvent = (upnp_timeout *) malloc(sizeof(upnp_timeout));
if (RenewEvent == NULL) {
@ -164,10 +169,12 @@ static int ScheduleGenaAutoRenew(
memset(RenewEvent, 0, sizeof(upnp_timeout));
/* schedule expire event */
UpnpEventSubscribe_set_ErrCode(RenewEventStruct, UPNP_E_SUCCESS);
UpnpEventSubscribe_set_TimeOut(RenewEventStruct, TimeOut);
UpnpEventSubscribe_set_SID(RenewEventStruct, GenlibClientSubscription_get_SID(sub));
UpnpEventSubscribe_set_PublisherUrl(RenewEventStruct, GenlibClientSubscription_get_EventURL(sub));
RenewEventStruct->ErrCode = UPNP_E_SUCCESS;
RenewEventStruct->TimeOut = TimeOut;
strncpy(RenewEventStruct->Sid, UpnpString_get_String(tmpSID),
sizeof(RenewEventStruct->Sid) - 1);
strncpy(RenewEventStruct->PublisherUrl,
UpnpString_get_String(tmpEventURL), NAME_SIZE - 1);
/* RenewEvent->EventType=UPNP_EVENT_SUBSCRIPTION_EXPIRE; */
RenewEvent->handle = client_handle;
@ -190,12 +197,11 @@ static int ScheduleGenaAutoRenew(
goto end_function;
}
GenlibClientSubscription_set_RenewEventId(sub, RenewEvent->eventId);
UpnpClientSubscription_set_RenewEventId(sub, RenewEvent->eventId);
return_code = GENA_SUCCESS;
end_function:
return return_code;
}
@ -410,7 +416,7 @@ static int gena_subscribe(
int genaUnregisterClient(UpnpClient_Handle client_handle)
{
GenlibClientSubscription *sub_copy = GenlibClientSubscription_new();
ClientSubscription *sub_copy = UpnpClientSubscription_new();
int return_code = UPNP_E_SUCCESS;
struct Handle_Info *handle_info = NULL;
http_parser_t response;
@ -427,16 +433,16 @@ int genaUnregisterClient(UpnpClient_Handle client_handle)
return_code = UPNP_E_SUCCESS;
break;
}
GenlibClientSubscription_assign(sub_copy, handle_info->ClientSubList);
UpnpClientSubscription_assign(sub_copy, handle_info->ClientSubList);
RemoveClientSubClientSID(
&handle_info->ClientSubList,
GenlibClientSubscription_get_SID(sub_copy));
UpnpClientSubscription_get_SID(sub_copy));
HandleUnlock();
return_code = gena_unsubscribe(
GenlibClientSubscription_get_EventURL(sub_copy),
GenlibClientSubscription_get_ActualSID(sub_copy),
UpnpClientSubscription_get_EventURL(sub_copy),
UpnpClientSubscription_get_ActualSID(sub_copy),
&response);
if (return_code == 0) {
httpmsg_destroy(&response.msg);
@ -448,7 +454,7 @@ int genaUnregisterClient(UpnpClient_Handle client_handle)
HandleUnlock();
exit_function:
GenlibClientSubscription_delete(sub_copy);
UpnpClientSubscription_delete(sub_copy);
return return_code;
}
@ -458,10 +464,10 @@ int genaUnSubscribe(
UpnpClient_Handle client_handle,
const UpnpString *in_sid)
{
GenlibClientSubscription *sub = NULL;
ClientSubscription *sub = NULL;
int return_code = GENA_SUCCESS;
struct Handle_Info *handle_info;
GenlibClientSubscription *sub_copy = GenlibClientSubscription_new();
ClientSubscription *sub_copy = UpnpClientSubscription_new();
http_parser_t response;
/* validate handle and sid */
@ -477,12 +483,12 @@ int genaUnSubscribe(
return_code = GENA_E_BAD_SID;
goto exit_function;
}
GenlibClientSubscription_assign(sub_copy, sub);
UpnpClientSubscription_assign(sub_copy, sub);
HandleUnlock();
return_code = gena_unsubscribe(
GenlibClientSubscription_get_EventURL(sub_copy),
GenlibClientSubscription_get_ActualSID(sub_copy),
UpnpClientSubscription_get_EventURL(sub_copy),
UpnpClientSubscription_get_ActualSID(sub_copy),
&response);
if (return_code == 0) {
httpmsg_destroy(&response.msg);
@ -499,7 +505,7 @@ int genaUnSubscribe(
HandleUnlock();
exit_function:
GenlibClientSubscription_delete(sub_copy);
UpnpClientSubscription_delete(sub_copy);
return return_code;
}
#endif /* INCLUDE_CLIENT_APIS */
@ -513,7 +519,7 @@ int genaSubscribe(
UpnpString *out_sid)
{
int return_code = GENA_SUCCESS;
GenlibClientSubscription *newSubscription = GenlibClientSubscription_new();
ClientSubscription *newSubscription = UpnpClientSubscription_new();
uuid_upnp uid;
Upnp_SID temp_sid;
Upnp_SID temp_sid2;
@ -572,11 +578,11 @@ int genaSubscribe(
return_code = UPNP_E_OUTOF_MEMORY;
goto error_handler;
}
GenlibClientSubscription_set_RenewEventId(newSubscription, -1);
GenlibClientSubscription_set_SID(newSubscription, out_sid);
GenlibClientSubscription_set_ActualSID(newSubscription, ActualSID);
GenlibClientSubscription_set_EventURL(newSubscription, EventURL);
GenlibClientSubscription_set_Next(newSubscription, handle_info->ClientSubList);
UpnpClientSubscription_set_RenewEventId(newSubscription, -1);
UpnpClientSubscription_set_SID(newSubscription, out_sid);
UpnpClientSubscription_set_ActualSID(newSubscription, ActualSID);
UpnpClientSubscription_set_EventURL(newSubscription, EventURL);
UpnpClientSubscription_set_Next(newSubscription, handle_info->ClientSubList);
handle_info->ClientSubList = newSubscription;
/* schedule expiration event */
@ -586,7 +592,7 @@ error_handler:
UpnpString_delete(ActualSID);
UpnpString_delete(EventURL);
if (return_code != UPNP_E_SUCCESS)
GenlibClientSubscription_delete(newSubscription);
UpnpClientSubscription_delete(newSubscription);
HandleUnlock();
SubscribeUnlock();
@ -601,8 +607,8 @@ int genaRenewSubscription(
int *TimeOut)
{
int return_code = GENA_SUCCESS;
GenlibClientSubscription *sub = NULL;
GenlibClientSubscription *sub_copy = GenlibClientSubscription_new();
ClientSubscription *sub = NULL;
ClientSubscription *sub_copy = UpnpClientSubscription_new();
struct Handle_Info *handle_info;
UpnpString *ActualSID = UpnpString_new();
ThreadPoolJob tempJob;
@ -628,22 +634,22 @@ int genaRenewSubscription(
/* remove old events */
if (TimerThreadRemove(
&gTimerThread,
GenlibClientSubscription_get_RenewEventId(sub),
UpnpClientSubscription_get_RenewEventId(sub),
&tempJob) == 0 ) {
free_upnp_timeout((upnp_timeout *)tempJob.arg);
}
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "REMOVED AUTO RENEW EVENT");
GenlibClientSubscription_set_RenewEventId(sub, -1);
GenlibClientSubscription_assign(sub_copy, sub);
UpnpClientSubscription_set_RenewEventId(sub, -1);
UpnpClientSubscription_assign(sub_copy, sub);
HandleUnlock();
return_code = gena_subscribe(
GenlibClientSubscription_get_EventURL(sub_copy),
UpnpClientSubscription_get_EventURL(sub_copy),
TimeOut,
GenlibClientSubscription_get_ActualSID(sub_copy),
UpnpClientSubscription_get_ActualSID(sub_copy),
ActualSID);
HandleLock();
@ -674,21 +680,21 @@ int genaRenewSubscription(
}
/* store actual sid */
GenlibClientSubscription_set_ActualSID(sub, ActualSID);
UpnpClientSubscription_set_ActualSID(sub, ActualSID);
/* start renew subscription timer */
return_code = ScheduleGenaAutoRenew(client_handle, *TimeOut, sub);
if (return_code != GENA_SUCCESS) {
RemoveClientSubClientSID(
&handle_info->ClientSubList,
GenlibClientSubscription_get_SID(sub));
UpnpClientSubscription_get_SID(sub));
}
free_client_subscription(sub_copy);
HandleUnlock();
exit_function:
UpnpString_delete(ActualSID);
GenlibClientSubscription_delete(sub_copy);
UpnpClientSubscription_delete(sub_copy);
return return_code;
}
@ -697,15 +703,16 @@ void gena_process_notification_event(
SOCKINFO *info,
http_message_t *event)
{
UpnpEvent *event_struct = UpnpEvent_new();
struct Upnp_Event event_struct;
IXML_Document *ChangedVars = NULL;
int eventKey;
token sid;
GenlibClientSubscription *subscription = NULL;
ClientSubscription *subscription = NULL;
struct Handle_Info *handle_info;
void *cookie;
Upnp_FunPtr callback;
UpnpClient_Handle client_handle;
const UpnpString *tmpSID = NULL;
memptr sid_hdr;
memptr nt_hdr,
@ -802,9 +809,12 @@ void gena_process_notification_event(
error_respond(info, HTTP_OK, event);
/* fill event struct */
UpnpEvent_set_EventKey(event_struct, eventKey);
UpnpEvent_set_ChangedVariables(event_struct, ChangedVars);
UpnpEvent_set_SID(event_struct, GenlibClientSubscription_get_SID(subscription));
tmpSID = UpnpClientSubscription_get_SID(subscription);
memset(event_struct.Sid, 0, sizeof(event_struct.Sid));
strncpy(event_struct.Sid, UpnpString_get_String(tmpSID),
sizeof(event_struct.Sid) - 1);
event_struct.EventKey = eventKey;
event_struct.ChangedVariables = ChangedVars;
/* copy callback */
callback = handle_info->Callback;
@ -816,11 +826,10 @@ void gena_process_notification_event(
/* In future, should find a way of mainting */
/* that the handle is not unregistered in the middle of a */
/* callback */
callback(UPNP_EVENT_RECEIVED, event_struct, cookie);
callback(UPNP_EVENT_RECEIVED, &event_struct, cookie);
exit_function:
ixmlDocument_free(ChangedVars);
UpnpEvent_delete(event_struct);
}

View File

@ -1187,7 +1187,7 @@ void gena_process_subscription_request(
SOCKINFO *info,
http_message_t *request)
{
UpnpSubscriptionRequest *request_struct = UpnpSubscriptionRequest_new();
struct Upnp_Subscription_Request request_struct;
Upnp_SID temp_sid;
int return_code = 1;
int time_out = 1801;
@ -1204,6 +1204,8 @@ void gena_process_subscription_request(
memptr timeout_hdr;
int rc = 0;
memset(&request_struct, 0, sizeof(request_struct));
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
"Subscription Request Received:\n");
@ -1349,9 +1351,10 @@ void gena_process_subscription_request(
service->TotalSubscriptions++;
/* finally generate callback for init table dump */
UpnpSubscriptionRequest_strcpy_ServiceId(request_struct, service->serviceId);
UpnpSubscriptionRequest_strcpy_UDN(request_struct, service->UDN);
UpnpSubscriptionRequest_strcpy_SID(request_struct, sub->sid);
request_struct.ServiceId = service->serviceId;
request_struct.UDN = service->UDN;
strncpy((char *)request_struct.Sid, sub->sid,
sizeof(request_struct.Sid) - 1);
/* copy callback */
callback_fun = handle_info->Callback;
@ -1362,10 +1365,10 @@ void gena_process_subscription_request(
/* make call back with request struct */
/* in the future should find a way of mainting that the handle */
/* is not unregistered in the middle of a callback */
callback_fun(UPNP_EVENT_SUBSCRIPTION_REQUEST, request_struct, cookie);
callback_fun(UPNP_EVENT_SUBSCRIPTION_REQUEST, &request_struct, cookie);
exit_function:
UpnpSubscriptionRequest_delete(request_struct);
return;
}

View File

@ -1,18 +0,0 @@
/*!
* \file
*
* \brief GenlibClientSubscription object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#ifdef INCLUDE_CLIENT_APIS
#define TEMPLATE_GENERATE_SOURCE
#include "ClientSubscription.h"
#endif /* INCLUDE_CLIENT_APIS */

View File

@ -1,3 +1,34 @@
/*******************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
* Copyright (c) 2012 France Telecom All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
/************************************************************************
* Purpose: This file defines the functions for clients. It defines
@ -14,19 +45,199 @@
#ifdef INCLUDE_CLIENT_APIS
#if EXCLUDE_GENA == 0
#include <stdlib.h> /* for calloc(), free() */
void free_client_subscription(GenlibClientSubscription *sub)
struct SClientSubscription {
int m_renewEventId;
UpnpString *m_SID;
UpnpString *m_actualSID;
UpnpString *m_eventURL;
struct SClientSubscription *m_next;
};
/** Constructor */
ClientSubscription *UpnpClientSubscription_new()
{
struct SClientSubscription *p = calloc(1, sizeof (struct SClientSubscription));
#if 0
p->renewEventId = 0;
#endif
p->m_SID = UpnpString_new();
p->m_actualSID = UpnpString_new();
p->m_eventURL = UpnpString_new();
p->m_next = NULL;
return (ClientSubscription *)p;
}
/** Destructor */
void UpnpClientSubscription_delete(ClientSubscription *p)
{
struct SClientSubscription *q = (struct SClientSubscription *)p;
if (!q) return;
q->m_renewEventId = 0;
UpnpString_delete(q->m_SID);
q->m_SID = NULL;
UpnpString_delete(q->m_actualSID);
q->m_actualSID = NULL;
UpnpString_delete(q->m_eventURL);
q->m_eventURL = NULL;
q->m_next = NULL;
free(p);
}
/** Copy Constructor */
ClientSubscription *UpnpClientSubscription_dup(const ClientSubscription *p)
{
ClientSubscription *q = UpnpClientSubscription_new();
UpnpClientSubscription_assign(q, p);
return q;
}
/** Assignment operator */
void UpnpClientSubscription_assign(ClientSubscription *q, const ClientSubscription *p)
{
if (q != p) {
/* Do not copy RenewEventId */
((struct SClientSubscription *)q)->m_renewEventId = -1;
UpnpClientSubscription_set_SID(q, UpnpClientSubscription_get_SID(p));
UpnpClientSubscription_set_ActualSID(q, UpnpClientSubscription_get_ActualSID(p));
UpnpClientSubscription_set_EventURL(q, UpnpClientSubscription_get_EventURL(p));
/* Do not copy m_next */
((struct SClientSubscription *)q)->m_next = NULL;
}
}
int UpnpClientSubscription_get_RenewEventId(const ClientSubscription *p)
{
return ((struct SClientSubscription *)p)->m_renewEventId;
}
void UpnpClientSubscription_set_RenewEventId(ClientSubscription *p, int n)
{
((struct SClientSubscription *)p)->m_renewEventId = n;
}
const UpnpString *UpnpClientSubscription_get_SID(const ClientSubscription *p)
{
return ((struct SClientSubscription *)p)->m_SID;
}
const char *UpnpClientSubscription_get_SID_cstr(const ClientSubscription *p)
{
return UpnpString_get_String(UpnpClientSubscription_get_SID(p));
}
void UpnpClientSubscription_set_SID(ClientSubscription *p, const UpnpString *s)
{
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
((struct SClientSubscription *)p)->m_SID = UpnpString_dup(s);
}
void UpnpClientSubscription_strcpy_SID(ClientSubscription *p, const char *s)
{
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
((struct SClientSubscription *)p)->m_SID = UpnpString_new();
UpnpString_set_String(((struct SClientSubscription *)p)->m_SID, s);
}
const UpnpString *UpnpClientSubscription_get_ActualSID(const ClientSubscription *p)
{
return ((struct SClientSubscription *)p)->m_actualSID;
}
const char *UpnpClientSubscription_get_ActualSID_cstr(const ClientSubscription *p)
{
return UpnpString_get_String(UpnpClientSubscription_get_ActualSID(p));
}
void UpnpClientSubscription_set_ActualSID(ClientSubscription *p, const UpnpString *s)
{
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
((struct SClientSubscription *)p)->m_actualSID = UpnpString_dup(s);
}
void UpnpClientSubscription_strcpy_ActualSID(ClientSubscription *p, const char *s)
{
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
((struct SClientSubscription *)p)->m_actualSID = UpnpString_new();
UpnpString_set_String(((struct SClientSubscription *)p)->m_actualSID, s);
}
const UpnpString *UpnpClientSubscription_get_EventURL(const ClientSubscription *p)
{
return ((struct SClientSubscription *)p)->m_eventURL;
}
const char *UpnpClientSubscription_get_EventURL_cstr(const ClientSubscription *p)
{
return UpnpString_get_String(UpnpClientSubscription_get_EventURL(p));
}
void UpnpClientSubscription_set_EventURL(ClientSubscription *p, const UpnpString *s)
{
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
((struct SClientSubscription *)p)->m_eventURL = UpnpString_dup(s);
}
void UpnpClientSubscription_strcpy_EventURL(ClientSubscription *p, const char *s)
{
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
((struct SClientSubscription *)p)->m_eventURL = UpnpString_new();
UpnpString_set_String(((struct SClientSubscription *)p)->m_eventURL, s);
}
ClientSubscription *UpnpClientSubscription_get_Next(const ClientSubscription *p)
{
return (ClientSubscription *)(((struct SClientSubscription *)p)->m_next);
}
void UpnpClientSubscription_set_Next(ClientSubscription *p, ClientSubscription *q)
{
((struct SClientSubscription *)p)->m_next = (struct SClientSubscription *)q;
}
void free_client_subscription(ClientSubscription *sub)
{
upnp_timeout *event;
ThreadPoolJob tempJob;
if (sub) {
int renewEventId = GenlibClientSubscription_get_RenewEventId(sub);
GenlibClientSubscription_strcpy_ActualSID(sub, "");
GenlibClientSubscription_strcpy_EventURL(sub, "");
int renewEventId = UpnpClientSubscription_get_RenewEventId(sub);
UpnpClientSubscription_strcpy_ActualSID(sub, "");
UpnpClientSubscription_strcpy_EventURL(sub, "");
if (renewEventId != -1) {
/* do not remove timer event of copy */
/* invalid timer event id */
@ -35,62 +246,62 @@ void free_client_subscription(GenlibClientSubscription *sub)
free_upnp_timeout(event);
}
}
GenlibClientSubscription_set_RenewEventId(sub, -1);
UpnpClientSubscription_set_RenewEventId(sub, -1);
}
}
void freeClientSubList(GenlibClientSubscription *list)
void freeClientSubList(ClientSubscription *list)
{
GenlibClientSubscription *next;
ClientSubscription *next;
while (list) {
free_client_subscription(list);
next = GenlibClientSubscription_get_Next(list);
GenlibClientSubscription_delete(list);
next = UpnpClientSubscription_get_Next(list);
UpnpClientSubscription_delete(list);
list = next;
}
}
void RemoveClientSubClientSID(GenlibClientSubscription **head, const UpnpString *sid)
void RemoveClientSubClientSID(ClientSubscription **head, const UpnpString *sid)
{
GenlibClientSubscription *finger = *head;
GenlibClientSubscription *previous = NULL;
ClientSubscription *finger = *head;
ClientSubscription *previous = NULL;
int found = 0;
while (finger) {
found = !strcmp(
UpnpString_get_String(sid),
GenlibClientSubscription_get_SID_cstr(finger));
UpnpClientSubscription_get_SID_cstr(finger));
if (found) {
if (previous) {
GenlibClientSubscription_set_Next(previous,
GenlibClientSubscription_get_Next(finger));
UpnpClientSubscription_set_Next(previous,
UpnpClientSubscription_get_Next(finger));
} else {
*head = GenlibClientSubscription_get_Next(finger);
*head = UpnpClientSubscription_get_Next(finger);
}
GenlibClientSubscription_set_Next(finger, NULL);
UpnpClientSubscription_set_Next(finger, NULL);
freeClientSubList(finger);
finger = NULL;
} else {
previous = finger;
finger = GenlibClientSubscription_get_Next(finger);
finger = UpnpClientSubscription_get_Next(finger);
}
}
}
GenlibClientSubscription *GetClientSubClientSID(GenlibClientSubscription *head, const UpnpString *sid)
ClientSubscription *GetClientSubClientSID(ClientSubscription *head, const UpnpString *sid)
{
GenlibClientSubscription *next = head;
ClientSubscription *next = head;
int found = 0;
while (next) {
found = !strcmp(
GenlibClientSubscription_get_SID_cstr(next),
UpnpClientSubscription_get_SID_cstr(next),
UpnpString_get_String(sid));
if(found) {
break;
} else {
next = GenlibClientSubscription_get_Next(next);
next = UpnpClientSubscription_get_Next(next);
}
}
@ -98,22 +309,22 @@ GenlibClientSubscription *GetClientSubClientSID(GenlibClientSubscription *head,
}
GenlibClientSubscription *GetClientSubActualSID(GenlibClientSubscription *head, token *sid)
ClientSubscription *GetClientSubActualSID(ClientSubscription *head, token *sid)
{
GenlibClientSubscription *next = head;
ClientSubscription *next = head;
while (next) {
if (!memcmp(
GenlibClientSubscription_get_ActualSID_cstr(next),
UpnpClientSubscription_get_ActualSID_cstr(next),
sid->buff, sid->size)) {
break;
} else {
next = GenlibClientSubscription_get_Next(next);
next = UpnpClientSubscription_get_Next(next);
}
}
return next;
}
#endif /* EXCLUDE_GENA */
#endif /* INCLUDE_CLIENT_APIS */

View File

@ -55,9 +55,8 @@
/* entity positions */
#define NUM_HTTP_METHODS 11
#define NUM_HTTP_METHODS 9
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
{"DELETE", HTTPMETHOD_DELETE},
{"GET", HTTPMETHOD_GET},
{"HEAD", HTTPMETHOD_HEAD},
{"M-POST", HTTPMETHOD_MPOST},
@ -67,7 +66,6 @@ static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
{"SUBSCRIBE", HTTPMETHOD_SUBSCRIBE},
{"UNSUBSCRIBE", HTTPMETHOD_UNSUBSCRIBE},
{"POST", SOAPMETHOD_POST},
{"PUT", HTTPMETHOD_PUT}
};
#define NUM_HTTP_HEADER_NAMES 33

File diff suppressed because it is too large Load Diff

View File

@ -43,8 +43,6 @@
#include "webserver.h"
#include "FileInfo.h"
#include "httpparser.h"
#include "httpreadwrite.h"
#include "ithread.h"
@ -315,7 +313,7 @@ static UPNP_INLINE int get_content_type(
/*! [in] . */
const char *filename,
/*! [out] . */
OUT UpnpFileInfo *fileInfo)
DOMString *content_type)
{
const char *extension;
const char *type;
@ -325,7 +323,7 @@ static UPNP_INLINE int get_content_type(
size_t length = 0;
int rc = 0;
UpnpFileInfo_set_ContentType(fileInfo, NULL);
(*content_type) = NULL;
/* get ext */
extension = strrchr(filename, '.');
if (extension != NULL)
@ -345,9 +343,9 @@ static UPNP_INLINE int get_content_type(
free(temp);
return UPNP_E_OUTOF_MEMORY;
}
UpnpFileInfo_set_ContentType(fileInfo, temp);
(*content_type) = ixmlCloneDOMString(temp);
free(temp);
if (!UpnpFileInfo_get_ContentType(fileInfo))
if (!(*content_type))
return UPNP_E_OUTOF_MEMORY;
return 0;
@ -520,41 +518,39 @@ static int get_file_info(
/*! [out] File information object having file attributes such as filelength,
* when was the file last modified, whether a file or a directory and
* whether the file or directory is readable. */
OUT UpnpFileInfo *info)
struct File_Info *info)
{
int code;
struct stat s;
FILE *fp;
int rc = 0;
time_t aux_LastModified;
struct tm date;
char buffer[ASCTIME_R_BUFFER_SIZE];
UpnpFileInfo_set_ContentType(info, NULL);
ixmlFreeDOMString(info->content_type);
info->content_type = NULL;
code = stat(filename, &s);
if (code == -1)
return -1;
if (S_ISDIR(s.st_mode))
UpnpFileInfo_set_IsDirectory(info, TRUE);
info->is_directory = TRUE;
else if (S_ISREG(s.st_mode))
UpnpFileInfo_set_IsDirectory(info, FALSE);
info->is_directory = FALSE;
else
return -1;
/* check readable */
fp = fopen(filename, "r");
UpnpFileInfo_set_IsReadable(info, fp != NULL);
info->is_readable = (fp != NULL);
if (fp)
fclose(fp);
UpnpFileInfo_set_FileLength(info, s.st_size);
UpnpFileInfo_set_LastModified(info, s.st_mtime);
rc = get_content_type(filename, info);
aux_LastModified = UpnpFileInfo_get_LastModified(info);
info->file_length = s.st_size;
info->last_modified = s.st_mtime;
rc = get_content_type(filename, &info->content_type);
UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__,
"file info: %s, length: %lld, last_mod=%s readable=%d\n",
filename,
(long long)UpnpFileInfo_get_FileLength(info),
web_server_asctime_r(http_gmtime_r(&aux_LastModified, &date), buffer),
UpnpFileInfo_get_IsReadable(info));
filename, (long long)info->file_length,
web_server_asctime_r(http_gmtime_r(&info->last_modified, &date), buffer),
info->is_readable);
return rc;
}
@ -592,14 +588,15 @@ static UPNP_INLINE int get_alias(
struct xml_alias_t *alias,
/*! [out] File information object which will be filled up if the file
* comparison succeeds. */
UpnpFileInfo *info)
struct File_Info *info)
{
int cmp = strcmp(alias->name.buf, request_file);
if (cmp == 0) {
UpnpFileInfo_set_FileLength(info, (off_t)alias->doc.length);
UpnpFileInfo_set_IsDirectory(info, FALSE);
UpnpFileInfo_set_IsReadable(info, TRUE);
UpnpFileInfo_set_LastModified(info, alias->last_modified);
/* fill up info */
info->file_length = (off_t)alias->doc.length;
info->is_readable = TRUE;
info->is_directory = FALSE;
info->last_modified = alias->last_modified;
}
return cmp == 0;
@ -1041,8 +1038,7 @@ static int process_request(
int err_code;
char *request_doc;
UpnpFileInfo *finfo;
time_t aux_LastModified;
struct File_Info finfo;
int using_alias;
int using_virtual_dir;
uri_type *url;
@ -1062,7 +1058,7 @@ static int process_request(
/* init */
memset(&finfo, 0, sizeof(finfo));
request_doc = NULL;
finfo = UpnpFileInfo_new();
finfo.content_type = NULL;
alias_grabbed = FALSE;
err_code = HTTP_INTERNAL_SERVER_ERROR; /* default error */
using_virtual_dir = FALSE;
@ -1102,11 +1098,12 @@ static int process_request(
if (is_valid_alias(&gAliasDoc)) {
alias_grab(alias);
alias_grabbed = TRUE;
using_alias = get_alias(request_doc, alias, finfo);
using_alias = get_alias(request_doc, alias, &finfo);
if (using_alias == TRUE) {
UpnpFileInfo_set_ContentType(finfo,
"text/xml; charset=\"utf-8\"");
if (UpnpFileInfo_get_ContentType(finfo) == NULL) {
finfo.content_type =
ixmlCloneDOMString("text/xml");
if (finfo.content_type == NULL) {
goto error_handler;
}
}
@ -1116,12 +1113,12 @@ static int process_request(
if (req->method != HTTPMETHOD_POST) {
/* get file info */
if (virtualDirCallback.
get_info(filename->buf, finfo) != 0) {
get_info(filename->buf, &finfo) != 0) {
err_code = HTTP_NOT_FOUND;
goto error_handler;
}
/* try index.html if req is a dir */
if (UpnpFileInfo_get_IsDirectory(finfo)) {
if (finfo.is_directory) {
if (filename->buf[filename->length - 1] == '/') {
temp_str = "index.html";
} else {
@ -1132,14 +1129,16 @@ static int process_request(
goto error_handler;
}
/* get info */
if (virtualDirCallback.get_info(filename->buf, finfo) != UPNP_E_SUCCESS ||
UpnpFileInfo_get_IsDirectory(finfo)) {
if ((virtualDirCallback.
get_info(filename->buf,
&finfo) != UPNP_E_SUCCESS)
|| finfo.is_directory) {
err_code = HTTP_NOT_FOUND;
goto error_handler;
}
}
/* not readable */
if (!UpnpFileInfo_get_IsReadable(finfo)) {
if (!finfo.is_readable) {
err_code = HTTP_FORBIDDEN;
goto error_handler;
}
@ -1169,12 +1168,12 @@ static int process_request(
}
if (req->method != HTTPMETHOD_POST) {
/* get info on file */
if (get_file_info(filename->buf, finfo) != 0) {
if (get_file_info(filename->buf, &finfo) != 0) {
err_code = HTTP_NOT_FOUND;
goto error_handler;
}
/* try index.html if req is a dir */
if (UpnpFileInfo_get_IsDirectory(finfo)) {
if (finfo.is_directory) {
if (filename->buf[filename->length - 1] == '/') {
temp_str = "index.html";
} else {
@ -1185,14 +1184,14 @@ static int process_request(
goto error_handler;
}
/* get info */
if (get_file_info(filename->buf, finfo) != 0 ||
UpnpFileInfo_get_IsDirectory(finfo)) {
if (get_file_info(filename->buf, &finfo) != 0 ||
finfo.is_directory) {
err_code = HTTP_NOT_FOUND;
goto error_handler;
}
}
/* not readable */
if (!UpnpFileInfo_get_IsReadable(finfo)) {
if (!finfo.is_readable) {
err_code = HTTP_FORBIDDEN;
goto error_handler;
}
@ -1203,11 +1202,11 @@ static int process_request(
/* goto error_handler; */
/* } */
}
RespInstr->ReadSendSize = UpnpFileInfo_get_FileLength(finfo);
RespInstr->ReadSendSize = finfo.file_length;
/* Check other header field. */
code = CheckOtherHTTPHeaders(req, RespInstr,
UpnpFileInfo_get_FileLength(finfo));
if (code != HTTP_OK) {
if ((code =
CheckOtherHTTPHeaders(req, RespInstr,
finfo.file_length)) != HTTP_OK) {
err_code = code;
goto error_handler;
}
@ -1216,13 +1215,13 @@ static int process_request(
err_code = HTTP_OK;
goto error_handler;
}
extra_headers = UpnpFileInfo_get_ExtraHeaders(finfo);
/*extra_headers = UpnpFileInfo_get_ExtraHeaders(finfo); */
if (!extra_headers) {
extra_headers = "";
}
/* Check if chunked encoding should be used. */
if (using_virtual_dir && UpnpFileInfo_get_FileLength(finfo) == UPNP_USING_CHUNKED) {
if (using_virtual_dir && finfo.file_length == UPNP_USING_CHUNKED) {
/* Chunked encoding is only supported by HTTP 1.1 clients */
if (resp_major == 1 && resp_minor == 1) {
RespInstr->IsChunkActive = 1;
@ -1235,18 +1234,17 @@ static int process_request(
}
}
aux_LastModified = UpnpFileInfo_get_LastModified(finfo);
if (RespInstr->IsRangeActive && RespInstr->IsChunkActive) {
/* Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT */
/* Transfer-Encoding: chunked */
if (http_MakeMessage(headers, resp_major, resp_minor,
"R" "T" "GKLD" "s" "tcS" "Xc" "sCc",
HTTP_PARTIAL_CONTENT, /* status code */
UpnpFileInfo_get_ContentType(finfo), /* content type */
finfo.content_type, /* content type */
RespInstr, /* range info */
RespInstr, /* language info */
"LAST-MODIFIED: ",
&aux_LastModified,
&finfo.last_modified,
X_USER_AGENT, extra_headers) != 0) {
goto error_handler;
}
@ -1256,11 +1254,11 @@ static int process_request(
"R" "N" "T" "GLD" "s" "tcS" "Xc" "sCc",
HTTP_PARTIAL_CONTENT, /* status code */
RespInstr->ReadSendSize, /* content length */
UpnpFileInfo_get_ContentType(finfo), /* content type */
finfo.content_type, /* content type */
RespInstr, /* range info */
RespInstr, /* language info */
"LAST-MODIFIED: ",
&aux_LastModified,
&finfo.last_modified,
X_USER_AGENT, extra_headers) != 0) {
goto error_handler;
}
@ -1269,10 +1267,10 @@ static int process_request(
if (http_MakeMessage(headers, resp_major, resp_minor,
"RK" "TLD" "s" "tcS" "Xc" "sCc",
HTTP_OK, /* status code */
UpnpFileInfo_get_ContentType(finfo), /* content type */
finfo.content_type, /* content type */
RespInstr, /* language info */
"LAST-MODIFIED: ",
&aux_LastModified,
&finfo.last_modified,
X_USER_AGENT, extra_headers) != 0) {
goto error_handler;
}
@ -1283,10 +1281,10 @@ static int process_request(
"R" "N" "TLD" "s" "tcS" "Xc" "sCc",
HTTP_OK, /* status code */
RespInstr->ReadSendSize, /* content length */
UpnpFileInfo_get_ContentType(finfo), /* content type */
finfo.content_type, /* content type */
RespInstr, /* language info */
"LAST-MODIFIED: ",
&aux_LastModified,
&finfo.last_modified,
X_USER_AGENT,
extra_headers) != 0) {
goto error_handler;
@ -1295,10 +1293,10 @@ static int process_request(
if (http_MakeMessage(headers, resp_major, resp_minor,
"R" "TLD" "s" "tcS" "Xc" "sCc",
HTTP_OK, /* status code */
UpnpFileInfo_get_ContentType(finfo), /* content type */
finfo.content_type, /* content type */
RespInstr, /* language info */
"LAST-MODIFIED: ",
&aux_LastModified,
&finfo.last_modified,
X_USER_AGENT,
extra_headers) != 0) {
goto error_handler;
@ -1325,7 +1323,7 @@ static int process_request(
error_handler:
free(request_doc);
UpnpFileInfo_delete(finfo);
ixmlFreeDOMString(finfo.content_type);
if (err_code != HTTP_OK && alias_grabbed) {
alias_release(alias);
}
@ -1356,7 +1354,7 @@ static int http_RecvPostMessage(
{
size_t Data_Buf_Size = 1024;
char Buf[1024];
int Timeout = -1;
int Timeout = 0;
FILE *Fp;
parse_status_t status = PARSE_OK;
int ok_on_close = FALSE;
@ -1467,7 +1465,7 @@ void web_server_callback(http_parser_t *parser, INOUT http_message_t *req,
SOCKINFO *info)
{
int ret;
int timeout = -1;
int timeout = 0;
enum resp_type rtype = 0;
membuffer headers;
membuffer filename;

View File

@ -57,19 +57,10 @@
#include <time.h>
#include <string.h>
#ifdef UPNP_ENABLE_OPEN_SSL
#include <openssl/ssl.h>
#endif
#ifndef MSG_NOSIGNAL
#define MSG_NOSIGNAL 0
#endif
#ifdef UPNP_ENABLE_OPEN_SSL
/* OpenSSL context defined in upnpapi.c */
extern SSL_CTX *gSslCtx;
#endif
int sock_init(SOCKINFO *info, SOCKET sockfd)
{
assert(info);
@ -96,38 +87,12 @@ int sock_init_with_ip(SOCKINFO *info, SOCKET sockfd,
return UPNP_E_SUCCESS;
}
#ifdef UPNP_ENABLE_OPEN_SSL
int sock_ssl_connect(SOCKINFO *info)
{
int status = 0;
info->ssl = SSL_new(gSslCtx);
if (!info->ssl) {
return UPNP_E_SOCKET_ERROR;
}
status = SSL_set_fd(info->ssl, info->socket);
if (status == 1) {
status = SSL_connect(info->ssl);
}
if (status == 1) {
return UPNP_E_SUCCESS;
}
return UPNP_E_SOCKET_ERROR;
}
#endif
int sock_destroy(SOCKINFO *info, int ShutdownMethod)
{
int ret = UPNP_E_SUCCESS;
char errorBuffer[ERROR_BUFFER_LEN];
if (info->socket != INVALID_SOCKET) {
#ifdef UPNP_ENABLE_OPEN_SSL
if (info->ssl) {
SSL_shutdown(info->ssl);
SSL_free(info->ssl);
info->ssl = NULL;
}
#endif
if (shutdown(info->socket, ShutdownMethod) == -1) {
strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN);
UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__,
@ -174,6 +139,8 @@ static int sock_read_write(
size_t byte_left = (size_t)0;
ssize_t num_written;
if (*timeoutSecs < 0)
return UPNP_E_TIMEDOUT;
FD_ZERO(&readSet);
FD_ZERO(&writeSet);
if (bRead)
@ -183,7 +150,7 @@ static int sock_read_write(
timeout.tv_sec = *timeoutSecs;
timeout.tv_usec = 0;
while (TRUE) {
if (*timeoutSecs < 0)
if (*timeoutSecs == 0)
retCode = select(sockfd + 1, &readSet, &writeSet,
NULL, NULL);
else
@ -208,36 +175,16 @@ static int sock_read_write(
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
#endif
if (bRead) {
#ifdef UPNP_ENABLE_OPEN_SSL
if (info->ssl) {
numBytes = (long)SSL_read(info->ssl,
buffer, (size_t)bufsize);
}
else {
#endif
/* read data. */
numBytes = (long)recv(sockfd, buffer, bufsize, MSG_NOSIGNAL);
#ifdef UPNP_ENABLE_OPEN_SSL
}
#endif
} else {
byte_left = bufsize;
bytes_sent = 0;
while (byte_left != (size_t)0) {
#ifdef UPNP_ENABLE_OPEN_SSL
if (info->ssl) {
num_written = SSL_write(info->ssl,
buffer + bytes_sent, byte_left);
}
else {
#endif
/* write data. */
num_written = send(sockfd,
buffer + bytes_sent, byte_left,
MSG_DONTROUTE | MSG_NOSIGNAL);
#ifdef UPNP_ENABLE_OPEN_SSL
}
#endif
if (num_written == -1) {
#ifdef SO_NOSIGPIPE
setsockopt(sockfd, SOL_SOCKET,

View File

@ -2,7 +2,7 @@
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
* Copyright (c) 2012 France Telecom All rights reserved.
* Copyright (c) 2012 France Telecom All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -325,7 +325,6 @@ static int parse_hostport(
const char *in,
/*! [out] Output parameter where the host and port are represented as
* an internet address. */
unsigned short int defaultPort,
hostport_type *out)
{
char workbuf[256];
@ -421,7 +420,7 @@ found:
return UPNP_E_INVALID_URL;
} else
/* Port was not specified, use default port. */
port = defaultPort;
port = 80u;
/* The length of the host and port string can be calculated by */
/* subtracting pointers. */
hostport_size = (size_t)c - (size_t)workbuf;
@ -709,7 +708,6 @@ int parse_uri(const char *in, size_t max, uri_type *out)
int begin_path = 0;
size_t begin_hostport = (size_t)0;
size_t begin_fragment = (size_t)0;
unsigned short int defaultPort = 80;
begin_hostport = parse_scheme(in, max, &out->scheme);
if (begin_hostport) {
@ -724,11 +722,7 @@ int parse_uri(const char *in, size_t max, uri_type *out)
in[begin_hostport] == '/' &&
in[begin_hostport + (size_t)1] == '/') {
begin_hostport += (size_t)2;
if (token_string_casecmp(&out->scheme, "https") == 0) {
defaultPort = 443;
}
begin_path = parse_hostport(&in[begin_hostport],
defaultPort,
&out->hostport);
if (begin_path >= 0) {
begin_path += (int)begin_hostport;

View File

@ -1,28 +0,0 @@
#ifndef CLIENTSUBSCRIPTION_H
#define CLIENTSUBSCRIPTION_H
/*!
* \file
*
* \brief GenlibClientSubscription object declararion.
*
* \author Marcelo Roberto Jimenez
*/
#define CLASS GenlibClientSubscription
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, RenewEventId, int) \
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
EXPAND_CLASS_MEMBER_STRING(CLASS, ActualSID) \
EXPAND_CLASS_MEMBER_STRING(CLASS, EventURL) \
EXPAND_CLASS_MEMBER_INT(CLASS, Next, GenlibClientSubscription *) \
#include "TemplateInclude.h"
#endif /* CLIENTSUBSCRIPTION_H */

View File

@ -13,7 +13,6 @@ extern "C" {
#endif
#include "ClientSubscription.h"
#include "service_table.h"
#include "upnp.h"
#include "UpnpString.h"
@ -33,6 +32,154 @@ extern TimerThread gTimerThread;
#ifdef INCLUDE_CLIENT_APIS
typedef struct s_ClientSubscription ClientSubscription;
/*!
* \brief Constructor.
*/
ClientSubscription *UpnpClientSubscription_new();
/*!
* \brief Destructor.
*/
void UpnpClientSubscription_delete(
/*! [in] The \b this pointer. */
ClientSubscription *p);
/*!
* \brief Copy Constructor.
*/
ClientSubscription *UpnpClientSubscription_dup(
/*! [in] The \b this pointer. */
const ClientSubscription *p);
/*!
* \brief Assignment operator.
*/
void UpnpClientSubscription_assign(
/*! [in] The \b this pointer. */
ClientSubscription *q,
const ClientSubscription *p);
/*!
* \brief
*/
int UpnpClientSubscription_get_RenewEventId(
/*! [in] The \b this pointer. */
const ClientSubscription *p);
/*!
* \brief
*/
void UpnpClientSubscription_set_RenewEventId(
/*! [in] The \b this pointer. */
ClientSubscription *p,
/*! [in] . */
int n);
/*!
* \brief
*/
const UpnpString *UpnpClientSubscription_get_SID(
/*! [in] The \b this pointer. */
const ClientSubscription *p);
/*!
* \brief
*/
void UpnpClientSubscription_set_SID(
/*! [in] The \b this pointer. */
ClientSubscription *p,
const UpnpString *s);
/*!
* \brief
*/
void UpnpClientSubscription_strcpy_SID(
/*! [in] The \b this pointer. */
ClientSubscription *p,
const char *s);
/*!
* \brief
*/
const UpnpString *UpnpClientSubscription_get_ActualSID(
/*! [in] The \b this pointer. */
const ClientSubscription *p);
/*!
* \brief
*/
void UpnpClientSubscription_set_ActualSID(
/*! [in] The \b this pointer. */
ClientSubscription *p,
const UpnpString *s);
/*!
* \brief
*/
void UpnpClientSubscription_strcpy_ActualSID(
/*! [in] The \b this pointer. */
ClientSubscription *p,
const char *s);
/*!
* \brief
*/
const UpnpString *UpnpClientSubscription_get_EventURL(
/*! [in] The \b this pointer. */
const ClientSubscription *p);
/*!
* \brief
*/
void UpnpClientSubscription_set_EventURL(
/*! [in] The \b this pointer. */
ClientSubscription *p,
const UpnpString *s);
/*!
* \brief
*/
void UpnpClientSubscription_strcpy_EventURL(
/*! [in] The \b this pointer. */
ClientSubscription *p,
const char *s);
/*!
* \brief
*/
ClientSubscription *UpnpClientSubscription_get_Next(
/*! [in] The \b this pointer. */
const ClientSubscription *p);
/*!
* \brief
*/
void UpnpClientSubscription_set_Next(
/*! [in] The \b this pointer. */
ClientSubscription *p,
ClientSubscription *q);
/*!
* \brief Free memory allocated for client subscription data.
*
@ -40,7 +187,7 @@ extern TimerThread gTimerThread;
*/
void free_client_subscription(
/*! [in] Client subscription to be freed. */
GenlibClientSubscription *sub);
ClientSubscription *sub);
/*!
@ -48,7 +195,7 @@ void free_client_subscription(
*/
void freeClientSubList(
/*! [in] Client subscription list to be freed. */
GenlibClientSubscription *list);
ClientSubscription *list);
/*!
@ -58,7 +205,7 @@ void freeClientSubList(
*/
void RemoveClientSubClientSID(
/*! [in] Head of the subscription list. */
GenlibClientSubscription **head,
ClientSubscription **head,
/*! [in] Subscription ID to be mactched. */
const UpnpString *sid);
@ -69,9 +216,9 @@ void RemoveClientSubClientSID(
*
* \return The matching subscription.
*/
GenlibClientSubscription *GetClientSubClientSID(
ClientSubscription *GetClientSubClientSID(
/*! [in] Head of the subscription list. */
GenlibClientSubscription *head,
ClientSubscription *head,
/*! [in] Subscription ID to be mactched. */
const UpnpString *sid);
@ -82,9 +229,9 @@ GenlibClientSubscription *GetClientSubClientSID(
*
* \return The matching subscription.
*/
GenlibClientSubscription *GetClientSubActualSID(
ClientSubscription *GetClientSubActualSID(
/*! [in] Head of the subscription list. */
GenlibClientSubscription *head,
ClientSubscription *head,
/*! [in] Subscription ID to be mactched. */
token *sid);

View File

@ -86,20 +86,16 @@ typedef enum
/* end of private section. */
/* method in a HTTP request.
* IMPORTANT: The enum values of the standard HTTP method should match
* those of Upnp_HttpMethod enum defined in upnp.h */
/* method in a HTTP request. */
typedef enum
{
HTTPMETHOD_PUT = 0,
HTTPMETHOD_DELETE = 1,
HTTPMETHOD_GET = 2,
HTTPMETHOD_HEAD = 3,
HTTPMETHOD_POST = 4,
HTTPMETHOD_POST,
HTTPMETHOD_MPOST,
HTTPMETHOD_SUBSCRIBE,
HTTPMETHOD_UNSUBSCRIBE,
HTTPMETHOD_NOTIFY,
HTTPMETHOD_GET,
HTTPMETHOD_HEAD,
HTTPMETHOD_MSEARCH,
HTTPMETHOD_UNKNOWN,
SOAPMETHOD_POST,

View File

@ -229,6 +229,111 @@ int http_Download(
OUT char* content_type );
/************************************************************************
* Function: http_WriteHttpPost
*
* Parameters:
* IN void *Handle: Handle to the http post object
* IN char *buf: Buffer to send to peer, if format used
* is not UPNP_USING_CHUNKED,
* IN size_t *size: Size of the data to be sent.
* IN int timeout: time out value
*
* Description:
* Formats data if format used is UPNP_USING_CHUNKED.
* Writes data on the socket connected to the peer.
*
* Return: int
* UPNP_E_SUCCESS - On Success
* UPNP_E_INVALID_PARAM - Invalid Parameter
* -1 - On Socket Error.
************************************************************************/
int http_WriteHttpPost(IN void *Handle,
IN char *buf,
IN size_t *size,
IN int timeout);
/************************************************************************
* Function: http_CloseHttpPost
*
* Parameters:
* IN void *Handle; Handle to the http post object
* IN OUT int *httpStatus; HTTP status returned on receiving a
* response message
* IN int timeout; time out value
*
* Description:
* Sends remaining data if using UPNP_USING_CHUNKED
* format. Receives any more messages. Destroys socket and any socket
* associated memory. Frees handle associated with the HTTP POST msg.
*
* Return: int
* UPNP_E_SUCCESS - On success
* UPNP_E_INVALID_PARAM - Invalid Parameter
************************************************************************/
int http_CloseHttpPost(IN void *Handle,
IN OUT int *httpStatus,
IN int timeout);
/************************************************************************
* Function: http_OpenHttpPost
*
* Parameters:
* IN const char *url_str; String as a URL
* IN OUT void **Handle; Pointer to buffer to store HTTP
* post handle
* IN const char *contentType; Type of content
* IN int contentLength; length of content
* IN int timeout; time out value
*
* Description:
* Makes the HTTP POST message, connects to the peer,
* sends the HTTP POST request. Adds the post handle to buffer of
* such handles
*
* Return : int;
* UPNP_E_SUCCESS - On success
* UPNP_E_INVALID_PARAM - Invalid Parameter
* UPNP_E_OUTOF_MEMORY
* UPNP_E_SOCKET_ERROR
* UPNP_E_SOCKET_CONNECT
************************************************************************/
int http_OpenHttpPost(IN const char *url_str,
IN OUT void **Handle,
IN const char *contentType,
IN int contentLength,
IN int timeout);
/************************************************************************
* Function: http_ReadHttpGet
*
* Parameters:
* IN void *Handle; Handle to the HTTP get object
* IN OUT char *buf; Buffer to get the read and parsed data
* IN OUT size_t *size; Size of the buffer passed
* IN int timeout; time out value
*
* Description:
* Parses already existing data, then gets new data.
* Parses and extracts information from the new data.
*
* Return: int
* UPNP_E_SUCCESS - On success
* UPNP_E_INVALID_PARAM - Invalid Parameter
* UPNP_E_BAD_RESPONSE
* UPNP_E_BAD_HTTPMSG
* UPNP_E_CANCELED
************************************************************************/
int http_ReadHttpGet(
IN void *Handle,
IN OUT char *buf,
IN OUT size_t *size,
IN int timeout);
/************************************************************************
* Function: http_HttpGetProgress
*
@ -249,242 +354,79 @@ int http_HttpGetProgress(
OUT size_t *length,
OUT size_t *total);
/************************************************************************
* Function: http_CloseHttpGet
*
* Parameters:
* IN void *Handle; Handle to HTTP get object
*
* Description:
* Clears the handle allocated for the HTTP GET operation
* Clears socket states and memory allocated for socket operations.
*
* Return: int
* UPNP_E_SUCCESS - On Success
* UPNP_E_INVALID_PARAM - Invalid Parameter
************************************************************************/
int http_CloseHttpGet(IN void *Handle);
/*!
* \brief Opens a connection to the server.
* \brief Makes the HTTP GET message, connects to the peer,
* sends the HTTP GET request, gets the response and parses the response.
*
* The SDK allocates the memory for \b handle, the
* application is responsible for freeing this memory.
* If a proxy URL is defined then the connection is made there.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b url, or \b handle
* is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
* resources or an error occurred binding a socket.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
* \return integer
* \li \c UPNP_E_SUCCESS - On Success
* \li \c UPNP_E_INVALID_PARAM - Invalid Paramters
* \li \c UPNP_E_OUTOF_MEMORY
* \li \c UPNP_E_SOCKET_ERROR
* \li \c UPNP_E_BAD_RESPONSE
*/
EXPORT_SPEC int http_OpenHttpConnection(
/*! [in] The URL which contains the host, and the scheme to make the connection. */
const char *url,
/*! [in,out] A pointer in which to store the handle for this connection. This
* handle is required for futher operations over this connection. */
void **handle,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Makes a HTTP request using a connection previously created by
* \b UpnpOpenHttpConnection.
*
* \note Trying to make another request while a request is already being processed
* results in undefined behavior. It's up to the user to end a previous
* request by calling \b UpnpEndHttpRequest.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle
* or \b contentType is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
* resources or an error occurred binding a socket.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int http_MakeHttpRequest(
/* ![in] The method to use to make the request. */
Upnp_HttpMethod method,
/*! [in] The URL to use to make the request. The URL should use the same
* host and scheme used to create the connection. */
const char *url,
/*! [in] The handle to the connection. */
void *handle,
/*! [in] Headers to be used for the request. Each header should be terminated by a CRLF as specified
* in the HTTP specification. If NULL then the default headers will be used. */
UpnpString *headers,
/*! [in] The media type of content being sent. Can be NULL. */
const char *contentType,
/*! [in] The length of the content being sent, in bytes. Set to \b UPNP_USING_CHUNKED to use
* chunked encoding, or \b UPNP_UNTIL_CLOSE to avoid specifying the content length to the server.
* In this case the request is considered unfinished until the connection is closed. */
int contentLength,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Writes the content of a HTTP request initiated by a \b UpnpMakeHttpRequest call.
* The end of the content should be indicated by a call to \b UpnpEndHttpRequest
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
* or \b size is not a valid pointer.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int http_WriteHttpRequest(
/*! [in] The handle of the connection created by the call to
* \b UpnpOpenHttpConnection. */
void *handle,
/*! [in] The buffer containing date to be written. */
char *buf,
/*! [in] The size, in bytes of \b buf. */
size_t *size,
/*! [in] A timeout value sent with the request during which a response is
* expected from the server, failing which, an error is reported. If
* value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Indicates the end of a HTTP request previously made by
* \b UpnpMakeHttpRequest.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
* resources or an error occurred binding a socket.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int http_EndHttpRequest(
/*! [in] The handle to the connection. */
void *handle,
/*! [in] The time out value sent with the request during which a response
* is expected from the receiver, failing which, an error is reported.
* If value is negative, timeout is infinite. */
int timeout);
/*!
* \brief Gets the response from the server using a connection previously created
* by \b UpnpOpenHttpConnection
*
* \note Memory for \b contentType is only valid until the next call to the HTTP API
* for the same connection.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b handle,
* \b contentType, \b contentLength or \b httpStatus
* is not a valid pointer.
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
* URL.
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
* download this file.
* \li \c UPNP_E_NETWORK_ERROR: A network error occurred.
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
* to a socket.
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
* from a socket.
* \li \c UPNP_E_SOCKET_BIND: An error occurred binding a socket.
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
* socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
* remote server.
*/
EXPORT_SPEC int http_GetHttpResponse(
/*! [in] The handle of the connection created by the call to
* \b UpnpOpenHttpConnection. */
void *handle,
/*! [in] Headers sent by the server for the response. If NULL then the
* headers are not copied. */
UpnpString *headers,
/*! [out] A buffer to store the media type of the item. */
int http_OpenHttpGet(
/* [in] String as a URL. */
const char *url_str,
/* [in,out] Pointer to buffer to store HTTP post handle. */
void **Handle,
/* [in,out] Type of content. */
char **contentType,
/*! [out] A pointer to store the length of the item. */
/* [out] length of content. */
int *contentLength,
/*! [out] The status returned on receiving a response message. */
/* [out] HTTP status returned on receiving a response message. */
int *httpStatus,
/*! [in] The time out value sent with the request during which a response
* is expected from the server, failing which, an error is reported
* back to the user. If value is negative, timeout is infinite. */
/* [in] time out value. */
int timeout);
/*!
* \brief Reads the content of a response using a connection previously created
* by \b UpnpOpenHttpConnection.
* \brief Makes the HTTP GET message, connects to the peer,
* sends the HTTP GET request, gets the response and parses the response.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
* or \b size is not a valid pointer.
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
* remote server.
* \li \c UPNP_E_BAD_HTTPMSG: Either the request or response was in
* the incorrect format.
* \li \c UPNP_E_CANCELED: another thread called UpnpCancelHttpGet.
* If a proxy URL is defined then the connection is made there.
*
* Note: In case of return values, the status code parameter of the passed
* in handle value may provide additional information on the return
* value.
* \return integer
* \li \c UPNP_E_SUCCESS - On Success
* \li \c UPNP_E_INVALID_PARAM - Invalid Paramters
* \li \c UPNP_E_OUTOF_MEMORY
* \li \c UPNP_E_SOCKET_ERROR
* \li \c UPNP_E_BAD_RESPONSE
*/
EXPORT_SPEC int http_ReadHttpResponse(
/*! [in] The handle of the connection created by the call to
* \b UpnpOpenHttpConnection. */
void *handle,
/*! [in,out] The buffer to store the read item. */
char *buf,
/*! [in,out] The size of the buffer to be read. */
size_t *size,
/*! [in] The time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported back to
* the user. If value is negative, timeout is infinite. */
int http_OpenHttpGetProxy(
/* [in] String as a URL. */
const char *url_str,
/* [in] String as a URL. */
const char *proxy_str,
/* [in,out] Pointer to buffer to store HTTP post handle. */
void **Handle,
/* [in,out] Type of content. */
char **contentType,
/* [out] length of content. */
int *contentLength,
/* [out] HTTP status returned on receiving a response message. */
int *httpStatus,
/* [in] time out value. */
int timeout);
/*!
* \brief Closes the connection created with \b UpnpOpenHttpConnection
* and frees any memory associated with the connection.
*
* \return An integer representing one of the following:
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
* \li \c UPNP_E_INVALID_PARAM: \b handle, or is not a valid pointer.
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
* from a socket.
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
* allocated.
*/
EXPORT_SPEC int http_CloseHttpConnection(
/*! [in] The handle of the connection to close, created by the call to
* \b UpnpOpenHttpPost. */
void *handle);
/************************************************************************
* Function: http_SendStatusResponse
*

View File

@ -41,12 +41,8 @@
* \file
*/
#include "upnpconfig.h"
#include "UpnpInet.h" /* for SOCKET, netinet/in */
#include "UpnpGlobal.h" /* for UPNP_INLINE */
#ifdef UPNP_ENABLE_OPEN_SSL
#include <openssl/ssl.h>
#endif
/* The following are not defined under winsock.h */
#ifndef SD_RECEIVE
@ -62,9 +58,6 @@ typedef struct
SOCKET socket;
/*! The following two fields are filled only in incoming requests. */
struct sockaddr_storage foreign_sockaddr;
#ifdef UPNP_ENABLE_OPEN_SSL
SSL *ssl;
#endif
} SOCKINFO;
#ifdef __cplusplus
@ -120,20 +113,6 @@ int sock_init_with_ip(
/*! [in] Remote socket address. */
struct sockaddr *foreign_sockaddr);
/*!
* \brief Associates an SSL object with the socket and begins
* the client-side SSL/TLS handshake.
*
* \return Integer:
* \li \c UPNP_E_SUCCESS
* \li \c UPNP_E_SOCKET_ERROR
*/
#ifdef UPNP_ENABLE_OPEN_SSL
int sock_ssl_connect(
/*! [out] Socket Information Object. */
SOCKINFO* info);
#endif
/*!
* \brief Shutsdown the socket using the ShutdownMethod to indicate whether
* sends and receives on the socket will be dis-allowed.

View File

@ -113,7 +113,7 @@ struct Handle_Info
/* Client only */
#ifdef INCLUDE_CLIENT_APIS
/*! Client subscription list. */
GenlibClientSubscription *ClientSubList;
ClientSubscription *ClientSubList;
/*! Active SSDP searches. */
LinkedList SsdpSearchList;
#endif

View File

@ -39,7 +39,6 @@
#ifdef INCLUDE_DEVICE_APIS
#if EXCLUDE_SOAP == 0
#include "ActionRequest.h"
#include "httpparser.h"
#include "httpreadwrite.h"
#include "parsetools.h"
@ -298,52 +297,46 @@ static UPNP_INLINE void handle_query_variable(
/*! [in] Node containing variable name. */
IXML_Node *req_node)
{
UpnpStateVarRequest *variable = UpnpStateVarRequest_new();
struct Upnp_State_Var_Request variable;
const char *err_str;
int err_code;
const DOMString var_name;
/* set default error */
err_code = SOAP_INVALID_VAR;
err_str = Soap_Invalid_Var;
if (variable == NULL) {
err_code = SOAP_MEMORY_OUT;
err_str = Soap_Memory_out;
goto error_handler;
}
UpnpStateVarRequest_set_ErrCode(variable, UPNP_E_SUCCESS);
UpnpStateVarRequest_strcpy_DevUDN(variable, soap_info->dev_udn);
UpnpStateVarRequest_strcpy_ServiceID(variable, soap_info->service_id);
variable.ErrCode = UPNP_E_SUCCESS;
linecopy(variable.ErrStr, "");
namecopy(variable.DevUDN, soap_info->dev_udn);
namecopy(variable.ServiceID, soap_info->service_id);
var_name = ixmlNode_getNodeValue(req_node);
UpnpStateVarRequest_strcpy_StateVarName(variable, var_name);
UpnpStateVarRequest_set_CtrlPtIPAddr(variable, &info->foreign_sockaddr);
namecopy(variable.StateVarName, var_name);
variable.CtrlPtIPAddr = info->foreign_sockaddr;
variable.CurrentVal = NULL;
/* send event */
soap_info->callback(UPNP_CONTROL_GET_VAR_REQUEST, variable,
soap_info->callback(UPNP_CONTROL_GET_VAR_REQUEST, &variable,
soap_info->cookie);
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__,
"Return from callback for var request\n");
"Return from callback for var request\n");
/* validate, and handle result */
if (UpnpStateVarRequest_get_CurrentVal(variable) == NULL)
goto error_handler;
if (UpnpStateVarRequest_get_ErrCode(variable) != UPNP_E_SUCCESS) {
if (UpnpString_get_Length(UpnpStateVarRequest_get_ErrStr(variable)) > 0) {
err_code = UpnpStateVarRequest_get_ErrCode(variable);
err_str = UpnpStateVarRequest_get_ErrStr_cstr(variable);
if (variable.CurrentVal == NULL) {
send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var,
request);
return;
}
if (variable.ErrCode != UPNP_E_SUCCESS) {
if (strlen(variable.ErrStr) == 0) {
err_code = SOAP_INVALID_VAR;
err_str = Soap_Invalid_Var;
} else {
err_code = variable.ErrCode;
err_str = variable.ErrStr;
}
goto error_handler;
send_error_response(info, err_code, err_str, request);
ixmlFreeDOMString(variable.CurrentVal);
return;
}
/* send response */
send_var_query_response(info, UpnpStateVarRequest_get_CurrentVal(variable), request);
err_code = 0;
/* error handling and cleanup */
error_handler:
UpnpStateVarRequest_delete(variable);
if (err_code != 0)
send_error_response(info, err_code, err_str, request);
send_var_query_response(info, variable.CurrentVal, request);
ixmlFreeDOMString(variable.CurrentVal);
}
/*!
@ -360,12 +353,12 @@ static void handle_invoke_action(
IXML_Node *req_node)
{
char save_char;
UpnpActionRequest *action = UpnpActionRequest_new();
IXML_Document *actionRequestDoc = NULL;
IXML_Document *actionResultDoc = NULL;
IXML_Document *req_doc = NULL;
struct Upnp_Action_Request action;
int err_code;
const char *err_str;
memptr action_name;
action.ActionResult = NULL;
DOMString act_node = NULL;
/* null-terminate */
@ -379,7 +372,7 @@ static void handle_invoke_action(
err_str = Soap_Memory_out;
goto error_handler;
}
err_code = ixmlParseBufferEx(act_node, &actionRequestDoc);
err_code = ixmlParseBufferEx(act_node, &req_doc);
if (err_code != IXML_SUCCESS) {
if (IXML_INSUFFICIENT_MEMORY == err_code) {
err_code = SOAP_MEMORY_OUT;
@ -390,46 +383,45 @@ static void handle_invoke_action(
}
goto error_handler;
}
UpnpActionRequest_set_ErrCode(action, UPNP_E_SUCCESS);
UpnpActionRequest_strcpy_ActionName(action, action_name.buf);
UpnpActionRequest_strcpy_DevUDN(action, soap_info->dev_udn);
UpnpActionRequest_strcpy_ServiceID(action, soap_info->service_id);
UpnpActionRequest_set_ActionRequest(action, actionRequestDoc);
UpnpActionRequest_set_ActionResult(action, NULL);
UpnpActionRequest_set_CtrlPtIPAddr(action, &info->foreign_sockaddr);
action.ErrCode = UPNP_E_SUCCESS;
linecopy(action.ErrStr, "");
namecopy(action.ActionName, action_name.buf);
namecopy(action.DevUDN, soap_info->dev_udn);
namecopy(action.ServiceID, soap_info->service_id);
action.ActionRequest = req_doc;
action.ActionResult = NULL;
action.CtrlPtIPAddr = info->foreign_sockaddr;
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__, "Calling Callback\n");
soap_info->callback(UPNP_CONTROL_ACTION_REQUEST, action, soap_info->cookie);
err_code = UpnpActionRequest_get_ErrCode(action);
if (err_code != UPNP_E_SUCCESS) {
err_str = UpnpActionRequest_get_ErrStr_cstr(action);
if (strlen(err_str) <= 0) {
soap_info->callback(UPNP_CONTROL_ACTION_REQUEST, &action, soap_info->cookie);
if (action.ErrCode != UPNP_E_SUCCESS) {
if (strlen(action.ErrStr) <= 0) {
err_code = SOAP_ACTION_FAILED;
err_str = Soap_Action_Failed;
} else {
err_code = action.ErrCode;
err_str = action.ErrStr;
}
goto error_handler;
}
/* validate, and handle action error */
actionResultDoc = UpnpActionRequest_get_ActionResult(action);
if (actionResultDoc == NULL) {
if (action.ActionResult == NULL) {
err_code = SOAP_ACTION_FAILED;
err_str = Soap_Action_Failed;
goto error_handler;
}
/* send response */
send_action_response(info, actionResultDoc, request);
send_action_response(info, action.ActionResult, request);
err_code = 0;
/* error handling and cleanup */
error_handler:
ixmlDocument_free(actionResultDoc);
ixmlDocument_free(actionRequestDoc);
ixmlDocument_free(action.ActionResult);
ixmlDocument_free(req_doc);
ixmlFreeDOMString(act_node);
/* restore */
action_name.buf[action_name.length] = save_char;
if (err_code != 0)
send_error_response(info, err_code, err_str, request);
UpnpActionRequest_delete(action);
}
/*!

View File

@ -1,22 +0,0 @@
/*!
* \file
*
* \brief SSDPResultData object implementation.
*
* \author Marcelo Roberto Jimenez
*/
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "ssdp_ResultData.h"
void SSDPResultData_Callback(const SSDPResultData *p)
{
Upnp_FunPtr callback = SSDPResultData_get_CtrlptCallback(p);
callback(UPNP_DISCOVERY_SEARCH_RESULT,
SSDPResultData_get_Param(p),
SSDPResultData_get_Cookie(p));
}

View File

@ -1,4 +1,3 @@
#ifndef SSDP_RESULTDATA_H
#define SSDP_RESULTDATA_H
@ -14,37 +13,14 @@
* \author Marcelo Roberto Jimenez
*/
/******************************************************************************/
#ifdef TEMPLATE_GENERATE_SOURCE
#undef TEMPLATE_GENERATE_SOURCE
#include "Discovery.h" /* for UpnpDiscovery */
#define TEMPLATE_GENERATE_SOURCE
#else /* TEMPLATE_GENERATE_SOURCE */
#include "Discovery.h" /* for UpnpDiscovery */
#endif /* TEMPLATE_GENERATE_SOURCE */
/******************************************************************************/
#include "Callback.h" /* for Upnp_FunPtr */
#define CLASS SSDPResultData
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_OBJECT(CLASS, Param, UpnpDiscovery) \
EXPAND_CLASS_MEMBER_INT(CLASS, Cookie, void *) \
EXPAND_CLASS_MEMBER_INT(CLASS, CtrlptCallback, Upnp_FunPtr) \
#include "TemplateInclude.h"
/*! */
void SSDPResultData_Callback(const SSDPResultData *p);
/*! Structure to contain Discovery response. */
typedef struct resultData
{
struct Upnp_Discovery param;
void *cookie;
Upnp_FunPtr ctrlpt_callback;
} ResultData;
/* @} SSDPlib */
#endif /* SSDP_RESULTDATA_H */

View File

@ -2,6 +2,7 @@
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
* Copyright (C) 2012 France Telecom All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -69,10 +70,11 @@ static void send_search_result(
/* [in] Search reply from the device. */
IN void *data)
{
SSDPResultData *temp = (SSDPResultData *)data;
ResultData *temp = (ResultData *) data;
SSDPResultData_Callback(temp);
SSDPResultData_delete(temp);
temp->ctrlpt_callback(UPNP_DISCOVERY_SEARCH_RESULT, &temp->param,
temp->cookie);
free(temp);
}
void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_addr,
@ -83,9 +85,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
memptr hdr_value;
/* byebye or alive */
int is_byebye;
UpnpDiscovery *param = UpnpDiscovery_new();
int expires;
int ret;
struct Upnp_Discovery param;
SsdpEvent event;
int nt_found;
int usn_found;
@ -97,7 +97,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
ListNode *node = NULL;
SsdpSearchArg *searchArg = NULL;
int matched = 0;
SSDPResultData *threadData = NULL;
ResultData *threadData = NULL;
ThreadPoolJob job;
memset(&job, 0, sizeof(job));
@ -107,7 +107,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
if (GetClientHandleInfo(&handle, &ctrlpt_info) != HND_CLIENT) {
HandleUnlock();
goto end_ssdp_handle_ctrlpt_msg;
return;
}
/* copy */
ctrlpt_callback = ctrlpt_info->Callback;
@ -116,43 +116,45 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
/* search timeout */
if (timeout) {
ctrlpt_callback(UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie);
goto end_ssdp_handle_ctrlpt_msg;
return;
}
UpnpDiscovery_set_ErrCode(param, UPNP_E_SUCCESS);
param.ErrCode = UPNP_E_SUCCESS;
/* MAX-AGE, assume error */
expires = -1;
UpnpDiscovery_set_Expires(param, expires);
param.Expires = -1;
if (httpmsg_find_hdr(hmsg, HDR_CACHE_CONTROL, &hdr_value) != NULL) {
ret = matchstr(hdr_value.buf, hdr_value.length,
"%imax-age = %d%0", &expires);
UpnpDiscovery_set_Expires(param, expires);
if (ret != PARSE_OK)
goto end_ssdp_handle_ctrlpt_msg;
if (matchstr(hdr_value.buf, hdr_value.length,
"%imax-age = %d%0", &param.Expires) != PARSE_OK)
return;
}
/* DATE */
param.Date[0] = '\0';
if (httpmsg_find_hdr(hmsg, HDR_DATE, &hdr_value) != NULL) {
UpnpDiscovery_strcpy_Date(param, hdr_value.buf);
linecopylen(param.Date, hdr_value.buf, hdr_value.length);
}
/* dest addr */
UpnpDiscovery_set_DestAddr(param, dest_addr);
memcpy(&param.DestAddr, dest_addr, sizeof(struct sockaddr_storage));
/* EXT */
param.Ext[0] = '\0';
if (httpmsg_find_hdr(hmsg, HDR_EXT, &hdr_value) != NULL) {
UpnpDiscovery_strncpy_Ext(param, hdr_value.buf,
hdr_value.length);
linecopylen(param.Ext, hdr_value.buf, hdr_value.length);
}
/* LOCATION */
param.Location[0] = '\0';
if (httpmsg_find_hdr(hmsg, HDR_LOCATION, &hdr_value) != NULL) {
UpnpDiscovery_strncpy_Location(param, hdr_value.buf,
hdr_value.length);
linecopylen(param.Location, hdr_value.buf, hdr_value.length);
}
/* SERVER / USER-AGENT */
param.Os[0] = '\0';
if (httpmsg_find_hdr(hmsg, HDR_SERVER, &hdr_value) != NULL ||
httpmsg_find_hdr(hmsg, HDR_USER_AGENT, &hdr_value) != NULL) {
UpnpDiscovery_strncpy_Os(param, hdr_value.buf,
hdr_value.length);
linecopylen(param.Os, hdr_value.buf, hdr_value.length);
}
/* clear everything */
memset(param.DeviceId, 0, sizeof(param.DeviceId));
memset(param.DeviceType, 0, sizeof(param.DeviceType));
memset(param.ServiceType, 0, sizeof(param.ServiceType));
/* not used; version is in ServiceType */
param.ServiceVer[0] = '\0';
event.UDN[0] = '\0';
event.DeviceType[0] = '\0';
event.ServiceType[0] = '\0';
@ -171,30 +173,29 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
hdr_value.buf[hdr_value.length] = save_char;
}
if (nt_found || usn_found) {
UpnpDiscovery_strcpy_DeviceID(param, event.UDN);
UpnpDiscovery_strcpy_DeviceType(param, event.DeviceType);
UpnpDiscovery_strcpy_ServiceType(param, event.ServiceType);
strncpy(param.DeviceId, event.UDN, sizeof(param.DeviceId) - 1);
strncpy(param.DeviceType, event.DeviceType,
sizeof(param.DeviceType) - 1);
strncpy(param.ServiceType, event.ServiceType,
sizeof(param.ServiceType) - 1);
}
/* ADVERT. OR BYEBYE */
if (hmsg->is_request) {
/* use NTS hdr to determine advert., or byebye */
if (httpmsg_find_hdr(hmsg, HDR_NTS, &hdr_value) == NULL) {
/* error; NTS header not found */
goto end_ssdp_handle_ctrlpt_msg;
return; /* error; NTS header not found */
}
if (memptr_cmp(&hdr_value, "ssdp:alive") == 0) {
is_byebye = FALSE;
} else if (memptr_cmp(&hdr_value, "ssdp:byebye") == 0) {
is_byebye = TRUE;
} else {
/* bad value */
goto end_ssdp_handle_ctrlpt_msg;
return; /* bad value */
}
if (is_byebye) {
/* check device byebye */
if (!nt_found || !usn_found) {
/* bad byebye */
goto end_ssdp_handle_ctrlpt_msg;
return; /* bad byebye */
}
event_type = UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE;
} else {
@ -203,15 +204,13 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
* only. Expires should be greater than 1800 (30 mins) */
if (!nt_found ||
!usn_found ||
UpnpString_get_Length(UpnpDiscovery_get_Location(param)) == 0 ||
UpnpDiscovery_get_Expires(param) <= 0) {
/* bad advertisement */
goto end_ssdp_handle_ctrlpt_msg;
strlen(param.Location) == 0 || param.Expires <= 0) {
return; /* bad advertisement */
}
event_type = UPNP_DISCOVERY_ADVERTISEMENT_ALIVE;
}
/* call callback */
ctrlpt_callback(event_type, param, ctrlpt_cookie);
ctrlpt_callback(event_type, &param, ctrlpt_cookie);
} else {
/* reply (to a SEARCH) */
/* only checking to see if there is a valid ST header */
@ -224,17 +223,15 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
hdr_value.buf[hdr_value.length] = save_char;
}
if (hmsg->status_code != HTTP_OK ||
UpnpDiscovery_get_Expires(param) <= 0 ||
UpnpString_get_Length(UpnpDiscovery_get_Location(param)) == 0 ||
!usn_found || !st_found) {
/* bad reply */
goto end_ssdp_handle_ctrlpt_msg;
param.Expires <= 0 ||
strlen(param.Location) == 0 || !usn_found || !st_found) {
return; /* bad reply */
}
/* check each current search */
HandleLock();
if (GetClientHandleInfo(&handle, &ctrlpt_info) != HND_CLIENT) {
HandleUnlock();
goto end_ssdp_handle_ctrlpt_msg;
return;
}
node = ListHead(&ctrlpt_info->SsdpSearchList);
/* temporary add null termination */
@ -280,15 +277,13 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
}
if (matched) {
/* schedule call back */
threadData = SSDPResultData_new();
threadData =
(ResultData *) malloc(sizeof(ResultData));
if (threadData != NULL) {
SSDPResultData_set_Param(threadData,
param);
SSDPResultData_set_Cookie(threadData,
searchArg->
cookie);
SSDPResultData_set_CtrlptCallback
(threadData, ctrlpt_callback);
threadData->param = param;
threadData->cookie = searchArg->cookie;
threadData->ctrlpt_callback =
ctrlpt_callback;
TPJobInit(&job, (start_routine)
send_search_result,
threadData);
@ -297,7 +292,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
(free_routine)
free);
if (ThreadPoolAdd(&gRecvThreadPool, &job, NULL) != 0) {
SSDPResultData_delete(threadData);
free(threadData);
}
}
}
@ -305,11 +300,8 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
}
HandleUnlock();
/*ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, param, cookie ); */
/*ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, &param, cookie ); */
}
end_ssdp_handle_ctrlpt_msg:
UpnpDiscovery_delete(param);
}
/*!

View File

@ -1,33 +0,0 @@
#
# "Makefile.am" for "libupnp/upnp/unittest"
#
# Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
#
AM_CPPFLAGS = \
-I$(top_srcdir)/upnp/inc \
-I$(top_srcdir)/threadutil/inc \
-I$(top_srcdir)/ixml/inc \
-I$(top_srcdir)/upnp/src/inc
LDADD = \
$(top_builddir)/upnp/libupnp.la \
$(top_builddir)/threadutil/libthreadutil.la \
$(top_builddir)/ixml/libixml.la
#unittest
noinst_PROGRAMS = unittest
unittest_CPPFLAGS = \
$(AM_CPPFLAGS)
unittest_SOURCES = \
main.c \
templates/FirstObject.c \
templates/FirstObject.h \
templates/templates.c \
templates/templates.h \
templates/SecondObject.c \
templates/SecondObject.h \
templates/TheStruct.h

View File

@ -1,29 +0,0 @@
#include <stdio.h>
#include "templates/templates.h"
int (*tests[])(void) = {
templates,
};
int main(void)
{
int ret = 0;
int i;
int n = (sizeof tests) / (sizeof tests[0]);
int result;
for (i = 0; i < n; ++i) {
result = tests[i]();
printf("Test number %3d: %s.\n", i + 1, !result ? "PASS" : "FAIL");
ret += result;
}
printf("\n"
"Failed in %d tests.\n"
"Passed in %d tests.\n",
ret, n - ret);
return ret;
}

View File

@ -1,6 +0,0 @@
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "FirstObject.h"

View File

@ -1,44 +0,0 @@
#ifndef FIRSTOBJECT_H
#define FIRSTOBJECT_H
/*!
* \file
*
* \brief Object used in unit testing of object templates.
*/
/******************************************************************************/
#ifdef TEMPLATE_GENERATE_SOURCE
#undef TEMPLATE_GENERATE_SOURCE
#include "SecondObject.h"
#define TEMPLATE_GENERATE_SOURCE
#else /* TEMPLATE_GENERATE_SOURCE */
#include "SecondObject.h"
#endif /* TEMPLATE_GENERATE_SOURCE */
/******************************************************************************/
#include "TheStruct.h"
#define CLASS UnitFirstObject
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, TheInteger, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, TheUnsignedLong, unsigned long) \
EXPAND_CLASS_MEMBER_INT(CLASS, TheCharPointer, char *) \
EXPAND_CLASS_MEMBER_BUFFER(CLASS, TheBuffer, struct TheStruct) \
EXPAND_CLASS_MEMBER_LIST(CLASS, TheList) \
EXPAND_CLASS_MEMBER_OBJECT(CLASS, TheSecondObject, UnitSecondObject) \
EXPAND_CLASS_MEMBER_STRING(CLASS, TheString) \
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, TheDomString)
#include "TemplateInclude.h"
#endif /* FIRSTOBJECT_H */

View File

@ -1,6 +0,0 @@
#include "config.h"
#define TEMPLATE_GENERATE_SOURCE
#include "SecondObject.h"

View File

@ -1,44 +0,0 @@
#ifndef SECONDOBJECT_H
#define SECONDOBJECT_H
/*!
* \file
*
* \brief Object used in unit testing of object templates.
*/
/******************************************************************************/
#ifdef TEMPLATE_GENERATE_SOURCE
#undef TEMPLATE_GENERATE_SOURCE
/*#include "ThirdObject.h"*/
#define TEMPLATE_GENERATE_SOURCE
#else /* TEMPLATE_GENERATE_SOURCE */
/*#include "ThirdObject.h"*/
#endif /* TEMPLATE_GENERATE_SOURCE */
/******************************************************************************/
#include "TheStruct.h"
#define CLASS UnitSecondObject
#define EXPAND_CLASS_MEMBERS(CLASS) \
EXPAND_CLASS_MEMBER_INT(CLASS, TheInteger, int) \
EXPAND_CLASS_MEMBER_INT(CLASS, TheUnsignedLong, unsigned long) \
EXPAND_CLASS_MEMBER_INT(CLASS, TheCharPointer, char *) \
EXPAND_CLASS_MEMBER_BUFFER(CLASS, TheBuffer, struct TheStruct) \
EXPAND_CLASS_MEMBER_LIST(CLASS, TheList) \
/* EXPAND_CLASS_MEMBER_OBJECT(CLASS, TheThirdObject, ThirdObject) */ \
EXPAND_CLASS_MEMBER_STRING(CLASS, TheString) \
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, TheDomString)
#include "TemplateInclude.h"
#endif /* SECONDOBJECT_H */

View File

@ -1,11 +0,0 @@
#ifndef THESTRUCT_H
#define THESTRUCT_H
struct TheStruct {
int a;
long b;
};
#endif /* THESTRUCT_H */

View File

@ -1,33 +0,0 @@
#! /bin/bash
#
# The purpose of this file is to make it easier to find problems in
# Template Objects compilation.
#
# Because Template Objects are a result of preprocessing, the are normally
# invisible to the human eye. So, we paint him! Using the C pre-processor.
#
# The issue is that compilation error messages give all errors at the same
# lines. Using a combination of the pre-processor and indent, we are able
# to produce a good readable code, so that we can debug the templates.
#
if [[ "$1" == "" ]]; then
echo "Error: no file name given, please enter the C file name."
exit -1
fi
FILENAME=$(basename $1 .c)
top_srcdir=../../..
INCLUDES=
INCLUDES="${INCLUDES} -I${top_srcdir}"
INCLUDES="${INCLUDES} -I${top_srcdir}/ixml/inc"
INCLUDES="${INCLUDES} -I${top_srcdir}/threadutil/inc" \
INCLUDES="${INCLUDES} -I${top_srcdir}/upnp/inc" \
INCLUDES="${INCLUDES} -I${top_srcdir}/upnp/src/inc"
gcc ${INCLUDES} -E ${FILENAME}.c | grep -v ^# | indent -linux > ${FILENAME}.pp.c
gcc ${INCLUDES} -Wall -c ${FILENAME}.pp.c

View File

@ -1,13 +0,0 @@
#include "templates.h"
#include "FirstObject.h"
#include "SecondObject.h"
int templates(void)
{
int ret = 0;
return ret;
}

View File

@ -1,8 +0,0 @@
#ifndef TEMPLATES_H
#define TEMPLATES_H
int templates(void);
#endif /* TEMPLATES_H */