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 |
355
ChangeLog
355
ChangeLog
@@ -1,335 +1,6 @@
|
||||
*******************************************************************************
|
||||
Version 1.6.4
|
||||
*******************************************************************************
|
||||
|
||||
2008-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Workaround for a problem with the new automake AM_CONDITIONAL macro
|
||||
from autotools-1.10. Thanks to Ingo Hofmann for helping with debugging
|
||||
this one.
|
||||
|
||||
2008-01-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Added quoting to macros AC_CONFIG_AUX_DIR, AC_CONFIG_MACRO_DIR and
|
||||
AC_CONFIG_SRCDIR in configure.ac. Also changed the name of the
|
||||
auxiliary directory in AC_CONFIG_AUX_DIR to build-aux.
|
||||
|
||||
2008-01-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Fix for setsockopt() in Threadpool.c to allow more than one process
|
||||
to join the multicast-group on OSX. Thanks to Ingo Hofmann.
|
||||
|
||||
2008-01-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Using defined(__OSX__) || defined(__APPLE__) instead of just
|
||||
defined(__OSX__) in the code. Thanks to Ingo Hofmann and Chris
|
||||
Pickel.
|
||||
|
||||
2008-01-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Fix for isFileInVirtualDir. Thanks to Peter Hartley for the patch.
|
||||
|
||||
2008-01-07 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Putting back a "defined(__OSX__)" that has been removed in the
|
||||
previous *BSD patch. Thanks to Chris Pickel for pointing it out.
|
||||
|
||||
2008-01-07 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patches Tracker [ 1865812 ] typo in docs comment
|
||||
Submitted By: Hartmut Holzgraefe - hholzgra
|
||||
typo in docs comment ACCAPTED instead of ACCEPTED in
|
||||
@name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302]
|
||||
Also, the documentation file name was mispelled and was corrected in
|
||||
the Makefile.am.
|
||||
|
||||
*******************************************************************************
|
||||
Version 1.6.3
|
||||
*******************************************************************************
|
||||
|
||||
2007-12-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Using pthread flags for the whole project, not just at the places
|
||||
individually indicated by several Makefile.am files spread all over
|
||||
the directories. That was too much error prone.
|
||||
|
||||
2007-12-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Added a configure test to check if pthread_rwlock_t is available.
|
||||
Define _GNU_SOURCE if needed. The fallback behaviou will only be
|
||||
implemented if _GNU_SOURCE prooves to be insufficient on some
|
||||
platforms. Thanks to Jonathan Casiot (no_dice) and Robert Gingher
|
||||
(robsbox).
|
||||
|
||||
2007-12-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Removed unused iasnprintf.{c,h} files.
|
||||
|
||||
2007-12-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Removed STATSONLY() macro from ThreadPool.{c,h}.
|
||||
* Removed time() usage from ThreadPool.c.
|
||||
* Fixed STATS = 0 compilation.
|
||||
|
||||
2007-12-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Library was not compiling on FreeBSD 7. Code now no longer uses
|
||||
ftime(), using gettimeofday() instead. Thanks to Josh Carroll.
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
Version 1.6.2
|
||||
*******************************************************************************
|
||||
|
||||
2007-12-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Fixed a compilation error due to a missing #ifdef in
|
||||
upnp/src/genlib/miniserver/miniserver.c. Thanks to Eugene Christensen.
|
||||
|
||||
2007-11-12 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* "make check" was failing because ixml/test/test_document.sh did not
|
||||
have the executable flag set. Thanks to Steve Bresson.
|
||||
|
||||
2007-11-12 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Fixed a memory leak in upnpapi.c to delete gMiniServerThreadPool in
|
||||
the call to UpnpFinish(). Thanks to Fabrice Fontaine.
|
||||
|
||||
2007-11-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Added a isleep() call to the error handler of select() in
|
||||
RunMiniServer(), so that it does not take 100% cpu in case select()
|
||||
fails repeatedly.
|
||||
|
||||
*******************************************************************************
|
||||
Version 1.6.1
|
||||
*******************************************************************************
|
||||
|
||||
2007-11-07 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Bug Tracker [ 1825278 ] AdvertiseAndReply sleeps with handle lock out
|
||||
Applied patch from Alex (afaucher) to change some write locks to read
|
||||
locks.
|
||||
|
||||
2007-11-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Adjusting libtool library numbers to reflect the last changes.
|
||||
|
||||
2007-11-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Bug Tracker [ 1825278 ] AdvertiseAndReply sleeps with handle lock out
|
||||
GlobalHndMutex, which was a mutex is now GlobalHndRWLock, which is a
|
||||
rwlock. HandleLock() is mapped to HandleWriteLock() while all other
|
||||
instances have not been checked. One instance in AdvertiseAndReply()
|
||||
has been changed to HandleReadLock(). Thanks to Alex (afaucher) for the
|
||||
bug report and suggestions.
|
||||
|
||||
2007-11-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Added support for rwlocks.
|
||||
|
||||
2007-11-05 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Bug Tracker [ 1825929 ] woker thread still alive after UpnpFinish()
|
||||
Submitted By: Luke Kim - nereusuj
|
||||
Worker thread still alive after calling UpnpFinish() because
|
||||
ThreadPoolShutdown() is in the #ifdef DEBUG block.
|
||||
421
|
||||
422 #ifdef DEBUG
|
||||
423 ThreadPoolShutdown( &gSendThreadPool );
|
||||
424 ThreadPoolShutdown( &gRecvThreadPool );
|
||||
|
||||
2007-08-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Changed the calls to virtualDirCallback.open(filename, UPNP_WRITE)
|
||||
to (virtualDirCallback.open)(filename, UPNP_WRITE) (notice the
|
||||
parenthesis) due to a change in glibc that produces compilation
|
||||
errors.
|
||||
|
||||
2007-08-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Initialization of the "randomness" struct so that valgrind does not
|
||||
complain.
|
||||
|
||||
2007-08-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Merge of patch submitted By Keith Brindley - brindlk
|
||||
SF Bug Tracker [ 1762758 ] Seek not working for large files
|
||||
Problem:
|
||||
Requests from the uPnP client to seek to a position beyond 2GB in a large
|
||||
file are handled as a request to see from the 2GB point.
|
||||
|
||||
Impact:
|
||||
Varies depending on client. The Xbox 360 kills the connection when it
|
||||
realises.
|
||||
|
||||
Solution:
|
||||
GetNextRange function (webserver.c) is updated to handle large file sizes.
|
||||
Fix should also recognise when built on a 32bit platform rather than 64 and
|
||||
handle accordingly.
|
||||
|
||||
2007-08-05 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Merge of Mac OS X patch from St<53>phane Corth<74>sy (davelopper),
|
||||
SF Bug Tracker [ 1686420 ] Modifications for MacOSX.
|
||||
Some of the proposed changes were already done by Rene Hexel's patch.
|
||||
|
||||
*******************************************************************************
|
||||
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.
|
||||
|
||||
*******************************************************************************
|
||||
Version 1.4.7
|
||||
*******************************************************************************
|
||||
|
||||
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
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
|
||||
2007-04-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Tracker [ 1695399 ] Typo in util.h
|
||||
@@ -364,9 +35,9 @@ Version 1.4.4
|
||||
Please note, that I enabled some extra debugging lines that were commented,
|
||||
in order to get more information. See attached files.
|
||||
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
Version 1.4.3
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
|
||||
2007-03-13 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Tracker [ 1663004 ] Compile on Cygwin
|
||||
@@ -401,9 +72,9 @@ Version 1.4.3
|
||||
|
||||
* Fixed nasty segmentation fault bug on membuffer.c.
|
||||
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
Version 1.4.2
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
|
||||
2007-02-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
|
||||
@@ -425,7 +96,7 @@ Version 1.4.2
|
||||
2007-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
|
||||
* SF Tracker [ 1634922 ] Support for large files (>= 2 GiB), part 2
|
||||
Submitted By: Jonathan Casiot - no_dice
|
||||
Submitted By: Jonathan - no_dice
|
||||
Summary: This patch hopefully fixes the remaining types and related
|
||||
code to enable files >= 2 GiB to be streamed. Jonathan claims to have
|
||||
tested this with a patched version of ushare-0.9.8 and a D-Link DSM-520.
|
||||
@@ -505,9 +176,9 @@ Version 1.4.2
|
||||
* support for large files (>2 GBytes) added
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
Version 1.4.1
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
|
||||
2006-07-07 Oxy <virtual_worlds(at)gmx.de>
|
||||
|
||||
@@ -538,9 +209,9 @@ Version 1.4.1
|
||||
* Patch to fix memory leaks and reasons for crashes added (thanks
|
||||
to loigu)
|
||||
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
Version 1.4.0
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
|
||||
2006-05-26 Oxy <virtual_worlds(at)gmx.de>
|
||||
|
||||
@@ -566,9 +237,9 @@ Version 1.4.0
|
||||
|
||||
* Bugfix for M-Search packet
|
||||
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
FORK FROM DEAD libupnp
|
||||
*******************************************************************************
|
||||
*************************************************************************
|
||||
|
||||
2006-04-29 R<>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||
|
||||
|
11
Makefile.am
11
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
|
||||
#
|
||||
@@ -8,11 +9,7 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-samples
|
||||
|
||||
SUBDIRS = \
|
||||
ixml \
|
||||
threadutil \
|
||||
upnp \
|
||||
docs/dist
|
||||
SUBDIRS = ixml threadutil upnp docs/dist
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
@@ -26,8 +23,7 @@ EXTRA_DIST = \
|
||||
build/libupnp.dsw \
|
||||
build/inc/autoconfig.h \
|
||||
build/inc/config.h \
|
||||
build/inc/upnpconfig.h \
|
||||
build/msvc/inttypes.h
|
||||
build/inc/upnpconfig.h
|
||||
|
||||
|
||||
# This variable must have 'exec' in its name, in order to be installed
|
||||
@@ -35,7 +31,6 @@ EXTRA_DIST = \
|
||||
pkgconfigexecdir = $(libdir)/pkgconfig
|
||||
pkgconfigexec_DATA = libupnp.pc
|
||||
|
||||
|
||||
$(pkgconfigexec_DATA): config.status
|
||||
|
||||
|
||||
|
26
THANKS
26
THANKS
@@ -6,43 +6,25 @@ suggesting various improvements or submitting actual code.
|
||||
Here is a list of these people. Help us keep it complete and
|
||||
exempt of errors.
|
||||
|
||||
- Alex (afaucher)
|
||||
- Arno Willig
|
||||
- Bob Ciora
|
||||
- Chaos
|
||||
- Chris Pickel
|
||||
- Craig Nelson
|
||||
- David Maass
|
||||
- Emil Ljungdahl
|
||||
- Erik Johansson
|
||||
- Eric Tanguy
|
||||
- Erwan Velu
|
||||
- Eugene Christensen
|
||||
- Fabrice Fontaine
|
||||
- Fredrik Svensson
|
||||
- Glen Masgai
|
||||
- Hartmut Holzgraefe - hholzgra
|
||||
- Ingo Hofmann
|
||||
- Jiri Zouhar
|
||||
- John Dennis
|
||||
- Jonathan Casiot (no_dice)
|
||||
- Josh Carroll
|
||||
- Keith Brindley
|
||||
- Jonathan (no_dice)
|
||||
- Leuk_He
|
||||
- Loigu
|
||||
- Luke Kim
|
||||
- Marcelo Roberto Jimenez (mroberto)
|
||||
- Marcelo Roberto Jimenez
|
||||
- Markus Strobl
|
||||
- Nektarios K. Papadopoulos (npapadop)
|
||||
- Nektarios K. Papadopoulos
|
||||
- Oskar Liljeblad
|
||||
- Michael (oxygenic)
|
||||
- Michael (Oxy)
|
||||
- Paul Vixie
|
||||
- Peter Hartley
|
||||
- Rene Hexel
|
||||
- Robert Gingher (robsbox)
|
||||
- Siva Chandran
|
||||
- Stéphane Corthésy
|
||||
- Steve Bresson
|
||||
- Timothy Redaelli
|
||||
- Titus Winters
|
||||
|
||||
|
@@ -13,3 +13,7 @@ autoreconf --force --install -Wall -Wno-obsolete $* || exit 1
|
||||
echo "Now run ./configure and then make."
|
||||
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. */
|
||||
|
||||
/* Define to 1 to compile debug code */
|
||||
@@ -19,18 +19,15 @@
|
||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
||||
#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 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 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 HAVE_MEMORY_H 1
|
||||
|
||||
@@ -95,19 +92,19 @@
|
||||
#define PACKAGE "libupnp"
|
||||
|
||||
/* 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 PACKAGE_NAME "libupnp"
|
||||
|
||||
/* 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 PACKAGE_TARNAME "libupnp"
|
||||
|
||||
/* 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
|
||||
your system. */
|
||||
@@ -138,30 +135,27 @@
|
||||
#define UPNP_VERSION_MINOR 4
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_PATCH 7
|
||||
#define UPNP_VERSION_PATCH 0
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_STRING "1.4.7"
|
||||
#define UPNP_VERSION_STRING "1.4.0"
|
||||
|
||||
/* 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 to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
||||
/* #undef _LARGEFILE_SOURCE */
|
||||
|
||||
/* Large files support */
|
||||
#define _LARGE_FILE_SOURCE
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `long int' if <sys/types.h> does not define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Substitute for socklen_t */
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "autoconfig.h"
|
||||
|
||||
#define MAX_JOBS_TOTAL 10
|
||||
|
||||
/** @name Compile time configuration options
|
||||
* The Linux SDK for UPnP Devices contains some compile-time parameters
|
||||
@@ -95,17 +96,6 @@
|
||||
#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
|
||||
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
||||
* This prevents devices that have a misbehaving web server to send
|
||||
@@ -261,7 +251,7 @@
|
||||
|
||||
/** @name Other debugging features
|
||||
The UPnP SDK contains other features to aid in debugging:
|
||||
see <upnp/inc/upnpdebug.h>
|
||||
see <upnp/upnpdebug.h>
|
||||
*/
|
||||
|
||||
#define DEBUG_ALL 1
|
||||
@@ -304,6 +294,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_MINISERVER
|
||||
#ifdef INTERNAL_WEB_SERVER
|
||||
@@ -338,6 +349,13 @@
|
||||
#define CLIENTONLY(x)
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
#define DEVICEONLY(x) x
|
||||
#else
|
||||
#define DEVICEONLY(x)
|
||||
#endif
|
||||
|
||||
//@}
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* upnp/inc/upnpconfig.h. Generated from upnpconfig.h.in by configure. */
|
||||
/* upnp/inc/upnpconfig.h. Generated by configure. */
|
||||
// -*- C -*-
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -40,7 +40,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/** 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 */
|
||||
#define UPNP_VERSION_MAJOR 1
|
||||
@@ -49,7 +49,7 @@
|
||||
#define UPNP_VERSION_MINOR 4
|
||||
|
||||
/** 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 */
|
||||
#define UPNP_VERSION \
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
/** Defined to 1 if the library has been compiled with DEBUG enabled
|
||||
* (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
|
||||
|
@@ -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_ ]
|
270
configure.ac
270
configure.ac
@@ -1,151 +1,53 @@
|
||||
# -*- Autoconf -*-
|
||||
# $Id: configure.ac,v 1.11 2006/04/09 13:59:44 r3mi Exp $
|
||||
#
|
||||
# Top-level configure.ac file for libupnp
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# (C) Copyright 2005-2007 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
# (C) Copyright 2005-2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
#
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
AC_INIT([libupnp], [1.6.4], [mroberto@users.sourceforge.net])
|
||||
dnl ############################################################################
|
||||
dnl # *Independently* of the above libupnp package version, the libtool version
|
||||
dnl # of the 3 libraries need to be updated whenever there is a change released:
|
||||
dnl # "current:revision:age" (this is NOT the same as the package version),
|
||||
dnl # where:
|
||||
dnl # - library code modified: revision++
|
||||
dnl # - interfaces changed/added/removed: current++ and revision=0
|
||||
dnl # - interfaces added: age++
|
||||
dnl # - interfaces removed: age=0
|
||||
dnl # *please update only once, before a formal release, not for each change*
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.4.1:
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.4.6:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in ixml
|
||||
dnl # revision: 2 -> 3
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 2 -> 3
|
||||
dnl # - Interface added in threadutil
|
||||
dnl # current: 2 -> 3
|
||||
dnl # revisiion: 3 -> 0
|
||||
dnl # age: 0 -> 1
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 2 -> 3
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.0:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in ixml
|
||||
dnl # revision: 3 -> 4
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 0 -> 1
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 3 -> 4
|
||||
dnl # - Interface changed in upnp
|
||||
dnl # current: 2 -> 3
|
||||
dnl # revision: 4 -> 0
|
||||
dnl # - Interface removed in upnp
|
||||
dnl # age: 0 -> 0
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.1:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 1 -> 2
|
||||
dnl # - Interface added in threadutil
|
||||
dnl # current: 3 -> 4
|
||||
dnl # revision: 2 -> 0
|
||||
dnl # - Interface added in threadutil
|
||||
dnl # age: 1 -> 2
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 0 -> 1
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.2:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 1 -> 2
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.3:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 0 -> 1
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.4:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 1 -> 2
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 2 -> 3
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:3:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
|
||||
AC_SUBST([LT_VERSION_UPNP], [3:3:0])
|
||||
dnl ############################################################################
|
||||
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
||||
dnl # - library code modified: revision++
|
||||
dnl # - interfaces changed/added/removed: current++ and revision=0
|
||||
dnl # - interfaces added: age++
|
||||
dnl # - interfaces removed: age=0
|
||||
dnl # *please update only once, before a formal release, not for each change*
|
||||
dnl ############################################################################
|
||||
AC_INIT([libupnp], [1.4.4], [mroberto@users.sourceforge.net])
|
||||
# *Independently* of the above libupnp package version, the libtool version
|
||||
# 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:
|
||||
# - library code modified: revision++
|
||||
# - interfaces changed/added/removed: current++ and revision=0
|
||||
# - interfaces added: age++
|
||||
# - interfaces removed: age=0
|
||||
# *please update only once, before a formal release, not for each change*
|
||||
#
|
||||
# For release 1.4.1, we had:
|
||||
#AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
||||
#AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
||||
#AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
||||
#
|
||||
# "current:revision:age"
|
||||
#
|
||||
# - Code has changed in ixml
|
||||
# revision: 2 -> 3
|
||||
# - Code has changed in threadutil
|
||||
# revision: 2 -> 3
|
||||
# - Interface added in threadutil
|
||||
# current: 2 -> 3
|
||||
# revisiion: 3 -> 0
|
||||
# age: 0 -> 1
|
||||
# - Code has changed in upnp (revision 2 -> 3)
|
||||
# revision: 2 -> 3
|
||||
AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
||||
AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
||||
AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
||||
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR([upnp/inc/upnp.h])
|
||||
|
||||
AC_CONFIG_AUX_DIR(config.aux)
|
||||
AC_CONFIG_MACRO_DIR(m4)
|
||||
AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
|
||||
|
||||
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 :
|
||||
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
||||
@@ -165,7 +67,8 @@ AC_REVISION([$Revision: 1.11 $])
|
||||
upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' `
|
||||
upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `]
|
||||
upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `]
|
||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION", [see upnpconfig.h])
|
||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION",
|
||||
[see upnpconfig.h])
|
||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_MAJOR], $upnpmaj, [see upnpconfig.h])
|
||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h])
|
||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h])
|
||||
@@ -187,6 +90,7 @@ fi
|
||||
#
|
||||
# Check for libupnp subsets
|
||||
#
|
||||
|
||||
RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)])
|
||||
if test "x$enable_client" = xyes ; then
|
||||
AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h])
|
||||
@@ -220,30 +124,23 @@ fi
|
||||
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
||||
|
||||
|
||||
#
|
||||
# doc installation
|
||||
# autoconf >= 2.60 already defines ${docdir}, but we will not use its
|
||||
# default value, which is ${datarootdir}/doc/${PACKAGE_TARNAME}.
|
||||
# That would give us ${datarootdir}/doc/libupnp, and we want the package
|
||||
# version on that.
|
||||
#
|
||||
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
||||
AC_MSG_CHECKING([for documentation directory])
|
||||
AC_ARG_WITH(
|
||||
[documentation],
|
||||
AS_HELP_STRING(
|
||||
[--with-documentation=directory_name],
|
||||
AC_ARG_WITH([documentation],
|
||||
AS_HELP_STRING([--with-documentation=directory_name],
|
||||
[where documentation is installed
|
||||
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
||||
AS_HELP_STRING(
|
||||
[--without-documentation],
|
||||
AS_HELP_STRING([--without-documentation],
|
||||
[do not install the documentation]),
|
||||
[],
|
||||
[with_documentation=no])
|
||||
|
||||
#
|
||||
# If something has been entered after an equal sign, assume it is the directory
|
||||
#
|
||||
if test x"$with_documentation" != xyes -a x"$with_documentation" != xno; then
|
||||
docdir="$with_documentation"
|
||||
fi
|
||||
@@ -262,19 +159,10 @@ AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_EGREP
|
||||
|
||||
|
||||
#
|
||||
# Default compilation flags
|
||||
#
|
||||
echo "--------------------- Default compilation flags -------------------------------"
|
||||
echo host is $host
|
||||
echo host_os is $host_os
|
||||
case $host_os in
|
||||
freebsd*)
|
||||
echo "Using FreeBSD specific compiler settings"
|
||||
# Put FreeBSD specific compiler flags here
|
||||
;;
|
||||
*)
|
||||
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
|
||||
:
|
||||
@@ -282,20 +170,14 @@ freebsd*)
|
||||
# add optimise for size
|
||||
AX_CFLAGS_GCC_OPTION([-Os])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AX_CFLAGS_WARN_ALL
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
|
||||
|
||||
#
|
||||
# Lot's of stuff to ensure large file support
|
||||
#
|
||||
AC_TYPE_SIZE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support])
|
||||
AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
||||
AC_DEFINE(_LARGE_FILE_SOURCE, [], [Large files support])
|
||||
AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size])
|
||||
|
||||
|
||||
#
|
||||
@@ -304,31 +186,14 @@ AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
||||
AC_HEADER_STDC
|
||||
# libupnp code doesn't use autoconf variables yet,
|
||||
# so just abort if a header file is not found.
|
||||
AC_CHECK_HEADERS(
|
||||
[ \
|
||||
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])])
|
||||
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])])
|
||||
|
||||
|
||||
#
|
||||
# Checks for typedefs, structures, and compiler characteristics
|
||||
#
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
TYPE_SOCKLEN_T
|
||||
|
||||
|
||||
@@ -337,60 +202,25 @@ TYPE_SOCKLEN_T
|
||||
#
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_FSEEKO
|
||||
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
||||
|
||||
|
||||
#
|
||||
# Checks for POSIX Threads
|
||||
#
|
||||
echo "--------------------------- pthread stuff -------------------------------------"
|
||||
ACX_PTHREAD(
|
||||
[],
|
||||
[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
||||
#
|
||||
# Update environment variables for pthreads
|
||||
#
|
||||
CC="$PTHREAD_CC"
|
||||
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
#
|
||||
# Determine if pthread_rwlock_t is available
|
||||
#
|
||||
echo "----------------------- pthread_rwlock_t stuff --------------------------------"
|
||||
AC_MSG_CHECKING([if pthread_rwlock_t is available])
|
||||
AC_LANG([C])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#include <pthread.h>],
|
||||
[pthread_rwlock_t *x;])],
|
||||
[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
|
||||
AC_MSG_RESULT([yes, supported without any options])],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[#define _GNU_SOURCE
|
||||
#include <pthread.h>],
|
||||
[pthread_rwlock_t *x;])],
|
||||
[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
|
||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||
AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])],
|
||||
[AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t])
|
||||
AC_MSG_RESULT([no, needs to fallback to pthread_mutex])
|
||||
AC_MSG_ERROR([pthread_rwlock_t not available])])])
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
||||
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
|
||||
|
||||
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_OUTPUT
|
||||
|
||||
|
4
docs/dist/Makefile.am
vendored
4
docs/dist/Makefile.am
vendored
@@ -39,7 +39,7 @@ EXTRA_DIST = \
|
||||
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
||||
./html/upnp/UPNP_E_CANCELED-210.html \
|
||||
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \
|
||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \
|
||||
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
||||
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
||||
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
||||
@@ -295,7 +295,7 @@ if WITH_DOCUMENTATION
|
||||
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
||||
./html/upnp/UPNP_E_CANCELED-210.html \
|
||||
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \
|
||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \
|
||||
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
||||
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
||||
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
||||
|
125
ixml/inc/ixml.h
125
ixml/inc/ixml.h
@@ -1,47 +1,46 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 _IXML_H_
|
||||
#define _IXML_H_
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//#include <malloc.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef UPNP_STATIC_LIB
|
||||
#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)
|
||||
#else
|
||||
#define EXPORT_SPEC __declspec(dllimport)
|
||||
@@ -55,7 +54,6 @@
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
|
||||
#define DOMString char *
|
||||
|
||||
|
||||
@@ -90,7 +88,7 @@ typedef int BOOL;
|
||||
* etc., refer to section 1.1 of the DOM2-Core recommendation.
|
||||
*/
|
||||
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/*================================================================
|
||||
*
|
||||
@@ -123,7 +121,7 @@ typedef enum
|
||||
*
|
||||
*=================================================================*/
|
||||
typedef enum
|
||||
{ /* see DOM spec */
|
||||
{ // see DOM spec
|
||||
IXML_INDEX_SIZE_ERR = 1,
|
||||
IXML_DOMSTRING_SIZE_ERR = 2,
|
||||
IXML_HIERARCHY_REQUEST_ERR = 3,
|
||||
@@ -242,7 +240,7 @@ extern "C" {
|
||||
* its functionality. For more information, refer to DOM2-Core page 34.
|
||||
*/
|
||||
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** 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
|
||||
@@ -622,7 +620,7 @@ ixmlNode_cloneNode(IXML_Node *nodeptr,
|
||||
*/
|
||||
|
||||
EXPORT_SPEC BOOL
|
||||
ixmlNode_hasAttributes(IXML_Node *nodeptr
|
||||
ixmlNode_hasAttributes(IXML_Node *node
|
||||
/** The {\bf Node} to query for attributes. */
|
||||
);
|
||||
|
||||
@@ -632,11 +630,11 @@ ixmlNode_hasAttributes(IXML_Node *nodeptr
|
||||
*/
|
||||
|
||||
EXPORT_SPEC void
|
||||
ixmlNode_free(IXML_Node *nodeptr
|
||||
ixmlNode_free(IXML_Node *IXML_Node
|
||||
/** The {\bf Node} to free. */
|
||||
);
|
||||
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/*================================================================
|
||||
*
|
||||
@@ -651,7 +649,7 @@ ixmlNode_free(IXML_Node *nodeptr
|
||||
* allowable attributes and values for a particular element. For more
|
||||
* information, refer to the {\it Interface Attr} section in the DOM2-Core.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
|
||||
/** Frees an {\bf Attr} node.
|
||||
@@ -664,7 +662,7 @@ ixmlAttr_free(IXML_Attr *attrNode
|
||||
/** 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
|
||||
* DOM2-Core.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
|
||||
/** Initializes a {\bf CDATASection} node.
|
||||
@@ -706,7 +704,7 @@ ixmlCDATASection_free(IXML_CDATASection *nodeptr
|
||||
/** 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,
|
||||
* refer to the {\it Interface Document} section in the DOM2Core.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** Initializes a {\bf Document} node.
|
||||
*
|
||||
@@ -949,7 +947,7 @@ ixmlDocument_getElementsByTagName(IXML_Document *doc,
|
||||
/** 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
|
||||
* namespace URI.
|
||||
@@ -1130,7 +1128,7 @@ ixmlDocument_importNode(IXML_Document* doc,
|
||||
/** A pointer to a new {\bf Node} owned by {\bf
|
||||
doc}. */
|
||||
);
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/*================================================================
|
||||
*
|
||||
@@ -1146,7 +1144,7 @@ ixmlDocument_importNode(IXML_Document* doc,
|
||||
* extends the {\bf Node} interface and adds more operations to manipulate
|
||||
* attributes.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** Initializes a {\bf IXML_Element} node.
|
||||
*
|
||||
@@ -1316,7 +1314,7 @@ ixmlElement_getElementsByTagName(IXML_Element* element,
|
||||
search. */
|
||||
);
|
||||
|
||||
/* introduced in DOM 2 */
|
||||
// introduced in DOM 2
|
||||
|
||||
/** 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. */
|
||||
);
|
||||
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/*================================================================
|
||||
*
|
||||
@@ -1510,7 +1508,7 @@ ixmlElement_free(IXML_Element* element
|
||||
* no particular order. The {\bf Node} interface uses a {\bf NamedNodeMap}
|
||||
* to maintain the attributes of a node.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** 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. */
|
||||
);
|
||||
|
||||
/* introduced in DOM level 2 */
|
||||
// introduced in DOM level 2
|
||||
|
||||
/** Retrieves a {\bf Node} from a {\bf NamedNodeMap} specified by
|
||||
* namespace URI and local name.
|
||||
@@ -1648,7 +1646,7 @@ ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap
|
||||
/** 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
|
||||
* this as being {\it live}.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** Retrieves a {\bf Node} from a {\bf NodeList} specified by a
|
||||
* numerical index.
|
||||
@@ -1703,8 +1701,8 @@ ixmlNodeList_free(IXML_NodeList *nList
|
||||
/** The {\bf NodeList} to free. */
|
||||
);
|
||||
|
||||
/*! @} */ /* Interface NodeList */
|
||||
/*! @} */ /* DOM Interfaces */
|
||||
//@} Interface NodeList
|
||||
//@} DOM Interfaces
|
||||
|
||||
/**@name IXML API
|
||||
* 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
|
||||
* DOMString objects.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/*================================================================
|
||||
*
|
||||
@@ -1740,7 +1738,7 @@ ixmlNodeList_free(IXML_NodeList *nList
|
||||
* of the DOM tree or {\tt NULL} on an error.
|
||||
*/
|
||||
|
||||
EXPORT_SPEC DOMString
|
||||
DOMString
|
||||
ixmlPrintDocument(IXML_Document *doc);
|
||||
|
||||
/** 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.
|
||||
*/
|
||||
|
||||
EXPORT_SPEC DOMString
|
||||
DOMString
|
||||
ixmlPrintNode(IXML_Node *doc
|
||||
/** 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.
|
||||
*/
|
||||
|
||||
EXPORT_SPEC DOMString
|
||||
DOMString
|
||||
ixmlDocumenttoString(IXML_Document *doc);
|
||||
|
||||
/** 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
|
||||
* are left untranslated. The parsing is then allowed to continue.
|
||||
*/
|
||||
EXPORT_SPEC void
|
||||
void
|
||||
ixmlRelaxParser(char errorChar);
|
||||
|
||||
|
||||
@@ -1915,7 +1913,6 @@ ixmlFreeDOMString(DOMString buf
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! @} */ /* IXML API */
|
||||
|
||||
#endif /* _IXML_H_ */
|
||||
//@} IXML API
|
||||
|
||||
#endif // _IXML_H_
|
||||
|
@@ -38,6 +38,10 @@
|
||||
#define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) )
|
||||
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
||||
|
||||
#ifndef WIN32
|
||||
#define XINLINE inline
|
||||
#endif
|
||||
|
||||
#define MEMBUF_DEF_SIZE_INC 20
|
||||
|
||||
|
||||
|
@@ -504,19 +504,14 @@ Parser_init( )
|
||||
* Parser_isValidEndElement
|
||||
* check if a new node->nodeName matches top of element stack.
|
||||
* Internal to parser only.
|
||||
*
|
||||
*=================================================================*/
|
||||
static int
|
||||
Parser_isValidEndElement(
|
||||
IN Parser * xmlParser,
|
||||
Parser_isValidEndElement( IN Parser * xmlParser,
|
||||
IN IXML_Node * newNode )
|
||||
{
|
||||
assert( xmlParser );
|
||||
assert( xmlParser->pCurElement );
|
||||
assert( xmlParser->pCurElement->element );
|
||||
assert( newNode );
|
||||
assert( newNode->nodeName );
|
||||
|
||||
return strcmp( xmlParser->pCurElement->element, newNode->nodeName ) == 0;
|
||||
return ( strcmp( xmlParser->pCurElement->element, newNode->nodeName )
|
||||
== 0 );
|
||||
}
|
||||
|
||||
/*===============================================================
|
||||
@@ -926,8 +921,6 @@ Parser_parseDocument( OUT IXML_Document ** retDoc,
|
||||
int rc = IXML_SUCCESS;
|
||||
IXML_CDATASection *cdataSecNode = NULL;
|
||||
|
||||
// It is important that the node gets initialized here, otherwise things
|
||||
// can go wrong on the error handler.
|
||||
ixmlNode_init( &newNode );
|
||||
|
||||
rc = ixmlDocument_createDocumentEx( &gRootDoc );
|
||||
@@ -943,9 +936,7 @@ Parser_parseDocument( OUT IXML_Document ** retDoc,
|
||||
}
|
||||
|
||||
while( bETag == FALSE ) {
|
||||
// clear the newNode contents. Redundant on the first iteration,
|
||||
// but nonetheless, necessary due to the possible calls to
|
||||
// ErrorHandler above. Currently, this is just a memset to zero.
|
||||
// clear the newNode contents
|
||||
ixmlNode_init( &newNode );
|
||||
|
||||
if( Parser_getNextNode( xmlParser, &newNode, &bETag ) ==
|
||||
@@ -2506,4 +2497,3 @@ Parser_getNextNode( IN Parser * xmlParser,
|
||||
return IXML_SYNTAX_ERR;
|
||||
|
||||
}
|
||||
|
||||
|
0
ixml/test/test_document.sh
Executable file → Normal file
0
ixml/test/test_document.sh
Executable file → Normal file
@@ -7,5 +7,6 @@ Name: libupnp
|
||||
Description: Linux SDK for UPnP Devices
|
||||
Version: @VERSION@
|
||||
Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
||||
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
||||
Cflags: @PTHREAD_CFLAGS@ -I${includedir}
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
Version: 1.6.4
|
||||
Version: 1.4.2
|
||||
Summary: Universal Plug and Play (UPnP) SDK
|
||||
Name: libupnp
|
||||
Release: 1%{?dist}
|
||||
@@ -77,12 +77,6 @@ make install DESTDIR=$RPM_BUILD_ROOT
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%changelog
|
||||
* Mon Nov 19 2007 Marcelo Jimenez <mroberto@users.sourceforge.net> - 1.6.2-1
|
||||
- Update to version 1.6.2
|
||||
|
||||
* Mon Nov 19 2007 Marcelo Jimenez <mroberto@users.sourceforge.net> - 1.4.7-1
|
||||
- Update to version 1.4.7
|
||||
|
||||
* Fri Feb 02 2007 Eric Tanguy <eric.tanguy@univ-nantes.fr> - 1.4.2-1
|
||||
- Update to version 1.4.2
|
||||
|
||||
|
@@ -1,88 +1,50 @@
|
||||
##### http://autoconf-archive.cryp.to/acx_pthread.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# This macro figures out how to build C programs using POSIX threads.
|
||||
# It sets the PTHREAD_LIBS output variable to the threads library and
|
||||
# linker flags, and the PTHREAD_CFLAGS output variable to any special
|
||||
# C compiler flags that are needed. (The user can also force certain
|
||||
# compiler flags/libs to be tested by setting these environment
|
||||
# variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise).
|
||||
# (This is necessary on AIX to use the special cc_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these
|
||||
# flags, but also link it with them as well. e.g. you should link
|
||||
# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
||||
# $LIBS
|
||||
#
|
||||
# If you are only building threads programs, you may wish to use
|
||||
# these variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
||||
# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
||||
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# ACTION-IF-FOUND is a list of shell commands to run if a threads
|
||||
# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
||||
# run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
||||
# default action will define HAVE_PTHREAD.
|
||||
#
|
||||
# Please let the authors know if this macro fails on any platform, or
|
||||
# if you have any other suggestions or comments. This macro was based
|
||||
# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
|
||||
# (with help from M. Frigo), as well as ac_pthread and hb_pthread
|
||||
# macros posted by Alejandro Forero Cuervo to the autoconf macro
|
||||
# repository. We are also grateful for the helpful feedback of
|
||||
# numerous users.
|
||||
#
|
||||
# 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.
|
||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
dnl
|
||||
dnl @summary figure out how to build C programs using POSIX threads
|
||||
dnl
|
||||
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
|
||||
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
|
||||
dnl compiler flags/libs to be tested by setting these environment
|
||||
dnl variables.)
|
||||
dnl
|
||||
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
dnl multi-threaded programs (defaults to the value of CC otherwise).
|
||||
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
|
||||
dnl
|
||||
dnl 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 with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
||||
dnl $LIBS
|
||||
dnl
|
||||
dnl If you are only building threads programs, you may wish to use
|
||||
dnl these variables in your default LIBS, CFLAGS, and CC:
|
||||
dnl
|
||||
dnl LIBS="$PTHREAD_LIBS $LIBS"
|
||||
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
dnl CC="$PTHREAD_CC"
|
||||
dnl
|
||||
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
||||
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
||||
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
dnl
|
||||
dnl 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 run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
||||
dnl default action will define HAVE_PTHREAD.
|
||||
dnl
|
||||
dnl Please let the authors know if this macro fails on any platform, or
|
||||
dnl if you have any other suggestions or comments. This macro was based
|
||||
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
|
||||
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
|
||||
dnl We are also grateful for the helpful feedback of numerous users.
|
||||
dnl
|
||||
dnl @category InstalledPackages
|
||||
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
dnl @version 2005-06-15
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([ACX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
@@ -254,12 +216,8 @@ if test "x$acx_pthread_ok" = xyes; then
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# More AIX lossage: must compile with xlc_r or cc_r
|
||||
if test x"$GCC" != xyes; then
|
||||
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC=$CC
|
||||
fi
|
||||
# More AIX lossage: must compile with cc_r
|
||||
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
||||
else
|
||||
PTHREAD_CC="$CC"
|
||||
fi
|
||||
|
@@ -1,87 +1,48 @@
|
||||
##### http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
|
||||
# "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
|
||||
# optionflag to CFLAGS if it is understood. You can override the
|
||||
# shellvar-default of CFLAGS of course. The order of arguments stems
|
||||
# from the explicit macros like AX_CFLAGS_WARN_ALL.
|
||||
#
|
||||
# The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
|
||||
# to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
|
||||
# (since it is possible to use different compilers for C and C++).
|
||||
#
|
||||
# The macro is a lot simpler than any special AX_CFLAGS_* macro (or
|
||||
# ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
|
||||
# However, if you use this macro in a few places, it would be great
|
||||
# if you would make up a new function-macro and submit it to the
|
||||
# ac-archive.
|
||||
#
|
||||
# - $1 option-to-check-for : required ("-option" as non-value)
|
||||
# - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
|
||||
# - $3 action-if-found : add value to shellvariable
|
||||
# - $4 action-if-not-found : nothing
|
||||
#
|
||||
# note: in earlier versions, $1-$2 were swapped. We try to detect the
|
||||
# situation and accept a $2=~/-/ as being the old
|
||||
# option-to-check-for.
|
||||
#
|
||||
# also: there are other variants that emerged from the original macro
|
||||
# variant which did just test an option to be possibly added.
|
||||
# However, some compilers accept an option silently, or possibly for
|
||||
# just another option that was not intended. Therefore, we have to do
|
||||
# a generic test for a compiler family. For gcc we check "-pedantic"
|
||||
# being accepted which is also understood by compilers who just want
|
||||
# to be compatible with gcc even when not being made from gcc
|
||||
# sources.
|
||||
#
|
||||
# see also:
|
||||
#
|
||||
# AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
|
||||
# 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.
|
||||
dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
|
||||
dnl
|
||||
dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
|
||||
dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
|
||||
dnl optionflag to CFLAGS if it is understood. You can override the
|
||||
dnl shellvar-default of CFLAGS of course. The order of arguments stems
|
||||
dnl from the explicit macros like AX_CFLAGS_WARN_ALL.
|
||||
dnl
|
||||
dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
|
||||
dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
|
||||
dnl (since it is possible to use different compilers for C and C++).
|
||||
dnl
|
||||
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.
|
||||
dnl However, if you use this macro in a few places, it would be great
|
||||
dnl if you would make up a new function-macro and submit it to the
|
||||
dnl ac-archive.
|
||||
dnl
|
||||
dnl - $1 option-to-check-for : required ("-option" as non-value)
|
||||
dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
|
||||
dnl - $3 action-if-found : add value to shellvariable
|
||||
dnl - $4 action-if-not-found : nothing
|
||||
dnl
|
||||
dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
|
||||
dnl situation and accept a $2=~/-/ as being the old
|
||||
dnl option-to-check-for.
|
||||
dnl
|
||||
dnl also: there are other variants that emerged from the original macro
|
||||
dnl variant which did just test an option to be possibly added.
|
||||
dnl However, some compilers accept an option silently, or possibly for
|
||||
dnl just another option that was not intended. Therefore, we have to do
|
||||
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
|
||||
dnl to be compatible with gcc even when not being made from gcc
|
||||
dnl sources.
|
||||
dnl
|
||||
dnl see also:
|
||||
dnl
|
||||
dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
|
||||
dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
|
||||
dnl
|
||||
dnl @category C
|
||||
dnl @author Guido Draheim <guidod@gmx.de>
|
||||
dnl @version 2003-11-04
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||
@@ -92,8 +53,7 @@ VAR,[VAR="no, unknown"
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
|
||||
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
|
||||
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
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)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
|
||||
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
|
||||
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
@@ -163,8 +122,7 @@ VAR,[VAR="no, unknown"
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
|
||||
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
|
||||
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
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)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
|
||||
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
|
||||
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
|
@@ -1,66 +1,27 @@
|
||||
##### http://autoconf-archive.cryp.to/ax_cflags_warn_all.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Try to find a compiler option that enables most reasonable
|
||||
# warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||
# which is split up into two AX_CFLAGS_WARN_ALL and
|
||||
# AX_CFLAGS_WARN_ALL_ANSI
|
||||
#
|
||||
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||
# result is added to the shellvar being CFLAGS by default.
|
||||
#
|
||||
# Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||
# Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
||||
# compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
||||
# 10.0.0.8) C compiler.
|
||||
#
|
||||
# - $1 shell-variable-to-add-to : CFLAGS
|
||||
# - $2 add-value-if-not-found : nothing
|
||||
# - $3 action-if-found : add value to shellvariable
|
||||
# - $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.
|
||||
dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||
dnl
|
||||
dnl Try to find a compiler option that enables most reasonable
|
||||
dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||
dnl which is split up into two AX_CFLAGS_WARN_ALL and
|
||||
dnl AX_CFLAGS_WARN_ALL_ANSI
|
||||
dnl
|
||||
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||
dnl result is added to the shellvar being CFLAGS by default.
|
||||
dnl
|
||||
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||
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
|
||||
dnl 10.0.0.8) C compiler.
|
||||
dnl
|
||||
dnl - $1 shell-variable-to-add-to : CFLAGS
|
||||
dnl - $2 add-value-if-not-found : nothing
|
||||
dnl - $3 action-if-found : add value to shellvariable
|
||||
dnl - $4 action-if-not-found : nothing
|
||||
dnl
|
||||
dnl @category C
|
||||
dnl @author Guido Draheim <guidod@gmx.de>
|
||||
dnl @version 2003-01-06
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_WARN_ALL],[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],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
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 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 delimimiter. A non-option comment can be given after "%%" marks
|
||||
dnl which will be shown but not added to the respective C/CXXFLAGS.
|
||||
dnl delimimiter. A non-option comment can be given after "%%" marks.
|
||||
|
@@ -1,66 +1,27 @@
|
||||
##### http://autoconf-archive.cryp.to/ax_cflags_warn_all_ansi.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Try to find a compiler option that enables most reasonable
|
||||
# warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||
# which is split up into two AX_CFLAGS_WARN_ALL and
|
||||
# AX_CFLAGS_WARN_ALL_ANSI
|
||||
#
|
||||
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||
# result is added to the shellvar being CFLAGS by default.
|
||||
#
|
||||
# Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||
# Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
||||
# compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
||||
# 10.0.0.8) C compiler.
|
||||
#
|
||||
# - $1 shell-variable-to-add-to : CFLAGS
|
||||
# - $2 add-value-if-not-found : nothing
|
||||
# - $3 action-if-found : add value to shellvariable
|
||||
# - $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.
|
||||
dnl @synopsis AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
||||
dnl
|
||||
dnl Try to find a compiler option that enables most reasonable
|
||||
dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||
dnl which is split up into two AX_CFLAGS_WARN_ALL and
|
||||
dnl AX_CFLAGS_WARN_ALL_ANSI
|
||||
dnl
|
||||
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||
dnl result is added to the shellvar being CFLAGS by default.
|
||||
dnl
|
||||
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||
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
|
||||
dnl 10.0.0.8) C compiler.
|
||||
dnl
|
||||
dnl - $1 shell-variable-to-add-to : CFLAGS
|
||||
dnl - $2 add-value-if-not-found : nothing
|
||||
dnl - $3 action-if-found : add value to shellvariable
|
||||
dnl - $4 action-if-not-found : nothing
|
||||
dnl
|
||||
dnl @category C
|
||||
dnl @author Guido Draheim <guidod@gmx.de>
|
||||
dnl @version 2003-01-06
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[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],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
# IRIX C compiler:
|
||||
# -use_readonly_const is the default for IRIX C,
|
||||
|
@@ -41,7 +41,7 @@ AC_DEFUN([RT_BOOL_ARG_ENABLE],[
|
||||
)])
|
||||
test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl
|
||||
&& enable_[]Name=[$2]
|
||||
AC_MSG_RESULT($enable_[]Name)
|
||||
AC_MSG_RESULT($enable_[]Name)dnl
|
||||
AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes)
|
||||
dnl
|
||||
m4_popdef([NAME])dnl
|
||||
|
@@ -1,52 +1,13 @@
|
||||
##### http://autoconf-archive.cryp.to/type_socklen_t.html
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# TYPE_SOCKLEN_T
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether sys/socket.h defines type socklen_t. Please note that
|
||||
# some systems require sys/types.h to be included before sys/socket.h
|
||||
# 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.
|
||||
dnl @synopsis TYPE_SOCKLEN_T
|
||||
dnl
|
||||
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
|
||||
dnl can be compiled.
|
||||
dnl
|
||||
dnl @category Misc
|
||||
dnl @author Lars Brinkhoff <lars@nocrew.org>
|
||||
dnl @version 2005-01-11
|
||||
dnl @license GPLWithACException
|
||||
|
||||
AC_DEFUN([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*
|
@@ -6,6 +6,7 @@
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/inc -I$(srcdir)/src/inc
|
||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||
|
||||
if ENABLE_DEBUG
|
||||
AM_CPPFLAGS += -DDEBUG -DSTATS
|
||||
@@ -20,11 +21,12 @@ libthreadutil_la_LDFLAGS = -version-info $(LT_VERSION_THREADUTIL)
|
||||
|
||||
libthreadutil_la_SOURCES = \
|
||||
src/FreeList.c src/LinkedList.c \
|
||||
src/ThreadPool.c src/TimerThread.c
|
||||
src/ThreadPool.c src/TimerThread.c \
|
||||
src/iasnprintf.c
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = \
|
||||
inc/FreeList.h inc/LinkedList.h \
|
||||
inc/ThreadPool.h inc/TimerThread.h \
|
||||
inc/ithread.h
|
||||
inc/iasnprintf.h inc/ithread.h
|
||||
|
||||
|
@@ -1,33 +1,33 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 FREE_LIST_H
|
||||
#define FREE_LIST_H
|
||||
@@ -36,6 +36,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//#include <malloc.h>
|
||||
|
||||
|
||||
#include "ithread.h"
|
||||
#include <errno.h>
|
||||
|
||||
@@ -49,7 +52,7 @@ extern "C" {
|
||||
*****************************************************************************/
|
||||
typedef struct FREELISTNODE
|
||||
{
|
||||
struct FREELISTNODE *next;
|
||||
struct FREELISTNODE*next; //pointer to next free node
|
||||
} FreeListNode;
|
||||
|
||||
|
||||
@@ -62,10 +65,12 @@ typedef struct FREELISTNODE
|
||||
*****************************************************************************/
|
||||
typedef struct FREELIST
|
||||
{
|
||||
FreeListNode *head;
|
||||
size_t element_size;
|
||||
int maxFreeListLength;
|
||||
int freeListLength;
|
||||
FreeListNode *head; //head of free list
|
||||
size_t element_size; //size of elements in free
|
||||
//list
|
||||
int maxFreeListLength; //max size of free structures
|
||||
//to keep
|
||||
int freeListLength; //current size of free list
|
||||
|
||||
}FreeList;
|
||||
|
||||
@@ -136,5 +141,4 @@ int FreeListDestroy (FreeList *free_list);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREE_LIST_H */
|
||||
|
||||
#endif // FREE_LIST_H
|
||||
|
@@ -1,33 +1,33 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 LINKED_LIST_H
|
||||
#define LINKED_LIST_H
|
||||
@@ -70,9 +70,9 @@ typedef int (*cmp_routine)(void *itemA,void *itemB);
|
||||
*****************************************************************************/
|
||||
typedef struct LISTNODE
|
||||
{
|
||||
struct LISTNODE *prev;
|
||||
struct LISTNODE *next;
|
||||
void *item;
|
||||
struct LISTNODE *prev; //previous node
|
||||
struct LISTNODE *next; //next node
|
||||
void *item; //item
|
||||
} ListNode;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -96,12 +96,12 @@ typedef struct LISTNODE
|
||||
*****************************************************************************/
|
||||
typedef struct LINKEDLIST
|
||||
{
|
||||
ListNode head; /* head, first item is stored at: head->next */
|
||||
ListNode tail; /* tail, last item is stored at: tail->prev */
|
||||
long size; /* size of list */
|
||||
FreeList freeNodeList; /* free list to use */
|
||||
free_function free_func; /* free function to use */
|
||||
cmp_routine cmp_func; /* compare function to use */
|
||||
ListNode head; //head, first item is stored at: head->next
|
||||
ListNode tail; //tail, last item is stored at: tail->prev
|
||||
long size; //size of list
|
||||
FreeList freeNodeList; //free list to use
|
||||
free_function free_func; //free function to use
|
||||
cmp_routine cmp_func; //compare function to use
|
||||
} LinkedList;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -327,5 +327,4 @@ int ListSize(LinkedList* list);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LINKED_LIST_H */
|
||||
|
||||
#endif //LINKED_LIST_H
|
||||
|
@@ -1,58 +1,52 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 THREADPOOL_H
|
||||
#define THREADPOOL_H
|
||||
|
||||
#ifdef UPNP_USE_MSVCPP
|
||||
#define UPNP_INLINE
|
||||
#else
|
||||
#define UPNP_INLINE inline
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Size of job free list */
|
||||
//Size of job free list
|
||||
#define JOBFREELISTSIZE 100
|
||||
|
||||
#define INFINITE_THREADS -1
|
||||
|
||||
#define EMAXTHREADS (-8 & 1<<29)
|
||||
|
||||
/* Invalid Policy */
|
||||
//Invalid Policy
|
||||
#define INVALID_POLICY (-9 & 1<<29)
|
||||
|
||||
/* Invalid JOB Id */
|
||||
//Invalid JOB Id
|
||||
#define INVALID_JOB_ID (-2 & 1<<29)
|
||||
|
||||
typedef enum duration {SHORT_TERM,PERSISTENT} Duration;
|
||||
@@ -61,35 +55,53 @@ typedef enum priority {LOW_PRIORITY,
|
||||
MED_PRIORITY,
|
||||
HIGH_PRIORITY} ThreadPriority;
|
||||
|
||||
#define DEFAULT_PRIORITY MED_PRIORITY /* default priority used by TPJobInit */
|
||||
#define DEFAULT_MIN_THREADS 1 /* default minimum 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_STARVATION_TIME 500 /* default starvation 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_MAX_JOBS_TOTAL 100 /* default max jobs used TPAttrInit */
|
||||
#define DEFAULT_PRIORITY MED_PRIORITY //default priority used by TPJobInit
|
||||
#define DEFAULT_MIN_THREADS 1 //default minimum 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_STARVATION_TIME 500 //default starvation 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_MAX_JOBS_TOTAL 100 //default max jobs used TPAttrInit
|
||||
|
||||
/* Statistics */
|
||||
/* always include stats because code change is minimal */
|
||||
#define STATS 1
|
||||
#define STATS 1 //always include stats because code change is minimal
|
||||
|
||||
|
||||
//Statistics
|
||||
#ifdef WIN32 // todo: check why STATSONLY fails during compilation
|
||||
#undef STATS
|
||||
#endif
|
||||
|
||||
#ifdef STATS
|
||||
#define STATSONLY(x) x
|
||||
#else
|
||||
#define STATSONLY(x)
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG 1
|
||||
#endif
|
||||
|
||||
//DEBUGGING
|
||||
#ifndef WIN32
|
||||
#ifdef DEBUG
|
||||
#define DBGONLY(x) x
|
||||
#else
|
||||
#define DBGONLY(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "LinkedList.h"
|
||||
#include <sys/time.h> /* for gettimeofday() */
|
||||
#include <sys/timeb.h>
|
||||
#include "FreeList.h"
|
||||
|
||||
#include "ithread.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/timeb.h>
|
||||
#define EXPORT
|
||||
|
||||
typedef int PolicyType;
|
||||
#define DEFAULT_POLICY SCHED_OTHER
|
||||
#define DEFAULT_SCHED_PARAM 0 /* default priority */
|
||||
#define DEFAULT_SCHED_PARAM 0 //default priority
|
||||
|
||||
/****************************************************************************
|
||||
* Name: free_routine
|
||||
@@ -108,28 +120,26 @@ typedef void (*free_routine)(void *arg);
|
||||
*****************************************************************************/
|
||||
typedef struct THREADPOOLATTR
|
||||
{
|
||||
/* minThreads, ThreadPool will always maintain at least this many threads */
|
||||
int minThreads;
|
||||
int minThreads; // minThreads, ThreadPool will always maintain at least
|
||||
// this many threads
|
||||
|
||||
/* maxThreads, ThreadPool will never have more than this number of threads */
|
||||
int maxThreads;
|
||||
int maxThreads; // maxThreads, ThreadPool will never have more than this
|
||||
// number of threads
|
||||
|
||||
/* maxIdleTime (in milliseconds) this is the maximum time a thread will
|
||||
* remain idle before dying */
|
||||
int maxIdleTime;
|
||||
int maxIdleTime; // maxIdleTime (in milliseconds)
|
||||
// this is the maximum time a thread will remain idle
|
||||
// before dying
|
||||
|
||||
/* jobs per thread to maintain */
|
||||
int jobsPerThread;
|
||||
int jobsPerThread; // jobs per thread to maintain
|
||||
|
||||
/* maximum number of jobs that can be queued totally. */
|
||||
int maxJobsTotal;
|
||||
int maxJobsTotal; // maximum number of jobs that can be queued totally.
|
||||
|
||||
/* the time a low priority or med priority job waits before getting bumped
|
||||
* up a priority (in milliseconds) */
|
||||
int starvationTime;
|
||||
int starvationTime; // the time a low priority or med priority
|
||||
// job waits before getting bumped
|
||||
// up a priority (in milliseconds)
|
||||
|
||||
PolicyType schedPolicy; // scheduling policy to use
|
||||
|
||||
/* scheduling policy to use */
|
||||
PolicyType schedPolicy;
|
||||
} ThreadPoolAttr;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -140,12 +150,12 @@ typedef struct THREADPOOLATTR
|
||||
*****************************************************************************/
|
||||
typedef struct THREADPOOLJOB
|
||||
{
|
||||
start_routine func;
|
||||
void *arg;
|
||||
free_routine free_func;
|
||||
struct timeval requestTime;
|
||||
int priority;
|
||||
int jobId;
|
||||
start_routine func; //function
|
||||
void *arg; //arg
|
||||
free_routine free_func; //free function
|
||||
struct timeb requestTime; //time of request
|
||||
int priority; //priority of request
|
||||
int jobId; //id
|
||||
} ThreadPoolJob;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -155,29 +165,33 @@ typedef struct THREADPOOLJOB
|
||||
* Structure to hold statistics
|
||||
*****************************************************************************/
|
||||
|
||||
STATSONLY(
|
||||
|
||||
typedef struct TPOOLSTATS
|
||||
{
|
||||
double totalTimeHQ;
|
||||
int totalJobsHQ;
|
||||
double avgWaitHQ;
|
||||
double totalTimeMQ;
|
||||
int totalJobsMQ;
|
||||
double avgWaitMQ;
|
||||
double totalTimeLQ;
|
||||
int totalJobsLQ;
|
||||
double avgWaitLQ;
|
||||
double totalWorkTime;
|
||||
double totalIdleTime;
|
||||
int workerThreads;
|
||||
int idleThreads;
|
||||
int persistentThreads;
|
||||
int totalThreads;
|
||||
int maxThreads;
|
||||
int currentJobsHQ;
|
||||
int currentJobsLQ;
|
||||
int currentJobsMQ;
|
||||
double totalTimeHQ; //total time spent by all jobs in high priority Q
|
||||
int totalJobsHQ; //total jobs in HQ run so far
|
||||
double avgWaitHQ; //average wait in HQ
|
||||
double totalTimeMQ; //total time spent by all jobs in med priority Q
|
||||
int totalJobsMQ; //total jobs in MQ run so far
|
||||
double avgWaitMQ; //average wait in MQ
|
||||
double totalTimeLQ; //total time spent by all jobs in low priority Q
|
||||
int totalJobsLQ; //total jobs in LQ run so far
|
||||
double avgWaitLQ; //average wait in LQ
|
||||
double totalWorkTime; //total time spent working for all threads
|
||||
double totalIdleTime; //total time spent idle for all threads
|
||||
int workerThreads; //number of current workerThreads
|
||||
int idleThreads; //number of current idle threads
|
||||
int persistentThreads; //number of persistent threads
|
||||
int totalThreads; //total number of current threads
|
||||
int maxThreads; //max threads so far
|
||||
int currentJobsHQ; // current jobs in Q
|
||||
int currentJobsLQ; //current jobs in Q
|
||||
int currentJobsMQ; //current jobs in Q
|
||||
}ThreadPoolStats;
|
||||
|
||||
)
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ThreadPool
|
||||
@@ -201,24 +215,25 @@ typedef struct TPOOLSTATS
|
||||
|
||||
typedef struct THREADPOOL
|
||||
{
|
||||
ithread_mutex_t mutex; /* mutex to protect job qs */
|
||||
ithread_cond_t condition; /* condition variable to signal Q */
|
||||
ithread_cond_t start_and_shutdown; /* condition variable for start
|
||||
and stop */
|
||||
int lastJobId; /* ids for jobs */
|
||||
int shutdown; /* whether or not we are shutting down */
|
||||
int totalThreads; /* total number of threads */
|
||||
int persistentThreads; /* number of persistent threads */
|
||||
FreeList jobFreeList; /* free list of jobs */
|
||||
LinkedList lowJobQ; /* low priority job Q */
|
||||
LinkedList medJobQ; /* med priority job Q */
|
||||
LinkedList highJobQ; /* high priority job Q */
|
||||
ThreadPoolJob *persistentJob; /* persistent job */
|
||||
ithread_mutex_t mutex; //mutex to protect job qs
|
||||
ithread_cond_t condition; //condition variable to signal Q
|
||||
ithread_cond_t start_and_shutdown; //condition variable for start
|
||||
//and stop
|
||||
int lastJobId; //ids for jobs
|
||||
int shutdown; //whether or not we are shutting down
|
||||
int totalThreads; //total number of threads
|
||||
int persistentThreads; //number of persistent threads
|
||||
FreeList jobFreeList; //free list of jobs
|
||||
LinkedList lowJobQ; //low priority job Q
|
||||
LinkedList medJobQ; //med priority job Q
|
||||
LinkedList highJobQ; //high priority job Q
|
||||
ThreadPoolJob *persistentJob; //persistent job
|
||||
|
||||
ThreadPoolAttr attr; /* thread pool attributes */
|
||||
ThreadPoolAttr attr; //thread pool attributes
|
||||
|
||||
//statistics
|
||||
STATSONLY(ThreadPoolStats stats;)
|
||||
|
||||
/* statistics */
|
||||
ThreadPoolStats stats;
|
||||
} ThreadPool;
|
||||
|
||||
|
||||
@@ -259,7 +274,8 @@ typedef struct THREADPOOL
|
||||
* INVALID_POLICY if schedPolicy can't be set
|
||||
* EMAXTHREADS if minimum threads is greater than maximum threads
|
||||
*****************************************************************************/
|
||||
int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
||||
int ThreadPoolInit(ThreadPool *tp,
|
||||
ThreadPoolAttr *attr);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolAddPersistent
|
||||
@@ -281,7 +297,9 @@ int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
||||
* EOUTOFMEM not enough memory to add job.
|
||||
* EMAXTHREADS not enough threads to add persistent job.
|
||||
*****************************************************************************/
|
||||
int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
||||
int ThreadPoolAddPersistent (ThreadPool*tp,
|
||||
ThreadPoolJob *job,
|
||||
int *jobId);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolGetAttr
|
||||
@@ -296,7 +314,8 @@ int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
||||
* 0 on success, nonzero on failure
|
||||
* Always returns 0.
|
||||
*****************************************************************************/
|
||||
int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
||||
int ThreadPoolGetAttr(ThreadPool *tp,
|
||||
ThreadPoolAttr *out);
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolSetAttr
|
||||
*
|
||||
@@ -310,7 +329,8 @@ int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
||||
* 0 on success, nonzero on failure
|
||||
* Returns INVALID_POLICY if policy can not be set.
|
||||
*****************************************************************************/
|
||||
int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
||||
int ThreadPoolSetAttr(ThreadPool *tp,
|
||||
ThreadPoolAttr *attr);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolAdd
|
||||
@@ -329,7 +349,9 @@ int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
||||
* 0 on success, nonzero on failure
|
||||
* EOUTOFMEM if not enough memory to add job.
|
||||
*****************************************************************************/
|
||||
int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
||||
int ThreadPoolAdd (ThreadPool*tp,
|
||||
ThreadPoolJob *job,
|
||||
int *jobId);
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolRemove
|
||||
@@ -346,7 +368,8 @@ int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
||||
* 0 on success, nonzero on failure.
|
||||
* INVALID_JOB_ID if job not found.
|
||||
*****************************************************************************/
|
||||
int ThreadPoolRemove(ThreadPool *tp, int jobId, ThreadPoolJob *out);
|
||||
int ThreadPoolRemove(ThreadPool *tp,
|
||||
int jobId, ThreadPoolJob *out);
|
||||
|
||||
|
||||
|
||||
@@ -409,6 +432,7 @@ int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
||||
*****************************************************************************/
|
||||
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrInit
|
||||
*
|
||||
@@ -526,19 +550,12 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
||||
* Returns:
|
||||
* Always returns 0.
|
||||
*****************************************************************************/
|
||||
#ifdef STATS
|
||||
EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
||||
STATSONLY( EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats););
|
||||
|
||||
EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
||||
#else
|
||||
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
||||
|
||||
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
||||
#endif
|
||||
STATSONLY(EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats););
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ThreadPool */
|
||||
|
||||
#endif //ThreadPool
|
||||
|
@@ -1,33 +1,33 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 TIMERTHREAD_H
|
||||
#define TIMERTHREAD_H
|
||||
@@ -43,9 +43,9 @@ extern "C" {
|
||||
|
||||
#define INVALID_EVENT_ID (-10 & 1<<29)
|
||||
|
||||
/* Timeout Types */
|
||||
/* absolute means in seconds from Jan 1, 1970 */
|
||||
/* relative means in seconds from current time */
|
||||
//Timeout Types
|
||||
//absolute means in seconds from Jan 1, 1970
|
||||
//relative means in seconds from current time
|
||||
typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
||||
|
||||
|
||||
@@ -63,13 +63,13 @@ typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
||||
*****************************************************************************/
|
||||
typedef struct TIMERTHREAD
|
||||
{
|
||||
ithread_mutex_t mutex;
|
||||
ithread_cond_t condition;
|
||||
int lastEventId;
|
||||
LinkedList eventQ;
|
||||
int shutdown;
|
||||
FreeList freeEvents;
|
||||
ThreadPool *tp;
|
||||
ithread_mutex_t mutex; //mutex to protect eventQ
|
||||
ithread_cond_t condition; //condition variable
|
||||
int lastEventId; //last event id
|
||||
LinkedList eventQ; //event q
|
||||
int shutdown; //whether or not we are shutdown
|
||||
FreeList freeEvents; //FreeList for events
|
||||
ThreadPool *tp; //ThreadPool to use
|
||||
} TimerThread;
|
||||
|
||||
|
||||
@@ -85,9 +85,9 @@ typedef struct TIMERTHREAD
|
||||
typedef struct TIMEREVENT
|
||||
{
|
||||
ThreadPoolJob job;
|
||||
time_t eventTime; /* absolute time for event in seconds since Jan 1, 1970 */
|
||||
Duration persistent; /* long term or short term job */
|
||||
int id;
|
||||
time_t eventTime; //absolute time for event in seconds since Jan 1, 1970
|
||||
Duration persistent; //long term or short term job
|
||||
int id; //id of job
|
||||
} TimerEvent;
|
||||
|
||||
|
||||
@@ -188,5 +188,4 @@ int TimerThreadShutdown(TimerThread *timer);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* TIMER_THREAD_H */
|
||||
|
||||
#endif //TIMER_THREAD_H
|
||||
|
66
threadutil/inc/iasnprintf.h
Normal file
66
threadutil/inc/iasnprintf.h
Normal file
@@ -0,0 +1,66 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <stdarg.h>
|
||||
|
||||
#define EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocates enough memory for the
|
||||
* Formatted string, up to max
|
||||
* specified.
|
||||
* With max set to -1, allocates
|
||||
* as much size as needed.
|
||||
* Memory must be freed using free.
|
||||
*/
|
||||
|
||||
EXPORT int iasnprintf(char **ret,
|
||||
int incr,
|
||||
int max,
|
||||
const char * fmt, ...)
|
||||
#ifndef SPARC_SOLARIS
|
||||
#if (__GNUC__ >= 3)
|
||||
__attribute__((format (__printf__, 4, 5)));
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
EXPORT void iasnprintfFree(char *);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -1,33 +1,33 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 ITHREADH
|
||||
#define ITHREADH
|
||||
@@ -36,15 +36,17 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_ONLY(x) x
|
||||
#else
|
||||
#define DEBUG_ONLY(x)
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
|
||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||
/* This system has SuS2-compliant mutex attributes.
|
||||
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
||||
@@ -52,16 +54,11 @@ extern "C" {
|
||||
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
|
||||
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
|
||||
#else /* PTHREAD_MUTEX_RECURSIVE */
|
||||
#else
|
||||
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
|
||||
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
|
||||
#endif /* PTHREAD_MUTEX_RECURSIVE */
|
||||
|
||||
|
||||
#define ITHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
|
||||
#define ITHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
|
||||
|
||||
#endif
|
||||
|
||||
#define ITHREAD_CANCELED PTHREAD_CANCELED
|
||||
|
||||
@@ -141,28 +138,6 @@ typedef pthread_mutex_t ithread_mutex_t;
|
||||
***************************************************************************/
|
||||
typedef pthread_condattr_t ithread_condattr_t;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ithread_rwlockattr_t
|
||||
*
|
||||
* Description:
|
||||
* Mutex attribute.
|
||||
* typedef to pthread_rwlockattr_t
|
||||
* Internal Use Only
|
||||
***************************************************************************/
|
||||
typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ithread_rwlock_t
|
||||
*
|
||||
* Description:
|
||||
* Condition attribute.
|
||||
* typedef to pthread_rwlock_t
|
||||
* Internal Use Only
|
||||
***************************************************************************/
|
||||
typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_mutexattr_init
|
||||
*
|
||||
@@ -177,8 +152,8 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
* Always returns 0.
|
||||
* See man page for pthread_mutexattr_init
|
||||
***************************************************************************/
|
||||
#define ithread_mutexattr_init pthread_mutexattr_init
|
||||
|
||||
#define ithread_mutexattr_init pthread_mutexattr_init
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_mutexattr_destroy
|
||||
@@ -207,7 +182,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
* ITHREAD_MUTEX_ERRORCHECK_NP
|
||||
*
|
||||
* Parameters:
|
||||
* ithread_mutexattr_t * attr (must be valid non NULL pointer to
|
||||
* ithread_mutexattr_t * mutex (must be valid non NULL pointer to
|
||||
* ithread_mutexattr_t)
|
||||
* int kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP
|
||||
* or ITHREAD_MUTEX_ERRORCHECK_NP)
|
||||
@@ -232,7 +207,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
* ITHREAD_MUTEX_ERRORCHECK_NP
|
||||
*
|
||||
* Parameters:
|
||||
* ithread_mutexattr_t * attr (must be valid non NULL pointer to
|
||||
* ithread_mutexattr_t * mutex (must be valid non NULL pointer to
|
||||
* pthread_mutexattr_t)
|
||||
* int *kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP
|
||||
* or ITHREAD_MUTEX_ERRORCHECK_NP)
|
||||
@@ -265,7 +240,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
*****************************************************************************/
|
||||
#define ithread_mutex_init pthread_mutex_init
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_mutex_lock
|
||||
*
|
||||
@@ -320,169 +294,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
#define ithread_mutex_destroy pthread_mutex_destroy
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlockattr_init
|
||||
*
|
||||
* Description:
|
||||
* Initializes a rwlock attribute variable to default values.
|
||||
* Parameters:
|
||||
* const ithread_rwlockattr_init *attr (must be valid non NULL pointer to
|
||||
* pthread_rwlockattr_t)
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlockattr_init
|
||||
***************************************************************************/
|
||||
#define ithread_rwlockattr_init pthread_rwlockattr_init
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlockattr_destroy
|
||||
*
|
||||
* Description:
|
||||
* Releases any resources held by the rwlock attribute.
|
||||
* Parameters:
|
||||
* ithread_rwlockattr_t *attr (must be valid non NULL pointer to
|
||||
* pthread_rwlockattr_t)
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlockattr_destroy
|
||||
***************************************************************************/
|
||||
#define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlockatttr_setpshared
|
||||
*
|
||||
* Description:
|
||||
* Sets the rwlock type in the attribute.
|
||||
* Valid types are: ITHREAD_PROCESS_PRIVATE
|
||||
* ITHREAD_PROCESS_SHARED
|
||||
*
|
||||
* Parameters:
|
||||
* ithread_rwlockattr_t * attr (must be valid non NULL pointer to
|
||||
* ithread_rwlockattr_t)
|
||||
* int kind (one of ITHREAD_PROCESS_PRIVATE or ITHREAD_PROCESS_SHARED)
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success. Nonzero on failure.
|
||||
* Returns EINVAL if the kind is not supported.
|
||||
* See man page for pthread_rwlockattr_setkind_np
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlockatttr_getpshared
|
||||
*
|
||||
* Description:
|
||||
* Gets the rwlock type in the attribute.
|
||||
* Valid types are: ITHREAD_PROCESS_PRIVATE
|
||||
* ITHREAD_PROCESS_SHARED
|
||||
*
|
||||
* Parameters:
|
||||
* ithread_rwlockattr_t * attr (must be valid non NULL pointer to
|
||||
* pthread_rwlockattr_t)
|
||||
* int *kind (one of ITHREAD_PROCESS_PRIVATE or ITHREAD_PROCESS_SHARED)
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success. Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlockatttr_getpshared
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlock_init
|
||||
*
|
||||
* Description:
|
||||
* Initializes rwlock.
|
||||
* Must be called before use.
|
||||
*
|
||||
* Parameters:
|
||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||
* const ithread_rwlockattr_t * rwlock_attr
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlock_init
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlock_init pthread_rwlock_init
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlock_rdlock
|
||||
*
|
||||
* Description:
|
||||
* Locks rwlock for reading.
|
||||
* Parameters:
|
||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||
* rwlock must be initialized.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlock_rdlock
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlock_rdlock pthread_rwlock_rdlock
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlock_wrlock
|
||||
*
|
||||
* Description:
|
||||
* Locks rwlock for writting.
|
||||
* Parameters:
|
||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||
* rwlock must be initialized.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlock_wrlock
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlock_wrlock pthread_rwlock_wrlock
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlock_unlock
|
||||
*
|
||||
* Description:
|
||||
* Unlocks rwlock.
|
||||
*
|
||||
* Parameters:
|
||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||
* rwlock must be initialized.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlock_unlock
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlock_unlock pthread_rwlock_unlock
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_rwlock_destroy
|
||||
*
|
||||
* Description:
|
||||
* Releases any resources held by the rwlock.
|
||||
* rwlock can no longer be used after this call.
|
||||
* rwlock is only destroyed when there are no longer any threads waiting on it.
|
||||
* rwlock cannot be destroyed if it is locked.
|
||||
* Parameters:
|
||||
* ithread_rwlock_t * rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||
* rwlock must be initialized.
|
||||
* Returns:
|
||||
* 0 on success. Nonzero on failure.
|
||||
* Always returns 0.
|
||||
* See man page for pthread_rwlock_destroy
|
||||
*****************************************************************************/
|
||||
#define ithread_rwlock_destroy pthread_rwlock_destroy
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_cond_init
|
||||
*
|
||||
@@ -735,7 +546,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
#ifdef WIN32
|
||||
#ifndef UPNP_STATIC_LIB
|
||||
#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)
|
||||
#else
|
||||
#define EXPORT_SPEC __declspec(dllimport)
|
||||
@@ -749,7 +560,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
|
||||
|
||||
#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);
|
||||
#endif
|
||||
|
||||
@@ -757,5 +568,4 @@ EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ITHREADH */
|
||||
|
||||
#endif //ITHREADH
|
||||
|
@@ -30,8 +30,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "LinkedList.h"
|
||||
#include <sys/param.h>
|
||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
|
||||
#ifdef __FreeBSD__
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
|
File diff suppressed because it is too large
Load Diff
152
threadutil/src/iasnprintf.c
Normal file
152
threadutil/src/iasnprintf.c
Normal file
@@ -0,0 +1,152 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <stdarg.h>
|
||||
#include <assert.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "iasnprintf.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocates enough memory for the
|
||||
* Formatted string, up to max
|
||||
* specified.
|
||||
* With max set to -1, it allocates as
|
||||
* much size as needed.
|
||||
* Memory must be freed using free.
|
||||
*/
|
||||
|
||||
int
|
||||
iasnprintf( char **ret,
|
||||
int incr,
|
||||
int max,
|
||||
const char *fmt,
|
||||
... )
|
||||
{
|
||||
int size = incr;
|
||||
int retc = 0;
|
||||
va_list ap;
|
||||
char *temp = NULL;
|
||||
|
||||
assert( ret );
|
||||
assert( fmt );
|
||||
( *ret ) = ( char * )malloc( incr );
|
||||
|
||||
if( ( *ret ) == NULL ) return -1;
|
||||
|
||||
while( 1 ) {
|
||||
va_start( ap, fmt );
|
||||
retc = vsnprintf( ( *ret ), size, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
if( retc < 0 ) {
|
||||
//size not big enough
|
||||
//and vsnprintf does NOT return the
|
||||
//necessary number of bytes
|
||||
if( ( max != -1 ) && ( size == max ) ) //max reached
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
incr *= 2; //increase increment
|
||||
//increase size and try again
|
||||
if( ( max != -1 ) && ( ( size + incr ) > max ) ) {
|
||||
incr = ( max - size );
|
||||
}
|
||||
|
||||
temp = ( char * )realloc( ( *ret ), size + incr );
|
||||
if( temp == NULL ) {
|
||||
break;
|
||||
}
|
||||
size += incr;
|
||||
( *ret ) = temp;
|
||||
|
||||
} else {
|
||||
if( ( retc + 1 ) > size ) {
|
||||
//size not big enough
|
||||
//and vsnprintf
|
||||
//returns the necessary
|
||||
//number of bytes
|
||||
if( ( max != -1 ) && ( retc + 1 > max ) ) {
|
||||
retc = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
temp = ( char * )realloc( ( *ret ), retc + 1 );
|
||||
if( temp == NULL ) {
|
||||
retc = -1;
|
||||
break;
|
||||
}
|
||||
size = retc + 1;
|
||||
( *ret ) = temp; //size increased try again
|
||||
} else if( ( retc + 1 ) < size ) {
|
||||
//size is bigger than needed
|
||||
//try and reallocate smaller
|
||||
|
||||
temp = ( char * )realloc( ( *ret ), retc + 1 );
|
||||
if( temp != NULL ) {
|
||||
( *ret ) = temp;
|
||||
}
|
||||
break;
|
||||
} else //size is just right, exit
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( retc < 0 ) {
|
||||
free( ( *ret ) );
|
||||
( *ret ) = NULL;
|
||||
}
|
||||
|
||||
return retc;
|
||||
}
|
||||
|
||||
void
|
||||
iasnprintfFree( char *fChar )
|
||||
{
|
||||
free( fChar );
|
||||
fChar = NULL;
|
||||
}
|
144
upnp/Makefile.am
144
upnp/Makefile.am
@@ -1,89 +1,69 @@
|
||||
# $Id: Makefile.am,v 1.10 2006/04/08 15:22:22 r3mi Exp $
|
||||
#
|
||||
# "Makefile.am" for "libupnp/upnp"
|
||||
#
|
||||
# Copyright (C) 2005 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
#
|
||||
|
||||
SUBDIRS = doc . sample
|
||||
SUBDIRS = doc
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(srcdir)/inc \
|
||||
AM_CPPFLAGS = -I$(srcdir)/inc \
|
||||
-I$(top_srcdir)/threadutil/inc \
|
||||
-I$(top_srcdir)/ixml/inc
|
||||
|
||||
LDADD = \
|
||||
libupnp.la \
|
||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||
|
||||
AM_LDFLAGS = $(PTHREAD_LIBS)
|
||||
|
||||
LDADD = libupnp.la \
|
||||
$(top_builddir)/threadutil/libthreadutil.la \
|
||||
$(top_builddir)/ixml/libixml.la
|
||||
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = \
|
||||
inc/upnp.h \
|
||||
inc/upnpdebug.h
|
||||
|
||||
upnpinclude_HEADERS = inc/upnp.h
|
||||
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
||||
if ENABLE_TOOLS
|
||||
upnpinclude_HEADERS += inc/upnptools.h
|
||||
endif
|
||||
|
||||
if ENABLE_DEBUG
|
||||
upnpinclude_HEADERS += inc/upnpdebug.h
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = libupnp.la
|
||||
|
||||
libupnp_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/inc
|
||||
|
||||
libupnp_la_LDFLAGS = \
|
||||
-version-info $(LT_VERSION_UPNP) \
|
||||
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/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 \
|
||||
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 \
|
||||
libupnp_la_SOURCES += src/soap/soap_device.c src/soap/soap_ctrlpt.c \
|
||||
src/soap/soap_common.c
|
||||
|
||||
# genlib
|
||||
@@ -104,9 +84,7 @@ libupnp_la_SOURCES += \
|
||||
src/genlib/net/uri/uri.c
|
||||
|
||||
# gena
|
||||
libupnp_la_SOURCES += \
|
||||
src/gena/gena_device.c \
|
||||
src/gena/gena_ctrlpt.c \
|
||||
libupnp_la_SOURCES += src/gena/gena_device.c src/gena/gena_ctrlpt.c \
|
||||
src/gena/gena_callback2.c
|
||||
|
||||
# api
|
||||
@@ -118,32 +96,68 @@ if ENABLE_DEBUG
|
||||
libupnp_la_SOURCES += src/api/upnpdebug.c
|
||||
endif
|
||||
|
||||
|
||||
# uuid
|
||||
libupnp_la_SOURCES += \
|
||||
src/uuid/md5.c \
|
||||
src/uuid/sysdep.c \
|
||||
src/uuid/uuid.c
|
||||
|
||||
libupnp_la_SOURCES += src/uuid/md5.c src/uuid/sysdep.c src/uuid/uuid.c
|
||||
|
||||
# urlconfig
|
||||
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_PROGRAMS = test_init
|
||||
TESTS = test_init
|
||||
|
||||
test_init_SOURCES = test/test_init.c
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
LICENSE \
|
||||
EXTRA_DIST = LICENSE \
|
||||
sample/tvdevice/web/tvcontrolSCPD.xml \
|
||||
sample/tvdevice/web/tvdevicedesc.xml \
|
||||
sample/tvdevice/web/tvdevicepres.html \
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
398
upnp/inc/upnp.h
398
upnp/inc/upnp.h
@@ -1,41 +1,40 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_H
|
||||
#define UPNP_H
|
||||
|
||||
/** @name The API */
|
||||
|
||||
/*! @{ */
|
||||
|
||||
//@{
|
||||
|
||||
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
||||
#if defined __GNUC__
|
||||
@@ -45,20 +44,20 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
#if (defined(BSD) && BSD >= 199306)
|
||||
#ifdef __FreeBSD__
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include "ixml.h"
|
||||
#include "upnpconfig.h"
|
||||
|
||||
#if UPNP_HAVE_DEBUG
|
||||
# include "upnpdebug.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef UPNP_STATIC_LIB
|
||||
#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)
|
||||
#else
|
||||
#define EXPORT_SPEC __declspec(dllimport)
|
||||
@@ -66,36 +65,16 @@
|
||||
#else
|
||||
#define EXPORT_SPEC
|
||||
#endif
|
||||
#ifdef UPNP_USE_MSVCPP
|
||||
/* define some things the M$ VC++ doesn't know */
|
||||
#define UPNP_INLINE
|
||||
#ifdef UPNP_USE_MSVCPP // define some things the M$ VC++ doesn't knows
|
||||
typedef __int64 int64_t;
|
||||
#define PRId64 "I64d"
|
||||
#define PRIzu "lu"
|
||||
#endif
|
||||
#ifdef UPNP_USE_BCBPP
|
||||
/* define some things Borland Builder doesn't know */
|
||||
#define UPNP_INLINE inline
|
||||
#ifdef UPNP_USE_BCBPP // define some things Borland Builder doesn't knows
|
||||
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
|
||||
#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
|
||||
|
||||
/*
|
||||
* 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
|
||||
#define UpnpCloseSocket close
|
||||
#else
|
||||
@@ -108,7 +87,6 @@
|
||||
#define SOCKET int
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#else
|
||||
@@ -116,10 +94,8 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#define NUM_HANDLE 200
|
||||
#define LINE_SIZE 180
|
||||
#define NAME_SIZE 256
|
||||
@@ -128,6 +104,7 @@
|
||||
#define SERL_NUMR_SIZE 64
|
||||
#define MODL_DESC_SIZE 64
|
||||
#define UPNP_INFINITE -1
|
||||
|
||||
#define UPNP_USING_CHUNKED -3
|
||||
#define UPNP_UNTIL_CLOSE -4
|
||||
|
||||
@@ -139,7 +116,7 @@
|
||||
* code means. Refer to the documentation for each function for a
|
||||
* description of what an error code means in that context.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** @name UPNP_E_SUCCESS [0]
|
||||
* {\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 entire operation comes as part of the callback for that operation.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SUCCESS 0
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INVALID_HANDLE [-100]
|
||||
* {\tt UPNP_E_INVALID_HANDLE} signifies that the handle passed to a
|
||||
* function is not a recognized as a valid handle.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_HANDLE -100
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INVALID_PARAM [-101]
|
||||
* {\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
|
||||
* function for more information on the valid ranges of the parameters.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_PARAM -101
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_OUTOF_HANDLE [-102]
|
||||
* {\tt UPNP_E_OUTOF_HANDLE} signifies that the SDK does not have any
|
||||
* more space for additional handles. The SDK allocates space for only
|
||||
* a few handles in order to conserve memory.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_OUTOF_HANDLE -102
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_OUTOF_CONTEXT -103
|
||||
|
||||
@@ -184,9 +161,9 @@
|
||||
* currently available to complete the operation. Most operations require
|
||||
* some free memory in order to complete their work.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_OUTOF_MEMORY -104
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INIT [-105]
|
||||
* {\tt UPNP_E_INIT} signifies that the SDK has already been
|
||||
@@ -194,9 +171,9 @@
|
||||
* Any additional initialization attempts simply return this error with
|
||||
* no other ill effects.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INIT -105
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_BUFFER_TOO_SMALL -106
|
||||
|
||||
@@ -205,9 +182,9 @@
|
||||
* to {\bf UpnpRegisterRootDevice} or {\bf UpnpRegisterRootDevice2} is an
|
||||
* invalid description document.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_DESC -107
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INVALID_URL [-108]
|
||||
* {\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
|
||||
* the host might be unreachable.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_URL -108
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_INVALID_SID -109
|
||||
#define UPNP_E_INVALID_DEVICE -110
|
||||
@@ -228,18 +205,18 @@
|
||||
* {\bf UpnpAcceptSubscriptionExt} to signify that the device ID/service
|
||||
* ID pair does not refer to a valid service.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_SERVICE -111
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_BAD_RESPONSE [-113]
|
||||
* {\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
|
||||
* to the GENA, SOAP, and HTTP protocols.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_BAD_RESPONSE -113
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_BAD_REQUEST -114
|
||||
|
||||
@@ -248,26 +225,26 @@
|
||||
* 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.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_ACTION -115
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_FINISH [-116]
|
||||
* {\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
|
||||
* operate until {\bf UpnpInit} successfully completes.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_FINISH -116
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INIT_FAILED [-117]
|
||||
* {\tt UPNP_E_INIT_FAILED} signifies that {\bf UpnpInit} cannot complete.
|
||||
* The typical reason is failure to allocate sufficient resources.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INIT_FAILED -117
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_URL_TOO_BIG [-118]
|
||||
* {\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
|
||||
* UpnpNotify}), and HTTP transfers (e.g. {\bf UpnpDownloadXmlDoc}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_BAD_HTTPMSG -119
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_ALREADY_REGISTERED [-120]
|
||||
* {\tt UPNP_E_ALREADY_REGISTERED} signifies that a client or a device is
|
||||
* already registered. The SDK currently has a limit of one registered
|
||||
* client and one registered device per process.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_ALREADY_REGISTERED -120
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_NETWORK_ERROR [-200]
|
||||
* {\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
|
||||
* the sockets.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_NETWORK_ERROR -200
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_SOCKET_WRITE [-201]
|
||||
* {\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}),
|
||||
* and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SOCKET_WRITE -201
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_SOCKET_READ [-202]
|
||||
* {\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}),
|
||||
* and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SOCKET_READ -202
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_SOCKET_BIND [-203]
|
||||
* {\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.
|
||||
* {\bf UpnpDownloadXmlDoc}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SOCKET_BIND -203
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_SOCKET_CONNECT [-204]
|
||||
* {\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.
|
||||
* {\bf UpnpDownloadXmlDoc}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SOCKET_CONNECT -204
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_OUTOF_SOCKET [-205]
|
||||
* {\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.
|
||||
* {\bf UpnpDownloadXmlDoc}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_OUTOF_SOCKET -205
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_LISTEN [-206]
|
||||
* {\tt UPNP_E_LISTEN} signifies that the SDK had a problem setting the
|
||||
* socket to listen for incoming connections. This error only happens during
|
||||
* initialization (i.e. {\bf UpnpInit}).
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_LISTEN -206
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_TIMEDOUT [-207]
|
||||
* {\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
|
||||
* can be returned by any function that performs network operations.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_TIMEDOUT -207
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_SOCKET_ERROR [-208]
|
||||
* {\tt UPNP_E_SOCKET_ERROR} is the generic socket error code for
|
||||
* conditions not covered by other error codes. This error can be returned
|
||||
* by any function that performs network operations.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SOCKET_ERROR -208
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_FILE_WRITE_ERROR -209
|
||||
|
||||
@@ -399,9 +376,9 @@
|
||||
* error can be returned by any function that allows for external
|
||||
* cancelation.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_CANCELED -210
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_EVENT_PROTOCOL -300
|
||||
|
||||
@@ -409,58 +386,58 @@
|
||||
* {\tt UPNP_E_SUBSCRIBE_UNACCEPTED} signifies that a subscription
|
||||
* request was rejected from the remote side.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_SUBSCRIBE_UNACCEPTED -301
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_UNSUBSCRIBE_UNACCEPTED [-302]
|
||||
/** @name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302]
|
||||
* {\tt UPNP_E_UNSUBSCRIBE_UNACCEPTED} signifies that an unsubscribe
|
||||
* request was rejected from the remote side.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_UNSUBSCRIBE_UNACCEPTED -302
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_NOTIFY_UNACCEPTED [-303]
|
||||
* {\tt UPNP_E_NOTIFY_UNACCEPTED} signifies that the remote host did not
|
||||
* accept the notify sent from the local device.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_NOTIFY_UNACCEPTED -303
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INVALID_ARGUMENT [-501]
|
||||
* {\tt UPNP_E_INVALID_ARGUMENT} signifies that one or more of the parameters
|
||||
* passed to a function is invalid. Refer to the individual function
|
||||
* descriptions for the acceptable ranges for parameters.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_INVALID_ARGUMENT -501
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_FILE_NOT_FOUND [-502]
|
||||
* {\tt UPNP_E_FILE_NOT_FOUND} signifies that the filename passed
|
||||
* to one of the device registration functions was not found or was not
|
||||
* accessible.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_FILE_NOT_FOUND -502
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_FILE_READ_ERROR [-503]
|
||||
* {\tt UPNP_E_FILE_READ_ERROR} signifies an error when reading a file.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_FILE_READ_ERROR -503
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_EXT_NOT_XML [-504]
|
||||
* {\tt UPNP_E_EXT_NOT_XML} signifies that the file name of the description
|
||||
* document passed to {\bf UpnpRegisterRootDevice2} does not end in ".xml".
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_EXT_NOT_XML -504
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#define UPNP_E_NO_WEB_SERVER -505
|
||||
#define UPNP_E_OUTOF_BOUNDS -506
|
||||
@@ -469,26 +446,26 @@
|
||||
* {\tt UPNP_E_NOT_FOUND} signifies that the response to a SOAP request
|
||||
* did not contain the required XML constructs.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#define UPNP_E_NOT_FOUND -507
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
/** @name UPNP_E_INTERNAL_ERROR [-911]
|
||||
* {\tt UPNP_E_INTERNAL_ERROR} is the generic error code for internal
|
||||
* conditions not covered by other error codes.
|
||||
*/
|
||||
/*! @{ */
|
||||
//@{
|
||||
#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_ARGS 402
|
||||
#define UPNP_SOAP_E_OUT_OF_SYNC 403
|
||||
#define UPNP_SOAP_E_INVALID_VAR 404
|
||||
#define UPNP_SOAP_E_ACTION_FAILED 501
|
||||
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#ifndef OUT
|
||||
#define OUT
|
||||
@@ -502,12 +479,10 @@
|
||||
#define INOUT
|
||||
#endif
|
||||
|
||||
#include "upnpdebug.h"
|
||||
|
||||
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
|
||||
* UpnpRegisterClient}. Client handles can only be used with
|
||||
@@ -530,9 +505,9 @@ typedef int UpnpDevice_Handle;
|
||||
|
||||
enum Upnp_EventType_e {
|
||||
|
||||
/*
|
||||
* Control callbacks
|
||||
*/
|
||||
//
|
||||
// Control callbacks
|
||||
//
|
||||
|
||||
/** Received by a device when a control point issues a control
|
||||
* request. The {\bf Event} parameter contains a pointer to a {\bf
|
||||
@@ -560,9 +535,9 @@ enum Upnp_EventType_e {
|
||||
|
||||
UPNP_CONTROL_GET_VAR_COMPLETE,
|
||||
|
||||
/*
|
||||
* Discovery callbacks
|
||||
*/
|
||||
//
|
||||
// Discovery callbacks
|
||||
//
|
||||
|
||||
/** Received by a control point when a new device or service is available.
|
||||
* The {\bf Event} parameter contains a pointer to a {\bf
|
||||
@@ -591,9 +566,9 @@ enum Upnp_EventType_e {
|
||||
|
||||
UPNP_DISCOVERY_SEARCH_TIMEOUT,
|
||||
|
||||
/*
|
||||
* Eventing callbacks
|
||||
*/
|
||||
//
|
||||
// Eventing callbacks
|
||||
//
|
||||
|
||||
/** Received by a device when a subscription arrives.
|
||||
* The {\bf Event} parameter contains a pointer to a {\bf
|
||||
@@ -824,15 +799,18 @@ struct Upnp_Event
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* This typedef is required by Doc++ to parse the last entry of the
|
||||
* Upnp_Discovery structure correctly.
|
||||
*/
|
||||
//
|
||||
// This typedef is required by Doc++ to parse the last entry of the
|
||||
// Upnp_Discovery structure correctly.
|
||||
//
|
||||
|
||||
typedef struct sockaddr_in SOCKADDRIN;
|
||||
|
||||
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
|
||||
|
||||
struct Upnp_Discovery
|
||||
{
|
||||
|
||||
/** The result code of the {\bf UpnpSearchAsync} call. */
|
||||
int ErrCode;
|
||||
|
||||
@@ -864,7 +842,8 @@ struct Upnp_Discovery
|
||||
char Ext[LINE_SIZE];
|
||||
|
||||
/** The host address of the device responding to the search. */
|
||||
struct sockaddr_in DestAddr;
|
||||
SOCKADDRIN * DestAddr;
|
||||
|
||||
};
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf
|
||||
@@ -1068,14 +1047,14 @@ typedef int (*Upnp_FunPtr) (
|
||||
IN void *Cookie
|
||||
);
|
||||
|
||||
/*! @} */ /* Constants, Structures, and Types */
|
||||
//@} // Constants, Structures, and Types
|
||||
|
||||
#ifdef __cplusplus
|
||||
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
|
||||
* 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}
|
||||
@@ -1386,18 +1365,18 @@ EXPORT_SPEC int UpnpSetMaxContentLength(
|
||||
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
|
||||
* search target. The function returns immediately and the SDK
|
||||
@@ -1456,18 +1435,18 @@ EXPORT_SPEC int UpnpSendAdvertisement(
|
||||
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
|
||||
* 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. */
|
||||
);
|
||||
|
||||
/*! @} */ /* 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
|
||||
* out the current state of the eventable variables for a service.
|
||||
@@ -2204,19 +2183,19 @@ EXPORT_SPEC int UpnpUnSubscribeAsync(
|
||||
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.
|
||||
* The SDK allocates the memory for {\bf outBuf} and the
|
||||
@@ -2609,18 +2588,18 @@ EXPORT_SPEC int UpnpDownloadXmlDoc(
|
||||
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
|
||||
* the internal web server. This directory is considered the
|
||||
@@ -2736,13 +2715,12 @@ EXPORT_SPEC void UpnpFree(
|
||||
IN void *item /* The item to free. */
|
||||
);
|
||||
|
||||
/*! @} */ /* Web Server API */
|
||||
//@} // Web Server API
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif // __cplusplus
|
||||
|
||||
/*! @} */ /* The API */
|
||||
//@} The API
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -1,34 +1,34 @@
|
||||
/* -*- C -*- */
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
// -*- C -*-
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
// 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_CONFIG_H
|
||||
#define UPNP_CONFIG_H
|
||||
@@ -91,5 +91,6 @@
|
||||
#undef UPNP_HAVE_TOOLS
|
||||
|
||||
|
||||
#endif /* UPNP_CONFIG_H */
|
||||
#endif // UPNP_CONFIG_H
|
||||
|
||||
|
||||
|
@@ -1,41 +1,43 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2000-2003 Intel Corporation
|
||||
// Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||
// 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_DEBUG_H
|
||||
#define UPNP_DEBUG_H
|
||||
|
||||
#include "upnp.h"
|
||||
#include "upnpconfig.h"
|
||||
|
||||
// Function declarations only if debug compiled into the library
|
||||
#if UPNP_HAVE_DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -47,7 +49,7 @@ extern "C" {
|
||||
The UPnP SDK contains other features to aid in debugging.
|
||||
*/
|
||||
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
/** @name Upnp_LogLevel
|
||||
* The user has the option to select 4 different types of debugging levels,
|
||||
@@ -68,25 +70,18 @@ extern "C" {
|
||||
* \end{itemize}
|
||||
*/
|
||||
|
||||
typedef enum Upnp_Module {
|
||||
SSDP,
|
||||
SOAP,
|
||||
GENA,
|
||||
TPOOL,
|
||||
MSERV,
|
||||
DOM,
|
||||
API,
|
||||
HTTP
|
||||
} Dbg_Module;
|
||||
|
||||
/*! @{ */
|
||||
typedef enum Upnp_Module {SSDP,SOAP,GENA,TPOOL,MSERV,DOM,API, HTTP} Dbg_Module;
|
||||
//@{
|
||||
typedef enum Upnp_LogLevel_e {
|
||||
UPNP_CRITICAL,
|
||||
UPNP_PACKET,
|
||||
UPNP_INFO,
|
||||
UPNP_ALL
|
||||
} Upnp_LogLevel;
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
// for backward compatibility
|
||||
#define Dbg_Level Upnp_LogLevel
|
||||
|
||||
|
||||
/**
|
||||
@@ -103,32 +98,26 @@ typedef enum Upnp_LogLevel_e {
|
||||
*
|
||||
* Description:
|
||||
* This functions initializes the log files
|
||||
*
|
||||
* Returns: int
|
||||
* -1 : If fails
|
||||
* UPNP_E_SUCCESS : if success
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
int UpnpInitLog();
|
||||
#else
|
||||
static UPNP_INLINE int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
||||
#endif
|
||||
|
||||
// for backward compatibility
|
||||
#define InitLog UpnpInitLog
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpSetLogLevel
|
||||
*
|
||||
* Parameters: Upnp_LogLevel log_level
|
||||
* Parameters: void
|
||||
*
|
||||
* Description:
|
||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
||||
#endif
|
||||
void UpnpSetLogLevel (Upnp_LogLevel);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@@ -140,11 +129,10 @@ static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
||||
* This functions closes the log files
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpCloseLog();
|
||||
#else
|
||||
static UPNP_INLINE void UpnpCloseLog() {}
|
||||
#endif
|
||||
|
||||
// for backward compatibility
|
||||
#define CloseLog UpnpCloseLog
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@@ -161,22 +149,17 @@ static UPNP_INLINE void UpnpCloseLog() {}
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpSetLogFileNames(
|
||||
const char *ErrFileName,
|
||||
const char *InfoFileName);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpSetLogFileNames(
|
||||
const char *ErrFileName,
|
||||
const char *InfoFileName) {}
|
||||
#endif
|
||||
void UpnpSetLogFileNames (const char* ErrFileName, const char* InfoFileName);
|
||||
|
||||
// for backward compatibility
|
||||
#define SetLogFileNames UpnpSetLogFileNames
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpGetDebugFile
|
||||
*
|
||||
* 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,
|
||||
* or any of the log files.
|
||||
* 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
|
||||
* else returns the right file descriptor
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
FILE* UpnpGetDebugFile (Upnp_LogLevel level, Dbg_Module module);
|
||||
#else
|
||||
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* 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
|
||||
// for backward compatibility
|
||||
#define GetDebugFile UpnpGetDebugFile
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpPrintf
|
||||
*
|
||||
* 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,
|
||||
* or any of the log files.
|
||||
* 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
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpPrintf(
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module,
|
||||
const char* DbgFileName,
|
||||
int DbgLineNo,
|
||||
void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module,
|
||||
const char* DbgFileName, int DbgLineNo,
|
||||
const char* FmtStr,
|
||||
...)
|
||||
#if (__GNUC__ >= 3)
|
||||
/* This enables printf like format checking by the compiler */
|
||||
__attribute__((format (__printf__, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
#else /* DEBUG */
|
||||
static UPNP_INLINE void UpnpPrintf(
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module,
|
||||
const char* DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char* FmtStr,
|
||||
...) {}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@@ -283,19 +222,8 @@ static UPNP_INLINE void UpnpPrintf(
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
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
|
||||
void UpnpDisplayBanner (FILE *fd,
|
||||
const char** lines, size_t size, int starlength);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@@ -312,23 +240,19 @@ static UPNP_INLINE void UpnpDisplayBanner(
|
||||
* debug statement is coming to the log file
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayFileAndLine(
|
||||
FILE *fd,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
||||
FILE *fd,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo) {}
|
||||
#endif
|
||||
void UpnpDisplayFileAndLine (FILE *fd, const char *DbgFileName, int DbgLineNo);
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPNP_DEBUG_H */
|
||||
#endif // UPNP_HAVE_DEBUG
|
||||
|
||||
#endif // UPNP_DEBUG_H
|
||||
|
||||
|
||||
|
||||
|
@@ -1,33 +1,33 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** @name Optional Tool APIs
|
||||
* The Linux SDK for UPnP Devices contains some additional, optional
|
||||
@@ -36,14 +36,14 @@
|
||||
* size in the SDK. Refer to the README for details.
|
||||
*/
|
||||
|
||||
/*! @{ */
|
||||
//@{
|
||||
|
||||
#ifndef UPNP_TOOLS_H
|
||||
#define UPNP_TOOLS_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
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -217,13 +217,14 @@ EXPORT_SPEC const char * UpnpGetErrorMessage(
|
||||
int errorcode /** The SDK error code to convert. */
|
||||
);
|
||||
|
||||
/*! @} */
|
||||
//@}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPNP_HAVE_TOOLS */
|
||||
#endif // UPNP_HAVE_TOOLS
|
||||
|
||||
#endif // UPNP_TOOLS_H
|
||||
|
||||
#endif /* UPNP_TOOLS_H */
|
||||
|
||||
|
@@ -1,83 +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
|
||||
|
||||
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
|
@@ -1362,7 +1362,7 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
ithread_mutex_init( &DeviceListMutex, 0 );
|
||||
|
||||
SampleUtil_Print( "Initializing UPnP with ipaddress=%s port=%d",
|
||||
SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d",
|
||||
ip_address, port );
|
||||
rc = UpnpInit( ip_address, port );
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
|
@@ -7,6 +7,7 @@
|
||||
</specVersion>
|
||||
|
||||
|
||||
|
||||
<actionList>
|
||||
|
||||
<action>
|
||||
@@ -37,12 +38,6 @@
|
||||
<name>SetChannel</name>
|
||||
<argumentList>
|
||||
|
||||
<argument>
|
||||
<name>Channel</name>
|
||||
<relatedStateVariable>Channel</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>NewChannel</name>
|
||||
<retval />
|
||||
@@ -50,6 +45,11 @@
|
||||
<direction>out</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>Channel</name>
|
||||
<relatedStateVariable>Channel</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
|
||||
@@ -80,11 +80,6 @@
|
||||
<action>
|
||||
<name>SetVolume</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
<name>Volume</name>
|
||||
<relatedStateVariable>Volume</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>NewVolume</name>
|
||||
@@ -92,6 +87,11 @@
|
||||
<relatedStateVariable>Volume</relatedStateVariable>
|
||||
<direction>out</direction>
|
||||
</argument>
|
||||
<argument>
|
||||
<name>Volume</name>
|
||||
<relatedStateVariable>Volume</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
|
||||
@@ -124,6 +124,9 @@
|
||||
|
||||
</actionList>
|
||||
|
||||
|
||||
|
||||
|
||||
<serviceStateTable>
|
||||
|
||||
<stateVariable sendEvents="yes">
|
@@ -12,12 +12,6 @@
|
||||
<action>
|
||||
<name>SetColor</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
<name>Color</name>
|
||||
<relatedStateVariable>Color</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>NewColor</name>
|
||||
<retval />
|
||||
@@ -25,6 +19,11 @@
|
||||
<direction>out</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>Color</name>
|
||||
<relatedStateVariable>Color</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
|
||||
@@ -55,11 +54,6 @@
|
||||
<action>
|
||||
<name>SetTint</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
<name>Tint</name>
|
||||
<relatedStateVariable>Tint</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
<argument>
|
||||
<name>NewTint</name>
|
||||
<retval />
|
||||
@@ -67,6 +61,11 @@
|
||||
<direction>out</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>Tint</name>
|
||||
<relatedStateVariable>Tint</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
|
||||
@@ -97,17 +96,17 @@
|
||||
<action>
|
||||
<name>SetContrast</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
<name>Contrast</name>
|
||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
<argument>
|
||||
<name>NewContrast</name>
|
||||
<retval />
|
||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||
<direction>out</direction>
|
||||
</argument>
|
||||
<argument>
|
||||
<name>Contrast</name>
|
||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
|
||||
@@ -138,17 +137,19 @@
|
||||
<action>
|
||||
<name>SetBrightness</name>
|
||||
<argumentList>
|
||||
<argument>
|
||||
<name>Brightness</name>
|
||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>NewBrightness</name>
|
||||
<retval />
|
||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||
<direction>out</direction>
|
||||
</argument>
|
||||
|
||||
<argument>
|
||||
<name>Brightness</name>
|
||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||
<direction>in</direction>
|
||||
</argument>
|
||||
</argumentList>
|
||||
</action>
|
||||
|
||||
@@ -181,6 +182,7 @@
|
||||
</actionList>
|
||||
|
||||
|
||||
|
||||
<serviceStateTable>
|
||||
|
||||
<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
@@ -94,7 +94,6 @@ UpnpSetLogFileNames ( IN const char *ErrFileName,
|
||||
*
|
||||
* Description:
|
||||
* This functions initializes the log files
|
||||
*
|
||||
* Returns: int
|
||||
* -1 : If fails
|
||||
* UPNP_E_SUCCESS : if success
|
||||
@@ -117,7 +116,7 @@ UpnpInitLog()
|
||||
/***************************************************************************
|
||||
* Function : UpnpSetLogLevel
|
||||
*
|
||||
* Parameters: Upnp_LogLevel log_level
|
||||
* Parameters: void
|
||||
*
|
||||
* Description:
|
||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||
@@ -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
|
||||
*
|
||||
* 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,
|
||||
* or any of the log files.
|
||||
* IN Dbg_Module Module: debug will go in the name of this module
|
||||
@@ -210,53 +173,71 @@ int DebugAtThisLevel(
|
||||
* statement is coming
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpPrintf(
|
||||
IN Upnp_LogLevel DLevel,
|
||||
DBGONLY( void UpnpPrintf( IN Upnp_LogLevel DLevel,
|
||||
IN Dbg_Module Module,
|
||||
IN const char *DbgFileName,
|
||||
IN int DbgLineNo,
|
||||
IN const char *FmtStr,
|
||||
... )
|
||||
{
|
||||
... ) {
|
||||
|
||||
va_list ArgList;
|
||||
|
||||
if (!DebugAtThisLevel(DLevel, Module)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ithread_mutex_lock(&GlobalDebugMutex);
|
||||
va_start( ArgList, FmtStr );
|
||||
if (!DEBUG_TARGET) {
|
||||
if( g_log_level < DLevel ) return; if( DEBUG_ALL == 0 ) {
|
||||
switch ( Module ) {
|
||||
case SSDP:
|
||||
if( DEBUG_SSDP == 1 ) break;
|
||||
else
|
||||
return; case SOAP:
|
||||
if( DEBUG_SOAP == 1 ) break;
|
||||
else
|
||||
return; case GENA:
|
||||
if( DEBUG_GENA == 1 ) break;
|
||||
else
|
||||
return; case TPOOL:
|
||||
if( DEBUG_TPOOL == 1 ) break;
|
||||
else
|
||||
return; case MSERV:
|
||||
if( DEBUG_MSERV == 1 ) break;
|
||||
else
|
||||
return; case DOM:
|
||||
if( DEBUG_DOM == 1 ) break;
|
||||
else
|
||||
return; case HTTP:
|
||||
if( DEBUG_HTTP == 1 ) break;
|
||||
else
|
||||
return; case API:
|
||||
if( DEBUG_API == 1 ) break;
|
||||
else
|
||||
return; default:
|
||||
return;}
|
||||
}
|
||||
|
||||
ithread_mutex_lock( &GlobalDebugMutex ); if( DEBUG_TARGET == 0 ) {
|
||||
if( DbgFileName ) {
|
||||
UpnpDisplayFileAndLine(stdout, DbgFileName, DbgLineNo);
|
||||
}
|
||||
vfprintf(stdout, FmtStr, ArgList);
|
||||
fflush(stdout);
|
||||
} else if (DLevel == 0) {
|
||||
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 {
|
||||
UpnpDisplayFileAndLine( ErrFileHnd, DbgFileName, DbgLineNo );}
|
||||
vfprintf( ErrFileHnd, FmtStr, ArgList ); fflush( ErrFileHnd );}
|
||||
else
|
||||
{
|
||||
if( DbgFileName ) {
|
||||
UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, DbgLineNo);
|
||||
UpnpDisplayFileAndLine( InfoFileHnd, DbgFileName, DbgLineNo );}
|
||||
vfprintf( InfoFileHnd, FmtStr, ArgList ); fflush( InfoFileHnd );}
|
||||
}
|
||||
vfprintf(InfoFileHnd, FmtStr, ArgList);
|
||||
fflush(InfoFileHnd);
|
||||
}
|
||||
va_end(ArgList);
|
||||
ithread_mutex_unlock(&GlobalDebugMutex);
|
||||
}
|
||||
#endif
|
||||
va_end( ArgList ); ithread_mutex_unlock( &GlobalDebugMutex );}
|
||||
|
||||
)
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpGetDebugFile
|
||||
*
|
||||
* 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,
|
||||
* or any of the log files.
|
||||
* 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
|
||||
* else returns the right file descriptor
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
||||
DBGONLY( FILE * GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module ) {
|
||||
if( g_log_level < DLevel ) return NULL; if( DEBUG_ALL == 0 ) {
|
||||
switch ( Module ) {
|
||||
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( DEBUG_TARGET == 0 ) {
|
||||
return stdout;}
|
||||
else
|
||||
{
|
||||
FILE *ret;
|
||||
|
||||
if (!DebugAtThisLevel(DLevel, Module)) {
|
||||
ret = NULL;
|
||||
if( DLevel == 0 ) {
|
||||
return ErrFileHnd;}
|
||||
else
|
||||
{
|
||||
return InfoFileHnd;}
|
||||
}
|
||||
|
||||
if (!DEBUG_TARGET) {
|
||||
ret = stdout;
|
||||
} else if (DLevel == 0) {
|
||||
ret = ErrFileHnd;
|
||||
} else {
|
||||
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
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayFileAndLine(
|
||||
IN FILE * fd,
|
||||
DBGONLY( void UpnpDisplayFileAndLine( IN FILE * fd,
|
||||
IN const char *DbgFileName,
|
||||
IN int DbgLineNo)
|
||||
{
|
||||
IN int DbgLineNo ) {
|
||||
int starlength = 66;
|
||||
const char *lines[2];
|
||||
char FileAndLine[500];
|
||||
lines[0] = "DEBUG";
|
||||
if (DbgFileName) {
|
||||
sprintf(FileAndLine,
|
||||
"FILE: %s, LINE: %d",
|
||||
DbgFileName, DbgLineNo);
|
||||
lines[1] = FileAndLine;
|
||||
}
|
||||
UpnpDisplayBanner(fd, lines, 2, starlength);
|
||||
fflush(fd);
|
||||
}
|
||||
#endif
|
||||
char FileAndLine[500]; lines[0] = "DEBUG"; if( DbgFileName ) {
|
||||
sprintf( FileAndLine, "FILE: %s, LINE: %d", DbgFileName,
|
||||
DbgLineNo ); lines[1] = FileAndLine;}
|
||||
|
||||
UpnpDisplayBanner( fd, lines, 2, starlength ); fflush( fd );}
|
||||
)
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@@ -340,58 +332,47 @@ void UpnpDisplayFileAndLine(
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
IN FILE * fd,
|
||||
DBGONLY( void UpnpDisplayBanner( IN FILE * fd,
|
||||
IN const char **lines,
|
||||
IN size_t size,
|
||||
IN int starLength)
|
||||
{
|
||||
IN int starLength ) {
|
||||
char *stars = ( char * )malloc( starLength + 1 );
|
||||
const char *line = NULL;
|
||||
int leftMarginLength = starLength / 2 + 1;
|
||||
int rightMarginLength = starLength / 2 + 1;
|
||||
int i = 0;
|
||||
int LineSize = 0;
|
||||
int starLengthMinus2 = starLength - 2;
|
||||
|
||||
char *leftMargin = ( char * )malloc( leftMarginLength );
|
||||
char *rightMargin = ( char * )malloc( rightMarginLength );
|
||||
char *stars = ( char * )malloc( starLength + 1 );
|
||||
int i = 0;
|
||||
int LineSize = 0;
|
||||
char *currentLine = ( char * )malloc( starLength + 1 );
|
||||
const char *line = NULL;
|
||||
|
||||
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++ ) {
|
||||
fprintf( fd, "\n%s\n", stars ); for( i = 0; i < size; i++ ) {
|
||||
LineSize = strlen( lines[i] );
|
||||
line = lines[i];
|
||||
while( LineSize > starLengthMinus2 ) {
|
||||
memcpy( currentLine, line, starLengthMinus2 );
|
||||
currentLine[starLengthMinus2] = 0;
|
||||
line = lines[i]; while( LineSize > ( starLength - 2 ) ) {
|
||||
memcpy( currentLine, line, ( starLength - 2 ) );
|
||||
currentLine[( starLength - 2 )] = 0;
|
||||
fprintf( fd, "*%s*\n", currentLine );
|
||||
LineSize -= starLengthMinus2;
|
||||
line += starLengthMinus2;
|
||||
}
|
||||
leftMarginLength = (starLengthMinus2 - LineSize)/2;
|
||||
LineSize -= ( starLength - 2 ); line += ( starLength - 2 );}
|
||||
|
||||
if( LineSize % 2 == 0 ) {
|
||||
rightMarginLength = leftMarginLength;
|
||||
} else {
|
||||
rightMarginLength = leftMarginLength + 1;
|
||||
}
|
||||
leftMarginLength = rightMarginLength =
|
||||
( ( starLength - 2 ) - LineSize ) / 2;}
|
||||
else
|
||||
{
|
||||
leftMarginLength = ( ( starLength - 2 ) - LineSize ) / 2;
|
||||
rightMarginLength =
|
||||
( ( starLength - 2 ) - LineSize ) / 2 + 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%s%s*\n", leftMargin, line, rightMargin );}
|
||||
|
||||
fprintf( fd, "%s\n\n", stars );
|
||||
|
||||
free( currentLine );
|
||||
free( stars );
|
||||
free( rightMargin );
|
||||
free( leftMargin );
|
||||
}
|
||||
#endif
|
||||
|
||||
free( rightMargin ); free( stars ); free( currentLine );}
|
||||
)
|
||||
|
@@ -44,7 +44,7 @@ struct ErrorString {
|
||||
|
||||
};
|
||||
|
||||
// Initializing the array of error structures.
|
||||
//Intializing the array of error structures.
|
||||
struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
||||
{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"},
|
||||
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
||||
@@ -256,8 +256,8 @@ makeAction( IN int response,
|
||||
IN const char *Arg,
|
||||
IN va_list ArgList )
|
||||
{
|
||||
const char *ArgName;
|
||||
const char *ArgValue;
|
||||
const char *ArgName,
|
||||
*ArgValue;
|
||||
char *ActBuff;
|
||||
int Idx = 0;
|
||||
IXML_Document *ActionDoc;
|
||||
@@ -298,7 +298,7 @@ makeAction( IN int response,
|
||||
if( NumArg > 0 ) {
|
||||
//va_start(ArgList, Arg);
|
||||
ArgName = Arg;
|
||||
for ( ; ; ) {
|
||||
while( Idx++ != NumArg ) {
|
||||
ArgValue = va_arg( ArgList, const char * );
|
||||
|
||||
if( ArgName != NULL ) {
|
||||
@@ -313,11 +313,7 @@ makeAction( IN int response,
|
||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
||||
}
|
||||
|
||||
if (++Idx < NumArg) {
|
||||
ArgName = va_arg( ArgList, const char * );
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//va_end(ArgList);
|
||||
}
|
||||
@@ -581,5 +577,4 @@ UpnpCreatePropertySet( IN int NumArg,
|
||||
return PropSet;
|
||||
}
|
||||
|
||||
#endif // EXCLUDE_DOM == 0
|
||||
|
||||
#endif
|
||||
|
@@ -93,29 +93,32 @@ genaCallback( IN http_parser_t * parser,
|
||||
xboolean found_function = FALSE;
|
||||
|
||||
if( request->method == HTTPMETHOD_SUBSCRIBE ) {
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
found_function = TRUE;
|
||||
if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL ) {
|
||||
DEVICEONLY( found_function = TRUE;
|
||||
if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL )
|
||||
{
|
||||
// renew subscription
|
||||
gena_process_subscription_renewal_request
|
||||
( info, request );
|
||||
} else {
|
||||
( info, request );}
|
||||
else
|
||||
{
|
||||
// subscribe
|
||||
gena_process_subscription_request( info, request );
|
||||
gena_process_subscription_request( info, request );}
|
||||
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||
"got subscription request\n" ); )
|
||||
)
|
||||
}
|
||||
UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||
"got subscription request\n" );
|
||||
} else if( request->method == HTTPMETHOD_UNSUBSCRIBE ) {
|
||||
found_function = TRUE;
|
||||
else
|
||||
if( request->method == HTTPMETHOD_UNSUBSCRIBE ) {
|
||||
DEVICEONLY( found_function = TRUE;
|
||||
// unsubscribe
|
||||
gena_process_unsubscribe_request( info, request );
|
||||
#endif
|
||||
gena_process_unsubscribe_request( info,
|
||||
request ); )
|
||||
} else if( request->method == HTTPMETHOD_NOTIFY ) {
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
found_function = TRUE;
|
||||
CLIENTONLY( found_function = TRUE;
|
||||
// notify
|
||||
gena_process_notification_event( info, request );
|
||||
#endif
|
||||
gena_process_notification_event( info, request ); )
|
||||
}
|
||||
|
||||
if( !found_function ) {
|
||||
@@ -124,4 +127,3 @@ genaCallback( IN http_parser_t * parser,
|
||||
}
|
||||
}
|
||||
#endif // EXCLUDE_GENA
|
||||
|
||||
|
@@ -72,14 +72,14 @@ GenaAutoRenewSubscription( IN void *input )
|
||||
int eventType = 0;
|
||||
|
||||
if( AUTO_RENEW_TIME == 0 ) {
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA SUB EXPIRED" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA SUB EXPIRED" ) );
|
||||
sub_struct->ErrCode = UPNP_E_SUCCESS;
|
||||
send_callback = 1;
|
||||
eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED;
|
||||
} else {
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA AUTO RENEW" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA AUTO RENEW" ) );
|
||||
if( ( ( sub_struct->ErrCode = genaRenewSubscription( event->handle,
|
||||
sub_struct->
|
||||
Sid,
|
||||
@@ -93,14 +93,14 @@ GenaAutoRenewSubscription( IN void *input )
|
||||
}
|
||||
}
|
||||
if( send_callback ) {
|
||||
HandleReadLock();
|
||||
HandleLock( );
|
||||
if( GetHandleInfo( event->handle, &handle_info ) != HND_CLIENT ) {
|
||||
HandleUnlock( );
|
||||
free_upnp_timeout( event );
|
||||
return;
|
||||
}
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"HANDLE IS VALID" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"HANDLE IS VALID" ) );
|
||||
callback_fun = handle_info->Callback;
|
||||
cookie = handle_info->Cookie;
|
||||
HandleUnlock( );
|
||||
@@ -449,7 +449,6 @@ genaUnregisterClient( IN UpnpClient_Handle client_handle )
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
int
|
||||
genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
||||
IN const Upnp_SID in_sid )
|
||||
@@ -502,7 +501,6 @@ genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
||||
|
||||
return return_code;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaSubscribe
|
||||
@@ -526,7 +524,6 @@ genaUnSubscribe( IN UpnpClient_Handle client_handle,
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
int
|
||||
genaSubscribe( IN UpnpClient_Handle client_handle,
|
||||
IN char *PublisherURL,
|
||||
@@ -541,12 +538,12 @@ genaSubscribe( IN UpnpClient_Handle client_handle,
|
||||
struct Handle_Info *handle_info;
|
||||
char *EventURL = NULL;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA SUBSCRIBE BEGIN" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA SUBSCRIBE BEGIN" ) );
|
||||
HandleLock( );
|
||||
|
||||
memset( out_sid, 0, sizeof( Upnp_SID ) );
|
||||
|
||||
HandleReadLock();
|
||||
// validate handle
|
||||
if( GetHandleInfo( client_handle, &handle_info ) != HND_CLIENT ) {
|
||||
HandleUnlock( );
|
||||
@@ -560,9 +557,9 @@ genaSubscribe( IN UpnpClient_Handle client_handle,
|
||||
gena_subscribe( PublisherURL, TimeOut, NULL, &ActualSID );
|
||||
HandleLock( );
|
||||
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",
|
||||
return_code );
|
||||
return_code ) );
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
@@ -612,7 +609,6 @@ genaSubscribe( IN UpnpClient_Handle client_handle,
|
||||
SubscribeUnlock( );
|
||||
return return_code;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaRenewSubscription
|
||||
@@ -667,8 +663,8 @@ genaRenewSubscription( IN UpnpClient_Handle client_handle,
|
||||
free_upnp_timeout( ( upnp_timeout * ) tempJob.arg );
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"REMOVED AUTO RENEW EVENT" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"REMOVED AUTO RENEW EVENT" ) );
|
||||
|
||||
sub->RenewEventId = -1;
|
||||
return_code = copy_client_subscription( sub, &sub_copy );
|
||||
@@ -881,4 +877,3 @@ gena_process_notification_event( IN SOCKINFO * info,
|
||||
|
||||
#endif // INCLUDE_CLIENT_APIS
|
||||
#endif // EXCLUDE_GENA
|
||||
|
||||
|
@@ -65,9 +65,9 @@ genaUnregisterDevice( IN UpnpDevice_Handle device_handle )
|
||||
HandleLock( );
|
||||
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",
|
||||
device_handle );
|
||||
device_handle ) );
|
||||
|
||||
HandleUnlock( );
|
||||
return GENA_E_BAD_HANDLE;
|
||||
@@ -188,7 +188,7 @@ free_notify_struct( IN notify_thread_struct * input )
|
||||
*
|
||||
* Note : called by genaNotify
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
notify_send_and_recv( IN uri_type * destination_url,
|
||||
IN membuffer * mid_msg,
|
||||
IN char *propertySet,
|
||||
@@ -203,10 +203,10 @@ notify_send_and_recv( IN uri_type * destination_url,
|
||||
SOCKINFO info;
|
||||
|
||||
// connect
|
||||
UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__,
|
||||
"gena notify to: %.*s\n",
|
||||
(int)destination_url->hostport.text.size,
|
||||
destination_url->hostport.text.buff );
|
||||
destination_url->hostport.text.size,
|
||||
destination_url->hostport.text.buff ); )
|
||||
|
||||
conn_fd = http_Connect( destination_url, &url );
|
||||
if( conn_fd < 0 ) {
|
||||
@@ -365,7 +365,7 @@ genaNotifyThread( IN void *input )
|
||||
struct Handle_Info *handle_info;
|
||||
ThreadPoolJob job;
|
||||
|
||||
HandleReadLock();
|
||||
HandleLock( );
|
||||
//validate context
|
||||
|
||||
if( GetHandleInfo( in->device_handle, &handle_info ) != HND_DEVICE ) {
|
||||
@@ -477,8 +477,8 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
||||
|
||||
notify_thread_struct *thread_struct = NULL;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA BEGIN INITIAL NOTIFY " );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA BEGIN INITIAL NOTIFY " ) );
|
||||
|
||||
reference_count = ( int * )malloc( sizeof( int ) );
|
||||
|
||||
@@ -523,9 +523,9 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
||||
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 ",
|
||||
UDN, servId );
|
||||
UDN, servId ) );
|
||||
|
||||
if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ||
|
||||
( sub->active ) ) {
|
||||
@@ -536,8 +536,9 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
||||
return GENA_E_BAD_SID;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s ", sid );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"FOUND SUBSCRIPTION IN INIT NOTIFY: SID %s ",
|
||||
sid ) );
|
||||
|
||||
sub->active = 1;
|
||||
|
||||
@@ -552,9 +553,9 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
||||
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",
|
||||
propertySet );
|
||||
propertySet ) );
|
||||
|
||||
headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) +
|
||||
strlen( "CONTENT-LENGTH: \r\n" ) + MAX_CONTENT_LENGTH +
|
||||
@@ -573,7 +574,7 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
//schedule thread for initial notification
|
||||
@@ -667,8 +668,8 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
||||
|
||||
notify_thread_struct *thread_struct = NULL;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA BEGIN INITIAL NOTIFY EXT" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"GENA BEGIN INITIAL NOTIFY EXT" ) );
|
||||
reference_count = ( int * )malloc( sizeof( int ) );
|
||||
|
||||
if( reference_count == NULL ) {
|
||||
@@ -711,9 +712,9 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
||||
HandleUnlock( );
|
||||
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",
|
||||
UDN, servId );
|
||||
UDN, servId ) );
|
||||
|
||||
if( ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ||
|
||||
( sub->active ) ) {
|
||||
@@ -723,8 +724,9 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
||||
HandleUnlock( );
|
||||
return GENA_E_BAD_SID;
|
||||
}
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s", sid );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"FOUND SUBSCRIPTION IN INIT NOTIFY EXT: SID %s",
|
||||
sid ) );
|
||||
|
||||
sub->active = 1;
|
||||
|
||||
@@ -737,9 +739,9 @@ genaInitNotifyExt( IN UpnpDevice_Handle device_handle,
|
||||
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",
|
||||
propertySet );
|
||||
propertySet ) );
|
||||
|
||||
headers_size = strlen( "CONTENT-TYPE text/xml\r\n" ) +
|
||||
strlen( "CONTENT-LENGTH: \r\n" ) + MAX_CONTENT_LENGTH +
|
||||
@@ -1315,8 +1317,8 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
||||
memptr callback_hdr;
|
||||
memptr timeout_hdr;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"Subscription Request Received:\n" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"Subscription Request Received:\n" ) );
|
||||
|
||||
if( httpmsg_find_hdr( request, HDR_NT, &nt_hdr ) == NULL ) {
|
||||
error_respond( info, HTTP_BAD_REQUEST, request );
|
||||
@@ -1345,9 +1347,10 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
||||
return;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"SubscriptionRequest for event URL path: %s\n",
|
||||
event_url_path );
|
||||
)
|
||||
|
||||
HandleLock( );
|
||||
|
||||
@@ -1368,11 +1371,11 @@ gena_process_subscription_request( IN SOCKINFO * info,
|
||||
return;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"Subscription Request: Number of Subscriptions already %d\n "
|
||||
"Max Subscriptions allowed: %d\n",
|
||||
service->TotalSubscriptions,
|
||||
handle_info->MaxSubscriptions );
|
||||
handle_info->MaxSubscriptions ) );
|
||||
|
||||
// too many subscriptions
|
||||
if( handle_info->MaxSubscriptions != -1 &&
|
||||
@@ -1545,11 +1548,12 @@ gena_process_subscription_renewal_request( IN SOCKINFO * info,
|
||||
return;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"Renew request: Number of subscriptions already: %d\n "
|
||||
"Max Subscriptions allowed:%d\n",
|
||||
service->TotalSubscriptions,
|
||||
handle_info->MaxSubscriptions );
|
||||
)
|
||||
// too many subscriptions
|
||||
if( handle_info->MaxSubscriptions != -1 &&
|
||||
service->TotalSubscriptions > handle_info->MaxSubscriptions ) {
|
||||
|
@@ -42,12 +42,12 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#else /* WIN32 */
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
|
||||
typedef int socklen_t;
|
||||
#define EAFNOSUPPORT 97
|
||||
#endif /* WIN32 */
|
||||
#endif
|
||||
#include "unixutil.h"
|
||||
#include "ithread.h"
|
||||
|
||||
@@ -91,12 +91,13 @@ static MiniServerState gMServState = MSERV_IDLE;
|
||||
* Function : SetHTTPGetCallback
|
||||
*
|
||||
* Parameters :
|
||||
* MiniServerCallback callback - HTTP Callback to be invoked
|
||||
* MiniServerCallback callback ; - HTTP Callback to be invoked
|
||||
*
|
||||
* Description:
|
||||
* Set HTTP Get Callback
|
||||
* Description : Set HTTP Get Callback
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
void
|
||||
SetHTTPGetCallback( MiniServerCallback callback )
|
||||
@@ -108,31 +109,31 @@ SetHTTPGetCallback( MiniServerCallback callback )
|
||||
* Function : SetSoapCallback
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
void
|
||||
SetSoapCallback( MiniServerCallback callback )
|
||||
{
|
||||
gSoapCallback = callback;
|
||||
}
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
|
||||
/************************************************************************
|
||||
* Function : SetGenaCallback
|
||||
*
|
||||
* Parameters :
|
||||
* MiniServerCallback callback - GENA Callback to be invoked
|
||||
* MiniServerCallback callback ; - GENA Callback to be invoked
|
||||
*
|
||||
* Description:
|
||||
* Set GENA Callback
|
||||
* Description : Set GENA Callback
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
void
|
||||
SetGenaCallback( MiniServerCallback callback )
|
||||
@@ -144,15 +145,17 @@ SetGenaCallback( MiniServerCallback callback )
|
||||
* Function : dispatch_request
|
||||
*
|
||||
* Parameters :
|
||||
* IN SOCKINFO *info - Socket Information object.
|
||||
* http_parser_t* hparser - HTTP parser object.
|
||||
* IN SOCKINFO *info ; Socket Information object.
|
||||
* http_parser_t* hparser ; HTTP parser object.
|
||||
*
|
||||
* Description :
|
||||
* Based on the type pf message, appropriate callback is issued
|
||||
* Description : Based on the type pf message, appropriate callback
|
||||
* is issued
|
||||
*
|
||||
* Return: int
|
||||
* Return : int ;
|
||||
* 0 - On Success
|
||||
* HTTP_INTERNAL_SERVER_ERROR - Callback is NULL
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static int
|
||||
dispatch_request( IN SOCKINFO * info,
|
||||
@@ -171,8 +174,10 @@ dispatch_request( IN SOCKINFO * info,
|
||||
case HTTPMETHOD_NOTIFY:
|
||||
case HTTPMETHOD_SUBSCRIBE:
|
||||
case HTTPMETHOD_UNSUBSCRIBE:
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"miniserver %d: got GENA msg\n", info->socket );
|
||||
)
|
||||
callback = gGenaCallback;
|
||||
break;
|
||||
|
||||
@@ -200,17 +205,19 @@ dispatch_request( IN SOCKINFO * info,
|
||||
* Function : handle_error
|
||||
*
|
||||
* Parameters :
|
||||
* IN SOCKINFO *info - Socket Inforamtion Object
|
||||
* int http_error_code - HTTP Error Code
|
||||
* int major - Major Version Number
|
||||
* int minor - Minor Version Number
|
||||
*
|
||||
* Description:
|
||||
* Send Error Message
|
||||
* IN SOCKINFO *info ; Socket Inforamtion Object
|
||||
* int http_error_code ; HTTP Error Code
|
||||
* int major ; Major Version Number
|
||||
* int minor ; Minor Version Number
|
||||
*
|
||||
* Return: void
|
||||
* Description : Send Error Message
|
||||
*
|
||||
* Return : void;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
handle_error( IN SOCKINFO * info,
|
||||
int http_error_code,
|
||||
int major,
|
||||
@@ -225,11 +232,12 @@ handle_error( IN SOCKINFO * info,
|
||||
* Parameters :
|
||||
* void *args ; Request Message to be freed
|
||||
*
|
||||
* Description:
|
||||
* Free memory assigned for handling request and unitialize socket
|
||||
* functionality
|
||||
* Description : Free memory assigned for handling request and unitial-
|
||||
* -ize socket functionality
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static void
|
||||
free_handle_request_arg( void *args )
|
||||
@@ -245,12 +253,13 @@ free_handle_request_arg( void *args )
|
||||
* Function : handle_request
|
||||
*
|
||||
* Parameters :
|
||||
* void *args - Request Message to be handled
|
||||
* void *args ; Request Message to be handled
|
||||
*
|
||||
* Description:
|
||||
* Receive the request and dispatch it for handling
|
||||
* Description : Receive the request and dispatch it for handling
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static void
|
||||
handle_request( void *args )
|
||||
@@ -266,8 +275,10 @@ handle_request( void *args )
|
||||
struct mserv_request_t *request = ( struct mserv_request_t * )args;
|
||||
int connfd = request->connfd;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"miniserver %d: READING\n", connfd );
|
||||
)
|
||||
//parser_request_init( &parser ); ////LEAK_FIX_MK
|
||||
hmsg = &parser.msg;
|
||||
|
||||
@@ -284,8 +295,10 @@ handle_request( void *args )
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"miniserver %d: PROCESSING...\n", connfd );
|
||||
)
|
||||
// dispatch
|
||||
http_error_code = dispatch_request( &info, &parser );
|
||||
if( http_error_code != 0 ) {
|
||||
@@ -303,8 +316,10 @@ handle_request( void *args )
|
||||
handle_error( &info, http_error_code, major, minor );
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"miniserver %d: COMPLETE\n", connfd );
|
||||
)
|
||||
sock_destroy( &info, SD_BOTH ); //should shutdown completely
|
||||
|
||||
httpmsg_destroy( hmsg );
|
||||
@@ -315,16 +330,18 @@ handle_request( void *args )
|
||||
* Function : schedule_request_job
|
||||
*
|
||||
* Parameters :
|
||||
* IN int connfd - Socket Descriptor on which connection is accepted
|
||||
* IN struct sockaddr_in* clientAddr - Clients Address information
|
||||
* IN int connfd ; Socket Descriptor on which connection is accepted
|
||||
* IN struct sockaddr_in* clientAddr ; Clients Address information
|
||||
*
|
||||
* Description:
|
||||
* Initilize the thread pool to handle a request.
|
||||
* Description : Initilize the thread pool to handle a request.
|
||||
* Sets priority for the job and adds the job to the thread pool
|
||||
*
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
schedule_request_job( IN int connfd,
|
||||
IN struct sockaddr_in *clientAddr )
|
||||
{
|
||||
@@ -335,8 +352,10 @@ schedule_request_job( IN int connfd,
|
||||
( struct mserv_request_t * )
|
||||
malloc( sizeof( struct mserv_request_t ) );
|
||||
if( request == NULL ) {
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"mserv %d: out of memory\n", connfd );
|
||||
)
|
||||
shutdown( request->connfd, SD_BOTH );
|
||||
UpnpCloseSocket( connfd );
|
||||
return;
|
||||
@@ -350,9 +369,11 @@ schedule_request_job( IN int connfd,
|
||||
TPJobSetFreeFunction( &job, free_handle_request_arg );
|
||||
TPJobSetPriority( &job, MED_PRIORITY );
|
||||
|
||||
if( ThreadPoolAdd( &gMiniServerThreadPool, &job, NULL ) != 0 ) {
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
if( ThreadPoolAdd( &gRecvThreadPool, &job, NULL ) != 0 ) {
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"mserv %d: cannot schedule request\n", connfd );
|
||||
)
|
||||
free( request );
|
||||
shutdown( connfd, SD_BOTH );
|
||||
UpnpCloseSocket( connfd );
|
||||
@@ -365,28 +386,29 @@ schedule_request_job( IN int connfd,
|
||||
* Function : RunMiniServer
|
||||
*
|
||||
* Parameters :
|
||||
* MiniServerSockArray *miniSock - Socket Array
|
||||
* MiniServerSockArray *miniSock ; Socket Array
|
||||
*
|
||||
* Description:
|
||||
* Function runs the miniserver. The MiniServer accepts a
|
||||
* Description : Function runs the miniserver. The MiniServer accepts a
|
||||
* new request and schedules a thread to handle the new request.
|
||||
* Checks for socket state and invokes appropriate read and shutdown
|
||||
* actions for the Miniserver and SSDP sockets
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static void
|
||||
RunMiniServer( MiniServerSockArray * miniSock )
|
||||
{
|
||||
struct sockaddr_in clientAddr;
|
||||
socklen_t clientLen;
|
||||
SOCKET connectHnd;
|
||||
SOCKET miniServSock = miniSock->miniServerSock;
|
||||
SOCKET miniServStopSock = miniSock->miniServerStopSock;
|
||||
SOCKET ssdpSock = miniSock->ssdpSock;
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
SOCKET ssdpReqSock = miniSock->ssdpReqSock;
|
||||
#endif
|
||||
SOCKET miniServSock,
|
||||
connectHnd;
|
||||
SOCKET miniServStopSock;
|
||||
SOCKET ssdpSock;
|
||||
|
||||
CLIENTONLY( SOCKET ssdpReqSock;
|
||||
)
|
||||
|
||||
fd_set expSet;
|
||||
fd_set rdSet;
|
||||
@@ -394,55 +416,70 @@ RunMiniServer( MiniServerSockArray * miniSock )
|
||||
int byteReceived;
|
||||
char requestBuf[256];
|
||||
|
||||
maxMiniSock = max( miniServSock, miniServStopSock) ;
|
||||
maxMiniSock = max( maxMiniSock, (SOCKET)(ssdpSock) );
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
maxMiniSock = max( maxMiniSock, (SOCKET)(ssdpReqSock) );
|
||||
#endif
|
||||
++maxMiniSock;
|
||||
miniServSock = miniSock->miniServerSock;
|
||||
miniServStopSock = miniSock->miniServerStopSock;
|
||||
|
||||
ssdpSock = miniSock->ssdpSock;
|
||||
|
||||
CLIENTONLY( ssdpReqSock = miniSock->ssdpReqSock;
|
||||
);
|
||||
|
||||
gMServState = MSERV_RUNNING;
|
||||
maxMiniSock = max( miniServSock, miniServStopSock );
|
||||
maxMiniSock = max( maxMiniSock, ( SOCKET ) ( ssdpSock ) );
|
||||
|
||||
CLIENTONLY( maxMiniSock =
|
||||
max( maxMiniSock, ( SOCKET ) ( ssdpReqSock ) ) );
|
||||
|
||||
++maxMiniSock;
|
||||
|
||||
while( TRUE ) {
|
||||
FD_ZERO( &rdSet );
|
||||
FD_ZERO( &expSet );
|
||||
|
||||
FD_SET( miniServStopSock, &expSet );
|
||||
|
||||
FD_SET( miniServSock, &rdSet );
|
||||
FD_SET( miniServStopSock, &rdSet );
|
||||
FD_SET( ssdpSock, &rdSet );
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
FD_SET( ssdpReqSock, &rdSet );
|
||||
#endif
|
||||
CLIENTONLY( FD_SET( ssdpReqSock, &rdSet ) );
|
||||
|
||||
if( select( maxMiniSock, &rdSet, NULL, &expSet, NULL ) ==
|
||||
UPNP_SOCKETERROR ) {
|
||||
UpnpPrintf( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||
"Error in select call!\n" );
|
||||
/* Avoid 100% CPU in case of repeated error in select() */
|
||||
isleep( 1 );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||
"Error in select call !!!\n" );
|
||||
)
|
||||
continue;
|
||||
} else {
|
||||
|
||||
if( FD_ISSET( miniServSock, &rdSet ) ) {
|
||||
clientLen = sizeof( struct sockaddr_in );
|
||||
connectHnd = accept( miniServSock,
|
||||
( struct sockaddr * )&clientAddr, &clientLen );
|
||||
( struct sockaddr * )&clientAddr,
|
||||
&clientLen );
|
||||
if( connectHnd == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"miniserver: Error in accepting connection\n" );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"miniserver: Error"
|
||||
" in accepting connection\n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
schedule_request_job( connectHnd, &clientAddr );
|
||||
}
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
//ssdp
|
||||
if( FD_ISSET( ssdpReqSock, &rdSet ) ) {
|
||||
readFromSSDPSocket( ssdpReqSock );
|
||||
}
|
||||
#endif
|
||||
CLIENTONLY( if( FD_ISSET( ssdpReqSock, &rdSet ) ) {
|
||||
|
||||
readFromSSDPSocket( ssdpReqSock );}
|
||||
)
|
||||
|
||||
if( FD_ISSET( ssdpSock, &rdSet ) ) {
|
||||
readFromSSDPSocket( ssdpSock );
|
||||
}
|
||||
|
||||
if( FD_ISSET( miniServStopSock, &rdSet ) ) {
|
||||
|
||||
clientLen = sizeof( struct sockaddr_in );
|
||||
memset( ( char * )&clientAddr, 0,
|
||||
sizeof( struct sockaddr_in ) );
|
||||
@@ -452,18 +489,24 @@ RunMiniServer( MiniServerSockArray * miniSock )
|
||||
&clientLen );
|
||||
if( byteReceived > 0 ) {
|
||||
requestBuf[byteReceived] = '\0';
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"Received response !!! %s From host %s \n",
|
||||
requestBuf, inet_ntoa( clientAddr.sin_addr ) );
|
||||
UpnpPrintf( UPNP_PACKET, MSERV, __FILE__, __LINE__,
|
||||
requestBuf,
|
||||
inet_ntoa( clientAddr.sin_addr ) );
|
||||
)
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
shutdown( miniServSock, SD_BOTH );
|
||||
@@ -472,29 +515,30 @@ RunMiniServer( MiniServerSockArray * miniSock )
|
||||
UpnpCloseSocket( miniServStopSock );
|
||||
shutdown( ssdpSock, SD_BOTH );
|
||||
UpnpCloseSocket( ssdpSock );
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
shutdown( ssdpReqSock, SD_BOTH );
|
||||
UpnpCloseSocket( ssdpReqSock );
|
||||
#endif
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
|
||||
free( miniSock );
|
||||
|
||||
gMServState = MSERV_IDLE;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : get_port
|
||||
*
|
||||
* Parameters :
|
||||
* int sockfd - Socket Descriptor
|
||||
* int sockfd ; Socket Descriptor
|
||||
*
|
||||
* Description:
|
||||
* Returns port to which socket, sockfd, is bound.
|
||||
* Description : Returns port to which socket, sockfd, is bound.
|
||||
*
|
||||
* Return: int
|
||||
* Return : int,
|
||||
* -1 on error; check errno
|
||||
* > 0 means port number
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static int
|
||||
get_port( int sockfd )
|
||||
@@ -511,8 +555,10 @@ get_port( int sockfd )
|
||||
}
|
||||
|
||||
port = ntohs( sockinfo.sin_port );
|
||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||
"sockfd = %d, .... port = %d\n", sockfd, port );
|
||||
)
|
||||
|
||||
return port;
|
||||
}
|
||||
@@ -521,24 +567,24 @@ get_port( int sockfd )
|
||||
* Function : get_miniserver_sockets
|
||||
*
|
||||
* Parameters :
|
||||
* MiniServerSockArray *out - Socket Array
|
||||
* unsigned short listen_port - port on which the server is
|
||||
* listening for incoming connections
|
||||
*
|
||||
* Description:
|
||||
* Creates a STREAM socket, binds to INADDR_ANY and listens for
|
||||
* incoming connecttions. Returns the actual port which the sockets
|
||||
* sub-system returned.
|
||||
* MiniServerSockArray *out ; Socket Array
|
||||
* unsigned short listen_port ; port on which the server is listening
|
||||
* for incoming connections
|
||||
*
|
||||
* Description : Creates a STREAM socket, binds to INADDR_ANY and
|
||||
* listens for incoming connecttions. Returns the actual port which
|
||||
* the sockets sub-system returned.
|
||||
* Also creates a DGRAM socket, binds to the loop back address and
|
||||
* returns the port allocated by the socket sub-system.
|
||||
*
|
||||
* Return: int
|
||||
* Return : int :
|
||||
* UPNP_E_OUTOF_SOCKET - Failed to create a socket
|
||||
* UPNP_E_SOCKET_BIND - Bind() failed
|
||||
* UPNP_E_LISTEN - Listen() failed
|
||||
* UPNP_E_INTERNAL_ERROR - Port returned by the socket layer is < 0
|
||||
* UPNP_E_SUCCESS - Success
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int
|
||||
get_miniserver_sockets( MiniServerSockArray * out,
|
||||
@@ -577,10 +623,16 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
//THIS MAY CAUSE TCP TO BECOME LESS RELIABLE
|
||||
//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" );
|
||||
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 ) {
|
||||
shutdown( listenfd, SD_BOTH );
|
||||
UpnpCloseSocket( listenfd );
|
||||
@@ -613,14 +665,16 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
}
|
||||
|
||||
if( sockError == UPNP_SOCKETERROR ) {
|
||||
perror( "mserv start: bind failed" );
|
||||
DBGONLY( perror( "mserv start: bind failed" );
|
||||
)
|
||||
shutdown( listenfd, SD_BOTH );
|
||||
UpnpCloseSocket( listenfd );
|
||||
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" );
|
||||
)
|
||||
|
||||
success = listen( listenfd, SOMAXCONN );
|
||||
if( success == UPNP_SOCKETERROR ) {
|
||||
@@ -640,9 +694,10 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
|
||||
if( ( miniServerStopSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) ==
|
||||
UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
MSERV, __FILE__, __LINE__,
|
||||
"Error in socket operation !!!\n" );
|
||||
)
|
||||
shutdown( listenfd, SD_BOTH );
|
||||
UpnpCloseSocket( listenfd );
|
||||
return UPNP_E_OUTOF_SOCKET;
|
||||
@@ -656,9 +711,10 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
if( bind( miniServerStopSock, ( struct sockaddr * )&serverAddr,
|
||||
sizeof( serverAddr ) ) == UPNP_SOCKETERROR ) {
|
||||
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
MSERV, __FILE__, __LINE__,
|
||||
"Error in binding localhost!!!\n" );
|
||||
)
|
||||
shutdown( listenfd, SD_BOTH );
|
||||
UpnpCloseSocket( listenfd );
|
||||
shutdown( miniServerStopSock, SD_BOTH );
|
||||
@@ -669,8 +725,8 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
miniStopSockPort = get_port( miniServerStopSock );
|
||||
if( miniStopSockPort <= 0 ) {
|
||||
shutdown( miniServerStopSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniServerStopSock );
|
||||
shutdown( listenfd, SD_BOTH );
|
||||
UpnpCloseSocket( miniServerStopSock );
|
||||
UpnpCloseSocket( listenfd );
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
@@ -688,11 +744,10 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
* Function : StartMiniServer
|
||||
*
|
||||
* Parameters :
|
||||
* unsigned short listen_port - Port on which the server listens for
|
||||
* unsigned short listen_port ; Port on which the server listens for
|
||||
* incoming connections
|
||||
*
|
||||
* Description:
|
||||
* Initialize the sockets functionality for the
|
||||
* Description : Initialize the sockets functionality for the
|
||||
* Miniserver. Initialize a thread pool job to run the MiniServer
|
||||
* and the job to the thread pool. If listen port is 0, port is
|
||||
* dynamically picked
|
||||
@@ -700,14 +755,17 @@ get_miniserver_sockets( MiniServerSockArray * out,
|
||||
* Use timer mechanism to start the MiniServer, failure to meet the
|
||||
* allowed delay aborts the attempt to launch the MiniServer.
|
||||
*
|
||||
* Return: int
|
||||
* Actual port socket is bound to - On Success
|
||||
* Return : int ;
|
||||
* Actual port socket is bound to - On Success:
|
||||
* A negative number UPNP_E_XXX - On Error
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int
|
||||
StartMiniServer( unsigned short listen_port )
|
||||
{
|
||||
|
||||
int success;
|
||||
|
||||
int count;
|
||||
int max_count = 10000;
|
||||
|
||||
@@ -730,10 +788,12 @@ StartMiniServer( unsigned short listen_port )
|
||||
}
|
||||
|
||||
if( ( success = get_ssdp_sockets( miniSocket ) ) != UPNP_E_SUCCESS ) {
|
||||
|
||||
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->miniServerSock );
|
||||
shutdown( miniSocket->miniServerStopSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->miniServerStopSock );
|
||||
|
||||
free( miniSocket );
|
||||
|
||||
return success;
|
||||
@@ -745,19 +805,18 @@ StartMiniServer( unsigned short listen_port )
|
||||
|
||||
TPJobSetFreeFunction( &job, ( free_routine ) free );
|
||||
|
||||
success = ThreadPoolAddPersistent( &gMiniServerThreadPool, &job, NULL );
|
||||
success = ThreadPoolAddPersistent( &gRecvThreadPool, &job, NULL );
|
||||
|
||||
if( success < 0 ) {
|
||||
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->miniServerSock );
|
||||
shutdown( miniSocket->miniServerStopSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->miniServerStopSock );
|
||||
shutdown( miniSocket->ssdpSock, SD_BOTH );
|
||||
CLIENTONLY( shutdown( miniSocket->ssdpReqSock, SD_BOTH ) );
|
||||
UpnpCloseSocket( miniSocket->miniServerSock );
|
||||
UpnpCloseSocket( miniSocket->miniServerStopSock );
|
||||
UpnpCloseSocket( miniSocket->ssdpSock );
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
shutdown( miniSocket->ssdpReqSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->ssdpReqSock );
|
||||
#endif
|
||||
|
||||
CLIENTONLY( UpnpCloseSocket( miniSocket->ssdpReqSock ) );
|
||||
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
@@ -770,16 +829,16 @@ StartMiniServer( unsigned short listen_port )
|
||||
|
||||
// taking too long to start that thread
|
||||
if( count >= max_count ) {
|
||||
|
||||
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->miniServerSock );
|
||||
shutdown( miniSocket->miniServerStopSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->miniServerStopSock );
|
||||
shutdown( miniSocket->ssdpSock, SD_BOTH );
|
||||
CLIENTONLY( shutdown( miniSocket->ssdpReqSock, SD_BOTH ) );
|
||||
|
||||
UpnpCloseSocket( miniSocket->miniServerSock );
|
||||
UpnpCloseSocket( miniSocket->miniServerStopSock );
|
||||
UpnpCloseSocket( miniSocket->ssdpSock );
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
shutdown( miniSocket->ssdpReqSock, SD_BOTH );
|
||||
UpnpCloseSocket( miniSocket->ssdpReqSock );
|
||||
#endif
|
||||
CLIENTONLY( UpnpCloseSocket( miniSocket->ssdpReqSock ) );
|
||||
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
@@ -791,35 +850,37 @@ StartMiniServer( unsigned short listen_port )
|
||||
* Function : StopMiniServer
|
||||
*
|
||||
* Parameters :
|
||||
* void
|
||||
* void ;
|
||||
*
|
||||
* Description:
|
||||
* Stop and Shutdown the MiniServer and free socket
|
||||
* Description : Stop and Shutdown the MiniServer and free socket
|
||||
* resources.
|
||||
*
|
||||
* Return: int
|
||||
* Return : int ;
|
||||
* Always returns 0
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int
|
||||
StopMiniServer( void )
|
||||
{
|
||||
|
||||
int socklen = sizeof( struct sockaddr_in );
|
||||
int sock;
|
||||
int socklen = sizeof( struct sockaddr_in ),
|
||||
sock;
|
||||
struct sockaddr_in ssdpAddr;
|
||||
char buf[256] = "ShutDown";
|
||||
int bufLen = strlen( buf );
|
||||
|
||||
if( gMServState == MSERV_RUNNING ) {
|
||||
if( gMServState == MSERV_RUNNING )
|
||||
gMServState = MSERV_STOPPING;
|
||||
} else {
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
sock = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
if( sock == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"SSDP_SERVER:StopSSDPServer: Error in socket operation !!!\n" );
|
||||
)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -838,4 +899,3 @@ StopMiniServer( void )
|
||||
UpnpCloseSocket( sock );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,6 @@
|
||||
* messages.
|
||||
************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For strcasestr() in string.h
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@@ -101,7 +100,7 @@ str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES] = {
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
/************* scanner *************/
|
||||
/************* scanner **************/
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
@@ -121,7 +120,7 @@ str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES] = {
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
scanner_init( OUT scanner_t * scanner,
|
||||
IN membuffer * bufptr )
|
||||
{
|
||||
@@ -142,7 +141,7 @@ scanner_init( OUT scanner_t * scanner,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
is_separator_char( IN char c )
|
||||
{
|
||||
return strchr( " \t()<>@,;:\\\"/[]?={}", c ) != NULL;
|
||||
@@ -160,7 +159,7 @@ is_separator_char( IN char c )
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
is_identifier_char( IN char c )
|
||||
{
|
||||
return ( c >= 32 && c <= 126 ) && !is_separator_char( c );
|
||||
@@ -178,7 +177,7 @@ is_identifier_char( IN char c )
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
is_control_char( IN char c )
|
||||
{
|
||||
return ( ( c >= 0 && c <= 31 ) || ( c == 127 ) );
|
||||
@@ -196,7 +195,7 @@ is_control_char( IN char c )
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
is_qdtext_char( IN char cc )
|
||||
{
|
||||
unsigned char c = ( unsigned char )cc;
|
||||
@@ -375,7 +374,7 @@ scanner_get_token( INOUT scanner_t * scanner,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE char *
|
||||
static XINLINE char *
|
||||
scanner_get_str( IN scanner_t * scanner )
|
||||
{
|
||||
return scanner->msg->buf + scanner->cursor;
|
||||
@@ -395,9 +394,7 @@ scanner_get_str( IN scanner_t * scanner )
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#warning The only use of the function 'scanner_pushback()' in the code is commented out.
|
||||
#warning 'scanner_pushback()' is a candidate for removal.
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
scanner_pushback( INOUT scanner_t * scanner,
|
||||
IN size_t pushback_bytes )
|
||||
{
|
||||
@@ -564,7 +561,7 @@ httpmsg_find_hdr_str( IN http_message_t * msg,
|
||||
*
|
||||
* Description : Finds header from a list, with the given 'name_id'.
|
||||
*
|
||||
* Return : http_header_t* - Pointer to a header on success;
|
||||
* Return : http_header_t* - Pointer to a header on success; *
|
||||
* NULL on failure
|
||||
*
|
||||
* Note :
|
||||
@@ -616,7 +613,7 @@ httpmsg_find_hdr( IN http_message_t * msg,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
skip_blank_lines( INOUT scanner_t * scanner )
|
||||
{
|
||||
memptr token;
|
||||
@@ -653,7 +650,7 @@ skip_blank_lines( INOUT scanner_t * scanner )
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
skip_lws( INOUT scanner_t * scanner )
|
||||
{
|
||||
memptr token;
|
||||
@@ -700,7 +697,7 @@ skip_lws( INOUT scanner_t * scanner )
|
||||
*
|
||||
* Description : Match a string without whitespace or CRLF (%S)
|
||||
*
|
||||
* Return : UPNP_INLINE parse_status_t ;
|
||||
* Return : XINLINE parse_status_t ;
|
||||
* PARSE_OK
|
||||
* PARSE_NO_MATCH
|
||||
* PARSE_FAILURE
|
||||
@@ -708,7 +705,7 @@ skip_lws( INOUT scanner_t * scanner )
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
match_non_ws_string( INOUT scanner_t * scanner,
|
||||
OUT memptr * str )
|
||||
{
|
||||
@@ -774,7 +771,7 @@ match_non_ws_string( INOUT scanner_t * scanner,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
match_raw_value( INOUT scanner_t * scanner,
|
||||
OUT memptr * raw_value )
|
||||
{
|
||||
@@ -865,7 +862,7 @@ match_raw_value( INOUT scanner_t * scanner,
|
||||
* PARSE_FAILURE -- bad input
|
||||
* PARSE_INCOMPLETE
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
match_int( INOUT scanner_t * scanner,
|
||||
IN int base,
|
||||
OUT int *value )
|
||||
@@ -924,7 +921,7 @@ match_int( INOUT scanner_t * scanner,
|
||||
* PARSE_FAILURE
|
||||
* PARSE_INCOMPLETE
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
read_until_crlf( INOUT scanner_t * scanner,
|
||||
OUT memptr * str )
|
||||
{
|
||||
@@ -965,9 +962,7 @@ read_until_crlf( INOUT scanner_t * scanner,
|
||||
* PARSE_FAILURE
|
||||
* PARSE_INCOMPLETE
|
||||
************************************************************************/
|
||||
#warning There are currently no uses of the function 'skip_to_end_of_header()' in the code.
|
||||
#warning 'skip_to_end_of_header()' is a candidate for removal.
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
skip_to_end_of_header( INOUT scanner_t * scanner )
|
||||
{
|
||||
memptr dummy_raw_value;
|
||||
@@ -983,8 +978,8 @@ skip_to_end_of_header( INOUT scanner_t * scanner )
|
||||
* Parameters:
|
||||
* INOUT scanner_t* scanner ; Scanner Object
|
||||
* IN char c ; Character to be compared with
|
||||
* IN xboolean case_sensitive; Flag indicating whether
|
||||
* comparison should be case sensitive
|
||||
* IN xboolean case_sensitive; Flag indicating whether comparison should
|
||||
* be case sensitive
|
||||
*
|
||||
* Description: Compares a character to the next char in the scanner;
|
||||
* on error, scanner chars are not restored
|
||||
@@ -994,7 +989,7 @@ skip_to_end_of_header( INOUT scanner_t * scanner )
|
||||
* PARSE_NO_MATCH
|
||||
* PARSE_INCOMPLETE
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
match_char( INOUT scanner_t * scanner,
|
||||
IN char c,
|
||||
IN xboolean case_sensitive )
|
||||
@@ -1341,7 +1336,7 @@ matchstr( IN char *str,
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
parser_init( OUT http_parser_t * parser )
|
||||
{
|
||||
memset( parser, 0, sizeof( http_parser_t ) );
|
||||
@@ -1876,7 +1871,7 @@ parser_parse_headers_old( INOUT http_parser_t * parser )
|
||||
* PARSE_FAILURE -- entity length > content-length value
|
||||
* PARSE_SUCCESS
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
||||
{
|
||||
//int entity_length;
|
||||
@@ -1923,7 +1918,7 @@ parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
||||
* PARSE_FAILURE -- entity length > content-length value
|
||||
* PARSE_SUCCESS
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
parser_parse_chunky_body( INOUT http_parser_t * parser )
|
||||
{
|
||||
parse_status_t status;
|
||||
@@ -1968,7 +1963,7 @@ parser_parse_chunky_body( INOUT http_parser_t * parser )
|
||||
* PARSE_FAILURE -- entity length > content-length value
|
||||
* PARSE_SUCCESS
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
parser_parse_chunky_headers( INOUT http_parser_t * parser )
|
||||
{
|
||||
parse_status_t status;
|
||||
@@ -2008,7 +2003,7 @@ parser_parse_chunky_headers( INOUT http_parser_t * parser )
|
||||
* PARSE_SUCCESS
|
||||
* PARSE_CONTINUE_1
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
parser_parse_chunky_entity( INOUT http_parser_t * parser )
|
||||
{
|
||||
scanner_t *scanner = &parser->scanner;
|
||||
@@ -2024,8 +2019,9 @@ parser_parse_chunky_entity( INOUT http_parser_t * parser )
|
||||
status = match( scanner, "%x%L%c", &parser->chunk_size, &dummy );
|
||||
if( status != PARSE_OK ) {
|
||||
scanner->cursor = save_pos;
|
||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
"CHUNK COULD NOT BE PARSED\n" );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
"CHUNK COULD NOT BE PARSED\n" ); )
|
||||
return status;
|
||||
}
|
||||
// remove chunk info just matched; just retain data
|
||||
@@ -2059,7 +2055,7 @@ parser_parse_chunky_entity( INOUT http_parser_t * parser )
|
||||
* Returns:
|
||||
* PARSE_INCOMPLETE_ENTITY
|
||||
************************************************************************/
|
||||
static UPNP_INLINE parse_status_t
|
||||
static XINLINE parse_status_t
|
||||
parser_parse_entity_until_close( INOUT http_parser_t * parser )
|
||||
{
|
||||
size_t cursor;
|
||||
@@ -2094,7 +2090,7 @@ parser_parse_entity_until_close( INOUT http_parser_t * parser )
|
||||
* PARSE_FAILURE
|
||||
* PARSE_COMPLETE -- no more reading to do
|
||||
************************************************************************/
|
||||
UPNP_INLINE parse_status_t
|
||||
XINLINE parse_status_t
|
||||
parser_get_entity_read_method( INOUT http_parser_t * parser )
|
||||
{
|
||||
http_message_t *hmsg = &parser->msg;
|
||||
@@ -2152,8 +2148,9 @@ parser_get_entity_read_method( INOUT http_parser_t * parser )
|
||||
if( raw_find_str( &hdr_value, "chunked" ) >= 0 ) {
|
||||
// read method to use chunked transfer encoding
|
||||
parser->ent_position = ENTREAD_USING_CHUNKED;
|
||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
"Found Chunked Encoding ....\n" );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
"Found Chunked Encoding ....\n" ); )
|
||||
|
||||
return PARSE_CONTINUE_1;
|
||||
}
|
||||
@@ -2199,7 +2196,7 @@ parser_get_entity_read_method( INOUT http_parser_t * parser )
|
||||
* PARSE_FAILURE
|
||||
* PARSE_COMPLETE -- no more reading to do
|
||||
************************************************************************/
|
||||
UPNP_INLINE parse_status_t
|
||||
XINLINE parse_status_t
|
||||
parser_parse_entity( INOUT http_parser_t * parser )
|
||||
{
|
||||
parse_status_t status = PARSE_OK;
|
||||
@@ -2424,8 +2421,6 @@ raw_to_int( IN memptr * raw_value,
|
||||
*
|
||||
* Description: Find a substring from raw character string buffer
|
||||
*
|
||||
* Side effects: raw_value is transformed to lowercase.
|
||||
*
|
||||
* Returns:
|
||||
* int - index at which the substring is found.
|
||||
************************************************************************/
|
||||
@@ -2435,31 +2430,19 @@ raw_find_str( IN memptr *raw_value,
|
||||
{
|
||||
char c;
|
||||
char *ptr;
|
||||
int i = 0;
|
||||
|
||||
// save
|
||||
c = raw_value->buf[raw_value->length];
|
||||
c = raw_value->buf[raw_value->length]; // save
|
||||
raw_value->buf[raw_value->length] = 0; // null-terminate
|
||||
|
||||
// Make it lowercase
|
||||
for (i = 0; raw_value->buf[i]; ++i) {
|
||||
raw_value->buf[i] = tolower(raw_value->buf[i]);
|
||||
}
|
||||
|
||||
// null-terminate
|
||||
raw_value->buf[raw_value->length] = 0;
|
||||
|
||||
// Find the substring position
|
||||
ptr = strstr( raw_value->buf, str );
|
||||
|
||||
// restore the "length" byte
|
||||
raw_value->buf[raw_value->length] = c;
|
||||
raw_value->buf[raw_value->length] = c; // restore
|
||||
|
||||
if( ptr == 0 ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// return index
|
||||
return ptr - raw_value->buf;
|
||||
return ptr - raw_value->buf; // return index
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@@ -2472,7 +2455,7 @@ raw_find_str( IN memptr *raw_value,
|
||||
* nameConverts a http_method id stored in the HTTP Method
|
||||
*
|
||||
* Returns:
|
||||
* const char* ptr - Ptr to the HTTP Method
|
||||
* const char* ptr - Ptr to the HTTP Method *
|
||||
************************************************************************/
|
||||
const char *
|
||||
method_to_str( IN http_method_t method )
|
||||
@@ -2497,38 +2480,40 @@ method_to_str( IN http_method_t method )
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void
|
||||
print_http_headers( http_message_t * hmsg )
|
||||
{
|
||||
|
||||
ListNode *node;
|
||||
|
||||
//NNS: dlist_node *node;
|
||||
http_header_t *header;
|
||||
|
||||
// print start line
|
||||
if( hmsg->is_request ) {
|
||||
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
||||
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
||||
(int)hmsg->uri.pathquery.size, hmsg->uri.pathquery.buff);
|
||||
//printf( "method = %d, version = %d.%d, url = %.*s\n",
|
||||
// hmsg->method, hmsg->major_version, hmsg->minor_version,
|
||||
// hmsg->uri.pathquery.size, hmsg->uri.pathquery.buff);
|
||||
} else {
|
||||
printf( "resp status = %d, version = %d.%d, status msg = %.*s\n",
|
||||
hmsg->status_code, hmsg->major_version, hmsg->minor_version,
|
||||
(int)hmsg->status_msg.length, hmsg->status_msg.buf);
|
||||
// printf( "resp status = %d, version = %d.%d, status msg = %.*s\n",
|
||||
// hmsg->status_code, hmsg->major_version, hmsg->minor_version,
|
||||
// (int)hmsg->status_msg.length, hmsg->status_msg.buf);
|
||||
}
|
||||
|
||||
// print headers
|
||||
|
||||
node = ListHead( &hmsg->headers );
|
||||
//NNS: node = dlist_first_node( &hmsg->headers );
|
||||
while( node != NULL ) {
|
||||
|
||||
header = ( http_header_t * ) node->item;
|
||||
//NNS: header = (http_header_t *)node->data;
|
||||
printf( "hdr name: %.*s, value: %.*s\n",
|
||||
(int)header->name.length, header->name.buf,
|
||||
(int)header->value.length, header->value.buf );
|
||||
//printf( "hdr name: %.*s, value: %.*s\n",
|
||||
// (int)header->name.length, header->name.buf,
|
||||
// (int)header->value.length, header->value.buf );
|
||||
|
||||
node = ListNext( &hmsg->headers, node );
|
||||
|
||||
//NNS: node = dlist_next( &hmsg->headers, node );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -118,7 +118,7 @@ static xboolean gInitialized = FALSE;
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
init_table( IN const char *encoded_str,
|
||||
OUT const char *table[],
|
||||
IN int tbl_size )
|
||||
@@ -144,7 +144,7 @@ init_table( IN const char *encoded_str,
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
init_tables( void )
|
||||
{
|
||||
init_table( Http1xxStr, Http1xxCodes, NUM_1XX_CODES );
|
||||
|
@@ -29,10 +29,10 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/******************************************************************************
|
||||
/************************************************************************
|
||||
* Purpose: This file defines the Web Server and has functions to carry out
|
||||
* operations of the Web Server.
|
||||
******************************************************************************/
|
||||
************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
@@ -64,11 +64,7 @@
|
||||
/*
|
||||
Response Types
|
||||
*/
|
||||
enum resp_type {
|
||||
RESP_FILEDOC,
|
||||
RESP_XMLDOC,
|
||||
RESP_HEADERS,
|
||||
RESP_WEBDOC,
|
||||
enum resp_type { RESP_FILEDOC, RESP_XMLDOC, RESP_HEADERS, RESP_WEBDOC,
|
||||
RESP_POST };
|
||||
|
||||
// mapping of file extension to content-type of document
|
||||
@@ -186,9 +182,12 @@ static const char *gEncodedMediaTypes =
|
||||
"zip\0" APPLICATION_STR "zip\0" "\0";
|
||||
// *** end ***
|
||||
|
||||
/************************************************************************
|
||||
/***********************************************************************/
|
||||
/*
|
||||
module variables - Globals, static and externs
|
||||
************************************************************************/
|
||||
*/
|
||||
|
||||
/***********************************************************************/
|
||||
static struct document_type_t gMediaTypeList[NUM_MEDIA_TYPES];
|
||||
membuffer gDocumentRootDir; // a local dir which serves as webserver root
|
||||
static struct xml_alias_t gAliasDoc; // XML document
|
||||
@@ -206,7 +205,7 @@ extern str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES];
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
media_list_init( void )
|
||||
{
|
||||
int i;
|
||||
@@ -244,7 +243,7 @@ media_list_init( void )
|
||||
* 0 on success;
|
||||
* -1 on error
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
search_extension( IN const char *extension,
|
||||
OUT const char **con_type,
|
||||
OUT const char **con_subtype )
|
||||
@@ -291,7 +290,7 @@ search_extension( IN const char *extension,
|
||||
* 0 - On Sucess
|
||||
* UPNP_E_OUTOF_MEMORY - on memory allocation failures
|
||||
************************************************************************/
|
||||
UPNP_INLINE int
|
||||
XINLINE int
|
||||
get_content_type( IN const char *filename,
|
||||
OUT DOMString * content_type )
|
||||
{
|
||||
@@ -349,7 +348,7 @@ get_content_type( IN const char *filename,
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
glob_alias_init( void )
|
||||
{
|
||||
struct xml_alias_t *alias = &gAliasDoc;
|
||||
@@ -371,7 +370,7 @@ glob_alias_init( void )
|
||||
* Returns:
|
||||
* BOOLEAN
|
||||
************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
is_valid_alias( IN const struct xml_alias_t *alias )
|
||||
{
|
||||
return alias->doc.buf != NULL;
|
||||
@@ -590,9 +589,10 @@ web_server_destroy( void )
|
||||
* Parameters:
|
||||
* IN const char* filename ; Filename having the description document
|
||||
* OUT struct File_Info * info ; File information object having file
|
||||
* attributes such as filelength, when was the file last
|
||||
* modified, whether a file or a directory and whether the
|
||||
* file or directory is readable.
|
||||
* attributes such as filelength, when was
|
||||
* the file last modified, whether a file
|
||||
* or a directory and whether the file or
|
||||
* directory is readable.
|
||||
*
|
||||
* Description: Release memory allocated for the global web server root
|
||||
* directory and the global XML document
|
||||
@@ -637,11 +637,11 @@ get_file_info( IN const char *filename,
|
||||
|
||||
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",
|
||||
filename, (long long)info->file_length,
|
||||
asctime( gmtime( &info->last_modified ) ),
|
||||
info->is_readable );
|
||||
info->is_readable ); )
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -689,7 +689,8 @@ web_server_set_root_dir( IN const char *root_dir )
|
||||
* OUT struct xml_alias_t* alias ; xml alias object which has a file name
|
||||
* stored
|
||||
* OUT struct File_Info * info ; File information object which will be
|
||||
* filled up if the file comparison succeeds
|
||||
* filled up if the file comparison
|
||||
* succeeds
|
||||
*
|
||||
* Description: Compare the files names between the one on the XML alias
|
||||
* the one passed in as the input parameter. If equal extract file
|
||||
@@ -699,7 +700,7 @@ web_server_set_root_dir( IN const char *root_dir )
|
||||
* TRUE - On Success
|
||||
* FALSE if request is not an alias
|
||||
************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
get_alias( IN const char *request_file,
|
||||
OUT struct xml_alias_t *alias,
|
||||
OUT struct File_Info *info )
|
||||
@@ -745,7 +746,7 @@ isFileInVirtualDir( IN char *filePath )
|
||||
return TRUE;
|
||||
} else {
|
||||
if( ( strncmp( pCurVirtualDir->dirName, filePath, webDirLen )
|
||||
== 0 ) && ( filePath[webDirLen] == '/' || filePath[webDirLen] == '\0' || filePath[webDirLen] == '?' ) )
|
||||
== 0 ) && ( filePath[webDirLen] == '/' ) )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -869,7 +870,7 @@ StrTok( char **Src,
|
||||
* OUT int * FirstByte ; gets the first byte of the token
|
||||
* OUT int * LastByte ; gets the last byte of the token
|
||||
*
|
||||
* Description: Returns a range of integers from a string
|
||||
* Description: Returns a range of integers from a sring
|
||||
*
|
||||
* Returns: int ;
|
||||
* always returns 1;
|
||||
@@ -879,24 +880,22 @@ GetNextRange( char **SrcRangeStr,
|
||||
off_t *FirstByte,
|
||||
off_t *LastByte )
|
||||
{
|
||||
char *Ptr;
|
||||
char *Tok;
|
||||
int i;
|
||||
int64_t F = -1;
|
||||
int64_t L = -1;
|
||||
char *Ptr,
|
||||
*Tok;
|
||||
int i,
|
||||
F = -1,
|
||||
L = -1;
|
||||
int Is_Suffix_byte_Range = 1;
|
||||
|
||||
if( *SrcRangeStr == NULL ) {
|
||||
if( *SrcRangeStr == NULL )
|
||||
return -1;
|
||||
}
|
||||
|
||||
Tok = StrTok( SrcRangeStr, "," );
|
||||
|
||||
if( ( Ptr = strstr( Tok, "-" ) ) == NULL ) {
|
||||
if( ( Ptr = strstr( Tok, "-" ) ) == NULL )
|
||||
return -1;
|
||||
}
|
||||
*Ptr = ' ';
|
||||
sscanf( Tok, "%"SCNd64"%"SCNd64, &F, &L );
|
||||
sscanf( Tok, "%d%d", &F, &L );
|
||||
|
||||
if( F == -1 || L == -1 ) {
|
||||
*Ptr = '-';
|
||||
@@ -911,15 +910,16 @@ GetNextRange( char **SrcRangeStr,
|
||||
}
|
||||
|
||||
if( Is_Suffix_byte_Range ) {
|
||||
*FirstByte = (off_t)L;
|
||||
*LastByte = (off_t)F;
|
||||
*FirstByte = L;
|
||||
*LastByte = F;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
*FirstByte = (off_t)F;
|
||||
*LastByte = (off_t)L;
|
||||
|
||||
*FirstByte = F;
|
||||
*LastByte = L;
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@@ -928,8 +928,8 @@ GetNextRange( char **SrcRangeStr,
|
||||
* Parameters:
|
||||
* char * ByteRangeSpecifier ; String containing the range
|
||||
* long FileLength ; Length of the file
|
||||
* OUT struct SendInstruction * Instr ; SendInstruction object
|
||||
* where the range operations will be stored
|
||||
* OUT struct SendInstruction * Instr ; SendInstruction object where the
|
||||
* range operations will be stored
|
||||
*
|
||||
* Description: Fills in the Offset, read size and contents to send out
|
||||
* as an HTTP Range Response
|
||||
@@ -1531,7 +1531,7 @@ http_RecvPostMessage( http_parser_t * parser,
|
||||
|
||||
if( Instr && Instr->IsVirtualFile ) {
|
||||
|
||||
Fp = (virtualDirCallback.open)( filename, UPNP_WRITE );
|
||||
Fp = virtualDirCallback.open( filename, UPNP_WRITE );
|
||||
if( Fp == NULL ) {
|
||||
return HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
@@ -1586,10 +1586,13 @@ http_RecvPostMessage( http_parser_t * parser,
|
||||
}
|
||||
} else if( num_read == 0 ) {
|
||||
if( ok_on_close ) {
|
||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
||||
parser->msg.msg.buf );
|
||||
print_http_headers( &parser->msg );
|
||||
//print_http_headers( &parser->msg );
|
||||
)
|
||||
|
||||
parser->position = POS_COMPLETE;
|
||||
} else {
|
||||
// partial msg
|
||||
@@ -1757,10 +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" );
|
||||
)
|
||||
|
||||
membuffer_destroy( &headers );
|
||||
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 ) {
|
||||
// read data
|
||||
numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL);
|
||||
@@ -252,9 +243,6 @@ sock_read_write( IN SOCKINFO * info,
|
||||
send( sockfd, buffer + bytes_sent, byte_left,
|
||||
MSG_DONTROUTE|MSG_NOSIGNAL);
|
||||
if( num_written == -1 ) {
|
||||
#ifdef SO_NOSIGPIPE
|
||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
||||
#endif
|
||||
return num_written;
|
||||
}
|
||||
|
||||
@@ -265,11 +253,6 @@ sock_read_write( IN SOCKINFO * info,
|
||||
numBytes = bytes_sent;
|
||||
}
|
||||
|
||||
#ifdef SO_NOSIGPIPE
|
||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
||||
}
|
||||
#endif
|
||||
|
||||
if( numBytes < 0 ) {
|
||||
return UPNP_E_SOCKET_ERROR;
|
||||
}
|
||||
|
@@ -34,11 +34,8 @@
|
||||
************************************************************************/
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <osreldate.h>
|
||||
#if __FreeBSD_version < 601103
|
||||
#include <lwres/netdb.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "config.h"
|
||||
#include "uri.h"
|
||||
|
||||
@@ -367,20 +364,16 @@ free_URL_list( URL_list * list )
|
||||
* uri_type *in ; URI object
|
||||
*
|
||||
* Description : Function useful in debugging for printing a parsed uri.
|
||||
* Compiled out with DBGONLY macro.
|
||||
*
|
||||
* Return : void ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void print_uri( uri_type *in )
|
||||
{
|
||||
DBGONLY( void print_uri( uri_type * in ) {
|
||||
print_token( &in->scheme );
|
||||
print_token( &in->hostport.text );
|
||||
print_token( &in->pathquery );
|
||||
print_token( &in->fragment );
|
||||
}
|
||||
#endif
|
||||
print_token( &in->pathquery ); print_token( &in->fragment );} )
|
||||
|
||||
/************************************************************************
|
||||
* Function : print_token
|
||||
@@ -389,23 +382,20 @@ void print_uri( uri_type *in )
|
||||
* token * in ; token
|
||||
*
|
||||
* Description : Function useful in debugging for printing a token.
|
||||
* Compiled out with DBGONLY macro.
|
||||
*
|
||||
* Return : void ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void print_token(token * in)
|
||||
{
|
||||
DBGONLY( void print_token( token * in ) {
|
||||
int i = 0;
|
||||
printf( "Token Size : %"PRIzu"\n\'", in->size );
|
||||
printf( "Token Size : %d\n\'", in->size );
|
||||
for( i = 0; i < in->size; i++ ) {
|
||||
putchar( in->buff[i] );
|
||||
}
|
||||
putchar( '\'' );
|
||||
putchar( '\n' );
|
||||
}
|
||||
#endif
|
||||
putchar( in->buff[i] );}
|
||||
putchar( '\'' ); putchar( '\n' );}
|
||||
|
||||
)
|
||||
|
||||
/************************************************************************
|
||||
* Function : token_string_casecmp
|
||||
@@ -424,10 +414,8 @@ void print_token(token * in)
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int token_string_casecmp(
|
||||
token * in1,
|
||||
char *in2 )
|
||||
{
|
||||
int token_string_casecmp( token * in1,
|
||||
char *in2 ) {
|
||||
int in2_length = strlen( in2 );
|
||||
|
||||
if( in1->size != in2_length )
|
||||
@@ -555,7 +543,7 @@ parse_hostport( const char *in,
|
||||
int begin_port;
|
||||
int hostport_size = 0;
|
||||
int host_size = 0;
|
||||
#if !defined(WIN32) && !(defined(__OSX__) || defined(__APPLE__))
|
||||
#ifndef WIN32
|
||||
char temp_hostbyname_buff[BUFFER_SIZE];
|
||||
struct hostent h_buf;
|
||||
#endif
|
||||
@@ -628,59 +616,25 @@ parse_hostport( const char *in,
|
||||
#if defined(WIN32) || defined(__CYGWIN__)
|
||||
h=gethostbyname(temp_host_name);
|
||||
#elif defined(SPARC_SOLARIS)
|
||||
errCode = gethostbyname_r(
|
||||
temp_host_name,
|
||||
errCode = gethostbyname_r( temp_host_name,
|
||||
&h,
|
||||
temp_hostbyname_buff,
|
||||
BUFFER_SIZE, &errcode );
|
||||
#elif defined(__FreeBSD__) && __FreeBSD_version < 601103
|
||||
h = lwres_gethostbyname_r(
|
||||
temp_host_name,
|
||||
#elif defined(__FreeBSD__)
|
||||
h = lwres_gethostbyname_r( temp_host_name,
|
||||
&h_buf,
|
||||
temp_hostbyname_buff,
|
||||
BUFFER_SIZE, &errcode );
|
||||
if ( h == NULL ) {
|
||||
errCode = 1;
|
||||
}
|
||||
#elif defined(__OSX__) || defined(__APPLE__)
|
||||
h = gethostbyname(temp_host_name);
|
||||
if ( h == NULL ) {
|
||||
errCode = 1;
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
errCode = gethostbyname_r(
|
||||
temp_host_name,
|
||||
#else
|
||||
errCode = gethostbyname_r( temp_host_name,
|
||||
&h_buf,
|
||||
temp_hostbyname_buff,
|
||||
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
|
||||
|
||||
if( errCode == 0 ) {
|
||||
if( h ) {
|
||||
if( ( h->h_addrtype == AF_INET ) && ( h->h_length == 4 ) ) {
|
||||
@@ -833,8 +787,9 @@ remove_dots( char *in,
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
|
||||
Segments[0] = NULL;
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"REMOVE_DOTS: before: %s\n", in );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"REMOVE_DOTS: before: %s\n", in ) );
|
||||
while( ( copyFrom < max ) && ( *copyFrom != '?' )
|
||||
&& ( *copyFrom != '#' ) ) {
|
||||
|
||||
@@ -879,8 +834,9 @@ remove_dots( char *in,
|
||||
}
|
||||
( *copyTo ) = 0;
|
||||
free( Segments );
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"REMOVE_DOTS: after: %s\n", in );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"REMOVE_DOTS: after: %s\n", in ) );
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
@@ -433,7 +433,7 @@ FindServiceControlURLPath( service_table * table,
|
||||
*
|
||||
* Parameters :
|
||||
* 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
|
||||
*
|
||||
* Description : For debugging purposes prints information from the
|
||||
@@ -443,54 +443,38 @@ FindServiceControlURLPath( service_table * table,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void printService(
|
||||
service_info *service,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module )
|
||||
{
|
||||
DBGONLY( void printService( service_info * service, Dbg_Level level,
|
||||
Dbg_Module module ) {
|
||||
if( service ) {
|
||||
if( service->serviceType ) {
|
||||
if( service->serviceType )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"serviceType: %s\n", service->serviceType );
|
||||
}
|
||||
if( service->serviceId ) {
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"serviceId: %s\n", service->serviceId );
|
||||
}
|
||||
if( service->SCPDURL ) {
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"SCPDURL: %s\n", service->SCPDURL );
|
||||
}
|
||||
if( service->controlURL ) {
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"controlURL: %s\n", service->controlURL );
|
||||
}
|
||||
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 ) {
|
||||
if( service->serviceId )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__, "serviceId: %s\n",
|
||||
service->serviceId ); if( service->SCPDURL )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__, "SCPDURL: %s\n",
|
||||
service->SCPDURL ); if( service->controlURL )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__, "controlURL: %s\n",
|
||||
service->controlURL ); 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 {
|
||||
else
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"Service is inactive\n" );
|
||||
"Service is inactive\n" );}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
)
|
||||
|
||||
/************************************************************************
|
||||
* Function : printServiceList
|
||||
*
|
||||
* Parameters :
|
||||
* 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
|
||||
*
|
||||
* Description : For debugging purposes prints information of each
|
||||
@@ -500,55 +484,43 @@ void printService(
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void printServiceList(
|
||||
service_info * service,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module )
|
||||
{
|
||||
DBGONLY( void printServiceList( service_info * service,
|
||||
Dbg_Level level,
|
||||
Dbg_Module module ) {
|
||||
while( service ) {
|
||||
if( service->serviceType ) {
|
||||
if( service->serviceType )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"serviceType: %s\n", service->serviceType );
|
||||
}
|
||||
if( service->serviceId ) {
|
||||
if( service->serviceId )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"serviceId: %s\n", service->serviceId );
|
||||
}
|
||||
if( service->SCPDURL ) {
|
||||
if( service->SCPDURL )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"SCPDURL: %s\n", service->SCPDURL );
|
||||
}
|
||||
if( service->controlURL ) {
|
||||
if( service->controlURL )
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"controlURL: %s\n", service->controlURL );
|
||||
}
|
||||
if( service->eventURL ) {
|
||||
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 ) {
|
||||
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 {
|
||||
else
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"Service is inactive\n" );
|
||||
service = service->next;}
|
||||
}
|
||||
service = service->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
)
|
||||
|
||||
/************************************************************************
|
||||
* Function : printServiceTable
|
||||
*
|
||||
* Parameters :
|
||||
* 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
|
||||
*
|
||||
* Description : For debugging purposes prints the URL base of the table
|
||||
@@ -559,18 +531,15 @@ void printServiceList(
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void printServiceTable(
|
||||
service_table * table,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module )
|
||||
{
|
||||
DBGONLY( void printServiceTable( service_table * table,
|
||||
Dbg_Level level,
|
||||
Dbg_Module module ) {
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"URL_BASE: %s\n", table->URLBase );
|
||||
UpnpPrintf( level, module, __FILE__, __LINE__,
|
||||
"Services: \n" );
|
||||
printServiceList( table->serviceList, level, module );}
|
||||
#endif
|
||||
)
|
||||
|
||||
/************************************************************************
|
||||
* Function : freeService
|
||||
@@ -880,10 +849,12 @@ getServiceList( IXML_Node * node,
|
||||
( !
|
||||
( current->controlURL =
|
||||
resolve_rel_url( URLBase, tempDOMString ) ) ) ) {
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"BAD OR MISSING CONTROL URL" );
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"CONTROL URL SET TO NULL IN SERVICE INFO" );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"BAD OR MISSING CONTROL URL" ) );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"CONTROL URL SET TO NULL IN SERVICE INFO" ) );
|
||||
current->controlURL = NULL;
|
||||
fail = 0;
|
||||
}
|
||||
@@ -899,10 +870,12 @@ getServiceList( IXML_Node * node,
|
||||
( !
|
||||
( current->eventURL =
|
||||
resolve_rel_url( URLBase, tempDOMString ) ) ) ) {
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"BAD OR MISSING EVENT URL" );
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"EVENT URL SET TO NULL IN SERVICE INFO" );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"BAD OR MISSING EVENT URL" ) );
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"EVENT URL SET TO NULL IN SERVICE INFO" ) );
|
||||
current->eventURL = NULL;
|
||||
fail = 0;
|
||||
}
|
||||
@@ -1153,8 +1126,9 @@ getServiceTable( IXML_Node * node,
|
||||
}
|
||||
}
|
||||
|
||||
if( ( out->serviceList = getAllServiceList(
|
||||
root, out->URLBase, &out->endServiceList ) ) ) {
|
||||
if( ( out->serviceList = getAllServiceList( root, out->URLBase,
|
||||
&out->
|
||||
endServiceList ) ) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -171,7 +171,7 @@ memptr_cmp_nocase( IN memptr * m,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
membuffer_initialize( INOUT membuffer * m )
|
||||
{
|
||||
m->buf = NULL;
|
||||
|
@@ -261,7 +261,7 @@
|
||||
|
||||
/** @name Other debugging features
|
||||
The UPnP SDK contains other features to aid in debugging:
|
||||
see <upnp/inc/upnpdebug.h>
|
||||
see <upnp/upnpdebug.h>
|
||||
*/
|
||||
|
||||
#define DEBUG_ALL 1
|
||||
@@ -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_MINISERVER
|
||||
#ifdef INTERNAL_WEB_SERVER
|
||||
@@ -338,6 +359,13 @@
|
||||
# define CLIENTONLY(x)
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
# define DEVICEONLY(x) x
|
||||
#else
|
||||
# define DEVICEONLY(x)
|
||||
#endif
|
||||
|
||||
//@}
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -89,23 +89,22 @@
|
||||
#define DEFAULT_TIMEOUT 1801
|
||||
|
||||
|
||||
|
||||
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||
|
||||
//Lock the subscription
|
||||
#define SubscribeLock() \
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Trying Subscribe Lock"); \
|
||||
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__, \
|
||||
"Trying Subscribe Lock")); \
|
||||
ithread_mutex_lock(&GlobalClientSubscribeMutex); \
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Subscribe Lock");
|
||||
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__,"Subscribe Lock");)
|
||||
|
||||
//Unlock the subscription
|
||||
#define SubscribeUnlock() \
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Trying Subscribe UnLock"); \
|
||||
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__, \
|
||||
"Trying Subscribe UnLock")); \
|
||||
ithread_mutex_unlock(&GlobalClientSubscribeMutex); \
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||
"Subscribe UnLock");
|
||||
DBGONLY(UpnpPrintf(UPNP_INFO,GENA,__FILE__,__LINE__,"Subscribe UnLock");)
|
||||
|
||||
|
||||
//Structure to send NOTIFY message to all subscribed control points
|
||||
@@ -162,13 +161,11 @@ EXTERN_C void genaCallback (IN http_parser_t *parser,
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaSubscribe(
|
||||
UpnpClient_Handle client_handle,
|
||||
CLIENTONLY(
|
||||
EXTERN_C int genaSubscribe(UpnpClient_Handle client_handle,
|
||||
char * PublisherURL,
|
||||
int * TimeOut,
|
||||
Upnp_SID out_sid );
|
||||
#endif
|
||||
Upnp_SID out_sid );)
|
||||
|
||||
|
||||
/************************************************************************
|
||||
@@ -187,11 +184,8 @@ EXTERN_C int genaSubscribe(
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaUnSubscribe(
|
||||
UpnpClient_Handle client_handle,
|
||||
const Upnp_SID in_sid);
|
||||
#endif
|
||||
CLIENTONLY(EXTERN_C int genaUnSubscribe(UpnpClient_Handle client_handle,
|
||||
const Upnp_SID in_sid);)
|
||||
|
||||
/************************************************************************
|
||||
* Function : genaUnregisterClient
|
||||
@@ -208,9 +202,8 @@ EXTERN_C int genaUnSubscribe(
|
||||
* Returns: int
|
||||
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
||||
#endif
|
||||
CLIENTONLY(EXTERN_C int genaUnregisterClient(
|
||||
UpnpClient_Handle client_handle);)
|
||||
|
||||
//server
|
||||
/************************************************************************
|
||||
@@ -225,9 +218,8 @@ EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
||||
* Returns: int
|
||||
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
||||
****************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
||||
#endif
|
||||
DEVICEONLY(EXTERN_C int genaUnregisterDevice(
|
||||
UpnpDevice_Handle device_handle);)
|
||||
|
||||
|
||||
/************************************************************************
|
||||
@@ -250,12 +242,10 @@ EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
||||
* return UPNP_E_SUCCESS if service response is OK else
|
||||
* returns appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
EXTERN_C int genaRenewSubscription(
|
||||
CLIENTONLY(EXTERN_C int genaRenewSubscription(
|
||||
IN UpnpClient_Handle client_handle,
|
||||
IN const Upnp_SID in_sid,
|
||||
OUT int * TimeOut);
|
||||
#endif
|
||||
OUT int * TimeOut);)
|
||||
/****************************************************************************
|
||||
* Function : genaNotifyAll
|
||||
*
|
||||
@@ -275,15 +265,13 @@ EXTERN_C int genaRenewSubscription(
|
||||
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
||||
* is it takes event variable array instead of xml document.
|
||||
****************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaNotifyAll(
|
||||
UpnpDevice_Handle device_handle,
|
||||
DEVICEONLY(EXTERN_C int genaNotifyAll(UpnpDevice_Handle device_handle,
|
||||
char *UDN,
|
||||
char *servId,
|
||||
char **VarNames,
|
||||
char **VarValues,
|
||||
int var_count);
|
||||
#endif
|
||||
int var_count
|
||||
);)
|
||||
|
||||
/****************************************************************************
|
||||
* Function : genaNotifyAllExt
|
||||
@@ -302,13 +290,8 @@ EXTERN_C int genaNotifyAll(
|
||||
* Note : This function is similar to the genaNotifyAll. the only difference
|
||||
* is it takes the document instead of event variable array
|
||||
****************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaNotifyAllExt(
|
||||
UpnpDevice_Handle device_handle,
|
||||
char *UDN,
|
||||
char *servId,
|
||||
IN IXML_Document *PropSet);
|
||||
#endif
|
||||
DEVICEONLY(EXTERN_C int genaNotifyAllExt(UpnpDevice_Handle device_handle,
|
||||
char *UDN, char *servId,IN IXML_Document *PropSet);)
|
||||
|
||||
/****************************************************************************
|
||||
* Function : genaInitNotify
|
||||
@@ -331,15 +314,13 @@ EXTERN_C int genaNotifyAllExt(
|
||||
* Note : No other event will be sent to this control point before the
|
||||
* intial state table dump.
|
||||
****************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
||||
DEVICEONLY(EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
||||
IN char *UDN,
|
||||
IN char *servId,
|
||||
IN char **VarNames,
|
||||
IN char **VarValues,
|
||||
IN int var_count,
|
||||
IN Upnp_SID sid);
|
||||
#endif
|
||||
IN Upnp_SID sid);)
|
||||
|
||||
/****************************************************************************
|
||||
* 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
|
||||
* intial state table dump.
|
||||
****************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
EXTERN_C int genaInitNotifyExt(
|
||||
DEVICEONLY(EXTERN_C int genaInitNotifyExt(
|
||||
IN UpnpDevice_Handle device_handle,
|
||||
IN char *UDN,
|
||||
IN char *servId,
|
||||
IN IXML_Document *PropSet,
|
||||
IN Upnp_SID sid);
|
||||
#endif
|
||||
IN Upnp_SID sid);)
|
||||
|
||||
|
||||
/************************************************************************
|
||||
|
@@ -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);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
EXTERN_C void print_http_request(
|
||||
http_message *message,
|
||||
Upnp_LogLevel DLevel,
|
||||
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
|
||||
DBGONLY(EXTERN_C void print_http_request(http_message
|
||||
*message,Dbg_Level DLevel,
|
||||
Dbg_Module Module,char *DbgFileName,
|
||||
int DbgLineNo););
|
||||
|
||||
#ifdef DEBUG
|
||||
EXTERN_C void print_http_response(
|
||||
http_message *message,
|
||||
Upnp_LogLevel DLevel,
|
||||
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
|
||||
DBGONLY(EXTERN_C void print_http_response(http_message *message,
|
||||
Dbg_Level DLevel,
|
||||
Dbg_Module Module,char *DbgFileName,
|
||||
int DbgLineNo););
|
||||
|
||||
#ifdef DEBUG
|
||||
EXTERN_C void print_token(
|
||||
token *in,
|
||||
Upnp_LogLevel DLevel,
|
||||
DBGONLY(EXTERN_C void print_token( token * in,
|
||||
Dbg_Level DLevel,
|
||||
Dbg_Module Module,
|
||||
char *DbgFileName,
|
||||
int DbgLineNo);
|
||||
#else
|
||||
static inline void print_token(
|
||||
token *in,
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module,
|
||||
char *DbgFileName,
|
||||
int DbgLineNo) {}
|
||||
#endif
|
||||
int DbgLineNo););
|
||||
|
||||
#ifdef DEBUG
|
||||
EXTERN_C void print_status_line(
|
||||
http_status *in,
|
||||
Upnp_LogLevel DLevel,
|
||||
DBGONLY(EXTERN_C void print_status_line(http_status *in,
|
||||
Dbg_Level DLevel,
|
||||
Dbg_Module Module,
|
||||
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
|
||||
int DbgLineNo););
|
||||
|
||||
#ifdef DEBUG
|
||||
EXTERN_C void print_request_line(
|
||||
http_request *in,
|
||||
Upnp_LogLevel DLevel,
|
||||
DBGONLY(EXTERN_C void print_request_line(http_request *in,
|
||||
Dbg_Level DLevel,
|
||||
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
|
||||
char *DbgFileName,int DbgLineNo));
|
||||
|
||||
#ifdef DEBUG
|
||||
EXTERN_C void print_uri(
|
||||
uri_type *in,
|
||||
Upnp_LogLevel DLevel,
|
||||
DBGONLY(EXTERN_C void print_uri( uri_type *in,
|
||||
Dbg_Level DLevel,
|
||||
Dbg_Module Module,
|
||||
char *DbgFileName,
|
||||
int DbgLineNo);
|
||||
#else
|
||||
static inline void print_uri(
|
||||
uri_type *in,
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module,
|
||||
char *DbgFileName,
|
||||
int DbgLineNo) {}
|
||||
#endif
|
||||
int DbgLineNo););
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -456,8 +456,6 @@ int raw_to_int( IN memptr* raw_value, int base );
|
||||
*
|
||||
* Description: Find a substring from raw character string buffer
|
||||
*
|
||||
* Side effects: raw_value is transformed to lowercase.
|
||||
*
|
||||
* Returns:
|
||||
* int - index at which the substring is found.
|
||||
************************************************************************/
|
||||
@@ -488,11 +486,7 @@ const char* method_to_str( IN http_method_t method );
|
||||
* Returns:
|
||||
* void
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
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
|
||||
} // extern "C"
|
||||
@@ -500,4 +494,3 @@ static UPNP_INLINE void print_http_headers( IN http_message_t *hmsg ) {}
|
||||
|
||||
|
||||
#endif // GENLIB_NET_HTTP_HTTPPARSER_H
|
||||
|
||||
|
@@ -56,8 +56,7 @@ http_CancelHttpGet( IN void *Handle );
|
||||
* IN uri_type* url ; URL to be validated and fixed
|
||||
* OUT uri_type* fixed_url ; URL after being fixed.
|
||||
*
|
||||
* Description:
|
||||
* Validates URL
|
||||
* Description: Validates URL
|
||||
*
|
||||
* Returns:
|
||||
* UPNP_E_INVALID_URL
|
||||
@@ -65,7 +64,6 @@ http_CancelHttpGet( IN void *Handle );
|
||||
************************************************************************/
|
||||
int http_FixUrl( IN uri_type* url, OUT uri_type* fixed_url );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_FixStrUrl
|
||||
*
|
||||
@@ -74,8 +72,7 @@ int http_FixUrl( IN uri_type* url, OUT uri_type* fixed_url );
|
||||
* IN int urlstrlen ; Length of the character string
|
||||
* OUT uri_type* fixed_url ; Fixed and corrected URL
|
||||
*
|
||||
* Description:
|
||||
* Parses URL and then validates URL
|
||||
* Description: Parses URL and then validates URL
|
||||
*
|
||||
* Returns:
|
||||
* UPNP_E_INVALID_URL
|
||||
@@ -91,8 +88,8 @@ int http_FixStrUrl( IN char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url )
|
||||
* IN uri_type* destination_url ; URL containing destination information
|
||||
* OUT uri_type *url ; Fixed and corrected URL
|
||||
*
|
||||
* Description:
|
||||
* Gets destination address from URL and then connects to the remote end
|
||||
* Description: Gets destination address from URL and then connects to the
|
||||
* remote end
|
||||
*
|
||||
* Returns:
|
||||
* socket descriptor on sucess
|
||||
@@ -101,21 +98,19 @@ int http_FixStrUrl( IN char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url )
|
||||
************************************************************************/
|
||||
int http_Connect( IN uri_type* destination_url, OUT uri_type *url );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_RecvMessage
|
||||
*
|
||||
* Parameters:
|
||||
* IN SOCKINFO *info ; Socket information object
|
||||
* OUT http_parser_t* parser; HTTP parser object
|
||||
* OUT http_parser_t* parser, HTTP parser object
|
||||
* IN http_method_t request_method ; HTTP request method
|
||||
* IN OUT int* timeout_secs ; time out
|
||||
* OUT int* http_error_code ; HTTP error code returned
|
||||
*
|
||||
* Description:
|
||||
* Get the data on the socket and take actions based on the read data
|
||||
* to modify the parser objects buffer. If an error is reported while
|
||||
* parsing the data, the error code is passed in the http_errr_code
|
||||
* Description: Get the data on the socket and take actions based on the
|
||||
* read data to modify the parser objects buffer. If an error is reported
|
||||
* while parsing the data, the error code is passed in the http_errr_code
|
||||
* parameter
|
||||
*
|
||||
* Returns:
|
||||
@@ -136,8 +131,7 @@ int http_RecvMessage( IN SOCKINFO *info, OUT http_parser_t* parser,
|
||||
* IN OUT int * TimeOut ; time out value
|
||||
* IN const char* fmt, ... Pattern format to take actions upon
|
||||
*
|
||||
* Description:
|
||||
* Sends a message to the destination based on the
|
||||
* Description: Sends a message to the destination based on the
|
||||
* IN const char* fmt parameter
|
||||
* fmt types:
|
||||
* 'f': arg = const char * file name
|
||||
@@ -154,12 +148,9 @@ int http_RecvMessage( IN SOCKINFO *info, OUT http_parser_t* parser,
|
||||
* UPNP_E_FILE_READ_ERROR
|
||||
* UPNP_E_SUCCESS
|
||||
************************************************************************/
|
||||
int http_SendMessage(
|
||||
IN SOCKINFO *info,
|
||||
IN OUT int* timeout_secs,
|
||||
int http_SendMessage( IN SOCKINFO *info, IN OUT int* timeout_secs,
|
||||
IN const char* fmt, ... );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_RequestAndResponse
|
||||
*
|
||||
@@ -172,8 +163,7 @@ int http_SendMessage(
|
||||
* IN int timeout_secs ; time out value
|
||||
* OUT http_parser_t* response ; Parser object to receive the repsonse
|
||||
*
|
||||
* Description:
|
||||
* Initiates socket, connects to the destination, sends a
|
||||
* Description: Initiates socket, connects to the destination, sends a
|
||||
* request and waits for the response from the remote end
|
||||
*
|
||||
* Returns:
|
||||
@@ -182,15 +172,12 @@ int http_SendMessage(
|
||||
* Error Codes returned by http_SendMessage
|
||||
* Error Codes returned by http_RecvMessage
|
||||
************************************************************************/
|
||||
int http_RequestAndResponse(
|
||||
IN uri_type* destination,
|
||||
IN const char* request,
|
||||
IN size_t request_length,
|
||||
int http_RequestAndResponse( IN uri_type* destination,
|
||||
IN const char* request, IN size_t request_length,
|
||||
IN http_method_t req_method,
|
||||
IN int timeout_secs,
|
||||
OUT http_parser_t* response );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* return codes:
|
||||
* 0 -- success
|
||||
@@ -203,31 +190,30 @@ int http_RequestAndResponse(
|
||||
* UPNP_E_SOCKET_WRITE
|
||||
************************************************************************/
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_Download
|
||||
*
|
||||
* Parameters :
|
||||
* IN const char* url_str; String as a URL
|
||||
* IN int timeout_secs; time out value
|
||||
* OUT char** document; buffer to store the document extracted
|
||||
* IN const char* url_str : String as a URL
|
||||
* IN int timeout_secs : time out value
|
||||
* OUT char** document : buffer to store the document extracted
|
||||
* from the donloaded message.
|
||||
* OUT int* doc_length; length of the extracted document
|
||||
* OUT char* content_type; Type of content
|
||||
* OUT int* doc_length : length of the extracted document
|
||||
* OUT char* content_type : Type of content
|
||||
*
|
||||
* Description:
|
||||
* Download the document message and extract the document
|
||||
* Description : Download the document message and extract the document
|
||||
* from the message.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS
|
||||
* UPNP_E_INVALID_URL
|
||||
* Return : int;
|
||||
* UPNP_E_SUCCESS;
|
||||
* UPNP_E_INVALID_URL;
|
||||
*
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_Download(
|
||||
IN const char* url,
|
||||
int http_Download( IN const char* url,
|
||||
IN int timeout_secs,
|
||||
OUT char** document,
|
||||
OUT int* doc_length,
|
||||
OUT char** document, OUT int* doc_length,
|
||||
OUT char* content_type );
|
||||
|
||||
|
||||
@@ -241,66 +227,67 @@ int http_Download(
|
||||
* IN unsigned int *size : Size of the data to be sent.
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Formats data if format used is UPNP_USING_CHUNKED.
|
||||
* Description : Formats data if format used is UPNP_USING_CHUNKED.
|
||||
* Writes data on the socket connected to the peer.
|
||||
*
|
||||
* Return: int
|
||||
* Return : int ;
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* -1 - On Socket Error.
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_WriteHttpPost(IN void *Handle,
|
||||
IN char *buf,
|
||||
IN unsigned int *size,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_CloseHttpPost
|
||||
*
|
||||
* Parameters :
|
||||
* IN void *Handle; Handle to the http post object
|
||||
* IN OUT int *httpStatus; HTTP status returned on receiving a
|
||||
* IN void *Handle : Handle to the http post object
|
||||
* IN OUT int *httpStatus : HTTP status returned on receiving a
|
||||
* response message
|
||||
* IN int timeout; time out value
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Sends remaining data if using UPNP_USING_CHUNKED
|
||||
* Description : Sends remaining data if using UPNP_USING_CHUNKED
|
||||
* format. Receives any more messages. Destroys socket and any socket
|
||||
* associated memory. Frees handle associated with the HTTP POST msg.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Sucess
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* Return : int ;
|
||||
* UPNP_E_SUCCESS - On Sucess ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_CloseHttpPost(IN void *Handle,
|
||||
IN OUT int *httpStatus,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_OpenHttpPost
|
||||
*
|
||||
* Parameters :
|
||||
* IN const char *url_str; String as a URL
|
||||
* IN OUT void **Handle; Pointer to buffer to store HTTP
|
||||
* IN const char *url_str : String as a URL
|
||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
||||
* post handle
|
||||
* IN const char *contentType; Type of content
|
||||
* IN int contentLength; length of content
|
||||
* IN int timeout; time out value
|
||||
* IN const char *contentType : Type of content
|
||||
* IN int contentLength : length of content
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Makes the HTTP POST message, connects to the peer,
|
||||
* Description : Makes the HTTP POST message, connects to the peer,
|
||||
* sends the HTTP POST request. Adds the post handle to buffer of
|
||||
* such handles
|
||||
*
|
||||
* Return : int;
|
||||
* UPNP_E_SUCCESS - On Sucess
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_SOCKET_ERROR
|
||||
* UPNP_E_SOCKET_CONNECT
|
||||
* UPNP_E_SUCCESS - On Sucess ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramter ;
|
||||
* UPNP_E_OUTOF_MEMORY ;
|
||||
* UPNP_E_SOCKET_ERROR ;
|
||||
* UPNP_E_SOCKET_CONNECT ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_OpenHttpPost(IN const char *url_str,
|
||||
IN OUT void **Handle,
|
||||
@@ -308,72 +295,69 @@ int http_OpenHttpPost(IN const char *url_str,
|
||||
IN int contentLength,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_ReadHttpGet
|
||||
*
|
||||
* Parameters :
|
||||
* IN void *Handle; Handle to the HTTP get object
|
||||
* IN OUT char *buf; Buffer to get the read and parsed data
|
||||
* IN OUT unsigned int *size; Size of the buffer passed
|
||||
* IN int timeout; time out value
|
||||
* IN void *Handle : Handle to the HTTP get object
|
||||
* IN OUT char *buf : Buffer to get the read and parsed data
|
||||
* IN OUT unsigned int *size : Size of tge buffer passed
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Parses already existing data, then gets new data.
|
||||
* Description : Parses already existing data, then gets new data.
|
||||
* Parses and extracts information from the new data.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Sucess
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* UPNP_E_BAD_RESPONSE
|
||||
* UPNP_E_BAD_HTTPMSG
|
||||
* UPNP_E_CANCELED
|
||||
* Return : int ;
|
||||
* UPNP_E_SUCCESS - On Sucess ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter;
|
||||
* UPNP_E_BAD_RESPONSE ;
|
||||
* UPNP_E_BAD_HTTPMSG ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_ReadHttpGet(
|
||||
IN void *Handle,
|
||||
int http_ReadHttpGet(IN void *Handle,
|
||||
IN OUT char *buf,
|
||||
IN OUT unsigned int *size,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_HttpGetProgress
|
||||
*
|
||||
* Parameters :
|
||||
* IN void *Handle; Handle to the HTTP get object
|
||||
* OUT unsigned int *length; Buffer to get the read and parsed data
|
||||
* OUT unsigned int *total; Size of tge buffer passed
|
||||
* IN void *Handle : Handle to the HTTP get object
|
||||
* OUT unsigned int *length : Buffer to get the read and parsed data
|
||||
* OUT unsigned int *total : Size of tge buffer passed
|
||||
*
|
||||
* Description:
|
||||
* Extracts information from the Handle to the HTTP get object.
|
||||
* Description : Extracts information from the Handle to the HTTP get
|
||||
* object.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Sucess
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* Return : int ;
|
||||
* UPNP_E_SUCCESS - On Sucess ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_HttpGetProgress(
|
||||
IN void *Handle,
|
||||
int http_HttpGetProgress(IN void *Handle,
|
||||
OUT unsigned int *length,
|
||||
OUT unsigned int *total );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_CloseHttpGet
|
||||
*
|
||||
* Parameters :
|
||||
* IN void *Handle ; Handle to HTTP get object
|
||||
*
|
||||
* Description:
|
||||
* Clears the handle allocated for the HTTP GET operation
|
||||
* Description : Clears the handle allocated for the HTTP GET operation
|
||||
* Clears socket states and memory allocated for socket operations.
|
||||
*
|
||||
* Return: int
|
||||
* Return : int ;
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_CloseHttpGet(IN void *Handle);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_OpenHttpGet
|
||||
*
|
||||
@@ -387,52 +371,54 @@ int http_CloseHttpGet(IN void *Handle);
|
||||
* response message
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Makes the HTTP GET message, connects to the peer,
|
||||
* Description : Makes the HTTP GET message, connects to the peer,
|
||||
* sends the HTTP GET request, gets the response and parses the
|
||||
* response.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramters
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_SOCKET_ERROR
|
||||
* UPNP_E_BAD_RESPONSE
|
||||
* Return : int;
|
||||
* UPNP_E_SUCCESS - On Success ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramters ;
|
||||
* UPNP_E_OUTOF_MEMORY ;
|
||||
* UPNP_E_SOCKET_ERROR ;
|
||||
* UPNP_E_BAD_RESPONSE ;
|
||||
*
|
||||
* Note :
|
||||
*
|
||||
************************************************************************/
|
||||
int http_OpenHttpGet(
|
||||
IN const char *url_str,
|
||||
int http_OpenHttpGet(IN const char *url_str,
|
||||
IN OUT void **Handle,
|
||||
IN OUT char **contentType,
|
||||
OUT int *contentLength,
|
||||
OUT int *httpStatus,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_OpenHttpGetProxy
|
||||
*
|
||||
* Parameters :
|
||||
* IN const char *url_str; String as a URL
|
||||
* IN const char *proxy_str; String as a URL
|
||||
* IN OUT void **Handle; Pointer to buffer to store HTTP
|
||||
* IN const char *url_str : String as a URL
|
||||
* IN const char *proxy_str : String as a URL to the proxy
|
||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
||||
* post handle
|
||||
* IN OUT char **contentType; Type of content
|
||||
* OUT int *contentLength; length of content
|
||||
* OUT int *httpStatus; HTTP status returned on receiving a
|
||||
* IN OUT char **contentType : Type of content
|
||||
* OUT int *contentLength : length of content
|
||||
* OUT int *httpStatus : HTTP status returned on receiving a
|
||||
* response message
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Makes the HTTP GET message, connects to the peer,
|
||||
* sends the HTTP GET request, gets the response and parses the response.
|
||||
* If a proxy URL is defined then the connection is made there.
|
||||
* Description : Makes the HTTP GET message, connects to the peer,
|
||||
* sends the HTTP GET request, gets the response and parses the
|
||||
* response.
|
||||
*
|
||||
* Return : int;
|
||||
* UPNP_E_SUCCESS - On Success ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramters ;
|
||||
* UPNP_E_OUTOF_MEMORY ;
|
||||
* UPNP_E_SOCKET_ERROR ;
|
||||
* UPNP_E_BAD_RESPONSE ;
|
||||
*
|
||||
* Note :
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramters
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_SOCKET_ERROR
|
||||
* UPNP_E_BAD_RESPONSE
|
||||
************************************************************************/
|
||||
int http_OpenHttpGetProxy(IN const char *url_str,
|
||||
IN const char *proxy_str,
|
||||
@@ -447,25 +433,24 @@ int http_OpenHttpGetProxy(IN const char *url_str,
|
||||
* Function : http_SendStatusResponse
|
||||
*
|
||||
* Parameters :
|
||||
* IN SOCKINFO *info; Socket information object
|
||||
* IN int http_status_code; error code returned while making
|
||||
* IN SOCKINFO *info : Socket information object
|
||||
* IN int http_status_code : error code returned while making
|
||||
* or sending the response message
|
||||
* IN int request_major_version; request major version
|
||||
* IN int request_minor_version; request minor version
|
||||
* IN int request_major_version : request major version
|
||||
* IN int request_minor_version : request minor version
|
||||
*
|
||||
* Description:
|
||||
* Generate a response message for the status query and send the
|
||||
* status response.
|
||||
* Description : Generate a response message for the status query and
|
||||
* send the status response.
|
||||
*
|
||||
* Return: int
|
||||
* Return : int;
|
||||
* 0 -- success
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_SOCKET_WRITE
|
||||
* UPNP_E_TIMEDOUT
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_SendStatusResponse(
|
||||
IN SOCKINFO *info,
|
||||
IN int http_status_code,
|
||||
int http_SendStatusResponse( IN SOCKINFO *info, IN int http_status_code,
|
||||
IN int request_major_version,
|
||||
IN int request_minor_version );
|
||||
|
||||
@@ -474,103 +459,96 @@ int http_SendStatusResponse(
|
||||
* Function : http_MakeMessage
|
||||
*
|
||||
* Parameters :
|
||||
* INOUT membuffer* buf; buffer with the contents of the
|
||||
* INOUT membuffer* buf : buffer with the contents of the
|
||||
* message
|
||||
* IN int http_major_version; HTTP major version
|
||||
* IN int http_minor_version; HTTP minor version
|
||||
* IN const char* fmt; Pattern format
|
||||
* ...;
|
||||
* IN int http_major_version : HTTP major version
|
||||
* IN int http_minor_version : HTTP minor version
|
||||
* IN const char* fmt : Pattern format
|
||||
* ... :
|
||||
*
|
||||
* Description:
|
||||
* Generate an HTTP message based on the format that is specified
|
||||
* in the input parameters.
|
||||
* Description : Generate an HTTP message based on the format that is
|
||||
* specified in the input parameters.
|
||||
*
|
||||
* fmt types:
|
||||
* 'B': arg = int status_code
|
||||
* appends content-length, content-type and HTML body
|
||||
* for given code
|
||||
* 'b': arg1 = const char* buf;
|
||||
* arg2 = size_t buf_length memory ptr
|
||||
* 's': arg = const char* C_string
|
||||
* 'b': arg1 = const char* buf; arg2 = size_t buf_length
|
||||
* memory ptr
|
||||
* 'c': (no args) appends CRLF "\r\n"
|
||||
* 'd': arg = int number // appends decimal number
|
||||
* 'h': arg = off_t number // appends off_t number
|
||||
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
|
||||
* 'D': (no args) appends HTTP DATE: header
|
||||
* 'S': (no args) appends HTTP SERVER: header
|
||||
* 'U': (no args) appends HTTP USER-AGENT: header
|
||||
* 'C': (no args) appends a HTTP CONNECTION: close header
|
||||
* depending on major,minor version
|
||||
* 'c': (no args) appends CRLF "\r\n"
|
||||
* 'D': (no args) appends HTTP DATE: header
|
||||
* 'd': arg = int number // appends decimal number
|
||||
* 'G': arg = range information // add range header
|
||||
* 'h': arg = off_t number // appends off_t number
|
||||
* 'K': (no args) // add chunky header
|
||||
* 'N': arg1 = off_t content_length // content-length header
|
||||
* 'q': arg1 = http_method_t // request start line and HOST header
|
||||
* arg2 = (uri_type *)
|
||||
* 'Q': arg1 = http_method_t; // start line of request
|
||||
* arg2 = char* url;
|
||||
* arg3 = size_t url_length
|
||||
* 'N': arg1 = int content_length // content-length header
|
||||
* 'Q': arg1 = http_method_t; arg2 = char* url;
|
||||
* arg3 = int url_length // start line of request
|
||||
* 'R': arg = int status_code // adds a response start line
|
||||
* 'S': (no args) appends HTTP SERVER: header
|
||||
* 's': arg = const char* C_string
|
||||
* 'T': arg = char * content_type; format
|
||||
* e.g: "text/html"; content-type header
|
||||
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
|
||||
* 'U': (no args) appends HTTP USER-AGENT: header
|
||||
* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
|
||||
* 'B': arg = int status_code
|
||||
* appends content-length, content-type and HTML body for given code
|
||||
* 'T': arg = char * content_type; format e.g: "text/html";
|
||||
* content-type header
|
||||
*
|
||||
* Return: int
|
||||
* Return : int;
|
||||
* 0 - On Success
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_INVALID_URL
|
||||
* UPNP_E_INVALID_URL;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int http_MakeMessage(
|
||||
INOUT membuffer* buf,
|
||||
int http_MakeMessage( INOUT membuffer* buf,
|
||||
IN int http_major_version,
|
||||
IN int http_minor_version,
|
||||
IN const char* fmt, ... );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_CalcResponseVersion
|
||||
*
|
||||
* Parameters :
|
||||
* IN int request_major_vers; Request major version
|
||||
* IN int request_minor_vers; Request minor version
|
||||
* OUT int* response_major_vers; Response mojor version
|
||||
* OUT int* response_minor_vers; Response minor version
|
||||
* IN int request_major_vers : Request major version
|
||||
* IN int request_minor_vers : Request minor version
|
||||
* OUT int* response_major_vers : Response mojor version
|
||||
* OUT int* response_minor_vers : Response minor version
|
||||
*
|
||||
* Description:
|
||||
* Calculate HTTP response versions based on the request versions.
|
||||
* Description : Calculate HTTP response versions based on the request
|
||||
* versions.
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
void http_CalcResponseVersion(
|
||||
IN int request_major_vers,
|
||||
IN int request_minor_vers,
|
||||
OUT int* response_major_vers,
|
||||
OUT int* response_minor_vers );
|
||||
|
||||
IN int request_major_vers, IN int request_minor_vers,
|
||||
OUT int* response_major_vers, OUT int* response_minor_vers );
|
||||
|
||||
/************************************************************************
|
||||
* Function : http_OpenHttpGetEx
|
||||
*
|
||||
* Parameters :
|
||||
* IN const char *url_str; String as a URL
|
||||
* IN OUT void **Handle; Pointer to buffer to store HTTP
|
||||
* IN const char *url_str : String as a URL
|
||||
* IN OUT void **Handle : Pointer to buffer to store HTTP
|
||||
* post handle
|
||||
* IN OUT char **contentType; Type of content
|
||||
* OUT int *contentLength; length of content
|
||||
* OUT int *httpStatus; HTTP status returned on receiving a
|
||||
* IN OUT char **contentType : Type of content
|
||||
* OUT int *contentLength : length of content
|
||||
* OUT int *httpStatus : HTTP status returned on receiving a
|
||||
* response message
|
||||
* IN int timeout; time out value
|
||||
* IN int timeout : time out value
|
||||
*
|
||||
* Description:
|
||||
* Makes the HTTP GET message, connects to the peer,
|
||||
* Description : Makes the HTTP GET message, connects to the peer,
|
||||
* sends the HTTP GET request, gets the response and parses the
|
||||
* response.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramters
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_SOCKET_ERROR
|
||||
* UPNP_E_BAD_RESPONSE
|
||||
* Return : int;
|
||||
* UPNP_E_SUCCESS - On Success ;
|
||||
* UPNP_E_INVALID_PARAM - Invalid Paramters ;
|
||||
* UPNP_E_OUTOF_MEMORY ;
|
||||
* UPNP_E_SOCKET_ERROR ;
|
||||
* UPNP_E_BAD_RESPONSE ;
|
||||
*
|
||||
* Note :
|
||||
*
|
||||
************************************************************************/
|
||||
int http_OpenHttpGetEx(IN const char *url_str,
|
||||
IN OUT void **Handle,
|
||||
@@ -581,18 +559,18 @@ int http_OpenHttpGetEx(IN const char *url_str,
|
||||
IN int highRange,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function : get_sdk_info
|
||||
*
|
||||
* Parameters :
|
||||
* OUT char *info; buffer to store the operating system information
|
||||
* OUT char *info ;
|
||||
*
|
||||
* Description:
|
||||
* Returns the server information for the operating system
|
||||
* Description : Returns the server information for the operating
|
||||
* system
|
||||
*
|
||||
* Return:
|
||||
* UPNP_INLINE void
|
||||
* Return : void ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
void get_sdk_info( OUT char *info );
|
||||
|
||||
@@ -602,4 +580,3 @@ void get_sdk_info( OUT char *info );
|
||||
|
||||
|
||||
#endif // GENLIB_NET_HTTP_HTTPREADWRITE_H
|
||||
|
||||
|
@@ -1,67 +1,63 @@
|
||||
/************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************/
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 MINISERVER_H
|
||||
#define MINISERVER_H
|
||||
|
||||
|
||||
#include "sock.h"
|
||||
#include "httpparser.h"
|
||||
|
||||
|
||||
extern SOCKET gMiniServerStopSock;
|
||||
|
||||
|
||||
typedef struct MServerSockArray {
|
||||
/* socket for listening for miniserver requests */
|
||||
int miniServerSock;
|
||||
/* socket for stopping miniserver */
|
||||
int miniServerStopSock;
|
||||
/* socket for incoming advertisments and search requests */
|
||||
int ssdpSock;
|
||||
int miniServerSock; //socket for listening for miniserver
|
||||
//requests
|
||||
int miniServerStopSock; //socket for stopping miniserver
|
||||
int ssdpSock; //socket for incoming advertisments and search requests
|
||||
|
||||
int stopPort;
|
||||
int miniServerPort;
|
||||
|
||||
/* socket for sending search requests and receiving search replies */
|
||||
CLIENTONLY(int ssdpReqSock;)
|
||||
CLIENTONLY(int ssdpReqSock;) //socket for sending search
|
||||
//requests and receiving
|
||||
// search replies
|
||||
|
||||
} MiniServerSockArray;
|
||||
|
||||
//typedef void (*MiniServerCallback) ( const char* document, int sockfd );
|
||||
|
||||
typedef void (*MiniServerCallback)(
|
||||
IN http_parser_t *parser,
|
||||
typedef void (*MiniServerCallback) ( IN http_parser_t *parser,
|
||||
IN http_message_t* request,
|
||||
IN SOCKINFO *info );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -75,6 +71,8 @@ extern "C" {
|
||||
* Description : Set HTTP Get Callback
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
void SetHTTPGetCallback( MiniServerCallback callback );
|
||||
|
||||
@@ -87,12 +85,10 @@ void SetHTTPGetCallback( MiniServerCallback callback );
|
||||
* Description : Set SOAP Callback
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
void SetSoapCallback( MiniServerCallback callback );
|
||||
#else /* INCLUDE_DEVICE_APIS */
|
||||
static inline void SetSoapCallback( MiniServerCallback callback ) {}
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
|
||||
/************************************************************************
|
||||
* Function : SetGenaCallback
|
||||
@@ -100,9 +96,11 @@ static inline void SetSoapCallback( MiniServerCallback callback ) {}
|
||||
* Parameters :
|
||||
* MiniServerCallback callback ; - GENA Callback to be invoked
|
||||
*
|
||||
* D6escription: Set GENA Callback
|
||||
* Description : Set GENA Callback
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
void SetGenaCallback( MiniServerCallback callback );
|
||||
|
||||
@@ -124,6 +122,7 @@ void SetGenaCallback( MiniServerCallback callback );
|
||||
* Return : int ;
|
||||
* Actual port socket is bound to - On Success:
|
||||
* A negative number UPNP_E_XXX - On Error
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int StartMiniServer( unsigned short listen_port );
|
||||
|
||||
@@ -133,18 +132,19 @@ int StartMiniServer( unsigned short listen_port );
|
||||
* Parameters :
|
||||
* void ;
|
||||
*
|
||||
* Description: Stop and Shutdown the MiniServer and free socket resources.
|
||||
* Description : Stop and Shutdown the MiniServer and free socket
|
||||
* resources.
|
||||
*
|
||||
* Return : int ;
|
||||
* Always returns 0
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
int StopMiniServer();
|
||||
int StopMiniServer( void );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* MINISERVER_H */
|
||||
|
||||
|
@@ -47,7 +47,7 @@ extern "C" {
|
||||
|
||||
#define SID_SIZE 41
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
DEVICEONLY(
|
||||
|
||||
typedef struct SUBSCRIPTION {
|
||||
Upnp_SID sid;
|
||||
@@ -73,7 +73,6 @@ typedef struct SERVICE_INFO {
|
||||
struct SERVICE_INFO *next;
|
||||
} service_info;
|
||||
|
||||
|
||||
typedef struct SERVICE_TABLE {
|
||||
DOMString URLBase;
|
||||
service_info *serviceList;
|
||||
@@ -254,7 +253,7 @@ service_info * FindServiceControlURLPath( service_table *table,
|
||||
*
|
||||
* Parameters :
|
||||
* 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
|
||||
*
|
||||
* Description : For debugging purposes prints information from the
|
||||
@@ -264,24 +263,16 @@ service_info * FindServiceControlURLPath( service_table *table,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void printService(
|
||||
service_info *service,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module);
|
||||
#else
|
||||
static UPNP_INLINE void printService(
|
||||
service_info *service,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module) {}
|
||||
#endif
|
||||
DBGONLY(void printService(service_info *service,Dbg_Level
|
||||
level,
|
||||
Dbg_Module module));
|
||||
|
||||
/************************************************************************
|
||||
* Function : printServiceList
|
||||
*
|
||||
* Parameters :
|
||||
* 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
|
||||
*
|
||||
* Description : For debugging purposes prints information of each
|
||||
@@ -291,24 +282,15 @@ static UPNP_INLINE void printService(
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void printServiceList(
|
||||
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
|
||||
DBGONLY(void printServiceList(service_info *service,
|
||||
Dbg_Level level, Dbg_Module module));
|
||||
|
||||
/************************************************************************
|
||||
* Function : printServiceTable
|
||||
*
|
||||
* Parameters :
|
||||
* 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
|
||||
*
|
||||
* Description : For debugging purposes prints the URL base of the table
|
||||
@@ -319,17 +301,9 @@ static UPNP_INLINE void printServiceList(
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void printServiceTable(
|
||||
service_table *table,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module);
|
||||
#else
|
||||
static UPNP_INLINE void printServiceTable(
|
||||
service_table *table,
|
||||
Upnp_LogLevel level,
|
||||
Dbg_Module module) {}
|
||||
#endif
|
||||
DBGONLY(void printServiceTable(service_table *
|
||||
table,Dbg_Level
|
||||
level,Dbg_Module module));
|
||||
|
||||
/************************************************************************
|
||||
* Function : freeService
|
||||
@@ -477,11 +451,10 @@ int getSubElement(const char *element_name, IXML_Node *node,
|
||||
IXML_Node **out);
|
||||
|
||||
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
) /* DEVICEONLY */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SERVICE_TABLE */
|
||||
|
||||
|
@@ -211,15 +211,8 @@ int Make_Socket_NoBlocking (int sock);
|
||||
* Returns: void *
|
||||
* 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 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
|
||||
@@ -241,8 +234,7 @@ static inline void ssdp_handle_device_request(
|
||||
* Returns: void
|
||||
*
|
||||
***************************************************************************/
|
||||
void ssdp_handle_ctrlpt_msg(
|
||||
IN http_message_t* hmsg,
|
||||
void ssdp_handle_ctrlpt_msg( IN http_message_t* hmsg,
|
||||
IN struct sockaddr_in* dest_addr,
|
||||
IN xboolean timeout,
|
||||
IN void* cookie );
|
||||
@@ -334,10 +326,12 @@ int ssdp_request_type(IN char * cmd, OUT SsdpEvent * Evt);
|
||||
* Function : SearchByTarget
|
||||
*
|
||||
* Parameters:
|
||||
* IN int Mx:Number of seconds to wait, to collect all the responses.
|
||||
* 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.
|
||||
* cokie will be returned to application in the
|
||||
* callback.
|
||||
*
|
||||
* Description:
|
||||
* This function creates and send the search request for a specific URL.
|
||||
@@ -353,9 +347,10 @@ int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
||||
* Parameters:
|
||||
* IN char * DevType : type of the device
|
||||
* 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.
|
||||
* IN char * nt : value of NT
|
||||
* IN char * usn :
|
||||
* IN char * location :Location URL.
|
||||
* IN int duration :Service duration in sec.
|
||||
*
|
||||
* Description:
|
||||
* This function creates the device advertisement request based on
|
||||
@@ -364,12 +359,8 @@ int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int DeviceAdvertisement(
|
||||
IN char *DevType,
|
||||
IN int RootDev,
|
||||
IN char *Udn,
|
||||
IN char *Location,
|
||||
IN int Duration);
|
||||
int DeviceAdvertisement(IN char * DevType, int RootDev,char * Udn,
|
||||
IN char * Location, IN int Duration);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
@@ -390,8 +381,7 @@ int DeviceAdvertisement(
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int DeviceShutdown(
|
||||
IN char *DevType,
|
||||
int DeviceShutdown( IN char * DevType,
|
||||
IN int RootDev,
|
||||
IN char * Udn,
|
||||
IN char * _Server,
|
||||
@@ -408,7 +398,7 @@ int DeviceShutdown(
|
||||
* IN char * Udn: Device UDN
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Life time of this device.
|
||||
*
|
||||
|
||||
* Description:
|
||||
* This function creates the reply packet based on the input parameter,
|
||||
* and send it to the client address given in its input parameter DestAddr.
|
||||
@@ -416,8 +406,7 @@ int DeviceShutdown(
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int DeviceReply(
|
||||
IN struct sockaddr_in * DestAddr,
|
||||
int DeviceReply(IN struct sockaddr_in * DestAddr,
|
||||
IN char *DevType,
|
||||
IN int RootDev,
|
||||
IN char * Udn,
|
||||
@@ -443,8 +432,7 @@ int DeviceReply(
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int SendReply(
|
||||
IN struct sockaddr_in * DestAddr,
|
||||
int SendReply(IN struct sockaddr_in * DestAddr,
|
||||
IN char *DevType,
|
||||
IN int RootDev,
|
||||
IN char * Udn,
|
||||
@@ -460,16 +448,16 @@ int SendReply(
|
||||
* IN char *ServType: Service Type.
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Life time of this device.
|
||||
*
|
||||
|
||||
* Description:
|
||||
* This function creates the advertisement packet based
|
||||
* on the input parameter, and send it to the multicast channel.
|
||||
|
||||
*
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int ServiceAdvertisement(
|
||||
IN char *Udn,
|
||||
int ServiceAdvertisement( IN char * Udn,
|
||||
IN char * ServType,
|
||||
IN char * Location,
|
||||
IN int Duration);
|
||||
@@ -484,16 +472,16 @@ int ServiceAdvertisement(
|
||||
* IN char *Server: Not used
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Life time of this device.
|
||||
*
|
||||
|
||||
* Description:
|
||||
* This function creates the advertisement packet based
|
||||
* on the input parameter, and send it to the multicast channel.
|
||||
|
||||
*
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int ServiceReply(
|
||||
IN struct sockaddr_in *DestAddr,
|
||||
int ServiceReply(IN struct sockaddr_in *DestAddr,
|
||||
IN char * ServType,
|
||||
IN char * Udn,
|
||||
IN char * Location,
|
||||
@@ -507,7 +495,7 @@ int ServiceReply(
|
||||
* IN char *ServType: Service Type.
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Service duration in sec.
|
||||
*
|
||||
|
||||
* Description:
|
||||
* This function creates a HTTP service shutdown request packet
|
||||
* and sent it to the multicast channel through RequestHandler.
|
||||
@@ -515,9 +503,7 @@ int ServiceReply(
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int ServiceShutdown(
|
||||
IN char *Udn,
|
||||
IN char *ServType,
|
||||
int ServiceShutdown( IN char * Udn, IN char * ServType,
|
||||
IN char * Location,
|
||||
IN int Duration);
|
||||
|
||||
@@ -541,8 +527,7 @@ void *advertiseAndReplyThread(IN void * data);
|
||||
* Function : AdvertiseAndReply
|
||||
*
|
||||
* Parameters:
|
||||
* IN int AdFlag: -1 = Send shutdown,
|
||||
* 0 = send reply,
|
||||
* IN int AdFlag: -1 = Send shutdown, 0 = send reply,
|
||||
* 1 = Send Advertisement
|
||||
* IN UpnpDevice_Handle Hnd: Device handle
|
||||
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
||||
@@ -558,8 +543,7 @@ void *advertiseAndReplyThread(IN void * data);
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
***************************************************************************/
|
||||
int AdvertiseAndReply(
|
||||
IN int AdFlag,
|
||||
int AdvertiseAndReply(IN int AdFlag,
|
||||
IN UpnpDevice_Handle Hnd,
|
||||
IN enum SsdpSearchType SearchType,
|
||||
IN struct sockaddr_in *DestAddr,
|
||||
|
@@ -38,9 +38,10 @@
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#define XINLINE
|
||||
|
||||
typedef int socklen_t;
|
||||
#define EAFNOSUPPORT 97
|
||||
#endif
|
||||
|
||||
#endif // GENLIB_NET_UNIXUTIL_H
|
||||
|
||||
|
@@ -71,53 +71,33 @@ struct Handle_Info
|
||||
Upnp_FunPtr Callback; // Callback function pointer.
|
||||
char * Cookie;
|
||||
|
||||
// Device Only
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
char DescURL[LINE_SIZE]; // URL for the use of SSDP
|
||||
char DescXML[LINE_SIZE]; // XML file path for device
|
||||
DEVICEONLY(char DescURL[LINE_SIZE];) // URL for the use of SSDP
|
||||
DEVICEONLY(char DescXML[LINE_SIZE];) // XML file path for device
|
||||
//description
|
||||
|
||||
int MaxAge; // Advertisement timeout
|
||||
IXML_Document *DescDocument;// Description parsed in
|
||||
DEVICEONLY(int MaxAge;) // Advertisement timeout
|
||||
DEVICEONLY(IXML_Document *DescDocument;) // Description parsed in
|
||||
//terms of DOM document
|
||||
IXML_NodeList *DeviceList; // List of devices in the
|
||||
DEVICEONLY(IXML_NodeList *DeviceList;) // List of devices in the
|
||||
//description document
|
||||
IXML_NodeList *ServiceList; // List of services in the
|
||||
DEVICEONLY(IXML_NodeList *ServiceList;) // List of services in the
|
||||
// description document
|
||||
service_table ServiceTable; //table holding subscriptions and
|
||||
DEVICEONLY(service_table ServiceTable;) //table holding subscriptions and
|
||||
//URL information
|
||||
int MaxSubscriptions;
|
||||
int MaxSubscriptionTimeOut;
|
||||
#endif
|
||||
DEVICEONLY(int MaxSubscriptions;)
|
||||
DEVICEONLY(int MaxSubscriptionTimeOut;)
|
||||
|
||||
//Client only
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
client_subscription *ClientSubList; //client subscription list
|
||||
LinkedList SsdpSearchList; // active ssdp searches
|
||||
#endif
|
||||
CLIENTONLY(client_subscription * ClientSubList;) //client subscription list
|
||||
CLIENTONLY(LinkedList SsdpSearchList;) // active ssdp searches
|
||||
int aliasInstalled; // 0 = not installed; otherwise installed
|
||||
} ;
|
||||
|
||||
extern ithread_rwlock_t GlobalHndRWLock;
|
||||
extern ithread_mutex_t GlobalHndMutex;
|
||||
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo);
|
||||
|
||||
#define HandleLock() HandleWriteLock()
|
||||
|
||||
#define HandleWriteLock() \
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock"); \
|
||||
ithread_rwlock_wrlock(&GlobalHndRWLock); \
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired");
|
||||
|
||||
#define HandleReadLock() \
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock"); \
|
||||
ithread_rwlock_rdlock(&GlobalHndRWLock); \
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired");
|
||||
|
||||
#define HandleUnlock() \
|
||||
UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock"); \
|
||||
ithread_rwlock_unlock(&GlobalHndRWLock); \
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock");
|
||||
|
||||
#define HandleLock() DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"Trying Lock")); ithread_mutex_lock(&GlobalHndMutex); DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"LOCK"));
|
||||
#define HandleUnlock() DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"Trying Unlock")); ithread_mutex_unlock(&GlobalHndMutex); DBGONLY(UpnpPrintf(UPNP_INFO,API,__FILE__,__LINE__,"Unlock"));
|
||||
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out,
|
||||
struct Handle_Info **HndInfo);
|
||||
Upnp_Handle_Type GetDeviceHandleInfo(int *device_handle_out,
|
||||
@@ -131,7 +111,7 @@ extern unsigned short LOCAL_PORT;
|
||||
extern TimerThread gTimerThread;
|
||||
extern ThreadPool gRecvThreadPool;
|
||||
extern ThreadPool gSendThreadPool;
|
||||
extern ThreadPool gMiniServerThreadPool;
|
||||
|
||||
|
||||
typedef enum {
|
||||
SUBSCRIBE,
|
||||
@@ -183,6 +163,7 @@ void UpnpThreadDistribution(struct UpnpNonblockParam * Param);
|
||||
void AutoAdvertise(void *input);
|
||||
int getlocalhostname(char *out);
|
||||
|
||||
virtualDirList *pVirtualDirList;
|
||||
extern WebServerState bWebServerState;
|
||||
|
||||
#endif
|
||||
|
@@ -182,16 +182,13 @@ void free_URL_list(URL_list * list);
|
||||
* uri_type *in ; URI object
|
||||
*
|
||||
* Description : Function useful in debugging for printing a parsed uri.
|
||||
* Compiled out with DBGONLY macro.
|
||||
*
|
||||
* Return : void ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void print_uri(uri_type *in);
|
||||
#else
|
||||
static UPNP_INLINE void print_uri(uri_type *in) {}
|
||||
#endif
|
||||
DBGONLY(void print_uri( uri_type *in);)
|
||||
|
||||
/************************************************************************
|
||||
* Function : print_token
|
||||
@@ -200,16 +197,13 @@ static UPNP_INLINE void print_uri(uri_type *in) {}
|
||||
* token * in ;
|
||||
*
|
||||
* Description : Function useful in debugging for printing a token.
|
||||
* Compiled out with DBGONLY macro.
|
||||
*
|
||||
* Return : void ;
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void print_token( token * in);
|
||||
#else
|
||||
static UPNP_INLINE void print_token(token * in) {}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Function : token_string_casecmp
|
||||
|
@@ -47,6 +47,12 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NO_DEBUG
|
||||
#define DBG(x)
|
||||
#else
|
||||
#define DBG(x) x
|
||||
#endif
|
||||
|
||||
#define GEMD_OUT_OF_MEMORY -1
|
||||
#define EVENT_TIMEDOUT -2
|
||||
#define EVENT_TERMINATE -3
|
||||
@@ -136,10 +142,14 @@ void linecopylen( OUT char dest[LINE_SIZE], IN const char* src, IN size_t srclen
|
||||
#endif
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
// C specific
|
||||
#ifndef __cplusplus
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef WIN32
|
||||
#define XINLINE inline
|
||||
#else
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
@@ -160,4 +170,3 @@ void linecopylen( OUT char dest[LINE_SIZE], IN const char* src, IN size_t srclen
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif /* GENLIB_UTIL_UTIL_H */
|
||||
|
||||
|
@@ -126,18 +126,18 @@ int web_server_set_alias( IN const char* alias_name,
|
||||
int web_server_set_root_dir( IN const char* root_dir );
|
||||
|
||||
/************************************************************************
|
||||
* Function: web_server_callback
|
||||
*
|
||||
* Parameters:
|
||||
* IN http_parser_t *parser,
|
||||
* INOUT http_message_t* req,
|
||||
* IN SOCKINFO *info
|
||||
*
|
||||
* Description: main entry point into web server;
|
||||
* handles HTTP GET and HEAD requests
|
||||
*
|
||||
* Returns:
|
||||
* void
|
||||
* Function: web_server_callback *
|
||||
* *
|
||||
* Parameters: *
|
||||
* IN http_parser_t *parser, *
|
||||
* INOUT http_message_t* req, *
|
||||
* IN SOCKINFO *info *
|
||||
* *
|
||||
* Description: main entry point into web server; *
|
||||
* handles HTTP GET and HEAD requests *
|
||||
* *
|
||||
* Returns: *
|
||||
* void *
|
||||
************************************************************************/
|
||||
void web_server_callback( IN http_parser_t *parser, IN http_message_t* req, INOUT SOCKINFO *info );
|
||||
|
||||
@@ -148,4 +148,3 @@ void web_server_callback( IN http_parser_t *parser, IN http_message_t* req, INOU
|
||||
|
||||
|
||||
#endif // GENLIB_NET_HTTP_WEBSERVER_H
|
||||
|
||||
|
@@ -244,7 +244,7 @@ get_node_value( IN IXML_Node * node )
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
get_host_and_path( IN char *ctrl_url,
|
||||
OUT const memptr *host,
|
||||
OUT const memptr *path,
|
||||
@@ -277,7 +277,7 @@ get_host_and_path( IN char *ctrl_url,
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
get_action_name( IN char *action,
|
||||
OUT memptr * name )
|
||||
{
|
||||
@@ -303,7 +303,7 @@ get_action_name( IN char *action,
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
add_man_header( INOUT membuffer * headers )
|
||||
{
|
||||
char *soap_action_hdr;
|
||||
@@ -611,16 +611,17 @@ SoapSendAction( IN char *action_url,
|
||||
char *xml_end =
|
||||
"</s:Body>\r\n"
|
||||
"</s:Envelope>\r\n\r\n";
|
||||
size_t xml_start_len;
|
||||
size_t xml_end_len;
|
||||
size_t action_str_len;
|
||||
int xml_start_len;
|
||||
int xml_end_len;
|
||||
int action_str_len;
|
||||
|
||||
*response_node = NULL; // init
|
||||
|
||||
err_code = UPNP_E_OUTOF_MEMORY; // default error
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Inside SoapSendAction():" );
|
||||
)
|
||||
// init
|
||||
membuffer_init( &request );
|
||||
membuffer_init( &responsename );
|
||||
@@ -641,12 +642,11 @@ SoapSendAction( IN char *action_url,
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"path=%.*s, hostport=%.*s\n",
|
||||
(int)url.pathquery.size,
|
||||
url.pathquery.buff,
|
||||
(int)url.hostport.text.size,
|
||||
url.hostport.text.buff );
|
||||
url.pathquery.size, url.pathquery.buff,
|
||||
url.hostport.text.size,
|
||||
url.hostport.text.buff ); )
|
||||
|
||||
xml_start_len = strlen( xml_start );
|
||||
xml_end_len = strlen( xml_end );
|
||||
@@ -757,21 +757,22 @@ SoapSendActionEx( IN char *action_url,
|
||||
char *xml_end =
|
||||
"</s:Body>\r\n"
|
||||
"</s:Envelope>\r\n";
|
||||
size_t xml_start_len;
|
||||
size_t xml_header_start_len;
|
||||
size_t xml_header_str_len;
|
||||
size_t xml_header_end_len;
|
||||
size_t xml_body_start_len;
|
||||
size_t action_str_len;
|
||||
size_t xml_end_len;
|
||||
int xml_start_len;
|
||||
int xml_header_start_len;
|
||||
int xml_header_str_len;
|
||||
int xml_header_end_len;
|
||||
int xml_body_start_len;
|
||||
int action_str_len;
|
||||
int xml_end_len;
|
||||
off_t content_length;
|
||||
|
||||
*response_node = NULL; // init
|
||||
|
||||
err_code = UPNP_E_OUTOF_MEMORY; // default error
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Inside SoapSendActionEx():" );
|
||||
)
|
||||
// init
|
||||
membuffer_init( &request );
|
||||
membuffer_init( &responsename );
|
||||
@@ -797,12 +798,11 @@ SoapSendActionEx( IN char *action_url,
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"path=%.*s, hostport=%.*s\n",
|
||||
(int)url.pathquery.size,
|
||||
url.pathquery.buff,
|
||||
(int)url.hostport.text.size,
|
||||
url.hostport.text.buff );
|
||||
url.pathquery.size, url.pathquery.buff,
|
||||
url.hostport.text.size,
|
||||
url.hostport.text.buff ); )
|
||||
|
||||
xml_start_len = strlen( xml_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;
|
||||
if (http_MakeMessage(
|
||||
&request, 1, 1,
|
||||
"q" "N" "s" "sssbsc" "Uc" "b" "b" "b" "b" "b" "b" "b",
|
||||
"q" "N" "s" "sssbsc" "Uc" "bbbbbbb",
|
||||
SOAPMETHOD_POST, &url,
|
||||
content_length,
|
||||
ContentTypeHeader,
|
||||
|
@@ -85,7 +85,7 @@ const char *ContentTypeHeader =
|
||||
* 0 if successful else returns appropriate error.
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
get_request_type( IN http_message_t * request,
|
||||
OUT memptr * action_name )
|
||||
{
|
||||
@@ -262,7 +262,7 @@ send_error_response( IN SOCKINFO * info,
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
send_var_query_response( IN SOCKINFO * info,
|
||||
IN const char *var_value,
|
||||
IN http_message_t * hmsg )
|
||||
@@ -326,12 +326,12 @@ send_var_query_response( IN SOCKINFO * info,
|
||||
* Description : This function separates the action node from
|
||||
* the root DOM node.
|
||||
*
|
||||
* Return : static UPNP_INLINE int
|
||||
* Return : static XINLINE int
|
||||
* 0 if successful, or -1 if fails.
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
get_action_node( IN IXML_Document * TempDoc,
|
||||
IN char *NodeName,
|
||||
OUT IXML_Document ** RespNode )
|
||||
@@ -344,8 +344,9 @@ get_action_node( IN IXML_Document * TempDoc,
|
||||
int ret_code = -1; // error, by default
|
||||
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 );
|
||||
)
|
||||
|
||||
* RespNode = NULL;
|
||||
|
||||
@@ -681,7 +682,7 @@ get_device_info( IN http_message_t * request,
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
send_action_response( IN SOCKINFO * info,
|
||||
IN IXML_Document * action_resp,
|
||||
IN http_message_t * request )
|
||||
@@ -737,11 +738,11 @@ send_action_response( IN SOCKINFO * info,
|
||||
xml_response, strlen( xml_response ),
|
||||
end_body, strlen( end_body ) );
|
||||
|
||||
if( ret_code != 0 ) {
|
||||
DBGONLY( if( ret_code != 0 ) {
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Failed to send response: err code = %d\n",
|
||||
ret_code );
|
||||
}
|
||||
ret_code );}
|
||||
)
|
||||
|
||||
err_code = 0;
|
||||
|
||||
@@ -769,7 +770,7 @@ error_handler:
|
||||
* returns 0 if successful else returns -1.
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
get_var_name( IN IXML_Document * TempDoc,
|
||||
OUT char *VarName )
|
||||
{
|
||||
@@ -813,9 +814,10 @@ get_var_name( IN IXML_Document * TempDoc,
|
||||
Temp = ixmlNode_getNodeValue( VarNode );
|
||||
linecopy( VarName, Temp );
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Received query for variable name %s\n",
|
||||
VarName );
|
||||
)
|
||||
|
||||
ret_val = 0; // success
|
||||
|
||||
@@ -840,7 +842,7 @@ error_handler:
|
||||
*
|
||||
* Note :
|
||||
****************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
handle_query_variable( IN SOCKINFO * info,
|
||||
IN http_message_t * request,
|
||||
IN IXML_Document * xml_doc )
|
||||
@@ -876,8 +878,8 @@ handle_query_variable( IN SOCKINFO * info,
|
||||
// send event
|
||||
soap_event_callback( UPNP_CONTROL_GET_VAR_REQUEST, &variable, cookie );
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Return from callback for var request\n" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Return from callback for var request\n" ) );
|
||||
|
||||
// validate, and handle result
|
||||
if( variable.CurrentVal == NULL ) {
|
||||
@@ -966,8 +968,8 @@ handle_invoke_action( IN SOCKINFO * info,
|
||||
action.ErrCode = UPNP_E_SUCCESS;
|
||||
action.CtrlPtIPAddr = info->foreign_ip_addr;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Calling Callback\n" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Calling Callback\n" ) );
|
||||
|
||||
soap_event_callback( UPNP_CONTROL_ACTION_REQUEST, &action, cookie );
|
||||
|
||||
|
@@ -125,7 +125,7 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
||||
|
||||
// we are assuming that there can be only one client supported at a time
|
||||
|
||||
HandleReadLock();
|
||||
HandleLock( );
|
||||
|
||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||
HandleUnlock( );
|
||||
@@ -159,7 +159,7 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
||||
}
|
||||
|
||||
// dest addr
|
||||
memcpy(¶m.DestAddr, dest_addr, sizeof(struct sockaddr_in) );
|
||||
param.DestAddr = dest_addr;
|
||||
|
||||
// EXT
|
||||
param.Ext[0] = '\0';
|
||||
@@ -365,9 +365,7 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
||||
* Returns: void
|
||||
*
|
||||
***************************************************************************/
|
||||
#warning There are currently no uses of the function 'process_reply()' in the code.
|
||||
#warning 'process_reply()' is a candidate for removal.
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
process_reply( IN char *request_buf,
|
||||
IN int buf_len,
|
||||
IN struct sockaddr_in *dest_addr,
|
||||
@@ -538,7 +536,9 @@ SearchByTarget( IN int Mx,
|
||||
if( ReqBuf == NULL )
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
|
||||
UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__, ">>> SSDP SEND >>>\n");
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
">>> SSDP SEND >>>\n%s\n", ReqBuf );
|
||||
)
|
||||
|
||||
timeTillRead = Mx;
|
||||
|
||||
@@ -589,22 +589,25 @@ SearchByTarget( IN int Mx,
|
||||
|
||||
if( select( gSsdpReqSocket + 1, NULL, &wrSet, NULL, NULL )
|
||||
== UPNP_SOCKETERROR ) {
|
||||
if( errno == EBADF ) {
|
||||
DBGONLY( if( errno == EBADF ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"SSDP_LIB :RequestHandler:An invalid file descriptor"
|
||||
" was givenin one of the sets. \n" );
|
||||
} else if( errno == EINTR ) {
|
||||
" was givenin one of the sets. \n" );}
|
||||
else
|
||||
if( errno == EINTR ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"SSDP_LIB :RequestHandler: A non blocked "
|
||||
"signal was caught. \n" );
|
||||
} else if( errno == EINVAL ) {
|
||||
"signal was caught. \n" );}
|
||||
else
|
||||
if( errno == EINVAL ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"SSDP_LIB :RequestHandler: n is negative. \n" );
|
||||
} else if( errno == ENOMEM ) {
|
||||
"SSDP_LIB :RequestHandler: n is negative. \n" );}
|
||||
else
|
||||
if( errno == ENOMEM ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"SSDP_LIB : RequestHandler:select was unable to "
|
||||
"allocate memory for internal tables.\n" );
|
||||
}
|
||||
"allocate memory for internal tables.\n" );}
|
||||
)
|
||||
shutdown( gSsdpReqSocket, SD_BOTH );
|
||||
UpnpCloseSocket( gSsdpReqSocket );
|
||||
free( ReqBuf );
|
||||
|
@@ -95,7 +95,6 @@ advertiseAndReplyThread( IN void *data )
|
||||
* Returns: void *
|
||||
* 1 if successful else appropriate error
|
||||
***************************************************************************/
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
void
|
||||
ssdp_handle_device_request( IN http_message_t * hmsg,
|
||||
IN struct sockaddr_in *dest_addr )
|
||||
@@ -145,7 +144,7 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
|
||||
maxAge = dev_info->MaxAge;
|
||||
HandleUnlock( );
|
||||
|
||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||
"ssdp_handle_device_request with Cmd %d SEARCH\n",
|
||||
event.Cmd );
|
||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||
@@ -157,7 +156,7 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
|
||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||
"DeviceUuid = %s\n", event.UDN );
|
||||
UpnpPrintf( UPNP_PACKET, API, __FILE__, __LINE__,
|
||||
"ServiceType = %s\n", event.ServiceType );
|
||||
"ServiceType = %s\n", event.ServiceType ); )
|
||||
|
||||
threadArg =
|
||||
( SsdpSearchReply * ) malloc( sizeof( SsdpSearchReply ) );
|
||||
@@ -191,7 +190,6 @@ ssdp_handle_device_request( IN http_message_t * hmsg,
|
||||
TimerThreadSchedule( &gTimerThread, replyTime, REL_SEC, &job,
|
||||
SHORT_TERM, NULL );
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Function : NewRequestHandler
|
||||
@@ -222,9 +220,9 @@ NewRequestHandler( IN struct sockaddr_in *DestAddr,
|
||||
|
||||
ReplySock = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
if( ReplySock == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"SSDP_LIB: New Request Handler:"
|
||||
"Error in socket operation !!!\n" );
|
||||
"Error in socket operation !!!\n" ) );
|
||||
|
||||
return UPNP_E_OUTOF_SOCKET;
|
||||
}
|
||||
@@ -242,16 +240,17 @@ NewRequestHandler( IN struct sockaddr_in *DestAddr,
|
||||
// "If a multicast resource would send a response(s) to any copy of the
|
||||
// request, it SHOULD send its response(s) to each copy of the request
|
||||
// it receives. It MUST NOT repeat its response(s) per copy of the
|
||||
// request."
|
||||
// reuqest."
|
||||
//
|
||||
// http://www.upnp.org/download/draft-goland-http-udp-04.txt
|
||||
//
|
||||
// So, NUM_COPY has been changed from 2 to 1.
|
||||
NumCopy = 0;
|
||||
while( NumCopy < NUM_COPY ) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
">>> SSDP SEND >>>\n%s\n",
|
||||
*( RqPacket + Index ) );
|
||||
)
|
||||
rc = sendto( ReplySock, *( RqPacket + Index ),
|
||||
strlen( *( RqPacket + Index ) ),
|
||||
0, ( struct sockaddr * )DestAddr, socklen );
|
||||
@@ -389,8 +388,9 @@ DeviceAdvertisement( IN char *DevType,
|
||||
char *msgs[3];
|
||||
int ret_code;
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"In function SendDeviceAdvertisemenrt\n" );
|
||||
)
|
||||
|
||||
DestAddr.sin_family = AF_INET;
|
||||
DestAddr.sin_addr.s_addr = inet_addr( SSDP_IP );
|
||||
@@ -530,6 +530,7 @@ SendReply( IN struct sockaddr_in *DestAddr,
|
||||
* IN char * Udn: Device UDN
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Life time of this device.
|
||||
|
||||
* Description:
|
||||
* This function creates the reply packet based on the input parameter,
|
||||
* and send it to the client address given in its input parameter DestAddr.
|
||||
@@ -606,9 +607,11 @@ DeviceReply( IN struct sockaddr_in *DestAddr,
|
||||
* IN char *ServType: Service Type.
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Life time of this device.
|
||||
|
||||
* Description:
|
||||
* This function creates the advertisement packet based
|
||||
* on the input parameter, and send it to the multicast channel.
|
||||
|
||||
*
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
@@ -653,9 +656,11 @@ ServiceAdvertisement( IN char *Udn,
|
||||
* IN char *ServType: Service Type.
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Life time of this device.
|
||||
|
||||
* Description:
|
||||
* This function creates the advertisement packet based
|
||||
* on the input parameter, and send it to the multicast channel.
|
||||
|
||||
*
|
||||
* Returns: int
|
||||
* UPNP_E_SUCCESS if successful else appropriate error
|
||||
@@ -695,6 +700,7 @@ ServiceReply( IN struct sockaddr_in *DestAddr,
|
||||
* IN char *ServType: Service Type.
|
||||
* IN char * Location: Location of Device description document.
|
||||
* IN int Duration :Service duration in sec.
|
||||
|
||||
* Description:
|
||||
* This function creates a HTTP service shutdown request packet
|
||||
* and sent it to the multicast channel through RequestHandler.
|
||||
@@ -777,8 +783,8 @@ DeviceShutdown( IN char *DevType,
|
||||
Mil_Usn, Location, Duration, &msgs[0] );
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"In function DeviceShutdown\n" );
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"In function DeviceShutdown\n" ); )
|
||||
// both root and sub-devices need to send these two messages
|
||||
CreateServicePacket( MSGTYPE_SHUTDOWN, Udn, Udn,
|
||||
Location, Duration, &msgs[1] );
|
||||
@@ -815,4 +821,3 @@ DeviceShutdown( IN char *DevType,
|
||||
|
||||
#endif // EXCLUDE_SSDP
|
||||
#endif // INCLUDE_DEVICE_APIS
|
||||
|
||||
|
@@ -50,7 +50,8 @@
|
||||
|
||||
#define MAX_TIME_TOREAD 45
|
||||
|
||||
CLIENTONLY( SOCKET gSsdpReqSocket = 0; )
|
||||
CLIENTONLY( SOCKET gSsdpReqSocket = 0;
|
||||
)
|
||||
|
||||
void RequestHandler( );
|
||||
Event ErrotEvt;
|
||||
@@ -60,10 +61,11 @@ enum Listener { Idle, Stopping, Running };
|
||||
unsigned short ssdpStopPort;
|
||||
|
||||
struct SSDPSockArray {
|
||||
// socket for incoming advertisments and search requests
|
||||
int ssdpSock;
|
||||
// socket for sending search requests and receiving search replies
|
||||
CLIENTONLY( int ssdpReqSock; )
|
||||
int ssdpSock; //socket for incoming advertisments and search requests
|
||||
CLIENTONLY( int ssdpReqSock;
|
||||
) //socket for sending search
|
||||
//requests and receiving
|
||||
// search replies
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
@@ -73,9 +75,7 @@ struct SSDPSockArray {
|
||||
* Function : AdvertiseAndReply
|
||||
*
|
||||
* Parameters:
|
||||
* IN int AdFlag:
|
||||
* -1 = Send shutdown,
|
||||
* 0 = send reply,
|
||||
* IN int AdFlag: -1 = Send shutdown, 0 = send reply,
|
||||
* 1 = Send Advertisement
|
||||
* IN UpnpDevice_Handle Hnd: Device handle
|
||||
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
||||
@@ -115,19 +115,23 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
const DOMString tmpStr;
|
||||
char SERVER[200];
|
||||
|
||||
const DOMString dbgStr;
|
||||
DBGONLY( const DOMString dbgStr;
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside AdvertiseAndReply with AdFlag = %d\n",
|
||||
AdFlag );
|
||||
AdFlag ); )
|
||||
|
||||
// Use a read lock
|
||||
HandleReadLock();
|
||||
HandleLock( );
|
||||
if( GetHandleInfo( Hnd, &SInfo ) != HND_DEVICE ) {
|
||||
HandleUnlock( );
|
||||
return UPNP_E_INVALID_HANDLE;
|
||||
}
|
||||
defaultExp = SInfo->MaxAge;
|
||||
|
||||
//Modifed to prevent more than one thread from accessing the
|
||||
//UpnpDocument stored with the handle at the same time
|
||||
// HandleUnlock();
|
||||
nodeList = NULL;
|
||||
|
||||
//get server info
|
||||
|
||||
get_sdk_info( SERVER );
|
||||
@@ -135,33 +139,41 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
// parse the device list and send advertisements/replies
|
||||
for( i = 0;; i++ ) {
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Entering new device list with i = %d\n\n", i );
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Entering new device list with i = %d\n\n",
|
||||
i );
|
||||
)
|
||||
|
||||
tmpNode = ixmlNodeList_item( SInfo->DeviceList, i );
|
||||
if( tmpNode == NULL ) {
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Exiting new device list with i = %d\n\n", i );
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Exiting new device list with i = %d\n\n",
|
||||
i );
|
||||
)
|
||||
break;
|
||||
}
|
||||
|
||||
dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||
DBGONLY( dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Extracting device type once for %s\n", dbgStr );
|
||||
"Extracting device type once for %s\n",
|
||||
dbgStr ); )
|
||||
// extract device type
|
||||
ixmlNodeList_free( nodeList );
|
||||
nodeList = NULL;
|
||||
nodeList = ixmlElement_getElementsByTagName(
|
||||
( IXML_Element * ) tmpNode, "deviceType" );
|
||||
nodeList =
|
||||
ixmlElement_getElementsByTagName( ( IXML_Element * ) tmpNode,
|
||||
"deviceType" );
|
||||
if( nodeList == NULL ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Extracting UDN for %s\n", dbgStr );
|
||||
DBGONLY( dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Extracting UDN for %s\n", dbgStr ); )
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Extracting device type\n" );
|
||||
)
|
||||
|
||||
tmpNode2 = ixmlNodeList_item( nodeList, 0 );
|
||||
if( tmpNode2 == NULL ) {
|
||||
@@ -172,8 +184,9 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
continue;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Extracting device type \n" );
|
||||
)
|
||||
|
||||
tmpStr = ixmlNode_getNodeValue( textNode );
|
||||
if( tmpStr == NULL ) {
|
||||
@@ -185,41 +198,47 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
continue;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Extracting device type = %s\n", devType );
|
||||
if( tmpNode == NULL ) {
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"TempNode is NULL\n" );
|
||||
}
|
||||
"TempNode is NULL\n" );}
|
||||
dbgStr = ixmlNode_getNodeName( tmpNode );
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Extracting UDN for %s\n", dbgStr );
|
||||
"Extracting UDN for %s\n", dbgStr ); )
|
||||
// extract UDN
|
||||
ixmlNodeList_free( nodeList );
|
||||
nodeList = NULL;
|
||||
nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * )
|
||||
tmpNode, "UDN" );
|
||||
if( nodeList == NULL ) {
|
||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||
__LINE__, "UDN not found!!!\n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
tmpNode2 = ixmlNodeList_item( nodeList, 0 );
|
||||
if( tmpNode2 == NULL ) {
|
||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||
__LINE__, "UDN not found!!!\n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
textNode = ixmlNode_getFirstChild( tmpNode2 );
|
||||
if( textNode == NULL ) {
|
||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__,
|
||||
__LINE__, "UDN not found!!!\n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
tmpStr = ixmlNode_getNodeValue( textNode );
|
||||
if( tmpStr == NULL ) {
|
||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||
"UDN not found!!!!\n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
strcpy( UDNstr, tmpStr );
|
||||
@@ -227,14 +246,16 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
continue;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Sending UDNStr = %s \n", UDNstr );
|
||||
)
|
||||
if( AdFlag ) {
|
||||
// send the device advertisement
|
||||
if( AdFlag == 1 ) {
|
||||
DeviceAdvertisement( devType, i == 0,
|
||||
UDNstr, SInfo->DescURL, Exp );
|
||||
} else { // AdFlag == -1
|
||||
} else // AdFlag == -1
|
||||
{
|
||||
DeviceShutdown( devType, i == 0, UDNstr,
|
||||
SERVER, SInfo->DescURL, Exp );
|
||||
}
|
||||
@@ -257,16 +278,22 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
{
|
||||
if( DeviceUDN != NULL && strlen( DeviceUDN ) != 0 ) {
|
||||
if( strcasecmp( DeviceUDN, UDNstr ) ) {
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, API, __FILE__,
|
||||
__LINE__,
|
||||
"DeviceUDN=%s and search "
|
||||
"UDN=%s did not match\n",
|
||||
UDNstr, DeviceUDN );
|
||||
)
|
||||
break;
|
||||
} else {
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, API, __FILE__,
|
||||
__LINE__,
|
||||
"DeviceUDN=%s and search "
|
||||
"UDN=%s MATCH\n", UDNstr,
|
||||
DeviceUDN );
|
||||
)
|
||||
SendReply( DestAddr, devType, 0,
|
||||
UDNstr, SInfo->DescURL,
|
||||
defaultExp, 0 );
|
||||
@@ -279,17 +306,24 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
if( !strncasecmp
|
||||
( DeviceType, devType,
|
||||
strlen( DeviceType ) ) ) {
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"DeviceType=%s and search devType=%s MATCH\n",
|
||||
devType, DeviceType );
|
||||
)
|
||||
SendReply( DestAddr, devType, 0, UDNstr,
|
||||
SInfo->DescURL, defaultExp, 1 );
|
||||
} else {
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
}
|
||||
|
||||
DBGONLY(
|
||||
else
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__,
|
||||
__LINE__,
|
||||
"DeviceType=%s and search devType=%s"
|
||||
" DID NOT MATCH\n",
|
||||
devType, DeviceType );
|
||||
}
|
||||
)
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -298,8 +332,9 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
}
|
||||
// send service advertisements for services corresponding
|
||||
// to the same device
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Sending service Advertisement\n" );
|
||||
)
|
||||
|
||||
tmpNode = ixmlNodeList_item( SInfo->ServiceList, i );
|
||||
if( tmpNode == NULL ) {
|
||||
@@ -310,23 +345,27 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
nodeList = ixmlElement_getElementsByTagName( ( IXML_Element * )
|
||||
tmpNode, "service" );
|
||||
if( nodeList == NULL ) {
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"Service not found 3\n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
for( j = 0;; j++ ) {
|
||||
tmpNode = ixmlNodeList_item( nodeList, j );
|
||||
if( tmpNode == NULL ) {
|
||||
if( tmpNode == NULL )
|
||||
break;
|
||||
}
|
||||
|
||||
ixmlNodeList_free( tmpNodeList );
|
||||
tmpNodeList = NULL;
|
||||
tmpNodeList = ixmlElement_getElementsByTagName(
|
||||
( IXML_Element *)tmpNode, "serviceType" );
|
||||
tmpNodeList = ixmlElement_getElementsByTagName( ( IXML_Element
|
||||
* ) tmpNode,
|
||||
"serviceType" );
|
||||
|
||||
if( tmpNodeList == NULL ) {
|
||||
UpnpPrintf( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_CRITICAL, API, __FILE__, __LINE__,
|
||||
"ServiceType not found \n" );
|
||||
)
|
||||
continue;
|
||||
}
|
||||
tmpNode2 = ixmlNodeList_item( tmpNodeList, 0 );
|
||||
@@ -347,34 +386,42 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
continue;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"ServiceType = %s\n", servType );
|
||||
)
|
||||
if( AdFlag ) {
|
||||
if( AdFlag == 1 ) {
|
||||
ServiceAdvertisement( UDNstr, servType,
|
||||
SInfo->DescURL, Exp );
|
||||
} else { // AdFlag == -1
|
||||
} else // AdFlag == -1
|
||||
{
|
||||
ServiceShutdown( UDNstr, servType,
|
||||
SInfo->DescURL, Exp );
|
||||
}
|
||||
|
||||
} else {
|
||||
switch ( SearchType ) {
|
||||
case SSDP_ALL:
|
||||
{
|
||||
ServiceReply( DestAddr, servType,
|
||||
UDNstr, SInfo->DescURL,
|
||||
defaultExp );
|
||||
break;
|
||||
}
|
||||
case SSDP_SERVICE:
|
||||
{
|
||||
if( ServiceType != NULL ) {
|
||||
if( !strncasecmp( ServiceType,
|
||||
servType,
|
||||
strlen( ServiceType ) ) ) {
|
||||
strlen( ServiceType ) ) )
|
||||
{
|
||||
ServiceReply( DestAddr, servType,
|
||||
UDNstr, SInfo->DescURL,
|
||||
defaultExp );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
} // switch(SearchType)
|
||||
@@ -386,8 +433,9 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
ixmlNodeList_free( nodeList );
|
||||
nodeList = NULL;
|
||||
}
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Exiting AdvertiseAndReply : \n" );
|
||||
)
|
||||
|
||||
HandleUnlock( );
|
||||
|
||||
@@ -395,8 +443,8 @@ int AdvertiseAndReply( IN int AdFlag,
|
||||
|
||||
} /****************** End of AdvertiseAndReply *********************/
|
||||
|
||||
#endif /* EXCLUDE_SSDP == 0 */
|
||||
#endif /* INCLUDE_DEVICE_APIS */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* Function : Make_Socket_NoBlocking
|
||||
@@ -629,7 +677,7 @@ free_ssdp_event_handler_data( void *the_data )
|
||||
* Returns: xboolean
|
||||
* returns TRUE if msg is valid else FALSE
|
||||
***************************************************************************/
|
||||
static UPNP_INLINE xboolean
|
||||
static XINLINE xboolean
|
||||
valid_ssdp_msg( IN http_message_t * hmsg )
|
||||
{
|
||||
memptr hdr_value;
|
||||
@@ -671,7 +719,7 @@ valid_ssdp_msg( IN http_message_t * hmsg )
|
||||
* Returns: int
|
||||
* 0 if successful -1 if error
|
||||
***************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
start_event_handler( void *Data )
|
||||
{
|
||||
|
||||
@@ -685,16 +733,18 @@ start_event_handler( void *Data )
|
||||
if( status == PARSE_FAILURE ) {
|
||||
if( parser->msg.method != HTTPMETHOD_NOTIFY ||
|
||||
!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",
|
||||
status );
|
||||
)
|
||||
// ignore bad msg, or not enuf mem
|
||||
goto error_handler;
|
||||
}
|
||||
// valid notify msg
|
||||
} 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 );
|
||||
)
|
||||
|
||||
goto error_handler;
|
||||
}
|
||||
@@ -734,9 +784,14 @@ ssdp_event_handler_thread( void *the_data )
|
||||
// send msg to device or ctrlpt
|
||||
if( ( hmsg->method == HTTPMETHOD_NOTIFY ) ||
|
||||
( hmsg->request_method == HTTPMETHOD_MSEARCH ) ) {
|
||||
CLIENTONLY( ssdp_handle_ctrlpt_msg( hmsg, &data->dest_addr, FALSE, NULL );)
|
||||
|
||||
CLIENTONLY( ssdp_handle_ctrlpt_msg( hmsg, &data->dest_addr,
|
||||
FALSE, NULL );
|
||||
);
|
||||
} else {
|
||||
ssdp_handle_device_request( hmsg, &data->dest_addr );
|
||||
|
||||
DEVICEONLY( ssdp_handle_device_request( hmsg, &data->dest_addr );
|
||||
);
|
||||
}
|
||||
|
||||
// free data
|
||||
@@ -806,20 +861,21 @@ readFromSSDPSocket( SOCKET socket )
|
||||
( struct sockaddr * )&clientAddr, &socklen );
|
||||
|
||||
if( byteReceived > 0 ) {
|
||||
|
||||
requestBuf[byteReceived] = '\0';
|
||||
UpnpPrintf( UPNP_INFO, SSDP,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, SSDP,
|
||||
__FILE__, __LINE__,
|
||||
"Start of received response ----------------------------------------------------\n"
|
||||
"%s\n"
|
||||
"End of received response ------------------------------------------------------\n"
|
||||
"From host %s\n",
|
||||
"Received response !!! "
|
||||
"%s From host %s \n",
|
||||
requestBuf,
|
||||
inet_ntoa( clientAddr.sin_addr ) );
|
||||
UpnpPrintf( UPNP_PACKET, SSDP, __FILE__, __LINE__,
|
||||
"Start of received multicast packet --------------------------------------------\n"
|
||||
"%s\n"
|
||||
"End of received multicast packet ----------------------------------------------\n",
|
||||
requestBuf );
|
||||
)
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_PACKET, SSDP,
|
||||
__FILE__, __LINE__,
|
||||
"Received multicast packet:"
|
||||
"\n %s\n", requestBuf );
|
||||
)
|
||||
//add thread pool job to handle request
|
||||
if( data != NULL ) {
|
||||
data->parser.msg.msg.length += byteReceived;
|
||||
@@ -835,6 +891,7 @@ readFromSSDPSocket( SOCKET socket )
|
||||
free_ssdp_event_handler_data( data );
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
free_ssdp_event_handler_data( data );
|
||||
}
|
||||
@@ -856,83 +913,87 @@ readFromSSDPSocket( SOCKET socket )
|
||||
int
|
||||
get_ssdp_sockets( MiniServerSockArray * out )
|
||||
{
|
||||
SOCKET ssdpSock;
|
||||
|
||||
CLIENTONLY( SOCKET ssdpReqSock;
|
||||
)
|
||||
int onOff = 1;
|
||||
u_char ttl = 4;
|
||||
struct ip_mreq ssdpMcastAddr;
|
||||
struct sockaddr_in ssdpAddr;
|
||||
int option = 1;
|
||||
struct in_addr addr;
|
||||
SOCKET ssdpSock;
|
||||
#if INCLUDE_CLIENT_APIS
|
||||
SOCKET ssdpReqSock;
|
||||
|
||||
if( ( ssdpReqSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
CLIENTONLY( if( ( ssdpReqSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
||||
== UPNP_INVALID_SOCKET ) {
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in socket operation !!!\n" );
|
||||
|
||||
return UPNP_E_OUTOF_SOCKET;
|
||||
}
|
||||
setsockopt( ssdpReqSock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
||||
"Error in socket operation !!!\n" ); )
|
||||
return UPNP_E_OUTOF_SOCKET;}
|
||||
setsockopt( ssdpReqSock,
|
||||
IPPROTO_IP,
|
||||
IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
||||
// just do it, regardless if fails or not.
|
||||
Make_Socket_NoBlocking( ssdpReqSock );
|
||||
gSsdpReqSocket = ssdpReqSock;
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
Make_Socket_NoBlocking( ssdpReqSock ); gSsdpReqSocket = ssdpReqSock; ) //CLIENTONLY
|
||||
|
||||
if( ( ssdpSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
if( ( ssdpSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
||||
== UPNP_INVALID_SOCKET ) {
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in socket operation !!!\n" );
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); )
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); )
|
||||
|
||||
)
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
return UPNP_E_OUTOF_SOCKET;
|
||||
}
|
||||
|
||||
onOff = 1;
|
||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEADDR,
|
||||
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in set reuse addr !!!\n" );
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); )
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); )
|
||||
)
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
shutdown( ssdpSock, SD_BOTH );
|
||||
UpnpCloseSocket( ssdpSock );
|
||||
|
||||
return UPNP_E_SOCKET_ERROR;
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OSX__) || defined(__APPLE__)
|
||||
#ifdef __FreeBSD__
|
||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEPORT,
|
||||
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in set reuse port !!!\n" );
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); )
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); )
|
||||
)
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
shutdown( ssdpSock, SD_BOTH );
|
||||
UpnpCloseSocket( ssdpSock );
|
||||
|
||||
return UPNP_E_SOCKET_ERROR;
|
||||
}
|
||||
#endif /* __FreeBSD__ */
|
||||
#endif
|
||||
|
||||
memset( ( void * )&ssdpAddr, 0, sizeof( struct sockaddr_in ) );
|
||||
ssdpAddr.sin_family = AF_INET;
|
||||
// ssdpAddr.sin_addr.s_addr = inet_addr(LOCAL_HOST);
|
||||
ssdpAddr.sin_addr.s_addr = htonl( INADDR_ANY );
|
||||
ssdpAddr.sin_port = htons( SSDP_PORT );
|
||||
if( bind( ssdpSock, ( struct sockaddr * )&ssdpAddr,
|
||||
if( bind
|
||||
( ssdpSock, ( struct sockaddr * )&ssdpAddr,
|
||||
sizeof( ssdpAddr ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||
"Error in binding !!!\n" );
|
||||
)
|
||||
shutdown( ssdpSock, SD_BOTH );
|
||||
UpnpCloseSocket( ssdpSock );
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); )
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); )
|
||||
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
return UPNP_E_SOCKET_BIND;
|
||||
}
|
||||
|
||||
@@ -940,15 +1001,16 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
ssdpMcastAddr.imr_interface.s_addr = inet_addr( LOCAL_HOST );
|
||||
ssdpMcastAddr.imr_multiaddr.s_addr = inet_addr( SSDP_IP );
|
||||
if( setsockopt( ssdpSock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
( char * )&ssdpMcastAddr, sizeof( struct ip_mreq ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
( char * )&ssdpMcastAddr,
|
||||
sizeof( struct ip_mreq ) ) != 0 ) {
|
||||
DBGONLY( UpnpPrintf
|
||||
( UPNP_CRITICAL, SSDP, __FILE__, __LINE__,
|
||||
"Error in joining" " multicast group !!!\n" );
|
||||
)
|
||||
shutdown( ssdpSock, SD_BOTH );
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); )
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
UpnpCloseSocket( ssdpSock );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); )
|
||||
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
return UPNP_E_SOCKET_ERROR;
|
||||
}
|
||||
|
||||
@@ -957,32 +1019,31 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
addr.s_addr = inet_addr(LOCAL_HOST);
|
||||
if (setsockopt(ssdpSock, IPPROTO_IP, IP_MULTICAST_IF,
|
||||
(char *)&addr, sizeof addr) != 0) {
|
||||
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"Couldn't set multicast interface.\n" );
|
||||
DBGONLY(UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
|
||||
"Couldn't set multicast interface.\n" ));
|
||||
/* This is probably not a critical error, so let's continue. */
|
||||
}
|
||||
|
||||
/* result is not checked becuase it will fail in WinMe and Win9x. */
|
||||
// result is not checked becuase it will fail in WinMe and Win9x.
|
||||
setsockopt( ssdpSock, IPPROTO_IP,
|
||||
IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_BROADCAST,
|
||||
( char * )&option, sizeof( option ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in setting broadcast !!!\n" );
|
||||
)
|
||||
shutdown( ssdpSock, SD_BOTH );
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ); )
|
||||
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
|
||||
UpnpCloseSocket( ssdpSock );
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ); )
|
||||
|
||||
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
|
||||
return UPNP_E_NETWORK_ERROR;
|
||||
}
|
||||
|
||||
CLIENTONLY( out->ssdpReqSock = ssdpReqSock; )
|
||||
CLIENTONLY( out->ssdpReqSock = ssdpReqSock;
|
||||
);
|
||||
out->ssdpSock = ssdpSock;
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* EXCLUDE_SSDP */
|
||||
|
||||
#endif // EXCLUDE_SSDP
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "config.h"
|
||||
#include <assert.h>
|
||||
#ifndef WIN32
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
@@ -63,7 +62,7 @@
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE void
|
||||
static XINLINE void
|
||||
addrToString( IN const struct sockaddr_in *addr,
|
||||
OUT char ipaddr_port[] )
|
||||
{
|
||||
@@ -88,7 +87,7 @@ addrToString( IN const struct sockaddr_in *addr,
|
||||
*
|
||||
* Note : 'newAlias' should be freed using free()
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
calc_alias( IN const char *alias,
|
||||
IN const char *rootPath,
|
||||
OUT char **newAlias )
|
||||
@@ -149,7 +148,7 @@ calc_alias( IN const char *alias,
|
||||
*
|
||||
* Note :
|
||||
************************************************************************/
|
||||
static UPNP_INLINE int
|
||||
static XINLINE int
|
||||
calc_descURL( IN const char *ipPortStr,
|
||||
IN const char *alias,
|
||||
OUT char descURL[LINE_SIZE] )
|
||||
@@ -169,8 +168,9 @@ calc_descURL( IN const char *ipPortStr,
|
||||
strcat( descURL, ipPortStr );
|
||||
strcat( descURL, alias );
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"desc url: %s\n", descURL );
|
||||
)
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
@@ -408,10 +408,12 @@ configure_urlbase( INOUT IXML_Document * doc,
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"desc url: %s\n", docURL );
|
||||
UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
)
|
||||
DBGONLY( UpnpPrintf( UPNP_INFO, API, __FILE__, __LINE__,
|
||||
"doc = %s\n", xml_str );
|
||||
)
|
||||
// store in web server
|
||||
err_code =
|
||||
web_server_set_alias( new_alias, xml_str, strlen( xml_str ),
|
||||
|
@@ -50,11 +50,22 @@
|
||||
#define S43 15
|
||||
#define S44 21
|
||||
|
||||
static void MD5Transform PROTO_LIST((UINT4[4], unsigned char[64]));
|
||||
static void Encode PROTO_LIST((unsigned char *, UINT4 *, unsigned int));
|
||||
static void Decode PROTO_LIST((UINT4 *, unsigned char *, unsigned int));
|
||||
static void MD5_memcpy PROTO_LIST((POINTER, POINTER, unsigned int));
|
||||
static void MD5_memset PROTO_LIST((POINTER, int, unsigned int));
|
||||
static void MD5Transform PROTO_LIST( ( UINT4[4],
|
||||
unsigned char[64] ) );
|
||||
static void Encode PROTO_LIST( ( unsigned char *,
|
||||
UINT4 *,
|
||||
unsigned int ) );
|
||||
|
||||
static void Decode PROTO_LIST( ( UINT4 *,
|
||||
unsigned char *,
|
||||
unsigned int ) );
|
||||
|
||||
static void MD5_memcpy PROTO_LIST( ( POINTER,
|
||||
POINTER,
|
||||
unsigned int ) );
|
||||
static void MD5_memset PROTO_LIST( ( POINTER,
|
||||
int,
|
||||
unsigned int ) );
|
||||
|
||||
static unsigned char PADDING[64] = {
|
||||
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
@@ -107,10 +118,14 @@ static unsigned char PADDING[64] = {
|
||||
MD5 initialization. Begins an MD5 operation, writing a new context.
|
||||
*/
|
||||
void
|
||||
MD5Init(MD5_CTX * context)
|
||||
MD5Init( context )
|
||||
MD5_CTX *context; /* context */
|
||||
{
|
||||
context->count[0] = context->count[1] = 0;
|
||||
/* Load magic initialization constants. */
|
||||
|
||||
/*
|
||||
Load magic initialization constants.
|
||||
*/
|
||||
context->state[0] = 0x67452301;
|
||||
context->state[1] = 0xefcdab89;
|
||||
context->state[2] = 0x98badcfe;
|
||||
@@ -124,72 +139,114 @@ MD5Init(MD5_CTX * context)
|
||||
*/
|
||||
|
||||
void
|
||||
MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
|
||||
MD5Update( context,
|
||||
input,
|
||||
inputLen )
|
||||
MD5_CTX *context; /* context */
|
||||
unsigned char *input; /* input block */
|
||||
unsigned int inputLen; /* length of input block */
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int index;
|
||||
unsigned int partLen;
|
||||
unsigned int i,
|
||||
index,
|
||||
partLen;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
/*
|
||||
Compute number of bytes mod 64
|
||||
*/
|
||||
index = ( unsigned int )( ( context->count[0] >> 3 ) & 0x3F );
|
||||
|
||||
/* Update number of bits */
|
||||
if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) {
|
||||
/*
|
||||
Update number of bits
|
||||
*/
|
||||
if( ( context->count[0] +=
|
||||
( ( UINT4 ) inputLen << 3 ) ) < ( ( UINT4 ) inputLen << 3 ) )
|
||||
context->count[1]++;
|
||||
}
|
||||
|
||||
context->count[1] += ( ( UINT4 ) inputLen >> 29 );
|
||||
|
||||
partLen = 64 - index;
|
||||
|
||||
/* Transform as many times as possible. */
|
||||
/*
|
||||
Transform as many times as possible.
|
||||
*/
|
||||
if( inputLen >= partLen ) {
|
||||
MD5_memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
|
||||
MD5Transform(context->state, context->buffer);
|
||||
for (i = partLen; i + 63 < inputLen; i += 64) {
|
||||
MD5Transform(context->state, &input[i]);
|
||||
}
|
||||
index = 0;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
/* Buffer remaining input */
|
||||
MD5_memcpy((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen - i);
|
||||
MD5_memcpy
|
||||
( ( POINTER ) & context->buffer[index], ( POINTER ) input,
|
||||
partLen );
|
||||
MD5Transform( context->state, context->buffer );
|
||||
|
||||
for( i = partLen; i + 63 < inputLen; i += 64 )
|
||||
MD5Transform( context->state, &input[i] );
|
||||
|
||||
index = 0;
|
||||
} else
|
||||
i = 0;
|
||||
|
||||
/*
|
||||
Buffer remaining input
|
||||
*/
|
||||
MD5_memcpy
|
||||
( ( POINTER ) & context->buffer[index], ( POINTER ) & input[i],
|
||||
inputLen - i );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
MD5 finalization. Ends an MD5 message-digest operation, writing the
|
||||
the message digest and zeroizing the context.
|
||||
*/
|
||||
void
|
||||
MD5Final(unsigned char digest[16], MD5_CTX *context)
|
||||
{
|
||||
unsigned char bits[8];
|
||||
unsigned int index;
|
||||
unsigned int padLen;
|
||||
|
||||
/* Save number of bits */
|
||||
void
|
||||
MD5Final( digest,
|
||||
context )
|
||||
unsigned char digest[16]; /* message digest */
|
||||
MD5_CTX *context; /* context */
|
||||
{
|
||||
|
||||
unsigned char bits[8];
|
||||
unsigned int index,
|
||||
padLen;
|
||||
|
||||
/*
|
||||
Save number of bits
|
||||
*/
|
||||
Encode( bits, context->count, 8 );
|
||||
|
||||
/* Pad out to 56 mod 64. */
|
||||
/*
|
||||
Pad out to 56 mod 64.
|
||||
*/
|
||||
index = ( unsigned int )( ( context->count[0] >> 3 ) & 0x3f );
|
||||
|
||||
padLen = ( index < 56 ) ? ( 56 - index ) : ( 120 - index );
|
||||
|
||||
MD5Update( context, PADDING, padLen );
|
||||
|
||||
/* Append length (before padding) */
|
||||
/*
|
||||
Append length (before padding)
|
||||
*/
|
||||
MD5Update( context, bits, 8 );
|
||||
|
||||
/* Store state in digest */
|
||||
/*
|
||||
Store state in digest
|
||||
*/
|
||||
Encode( digest, context->state, 16 );
|
||||
|
||||
/* Zeroize sensitive information. */
|
||||
/*
|
||||
Zeroize sensitive information.
|
||||
*/
|
||||
MD5_memset( ( POINTER ) context, 0, sizeof( *context ) );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
MD5 basic transformation. Transforms state based on block.
|
||||
*/
|
||||
static void
|
||||
MD5Transform(UINT4 state[4], unsigned char block[64])
|
||||
MD5Transform( state,
|
||||
block )
|
||||
UINT4 state[4];
|
||||
unsigned char block[64];
|
||||
{
|
||||
UINT4 a = state[0],
|
||||
b = state[1],
|
||||
@@ -296,16 +353,23 @@ MD5Transform(UINT4 state[4], unsigned char block[64])
|
||||
a multiple of 4.
|
||||
*/
|
||||
static void
|
||||
Encode(unsigned char *output, UINT4 *input, unsigned int len)
|
||||
Encode( output,
|
||||
input,
|
||||
len )
|
||||
unsigned char *output;
|
||||
UINT4 *input;
|
||||
unsigned int len;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
for (i = 0, j = 0; j < len; ++i, j += 4) {
|
||||
output[j+0] = (unsigned char)((input[i] >> 0) & 0xff);
|
||||
unsigned int i,
|
||||
j;
|
||||
|
||||
for( i = 0, j = 0; j < len; i++, j += 4 ) {
|
||||
output[j] = ( unsigned char )( input[i] & 0xff );
|
||||
output[j + 1] = ( unsigned char )( ( input[i] >> 8 ) & 0xff );
|
||||
output[j + 2] = ( unsigned char )( ( input[i] >> 16 ) & 0xff );
|
||||
output[j + 3] = ( unsigned char )( ( input[i] >> 24 ) & 0xff );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -314,40 +378,55 @@ Encode(unsigned char *output, UINT4 *input, unsigned int len)
|
||||
*/
|
||||
|
||||
static void
|
||||
Decode(UINT4 *output, unsigned char *input, unsigned int len)
|
||||
Decode( output,
|
||||
input,
|
||||
len )
|
||||
UINT4 *output;
|
||||
unsigned char *input;
|
||||
unsigned int len;
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
for (i = 0, j = 0; j < len; ++i, j += 4) {
|
||||
unsigned int i,
|
||||
j;
|
||||
|
||||
for( i = 0, j = 0; j < len; i++, j += 4 )
|
||||
output[i] =
|
||||
(((UINT4)input[j+0]) << 0) |
|
||||
(((UINT4)input[j+1]) << 8) |
|
||||
( ( UINT4 ) input[j] ) | ( ( ( UINT4 ) input[j + 1] ) << 8 ) |
|
||||
( ( ( UINT4 ) input[j + 2] ) << 16 ) |
|
||||
( ( ( UINT4 ) input[j + 3] ) << 24 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Note: Replace for loop with standard memcpy if possible.
|
||||
Note: Replace "for loop" with standard memcpy if possible.
|
||||
*/
|
||||
static void
|
||||
MD5_memcpy(POINTER output, POINTER input, unsigned int len)
|
||||
MD5_memcpy( output,
|
||||
input,
|
||||
len )
|
||||
POINTER output;
|
||||
POINTER input;
|
||||
unsigned int len;
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
|
||||
for( i = 0; i < len; i++ )
|
||||
output[i] = input[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Note: Replace for loop with standard memset if possible.
|
||||
Note: Replace "for loop" with standard memset if possible.
|
||||
*/
|
||||
static void
|
||||
MD5_memset(POINTER output, int value, unsigned int len)
|
||||
MD5_memset( output,
|
||||
value,
|
||||
len )
|
||||
POINTER output;
|
||||
int value;
|
||||
unsigned int len;
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
((char *)output)[i] = (char)value;
|
||||
}
|
||||
}
|
||||
|
||||
for( i = 0; i < len; i++ )
|
||||
( ( char * )output )[i] = ( char )value;
|
||||
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ get_ieee_node_identifier(uuid_node_t *node)
|
||||
get_random_info( seed );
|
||||
seed[0] |= 0x80;
|
||||
memcpy( &saved_node, seed, sizeof( uuid_node_t ) );
|
||||
|
||||
inited = 1;
|
||||
};
|
||||
|
||||
@@ -96,30 +97,34 @@ get_random_info(char seed[16])
|
||||
} randomness;
|
||||
randomness r;
|
||||
|
||||
/* Initialize memory area so that valgrind does not complain */
|
||||
memset(&r, 0, sizeof r);
|
||||
|
||||
/* memory usage stats */
|
||||
MD5Init( &c );
|
||||
/*
|
||||
memory usage stats
|
||||
*/
|
||||
GlobalMemoryStatus( &r.m );
|
||||
/* random system stats */
|
||||
/*
|
||||
random system stats
|
||||
*/
|
||||
GetSystemInfo( &r.s );
|
||||
/* 100ns resolution (nominally) time of day */
|
||||
/*
|
||||
100ns resolution (nominally) time of day
|
||||
*/
|
||||
GetSystemTimeAsFileTime( &r.t );
|
||||
/* high resolution performance counter */
|
||||
/*
|
||||
high resolution performance counter
|
||||
*/
|
||||
QueryPerformanceCounter( &r.pc );
|
||||
/* milliseconds since last boot */
|
||||
/*
|
||||
milliseconds since last boot
|
||||
*/
|
||||
r.tc = GetTickCount( );
|
||||
r.l = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
|
||||
GetComputerName( r.hostname, &r.l );
|
||||
|
||||
/* MD5 it */
|
||||
MD5Init(&c);
|
||||
MD5Update(&c, &r, sizeof r);
|
||||
MD5Update( &c, &r, sizeof( randomness ) );
|
||||
MD5Final( seed, &c );
|
||||
};
|
||||
|
||||
#else /* _WINDOWS_ */
|
||||
#else
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
void
|
||||
@@ -150,18 +155,12 @@ get_random_info(char seed[16])
|
||||
} randomness;
|
||||
randomness r;
|
||||
|
||||
/* Initialize memory area so that valgrind does not complain */
|
||||
memset(&r, 0, sizeof r);
|
||||
MD5Init( &c );
|
||||
|
||||
/* Get some random stuff */
|
||||
gettimeofday( &r.t, ( struct timezone * )0 );
|
||||
gethostname( r.hostname, 256 );
|
||||
|
||||
/* MD5 it */
|
||||
MD5Init(&c);
|
||||
MD5Update(&c, &r, sizeof r);
|
||||
MD5Update( &c, &r, sizeof( randomness ) );
|
||||
MD5Final( seed, &c );
|
||||
};
|
||||
|
||||
#endif /* _WINDOWS_ */
|
||||
|
||||
#endif
|
||||
|
@@ -55,8 +55,8 @@ static unsigned16 true_random( void );
|
||||
int
|
||||
uuid_create( uuid_upnp * uid )
|
||||
{
|
||||
uuid_time_t timestamp;
|
||||
uuid_time_t last_time;
|
||||
uuid_time_t timestamp,
|
||||
last_time;
|
||||
unsigned16 clockseq;
|
||||
uuid_node_t node;
|
||||
uuid_node_t last_node;
|
||||
@@ -86,11 +86,10 @@ uuid_create(uuid_upnp *uid)
|
||||
if no NV state, or if clock went backwards, or node ID changed
|
||||
(e.g., net card swap) change clockseq
|
||||
*/
|
||||
if (!f || memcmp(&node, &last_node, sizeof(uuid_node_t))) {
|
||||
if( !f || memcmp( &node, &last_node, sizeof( uuid_node_t ) ) )
|
||||
clockseq = true_random( );
|
||||
} else if (timestamp < last_time) {
|
||||
else if( timestamp < last_time )
|
||||
clockseq++;
|
||||
}
|
||||
|
||||
/*
|
||||
stuff fields into the UUID
|
||||
@@ -103,26 +102,24 @@ uuid_create(uuid_upnp *uid)
|
||||
write_state( clockseq, timestamp, node );
|
||||
|
||||
UUIDUnlock( );
|
||||
return 1;
|
||||
return ( 1 );
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
void
|
||||
uuid_unpack(uuid_upnp *u, char *out)
|
||||
uuid_unpack( uuid_upnp * u,
|
||||
char *out )
|
||||
{
|
||||
|
||||
sprintf( out,
|
||||
"%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x",
|
||||
(unsigned int)u->time_low,
|
||||
u->time_mid,
|
||||
u->time_hi_and_version,
|
||||
u->clock_seq_hi_and_reserved,
|
||||
u->clock_seq_low,
|
||||
u->node[0],
|
||||
u->node[1],
|
||||
u->node[2],
|
||||
u->node[3],
|
||||
u->node[4],
|
||||
u->node[5]);
|
||||
( unsigned int )u->time_low, u->time_mid,
|
||||
u->time_hi_and_version, u->clock_seq_hi_and_reserved,
|
||||
u->clock_seq_low, u->node[0], u->node[1], u->node[2],
|
||||
u->node[3], u->node[4], u->node[5] );
|
||||
|
||||
*( out + 36 ) = '\0';
|
||||
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
@@ -142,7 +139,8 @@ format_uuid_v1( uuid_upnp * uid,
|
||||
*/
|
||||
uid->time_low = ( unsigned long )( timestamp & 0xFFFFFFFF );
|
||||
uid->time_mid = ( unsigned short )( ( timestamp >> 32 ) & 0xFFFF );
|
||||
uid->time_hi_and_version = (unsigned short)((timestamp >> 48) & 0x0FFF);
|
||||
uid->time_hi_and_version = ( unsigned short )( ( timestamp >> 48 ) &
|
||||
0x0FFF );
|
||||
uid->time_hi_and_version |= ( 1 << 12 );
|
||||
uid->clock_seq_low = clock_seq & 0xFF;
|
||||
uid->clock_seq_hi_and_reserved = ( clock_seq & 0x3F00 ) >> 8;
|
||||
@@ -229,6 +227,7 @@ get_current_time( uuid_time_t * timestamp )
|
||||
static int inited = 0;
|
||||
|
||||
if( !inited ) {
|
||||
get_system_time( &time_now );
|
||||
uuids_this_tick = UUIDS_PER_TICK;
|
||||
inited = 1;
|
||||
};
|
||||
|
@@ -105,7 +105,7 @@ main (int argc, char* argv[])
|
||||
* Test library initialisation
|
||||
*/
|
||||
printf ("\n");
|
||||
printf ("Initializing UPnP ... \n");
|
||||
printf ("Intializing UPnP ... \n");
|
||||
rc = UpnpInit (NULL, 0);
|
||||
if ( UPNP_E_SUCCESS == rc ) {
|
||||
const char* ip_address = UpnpGetServerIpAddress();
|
||||
|
Reference in New Issue
Block a user