Compare commits
31 Commits
release-1.
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
caf4d24410 | ||
![]() |
85a8da77f2 | ||
![]() |
25620c1967 | ||
![]() |
8bc61b1a5c | ||
![]() |
aec58e6c9e | ||
![]() |
4bcb9dd5e1 | ||
![]() |
8cfa0e488c | ||
![]() |
9e775e662e | ||
![]() |
03400550cd | ||
![]() |
62a5d7c5ef | ||
![]() |
df80fbae36 | ||
![]() |
9c6ea48583 | ||
![]() |
8da593fae3 | ||
![]() |
b4816a33a9 | ||
![]() |
1b029e80af | ||
![]() |
907b103439 | ||
![]() |
ecd755d3f8 | ||
![]() |
b8cac59dd9 | ||
![]() |
591e0d3e25 | ||
![]() |
bd3bf7ad0a | ||
![]() |
374ff706fd | ||
![]() |
44564d16f8 | ||
![]() |
c0a5ccc174 | ||
![]() |
522dee807f | ||
![]() |
062d62bbc4 | ||
![]() |
ca1d800b96 | ||
![]() |
bd8ea3ac77 | ||
![]() |
191814ec13 | ||
![]() |
854cc93854 | ||
![]() |
6a0f25b290 | ||
![]() |
ed0a4d2222 |
197
ChangeLog
197
ChangeLog
@@ -1,179 +1,6 @@
|
|||||||
*******************************************************************************
|
*************************************************************************
|
||||||
Version 1.6.0
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2007-06-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* More fixes to Mac OS X and NetBSD from Rene Hexel:
|
|
||||||
[pupnp-devel] NetBSD & Mac OS X packages and patches
|
|
||||||
|
|
||||||
Okay, I found a couple more things. I have attached a patch file
|
|
||||||
against the trunk (version 206) that make the repository code compile
|
|
||||||
and run on both Mac OS X and NetBSD.
|
|
||||||
|
|
||||||
This fixes the following issues:
|
|
||||||
|
|
||||||
upnp/src/api/upnpapi.c: SIOCGIFCONF didn't work properly, use
|
|
||||||
getifaddrs() instead (on BSD systems).
|
|
||||||
|
|
||||||
threadutil/src/ThreadPool.c: priorities only work if
|
|
||||||
_POSIX_PRIORITY_SCHEDULING is defined (and greater than 0).
|
|
||||||
|
|
||||||
threadutil/src/LinkedList.c and threadutil/src/iasnprintf.c: use
|
|
||||||
stdlib.h instead of malloc.h on all BSD systems (not just FreeBSD).
|
|
||||||
This is important, because malloc.h does not exist on Darwin/Mac OS X.
|
|
||||||
|
|
||||||
Cheers
|
|
||||||
,
|
|
||||||
Rene
|
|
||||||
|
|
||||||
2007-06-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* [pupnp-devel] NetBSD & Mac OS X packages and patches.
|
|
||||||
Rene Hexel's <rh@netbsd.org> patch to compile in NetBSD and Mac OS X.
|
|
||||||
|
|
||||||
2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Updated the macro files acx_pthread.m4, ax_cflags_gcc_option.m4,
|
|
||||||
ax_cflags_warn_all.m4, m4/ax_cflags_warn_all_ansi.m4,
|
|
||||||
m4/type_socklen_t.m4.
|
|
||||||
|
|
||||||
2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fixed an issue with the instalation of the file upnpdebug.h. Since
|
|
||||||
the last modifications that removed the macro DEBUV_ONLY, this file
|
|
||||||
must be installed even on a non-debug build.
|
|
||||||
|
|
||||||
2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 1711325 ] Bad DestAddr in Upnp_Discovery structure
|
|
||||||
Submitted By: Bob Ciora
|
|
||||||
The field DestAddr of the structure Upnp_Discovery is now a full
|
|
||||||
SOCKADDRIN instead of a pointer to SOCKADDRIN. Commented code sugests
|
|
||||||
that in a previous moment, the function ssdp_handle_ctrlpt_msg() did
|
|
||||||
not use a postponed thread to call ctrlpt_callback(). Now the code
|
|
||||||
uses a thread, and most probably the original data would get lost and
|
|
||||||
the pointer would point to an invalid memory region. This fix caused
|
|
||||||
an interface change in the library and the minor library version was
|
|
||||||
bumped. Also, the libtool library numbers were changed accordingly.
|
|
||||||
|
|
||||||
2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added support for the Basic Device
|
|
||||||
(http://www.upnp.org/standardizeddcps/basic.asp) as suggested by
|
|
||||||
Titus Winters.
|
|
||||||
|
|
||||||
2007-05-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fixed the file libupnp.pc.in to generate a correct path for the
|
|
||||||
include files.
|
|
||||||
|
|
||||||
2007-05-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Removing the Dbg_Level, InitLog, SetLogFileNames and CloseLog
|
|
||||||
defines. These were just aliases, no reason to keep them.
|
|
||||||
|
|
||||||
2007-05-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Changed the comments of the include files that expose the UPnP API
|
|
||||||
to use only C89 comments and no C99 comments.
|
|
||||||
|
|
||||||
2007-05-24 Nektarios K. Papadopoulos <npapadop(at)inaccessnetworks.com>
|
|
||||||
* Added tvcombo sample that demonstrates coexistence of a device and a
|
|
||||||
control point in the same application.
|
|
||||||
|
|
||||||
2007-05-24 Nektarios K. Papadopoulos <npapadop(at)inaccessnetworks.com>
|
|
||||||
* SF Tracker FR [ 1570020 ].
|
|
||||||
* Enable both device and control point in the same application. Resolve
|
|
||||||
deadlock in the SSDP processing threads.
|
|
||||||
* Fix Threadpool expansion condition.
|
|
||||||
Thanks to Siva Chandran P. for the original patch.
|
|
||||||
|
|
||||||
2007-05-24 Nektarios K. Papadopoulos <npapadop(at)inaccessnetworks.com>
|
|
||||||
* Modified tvdevice (control and picture) service descriptions to make
|
|
||||||
compatible with WinXP/IE control point. 'in' arguments must appear before
|
|
||||||
'out' arguments in argument list.
|
|
||||||
Thanks to Martin Tremblay for pointing out the solution originally provided
|
|
||||||
by MORIOKA Yasuhiro.
|
|
||||||
|
|
||||||
2007-05-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* More MSVC fixes, using XINLINE instead of inline, MSVC has troubles
|
|
||||||
with inline. Thanks to David Maass for reporting.
|
|
||||||
* Changed XINLINE to UPNP_INLINE.
|
|
||||||
|
|
||||||
2007-05-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added the file build/inc/msvc/inttypes.h. This file is for use with
|
|
||||||
MSVC only, because it does not provide C99 compatibility.
|
|
||||||
|
|
||||||
2007-05-18 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Removed all uses of the DEVICEONLY(x) macro.
|
|
||||||
|
|
||||||
2007-05-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Removed all uses of the DBGONLY(x) macro. A static inline empty
|
|
||||||
function now is used and the compiler takes care of optimizing it out.
|
|
||||||
|
|
||||||
2007-05-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fixed a bug in UpnpPrintf, function could call va_start() and return
|
|
||||||
befor calling va_end().
|
|
||||||
|
|
||||||
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* EXPORT_SPEC missing on some declarations in ixml/inc/ixml.h.
|
|
||||||
Thanks to David Maass.
|
|
||||||
|
|
||||||
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* sizeof is unsigned, so %zu is more adequate than %zd.
|
|
||||||
|
|
||||||
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Using an invented printf directive PRIzu that on MSVC
|
|
||||||
expands to "lu", and on normal C99 compilers expands to "zu".
|
|
||||||
|
|
||||||
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Rewrote raw_find_str. Now it no longer uses strcasestr(), but it
|
|
||||||
transforms the first input buffer into lowercase.
|
|
||||||
|
|
||||||
2007-05-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fix for debug printf format strings. size_t are not expected
|
|
||||||
in a string format like "%.*s".
|
|
||||||
|
|
||||||
2007-05-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added inttypes.h as a header requirement in configure.ac.
|
|
||||||
|
|
||||||
2007-05-11 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Moved upnp_tv_ctrlpt and upnp_tv_device executables from folder
|
|
||||||
upnp to folder upnp/sample. Moved folder upnp/sample/tvdevice/web
|
|
||||||
to folder upnp/sample/web. This way, if someone compiles the
|
|
||||||
tarball and executes upnp_tv_device from its creation directory,
|
|
||||||
there will be no error -108 for not finding directory web.
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.4.6
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2007-04-19 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fix for freebsd host_os in configure.ac.
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.4.5
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2007-04-19 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Case insensitive comparison in raw_find_str() (httpparser.c) as
|
|
||||||
suggested by Craig Nelson in SF Tracker [ 1689382 ] DLINK DIR-625
|
|
||||||
patch.
|
|
||||||
|
|
||||||
2007-04-07 Nektarios K. Papadopoulos <npapadop(at)inaccessnetworks.com>
|
|
||||||
* Fix for a bug in makeAction where va_arg was beeing called one
|
|
||||||
extra time.
|
|
||||||
|
|
||||||
2007-04-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Tracker [ 1703533 ] Patch to make it compile under FreeBSD
|
|
||||||
Submitted By: Timothy Redaelli - drittz
|
|
||||||
I made some patches to make it compile under FreeBSD using
|
|
||||||
gethostbyaddr_r when supported.
|
|
||||||
|
|
||||||
2007-04-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* [pupnp-devel] Type mixup on x86_64 causes UPNP_E_OUTOF_MEMORY
|
|
||||||
Submitted By: Glen Masgai
|
|
||||||
after an UpnpSendActionAsync() for example, i get UPNP_E_OUTOF_MEMORY
|
|
||||||
in the callback using 1.4.4 on a x86_64 system. This happens in
|
|
||||||
http_MakeMessage(), which in some cases get called with wrong types
|
|
||||||
(int instead of size_t) in combination with format "b" and "Q".
|
|
||||||
The attached patch should fix this.
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.4.4
|
Version 1.4.4
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
2007-04-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-04-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* SF Tracker [ 1695399 ] Typo in util.h
|
* SF Tracker [ 1695399 ] Typo in util.h
|
||||||
@@ -208,9 +35,9 @@ Version 1.4.4
|
|||||||
Please note, that I enabled some extra debugging lines that were commented,
|
Please note, that I enabled some extra debugging lines that were commented,
|
||||||
in order to get more information. See attached files.
|
in order to get more information. See attached files.
|
||||||
|
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
Version 1.4.3
|
Version 1.4.3
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
2007-03-13 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-03-13 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* SF Tracker [ 1663004 ] Compile on Cygwin
|
* SF Tracker [ 1663004 ] Compile on Cygwin
|
||||||
@@ -245,9 +72,9 @@ Version 1.4.3
|
|||||||
|
|
||||||
* Fixed nasty segmentation fault bug on membuffer.c.
|
* Fixed nasty segmentation fault bug on membuffer.c.
|
||||||
|
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
Version 1.4.2
|
Version 1.4.2
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
2007-02-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-02-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
|
||||||
@@ -349,9 +176,9 @@ Version 1.4.2
|
|||||||
* support for large files (>2 GBytes) added
|
* support for large files (>2 GBytes) added
|
||||||
|
|
||||||
|
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
Version 1.4.1
|
Version 1.4.1
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
2006-07-07 Oxy <virtual_worlds(at)gmx.de>
|
2006-07-07 Oxy <virtual_worlds(at)gmx.de>
|
||||||
|
|
||||||
@@ -382,9 +209,9 @@ Version 1.4.1
|
|||||||
* Patch to fix memory leaks and reasons for crashes added (thanks
|
* Patch to fix memory leaks and reasons for crashes added (thanks
|
||||||
to loigu)
|
to loigu)
|
||||||
|
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
Version 1.4.0
|
Version 1.4.0
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
2006-05-26 Oxy <virtual_worlds(at)gmx.de>
|
2006-05-26 Oxy <virtual_worlds(at)gmx.de>
|
||||||
|
|
||||||
@@ -410,9 +237,9 @@ Version 1.4.0
|
|||||||
|
|
||||||
* Bugfix for M-Search packet
|
* Bugfix for M-Search packet
|
||||||
|
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
FORK FROM DEAD libupnp
|
FORK FROM DEAD libupnp
|
||||||
*******************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
2006-04-29 R<>mi Turboult <r3mi(at)users.sourceforge.net>
|
2006-04-29 R<>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
|
13
Makefile.am
13
Makefile.am
@@ -1,3 +1,4 @@
|
|||||||
|
# $Id: Makefile.am,v 1.5 2006/04/29 20:12:50 r3mi Exp $
|
||||||
#
|
#
|
||||||
# Top-level "Makefile.am" for libupnp
|
# Top-level "Makefile.am" for libupnp
|
||||||
#
|
#
|
||||||
@@ -8,11 +9,7 @@ ACLOCAL_AMFLAGS = -I m4
|
|||||||
|
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-samples
|
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-samples
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = ixml threadutil upnp docs/dist
|
||||||
ixml \
|
|
||||||
threadutil \
|
|
||||||
upnp \
|
|
||||||
docs/dist
|
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
@@ -26,8 +23,7 @@ EXTRA_DIST = \
|
|||||||
build/libupnp.dsw \
|
build/libupnp.dsw \
|
||||||
build/inc/autoconfig.h \
|
build/inc/autoconfig.h \
|
||||||
build/inc/config.h \
|
build/inc/config.h \
|
||||||
build/inc/upnpconfig.h \
|
build/inc/upnpconfig.h
|
||||||
build/msvc/inttypes.h
|
|
||||||
|
|
||||||
|
|
||||||
# This variable must have 'exec' in its name, in order to be installed
|
# This variable must have 'exec' in its name, in order to be installed
|
||||||
@@ -35,12 +31,11 @@ EXTRA_DIST = \
|
|||||||
pkgconfigexecdir = $(libdir)/pkgconfig
|
pkgconfigexecdir = $(libdir)/pkgconfig
|
||||||
pkgconfigexec_DATA = libupnp.pc
|
pkgconfigexec_DATA = libupnp.pc
|
||||||
|
|
||||||
|
|
||||||
$(pkgconfigexec_DATA): config.status
|
$(pkgconfigexec_DATA): config.status
|
||||||
|
|
||||||
|
|
||||||
if WITH_DOCUMENTATION
|
if WITH_DOCUMENTATION
|
||||||
doc_DATA = LICENSE README NEWS TODO THANKS
|
doc_DATA = LICENSE README NEWS TODO THANKS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
6
THANKS
6
THANKS
@@ -7,16 +7,13 @@ Here is a list of these people. Help us keep it complete and
|
|||||||
exempt of errors.
|
exempt of errors.
|
||||||
|
|
||||||
- Arno Willig
|
- Arno Willig
|
||||||
- Bob Ciora
|
|
||||||
- Chaos
|
- Chaos
|
||||||
- Craig Nelson
|
|
||||||
- David Maass
|
- David Maass
|
||||||
- Emil Ljungdahl
|
- Emil Ljungdahl
|
||||||
- Erik Johansson
|
- Erik Johansson
|
||||||
- Eric Tanguy
|
- Eric Tanguy
|
||||||
- Erwan Velu
|
- Erwan Velu
|
||||||
- Fredrik Svensson
|
- Fredrik Svensson
|
||||||
- Glen Masgai
|
|
||||||
- Jiri Zouhar
|
- Jiri Zouhar
|
||||||
- John Dennis
|
- John Dennis
|
||||||
- Jonathan (no_dice)
|
- Jonathan (no_dice)
|
||||||
@@ -29,8 +26,5 @@ exempt of errors.
|
|||||||
- Oskar Liljeblad
|
- Oskar Liljeblad
|
||||||
- Michael (Oxy)
|
- Michael (Oxy)
|
||||||
- Paul Vixie
|
- Paul Vixie
|
||||||
- Rene Hexel
|
|
||||||
- Siva Chandran
|
- Siva Chandran
|
||||||
- Timothy Redaelli
|
|
||||||
- Titus Winters
|
|
||||||
|
|
||||||
|
@@ -13,3 +13,7 @@ autoreconf --force --install -Wall -Wno-obsolete $* || exit 1
|
|||||||
echo "Now run ./configure and then make."
|
echo "Now run ./configure and then make."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* autoconfig.h. Generated from autoconfig.h.in by configure. */
|
/* autoconfig.h. Generated by configure. */
|
||||||
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
|
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
/* Define to 1 to compile debug code */
|
/* Define to 1 to compile debug code */
|
||||||
@@ -19,18 +19,15 @@
|
|||||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
||||||
#define HAVE_FSEEKO 1
|
#define HAVE_FSEEKO 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `ftime' function. */
|
|
||||||
#define HAVE_FTIME 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#define HAVE_INTTYPES_H 1
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `compat' library (-lcompat). */
|
|
||||||
/* #undef HAVE_LIBCOMPAT */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <limits.h> header file. */
|
/* Define to 1 if you have the <limits.h> header file. */
|
||||||
#define HAVE_LIMITS_H 1
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc.h> header file. */
|
||||||
|
#define HAVE_MALLOC_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#define HAVE_MEMORY_H 1
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
@@ -95,19 +92,19 @@
|
|||||||
#define PACKAGE "libupnp"
|
#define PACKAGE "libupnp"
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
#define PACKAGE_BUGREPORT "mroberto@users.sourceforge.net"
|
#define PACKAGE_BUGREPORT "virtual_worlds@gmx.de"
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
/* Define to the full name of this package. */
|
||||||
#define PACKAGE_NAME "libupnp"
|
#define PACKAGE_NAME "libupnp"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "libupnp 1.4.7"
|
#define PACKAGE_STRING "libupnp 1.4.0"
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#define PACKAGE_TARNAME "libupnp"
|
#define PACKAGE_TARNAME "libupnp"
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#define PACKAGE_VERSION "1.4.7"
|
#define PACKAGE_VERSION "1.4.0"
|
||||||
|
|
||||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||||
your system. */
|
your system. */
|
||||||
@@ -138,30 +135,27 @@
|
|||||||
#define UPNP_VERSION_MINOR 4
|
#define UPNP_VERSION_MINOR 4
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_PATCH 7
|
#define UPNP_VERSION_PATCH 0
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_STRING "1.4.7"
|
#define UPNP_VERSION_STRING "1.4.0"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "1.4.7"
|
#define VERSION "1.4.0"
|
||||||
|
|
||||||
/* File Offset size */
|
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
||||||
/* #undef _LARGEFILE_SOURCE */
|
/* #undef _LARGEFILE_SOURCE */
|
||||||
|
|
||||||
/* Large files support */
|
/* Define for large files, on AIX-style hosts. */
|
||||||
#define _LARGE_FILE_SOURCE
|
/* #undef _LARGE_FILES */
|
||||||
|
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
/* #undef const */
|
/* #undef const */
|
||||||
|
|
||||||
/* Define to `long int' if <sys/types.h> does not define. */
|
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||||
/* #undef off_t */
|
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
|
||||||
/* #undef size_t */
|
/* #undef size_t */
|
||||||
|
|
||||||
/* Substitute for socklen_t */
|
/* Substitute for socklen_t */
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#define MAX_JOBS_TOTAL 10
|
||||||
|
|
||||||
/** @name Compile time configuration options
|
/** @name Compile time configuration options
|
||||||
* The Linux SDK for UPnP Devices contains some compile-time parameters
|
* The Linux SDK for UPnP Devices contains some compile-time parameters
|
||||||
@@ -95,17 +96,6 @@
|
|||||||
#define MAX_THREADS 12
|
#define MAX_THREADS 12
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name MAX_JOBS_TOTAL
|
|
||||||
* The {\tt MAX_JOBS_TOTAL} constant determines the maximum number of jobs
|
|
||||||
* that can be queued. If this limit is reached further jobs will be thrown
|
|
||||||
* to avoid memory exhaustion. The default value 100.
|
|
||||||
* (Added by Axis.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MAX_JOBS_TOTAL 100
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** @name DEFAULT_SOAP_CONTENT_LENGTH
|
/** @name DEFAULT_SOAP_CONTENT_LENGTH
|
||||||
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
||||||
* This prevents devices that have a misbehaving web server to send
|
* This prevents devices that have a misbehaving web server to send
|
||||||
@@ -304,40 +294,68 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef EXCLUDE_WEB_SERVER
|
/** @name DBGONLY
|
||||||
#undef EXCLUDE_MINISERVER
|
The {\bf DBGONLY} macro allows code to be marked so that it
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
is only included in the DEBUG build and not the release. To
|
||||||
# define EXCLUDE_WEB_SERVER 0
|
use this macro, put the code inside of the parentheses:
|
||||||
# define EXCLUDE_MINISERVER 0
|
|
||||||
|
{\tt DBGONLY(int i;)}
|
||||||
|
|
||||||
|
This will cause a declaration of the integer {\tt i} only
|
||||||
|
in the debug build.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//@{
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define DBGONLY(x) x
|
||||||
#else
|
#else
|
||||||
# define EXCLUDE_WEB_SERVER 1
|
#define DBGONLY(x)
|
||||||
# define EXCLUDE_MINISERVER 1
|
#endif
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#undef EXCLUDE_WEB_SERVER
|
||||||
|
#undef EXCLUDE_MINISERVER
|
||||||
|
#ifdef INTERNAL_WEB_SERVER
|
||||||
|
#define EXCLUDE_WEB_SERVER 0
|
||||||
|
#define EXCLUDE_MINISERVER 0
|
||||||
|
#else
|
||||||
|
#define EXCLUDE_WEB_SERVER 1
|
||||||
|
#define EXCLUDE_MINISERVER 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1
|
#if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1
|
||||||
# undef EXCLUDE_MINISERVER
|
#undef EXCLUDE_MINISERVER
|
||||||
# define EXCLUDE_MINISERVER 1
|
#define EXCLUDE_MINISERVER 1
|
||||||
# if INTERNAL_WEB_SERVER
|
#if INTERNAL_WEB_SERVER
|
||||||
# error "conflicting settings: use configure --disable-webserver"
|
# error "conflicting settings: use configure --disable-webserver"
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0
|
#if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0
|
||||||
# undef EXCLUDE_MINISERVER
|
#undef EXCLUDE_MINISERVER
|
||||||
# define EXCLUDE_MINISERVER 0
|
#define EXCLUDE_MINISERVER 0
|
||||||
# if EXCLUDE_WEB_SERVER == 0 && !defined INTERNAL_WEB_SERVER
|
#if EXCLUDE_WEB_SERVER == 0 && !defined INTERNAL_WEB_SERVER
|
||||||
# error "conflicting settings : use configure --enable-webserver"
|
#error "conflicting settings : use configure --enable-webserver"
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
# define CLIENTONLY(x) x
|
#define CLIENTONLY(x) x
|
||||||
#else
|
#else
|
||||||
# define CLIENTONLY(x)
|
#define CLIENTONLY(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
|
#define DEVICEONLY(x) x
|
||||||
|
#else
|
||||||
|
#define DEVICEONLY(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,46 +1,46 @@
|
|||||||
/* upnp/inc/upnpconfig.h. Generated from upnpconfig.h.in by configure. */
|
/* upnp/inc/upnpconfig.h. Generated by configure. */
|
||||||
// -*- C -*-
|
// -*- C -*-
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
// Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
//
|
//
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
// without specific prior written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef UPNP_CONFIG_H
|
#ifndef UPNP_CONFIG_H
|
||||||
#define UPNP_CONFIG_H
|
#define UPNP_CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Library version
|
* Library version
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/** The library version (string) e.g. "1.3.0" */
|
/** The library version (string) e.g. "1.3.0" */
|
||||||
#define UPNP_VERSION_STRING "1.4.7"
|
#define UPNP_VERSION_STRING "1.4.0"
|
||||||
|
|
||||||
/** Major version of the library */
|
/** Major version of the library */
|
||||||
#define UPNP_VERSION_MAJOR 1
|
#define UPNP_VERSION_MAJOR 1
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#define UPNP_VERSION_MINOR 4
|
#define UPNP_VERSION_MINOR 4
|
||||||
|
|
||||||
/** Patch version of the library */
|
/** Patch version of the library */
|
||||||
#define UPNP_VERSION_PATCH 7
|
#define UPNP_VERSION_PATCH 0
|
||||||
|
|
||||||
/** The library version (numeric) e.g. 10300 means version 1.3.0 */
|
/** The library version (numeric) e.g. 10300 means version 1.3.0 */
|
||||||
#define UPNP_VERSION \
|
#define UPNP_VERSION \
|
||||||
@@ -59,25 +59,25 @@
|
|||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Library optional features
|
* Library optional features
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following defines can be tested in order to know which
|
* The following defines can be tested in order to know which
|
||||||
* optional features have been included in the installed library.
|
* optional features have been included in the installed library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** Defined to 1 if the library has been compiled with DEBUG enabled
|
/** Defined to 1 if the library has been compiled with DEBUG enabled
|
||||||
* (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */
|
* (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */
|
||||||
/* #undef UPNP_HAVE_DEBUG */
|
#undef UPNP_HAVE_DEBUG
|
||||||
|
|
||||||
|
|
||||||
/** Defined to 1 if the library has been compiled with client API enabled
|
/** Defined to 1 if the library has been compiled with client API enabled
|
||||||
* (i.e. configure --enable-client) */
|
* (i.e. configure --enable-client) */
|
||||||
#define UPNP_HAVE_CLIENT 1
|
#define UPNP_HAVE_CLIENT 1
|
||||||
|
|
||||||
|
|
||||||
/** Defined to 1 if the library has been compiled with device API enabled
|
/** Defined to 1 if the library has been compiled with device API enabled
|
||||||
* (i.e. configure --enable-device) */
|
* (i.e. configure --enable-device) */
|
||||||
#define UPNP_HAVE_DEVICE 1
|
#define UPNP_HAVE_DEVICE 1
|
||||||
|
|
||||||
|
@@ -1,301 +0,0 @@
|
|||||||
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
|
|
||||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
|
||||||
//
|
|
||||||
// Copyright (c) 2006 Alexander Chemeris
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// 2. 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.
|
|
||||||
//
|
|
||||||
// 3. The name of the author may be used to endorse or promote products
|
|
||||||
// derived from this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef _MSC_VER // [
|
|
||||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
|
||||||
#endif // _MSC_VER ]
|
|
||||||
|
|
||||||
#ifndef _MSC_INTTYPES_H_ // [
|
|
||||||
#define _MSC_INTTYPES_H_
|
|
||||||
|
|
||||||
#if _MSC_VER > 1000
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// 7.8 Format conversion of integer types
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
intmax_t quot;
|
|
||||||
intmax_t rem;
|
|
||||||
} imaxdiv_t;
|
|
||||||
|
|
||||||
// 7.8.1 Macros for format specifiers
|
|
||||||
|
|
||||||
// The fprintf macros for signed integers are:
|
|
||||||
#define PRId8 "d"
|
|
||||||
#define PRIi8 "i"
|
|
||||||
#define PRIdLEAST8 "d"
|
|
||||||
#define PRIiLEAST8 "i"
|
|
||||||
#define PRIdFAST8 "d"
|
|
||||||
#define PRIiFAST8 "i"
|
|
||||||
|
|
||||||
#define PRId16 "hd"
|
|
||||||
#define PRIi16 "hi"
|
|
||||||
#define PRIdLEAST16 "hd"
|
|
||||||
#define PRIiLEAST16 "hi"
|
|
||||||
#define PRIdFAST16 "hd"
|
|
||||||
#define PRIiFAST16 "hi"
|
|
||||||
|
|
||||||
#define PRId32 "I32d"
|
|
||||||
#define PRIi32 "I32i"
|
|
||||||
#define PRIdLEAST32 "I32d"
|
|
||||||
#define PRIiLEAST32 "I32i"
|
|
||||||
#define PRIdFAST32 "I32d"
|
|
||||||
#define PRIiFAST32 "I32i"
|
|
||||||
|
|
||||||
#define PRId64 "I64d"
|
|
||||||
#define PRIi64 "I64i"
|
|
||||||
#define PRIdLEAST64 "I64d"
|
|
||||||
#define PRIiLEAST64 "I64i"
|
|
||||||
#define PRIdFAST64 "I64d"
|
|
||||||
#define PRIiFAST64 "I64i"
|
|
||||||
|
|
||||||
#define PRIdMAX "I64d"
|
|
||||||
#define PRIiMAX "I64i"
|
|
||||||
|
|
||||||
#define PRIdPTR "Id"
|
|
||||||
#define PRIiPTR "Ii"
|
|
||||||
|
|
||||||
// The fprintf macros for unsigned integers are:
|
|
||||||
#define PRIo8 "o"
|
|
||||||
#define PRIu8 "u"
|
|
||||||
#define PRIx8 "x"
|
|
||||||
#define PRIX8 "X"
|
|
||||||
#define PRIoLEAST8 "o"
|
|
||||||
#define PRIuLEAST8 "u"
|
|
||||||
#define PRIxLEAST8 "x"
|
|
||||||
#define PRIXLEAST8 "X"
|
|
||||||
#define PRIoFAST8 "o"
|
|
||||||
#define PRIuFAST8 "u"
|
|
||||||
#define PRIxFAST8 "x"
|
|
||||||
#define PRIXFAST8 "X"
|
|
||||||
|
|
||||||
#define PRIo16 "ho"
|
|
||||||
#define PRIu16 "hu"
|
|
||||||
#define PRIx16 "hx"
|
|
||||||
#define PRIX16 "hX"
|
|
||||||
#define PRIoLEAST16 "ho"
|
|
||||||
#define PRIuLEAST16 "hu"
|
|
||||||
#define PRIxLEAST16 "hx"
|
|
||||||
#define PRIXLEAST16 "hX"
|
|
||||||
#define PRIoFAST16 "ho"
|
|
||||||
#define PRIuFAST16 "hu"
|
|
||||||
#define PRIxFAST16 "hx"
|
|
||||||
#define PRIXFAST16 "hX"
|
|
||||||
|
|
||||||
#define PRIo32 "I32o"
|
|
||||||
#define PRIu32 "I32u"
|
|
||||||
#define PRIx32 "I32x"
|
|
||||||
#define PRIX32 "I32X"
|
|
||||||
#define PRIoLEAST32 "I32o"
|
|
||||||
#define PRIuLEAST32 "I32u"
|
|
||||||
#define PRIxLEAST32 "I32x"
|
|
||||||
#define PRIXLEAST32 "I32X"
|
|
||||||
#define PRIoFAST32 "I32o"
|
|
||||||
#define PRIuFAST32 "I32u"
|
|
||||||
#define PRIxFAST32 "I32x"
|
|
||||||
#define PRIXFAST32 "I32X"
|
|
||||||
|
|
||||||
#define PRIo64 "I64o"
|
|
||||||
#define PRIu64 "I64u"
|
|
||||||
#define PRIx64 "I64x"
|
|
||||||
#define PRIX64 "I64X"
|
|
||||||
#define PRIoLEAST64 "I64o"
|
|
||||||
#define PRIuLEAST64 "I64u"
|
|
||||||
#define PRIxLEAST64 "I64x"
|
|
||||||
#define PRIXLEAST64 "I64X"
|
|
||||||
#define PRIoFAST64 "I64o"
|
|
||||||
#define PRIuFAST64 "I64u"
|
|
||||||
#define PRIxFAST64 "I64x"
|
|
||||||
#define PRIXFAST64 "I64X"
|
|
||||||
|
|
||||||
#define PRIoMAX "I64o"
|
|
||||||
#define PRIuMAX "I64u"
|
|
||||||
#define PRIxMAX "I64x"
|
|
||||||
#define PRIXMAX "I64X"
|
|
||||||
|
|
||||||
#define PRIoPTR "Io"
|
|
||||||
#define PRIuPTR "Iu"
|
|
||||||
#define PRIxPTR "Ix"
|
|
||||||
#define PRIXPTR "IX"
|
|
||||||
|
|
||||||
// The fscanf macros for signed integers are:
|
|
||||||
#define SCNd8 "d"
|
|
||||||
#define SCNi8 "i"
|
|
||||||
#define SCNdLEAST8 "d"
|
|
||||||
#define SCNiLEAST8 "i"
|
|
||||||
#define SCNdFAST8 "d"
|
|
||||||
#define SCNiFAST8 "i"
|
|
||||||
|
|
||||||
#define SCNd16 "hd"
|
|
||||||
#define SCNi16 "hi"
|
|
||||||
#define SCNdLEAST16 "hd"
|
|
||||||
#define SCNiLEAST16 "hi"
|
|
||||||
#define SCNdFAST16 "hd"
|
|
||||||
#define SCNiFAST16 "hi"
|
|
||||||
|
|
||||||
#define SCNd32 "ld"
|
|
||||||
#define SCNi32 "li"
|
|
||||||
#define SCNdLEAST32 "ld"
|
|
||||||
#define SCNiLEAST32 "li"
|
|
||||||
#define SCNdFAST32 "ld"
|
|
||||||
#define SCNiFAST32 "li"
|
|
||||||
|
|
||||||
#define SCNd64 "I64d"
|
|
||||||
#define SCNi64 "I64i"
|
|
||||||
#define SCNdLEAST64 "I64d"
|
|
||||||
#define SCNiLEAST64 "I64i"
|
|
||||||
#define SCNdFAST64 "I64d"
|
|
||||||
#define SCNiFAST64 "I64i"
|
|
||||||
|
|
||||||
#define SCNdMAX "I64d"
|
|
||||||
#define SCNiMAX "I64i"
|
|
||||||
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
# define SCNdPTR "I64d"
|
|
||||||
# define SCNiPTR "I64i"
|
|
||||||
#else // _WIN64 ][
|
|
||||||
# define SCNdPTR "ld"
|
|
||||||
# define SCNiPTR "li"
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
// The fscanf macros for unsigned integers are:
|
|
||||||
#define SCNo8 "o"
|
|
||||||
#define SCNu8 "u"
|
|
||||||
#define SCNx8 "x"
|
|
||||||
#define SCNX8 "X"
|
|
||||||
#define SCNoLEAST8 "o"
|
|
||||||
#define SCNuLEAST8 "u"
|
|
||||||
#define SCNxLEAST8 "x"
|
|
||||||
#define SCNXLEAST8 "X"
|
|
||||||
#define SCNoFAST8 "o"
|
|
||||||
#define SCNuFAST8 "u"
|
|
||||||
#define SCNxFAST8 "x"
|
|
||||||
#define SCNXFAST8 "X"
|
|
||||||
|
|
||||||
#define SCNo16 "ho"
|
|
||||||
#define SCNu16 "hu"
|
|
||||||
#define SCNx16 "hx"
|
|
||||||
#define SCNX16 "hX"
|
|
||||||
#define SCNoLEAST16 "ho"
|
|
||||||
#define SCNuLEAST16 "hu"
|
|
||||||
#define SCNxLEAST16 "hx"
|
|
||||||
#define SCNXLEAST16 "hX"
|
|
||||||
#define SCNoFAST16 "ho"
|
|
||||||
#define SCNuFAST16 "hu"
|
|
||||||
#define SCNxFAST16 "hx"
|
|
||||||
#define SCNXFAST16 "hX"
|
|
||||||
|
|
||||||
#define SCNo32 "lo"
|
|
||||||
#define SCNu32 "lu"
|
|
||||||
#define SCNx32 "lx"
|
|
||||||
#define SCNX32 "lX"
|
|
||||||
#define SCNoLEAST32 "lo"
|
|
||||||
#define SCNuLEAST32 "lu"
|
|
||||||
#define SCNxLEAST32 "lx"
|
|
||||||
#define SCNXLEAST32 "lX"
|
|
||||||
#define SCNoFAST32 "lo"
|
|
||||||
#define SCNuFAST32 "lu"
|
|
||||||
#define SCNxFAST32 "lx"
|
|
||||||
#define SCNXFAST32 "lX"
|
|
||||||
|
|
||||||
#define SCNo64 "I64o"
|
|
||||||
#define SCNu64 "I64u"
|
|
||||||
#define SCNx64 "I64x"
|
|
||||||
#define SCNX64 "I64X"
|
|
||||||
#define SCNoLEAST64 "I64o"
|
|
||||||
#define SCNuLEAST64 "I64u"
|
|
||||||
#define SCNxLEAST64 "I64x"
|
|
||||||
#define SCNXLEAST64 "I64X"
|
|
||||||
#define SCNoFAST64 "I64o"
|
|
||||||
#define SCNuFAST64 "I64u"
|
|
||||||
#define SCNxFAST64 "I64x"
|
|
||||||
#define SCNXFAST64 "I64X"
|
|
||||||
|
|
||||||
#define SCNoMAX "I64o"
|
|
||||||
#define SCNuMAX "I64u"
|
|
||||||
#define SCNxMAX "I64x"
|
|
||||||
#define SCNXMAX "I64X"
|
|
||||||
|
|
||||||
#ifdef _WIN64 // [
|
|
||||||
# define SCNoPTR "I64o"
|
|
||||||
# define SCNuPTR "I64u"
|
|
||||||
# define SCNxPTR "I64x"
|
|
||||||
# define SCNXPTR "I64X"
|
|
||||||
#else // _WIN64 ][
|
|
||||||
# define SCNoPTR "lo"
|
|
||||||
# define SCNuPTR "lu"
|
|
||||||
# define SCNxPTR "lx"
|
|
||||||
# define SCNXPTR "lX"
|
|
||||||
#endif // _WIN64 ]
|
|
||||||
|
|
||||||
// 7.8.2 Functions for greatest-width integer types
|
|
||||||
|
|
||||||
// 7.8.2.1 The imaxabs function
|
|
||||||
#define imaxabs _abs64
|
|
||||||
|
|
||||||
// 7.8.2.2 The imaxdiv function
|
|
||||||
|
|
||||||
// This is modified version of div() function from Microsoft's div.c found
|
|
||||||
// in %MSVC.NET%\crt\src\div.c
|
|
||||||
#ifdef STATIC_IMAXDIV // [
|
|
||||||
static
|
|
||||||
#else // STATIC_IMAXDIV ][
|
|
||||||
_inline
|
|
||||||
#endif // STATIC_IMAXDIV ]
|
|
||||||
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
|
|
||||||
{
|
|
||||||
imaxdiv_t result;
|
|
||||||
|
|
||||||
result.quot = numer / denom;
|
|
||||||
result.rem = numer % denom;
|
|
||||||
|
|
||||||
if (numer < 0 && result.rem > 0) {
|
|
||||||
// did division wrong; must fix up
|
|
||||||
++result.quot;
|
|
||||||
result.rem -= denom;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 7.8.2.3 The strtoimax and strtoumax functions
|
|
||||||
#define strtoimax _strtoi64
|
|
||||||
#define strtoumax _strtoui64
|
|
||||||
|
|
||||||
// 7.8.2.4 The wcstoimax and wcstoumax functions
|
|
||||||
#define wcstoimax _wcstoi64
|
|
||||||
#define wcstoumax _wcstoui64
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _MSC_INTTYPES_H_ ]
|
|
130
configure.ac
130
configure.ac
@@ -1,4 +1,5 @@
|
|||||||
# -*- Autoconf -*-
|
# -*- Autoconf -*-
|
||||||
|
# $Id: configure.ac,v 1.11 2006/04/09 13:59:44 r3mi Exp $
|
||||||
#
|
#
|
||||||
# Top-level configure.ac file for libupnp
|
# Top-level configure.ac file for libupnp
|
||||||
#
|
#
|
||||||
@@ -9,7 +10,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
|
|
||||||
AC_INIT([libupnp], [1.6.0], [mroberto@users.sourceforge.net])
|
AC_INIT([libupnp], [1.4.4], [mroberto@users.sourceforge.net])
|
||||||
# *Independently* of the above libupnp package version, the libtool version
|
# *Independently* of the above libupnp package version, the libtool version
|
||||||
# of the 3 libraries need to be updated whenever there is a change released :
|
# of the 3 libraries need to be updated whenever there is a change released :
|
||||||
# "current:revision:age" (this is NOT the same as the package version), where:
|
# "current:revision:age" (this is NOT the same as the package version), where:
|
||||||
@@ -34,35 +35,11 @@ AC_INIT([libupnp], [1.6.0], [mroberto@users.sourceforge.net])
|
|||||||
# current: 2 -> 3
|
# current: 2 -> 3
|
||||||
# revisiion: 3 -> 0
|
# revisiion: 3 -> 0
|
||||||
# age: 0 -> 1
|
# age: 0 -> 1
|
||||||
# - Code has changed in upnp
|
# - Code has changed in upnp (revision 2 -> 3)
|
||||||
# revision: 2 -> 3
|
# revision: 2 -> 3
|
||||||
#
|
AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
||||||
# For release 1.4.6, we had:
|
AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
||||||
#AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
||||||
#AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
|
||||||
#AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
|
||||||
#
|
|
||||||
# "current:revision:age"
|
|
||||||
#
|
|
||||||
# - Code has changed in ixml
|
|
||||||
# revision: 3 -> 4
|
|
||||||
# - Code has changed in threadutil
|
|
||||||
# revision: 0 -> 1
|
|
||||||
# - Code has changed in upnp
|
|
||||||
# revision: 3 -> 4
|
|
||||||
# - Interface changed in upnp
|
|
||||||
# current: 2 -> 3
|
|
||||||
# revision: 4 -> 0
|
|
||||||
# - Interface removed in upnp
|
|
||||||
# age: 0 -> 0
|
|
||||||
#
|
|
||||||
# For release 1.6.0, we had:
|
|
||||||
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
|
||||||
#AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
|
||||||
#AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
|
||||||
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
|
||||||
AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
|
||||||
AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR(config.aux)
|
AC_CONFIG_AUX_DIR(config.aux)
|
||||||
@@ -71,11 +48,6 @@ AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
|
|||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
||||||
|
|
||||||
#
|
|
||||||
# Get canonical host names in host and host_os
|
|
||||||
#
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# There are 3 configuration files :
|
# There are 3 configuration files :
|
||||||
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
||||||
@@ -159,14 +131,11 @@ RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
|||||||
# version on that.
|
# version on that.
|
||||||
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
||||||
AC_MSG_CHECKING([for documentation directory])
|
AC_MSG_CHECKING([for documentation directory])
|
||||||
AC_ARG_WITH(
|
AC_ARG_WITH([documentation],
|
||||||
[documentation],
|
AS_HELP_STRING([--with-documentation=directory_name],
|
||||||
AS_HELP_STRING(
|
|
||||||
[--with-documentation=directory_name],
|
|
||||||
[where documentation is installed
|
[where documentation is installed
|
||||||
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
||||||
AS_HELP_STRING(
|
AS_HELP_STRING([--without-documentation],
|
||||||
[--without-documentation],
|
|
||||||
[do not install the documentation]),
|
[do not install the documentation]),
|
||||||
[],
|
[],
|
||||||
[with_documentation=no])
|
[with_documentation=no])
|
||||||
@@ -190,40 +159,25 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_EGREP
|
AC_PROG_EGREP
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default compilation flags
|
# Default compilation flags
|
||||||
#
|
#
|
||||||
echo "--------------------- Default compilation flags -------------------------------"
|
if test x"$enable_debug" = xyes; then
|
||||||
echo host is $host
|
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
||||||
echo host_os is $host_os
|
:
|
||||||
case $host_os in
|
else
|
||||||
freebsd*)
|
# add optimise for size
|
||||||
echo "Using FreeBSD specific compiler settings"
|
AX_CFLAGS_GCC_OPTION([-Os])
|
||||||
# Put FreeBSD specific compiler flags here
|
fi
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Using non-specific system compiler settings"
|
|
||||||
if test x"$enable_debug" = xyes; then
|
|
||||||
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
|
||||||
:
|
|
||||||
else
|
|
||||||
# add optimise for size
|
|
||||||
AX_CFLAGS_GCC_OPTION([-Os])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AX_CFLAGS_WARN_ALL
|
AX_CFLAGS_WARN_ALL
|
||||||
echo "-------------------------------------------------------------------------------"
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Lot's of stuff to ensure large file support
|
# Lot's of stuff to ensure large file support
|
||||||
#
|
#
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support])
|
AC_DEFINE(_LARGE_FILE_SOURCE, [], [Large files support])
|
||||||
AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -232,25 +186,7 @@ AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
|||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
# libupnp code doesn't use autoconf variables yet,
|
# libupnp code doesn't use autoconf variables yet,
|
||||||
# so just abort if a header file is not found.
|
# so just abort if a header file is not found.
|
||||||
AC_CHECK_HEADERS(
|
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h],[],[AC_MSG_ERROR([required header file missing])])
|
||||||
[ \
|
|
||||||
arpa/inet.h \
|
|
||||||
fcntl.h \
|
|
||||||
inttypes.h \
|
|
||||||
limits.h \
|
|
||||||
netdb.h \
|
|
||||||
netinet/in.h \
|
|
||||||
stdlib.h \
|
|
||||||
string.h \
|
|
||||||
sys/ioctl.h \
|
|
||||||
sys/socket.h \
|
|
||||||
sys/time.h \
|
|
||||||
sys/timeb.h \
|
|
||||||
syslog.h \
|
|
||||||
unistd.h \
|
|
||||||
],
|
|
||||||
[],
|
|
||||||
[AC_MSG_ERROR([required header file missing])])
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -266,29 +202,25 @@ TYPE_SOCKLEN_T
|
|||||||
#
|
#
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for POSIX Threads
|
# Checks for POSIX Threads
|
||||||
#
|
#
|
||||||
ACX_PTHREAD(
|
ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
||||||
[],
|
|
||||||
[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
Makefile
|
|
||||||
ixml/Makefile
|
|
||||||
ixml/doc/Makefile
|
|
||||||
threadutil/Makefile
|
|
||||||
upnp/Makefile
|
|
||||||
upnp/doc/Makefile
|
|
||||||
upnp/sample/Makefile
|
|
||||||
docs/dist/Makefile
|
|
||||||
libupnp.pc
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([Makefile
|
||||||
|
ixml/Makefile
|
||||||
|
ixml/doc/Makefile
|
||||||
|
threadutil/Makefile
|
||||||
|
upnp/Makefile
|
||||||
|
upnp/doc/Makefile
|
||||||
|
docs/dist/Makefile
|
||||||
|
libupnp.pc
|
||||||
|
])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
145
ixml/inc/ixml.h
145
ixml/inc/ixml.h
@@ -1,61 +1,59 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _IXML_H_
|
#ifndef _IXML_H_
|
||||||
#define _IXML_H_
|
#define _IXML_H_
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
//#include <malloc.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef UPNP_STATIC_LIB
|
#ifndef UPNP_STATIC_LIB
|
||||||
#ifdef LIBUPNP_EXPORTS
|
#ifdef LIBUPNP_EXPORTS
|
||||||
/* set up declspec for dll export to make functions visible to library users */
|
// set up declspec for dll export to make functions visible to library users
|
||||||
#define EXPORT_SPEC __declspec(dllexport)
|
#define EXPORT_SPEC __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC __declspec(dllimport)
|
#define EXPORT_SPEC __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef int BOOL;
|
typedef int BOOL;
|
||||||
|
|
||||||
|
|
||||||
#define DOMString char *
|
#define DOMString char *
|
||||||
|
|
||||||
|
|
||||||
@@ -90,7 +88,7 @@ typedef int BOOL;
|
|||||||
* etc., refer to section 1.1 of the DOM2-Core recommendation.
|
* etc., refer to section 1.1 of the DOM2-Core recommendation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -123,7 +121,7 @@ typedef enum
|
|||||||
*
|
*
|
||||||
*=================================================================*/
|
*=================================================================*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{ /* see DOM spec */
|
{ // see DOM spec
|
||||||
IXML_INDEX_SIZE_ERR = 1,
|
IXML_INDEX_SIZE_ERR = 1,
|
||||||
IXML_DOMSTRING_SIZE_ERR = 2,
|
IXML_DOMSTRING_SIZE_ERR = 2,
|
||||||
IXML_HIERARCHY_REQUEST_ERR = 3,
|
IXML_HIERARCHY_REQUEST_ERR = 3,
|
||||||
@@ -242,7 +240,7 @@ extern "C" {
|
|||||||
* its functionality. For more information, refer to DOM2-Core page 34.
|
* its functionality. For more information, refer to DOM2-Core page 34.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** Returns the name of the {\bf Node}, depending on what type of
|
/** Returns the name of the {\bf Node}, depending on what type of
|
||||||
* {\bf Node} it is, in a read-only string. Refer to the table in the
|
* {\bf Node} it is, in a read-only string. Refer to the table in the
|
||||||
@@ -622,7 +620,7 @@ ixmlNode_cloneNode(IXML_Node *nodeptr,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC BOOL
|
EXPORT_SPEC BOOL
|
||||||
ixmlNode_hasAttributes(IXML_Node *nodeptr
|
ixmlNode_hasAttributes(IXML_Node *node
|
||||||
/** The {\bf Node} to query for attributes. */
|
/** The {\bf Node} to query for attributes. */
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -632,11 +630,11 @@ ixmlNode_hasAttributes(IXML_Node *nodeptr
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC void
|
EXPORT_SPEC void
|
||||||
ixmlNode_free(IXML_Node *nodeptr
|
ixmlNode_free(IXML_Node *IXML_Node
|
||||||
/** The {\bf Node} to free. */
|
/** The {\bf Node} to free. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -651,7 +649,7 @@ ixmlNode_free(IXML_Node *nodeptr
|
|||||||
* allowable attributes and values for a particular element. For more
|
* allowable attributes and values for a particular element. For more
|
||||||
* information, refer to the {\it Interface Attr} section in the DOM2-Core.
|
* information, refer to the {\it Interface Attr} section in the DOM2-Core.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
|
|
||||||
/** Frees an {\bf Attr} node.
|
/** Frees an {\bf Attr} node.
|
||||||
@@ -664,7 +662,7 @@ ixmlAttr_free(IXML_Attr *attrNode
|
|||||||
/** The {\bf Attr} node to free. */
|
/** The {\bf Attr} node to free. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
@@ -682,7 +680,7 @@ ixmlAttr_free(IXML_Attr *attrNode
|
|||||||
* information, refer to the {\it Interface CDATASection} section in the
|
* information, refer to the {\it Interface CDATASection} section in the
|
||||||
* DOM2-Core.
|
* DOM2-Core.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
|
|
||||||
/** Initializes a {\bf CDATASection} node.
|
/** Initializes a {\bf CDATASection} node.
|
||||||
@@ -706,7 +704,7 @@ ixmlCDATASection_free(IXML_CDATASection *nodeptr
|
|||||||
/** The {\bf CDATASection} node to free. */
|
/** The {\bf CDATASection} node to free. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -721,7 +719,7 @@ ixmlCDATASection_free(IXML_CDATASection *nodeptr
|
|||||||
* primary interface to the elements of the document. For more information,
|
* primary interface to the elements of the document. For more information,
|
||||||
* refer to the {\it Interface Document} section in the DOM2Core.
|
* refer to the {\it Interface Document} section in the DOM2Core.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** Initializes a {\bf Document} node.
|
/** Initializes a {\bf Document} node.
|
||||||
*
|
*
|
||||||
@@ -949,7 +947,7 @@ ixmlDocument_getElementsByTagName(IXML_Document *doc,
|
|||||||
/** The tag name to find. */
|
/** The tag name to find. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* introduced in DOM level 2 */
|
// introduced in DOM level 2
|
||||||
|
|
||||||
/** Creates a new {\bf Element} node in the given qualified name and
|
/** Creates a new {\bf Element} node in the given qualified name and
|
||||||
* namespace URI.
|
* namespace URI.
|
||||||
@@ -1130,7 +1128,7 @@ ixmlDocument_importNode(IXML_Document* doc,
|
|||||||
/** A pointer to a new {\bf Node} owned by {\bf
|
/** A pointer to a new {\bf Node} owned by {\bf
|
||||||
doc}. */
|
doc}. */
|
||||||
);
|
);
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -1146,7 +1144,7 @@ ixmlDocument_importNode(IXML_Document* doc,
|
|||||||
* extends the {\bf Node} interface and adds more operations to manipulate
|
* extends the {\bf Node} interface and adds more operations to manipulate
|
||||||
* attributes.
|
* attributes.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** Initializes a {\bf IXML_Element} node.
|
/** Initializes a {\bf IXML_Element} node.
|
||||||
*
|
*
|
||||||
@@ -1316,7 +1314,7 @@ ixmlElement_getElementsByTagName(IXML_Element* element,
|
|||||||
search. */
|
search. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* introduced in DOM 2 */
|
// introduced in DOM 2
|
||||||
|
|
||||||
/** Retrieves an attribute value using the local name and namespace URI.
|
/** Retrieves an attribute value using the local name and namespace URI.
|
||||||
*
|
*
|
||||||
@@ -1495,7 +1493,7 @@ ixmlElement_free(IXML_Element* element
|
|||||||
/** The {\bf Element} to free. */
|
/** The {\bf Element} to free. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -1510,7 +1508,7 @@ ixmlElement_free(IXML_Element* element
|
|||||||
* no particular order. The {\bf Node} interface uses a {\bf NamedNodeMap}
|
* no particular order. The {\bf Node} interface uses a {\bf NamedNodeMap}
|
||||||
* to maintain the attributes of a node.
|
* to maintain the attributes of a node.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** Returns the number of items contained in this {\bf NamedNodeMap}.
|
/** Returns the number of items contained in this {\bf NamedNodeMap}.
|
||||||
*
|
*
|
||||||
@@ -1581,7 +1579,7 @@ ixmlNamedNodeMap_item(IXML_NamedNodeMap *nnMap,
|
|||||||
/** The index into the map to remove. */
|
/** The index into the map to remove. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* introduced in DOM level 2 */
|
// introduced in DOM level 2
|
||||||
|
|
||||||
/** Retrieves a {\bf Node} from a {\bf NamedNodeMap} specified by
|
/** Retrieves a {\bf Node} from a {\bf NamedNodeMap} specified by
|
||||||
* namespace URI and local name.
|
* namespace URI and local name.
|
||||||
@@ -1648,7 +1646,7 @@ ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap
|
|||||||
/** The {\bf NamedNodeMap to free}. */
|
/** The {\bf NamedNodeMap to free}. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -1663,7 +1661,7 @@ ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap
|
|||||||
* the nodes contained in a {\bf NodeList}. The DOM2-Core refers to
|
* the nodes contained in a {\bf NodeList}. The DOM2-Core refers to
|
||||||
* this as being {\it live}.
|
* this as being {\it live}.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** Retrieves a {\bf Node} from a {\bf NodeList} specified by a
|
/** Retrieves a {\bf Node} from a {\bf NodeList} specified by a
|
||||||
* numerical index.
|
* numerical index.
|
||||||
@@ -1703,8 +1701,8 @@ ixmlNodeList_free(IXML_NodeList *nList
|
|||||||
/** The {\bf NodeList} to free. */
|
/** The {\bf NodeList} to free. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Interface NodeList */
|
//@} Interface NodeList
|
||||||
/*! @} */ /* DOM Interfaces */
|
//@} DOM Interfaces
|
||||||
|
|
||||||
/**@name IXML API
|
/**@name IXML API
|
||||||
* The IXML API contains utility functions that are not part of the standard
|
* The IXML API contains utility functions that are not part of the standard
|
||||||
@@ -1712,7 +1710,7 @@ ixmlNodeList_free(IXML_NodeList *nList
|
|||||||
* file or buffer, create an XML file from a DOM structure, and manipulate
|
* file or buffer, create an XML file from a DOM structure, and manipulate
|
||||||
* DOMString objects.
|
* DOMString objects.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/*================================================================
|
/*================================================================
|
||||||
*
|
*
|
||||||
@@ -1740,7 +1738,7 @@ ixmlNodeList_free(IXML_NodeList *nList
|
|||||||
* of the DOM tree or {\tt NULL} on an error.
|
* of the DOM tree or {\tt NULL} on an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC DOMString
|
DOMString
|
||||||
ixmlPrintDocument(IXML_Document *doc);
|
ixmlPrintDocument(IXML_Document *doc);
|
||||||
|
|
||||||
/** Renders a {\bf Node} and all sub-elements into an XML text
|
/** Renders a {\bf Node} and all sub-elements into an XML text
|
||||||
@@ -1758,7 +1756,7 @@ ixmlPrintDocument(IXML_Document *doc);
|
|||||||
* of the DOM tree or {\tt NULL} on an error.
|
* of the DOM tree or {\tt NULL} on an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC DOMString
|
DOMString
|
||||||
ixmlPrintNode(IXML_Node *doc
|
ixmlPrintNode(IXML_Node *doc
|
||||||
/** The root of the {\bf Node} tree to render to XML text. */
|
/** The root of the {\bf Node} tree to render to XML text. */
|
||||||
);
|
);
|
||||||
@@ -1779,7 +1777,7 @@ ixmlPrintNode(IXML_Node *doc
|
|||||||
* of the DOM tree or {\tt NULL} on an error.
|
* of the DOM tree or {\tt NULL} on an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EXPORT_SPEC DOMString
|
DOMString
|
||||||
ixmlDocumenttoString(IXML_Document *doc);
|
ixmlDocumenttoString(IXML_Document *doc);
|
||||||
|
|
||||||
/** Renders a {\bf Node} and all sub-elements into an XML text
|
/** Renders a {\bf Node} and all sub-elements into an XML text
|
||||||
@@ -1811,7 +1809,7 @@ ixmlNodetoString(IXML_Node *doc
|
|||||||
* characters are replaced by the {\bf errorChar}, and invalid "&" entities
|
* characters are replaced by the {\bf errorChar}, and invalid "&" entities
|
||||||
* are left untranslated. The parsing is then allowed to continue.
|
* are left untranslated. The parsing is then allowed to continue.
|
||||||
*/
|
*/
|
||||||
EXPORT_SPEC void
|
void
|
||||||
ixmlRelaxParser(char errorChar);
|
ixmlRelaxParser(char errorChar);
|
||||||
|
|
||||||
|
|
||||||
@@ -1915,7 +1913,6 @@ ixmlFreeDOMString(DOMString buf
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! @} */ /* IXML API */
|
//@} IXML API
|
||||||
|
|
||||||
#endif /* _IXML_H_ */
|
|
||||||
|
|
||||||
|
#endif // _IXML_H_
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define UPNP_INLINE inline
|
#define XINLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MEMBUF_DEF_SIZE_INC 20
|
#define MEMBUF_DEF_SIZE_INC 20
|
||||||
|
@@ -7,5 +7,6 @@ Name: libupnp
|
|||||||
Description: Linux SDK for UPnP Devices
|
Description: Linux SDK for UPnP Devices
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
||||||
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
Cflags: @PTHREAD_CFLAGS@ -I${includedir}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,88 +1,50 @@
|
|||||||
##### http://autoconf-archive.cryp.to/acx_pthread.html
|
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||||
#
|
dnl
|
||||||
# SYNOPSIS
|
dnl @summary figure out how to build C programs using POSIX threads
|
||||||
#
|
dnl
|
||||||
# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
dnl This macro figures out how to build C programs using POSIX threads.
|
||||||
#
|
dnl It sets the PTHREAD_LIBS output variable to the threads library and
|
||||||
# DESCRIPTION
|
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
|
||||||
#
|
dnl C compiler flags that are needed. (The user can also force certain
|
||||||
# This macro figures out how to build C programs using POSIX threads.
|
dnl compiler flags/libs to be tested by setting these environment
|
||||||
# It sets the PTHREAD_LIBS output variable to the threads library and
|
dnl variables.)
|
||||||
# linker flags, and the PTHREAD_CFLAGS output variable to any special
|
dnl
|
||||||
# C compiler flags that are needed. (The user can also force certain
|
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||||
# compiler flags/libs to be tested by setting these environment
|
dnl multi-threaded programs (defaults to the value of CC otherwise).
|
||||||
# variables.)
|
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
|
||||||
#
|
dnl
|
||||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
dnl NOTE: You are assumed to not only compile your program with these
|
||||||
# multi-threaded programs (defaults to the value of CC otherwise).
|
dnl flags, but also link it with them as well. e.g. you should link
|
||||||
# (This is necessary on AIX to use the special cc_r compiler alias.)
|
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
||||||
#
|
dnl $LIBS
|
||||||
# NOTE: You are assumed to not only compile your program with these
|
dnl
|
||||||
# flags, but also link it with them as well. e.g. you should link
|
dnl If you are only building threads programs, you may wish to use
|
||||||
# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
dnl these variables in your default LIBS, CFLAGS, and CC:
|
||||||
# $LIBS
|
dnl
|
||||||
#
|
dnl LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
# If you are only building threads programs, you may wish to use
|
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
# these variables in your default LIBS, CFLAGS, and CC:
|
dnl CC="$PTHREAD_CC"
|
||||||
#
|
dnl
|
||||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
||||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
||||||
# CC="$PTHREAD_CC"
|
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||||
#
|
dnl
|
||||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
|
||||||
# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
||||||
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
||||||
#
|
dnl default action will define HAVE_PTHREAD.
|
||||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads
|
dnl
|
||||||
# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
dnl Please let the authors know if this macro fails on any platform, or
|
||||||
# run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
dnl if you have any other suggestions or comments. This macro was based
|
||||||
# default action will define HAVE_PTHREAD.
|
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
|
||||||
#
|
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
|
||||||
# Please let the authors know if this macro fails on any platform, or
|
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
|
||||||
# if you have any other suggestions or comments. This macro was based
|
dnl We are also grateful for the helpful feedback of numerous users.
|
||||||
# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
|
dnl
|
||||||
# (with help from M. Frigo), as well as ac_pthread and hb_pthread
|
dnl @category InstalledPackages
|
||||||
# macros posted by Alejandro Forero Cuervo to the autoconf macro
|
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
|
||||||
# repository. We are also grateful for the helpful feedback of
|
dnl @version 2005-06-15
|
||||||
# numerous users.
|
dnl @license GPLWithACException
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2006-05-29
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License as
|
|
||||||
# published by the Free Software Foundation; either version 2 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
# 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# As a special exception, the respective Autoconf Macro's copyright
|
|
||||||
# owner gives unlimited permission to copy, distribute and modify the
|
|
||||||
# configure scripts that are the output of Autoconf when processing
|
|
||||||
# the Macro. You need not follow the terms of the GNU General Public
|
|
||||||
# License when using or distributing such scripts, even though
|
|
||||||
# portions of the text of the Macro appear in them. The GNU General
|
|
||||||
# Public License (GPL) does govern all other use of the material that
|
|
||||||
# constitutes the Autoconf Macro.
|
|
||||||
#
|
|
||||||
# This special exception to the GPL applies to versions of the
|
|
||||||
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
|
||||||
# make and distribute a modified version of the Autoconf Macro, you
|
|
||||||
# may extend this special exception to the GPL to apply to your
|
|
||||||
# modified version as well.
|
|
||||||
|
|
||||||
AC_DEFUN([ACX_PTHREAD], [
|
AC_DEFUN([ACX_PTHREAD], [
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
@@ -254,12 +216,8 @@ if test "x$acx_pthread_ok" = xyes; then
|
|||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
# More AIX lossage: must compile with xlc_r or cc_r
|
# More AIX lossage: must compile with cc_r
|
||||||
if test x"$GCC" != xyes; then
|
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
||||||
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
|
||||||
else
|
|
||||||
PTHREAD_CC=$CC
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
PTHREAD_CC="$CC"
|
PTHREAD_CC="$CC"
|
||||||
fi
|
fi
|
||||||
|
@@ -1,87 +1,48 @@
|
|||||||
##### http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html
|
dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
|
||||||
#
|
dnl
|
||||||
# SYNOPSIS
|
dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
|
||||||
#
|
dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
|
||||||
# AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
|
dnl optionflag to CFLAGS if it is understood. You can override the
|
||||||
#
|
dnl shellvar-default of CFLAGS of course. The order of arguments stems
|
||||||
# DESCRIPTION
|
dnl from the explicit macros like AX_CFLAGS_WARN_ALL.
|
||||||
#
|
dnl
|
||||||
# AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
|
dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
|
||||||
# "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
|
dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
|
||||||
# optionflag to CFLAGS if it is understood. You can override the
|
dnl (since it is possible to use different compilers for C and C++).
|
||||||
# shellvar-default of CFLAGS of course. The order of arguments stems
|
dnl
|
||||||
# from the explicit macros like AX_CFLAGS_WARN_ALL.
|
dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
|
||||||
#
|
dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
|
||||||
# The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
|
dnl However, if you use this macro in a few places, it would be great
|
||||||
# to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
|
dnl if you would make up a new function-macro and submit it to the
|
||||||
# (since it is possible to use different compilers for C and C++).
|
dnl ac-archive.
|
||||||
#
|
dnl
|
||||||
# The macro is a lot simpler than any special AX_CFLAGS_* macro (or
|
dnl - $1 option-to-check-for : required ("-option" as non-value)
|
||||||
# ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
|
dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
|
||||||
# However, if you use this macro in a few places, it would be great
|
dnl - $3 action-if-found : add value to shellvariable
|
||||||
# if you would make up a new function-macro and submit it to the
|
dnl - $4 action-if-not-found : nothing
|
||||||
# ac-archive.
|
dnl
|
||||||
#
|
dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
|
||||||
# - $1 option-to-check-for : required ("-option" as non-value)
|
dnl situation and accept a $2=~/-/ as being the old
|
||||||
# - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
|
dnl option-to-check-for.
|
||||||
# - $3 action-if-found : add value to shellvariable
|
dnl
|
||||||
# - $4 action-if-not-found : nothing
|
dnl also: there are other variants that emerged from the original macro
|
||||||
#
|
dnl variant which did just test an option to be possibly added.
|
||||||
# note: in earlier versions, $1-$2 were swapped. We try to detect the
|
dnl However, some compilers accept an option silently, or possibly for
|
||||||
# situation and accept a $2=~/-/ as being the old
|
dnl just another option that was not intended. Therefore, we have to do
|
||||||
# option-to-check-for.
|
dnl a generic test for a compiler family. For gcc we check "-pedantic"
|
||||||
#
|
dnl being accepted which is also understood by compilers who just want
|
||||||
# also: there are other variants that emerged from the original macro
|
dnl to be compatible with gcc even when not being made from gcc
|
||||||
# variant which did just test an option to be possibly added.
|
dnl sources.
|
||||||
# However, some compilers accept an option silently, or possibly for
|
dnl
|
||||||
# just another option that was not intended. Therefore, we have to do
|
dnl see also:
|
||||||
# a generic test for a compiler family. For gcc we check "-pedantic"
|
dnl
|
||||||
# being accepted which is also understood by compilers who just want
|
dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
|
||||||
# to be compatible with gcc even when not being made from gcc
|
dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
|
||||||
# sources.
|
dnl
|
||||||
#
|
dnl @category C
|
||||||
# see also:
|
dnl @author Guido Draheim <guidod@gmx.de>
|
||||||
#
|
dnl @version 2003-11-04
|
||||||
# AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
|
dnl @license GPLWithACException
|
||||||
# AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2006-12-12
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License as
|
|
||||||
# published by the Free Software Foundation; either version 2 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
# 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# As a special exception, the respective Autoconf Macro's copyright
|
|
||||||
# owner gives unlimited permission to copy, distribute and modify the
|
|
||||||
# configure scripts that are the output of Autoconf when processing
|
|
||||||
# the Macro. You need not follow the terms of the GNU General Public
|
|
||||||
# License when using or distributing such scripts, even though
|
|
||||||
# portions of the text of the Macro appear in them. The GNU General
|
|
||||||
# Public License (GPL) does govern all other use of the material that
|
|
||||||
# constitutes the Autoconf Macro.
|
|
||||||
#
|
|
||||||
# This special exception to the GPL applies to versions of the
|
|
||||||
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
|
||||||
# make and distribute a modified version of the Autoconf Macro, you
|
|
||||||
# may extend this special exception to the GPL to apply to your
|
|
||||||
# modified version as well.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
|
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
|
||||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||||
@@ -92,8 +53,7 @@ VAR,[VAR="no, unknown"
|
|||||||
AC_LANG_C
|
AC_LANG_C
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
|
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
||||||
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
|
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
@@ -125,11 +85,10 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CXX
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
|
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
||||||
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
|
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
@@ -163,8 +122,7 @@ VAR,[VAR="no, unknown"
|
|||||||
AC_LANG_C
|
AC_LANG_C
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
|
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
||||||
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
|
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
@@ -196,11 +154,10 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
|
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CXX
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
|
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
||||||
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
|
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
|
@@ -1,66 +1,27 @@
|
|||||||
##### http://autoconf-archive.cryp.to/ax_cflags_warn_all.html
|
dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||||
#
|
dnl
|
||||||
# SYNOPSIS
|
dnl Try to find a compiler option that enables most reasonable
|
||||||
#
|
dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||||
# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
dnl which is split up into two AX_CFLAGS_WARN_ALL and
|
||||||
#
|
dnl AX_CFLAGS_WARN_ALL_ANSI
|
||||||
# DESCRIPTION
|
dnl
|
||||||
#
|
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||||
# Try to find a compiler option that enables most reasonable
|
dnl result is added to the shellvar being CFLAGS by default.
|
||||||
# warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
dnl
|
||||||
# which is split up into two AX_CFLAGS_WARN_ALL and
|
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||||
# AX_CFLAGS_WARN_ALL_ANSI
|
dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
||||||
#
|
dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
||||||
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
dnl 10.0.0.8) C compiler.
|
||||||
# result is added to the shellvar being CFLAGS by default.
|
dnl
|
||||||
#
|
dnl - $1 shell-variable-to-add-to : CFLAGS
|
||||||
# Currently this macro knows about GCC, Solaris C compiler, Digital
|
dnl - $2 add-value-if-not-found : nothing
|
||||||
# Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
dnl - $3 action-if-found : add value to shellvariable
|
||||||
# compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
dnl - $4 action-if-not-found : nothing
|
||||||
# 10.0.0.8) C compiler.
|
dnl
|
||||||
#
|
dnl @category C
|
||||||
# - $1 shell-variable-to-add-to : CFLAGS
|
dnl @author Guido Draheim <guidod@gmx.de>
|
||||||
# - $2 add-value-if-not-found : nothing
|
dnl @version 2003-01-06
|
||||||
# - $3 action-if-found : add value to shellvariable
|
dnl @license GPLWithACException
|
||||||
# - $4 action-if-not-found : nothing
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2006-12-12
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License as
|
|
||||||
# published by the Free Software Foundation; either version 2 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
# 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# As a special exception, the respective Autoconf Macro's copyright
|
|
||||||
# owner gives unlimited permission to copy, distribute and modify the
|
|
||||||
# configure scripts that are the output of Autoconf when processing
|
|
||||||
# the Macro. You need not follow the terms of the GNU General Public
|
|
||||||
# License when using or distributing such scripts, even though
|
|
||||||
# portions of the text of the Macro appear in them. The GNU General
|
|
||||||
# Public License (GPL) does govern all other use of the material that
|
|
||||||
# constitutes the Autoconf Macro.
|
|
||||||
#
|
|
||||||
# This special exception to the GPL applies to versions of the
|
|
||||||
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
|
||||||
# make and distribute a modified version of the Autoconf Macro, you
|
|
||||||
# may extend this special exception to the GPL to apply to your
|
|
||||||
# modified version as well.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
|
AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
|
||||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||||
@@ -111,7 +72,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CXX
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic % -Wall" dnl GCC
|
in "-pedantic % -Wall" dnl GCC
|
||||||
@@ -154,5 +115,4 @@ dnl compilers will fail about it. That was needed since a lot of
|
|||||||
dnl compilers will give false positives for some option-syntax
|
dnl compilers will give false positives for some option-syntax
|
||||||
dnl like -Woption or -Xoption as they think of it is a pass-through
|
dnl like -Woption or -Xoption as they think of it is a pass-through
|
||||||
dnl to later compile stages or something. The "%" is used as a
|
dnl to later compile stages or something. The "%" is used as a
|
||||||
dnl delimimiter. A non-option comment can be given after "%%" marks
|
dnl delimimiter. A non-option comment can be given after "%%" marks.
|
||||||
dnl which will be shown but not added to the respective C/CXXFLAGS.
|
|
||||||
|
@@ -1,66 +1,27 @@
|
|||||||
##### http://autoconf-archive.cryp.to/ax_cflags_warn_all_ansi.html
|
dnl @synopsis AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
||||||
#
|
dnl
|
||||||
# SYNOPSIS
|
dnl Try to find a compiler option that enables most reasonable
|
||||||
#
|
dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||||
# AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
dnl which is split up into two AX_CFLAGS_WARN_ALL and
|
||||||
#
|
dnl AX_CFLAGS_WARN_ALL_ANSI
|
||||||
# DESCRIPTION
|
dnl
|
||||||
#
|
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||||
# Try to find a compiler option that enables most reasonable
|
dnl result is added to the shellvar being CFLAGS by default.
|
||||||
# warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
dnl
|
||||||
# which is split up into two AX_CFLAGS_WARN_ALL and
|
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||||
# AX_CFLAGS_WARN_ALL_ANSI
|
dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
||||||
#
|
dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
||||||
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
dnl 10.0.0.8) C compiler.
|
||||||
# result is added to the shellvar being CFLAGS by default.
|
dnl
|
||||||
#
|
dnl - $1 shell-variable-to-add-to : CFLAGS
|
||||||
# Currently this macro knows about GCC, Solaris C compiler, Digital
|
dnl - $2 add-value-if-not-found : nothing
|
||||||
# Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
dnl - $3 action-if-found : add value to shellvariable
|
||||||
# compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
dnl - $4 action-if-not-found : nothing
|
||||||
# 10.0.0.8) C compiler.
|
dnl
|
||||||
#
|
dnl @category C
|
||||||
# - $1 shell-variable-to-add-to : CFLAGS
|
dnl @author Guido Draheim <guidod@gmx.de>
|
||||||
# - $2 add-value-if-not-found : nothing
|
dnl @version 2003-01-06
|
||||||
# - $3 action-if-found : add value to shellvariable
|
dnl @license GPLWithACException
|
||||||
# - $4 action-if-not-found : nothing
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2006-12-12
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License as
|
|
||||||
# published by the Free Software Foundation; either version 2 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
# 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# As a special exception, the respective Autoconf Macro's copyright
|
|
||||||
# owner gives unlimited permission to copy, distribute and modify the
|
|
||||||
# configure scripts that are the output of Autoconf when processing
|
|
||||||
# the Macro. You need not follow the terms of the GNU General Public
|
|
||||||
# License when using or distributing such scripts, even though
|
|
||||||
# portions of the text of the Macro appear in them. The GNU General
|
|
||||||
# Public License (GPL) does govern all other use of the material that
|
|
||||||
# constitutes the Autoconf Macro.
|
|
||||||
#
|
|
||||||
# This special exception to the GPL applies to versions of the
|
|
||||||
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
|
||||||
# make and distribute a modified version of the Autoconf Macro, you
|
|
||||||
# may extend this special exception to the GPL to apply to your
|
|
||||||
# modified version as well.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
|
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
|
||||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||||
@@ -116,7 +77,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CXX
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
# IRIX C compiler:
|
# IRIX C compiler:
|
||||||
# -use_readonly_const is the default for IRIX C,
|
# -use_readonly_const is the default for IRIX C,
|
||||||
|
@@ -1,52 +1,13 @@
|
|||||||
##### http://autoconf-archive.cryp.to/type_socklen_t.html
|
dnl @synopsis TYPE_SOCKLEN_T
|
||||||
#
|
dnl
|
||||||
# SYNOPSIS
|
dnl Check whether sys/socket.h defines type socklen_t. Please note that
|
||||||
#
|
dnl some systems require sys/types.h to be included before sys/socket.h
|
||||||
# TYPE_SOCKLEN_T
|
dnl can be compiled.
|
||||||
#
|
dnl
|
||||||
# DESCRIPTION
|
dnl @category Misc
|
||||||
#
|
dnl @author Lars Brinkhoff <lars@nocrew.org>
|
||||||
# Check whether sys/socket.h defines type socklen_t. Please note that
|
dnl @version 2005-01-11
|
||||||
# some systems require sys/types.h to be included before sys/socket.h
|
dnl @license GPLWithACException
|
||||||
# can be compiled.
|
|
||||||
#
|
|
||||||
# LAST MODIFICATION
|
|
||||||
#
|
|
||||||
# 2005-01-11
|
|
||||||
#
|
|
||||||
# COPYLEFT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2005 Lars Brinkhoff <lars@nocrew.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License as
|
|
||||||
# published by the Free Software Foundation; either version 2 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
# 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# As a special exception, the respective Autoconf Macro's copyright
|
|
||||||
# owner gives unlimited permission to copy, distribute and modify the
|
|
||||||
# configure scripts that are the output of Autoconf when processing
|
|
||||||
# the Macro. You need not follow the terms of the GNU General Public
|
|
||||||
# License when using or distributing such scripts, even though
|
|
||||||
# portions of the text of the Macro appear in them. The GNU General
|
|
||||||
# Public License (GPL) does govern all other use of the material that
|
|
||||||
# constitutes the Autoconf Macro.
|
|
||||||
#
|
|
||||||
# This special exception to the GPL applies to versions of the
|
|
||||||
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
|
||||||
# make and distribute a modified version of the Autoconf Macro, you
|
|
||||||
# may extend this special exception to the GPL to apply to your
|
|
||||||
# modified version as well.
|
|
||||||
|
|
||||||
AC_DEFUN([TYPE_SOCKLEN_T],
|
AC_DEFUN([TYPE_SOCKLEN_T],
|
||||||
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
|
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
|
||||||
|
14
svnignore
14
svnignore
@@ -1,14 +0,0 @@
|
|||||||
.deps
|
|
||||||
.dirstamp
|
|
||||||
.libs
|
|
||||||
.*.swp
|
|
||||||
*~
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
autoconfig.h*
|
|
||||||
autom4te.cache
|
|
||||||
config*
|
|
||||||
libtool
|
|
||||||
libupnp.pc
|
|
||||||
stamp-h*
|
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef FREE_LIST_H
|
#ifndef FREE_LIST_H
|
||||||
#define FREE_LIST_H
|
#define FREE_LIST_H
|
||||||
@@ -36,6 +36,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//#include <malloc.h>
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -49,7 +52,7 @@ extern "C" {
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct FREELISTNODE
|
typedef struct FREELISTNODE
|
||||||
{
|
{
|
||||||
struct FREELISTNODE *next;
|
struct FREELISTNODE*next; //pointer to next free node
|
||||||
} FreeListNode;
|
} FreeListNode;
|
||||||
|
|
||||||
|
|
||||||
@@ -62,10 +65,12 @@ typedef struct FREELISTNODE
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct FREELIST
|
typedef struct FREELIST
|
||||||
{
|
{
|
||||||
FreeListNode *head;
|
FreeListNode *head; //head of free list
|
||||||
size_t element_size;
|
size_t element_size; //size of elements in free
|
||||||
int maxFreeListLength;
|
//list
|
||||||
int freeListLength;
|
int maxFreeListLength; //max size of free structures
|
||||||
|
//to keep
|
||||||
|
int freeListLength; //current size of free list
|
||||||
|
|
||||||
}FreeList;
|
}FreeList;
|
||||||
|
|
||||||
@@ -136,5 +141,4 @@ int FreeListDestroy (FreeList *free_list);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* FREE_LIST_H */
|
#endif // FREE_LIST_H
|
||||||
|
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef LINKED_LIST_H
|
#ifndef LINKED_LIST_H
|
||||||
#define LINKED_LIST_H
|
#define LINKED_LIST_H
|
||||||
@@ -70,9 +70,9 @@ typedef int (*cmp_routine)(void *itemA,void *itemB);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct LISTNODE
|
typedef struct LISTNODE
|
||||||
{
|
{
|
||||||
struct LISTNODE *prev;
|
struct LISTNODE *prev; //previous node
|
||||||
struct LISTNODE *next;
|
struct LISTNODE *next; //next node
|
||||||
void *item;
|
void *item; //item
|
||||||
} ListNode;
|
} ListNode;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -96,12 +96,12 @@ typedef struct LISTNODE
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct LINKEDLIST
|
typedef struct LINKEDLIST
|
||||||
{
|
{
|
||||||
ListNode head; /* head, first item is stored at: head->next */
|
ListNode head; //head, first item is stored at: head->next
|
||||||
ListNode tail; /* tail, last item is stored at: tail->prev */
|
ListNode tail; //tail, last item is stored at: tail->prev
|
||||||
long size; /* size of list */
|
long size; //size of list
|
||||||
FreeList freeNodeList; /* free list to use */
|
FreeList freeNodeList; //free list to use
|
||||||
free_function free_func; /* free function to use */
|
free_function free_func; //free function to use
|
||||||
cmp_routine cmp_func; /* compare function to use */
|
cmp_routine cmp_func; //compare function to use
|
||||||
} LinkedList;
|
} LinkedList;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -327,5 +327,4 @@ int ListSize(LinkedList* list);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* LINKED_LIST_H */
|
#endif //LINKED_LIST_H
|
||||||
|
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef THREADPOOL_H
|
#ifndef THREADPOOL_H
|
||||||
#define THREADPOOL_H
|
#define THREADPOOL_H
|
||||||
@@ -36,17 +36,17 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Size of job free list */
|
//Size of job free list
|
||||||
#define JOBFREELISTSIZE 100
|
#define JOBFREELISTSIZE 100
|
||||||
|
|
||||||
#define INFINITE_THREADS -1
|
#define INFINITE_THREADS -1
|
||||||
|
|
||||||
#define EMAXTHREADS (-8 & 1<<29)
|
#define EMAXTHREADS (-8 & 1<<29)
|
||||||
|
|
||||||
/* Invalid Policy */
|
//Invalid Policy
|
||||||
#define INVALID_POLICY (-9 & 1<<29)
|
#define INVALID_POLICY (-9 & 1<<29)
|
||||||
|
|
||||||
/* Invalid JOB Id */
|
//Invalid JOB Id
|
||||||
#define INVALID_JOB_ID (-2 & 1<<29)
|
#define INVALID_JOB_ID (-2 & 1<<29)
|
||||||
|
|
||||||
typedef enum duration {SHORT_TERM,PERSISTENT} Duration;
|
typedef enum duration {SHORT_TERM,PERSISTENT} Duration;
|
||||||
@@ -55,31 +55,40 @@ typedef enum priority {LOW_PRIORITY,
|
|||||||
MED_PRIORITY,
|
MED_PRIORITY,
|
||||||
HIGH_PRIORITY} ThreadPriority;
|
HIGH_PRIORITY} ThreadPriority;
|
||||||
|
|
||||||
#define DEFAULT_PRIORITY MED_PRIORITY /* default priority used by TPJobInit */
|
#define DEFAULT_PRIORITY MED_PRIORITY //default priority used by TPJobInit
|
||||||
#define DEFAULT_MIN_THREADS 1 /* default minimum used by TPAttrInit */
|
#define DEFAULT_MIN_THREADS 1 //default minimum used by TPAttrInit
|
||||||
#define DEFAULT_MAX_THREADS 10 /* default max used by TPAttrInit */
|
#define DEFAULT_MAX_THREADS 10 //default max used by TPAttrInit
|
||||||
#define DEFAULT_JOBS_PER_THREAD 10 /* default jobs per thread used by TPAttrInit */
|
#define DEFAULT_JOBS_PER_THREAD 10 //default jobs per thread used by TPAttrInit
|
||||||
#define DEFAULT_STARVATION_TIME 500 /* default starvation time used by TPAttrInit */
|
#define DEFAULT_STARVATION_TIME 500 //default starvation time used by TPAttrInit
|
||||||
#define DEFAULT_IDLE_TIME 10 * 1000 /* default idle time used by TPAttrInit */
|
#define DEFAULT_IDLE_TIME 10 * 1000 //default idle time used by TPAttrInit
|
||||||
#define DEFAULT_FREE_ROUTINE NULL /* default free routine used TPJobInit */
|
#define DEFAULT_FREE_ROUTINE NULL //default free routine used TPJobInit
|
||||||
#define DEFAULT_MAX_JOBS_TOTAL 100 /* default max jobs used TPAttrInit */
|
#define DEFAULT_MAX_JOBS_TOTAL 100 //default max jobs used TPAttrInit
|
||||||
|
|
||||||
#define STATS 1 /* always include stats because code change is minimal */
|
#define STATS 1 //always include stats because code change is minimal
|
||||||
|
|
||||||
|
|
||||||
/* Statistics */
|
//Statistics
|
||||||
#ifdef WIN32 /* TODO: check why STATSONLY fails during compilation */
|
#ifdef WIN32 // todo: check why STATSONLY fails during compilation
|
||||||
#undef STATS
|
#undef STATS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STATS
|
#ifdef STATS
|
||||||
#define STATSONLY(x) x
|
#define STATSONLY(x) x
|
||||||
#else
|
#else
|
||||||
#define STATSONLY(x)
|
#define STATSONLY(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//DEBUGGING
|
||||||
|
#ifndef WIN32
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define DBGONLY(x) x
|
||||||
|
#else
|
||||||
|
#define DBGONLY(x)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "LinkedList.h"
|
#include "LinkedList.h"
|
||||||
@@ -92,7 +101,7 @@ typedef enum priority {LOW_PRIORITY,
|
|||||||
#define EXPORT
|
#define EXPORT
|
||||||
typedef int PolicyType;
|
typedef int PolicyType;
|
||||||
#define DEFAULT_POLICY SCHED_OTHER
|
#define DEFAULT_POLICY SCHED_OTHER
|
||||||
#define DEFAULT_SCHED_PARAM 0 /* default priority */
|
#define DEFAULT_SCHED_PARAM 0 //default priority
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: free_routine
|
* Name: free_routine
|
||||||
@@ -111,25 +120,25 @@ typedef void (*free_routine)(void *arg);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct THREADPOOLATTR
|
typedef struct THREADPOOLATTR
|
||||||
{
|
{
|
||||||
int minThreads; /* minThreads, ThreadPool will always maintain at least
|
int minThreads; // minThreads, ThreadPool will always maintain at least
|
||||||
this many threads */
|
// this many threads
|
||||||
|
|
||||||
int maxThreads; /* maxThreads, ThreadPool will never have more than this
|
int maxThreads; // maxThreads, ThreadPool will never have more than this
|
||||||
number of threads */
|
// number of threads
|
||||||
|
|
||||||
int maxIdleTime; /* maxIdleTime (in milliseconds)
|
int maxIdleTime; // maxIdleTime (in milliseconds)
|
||||||
this is the maximum time a thread will remain idle
|
// this is the maximum time a thread will remain idle
|
||||||
before dying */
|
// before dying
|
||||||
|
|
||||||
int jobsPerThread; /* jobs per thread to maintain */
|
int jobsPerThread; // jobs per thread to maintain
|
||||||
|
|
||||||
int maxJobsTotal; /* maximum number of jobs that can be queued totally. */
|
int maxJobsTotal; // maximum number of jobs that can be queued totally.
|
||||||
|
|
||||||
int starvationTime; /* the time a low priority or med priority
|
int starvationTime; // the time a low priority or med priority
|
||||||
job waits before getting bumped
|
// job waits before getting bumped
|
||||||
up a priority (in milliseconds) */
|
// up a priority (in milliseconds)
|
||||||
|
|
||||||
PolicyType schedPolicy; /* scheduling policy to use */
|
PolicyType schedPolicy; // scheduling policy to use
|
||||||
|
|
||||||
} ThreadPoolAttr;
|
} ThreadPoolAttr;
|
||||||
|
|
||||||
@@ -141,12 +150,12 @@ typedef struct THREADPOOLATTR
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct THREADPOOLJOB
|
typedef struct THREADPOOLJOB
|
||||||
{
|
{
|
||||||
start_routine func;
|
start_routine func; //function
|
||||||
void *arg;
|
void *arg; //arg
|
||||||
free_routine free_func;
|
free_routine free_func; //free function
|
||||||
struct timeb requestTime;
|
struct timeb requestTime; //time of request
|
||||||
int priority;
|
int priority; //priority of request
|
||||||
int jobId;
|
int jobId; //id
|
||||||
} ThreadPoolJob;
|
} ThreadPoolJob;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -156,32 +165,32 @@ typedef struct THREADPOOLJOB
|
|||||||
* Structure to hold statistics
|
* Structure to hold statistics
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifdef STATS
|
STATSONLY(
|
||||||
|
|
||||||
typedef struct TPOOLSTATS
|
typedef struct TPOOLSTATS
|
||||||
{
|
{
|
||||||
double totalTimeHQ;
|
double totalTimeHQ; //total time spent by all jobs in high priority Q
|
||||||
int totalJobsHQ;
|
int totalJobsHQ; //total jobs in HQ run so far
|
||||||
double avgWaitHQ;
|
double avgWaitHQ; //average wait in HQ
|
||||||
double totalTimeMQ;
|
double totalTimeMQ; //total time spent by all jobs in med priority Q
|
||||||
int totalJobsMQ;
|
int totalJobsMQ; //total jobs in MQ run so far
|
||||||
double avgWaitMQ;
|
double avgWaitMQ; //average wait in MQ
|
||||||
double totalTimeLQ;
|
double totalTimeLQ; //total time spent by all jobs in low priority Q
|
||||||
int totalJobsLQ;
|
int totalJobsLQ; //total jobs in LQ run so far
|
||||||
double avgWaitLQ;
|
double avgWaitLQ; //average wait in LQ
|
||||||
double totalWorkTime;
|
double totalWorkTime; //total time spent working for all threads
|
||||||
double totalIdleTime;
|
double totalIdleTime; //total time spent idle for all threads
|
||||||
int workerThreads;
|
int workerThreads; //number of current workerThreads
|
||||||
int idleThreads;
|
int idleThreads; //number of current idle threads
|
||||||
int persistentThreads;
|
int persistentThreads; //number of persistent threads
|
||||||
int totalThreads;
|
int totalThreads; //total number of current threads
|
||||||
int maxThreads;
|
int maxThreads; //max threads so far
|
||||||
int currentJobsHQ;
|
int currentJobsHQ; // current jobs in Q
|
||||||
int currentJobsLQ;
|
int currentJobsLQ; //current jobs in Q
|
||||||
int currentJobsMQ;
|
int currentJobsMQ; //current jobs in Q
|
||||||
}ThreadPoolStats;
|
}ThreadPoolStats;
|
||||||
|
|
||||||
#endif
|
)
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -206,26 +215,24 @@ typedef struct TPOOLSTATS
|
|||||||
|
|
||||||
typedef struct THREADPOOL
|
typedef struct THREADPOOL
|
||||||
{
|
{
|
||||||
ithread_mutex_t mutex; /* mutex to protect job qs */
|
ithread_mutex_t mutex; //mutex to protect job qs
|
||||||
ithread_cond_t condition; /* condition variable to signal Q */
|
ithread_cond_t condition; //condition variable to signal Q
|
||||||
ithread_cond_t start_and_shutdown; /* condition variable for start
|
ithread_cond_t start_and_shutdown; //condition variable for start
|
||||||
and stop */
|
//and stop
|
||||||
int lastJobId; /* ids for jobs */
|
int lastJobId; //ids for jobs
|
||||||
int shutdown; /* whether or not we are shutting down */
|
int shutdown; //whether or not we are shutting down
|
||||||
int totalThreads; /* total number of threads */
|
int totalThreads; //total number of threads
|
||||||
int persistentThreads; /* number of persistent threads */
|
int persistentThreads; //number of persistent threads
|
||||||
FreeList jobFreeList; /* free list of jobs */
|
FreeList jobFreeList; //free list of jobs
|
||||||
LinkedList lowJobQ; /* low priority job Q */
|
LinkedList lowJobQ; //low priority job Q
|
||||||
LinkedList medJobQ; /* med priority job Q */
|
LinkedList medJobQ; //med priority job Q
|
||||||
LinkedList highJobQ; /* high priority job Q */
|
LinkedList highJobQ; //high priority job Q
|
||||||
ThreadPoolJob *persistentJob; /* persistent job */
|
ThreadPoolJob *persistentJob; //persistent job
|
||||||
|
|
||||||
ThreadPoolAttr attr; /* thread pool attributes */
|
ThreadPoolAttr attr; //thread pool attributes
|
||||||
|
|
||||||
#ifdef STATS
|
//statistics
|
||||||
/* statistics */
|
STATSONLY(ThreadPoolStats stats;)
|
||||||
ThreadPoolStats stats;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} ThreadPool;
|
} ThreadPool;
|
||||||
|
|
||||||
@@ -543,15 +550,12 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
|||||||
* Returns:
|
* Returns:
|
||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef STATS
|
STATSONLY( EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats););
|
||||||
EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
|
||||||
|
|
||||||
EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
STATSONLY(EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats););
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ThreadPool */
|
#endif //ThreadPool
|
||||||
|
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef TIMERTHREAD_H
|
#ifndef TIMERTHREAD_H
|
||||||
#define TIMERTHREAD_H
|
#define TIMERTHREAD_H
|
||||||
@@ -43,9 +43,9 @@ extern "C" {
|
|||||||
|
|
||||||
#define INVALID_EVENT_ID (-10 & 1<<29)
|
#define INVALID_EVENT_ID (-10 & 1<<29)
|
||||||
|
|
||||||
/* Timeout Types */
|
//Timeout Types
|
||||||
/* absolute means in seconds from Jan 1, 1970 */
|
//absolute means in seconds from Jan 1, 1970
|
||||||
/* relative means in seconds from current time */
|
//relative means in seconds from current time
|
||||||
typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,13 +63,13 @@ typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct TIMERTHREAD
|
typedef struct TIMERTHREAD
|
||||||
{
|
{
|
||||||
ithread_mutex_t mutex;
|
ithread_mutex_t mutex; //mutex to protect eventQ
|
||||||
ithread_cond_t condition;
|
ithread_cond_t condition; //condition variable
|
||||||
int lastEventId;
|
int lastEventId; //last event id
|
||||||
LinkedList eventQ;
|
LinkedList eventQ; //event q
|
||||||
int shutdown;
|
int shutdown; //whether or not we are shutdown
|
||||||
FreeList freeEvents;
|
FreeList freeEvents; //FreeList for events
|
||||||
ThreadPool *tp;
|
ThreadPool *tp; //ThreadPool to use
|
||||||
} TimerThread;
|
} TimerThread;
|
||||||
|
|
||||||
|
|
||||||
@@ -85,9 +85,9 @@ typedef struct TIMERTHREAD
|
|||||||
typedef struct TIMEREVENT
|
typedef struct TIMEREVENT
|
||||||
{
|
{
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
time_t eventTime; /* absolute time for event in seconds since Jan 1, 1970 */
|
time_t eventTime; //absolute time for event in seconds since Jan 1, 1970
|
||||||
Duration persistent; /* long term or short term job */
|
Duration persistent; //long term or short term job
|
||||||
int id;
|
int id; //id of job
|
||||||
} TimerEvent;
|
} TimerEvent;
|
||||||
|
|
||||||
|
|
||||||
@@ -188,5 +188,4 @@ int TimerThreadShutdown(TimerThread *timer);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* TIMER_THREAD_H */
|
#endif //TIMER_THREAD_H
|
||||||
|
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef ITHREADH
|
#ifndef ITHREADH
|
||||||
#define ITHREADH
|
#define ITHREADH
|
||||||
@@ -36,13 +36,15 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#ifdef DEBUG
|
||||||
#ifndef WIN32
|
#define DEBUG_ONLY(x) x
|
||||||
#include <unistd.h>
|
#else
|
||||||
|
#define DEBUG_ONLY(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#include <pthread.h>
|
||||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
#ifndef WIN32
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||||
@@ -542,23 +544,23 @@ extern "C" {
|
|||||||
#define imillisleep(x) usleep(1000*x)
|
#define imillisleep(x) usleep(1000*x)
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef UPNP_STATIC_LIB
|
#ifndef UPNP_STATIC_LIB
|
||||||
#ifdef LIBUPNP_EXPORTS
|
#ifdef LIBUPNP_EXPORTS
|
||||||
/* set up declspec for dll export to make functions visible to library users */
|
// set up declspec for dll export to make functions visible to library users
|
||||||
#define EXPORT_SPEC __declspec(dllexport)
|
#define EXPORT_SPEC __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC __declspec(dllimport)
|
#define EXPORT_SPEC __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef PTHREAD_MUTEX_RECURSIVE
|
#ifndef PTHREAD_MUTEX_RECURSIVE
|
||||||
/* NK: Added for satisfying the gcc compiler */
|
//NK: Added for satisfying the gcc compiler
|
||||||
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -566,5 +568,4 @@ EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ITHREADH */
|
#endif //ITHREADH
|
||||||
|
|
||||||
|
@@ -30,8 +30,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "LinkedList.h"
|
#include "LinkedList.h"
|
||||||
#include <sys/param.h>
|
#ifdef __FreeBSD__
|
||||||
#if (defined(BSD) && BSD >= 199306)
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
@@ -96,14 +96,12 @@ SetPolicyType( PolicyType in )
|
|||||||
#else
|
#else
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
return sched_setscheduler( 0, in);
|
return sched_setscheduler( 0, in);
|
||||||
#elif defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
|
#else
|
||||||
struct sched_param current;
|
struct sched_param current;
|
||||||
|
|
||||||
sched_getparam( 0, ¤t );
|
sched_getparam( 0, ¤t );
|
||||||
current.sched_priority = DEFAULT_SCHED_PARAM;
|
current.sched_priority = DEFAULT_SCHED_PARAM;
|
||||||
return sched_setscheduler( 0, in, ¤t );
|
return sched_setscheduler( 0, in, ¤t );
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -125,7 +123,7 @@ SetPolicyType( PolicyType in )
|
|||||||
static int
|
static int
|
||||||
SetPriority( ThreadPriority priority )
|
SetPriority( ThreadPriority priority )
|
||||||
{
|
{
|
||||||
#if defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
|
|
||||||
int currentPolicy;
|
int currentPolicy;
|
||||||
int minPriority = 0;
|
int minPriority = 0;
|
||||||
int maxPriority = 0;
|
int maxPriority = 0;
|
||||||
@@ -133,7 +131,7 @@ SetPriority( ThreadPriority priority )
|
|||||||
int midPriority = 0;
|
int midPriority = 0;
|
||||||
struct sched_param newPriority;
|
struct sched_param newPriority;
|
||||||
|
|
||||||
pthread_getschedparam( ithread_self(), ¤tPolicy,
|
pthread_getschedparam( ithread_self( ), ¤tPolicy,
|
||||||
&newPriority );
|
&newPriority );
|
||||||
minPriority = sched_get_priority_min( currentPolicy );
|
minPriority = sched_get_priority_min( currentPolicy );
|
||||||
maxPriority = sched_get_priority_max( currentPolicy );
|
maxPriority = sched_get_priority_max( currentPolicy );
|
||||||
@@ -155,11 +153,9 @@ SetPriority( ThreadPriority priority )
|
|||||||
|
|
||||||
newPriority.sched_priority = actPriority;
|
newPriority.sched_priority = actPriority;
|
||||||
|
|
||||||
return pthread_setschedparam( ithread_self(), currentPolicy,
|
return pthread_setschedparam( ithread_self( ), currentPolicy,
|
||||||
&newPriority );
|
&newPriority );
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -224,8 +220,10 @@ BumpPriority( ThreadPool * tp )
|
|||||||
//starvation time
|
//starvation time
|
||||||
//bump priority (add to higher priority Q)
|
//bump priority (add to higher priority Q)
|
||||||
|
|
||||||
STATSONLY( tp->stats.totalJobsMQ++; )
|
STATSONLY( tp->stats.totalJobsMQ++;
|
||||||
STATSONLY( tp->stats.totalTimeMQ += diffTime; )
|
);
|
||||||
|
STATSONLY( tp->stats.totalTimeMQ += diffTime;
|
||||||
|
);
|
||||||
|
|
||||||
ListDelNode( &tp->medJobQ, tp->medJobQ.head.next, 0 );
|
ListDelNode( &tp->medJobQ, tp->medJobQ.head.next, 0 );
|
||||||
ListAddTail( &tp->highJobQ, tempJob );
|
ListAddTail( &tp->highJobQ, tempJob );
|
||||||
@@ -243,8 +241,10 @@ BumpPriority( ThreadPool * tp )
|
|||||||
//starvation time
|
//starvation time
|
||||||
//bump priority (add to higher priority Q)
|
//bump priority (add to higher priority Q)
|
||||||
|
|
||||||
STATSONLY( tp->stats.totalJobsLQ++; )
|
STATSONLY( tp->stats.totalJobsLQ++;
|
||||||
STATSONLY( tp->stats.totalTimeLQ += diffTime; )
|
);
|
||||||
|
STATSONLY( tp->stats.totalTimeLQ += diffTime;
|
||||||
|
);
|
||||||
|
|
||||||
ListDelNode( &tp->lowJobQ, tp->lowJobQ.head.next, 0 );
|
ListDelNode( &tp->lowJobQ, tp->lowJobQ.head.next, 0 );
|
||||||
ListAddTail( &tp->medJobQ, tempJob );
|
ListAddTail( &tp->medJobQ, tempJob );
|
||||||
@@ -293,26 +293,14 @@ SetRelTimeout( struct timespec *time,
|
|||||||
* ThreadPoolStats *stats must be valid non null stats structure
|
* ThreadPoolStats *stats must be valid non null stats structure
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef STATS
|
#ifdef STATS
|
||||||
static void StatsInit( ThreadPoolStats * stats )
|
static void StatsInit( ThreadPoolStats * stats ) {
|
||||||
{
|
assert( stats != NULL ); stats->totalIdleTime = 0; stats->totalJobsHQ = 0; stats->totalJobsLQ = 0; stats->totalJobsMQ = 0; stats->totalTimeHQ = 0; stats->totalTimeMQ = 0; stats->totalTimeLQ = 0; stats->totalWorkTime = 0; stats->totalIdleTime = 0; stats->avgWaitHQ = 0; //average wait in HQ
|
||||||
assert( stats != NULL );
|
stats->avgWaitMQ = 0; //average wait in MQ
|
||||||
stats->totalIdleTime = 0;
|
|
||||||
stats->totalJobsHQ = 0;
|
|
||||||
stats->totalJobsLQ = 0;
|
|
||||||
stats->totalJobsMQ = 0;
|
|
||||||
stats->totalTimeHQ = 0;
|
|
||||||
stats->totalTimeMQ = 0;
|
|
||||||
stats->totalTimeLQ = 0;
|
|
||||||
stats->totalWorkTime = 0;
|
|
||||||
stats->totalIdleTime = 0;
|
|
||||||
stats->avgWaitHQ = 0;
|
|
||||||
stats->avgWaitMQ = 0;
|
|
||||||
stats->avgWaitLQ = 0;
|
stats->avgWaitLQ = 0;
|
||||||
stats->workerThreads = 0;
|
stats->workerThreads = 0;
|
||||||
stats->idleThreads = 0;
|
stats->idleThreads = 0;
|
||||||
stats->persistentThreads = 0;
|
stats->persistentThreads = 0;
|
||||||
stats->maxThreads = 0; stats->totalThreads = 0;
|
stats->maxThreads = 0; stats->totalThreads = 0;}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -358,25 +346,18 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void SetSeed() {
|
static void SetSeed( ) {
|
||||||
struct timeb t;
|
struct timeb t;
|
||||||
|
|
||||||
ftime( &t );
|
ftime( &t );
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id().p );
|
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id( ).p );
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id() );
|
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id( ) );
|
||||||
#elif defined(__linux__)
|
|
||||||
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id() );
|
|
||||||
#else
|
#else
|
||||||
{
|
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id( ) );
|
||||||
volatile union { volatile pthread_t tid; volatile unsigned i; } idu;
|
|
||||||
|
|
||||||
idu.tid = ithread_get_current_thread_id();
|
|
||||||
srand( ( unsigned int )t.millitm + idu.i );
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: WorkerThread
|
* Function: WorkerThread
|
||||||
@@ -394,7 +375,8 @@ static void SetSeed() {
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static void *WorkerThread( void *arg ) {
|
static void *WorkerThread( void *arg ) {
|
||||||
|
|
||||||
STATSONLY( time_t start = 0; )
|
STATSONLY( time_t start = 0;
|
||||||
|
)
|
||||||
|
|
||||||
ThreadPoolJob *job = NULL;
|
ThreadPoolJob *job = NULL;
|
||||||
ListNode *head = NULL;
|
ListNode *head = NULL;
|
||||||
@@ -418,9 +400,10 @@ static void SetSeed() {
|
|||||||
ithread_cond_broadcast( &tp->start_and_shutdown );
|
ithread_cond_broadcast( &tp->start_and_shutdown );
|
||||||
ithread_mutex_unlock( &tp->mutex );
|
ithread_mutex_unlock( &tp->mutex );
|
||||||
|
|
||||||
SetSeed();
|
SetSeed( );
|
||||||
|
|
||||||
STATSONLY( time( &start ); )
|
STATSONLY( time( &start );
|
||||||
|
);
|
||||||
|
|
||||||
while( 1 ) {
|
while( 1 ) {
|
||||||
|
|
||||||
@@ -435,9 +418,12 @@ static void SetSeed() {
|
|||||||
|
|
||||||
retCode = 0;
|
retCode = 0;
|
||||||
|
|
||||||
STATSONLY( tp->stats.idleThreads++; )
|
STATSONLY( tp->stats.idleThreads++;
|
||||||
STATSONLY( tp->stats.totalWorkTime += ( time( NULL ) - start ); ) //work time
|
);
|
||||||
STATSONLY( time( &start ); ) // idle time
|
STATSONLY( tp->stats.totalWorkTime += ( time( NULL ) - start );
|
||||||
|
); //work time
|
||||||
|
STATSONLY( time( &start );
|
||||||
|
); //idle time
|
||||||
|
|
||||||
if( persistent == 1 ) {
|
if( persistent == 1 ) {
|
||||||
//Persistent thread
|
//Persistent thread
|
||||||
@@ -445,7 +431,8 @@ static void SetSeed() {
|
|||||||
tp->persistentThreads--;
|
tp->persistentThreads--;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATSONLY( if( persistent == 0 ) tp->stats.workerThreads--; )
|
STATSONLY( if( persistent == 0 )
|
||||||
|
tp->stats.workerThreads--; );
|
||||||
|
|
||||||
//Check for a job or shutdown
|
//Check for a job or shutdown
|
||||||
while( ( tp->lowJobQ.size == 0 )
|
while( ( tp->lowJobQ.size == 0 )
|
||||||
@@ -466,7 +453,7 @@ static void SetSeed() {
|
|||||||
&& ( ( tp->totalThreads ) >
|
&& ( ( tp->totalThreads ) >
|
||||||
tp->attr.maxThreads ) ) ) {
|
tp->attr.maxThreads ) ) ) {
|
||||||
|
|
||||||
STATSONLY( tp->stats.idleThreads--; )
|
STATSONLY( tp->stats.idleThreads-- );
|
||||||
|
|
||||||
tp->totalThreads--;
|
tp->totalThreads--;
|
||||||
ithread_cond_broadcast( &tp->start_and_shutdown );
|
ithread_cond_broadcast( &tp->start_and_shutdown );
|
||||||
@@ -488,9 +475,12 @@ static void SetSeed() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATSONLY( tp->stats.idleThreads--; )
|
STATSONLY( tp->stats.idleThreads--;
|
||||||
STATSONLY( tp->stats.totalIdleTime += ( time( NULL ) - start ); ) // idle time
|
);
|
||||||
STATSONLY( time( &start ); ) // work time
|
STATSONLY( tp->stats.totalIdleTime += ( time( NULL ) - start );
|
||||||
|
); //idle time
|
||||||
|
STATSONLY( time( &start );
|
||||||
|
); //work time
|
||||||
|
|
||||||
//bump priority of starved jobs
|
//bump priority of starved jobs
|
||||||
BumpPriority( tp );
|
BumpPriority( tp );
|
||||||
@@ -522,33 +512,34 @@ static void SetSeed() {
|
|||||||
ithread_cond_broadcast( &tp->start_and_shutdown );
|
ithread_cond_broadcast( &tp->start_and_shutdown );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
STATSONLY( tp->stats.workerThreads++; )
|
STATSONLY( tp->stats.workerThreads++ );
|
||||||
persistent = 0;
|
persistent = 0;
|
||||||
|
|
||||||
//Pick the highest priority job
|
//Pick the highest priority job
|
||||||
if( tp->highJobQ.size > 0 ) {
|
if( tp->highJobQ.size > 0 ) {
|
||||||
head = ListHead( &tp->highJobQ );
|
head = ListHead( &tp->highJobQ );
|
||||||
job = ( ThreadPoolJob * ) head->item;
|
job = ( ThreadPoolJob * ) head->item;
|
||||||
STATSONLY( CalcWaitTime( tp, HIGH_PRIORITY, job ); )
|
STATSONLY( CalcWaitTime
|
||||||
|
( tp, HIGH_PRIORITY, job ) );
|
||||||
ListDelNode( &tp->highJobQ, head, 0 );
|
ListDelNode( &tp->highJobQ, head, 0 );
|
||||||
|
|
||||||
} else if( tp->medJobQ.size > 0 ) {
|
} else if( tp->medJobQ.size > 0 ) {
|
||||||
head = ListHead( &tp->medJobQ );
|
head = ListHead( &tp->medJobQ );
|
||||||
job = ( ThreadPoolJob * ) head->item;
|
job = ( ThreadPoolJob * ) head->item;
|
||||||
STATSONLY( CalcWaitTime( tp, MED_PRIORITY, job ); )
|
STATSONLY( CalcWaitTime( tp, MED_PRIORITY, job ) );
|
||||||
ListDelNode( &tp->medJobQ, head, 0 );
|
ListDelNode( &tp->medJobQ, head, 0 );
|
||||||
|
|
||||||
} else if( tp->lowJobQ.size > 0 ) {
|
} else if( tp->lowJobQ.size > 0 ) {
|
||||||
head = ListHead( &tp->lowJobQ );
|
head = ListHead( &tp->lowJobQ );
|
||||||
job = ( ThreadPoolJob * ) head->item;
|
job = ( ThreadPoolJob * ) head->item;
|
||||||
STATSONLY( CalcWaitTime( tp, LOW_PRIORITY, job ); )
|
STATSONLY( CalcWaitTime( tp, LOW_PRIORITY, job ) );
|
||||||
ListDelNode( &tp->lowJobQ, head, 0 );
|
ListDelNode( &tp->lowJobQ, head, 0 );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Should never get here
|
// Should never get here
|
||||||
assert( 0 );
|
assert( 0 );
|
||||||
STATSONLY( tp->stats.workerThreads--; )
|
STATSONLY( tp->stats.workerThreads-- );
|
||||||
tp->totalThreads--;
|
tp->totalThreads--;
|
||||||
ithread_cond_broadcast( &tp->start_and_shutdown );
|
ithread_cond_broadcast( &tp->start_and_shutdown );
|
||||||
ithread_mutex_unlock( &tp->mutex );
|
ithread_mutex_unlock( &tp->mutex );
|
||||||
@@ -653,11 +644,9 @@ static void SetSeed() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef STATS
|
STATSONLY( if( tp->stats.maxThreads < tp->totalThreads ) {
|
||||||
if( tp->stats.maxThreads < tp->totalThreads ) {
|
tp->stats.maxThreads = tp->totalThreads;}
|
||||||
tp->stats.maxThreads = tp->totalThreads;
|
)
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -685,7 +674,7 @@ static void SetSeed() {
|
|||||||
threads = tp->totalThreads - tp->persistentThreads;
|
threads = tp->totalThreads - tp->persistentThreads;
|
||||||
|
|
||||||
while( ( threads == 0 )
|
while( ( threads == 0 )
|
||||||
|| ( ( jobs / threads ) >= tp->attr.jobsPerThread ) ) {
|
|| ( ( jobs / threads ) > tp->attr.jobsPerThread ) ) {
|
||||||
|
|
||||||
if( CreateWorker( tp ) != 0 )
|
if( CreateWorker( tp ) != 0 )
|
||||||
return;
|
return;
|
||||||
@@ -777,7 +766,7 @@ static void SetSeed() {
|
|||||||
JOBFREELISTSIZE );
|
JOBFREELISTSIZE );
|
||||||
assert( retCode == 0 );
|
assert( retCode == 0 );
|
||||||
|
|
||||||
STATSONLY( StatsInit( &tp->stats ); )
|
STATSONLY( StatsInit( &tp->stats ) );
|
||||||
|
|
||||||
retCode += ListInit( &tp->highJobQ, CmpThreadPoolJob, NULL );
|
retCode += ListInit( &tp->highJobQ, CmpThreadPoolJob, NULL );
|
||||||
assert( retCode == 0 );
|
assert( retCode == 0 );
|
||||||
|
@@ -31,8 +31,7 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/param.h>
|
#ifdef __FreeBSD__
|
||||||
#if (defined(BSD) && BSD >= 199306)
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
256
upnp/Makefile.am
256
upnp/Makefile.am
@@ -1,153 +1,163 @@
|
|||||||
|
# $Id: Makefile.am,v 1.10 2006/04/08 15:22:22 r3mi Exp $
|
||||||
#
|
#
|
||||||
# "Makefile.am" for "libupnp/upnp"
|
# "Makefile.am" for "libupnp/upnp"
|
||||||
#
|
#
|
||||||
# Copyright (C) 2005 R<>mi Turboult <r3mi@users.sourceforge.net>
|
# Copyright (C) 2005 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
SUBDIRS = doc . sample
|
SUBDIRS = doc
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = -I$(srcdir)/inc \
|
||||||
-I$(srcdir)/inc \
|
-I$(top_srcdir)/threadutil/inc \
|
||||||
-I$(top_srcdir)/threadutil/inc \
|
-I$(top_srcdir)/ixml/inc
|
||||||
-I$(top_srcdir)/ixml/inc
|
|
||||||
|
|
||||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||||
|
|
||||||
AM_LDFLAGS = $(PTHREAD_LIBS)
|
AM_LDFLAGS = $(PTHREAD_LIBS)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = libupnp.la \
|
||||||
libupnp.la \
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
$(top_builddir)/ixml/libixml.la
|
||||||
$(top_builddir)/ixml/libixml.la
|
|
||||||
|
|
||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = \
|
upnpinclude_HEADERS = inc/upnp.h
|
||||||
inc/upnp.h \
|
|
||||||
inc/upnpdebug.h
|
|
||||||
|
|
||||||
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
||||||
if ENABLE_TOOLS
|
if ENABLE_TOOLS
|
||||||
upnpinclude_HEADERS += inc/upnptools.h
|
upnpinclude_HEADERS += inc/upnptools.h
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libupnp.la
|
|
||||||
|
|
||||||
libupnp_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/inc
|
|
||||||
|
|
||||||
libupnp_la_LDFLAGS = \
|
|
||||||
-version-info $(LT_VERSION_UPNP) \
|
|
||||||
-export-symbols-regex '^Upnp.*' \
|
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
|
||||||
$(top_builddir)/ixml/libixml.la
|
|
||||||
|
|
||||||
libupnp_la_SOURCES = \
|
|
||||||
src/inc/config.h \
|
|
||||||
src/inc/client_table.h \
|
|
||||||
src/inc/gena.h \
|
|
||||||
src/inc/gena_ctrlpt.h \
|
|
||||||
src/inc/gena_device.h \
|
|
||||||
src/inc/global.h \
|
|
||||||
src/inc/gmtdate.h \
|
|
||||||
src/inc/http_client.h \
|
|
||||||
src/inc/httpparser.h \
|
|
||||||
src/inc/httpreadwrite.h \
|
|
||||||
src/inc/md5.h \
|
|
||||||
src/inc/membuffer.h \
|
|
||||||
src/inc/miniserver.h \
|
|
||||||
src/inc/netall.h \
|
|
||||||
src/inc/parsetools.h \
|
|
||||||
src/inc/server.h \
|
|
||||||
src/inc/service_table.h \
|
|
||||||
src/inc/soaplib.h \
|
|
||||||
src/inc/sock.h \
|
|
||||||
src/inc/statcodes.h \
|
|
||||||
src/inc/statuscodes.h \
|
|
||||||
src/inc/strintmap.h \
|
|
||||||
src/inc/ssdplib.h \
|
|
||||||
src/inc/sysdep.h \
|
|
||||||
src/inc/unixutil.h \
|
|
||||||
src/inc/upnpapi.h \
|
|
||||||
src/inc/upnpclosesocket.h \
|
|
||||||
src/inc/upnp_timeout.h \
|
|
||||||
src/inc/uri.h \
|
|
||||||
src/inc/urlconfig.h \
|
|
||||||
src/inc/util.h \
|
|
||||||
src/inc/utilall.h \
|
|
||||||
src/inc/uuid.h \
|
|
||||||
src/inc/webserver.h
|
|
||||||
|
|
||||||
# ssdp
|
|
||||||
libupnp_la_SOURCES += \
|
|
||||||
src/ssdp/ssdp_device.c \
|
|
||||||
src/ssdp/ssdp_ctrlpt.c \
|
|
||||||
src/ssdp/ssdp_server.c
|
|
||||||
|
|
||||||
# soap
|
|
||||||
libupnp_la_SOURCES += \
|
|
||||||
src/soap/soap_device.c \
|
|
||||||
src/soap/soap_ctrlpt.c \
|
|
||||||
src/soap/soap_common.c
|
|
||||||
|
|
||||||
# genlib
|
|
||||||
libupnp_la_SOURCES += \
|
|
||||||
src/genlib/miniserver/miniserver.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 \
|
|
||||||
src/genlib/net/http/statcodes.c \
|
|
||||||
src/genlib/net/http/webserver.c \
|
|
||||||
src/genlib/net/http/parsetools.c \
|
|
||||||
src/genlib/net/uri/uri.c
|
|
||||||
|
|
||||||
# gena
|
|
||||||
libupnp_la_SOURCES += \
|
|
||||||
src/gena/gena_device.c \
|
|
||||||
src/gena/gena_ctrlpt.c \
|
|
||||||
src/gena/gena_callback2.c
|
|
||||||
|
|
||||||
# api
|
|
||||||
libupnp_la_SOURCES += src/api/upnpapi.c
|
|
||||||
if ENABLE_TOOLS
|
|
||||||
libupnp_la_SOURCES += src/api/upnptools.c
|
|
||||||
endif
|
endif
|
||||||
if ENABLE_DEBUG
|
if ENABLE_DEBUG
|
||||||
libupnp_la_SOURCES += src/api/upnpdebug.c
|
upnpinclude_HEADERS += inc/upnpdebug.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
lib_LTLIBRARIES = libupnp.la
|
||||||
|
|
||||||
|
libupnp_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/inc
|
||||||
|
libupnp_la_LDFLAGS = -version-info $(LT_VERSION_UPNP) \
|
||||||
|
-export-symbols-regex '^Upnp.*' \
|
||||||
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
|
$(top_builddir)/ixml/libixml.la
|
||||||
|
|
||||||
|
libupnp_la_SOURCES = \
|
||||||
|
src/inc/config.h \
|
||||||
|
src/inc/client_table.h src/inc/global.h \
|
||||||
|
src/inc/md5.h src/inc/ssdplib.h \
|
||||||
|
src/inc/unixutil.h src/inc/urlconfig.h \
|
||||||
|
src/inc/gmtdate.h src/inc/membuffer.h \
|
||||||
|
src/inc/server.h src/inc/statcodes.h \
|
||||||
|
src/inc/upnpapi.h src/inc/utilall.h \
|
||||||
|
src/inc/gena_ctrlpt.h src/inc/http_client.h \
|
||||||
|
src/inc/miniserver.h src/inc/service_table.h \
|
||||||
|
src/inc/statuscodes.h src/inc/upnpclosesocket.h \
|
||||||
|
src/inc/util.h src/inc/gena_device.h \
|
||||||
|
src/inc/httpparser.h src/inc/netall.h \
|
||||||
|
src/inc/soaplib.h src/inc/strintmap.h \
|
||||||
|
src/inc/upnp_timeout.h src/inc/uuid.h \
|
||||||
|
src/inc/gena.h src/inc/httpreadwrite.h \
|
||||||
|
src/inc/parsetools.h src/inc/sock.h \
|
||||||
|
src/inc/sysdep.h src/inc/uri.h \
|
||||||
|
src/inc/webserver.h
|
||||||
|
|
||||||
|
# ssdp
|
||||||
|
libupnp_la_SOURCES += src/ssdp/ssdp_device.c src/ssdp/ssdp_ctrlpt.c \
|
||||||
|
src/ssdp/ssdp_server.c
|
||||||
|
|
||||||
|
# soap
|
||||||
|
libupnp_la_SOURCES += src/soap/soap_device.c src/soap/soap_ctrlpt.c \
|
||||||
|
src/soap/soap_common.c
|
||||||
|
|
||||||
|
# genlib
|
||||||
|
libupnp_la_SOURCES += \
|
||||||
|
src/genlib/miniserver/miniserver.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 \
|
||||||
|
src/genlib/net/http/statcodes.c \
|
||||||
|
src/genlib/net/http/webserver.c \
|
||||||
|
src/genlib/net/http/parsetools.c \
|
||||||
|
src/genlib/net/uri/uri.c
|
||||||
|
|
||||||
|
# gena
|
||||||
|
libupnp_la_SOURCES += src/gena/gena_device.c src/gena/gena_ctrlpt.c \
|
||||||
|
src/gena/gena_callback2.c
|
||||||
|
|
||||||
|
# api
|
||||||
|
libupnp_la_SOURCES += src/api/upnpapi.c
|
||||||
|
if ENABLE_TOOLS
|
||||||
|
libupnp_la_SOURCES += src/api/upnptools.c
|
||||||
|
endif
|
||||||
|
if ENABLE_DEBUG
|
||||||
|
libupnp_la_SOURCES += src/api/upnpdebug.c
|
||||||
|
endif
|
||||||
|
|
||||||
# uuid
|
# uuid
|
||||||
libupnp_la_SOURCES += \
|
libupnp_la_SOURCES += src/uuid/md5.c src/uuid/sysdep.c src/uuid/uuid.c
|
||||||
src/uuid/md5.c \
|
|
||||||
src/uuid/sysdep.c \
|
|
||||||
src/uuid/uuid.c
|
|
||||||
|
|
||||||
|
|
||||||
# urlconfig
|
# urlconfig
|
||||||
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
||||||
|
|
||||||
|
|
||||||
|
# samples
|
||||||
|
noinst_PROGRAMS =
|
||||||
|
if ENABLE_SAMPLES
|
||||||
|
if ENABLE_CLIENT
|
||||||
|
noinst_PROGRAMS += upnp_tv_ctrlpt
|
||||||
|
upnp_tv_ctrlpt_CPPFLAGS = $(AM_CPPFLAGS) \
|
||||||
|
-I$(srcdir)/sample/common/ \
|
||||||
|
-I$(srcdir)/sample/tvctrlpt
|
||||||
|
endif
|
||||||
|
if ENABLE_DEVICE
|
||||||
|
noinst_PROGRAMS += upnp_tv_device
|
||||||
|
upnp_tv_device_CPPFLAGS = $(AM_CPPFLAGS) \
|
||||||
|
-I$(srcdir)/sample/common/ \
|
||||||
|
-I$(srcdir)/sample/tvdevice
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
upnp_tv_device_SOURCES = \
|
||||||
|
sample/common/sample_util.c \
|
||||||
|
sample/common/sample_util.h \
|
||||||
|
sample/tvdevice/upnp_tv_device.c \
|
||||||
|
sample/tvdevice/upnp_tv_device.h \
|
||||||
|
sample/tvdevice/linux/upnp_tv_device_main.c
|
||||||
|
upnp_tv_ctrlpt_SOURCES = \
|
||||||
|
sample/common/sample_util.c \
|
||||||
|
sample/common/sample_util.h \
|
||||||
|
sample/tvctrlpt/upnp_tv_ctrlpt.c \
|
||||||
|
sample/tvctrlpt/upnp_tv_ctrlpt.h \
|
||||||
|
sample/tvctrlpt/linux/upnp_tv_ctrlpt_main.c
|
||||||
|
|
||||||
|
if WITH_DOCUMENTATION
|
||||||
|
examplesdir = $(docdir)/examples
|
||||||
|
examples_DATA = $(upnp_tv_ctrlpt_SOURCES) $(upnp_tv_device_SOURCES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
# check / distcheck tests
|
# check / distcheck tests
|
||||||
check_PROGRAMS = test_init
|
check_PROGRAMS = test_init
|
||||||
TESTS = test_init
|
TESTS = test_init
|
||||||
test_init_SOURCES = test/test_init.c
|
|
||||||
|
test_init_SOURCES = test/test_init.c
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = LICENSE \
|
||||||
LICENSE \
|
sample/tvdevice/web/tvcontrolSCPD.xml \
|
||||||
src/inc/inet_pton.h \
|
sample/tvdevice/web/tvdevicedesc.xml \
|
||||||
src/inet_pton.c \
|
sample/tvdevice/web/tvdevicepres.html \
|
||||||
src/win_dll.c
|
sample/tvdevice/web/tvpictureSCPD.xml \
|
||||||
|
src/inc/inet_pton.h \
|
||||||
|
src/inet_pton.c \
|
||||||
|
src/win_dll.c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLEANFILES = IUpnpErrFile.txt IUpnpInfoFile.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLEANFILES = \
|
|
||||||
IUpnpErrFile.txt \
|
|
||||||
IUpnpInfoFile.txt
|
|
||||||
|
|
||||||
|
508
upnp/inc/upnp.h
508
upnp/inc/upnp.h
@@ -1,125 +1,101 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef UPNP_H
|
#ifndef UPNP_H
|
||||||
#define UPNP_H
|
#define UPNP_H
|
||||||
|
|
||||||
/** @name The API */
|
/** @name The API */
|
||||||
|
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
|
|
||||||
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
||||||
#else
|
#else
|
||||||
#error libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
#error libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/param.h>
|
#ifdef __FreeBSD__
|
||||||
#if (defined(BSD) && BSD >= 199306)
|
#include <time.h>
|
||||||
#include <time.h>
|
|
||||||
#endif
|
#endif
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
#include "upnpconfig.h"
|
#include "upnpconfig.h"
|
||||||
|
#if UPNP_HAVE_DEBUG
|
||||||
|
# include "upnpdebug.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef UPNP_STATIC_LIB
|
#ifndef UPNP_STATIC_LIB
|
||||||
#ifdef LIBUPNP_EXPORTS
|
#ifdef LIBUPNP_EXPORTS
|
||||||
/* set up declspec for dll export to make functions visible to library users */
|
// set up declspec for dll export to make functions visible to library users
|
||||||
#define EXPORT_SPEC __declspec(dllexport)
|
#define EXPORT_SPEC __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC __declspec(dllimport)
|
#define EXPORT_SPEC __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
#ifdef UPNP_USE_MSVCPP
|
#ifdef UPNP_USE_MSVCPP // define some things the M$ VC++ doesn't knows
|
||||||
/* define some things the M$ VC++ doesn't know */
|
typedef __int64 int64_t;
|
||||||
#define UPNP_INLINE
|
#endif
|
||||||
typedef __int64 int64_t;
|
#ifdef UPNP_USE_BCBPP // define some things Borland Builder doesn't knows
|
||||||
#define PRId64 "I64d"
|
typedef __int64 int64_t;
|
||||||
#define PRIzu "lu"
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef UPNP_USE_BCBPP
|
|
||||||
/* define some things Borland Builder doesn't know */
|
|
||||||
#define UPNP_INLINE inline
|
|
||||||
typedef __int64 int64_t;
|
|
||||||
#warning The Borland C compiler is probably broken on PRId64, please someone provide a proper fix here
|
|
||||||
#define PRId64 "I64d"
|
|
||||||
#define PRIzu "zu"
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#define UPNP_INLINE inline
|
|
||||||
/* Invented this macro so that we can live a little longer with MSVC lack of C99. */
|
|
||||||
#define PRIzu "zu"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Defining this macro here gives some interesting information about unused
|
|
||||||
* functions in the code. Of course, this should never go uncommented on a
|
|
||||||
* release.
|
|
||||||
*/
|
|
||||||
/*#define inline*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define UpnpCloseSocket close
|
#define UpnpCloseSocket close
|
||||||
#else
|
#else
|
||||||
#define UpnpCloseSocket closesocket
|
#define UpnpCloseSocket closesocket
|
||||||
#define fseeko fseek
|
#define fseeko fseek
|
||||||
#endif
|
#endif
|
||||||
#define UPNP_SOCKETERROR -1
|
#define UPNP_SOCKETERROR -1
|
||||||
#define UPNP_INVALID_SOCKET -1
|
#define UPNP_INVALID_SOCKET -1
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define SOCKET int
|
#define SOCKET int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#else
|
#else
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
#define NUM_HANDLE 200
|
#define NUM_HANDLE 200
|
||||||
#define LINE_SIZE 180
|
#define LINE_SIZE 180
|
||||||
#define NAME_SIZE 256
|
#define NAME_SIZE 256
|
||||||
@@ -128,6 +104,7 @@
|
|||||||
#define SERL_NUMR_SIZE 64
|
#define SERL_NUMR_SIZE 64
|
||||||
#define MODL_DESC_SIZE 64
|
#define MODL_DESC_SIZE 64
|
||||||
#define UPNP_INFINITE -1
|
#define UPNP_INFINITE -1
|
||||||
|
|
||||||
#define UPNP_USING_CHUNKED -3
|
#define UPNP_USING_CHUNKED -3
|
||||||
#define UPNP_UNTIL_CLOSE -4
|
#define UPNP_UNTIL_CLOSE -4
|
||||||
|
|
||||||
@@ -139,7 +116,7 @@
|
|||||||
* code means. Refer to the documentation for each function for a
|
* code means. Refer to the documentation for each function for a
|
||||||
* description of what an error code means in that context.
|
* description of what an error code means in that context.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** @name UPNP_E_SUCCESS [0]
|
/** @name UPNP_E_SUCCESS [0]
|
||||||
* {\tt UPNP_E_SUCCESS} signifies that the operation completed successfully.
|
* {\tt UPNP_E_SUCCESS} signifies that the operation completed successfully.
|
||||||
@@ -147,35 +124,35 @@
|
|||||||
* the operation was successfully transmitted on the network. The result of
|
* the operation was successfully transmitted on the network. The result of
|
||||||
* the entire operation comes as part of the callback for that operation.
|
* the entire operation comes as part of the callback for that operation.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SUCCESS 0
|
#define UPNP_E_SUCCESS 0
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INVALID_HANDLE [-100]
|
/** @name UPNP_E_INVALID_HANDLE [-100]
|
||||||
* {\tt UPNP_E_INVALID_HANDLE} signifies that the handle passed to a
|
* {\tt UPNP_E_INVALID_HANDLE} signifies that the handle passed to a
|
||||||
* function is not a recognized as a valid handle.
|
* function is not a recognized as a valid handle.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_HANDLE -100
|
#define UPNP_E_INVALID_HANDLE -100
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INVALID_PARAM [-101]
|
/** @name UPNP_E_INVALID_PARAM [-101]
|
||||||
* {\tt UPNP_E_INVALID_PARAM} signifies that one or more of the parameters
|
* {\tt UPNP_E_INVALID_PARAM} signifies that one or more of the parameters
|
||||||
* passed to the function is not valid. Refer to the documentation for each
|
* passed to the function is not valid. Refer to the documentation for each
|
||||||
* function for more information on the valid ranges of the parameters.
|
* function for more information on the valid ranges of the parameters.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_PARAM -101
|
#define UPNP_E_INVALID_PARAM -101
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_OUTOF_HANDLE [-102]
|
/** @name UPNP_E_OUTOF_HANDLE [-102]
|
||||||
* {\tt UPNP_E_OUTOF_HANDLE} signifies that the SDK does not have any
|
* {\tt UPNP_E_OUTOF_HANDLE} signifies that the SDK does not have any
|
||||||
* more space for additional handles. The SDK allocates space for only
|
* more space for additional handles. The SDK allocates space for only
|
||||||
* a few handles in order to conserve memory.
|
* a few handles in order to conserve memory.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_OUTOF_HANDLE -102
|
#define UPNP_E_OUTOF_HANDLE -102
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_OUTOF_CONTEXT -103
|
#define UPNP_E_OUTOF_CONTEXT -103
|
||||||
|
|
||||||
@@ -184,9 +161,9 @@
|
|||||||
* currently available to complete the operation. Most operations require
|
* currently available to complete the operation. Most operations require
|
||||||
* some free memory in order to complete their work.
|
* some free memory in order to complete their work.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_OUTOF_MEMORY -104
|
#define UPNP_E_OUTOF_MEMORY -104
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INIT [-105]
|
/** @name UPNP_E_INIT [-105]
|
||||||
* {\tt UPNP_E_INIT} signifies that the SDK has already been
|
* {\tt UPNP_E_INIT} signifies that the SDK has already been
|
||||||
@@ -194,9 +171,9 @@
|
|||||||
* Any additional initialization attempts simply return this error with
|
* Any additional initialization attempts simply return this error with
|
||||||
* no other ill effects.
|
* no other ill effects.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INIT -105
|
#define UPNP_E_INIT -105
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_BUFFER_TOO_SMALL -106
|
#define UPNP_E_BUFFER_TOO_SMALL -106
|
||||||
|
|
||||||
@@ -205,9 +182,9 @@
|
|||||||
* to {\bf UpnpRegisterRootDevice} or {\bf UpnpRegisterRootDevice2} is an
|
* to {\bf UpnpRegisterRootDevice} or {\bf UpnpRegisterRootDevice2} is an
|
||||||
* invalid description document.
|
* invalid description document.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_DESC -107
|
#define UPNP_E_INVALID_DESC -107
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INVALID_URL [-108]
|
/** @name UPNP_E_INVALID_URL [-108]
|
||||||
* {\tt UPNP_E_INVALID_URL} signifies that a URL passed into the function
|
* {\tt UPNP_E_INVALID_URL} signifies that a URL passed into the function
|
||||||
@@ -215,9 +192,9 @@
|
|||||||
* URL itself might be malformed (e.g. have invalid characters in it) or
|
* URL itself might be malformed (e.g. have invalid characters in it) or
|
||||||
* the host might be unreachable.
|
* the host might be unreachable.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_URL -108
|
#define UPNP_E_INVALID_URL -108
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_INVALID_SID -109
|
#define UPNP_E_INVALID_SID -109
|
||||||
#define UPNP_E_INVALID_DEVICE -110
|
#define UPNP_E_INVALID_DEVICE -110
|
||||||
@@ -228,18 +205,18 @@
|
|||||||
* {\bf UpnpAcceptSubscriptionExt} to signify that the device ID/service
|
* {\bf UpnpAcceptSubscriptionExt} to signify that the device ID/service
|
||||||
* ID pair does not refer to a valid service.
|
* ID pair does not refer to a valid service.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_SERVICE -111
|
#define UPNP_E_INVALID_SERVICE -111
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_BAD_RESPONSE [-113]
|
/** @name UPNP_E_BAD_RESPONSE [-113]
|
||||||
* {\tt UPNP_E_BAD_RESPONSE} signifies that the response received from the
|
* {\tt UPNP_E_BAD_RESPONSE} signifies that the response received from the
|
||||||
* remote side of a connection is not correct for the protocol. This applies
|
* remote side of a connection is not correct for the protocol. This applies
|
||||||
* to the GENA, SOAP, and HTTP protocols.
|
* to the GENA, SOAP, and HTTP protocols.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_BAD_RESPONSE -113
|
#define UPNP_E_BAD_RESPONSE -113
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_BAD_REQUEST -114
|
#define UPNP_E_BAD_REQUEST -114
|
||||||
|
|
||||||
@@ -248,26 +225,26 @@
|
|||||||
* invalid. This can be because the DOM document passed to the function was
|
* invalid. This can be because the DOM document passed to the function was
|
||||||
* malformed or the action message is not correct for the given action.
|
* malformed or the action message is not correct for the given action.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_ACTION -115
|
#define UPNP_E_INVALID_ACTION -115
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_FINISH [-116]
|
/** @name UPNP_E_FINISH [-116]
|
||||||
* {\tt UPNP_E_FINISH} signifies that {\bf UpnpInit} has not been called, or
|
* {\tt UPNP_E_FINISH} signifies that {\bf UpnpInit} has not been called, or
|
||||||
* that {\bf UpnpFinish} has already been called. None of the API functions
|
* that {\bf UpnpFinish} has already been called. None of the API functions
|
||||||
* operate until {\bf UpnpInit} successfully completes.
|
* operate until {\bf UpnpInit} successfully completes.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_FINISH -116
|
#define UPNP_E_FINISH -116
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INIT_FAILED [-117]
|
/** @name UPNP_E_INIT_FAILED [-117]
|
||||||
* {\tt UPNP_E_INIT_FAILED} signifies that {\bf UpnpInit} cannot complete.
|
* {\tt UPNP_E_INIT_FAILED} signifies that {\bf UpnpInit} cannot complete.
|
||||||
* The typical reason is failure to allocate sufficient resources.
|
* The typical reason is failure to allocate sufficient resources.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INIT_FAILED -117
|
#define UPNP_E_INIT_FAILED -117
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_URL_TOO_BIG [-118]
|
/** @name UPNP_E_URL_TOO_BIG [-118]
|
||||||
* {\tt UPNP_E_URL_TOO_BIG} signifies that the URL passed into a function
|
* {\tt UPNP_E_URL_TOO_BIG} signifies that the URL passed into a function
|
||||||
@@ -283,18 +260,18 @@
|
|||||||
* message (e.g. {\bf UpnpSubscribe}), GENA event notifications (e.g. {\bf
|
* message (e.g. {\bf UpnpSubscribe}), GENA event notifications (e.g. {\bf
|
||||||
* UpnpNotify}), and HTTP transfers (e.g. {\bf UpnpDownloadXmlDoc}).
|
* UpnpNotify}), and HTTP transfers (e.g. {\bf UpnpDownloadXmlDoc}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_BAD_HTTPMSG -119
|
#define UPNP_E_BAD_HTTPMSG -119
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_ALREADY_REGISTERED [-120]
|
/** @name UPNP_E_ALREADY_REGISTERED [-120]
|
||||||
* {\tt UPNP_E_ALREADY_REGISTERED} signifies that a client or a device is
|
* {\tt UPNP_E_ALREADY_REGISTERED} signifies that a client or a device is
|
||||||
* already registered. The SDK currently has a limit of one registered
|
* already registered. The SDK currently has a limit of one registered
|
||||||
* client and one registered device per process.
|
* client and one registered device per process.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_ALREADY_REGISTERED -120
|
#define UPNP_E_ALREADY_REGISTERED -120
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_NETWORK_ERROR [-200]
|
/** @name UPNP_E_NETWORK_ERROR [-200]
|
||||||
* {\tt UPNP_E_NETWORK_ERROR} signifies that a network error occurred. It
|
* {\tt UPNP_E_NETWORK_ERROR} signifies that a network error occurred. It
|
||||||
@@ -303,9 +280,9 @@
|
|||||||
* failed to read the local IP address or had problems configuring one of
|
* failed to read the local IP address or had problems configuring one of
|
||||||
* the sockets.
|
* the sockets.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_NETWORK_ERROR -200
|
#define UPNP_E_NETWORK_ERROR -200
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_SOCKET_WRITE [-201]
|
/** @name UPNP_E_SOCKET_WRITE [-201]
|
||||||
* {\tt UPNP_E_SOCKET_WRITE} signifies an error writing to a socket. This
|
* {\tt UPNP_E_SOCKET_WRITE} signifies an error writing to a socket. This
|
||||||
@@ -314,9 +291,9 @@
|
|||||||
* control (e.g. {\bf UpnpSendAction}), eventing (e.g. {\bf UpnpNotify}),
|
* control (e.g. {\bf UpnpSendAction}), eventing (e.g. {\bf UpnpNotify}),
|
||||||
* and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}).
|
* and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SOCKET_WRITE -201
|
#define UPNP_E_SOCKET_WRITE -201
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_SOCKET_READ [-202]
|
/** @name UPNP_E_SOCKET_READ [-202]
|
||||||
* {\tt UPNP_E_SOCKET_READ} signifies an error reading from a socket. This
|
* {\tt UPNP_E_SOCKET_READ} signifies an error reading from a socket. This
|
||||||
@@ -325,9 +302,9 @@
|
|||||||
* control (e.g. {\bf UpnpSendAction}), eventing (e.g. {\bf UpnpNotify}),
|
* control (e.g. {\bf UpnpSendAction}), eventing (e.g. {\bf UpnpNotify}),
|
||||||
* and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}).
|
* and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SOCKET_READ -202
|
#define UPNP_E_SOCKET_READ -202
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_SOCKET_BIND [-203]
|
/** @name UPNP_E_SOCKET_BIND [-203]
|
||||||
* {\tt UPNP_E_SOCKET_BIND} signifies that the SDK had a problem binding
|
* {\tt UPNP_E_SOCKET_BIND} signifies that the SDK had a problem binding
|
||||||
@@ -337,9 +314,9 @@
|
|||||||
* (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.
|
* (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.
|
||||||
* {\bf UpnpDownloadXmlDoc}).
|
* {\bf UpnpDownloadXmlDoc}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SOCKET_BIND -203
|
#define UPNP_E_SOCKET_BIND -203
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_SOCKET_CONNECT [-204]
|
/** @name UPNP_E_SOCKET_CONNECT [-204]
|
||||||
* {\tt UPNP_E_SOCKET_CONNECT} signifies that the SDK had a problem
|
* {\tt UPNP_E_SOCKET_CONNECT} signifies that the SDK had a problem
|
||||||
@@ -349,9 +326,9 @@
|
|||||||
* (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.
|
* (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.
|
||||||
* {\bf UpnpDownloadXmlDoc}).
|
* {\bf UpnpDownloadXmlDoc}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SOCKET_CONNECT -204
|
#define UPNP_E_SOCKET_CONNECT -204
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_OUTOF_SOCKET [-205]
|
/** @name UPNP_E_OUTOF_SOCKET [-205]
|
||||||
* {\tt UPNP_E_OUTOF_SOCKET} signifies that the SDK cannot create any
|
* {\tt UPNP_E_OUTOF_SOCKET} signifies that the SDK cannot create any
|
||||||
@@ -361,36 +338,36 @@
|
|||||||
* (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.
|
* (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.
|
||||||
* {\bf UpnpDownloadXmlDoc}).
|
* {\bf UpnpDownloadXmlDoc}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_OUTOF_SOCKET -205
|
#define UPNP_E_OUTOF_SOCKET -205
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_LISTEN [-206]
|
/** @name UPNP_E_LISTEN [-206]
|
||||||
* {\tt UPNP_E_LISTEN} signifies that the SDK had a problem setting the
|
* {\tt UPNP_E_LISTEN} signifies that the SDK had a problem setting the
|
||||||
* socket to listen for incoming connections. This error only happens during
|
* socket to listen for incoming connections. This error only happens during
|
||||||
* initialization (i.e. {\bf UpnpInit}).
|
* initialization (i.e. {\bf UpnpInit}).
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_LISTEN -206
|
#define UPNP_E_LISTEN -206
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_TIMEDOUT [-207]
|
/** @name UPNP_E_TIMEDOUT [-207]
|
||||||
* {\tt UPNP_E_TIMEDOUT} signifies that too much time elapsed before the
|
* {\tt UPNP_E_TIMEDOUT} signifies that too much time elapsed before the
|
||||||
* required number of bytes were sent or received over a socket. This error
|
* required number of bytes were sent or received over a socket. This error
|
||||||
* can be returned by any function that performs network operations.
|
* can be returned by any function that performs network operations.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_TIMEDOUT -207
|
#define UPNP_E_TIMEDOUT -207
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_SOCKET_ERROR [-208]
|
/** @name UPNP_E_SOCKET_ERROR [-208]
|
||||||
* {\tt UPNP_E_SOCKET_ERROR} is the generic socket error code for
|
* {\tt UPNP_E_SOCKET_ERROR} is the generic socket error code for
|
||||||
* conditions not covered by other error codes. This error can be returned
|
* conditions not covered by other error codes. This error can be returned
|
||||||
* by any function that performs network operations.
|
* by any function that performs network operations.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SOCKET_ERROR -208
|
#define UPNP_E_SOCKET_ERROR -208
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_FILE_WRITE_ERROR -209
|
#define UPNP_E_FILE_WRITE_ERROR -209
|
||||||
|
|
||||||
@@ -399,9 +376,9 @@
|
|||||||
* error can be returned by any function that allows for external
|
* error can be returned by any function that allows for external
|
||||||
* cancelation.
|
* cancelation.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_CANCELED -210
|
#define UPNP_E_CANCELED -210
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_EVENT_PROTOCOL -300
|
#define UPNP_E_EVENT_PROTOCOL -300
|
||||||
|
|
||||||
@@ -409,58 +386,58 @@
|
|||||||
* {\tt UPNP_E_SUBSCRIBE_UNACCEPTED} signifies that a subscription
|
* {\tt UPNP_E_SUBSCRIBE_UNACCEPTED} signifies that a subscription
|
||||||
* request was rejected from the remote side.
|
* request was rejected from the remote side.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
|
#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302]
|
/** @name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302]
|
||||||
* {\tt UPNP_E_UNSUBSCRIBE_UNACCEPTED} signifies that an unsubscribe
|
* {\tt UPNP_E_UNSUBSCRIBE_UNACCEPTED} signifies that an unsubscribe
|
||||||
* request was rejected from the remote side.
|
* request was rejected from the remote side.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
|
#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_NOTIFY_UNACCEPTED [-303]
|
/** @name UPNP_E_NOTIFY_UNACCEPTED [-303]
|
||||||
* {\tt UPNP_E_NOTIFY_UNACCEPTED} signifies that the remote host did not
|
* {\tt UPNP_E_NOTIFY_UNACCEPTED} signifies that the remote host did not
|
||||||
* accept the notify sent from the local device.
|
* accept the notify sent from the local device.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_NOTIFY_UNACCEPTED -303
|
#define UPNP_E_NOTIFY_UNACCEPTED -303
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INVALID_ARGUMENT [-501]
|
/** @name UPNP_E_INVALID_ARGUMENT [-501]
|
||||||
* {\tt UPNP_E_INVALID_ARGUMENT} signifies that one or more of the parameters
|
* {\tt UPNP_E_INVALID_ARGUMENT} signifies that one or more of the parameters
|
||||||
* passed to a function is invalid. Refer to the individual function
|
* passed to a function is invalid. Refer to the individual function
|
||||||
* descriptions for the acceptable ranges for parameters.
|
* descriptions for the acceptable ranges for parameters.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INVALID_ARGUMENT -501
|
#define UPNP_E_INVALID_ARGUMENT -501
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_FILE_NOT_FOUND [-502]
|
/** @name UPNP_E_FILE_NOT_FOUND [-502]
|
||||||
* {\tt UPNP_E_FILE_NOT_FOUND} signifies that the filename passed
|
* {\tt UPNP_E_FILE_NOT_FOUND} signifies that the filename passed
|
||||||
* to one of the device registration functions was not found or was not
|
* to one of the device registration functions was not found or was not
|
||||||
* accessible.
|
* accessible.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_FILE_NOT_FOUND -502
|
#define UPNP_E_FILE_NOT_FOUND -502
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_FILE_READ_ERROR [-503]
|
/** @name UPNP_E_FILE_READ_ERROR [-503]
|
||||||
* {\tt UPNP_E_FILE_READ_ERROR} signifies an error when reading a file.
|
* {\tt UPNP_E_FILE_READ_ERROR} signifies an error when reading a file.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_FILE_READ_ERROR -503
|
#define UPNP_E_FILE_READ_ERROR -503
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_EXT_NOT_XML [-504]
|
/** @name UPNP_E_EXT_NOT_XML [-504]
|
||||||
* {\tt UPNP_E_EXT_NOT_XML} signifies that the file name of the description
|
* {\tt UPNP_E_EXT_NOT_XML} signifies that the file name of the description
|
||||||
* document passed to {\bf UpnpRegisterRootDevice2} does not end in ".xml".
|
* document passed to {\bf UpnpRegisterRootDevice2} does not end in ".xml".
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_EXT_NOT_XML -504
|
#define UPNP_E_EXT_NOT_XML -504
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#define UPNP_E_NO_WEB_SERVER -505
|
#define UPNP_E_NO_WEB_SERVER -505
|
||||||
#define UPNP_E_OUTOF_BOUNDS -506
|
#define UPNP_E_OUTOF_BOUNDS -506
|
||||||
@@ -469,26 +446,26 @@
|
|||||||
* {\tt UPNP_E_NOT_FOUND} signifies that the response to a SOAP request
|
* {\tt UPNP_E_NOT_FOUND} signifies that the response to a SOAP request
|
||||||
* did not contain the required XML constructs.
|
* did not contain the required XML constructs.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_NOT_FOUND -507
|
#define UPNP_E_NOT_FOUND -507
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/** @name UPNP_E_INTERNAL_ERROR [-911]
|
/** @name UPNP_E_INTERNAL_ERROR [-911]
|
||||||
* {\tt UPNP_E_INTERNAL_ERROR} is the generic error code for internal
|
* {\tt UPNP_E_INTERNAL_ERROR} is the generic error code for internal
|
||||||
* conditions not covered by other error codes.
|
* conditions not covered by other error codes.
|
||||||
*/
|
*/
|
||||||
/*! @{ */
|
//@{
|
||||||
#define UPNP_E_INTERNAL_ERROR -911
|
#define UPNP_E_INTERNAL_ERROR -911
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
/* SOAP-related error codes */
|
// SOAP-related error codes
|
||||||
#define UPNP_SOAP_E_INVALID_ACTION 401
|
#define UPNP_SOAP_E_INVALID_ACTION 401
|
||||||
#define UPNP_SOAP_E_INVALID_ARGS 402
|
#define UPNP_SOAP_E_INVALID_ARGS 402
|
||||||
#define UPNP_SOAP_E_OUT_OF_SYNC 403
|
#define UPNP_SOAP_E_OUT_OF_SYNC 403
|
||||||
#define UPNP_SOAP_E_INVALID_VAR 404
|
#define UPNP_SOAP_E_INVALID_VAR 404
|
||||||
#define UPNP_SOAP_E_ACTION_FAILED 501
|
#define UPNP_SOAP_E_ACTION_FAILED 501
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#ifndef OUT
|
#ifndef OUT
|
||||||
#define OUT
|
#define OUT
|
||||||
@@ -502,12 +479,10 @@
|
|||||||
#define INOUT
|
#define INOUT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "upnpdebug.h"
|
|
||||||
|
|
||||||
enum UpnpOpenFileMode{UPNP_READ, UPNP_WRITE};
|
enum UpnpOpenFileMode{UPNP_READ, UPNP_WRITE};
|
||||||
|
|
||||||
/*! @name Constants, Structures, and Types */
|
/// @name Constants, Structures, and Types
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** Returned when a control point application registers with {\bf
|
/** Returned when a control point application registers with {\bf
|
||||||
* UpnpRegisterClient}. Client handles can only be used with
|
* UpnpRegisterClient}. Client handles can only be used with
|
||||||
@@ -530,9 +505,9 @@ typedef int UpnpDevice_Handle;
|
|||||||
|
|
||||||
enum Upnp_EventType_e {
|
enum Upnp_EventType_e {
|
||||||
|
|
||||||
/*
|
//
|
||||||
* Control callbacks
|
// Control callbacks
|
||||||
*/
|
//
|
||||||
|
|
||||||
/** Received by a device when a control point issues a control
|
/** Received by a device when a control point issues a control
|
||||||
* request. The {\bf Event} parameter contains a pointer to a {\bf
|
* request. The {\bf Event} parameter contains a pointer to a {\bf
|
||||||
@@ -560,9 +535,9 @@ enum Upnp_EventType_e {
|
|||||||
|
|
||||||
UPNP_CONTROL_GET_VAR_COMPLETE,
|
UPNP_CONTROL_GET_VAR_COMPLETE,
|
||||||
|
|
||||||
/*
|
//
|
||||||
* Discovery callbacks
|
// Discovery callbacks
|
||||||
*/
|
//
|
||||||
|
|
||||||
/** Received by a control point when a new device or service is available.
|
/** Received by a control point when a new device or service is available.
|
||||||
* The {\bf Event} parameter contains a pointer to a {\bf
|
* The {\bf Event} parameter contains a pointer to a {\bf
|
||||||
@@ -591,9 +566,9 @@ enum Upnp_EventType_e {
|
|||||||
|
|
||||||
UPNP_DISCOVERY_SEARCH_TIMEOUT,
|
UPNP_DISCOVERY_SEARCH_TIMEOUT,
|
||||||
|
|
||||||
/*
|
//
|
||||||
* Eventing callbacks
|
// Eventing callbacks
|
||||||
*/
|
//
|
||||||
|
|
||||||
/** Received by a device when a subscription arrives.
|
/** Received by a device when a subscription arrives.
|
||||||
* The {\bf Event} parameter contains a pointer to a {\bf
|
* The {\bf Event} parameter contains a pointer to a {\bf
|
||||||
@@ -824,47 +799,51 @@ struct Upnp_Event
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
//
|
||||||
* This typedef is required by Doc++ to parse the last entry of the
|
// This typedef is required by Doc++ to parse the last entry of the
|
||||||
* Upnp_Discovery structure correctly.
|
// Upnp_Discovery structure correctly.
|
||||||
*/
|
//
|
||||||
|
|
||||||
|
typedef struct sockaddr_in SOCKADDRIN;
|
||||||
|
|
||||||
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
|
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
|
||||||
|
|
||||||
struct Upnp_Discovery
|
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. */
|
/** The result code of the {\bf UpnpSearchAsync} call. */
|
||||||
char DeviceType[LINE_SIZE];
|
int ErrCode;
|
||||||
|
|
||||||
/** 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. */
|
/** The expiration time of the advertisement. */
|
||||||
char Date[LINE_SIZE];
|
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];
|
||||||
|
|
||||||
/** Confirmation that the MAN header was understood by the device. */
|
/** Date when the response was generated. */
|
||||||
char Ext[LINE_SIZE];
|
char Date[LINE_SIZE];
|
||||||
|
|
||||||
/** The host address of the device responding to the search. */
|
/** Confirmation that the MAN header was understood by the device. */
|
||||||
struct sockaddr_in DestAddr;
|
char Ext[LINE_SIZE];
|
||||||
|
|
||||||
|
/** The host address of the device responding to the search. */
|
||||||
|
SOCKADDRIN * DestAddr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf
|
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf
|
||||||
@@ -1068,14 +1047,14 @@ typedef int (*Upnp_FunPtr) (
|
|||||||
IN void *Cookie
|
IN void *Cookie
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Constants, Structures, and Types */
|
//@} // Constants, Structures, and Types
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif // __cplusplus
|
||||||
|
|
||||||
/*! @name Initialization and Registration */
|
///@name Initialization and Registration
|
||||||
/*! @{ */
|
//@{
|
||||||
/** Initializes the Linux SDK for UPnP Devices. This function must be called
|
/** Initializes the Linux SDK for UPnP Devices. This function must be called
|
||||||
* before any other API function can be called. It should be called
|
* before any other API function can be called. It should be called
|
||||||
* only once. Subsequent calls to this API return a {\tt UPNP_E_INIT}
|
* only once. Subsequent calls to this API return a {\tt UPNP_E_INIT}
|
||||||
@@ -1386,18 +1365,18 @@ EXPORT_SPEC int UpnpSetMaxContentLength(
|
|||||||
for incoming SOAP actions, in bytes. */
|
for incoming SOAP actions, in bytes. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Initialization and Registration */
|
//@} // Initialization and Registration
|
||||||
|
|
||||||
/******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
* *
|
// //
|
||||||
* D I S C O V E R Y *
|
// D I S C O V E R Y //
|
||||||
* *
|
// //
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************/
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*! @name Discovery */
|
///@name Discovery
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** {\bf UpnpSearchAsync} searches for devices matching the given
|
/** {\bf UpnpSearchAsync} searches for devices matching the given
|
||||||
* search target. The function returns immediately and the SDK
|
* search target. The function returns immediately and the SDK
|
||||||
@@ -1456,18 +1435,18 @@ EXPORT_SPEC int UpnpSendAdvertisement(
|
|||||||
the announcements. */
|
the announcements. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Discovery */
|
//@} // Discovery
|
||||||
|
|
||||||
/******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
* *
|
// //
|
||||||
* C O N T R O L *
|
// C O N T R O L //
|
||||||
* *
|
// //
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************/
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*! @name Control */
|
///@name Control
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** {\bf UpnpGetServiceVarStatus} queries the state of a state
|
/** {\bf UpnpGetServiceVarStatus} queries the state of a state
|
||||||
* variable of a service on another device. This is a synchronous call.
|
* variable of a service on another device. This is a synchronous call.
|
||||||
@@ -1690,18 +1669,18 @@ EXPORT_SPEC int UpnpSendActionExAsync(
|
|||||||
passed to the callback when invoked. */
|
passed to the callback when invoked. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Control */
|
//@} // Control
|
||||||
|
|
||||||
/******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
* *
|
// //
|
||||||
* E V E N T I N G *
|
// E V E N T I N G //
|
||||||
* *
|
// //
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************/
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*! @name Eventing */
|
///@name Eventing
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** {\bf UpnpAcceptSubscription} accepts a subscription request and sends
|
/** {\bf UpnpAcceptSubscription} accepts a subscription request and sends
|
||||||
* out the current state of the eventable variables for a service.
|
* out the current state of the eventable variables for a service.
|
||||||
@@ -2204,19 +2183,19 @@ EXPORT_SPEC int UpnpUnSubscribeAsync(
|
|||||||
callback function when invoked. */
|
callback function when invoked. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Eventing */
|
//@} // Eventing
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
* *
|
// //
|
||||||
* C L I E N T - A P I *
|
// C L I E N T - A P I //
|
||||||
* *
|
// //
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************/
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*! @name Control Point HTTP API */
|
///@name Control Point HTTP API
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** {\bf UpnpDownloadUrlItem} downloads a file specified in a URL.
|
/** {\bf UpnpDownloadUrlItem} downloads a file specified in a URL.
|
||||||
* The SDK allocates the memory for {\bf outBuf} and the
|
* The SDK allocates the memory for {\bf outBuf} and the
|
||||||
@@ -2609,18 +2588,18 @@ EXPORT_SPEC int UpnpDownloadXmlDoc(
|
|||||||
XML document. */
|
XML document. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Control Point HTTP API */
|
//@} // Control Point HTTP API
|
||||||
|
|
||||||
/******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
* *
|
// //
|
||||||
* W E B S E R V E R A P I *
|
// W E B S E R V E R A P I //
|
||||||
* *
|
// //
|
||||||
******************************************************************************
|
////////////////////////////////////////////////////////////////////////
|
||||||
******************************************************************************/
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*! @name Web Server API */
|
///@name Web Server API
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** {\bf UpnpSetWebServerRootDir} sets the document root directory for
|
/** {\bf UpnpSetWebServerRootDir} sets the document root directory for
|
||||||
* the internal web server. This directory is considered the
|
* the internal web server. This directory is considered the
|
||||||
@@ -2736,13 +2715,12 @@ EXPORT_SPEC void UpnpFree(
|
|||||||
IN void *item /* The item to free. */
|
IN void *item /* The item to free. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */ /* Web Server API */
|
//@} // Web Server API
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif // __cplusplus
|
||||||
|
|
||||||
/*! @} */ /* The API */
|
//@} The API
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,34 +1,34 @@
|
|||||||
/* -*- C -*- */
|
// -*- C -*-
|
||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
// Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef UPNP_CONFIG_H
|
#ifndef UPNP_CONFIG_H
|
||||||
#define UPNP_CONFIG_H
|
#define UPNP_CONFIG_H
|
||||||
@@ -91,5 +91,6 @@
|
|||||||
#undef UPNP_HAVE_TOOLS
|
#undef UPNP_HAVE_TOOLS
|
||||||
|
|
||||||
|
|
||||||
#endif /* UPNP_CONFIG_H */
|
#endif // UPNP_CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,41 +1,43 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
// Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef UPNP_DEBUG_H
|
#ifndef UPNP_DEBUG_H
|
||||||
#define UPNP_DEBUG_H
|
#define UPNP_DEBUG_H
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnpconfig.h"
|
#include "upnpconfig.h"
|
||||||
|
|
||||||
|
// Function declarations only if debug compiled into the library
|
||||||
|
#if UPNP_HAVE_DEBUG
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -47,7 +49,7 @@ extern "C" {
|
|||||||
The UPnP SDK contains other features to aid in debugging.
|
The UPnP SDK contains other features to aid in debugging.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
/** @name Upnp_LogLevel
|
/** @name Upnp_LogLevel
|
||||||
* The user has the option to select 4 different types of debugging levels,
|
* The user has the option to select 4 different types of debugging levels,
|
||||||
@@ -68,25 +70,18 @@ extern "C" {
|
|||||||
* \end{itemize}
|
* \end{itemize}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum Upnp_Module {
|
typedef enum Upnp_Module {SSDP,SOAP,GENA,TPOOL,MSERV,DOM,API, HTTP} Dbg_Module;
|
||||||
SSDP,
|
//@{
|
||||||
SOAP,
|
|
||||||
GENA,
|
|
||||||
TPOOL,
|
|
||||||
MSERV,
|
|
||||||
DOM,
|
|
||||||
API,
|
|
||||||
HTTP
|
|
||||||
} Dbg_Module;
|
|
||||||
|
|
||||||
/*! @{ */
|
|
||||||
typedef enum Upnp_LogLevel_e {
|
typedef enum Upnp_LogLevel_e {
|
||||||
UPNP_CRITICAL,
|
UPNP_CRITICAL,
|
||||||
UPNP_PACKET,
|
UPNP_PACKET,
|
||||||
UPNP_INFO,
|
UPNP_INFO,
|
||||||
UPNP_ALL
|
UPNP_ALL
|
||||||
} Upnp_LogLevel;
|
} Upnp_LogLevel;
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
|
// for backward compatibility
|
||||||
|
#define Dbg_Level Upnp_LogLevel
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,38 +92,32 @@ typedef enum Upnp_LogLevel_e {
|
|||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpInitLog
|
* Function : UpnpInitLog
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* Parameters: void
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This functions initializes the log files
|
* This functions initializes the log files
|
||||||
*
|
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* -1 : If fails
|
* -1 : If fails
|
||||||
* UPNP_E_SUCCESS : if success
|
* UPNP_E_SUCCESS : if success
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
|
||||||
int UpnpInitLog();
|
int UpnpInitLog();
|
||||||
#else
|
|
||||||
static UPNP_INLINE int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
// for backward compatibility
|
||||||
#endif
|
#define InitLog UpnpInitLog
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpSetLogLevel
|
* Function : UpnpSetLogLevel
|
||||||
*
|
*
|
||||||
* Parameters: Upnp_LogLevel log_level
|
* Parameters: void
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
void UpnpSetLogLevel (Upnp_LogLevel);
|
||||||
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -140,11 +129,10 @@ static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
|||||||
* This functions closes the log files
|
* This functions closes the log files
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
|
||||||
void UpnpCloseLog();
|
void UpnpCloseLog();
|
||||||
#else
|
|
||||||
static UPNP_INLINE void UpnpCloseLog() {}
|
// for backward compatibility
|
||||||
#endif
|
#define CloseLog UpnpCloseLog
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -161,22 +149,17 @@ static UPNP_INLINE void UpnpCloseLog() {}
|
|||||||
* per the requested banner
|
* per the requested banner
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
void UpnpSetLogFileNames (const char* ErrFileName, const char* InfoFileName);
|
||||||
void UpnpSetLogFileNames(
|
|
||||||
const char *ErrFileName,
|
// for backward compatibility
|
||||||
const char *InfoFileName);
|
#define SetLogFileNames UpnpSetLogFileNames
|
||||||
#else
|
|
||||||
static UPNP_INLINE void UpnpSetLogFileNames(
|
|
||||||
const char *ErrFileName,
|
|
||||||
const char *InfoFileName) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpGetDebugFile
|
* Function : UpnpGetDebugFile
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
* IN Dbg_Level DLevel: The level of the debug logging. It will decide
|
||||||
* whether debug statement will go to standard output,
|
* whether debug statement will go to standard output,
|
||||||
* or any of the log files.
|
* or any of the log files.
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
@@ -188,47 +171,17 @@ static UPNP_INLINE void UpnpSetLogFileNames(
|
|||||||
* NULL : if the module is turn off for debug
|
* NULL : if the module is turn off for debug
|
||||||
* else returns the right file descriptor
|
* else returns the right file descriptor
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
FILE* UpnpGetDebugFile (Upnp_LogLevel level, Dbg_Module module);
|
||||||
FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
// for backward compatibility
|
||||||
/***************************************************************************
|
#define GetDebugFile UpnpGetDebugFile
|
||||||
* Function : DebugAtThisLevel
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
|
||||||
* whether debug statement will go to standard output,
|
|
||||||
* or any of the log files.
|
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This functions returns true if debug output should be done in this
|
|
||||||
* module.
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef DEBUG
|
|
||||||
int DebugAtThisLevel(
|
|
||||||
IN Upnp_LogLevel DLevel,
|
|
||||||
IN Dbg_Module Module);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE int DebugAtThisLevel(
|
|
||||||
IN Upnp_LogLevel DLevel,
|
|
||||||
IN Dbg_Module Module) { return 0; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpPrintf
|
* Function : UpnpPrintf
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
* IN Dbg_Level DLevel: The level of the debug logging. It will decide
|
||||||
* whether debug statement will go to standard output,
|
* whether debug statement will go to standard output,
|
||||||
* or any of the log files.
|
* or any of the log files.
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
@@ -245,28 +198,14 @@ static UPNP_INLINE int DebugAtThisLevel(
|
|||||||
* debug statement is coming
|
* debug statement is coming
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module,
|
||||||
void UpnpPrintf(
|
const char* DbgFileName, int DbgLineNo,
|
||||||
Upnp_LogLevel DLevel,
|
const char* FmtStr,
|
||||||
Dbg_Module Module,
|
...)
|
||||||
const char* DbgFileName,
|
|
||||||
int DbgLineNo,
|
|
||||||
const char* FmtStr,
|
|
||||||
...)
|
|
||||||
#if (__GNUC__ >= 3)
|
#if (__GNUC__ >= 3)
|
||||||
/* This enables printf like format checking by the compiler */
|
|
||||||
__attribute__((format (__printf__, 5, 6)))
|
__attribute__((format (__printf__, 5, 6)))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
#else
|
|
||||||
static UPNP_INLINE void UpnpPrintf(
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
const char* DbgFileName,
|
|
||||||
int DbgLineNo,
|
|
||||||
const char* FmtStr,
|
|
||||||
...) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -283,19 +222,8 @@ static UPNP_INLINE void UpnpPrintf(
|
|||||||
* per the requested banner
|
* per the requested banner
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
void UpnpDisplayBanner (FILE *fd,
|
||||||
void UpnpDisplayBanner(
|
const char** lines, size_t size, int starlength);
|
||||||
FILE *fd,
|
|
||||||
const char **lines,
|
|
||||||
size_t size,
|
|
||||||
int starlength);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void UpnpDisplayBanner(
|
|
||||||
FILE *fd,
|
|
||||||
const char **lines,
|
|
||||||
size_t size,
|
|
||||||
int starlength) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -312,23 +240,19 @@ static UPNP_INLINE void UpnpDisplayBanner(
|
|||||||
* debug statement is coming to the log file
|
* debug statement is coming to the log file
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
void UpnpDisplayFileAndLine (FILE *fd, const char *DbgFileName, int DbgLineNo);
|
||||||
void UpnpDisplayFileAndLine(
|
|
||||||
FILE *fd,
|
|
||||||
const char *DbgFileName,
|
//@}
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
|
||||||
FILE *fd,
|
|
||||||
const char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*! @} */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* UPNP_DEBUG_H */
|
#endif // UPNP_HAVE_DEBUG
|
||||||
|
|
||||||
|
#endif // UPNP_DEBUG_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/** @name Optional Tool APIs
|
/** @name Optional Tool APIs
|
||||||
* The Linux SDK for UPnP Devices contains some additional, optional
|
* The Linux SDK for UPnP Devices contains some additional, optional
|
||||||
@@ -36,14 +36,14 @@
|
|||||||
* size in the SDK. Refer to the README for details.
|
* size in the SDK. Refer to the README for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! @{ */
|
//@{
|
||||||
|
|
||||||
#ifndef UPNP_TOOLS_H
|
#ifndef UPNP_TOOLS_H
|
||||||
#define UPNP_TOOLS_H
|
#define UPNP_TOOLS_H
|
||||||
|
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
|
|
||||||
/* Function declarations only if tools compiled into the library */
|
// Function declarations only if tools compiled into the library
|
||||||
#if UPNP_HAVE_TOOLS
|
#if UPNP_HAVE_TOOLS
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -217,13 +217,14 @@ EXPORT_SPEC const char * UpnpGetErrorMessage(
|
|||||||
int errorcode /** The SDK error code to convert. */
|
int errorcode /** The SDK error code to convert. */
|
||||||
);
|
);
|
||||||
|
|
||||||
/*! @} */
|
//@}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* UPNP_HAVE_TOOLS */
|
#endif // UPNP_HAVE_TOOLS
|
||||||
|
|
||||||
|
#endif // UPNP_TOOLS_H
|
||||||
|
|
||||||
#endif /* UPNP_TOOLS_H */
|
|
||||||
|
|
||||||
|
@@ -1,87 +0,0 @@
|
|||||||
#
|
|
||||||
# "Makefile.am" for "libupnp/upnp/sample"
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
|
||||||
-I$(top_srcdir)/upnp/inc \
|
|
||||||
-I$(top_srcdir)/threadutil/inc \
|
|
||||||
-I$(top_srcdir)/ixml/inc
|
|
||||||
|
|
||||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
|
||||||
|
|
||||||
AM_LDFLAGS = $(PTHREAD_LIBS)
|
|
||||||
|
|
||||||
LDADD = \
|
|
||||||
$(top_builddir)/upnp/libupnp.la \
|
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
|
||||||
$(top_builddir)/ixml/libixml.la
|
|
||||||
|
|
||||||
|
|
||||||
# samples
|
|
||||||
noinst_PROGRAMS =
|
|
||||||
if ENABLE_SAMPLES
|
|
||||||
if ENABLE_CLIENT
|
|
||||||
noinst_PROGRAMS += upnp_tv_ctrlpt
|
|
||||||
upnp_tv_ctrlpt_CPPFLAGS = \
|
|
||||||
$(AM_CPPFLAGS) \
|
|
||||||
-I$(srcdir)/common/ \
|
|
||||||
-I$(srcdir)/tvctrlpt
|
|
||||||
if ENABLE_DEVICE
|
|
||||||
noinst_PROGRAMS += upnp_tv_combo
|
|
||||||
upnp_tv_combo_CPPFLAGS = $(AM_CPPFLAGS) \
|
|
||||||
-I$(srcdir)/common/ \
|
|
||||||
-I$(srcdir)/tvcombo
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
if ENABLE_DEVICE
|
|
||||||
noinst_PROGRAMS += upnp_tv_device
|
|
||||||
upnp_tv_device_CPPFLAGS = \
|
|
||||||
$(AM_CPPFLAGS) \
|
|
||||||
-I$(srcdir)/common/ \
|
|
||||||
-I$(srcdir)/tvdevice
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
upnp_tv_device_SOURCES = \
|
|
||||||
common/sample_util.c \
|
|
||||||
common/sample_util.h \
|
|
||||||
tvdevice/upnp_tv_device.c \
|
|
||||||
tvdevice/upnp_tv_device.h \
|
|
||||||
tvdevice/linux/upnp_tv_device_main.c
|
|
||||||
|
|
||||||
|
|
||||||
upnp_tv_ctrlpt_SOURCES = \
|
|
||||||
common/sample_util.c \
|
|
||||||
common/sample_util.h \
|
|
||||||
tvctrlpt/upnp_tv_ctrlpt.c \
|
|
||||||
tvctrlpt/upnp_tv_ctrlpt.h \
|
|
||||||
tvctrlpt/linux/upnp_tv_ctrlpt_main.c
|
|
||||||
|
|
||||||
upnp_tv_combo_SOURCES = \
|
|
||||||
common/sample_util.c \
|
|
||||||
common/sample_util.h \
|
|
||||||
tvcombo/upnp_tv_ctrlpt.c \
|
|
||||||
tvcombo/upnp_tv_ctrlpt.h \
|
|
||||||
tvcombo/upnp_tv_device.c \
|
|
||||||
tvcombo/upnp_tv_device.h \
|
|
||||||
tvcombo/linux/upnp_tv_combo_main.c
|
|
||||||
|
|
||||||
|
|
||||||
if WITH_DOCUMENTATION
|
|
||||||
examplesdir = $(docdir)/examples
|
|
||||||
examples_DATA = \
|
|
||||||
$(upnp_tv_ctrlpt_SOURCES) \
|
|
||||||
$(upnp_tv_device_SOURCES)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
|
||||||
web/tvcombodesc.xml \
|
|
||||||
web/tvcontrolSCPD.xml \
|
|
||||||
web/tvdevicedesc.xml \
|
|
||||||
web/tvdevicepres.html \
|
|
||||||
web/tvpictureSCPD.xml
|
|
||||||
|
|
@@ -1,489 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
#include "sample_util.h"
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
|
||||||
#include "upnp_tv_device.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
Tags for valid commands issued at the command prompt
|
|
||||||
*/
|
|
||||||
enum cmdloop_tvcmds {
|
|
||||||
PRTHELP = 0, PRTFULLHELP, POWON, POWOFF,
|
|
||||||
SETCHAN, SETVOL, SETCOL, SETTINT, SETCONT, SETBRT,
|
|
||||||
CTRLACTION, PICTACTION, CTRLGETVAR, PICTGETVAR,
|
|
||||||
PRTDEV, LSTDEV, REFRESH, EXITCMD
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Data structure for parsing commands from the command line
|
|
||||||
*/
|
|
||||||
struct cmdloop_commands {
|
|
||||||
char *str; // the string
|
|
||||||
int cmdnum; // the command
|
|
||||||
int numargs; // the number of arguments
|
|
||||||
char *args; // the args
|
|
||||||
} cmdloop_commands;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Mappings between command text names, command tag,
|
|
||||||
and required command arguments for command line
|
|
||||||
commands
|
|
||||||
*/
|
|
||||||
static struct cmdloop_commands cmdloop_cmdlist[] = {
|
|
||||||
{"Help", PRTHELP, 1, ""},
|
|
||||||
{"HelpFull", PRTFULLHELP, 1, ""},
|
|
||||||
{"ListDev", LSTDEV, 1, ""},
|
|
||||||
{"Refresh", REFRESH, 1, ""},
|
|
||||||
{"PrintDev", PRTDEV, 2, "<devnum>"},
|
|
||||||
{"PowerOn", POWON, 2, "<devnum>"},
|
|
||||||
{"PowerOff", POWOFF, 2, "<devnum>"},
|
|
||||||
{"SetChannel", SETCHAN, 3, "<devnum> <channel (int)>"},
|
|
||||||
{"SetVolume", SETVOL, 3, "<devnum> <volume (int)>"},
|
|
||||||
{"SetColor", SETCOL, 3, "<devnum> <color (int)>"},
|
|
||||||
{"SetTint", SETTINT, 3, "<devnum> <tint (int)>"},
|
|
||||||
{"SetContrast", SETCONT, 3, "<devnum> <contrast (int)>"},
|
|
||||||
{"SetBrightness", SETBRT, 3, "<devnum> <brightness (int)>"},
|
|
||||||
{"CtrlAction", CTRLACTION, 2, "<devnum> <action (string)>"},
|
|
||||||
{"PictAction", PICTACTION, 2, "<devnum> <action (string)>"},
|
|
||||||
{"CtrlGetVar", CTRLGETVAR, 2, "<devnum> <varname (string)>"},
|
|
||||||
{"PictGetVar", PICTGETVAR, 2, "<devnum> <varname (string)>"},
|
|
||||||
{"Exit", EXITCMD, 1, ""}
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
linux_print( const char *string )
|
|
||||||
{
|
|
||||||
puts( string );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* TvCtrlPointPrintHelp
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Print help info for this application.
|
|
||||||
********************************************************************************/
|
|
||||||
void
|
|
||||||
TvCtrlPointPrintShortHelp( void )
|
|
||||||
{
|
|
||||||
SampleUtil_Print( "Commands:" );
|
|
||||||
SampleUtil_Print( " Help" );
|
|
||||||
SampleUtil_Print( " HelpFull" );
|
|
||||||
SampleUtil_Print( " ListDev" );
|
|
||||||
SampleUtil_Print( " Refresh" );
|
|
||||||
SampleUtil_Print( " PrintDev <devnum>" );
|
|
||||||
SampleUtil_Print( " PowerOn <devnum>" );
|
|
||||||
SampleUtil_Print( " PowerOff <devnum>" );
|
|
||||||
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
|
||||||
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
|
||||||
SampleUtil_Print( " SetColor <devnum> <color>" );
|
|
||||||
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
|
||||||
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
|
||||||
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
|
||||||
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " PictAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " CtrlGetVar <devnum> <varname>" );
|
|
||||||
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " Exit" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TvCtrlPointPrintLongHelp( void )
|
|
||||||
{
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
SampleUtil_Print( "******************************" );
|
|
||||||
SampleUtil_Print( "* TV Control Point Help Info *" );
|
|
||||||
SampleUtil_Print( "******************************" );
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
SampleUtil_Print( "This sample control point application automatically searches" );
|
|
||||||
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
|
||||||
SampleUtil_Print( "devices. While registers a tv device itself." );
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
SampleUtil_Print( "Commands:" );
|
|
||||||
SampleUtil_Print( " Help" );
|
|
||||||
SampleUtil_Print( " Print this help info." );
|
|
||||||
SampleUtil_Print( " ListDev" );
|
|
||||||
SampleUtil_Print( " Print the current list of TV Device Emulators that this" );
|
|
||||||
SampleUtil_Print( " control point is aware of. Each device is preceded by a" );
|
|
||||||
SampleUtil_Print( " device number which corresponds to the devnum argument of" );
|
|
||||||
SampleUtil_Print( " commands listed below." );
|
|
||||||
SampleUtil_Print( " Refresh" );
|
|
||||||
SampleUtil_Print( " Delete all of the devices from the device list and issue new" );
|
|
||||||
SampleUtil_Print( " search request to rebuild the list from scratch." );
|
|
||||||
SampleUtil_Print( " PrintDev <devnum>" );
|
|
||||||
SampleUtil_Print( " Print the state table for the device <devnum>." );
|
|
||||||
SampleUtil_Print( " e.g., 'PrintDev 1' prints the state table for the first" );
|
|
||||||
SampleUtil_Print( " device in the device list." );
|
|
||||||
SampleUtil_Print( " PowerOn <devnum>" );
|
|
||||||
SampleUtil_Print( " Sends the PowerOn action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>." );
|
|
||||||
SampleUtil_Print( " PowerOff <devnum>" );
|
|
||||||
SampleUtil_Print( " Sends the PowerOff action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>." );
|
|
||||||
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
|
||||||
SampleUtil_Print( " Sends the SetChannel action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>, requesting the channel to be changed" );
|
|
||||||
SampleUtil_Print( " to <channel>." );
|
|
||||||
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
|
||||||
SampleUtil_Print( " Sends the SetVolume action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>, requesting the volume to be changed" );
|
|
||||||
SampleUtil_Print( " to <volume>." );
|
|
||||||
SampleUtil_Print( " SetColor <devnum> <color>" );
|
|
||||||
SampleUtil_Print( " Sends the SetColor action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>, requesting the color to be changed" );
|
|
||||||
SampleUtil_Print( " to <color>." );
|
|
||||||
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
|
||||||
SampleUtil_Print( " Sends the SetTint action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>, requesting the tint to be changed" );
|
|
||||||
SampleUtil_Print( " to <tint>." );
|
|
||||||
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
|
||||||
SampleUtil_Print( " Sends the SetContrast action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>, requesting the contrast to be changed" );
|
|
||||||
SampleUtil_Print( " to <contrast>." );
|
|
||||||
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
|
||||||
SampleUtil_Print( " Sends the SetBrightness action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>, requesting the brightness to be changed" );
|
|
||||||
SampleUtil_Print( " to <brightness>." );
|
|
||||||
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " Sends an action request specified by the string <action>" );
|
|
||||||
SampleUtil_Print( " to the Control Service of device <devnum>. This command" );
|
|
||||||
SampleUtil_Print( " only works for actions that have no arguments." );
|
|
||||||
SampleUtil_Print( " (e.g., \"CtrlAction 1 IncreaseChannel\")" );
|
|
||||||
SampleUtil_Print( " PictAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " Sends an action request specified by the string <action>" );
|
|
||||||
SampleUtil_Print( " to the Picture Service of device <devnum>. This command" );
|
|
||||||
SampleUtil_Print( " only works for actions that have no arguments." );
|
|
||||||
SampleUtil_Print( " (e.g., \"PictAction 1 DecreaseContrast\")" );
|
|
||||||
SampleUtil_Print( " CtrlGetVar <devnum> <varname>" );
|
|
||||||
SampleUtil_Print( " Requests the value of a variable specified by the string <varname>" );
|
|
||||||
SampleUtil_Print( " from the Control Service of device <devnum>." );
|
|
||||||
SampleUtil_Print( " (e.g., \"CtrlGetVar 1 Volume\")" );
|
|
||||||
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " Requests the value of a variable specified by the string <varname>" );
|
|
||||||
SampleUtil_Print( " from the Picture Service of device <devnum>." );
|
|
||||||
SampleUtil_Print( " (e.g., \"PictGetVar 1 Tint\")" );
|
|
||||||
SampleUtil_Print( " Exit" );
|
|
||||||
SampleUtil_Print( " Exits the control point application." );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* TvCtrlPointPrintCommands
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Print the list of valid command line commands to the user
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
void
|
|
||||||
TvCtrlPointPrintCommands()
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands );
|
|
||||||
|
|
||||||
SampleUtil_Print( "Valid Commands:" );
|
|
||||||
for( i = 0; i < numofcmds; i++ ) {
|
|
||||||
SampleUtil_Print( " %-14s %s", cmdloop_cmdlist[i].str,
|
|
||||||
cmdloop_cmdlist[i].args );
|
|
||||||
}
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* TvCtrlPointCommandLoop
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Function that receives commands from the user at the command prompt
|
|
||||||
* during the lifetime of the control point, and calls the appropriate
|
|
||||||
* functions for those commands.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
void *
|
|
||||||
TvCtrlPointCommandLoop( void *args )
|
|
||||||
{
|
|
||||||
char cmdline[100];
|
|
||||||
|
|
||||||
while( 1 ) {
|
|
||||||
SampleUtil_Print( "\n>> " );
|
|
||||||
fgets( cmdline, 100, stdin );
|
|
||||||
TvCtrlPointProcessCommand( cmdline );
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
TvCtrlPointProcessCommand( char *cmdline )
|
|
||||||
{
|
|
||||||
char cmd[100];
|
|
||||||
char strarg[100];
|
|
||||||
int arg_val_err = -99999;
|
|
||||||
int arg1 = arg_val_err;
|
|
||||||
int arg2 = arg_val_err;
|
|
||||||
int cmdnum = -1;
|
|
||||||
int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands );
|
|
||||||
int cmdfound = 0;
|
|
||||||
int i,
|
|
||||||
rc;
|
|
||||||
int invalidargs = 0;
|
|
||||||
int validargs;
|
|
||||||
|
|
||||||
validargs = sscanf( cmdline, "%s %d %d", cmd, &arg1, &arg2 );
|
|
||||||
|
|
||||||
for( i = 0; i < numofcmds; i++ ) {
|
|
||||||
if( strcasecmp( cmd, cmdloop_cmdlist[i].str ) == 0 ) {
|
|
||||||
cmdnum = cmdloop_cmdlist[i].cmdnum;
|
|
||||||
cmdfound++;
|
|
||||||
if( validargs != cmdloop_cmdlist[i].numargs )
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !cmdfound ) {
|
|
||||||
SampleUtil_Print( "Command not found; try 'Help'" );
|
|
||||||
return TV_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( invalidargs ) {
|
|
||||||
SampleUtil_Print( "Invalid arguments; try 'Help'" );
|
|
||||||
return TV_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( cmdnum ) {
|
|
||||||
case PRTHELP:
|
|
||||||
TvCtrlPointPrintShortHelp();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PRTFULLHELP:
|
|
||||||
TvCtrlPointPrintLongHelp();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case POWON:
|
|
||||||
TvCtrlPointSendPowerOn( arg1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case POWOFF:
|
|
||||||
TvCtrlPointSendPowerOff( arg1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETCHAN:
|
|
||||||
TvCtrlPointSendSetChannel( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETVOL:
|
|
||||||
TvCtrlPointSendSetVolume( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETCOL:
|
|
||||||
TvCtrlPointSendSetColor( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINT:
|
|
||||||
TvCtrlPointSendSetTint( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETCONT:
|
|
||||||
TvCtrlPointSendSetContrast( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETBRT:
|
|
||||||
TvCtrlPointSendSetBrightness( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CTRLACTION:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointSendAction( TV_SERVICE_CONTROL, arg1, strarg,
|
|
||||||
NULL, NULL, 0 );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PICTACTION:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointSendAction( TV_SERVICE_PICTURE, arg1, strarg,
|
|
||||||
NULL, NULL, 0 );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CTRLGETVAR:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointGetVar( TV_SERVICE_CONTROL, arg1, strarg );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PICTGETVAR:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointGetVar( TV_SERVICE_PICTURE, arg1, strarg );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PRTDEV:
|
|
||||||
TvCtrlPointPrintDevice( arg1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LSTDEV:
|
|
||||||
TvCtrlPointPrintList();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case REFRESH:
|
|
||||||
TvCtrlPointRefresh();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EXITCMD:
|
|
||||||
rc = TvCtrlPointStop();
|
|
||||||
exit( rc );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
SampleUtil_Print( "Command not implemented; see 'Help'" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( invalidargs )
|
|
||||||
SampleUtil_Print( "Invalid args in command; see 'Help'" );
|
|
||||||
|
|
||||||
return TV_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
device_main( int argc, char **argv )
|
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int portTemp = 0;
|
|
||||||
char *ip_address = NULL,
|
|
||||||
*desc_doc_name = NULL,
|
|
||||||
*web_dir_path = NULL;
|
|
||||||
unsigned int port = 0;
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
SampleUtil_Initialize( linux_print );
|
|
||||||
|
|
||||||
// Parse options
|
|
||||||
for( i = 1; i < argc; i++ ) {
|
|
||||||
if( strcmp( argv[i], "-ip" ) == 0 ) {
|
|
||||||
ip_address = argv[++i];
|
|
||||||
} else if( strcmp( argv[i], "-port" ) == 0 ) {
|
|
||||||
sscanf( argv[++i], "%u", &portTemp );
|
|
||||||
} else if( strcmp( argv[i], "-desc" ) == 0 ) {
|
|
||||||
desc_doc_name = argv[++i];
|
|
||||||
} else if( strcmp( argv[i], "-webdir" ) == 0 ) {
|
|
||||||
web_dir_path = argv[++i];
|
|
||||||
} else if( strcmp( argv[i], "-help" ) == 0 ) {
|
|
||||||
SampleUtil_Print( "Usage: %s -ip ipaddress -port port"
|
|
||||||
" -desc desc_doc_name -webdir web_dir_path"
|
|
||||||
" -help (this message)\n", argv[0] );
|
|
||||||
SampleUtil_Print( "\tipaddress: IP address of the device"
|
|
||||||
" (must match desc. doc)\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: 192.168.0.4\n" );
|
|
||||||
SampleUtil_Print( "\tport: Port number to use for "
|
|
||||||
"receiving UPnP messages (must match desc. doc)\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: 5431\n" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "\tdesc_doc_name: name of device description document\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: tvcombodesc.xml\n" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "\tweb_dir_path: Filesystem path where web files "
|
|
||||||
"related to the device are stored\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: /upnp/sample/web\n" );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
port = ( unsigned short )portTemp;
|
|
||||||
|
|
||||||
return TvDeviceStart(
|
|
||||||
ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main( int argc, char **argv )
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
ithread_t cmdloop_thread;
|
|
||||||
int sig;
|
|
||||||
sigset_t sigs_to_catch;
|
|
||||||
int code;
|
|
||||||
|
|
||||||
device_main(argc, argv);
|
|
||||||
rc = TvCtrlPointStart( linux_print, NULL );
|
|
||||||
if( rc != TV_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
// start a command loop thread
|
|
||||||
code =
|
|
||||||
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
/*
|
|
||||||
Catch Ctrl-C and properly shutdown
|
|
||||||
*/
|
|
||||||
sigemptyset( &sigs_to_catch );
|
|
||||||
sigaddset( &sigs_to_catch, SIGINT );
|
|
||||||
sigwait( &sigs_to_catch, &sig );
|
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
|
||||||
TvDeviceStop();
|
|
||||||
rc = TvCtrlPointStop();
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,158 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_CTRLPT_H
|
|
||||||
#define UPNP_TV_CTRLPT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnptools.h"
|
|
||||||
#include "sample_util.h"
|
|
||||||
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
|
||||||
#define TV_SERVICE_CONTROL 0
|
|
||||||
#define TV_SERVICE_PICTURE 1
|
|
||||||
|
|
||||||
#define TV_CONTROL_VARCOUNT 3
|
|
||||||
#define TV_CONTROL_POWER 0
|
|
||||||
#define TV_CONTROL_CHANNEL 1
|
|
||||||
#define TV_CONTROL_VOLUME 2
|
|
||||||
|
|
||||||
#define TV_PICTURE_VARCOUNT 4
|
|
||||||
#define TV_PICTURE_COLOR 0
|
|
||||||
#define TV_PICTURE_TINT 1
|
|
||||||
#define TV_PICTURE_CONTRAST 2
|
|
||||||
#define TV_PICTURE_BRIGHTNESS 3
|
|
||||||
|
|
||||||
#define TV_MAX_VAL_LEN 5
|
|
||||||
|
|
||||||
#define TV_SUCCESS 0
|
|
||||||
#define TV_ERROR (-1)
|
|
||||||
#define TV_WARNING 1
|
|
||||||
|
|
||||||
/* This should be the maximum VARCOUNT from above */
|
|
||||||
#define TV_MAXVARS TV_PICTURE_VARCOUNT
|
|
||||||
|
|
||||||
extern char TvDeviceType[];
|
|
||||||
extern char *TvServiceType[];
|
|
||||||
extern char *TvServiceName[];
|
|
||||||
extern char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS];
|
|
||||||
extern char TvVarCount[];
|
|
||||||
|
|
||||||
struct tv_service {
|
|
||||||
char ServiceId[NAME_SIZE];
|
|
||||||
char ServiceType[NAME_SIZE];
|
|
||||||
char *VariableStrVal[TV_MAXVARS];
|
|
||||||
char EventURL[NAME_SIZE];
|
|
||||||
char ControlURL[NAME_SIZE];
|
|
||||||
char SID[NAME_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct TvDeviceNode *GlobalDeviceList;
|
|
||||||
|
|
||||||
struct TvDevice {
|
|
||||||
char UDN[250];
|
|
||||||
char DescDocURL[250];
|
|
||||||
char FriendlyName[250];
|
|
||||||
char PresURL[250];
|
|
||||||
int AdvrTimeOut;
|
|
||||||
struct tv_service TvService[TV_SERVICE_SERVCOUNT];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TvDeviceNode {
|
|
||||||
struct TvDevice device;
|
|
||||||
struct TvDeviceNode *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern ithread_mutex_t DeviceListMutex;
|
|
||||||
|
|
||||||
extern UpnpClient_Handle ctrlpt_handle;
|
|
||||||
|
|
||||||
void TvCtrlPointPrintHelp( void );
|
|
||||||
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
|
||||||
int TvCtrlPointRemoveDevice(char*);
|
|
||||||
int TvCtrlPointRemoveAll( void );
|
|
||||||
int TvCtrlPointRefresh( void );
|
|
||||||
|
|
||||||
|
|
||||||
int TvCtrlPointSendAction(int, int, char *, char **, char **, int);
|
|
||||||
int TvCtrlPointSendActionNumericArg(int devnum, int service, char *actionName, char *paramName, int paramValue);
|
|
||||||
int TvCtrlPointSendPowerOn(int devnum);
|
|
||||||
int TvCtrlPointSendPowerOff(int devnum);
|
|
||||||
int TvCtrlPointSendSetChannel(int, int);
|
|
||||||
int TvCtrlPointSendSetVolume(int, int);
|
|
||||||
int TvCtrlPointSendSetColor(int, int);
|
|
||||||
int TvCtrlPointSendSetTint(int, int);
|
|
||||||
int TvCtrlPointSendSetContrast(int, int);
|
|
||||||
int TvCtrlPointSendSetBrightness(int, int);
|
|
||||||
|
|
||||||
int TvCtrlPointGetVar(int, int, char*);
|
|
||||||
int TvCtrlPointGetPower(int devnum);
|
|
||||||
int TvCtrlPointGetChannel(int);
|
|
||||||
int TvCtrlPointGetVolume(int);
|
|
||||||
int TvCtrlPointGetColor(int);
|
|
||||||
int TvCtrlPointGetTint(int);
|
|
||||||
int TvCtrlPointGetContrast(int);
|
|
||||||
int TvCtrlPointGetBrightness(int);
|
|
||||||
|
|
||||||
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
|
||||||
int TvCtrlPointPrintList( void );
|
|
||||||
int TvCtrlPointPrintDevice(int);
|
|
||||||
void TvCtrlPointAddDevice (IXML_Document *, char *, int);
|
|
||||||
void TvCtrlPointHandleGetVar(char *,char *,DOMString);
|
|
||||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
|
||||||
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
|
||||||
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
|
||||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
|
||||||
void TvCtrlPointVerifyTimeouts(int);
|
|
||||||
void TvCtrlPointPrintCommands( void );
|
|
||||||
void* TvCtrlPointCommandLoop( void* );
|
|
||||||
int TvCtrlPointStart( print_string printFunctionPtr, state_update updateFunctionPtr );
|
|
||||||
int TvCtrlPointStop( void );
|
|
||||||
int TvCtrlPointProcessCommand( char *cmdline );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //UPNP_TV_CTRLPT_H
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,638 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_DEVICE_H
|
|
||||||
#define UPNP_TV_DEVICE_H
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "sample_util.h"
|
|
||||||
|
|
||||||
//Color constants
|
|
||||||
#define MAX_COLOR 10
|
|
||||||
#define MIN_COLOR 1
|
|
||||||
|
|
||||||
//Brightness constants
|
|
||||||
#define MAX_BRIGHTNESS 10
|
|
||||||
#define MIN_BRIGHTNESS 1
|
|
||||||
|
|
||||||
//Power constants
|
|
||||||
#define POWER_ON 1
|
|
||||||
#define POWER_OFF 0
|
|
||||||
|
|
||||||
//Tint constants
|
|
||||||
#define MAX_TINT 10
|
|
||||||
#define MIN_TINT 1
|
|
||||||
|
|
||||||
//Volume constants
|
|
||||||
#define MAX_VOLUME 10
|
|
||||||
#define MIN_VOLUME 1
|
|
||||||
|
|
||||||
//Contrast constants
|
|
||||||
#define MAX_CONTRAST 10
|
|
||||||
#define MIN_CONTRAST 1
|
|
||||||
|
|
||||||
//Channel constants
|
|
||||||
#define MAX_CHANNEL 100
|
|
||||||
#define MIN_CHANNEL 1
|
|
||||||
|
|
||||||
//Number of services.
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
|
||||||
|
|
||||||
//Index of control service
|
|
||||||
#define TV_SERVICE_CONTROL 0
|
|
||||||
|
|
||||||
//Index of picture service
|
|
||||||
#define TV_SERVICE_PICTURE 1
|
|
||||||
|
|
||||||
//Number of control variables
|
|
||||||
#define TV_CONTROL_VARCOUNT 3
|
|
||||||
|
|
||||||
//Index of power variable
|
|
||||||
#define TV_CONTROL_POWER 0
|
|
||||||
|
|
||||||
//Index of channel variable
|
|
||||||
#define TV_CONTROL_CHANNEL 1
|
|
||||||
|
|
||||||
//Index of volume variable
|
|
||||||
#define TV_CONTROL_VOLUME 2
|
|
||||||
|
|
||||||
//Number of picture variables
|
|
||||||
#define TV_PICTURE_VARCOUNT 4
|
|
||||||
|
|
||||||
//Index of color variable
|
|
||||||
#define TV_PICTURE_COLOR 0
|
|
||||||
|
|
||||||
//Index of tint variable
|
|
||||||
#define TV_PICTURE_TINT 1
|
|
||||||
|
|
||||||
//Index of contrast variable
|
|
||||||
#define TV_PICTURE_CONTRAST 2
|
|
||||||
|
|
||||||
//Index of brightness variable
|
|
||||||
#define TV_PICTURE_BRIGHTNESS 3
|
|
||||||
|
|
||||||
//Max value length
|
|
||||||
#define TV_MAX_VAL_LEN 5
|
|
||||||
|
|
||||||
//Max actions
|
|
||||||
#define TV_MAXACTIONS 12
|
|
||||||
|
|
||||||
/* This should be the maximum VARCOUNT from above */
|
|
||||||
#define TV_MAXVARS TV_PICTURE_VARCOUNT
|
|
||||||
|
|
||||||
|
|
||||||
extern char TvDeviceType[];
|
|
||||||
|
|
||||||
extern char *TvServiceType[];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* upnp_action
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Prototype for all actions. For each action that a service
|
|
||||||
* implements, there is a corresponding function with this prototype.
|
|
||||||
* Pointers to these functions, along with action names, are stored
|
|
||||||
* in the service table. When an action request comes in the action
|
|
||||||
* name is matched, and the appropriate function is called.
|
|
||||||
* Each function returns UPNP_E_SUCCESS, on success, and a nonzero
|
|
||||||
* error code on failure.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * request - document of action request
|
|
||||||
* IXML_Document **out - action result
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,
|
|
||||||
char **errorString);
|
|
||||||
|
|
||||||
/* Structure for storing Tv Service
|
|
||||||
identifiers and state table */
|
|
||||||
struct TvService {
|
|
||||||
|
|
||||||
char UDN[NAME_SIZE]; /* Universally Unique Device Name */
|
|
||||||
char ServiceId[NAME_SIZE];
|
|
||||||
char ServiceType[NAME_SIZE];
|
|
||||||
char *VariableName[TV_MAXVARS];
|
|
||||||
char *VariableStrVal[TV_MAXVARS];
|
|
||||||
char *ActionNames[TV_MAXACTIONS];
|
|
||||||
upnp_action actions[TV_MAXACTIONS];
|
|
||||||
unsigned int VariableCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Array of service structures
|
|
||||||
extern struct TvService tv_service_table[];
|
|
||||||
|
|
||||||
//Device handle returned from sdk
|
|
||||||
extern UpnpDevice_Handle device_handle;
|
|
||||||
|
|
||||||
|
|
||||||
/* Mutex for protecting the global state table data
|
|
||||||
in a multi-threaded, asynchronous environment.
|
|
||||||
All functions should lock this mutex before reading
|
|
||||||
or writing the state table data. */
|
|
||||||
extern ithread_mutex_t TVDevMutex;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* SetActionTable
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initializes the action table for the specified service.
|
|
||||||
* Note that
|
|
||||||
* knowledge of the service description is
|
|
||||||
* assumed. Action names are hardcoded.
|
|
||||||
* Parameters:
|
|
||||||
* int serviceType - one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE
|
|
||||||
* struct TvService *out - service containing action table to set.
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int SetActionTable(int serviceType, struct TvService * out);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceStateTableInit
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initialize the device state table for
|
|
||||||
* this TvDevice, pulling identifier info
|
|
||||||
* from the description Document. Note that
|
|
||||||
* knowledge of the service description is
|
|
||||||
* assumed. State table variables and default
|
|
||||||
* values are currently hardcoded in this file
|
|
||||||
* rather than being read from service description
|
|
||||||
* documents.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* DescDocURL -- The description document URL
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceStateTableInit(char*);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceHandleSubscriptionRequest
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called during a subscription request callback. If the
|
|
||||||
* subscription request is for this device and either its
|
|
||||||
* control service or picture service, then accept it.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* sr_event -- The subscription request event structure
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceHandleGetVarRequest
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called during a get variable request callback. If the
|
|
||||||
* request is for this device and either its control service
|
|
||||||
* or picture service, then respond with the variable value.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* cgv_event -- The control get variable request event structure
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceHandleActionRequest
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called during an action request callback. If the
|
|
||||||
* request is for this device and either its control service
|
|
||||||
* or picture service, then perform the action and respond.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* ca_event -- The control action request event structure
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceHandleActionRequest(struct Upnp_Action_Request *);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceCallbackEventHandler
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* The callback handler registered with the SDK while registering
|
|
||||||
* root device. Dispatches the request to the appropriate procedure
|
|
||||||
* based on the value of EventType. The four requests handled by the
|
|
||||||
* device are:
|
|
||||||
* 1) Event Subscription requests.
|
|
||||||
* 2) Get Variable requests.
|
|
||||||
* 3) Action requests.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* EventType -- The type of callback event
|
|
||||||
* Event -- Data structure containing event data
|
|
||||||
* Cookie -- Optional data specified during callback registration
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceCallbackEventHandler(Upnp_EventType, void*, void*);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetServiceTableVar
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Update the TvDevice service state table, and notify all subscribed
|
|
||||||
* control points of the updated state. Note that since this function
|
|
||||||
* blocks on the mutex TVDevMutex, to avoid a hang this function should
|
|
||||||
* not be called within any other function that currently has this mutex
|
|
||||||
* locked.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* service -- The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE)
|
|
||||||
* variable -- The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL,
|
|
||||||
* TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT,
|
|
||||||
* TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS)
|
|
||||||
* value -- The string representation of the new value
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*);
|
|
||||||
|
|
||||||
//Control Service Actions
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDevicePowerOn
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Turn the power on.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - document of action request
|
|
||||||
* IXML_Document **out - action result
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDevicePowerOff
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Turn the power off.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - document of action request
|
|
||||||
* IXML_Document **out - action result
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetChannel
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the channel, update the TvDevice control service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseChannel
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase the channel.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseChannel
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the channel.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetVolume
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the volume, update the TvDevice control service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseVolume
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase the volume.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseVolume
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the volume.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
//Picture Service Actions
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetColor
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the color, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseColor
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase the color.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseColor
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the color.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetTint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the tint, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseTint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase tint.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseTint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease tint.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* TvDeviceSetContrast
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the contrast, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseContrast
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Increase the contrast.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseContrast
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the contrast.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetBrightness
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the brightness, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* brightness -- The brightness value to change to.
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseBrightness
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase brightness.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseBrightness
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease brightnesss.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
|
||||||
char *web_dir_path, print_string pfun);
|
|
||||||
int TvDeviceStop();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@@ -7,6 +7,7 @@
|
|||||||
</specVersion>
|
</specVersion>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<actionList>
|
<actionList>
|
||||||
|
|
||||||
<action>
|
<action>
|
||||||
@@ -37,12 +38,6 @@
|
|||||||
<name>SetChannel</name>
|
<name>SetChannel</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
|
||||||
<argument>
|
|
||||||
<name>Channel</name>
|
|
||||||
<relatedStateVariable>Channel</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewChannel</name>
|
<name>NewChannel</name>
|
||||||
<retval />
|
<retval />
|
||||||
@@ -50,6 +45,11 @@
|
|||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
|
<argument>
|
||||||
|
<name>Channel</name>
|
||||||
|
<relatedStateVariable>Channel</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -80,11 +80,6 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetVolume</name>
|
<name>SetVolume</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
<argument>
|
|
||||||
<name>Volume</name>
|
|
||||||
<relatedStateVariable>Volume</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewVolume</name>
|
<name>NewVolume</name>
|
||||||
@@ -92,6 +87,11 @@
|
|||||||
<relatedStateVariable>Volume</relatedStateVariable>
|
<relatedStateVariable>Volume</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
<argument>
|
||||||
|
<name>Volume</name>
|
||||||
|
<relatedStateVariable>Volume</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -124,6 +124,9 @@
|
|||||||
|
|
||||||
</actionList>
|
</actionList>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<serviceStateTable>
|
<serviceStateTable>
|
||||||
|
|
||||||
<stateVariable sendEvents="yes">
|
<stateVariable sendEvents="yes">
|
@@ -12,12 +12,6 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetColor</name>
|
<name>SetColor</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
<argument>
|
|
||||||
<name>Color</name>
|
|
||||||
<relatedStateVariable>Color</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewColor</name>
|
<name>NewColor</name>
|
||||||
<retval />
|
<retval />
|
||||||
@@ -25,6 +19,11 @@
|
|||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
|
<argument>
|
||||||
|
<name>Color</name>
|
||||||
|
<relatedStateVariable>Color</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -55,19 +54,19 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetTint</name>
|
<name>SetTint</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
<argument>
|
<argument>
|
||||||
<name>Tint</name>
|
|
||||||
<relatedStateVariable>Tint</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
<argument>
|
|
||||||
<name>NewTint</name>
|
<name>NewTint</name>
|
||||||
<retval />
|
<retval />
|
||||||
<relatedStateVariable>Tint</relatedStateVariable>
|
<relatedStateVariable>Tint</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
</argumentList>
|
<argument>
|
||||||
|
<name>Tint</name>
|
||||||
|
<relatedStateVariable>Tint</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
<action>
|
<action>
|
||||||
@@ -97,18 +96,18 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetContrast</name>
|
<name>SetContrast</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
<argument>
|
<argument>
|
||||||
<name>Contrast</name>
|
|
||||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
<argument>
|
|
||||||
<name>NewContrast</name>
|
<name>NewContrast</name>
|
||||||
<retval />
|
<retval />
|
||||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
</argumentList>
|
<argument>
|
||||||
|
<name>Contrast</name>
|
||||||
|
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
<action>
|
<action>
|
||||||
@@ -138,17 +137,19 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetBrightness</name>
|
<name>SetBrightness</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
<argument>
|
|
||||||
<name>Brightness</name>
|
|
||||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewBrightness</name>
|
<name>NewBrightness</name>
|
||||||
<retval />
|
<retval />
|
||||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
|
<argument>
|
||||||
|
<name>Brightness</name>
|
||||||
|
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -181,6 +182,7 @@
|
|||||||
</actionList>
|
</actionList>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<serviceStateTable>
|
<serviceStateTable>
|
||||||
|
|
||||||
<stateVariable sendEvents="yes">
|
<stateVariable sendEvents="yes">
|
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<root xmlns="urn:schemas-upnp-org:device-1-0">
|
|
||||||
<specVersion>
|
|
||||||
<major>1</major>
|
|
||||||
<minor>0</minor>
|
|
||||||
</specVersion>
|
|
||||||
<device>
|
|
||||||
<deviceType>urn:schemas-upnp-org:device:tvdevice:1</deviceType>
|
|
||||||
<friendlyName>UPnP Television Emulator</friendlyName>
|
|
||||||
<manufacturer>TV Manufacturer Name</manufacturer>
|
|
||||||
<manufacturerURL>http://www.manufacturer.com</manufacturerURL>
|
|
||||||
<modelDescription>UPnP Television Device Emulator 1.0</modelDescription>
|
|
||||||
<modelName>TVEmulator</modelName>
|
|
||||||
<modelNumber>1.0</modelNumber>
|
|
||||||
<modelURL>http://www.manufacturer.com/TVEmulator/</modelURL>
|
|
||||||
<serialNumber>123456789001</serialNumber>
|
|
||||||
<UDN>uuid:Upnp-TVEmulator-1_0-1234567890002</UDN>
|
|
||||||
<UPC>123456789</UPC>
|
|
||||||
<serviceList>
|
|
||||||
<service>
|
|
||||||
<serviceType>urn:schemas-upnp-org:service:tvcontrol:1</serviceType>
|
|
||||||
<serviceId>urn:upnp-org:serviceId:tvcontrol1</serviceId>
|
|
||||||
<controlURL>/upnp/control/tvcontrol1</controlURL>
|
|
||||||
<eventSubURL>/upnp/event/tvcontrol1</eventSubURL>
|
|
||||||
<SCPDURL>/tvcontrolSCPD.xml</SCPDURL>
|
|
||||||
</service>
|
|
||||||
<service>
|
|
||||||
<serviceType>urn:schemas-upnp-org:service:tvpicture:1</serviceType>
|
|
||||||
<serviceId>urn:upnp-org:serviceId:tvpicture1</serviceId>
|
|
||||||
<controlURL>/upnp/control/tvpicture1</controlURL>
|
|
||||||
<eventSubURL>/upnp/event/tvpicture1</eventSubURL>
|
|
||||||
<SCPDURL>/tvpictureSCPD.xml</SCPDURL>
|
|
||||||
</service>
|
|
||||||
</serviceList>
|
|
||||||
<presentationURL>/tvdevicepres.html</presentationURL>
|
|
||||||
</device>
|
|
||||||
</root>
|
|
File diff suppressed because it is too large
Load Diff
@@ -88,19 +88,18 @@ UpnpSetLogFileNames ( IN const char *ErrFileName,
|
|||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpInitLog
|
* Function : UpnpInitLog
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* Parameters: void
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This functions initializes the log files
|
* This functions initializes the log files
|
||||||
*
|
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* -1 : If fails
|
* -1 : If fails
|
||||||
* UPNP_E_SUCCESS : if success
|
* UPNP_E_SUCCESS : if success
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
UpnpInitLog()
|
UpnpInitLog( )
|
||||||
{
|
{
|
||||||
ithread_mutex_init( &GlobalDebugMutex, NULL );
|
ithread_mutex_init( &GlobalDebugMutex, NULL );
|
||||||
|
|
||||||
@@ -117,7 +116,7 @@ UpnpInitLog()
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpSetLogLevel
|
* Function : UpnpSetLogLevel
|
||||||
*
|
*
|
||||||
* Parameters: Upnp_LogLevel log_level
|
* Parameters: void
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||||
@@ -140,7 +139,7 @@ UpnpSetLogLevel (Upnp_LogLevel log_level)
|
|||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void
|
void
|
||||||
UpnpCloseLog()
|
UpnpCloseLog( )
|
||||||
{
|
{
|
||||||
if( DEBUG_TARGET == 1 ) {
|
if( DEBUG_TARGET == 1 ) {
|
||||||
fflush( ErrFileHnd );
|
fflush( ErrFileHnd );
|
||||||
@@ -153,47 +152,11 @@ UpnpCloseLog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* Function : DebugAtThisLevel
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
|
||||||
* whether debug statement will go to standard output,
|
|
||||||
* or any of the log files.
|
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This functions returns true if debug output should be done in this
|
|
||||||
* module.
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef DEBUG
|
|
||||||
int DebugAtThisLevel(
|
|
||||||
IN Upnp_LogLevel DLevel,
|
|
||||||
IN Dbg_Module Module)
|
|
||||||
{
|
|
||||||
int ret = DLevel <= g_log_level;
|
|
||||||
ret &=
|
|
||||||
DEBUG_ALL ||
|
|
||||||
(Module == SSDP && DEBUG_SSDP ) ||
|
|
||||||
(Module == SOAP && DEBUG_SOAP ) ||
|
|
||||||
(Module == GENA && DEBUG_GENA ) ||
|
|
||||||
(Module == TPOOL && DEBUG_TPOOL) ||
|
|
||||||
(Module == MSERV && DEBUG_MSERV) ||
|
|
||||||
(Module == DOM && DEBUG_DOM ) ||
|
|
||||||
(Module == HTTP && DEBUG_HTTP );
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpPrintf
|
* Function : UpnpPrintf
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
* IN Dbg_Level DLevel: The level of the debug logging. It will decide
|
||||||
* whether debug statement will go to standard output,
|
* whether debug statement will go to standard output,
|
||||||
* or any of the log files.
|
* or any of the log files.
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
@@ -210,53 +173,71 @@ int DebugAtThisLevel(
|
|||||||
* statement is coming
|
* statement is coming
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void UpnpPrintf( IN Upnp_LogLevel DLevel,
|
||||||
void UpnpPrintf(
|
IN Dbg_Module Module,
|
||||||
IN Upnp_LogLevel DLevel,
|
IN const char *DbgFileName,
|
||||||
IN Dbg_Module Module,
|
IN int DbgLineNo,
|
||||||
IN const char *DbgFileName,
|
IN const char *FmtStr,
|
||||||
IN int DbgLineNo,
|
... ) {
|
||||||
IN const char *FmtStr,
|
|
||||||
... )
|
va_list ArgList;
|
||||||
{
|
va_start( ArgList, FmtStr );
|
||||||
va_list ArgList;
|
if( g_log_level < DLevel ) return; if( DEBUG_ALL == 0 ) {
|
||||||
|
switch ( Module ) {
|
||||||
if (!DebugAtThisLevel(DLevel, Module)) {
|
case SSDP:
|
||||||
return;
|
if( DEBUG_SSDP == 1 ) break;
|
||||||
}
|
else
|
||||||
|
return; case SOAP:
|
||||||
ithread_mutex_lock(&GlobalDebugMutex);
|
if( DEBUG_SOAP == 1 ) break;
|
||||||
va_start(ArgList, FmtStr);
|
else
|
||||||
if (!DEBUG_TARGET) {
|
return; case GENA:
|
||||||
if( DbgFileName ) {
|
if( DEBUG_GENA == 1 ) break;
|
||||||
UpnpDisplayFileAndLine(stdout, DbgFileName, DbgLineNo);
|
else
|
||||||
}
|
return; case TPOOL:
|
||||||
vfprintf(stdout, FmtStr, ArgList);
|
if( DEBUG_TPOOL == 1 ) break;
|
||||||
fflush(stdout);
|
else
|
||||||
} else if (DLevel == 0) {
|
return; case MSERV:
|
||||||
if (DbgFileName) {
|
if( DEBUG_MSERV == 1 ) break;
|
||||||
UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, DbgLineNo);
|
else
|
||||||
}
|
return; case DOM:
|
||||||
vfprintf(ErrFileHnd, FmtStr, ArgList);
|
if( DEBUG_DOM == 1 ) break;
|
||||||
fflush(ErrFileHnd);
|
else
|
||||||
} else {
|
return; case HTTP:
|
||||||
if (DbgFileName) {
|
if( DEBUG_HTTP == 1 ) break;
|
||||||
UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, DbgLineNo);
|
else
|
||||||
}
|
return; case API:
|
||||||
vfprintf(InfoFileHnd, FmtStr, ArgList);
|
if( DEBUG_API == 1 ) break;
|
||||||
fflush(InfoFileHnd);
|
else
|
||||||
}
|
return; default:
|
||||||
va_end(ArgList);
|
return;}
|
||||||
ithread_mutex_unlock(&GlobalDebugMutex);
|
}
|
||||||
}
|
|
||||||
#endif
|
ithread_mutex_lock( &GlobalDebugMutex ); if( DEBUG_TARGET == 0 ) {
|
||||||
|
if( DbgFileName ) {
|
||||||
|
UpnpDisplayFileAndLine( stdout, DbgFileName, DbgLineNo );}
|
||||||
|
vfprintf( stdout, FmtStr, ArgList ); fflush( stdout );}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( DLevel == 0 ) {
|
||||||
|
if( DbgFileName ) {
|
||||||
|
UpnpDisplayFileAndLine( ErrFileHnd, DbgFileName, DbgLineNo );}
|
||||||
|
vfprintf( ErrFileHnd, FmtStr, ArgList ); fflush( ErrFileHnd );}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( DbgFileName ) {
|
||||||
|
UpnpDisplayFileAndLine( InfoFileHnd, DbgFileName, DbgLineNo );}
|
||||||
|
vfprintf( InfoFileHnd, FmtStr, ArgList ); fflush( InfoFileHnd );}
|
||||||
|
}
|
||||||
|
va_end( ArgList ); ithread_mutex_unlock( &GlobalDebugMutex );}
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpGetDebugFile
|
* Function : UpnpGetDebugFile
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
* IN Dbg_Level DLevel: The level of the debug logging. It will decide
|
||||||
* whether debug statement will go to standard output,
|
* whether debug statement will go to standard output,
|
||||||
* or any of the log files.
|
* or any of the log files.
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
@@ -268,26 +249,46 @@ void UpnpPrintf(
|
|||||||
* NULL : if the module is turn off for debug
|
* NULL : if the module is turn off for debug
|
||||||
* else returns the right file descriptor
|
* else returns the right file descriptor
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( FILE * GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module ) {
|
||||||
FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
if( g_log_level < DLevel ) return NULL; if( DEBUG_ALL == 0 ) {
|
||||||
{
|
switch ( Module ) {
|
||||||
FILE *ret;
|
case SSDP:
|
||||||
|
if( DEBUG_SSDP == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; case SOAP:
|
||||||
|
if( DEBUG_SOAP == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; case GENA:
|
||||||
|
if( DEBUG_GENA == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; case TPOOL:
|
||||||
|
if( DEBUG_TPOOL == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; case MSERV:
|
||||||
|
if( DEBUG_MSERV == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; case DOM:
|
||||||
|
if( DEBUG_DOM == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; case API:
|
||||||
|
if( DEBUG_API == 1 ) break;
|
||||||
|
else
|
||||||
|
return NULL; default:
|
||||||
|
return NULL;}
|
||||||
|
}
|
||||||
|
|
||||||
if (!DebugAtThisLevel(DLevel, Module)) {
|
if( DEBUG_TARGET == 0 ) {
|
||||||
ret = NULL;
|
return stdout;}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
if (!DEBUG_TARGET) {
|
if( DLevel == 0 ) {
|
||||||
ret = stdout;
|
return ErrFileHnd;}
|
||||||
} else if (DLevel == 0) {
|
else
|
||||||
ret = ErrFileHnd;
|
{
|
||||||
} else {
|
return InfoFileHnd;}
|
||||||
ret = InfoFileHnd;
|
}
|
||||||
}
|
}
|
||||||
|
)
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -304,26 +305,17 @@ FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
|||||||
* debug statement is coming to the log file
|
* debug statement is coming to the log file
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void UpnpDisplayFileAndLine( IN FILE * fd,
|
||||||
void UpnpDisplayFileAndLine(
|
IN const char *DbgFileName,
|
||||||
IN FILE * fd,
|
IN int DbgLineNo ) {
|
||||||
IN const char *DbgFileName,
|
int starlength = 66;
|
||||||
IN int DbgLineNo)
|
const char *lines[2];
|
||||||
{
|
char FileAndLine[500]; lines[0] = "DEBUG"; if( DbgFileName ) {
|
||||||
int starlength = 66;
|
sprintf( FileAndLine, "FILE: %s, LINE: %d", DbgFileName,
|
||||||
const char *lines[2];
|
DbgLineNo ); lines[1] = FileAndLine;}
|
||||||
char FileAndLine[500];
|
|
||||||
lines[0] = "DEBUG";
|
UpnpDisplayBanner( fd, lines, 2, starlength ); fflush( fd );}
|
||||||
if (DbgFileName) {
|
)
|
||||||
sprintf(FileAndLine,
|
|
||||||
"FILE: %s, LINE: %d",
|
|
||||||
DbgFileName, DbgLineNo);
|
|
||||||
lines[1] = FileAndLine;
|
|
||||||
}
|
|
||||||
UpnpDisplayBanner(fd, lines, 2, starlength);
|
|
||||||
fflush(fd);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -340,58 +332,47 @@ void UpnpDisplayFileAndLine(
|
|||||||
* per the requested banner
|
* per the requested banner
|
||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void UpnpDisplayBanner( IN FILE * fd,
|
||||||
void UpnpDisplayBanner(
|
IN const char **lines,
|
||||||
IN FILE * fd,
|
IN size_t size,
|
||||||
IN const char **lines,
|
IN int starLength ) {
|
||||||
IN size_t size,
|
char *stars = ( char * )malloc( starLength + 1 );
|
||||||
IN int starLength)
|
const char *line = NULL;
|
||||||
{
|
int leftMarginLength = starLength / 2 + 1;
|
||||||
int leftMarginLength = starLength / 2 + 1;
|
int rightMarginLength = starLength / 2 + 1;
|
||||||
int rightMarginLength = starLength / 2 + 1;
|
char *leftMargin = ( char * )malloc( leftMarginLength );
|
||||||
int i = 0;
|
char *rightMargin = ( char * )malloc( rightMarginLength );
|
||||||
int LineSize = 0;
|
int i = 0;
|
||||||
int starLengthMinus2 = starLength - 2;
|
int LineSize = 0;
|
||||||
|
char *currentLine = ( char * )malloc( starLength + 1 );
|
||||||
|
memset( stars, '*', starLength );
|
||||||
|
stars[starLength] = 0;
|
||||||
|
memset( leftMargin, 0, leftMarginLength );
|
||||||
|
memset( rightMargin, 0, rightMarginLength );
|
||||||
|
fprintf( fd, "\n%s\n", stars ); for( i = 0; i < size; i++ ) {
|
||||||
|
LineSize = strlen( lines[i] );
|
||||||
|
line = lines[i]; while( LineSize > ( starLength - 2 ) ) {
|
||||||
|
memcpy( currentLine, line, ( starLength - 2 ) );
|
||||||
|
currentLine[( starLength - 2 )] = 0;
|
||||||
|
fprintf( fd, "*%s*\n", currentLine );
|
||||||
|
LineSize -= ( starLength - 2 ); line += ( starLength - 2 );}
|
||||||
|
|
||||||
char *leftMargin = ( char * )malloc( leftMarginLength );
|
if( LineSize % 2 == 0 ) {
|
||||||
char *rightMargin = ( char * )malloc( rightMarginLength );
|
leftMarginLength = rightMarginLength =
|
||||||
char *stars = ( char * )malloc( starLength + 1 );
|
( ( starLength - 2 ) - LineSize ) / 2;}
|
||||||
char *currentLine = ( char * )malloc( starLength + 1 );
|
else
|
||||||
const char *line = NULL;
|
{
|
||||||
|
leftMarginLength = ( ( starLength - 2 ) - LineSize ) / 2;
|
||||||
|
rightMarginLength =
|
||||||
|
( ( starLength - 2 ) - LineSize ) / 2 + 1;}
|
||||||
|
|
||||||
memset( stars, '*', starLength );
|
memset( leftMargin, ' ', leftMarginLength );
|
||||||
stars[starLength] = 0;
|
memset( rightMargin, ' ', rightMarginLength );
|
||||||
memset( leftMargin, 0, leftMarginLength );
|
leftMargin[leftMarginLength] = 0;
|
||||||
memset( rightMargin, 0, rightMarginLength );
|
rightMargin[rightMarginLength] = 0;
|
||||||
fprintf( fd, "\n%s\n", stars );
|
fprintf( fd, "*%s%s%s*\n", leftMargin, line, rightMargin );}
|
||||||
for( i = 0; i < size; i++ ) {
|
|
||||||
LineSize = strlen( lines[i] );
|
|
||||||
line = lines[i];
|
|
||||||
while( LineSize > starLengthMinus2 ) {
|
|
||||||
memcpy( currentLine, line, starLengthMinus2 );
|
|
||||||
currentLine[starLengthMinus2] = 0;
|
|
||||||
fprintf( fd, "*%s*\n", currentLine );
|
|
||||||
LineSize -= starLengthMinus2;
|
|
||||||
line += starLengthMinus2;
|
|
||||||
}
|
|
||||||
leftMarginLength = (starLengthMinus2 - LineSize)/2;
|
|
||||||
if( LineSize % 2 == 0 ) {
|
|
||||||
rightMarginLength = leftMarginLength;
|
|
||||||
} else {
|
|
||||||
rightMarginLength = leftMarginLength + 1;
|
|
||||||
}
|
|
||||||
memset( leftMargin, ' ', leftMarginLength );
|
|
||||||
memset( rightMargin, ' ', rightMarginLength );
|
|
||||||
leftMargin[leftMarginLength] = 0;
|
|
||||||
rightMargin[rightMarginLength] = 0;
|
|
||||||
fprintf( fd, "*%s%s%s*\n", leftMargin, line, rightMargin );
|
|
||||||
}
|
|
||||||
fprintf( fd, "%s\n\n", stars );
|
|
||||||
|
|
||||||
free( currentLine );
|
fprintf( fd, "%s\n\n", stars );
|
||||||
free( stars );
|
free( leftMargin );
|
||||||
free( rightMargin );
|
free( rightMargin ); free( stars ); free( currentLine );}
|
||||||
free( leftMargin );
|
)
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@@ -256,8 +256,8 @@ makeAction( IN int response,
|
|||||||
IN const char *Arg,
|
IN const char *Arg,
|
||||||
IN va_list ArgList )
|
IN va_list ArgList )
|
||||||
{
|
{
|
||||||
const char *ArgName;
|
const char *ArgName,
|
||||||
const char *ArgValue;
|
*ArgValue;
|
||||||
char *ActBuff;
|
char *ActBuff;
|
||||||
int Idx = 0;
|
int Idx = 0;
|
||||||
IXML_Document *ActionDoc;
|
IXML_Document *ActionDoc;
|
||||||
@@ -298,7 +298,7 @@ makeAction( IN int response,
|
|||||||
if( NumArg > 0 ) {
|
if( NumArg > 0 ) {
|
||||||
//va_start(ArgList, Arg);
|
//va_start(ArgList, Arg);
|
||||||
ArgName = Arg;
|
ArgName = Arg;
|
||||||
for ( ; ; ) {
|
while( Idx++ != NumArg ) {
|
||||||
ArgValue = va_arg( ArgList, const char * );
|
ArgValue = va_arg( ArgList, const char * );
|
||||||
|
|
||||||
if( ArgName != NULL ) {
|
if( ArgName != NULL ) {
|
||||||
@@ -313,11 +313,7 @@ makeAction( IN int response,
|
|||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++Idx < NumArg) {
|
ArgName = va_arg( ArgList, const char * );
|
||||||
ArgName = va_arg( ArgList, const char * );
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//va_end(ArgList);
|
//va_end(ArgList);
|
||||||
}
|
}
|
||||||
|
@@ -93,35 +93,37 @@ genaCallback( IN http_parser_t * parser,
|
|||||||
xboolean found_function = FALSE;
|
xboolean found_function = FALSE;
|
||||||
|
|
||||||
if( request->method == HTTPMETHOD_SUBSCRIBE ) {
|
if( request->method == HTTPMETHOD_SUBSCRIBE ) {
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY( found_function = TRUE;
|
||||||
found_function = TRUE;
|
if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL )
|
||||||
if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL ) {
|
{
|
||||||
// renew subscription
|
// renew subscription
|
||||||
gena_process_subscription_renewal_request
|
gena_process_subscription_renewal_request
|
||||||
( info, request );
|
( info, request );}
|
||||||
} else {
|
else
|
||||||
// subscribe
|
{
|
||||||
gena_process_subscription_request( info, request );
|
// subscribe
|
||||||
}
|
gena_process_subscription_request( info, request );}
|
||||||
UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
|
||||||
"got subscription request\n" );
|
|
||||||
} else if( request->method == HTTPMETHOD_UNSUBSCRIBE ) {
|
|
||||||
found_function = TRUE;
|
|
||||||
// unsubscribe
|
|
||||||
gena_process_unsubscribe_request( info, request );
|
|
||||||
#endif
|
|
||||||
} else if( request->method == HTTPMETHOD_NOTIFY ) {
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
|
||||||
found_function = TRUE;
|
|
||||||
// notify
|
|
||||||
gena_process_notification_event( info, request );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !found_function ) {
|
DBGONLY( UpnpPrintf
|
||||||
|
( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||||
|
"got subscription request\n" ); )
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if( request->method == HTTPMETHOD_UNSUBSCRIBE ) {
|
||||||
|
DEVICEONLY( found_function = TRUE;
|
||||||
|
// unsubscribe
|
||||||
|
gena_process_unsubscribe_request( info,
|
||||||
|
request ); )
|
||||||
|
} else if( request->method == HTTPMETHOD_NOTIFY ) {
|
||||||
|
CLIENTONLY( found_function = TRUE;
|
||||||
|
// notify
|
||||||
|
gena_process_notification_event( info, request ); )
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !found_function ) {
|
||||||
// handle missing functions of device or ctrl pt
|
// handle missing functions of device or ctrl pt
|
||||||
error_respond( info, HTTP_NOT_IMPLEMENTED, request );
|
error_respond( info, HTTP_NOT_IMPLEMENTED, request );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // EXCLUDE_GENA
|
#endif // EXCLUDE_GENA
|
||||||
|
|
||||||
|
@@ -72,14 +72,14 @@ GenaAutoRenewSubscription( IN void *input )
|
|||||||
int eventType = 0;
|
int eventType = 0;
|
||||||
|
|
||||||
if( AUTO_RENEW_TIME == 0 ) {
|
if( AUTO_RENEW_TIME == 0 ) {
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA SUB EXPIRED" );
|
"GENA SUB EXPIRED" ) );
|
||||||
sub_struct->ErrCode = UPNP_E_SUCCESS;
|
sub_struct->ErrCode = UPNP_E_SUCCESS;
|
||||||
send_callback = 1;
|
send_callback = 1;
|
||||||
eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED;
|
eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED;
|
||||||
} else {
|
} else {
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA AUTO RENEW" );
|
"GENA AUTO RENEW" ) );
|
||||||
if( ( ( sub_struct->ErrCode = genaRenewSubscription( event->handle,
|
if( ( ( sub_struct->ErrCode = genaRenewSubscription( event->handle,
|
||||||
sub_struct->
|
sub_struct->
|
||||||
Sid,
|
Sid,
|
||||||
@@ -93,17 +93,17 @@ GenaAutoRenewSubscription( IN void *input )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( send_callback ) {
|
if( send_callback ) {
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( GetHandleInfo( event->handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( event->handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
free_upnp_timeout( event );
|
free_upnp_timeout( event );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"HANDLE IS VALID" );
|
"HANDLE IS VALID" ) );
|
||||||
callback_fun = handle_info->Callback;
|
callback_fun = handle_info->Callback;
|
||||||
cookie = handle_info->Cookie;
|
cookie = handle_info->Cookie;
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
//make callback
|
//make callback
|
||||||
|
|
||||||
callback_fun( eventType, event->Event, cookie );
|
callback_fun( eventType, event->Event, cookie );
|
||||||
@@ -397,9 +397,9 @@ genaUnregisterClient( IN UpnpClient_Handle client_handle )
|
|||||||
http_parser_t response;
|
http_parser_t response;
|
||||||
|
|
||||||
while( TRUE ) {
|
while( TRUE ) {
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +417,7 @@ genaUnregisterClient( IN UpnpClient_Handle client_handle )
|
|||||||
RemoveClientSubClientSID( &handle_info->ClientSubList,
|
RemoveClientSubClientSID( &handle_info->ClientSubList,
|
||||||
sub_copy.sid );
|
sub_copy.sid );
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return_code = gena_unsubscribe( sub_copy.EventURL,
|
return_code = gena_unsubscribe( sub_copy.EventURL,
|
||||||
sub_copy.ActualSID, &response );
|
sub_copy.ActualSID, &response );
|
||||||
@@ -429,7 +429,7 @@ genaUnregisterClient( IN UpnpClient_Handle client_handle )
|
|||||||
}
|
}
|
||||||
|
|
||||||
freeClientSubList( handle_info->ClientSubList );
|
freeClientSubList( handle_info->ClientSubList );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +449,6 @@ genaUnregisterClient( IN UpnpClient_Handle client_handle )
|
|||||||
* return UPNP_E_SUCCESS if service response is OK else
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
* returns appropriate error
|
* returns appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
|
||||||
int
|
int
|
||||||
genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
||||||
IN const Upnp_SID in_sid )
|
IN const Upnp_SID in_sid )
|
||||||
@@ -460,25 +459,25 @@ genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
|||||||
client_subscription sub_copy;
|
client_subscription sub_copy;
|
||||||
http_parser_t response;
|
http_parser_t response;
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
// validate handle and sid
|
// validate handle and sid
|
||||||
|
|
||||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( sub =
|
if( ( sub =
|
||||||
GetClientSubClientSID( handle_info->ClientSubList, in_sid ) )
|
GetClientSubClientSID( handle_info->ClientSubList, in_sid ) )
|
||||||
== NULL ) {
|
== NULL ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SID;
|
return GENA_E_BAD_SID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_code = copy_client_subscription( sub, &sub_copy );
|
return_code = copy_client_subscription( sub, &sub_copy );
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return_code = gena_unsubscribe( sub_copy.EventURL, sub_copy.ActualSID,
|
return_code = gena_unsubscribe( sub_copy.EventURL, sub_copy.ActualSID,
|
||||||
&response );
|
&response );
|
||||||
@@ -489,20 +488,19 @@ genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
|||||||
|
|
||||||
free_client_subscription( &sub_copy );
|
free_client_subscription( &sub_copy );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveClientSubClientSID( &handle_info->ClientSubList, in_sid );
|
RemoveClientSubClientSID( &handle_info->ClientSubList, in_sid );
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : genaSubscribe
|
* Function : genaSubscribe
|
||||||
@@ -526,7 +524,6 @@ genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
|||||||
* return UPNP_E_SUCCESS if service response is OK else
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
* returns appropriate error
|
* returns appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
|
||||||
int
|
int
|
||||||
genaSubscribe( IN UpnpClient_Handle client_handle,
|
genaSubscribe( IN UpnpClient_Handle client_handle,
|
||||||
IN char *PublisherURL,
|
IN char *PublisherURL,
|
||||||
@@ -541,28 +538,28 @@ genaSubscribe( IN UpnpClient_Handle client_handle,
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
char *EventURL = NULL;
|
char *EventURL = NULL;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA SUBSCRIBE BEGIN" );
|
"GENA SUBSCRIBE BEGIN" ) );
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
memset( out_sid, 0, sizeof( Upnp_SID ) );
|
memset( out_sid, 0, sizeof( Upnp_SID ) );
|
||||||
|
|
||||||
// validate handle
|
// validate handle
|
||||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
// subscribe
|
// subscribe
|
||||||
SubscribeLock();
|
SubscribeLock( );
|
||||||
return_code =
|
return_code =
|
||||||
gena_subscribe( PublisherURL, TimeOut, NULL, &ActualSID );
|
gena_subscribe( PublisherURL, TimeOut, NULL, &ActualSID );
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( return_code != UPNP_E_SUCCESS ) {
|
if( return_code != UPNP_E_SUCCESS ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL, GENA, __FILE__, __LINE__,
|
||||||
"SUBSCRIBE FAILED in transfer error code: %d returned\n",
|
"SUBSCRIBE FAILED in transfer error code: %d returned\n",
|
||||||
return_code );
|
return_code ) );
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,11 +605,10 @@ genaSubscribe( IN UpnpClient_Handle client_handle,
|
|||||||
free( EventURL );
|
free( EventURL );
|
||||||
free( newSubscription );
|
free( newSubscription );
|
||||||
}
|
}
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
SubscribeUnlock();
|
SubscribeUnlock( );
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : genaRenewSubscription
|
* Function : genaRenewSubscription
|
||||||
@@ -647,17 +643,17 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
|||||||
char *ActualSID;
|
char *ActualSID;
|
||||||
ThreadPoolJob tempJob;
|
ThreadPoolJob tempJob;
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
// validate handle and sid
|
// validate handle and sid
|
||||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( sub = GetClientSubClientSID( handle_info->ClientSubList,
|
if( ( sub = GetClientSubClientSID( handle_info->ClientSubList,
|
||||||
in_sid ) ) == NULL ) {
|
in_sid ) ) == NULL ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SID;
|
return GENA_E_BAD_SID;
|
||||||
}
|
}
|
||||||
// remove old events
|
// remove old events
|
||||||
@@ -667,13 +663,13 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
|||||||
free_upnp_timeout( ( upnp_timeout * ) tempJob.arg );
|
free_upnp_timeout( ( upnp_timeout * ) tempJob.arg );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"REMOVED AUTO RENEW EVENT" );
|
"REMOVED AUTO RENEW EVENT" ) );
|
||||||
|
|
||||||
sub->RenewEventId = -1;
|
sub->RenewEventId = -1;
|
||||||
return_code = copy_client_subscription( sub, &sub_copy );
|
return_code = copy_client_subscription( sub, &sub_copy );
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
if( return_code != HTTP_SUCCESS ) {
|
if( return_code != HTTP_SUCCESS ) {
|
||||||
return return_code;
|
return return_code;
|
||||||
@@ -681,10 +677,10 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
|||||||
|
|
||||||
return_code = gena_subscribe( sub_copy.EventURL, TimeOut,
|
return_code = gena_subscribe( sub_copy.EventURL, TimeOut,
|
||||||
sub_copy.ActualSID, &ActualSID );
|
sub_copy.ActualSID, &ActualSID );
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
if( return_code == UPNP_E_SUCCESS ) {
|
if( return_code == UPNP_E_SUCCESS ) {
|
||||||
free( ActualSID );
|
free( ActualSID );
|
||||||
}
|
}
|
||||||
@@ -697,7 +693,7 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
|||||||
// network failure (remove client sub)
|
// network failure (remove client sub)
|
||||||
RemoveClientSubClientSID( &handle_info->ClientSubList, in_sid );
|
RemoveClientSubClientSID( &handle_info->ClientSubList, in_sid );
|
||||||
free_client_subscription( &sub_copy );
|
free_client_subscription( &sub_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
// get subscription
|
// get subscription
|
||||||
@@ -705,7 +701,7 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
|||||||
in_sid ) ) == NULL ) {
|
in_sid ) ) == NULL ) {
|
||||||
free( ActualSID );
|
free( ActualSID );
|
||||||
free_client_subscription( &sub_copy );
|
free_client_subscription( &sub_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SID;
|
return GENA_E_BAD_SID;
|
||||||
}
|
}
|
||||||
// store actual sid
|
// store actual sid
|
||||||
@@ -718,7 +714,7 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
|||||||
RemoveClientSubClientSID( &handle_info->ClientSubList, sub->sid );
|
RemoveClientSubClientSID( &handle_info->ClientSubList, sub->sid );
|
||||||
}
|
}
|
||||||
free_client_subscription( &sub_copy );
|
free_client_subscription( &sub_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -799,12 +795,12 @@ gena_process_notification_event( IN SOCKINFO * info,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
// get client info
|
// get client info
|
||||||
if( GetClientHandleInfo( &client_handle, &handle_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &client_handle, &handle_info ) != HND_CLIENT ) {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
ixmlDocument_free( ChangedVars );
|
ixmlDocument_free( ChangedVars );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -817,20 +813,20 @@ gena_process_notification_event( IN SOCKINFO * info,
|
|||||||
// (if we are in the middle)
|
// (if we are in the middle)
|
||||||
// this is to avoid mistakenly rejecting the first event if we
|
// this is to avoid mistakenly rejecting the first event if we
|
||||||
// receive it before the subscription response
|
// receive it before the subscription response
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
// try and get Subscription Lock
|
// try and get Subscription Lock
|
||||||
// (in case we are in the process of subscribing)
|
// (in case we are in the process of subscribing)
|
||||||
SubscribeLock();
|
SubscribeLock( );
|
||||||
|
|
||||||
// get HandleLock again
|
// get HandleLock again
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetClientHandleInfo( &client_handle, &handle_info )
|
if( GetClientHandleInfo( &client_handle, &handle_info )
|
||||||
!= HND_CLIENT ) {
|
!= HND_CLIENT ) {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
||||||
SubscribeUnlock();
|
SubscribeUnlock( );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
ixmlDocument_free( ChangedVars );
|
ixmlDocument_free( ChangedVars );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -840,17 +836,17 @@ gena_process_notification_event( IN SOCKINFO * info,
|
|||||||
GetClientSubActualSID( handle_info->ClientSubList,
|
GetClientSubActualSID( handle_info->ClientSubList,
|
||||||
&sid ) ) == NULL ) {
|
&sid ) ) == NULL ) {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
||||||
SubscribeUnlock();
|
SubscribeUnlock( );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
ixmlDocument_free( ChangedVars );
|
ixmlDocument_free( ChangedVars );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubscribeUnlock();
|
SubscribeUnlock( );
|
||||||
} else {
|
} else {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
error_respond( info, HTTP_PRECONDITION_FAILED, event );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
ixmlDocument_free( ChangedVars );
|
ixmlDocument_free( ChangedVars );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -868,7 +864,7 @@ gena_process_notification_event( IN SOCKINFO * info,
|
|||||||
callback = handle_info->Callback;
|
callback = handle_info->Callback;
|
||||||
cookie = handle_info->Cookie;
|
cookie = handle_info->Cookie;
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
// make callback with event struct
|
// make callback with event struct
|
||||||
// In future, should find a way of mainting
|
// In future, should find a way of mainting
|
||||||
|
@@ -62,19 +62,19 @@ genaUnregisterDevice( IN UpnpDevice_Handle device_handle )
|
|||||||
{
|
{
|
||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
|
|
||||||
UpnpPrintf( UPNP_CRITICAL, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL, GENA, __FILE__, __LINE__,
|
||||||
"genaUnregisterDevice : BAD Handle : %d\n",
|
"genaUnregisterDevice : BAD Handle : %d\n",
|
||||||
device_handle );
|
device_handle ) );
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
freeServiceTable( &handle_info->ServiceTable );
|
freeServiceTable( &handle_info->ServiceTable );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -188,7 +188,7 @@ free_notify_struct( IN notify_thread_struct * input )
|
|||||||
*
|
*
|
||||||
* Note : called by genaNotify
|
* Note : called by genaNotify
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
notify_send_and_recv( IN uri_type * destination_url,
|
notify_send_and_recv( IN uri_type * destination_url,
|
||||||
IN membuffer * mid_msg,
|
IN membuffer * mid_msg,
|
||||||
IN char *propertySet,
|
IN char *propertySet,
|
||||||
@@ -203,12 +203,12 @@ notify_send_and_recv( IN uri_type * destination_url,
|
|||||||
SOCKINFO info;
|
SOCKINFO info;
|
||||||
|
|
||||||
// connect
|
// connect
|
||||||
UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||||
"gena notify to: %.*s\n",
|
"gena notify to: %.*s\n",
|
||||||
(int)destination_url->hostport.text.size,
|
destination_url->hostport.text.size,
|
||||||
destination_url->hostport.text.buff );
|
destination_url->hostport.text.buff ); )
|
||||||
|
|
||||||
conn_fd = http_Connect( destination_url, &url );
|
conn_fd = http_Connect( destination_url, &url );
|
||||||
if( conn_fd < 0 ) {
|
if( conn_fd < 0 ) {
|
||||||
return conn_fd; // return UPNP error
|
return conn_fd; // return UPNP error
|
||||||
}
|
}
|
||||||
@@ -365,12 +365,12 @@ genaNotifyThread( IN void *input )
|
|||||||
struct Handle_Info *handle_info;
|
struct Handle_Info *handle_info;
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
//validate context
|
//validate context
|
||||||
|
|
||||||
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
free_notify_struct( in );
|
free_notify_struct( in );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ genaNotifyThread( IN void *input )
|
|||||||
|| ( ( sub = GetSubscriptionSID( in->sid, service ) ) == NULL )
|
|| ( ( sub = GetSubscriptionSID( in->sid, service ) ) == NULL )
|
||||||
|| ( ( copy_subscription( sub, &sub_copy ) != HTTP_SUCCESS ) ) ) {
|
|| ( ( copy_subscription( sub, &sub_copy ) != HTTP_SUCCESS ) ) ) {
|
||||||
free_notify_struct( in );
|
free_notify_struct( in );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//If the event is out of order push it back to the job queue
|
//If the event is out of order push it back to the job queue
|
||||||
@@ -392,22 +392,22 @@ genaNotifyThread( IN void *input )
|
|||||||
ThreadPoolAdd( &gSendThreadPool, &job, NULL );
|
ThreadPoolAdd( &gSendThreadPool, &job, NULL );
|
||||||
|
|
||||||
freeSubscription( &sub_copy );
|
freeSubscription( &sub_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
//send the notify
|
//send the notify
|
||||||
return_code = genaNotify( in->headers, in->propertySet, &sub_copy );
|
return_code = genaNotify( in->headers, in->propertySet, &sub_copy );
|
||||||
|
|
||||||
freeSubscription( &sub_copy );
|
freeSubscription( &sub_copy );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
free_notify_struct( in );
|
free_notify_struct( in );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//validate context
|
//validate context
|
||||||
@@ -416,7 +416,7 @@ genaNotifyThread( IN void *input )
|
|||||||
|| ( !service->active )
|
|| ( !service->active )
|
||||||
|| ( ( sub = GetSubscriptionSID( in->sid, service ) ) == NULL ) ) {
|
|| ( ( sub = GetSubscriptionSID( in->sid, service ) ) == NULL ) ) {
|
||||||
free_notify_struct( in );
|
free_notify_struct( in );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ genaNotifyThread( IN void *input )
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_notify_struct( in );
|
free_notify_struct( in );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -477,8 +477,8 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
|
|
||||||
notify_thread_struct *thread_struct = NULL;
|
notify_thread_struct *thread_struct = NULL;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA BEGIN INITIAL NOTIFY " );
|
"GENA BEGIN INITIAL NOTIFY " ) );
|
||||||
|
|
||||||
reference_count = ( int * )malloc( sizeof( int ) );
|
reference_count = ( int * )malloc( sizeof( int ) );
|
||||||
|
|
||||||
@@ -504,13 +504,13 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
strcpy( UDN_copy, UDN );
|
strcpy( UDN_copy, UDN );
|
||||||
strcpy( servId_copy, servId );
|
strcpy( servId_copy, servId );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,25 +519,26 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SERVICE;
|
return GENA_E_BAD_SERVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"FOUND SERVICE IN INIT NOTFY: UDN %s, ServID: %s ",
|
"FOUND SERVICE IN INIT NOTFY: UDN %s, ServID: %s ",
|
||||||
UDN, servId );
|
UDN, servId ) );
|
||||||
|
|
||||||
if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ||
|
if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ||
|
||||||
( sub->active ) ) {
|
( sub->active ) ) {
|
||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SID;
|
return GENA_E_BAD_SID;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s ", sid );
|
"FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s ",
|
||||||
|
sid ) );
|
||||||
|
|
||||||
sub->active = 1;
|
sub->active = 1;
|
||||||
|
|
||||||
@@ -548,13 +549,13 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENERATED PROPERY SET IN INIT NOTIFY: \n'%s'\n",
|
"GENERATED PROPERY SET IN INIT NOTIFY: \n'%s'\n",
|
||||||
propertySet );
|
propertySet ) );
|
||||||
|
|
||||||
headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) +
|
headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) +
|
||||||
strlen( "CONTENT-LENGTH: \r\n" ) + MAX_CONTENT_LENGTH +
|
strlen( "CONTENT-LENGTH: \r\n" ) + MAX_CONTENT_LENGTH +
|
||||||
@@ -568,12 +569,12 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( headers, "CONTENT-TYPE: text/xml\r\nCONTENT-LENGTH: "
|
sprintf( headers, "CONTENT-TYPE: text/xml\r\nCONTENT-LENGTH: "
|
||||||
"%"PRIzu"\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n",
|
"%zd\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n",
|
||||||
strlen( propertySet ) + 1 );
|
strlen( propertySet ) + 1 );
|
||||||
|
|
||||||
//schedule thread for initial notification
|
//schedule thread for initial notification
|
||||||
@@ -620,7 +621,7 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
free( headers );
|
free( headers );
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
@@ -667,8 +668,8 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
|||||||
|
|
||||||
notify_thread_struct *thread_struct = NULL;
|
notify_thread_struct *thread_struct = NULL;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENA BEGIN INITIAL NOTIFY EXT" );
|
"GENA BEGIN INITIAL NOTIFY EXT" ) );
|
||||||
reference_count = ( int * )malloc( sizeof( int ) );
|
reference_count = ( int * )malloc( sizeof( int ) );
|
||||||
|
|
||||||
if( reference_count == NULL ) {
|
if( reference_count == NULL ) {
|
||||||
@@ -693,13 +694,13 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
|||||||
strcpy( UDN_copy, UDN );
|
strcpy( UDN_copy, UDN );
|
||||||
strcpy( servId_copy, servId );
|
strcpy( servId_copy, servId );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_HANDLE;
|
return GENA_E_BAD_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,23 +709,24 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
|||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SERVICE;
|
return GENA_E_BAD_SERVICE;
|
||||||
}
|
}
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"FOUND SERVICE IN INIT NOTFY EXT: UDN %s, ServID: %s\n",
|
"FOUND SERVICE IN INIT NOTFY EXT: UDN %s, ServID: %s\n",
|
||||||
UDN, servId );
|
UDN, servId ) );
|
||||||
|
|
||||||
if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ||
|
if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ||
|
||||||
( sub->active ) ) {
|
( sub->active ) ) {
|
||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return GENA_E_BAD_SID;
|
return GENA_E_BAD_SID;
|
||||||
}
|
}
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s", sid );
|
"FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s",
|
||||||
|
sid ) );
|
||||||
|
|
||||||
sub->active = 1;
|
sub->active = 1;
|
||||||
|
|
||||||
@@ -733,13 +735,13 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
|||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return UPNP_E_INVALID_PARAM;
|
return UPNP_E_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"GENERATED PROPERY SET IN INIT EXT NOTIFY: %s",
|
"GENERATED PROPERY SET IN INIT EXT NOTIFY: %s",
|
||||||
propertySet );
|
propertySet ) );
|
||||||
|
|
||||||
headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) +
|
headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) +
|
||||||
strlen( "CONTENT-LENGTH: \r\n" ) + MAX_CONTENT_LENGTH +
|
strlen( "CONTENT-LENGTH: \r\n" ) + MAX_CONTENT_LENGTH +
|
||||||
@@ -752,7 +754,7 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
|||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
free( reference_count );
|
free( reference_count );
|
||||||
ixmlFreeDOMString( propertySet );
|
ixmlFreeDOMString( propertySet );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +804,7 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
|||||||
free( thread_struct );
|
free( thread_struct );
|
||||||
free( headers );
|
free( headers );
|
||||||
}
|
}
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
@@ -897,7 +899,7 @@ genaNotifyAllExt( IN UpnpDevice_Handle device_handle,
|
|||||||
"%ld\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n",
|
"%ld\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n",
|
||||||
(long) strlen( propertySet ) + 1 );
|
(long) strlen( propertySet ) + 1 );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE )
|
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE )
|
||||||
return_code = GENA_E_BAD_HANDLE;
|
return_code = GENA_E_BAD_HANDLE;
|
||||||
@@ -957,7 +959,7 @@ genaNotifyAllExt( IN UpnpDevice_Handle device_handle,
|
|||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
@@ -1059,7 +1061,7 @@ genaNotifyAll( IN UpnpDevice_Handle device_handle,
|
|||||||
" upnp:event\r\nNTS: upnp:propchange\r\n",
|
" upnp:event\r\nNTS: upnp:propchange\r\n",
|
||||||
(long) strlen( propertySet ) + 1 );
|
(long) strlen( propertySet ) + 1 );
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetHandleInfo( device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
return_code = GENA_E_BAD_HANDLE;
|
return_code = GENA_E_BAD_HANDLE;
|
||||||
@@ -1121,7 +1123,7 @@ genaNotifyAll( IN UpnpDevice_Handle device_handle,
|
|||||||
free( UDN_copy );
|
free( UDN_copy );
|
||||||
free( servId_copy );
|
free( servId_copy );
|
||||||
}
|
}
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
@@ -1315,8 +1317,8 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
|||||||
memptr callback_hdr;
|
memptr callback_hdr;
|
||||||
memptr timeout_hdr;
|
memptr timeout_hdr;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"Subscription Request Received:\n" );
|
"Subscription Request Received:\n" ) );
|
||||||
|
|
||||||
if( httpmsg_find_hdr( request, HDR_NT, &nt_hdr ) == NULL ) {
|
if( httpmsg_find_hdr( request, HDR_NT, &nt_hdr ) == NULL ) {
|
||||||
error_respond( info, HTTP_BAD_REQUEST, request );
|
error_respond( info, HTTP_BAD_REQUEST, request );
|
||||||
@@ -1345,17 +1347,18 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"SubscriptionRequest for event URL path: %s\n",
|
"SubscriptionRequest for event URL path: %s\n",
|
||||||
event_url_path );
|
event_url_path );
|
||||||
|
)
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
// CURRENTLY, ONLY ONE DEVICE
|
// CURRENTLY, ONLY ONE DEVICE
|
||||||
if( GetDeviceHandleInfo( &device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetDeviceHandleInfo( &device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
free( event_url_path );
|
free( event_url_path );
|
||||||
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
service = FindServiceEventURLPath( &handle_info->ServiceTable,
|
service = FindServiceEventURLPath( &handle_info->ServiceTable,
|
||||||
@@ -1364,28 +1367,28 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
|||||||
|
|
||||||
if( service == NULL || !service->active ) {
|
if( service == NULL || !service->active ) {
|
||||||
error_respond( info, HTTP_NOT_FOUND, request );
|
error_respond( info, HTTP_NOT_FOUND, request );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"Subscription Request: Number of Subscriptions already %d\n "
|
"Subscription Request: Number of Subscriptions already %d\n "
|
||||||
"Max Subscriptions allowed: %d\n",
|
"Max Subscriptions allowed: %d\n",
|
||||||
service->TotalSubscriptions,
|
service->TotalSubscriptions,
|
||||||
handle_info->MaxSubscriptions );
|
handle_info->MaxSubscriptions ) );
|
||||||
|
|
||||||
// too many subscriptions
|
// too many subscriptions
|
||||||
if( handle_info->MaxSubscriptions != -1 &&
|
if( handle_info->MaxSubscriptions != -1 &&
|
||||||
service->TotalSubscriptions >= handle_info->MaxSubscriptions ) {
|
service->TotalSubscriptions >= handle_info->MaxSubscriptions ) {
|
||||||
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// generate new subscription
|
// generate new subscription
|
||||||
sub = ( subscription * ) malloc( sizeof( subscription ) );
|
sub = ( subscription * ) malloc( sizeof( subscription ) );
|
||||||
if( sub == NULL ) {
|
if( sub == NULL ) {
|
||||||
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sub->eventKey = 0;
|
sub->eventKey = 0;
|
||||||
@@ -1402,13 +1405,13 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
|||||||
&sub->DeliveryURLs ) ) == 0 ) {
|
&sub->DeliveryURLs ) ) == 0 ) {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
||||||
freeSubscriptionList( sub );
|
freeSubscriptionList( sub );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( return_code == UPNP_E_OUTOF_MEMORY ) {
|
if( return_code == UPNP_E_OUTOF_MEMORY ) {
|
||||||
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
||||||
freeSubscriptionList( sub );
|
freeSubscriptionList( sub );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// set the timeout
|
// set the timeout
|
||||||
@@ -1444,7 +1447,7 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
|||||||
// respond OK
|
// respond OK
|
||||||
if( respond_ok( info, time_out, sub, request ) != UPNP_E_SUCCESS ) {
|
if( respond_ok( info, time_out, sub, request ) != UPNP_E_SUCCESS ) {
|
||||||
freeSubscriptionList( sub );
|
freeSubscriptionList( sub );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//add to subscription list
|
//add to subscription list
|
||||||
@@ -1461,7 +1464,7 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
|||||||
callback_fun = handle_info->Callback;
|
callback_fun = handle_info->Callback;
|
||||||
cookie = handle_info->Cookie;
|
cookie = handle_info->Cookie;
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
//make call back with request struct
|
//make call back with request struct
|
||||||
//in the future should find a way of mainting
|
//in the future should find a way of mainting
|
||||||
@@ -1524,7 +1527,7 @@ gena_process_subscription_renewal_request( IN SOCKINFO * info,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
// CURRENTLY, ONLY SUPPORT ONE DEVICE
|
// CURRENTLY, ONLY SUPPORT ONE DEVICE
|
||||||
if( GetDeviceHandleInfo( &device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetDeviceHandleInfo( &device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
@@ -1541,21 +1544,22 @@ gena_process_subscription_renewal_request( IN SOCKINFO * info,
|
|||||||
!service->active ||
|
!service->active ||
|
||||||
( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ) {
|
( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ) {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
"Renew request: Number of subscriptions already: %d\n "
|
"Renew request: Number of subscriptions already: %d\n "
|
||||||
"Max Subscriptions allowed:%d\n",
|
"Max Subscriptions allowed:%d\n",
|
||||||
service->TotalSubscriptions,
|
service->TotalSubscriptions,
|
||||||
handle_info->MaxSubscriptions );
|
handle_info->MaxSubscriptions );
|
||||||
// too many subscriptions
|
)
|
||||||
if( handle_info->MaxSubscriptions != -1 &&
|
// too many subscriptions
|
||||||
|
if( handle_info->MaxSubscriptions != -1 &&
|
||||||
service->TotalSubscriptions > handle_info->MaxSubscriptions ) {
|
service->TotalSubscriptions > handle_info->MaxSubscriptions ) {
|
||||||
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );
|
||||||
RemoveSubscriptionSID( sub->sid, service );
|
RemoveSubscriptionSID( sub->sid, service );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// set the timeout
|
// set the timeout
|
||||||
@@ -1594,7 +1598,7 @@ gena_process_subscription_renewal_request( IN SOCKINFO * info,
|
|||||||
RemoveSubscriptionSID( sub->sid, service );
|
RemoveSubscriptionSID( sub->sid, service );
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -1647,13 +1651,13 @@ gena_process_unsubscribe_request( IN SOCKINFO * info,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
// CURRENTLY, ONLY SUPPORT ONE DEVICE
|
// CURRENTLY, ONLY SUPPORT ONE DEVICE
|
||||||
if( GetDeviceHandleInfo( &device_handle, &handle_info ) != HND_DEVICE ) {
|
if( GetDeviceHandleInfo( &device_handle, &handle_info ) != HND_DEVICE ) {
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
||||||
membuffer_destroy( &event_url_path );
|
membuffer_destroy( &event_url_path );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
service = FindServiceEventURLPath( &handle_info->ServiceTable,
|
service = FindServiceEventURLPath( &handle_info->ServiceTable,
|
||||||
@@ -1666,14 +1670,14 @@ gena_process_unsubscribe_request( IN SOCKINFO * info,
|
|||||||
//CheckSubscriptionSID(sid, service) == NULL )
|
//CheckSubscriptionSID(sid, service) == NULL )
|
||||||
{
|
{
|
||||||
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
error_respond( info, HTTP_PRECONDITION_FAILED, request );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveSubscriptionSID( sid, service );
|
RemoveSubscriptionSID( sid, service );
|
||||||
error_respond( info, HTTP_OK, request ); // success
|
error_respond( info, HTTP_OK, request ); // success
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // INCLUDE_DEVICE_APIS
|
#endif // INCLUDE_DEVICE_APIS
|
||||||
|
@@ -106,16 +106,16 @@ SetHTTPGetCallback( MiniServerCallback callback )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SetSoapCallback
|
* Function : SetSoapCallback
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* MiniServerCallback callback ; - SOAP Callback to be invoked
|
* MiniServerCallback callback ; - SOAP Callback to be invoked
|
||||||
*
|
*
|
||||||
* Description : Set SOAP Callback
|
* Description : Set SOAP Callback
|
||||||
*
|
*
|
||||||
* Return : void
|
* Return : void
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void
|
void
|
||||||
SetSoapCallback( MiniServerCallback callback )
|
SetSoapCallback( MiniServerCallback callback )
|
||||||
@@ -174,9 +174,11 @@ dispatch_request( IN SOCKINFO * info,
|
|||||||
case HTTPMETHOD_NOTIFY:
|
case HTTPMETHOD_NOTIFY:
|
||||||
case HTTPMETHOD_SUBSCRIBE:
|
case HTTPMETHOD_SUBSCRIBE:
|
||||||
case HTTPMETHOD_UNSUBSCRIBE:
|
case HTTPMETHOD_UNSUBSCRIBE:
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"miniserver %d: got GENA msg\n", info->socket );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
callback = gGenaCallback;
|
"miniserver %d: got GENA msg\n", info->socket );
|
||||||
|
)
|
||||||
|
callback = gGenaCallback;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//HTTP server call
|
//HTTP server call
|
||||||
@@ -215,7 +217,7 @@ dispatch_request( IN SOCKINFO * info,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
handle_error( IN SOCKINFO * info,
|
handle_error( IN SOCKINFO * info,
|
||||||
int http_error_code,
|
int http_error_code,
|
||||||
int major,
|
int major,
|
||||||
@@ -273,10 +275,12 @@ handle_request( void *args )
|
|||||||
struct mserv_request_t *request = ( struct mserv_request_t * )args;
|
struct mserv_request_t *request = ( struct mserv_request_t * )args;
|
||||||
int connfd = request->connfd;
|
int connfd = request->connfd;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"miniserver %d: READING\n", connfd );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
//parser_request_init( &parser ); ////LEAK_FIX_MK
|
"miniserver %d: READING\n", connfd );
|
||||||
hmsg = &parser.msg;
|
)
|
||||||
|
//parser_request_init( &parser ); ////LEAK_FIX_MK
|
||||||
|
hmsg = &parser.msg;
|
||||||
|
|
||||||
if( sock_init_with_ip( &info, connfd, request->foreign_ip_addr,
|
if( sock_init_with_ip( &info, connfd, request->foreign_ip_addr,
|
||||||
request->foreign_ip_port ) != UPNP_E_SUCCESS ) {
|
request->foreign_ip_port ) != UPNP_E_SUCCESS ) {
|
||||||
@@ -291,10 +295,12 @@ handle_request( void *args )
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"miniserver %d: PROCESSING...\n", connfd );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
// dispatch
|
"miniserver %d: PROCESSING...\n", connfd );
|
||||||
http_error_code = dispatch_request( &info, &parser );
|
)
|
||||||
|
// dispatch
|
||||||
|
http_error_code = dispatch_request( &info, &parser );
|
||||||
if( http_error_code != 0 ) {
|
if( http_error_code != 0 ) {
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@@ -310,9 +316,11 @@ handle_request( void *args )
|
|||||||
handle_error( &info, http_error_code, major, minor );
|
handle_error( &info, http_error_code, major, minor );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"miniserver %d: COMPLETE\n", connfd );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
sock_destroy( &info, SD_BOTH ); //should shutdown completely
|
"miniserver %d: COMPLETE\n", connfd );
|
||||||
|
)
|
||||||
|
sock_destroy( &info, SD_BOTH ); //should shutdown completely
|
||||||
|
|
||||||
httpmsg_destroy( hmsg );
|
httpmsg_destroy( hmsg );
|
||||||
free( request );
|
free( request );
|
||||||
@@ -333,7 +341,7 @@ handle_request( void *args )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
schedule_request_job( IN int connfd,
|
schedule_request_job( IN int connfd,
|
||||||
IN struct sockaddr_in *clientAddr )
|
IN struct sockaddr_in *clientAddr )
|
||||||
{
|
{
|
||||||
@@ -344,9 +352,11 @@ schedule_request_job( IN int connfd,
|
|||||||
( struct mserv_request_t * )
|
( struct mserv_request_t * )
|
||||||
malloc( sizeof( struct mserv_request_t ) );
|
malloc( sizeof( struct mserv_request_t ) );
|
||||||
if( request == NULL ) {
|
if( request == NULL ) {
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"mserv %d: out of memory\n", connfd );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
shutdown( request->connfd, SD_BOTH );
|
"mserv %d: out of memory\n", connfd );
|
||||||
|
)
|
||||||
|
shutdown( request->connfd, SD_BOTH );
|
||||||
UpnpCloseSocket( connfd );
|
UpnpCloseSocket( connfd );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -359,9 +369,11 @@ schedule_request_job( IN int connfd,
|
|||||||
TPJobSetFreeFunction( &job, free_handle_request_arg );
|
TPJobSetFreeFunction( &job, free_handle_request_arg );
|
||||||
TPJobSetPriority( &job, MED_PRIORITY );
|
TPJobSetPriority( &job, MED_PRIORITY );
|
||||||
|
|
||||||
if( ThreadPoolAdd( &gMiniServerThreadPool, &job, NULL ) != 0 ) {
|
if( ThreadPoolAdd( &gRecvThreadPool, &job, NULL ) != 0 ) {
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"mserv %d: cannot schedule request\n", connfd );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
|
"mserv %d: cannot schedule request\n", connfd );
|
||||||
|
)
|
||||||
free( request );
|
free( request );
|
||||||
shutdown( connfd, SD_BOTH );
|
shutdown( connfd, SD_BOTH );
|
||||||
UpnpCloseSocket( connfd );
|
UpnpCloseSocket( connfd );
|
||||||
@@ -434,9 +446,11 @@ RunMiniServer( MiniServerSockArray * miniSock )
|
|||||||
|
|
||||||
if( select( maxMiniSock, &rdSet, NULL, &expSet, NULL ) ==
|
if( select( maxMiniSock, &rdSet, NULL, &expSet, NULL ) ==
|
||||||
UPNP_SOCKETERROR ) {
|
UPNP_SOCKETERROR ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"Error in select call !!!\n" );
|
( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||||
continue;
|
"Error in select call !!!\n" );
|
||||||
|
)
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if( FD_ISSET( miniServSock, &rdSet ) ) {
|
if( FD_ISSET( miniServSock, &rdSet ) ) {
|
||||||
@@ -445,10 +459,12 @@ RunMiniServer( MiniServerSockArray * miniSock )
|
|||||||
( struct sockaddr * )&clientAddr,
|
( struct sockaddr * )&clientAddr,
|
||||||
&clientLen );
|
&clientLen );
|
||||||
if( connectHnd == UPNP_INVALID_SOCKET ) {
|
if( connectHnd == UPNP_INVALID_SOCKET ) {
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"miniserver: Error"
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
" in accepting connection\n" );
|
"miniserver: Error"
|
||||||
continue;
|
" in accepting connection\n" );
|
||||||
|
)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
schedule_request_job( connectHnd, &clientAddr );
|
schedule_request_job( connectHnd, &clientAddr );
|
||||||
}
|
}
|
||||||
@@ -473,19 +489,24 @@ RunMiniServer( MiniServerSockArray * miniSock )
|
|||||||
&clientLen );
|
&clientLen );
|
||||||
if( byteReceived > 0 ) {
|
if( byteReceived > 0 ) {
|
||||||
requestBuf[byteReceived] = '\0';
|
requestBuf[byteReceived] = '\0';
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"Received response !!! %s From host %s \n",
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
requestBuf, inet_ntoa( clientAddr.sin_addr ) );
|
"Received response !!! %s From host %s \n",
|
||||||
UpnpPrintf( UPNP_PACKET, MSERV, __FILE__, __LINE__,
|
requestBuf,
|
||||||
"Received multicast packet: \n %s\n",
|
inet_ntoa( clientAddr.sin_addr ) );
|
||||||
requestBuf );
|
)
|
||||||
|
DBGONLY( UpnpPrintf
|
||||||
|
( UPNP_PACKET, MSERV, __FILE__, __LINE__,
|
||||||
|
"Received multicast packet: \n %s\n",
|
||||||
|
requestBuf );
|
||||||
|
)
|
||||||
|
|
||||||
if( NULL != strstr( requestBuf, "ShutDown" ) ) {
|
if( NULL != strstr( requestBuf, "ShutDown" ) )
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown( miniServSock, SD_BOTH );
|
shutdown( miniServSock, SD_BOTH );
|
||||||
@@ -534,10 +555,12 @@ get_port( int sockfd )
|
|||||||
}
|
}
|
||||||
|
|
||||||
port = ntohs( sockinfo.sin_port );
|
port = ntohs( sockinfo.sin_port );
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"sockfd = %d, .... port = %d\n", sockfd, port );
|
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
|
"sockfd = %d, .... port = %d\n", sockfd, port );
|
||||||
|
)
|
||||||
|
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -600,10 +623,16 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
|||||||
//THIS MAY CAUSE TCP TO BECOME LESS RELIABLE
|
//THIS MAY CAUSE TCP TO BECOME LESS RELIABLE
|
||||||
//HOWEVER IT HAS BEEN SUGESTED FOR TCP SERVERS
|
//HOWEVER IT HAS BEEN SUGESTED FOR TCP SERVERS
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
"mserv start: resuseaddr set\n" );
|
"mserv start: resuseaddr set\n" );
|
||||||
sockError = setsockopt( listenfd, SOL_SOCKET, SO_REUSEADDR,
|
)
|
||||||
( const char * )&reuseaddr_on, sizeof( int ));
|
|
||||||
|
sockError = setsockopt( listenfd,
|
||||||
|
SOL_SOCKET,
|
||||||
|
SO_REUSEADDR,
|
||||||
|
( const char * )&reuseaddr_on,
|
||||||
|
sizeof( int )
|
||||||
|
);
|
||||||
if( sockError == UPNP_SOCKETERROR ) {
|
if( sockError == UPNP_SOCKETERROR ) {
|
||||||
shutdown( listenfd, SD_BOTH );
|
shutdown( listenfd, SD_BOTH );
|
||||||
UpnpCloseSocket( listenfd );
|
UpnpCloseSocket( listenfd );
|
||||||
@@ -623,9 +652,9 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
|||||||
);
|
);
|
||||||
if( sockError == UPNP_SOCKETERROR ) {
|
if( sockError == UPNP_SOCKETERROR ) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
errCode = WSAGetLastError();
|
errCode = WSAGetLastError();
|
||||||
#else
|
#else
|
||||||
errCode = errno;
|
errCode = errno;
|
||||||
#endif
|
#endif
|
||||||
if( errno == EADDRINUSE )
|
if( errno == EADDRINUSE )
|
||||||
errCode = 1;
|
errCode = 1;
|
||||||
@@ -636,16 +665,18 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( sockError == UPNP_SOCKETERROR ) {
|
if( sockError == UPNP_SOCKETERROR ) {
|
||||||
perror( "mserv start: bind failed" );
|
DBGONLY( perror( "mserv start: bind failed" );
|
||||||
shutdown( listenfd, SD_BOTH );
|
)
|
||||||
|
shutdown( listenfd, SD_BOTH );
|
||||||
UpnpCloseSocket( listenfd );
|
UpnpCloseSocket( listenfd );
|
||||||
return UPNP_E_SOCKET_BIND; // bind failed
|
return UPNP_E_SOCKET_BIND; // bind failed
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
"mserv start: bind success\n" );
|
"mserv start: bind success\n" );
|
||||||
|
)
|
||||||
|
|
||||||
success = listen( listenfd, SOMAXCONN );
|
success = listen( listenfd, SOMAXCONN );
|
||||||
if( success == UPNP_SOCKETERROR ) {
|
if( success == UPNP_SOCKETERROR ) {
|
||||||
shutdown( listenfd, SD_BOTH );
|
shutdown( listenfd, SD_BOTH );
|
||||||
UpnpCloseSocket( listenfd );
|
UpnpCloseSocket( listenfd );
|
||||||
@@ -663,10 +694,11 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
|||||||
|
|
||||||
if( ( miniServerStopSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) ==
|
if( ( miniServerStopSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) ==
|
||||||
UPNP_INVALID_SOCKET ) {
|
UPNP_INVALID_SOCKET ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
MSERV, __FILE__, __LINE__,
|
MSERV, __FILE__, __LINE__,
|
||||||
"Error in socket operation !!!\n" );
|
"Error in socket operation !!!\n" );
|
||||||
shutdown( listenfd, SD_BOTH );
|
)
|
||||||
|
shutdown( listenfd, SD_BOTH );
|
||||||
UpnpCloseSocket( listenfd );
|
UpnpCloseSocket( listenfd );
|
||||||
return UPNP_E_OUTOF_SOCKET;
|
return UPNP_E_OUTOF_SOCKET;
|
||||||
}
|
}
|
||||||
@@ -679,10 +711,11 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
|||||||
if( bind( miniServerStopSock, ( struct sockaddr * )&serverAddr,
|
if( bind( miniServerStopSock, ( struct sockaddr * )&serverAddr,
|
||||||
sizeof( serverAddr ) ) == UPNP_SOCKETERROR ) {
|
sizeof( serverAddr ) ) == UPNP_SOCKETERROR ) {
|
||||||
|
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
MSERV, __FILE__, __LINE__,
|
MSERV, __FILE__, __LINE__,
|
||||||
"Error in binding localhost!!!\n" );
|
"Error in binding localhost!!!\n" );
|
||||||
shutdown( listenfd, SD_BOTH );
|
)
|
||||||
|
shutdown( listenfd, SD_BOTH );
|
||||||
UpnpCloseSocket( listenfd );
|
UpnpCloseSocket( listenfd );
|
||||||
shutdown( miniServerStopSock, SD_BOTH );
|
shutdown( miniServerStopSock, SD_BOTH );
|
||||||
UpnpCloseSocket( miniServerStopSock );
|
UpnpCloseSocket( miniServerStopSock );
|
||||||
@@ -772,7 +805,7 @@ StartMiniServer( unsigned short listen_port )
|
|||||||
|
|
||||||
TPJobSetFreeFunction( &job, ( free_routine ) free );
|
TPJobSetFreeFunction( &job, ( free_routine ) free );
|
||||||
|
|
||||||
success = ThreadPoolAddPersistent( &gMiniServerThreadPool, &job, NULL );
|
success = ThreadPoolAddPersistent( &gRecvThreadPool, &job, NULL );
|
||||||
|
|
||||||
if( success < 0 ) {
|
if( success < 0 ) {
|
||||||
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
||||||
@@ -844,9 +877,11 @@ StopMiniServer( void )
|
|||||||
|
|
||||||
sock = socket( AF_INET, SOCK_DGRAM, 0 );
|
sock = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||||
if( sock == UPNP_INVALID_SOCKET ) {
|
if( sock == UPNP_INVALID_SOCKET ) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"SSDP_SERVER:StopSSDPServer: Error in socket operation !!!\n" );
|
( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
return 0;
|
"SSDP_SERVER:StopSSDPServer: Error in socket operation !!!\n" );
|
||||||
|
)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( gMServState != MSERV_IDLE ) {
|
while( gMServState != MSERV_IDLE ) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -118,7 +118,7 @@ static xboolean gInitialized = FALSE;
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
init_table( IN const char *encoded_str,
|
init_table( IN const char *encoded_str,
|
||||||
OUT const char *table[],
|
OUT const char *table[],
|
||||||
IN int tbl_size )
|
IN int tbl_size )
|
||||||
@@ -144,7 +144,7 @@ init_table( IN const char *encoded_str,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
init_tables( void )
|
init_tables( void )
|
||||||
{
|
{
|
||||||
init_table( Http1xxStr, Http1xxCodes, NUM_1XX_CODES );
|
init_table( Http1xxStr, Http1xxCodes, NUM_1XX_CODES );
|
||||||
|
@@ -205,7 +205,7 @@ extern str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES];
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
media_list_init( void )
|
media_list_init( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -243,7 +243,7 @@ media_list_init( void )
|
|||||||
* 0 on success;
|
* 0 on success;
|
||||||
* -1 on error
|
* -1 on error
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
search_extension( IN const char *extension,
|
search_extension( IN const char *extension,
|
||||||
OUT const char **con_type,
|
OUT const char **con_type,
|
||||||
OUT const char **con_subtype )
|
OUT const char **con_subtype )
|
||||||
@@ -290,7 +290,7 @@ search_extension( IN const char *extension,
|
|||||||
* 0 - On Sucess
|
* 0 - On Sucess
|
||||||
* UPNP_E_OUTOF_MEMORY - on memory allocation failures
|
* UPNP_E_OUTOF_MEMORY - on memory allocation failures
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
UPNP_INLINE int
|
XINLINE int
|
||||||
get_content_type( IN const char *filename,
|
get_content_type( IN const char *filename,
|
||||||
OUT DOMString * content_type )
|
OUT DOMString * content_type )
|
||||||
{
|
{
|
||||||
@@ -348,7 +348,7 @@ get_content_type( IN const char *filename,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
glob_alias_init( void )
|
glob_alias_init( void )
|
||||||
{
|
{
|
||||||
struct xml_alias_t *alias = &gAliasDoc;
|
struct xml_alias_t *alias = &gAliasDoc;
|
||||||
@@ -370,7 +370,7 @@ glob_alias_init( void )
|
|||||||
* Returns:
|
* Returns:
|
||||||
* BOOLEAN
|
* BOOLEAN
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static XINLINE xboolean
|
||||||
is_valid_alias( IN const struct xml_alias_t *alias )
|
is_valid_alias( IN const struct xml_alias_t *alias )
|
||||||
{
|
{
|
||||||
return alias->doc.buf != NULL;
|
return alias->doc.buf != NULL;
|
||||||
@@ -637,13 +637,13 @@ get_file_info( IN const char *filename,
|
|||||||
|
|
||||||
rc = get_content_type( filename, &info->content_type );
|
rc = get_content_type( filename, &info->content_type );
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"file info: %s, length: %lld, last_mod=%s readable=%d\n",
|
"file info: %s, length: %lld, last_mod=%s readable=%d\n",
|
||||||
filename, (long long)info->file_length,
|
filename, (long long)info->file_length,
|
||||||
asctime( gmtime( &info->last_modified ) ),
|
asctime( gmtime( &info->last_modified ) ),
|
||||||
info->is_readable );
|
info->is_readable ); )
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -700,7 +700,7 @@ web_server_set_root_dir( IN const char *root_dir )
|
|||||||
* TRUE - On Success
|
* TRUE - On Success
|
||||||
* FALSE if request is not an alias
|
* FALSE if request is not an alias
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static XINLINE xboolean
|
||||||
get_alias( IN const char *request_file,
|
get_alias( IN const char *request_file,
|
||||||
OUT struct xml_alias_t *alias,
|
OUT struct xml_alias_t *alias,
|
||||||
OUT struct File_Info *info )
|
OUT struct File_Info *info )
|
||||||
@@ -1586,11 +1586,14 @@ http_RecvPostMessage( http_parser_t * parser,
|
|||||||
}
|
}
|
||||||
} else if( num_read == 0 ) {
|
} else if( num_read == 0 ) {
|
||||||
if( ok_on_close ) {
|
if( ok_on_close ) {
|
||||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
parser->msg.msg.buf );
|
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
||||||
print_http_headers( &parser->msg );
|
parser->msg.msg.buf );
|
||||||
parser->position = POS_COMPLETE;
|
//print_http_headers( &parser->msg );
|
||||||
|
)
|
||||||
|
|
||||||
|
parser->position = POS_COMPLETE;
|
||||||
} else {
|
} else {
|
||||||
// partial msg
|
// partial msg
|
||||||
parser->http_error_code = HTTP_BAD_REQUEST; // or response
|
parser->http_error_code = HTTP_BAD_REQUEST; // or response
|
||||||
@@ -1757,9 +1760,10 @@ web_server_callback( IN http_parser_t * parser,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"webserver: request processed...\n" );
|
"webserver: request processed...\n" );
|
||||||
|
)
|
||||||
|
|
||||||
membuffer_destroy( &headers );
|
membuffer_destroy( &headers );
|
||||||
membuffer_destroy( &filename );
|
membuffer_destroy( &filename );
|
||||||
}
|
}
|
||||||
|
@@ -231,15 +231,6 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SO_NOSIGPIPE
|
|
||||||
{
|
|
||||||
int old;
|
|
||||||
int set = 1;
|
|
||||||
socklen_t olen = sizeof(old);
|
|
||||||
getsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, &olen);
|
|
||||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( bRead ) {
|
if( bRead ) {
|
||||||
// read data
|
// read data
|
||||||
numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL);
|
numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL);
|
||||||
@@ -252,9 +243,6 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
send( sockfd, buffer + bytes_sent, byte_left,
|
send( sockfd, buffer + bytes_sent, byte_left,
|
||||||
MSG_DONTROUTE|MSG_NOSIGNAL);
|
MSG_DONTROUTE|MSG_NOSIGNAL);
|
||||||
if( num_written == -1 ) {
|
if( num_written == -1 ) {
|
||||||
#ifdef SO_NOSIGPIPE
|
|
||||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
|
||||||
#endif
|
|
||||||
return num_written;
|
return num_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,11 +253,6 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
numBytes = bytes_sent;
|
numBytes = bytes_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SO_NOSIGPIPE
|
|
||||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( numBytes < 0 ) {
|
if( numBytes < 0 ) {
|
||||||
return UPNP_E_SOCKET_ERROR;
|
return UPNP_E_SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
|
@@ -34,11 +34,8 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#include <osreldate.h>
|
|
||||||
#if __FreeBSD_version < 601103
|
|
||||||
#include <lwres/netdb.h>
|
#include <lwres/netdb.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
|
|
||||||
@@ -367,20 +364,16 @@ free_URL_list( URL_list * list )
|
|||||||
* uri_type *in ; URI object
|
* uri_type *in ; URI object
|
||||||
*
|
*
|
||||||
* Description : Function useful in debugging for printing a parsed uri.
|
* Description : Function useful in debugging for printing a parsed uri.
|
||||||
|
* Compiled out with DBGONLY macro.
|
||||||
*
|
*
|
||||||
* Return : void ;
|
* Return : void ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void print_uri( uri_type * in ) {
|
||||||
void print_uri( uri_type *in )
|
print_token( &in->scheme );
|
||||||
{
|
print_token( &in->hostport.text );
|
||||||
print_token( &in->scheme );
|
print_token( &in->pathquery ); print_token( &in->fragment );} )
|
||||||
print_token( &in->hostport.text );
|
|
||||||
print_token( &in->pathquery );
|
|
||||||
print_token( &in->fragment );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : print_token
|
* Function : print_token
|
||||||
@@ -389,23 +382,20 @@ void print_uri( uri_type *in )
|
|||||||
* token * in ; token
|
* token * in ; token
|
||||||
*
|
*
|
||||||
* Description : Function useful in debugging for printing a token.
|
* Description : Function useful in debugging for printing a token.
|
||||||
|
* Compiled out with DBGONLY macro.
|
||||||
*
|
*
|
||||||
* Return : void ;
|
* Return : void ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void print_token( token * in ) {
|
||||||
void print_token(token * in)
|
int i = 0;
|
||||||
{
|
printf( "Token Size : %d\n\'", in->size );
|
||||||
int i = 0;
|
for( i = 0; i < in->size; i++ ) {
|
||||||
printf( "Token Size : %"PRIzu"\n\'", in->size );
|
putchar( in->buff[i] );}
|
||||||
for( i = 0; i < in->size; i++ ) {
|
putchar( '\'' ); putchar( '\n' );}
|
||||||
putchar( in->buff[i] );
|
|
||||||
}
|
)
|
||||||
putchar( '\'' );
|
|
||||||
putchar( '\n' );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : token_string_casecmp
|
* Function : token_string_casecmp
|
||||||
@@ -424,10 +414,8 @@ void print_token(token * in)
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int token_string_casecmp(
|
int token_string_casecmp( token * in1,
|
||||||
token * in1,
|
char *in2 ) {
|
||||||
char *in2 )
|
|
||||||
{
|
|
||||||
int in2_length = strlen( in2 );
|
int in2_length = strlen( in2 );
|
||||||
|
|
||||||
if( in1->size != in2_length )
|
if( in1->size != in2_length )
|
||||||
@@ -632,7 +620,7 @@ parse_hostport( const char *in,
|
|||||||
&h,
|
&h,
|
||||||
temp_hostbyname_buff,
|
temp_hostbyname_buff,
|
||||||
BUFFER_SIZE, &errcode );
|
BUFFER_SIZE, &errcode );
|
||||||
#elif defined(__FreeBSD__) && __FreeBSD_version < 601103
|
#elif defined(__FreeBSD__)
|
||||||
h = lwres_gethostbyname_r( temp_host_name,
|
h = lwres_gethostbyname_r( temp_host_name,
|
||||||
&h_buf,
|
&h_buf,
|
||||||
temp_hostbyname_buff,
|
temp_hostbyname_buff,
|
||||||
@@ -640,38 +628,11 @@ parse_hostport( const char *in,
|
|||||||
if ( h == NULL ) {
|
if ( h == NULL ) {
|
||||||
errCode = 1;
|
errCode = 1;
|
||||||
}
|
}
|
||||||
#elif defined(__linux__)
|
#else
|
||||||
errCode = gethostbyname_r( temp_host_name,
|
errCode = gethostbyname_r( temp_host_name,
|
||||||
&h_buf,
|
&h_buf,
|
||||||
temp_hostbyname_buff,
|
temp_hostbyname_buff,
|
||||||
BUFFER_SIZE, &h, &errcode );
|
BUFFER_SIZE, &h, &errcode );
|
||||||
#else
|
|
||||||
{
|
|
||||||
struct addrinfo hints, *res, *res0;
|
|
||||||
|
|
||||||
h = NULL;
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
|
||||||
hints.ai_family = PF_INET;
|
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
|
||||||
errCode = getaddrinfo(temp_host_name, "http", &hints, &res0);
|
|
||||||
|
|
||||||
if (!errCode) {
|
|
||||||
for (res = res0; res; res = res->ai_next) {
|
|
||||||
if (res->ai_family == PF_INET &&
|
|
||||||
res->ai_addr->sa_family == AF_INET)
|
|
||||||
{
|
|
||||||
h = &h_buf;
|
|
||||||
h->h_addrtype = res->ai_addr->sa_family;
|
|
||||||
h->h_length = 4;
|
|
||||||
h->h_addr = (void *) temp_hostbyname_buff;
|
|
||||||
*(struct in_addr *)h->h_addr =
|
|
||||||
((struct sockaddr_in *)res->ai_addr)->sin_addr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
freeaddrinfo(res0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( errCode == 0 ) {
|
if( errCode == 0 ) {
|
||||||
@@ -826,8 +787,9 @@ remove_dots( char *in,
|
|||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
|
|
||||||
Segments[0] = NULL;
|
Segments[0] = NULL;
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"REMOVE_DOTS: before: %s\n", in );
|
( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
|
"REMOVE_DOTS: before: %s\n", in ) );
|
||||||
while( ( copyFrom < max ) && ( *copyFrom != '?' )
|
while( ( copyFrom < max ) && ( *copyFrom != '?' )
|
||||||
&& ( *copyFrom != '#' ) ) {
|
&& ( *copyFrom != '#' ) ) {
|
||||||
|
|
||||||
@@ -872,8 +834,9 @@ remove_dots( char *in,
|
|||||||
}
|
}
|
||||||
( *copyTo ) = 0;
|
( *copyTo ) = 0;
|
||||||
free( Segments );
|
free( Segments );
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"REMOVE_DOTS: after: %s\n", in );
|
( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
|
"REMOVE_DOTS: after: %s\n", in ) );
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -433,7 +433,7 @@ FindServiceControlURLPath( service_table * table,
|
|||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* service_info *service ;Service whose information is to be printed
|
* service_info *service ;Service whose information is to be printed
|
||||||
* Upnp_LogLevel level ; Debug level specified to the print function
|
* Dbg_Level level ; Debug level specified to the print function
|
||||||
* Dbg_Module module ; Debug module specified to the print function
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
*
|
*
|
||||||
* Description : For debugging purposes prints information from the
|
* Description : For debugging purposes prints information from the
|
||||||
@@ -443,54 +443,38 @@ FindServiceControlURLPath( service_table * table,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void printService( service_info * service, Dbg_Level level,
|
||||||
void printService(
|
Dbg_Module module ) {
|
||||||
service_info *service,
|
if( service ) {
|
||||||
Upnp_LogLevel level,
|
if( service->serviceType )
|
||||||
Dbg_Module module )
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
{
|
"serviceType: %s\n", service->serviceType );
|
||||||
if( service ) {
|
if( service->serviceId )
|
||||||
if( service->serviceType ) {
|
UpnpPrintf( level, module, __FILE__, __LINE__, "serviceId: %s\n",
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
service->serviceId ); if( service->SCPDURL )
|
||||||
"serviceType: %s\n", service->serviceType );
|
UpnpPrintf( level, module, __FILE__, __LINE__, "SCPDURL: %s\n",
|
||||||
}
|
service->SCPDURL ); if( service->controlURL )
|
||||||
if( service->serviceId ) {
|
UpnpPrintf( level, module, __FILE__, __LINE__, "controlURL: %s\n",
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
service->controlURL ); if( service->eventURL )
|
||||||
"serviceId: %s\n", service->serviceId );
|
UpnpPrintf( level, module, __FILE__, __LINE__, "eventURL: %s\n",
|
||||||
}
|
service->eventURL ); if( service->UDN )
|
||||||
if( service->SCPDURL ) {
|
UpnpPrintf( level, module, __FILE__, __LINE__, "UDN: %s\n\n",
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
service->UDN ); if( service->active )
|
||||||
"SCPDURL: %s\n", service->SCPDURL );
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
}
|
"Service is active\n" );
|
||||||
if( service->controlURL ) {
|
else
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
"controlURL: %s\n", service->controlURL );
|
"Service is inactive\n" );}
|
||||||
}
|
}
|
||||||
if( service->eventURL ) {
|
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
)
|
||||||
"eventURL: %s\n", service->eventURL );
|
|
||||||
}
|
|
||||||
if( service->UDN ) {
|
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
|
||||||
"UDN: %s\n\n", service->UDN );
|
|
||||||
}
|
|
||||||
if( service->active ) {
|
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
|
||||||
"Service is active\n" );
|
|
||||||
} else {
|
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
|
||||||
"Service is inactive\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : printServiceList
|
* Function : printServiceList
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* service_info *service ; Service whose information is to be printed
|
* service_info *service ; Service whose information is to be printed
|
||||||
* Upnp_LogLevel level ; Debug level specified to the print function
|
* Dbg_Level level ; Debug level specified to the print function
|
||||||
* Dbg_Module module ; Debug module specified to the print function
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
*
|
*
|
||||||
* Description : For debugging purposes prints information of each
|
* Description : For debugging purposes prints information of each
|
||||||
@@ -500,55 +484,43 @@ void printService(
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void printServiceList( service_info * service,
|
||||||
void printServiceList(
|
Dbg_Level level,
|
||||||
service_info * service,
|
Dbg_Module module ) {
|
||||||
Upnp_LogLevel level,
|
while( service ) {
|
||||||
Dbg_Module module )
|
if( service->serviceType )
|
||||||
{
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
while( service ) {
|
"serviceType: %s\n", service->serviceType );
|
||||||
if( service->serviceType ) {
|
if( service->serviceId )
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
"serviceType: %s\n", service->serviceType );
|
"serviceId: %s\n", service->serviceId );
|
||||||
}
|
if( service->SCPDURL )
|
||||||
if( service->serviceId ) {
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
"SCPDURL: %s\n", service->SCPDURL );
|
||||||
"serviceId: %s\n", service->serviceId );
|
if( service->controlURL )
|
||||||
}
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
if( service->SCPDURL ) {
|
"controlURL: %s\n", service->controlURL );
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
if( service->eventURL )
|
||||||
"SCPDURL: %s\n", service->SCPDURL );
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
}
|
"eventURL: %s\n", service->eventURL );
|
||||||
if( service->controlURL ) {
|
if( service->UDN )
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
UpnpPrintf( level, module, __FILE__, __LINE__, "UDN: %s\n\n",
|
||||||
"controlURL: %s\n", service->controlURL );
|
service->UDN ); if( service->active )
|
||||||
}
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
if( service->eventURL ) {
|
"Service is active\n" );
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
else
|
||||||
"eventURL: %s\n", service->eventURL );
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
}
|
"Service is inactive\n" );
|
||||||
if( service->UDN ) {
|
service = service->next;}
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
}
|
||||||
"UDN: %s\n\n", service->UDN );
|
)
|
||||||
}
|
|
||||||
if( service->active ) {
|
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
|
||||||
"Service is active\n" );
|
|
||||||
} else {
|
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
|
||||||
"Service is inactive\n" );
|
|
||||||
}
|
|
||||||
service = service->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : printServiceTable
|
* Function : printServiceTable
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* service_table * table ; Service table to be printed
|
* service_table * table ; Service table to be printed
|
||||||
* Upnp_LogLevel level ; Debug level specified to the print function
|
* Dbg_Level level ; Debug level specified to the print function
|
||||||
* Dbg_Module module ; Debug module specified to the print function
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
*
|
*
|
||||||
* Description : For debugging purposes prints the URL base of the table
|
* Description : For debugging purposes prints the URL base of the table
|
||||||
@@ -559,18 +531,15 @@ void printServiceList(
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY( void printServiceTable( service_table * table,
|
||||||
void printServiceTable(
|
Dbg_Level level,
|
||||||
service_table * table,
|
Dbg_Module module ) {
|
||||||
Upnp_LogLevel level,
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
Dbg_Module module )
|
"URL_BASE: %s\n", table->URLBase );
|
||||||
{
|
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
"Services: \n" );
|
||||||
"URL_BASE: %s\n", table->URLBase );
|
printServiceList( table->serviceList, level, module );}
|
||||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
)
|
||||||
"Services: \n" );
|
|
||||||
printServiceList( table->serviceList, level, module );}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : freeService
|
* Function : freeService
|
||||||
@@ -585,7 +554,7 @@ void printServiceTable(
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void freeService( service_info * in )
|
void freeService( service_info * in )
|
||||||
{
|
{
|
||||||
if( in ) {
|
if( in ) {
|
||||||
if( in->serviceType )
|
if( in->serviceType )
|
||||||
@@ -880,10 +849,12 @@ getServiceList( IXML_Node * node,
|
|||||||
( !
|
( !
|
||||||
( current->controlURL =
|
( current->controlURL =
|
||||||
resolve_rel_url( URLBase, tempDOMString ) ) ) ) {
|
resolve_rel_url( URLBase, tempDOMString ) ) ) ) {
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"BAD OR MISSING CONTROL URL" );
|
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
"BAD OR MISSING CONTROL URL" ) );
|
||||||
"CONTROL URL SET TO NULL IN SERVICE INFO" );
|
DBGONLY( UpnpPrintf
|
||||||
|
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
|
"CONTROL URL SET TO NULL IN SERVICE INFO" ) );
|
||||||
current->controlURL = NULL;
|
current->controlURL = NULL;
|
||||||
fail = 0;
|
fail = 0;
|
||||||
}
|
}
|
||||||
@@ -899,10 +870,12 @@ getServiceList( IXML_Node * node,
|
|||||||
( !
|
( !
|
||||||
( current->eventURL =
|
( current->eventURL =
|
||||||
resolve_rel_url( URLBase, tempDOMString ) ) ) ) {
|
resolve_rel_url( URLBase, tempDOMString ) ) ) ) {
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"BAD OR MISSING EVENT URL" );
|
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
"BAD OR MISSING EVENT URL" ) );
|
||||||
"EVENT URL SET TO NULL IN SERVICE INFO" );
|
DBGONLY( UpnpPrintf
|
||||||
|
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||||
|
"EVENT URL SET TO NULL IN SERVICE INFO" ) );
|
||||||
current->eventURL = NULL;
|
current->eventURL = NULL;
|
||||||
fail = 0;
|
fail = 0;
|
||||||
}
|
}
|
||||||
@@ -935,20 +908,20 @@ getServiceList( IXML_Node * node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : getAllServiceList
|
* Function : getAllServiceList
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IXML_Node *node ; XML node information
|
* IXML_Node *node ; XML node information
|
||||||
* char * URLBase ; provides Base URL to resolve relative URL
|
* char * URLBase ; provides Base URL to resolve relative URL
|
||||||
* service_info **out_end ; service added is returned to the output
|
* service_info **out_end ; service added is returned to the output
|
||||||
* parameter
|
* parameter
|
||||||
*
|
*
|
||||||
* Description : Returns pointer to service info after getting the
|
* Description : Returns pointer to service info after getting the
|
||||||
* sub-elements of the service info.
|
* sub-elements of the service info.
|
||||||
*
|
*
|
||||||
* Return : service_info * ;
|
* Return : service_info * ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
service_info *
|
service_info *
|
||||||
getAllServiceList( IXML_Node * node,
|
getAllServiceList( IXML_Node * node,
|
||||||
@@ -1119,20 +1092,20 @@ addServiceTable( IXML_Node * node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : getServiceTable
|
* Function : getServiceTable
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IXML_Node *node ; XML node information
|
* IXML_Node *node ; XML node information
|
||||||
* service_table *out ; output parameter which will contain the
|
* service_table *out ; output parameter which will contain the
|
||||||
* service list and URL
|
* service list and URL
|
||||||
* const char *DefaultURLBase ; Default base URL on which the URL
|
* const char *DefaultURLBase ; Default base URL on which the URL
|
||||||
* will be returned.
|
* will be returned.
|
||||||
*
|
*
|
||||||
* Description : Retrieve service from the table
|
* Description : Retrieve service from the table
|
||||||
*
|
*
|
||||||
* Return : int ;
|
* Return : int ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int
|
||||||
getServiceTable( IXML_Node * node,
|
getServiceTable( IXML_Node * node,
|
||||||
@@ -1153,8 +1126,9 @@ getServiceTable( IXML_Node * node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( out->serviceList = getAllServiceList(
|
if( ( out->serviceList = getAllServiceList( root, out->URLBase,
|
||||||
root, out->URLBase, &out->endServiceList ) ) ) {
|
&out->
|
||||||
|
endServiceList ) ) ) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -171,7 +171,7 @@ memptr_cmp_nocase( IN memptr * m,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
membuffer_initialize( INOUT membuffer * m )
|
membuffer_initialize( INOUT membuffer * m )
|
||||||
{
|
{
|
||||||
m->buf = NULL;
|
m->buf = NULL;
|
||||||
|
@@ -304,6 +304,27 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** @name DBGONLY
|
||||||
|
The {\bf DBGONLY} macro allows code to be marked so that it
|
||||||
|
is only included in the DEBUG build and not the release. To
|
||||||
|
use this macro, put the code inside of the parentheses:
|
||||||
|
|
||||||
|
{\tt DBGONLY(int i;)}
|
||||||
|
|
||||||
|
This will cause a declaration of the integer {\tt i} only
|
||||||
|
in the debug build.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//@{
|
||||||
|
#ifdef DEBUG
|
||||||
|
# define DBGONLY(x) x
|
||||||
|
#else
|
||||||
|
# define DBGONLY(x)
|
||||||
|
#endif
|
||||||
|
//@}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef EXCLUDE_WEB_SERVER
|
#undef EXCLUDE_WEB_SERVER
|
||||||
#undef EXCLUDE_MINISERVER
|
#undef EXCLUDE_MINISERVER
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
#ifdef INTERNAL_WEB_SERVER
|
||||||
@@ -338,6 +359,13 @@
|
|||||||
# define CLIENTONLY(x)
|
# define CLIENTONLY(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
|
# define DEVICEONLY(x) x
|
||||||
|
#else
|
||||||
|
# define DEVICEONLY(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -89,26 +89,25 @@
|
|||||||
#define DEFAULT_TIMEOUT 1801
|
#define DEFAULT_TIMEOUT 1801
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||||
|
|
||||||
// Lock the subscription
|
//Lock the subscription
|
||||||
#define SubscribeLock() \
|
#define SubscribeLock() \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__, \
|
||||||
"Trying Subscribe Lock"); \
|
"Trying Subscribe Lock")); \
|
||||||
ithread_mutex_lock(&GlobalClientSubscribeMutex); \
|
ithread_mutex_lock(&GlobalClientSubscribeMutex); \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__,"Subscribe Lock");)
|
||||||
"Subscribe Lock");
|
|
||||||
|
|
||||||
// Unlock the subscription
|
//Unlock the subscription
|
||||||
#define SubscribeUnlock() \
|
#define SubscribeUnlock() \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__, \
|
||||||
"Trying Subscribe UnLock"); \
|
"Trying Subscribe UnLock")); \
|
||||||
ithread_mutex_unlock(&GlobalClientSubscribeMutex); \
|
ithread_mutex_unlock(&GlobalClientSubscribeMutex); \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__,"Subscribe UnLock");)
|
||||||
"Subscribe UnLock");
|
|
||||||
|
|
||||||
|
|
||||||
// Structure to send NOTIFY message to all subscribed control points
|
//Structure to send NOTIFY message to all subscribed control points
|
||||||
typedef struct NOTIFY_THREAD_STRUCT {
|
typedef struct NOTIFY_THREAD_STRUCT {
|
||||||
char * headers;
|
char * headers;
|
||||||
DOMString propertySet;
|
DOMString propertySet;
|
||||||
@@ -162,13 +161,11 @@ EXTERN_C void genaCallback (IN http_parser_t *parser,
|
|||||||
* return UPNP_E_SUCCESS if service response is OK else
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
* returns appropriate error
|
* returns appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
CLIENTONLY(
|
||||||
EXTERN_C int genaSubscribe(
|
EXTERN_C int genaSubscribe(UpnpClient_Handle client_handle,
|
||||||
UpnpClient_Handle client_handle,
|
char * PublisherURL,
|
||||||
char * PublisherURL,
|
int * TimeOut,
|
||||||
int * TimeOut,
|
Upnp_SID out_sid );)
|
||||||
Upnp_SID out_sid );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -187,11 +184,8 @@ EXTERN_C int genaSubscribe(
|
|||||||
* return UPNP_E_SUCCESS if service response is OK else
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
* returns appropriate error
|
* returns appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
CLIENTONLY(EXTERN_C int genaUnSubscribe(UpnpClient_Handle client_handle,
|
||||||
EXTERN_C int genaUnSubscribe(
|
const Upnp_SID in_sid);)
|
||||||
UpnpClient_Handle client_handle,
|
|
||||||
const Upnp_SID in_sid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : genaUnregisterClient
|
* Function : genaUnregisterClient
|
||||||
@@ -208,9 +202,8 @@ EXTERN_C int genaUnSubscribe(
|
|||||||
* Returns: int
|
* Returns: int
|
||||||
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
CLIENTONLY(EXTERN_C int genaUnregisterClient(
|
||||||
EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
UpnpClient_Handle client_handle);)
|
||||||
#endif
|
|
||||||
|
|
||||||
//server
|
//server
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -225,9 +218,8 @@ EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
|||||||
* Returns: int
|
* Returns: int
|
||||||
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(EXTERN_C int genaUnregisterDevice(
|
||||||
EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
UpnpDevice_Handle device_handle);)
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -250,12 +242,10 @@ EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
|||||||
* return UPNP_E_SUCCESS if service response is OK else
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
* returns appropriate error
|
* returns appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
CLIENTONLY(EXTERN_C int genaRenewSubscription(
|
||||||
EXTERN_C int genaRenewSubscription(
|
IN UpnpClient_Handle client_handle,
|
||||||
IN UpnpClient_Handle client_handle,
|
IN const Upnp_SID in_sid,
|
||||||
IN const Upnp_SID in_sid,
|
OUT int * TimeOut);)
|
||||||
OUT int * TimeOut);
|
|
||||||
#endif
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaNotifyAll
|
* Function : genaNotifyAll
|
||||||
*
|
*
|
||||||
@@ -275,40 +265,33 @@ EXTERN_C int genaRenewSubscription(
|
|||||||
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
||||||
* is it takes event variable array instead of xml document.
|
* is it takes event variable array instead of xml document.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(EXTERN_C int genaNotifyAll(UpnpDevice_Handle device_handle,
|
||||||
EXTERN_C int genaNotifyAll(
|
char *UDN,
|
||||||
UpnpDevice_Handle device_handle,
|
char *servId,
|
||||||
char *UDN,
|
char **VarNames,
|
||||||
char *servId,
|
char **VarValues,
|
||||||
char **VarNames,
|
int var_count
|
||||||
char **VarValues,
|
);)
|
||||||
int var_count);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaNotifyAllExt
|
* Function : genaNotifyAllExt
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IN UpnpDevice_Handle device_handle : Device handle
|
* IN UpnpDevice_Handle device_handle : Device handle
|
||||||
* IN char *UDN : Device udn
|
* IN char *UDN : Device udn
|
||||||
* IN char *servId : Service ID
|
* IN char *servId : Service ID
|
||||||
* IN IXML_Document *PropSet : XML document Event varible property set
|
* IN IXML_Document *PropSet : XML document Event varible property set
|
||||||
*
|
*
|
||||||
* Description : This function sends a notification to all the subscribed
|
* Description : This function sends a notification to all the subscribed
|
||||||
* control points
|
* control points
|
||||||
*
|
*
|
||||||
* Return : int
|
* Return : int
|
||||||
*
|
*
|
||||||
* Note : This function is similar to the genaNotifyAll. the only difference
|
* Note : This function is similar to the genaNotifyAll. the only difference
|
||||||
* is it takes the document instead of event variable array
|
* is it takes the document instead of event variable array
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(EXTERN_C int genaNotifyAllExt(UpnpDevice_Handle device_handle,
|
||||||
EXTERN_C int genaNotifyAllExt(
|
char *UDN, char *servId,IN IXML_Document *PropSet);)
|
||||||
UpnpDevice_Handle device_handle,
|
|
||||||
char *UDN,
|
|
||||||
char *servId,
|
|
||||||
IN IXML_Document *PropSet);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaInitNotify
|
* Function : genaInitNotify
|
||||||
@@ -331,15 +314,13 @@ EXTERN_C int genaNotifyAllExt(
|
|||||||
* Note : No other event will be sent to this control point before the
|
* Note : No other event will be sent to this control point before the
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
||||||
EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
IN char *UDN,
|
||||||
IN char *UDN,
|
IN char *servId,
|
||||||
IN char *servId,
|
IN char **VarNames,
|
||||||
IN char **VarNames,
|
IN char **VarValues,
|
||||||
IN char **VarValues,
|
IN int var_count,
|
||||||
IN int var_count,
|
IN Upnp_SID sid);)
|
||||||
IN Upnp_SID sid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : genaInitNotifyExt
|
* Function : genaInitNotifyExt
|
||||||
@@ -361,14 +342,12 @@ EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
|||||||
* Note : No other event will be sent to this control point before the
|
* Note : No other event will be sent to this control point before the
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(EXTERN_C int genaInitNotifyExt(
|
||||||
EXTERN_C int genaInitNotifyExt(
|
IN UpnpDevice_Handle device_handle,
|
||||||
IN UpnpDevice_Handle device_handle,
|
IN char *UDN,
|
||||||
IN char *UDN,
|
IN char *servId,
|
||||||
IN char *servId,
|
IN IXML_Document *PropSet,
|
||||||
IN IXML_Document *PropSet,
|
IN Upnp_SID sid);)
|
||||||
IN Upnp_SID sid);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@@ -214,101 +214,37 @@ EXTERN_C ssize_t readLine(int fd, char *out, int max, int *timeout);
|
|||||||
EXTERN_C int remove_dots(char * in, int size);
|
EXTERN_C int remove_dots(char * in, int size);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
DBGONLY(EXTERN_C void print_http_request(http_message
|
||||||
EXTERN_C void print_http_request(
|
*message,Dbg_Level DLevel,
|
||||||
http_message *message,
|
Dbg_Module Module,char *DbgFileName,
|
||||||
Upnp_LogLevel DLevel,
|
int DbgLineNo););
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static inline void print_http_request(
|
|
||||||
http_message *message,
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
DBGONLY(EXTERN_C void print_http_response(http_message *message,
|
||||||
EXTERN_C void print_http_response(
|
Dbg_Level DLevel,
|
||||||
http_message *message,
|
Dbg_Module Module,char *DbgFileName,
|
||||||
Upnp_LogLevel DLevel,
|
int DbgLineNo););
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static inline void print_http_response(
|
|
||||||
http_message *message,
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
DBGONLY(EXTERN_C void print_token( token * in,
|
||||||
EXTERN_C void print_token(
|
Dbg_Level DLevel,
|
||||||
token *in,
|
Dbg_Module Module,
|
||||||
Upnp_LogLevel DLevel,
|
char *DbgFileName,
|
||||||
Dbg_Module Module,
|
int DbgLineNo););
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static inline void print_token(
|
|
||||||
token *in,
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
DBGONLY(EXTERN_C void print_status_line(http_status *in,
|
||||||
EXTERN_C void print_status_line(
|
Dbg_Level DLevel,
|
||||||
http_status *in,
|
Dbg_Module Module,
|
||||||
Upnp_LogLevel DLevel,
|
char *DbgFileName,
|
||||||
Dbg_Module Module,
|
int DbgLineNo););
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static inline void print_status_line(
|
|
||||||
http_status *in,
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
DBGONLY(EXTERN_C void print_request_line(http_request *in,
|
||||||
EXTERN_C void print_request_line(
|
Dbg_Level DLevel,
|
||||||
http_request *in,
|
Dbg_Module Module,
|
||||||
Upnp_LogLevel DLevel,
|
char *DbgFileName,int DbgLineNo));
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static inline void print_request_line(
|
|
||||||
http_request *in,
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
DBGONLY(EXTERN_C void print_uri( uri_type *in,
|
||||||
EXTERN_C void print_uri(
|
Dbg_Level DLevel,
|
||||||
uri_type *in,
|
Dbg_Module Module,
|
||||||
Upnp_LogLevel DLevel,
|
char *DbgFileName,
|
||||||
Dbg_Module Module,
|
int DbgLineNo););
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo);
|
|
||||||
#else
|
|
||||||
static inline void print_uri(
|
|
||||||
uri_type *in,
|
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
Dbg_Module Module,
|
|
||||||
char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -448,17 +448,15 @@ int matchstr( IN char *str, IN size_t slen, IN const char* fmt, ... );
|
|||||||
int raw_to_int( IN memptr* raw_value, int base );
|
int raw_to_int( IN memptr* raw_value, int base );
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: raw_find_str
|
* Function: raw_find_str
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN memptr* raw_value ; Buffer containg the string
|
* IN memptr* raw_value ; Buffer containg the string
|
||||||
* IN const char* str ; Substring to be found
|
* IN const char* str ; Substring to be found
|
||||||
*
|
*
|
||||||
* Description: Find a substring from raw character string buffer
|
* Description: Find a substring from raw character string buffer
|
||||||
*
|
*
|
||||||
* Side effects: raw_value is transformed to lowercase.
|
* Returns:
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* int - index at which the substring is found.
|
* int - index at which the substring is found.
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int raw_find_str( IN memptr* raw_value, IN const char* str );
|
int raw_find_str( IN memptr* raw_value, IN const char* str );
|
||||||
@@ -478,21 +476,17 @@ int raw_find_str( IN memptr* raw_value, IN const char* str );
|
|||||||
const char* method_to_str( IN http_method_t method );
|
const char* method_to_str( IN http_method_t method );
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: print_http_headers
|
* Function: print_http_headers
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* http_message_t* hmsg ; HTTP Message object
|
* http_message_t* hmsg ; HTTP Message object
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
void print_http_headers( IN http_message_t* hmsg );
|
||||||
void print_http_headers( IN http_message_t *hmsg );
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void print_http_headers( IN http_message_t *hmsg ) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
@@ -500,4 +494,3 @@ static UPNP_INLINE void print_http_headers( IN http_message_t *hmsg ) {}
|
|||||||
|
|
||||||
|
|
||||||
#endif // GENLIB_NET_HTTP_HTTPPARSER_H
|
#endif // GENLIB_NET_HTTP_HTTPPARSER_H
|
||||||
|
|
||||||
|
@@ -88,11 +88,7 @@ void SetHTTPGetCallback( MiniServerCallback callback );
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
|
||||||
void SetSoapCallback( MiniServerCallback callback );
|
void SetSoapCallback( MiniServerCallback callback );
|
||||||
#else
|
|
||||||
static inline void SetSoapCallback( MiniServerCallback callback ) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SetGenaCallback
|
* Function : SetGenaCallback
|
||||||
|
@@ -47,7 +47,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define SID_SIZE 41
|
#define SID_SIZE 41
|
||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(
|
||||||
|
|
||||||
typedef struct SUBSCRIPTION {
|
typedef struct SUBSCRIPTION {
|
||||||
Upnp_SID sid;
|
Upnp_SID sid;
|
||||||
@@ -61,19 +61,18 @@ typedef struct SUBSCRIPTION {
|
|||||||
|
|
||||||
|
|
||||||
typedef struct SERVICE_INFO {
|
typedef struct SERVICE_INFO {
|
||||||
DOMString serviceType;
|
DOMString serviceType;
|
||||||
DOMString serviceId;
|
DOMString serviceId;
|
||||||
char *SCPDURL ;
|
char *SCPDURL ;
|
||||||
char *controlURL;
|
char *controlURL;
|
||||||
char *eventURL;
|
char *eventURL;
|
||||||
DOMString UDN;
|
DOMString UDN;
|
||||||
int active;
|
int active;
|
||||||
int TotalSubscriptions;
|
int TotalSubscriptions;
|
||||||
subscription *subscriptionList;
|
subscription *subscriptionList;
|
||||||
struct SERVICE_INFO *next;
|
struct SERVICE_INFO *next;
|
||||||
} service_info;
|
} service_info;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SERVICE_TABLE {
|
typedef struct SERVICE_TABLE {
|
||||||
DOMString URLBase;
|
DOMString URLBase;
|
||||||
service_info *serviceList;
|
service_info *serviceList;
|
||||||
@@ -81,7 +80,7 @@ typedef struct SERVICE_TABLE {
|
|||||||
} service_table;
|
} service_table;
|
||||||
|
|
||||||
|
|
||||||
/* Functions for Subscriptions */
|
/* Functions for Subscriptions */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : copy_subscription
|
* Function : copy_subscription
|
||||||
@@ -254,7 +253,7 @@ service_info * FindServiceControlURLPath( service_table *table,
|
|||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* service_info *service ;Service whose information is to be printed
|
* service_info *service ;Service whose information is to be printed
|
||||||
* Upnp_LogLevel level ; Debug level specified to the print function
|
* Dbg_Level level ; Debug level specified to the print function
|
||||||
* Dbg_Module module ; Debug module specified to the print function
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
*
|
*
|
||||||
* Description : For debugging purposes prints information from the
|
* Description : For debugging purposes prints information from the
|
||||||
@@ -264,24 +263,16 @@ service_info * FindServiceControlURLPath( service_table *table,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY(void printService(service_info *service,Dbg_Level
|
||||||
void printService(
|
level,
|
||||||
service_info *service,
|
Dbg_Module module));
|
||||||
Upnp_LogLevel level,
|
|
||||||
Dbg_Module module);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void printService(
|
|
||||||
service_info *service,
|
|
||||||
Upnp_LogLevel level,
|
|
||||||
Dbg_Module module) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : printServiceList
|
* Function : printServiceList
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* service_info *service ; Service whose information is to be printed
|
* service_info *service ; Service whose information is to be printed
|
||||||
* Upnp_LogLevel level ; Debug level specified to the print function
|
* Dbg_Level level ; Debug level specified to the print function
|
||||||
* Dbg_Module module ; Debug module specified to the print function
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
*
|
*
|
||||||
* Description : For debugging purposes prints information of each
|
* Description : For debugging purposes prints information of each
|
||||||
@@ -291,24 +282,15 @@ static UPNP_INLINE void printService(
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY(void printServiceList(service_info *service,
|
||||||
void printServiceList(
|
Dbg_Level level, Dbg_Module module));
|
||||||
service_info *service,
|
|
||||||
Upnp_LogLevel level,
|
|
||||||
Dbg_Module module);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void printServiceList(
|
|
||||||
service_info *service,
|
|
||||||
Upnp_LogLevel level,
|
|
||||||
Dbg_Module module) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : printServiceTable
|
* Function : printServiceTable
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* service_table * table ; Service table to be printed
|
* service_table * table ; Service table to be printed
|
||||||
* Upnp_LogLevel level ; Debug level specified to the print function
|
* Dbg_Level level ; Debug level specified to the print function
|
||||||
* Dbg_Module module ; Debug module specified to the print function
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
*
|
*
|
||||||
* Description : For debugging purposes prints the URL base of the table
|
* Description : For debugging purposes prints the URL base of the table
|
||||||
@@ -319,17 +301,9 @@ static UPNP_INLINE void printServiceList(
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY(void printServiceTable(service_table *
|
||||||
void printServiceTable(
|
table,Dbg_Level
|
||||||
service_table *table,
|
level,Dbg_Module module));
|
||||||
Upnp_LogLevel level,
|
|
||||||
Dbg_Module module);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void printServiceTable(
|
|
||||||
service_table *table,
|
|
||||||
Upnp_LogLevel level,
|
|
||||||
Dbg_Module module) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : freeService
|
* Function : freeService
|
||||||
@@ -477,11 +451,10 @@ int getSubElement(const char *element_name, IXML_Node *node,
|
|||||||
IXML_Node **out);
|
IXML_Node **out);
|
||||||
|
|
||||||
|
|
||||||
#endif /* INCLUDE_DEVICE_APIS */
|
) /* DEVICEONLY */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _SERVICE_TABLE */
|
#endif /* _SERVICE_TABLE */
|
||||||
|
|
||||||
|
@@ -33,28 +33,28 @@
|
|||||||
#define SOAPLIB_H
|
#define SOAPLIB_H
|
||||||
|
|
||||||
|
|
||||||
// SOAP module API to be called in Upnp-Dk API
|
//SOAP module API to be called in Upnp-Dk API
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function : soap_device_callback
|
* Function : soap_device_callback
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* IN http_parser_t *parser : Parsed request received by the device
|
* IN http_parser_t *parser : Parsed request received by the device
|
||||||
* IN http_message_t* request : HTTP request
|
* IN http_message_t* request : HTTP request
|
||||||
* INOUT SOCKINFO *info : socket info
|
* INOUT SOCKINFO *info : socket info
|
||||||
*
|
*
|
||||||
* Description : This is a callback called by minisever after receiving
|
* Description : This is a callback called by minisever after receiving
|
||||||
* the request from the control point. This function will start
|
* the request from the control point. This function will start
|
||||||
* processing the request. It calls handle_invoke_action to handle the
|
* processing the request. It calls handle_invoke_action to handle the
|
||||||
* SOAP action
|
* SOAP action
|
||||||
*
|
*
|
||||||
* Return : void
|
* Return : void
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void soap_device_callback(
|
void soap_device_callback(
|
||||||
IN http_parser_t *parser,
|
IN http_parser_t *parser,
|
||||||
IN http_message_t* request,
|
IN http_message_t* request,
|
||||||
INOUT SOCKINFO *info );
|
INOUT SOCKINFO *info );
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@@ -184,12 +184,12 @@ typedef int (*ParserFun)(char *, Event *);
|
|||||||
//int AnalyzeCommand(char * szCommand, Event * Evt);
|
//int AnalyzeCommand(char * szCommand, Event * Evt);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : Make_Socket_NoBlocking
|
* Function : Make_Socket_NoBlocking
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN int sock: socket
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN int sock: socket
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function to make ssdp socket non-blocking.
|
* This function to make ssdp socket non-blocking.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
@@ -198,12 +198,12 @@ typedef int (*ParserFun)(char *, Event *);
|
|||||||
int Make_Socket_NoBlocking (int sock);
|
int Make_Socket_NoBlocking (int sock);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_handle_device_request
|
* Function : ssdp_handle_device_request
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN void *data:
|
* IN void *data:
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function handles the search request. It do the sanity checks of
|
* This function handles the search request. It do the sanity checks of
|
||||||
* the request and then schedules a thread to send a random time reply (
|
* the request and then schedules a thread to send a random time reply (
|
||||||
* random within maximum time given by the control point to reply).
|
* random within maximum time given by the control point to reply).
|
||||||
@@ -211,29 +211,22 @@ int Make_Socket_NoBlocking (int sock);
|
|||||||
* Returns: void *
|
* Returns: void *
|
||||||
* 1 if successful else appropriate error
|
* 1 if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
void ssdp_handle_device_request( IN http_message_t* hmsg,
|
||||||
void ssdp_handle_device_request(
|
IN struct sockaddr_in* dest_addr );
|
||||||
IN http_message_t* hmsg,
|
|
||||||
IN struct sockaddr_in* dest_addr );
|
|
||||||
#else
|
|
||||||
static inline void ssdp_handle_device_request(
|
|
||||||
IN http_message_t* hmsg,
|
|
||||||
IN struct sockaddr_in* dest_addr ) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_handle_ctrlpt_msg
|
* Function : ssdp_handle_ctrlpt_msg
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN http_message_t* hmsg: SSDP message from the device
|
* IN http_message_t* hmsg: SSDP message from the device
|
||||||
* IN struct sockaddr_in* dest_addr: Address of the device
|
* IN struct sockaddr_in* dest_addr: Address of the device
|
||||||
* IN xboolean timeout: timeout kept by the control point while sending
|
* IN xboolean timeout: timeout kept by the control point while sending
|
||||||
* search message
|
* search message
|
||||||
* IN void* cookie: Cookie stored by the control point application.
|
* IN void* cookie: Cookie stored by the control point application.
|
||||||
* This cookie will be returned to the control point
|
* This cookie will be returned to the control point
|
||||||
* in the callback
|
* in the callback
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function handles the ssdp messages from the devices. These
|
* This function handles the ssdp messages from the devices. These
|
||||||
* messages includes the search replies, advertisement of device coming
|
* messages includes the search replies, advertisement of device coming
|
||||||
* alive and bye byes.
|
* alive and bye byes.
|
||||||
@@ -241,21 +234,20 @@ static inline void ssdp_handle_device_request(
|
|||||||
* Returns: void
|
* Returns: void
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ssdp_handle_ctrlpt_msg(
|
void ssdp_handle_ctrlpt_msg( IN http_message_t* hmsg,
|
||||||
IN http_message_t* hmsg,
|
IN struct sockaddr_in* dest_addr,
|
||||||
IN struct sockaddr_in* dest_addr,
|
IN xboolean timeout,
|
||||||
IN xboolean timeout,
|
IN void* cookie );
|
||||||
IN void* cookie );
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : unique_service_name
|
* Function : unique_service_name
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN char *cmd: Service Name string
|
||||||
|
* OUT SsdpEvent *Evt: The SSDP event structure partially filled
|
||||||
|
* by all the function.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN char *cmd: Service Name string
|
|
||||||
* OUT SsdpEvent *Evt: The SSDP event structure partially filled
|
|
||||||
* by all the function.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function fills the fields of the event structure like DeviceType,
|
* This function fills the fields of the event structure like DeviceType,
|
||||||
* Device UDN and Service Type
|
* Device UDN and Service Type
|
||||||
*
|
*
|
||||||
@@ -266,12 +258,12 @@ int unique_service_name(char * cmd, SsdpEvent * Evt);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : get_ssdp_sockets
|
* Function : get_ssdp_sockets
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* OUT MiniServerSockArray *out: Arrays of SSDP sockets
|
* OUT MiniServerSockArray *out: Arrays of SSDP sockets
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the ssdp sockets. It set their option to listen
|
* This function creates the ssdp sockets. It set their option to listen
|
||||||
* for multicast traffic.
|
* for multicast traffic.
|
||||||
*
|
*
|
||||||
@@ -282,12 +274,12 @@ int get_ssdp_sockets(MiniServerSockArray *out);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : readFromSSDPSocket
|
* Function : readFromSSDPSocket
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN SOCKET socket: SSDP socket
|
* IN SOCKET socket: SSDP socket
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function reads the data from the ssdp socket.
|
* This function reads the data from the ssdp socket.
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
@@ -297,13 +289,13 @@ void readFromSSDPSocket(SOCKET socket);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_request_type1
|
* Function : ssdp_request_type1
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *cmd: command came in the ssdp request
|
* IN char *cmd: command came in the ssdp request
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function figures out the type of the SSDP search in the
|
* This function figures out the type of the SSDP search in the
|
||||||
* in the request.
|
* in the request.
|
||||||
*
|
*
|
||||||
* Returns: enum SsdpSearchType
|
* Returns: enum SsdpSearchType
|
||||||
@@ -313,14 +305,14 @@ enum SsdpSearchType ssdp_request_type1(IN char *cmd);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_request_type
|
* Function : ssdp_request_type
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *cmd: command came in the ssdp request
|
* IN char *cmd: command came in the ssdp request
|
||||||
* OUT SsdpEvent *Evt: The event structure partially filled by
|
* OUT SsdpEvent *Evt: The event structure partially filled by
|
||||||
* this function.
|
* this function.
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function starts filling the SSDP event structure based upon the
|
* This function starts filling the SSDP event structure based upon the
|
||||||
* request received.
|
* request received.
|
||||||
*
|
*
|
||||||
@@ -331,15 +323,17 @@ int ssdp_request_type(IN char * cmd, OUT SsdpEvent * Evt);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SearchByTarget
|
* Function : SearchByTarget
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN int Mx:Number of seconds to wait, to collect all the
|
||||||
|
* responses.
|
||||||
|
* char *St: Search target.
|
||||||
|
* void *Cookie: cookie provided by control point application. This
|
||||||
|
* cokie will be returned to application in the
|
||||||
|
* callback.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN int Mx:Number of seconds to wait, to collect all the responses.
|
|
||||||
* char *St: Search target.
|
|
||||||
* void *Cookie: cookie provided by control point application. This
|
|
||||||
* cokie will be returned to application in the callback.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function creates and send the search request for a specific URL.
|
* This function creates and send the search request for a specific URL.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
@@ -348,224 +342,214 @@ int ssdp_request_type(IN char * cmd, OUT SsdpEvent * Evt);
|
|||||||
int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceAdvertisement
|
* Function : DeviceAdvertisement
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN char * DevType : type of the device
|
||||||
|
* IN int RootDev: flag to indicate if the device is root device
|
||||||
|
* IN char * nt : value of NT
|
||||||
|
* IN char * usn :
|
||||||
|
* IN char * location :Location URL.
|
||||||
|
* IN int duration :Service duration in sec.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN char *DevType : type of the device
|
* This function creates the device advertisement request based on
|
||||||
* IN int RootDev : flag to indicate if the device is root device
|
|
||||||
* IN char *Udn :
|
|
||||||
* IN char *Location: Location URL.
|
|
||||||
* IN int Duration : Service duration in sec.
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function creates the device advertisement request based on
|
|
||||||
* the input parameter, and send it to the multicast channel.
|
* the input parameter, and send it to the multicast channel.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceAdvertisement(
|
int DeviceAdvertisement(IN char * DevType, int RootDev,char * Udn,
|
||||||
IN char *DevType,
|
IN char * Location, IN int Duration);
|
||||||
IN int RootDev,
|
|
||||||
IN char *Udn,
|
|
||||||
IN char *Location,
|
|
||||||
IN int Duration);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceShutdown
|
* Function : DeviceShutdown
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *DevType: Device Type.
|
* IN char *DevType: Device Type.
|
||||||
* IN int RootDev:1 means root device.
|
* IN int RootDev:1 means root device.
|
||||||
* IN char *Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *_Server:
|
* IN char *_Server:
|
||||||
* IN char *Location: Location URL
|
* IN char * Location: Location URL
|
||||||
* IN int Duration :Device duration in sec.
|
* IN int Duration :Device duration in sec.
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates a HTTP device shutdown request packet
|
* This function creates a HTTP device shutdown request packet
|
||||||
* and sent it to the multicast channel through RequestHandler.
|
* and sent it to the multicast channel through RequestHandler.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceShutdown(
|
int DeviceShutdown( IN char * DevType,
|
||||||
IN char *DevType,
|
IN int RootDev,
|
||||||
IN int RootDev,
|
IN char * Udn,
|
||||||
IN char *Udn,
|
IN char * _Server,
|
||||||
IN char *_Server,
|
IN char * Location,
|
||||||
IN char *Location,
|
IN int Duration );
|
||||||
IN int Duration);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceReply
|
* Function : DeviceReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr_in * DestAddr:destination IP address.
|
* IN struct sockaddr_in * DestAddr:destination IP address.
|
||||||
* IN char *DevType: Device type
|
* IN char *DevType: Device type
|
||||||
* IN int RootDev: 1 means root device 0 means embedded device.
|
* IN int RootDev: 1 means root device 0 means embedded device.
|
||||||
* IN char *Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the reply packet based on the input parameter,
|
* This function creates the reply packet based on the input parameter,
|
||||||
* and send it to the client address given in its input parameter DestAddr.
|
* and send it to the client address given in its input parameter DestAddr.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceReply(
|
int DeviceReply(IN struct sockaddr_in * DestAddr,
|
||||||
IN struct sockaddr_in * DestAddr,
|
IN char *DevType,
|
||||||
IN char *DevType,
|
IN int RootDev,
|
||||||
IN int RootDev,
|
IN char * Udn,
|
||||||
IN char *Udn,
|
IN char * Location, IN int Duration);
|
||||||
IN char *Location, IN int Duration);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SendReply
|
* Function : SendReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr_in * DestAddr:destination IP address.
|
* IN struct sockaddr_in * DestAddr:destination IP address.
|
||||||
* IN char *DevType: Device type
|
* IN char *DevType: Device type
|
||||||
* IN int RootDev: 1 means root device 0 means embedded device.
|
* IN int RootDev: 1 means root device 0 means embedded device.
|
||||||
* IN char * Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *_Server:
|
* IN char *_Server:
|
||||||
* IN char *Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
* IN int ByType:
|
* IN int ByType:
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the reply packet based on the input parameter,
|
* This function creates the reply packet based on the input parameter,
|
||||||
* and send it to the client addesss given in its input parameter DestAddr.
|
* and send it to the client addesss given in its input parameter DestAddr.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int SendReply(
|
int SendReply(IN struct sockaddr_in * DestAddr,
|
||||||
IN struct sockaddr_in * DestAddr,
|
IN char *DevType,
|
||||||
IN char *DevType,
|
IN int RootDev,
|
||||||
IN int RootDev,
|
IN char * Udn,
|
||||||
IN char *Udn,
|
IN char * Location,
|
||||||
IN char *Location,
|
IN int Duration,
|
||||||
IN int Duration,
|
IN int ByType );
|
||||||
IN int ByType );
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceAdvertisement
|
* Function : ServiceAdvertisement
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char * Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the advertisement packet based
|
* This function creates the advertisement packet based
|
||||||
* on the input parameter, and send it to the multicast channel.
|
* on the input parameter, and send it to the multicast channel.
|
||||||
|
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceAdvertisement(
|
int ServiceAdvertisement( IN char * Udn,
|
||||||
IN char *Udn,
|
IN char * ServType,
|
||||||
IN char *ServType,
|
IN char * Location,
|
||||||
IN char *Location,
|
IN int Duration);
|
||||||
IN int Duration);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceReply
|
* Function : ServiceReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr_in *DestAddr:
|
* IN struct sockaddr_in *DestAddr:
|
||||||
* IN char *Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char *Server: Not used
|
* IN char *Server: Not used
|
||||||
* IN char *Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the advertisement packet based
|
* This function creates the advertisement packet based
|
||||||
* on the input parameter, and send it to the multicast channel.
|
* on the input parameter, and send it to the multicast channel.
|
||||||
|
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceReply(
|
int ServiceReply(IN struct sockaddr_in *DestAddr,
|
||||||
IN struct sockaddr_in *DestAddr,
|
IN char * ServType,
|
||||||
IN char *ServType,
|
IN char * Udn,
|
||||||
IN char *Udn,
|
IN char * Location,
|
||||||
IN char *Location,
|
IN int Duration);
|
||||||
IN int Duration);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceShutdown
|
* Function : ServiceShutdown
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char *Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Service duration in sec.
|
* IN int Duration :Service duration in sec.
|
||||||
*
|
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates a HTTP service shutdown request packet
|
* This function creates a HTTP service shutdown request packet
|
||||||
* and sent it to the multicast channel through RequestHandler.
|
* and sent it to the multicast channel through RequestHandler.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceShutdown(
|
int ServiceShutdown( IN char * Udn, IN char * ServType,
|
||||||
IN char *Udn,
|
IN char * Location,
|
||||||
IN char *ServType,
|
IN int Duration);
|
||||||
IN char *Location,
|
|
||||||
IN int Duration);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : advertiseAndReplyThread
|
* Function : advertiseAndReplyThread
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN void *data: Structure containing the search request
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN void *data: Structure containing the search request
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function is a wrapper function to reply the search request
|
* This function is a wrapper function to reply the search request
|
||||||
* coming from the control point.
|
* coming from the control point.
|
||||||
*
|
*
|
||||||
* Returns: void *
|
* Returns: void *
|
||||||
* always return NULL
|
* always return NULL
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void *advertiseAndReplyThread(IN void * data);
|
void * advertiseAndReplyThread(IN void * data);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : AdvertiseAndReply
|
* Function : AdvertiseAndReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN int AdFlag: -1 = Send shutdown,
|
* IN int AdFlag: -1 = Send shutdown, 0 = send reply,
|
||||||
* 0 = send reply,
|
* 1 = Send Advertisement
|
||||||
* 1 = Send Advertisement
|
|
||||||
* IN UpnpDevice_Handle Hnd: Device handle
|
* IN UpnpDevice_Handle Hnd: Device handle
|
||||||
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
||||||
* IN struct sockaddr_in *DestAddr:Destination address
|
* IN struct sockaddr_in *DestAddr:Destination address
|
||||||
* IN char *DeviceType:Device type
|
* IN char *DeviceType:Device type
|
||||||
* IN char *DeviceUDN:Device UDN
|
* IN char *DeviceUDN:Device UDN
|
||||||
* IN char *ServiceType:Service type
|
* IN char *ServiceType:Service type
|
||||||
* IN int Exp:Advertisement age
|
* IN int Exp:Advertisement age
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function to send SSDP advertisements, replies and shutdown messages.
|
* This function to send SSDP advertisements, replies and shutdown messages.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int AdvertiseAndReply(
|
int AdvertiseAndReply(IN int AdFlag,
|
||||||
IN int AdFlag,
|
IN UpnpDevice_Handle Hnd,
|
||||||
IN UpnpDevice_Handle Hnd,
|
IN enum SsdpSearchType SearchType,
|
||||||
IN enum SsdpSearchType SearchType,
|
IN struct sockaddr_in *DestAddr,
|
||||||
IN struct sockaddr_in *DestAddr,
|
IN char *DeviceType,
|
||||||
IN char *DeviceType,
|
IN char *DeviceUDN,
|
||||||
IN char *DeviceUDN,
|
IN char *ServiceType, int Exp);
|
||||||
IN char *ServiceType, int Exp);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -36,11 +36,12 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#else
|
#else
|
||||||
typedef int socklen_t;
|
#define XINLINE
|
||||||
#define EAFNOSUPPORT 97
|
|
||||||
|
typedef int socklen_t;
|
||||||
|
#define EAFNOSUPPORT 97
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // GENLIB_NET_UNIXUTIL_H
|
#endif // GENLIB_NET_UNIXUTIL_H
|
||||||
|
|
||||||
|
@@ -71,46 +71,33 @@ struct Handle_Info
|
|||||||
Upnp_FunPtr Callback; // Callback function pointer.
|
Upnp_FunPtr Callback; // Callback function pointer.
|
||||||
char * Cookie;
|
char * Cookie;
|
||||||
|
|
||||||
// Device Only
|
DEVICEONLY(char DescURL[LINE_SIZE];) // URL for the use of SSDP
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
DEVICEONLY(char DescXML[LINE_SIZE];) // XML file path for device
|
||||||
char DescURL[LINE_SIZE]; // URL for the use of SSDP
|
//description
|
||||||
char DescXML[LINE_SIZE]; // XML file path for device
|
|
||||||
//description
|
|
||||||
|
|
||||||
int MaxAge; // Advertisement timeout
|
DEVICEONLY(int MaxAge;) // Advertisement timeout
|
||||||
IXML_Document *DescDocument;// Description parsed in
|
DEVICEONLY(IXML_Document *DescDocument;) // Description parsed in
|
||||||
//terms of DOM document
|
//terms of DOM document
|
||||||
IXML_NodeList *DeviceList; // List of devices in the
|
DEVICEONLY(IXML_NodeList *DeviceList;) // List of devices in the
|
||||||
//description document
|
//description document
|
||||||
IXML_NodeList *ServiceList; // List of services in the
|
DEVICEONLY(IXML_NodeList *ServiceList;) // List of services in the
|
||||||
// description document
|
// description document
|
||||||
service_table ServiceTable; //table holding subscriptions and
|
DEVICEONLY(service_table ServiceTable;) //table holding subscriptions and
|
||||||
//URL information
|
//URL information
|
||||||
int MaxSubscriptions;
|
DEVICEONLY(int MaxSubscriptions;)
|
||||||
int MaxSubscriptionTimeOut;
|
DEVICEONLY(int MaxSubscriptionTimeOut;)
|
||||||
#endif
|
|
||||||
|
|
||||||
// Client only
|
//Client only
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
CLIENTONLY(client_subscription * ClientSubList;) //client subscription list
|
||||||
client_subscription *ClientSubList; //client subscription list
|
CLIENTONLY(LinkedList SsdpSearchList;) // active ssdp searches
|
||||||
LinkedList SsdpSearchList; // active ssdp searches
|
|
||||||
#endif
|
|
||||||
int aliasInstalled; // 0 = not installed; otherwise installed
|
int aliasInstalled; // 0 = not installed; otherwise installed
|
||||||
};
|
} ;
|
||||||
|
|
||||||
extern ithread_mutex_t GlobalHndMutex;
|
extern ithread_mutex_t GlobalHndMutex;
|
||||||
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo);
|
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo);
|
||||||
|
|
||||||
#define HandleLock() \
|
#define HandleLock() DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"Trying Lock")); ithread_mutex_lock(&GlobalHndMutex); DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"LOCK"));
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying Lock"); \
|
#define HandleUnlock() DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"Trying Unlock")); ithread_mutex_unlock(&GlobalHndMutex); DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"Unlock"));
|
||||||
ithread_mutex_lock(&GlobalHndMutex); \
|
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "LOCK");
|
|
||||||
|
|
||||||
#define HandleUnlock() \
|
|
||||||
UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock"); \
|
|
||||||
ithread_mutex_unlock(&GlobalHndMutex); \
|
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlock");
|
|
||||||
|
|
||||||
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out,
|
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out,
|
||||||
struct Handle_Info **HndInfo);
|
struct Handle_Info **HndInfo);
|
||||||
Upnp_Handle_Type GetDeviceHandleInfo(int *device_handle_out,
|
Upnp_Handle_Type GetDeviceHandleInfo(int *device_handle_out,
|
||||||
@@ -124,7 +111,7 @@ extern unsigned short LOCAL_PORT;
|
|||||||
extern TimerThread gTimerThread;
|
extern TimerThread gTimerThread;
|
||||||
extern ThreadPool gRecvThreadPool;
|
extern ThreadPool gRecvThreadPool;
|
||||||
extern ThreadPool gSendThreadPool;
|
extern ThreadPool gSendThreadPool;
|
||||||
extern ThreadPool gMiniServerThreadPool;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SUBSCRIBE,
|
SUBSCRIBE,
|
||||||
@@ -176,6 +163,7 @@ void UpnpThreadDistribution(struct UpnpNonblockParam * Param);
|
|||||||
void AutoAdvertise(void *input);
|
void AutoAdvertise(void *input);
|
||||||
int getlocalhostname(char *out);
|
int getlocalhostname(char *out);
|
||||||
|
|
||||||
|
virtualDirList *pVirtualDirList;
|
||||||
extern WebServerState bWebServerState;
|
extern WebServerState bWebServerState;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -182,16 +182,13 @@ void free_URL_list(URL_list * list);
|
|||||||
* uri_type *in ; URI object
|
* uri_type *in ; URI object
|
||||||
*
|
*
|
||||||
* Description : Function useful in debugging for printing a parsed uri.
|
* Description : Function useful in debugging for printing a parsed uri.
|
||||||
|
* Compiled out with DBGONLY macro.
|
||||||
*
|
*
|
||||||
* Return : void ;
|
* Return : void ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
DBGONLY(void print_uri( uri_type *in);)
|
||||||
void print_uri(uri_type *in);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void print_uri(uri_type *in) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : print_token
|
* Function : print_token
|
||||||
@@ -200,16 +197,13 @@ static UPNP_INLINE void print_uri(uri_type *in) {}
|
|||||||
* token * in ;
|
* token * in ;
|
||||||
*
|
*
|
||||||
* Description : Function useful in debugging for printing a token.
|
* Description : Function useful in debugging for printing a token.
|
||||||
|
* Compiled out with DBGONLY macro.
|
||||||
*
|
*
|
||||||
* Return : void ;
|
* Return : void ;
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
void print_token( token * in);
|
||||||
void print_token(token *in);
|
|
||||||
#else
|
|
||||||
static UPNP_INLINE void print_token(token * in) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : token_string_casecmp
|
* Function : token_string_casecmp
|
||||||
|
@@ -47,6 +47,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NO_DEBUG
|
||||||
|
#define DBG(x)
|
||||||
|
#else
|
||||||
|
#define DBG(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
#define GEMD_OUT_OF_MEMORY -1
|
#define GEMD_OUT_OF_MEMORY -1
|
||||||
#define EVENT_TIMEDOUT -2
|
#define EVENT_TIMEDOUT -2
|
||||||
#define EVENT_TERMINATE -3
|
#define EVENT_TERMINATE -3
|
||||||
@@ -136,28 +142,31 @@ void linecopylen( OUT char dest[LINE_SIZE], IN const char* src, IN size_t srclen
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
|
|
||||||
// C specific
|
// C specific
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifndef WIN32
|
||||||
#ifndef S_ISREG
|
#define XINLINE inline
|
||||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
#else
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef S_ISDIR
|
#ifndef S_ISREG
|
||||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef S_ISDIR
|
||||||
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EADDRINUSE WSAEADDRINUSE
|
#define EADDRINUSE WSAEADDRINUSE
|
||||||
|
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
|
|
||||||
#define sleep(a) Sleep((a)*1000)
|
#define sleep(a) Sleep((a)*1000)
|
||||||
#define usleep(a) Sleep((a)/1000)
|
#define usleep(a) Sleep((a)/1000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif /* GENLIB_UTIL_UTIL_H */
|
#endif /* GENLIB_UTIL_UTIL_H */
|
||||||
|
|
||||||
|
@@ -244,7 +244,7 @@ get_node_value( IN IXML_Node * node )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
get_host_and_path( IN char *ctrl_url,
|
get_host_and_path( IN char *ctrl_url,
|
||||||
OUT const memptr *host,
|
OUT const memptr *host,
|
||||||
OUT const memptr *path,
|
OUT const memptr *path,
|
||||||
@@ -277,7 +277,7 @@ get_host_and_path( IN char *ctrl_url,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
get_action_name( IN char *action,
|
get_action_name( IN char *action,
|
||||||
OUT memptr * name )
|
OUT memptr * name )
|
||||||
{
|
{
|
||||||
@@ -303,7 +303,7 @@ get_action_name( IN char *action,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
add_man_header( INOUT membuffer * headers )
|
add_man_header( INOUT membuffer * headers )
|
||||||
{
|
{
|
||||||
char *soap_action_hdr;
|
char *soap_action_hdr;
|
||||||
@@ -611,18 +611,19 @@ SoapSendAction( IN char *action_url,
|
|||||||
char *xml_end =
|
char *xml_end =
|
||||||
"</s:Body>\r\n"
|
"</s:Body>\r\n"
|
||||||
"</s:Envelope>\r\n\r\n";
|
"</s:Envelope>\r\n\r\n";
|
||||||
size_t xml_start_len;
|
int xml_start_len;
|
||||||
size_t xml_end_len;
|
int xml_end_len;
|
||||||
size_t action_str_len;
|
int action_str_len;
|
||||||
|
|
||||||
*response_node = NULL; // init
|
*response_node = NULL; // init
|
||||||
|
|
||||||
err_code = UPNP_E_OUTOF_MEMORY; // default error
|
err_code = UPNP_E_OUTOF_MEMORY; // default error
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Inside SoapSendAction():" );
|
"Inside SoapSendAction():" );
|
||||||
// init
|
)
|
||||||
membuffer_init( &request );
|
// init
|
||||||
|
membuffer_init( &request );
|
||||||
membuffer_init( &responsename );
|
membuffer_init( &responsename );
|
||||||
|
|
||||||
// print action
|
// print action
|
||||||
@@ -641,12 +642,11 @@ SoapSendAction( IN char *action_url,
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"path=%.*s, hostport=%.*s\n",
|
"path=%.*s, hostport=%.*s\n",
|
||||||
(int)url.pathquery.size,
|
url.pathquery.size, url.pathquery.buff,
|
||||||
url.pathquery.buff,
|
url.hostport.text.size,
|
||||||
(int)url.hostport.text.size,
|
url.hostport.text.buff ); )
|
||||||
url.hostport.text.buff );
|
|
||||||
|
|
||||||
xml_start_len = strlen( xml_start );
|
xml_start_len = strlen( xml_start );
|
||||||
xml_end_len = strlen( xml_end );
|
xml_end_len = strlen( xml_end );
|
||||||
@@ -693,7 +693,7 @@ SoapSendAction( IN char *action_url,
|
|||||||
err_code = ret_code;
|
err_code = ret_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_handler:
|
error_handler:
|
||||||
ixmlFreeDOMString( action_str );
|
ixmlFreeDOMString( action_str );
|
||||||
membuffer_destroy( &request );
|
membuffer_destroy( &request );
|
||||||
membuffer_destroy( &responsename );
|
membuffer_destroy( &responsename );
|
||||||
@@ -757,23 +757,24 @@ SoapSendActionEx( IN char *action_url,
|
|||||||
char *xml_end =
|
char *xml_end =
|
||||||
"</s:Body>\r\n"
|
"</s:Body>\r\n"
|
||||||
"</s:Envelope>\r\n";
|
"</s:Envelope>\r\n";
|
||||||
size_t xml_start_len;
|
int xml_start_len;
|
||||||
size_t xml_header_start_len;
|
int xml_header_start_len;
|
||||||
size_t xml_header_str_len;
|
int xml_header_str_len;
|
||||||
size_t xml_header_end_len;
|
int xml_header_end_len;
|
||||||
size_t xml_body_start_len;
|
int xml_body_start_len;
|
||||||
size_t action_str_len;
|
int action_str_len;
|
||||||
size_t xml_end_len;
|
int xml_end_len;
|
||||||
off_t content_length;
|
off_t content_length;
|
||||||
|
|
||||||
*response_node = NULL; // init
|
*response_node = NULL; // init
|
||||||
|
|
||||||
err_code = UPNP_E_OUTOF_MEMORY; // default error
|
err_code = UPNP_E_OUTOF_MEMORY; // default error
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Inside SoapSendActionEx():" );
|
"Inside SoapSendActionEx():" );
|
||||||
// init
|
)
|
||||||
membuffer_init( &request );
|
// init
|
||||||
|
membuffer_init( &request );
|
||||||
membuffer_init( &responsename );
|
membuffer_init( &responsename );
|
||||||
|
|
||||||
// header string
|
// header string
|
||||||
@@ -797,12 +798,11 @@ SoapSendActionEx( IN char *action_url,
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"path=%.*s, hostport=%.*s\n",
|
"path=%.*s, hostport=%.*s\n",
|
||||||
(int)url.pathquery.size,
|
url.pathquery.size, url.pathquery.buff,
|
||||||
url.pathquery.buff,
|
url.hostport.text.size,
|
||||||
(int)url.hostport.text.size,
|
url.hostport.text.buff ); )
|
||||||
url.hostport.text.buff );
|
|
||||||
|
|
||||||
xml_start_len = strlen( xml_start );
|
xml_start_len = strlen( xml_start );
|
||||||
xml_body_start_len = strlen( xml_body_start );
|
xml_body_start_len = strlen( xml_body_start );
|
||||||
@@ -821,7 +821,7 @@ SoapSendActionEx( IN char *action_url,
|
|||||||
xml_body_start_len + action_str_len + xml_end_len;
|
xml_body_start_len + action_str_len + xml_end_len;
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
&request, 1, 1,
|
&request, 1, 1,
|
||||||
"q" "N" "s" "sssbsc" "Uc" "b" "b" "b" "b" "b" "b" "b",
|
"q" "N" "s" "sssbsc" "Uc" "bbbbbbb",
|
||||||
SOAPMETHOD_POST, &url,
|
SOAPMETHOD_POST, &url,
|
||||||
content_length,
|
content_length,
|
||||||
ContentTypeHeader,
|
ContentTypeHeader,
|
||||||
|
@@ -85,7 +85,7 @@ const char *ContentTypeHeader =
|
|||||||
* 0 if successful else returns appropriate error.
|
* 0 if successful else returns appropriate error.
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
get_request_type( IN http_message_t * request,
|
get_request_type( IN http_message_t * request,
|
||||||
OUT memptr * action_name )
|
OUT memptr * action_name )
|
||||||
{
|
{
|
||||||
@@ -262,7 +262,7 @@ send_error_response( IN SOCKINFO * info,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
send_var_query_response( IN SOCKINFO * info,
|
send_var_query_response( IN SOCKINFO * info,
|
||||||
IN const char *var_value,
|
IN const char *var_value,
|
||||||
IN http_message_t * hmsg )
|
IN http_message_t * hmsg )
|
||||||
@@ -326,12 +326,12 @@ send_var_query_response( IN SOCKINFO * info,
|
|||||||
* Description : This function separates the action node from
|
* Description : This function separates the action node from
|
||||||
* the root DOM node.
|
* the root DOM node.
|
||||||
*
|
*
|
||||||
* Return : static UPNP_INLINE int
|
* Return : static XINLINE int
|
||||||
* 0 if successful, or -1 if fails.
|
* 0 if successful, or -1 if fails.
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
get_action_node( IN IXML_Document * TempDoc,
|
get_action_node( IN IXML_Document * TempDoc,
|
||||||
IN char *NodeName,
|
IN char *NodeName,
|
||||||
OUT IXML_Document ** RespNode )
|
OUT IXML_Document ** RespNode )
|
||||||
@@ -344,10 +344,11 @@ get_action_node( IN IXML_Document * TempDoc,
|
|||||||
int ret_code = -1; // error, by default
|
int ret_code = -1; // error, by default
|
||||||
IXML_NodeList *nl = NULL;
|
IXML_NodeList *nl = NULL;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"get_action_node(): node name =%s\n ", NodeName );
|
"get_action_node(): node name =%s\n ", NodeName );
|
||||||
|
)
|
||||||
|
|
||||||
*RespNode = NULL;
|
* RespNode = NULL;
|
||||||
|
|
||||||
// Got the Envelope node here
|
// Got the Envelope node here
|
||||||
EnvpNode = ixmlNode_getFirstChild( ( IXML_Node * ) TempDoc );
|
EnvpNode = ixmlNode_getFirstChild( ( IXML_Node * ) TempDoc );
|
||||||
@@ -681,7 +682,7 @@ get_device_info( IN http_message_t * request,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
send_action_response( IN SOCKINFO * info,
|
send_action_response( IN SOCKINFO * info,
|
||||||
IN IXML_Document * action_resp,
|
IN IXML_Document * action_resp,
|
||||||
IN http_message_t * request )
|
IN http_message_t * request )
|
||||||
@@ -737,15 +738,15 @@ send_action_response( IN SOCKINFO * info,
|
|||||||
xml_response, strlen( xml_response ),
|
xml_response, strlen( xml_response ),
|
||||||
end_body, strlen( end_body ) );
|
end_body, strlen( end_body ) );
|
||||||
|
|
||||||
if( ret_code != 0 ) {
|
DBGONLY( if( ret_code != 0 ) {
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Failed to send response: err code = %d\n",
|
"Failed to send response: err code = %d\n",
|
||||||
ret_code );
|
ret_code );}
|
||||||
}
|
)
|
||||||
|
|
||||||
err_code = 0;
|
err_code = 0;
|
||||||
|
|
||||||
error_handler:
|
error_handler:
|
||||||
ixmlFreeDOMString( xml_response );
|
ixmlFreeDOMString( xml_response );
|
||||||
membuffer_destroy( &headers );
|
membuffer_destroy( &headers );
|
||||||
if( err_code != 0 ) {
|
if( err_code != 0 ) {
|
||||||
@@ -769,7 +770,7 @@ error_handler:
|
|||||||
* returns 0 if successful else returns -1.
|
* returns 0 if successful else returns -1.
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
get_var_name( IN IXML_Document * TempDoc,
|
get_var_name( IN IXML_Document * TempDoc,
|
||||||
OUT char *VarName )
|
OUT char *VarName )
|
||||||
{
|
{
|
||||||
@@ -813,13 +814,14 @@ get_var_name( IN IXML_Document * TempDoc,
|
|||||||
Temp = ixmlNode_getNodeValue( VarNode );
|
Temp = ixmlNode_getNodeValue( VarNode );
|
||||||
linecopy( VarName, Temp );
|
linecopy( VarName, Temp );
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Received query for variable name %s\n",
|
"Received query for variable name %s\n",
|
||||||
VarName );
|
VarName );
|
||||||
|
)
|
||||||
|
|
||||||
ret_val = 0; // success
|
ret_val = 0; // success
|
||||||
|
|
||||||
error_handler:
|
error_handler:
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,7 +842,7 @@ error_handler:
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
handle_query_variable( IN SOCKINFO * info,
|
handle_query_variable( IN SOCKINFO * info,
|
||||||
IN http_message_t * request,
|
IN http_message_t * request,
|
||||||
IN IXML_Document * xml_doc )
|
IN IXML_Document * xml_doc )
|
||||||
@@ -876,8 +878,8 @@ handle_query_variable( IN SOCKINFO * info,
|
|||||||
// send event
|
// send event
|
||||||
soap_event_callback( UPNP_CONTROL_GET_VAR_REQUEST, &variable, cookie );
|
soap_event_callback( UPNP_CONTROL_GET_VAR_REQUEST, &variable, cookie );
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Return from callback for var request\n" );
|
"Return from callback for var request\n" ) );
|
||||||
|
|
||||||
// validate, and handle result
|
// validate, and handle result
|
||||||
if( variable.CurrentVal == NULL ) {
|
if( variable.CurrentVal == NULL ) {
|
||||||
@@ -966,8 +968,8 @@ handle_invoke_action( IN SOCKINFO * info,
|
|||||||
action.ErrCode = UPNP_E_SUCCESS;
|
action.ErrCode = UPNP_E_SUCCESS;
|
||||||
action.CtrlPtIPAddr = info->foreign_ip_addr;
|
action.CtrlPtIPAddr = info->foreign_ip_addr;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Calling Callback\n" );
|
"Calling Callback\n" ) );
|
||||||
|
|
||||||
soap_event_callback( UPNP_CONTROL_ACTION_REQUEST, &action, cookie );
|
soap_event_callback( UPNP_CONTROL_ACTION_REQUEST, &action, cookie );
|
||||||
|
|
||||||
|
@@ -55,12 +55,12 @@
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : send_search_result
|
* Function : send_search_result
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN void *data: Search reply from the device
|
* IN void *data: Search reply from the device
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function sends a callback to the control point application with
|
* This function sends a callback to the control point application with
|
||||||
* a SEARCH result
|
* a SEARCH result
|
||||||
*
|
*
|
||||||
@@ -125,16 +125,16 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
|
|
||||||
// we are assuming that there can be only one client supported at a time
|
// we are assuming that there can be only one client supported at a time
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// copy
|
// copy
|
||||||
ctrlpt_callback = ctrlpt_info->Callback;
|
ctrlpt_callback = ctrlpt_info->Callback;
|
||||||
ctrlpt_cookie = ctrlpt_info->Cookie;
|
ctrlpt_cookie = ctrlpt_info->Cookie;
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
// search timeout
|
// search timeout
|
||||||
if( timeout ) {
|
if( timeout ) {
|
||||||
@@ -159,7 +159,7 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dest addr
|
// dest addr
|
||||||
memcpy(¶m.DestAddr, dest_addr, sizeof(struct sockaddr_in) );
|
param.DestAddr = dest_addr;
|
||||||
|
|
||||||
// EXT
|
// EXT
|
||||||
param.Ext[0] = '\0';
|
param.Ext[0] = '\0';
|
||||||
@@ -267,22 +267,22 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
strlen( param.Location ) == 0 || !usn_found || !st_found ) {
|
strlen( param.Location ) == 0 || !usn_found || !st_found ) {
|
||||||
return; // bad reply
|
return; // bad reply
|
||||||
}
|
}
|
||||||
// check each current search
|
//check each current search
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = ListHead( &ctrlpt_info->SsdpSearchList );
|
node = ListHead( &ctrlpt_info->SsdpSearchList );
|
||||||
|
|
||||||
// temporary add null termination
|
//temporary add null termination
|
||||||
//save_char = hdr_value.buf[ hdr_value.length ];
|
//save_char = hdr_value.buf[ hdr_value.length ];
|
||||||
//hdr_value.buf[ hdr_value.length ] = '\0';
|
//hdr_value.buf[ hdr_value.length ] = '\0';
|
||||||
|
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
searchArg = node->item;
|
searchArg = node->item;
|
||||||
matched = 0;
|
matched = 0;
|
||||||
// check for match of ST header and search target
|
//check for match of ST header and search target
|
||||||
switch ( searchArg->requestType ) {
|
switch ( searchArg->requestType ) {
|
||||||
case SSDP_ALL:
|
case SSDP_ALL:
|
||||||
{
|
{
|
||||||
@@ -327,7 +327,7 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( matched ) {
|
if( matched ) {
|
||||||
// schedule call back
|
//schedule call back
|
||||||
threadData =
|
threadData =
|
||||||
( ResultData * ) malloc( sizeof( ResultData ) );
|
( ResultData * ) malloc( sizeof( ResultData ) );
|
||||||
if( threadData != NULL ) {
|
if( threadData != NULL ) {
|
||||||
@@ -344,30 +344,28 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
//ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, ¶m, cookie );
|
//ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, ¶m, cookie );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : process_reply
|
* Function : process_reply
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN char* request_buf: the response came from the device
|
||||||
|
* IN int buf_len: The length of the response buffer
|
||||||
|
* IN struct sockaddr_in* dest_addr: The address of the device
|
||||||
|
* IN void *cookie : cookie passed by the control point application
|
||||||
|
* at the time of sending search message
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN char* request_buf: the response came from the device
|
|
||||||
* IN int buf_len: The length of the response buffer
|
|
||||||
* IN struct sockaddr_in* dest_addr: The address of the device
|
|
||||||
* IN void *cookie : cookie passed by the control point application
|
|
||||||
* at the time of sending search message
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function processes reply recevied from a search
|
* This function processes reply recevied from a search
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#warning There are currently no uses of the function 'process_reply()' in the code.
|
static XINLINE void
|
||||||
#warning 'process_reply()' is a candidate for removal.
|
|
||||||
static UPNP_INLINE void
|
|
||||||
process_reply( IN char *request_buf,
|
process_reply( IN char *request_buf,
|
||||||
IN int buf_len,
|
IN int buf_len,
|
||||||
IN struct sockaddr_in *dest_addr,
|
IN struct sockaddr_in *dest_addr,
|
||||||
@@ -390,17 +388,17 @@ process_reply( IN char *request_buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : CreateClientRequestPacket
|
* Function : CreateClientRequestPacket
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN char * RqstBuf:Output string in HTTP format.
|
||||||
|
* IN char *SearchTarget:Search Target
|
||||||
|
* IN int Mx dest_addr: Number of seconds to wait to
|
||||||
|
* collect all the responses
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN char * RqstBuf:Output string in HTTP format.
|
|
||||||
* IN char *SearchTarget:Search Target
|
|
||||||
* IN int Mx dest_addr: Number of seconds to wait to
|
|
||||||
* collect all the responses
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function creates a HTTP search request packet
|
* This function creates a HTTP search request packet
|
||||||
* depending on the input parameter.
|
* depending on the input parameter.
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
*
|
*
|
||||||
@@ -432,12 +430,12 @@ CreateClientRequestPacket( IN char *RqstBuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : searchExpired
|
* Function : searchExpired
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN void * arg:
|
* IN void * arg:
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function
|
* This function
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
@@ -458,13 +456,13 @@ searchExpired( void *arg )
|
|||||||
void *cookie = NULL;
|
void *cookie = NULL;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
|
|
||||||
//remove search target from search list
|
//remove search target from search list
|
||||||
|
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
free( id );
|
free( id );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,7 +483,7 @@ searchExpired( void *arg )
|
|||||||
}
|
}
|
||||||
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
||||||
}
|
}
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
if( found ) {
|
if( found ) {
|
||||||
ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie );
|
ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie );
|
||||||
@@ -538,10 +536,11 @@ SearchByTarget( IN int Mx,
|
|||||||
if( ReqBuf == NULL )
|
if( ReqBuf == NULL )
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
">>> SSDP SEND >>>\n%s\n", ReqBuf );
|
">>> SSDP SEND >>>\n%s\n", ReqBuf );
|
||||||
|
)
|
||||||
|
|
||||||
timeTillRead = Mx;
|
timeTillRead = Mx;
|
||||||
|
|
||||||
if( timeTillRead < MIN_SEARCH_TIME ) {
|
if( timeTillRead < MIN_SEARCH_TIME ) {
|
||||||
timeTillRead = MIN_SEARCH_TIME;
|
timeTillRead = MIN_SEARCH_TIME;
|
||||||
@@ -560,9 +559,9 @@ SearchByTarget( IN int Mx,
|
|||||||
FD_SET( gSsdpReqSocket, &wrSet );
|
FD_SET( gSsdpReqSocket, &wrSet );
|
||||||
|
|
||||||
//add search criteria to list
|
//add search criteria to list
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
free( ReqBuf );
|
free( ReqBuf );
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -583,30 +582,33 @@ SearchByTarget( IN int Mx,
|
|||||||
newArg->timeoutEventId = ( *id );
|
newArg->timeoutEventId = ( *id );
|
||||||
|
|
||||||
ListAddTail( &ctrlpt_info->SsdpSearchList, newArg );
|
ListAddTail( &ctrlpt_info->SsdpSearchList, newArg );
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
setsockopt( gSsdpReqSocket, IPPROTO_IP, IP_MULTICAST_IF,
|
setsockopt( gSsdpReqSocket, IPPROTO_IP, IP_MULTICAST_IF,
|
||||||
( char * )&addr, sizeof( addr ) );
|
( char * )&addr, sizeof( addr ) );
|
||||||
|
|
||||||
if( select( gSsdpReqSocket + 1, NULL, &wrSet, NULL, NULL )
|
if( select( gSsdpReqSocket + 1, NULL, &wrSet, NULL, NULL )
|
||||||
== UPNP_SOCKETERROR ) {
|
== UPNP_SOCKETERROR ) {
|
||||||
if( errno == EBADF ) {
|
DBGONLY( if( errno == EBADF ) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"SSDP_LIB :RequestHandler:An invalid file descriptor"
|
"SSDP_LIB :RequestHandler:An invalid file descriptor"
|
||||||
" was givenin one of the sets. \n" );
|
" was givenin one of the sets. \n" );}
|
||||||
} else if( errno == EINTR ) {
|
else
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
if( errno == EINTR ) {
|
||||||
"SSDP_LIB :RequestHandler: A non blocked "
|
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"signal was caught. \n" );
|
"SSDP_LIB :RequestHandler: A non blocked "
|
||||||
} else if( errno == EINVAL ) {
|
"signal was caught. \n" );}
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
else
|
||||||
"SSDP_LIB :RequestHandler: n is negative. \n" );
|
if( errno == EINVAL ) {
|
||||||
} else if( errno == ENOMEM ) {
|
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
"SSDP_LIB :RequestHandler: n is negative. \n" );}
|
||||||
"SSDP_LIB : RequestHandler:select was unable to "
|
else
|
||||||
"allocate memory for internal tables.\n" );
|
if( errno == ENOMEM ) {
|
||||||
}
|
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
shutdown( gSsdpReqSocket, SD_BOTH );
|
"SSDP_LIB : RequestHandler:select was unable to "
|
||||||
|
"allocate memory for internal tables.\n" );}
|
||||||
|
)
|
||||||
|
shutdown( gSsdpReqSocket, SD_BOTH );
|
||||||
UpnpCloseSocket( gSsdpReqSocket );
|
UpnpCloseSocket( gSsdpReqSocket );
|
||||||
free( ReqBuf );
|
free( ReqBuf );
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
|
@@ -43,22 +43,22 @@
|
|||||||
#include "unixutil.h"
|
#include "unixutil.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MSGTYPE_SHUTDOWN 0
|
#define MSGTYPE_SHUTDOWN 0
|
||||||
#define MSGTYPE_ADVERTISEMENT 1
|
#define MSGTYPE_ADVERTISEMENT 1
|
||||||
#define MSGTYPE_REPLY 2
|
#define MSGTYPE_REPLY 2
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : advertiseAndReplyThread
|
* Function : advertiseAndReplyThread
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN void *data: Structure containing the search request
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Description:
|
||||||
* IN void *data: Structure containing the search request
|
* This function is a wrapper function to reply the search request
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function is a wrapper function to reply the search request
|
|
||||||
* coming from the control point.
|
* coming from the control point.
|
||||||
*
|
*
|
||||||
* Returns: void *
|
* Returns: void *
|
||||||
@@ -81,11 +81,11 @@ advertiseAndReplyThread( IN void *data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_handle_device_request
|
* Function : ssdp_handle_device_request
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN http_message_t* hmsg: SSDP search request from the control point
|
* IN http_message_t* hmsg: SSDP search request from the control point
|
||||||
* IN struct sockaddr_in* dest_addr: The address info of control point
|
* IN struct sockaddr_in* dest_addr: The address info of control point
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function handles the search request. It do the sanity checks of
|
* This function handles the search request. It do the sanity checks of
|
||||||
@@ -95,7 +95,6 @@ advertiseAndReplyThread( IN void *data )
|
|||||||
* Returns: void *
|
* Returns: void *
|
||||||
* 1 if successful else appropriate error
|
* 1 if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
|
||||||
void
|
void
|
||||||
ssdp_handle_device_request( IN http_message_t * hmsg,
|
ssdp_handle_device_request( IN http_message_t * hmsg,
|
||||||
IN struct sockaddr_in *dest_addr )
|
IN struct sockaddr_in *dest_addr )
|
||||||
@@ -136,30 +135,30 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
|
|||||||
return; // bad ST header
|
return; // bad ST header
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
// device info
|
// device info
|
||||||
if( GetDeviceHandleInfo( &handle, &dev_info ) != HND_DEVICE ) {
|
if( GetDeviceHandleInfo( &handle, &dev_info ) != HND_DEVICE ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return; // no info found
|
return; // no info found
|
||||||
}
|
}
|
||||||
maxAge = dev_info->MaxAge;
|
maxAge = dev_info->MaxAge;
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
|
|
||||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||||
"ssdp_handle_device_request with Cmd %d SEARCH\n",
|
"ssdp_handle_device_request with Cmd %d SEARCH\n",
|
||||||
event.Cmd );
|
event.Cmd );
|
||||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||||
"MAX-AGE = %d\n", maxAge );
|
"MAX-AGE = %d\n", maxAge );
|
||||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||||
"MX = %d\n", event.Mx );
|
"MX = %d\n", event.Mx );
|
||||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||||
"DeviceType = %s\n", event.DeviceType );
|
"DeviceType = %s\n", event.DeviceType );
|
||||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||||
"DeviceUuid = %s\n", event.UDN );
|
"DeviceUuid = %s\n", event.UDN );
|
||||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||||
"ServiceType = %s\n", event.ServiceType );
|
"ServiceType = %s\n", event.ServiceType ); )
|
||||||
|
|
||||||
threadArg =
|
threadArg =
|
||||||
( SsdpSearchReply * ) malloc( sizeof( SsdpSearchReply ) );
|
( SsdpSearchReply * ) malloc( sizeof( SsdpSearchReply ) );
|
||||||
|
|
||||||
if( threadArg == NULL ) {
|
if( threadArg == NULL ) {
|
||||||
@@ -186,12 +185,11 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
|
|||||||
mx = 1;
|
mx = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
replyTime = rand() % mx;
|
replyTime = rand( ) % mx;
|
||||||
|
|
||||||
TimerThreadSchedule( &gTimerThread, replyTime, REL_SEC, &job,
|
TimerThreadSchedule( &gTimerThread, replyTime, REL_SEC, &job,
|
||||||
SHORT_TERM, NULL );
|
SHORT_TERM, NULL );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : NewRequestHandler
|
* Function : NewRequestHandler
|
||||||
@@ -222,9 +220,9 @@ NewRequestHandler( IN struct sockaddr_in *DestAddr,
|
|||||||
|
|
||||||
ReplySock = socket( AF_INET, SOCK_DGRAM, 0 );
|
ReplySock = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||||
if( ReplySock == UPNP_INVALID_SOCKET ) {
|
if( ReplySock == UPNP_INVALID_SOCKET ) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"SSDP_LIB: New Request Handler:"
|
"SSDP_LIB: New Request Handler:"
|
||||||
"Error in socket operation !!!\n" );
|
"Error in socket operation !!!\n" ) );
|
||||||
|
|
||||||
return UPNP_E_OUTOF_SOCKET;
|
return UPNP_E_OUTOF_SOCKET;
|
||||||
}
|
}
|
||||||
@@ -249,12 +247,13 @@ NewRequestHandler( IN struct sockaddr_in *DestAddr,
|
|||||||
// So, NUM_COPY has been changed from 2 to 1.
|
// So, NUM_COPY has been changed from 2 to 1.
|
||||||
NumCopy = 0;
|
NumCopy = 0;
|
||||||
while( NumCopy < NUM_COPY ) {
|
while( NumCopy < NUM_COPY ) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
">>> SSDP SEND >>>\n%s\n",
|
">>> SSDP SEND >>>\n%s\n",
|
||||||
*( RqPacket + Index ) );
|
*( RqPacket + Index ) );
|
||||||
rc = sendto( ReplySock, *( RqPacket + Index ),
|
)
|
||||||
strlen( *( RqPacket + Index ) ),
|
rc = sendto( ReplySock, *( RqPacket + Index ),
|
||||||
0, ( struct sockaddr * )DestAddr, socklen );
|
strlen( *( RqPacket + Index ) ),
|
||||||
|
0, ( struct sockaddr * )DestAddr, socklen );
|
||||||
imillisleep( SSDP_PAUSE );
|
imillisleep( SSDP_PAUSE );
|
||||||
++NumCopy;
|
++NumCopy;
|
||||||
}
|
}
|
||||||
@@ -389,10 +388,11 @@ DeviceAdvertisement( IN char *DevType,
|
|||||||
char *msgs[3];
|
char *msgs[3];
|
||||||
int ret_code;
|
int ret_code;
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"In function SendDeviceAdvertisemenrt\n" );
|
"In function SendDeviceAdvertisemenrt\n" );
|
||||||
|
)
|
||||||
|
|
||||||
DestAddr.sin_family = AF_INET;
|
DestAddr.sin_family = AF_INET;
|
||||||
DestAddr.sin_addr.s_addr = inet_addr( SSDP_IP );
|
DestAddr.sin_addr.s_addr = inet_addr( SSDP_IP );
|
||||||
DestAddr.sin_port = htons( SSDP_PORT );
|
DestAddr.sin_port = htons( SSDP_PORT );
|
||||||
|
|
||||||
@@ -783,11 +783,11 @@ DeviceShutdown( IN char *DevType,
|
|||||||
Mil_Usn, Location, Duration, &msgs[0] );
|
Mil_Usn, Location, Duration, &msgs[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"In function DeviceShutdown\n" );
|
"In function DeviceShutdown\n" ); )
|
||||||
// both root and sub-devices need to send these two messages
|
// both root and sub-devices need to send these two messages
|
||||||
CreateServicePacket( MSGTYPE_SHUTDOWN, Udn, Udn,
|
CreateServicePacket( MSGTYPE_SHUTDOWN, Udn, Udn,
|
||||||
Location, Duration, &msgs[1] );
|
Location, Duration, &msgs[1] );
|
||||||
|
|
||||||
sprintf( Mil_Usn, "%s::%s", Udn, DevType );
|
sprintf( Mil_Usn, "%s::%s", Udn, DevType );
|
||||||
CreateServicePacket( MSGTYPE_SHUTDOWN, DevType, Mil_Usn,
|
CreateServicePacket( MSGTYPE_SHUTDOWN, DevType, Mil_Usn,
|
||||||
|
@@ -91,14 +91,14 @@ CLIENTONLY( SOCKET gSsdpReqSocket = 0;
|
|||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int AdvertiseAndReply( IN int AdFlag,
|
int AdvertiseAndReply( IN int AdFlag,
|
||||||
IN UpnpDevice_Handle Hnd,
|
IN UpnpDevice_Handle Hnd,
|
||||||
IN enum SsdpSearchType SearchType,
|
IN enum SsdpSearchType SearchType,
|
||||||
IN struct sockaddr_in *DestAddr,
|
IN struct sockaddr_in *DestAddr,
|
||||||
IN char *DeviceType,
|
IN char *DeviceType,
|
||||||
IN char *DeviceUDN,
|
IN char *DeviceUDN,
|
||||||
IN char *ServiceType,
|
IN char *ServiceType,
|
||||||
int Exp )
|
int Exp )
|
||||||
{
|
{
|
||||||
int i,
|
int i,
|
||||||
j;
|
j;
|
||||||
@@ -115,14 +115,14 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
const DOMString tmpStr;
|
const DOMString tmpStr;
|
||||||
char SERVER[200];
|
char SERVER[200];
|
||||||
|
|
||||||
const DOMString dbgStr;
|
DBGONLY( const DOMString dbgStr;
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Inside AdvertiseAndReply with AdFlag = %d\n",
|
"Inside AdvertiseAndReply with AdFlag = %d\n",
|
||||||
AdFlag );
|
AdFlag ); )
|
||||||
|
|
||||||
HandleLock();
|
HandleLock( );
|
||||||
if( GetHandleInfo( Hnd, &SInfo ) != HND_DEVICE ) {
|
if( GetHandleInfo( Hnd, &SInfo ) != HND_DEVICE ) {
|
||||||
HandleUnlock();
|
HandleUnlock( );
|
||||||
return UPNP_E_INVALID_HANDLE;
|
return UPNP_E_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
defaultExp = SInfo->MaxAge;
|
defaultExp = SInfo->MaxAge;
|
||||||
@@ -139,20 +139,24 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
// parse the device list and send advertisements/replies
|
// parse the device list and send advertisements/replies
|
||||||
for( i = 0;; i++ ) {
|
for( i = 0;; i++ ) {
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Entering new device list with i = %d\n\n", i );
|
"Entering new device list with i = %d\n\n",
|
||||||
|
i );
|
||||||
|
)
|
||||||
|
|
||||||
tmpNode = ixmlNodeList_item( SInfo->DeviceList, i );
|
tmpNode = ixmlNodeList_item( SInfo->DeviceList, i );
|
||||||
if( tmpNode == NULL ) {
|
if( tmpNode == NULL ) {
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Exiting new device list with i = %d\n\n", i );
|
"Exiting new device list with i = %d\n\n",
|
||||||
break;
|
i );
|
||||||
|
)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgStr = ixmlNode_getNodeName( tmpNode );
|
DBGONLY( dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Extracting device type once for %s\n",
|
"Extracting device type once for %s\n",
|
||||||
dbgStr );
|
dbgStr ); )
|
||||||
// extract device type
|
// extract device type
|
||||||
ixmlNodeList_free( nodeList );
|
ixmlNodeList_free( nodeList );
|
||||||
nodeList = NULL;
|
nodeList = NULL;
|
||||||
@@ -163,14 +167,15 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgStr = ixmlNode_getNodeName( tmpNode );
|
DBGONLY( dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Extracting UDN for %s\n", dbgStr );
|
"Extracting UDN for %s\n", dbgStr ); )
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Extracting device type\n" );
|
"Extracting device type\n" );
|
||||||
|
)
|
||||||
|
|
||||||
tmpNode2 = ixmlNodeList_item( nodeList, 0 );
|
tmpNode2 = ixmlNodeList_item( nodeList, 0 );
|
||||||
if( tmpNode2 == NULL ) {
|
if( tmpNode2 == NULL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -179,10 +184,11 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Extracting device type \n" );
|
"Extracting device type \n" );
|
||||||
|
)
|
||||||
|
|
||||||
tmpStr = ixmlNode_getNodeValue( textNode );
|
tmpStr = ixmlNode_getNodeValue( textNode );
|
||||||
if( tmpStr == NULL ) {
|
if( tmpStr == NULL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -192,41 +198,47 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Extracting device type = %s\n", devType );
|
"Extracting device type = %s\n", devType );
|
||||||
if( tmpNode == NULL ) {
|
if( tmpNode == NULL ) {
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"TempNode is NULL\n" );
|
"TempNode is NULL\n" );}
|
||||||
}
|
dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||||
dbgStr = ixmlNode_getNodeName( tmpNode );
|
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
"Extracting UDN for %s\n", dbgStr ); )
|
||||||
"Extracting UDN for %s\n", dbgStr );
|
// extract UDN
|
||||||
// extract UDN
|
ixmlNodeList_free( nodeList );
|
||||||
ixmlNodeList_free( nodeList );
|
|
||||||
nodeList = NULL;
|
nodeList = NULL;
|
||||||
nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * )
|
nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * )
|
||||||
tmpNode, "UDN" );
|
tmpNode, "UDN" );
|
||||||
if( nodeList == NULL ) {
|
if( nodeList == NULL ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
|
||||||
__LINE__, "UDN not found!!!\n" );
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||||
|
__LINE__, "UDN not found!!!\n" );
|
||||||
|
)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmpNode2 = ixmlNodeList_item( nodeList, 0 );
|
tmpNode2 = ixmlNodeList_item( nodeList, 0 );
|
||||||
if( tmpNode2 == NULL ) {
|
if( tmpNode2 == NULL ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
|
||||||
__LINE__, "UDN not found!!!\n" );
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||||
continue;
|
__LINE__, "UDN not found!!!\n" );
|
||||||
|
)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
textNode = ixmlNode_getFirstChild( tmpNode2 );
|
textNode = ixmlNode_getFirstChild( tmpNode2 );
|
||||||
if( textNode == NULL ) {
|
if( textNode == NULL ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
|
||||||
__LINE__, "UDN not found!!!\n" );
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||||
continue;
|
__LINE__, "UDN not found!!!\n" );
|
||||||
|
)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
tmpStr = ixmlNode_getNodeValue( textNode );
|
tmpStr = ixmlNode_getNodeValue( textNode );
|
||||||
if( tmpStr == NULL ) {
|
if( tmpStr == NULL ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||||
"UDN not found!!!!\n" );
|
"UDN not found!!!!\n" );
|
||||||
|
)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strcpy( UDNstr, tmpStr );
|
strcpy( UDNstr, tmpStr );
|
||||||
@@ -234,8 +246,9 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Sending UDNStr = %s \n", UDNstr );
|
"Sending UDNStr = %s \n", UDNstr );
|
||||||
|
)
|
||||||
if( AdFlag ) {
|
if( AdFlag ) {
|
||||||
// send the device advertisement
|
// send the device advertisement
|
||||||
if( AdFlag == 1 ) {
|
if( AdFlag == 1 ) {
|
||||||
@@ -265,16 +278,22 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
{
|
{
|
||||||
if( DeviceUDN != NULL && strlen( DeviceUDN ) != 0 ) {
|
if( DeviceUDN != NULL && strlen( DeviceUDN ) != 0 ) {
|
||||||
if( strcasecmp( DeviceUDN, UDNstr ) ) {
|
if( strcasecmp( DeviceUDN, UDNstr ) ) {
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"DeviceUDN=%s and search "
|
( UPNP_INFO, API, __FILE__,
|
||||||
"UDN=%s did not match\n",
|
__LINE__,
|
||||||
UDNstr, DeviceUDN );
|
"DeviceUDN=%s and search "
|
||||||
|
"UDN=%s did not match\n",
|
||||||
|
UDNstr, DeviceUDN );
|
||||||
|
)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"DeviceUDN=%s and search "
|
( UPNP_INFO, API, __FILE__,
|
||||||
"UDN=%s MATCH\n", UDNstr,
|
__LINE__,
|
||||||
DeviceUDN );
|
"DeviceUDN=%s and search "
|
||||||
|
"UDN=%s MATCH\n", UDNstr,
|
||||||
|
DeviceUDN );
|
||||||
|
)
|
||||||
SendReply( DestAddr, devType, 0,
|
SendReply( DestAddr, devType, 0,
|
||||||
UDNstr, SInfo->DescURL,
|
UDNstr, SInfo->DescURL,
|
||||||
defaultExp, 0 );
|
defaultExp, 0 );
|
||||||
@@ -287,18 +306,25 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
if( !strncasecmp
|
if( !strncasecmp
|
||||||
( DeviceType, devType,
|
( DeviceType, devType,
|
||||||
strlen( DeviceType ) ) ) {
|
strlen( DeviceType ) ) ) {
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"DeviceType=%s and search devType=%s MATCH\n",
|
( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
devType, DeviceType );
|
"DeviceType=%s and search devType=%s MATCH\n",
|
||||||
SendReply( DestAddr, devType, 0, UDNstr,
|
devType, DeviceType );
|
||||||
SInfo->DescURL, defaultExp, 1 );
|
)
|
||||||
} else {
|
SendReply( DestAddr, devType, 0, UDNstr,
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
SInfo->DescURL, defaultExp, 1 );
|
||||||
"DeviceType=%s and search devType=%s"
|
}
|
||||||
" DID NOT MATCH\n",
|
|
||||||
devType, DeviceType );
|
DBGONLY(
|
||||||
}
|
else
|
||||||
break;
|
UpnpPrintf( UPNP_INFO, API, __FILE__,
|
||||||
|
__LINE__,
|
||||||
|
"DeviceType=%s and search devType=%s"
|
||||||
|
" DID NOT MATCH\n",
|
||||||
|
devType, DeviceType );
|
||||||
|
)
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -306,10 +332,11 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
}
|
}
|
||||||
// send service advertisements for services corresponding
|
// send service advertisements for services corresponding
|
||||||
// to the same device
|
// to the same device
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Sending service Advertisement\n" );
|
"Sending service Advertisement\n" );
|
||||||
|
)
|
||||||
|
|
||||||
tmpNode = ixmlNodeList_item( SInfo->ServiceList, i );
|
tmpNode = ixmlNodeList_item( SInfo->ServiceList, i );
|
||||||
if( tmpNode == NULL ) {
|
if( tmpNode == NULL ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -318,9 +345,10 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * )
|
nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * )
|
||||||
tmpNode, "service" );
|
tmpNode, "service" );
|
||||||
if( nodeList == NULL ) {
|
if( nodeList == NULL ) {
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"Service not found 3\n" );
|
"Service not found 3\n" );
|
||||||
continue;
|
)
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
for( j = 0;; j++ ) {
|
for( j = 0;; j++ ) {
|
||||||
tmpNode = ixmlNodeList_item( nodeList, j );
|
tmpNode = ixmlNodeList_item( nodeList, j );
|
||||||
@@ -329,11 +357,15 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
|
|
||||||
ixmlNodeList_free( tmpNodeList );
|
ixmlNodeList_free( tmpNodeList );
|
||||||
tmpNodeList = NULL;
|
tmpNodeList = NULL;
|
||||||
tmpNodeList = ixmlElement_getElementsByTagName(
|
tmpNodeList = ixmlElement_getElementsByTagName( ( IXML_Element
|
||||||
( IXML_Element *)tmpNode, "serviceType" );
|
* ) tmpNode,
|
||||||
|
"serviceType" );
|
||||||
|
|
||||||
if( tmpNodeList == NULL ) {
|
if( tmpNodeList == NULL ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf
|
||||||
"ServiceType not found \n" );
|
( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||||
|
"ServiceType not found \n" );
|
||||||
|
)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmpNode2 = ixmlNodeList_item( tmpNodeList, 0 );
|
tmpNode2 = ixmlNodeList_item( tmpNodeList, 0 );
|
||||||
@@ -354,16 +386,19 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"ServiceType = %s\n", servType );
|
"ServiceType = %s\n", servType );
|
||||||
if( AdFlag ) {
|
)
|
||||||
|
if( AdFlag ) {
|
||||||
if( AdFlag == 1 ) {
|
if( AdFlag == 1 ) {
|
||||||
ServiceAdvertisement( UDNstr, servType,
|
ServiceAdvertisement( UDNstr, servType,
|
||||||
SInfo->DescURL, Exp );
|
SInfo->DescURL, Exp );
|
||||||
} else { // AdFlag == -1
|
} else // AdFlag == -1
|
||||||
|
{
|
||||||
ServiceShutdown( UDNstr, servType,
|
ServiceShutdown( UDNstr, servType,
|
||||||
SInfo->DescURL, Exp );
|
SInfo->DescURL, Exp );
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
switch ( SearchType ) {
|
switch ( SearchType ) {
|
||||||
case SSDP_ALL:
|
case SSDP_ALL:
|
||||||
@@ -398,10 +433,11 @@ int AdvertiseAndReply( IN int AdFlag,
|
|||||||
ixmlNodeList_free( nodeList );
|
ixmlNodeList_free( nodeList );
|
||||||
nodeList = NULL;
|
nodeList = NULL;
|
||||||
}
|
}
|
||||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||||
"Exiting AdvertiseAndReply : \n" );
|
"Exiting AdvertiseAndReply : \n" );
|
||||||
|
)
|
||||||
|
|
||||||
HandleUnlock( );
|
HandleUnlock( );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
|
||||||
@@ -641,7 +677,7 @@ free_ssdp_event_handler_data( void *the_data )
|
|||||||
* Returns: xboolean
|
* Returns: xboolean
|
||||||
* returns TRUE if msg is valid else FALSE
|
* returns TRUE if msg is valid else FALSE
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static XINLINE xboolean
|
||||||
valid_ssdp_msg( IN http_message_t * hmsg )
|
valid_ssdp_msg( IN http_message_t * hmsg )
|
||||||
{
|
{
|
||||||
memptr hdr_value;
|
memptr hdr_value;
|
||||||
@@ -683,7 +719,7 @@ valid_ssdp_msg( IN http_message_t * hmsg )
|
|||||||
* Returns: int
|
* Returns: int
|
||||||
* 0 if successful -1 if error
|
* 0 if successful -1 if error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
start_event_handler( void *Data )
|
start_event_handler( void *Data )
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -697,18 +733,20 @@ start_event_handler( void *Data )
|
|||||||
if( status == PARSE_FAILURE ) {
|
if( status == PARSE_FAILURE ) {
|
||||||
if( parser->msg.method != HTTPMETHOD_NOTIFY ||
|
if( parser->msg.method != HTTPMETHOD_NOTIFY ||
|
||||||
!parser->valid_ssdp_notify_hack ) {
|
!parser->valid_ssdp_notify_hack ) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"SSDP recvd bad msg code = %d\n",
|
"SSDP recvd bad msg code = %d\n",
|
||||||
status );
|
status );
|
||||||
// ignore bad msg, or not enuf mem
|
)
|
||||||
goto error_handler;
|
// ignore bad msg, or not enuf mem
|
||||||
|
goto error_handler;
|
||||||
}
|
}
|
||||||
// valid notify msg
|
// valid notify msg
|
||||||
} else if( status != PARSE_SUCCESS ) {
|
} else if( status != PARSE_SUCCESS ) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"SSDP recvd bad msg code = %d\n", status );
|
"SSDP recvd bad msg code = %d\n", status );
|
||||||
|
)
|
||||||
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
// check msg
|
// check msg
|
||||||
if( !valid_ssdp_msg( &parser->msg ) ) {
|
if( !valid_ssdp_msg( &parser->msg ) ) {
|
||||||
@@ -746,10 +784,14 @@ ssdp_event_handler_thread( void *the_data )
|
|||||||
// send msg to device or ctrlpt
|
// send msg to device or ctrlpt
|
||||||
if( ( hmsg->method == HTTPMETHOD_NOTIFY ) ||
|
if( ( hmsg->method == HTTPMETHOD_NOTIFY ) ||
|
||||||
( hmsg->request_method == HTTPMETHOD_MSEARCH ) ) {
|
( hmsg->request_method == HTTPMETHOD_MSEARCH ) ) {
|
||||||
|
|
||||||
CLIENTONLY( ssdp_handle_ctrlpt_msg( hmsg, &data->dest_addr,
|
CLIENTONLY( ssdp_handle_ctrlpt_msg( hmsg, &data->dest_addr,
|
||||||
FALSE, NULL ););
|
FALSE, NULL );
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
ssdp_handle_device_request( hmsg, &data->dest_addr );
|
|
||||||
|
DEVICEONLY( ssdp_handle_device_request( hmsg, &data->dest_addr );
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// free data
|
// free data
|
||||||
@@ -821,18 +863,21 @@ readFromSSDPSocket( SOCKET socket )
|
|||||||
if( byteReceived > 0 ) {
|
if( byteReceived > 0 ) {
|
||||||
|
|
||||||
requestBuf[byteReceived] = '\0';
|
requestBuf[byteReceived] = '\0';
|
||||||
UpnpPrintf( UPNP_INFO, SSDP,
|
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP,
|
||||||
__FILE__, __LINE__,
|
__FILE__, __LINE__,
|
||||||
"Received response !!! "
|
"Received response !!! "
|
||||||
"%s From host %s \n",
|
"%s From host %s \n",
|
||||||
requestBuf,
|
requestBuf,
|
||||||
inet_ntoa( clientAddr.sin_addr ) );
|
inet_ntoa( clientAddr.sin_addr ) );
|
||||||
|
)
|
||||||
|
|
||||||
UpnpPrintf( UPNP_PACKET, SSDP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_PACKET, SSDP,
|
||||||
"Received multicast packet:"
|
__FILE__, __LINE__,
|
||||||
"\n %s\n", requestBuf );
|
"Received multicast packet:"
|
||||||
//add thread pool job to handle request
|
"\n %s\n", requestBuf );
|
||||||
if( data != NULL ) {
|
)
|
||||||
|
//add thread pool job to handle request
|
||||||
|
if( data != NULL ) {
|
||||||
data->parser.msg.msg.length += byteReceived;
|
data->parser.msg.msg.length += byteReceived;
|
||||||
// null-terminate
|
// null-terminate
|
||||||
data->parser.msg.msg.buf[byteReceived] = 0;
|
data->parser.msg.msg.buf[byteReceived] = 0;
|
||||||
@@ -846,6 +891,7 @@ readFromSSDPSocket( SOCKET socket )
|
|||||||
free_ssdp_event_handler_data( data );
|
free_ssdp_event_handler_data( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
free_ssdp_event_handler_data( data );
|
free_ssdp_event_handler_data( data );
|
||||||
}
|
}
|
||||||
@@ -880,9 +926,9 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
|
|
||||||
CLIENTONLY( if( ( ssdpReqSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
CLIENTONLY( if( ( ssdpReqSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
||||||
== UPNP_INVALID_SOCKET ) {
|
== UPNP_INVALID_SOCKET ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
SSDP, __FILE__, __LINE__,
|
SSDP, __FILE__, __LINE__,
|
||||||
"Error in socket operation !!!\n" );
|
"Error in socket operation !!!\n" ); )
|
||||||
return UPNP_E_OUTOF_SOCKET;}
|
return UPNP_E_OUTOF_SOCKET;}
|
||||||
setsockopt( ssdpReqSock,
|
setsockopt( ssdpReqSock,
|
||||||
IPPROTO_IP,
|
IPPROTO_IP,
|
||||||
@@ -892,10 +938,11 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
|
|
||||||
if( ( ssdpSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
if( ( ssdpSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
||||||
== UPNP_INVALID_SOCKET ) {
|
== UPNP_INVALID_SOCKET ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
SSDP, __FILE__, __LINE__,
|
SSDP, __FILE__, __LINE__,
|
||||||
"Error in socket operation !!!\n" );
|
"Error in socket operation !!!\n" );
|
||||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
)
|
||||||
|
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||||
return UPNP_E_OUTOF_SOCKET;
|
return UPNP_E_OUTOF_SOCKET;
|
||||||
}
|
}
|
||||||
@@ -904,10 +951,11 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEADDR,
|
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEADDR,
|
||||||
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
||||||
|
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
SSDP, __FILE__, __LINE__,
|
SSDP, __FILE__, __LINE__,
|
||||||
"Error in set reuse addr !!!\n" );
|
"Error in set reuse addr !!!\n" );
|
||||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
)
|
||||||
|
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||||
shutdown( ssdpSock, SD_BOTH );
|
shutdown( ssdpSock, SD_BOTH );
|
||||||
UpnpCloseSocket( ssdpSock );
|
UpnpCloseSocket( ssdpSock );
|
||||||
@@ -918,10 +966,11 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEPORT,
|
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEPORT,
|
||||||
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
||||||
|
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
SSDP, __FILE__, __LINE__,
|
SSDP, __FILE__, __LINE__,
|
||||||
"Error in set reuse port !!!\n" );
|
"Error in set reuse port !!!\n" );
|
||||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
)
|
||||||
|
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||||
shutdown( ssdpSock, SD_BOTH );
|
shutdown( ssdpSock, SD_BOTH );
|
||||||
UpnpCloseSocket( ssdpSock );
|
UpnpCloseSocket( ssdpSock );
|
||||||
@@ -937,9 +986,10 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
if( bind
|
if( bind
|
||||||
( ssdpSock, ( struct sockaddr * )&ssdpAddr,
|
( ssdpSock, ( struct sockaddr * )&ssdpAddr,
|
||||||
sizeof( ssdpAddr ) ) != 0 ) {
|
sizeof( ssdpAddr ) ) != 0 ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf
|
||||||
SSDP, __FILE__, __LINE__,
|
( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||||
"Error in binding !!!\n" );
|
"Error in binding !!!\n" );
|
||||||
|
)
|
||||||
shutdown( ssdpSock, SD_BOTH );
|
shutdown( ssdpSock, SD_BOTH );
|
||||||
UpnpCloseSocket( ssdpSock );
|
UpnpCloseSocket( ssdpSock );
|
||||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||||
@@ -953,10 +1003,11 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
if( setsockopt( ssdpSock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
if( setsockopt( ssdpSock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||||
( char * )&ssdpMcastAddr,
|
( char * )&ssdpMcastAddr,
|
||||||
sizeof( struct ip_mreq ) ) != 0 ) {
|
sizeof( struct ip_mreq ) ) != 0 ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf
|
||||||
SSDP, __FILE__, __LINE__,
|
( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||||
"Error in joining" " multicast group !!!\n" );
|
"Error in joining" " multicast group !!!\n" );
|
||||||
shutdown( ssdpSock, SD_BOTH );
|
)
|
||||||
|
shutdown( ssdpSock, SD_BOTH );
|
||||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||||
UpnpCloseSocket( ssdpSock );
|
UpnpCloseSocket( ssdpSock );
|
||||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||||
@@ -968,8 +1019,8 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
addr.s_addr = inet_addr(LOCAL_HOST);
|
addr.s_addr = inet_addr(LOCAL_HOST);
|
||||||
if (setsockopt(ssdpSock, IPPROTO_IP, IP_MULTICAST_IF,
|
if (setsockopt(ssdpSock, IPPROTO_IP, IP_MULTICAST_IF,
|
||||||
(char *)&addr, sizeof addr) != 0) {
|
(char *)&addr, sizeof addr) != 0) {
|
||||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
DBGONLY(UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||||
"Couldn't set multicast interface.\n" );
|
"Couldn't set multicast interface.\n" ));
|
||||||
/* This is probably not a critical error, so let's continue. */
|
/* This is probably not a critical error, so let's continue. */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -978,10 +1029,11 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
|||||||
IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
||||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_BROADCAST,
|
if( setsockopt( ssdpSock, SOL_SOCKET, SO_BROADCAST,
|
||||||
( char * )&option, sizeof( option ) ) != 0 ) {
|
( char * )&option, sizeof( option ) ) != 0 ) {
|
||||||
UpnpPrintf( UPNP_CRITICAL,
|
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||||
SSDP, __FILE__, __LINE__,
|
SSDP, __FILE__, __LINE__,
|
||||||
"Error in setting broadcast !!!\n" );
|
"Error in setting broadcast !!!\n" );
|
||||||
shutdown( ssdpSock, SD_BOTH );
|
)
|
||||||
|
shutdown( ssdpSock, SD_BOTH );
|
||||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||||
UpnpCloseSocket( ssdpSock );
|
UpnpCloseSocket( ssdpSock );
|
||||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@@ -63,7 +62,7 @@
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static XINLINE void
|
||||||
addrToString( IN const struct sockaddr_in *addr,
|
addrToString( IN const struct sockaddr_in *addr,
|
||||||
OUT char ipaddr_port[] )
|
OUT char ipaddr_port[] )
|
||||||
{
|
{
|
||||||
@@ -88,7 +87,7 @@ addrToString( IN const struct sockaddr_in *addr,
|
|||||||
*
|
*
|
||||||
* Note : 'newAlias' should be freed using free()
|
* Note : 'newAlias' should be freed using free()
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
calc_alias( IN const char *alias,
|
calc_alias( IN const char *alias,
|
||||||
IN const char *rootPath,
|
IN const char *rootPath,
|
||||||
OUT char **newAlias )
|
OUT char **newAlias )
|
||||||
@@ -149,7 +148,7 @@ calc_alias( IN const char *alias,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE int
|
static XINLINE int
|
||||||
calc_descURL( IN const char *ipPortStr,
|
calc_descURL( IN const char *ipPortStr,
|
||||||
IN const char *alias,
|
IN const char *alias,
|
||||||
OUT char descURL[LINE_SIZE] )
|
OUT char descURL[LINE_SIZE] )
|
||||||
@@ -169,10 +168,11 @@ calc_descURL( IN const char *ipPortStr,
|
|||||||
strcat( descURL, ipPortStr );
|
strcat( descURL, ipPortStr );
|
||||||
strcat( descURL, alias );
|
strcat( descURL, alias );
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"desc url: %s\n", descURL );
|
"desc url: %s\n", descURL );
|
||||||
|
)
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -408,16 +408,18 @@ configure_urlbase( INOUT IXML_Document * doc,
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
"desc url: %s\n", docURL );
|
"desc url: %s\n", docURL );
|
||||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
)
|
||||||
"doc = %s\n", xml_str );
|
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||||
// store in web server
|
"doc = %s\n", xml_str );
|
||||||
err_code =
|
)
|
||||||
|
// store in web server
|
||||||
|
err_code =
|
||||||
web_server_set_alias( new_alias, xml_str, strlen( xml_str ),
|
web_server_set_alias( new_alias, xml_str, strlen( xml_str ),
|
||||||
last_modified );
|
last_modified );
|
||||||
|
|
||||||
error_handler:
|
error_handler:
|
||||||
free( root_path );
|
free( root_path );
|
||||||
free( new_alias );
|
free( new_alias );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user