Compare commits
227 Commits
release-1.
...
last_svn_t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a15e0c99d7 | ||
|
|
93a3016df1 | ||
|
|
36d6a34f5d | ||
|
|
9763158d69 | ||
|
|
2963919081 | ||
|
|
9f7936781e | ||
|
|
bc724a8073 | ||
|
|
7ff1d56906 | ||
|
|
2150bdc5b6 | ||
|
|
5bb3621626 | ||
|
|
b895fce678 | ||
|
|
bc551a1ab3 | ||
|
|
a13d09176f | ||
|
|
03c858af51 | ||
|
|
b2e38b2fca | ||
|
|
fab22807c0 | ||
|
|
338b22b754 | ||
|
|
11524cc218 | ||
|
|
54727b2a9e | ||
|
|
71ec18a3a9 | ||
|
|
99758f2dff | ||
|
|
3772ad4595 | ||
|
|
d33ad5c03e | ||
|
|
ad9bcc9100 | ||
|
|
da5cf568e6 | ||
|
|
7f1be91e76 | ||
|
|
01039a1d9a | ||
|
|
472cc5a993 | ||
|
|
a627df4d10 | ||
|
|
8f852b1ee9 | ||
|
|
59ec1fd641 | ||
|
|
3fb182aa95 | ||
|
|
9c440e2cbf | ||
|
|
c434f275ef | ||
|
|
35392132af | ||
|
|
5eccaf4b64 | ||
|
|
c6558b04d5 | ||
|
|
bf169e434c | ||
|
|
b26fe55772 | ||
|
|
1e6c3331ed | ||
|
|
c7806de98c | ||
|
|
c56ab5613e | ||
|
|
f6a30b842c | ||
|
|
cbbbb14e21 | ||
|
|
0c578f7962 | ||
|
|
500eb1df8f | ||
|
|
8eac74ee50 | ||
|
|
b80e888ae2 | ||
|
|
82a3114379 | ||
|
|
218d4bf5dd | ||
|
|
6b0272d66b | ||
|
|
aca89457ae | ||
|
|
b77fead68a | ||
|
|
da3ce95628 | ||
|
|
44cb915b1b | ||
|
|
bb55b1ed9c | ||
|
|
5c61b05ee9 | ||
|
|
285f6a2a72 | ||
|
|
cd01b538a9 | ||
|
|
34b5a5ce90 | ||
|
|
78f5e5004f | ||
|
|
54ab392bbd | ||
|
|
13a771367d | ||
|
|
7847d15171 | ||
|
|
8ab8265fd2 | ||
|
|
443cc8ea37 | ||
|
|
cd6d5822fb | ||
|
|
c9484d4f20 | ||
|
|
8180a54f41 | ||
|
|
1548c9044d | ||
|
|
943483e8b7 | ||
|
|
d991fbe26c | ||
|
|
6baedbab55 | ||
|
|
7d1e026c0c | ||
|
|
f00392e678 | ||
|
|
654363468a | ||
|
|
b0f782f9c2 | ||
|
|
cb6dfa2824 | ||
|
|
40b43458f1 | ||
|
|
3182593c01 | ||
|
|
c89f83497e | ||
|
|
46bc551a48 | ||
|
|
087e675c94 | ||
|
|
11a4ce7359 | ||
|
|
a6ba868e58 | ||
|
|
9f96b04831 | ||
|
|
219871b1dc | ||
|
|
a583e0a60e | ||
|
|
3906d8c2c7 | ||
|
|
4578ff8452 | ||
|
|
8e03b34739 | ||
|
|
5c008e3634 | ||
|
|
7f4bac9727 | ||
|
|
f00752efbd | ||
|
|
b78f27dd3e | ||
|
|
9e3b03e229 | ||
|
|
3d7b653426 | ||
|
|
0f2463f739 | ||
|
|
680db7c78d | ||
|
|
a9064dc0ca | ||
|
|
9ca32e0eb4 | ||
|
|
aa63ef88f1 | ||
|
|
08a4da2876 | ||
|
|
93ff2d7361 | ||
|
|
37ecd99305 | ||
|
|
9fc2c364fa | ||
|
|
7a796b264e | ||
|
|
517965c946 | ||
|
|
767eac1050 | ||
|
|
ad8a223998 | ||
|
|
00e047f3c8 | ||
|
|
0ea80ee482 | ||
|
|
23260a7df1 | ||
|
|
2a4701328c | ||
|
|
0e7e47d5bd | ||
|
|
e83ccbe4d0 | ||
|
|
ef0835d038 | ||
|
|
3d78996c40 | ||
|
|
92f4a78ffa | ||
|
|
6fb2655086 | ||
|
|
441cf2e471 | ||
|
|
eb66b253e2 | ||
|
|
c1ac15fccc | ||
|
|
ecb06fa24f | ||
|
|
1175a0cadb | ||
|
|
1401fce206 | ||
|
|
bbb4478c81 | ||
|
|
b4b4ee982f | ||
|
|
a8521c09cf | ||
|
|
d0d4a0631a | ||
|
|
494518b14b | ||
|
|
724700be0d | ||
|
|
bad7c80e5e | ||
|
|
ddb2f2c478 | ||
|
|
4beacd4c2d | ||
|
|
0e51ee5b61 | ||
|
|
7cf161ad22 | ||
|
|
2e85c471ca | ||
|
|
35db3e9bba | ||
|
|
98e2b2b3af | ||
|
|
494613c23b | ||
|
|
0eba550da0 | ||
|
|
90f52baa61 | ||
|
|
094cedc807 | ||
|
|
9a98f25b95 | ||
|
|
e90e549cbb | ||
|
|
efb6812b3e | ||
|
|
263e616403 | ||
|
|
b503c89f78 | ||
|
|
c60ab8eeac | ||
|
|
d8fce6e0fe | ||
|
|
e56a9d68a3 | ||
|
|
4e6102d1c2 | ||
|
|
9e54783740 | ||
|
|
164dce7fc2 | ||
|
|
537a9a4d93 | ||
|
|
9326b73d06 | ||
|
|
0fb20847a7 | ||
|
|
6b7dc5d340 | ||
|
|
a86a127f44 | ||
|
|
7acfd52f6b | ||
|
|
be2fa49891 | ||
|
|
d2c34a15de | ||
|
|
98a45e17b5 | ||
|
|
2e4a96f034 | ||
|
|
4f2075b7c9 | ||
|
|
7206e80127 | ||
|
|
5e742f04e3 | ||
|
|
0fc29c3d99 | ||
|
|
2c094ee8ea | ||
|
|
a4a7dda7ef | ||
|
|
a732d1a62e | ||
|
|
f18abdb52d | ||
|
|
85024d9576 | ||
|
|
8d21e60a2f | ||
|
|
84cb69fc2d | ||
|
|
0a173ca0c3 | ||
|
|
39e77f6d25 | ||
|
|
e599661068 | ||
|
|
3846fcc9ba | ||
|
|
0b39b2ad6c | ||
|
|
a91534042e | ||
|
|
04f80795c2 | ||
|
|
6223b7521f | ||
|
|
04b2ccca92 | ||
|
|
13bcc67f14 | ||
|
|
156ee82358 | ||
|
|
6d426a5d2e | ||
|
|
59784a134c | ||
|
|
2683d884ce | ||
|
|
d2d2081230 | ||
|
|
37558fb793 | ||
|
|
fa84a12d61 | ||
|
|
5bc8cae4ea | ||
|
|
c28942f6fe | ||
|
|
cc5ebd5b78 | ||
|
|
d264810747 | ||
|
|
77f1cff5d5 | ||
|
|
c24997917a | ||
|
|
332064ce09 | ||
|
|
93d2b99446 | ||
|
|
bcfedbc45e | ||
|
|
7b4dfce3dc | ||
|
|
87eff01a43 | ||
|
|
757caf9284 | ||
|
|
3b38c5fe68 | ||
|
|
1ab5221db5 | ||
|
|
f94b090c80 | ||
|
|
5756f589d7 | ||
|
|
ad479caddf | ||
|
|
16c883932a | ||
|
|
1457bf5937 | ||
|
|
ff3c4ae623 | ||
|
|
4e23dd9c1b | ||
|
|
3fe9ccb9ae | ||
|
|
4a6014c6f6 | ||
|
|
3f4be1ef7b | ||
|
|
868d0f0a03 | ||
|
|
b66f2646c3 | ||
|
|
34e18c2444 | ||
|
|
0ea632f699 | ||
|
|
e156038d5c | ||
|
|
9bfac585af | ||
|
|
8faf828b50 | ||
|
|
44b8ee0b3a | ||
|
|
66ed0d8f69 | ||
|
|
be3a6c6825 |
12
Doxyfile
12
Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = libUPnP
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.4.7
|
||||
PROJECT_NUMBER = 1.8.0
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
@@ -91,7 +91,7 @@ ABBREVIATE_BRIEF =
|
||||
# Doxygen will generate a detailed section even if there is only a brief
|
||||
# description.
|
||||
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
ALWAYS_DETAILED_SEC = YES
|
||||
|
||||
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
|
||||
# inherited members of a class in the documentation of that class as if those
|
||||
@@ -290,7 +290,7 @@ HIDE_IN_BODY_DOCS = NO
|
||||
# to NO (the default) then the documentation will be excluded.
|
||||
# Set it to YES to include the internal documentation.
|
||||
|
||||
INTERNAL_DOCS = NO
|
||||
INTERNAL_DOCS = YES
|
||||
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
|
||||
# file names in lower-case letters. If set to YES upper-case letters are also
|
||||
@@ -462,7 +462,7 @@ WARN_LOGFILE =
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = ./upnp ./ixml ./threadutil
|
||||
INPUT = upnp ixml threadutil
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files that
|
||||
# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
|
||||
@@ -995,7 +995,7 @@ ENABLE_PREPROCESSING = YES
|
||||
# compilation will be performed. Macro expansion can be done in a controlled
|
||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
||||
|
||||
MACRO_EXPANSION = NO
|
||||
MACRO_EXPANSION = YES
|
||||
|
||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||
# then the macro expansion is limited to the macros specified with the
|
||||
@@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# undefined via #undef or recursively expanded use the := operator
|
||||
# instead of the = operator.
|
||||
|
||||
PREDEFINED =
|
||||
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0 EXCLUDE_DOM=0
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
|
||||
18
Makefile.am
18
Makefile.am
@@ -16,6 +16,7 @@ SUBDIRS = \
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
Doxyfile \
|
||||
libupnp.pc.in \
|
||||
LICENSE \
|
||||
THANKS \
|
||||
@@ -27,7 +28,22 @@ EXTRA_DIST = \
|
||||
build/inc/autoconfig.h \
|
||||
build/inc/config.h \
|
||||
build/inc/upnpconfig.h \
|
||||
build/msvc/inttypes.h
|
||||
build/msvc/inttypes.h \
|
||||
build/msvc/stdint.h \
|
||||
build/vc8/ixml.vcproj \
|
||||
build/vc8/libupnp.sln \
|
||||
build/vc8/libupnp.vcproj \
|
||||
build/vc8/threadutil.vcproj \
|
||||
build/vc8/tvcombo.vcproj \
|
||||
build/vc8/tvctrlpt.vcproj \
|
||||
build/vc8/tvdevice.vcproj \
|
||||
build/vc9/ixml.vcproj \
|
||||
build/vc9/libupnp.sln \
|
||||
build/vc9/libupnp.vcproj \
|
||||
build/vc9/threadutil.vcproj \
|
||||
build/vc9/tvcombo.vcproj \
|
||||
build/vc9/tvctrlpt.vcproj \
|
||||
build/vc9/tvdevice.vcproj
|
||||
|
||||
|
||||
# This variable must have 'exec' in its name, in order to be installed
|
||||
|
||||
24
THANKS
24
THANKS
@@ -7,10 +7,18 @@ Here is a list of these people. Help us keep it complete and
|
||||
exempt of errors.
|
||||
|
||||
- Alex (afaucher)
|
||||
- Andre Sodermans (wienerschnitzel)
|
||||
- Anthony Viallard (homer242)
|
||||
- Apostolos Syropoulos
|
||||
- Arno Willig
|
||||
- Bob Ciora
|
||||
- Carlo Parata
|
||||
- Chaos
|
||||
- Charles Nepveu (cnepveu)
|
||||
- Chris Pickel
|
||||
- Chuck Thomason (cyt4)
|
||||
- Craig Nelson
|
||||
- David Blanchet
|
||||
- David Maass
|
||||
- Emil Ljungdahl
|
||||
- Erik Johansson
|
||||
@@ -20,20 +28,28 @@ exempt of errors.
|
||||
- Fabrice Fontaine
|
||||
- Fredrik Svensson
|
||||
- Glen Masgai
|
||||
- Hartmut Holzgraefe - hholzgra
|
||||
- Ingo Hofmann
|
||||
- Jiri Zouhar
|
||||
- John Dennis
|
||||
- Jonathan (no_dice)
|
||||
- Jonathan Casiot (no_dice)
|
||||
- Josh Carroll
|
||||
- Keith Brindley
|
||||
- Leuk_He
|
||||
- Loigu
|
||||
- Luke Kim
|
||||
- Luke Kim (nereusuj)
|
||||
- Marcelo Roberto Jimenez (mroberto)
|
||||
- Markus Strobl
|
||||
- Nektarios K. Papadopoulos
|
||||
- Nektarios K. Papadopoulos (npapadop)
|
||||
- Nicholas Kraft
|
||||
- Nick Leverton (leveret)
|
||||
- Oskar Liljeblad
|
||||
- Michael (Oxy)
|
||||
- Michael (oxygenic)
|
||||
- Paul Vixie
|
||||
- Peter Hartley
|
||||
- Rene Hexel
|
||||
- Robert Gingher (robsbox)
|
||||
- Ronan Menard
|
||||
- Siva Chandran
|
||||
- Stéphane Corthésy
|
||||
- Steve Bresson
|
||||
|
||||
11
TODO
11
TODO
@@ -18,12 +18,13 @@ http://sourceforge.net/tracker/?group_id=7189&atid=307189
|
||||
|
||||
- make API clean for large files and 64 bits
|
||||
|
||||
- Why is NUM_HANDLE defined to 200 when we can register only:
|
||||
A) One client(1)
|
||||
B) An IPv4 and IPv6 device (2)
|
||||
NUM_HANDLE should be 3
|
||||
|
||||
To Be Decided
|
||||
=============
|
||||
|
||||
- IPV6 support ?
|
||||
|
||||
- A sane way to implement the virtual directory callback initialization and checking
|
||||
against NULL pointers.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -82,11 +82,14 @@
|
||||
/* Define to 1 if you have the `vprintf' function. */
|
||||
#define HAVE_VPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <ws2tcpip.h> header file. */
|
||||
/* #undef HAVE_WS2TCPIP_H */
|
||||
|
||||
/* Define to 1 to prevent compilation of assert() */
|
||||
#define NDEBUG 1
|
||||
/* #undef NDEBUG */
|
||||
|
||||
/* Define to 1 to prevent some debug code */
|
||||
#define NO_DEBUG 1
|
||||
/* #undef NO_DEBUG */
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
@@ -101,13 +104,13 @@
|
||||
#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.8.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.8.0"
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
@@ -120,7 +123,7 @@
|
||||
#define UPNP_HAVE_CLIENT 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
/* #undef UPNP_HAVE_DEBUG */
|
||||
#define UPNP_HAVE_DEBUG 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_HAVE_DEVICE 1
|
||||
@@ -131,20 +134,23 @@
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_HAVE_WEBSERVER 1
|
||||
|
||||
/* Do not use pthread_rwlock_t */
|
||||
#define UPNP_USE_RWLOCK 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_MAJOR 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_MINOR 4
|
||||
#define UPNP_VERSION_MINOR 8
|
||||
|
||||
/* 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.8.0"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.4.7"
|
||||
#define VERSION "1.8.0"
|
||||
|
||||
/* File Offset size */
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
@@ -164,5 +170,5 @@
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Substitute for socklen_t */
|
||||
/* Type for storing the length of struct sockaddr */
|
||||
/* #undef socklen_t */
|
||||
|
||||
@@ -1,86 +1,102 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 INTERNAL_CONFIG_H
|
||||
#define INTERNAL_CONFIG_H
|
||||
|
||||
|
||||
#include "autoconfig.h"
|
||||
|
||||
|
||||
/** @name Compile time configuration options
|
||||
/*!
|
||||
* \name Compile time configuration options
|
||||
*
|
||||
* The Linux SDK for UPnP Devices contains some compile-time parameters
|
||||
* that effect the behavior of the SDK. All configuration options are
|
||||
* located in {\tt src/inc/config.h}.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
|
||||
/** @name THREAD_IDLE_TIME
|
||||
/*!
|
||||
* \name THREAD_IDLE_TIME
|
||||
*
|
||||
* The {\tt THREAD_IDLE_TIME} constant determines when a thread will be
|
||||
* removed from the thread pool and returned to the operating system. When
|
||||
* a thread in the thread pool has been idle for this number of milliseconds
|
||||
* the thread will be released from the thread pool. The default value is
|
||||
* 5000 milliseconds (5 seconds).
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define THREAD_IDLE_TIME 5000
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name JOBS_PER_THREAD
|
||||
|
||||
/*!
|
||||
* \name JOBS_PER_THREAD
|
||||
*
|
||||
* The {\tt JOBS_PER_THREAD} constant determines when a new thread will be
|
||||
* allocated to the thread pool inside the SDK. The thread pool will
|
||||
* try and maintain this jobs/thread ratio. When the jobs/thread ratio
|
||||
* becomes greater than this, then a new thread (up to the max) will be
|
||||
* allocated to the thread pool. The default ratio is 10 jobs/thread.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define JOBS_PER_THREAD 10
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name MIN_THREADS
|
||||
|
||||
/*!
|
||||
* \name MIN_THREADS
|
||||
*
|
||||
* The {\tt MIN_THREADS} constant defines the minimum number of threads the
|
||||
* thread pool inside the SDK will create. The thread pool will
|
||||
* always have this number of threads. These threads are used
|
||||
* for both callbacks into applications built on top of the SDK and also
|
||||
* for making connections to other control points and devices. This number
|
||||
* includes persistent threads. The default value is two threads.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define MIN_THREADS 2
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name MAX_THREADS
|
||||
|
||||
/*!
|
||||
* \name MAX_THREADS
|
||||
*
|
||||
* The {\tt MAX_THREADS} constant defines the maximum number of threads the
|
||||
* thread pool inside the SDK will create. These threads are used
|
||||
* for both callbacks into applications built on top of the library and also
|
||||
@@ -89,60 +105,79 @@
|
||||
* necessary for correct operation. This value can be increased for greater
|
||||
* performance in operation at the expense of greater memory overhead. The
|
||||
* default value is 12.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define MAX_THREADS 12
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name MAX_JOBS_TOTAL
|
||||
|
||||
/*! \name MAX_JOBS_TOTAL
|
||||
*
|
||||
* The {\tt MAX_JOBS_TOTAL} constant determines the maximum number of jobs
|
||||
* that can be queued. If this limit is reached further jobs will be thrown
|
||||
* to avoid memory exhaustion. The default value 100.
|
||||
* (Added by Axis.)
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define MAX_JOBS_TOTAL 100
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name DEFAULT_SOAP_CONTENT_LENGTH
|
||||
|
||||
/*!
|
||||
* \name DEFAULT_SOAP_CONTENT_LENGTH
|
||||
*
|
||||
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
||||
* This prevents devices that have a misbehaving web server to send
|
||||
* a large amount of data to the control point causing it to crash.
|
||||
* This can be adjusted dynamically with {\tt UpnpSetMaxContentLength}.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
//@{
|
||||
#define DEFAULT_SOAP_CONTENT_LENGTH 16000
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name NUM_SSDP_COPY
|
||||
|
||||
/*!
|
||||
* \name NUM_SSDP_COPY
|
||||
*
|
||||
* This configuration parameter determines how many copies of each SSDP
|
||||
* advertisement and search packets will be sent. By default it will send two
|
||||
* copies of every packet.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
//@{
|
||||
#define NUM_SSDP_COPY 2
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name SSDP_PAUSE
|
||||
|
||||
/*!
|
||||
* \name SSDP_PAUSE
|
||||
*
|
||||
* This configuration parameter determines the pause between identical SSDP
|
||||
* advertisement and search packets. The pause is measured in milliseconds
|
||||
* and defaults to 100.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
//@{
|
||||
#define SSDP_PAUSE 100
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name WEB_SERVER_BUF_SIZE
|
||||
/*!
|
||||
* \name WEB_SERVER_BUF_SIZE
|
||||
*
|
||||
* This configuration parameter sets the maximum buffer size for the
|
||||
* webserver. The default value is 1MB.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
//@{
|
||||
#define WEB_SERVER_BUF_SIZE (1024*1024)
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name AUTO_RENEW_TIME
|
||||
/*!
|
||||
* \name AUTO_RENEW_TIME
|
||||
*
|
||||
* The {\tt AUTO_RENEW_TIME} is the time, in seconds, before a subscription
|
||||
* expires that the SDK automatically resubscribes. The default
|
||||
* value is 10 seconds. Setting this value too low can result in the
|
||||
@@ -150,71 +185,87 @@
|
||||
* subscription to timeout. In order to avoid continually resubscribing
|
||||
* the minimum subscription time is five seconds more than the auto renew
|
||||
* time.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define AUTO_RENEW_TIME 10
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name CP_MINIMUM_SUBSCRIPTION_TIME
|
||||
/*!
|
||||
* \name CP_MINIMUM_SUBSCRIPTION_TIME
|
||||
*
|
||||
* The {\tt CP_MINIMUM_SUBSCRIPTION_TIME} is the minimum subscription time
|
||||
* allowed for a control point using the SDK. Subscribing for less than
|
||||
* this time automatically results in a subscription for this amount. The
|
||||
* default value is 5 seconds more than the {\tt AUTO_RENEW_TIME}, or 15
|
||||
* seconds.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define CP_MINIMUM_SUBSCRIPTION_TIME (AUTO_RENEW_TIME + 5)
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name MAX_SEARCH_TIME
|
||||
|
||||
/*!
|
||||
* \name MAX_SEARCH_TIME
|
||||
*
|
||||
* The {\tt MAX_SEARCH_TIME} is the maximum time
|
||||
* allowed for an SSDP search by a control point. Searching for greater than
|
||||
* this time automatically results in a search for this amount. The default
|
||||
* value is 80 seconds.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define MAX_SEARCH_TIME 80
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name MIN_SEARCH_TIME
|
||||
|
||||
/*!
|
||||
* \name MIN_SEARCH_TIME
|
||||
*
|
||||
* The {\tt MIN_SEARCH_TIME} is the minimumm time
|
||||
* allowed for an SSDP search by a control point. Searching for less than
|
||||
* this time automatically results in a search for this amount. The default
|
||||
* value is 2 seconds.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define MIN_SEARCH_TIME 2
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
|
||||
/** @name AUTO_ADVERTISEMENT_TIME
|
||||
/*!
|
||||
* \name AUTO_ADVERTISEMENT_TIME
|
||||
*
|
||||
* The {\tt AUTO_ADVERTISEMENT_TIME} is the time, in seconds, before an
|
||||
* device advertisements expires before a renewed advertisement is sent.
|
||||
* The default time is 30 seconds.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define AUTO_ADVERTISEMENT_TIME 30
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name SSDP_PACKET_DISTRIBUTE
|
||||
|
||||
/*!
|
||||
* \name SSDP_PACKET_DISTRIBUTE
|
||||
*
|
||||
* The {\tt SSDP_PACKET_DISTRIBUTE} enables the SSDP packets to be sent
|
||||
* at an interval equal to half of the expiration time of SSDP packets
|
||||
* minus the AUTO_ADVERTISEMENT_TIME. This is used to increase
|
||||
* the probability of SSDP packets reaching to control points.
|
||||
* It is recommended that this flag be turned on for embedded wireless
|
||||
* devices.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define SSDP_PACKET_DISTRIBUTE 1
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
/** @name Module Exclusion
|
||||
|
||||
/*!
|
||||
* \name Module Exclusion
|
||||
*
|
||||
* Depending on the requirements, the user can selectively discard any of
|
||||
* the major modules like SOAP, GENA, SSDP or the Internal web server. By
|
||||
* default everything is included inside the SDK. By setting any of
|
||||
@@ -230,9 +281,8 @@
|
||||
* \item {\tt EXCLUDE_JNI[0,1]}
|
||||
* \end{itemize}
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define EXCLUDE_SSDP 0
|
||||
#define EXCLUDE_SOAP 0
|
||||
#define EXCLUDE_GENA 0
|
||||
@@ -244,24 +294,28 @@
|
||||
#else
|
||||
# define EXCLUDE_JNI 1
|
||||
#endif
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
|
||||
/** @name DEBUG_TARGET
|
||||
/*!
|
||||
* \name DEBUG_TARGET
|
||||
*
|
||||
* The user has the option to redirect the library output debug messages
|
||||
* to either the screen or to a log file. All the output messages with
|
||||
* debug level 0 will go to {\tt upnp.err} and messages with debug level
|
||||
* greater than zero will be redirected to {\tt upnp.out}.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
//@{
|
||||
#define DEBUG_TARGET 1
|
||||
//@}
|
||||
/* @} */
|
||||
|
||||
|
||||
/** @name Other debugging features
|
||||
The UPnP SDK contains other features to aid in debugging:
|
||||
see <upnp/inc/upnpdebug.h>
|
||||
/*!
|
||||
* \name Other debugging features
|
||||
*
|
||||
* The UPnP SDK contains other features to aid in debugging:
|
||||
* see <upnp/inc/upnpdebug.h>
|
||||
*/
|
||||
|
||||
#define DEBUG_ALL 1
|
||||
@@ -274,36 +328,44 @@
|
||||
#define DEBUG_HTTP 0
|
||||
#define DEBUG_API 0
|
||||
|
||||
//@} // Compile time configuration options
|
||||
|
||||
/*
|
||||
* @} Compile time configuration options
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Do not change, Internal purpose only!!!
|
||||
***************************************************************************/
|
||||
|
||||
//@{
|
||||
/*!
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Set additional defines based on requested configuration
|
||||
*/
|
||||
|
||||
// configure --enable-client
|
||||
|
||||
/* configure --enable-client */
|
||||
#if UPNP_HAVE_CLIENT
|
||||
# define INCLUDE_CLIENT_APIS 1
|
||||
#endif
|
||||
|
||||
// configure --enable-device
|
||||
|
||||
/* configure --enable-device */
|
||||
#if UPNP_HAVE_DEVICE
|
||||
# define INCLUDE_DEVICE_APIS 1
|
||||
#endif
|
||||
|
||||
// configure --enable-webserver --enable-device
|
||||
|
||||
/* configure --enable-webserver --enable-device */
|
||||
#if UPNP_HAVE_WEBSERVER
|
||||
# define INTERNAL_WEB_SERVER 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#undef EXCLUDE_WEB_SERVER
|
||||
#undef EXCLUDE_MINISERVER
|
||||
#ifdef INTERNAL_WEB_SERVER
|
||||
@@ -314,6 +376,7 @@
|
||||
# define EXCLUDE_MINISERVER 1
|
||||
#endif
|
||||
|
||||
|
||||
#if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1
|
||||
# undef EXCLUDE_MINISERVER
|
||||
# define EXCLUDE_MINISERVER 1
|
||||
@@ -322,6 +385,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0
|
||||
# undef EXCLUDE_MINISERVER
|
||||
# define EXCLUDE_MINISERVER 0
|
||||
@@ -331,13 +395,17 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
# define CLIENTONLY(x) x
|
||||
#else
|
||||
#else /* INCLUDE_CLIENT_APIS */
|
||||
# define CLIENTONLY(x)
|
||||
#endif
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
//@}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#endif /* INTERNAL_CONFIG_H */
|
||||
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
/* upnp/inc/upnpconfig.h. Generated from upnpconfig.h.in by configure. */
|
||||
// -*- 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
|
||||
@@ -40,16 +40,16 @@
|
||||
***************************************************************************/
|
||||
|
||||
/** The library version (string) e.g. "1.3.0" */
|
||||
#define UPNP_VERSION_STRING "1.4.7"
|
||||
#define UPNP_VERSION_STRING "1.8.0"
|
||||
|
||||
/** Major version of the library */
|
||||
#define UPNP_VERSION_MAJOR 1
|
||||
|
||||
/** Minor version of the library */
|
||||
#define UPNP_VERSION_MINOR 4
|
||||
#define UPNP_VERSION_MINOR 8
|
||||
|
||||
/** 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 */
|
||||
#define UPNP_HAVE_DEBUG 1
|
||||
|
||||
|
||||
/** Defined to 1 if the library has been compiled with client API enabled
|
||||
@@ -92,6 +92,5 @@
|
||||
#define UPNP_HAVE_TOOLS 1
|
||||
|
||||
|
||||
#endif // UPNP_CONFIG_H
|
||||
|
||||
#endif /* UPNP_CONFIG_H */
|
||||
|
||||
|
||||
222
build/msvc/stdint.h
Normal file
222
build/msvc/stdint.h
Normal file
@@ -0,0 +1,222 @@
|
||||
// ISO C9x compliant stdint.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_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#if (_MSC_VER < 1300) && defined(__cplusplus)
|
||||
extern "C++" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#if (_MSC_VER < 1300) && defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
typedef __int8 int8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
||||
217
build/vc8/ixml.vcproj
Normal file
217
build/vc8/ixml.vcproj
Normal file
@@ -0,0 +1,217 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="ixml"
|
||||
ProjectGUID="{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}"
|
||||
RootNamespace="ixml"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc"
|
||||
PreprocessorDefinitions="WIN32;IXML_INLINE="
|
||||
RuntimeLibrary="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\attr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\document.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\element.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixml.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmldebug.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlmembuf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlparser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\namedNodeMap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\node.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\nodeList.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\ixml\inc\ixml.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\inc\ixmldebug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\inc\ixmlmembuf.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\inc\ixmlparser.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
65
build/vc8/libupnp.sln
Normal file
65
build/vc8/libupnp.sln
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libupnp", "libupnp.vcproj", "{6227F51A-1498-4C4A-B213-F6FDED605125}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "threadutil", "threadutil.vcproj", "{24884928-0501-4CF2-BC8A-180AFC23B2AF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ixml", "ixml.vcproj", "{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvdevice", "tvdevice.vcproj", "{F592B023-E1F3-4A1E-841E-662DEE497435}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125}
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF} = {24884928-0501-4CF2-BC8A-180AFC23B2AF}
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} = {AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvctrlpt", "tvctrlpt.vcproj", "{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} = {AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF} = {24884928-0501-4CF2-BC8A-180AFC23B2AF}
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvcombo", "tvcombo.vcproj", "{B5D74697-F615-4DCB-AA8B-935F6372F01C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125}
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF} = {24884928-0501-4CF2-BC8A-180AFC23B2AF}
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} = {AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.Build.0 = Release|Win32
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Release|Win32.Build.0 = Release|Win32
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Release|Win32.Build.0 = Release|Win32
|
||||
{F592B023-E1F3-4A1E-841E-662DEE497435}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F592B023-E1F3-4A1E-841E-662DEE497435}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F592B023-E1F3-4A1E-841E-662DEE497435}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F592B023-E1F3-4A1E-841E-662DEE497435}.Release|Win32.Build.0 = Release|Win32
|
||||
{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Release|Win32.Build.0 = Release|Win32
|
||||
{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
654
build/vc8/libupnp.vcproj
Normal file
654
build/vc8/libupnp.vcproj
Normal file
@@ -0,0 +1,654 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libupnp"
|
||||
ProjectGUID="{6227F51A-1498-4C4A-B213-F6FDED605125}"
|
||||
RootNamespace="libupnp"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/libupnp.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/libupnp.pch"
|
||||
AssemblerListingLocation="$(OutDir)\"
|
||||
ObjectFile="$(OutDir)\"
|
||||
ProgramDataBaseFileName="$(OutDir)\"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1031"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib"
|
||||
OutputFile="$(OutDir)\libupnp.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\Release/libupnp.pdb"
|
||||
ImportLibrary=".\Release/libupnp.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/libupnp.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/libupnp.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc"
|
||||
PreprocessorDefinitions="DEBUG;WIN32;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile="$(OutDir)\libupnp.pch"
|
||||
AssemblerListingLocation="$(OutDir)\"
|
||||
ObjectFile="$(OutDir)\"
|
||||
ProgramDataBaseFileName="$(OutDir)\"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1031"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib ixml.lib"
|
||||
OutputFile="$(OutDir)\libupnp.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="$(OutDir)\..\ixml"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)\libupnp.pdb"
|
||||
ImportLibrary="$(OutDir)\libupnp.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile="$(OutDir)\libupnp.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="sources"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\ActionComplete.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\ActionRequest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\attr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\client_table\client_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\Discovery.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\document.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\element.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\Event.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\EventSubscribe.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\FileInfo.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\FreeList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\gena\gena_callback2.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\gena\gena_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\gena\gena_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\httpparser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\httpreadwrite.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inet_pton.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixml.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlmembuf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlparser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\LinkedList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\uuid\md5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\membuffer.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\miniserver\miniserver.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\namedNodeMap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\node.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\nodeList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\parsetools.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\service_table\service_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\soap\soap_common.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\soap\soap_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\soap\soap_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\sock.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_server.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\statcodes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\StateVarComplete.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\StateVarRequest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\strintmap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\SubscriptionRequest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\uuid\sysdep.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\ThreadPool.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\TimerThread.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\upnp_timeout.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\upnpapi.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\upnpdebug.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\UpnpString.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\upnptools.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\uri\uri.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\urlconfig\urlconfig.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\uuid\uuid.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\webserver.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\win_dll.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="headers"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\ActionComplete.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\actionrequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\client_table.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\discovery.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\Event.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\EventSubscribe.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\FileInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gena.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gena_ctrlpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gena_device.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\global.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gmtdate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\http_client.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\httpparser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\httpreadwrite.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\inet_pton.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\md5.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\membuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\miniserver.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\netall.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\parsetools.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\server.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\service_table.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\soaplib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\sock.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\ssdplib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\statcodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\StateVarComplete.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\statevarrequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\statuscodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\strintmap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\SubscriptionRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\sysdep.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\unixutil.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\upnp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\upnp_timeout.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\upnpapi.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\upnpclosesocket.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\upnpdebug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\UpnpString.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\upnptools.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\uri.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\urlconfig.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\utilall.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\uuid.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\webserver.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\..\..\libupnp_win32.patch"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
213
build/vc8/threadutil.vcproj
Normal file
213
build/vc8/threadutil.vcproj
Normal file
@@ -0,0 +1,213 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="threadutil"
|
||||
ProjectGUID="{24884928-0501-4CF2-BC8A-180AFC23B2AF}"
|
||||
RootNamespace="threadutil"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies="pthreadVC2.lib"
|
||||
AdditionalLibraryDirectories="..\..\pthreads\lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\FreeList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\LinkedList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\ThreadPool.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\TimerThread.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\FreeList.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\ithread.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\LinkedList.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\ThreadPool.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\TimerThread.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
216
build/vc8/tvcombo.vcproj
Normal file
216
build/vc8/tvcombo.vcproj
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="tvcombo"
|
||||
ProjectGUID="{B5D74697-F615-4DCB-AA8B-935F6372F01C}"
|
||||
RootNamespace="tvcombo"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvcombo;..\..\upnp\sample\tvcombo\linux"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\linux\upnp_tv_combo_main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
208
build/vc8/tvctrlpt.vcproj
Normal file
208
build/vc8/tvctrlpt.vcproj
Normal file
@@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="tvctrlpt"
|
||||
ProjectGUID="{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}"
|
||||
RootNamespace="tvctrlpt"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt;..\..\upnp\sample\tvctrlpt\linux"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvctrlpt\linux\upnp_tv_ctrlpt_main.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
208
build/vc8/tvdevice.vcproj
Normal file
208
build/vc8/tvdevice.vcproj
Normal file
@@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="tvdevice"
|
||||
ProjectGUID="{F592B023-E1F3-4A1E-841E-662DEE497435}"
|
||||
RootNamespace="tvdevice"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
RuntimeLibrary="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvdevice\linux\upnp_tv_device_main.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
216
build/vc9/ixml.vcproj
Normal file
216
build/vc9/ixml.vcproj
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="ixml"
|
||||
ProjectGUID="{9C2C266D-35A3-465F-A297-0E21D54E5C89}"
|
||||
RootNamespace="ixml"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc"
|
||||
PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\attr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\document.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\element.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixml.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmldebug.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlmembuf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlparser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\namedNodeMap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\node.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\nodeList.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\ixml\inc\ixml.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\inc\ixmldebug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\inc\ixmlmembuf.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\inc\ixmlparser.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
63
build/vc9/libupnp.sln
Normal file
63
build/vc9/libupnp.sln
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libupnp", "libupnp.vcproj", "{6227F51A-1498-4C4A-B213-F6FDED605125}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{9C2C266D-35A3-465F-A297-0E21D54E5C89} = {9C2C266D-35A3-465F-A297-0E21D54E5C89}
|
||||
{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D} = {1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ixml", "ixml.vcproj", "{9C2C266D-35A3-465F-A297-0E21D54E5C89}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "threadutil", "threadutil.vcproj", "{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvctrlpt", "tvctrlpt.vcproj", "{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvdevice", "tvdevice.vcproj", "{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvcombo", "tvcombo.vcproj", "{6365804B-22C6-4D5E-91F3-0C052EB55B4F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.Build.0 = Release|Win32
|
||||
{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|Win32.Build.0 = Release|Win32
|
||||
{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|Win32.Build.0 = Release|Win32
|
||||
{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|Win32.Build.0 = Release|Win32
|
||||
{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|Win32.Build.0 = Release|Win32
|
||||
{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
650
build/vc9/libupnp.vcproj
Normal file
650
build/vc9/libupnp.vcproj
Normal file
@@ -0,0 +1,650 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="libupnp"
|
||||
ProjectGUID="{6227F51A-1498-4C4A-B213-F6FDED605125}"
|
||||
RootNamespace="libupnp"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/libupnp.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\pthreads\include,..\ixml\src\inc,..\ixml\inc,..\threadutil\inc,..\upnp\inc,..\upnp\src\inc,.\inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/libupnp.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1031"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib"
|
||||
OutputFile=".\Release/libupnp.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\Release/libupnp.pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\Release/libupnp.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/libupnp.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/libupnp.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc"
|
||||
PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
PrecompiledHeaderFile="$(OutDir)\libupnp.pch"
|
||||
AssemblerListingLocation="$(OutDir)\"
|
||||
ObjectFile="$(OutDir)\"
|
||||
ProgramDataBaseFileName="$(OutDir)\"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1031"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib $(TargetDir)..\ixml\ixml.lib"
|
||||
OutputFile="$(OutDir)\libupnp.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)\libupnp.pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary="$(OutDir)\libupnp.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile="$(OutDir)\libupnp.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="sources"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\ActionComplete.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\ActionRequest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\attr.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\client_table\client_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\Discovery.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\document.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\element.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\Event.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\EventSubscribe.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\FileInfo.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\FreeList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\gena\gena_callback2.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\gena\gena_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\gena\gena_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\httpparser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\httpreadwrite.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inet_pton.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixml.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlmembuf.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\ixmlparser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\LinkedList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\uuid\md5.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\membuffer.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\miniserver\miniserver.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\namedNodeMap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\node.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\nodeList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\parsetools.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\service_table\service_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\soap\soap_common.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\soap\soap_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\soap\soap_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\sock.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_server.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\statcodes.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\StateVarComplete.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\StateVarRequest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\strintmap.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\SubscriptionRequest.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\uuid\sysdep.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\ThreadPool.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\TimerThread.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\upnp_timeout.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\upnpapi.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\upnpdebug.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\UpnpString.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\upnptools.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\uri\uri.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\urlconfig\urlconfig.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\util\util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\uuid\uuid.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\net\http\webserver.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\win_dll.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="headers"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\ActionComplete.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\ActionRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\client_table.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\Discovery.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\Event.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\EventSubscribe.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\FileInfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gena.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gena_ctrlpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gena_device.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\global.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\gmtdate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\http_client.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\httpparser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\httpreadwrite.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\inet_pton.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\md5.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\membuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\miniserver.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\netall.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\parsetools.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\server.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\service_table.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\soaplib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\sock.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\ssdplib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\statcodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\StateVarComplete.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\StateVarRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\statuscodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\strintmap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\SubscriptionRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\sysdep.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\unixutil.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\upnp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\upnp_timeout.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\upnpapi.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\upnpclosesocket.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\upnpdebug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\UpnpString.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\upnptools.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\uri.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\urlconfig.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\utilall.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\uuid.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\webserver.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\..\..\..\libupnp_win32.patch"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
216
build/vc9/threadutil.vcproj
Normal file
216
build/vc9/threadutil.vcproj
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="threadutil"
|
||||
ProjectGUID="{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}"
|
||||
RootNamespace="threadutil"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include"
|
||||
PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies="pthreadVC2.lib"
|
||||
AdditionalLibraryDirectories="..\..\pthreads\lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\FreeList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\LinkedList.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\ThreadPool.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\src\TimerThread.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\FreeList.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\ithread.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\LinkedList.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\threadpool.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\threadutil\inc\TimerThread.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
214
build/vc9/tvcombo.vcproj
Normal file
214
build/vc9/tvcombo.vcproj
Normal file
@@ -0,0 +1,214 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="tvcombo"
|
||||
ProjectGUID="{6365804B-22C6-4D5E-91F3-0C052EB55B4F}"
|
||||
RootNamespace="tvcombo"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo"
|
||||
PreprocessorDefinitions="DEBUG;WIN32"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib $(TargetDir)..\libupnp\libupnp.lib"
|
||||
AdditionalLibraryDirectories=""$(TargetDir)..\ixml";"$(TargetDir)..\threadutil";"$(TargetDir)..\libupnp""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\linux\upnp_tv_combo_main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
204
build/vc9/tvctrlpt.vcproj
Normal file
204
build/vc9/tvctrlpt.vcproj
Normal file
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="tvctrlpt"
|
||||
ProjectGUID="{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}"
|
||||
RootNamespace="sample"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";".\out.vc9.$(ConfigurationName)\ixml";".\out.vc9.$(ConfigurationName)\threadutil";".\out.vc9.$(ConfigurationName)\libupnp""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvctrlpt\linux\upnp_tv_ctrlpt_main.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
204
build/vc9/tvdevice.vcproj
Normal file
204
build/vc9/tvdevice.vcproj
Normal file
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="tvdevice"
|
||||
ProjectGUID="{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}"
|
||||
RootNamespace="tvdevice"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux"
|
||||
PreprocessorDefinitions="WIN32;DEBUG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";".\out.vc9.$(ConfigurationName)\ixml";".\out.vc9.$(ConfigurationName)\threadutil";".\out.vc9.$(ConfigurationName)\libupnp""
|
||||
GenerateDebugInformation="true"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvdevice\linux\upnp_tv_device_main.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\common\sample_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
363
configure.ac
363
configure.ac
@@ -4,110 +4,183 @@
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#
|
||||
# (C) Copyright 2005-2007 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
||||
# (C) Copyright 2005-2007 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||
#
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
AC_INIT([libupnp], [1.6.2], [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*
|
||||
#
|
||||
###############################################################################
|
||||
# Release 1.4.1:
|
||||
#AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
||||
#AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
||||
#AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
||||
#
|
||||
###############################################################################
|
||||
# Release 1.4.6:
|
||||
# "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
|
||||
#
|
||||
#AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
||||
#AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
||||
#AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
||||
#
|
||||
###############################################################################
|
||||
# Release 1.6.0:
|
||||
# "current:revision:age"
|
||||
#
|
||||
# - Code has changed in ixml
|
||||
# revision: 3 -> 4
|
||||
# - Code has changed in threadutil
|
||||
# revision: 0 -> 1
|
||||
# - Code has changed in upnp
|
||||
# revision: 3 -> 4
|
||||
# - Interface changed in upnp
|
||||
# current: 2 -> 3
|
||||
# revision: 4 -> 0
|
||||
# - Interface removed in upnp
|
||||
# age: 0 -> 0
|
||||
#
|
||||
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
#AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
||||
#AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
||||
#
|
||||
###############################################################################
|
||||
# Release 1.6.1:
|
||||
# "current:revision:age"
|
||||
#
|
||||
# - Code has changed in threadutil
|
||||
# revision: 1 -> 2
|
||||
# - Interface added in threadutil
|
||||
# current: 3 -> 4
|
||||
# revision: 2 -> 0
|
||||
# - Interface added in threadutil
|
||||
# age: 1 -> 2
|
||||
# - Code has changed in upnp
|
||||
# revision: 0 -> 1
|
||||
#
|
||||
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
#AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||
#AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
||||
#
|
||||
###############################################################################
|
||||
# Release 1.6.2:
|
||||
# "current:revision:age"
|
||||
#
|
||||
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
#AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||
#AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
||||
#
|
||||
###############################################################################
|
||||
AC_INIT([libupnp], [1.8.0], [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 ############################################################################
|
||||
dnl # Release 1.6.5:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 3 -> 4
|
||||
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:4:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.6:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 2 -> 3
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 4 -> 5
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:3:2])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:5:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.8.0:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 5 -> 6
|
||||
dnl # - Interfaces have been changed, added and removed in upnp
|
||||
dnl # current: 3 -> 4
|
||||
dnl # revision: 6 -> 0
|
||||
dnl # - Interface has been removed in upnp
|
||||
dnl # age = 0
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 3 -> 4
|
||||
dnl # - Interfaces have been changed, added and removed in upnp
|
||||
dnl # current: 4 -> 5
|
||||
dnl # revision: 4 -> 0
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||
AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||
AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
||||
###############################################################################
|
||||
# Repeating the algorithm so that it is closer to the modificatin place:
|
||||
# - 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*
|
||||
###############################################################################
|
||||
AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2])
|
||||
AC_SUBST([LT_VERSION_UPNP], [4:0: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_CONFIG_AUX_DIR(config.aux)
|
||||
AC_CONFIG_MACRO_DIR(m4)
|
||||
AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR([upnp/inc/upnp.h])
|
||||
|
||||
|
||||
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
||||
@@ -137,8 +210,7 @@ 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])
|
||||
@@ -160,7 +232,6 @@ 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])
|
||||
@@ -194,11 +265,13 @@ 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(
|
||||
@@ -213,7 +286,9 @@ AS_HELP_STRING(
|
||||
[],
|
||||
[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
|
||||
@@ -247,7 +322,9 @@ freebsd*)
|
||||
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
|
||||
:
|
||||
#:
|
||||
# Use -O0 in debug so that variables do not get optimized out
|
||||
AX_CFLAGS_GCC_OPTION([-O0])
|
||||
else
|
||||
# add optimise for size
|
||||
AX_CFLAGS_GCC_OPTION([-Os])
|
||||
@@ -269,9 +346,26 @@ AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
||||
|
||||
|
||||
#
|
||||
# Checks for header files
|
||||
# Are we targetting Win32?
|
||||
#
|
||||
AC_MSG_CHECKING([for Win32])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#ifdef WIN32
|
||||
#error Yup
|
||||
#endif
|
||||
],[])], [ac_cv_win32="no"], [ac_cv_win32="yes"])
|
||||
if test "$ac_cv_win32" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Checks for header files (which aren't needed on Win32)
|
||||
#
|
||||
AC_HEADER_STDC
|
||||
if test "$ac_cv_win32" = "no"; then
|
||||
# libupnp code doesn't use autoconf variables yet,
|
||||
# so just abort if a header file is not found.
|
||||
AC_CHECK_HEADERS(
|
||||
@@ -287,20 +381,43 @@ AC_CHECK_HEADERS(
|
||||
sys/ioctl.h \
|
||||
sys/socket.h \
|
||||
sys/time.h \
|
||||
sys/timeb.h \
|
||||
syslog.h \
|
||||
unistd.h \
|
||||
],
|
||||
[],
|
||||
[AC_MSG_ERROR([required header file missing])])
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Checks for typedefs, structures, and compiler characteristics
|
||||
#
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
TYPE_SOCKLEN_T
|
||||
|
||||
# The test for socklen_t was getting it wrong when it exists but is in ws2tcpip.h,
|
||||
# so we use a new test.
|
||||
#TYPE_SOCKLEN_T
|
||||
|
||||
AC_CHECK_HEADERS([sys/types.h sys/socket.h ws2tcpip.h])
|
||||
AC_MSG_CHECKING(for socklen_t)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
],[ socklen_t t = 0; return t; ])
|
||||
],[ac_cv_socklen_t="yes"],[ac_cv_socklen_t="no"])
|
||||
if test "$ac_cv_socklen_t" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no, using int])
|
||||
AC_DEFINE(socklen_t, int, [Type for storing the length of struct sockaddr])
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
@@ -309,14 +426,50 @@ TYPE_SOCKLEN_T
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_FSEEKO
|
||||
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
||||
#
|
||||
# Solaris needs -lsocket -lnsl -lrt
|
||||
AC_SEARCH_LIBS([bind], [socket])
|
||||
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
||||
AC_SEARCH_LIBS([sched_getparam], [rt])
|
||||
|
||||
|
||||
#
|
||||
# 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 "-------------------------------------------------------------------------------"
|
||||
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
|
||||
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_UNACCAPTED-302.html \
|
||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-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_UNACCAPTED-302.html \
|
||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-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 \
|
||||
|
||||
@@ -24,15 +24,23 @@ libixml_la_LDFLAGS = -version-info $(LT_VERSION_IXML) \
|
||||
-export-symbols-regex '^ixml.*'
|
||||
|
||||
libixml_la_SOURCES = \
|
||||
src/ixml.c src/node.c src/ixmlparser.c \
|
||||
src/ixmlmembuf.c src/nodeList.c \
|
||||
src/element.c src/attr.c src/document.c \
|
||||
src/attr.c \
|
||||
src/document.c \
|
||||
src/element.c \
|
||||
src/inc/ixmlmembuf.h \
|
||||
src/inc/ixmlparser.h \
|
||||
src/ixml.c \
|
||||
src/ixmldebug.c \
|
||||
src/ixmlparser.c \
|
||||
src/ixmlmembuf.c \
|
||||
src/namedNodeMap.c \
|
||||
src/inc/ixmlmembuf.h src/inc/ixmlparser.h
|
||||
src/node.c \
|
||||
src/nodeList.c
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = inc/ixml.h
|
||||
|
||||
upnpinclude_HEADERS = \
|
||||
inc/ixml.h \
|
||||
inc/ixmldebug.h
|
||||
|
||||
check_PROGRAMS = test_document
|
||||
TESTS = test/test_document.sh
|
||||
@@ -47,4 +55,3 @@ dist-hook:
|
||||
clean-local:
|
||||
@if [ -d bin ] ; then rm -rf bin ; fi
|
||||
|
||||
|
||||
|
||||
2634
ixml/inc/ixml.h
2634
ixml/inc/ixml.h
File diff suppressed because it is too large
Load Diff
67
ixml/inc/ixmldebug.h
Normal file
67
ixml/inc/ixmldebug.h
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
|
||||
#ifndef IXMLDEBUG_H
|
||||
#define IXMLDEBUG_H
|
||||
|
||||
|
||||
#include "UpnpGlobal.h"
|
||||
#include "ixml.h"
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Auxiliar routines to aid debugging.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Prints the debug statement either on the standard output or log file
|
||||
* along with the information from where this debug statement is coming.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void IxmlPrintf(
|
||||
/*! [in] The file name, usually __FILE__. */
|
||||
const char *DbgFileName,
|
||||
/*! [in] The line number, usually __LINE__ or a variable that got the
|
||||
* __LINE__ at the appropriate place. */
|
||||
int DbgLineNo,
|
||||
/*! [in] The function name. */
|
||||
const char *FunctionName,
|
||||
/*! [in] Printf like format specification. */
|
||||
const char* FmtStr,
|
||||
/*! [in] Printf like Variable number of arguments that will go in the debug
|
||||
* statement. */
|
||||
...)
|
||||
#if (__GNUC__ >= 3)
|
||||
/* This enables printf like format checking by the compiler */
|
||||
__attribute__((format (__printf__, 4, 5)))
|
||||
#endif
|
||||
;
|
||||
#else /* DEBUG */
|
||||
static UPNP_INLINE void IxmlPrintf(
|
||||
const char* FmtStr,
|
||||
...) {}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Print the node names and values of a XML tree.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void printNodes(
|
||||
/*! [in] The root of the tree to print. */
|
||||
IXML_Node *tmpRoot,
|
||||
/*! [in] The depth to print. */
|
||||
int depth);
|
||||
#else
|
||||
static UPNP_INLINE void printNodes(
|
||||
IXML_Node *tmpRoot,
|
||||
int depth)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* IXMLDEBUG_H */
|
||||
|
||||
@@ -1,60 +1,53 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* Function: Attr_init
|
||||
* Initializes an attribute node
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlAttr_init( IN IXML_Attr * attr )
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void ixmlAttr_init(IN IXML_Attr *attr)
|
||||
{
|
||||
if (attr != NULL) {
|
||||
memset(attr, 0, sizeof (IXML_Attr));
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* Function: Attr_free
|
||||
* Frees an attribute node.
|
||||
* external function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlAttr_free( IN IXML_Attr * attr )
|
||||
|
||||
void ixmlAttr_free(IN IXML_Attr *attr)
|
||||
{
|
||||
if (attr != NULL) {
|
||||
ixmlNode_free((IXML_Node *)attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,119 +1,97 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "ixmldebug.h"
|
||||
#include "ixmlparser.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_init
|
||||
* It initialize the document structure.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDocument_init( IN IXML_Document * doc )
|
||||
void ixmlDocument_init(IXML_Document *doc)
|
||||
{
|
||||
memset(doc, 0, sizeof(IXML_Document));
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_free
|
||||
* It frees the whole document tree.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDocument_free( IN IXML_Document * doc )
|
||||
|
||||
void ixmlDocument_free(IXML_Document *doc)
|
||||
{
|
||||
if (doc != NULL) {
|
||||
ixmlNode_free((IXML_Node *)doc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_setOwnerDocument
|
||||
*
|
||||
* When this function is called first time, nodeptr is the root
|
||||
* of the subtree, so it is not necessay to do two steps
|
||||
* recursion.
|
||||
|
||||
/*!
|
||||
* When this function is called first time, nodeptr is the root of the subtree,
|
||||
* so it is not necessay to do two steps recursion.
|
||||
*
|
||||
* Internal function called by ixmlDocument_importNode
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDocument_setOwnerDocument( IN IXML_Document * doc,
|
||||
IN IXML_Node * nodeptr )
|
||||
*/
|
||||
static void ixmlDocument_setOwnerDocument(
|
||||
/*! [in] The document node. */
|
||||
IXML_Document *doc,
|
||||
/*! [in] \todo documentation. */
|
||||
IXML_Node *nodeptr)
|
||||
{
|
||||
if (nodeptr != NULL) {
|
||||
nodeptr->ownerDocument = doc;
|
||||
ixmlDocument_setOwnerDocument( doc,
|
||||
ixmlNode_getFirstChild( nodeptr ) );
|
||||
ixmlDocument_setOwnerDocument( doc,
|
||||
ixmlNode_getNextSibling
|
||||
( nodeptr ) );
|
||||
ixmlDocument_setOwnerDocument(
|
||||
doc, ixmlNode_getFirstChild(nodeptr));
|
||||
ixmlDocument_setOwnerDocument(
|
||||
doc, ixmlNode_getNextSibling(nodeptr));
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_importNode
|
||||
* Imports a node from another document to this document. The
|
||||
* returned node has no parent; (parentNode is null). The source
|
||||
* node is not altered or removed from the original document;
|
||||
* this method creates a new copy of the source node.
|
||||
|
||||
* For all nodes, importing a node creates a node object owned
|
||||
* by the importing document, with attribute values identical to
|
||||
* the source node's nodeName and nodeType, plus the attributes
|
||||
* related to namespaces (prefix, localName, and namespaceURI).
|
||||
* As in the cloneNode operation on a node, the source node is
|
||||
* not altered.
|
||||
*
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_importNode( IN IXML_Document * doc,
|
||||
IN IXML_Node * importNode,
|
||||
IN BOOL deep,
|
||||
OUT IXML_Node ** rtNode )
|
||||
int ixmlDocument_importNode(
|
||||
IXML_Document *doc,
|
||||
IXML_Node *importNode,
|
||||
BOOL deep,
|
||||
IXML_Node **rtNode)
|
||||
{
|
||||
unsigned short nodeType;
|
||||
IXML_Node *newNode;
|
||||
|
||||
*rtNode = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( importNode == NULL ) ) {
|
||||
if (doc == NULL || importNode == NULL) {
|
||||
return IXML_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -133,29 +111,16 @@ ixmlDocument_importNode( IN IXML_Document * doc,
|
||||
return IXML_SUCCESS;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createElementEx
|
||||
* Creates an element of the type specified.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* doc: pointer to document
|
||||
* tagName: The name of the element, it is case-sensitive.
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INVALID_PARAMETER: if either doc or tagName is NULL
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createElementEx( IN IXML_Document * doc,
|
||||
IN const DOMString tagName,
|
||||
OUT IXML_Element ** rtElement )
|
||||
{
|
||||
|
||||
int ixmlDocument_createElementEx(
|
||||
IXML_Document *doc,
|
||||
const DOMString tagName,
|
||||
IXML_Element **rtElement)
|
||||
{
|
||||
int errCode = IXML_SUCCESS;
|
||||
IXML_Element *newElement = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
||||
if (doc == NULL || tagName == NULL) {
|
||||
errCode = IXML_INVALID_PARAMETER;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
@@ -188,46 +153,23 @@ ixmlDocument_createElementEx( IN IXML_Document * doc,
|
||||
|
||||
ErrorHandler:
|
||||
*rtElement = newElement;
|
||||
return errCode;
|
||||
|
||||
return errCode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createElement
|
||||
* Creates an element of the type specified.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* doc: pointer to document
|
||||
* tagName: The name of the element, it is case-sensitive.
|
||||
* Return Value:
|
||||
* A new element object with the nodeName set to tagName, and
|
||||
* localName, prefix and namespaceURI set to null.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Element *
|
||||
ixmlDocument_createElement( IN IXML_Document * doc,
|
||||
IN const DOMString tagName )
|
||||
|
||||
IXML_Element *ixmlDocument_createElement(
|
||||
IXML_Document *doc,
|
||||
const DOMString tagName)
|
||||
{
|
||||
IXML_Element *newElement = NULL;
|
||||
|
||||
ixmlDocument_createElementEx(doc, tagName, &newElement);
|
||||
return newElement;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createDocumentEx
|
||||
* Creates an document object
|
||||
* Internal function.
|
||||
* Parameters:
|
||||
* rtDoc: the document created or NULL on failure
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
|
||||
|
||||
int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
|
||||
{
|
||||
IXML_Document *doc;
|
||||
int errCode = IXML_SUCCESS;
|
||||
@@ -257,49 +199,27 @@ ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
|
||||
return errCode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createDocument
|
||||
* Creates an document object
|
||||
* Internal function.
|
||||
* Parameters:
|
||||
* none
|
||||
* Return Value:
|
||||
* A new document object with the nodeName set to "#document".
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Document *
|
||||
ixmlDocument_createDocument( )
|
||||
|
||||
IXML_Document *ixmlDocument_createDocument()
|
||||
{
|
||||
IXML_Document *doc = NULL;
|
||||
|
||||
ixmlDocument_createDocumentEx(&doc);
|
||||
|
||||
return doc;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createTextNodeEx
|
||||
* Creates an text node.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* data: text data for the text node. It is stored in nodeValue field.
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INVALID_PARAMETER: if either doc or data is NULL
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
|
||||
IN const char *data,
|
||||
OUT IXML_Node ** textNode )
|
||||
|
||||
int ixmlDocument_createTextNodeEx(
|
||||
IXML_Document *doc,
|
||||
const DOMString data,
|
||||
IXML_Node **textNode)
|
||||
{
|
||||
IXML_Node *returnNode;
|
||||
int rc = IXML_SUCCESS;
|
||||
|
||||
returnNode = NULL;
|
||||
if( ( doc == NULL ) || ( data == NULL ) ) {
|
||||
if (doc == NULL || data == NULL) {
|
||||
rc = IXML_INVALID_PARAMETER;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
@@ -336,22 +256,12 @@ ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
|
||||
ErrorHandler:
|
||||
*textNode = returnNode;
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createTextNode
|
||||
* Creates an text node.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* data: text data for the text node. It is stored in nodeValue field.
|
||||
* Return Value:
|
||||
* The new text node.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Node *
|
||||
ixmlDocument_createTextNode( IN IXML_Document * doc,
|
||||
IN const char *data )
|
||||
|
||||
IXML_Node *ixmlDocument_createTextNode(
|
||||
IXML_Document *doc,
|
||||
const DOMString data)
|
||||
{
|
||||
IXML_Node *returnNode = NULL;
|
||||
|
||||
@@ -360,21 +270,11 @@ ixmlDocument_createTextNode( IN IXML_Document * doc,
|
||||
return returnNode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createAttributeEx
|
||||
* Creates an attribute of the given name.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* name: The name of the Attribute node.
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
================================================================*/
|
||||
int
|
||||
ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
||||
IN const char *name,
|
||||
OUT IXML_Attr ** rtAttr )
|
||||
|
||||
int ixmlDocument_createAttributeEx(
|
||||
IXML_Document *doc,
|
||||
const char *name,
|
||||
IXML_Attr **rtAttr)
|
||||
{
|
||||
IXML_Attr *attrNode = NULL;
|
||||
int errCode = IXML_SUCCESS;
|
||||
@@ -385,7 +285,7 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
if( ( doc == NULL ) || ( name == NULL ) ) {
|
||||
if (doc == NULL || name == NULL) {
|
||||
ixmlAttr_free(attrNode);
|
||||
attrNode = NULL;
|
||||
errCode = IXML_INVALID_PARAMETER;
|
||||
@@ -393,7 +293,6 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
||||
}
|
||||
|
||||
ixmlAttr_init(attrNode);
|
||||
|
||||
attrNode->n.nodeType = eATTRIBUTE_NODE;
|
||||
|
||||
// set the node fields
|
||||
@@ -410,56 +309,31 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
||||
ErrorHandler:
|
||||
*rtAttr = attrNode;
|
||||
return errCode;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createAttribute
|
||||
* Creates an attribute of the given name.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* name: The name of the Attribute node.
|
||||
* Return Value:
|
||||
* A new attr object with the nodeName attribute set to the
|
||||
* given name, and the localName, prefix and namespaceURI set to NULL.
|
||||
* The value of the attribute is the empty string.
|
||||
*
|
||||
================================================================*/
|
||||
IXML_Attr *
|
||||
ixmlDocument_createAttribute( IN IXML_Document * doc,
|
||||
IN const char *name )
|
||||
|
||||
IXML_Attr *ixmlDocument_createAttribute(
|
||||
IXML_Document *doc,
|
||||
const char *name)
|
||||
{
|
||||
IXML_Attr *attrNode = NULL;
|
||||
|
||||
ixmlDocument_createAttributeEx(doc, name, &attrNode);
|
||||
return attrNode;
|
||||
|
||||
return attrNode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createAttributeNSEx
|
||||
* Creates an attrbute of the given name and namespace URI
|
||||
* External function.
|
||||
* Parameters:
|
||||
* namespaceURI: the namespace fo the attribute to create
|
||||
* qualifiedName: qualifiedName of the attribute to instantiate
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INVALID_PARAMETER: if either doc,namespaceURI or qualifiedName is NULL
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
|
||||
IN const DOMString namespaceURI,
|
||||
IN const DOMString qualifiedName,
|
||||
OUT IXML_Attr ** rtAttr )
|
||||
|
||||
int ixmlDocument_createAttributeNSEx(
|
||||
IXML_Document *doc,
|
||||
const DOMString namespaceURI,
|
||||
const DOMString qualifiedName,
|
||||
IXML_Attr **rtAttr )
|
||||
{
|
||||
IXML_Attr *attrNode = NULL;
|
||||
int errCode = IXML_SUCCESS;
|
||||
|
||||
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
||||
|| ( qualifiedName == NULL ) ) {
|
||||
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|
||||
errCode = IXML_INVALID_PARAMETER;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
@@ -489,68 +363,43 @@ ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
|
||||
ErrorHandler:
|
||||
*rtAttr = attrNode;
|
||||
return errCode;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createAttributeNS
|
||||
* Creates an attrbute of the given name and namespace URI
|
||||
* External function.
|
||||
* Parameters:
|
||||
* namespaceURI: the namespace fo the attribute to create
|
||||
* qualifiedName: qualifiedName of the attribute to instantiate
|
||||
* Return Value:
|
||||
* Creates an attribute node with the given namespaceURI and
|
||||
* qualifiedName. The prefix and localname are extracted from
|
||||
* the qualifiedName. The node value is empty.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Attr *
|
||||
ixmlDocument_createAttributeNS( IN IXML_Document * doc,
|
||||
IN const DOMString namespaceURI,
|
||||
IN const DOMString qualifiedName )
|
||||
|
||||
IXML_Attr *ixmlDocument_createAttributeNS(
|
||||
IXML_Document *doc,
|
||||
const DOMString namespaceURI,
|
||||
const DOMString qualifiedName)
|
||||
{
|
||||
IXML_Attr *attrNode = NULL;
|
||||
|
||||
ixmlDocument_createAttributeNSEx( doc, namespaceURI, qualifiedName,
|
||||
&attrNode );
|
||||
ixmlDocument_createAttributeNSEx(
|
||||
doc, namespaceURI, qualifiedName, &attrNode);
|
||||
|
||||
return attrNode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createCDATASectionEx
|
||||
* Creates an CDATASection node whose value is the specified string
|
||||
* External function.
|
||||
* Parameters:
|
||||
* data: the data for the CDATASection contents.
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INVALID_PARAMETER: if either doc or data is NULL
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
|
||||
IN const DOMString data,
|
||||
OUT IXML_CDATASection ** rtCD )
|
||||
|
||||
int ixmlDocument_createCDATASectionEx(
|
||||
IXML_Document *doc,
|
||||
const DOMString data,
|
||||
IXML_CDATASection **rtCD)
|
||||
{
|
||||
int errCode = IXML_SUCCESS;
|
||||
IXML_CDATASection *cDSectionNode = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( data == NULL ) ) {
|
||||
if(doc == NULL || data == NULL) {
|
||||
errCode = IXML_INVALID_PARAMETER;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
cDSectionNode =
|
||||
( IXML_CDATASection * ) malloc( sizeof( IXML_CDATASection ) );
|
||||
cDSectionNode = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection));
|
||||
if (cDSectionNode == NULL) {
|
||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
ixmlCDATASection_init(cDSectionNode);
|
||||
|
||||
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
|
||||
cDSectionNode->n.nodeName = strdup(CDATANODENAME);
|
||||
if (cDSectionNode->n.nodeName == NULL) {
|
||||
@@ -573,80 +422,58 @@ ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
|
||||
ErrorHandler:
|
||||
*rtCD = cDSectionNode;
|
||||
return errCode;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createCDATASection
|
||||
* Creates an CDATASection node whose value is the specified string
|
||||
* External function.
|
||||
* Parameters:
|
||||
* data: the data for the CDATASection contents.
|
||||
* Return Value:
|
||||
* The new CDATASection object.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_CDATASection *
|
||||
ixmlDocument_createCDATASection( IN IXML_Document * doc,
|
||||
IN const DOMString data )
|
||||
{
|
||||
|
||||
IXML_CDATASection *ixmlDocument_createCDATASection(
|
||||
IXML_Document *doc,
|
||||
const DOMString data)
|
||||
{
|
||||
IXML_CDATASection *cDSectionNode = NULL;
|
||||
|
||||
ixmlDocument_createCDATASectionEx(doc, data, &cDSectionNode);
|
||||
|
||||
return cDSectionNode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createElementNSEx
|
||||
* Creates an element of the given qualified name and namespace URI.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* namespaceURI: the namespace URI of the element to create.
|
||||
* qualifiedName: the qualified name of the element to instantiate.
|
||||
* Return Value:
|
||||
* Return Value:
|
||||
* IXML_SUCCESS
|
||||
* IXML_INVALID_PARAMETER: if either doc,namespaceURI or qualifiedName is NULL
|
||||
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlDocument_createElementNSEx( IN IXML_Document * doc,
|
||||
IN const DOMString namespaceURI,
|
||||
IN const DOMString qualifiedName,
|
||||
OUT IXML_Element ** rtElement )
|
||||
|
||||
int ixmlDocument_createElementNSEx(
|
||||
IXML_Document *doc,
|
||||
const DOMString namespaceURI,
|
||||
const DOMString qualifiedName,
|
||||
IXML_Element **rtElement)
|
||||
{
|
||||
|
||||
IXML_Element *newElement = NULL;
|
||||
int errCode = IXML_SUCCESS;
|
||||
int ret = IXML_SUCCESS;
|
||||
int line = 0;
|
||||
|
||||
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
||||
|| ( qualifiedName == NULL ) ) {
|
||||
errCode = IXML_INVALID_PARAMETER;
|
||||
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|
||||
line = __LINE__;
|
||||
ret = IXML_INVALID_PARAMETER;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
errCode =
|
||||
ixmlDocument_createElementEx( doc, qualifiedName, &newElement );
|
||||
if( errCode != IXML_SUCCESS ) {
|
||||
ret = ixmlDocument_createElementEx(doc, qualifiedName, &newElement);
|
||||
if (ret != IXML_SUCCESS) {
|
||||
line = __LINE__;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
// set the namespaceURI field
|
||||
newElement->n.namespaceURI = strdup(namespaceURI);
|
||||
if (newElement->n.namespaceURI == NULL) {
|
||||
line = __LINE__;
|
||||
ixmlElement_free(newElement);
|
||||
newElement = NULL;
|
||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||
ret = IXML_INSUFFICIENT_MEMORY;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
// set the localName and prefix
|
||||
errCode =
|
||||
ixmlNode_setNodeName( ( IXML_Node * ) newElement, qualifiedName );
|
||||
if( errCode != IXML_SUCCESS ) {
|
||||
ret = ixmlNode_setNodeName((IXML_Node *)newElement, qualifiedName);
|
||||
if (ret != IXML_SUCCESS) {
|
||||
line = __LINE__;
|
||||
ixmlElement_free(newElement);
|
||||
newElement = NULL;
|
||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||
ret = IXML_INSUFFICIENT_MEMORY;
|
||||
goto ErrorHandler;
|
||||
}
|
||||
|
||||
@@ -654,115 +481,70 @@ ixmlDocument_createElementNSEx( IN IXML_Document * doc,
|
||||
|
||||
ErrorHandler:
|
||||
*rtElement = newElement;
|
||||
return errCode;
|
||||
|
||||
if (ret != IXML_SUCCESS) {
|
||||
IxmlPrintf(__FILE__, line, "ixmlDocument_createElementNSEx", "Error %d\n", ret);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_createElementNS
|
||||
* Creates an element of the given qualified name and namespace URI.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* namespaceURI: the namespace URI of the element to create.
|
||||
* qualifiedName: the qualified name of the element to instantiate.
|
||||
* Return Value:
|
||||
* The new element object with tagName qualifiedName, prefix and
|
||||
* localName extraced from qualfiedName, nodeName of qualfiedName,
|
||||
* namespaceURI of namespaceURI.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Element *
|
||||
ixmlDocument_createElementNS( IN IXML_Document * doc,
|
||||
IN const DOMString namespaceURI,
|
||||
IN const DOMString qualifiedName )
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
IXML_Element *ixmlDocument_createElementNS(
|
||||
IXML_Document *doc,
|
||||
const DOMString namespaceURI,
|
||||
const DOMString qualifiedName)
|
||||
{
|
||||
IXML_Element *newElement = NULL;
|
||||
|
||||
ixmlDocument_createElementNSEx( doc, namespaceURI, qualifiedName,
|
||||
&newElement );
|
||||
ixmlDocument_createElementNSEx(doc, namespaceURI, qualifiedName, &newElement);
|
||||
|
||||
return newElement;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_getElementsByTagName
|
||||
* Returns a nodeList of all the Elements with a given tag name
|
||||
* in the order in which they are encountered in a preorder traversal
|
||||
* of the document tree.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* tagName: the name of the tag to match on. The special value "*"
|
||||
* matches all tags.
|
||||
* Return Value:
|
||||
* A new nodeList object containing all the matched Elements.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_NodeList *
|
||||
ixmlDocument_getElementsByTagName( IN IXML_Document * doc,
|
||||
IN const char *tagName )
|
||||
|
||||
IXML_NodeList *ixmlDocument_getElementsByTagName(
|
||||
IXML_Document *doc,
|
||||
const DOMString tagName)
|
||||
{
|
||||
IXML_NodeList *returnNodeList = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
||||
if (doc == NULL || tagName == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ixmlNode_getElementsByTagName( ( IXML_Node * ) doc, tagName,
|
||||
&returnNodeList );
|
||||
ixmlNode_getElementsByTagName((IXML_Node *)doc, tagName, &returnNodeList);
|
||||
|
||||
return returnNodeList;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_getElementsByTagNameNS
|
||||
* Returns a nodeList of all the Elements with a given local name and
|
||||
* namespace URI in the order in which they are encountered in a
|
||||
* preorder traversal of the document tree.
|
||||
* External function.
|
||||
* Parameters:
|
||||
* namespaceURI: the namespace of the elements to match on. The special
|
||||
* value "*" matches all namespaces.
|
||||
* localName: the local name of the elements to match on. The special
|
||||
* value "*" matches all local names.
|
||||
* Return Value:
|
||||
* A new nodeList object containing all the matched Elements.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_NodeList *
|
||||
ixmlDocument_getElementsByTagNameNS( IN IXML_Document * doc,
|
||||
IN const DOMString namespaceURI,
|
||||
IN const DOMString localName )
|
||||
|
||||
IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
|
||||
IXML_Document *doc,
|
||||
const DOMString namespaceURI,
|
||||
const DOMString localName)
|
||||
{
|
||||
IXML_NodeList *returnNodeList = NULL;
|
||||
|
||||
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
||||
|| ( localName == NULL ) ) {
|
||||
if (doc == NULL || namespaceURI == NULL || localName == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ixmlNode_getElementsByTagNameNS( ( IXML_Node * ) doc, namespaceURI,
|
||||
localName, &returnNodeList );
|
||||
ixmlNode_getElementsByTagNameNS(
|
||||
(IXML_Node *)doc, namespaceURI, localName, &returnNodeList);
|
||||
|
||||
return returnNodeList;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocument_getElementById
|
||||
* Returns the element whose ID is given by tagName. If no such
|
||||
* element exists, returns null.
|
||||
* External function.
|
||||
* Parameter:
|
||||
* tagName: the tag name for an element.
|
||||
* Return Values:
|
||||
* The matching element.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Element *
|
||||
ixmlDocument_getElementById( IN IXML_Document * doc,
|
||||
IN const DOMString tagName )
|
||||
|
||||
IXML_Element *ixmlDocument_getElementById(
|
||||
IXML_Document *doc,
|
||||
const DOMString tagName)
|
||||
{
|
||||
IXML_Element *rtElement = NULL;
|
||||
IXML_Node *nodeptr = (IXML_Node *)doc;
|
||||
const char *name;
|
||||
|
||||
if( ( nodeptr == NULL ) || ( tagName == NULL ) ) {
|
||||
if (nodeptr == NULL || tagName == NULL) {
|
||||
return rtElement;
|
||||
}
|
||||
|
||||
@@ -776,29 +558,26 @@ ixmlDocument_getElementById( IN IXML_Document * doc,
|
||||
rtElement = (IXML_Element *)nodeptr;
|
||||
return rtElement;
|
||||
} else {
|
||||
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
||||
ixmlNode_getFirstChild
|
||||
( nodeptr ),
|
||||
rtElement = ixmlDocument_getElementById(
|
||||
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
|
||||
tagName );
|
||||
if (rtElement == NULL) {
|
||||
rtElement = ixmlDocument_getElementById( ( IXML_Document
|
||||
* )
|
||||
ixmlNode_getNextSibling
|
||||
( nodeptr ),
|
||||
rtElement = ixmlDocument_getElementById(
|
||||
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
|
||||
tagName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
||||
ixmlNode_getFirstChild
|
||||
( nodeptr ), tagName );
|
||||
rtElement = ixmlDocument_getElementById(
|
||||
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
|
||||
tagName);
|
||||
if (rtElement == NULL) {
|
||||
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
||||
ixmlNode_getNextSibling
|
||||
( nodeptr ),
|
||||
rtElement = ixmlDocument_getElementById(
|
||||
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
|
||||
tagName);
|
||||
}
|
||||
}
|
||||
|
||||
return rtElement;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,77 +1,173 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_MEMBUF_H
|
||||
#define IXML_MEMBUF_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
#ifndef _IXML_MEMBUF_H
|
||||
#define _IXML_MEMBUF_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ixml.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for size_t */
|
||||
|
||||
|
||||
#define MINVAL(a, b) ( (a) < (b) ? (a) : (b) )
|
||||
#define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) )
|
||||
|
||||
#ifndef WIN32
|
||||
#define UPNP_INLINE inline
|
||||
#endif
|
||||
|
||||
#define MEMBUF_DEF_SIZE_INC 20
|
||||
|
||||
|
||||
typedef struct // ixml_membuf
|
||||
/*!
|
||||
* \brief The ixml_membuf type.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char *buf;
|
||||
|
||||
size_t length;
|
||||
size_t capacity;
|
||||
size_t size_inc;
|
||||
|
||||
} ixml_membuf;
|
||||
|
||||
//--------------------------------------------------
|
||||
//////////////// functions /////////////////////////
|
||||
//--------------------------------------------------
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/*!
|
||||
* \brief ixml_membuf initialization routine.
|
||||
*/
|
||||
void ixml_membuf_init(
|
||||
/*! [in,out] The memory buffer to initializa. */
|
||||
ixml_membuf *m);
|
||||
|
||||
void ixml_membuf_init(INOUT ixml_membuf *m);
|
||||
void ixml_membuf_destroy(INOUT ixml_membuf *m);
|
||||
int ixml_membuf_assign(INOUT ixml_membuf *m, IN const void *buf,
|
||||
IN size_t buf_len );
|
||||
int ixml_membuf_assign_str(INOUT ixml_membuf *m, IN const char *c_str );
|
||||
int ixml_membuf_append(INOUT ixml_membuf *m, IN const void *buf);
|
||||
int ixml_membuf_append_str(INOUT ixml_membuf *m, IN const char *c_str);
|
||||
int ixml_membuf_insert(INOUT ixml_membuf *m, IN const void* buf,
|
||||
IN size_t buf_len, int index );
|
||||
|
||||
#endif // _IXML_MEMBUF_H
|
||||
/*!
|
||||
* \brief ixml_membuf clearing routine.
|
||||
*
|
||||
* The internal buffer is deleted and ixml_membuf_init() is called in the end
|
||||
* to reinitialize the buffer.
|
||||
*/
|
||||
void ixml_membuf_destroy(
|
||||
/*! [in,out] The memory buffer to clear. */
|
||||
ixml_membuf *m);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Copies the contents o a buffer to the designated ixml_membuf.
|
||||
*
|
||||
* The previous contents of the ixml_membuf are destroyed.
|
||||
*
|
||||
* \return IXML_SUCCESS if successfull, or the error code returned
|
||||
* by ixml_membuf_set_size().
|
||||
*
|
||||
* \sa ixml_membuf_assign_str().
|
||||
*/
|
||||
int ixml_membuf_assign(
|
||||
/*! [in,out] The memory buffer on which to operate. */
|
||||
ixml_membuf *m,
|
||||
/*! [in] The input buffer to copy from. */
|
||||
const void *buf,
|
||||
/*! [in] The number of bytes to copy from the input buffer. */
|
||||
size_t buf_len);
|
||||
|
||||
/*!
|
||||
* \brief Copies a \b NULL terminated string to the ixml_buffer.
|
||||
*
|
||||
* This is a convenience function that internally uses ixml_membuf_assign().
|
||||
*
|
||||
* \return The return value of ixml_membuf_assign().
|
||||
*
|
||||
* \sa ixml_membuf_assign().
|
||||
*/
|
||||
int ixml_membuf_assign_str(
|
||||
/*! [in,out] The memory buffer on which to operate. */
|
||||
ixml_membuf *m,
|
||||
/*! [in] The input string to copy from. */
|
||||
const char *c_str);
|
||||
|
||||
/*!
|
||||
* \brief Appends one byte to the designated ixml_membuffer.
|
||||
*
|
||||
* This is a convenience function that internally uses ixml_membuf_insert().
|
||||
*
|
||||
* \return The return value of ixml_membuf_insert().
|
||||
*
|
||||
* \sa ixml_membuf_insert()
|
||||
*/
|
||||
int ixml_membuf_append(
|
||||
/*! [in,out] The memory buffer on which to operate. */
|
||||
ixml_membuf *m,
|
||||
/*! [in] The pointer to the byte to append. */
|
||||
const void *buf);
|
||||
|
||||
/*!
|
||||
* \brief Appends the contents of a \b NULL terminated string to the designated
|
||||
* ixml_membuf.
|
||||
*
|
||||
* This is a convenience function that internally uses ixml_membuf_insert().
|
||||
*
|
||||
* \return The return value of ixml_membuf_insert().
|
||||
*
|
||||
* \sa ixml_membuf_insert().
|
||||
*/
|
||||
int ixml_membuf_append_str(
|
||||
/*! [in,out] The memory buffer on which to operate. */
|
||||
ixml_membuf *m,
|
||||
/*! [in] The input string to copy from. */
|
||||
const char *c_str);
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*
|
||||
* \return
|
||||
* \li 0 if successfull.
|
||||
* \li IXML_INDEX_SIZE_ERR if the index parameter is out of range.
|
||||
* \li Or the return code of ixml_membuf_set_size()
|
||||
*
|
||||
* \sa ixml_membuf_set_size()
|
||||
*/
|
||||
int ixml_membuf_insert(
|
||||
/*! [in,out] The memory buffer on which to operate. */
|
||||
ixml_membuf *m,
|
||||
/*! [in] The pointer to the input buffer. */
|
||||
const void *buf,
|
||||
/*! [in] The buffer length. */
|
||||
size_t buf_len,
|
||||
/*! [in] The point of insertion relative to the beggining of the
|
||||
* ixml_membuf internal buffer. */
|
||||
int index);
|
||||
|
||||
|
||||
#endif /* IXML_MEMBUF_H */
|
||||
|
||||
|
||||
@@ -1,41 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 IXMLPARSER_H
|
||||
#define IXMLPARSER_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
#ifndef _IXMLPARSER_H
|
||||
#define _IXMLPARSER_H
|
||||
|
||||
#include "ixml.h"
|
||||
#include "ixmlmembuf.h"
|
||||
|
||||
// Parser definitions
|
||||
|
||||
/* Parser definitions */
|
||||
#define QUOT """
|
||||
#define LT "<"
|
||||
#define GT ">"
|
||||
@@ -44,6 +52,7 @@
|
||||
#define ESC_HEX "&#x"
|
||||
#define ESC_DEC "&#"
|
||||
|
||||
|
||||
typedef struct _IXML_NamespaceURI
|
||||
{
|
||||
char *nsURI;
|
||||
@@ -69,52 +78,192 @@ typedef enum
|
||||
eCONTENT,
|
||||
} PARSER_STATE;
|
||||
|
||||
|
||||
typedef struct _Parser
|
||||
{
|
||||
char *dataBuffer; //data buffer
|
||||
char *curPtr; //ptr to the token parsed
|
||||
char *savePtr; //Saves for backup
|
||||
/*! Data buffer. */
|
||||
char *dataBuffer;
|
||||
/*! Pointer to the token parsed. */
|
||||
char *curPtr;
|
||||
/*! Saves for backup. */
|
||||
char *savePtr;
|
||||
ixml_membuf lastElem;
|
||||
ixml_membuf tokenBuf;
|
||||
|
||||
IXML_Node *pNeedPrefixNode;
|
||||
IXML_ElementStack *pCurElement;
|
||||
IXML_Node *currentNodePtr;
|
||||
PARSER_STATE state;
|
||||
|
||||
BOOL bHasTopLevel;
|
||||
|
||||
} Parser;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Check to see whether name is a valid xml name.
|
||||
*/
|
||||
BOOL Parser_isValidXmlName(
|
||||
/*! [in] The string to be checked. */
|
||||
const DOMString name);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Sets the error character.
|
||||
*
|
||||
* If 'c' is 0 (default), the parser is strict about XML encoding:
|
||||
* invalid UTF-8 sequences or "&" entities are rejected, and the parsing
|
||||
* aborts.
|
||||
*
|
||||
* If 'c' is not 0, the parser is relaxed: invalid UTF-8 characters
|
||||
* are replaced by this character, and invalid "&" entities are left
|
||||
* untranslated. The parsing is then allowed to continue.
|
||||
*/
|
||||
void Parser_setErrorChar(
|
||||
/*! [in] The character to become the error character. */
|
||||
char c);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Fees a node contents.
|
||||
*/
|
||||
void Parser_freeNodeContent(
|
||||
/*! [in] The Node to process. */
|
||||
IXML_Node *IXML_Nodeptr);
|
||||
|
||||
int Parser_LoadDocument(IXML_Document **retDoc, const char * xmlFile, BOOL file);
|
||||
BOOL Parser_isValidXmlName( const DOMString name);
|
||||
|
||||
int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
|
||||
void Parser_freeNodeContent( IXML_Node *IXML_Nodeptr);
|
||||
|
||||
void Parser_setErrorChar( char c );
|
||||
|
||||
void ixmlAttr_free(IXML_Attr *attrNode);
|
||||
void ixmlAttr_init(IXML_Attr *attrNode);
|
||||
|
||||
int ixmlElement_setTagName(IXML_Element *element, const char *tagName);
|
||||
/*!
|
||||
* \brief Set the given element's tagName.
|
||||
*
|
||||
* \return One of the following:
|
||||
* \li \b IXML_SUCCESS, if successfull.
|
||||
* \li \b IXML_FAILED, if element of tagname is \b NULL.
|
||||
* \li \b IXML_INSUFFICIENT_MEMORY, if there is no memory to allocate the
|
||||
* buffer for the element's tagname.
|
||||
*/
|
||||
int ixmlElement_setTagName(
|
||||
/*! [in] The element to change the tagname. */
|
||||
IXML_Element *element,
|
||||
/*! [in] The new tagName for the element. */
|
||||
const char *tagName);
|
||||
|
||||
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap);
|
||||
int ixmlNamedNodeMap_addToNamedNodeMap(IXML_NamedNodeMap **nnMap, IXML_Node *add);
|
||||
|
||||
void ixmlNode_init(IXML_Node *IXML_Nodeptr);
|
||||
BOOL ixmlNode_compare(IXML_Node *srcIXML_Node, IXML_Node *destIXML_Node);
|
||||
/*!
|
||||
* \brief Initializes a NamedNodeMap object.
|
||||
*/
|
||||
void ixmlNamedNodeMap_init(
|
||||
/*! [in] The named node map to process. */
|
||||
IXML_NamedNodeMap *nnMap);
|
||||
|
||||
void ixmlNode_getElementsByTagName( IXML_Node *n, const char *tagname, IXML_NodeList **list);
|
||||
void ixmlNode_getElementsByTagNameNS( IXML_Node *IXML_Node, const char *namespaceURI,
|
||||
const char *localName, IXML_NodeList **list);
|
||||
|
||||
int ixmlNode_setNodeProperties(IXML_Node* node, IXML_Node *src);
|
||||
int ixmlNode_setNodeName( IXML_Node* node, const DOMString qualifiedName);
|
||||
/*!
|
||||
* \brief Add a node to a NamedNodeMap.
|
||||
*
|
||||
* \return IXML_SUCCESS or failure.
|
||||
*/
|
||||
int ixmlNamedNodeMap_addToNamedNodeMap(
|
||||
/* [in] The named node map. */
|
||||
IXML_NamedNodeMap **nnMap,
|
||||
/* [in] The node to add. */
|
||||
IXML_Node *add);
|
||||
|
||||
void ixmlNodeList_init(IXML_NodeList *nList);
|
||||
int ixmlNodeList_addToNodeList(IXML_NodeList **nList, IXML_Node *add);
|
||||
/*!
|
||||
* \brief Add a node to nodelist.
|
||||
*/
|
||||
int ixmlNodeList_addToNodeList(
|
||||
/*! [in] The pointer to the nodelist. */
|
||||
IXML_NodeList **nList,
|
||||
/*! [in] The node to add. */
|
||||
IXML_Node *add);
|
||||
|
||||
#endif // _IXMLPARSER_H
|
||||
|
||||
/*!
|
||||
* \brief Intializes a node.
|
||||
*/
|
||||
void ixmlNode_init(
|
||||
/*! [in] The \b Node to iniatialize. */
|
||||
IN IXML_Node *nodeptr);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Compare two nodes to see whether they are the same node.
|
||||
* Parent, sibling and children node are ignored.
|
||||
*
|
||||
* \return
|
||||
* \li TRUE, the two nodes are the same.
|
||||
* \li FALSE, the two nodes are not the same.
|
||||
*/
|
||||
BOOL ixmlNode_compare(
|
||||
/*! [in] The first \b Node. */
|
||||
IXML_Node *srcNode,
|
||||
/*! [in] The second \b Node. */
|
||||
IXML_Node *destNode);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Returns a nodeList of all descendant Elements with a given tagName,
|
||||
* in the order in which they are encountered in a traversal of this element
|
||||
* tree.
|
||||
*/
|
||||
void ixmlNode_getElementsByTagName(
|
||||
/*! [in] The \b Node tree. */
|
||||
IXML_Node *n,
|
||||
/*! [in] The tag name to match. */
|
||||
const char *tagname,
|
||||
/*! [out] The output \b NodeList. */
|
||||
IXML_NodeList **list);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Returns a nodeList of all the descendant Elements with a given local
|
||||
* name and namespace URI in the order in which they are encountered in a
|
||||
* preorder traversal of this Elememt tree.
|
||||
*/
|
||||
void ixmlNode_getElementsByTagNameNS(
|
||||
/*! [in] The \b Element tree. */
|
||||
IXML_Node *n,
|
||||
/*! [in] The name space to match. */
|
||||
const char *namespaceURI,
|
||||
/*! [in] The local name to match. */
|
||||
const char *localName,
|
||||
/*! [out] The output \b NodeList. */
|
||||
IXML_NodeList **list);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*
|
||||
* \return
|
||||
*/
|
||||
int ixmlNode_setNodeName(
|
||||
/*! [in] The \b Node. */
|
||||
IXML_Node *node,
|
||||
/*! [in] . */
|
||||
const DOMString qualifiedName);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*
|
||||
* \return
|
||||
*/
|
||||
int ixmlNode_setNodeProperties(
|
||||
/*! [in] . */
|
||||
IXML_Node *destNode,
|
||||
/*! [in] . */
|
||||
IXML_Node *src);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Initializes a nodelist
|
||||
*/
|
||||
void ixmlNodeList_init(
|
||||
/*! [in,out] The \b NodeList to initialize. */
|
||||
IXML_NodeList *nList);
|
||||
|
||||
|
||||
#endif /* IXMLPARSER_H */
|
||||
|
||||
|
||||
346
ixml/src/ixml.c
346
ixml/src/ixml.c
@@ -1,51 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "ixmldebug.h"
|
||||
#include "ixmlmembuf.h"
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* copy_with_escape
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
static void
|
||||
copy_with_escape( INOUT ixml_membuf * buf,
|
||||
IN const char *p )
|
||||
|
||||
#include <stdlib.h> /* for free() */
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Appends a string to a buffer, substituting some characters by escape
|
||||
* sequences.
|
||||
*/
|
||||
static void copy_with_escape(
|
||||
/*! [in,out] The input/output buffer. */
|
||||
ixml_membuf *buf,
|
||||
/*! [in] The string to copy from. */
|
||||
const char *p)
|
||||
{
|
||||
int i;
|
||||
int plen;
|
||||
|
||||
if( p == NULL )
|
||||
if (p == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
plen = strlen( p );
|
||||
|
||||
@@ -73,19 +87,21 @@ copy_with_escape( INOUT ixml_membuf * buf,
|
||||
|
||||
default:
|
||||
ixml_membuf_append(buf, &p[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlPrintDomTreeRecursive
|
||||
* It is a recursive function to print all the node in a tree.
|
||||
|
||||
/*!
|
||||
* \brief Recursive function to print all the node in a tree.
|
||||
* Internal to parser only.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
||||
IN ixml_membuf * buf )
|
||||
*/
|
||||
static void ixmlPrintDomTreeRecursive(
|
||||
/*! [in] \todo documentation. */
|
||||
IXML_Node *nodeptr,
|
||||
/*! [in] \todo documentation. */
|
||||
ixml_membuf *buf)
|
||||
{
|
||||
const char *nodeName = NULL;
|
||||
const char *nodeValue = NULL;
|
||||
@@ -97,7 +113,6 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
||||
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
||||
|
||||
switch (ixmlNode_getNodeType(nodeptr)) {
|
||||
|
||||
case eTEXT_NODE:
|
||||
copy_with_escape(buf, nodeValue);
|
||||
break;
|
||||
@@ -117,8 +132,8 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
||||
break;
|
||||
|
||||
case eDOCUMENT_NODE:
|
||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
||||
( nodeptr ), buf );
|
||||
ixmlPrintDomTreeRecursive(
|
||||
ixmlNode_getFirstChild(nodeptr), buf);
|
||||
break;
|
||||
|
||||
case eATTRIBUTE_NODE:
|
||||
@@ -126,7 +141,6 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
||||
ixml_membuf_append_str(buf, "=\"");
|
||||
copy_with_escape(buf, nodeValue);
|
||||
ixml_membuf_append_str(buf, "\"");
|
||||
|
||||
if (nodeptr->nextSibling != NULL) {
|
||||
ixml_membuf_append_str(buf, " ");
|
||||
ixmlPrintDomTreeRecursive(nodeptr->nextSibling, buf);
|
||||
@@ -136,71 +150,69 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
||||
case eELEMENT_NODE:
|
||||
ixml_membuf_append_str(buf, "<");
|
||||
ixml_membuf_append_str(buf, nodeName);
|
||||
|
||||
if (nodeptr->firstAttr != NULL) {
|
||||
ixml_membuf_append_str(buf, " ");
|
||||
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
||||
}
|
||||
|
||||
child = ixmlNode_getFirstChild(nodeptr);
|
||||
if( ( child != NULL )
|
||||
&& ( ixmlNode_getNodeType( child ) ==
|
||||
eELEMENT_NODE ) ) {
|
||||
if (child != NULL &&
|
||||
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
||||
ixml_membuf_append_str(buf, ">\r\n");
|
||||
} else {
|
||||
ixml_membuf_append_str(buf, ">");
|
||||
}
|
||||
|
||||
// output the children
|
||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
||||
( nodeptr ), buf );
|
||||
ixmlPrintDomTreeRecursive(
|
||||
ixmlNode_getFirstChild(nodeptr), buf);
|
||||
|
||||
// Done with children. Output the end tag.
|
||||
ixml_membuf_append_str(buf, "</");
|
||||
ixml_membuf_append_str(buf, nodeName);
|
||||
|
||||
sibling = ixmlNode_getNextSibling(nodeptr);
|
||||
if( sibling != NULL
|
||||
&& ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) {
|
||||
if (sibling != NULL &&
|
||||
ixmlNode_getNodeType(sibling) == eTEXT_NODE) {
|
||||
ixml_membuf_append_str( buf, ">" );
|
||||
} else {
|
||||
ixml_membuf_append_str( buf, ">\r\n" );
|
||||
}
|
||||
ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling
|
||||
( nodeptr ), buf );
|
||||
ixmlPrintDomTreeRecursive(
|
||||
ixmlNode_getNextSibling(nodeptr), buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTreeRecursive",
|
||||
"Warning, unknown node type %d\n",
|
||||
ixmlNode_getNodeType(nodeptr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlPrintDomTree
|
||||
* Print a DOM tree.
|
||||
* Element, and Attribute nodes are handled differently.
|
||||
* We don't want to print the Element and Attribute nodes' sibling.
|
||||
* External function.
|
||||
|
||||
/*!
|
||||
* \brief Print a DOM tree.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
||||
IN ixml_membuf * buf )
|
||||
* Element, and Attribute nodes are handled differently. We don't want to print
|
||||
* the Element and Attribute nodes' sibling.
|
||||
*/
|
||||
static void ixmlPrintDomTree(
|
||||
/*! [in] \todo documentation. */
|
||||
IXML_Node *nodeptr,
|
||||
/*! [in] \todo documentation. */
|
||||
ixml_membuf *buf)
|
||||
{
|
||||
const char *nodeName = NULL;
|
||||
const char *nodeValue = NULL;
|
||||
IXML_Node *child = NULL;
|
||||
|
||||
if( ( nodeptr == NULL ) || ( buf == NULL ) ) {
|
||||
if (nodeptr == NULL || buf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
nodeName = (const char *)ixmlNode_getNodeName(nodeptr);
|
||||
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
||||
|
||||
switch (ixmlNode_getNodeType(nodeptr)) {
|
||||
|
||||
case eTEXT_NODE:
|
||||
case eCDATA_SECTION_NODE:
|
||||
case ePROCESSING_INSTRUCTION_NODE:
|
||||
@@ -218,23 +230,21 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
||||
case eELEMENT_NODE:
|
||||
ixml_membuf_append_str(buf, "<");
|
||||
ixml_membuf_append_str(buf, nodeName);
|
||||
|
||||
if (nodeptr->firstAttr != NULL) {
|
||||
ixml_membuf_append_str(buf, " ");
|
||||
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
||||
}
|
||||
|
||||
child = ixmlNode_getFirstChild(nodeptr);
|
||||
if( ( child != NULL )
|
||||
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
||||
if (child != NULL &&
|
||||
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
||||
ixml_membuf_append_str(buf, ">\r\n");
|
||||
} else {
|
||||
ixml_membuf_append_str(buf, ">");
|
||||
}
|
||||
|
||||
// output the children
|
||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ),
|
||||
buf );
|
||||
ixmlPrintDomTreeRecursive(
|
||||
ixmlNode_getFirstChild(nodeptr), buf);
|
||||
|
||||
// Done with children. Output the end tag.
|
||||
ixml_membuf_append_str(buf, "</");
|
||||
@@ -243,27 +253,31 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
||||
break;
|
||||
|
||||
default:
|
||||
IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTree",
|
||||
"Warning, unknown node type %d\n",
|
||||
ixmlNode_getNodeType(nodeptr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDomTreetoString
|
||||
* Converts a DOM tree into a text string
|
||||
* Element, and Attribute nodes are handled differently.
|
||||
* We don't want to print the Element and Attribute nodes' sibling.
|
||||
* External function.
|
||||
|
||||
/*!
|
||||
* \brief Converts a DOM tree into a text string.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
||||
IN ixml_membuf * buf )
|
||||
* Element, and Attribute nodes are handled differently. We don't want to print
|
||||
* the Element and Attribute nodes' sibling.
|
||||
*/
|
||||
static void ixmlDomTreetoString(
|
||||
/*! [in] \todo documentation. */
|
||||
IXML_Node *nodeptr,
|
||||
/*! [in] \todo documentation. */
|
||||
ixml_membuf *buf)
|
||||
{
|
||||
const char *nodeName = NULL;
|
||||
const char *nodeValue = NULL;
|
||||
IXML_Node *child = NULL;
|
||||
|
||||
if( ( nodeptr == NULL ) || ( buf == NULL ) ) {
|
||||
if (nodeptr == NULL || buf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -271,7 +285,6 @@ ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
||||
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
||||
|
||||
switch (ixmlNode_getNodeType(nodeptr)) {
|
||||
|
||||
case eTEXT_NODE:
|
||||
case eCDATA_SECTION_NODE:
|
||||
case ePROCESSING_INSTRUCTION_NODE:
|
||||
@@ -289,23 +302,20 @@ ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
||||
case eELEMENT_NODE:
|
||||
ixml_membuf_append_str(buf, "<");
|
||||
ixml_membuf_append_str(buf, nodeName);
|
||||
|
||||
if (nodeptr->firstAttr != NULL) {
|
||||
ixml_membuf_append_str(buf, " ");
|
||||
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
||||
}
|
||||
|
||||
child = ixmlNode_getFirstChild(nodeptr);
|
||||
if( ( child != NULL )
|
||||
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
||||
if (child != NULL &&
|
||||
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
||||
ixml_membuf_append_str(buf, ">");
|
||||
} else {
|
||||
ixml_membuf_append_str(buf, ">");
|
||||
}
|
||||
|
||||
// output the children
|
||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ),
|
||||
buf );
|
||||
ixmlPrintDomTreeRecursive(ixmlNode_getFirstChild(nodeptr), buf);
|
||||
|
||||
// Done with children. Output the end tag.
|
||||
ixml_membuf_append_str(buf, "</");
|
||||
@@ -314,54 +324,35 @@ ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
||||
break;
|
||||
|
||||
default:
|
||||
IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTreeRecursive",
|
||||
"Warning, unknown node type %d\n",
|
||||
ixmlNode_getNodeType(nodeptr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlLoadDocumentEx
|
||||
* Parses the given file, and returns the DOM tree from it.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlLoadDocumentEx( IN const char *xmlFile,
|
||||
IXML_Document ** doc )
|
||||
{
|
||||
|
||||
if( ( xmlFile == NULL ) || ( doc == NULL ) ) {
|
||||
int ixmlLoadDocumentEx(const char *xmlFile, IXML_Document **doc)
|
||||
{
|
||||
if (xmlFile == NULL || doc == NULL) {
|
||||
return IXML_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return Parser_LoadDocument(doc, xmlFile, TRUE);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlLoadDocument
|
||||
* Parses the given file, and returns the DOM tree from it.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Document *
|
||||
ixmlLoadDocument( IN const char *xmlFile )
|
||||
{
|
||||
|
||||
IXML_Document *ixmlLoadDocument(const char *xmlFile)
|
||||
{
|
||||
IXML_Document *doc = NULL;
|
||||
|
||||
ixmlLoadDocumentEx(xmlFile, &doc);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlPrintDocument
|
||||
* Prints entire document, prepending XML prolog first.
|
||||
* Puts lots of white spaces.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
|
||||
DOMString
|
||||
ixmlPrintDocument(IXML_Document *doc)
|
||||
DOMString ixmlPrintDocument(IXML_Document *doc)
|
||||
{
|
||||
IXML_Node* rootNode = (IXML_Node *)doc;
|
||||
ixml_membuf memBuf;
|
||||
@@ -374,20 +365,13 @@ ixmlPrintDocument(IXML_Document *doc)
|
||||
ixml_membuf_init(buf);
|
||||
ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n");
|
||||
ixmlPrintDomTree(rootNode, buf);
|
||||
return buf->buf;
|
||||
|
||||
return buf->buf;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlPrintNode
|
||||
* Print DOM tree under node. Puts lots of white spaces
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
DOMString
|
||||
ixmlPrintNode( IN IXML_Node * node )
|
||||
{
|
||||
|
||||
DOMString ixmlPrintNode(IXML_Node *node)
|
||||
{
|
||||
ixml_membuf memBuf;
|
||||
ixml_membuf *buf = &memBuf;
|
||||
|
||||
@@ -397,20 +381,12 @@ ixmlPrintNode( IN IXML_Node * node )
|
||||
|
||||
ixml_membuf_init(buf);
|
||||
ixmlPrintDomTree(node, buf);
|
||||
return buf->buf;
|
||||
|
||||
return buf->buf;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlDocumenttoString
|
||||
* converts DOM tree under node to text string,
|
||||
* prepending XML prolog first.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
|
||||
DOMString
|
||||
ixmlDocumenttoString(IXML_Document *doc)
|
||||
DOMString ixmlDocumenttoString(IXML_Document *doc)
|
||||
{
|
||||
IXML_Node* rootNode = (IXML_Node *)doc;
|
||||
ixml_membuf memBuf;
|
||||
@@ -423,20 +399,13 @@ ixmlDocumenttoString(IXML_Document *doc)
|
||||
ixml_membuf_init(buf);
|
||||
ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n");
|
||||
ixmlDomTreetoString(rootNode, buf);
|
||||
return buf->buf;
|
||||
|
||||
return buf->buf;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlNodetoString
|
||||
* converts DOM tree under node to text string
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
DOMString
|
||||
ixmlNodetoString( IN IXML_Node * node )
|
||||
{
|
||||
|
||||
DOMString ixmlNodetoString(IXML_Node *node)
|
||||
{
|
||||
ixml_membuf memBuf;
|
||||
ixml_membuf *buf = &memBuf;
|
||||
|
||||
@@ -446,35 +415,20 @@ ixmlNodetoString( IN IXML_Node * node )
|
||||
|
||||
ixml_membuf_init(buf);
|
||||
ixmlDomTreetoString(node, buf);
|
||||
return buf->buf;
|
||||
|
||||
return buf->buf;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlRelaxParser
|
||||
* Makes the XML parser more tolerant to malformed text.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlRelaxParser(char errorChar)
|
||||
|
||||
void ixmlRelaxParser(char errorChar)
|
||||
{
|
||||
Parser_setErrorChar(errorChar);
|
||||
}
|
||||
|
||||
|
||||
/*================================================================
|
||||
* ixmlParseBufferEx
|
||||
* Parse xml file stored in buffer.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlParseBufferEx( IN const char *buffer,
|
||||
IXML_Document ** retDoc )
|
||||
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
|
||||
{
|
||||
|
||||
if( ( buffer == NULL ) || ( retDoc == NULL ) ) {
|
||||
if (buffer == NULL || retDoc == NULL) {
|
||||
return IXML_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -485,47 +439,31 @@ ixmlParseBufferEx( IN const char *buffer,
|
||||
return Parser_LoadDocument(retDoc, buffer, FALSE);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlParseBuffer
|
||||
* Parse xml file stored in buffer.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Document *
|
||||
ixmlParseBuffer( IN const char *buffer )
|
||||
|
||||
IXML_Document *ixmlParseBuffer(const char *buffer)
|
||||
{
|
||||
IXML_Document *doc = NULL;
|
||||
|
||||
ixmlParseBufferEx(buffer, &doc);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlCloneDOMString
|
||||
* Clones a DOM String.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
DOMString
|
||||
ixmlCloneDOMString( IN const DOMString src )
|
||||
|
||||
DOMString ixmlCloneDOMString(const DOMString src)
|
||||
{
|
||||
if (src == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ( strdup( src ) );
|
||||
return strdup(src);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlFreeDOMString
|
||||
* Frees a DOM String.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlFreeDOMString( IN DOMString buf )
|
||||
|
||||
void ixmlFreeDOMString(DOMString buf)
|
||||
{
|
||||
if (buf != NULL) {
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
70
ixml/src/ixmldebug.c
Normal file
70
ixml/src/ixmldebug.c
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "autoconfig.h"
|
||||
|
||||
|
||||
#include "ixmldebug.h"
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
void IxmlPrintf(
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *FunctionName,
|
||||
const char *FmtStr,
|
||||
...)
|
||||
{
|
||||
va_list ArgList;
|
||||
|
||||
FILE *fp = stdout;
|
||||
fprintf(fp, "(%s::%s), line %d", DbgFileName, FunctionName, DbgLineNo);
|
||||
if (FmtStr) {
|
||||
fprintf(fp, ": ");
|
||||
va_start(ArgList, FmtStr);
|
||||
vfprintf(fp, FmtStr, ArgList);
|
||||
fflush(fp);
|
||||
va_end(ArgList);
|
||||
} else {
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void printNodes(IXML_Node *tmpRoot, int depth)
|
||||
{
|
||||
int i;
|
||||
IXML_NodeList *NodeList1;
|
||||
IXML_Node *ChildNode1;
|
||||
unsigned short NodeType;
|
||||
const DOMString NodeValue;
|
||||
const DOMString NodeName;
|
||||
NodeList1 = ixmlNode_getChildNodes(tmpRoot);
|
||||
for (i = 0; i < 100; ++i) {
|
||||
ChildNode1 = ixmlNodeList_item(NodeList1, i);
|
||||
if (ChildNode1 == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
printNodes(ChildNode1, depth+1);
|
||||
NodeType = ixmlNode_getNodeType(ChildNode1);
|
||||
NodeValue = ixmlNode_getNodeValue(ChildNode1);
|
||||
NodeName = ixmlNode_getNodeName(ChildNode1);
|
||||
IxmlPrintf(__FILE__, __LINE__, "printNodes",
|
||||
"DEPTH-%2d-IXML_Node Type %d, "
|
||||
"IXML_Node Name: %s, IXML_Node Value: %s\n",
|
||||
depth, NodeType, NodeName, NodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,79 +1,87 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "ixmlmembuf.h"
|
||||
#include "ixml.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ixmlmembuf.h"
|
||||
#include "ixml.h"
|
||||
|
||||
/*================================================================
|
||||
* ixml_membuf_set_size
|
||||
*
|
||||
* Increases or decreases buffer cap so that at least
|
||||
* 'new_length' bytes can be stored
|
||||
|
||||
/*!
|
||||
* \brief Increases or decreases buffer capacity so that at least 'new_length'
|
||||
* bytes can be stored.
|
||||
*
|
||||
* On error, m's fields do not change.
|
||||
*
|
||||
* returns:
|
||||
* UPNP_E_SUCCESS
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
*
|
||||
*=================================================================*/
|
||||
static int
|
||||
ixml_membuf_set_size( INOUT ixml_membuf * m,
|
||||
* \return
|
||||
* \li UPNP_E_SUCCESS
|
||||
* \li UPNP_E_OUTOF_MEMORY
|
||||
*/
|
||||
static int ixml_membuf_set_size(
|
||||
/*! [in,out] The memory buffer. */
|
||||
INOUT ixml_membuf *m,
|
||||
/*! [in] The new lenght. */
|
||||
IN size_t new_length)
|
||||
{
|
||||
size_t diff;
|
||||
size_t alloc_len;
|
||||
char *temp_buf;
|
||||
|
||||
if( new_length >= m->length ) // increase length
|
||||
{
|
||||
// need more mem?
|
||||
if (new_length >= m->length) {
|
||||
/* increase length */
|
||||
/* need more mem? */
|
||||
if (new_length <= m->capacity) {
|
||||
return 0; // have enough mem; done
|
||||
/* have enough mem; done */
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff = new_length - m->length;
|
||||
alloc_len = MAXVAL(m->size_inc, diff) + m->capacity;
|
||||
} else // decrease length
|
||||
{
|
||||
} else {
|
||||
// decrease length
|
||||
assert(new_length <= m->length);
|
||||
|
||||
// if diff is 0..m->size_inc, don't free
|
||||
if ((m->capacity - new_length) <= m->size_inc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
alloc_len = new_length + m->size_inc;
|
||||
}
|
||||
|
||||
@@ -81,27 +89,22 @@ ixml_membuf_set_size( INOUT ixml_membuf * m,
|
||||
|
||||
temp_buf = realloc(m->buf, alloc_len + 1);
|
||||
if (temp_buf == NULL) {
|
||||
// try smaller size
|
||||
/* try smaller size */
|
||||
alloc_len = new_length;
|
||||
temp_buf = realloc(m->buf, alloc_len + 1);
|
||||
|
||||
if (temp_buf == NULL) {
|
||||
return IXML_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
}
|
||||
// save
|
||||
/* save */
|
||||
m->buf = temp_buf;
|
||||
m->capacity = alloc_len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* membuffer_init
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixml_membuf_init( INOUT ixml_membuf * m )
|
||||
|
||||
void ixml_membuf_init(ixml_membuf *m)
|
||||
{
|
||||
assert(m != NULL);
|
||||
|
||||
@@ -111,13 +114,8 @@ ixml_membuf_init( INOUT ixml_membuf * m )
|
||||
m->capacity = 0;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* membuffer_destroy
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixml_membuf_destroy( INOUT ixml_membuf * m )
|
||||
|
||||
void ixml_membuf_destroy(ixml_membuf *m)
|
||||
{
|
||||
if (m == NULL) {
|
||||
return;
|
||||
@@ -127,15 +125,11 @@ ixml_membuf_destroy( INOUT ixml_membuf * m )
|
||||
ixml_membuf_init(m);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixml_membuf_assign
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixml_membuf_assign( INOUT ixml_membuf * m,
|
||||
IN const void *buf,
|
||||
IN size_t buf_len )
|
||||
|
||||
int ixml_membuf_assign(
|
||||
ixml_membuf *m,
|
||||
const void *buf,
|
||||
size_t buf_len)
|
||||
{
|
||||
int return_code;
|
||||
|
||||
@@ -151,35 +145,28 @@ ixml_membuf_assign( INOUT ixml_membuf * m,
|
||||
if (return_code != 0) {
|
||||
return return_code;
|
||||
}
|
||||
|
||||
// copy
|
||||
memcpy(m->buf, buf, buf_len);
|
||||
m->buf[buf_len] = 0; // null-terminate
|
||||
|
||||
// null-terminate
|
||||
m->buf[buf_len] = 0;
|
||||
m->length = buf_len;
|
||||
|
||||
return IXML_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixml_membuf_assign_str
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixml_membuf_assign_str( INOUT ixml_membuf * m,
|
||||
IN const char *c_str )
|
||||
|
||||
int ixml_membuf_assign_str(
|
||||
ixml_membuf *m,
|
||||
const char *c_str)
|
||||
{
|
||||
return ixml_membuf_assign(m, c_str, strlen(c_str));
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixml_membuf_append
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixml_membuf_append( INOUT ixml_membuf * m,
|
||||
|
||||
int ixml_membuf_append(
|
||||
INOUT ixml_membuf *m,
|
||||
IN const void *buf)
|
||||
{
|
||||
assert(m != NULL);
|
||||
@@ -187,50 +174,45 @@ ixml_membuf_append( INOUT ixml_membuf * m,
|
||||
return ixml_membuf_insert(m, buf, 1, m->length);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixml_membuf_append_str
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixml_membuf_append_str( INOUT ixml_membuf * m,
|
||||
|
||||
int ixml_membuf_append_str(
|
||||
INOUT ixml_membuf *m,
|
||||
IN const char *c_str)
|
||||
{
|
||||
return ixml_membuf_insert(m, c_str, strlen(c_str), m->length);
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixml_membuf_insert
|
||||
*
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixml_membuf_insert( INOUT ixml_membuf * m,
|
||||
|
||||
int ixml_membuf_insert(
|
||||
INOUT ixml_membuf *m,
|
||||
IN const void *buf,
|
||||
IN size_t buf_len,
|
||||
int index)
|
||||
{
|
||||
int return_code;
|
||||
int return_code = 0;
|
||||
|
||||
assert(m != NULL);
|
||||
|
||||
if( index < 0 || index > ( int )m->length )
|
||||
if (index < 0 || index > (int)m->length) {
|
||||
return IXML_INDEX_SIZE_ERR;
|
||||
}
|
||||
|
||||
if (buf == NULL || buf_len == 0) {
|
||||
return 0;
|
||||
}
|
||||
// alloc mem
|
||||
/* alloc mem */
|
||||
return_code = ixml_membuf_set_size(m, m->length + buf_len);
|
||||
if (return_code != 0) {
|
||||
return return_code;
|
||||
}
|
||||
// insert data
|
||||
// move data to right of insertion point
|
||||
/* insert data */
|
||||
/* move data to right of insertion point */
|
||||
memmove(m->buf + index + buf_len, m->buf + index, m->length - index);
|
||||
memcpy(m->buf + index, buf, buf_len);
|
||||
m->length += buf_len;
|
||||
m->buf[m->length] = 0; // null-terminate
|
||||
/* Null terminate */
|
||||
m->buf[m->length] = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,53 +1,62 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* NamedNodeMap_getItemNumber
|
||||
* return the item number of a item in NamedNodeMap.
|
||||
* Internal to parser only.
|
||||
* Parameters:
|
||||
* name: the name of the item to find
|
||||
*
|
||||
*=================================================================*/
|
||||
unsigned long
|
||||
ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h> /* for free(), malloc() */
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Return the item number of a item in NamedNodeMap.
|
||||
*/
|
||||
static unsigned long ixmlNamedNodeMap_getItemNumber(
|
||||
/*! [in] The named node map to process. */
|
||||
IN IXML_NamedNodeMap *nnMap,
|
||||
/*! [in] The name of the item to find. */
|
||||
IN const char *name)
|
||||
{
|
||||
IXML_Node *tempNode;
|
||||
unsigned long returnItemNo = 0;
|
||||
|
||||
assert(nnMap != NULL && name != NULL);
|
||||
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
||||
if (nnMap == NULL || name == NULL) {
|
||||
return IXML_INVALID_ITEM_NUMBER;
|
||||
}
|
||||
|
||||
@@ -56,7 +65,6 @@ ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
||||
if (strcmp(name, tempNode->nodeName) == 0) {
|
||||
return returnItemNo;
|
||||
}
|
||||
|
||||
tempNode = tempNode->nextSibling;
|
||||
returnItemNo++;
|
||||
}
|
||||
@@ -64,39 +72,22 @@ ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
||||
return IXML_INVALID_ITEM_NUMBER;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* NamedNodeMap_init
|
||||
* Initializes a NamedNodeMap object.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlNamedNodeMap_init( IN IXML_NamedNodeMap * nnMap )
|
||||
|
||||
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap)
|
||||
{
|
||||
assert(nnMap != NULL);
|
||||
|
||||
memset(nnMap, 0, sizeof (IXML_NamedNodeMap));
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* NamedNodeMap_getNamedItem
|
||||
* Retrieves a node specified by name.
|
||||
* External function.
|
||||
*
|
||||
* Parameter:
|
||||
* name: type nodeName of a node to retrieve.
|
||||
*
|
||||
* Return Value:
|
||||
* A Node with the specified nodeName, or null if it
|
||||
* does not identify any node in this map.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Node *
|
||||
ixmlNamedNodeMap_getNamedItem( IN IXML_NamedNodeMap * nnMap,
|
||||
IN const char *name )
|
||||
|
||||
IXML_Node *ixmlNamedNodeMap_getNamedItem(
|
||||
IXML_NamedNodeMap *nnMap,
|
||||
const DOMString name)
|
||||
{
|
||||
long index;
|
||||
|
||||
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
||||
if (nnMap == NULL || name == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -104,26 +95,13 @@ ixmlNamedNodeMap_getNamedItem( IN IXML_NamedNodeMap * nnMap,
|
||||
if (index == IXML_INVALID_ITEM_NUMBER) {
|
||||
return NULL;
|
||||
} else {
|
||||
return ( ixmlNamedNodeMap_item( nnMap, ( unsigned long )index ) );
|
||||
return ixmlNamedNodeMap_item(nnMap, (unsigned long)index);
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* NamedNodeMap_item
|
||||
* Returns the indexth item in the map. If index is greater than or
|
||||
* equal to the number of nodes in this map, this returns null.
|
||||
* External function.
|
||||
*
|
||||
* Parameter:
|
||||
* index: index into this map.
|
||||
*
|
||||
* Return Value:
|
||||
* The node at the indexth position in the map, or null if that is
|
||||
* not a valid index.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Node *
|
||||
ixmlNamedNodeMap_item( IN IXML_NamedNodeMap * nnMap,
|
||||
|
||||
IXML_Node *ixmlNamedNodeMap_item(
|
||||
IN IXML_NamedNodeMap *nnMap,
|
||||
IN unsigned long index )
|
||||
{
|
||||
IXML_Node *tempNode;
|
||||
@@ -145,16 +123,8 @@ ixmlNamedNodeMap_item( IN IXML_NamedNodeMap * nnMap,
|
||||
return tempNode;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* NamedNodeMap_getLength
|
||||
* Return the number of Nodes in this map.
|
||||
* External function.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
*=================================================================*/
|
||||
unsigned long
|
||||
ixmlNamedNodeMap_getLength( IN IXML_NamedNodeMap * nnMap )
|
||||
|
||||
unsigned long ixmlNamedNodeMap_getLength(IXML_NamedNodeMap *nnMap)
|
||||
{
|
||||
IXML_Node *tempNode;
|
||||
unsigned long length = 0;
|
||||
@@ -165,17 +135,12 @@ ixmlNamedNodeMap_getLength( IN IXML_NamedNodeMap * nnMap )
|
||||
tempNode = tempNode->nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlNamedNodeMap_free
|
||||
* frees a NamedNodeMap.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlNamedNodeMap_free( IXML_NamedNodeMap * nnMap )
|
||||
|
||||
void ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap)
|
||||
{
|
||||
IXML_NamedNodeMap *pNext;
|
||||
|
||||
@@ -186,38 +151,27 @@ ixmlNamedNodeMap_free( IXML_NamedNodeMap * nnMap )
|
||||
}
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* NamedNodeMap_addToNamedNodeMap
|
||||
* add a node to a NamedNodeMap.
|
||||
* Internal to parser only.
|
||||
* Parameters:
|
||||
* add: the node to add into NamedNodeMap.
|
||||
* Return:
|
||||
* IXML_SUCCESS or failure.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap,
|
||||
IN IXML_Node * add )
|
||||
|
||||
int ixmlNamedNodeMap_addToNamedNodeMap(
|
||||
IXML_NamedNodeMap **nnMap,
|
||||
IXML_Node *add)
|
||||
{
|
||||
IXML_NamedNodeMap *traverse = NULL,
|
||||
*p = NULL;
|
||||
IXML_NamedNodeMap *traverse = NULL;
|
||||
IXML_NamedNodeMap *p = NULL;
|
||||
IXML_NamedNodeMap *newItem = NULL;
|
||||
|
||||
if(add == NULL) {
|
||||
return IXML_SUCCESS;
|
||||
}
|
||||
|
||||
if( *nnMap == NULL ) // nodelist is empty
|
||||
{
|
||||
*nnMap =
|
||||
( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) );
|
||||
if (*nnMap == NULL) {
|
||||
// nodelist is empty
|
||||
*nnMap = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap));
|
||||
if (*nnMap == NULL) {
|
||||
return IXML_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
ixmlNamedNodeMap_init(*nnMap);
|
||||
}
|
||||
|
||||
if ((*nnMap)->nodeItem == NULL) {
|
||||
(*nnMap)->nodeItem = add;
|
||||
} else {
|
||||
@@ -227,9 +181,7 @@ ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap,
|
||||
p = traverse;
|
||||
traverse = traverse->next;
|
||||
}
|
||||
|
||||
newItem =
|
||||
( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) );
|
||||
newItem = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap));
|
||||
if (newItem == NULL) {
|
||||
return IXML_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
@@ -240,3 +192,4 @@ ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap,
|
||||
|
||||
return IXML_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
1090
ixml/src/node.c
1090
ixml/src/node.c
File diff suppressed because it is too large
Load Diff
@@ -1,61 +1,57 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "ixmlparser.h"
|
||||
|
||||
/*================================================================
|
||||
* ixmlNodeList_init
|
||||
* initializes a nodelist
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlNodeList_init( IXML_NodeList * nList )
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void ixmlNodeList_init(IXML_NodeList *nList)
|
||||
{
|
||||
assert(nList != NULL);
|
||||
|
||||
memset(nList, 0, sizeof (IXML_NodeList));
|
||||
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlNodeList_item
|
||||
* Returns the indexth item in the collection. If index is greater
|
||||
* than or equal to the number of nodes in the list, this returns
|
||||
* null.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
IXML_Node *
|
||||
ixmlNodeList_item( IXML_NodeList * nList,
|
||||
|
||||
IXML_Node *ixmlNodeList_item(
|
||||
IXML_NodeList *nList,
|
||||
unsigned long index)
|
||||
{
|
||||
IXML_NodeList *next;
|
||||
@@ -75,24 +71,19 @@ ixmlNodeList_item( IXML_NodeList * nList,
|
||||
next = next->next;
|
||||
}
|
||||
|
||||
if( next == NULL ) return NULL;
|
||||
|
||||
return next->nodeItem;
|
||||
|
||||
if (next == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlNodeList_addToNodeList
|
||||
* Add a node to nodelist
|
||||
* Internal to parser only.
|
||||
*
|
||||
*=================================================================*/
|
||||
int
|
||||
ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
||||
IN IXML_Node * add )
|
||||
return next->nodeItem;
|
||||
}
|
||||
|
||||
int ixmlNodeList_addToNodeList(
|
||||
IXML_NodeList **nList,
|
||||
IXML_Node *add)
|
||||
{
|
||||
IXML_NodeList *traverse,
|
||||
*p = NULL;
|
||||
IXML_NodeList *traverse = NULL;
|
||||
IXML_NodeList *p = NULL;
|
||||
IXML_NodeList *newListItem;
|
||||
|
||||
assert(add != NULL);
|
||||
@@ -101,8 +92,8 @@ ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
||||
return IXML_FAILED;
|
||||
}
|
||||
|
||||
if( *nList == NULL ) // nodelist is empty
|
||||
{
|
||||
if (*nList == NULL) {
|
||||
// nodelist is empty
|
||||
*nList = (IXML_NodeList *)malloc(sizeof (IXML_NodeList));
|
||||
if (*nList == NULL) {
|
||||
return IXML_INSUFFICIENT_MEMORY;
|
||||
@@ -120,8 +111,7 @@ ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
||||
traverse = traverse->next;
|
||||
}
|
||||
|
||||
newListItem =
|
||||
( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) );
|
||||
newListItem = (IXML_NodeList *)malloc(sizeof (IXML_NodeList));
|
||||
if (newListItem == NULL) {
|
||||
return IXML_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
@@ -133,15 +123,8 @@ ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
||||
return IXML_SUCCESS;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlNodeList_length
|
||||
* Returns the number of nodes in the list. The range of valid
|
||||
* child node indices is 0 to length-1 inclusive.
|
||||
* External function.
|
||||
*
|
||||
*=================================================================*/
|
||||
unsigned long
|
||||
ixmlNodeList_length( IN IXML_NodeList * nList )
|
||||
|
||||
unsigned long ixmlNodeList_length(IXML_NodeList *nList)
|
||||
{
|
||||
IXML_NodeList *list;
|
||||
unsigned long length = 0;
|
||||
@@ -155,22 +138,15 @@ ixmlNodeList_length( IN IXML_NodeList * nList )
|
||||
return length;
|
||||
}
|
||||
|
||||
/*================================================================
|
||||
* ixmlNodeList_free
|
||||
* frees a nodeList
|
||||
* External function
|
||||
*
|
||||
*=================================================================*/
|
||||
void
|
||||
ixmlNodeList_free( IN IXML_NodeList * nList )
|
||||
|
||||
void ixmlNodeList_free(IXML_NodeList *nList)
|
||||
{
|
||||
IXML_NodeList *next;
|
||||
|
||||
while (nList != NULL) {
|
||||
next = nList->next;
|
||||
|
||||
free(nList);
|
||||
nList = next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@ includedir=@includedir@
|
||||
Name: libupnp
|
||||
Description: Linux SDK for UPnP Devices
|
||||
Version: @VERSION@
|
||||
Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
||||
Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
||||
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Version: 1.6.2
|
||||
Version: 1.6.6
|
||||
Summary: Universal Plug and Play (UPnP) SDK
|
||||
Name: libupnp
|
||||
Release: 1%{?dist}
|
||||
|
||||
@@ -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)dnl
|
||||
AC_MSG_RESULT($enable_[]Name)
|
||||
AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes)
|
||||
dnl
|
||||
m4_popdef([NAME])dnl
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = -I$(srcdir)/inc -I$(srcdir)/src/inc
|
||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||
|
||||
if ENABLE_DEBUG
|
||||
AM_CPPFLAGS += -DDEBUG -DSTATS
|
||||
@@ -21,12 +20,11 @@ libthreadutil_la_LDFLAGS = -version-info $(LT_VERSION_THREADUTIL)
|
||||
|
||||
libthreadutil_la_SOURCES = \
|
||||
src/FreeList.c src/LinkedList.c \
|
||||
src/ThreadPool.c src/TimerThread.c \
|
||||
src/iasnprintf.c
|
||||
src/ThreadPool.c src/TimerThread.c
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = \
|
||||
inc/FreeList.h inc/LinkedList.h \
|
||||
inc/ThreadPool.h inc/TimerThread.h \
|
||||
inc/iasnprintf.h inc/ithread.h
|
||||
inc/ithread.h
|
||||
|
||||
|
||||
@@ -29,14 +29,24 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef FREE_LIST_H
|
||||
#define FREE_LIST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include "ithread.h"
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -29,21 +29,32 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef LINKED_LIST_H
|
||||
#define LINKED_LIST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "FreeList.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define EOUTOFMEM (-7 & 1<<29)
|
||||
|
||||
|
||||
#define FREELISTSIZE 100
|
||||
#define LIST_SUCCESS 1
|
||||
#define LIST_FAIL 0
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: free_routine
|
||||
*
|
||||
@@ -52,6 +63,7 @@ extern "C" {
|
||||
*****************************************************************************/
|
||||
typedef void (*free_function)(void *arg);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cmp_routine
|
||||
*
|
||||
@@ -61,6 +73,7 @@ typedef void (*free_function)(void *arg);
|
||||
*****************************************************************************/
|
||||
typedef int (*cmp_routine)(void *itemA,void *itemB);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ListNode
|
||||
*
|
||||
@@ -75,6 +88,7 @@ typedef struct LISTNODE
|
||||
void *item;
|
||||
} ListNode;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: LinkedList
|
||||
*
|
||||
@@ -104,6 +118,7 @@ typedef struct LINKEDLIST
|
||||
cmp_routine cmp_func; /* compare function to use */
|
||||
} LinkedList;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListInit
|
||||
*
|
||||
@@ -119,6 +134,7 @@ typedef struct LINKEDLIST
|
||||
*****************************************************************************/
|
||||
int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListAddHead
|
||||
*
|
||||
@@ -135,6 +151,7 @@ int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func);
|
||||
*****************************************************************************/
|
||||
ListNode *ListAddHead(LinkedList *list, void *item);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListAddTail
|
||||
*
|
||||
@@ -151,6 +168,7 @@ ListNode *ListAddHead(LinkedList *list, void *item);
|
||||
*****************************************************************************/
|
||||
ListNode *ListAddTail(LinkedList *list, void *item);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListAddAfter
|
||||
*
|
||||
@@ -205,6 +223,7 @@ ListNode *ListAddBefore(LinkedList *list,void *item, ListNode *anode);
|
||||
*****************************************************************************/
|
||||
void *ListDelNode(LinkedList *list,ListNode *dnode, int freeItem);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListDestroy
|
||||
*
|
||||
@@ -240,6 +259,7 @@ int ListDestroy(LinkedList *list, int freeItem);
|
||||
*****************************************************************************/
|
||||
ListNode* ListHead(LinkedList *list);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListTail
|
||||
*
|
||||
@@ -256,6 +276,7 @@ ListNode* ListHead(LinkedList *list);
|
||||
*****************************************************************************/
|
||||
ListNode* ListTail(LinkedList *list);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListNext
|
||||
*
|
||||
@@ -272,6 +293,7 @@ ListNode* ListTail(LinkedList *list);
|
||||
*****************************************************************************/
|
||||
ListNode* ListNext(LinkedList *list, ListNode * node);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListPrev
|
||||
*
|
||||
@@ -288,6 +310,7 @@ ListNode* ListNext(LinkedList *list, ListNode * node);
|
||||
*****************************************************************************/
|
||||
ListNode* ListPrev(LinkedList *list, ListNode * node);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListFind
|
||||
*
|
||||
@@ -307,6 +330,7 @@ ListNode* ListPrev(LinkedList *list, ListNode * node);
|
||||
*****************************************************************************/
|
||||
ListNode* ListFind(LinkedList *list, ListNode *start, void * item);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ListSize
|
||||
*
|
||||
|
||||
@@ -29,70 +29,134 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef THREADPOOL_H
|
||||
#define THREADPOOL_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "FreeList.h"
|
||||
#include "ithread.h"
|
||||
#include "LinkedList.h"
|
||||
#include "UpnpInet.h"
|
||||
#include "UpnpGlobal.h" /* for UPNP_INLINE, EXPORT_SPEC */
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <time.h>
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#else /* WIN32 */
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h> /* for gettimeofday() */
|
||||
#if defined(__OSX__) || defined(__APPLE__) || defined(__NetBSD__)
|
||||
#include <sys/resource.h> /* for setpriority() */
|
||||
#endif
|
||||
|
||||
#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;
|
||||
|
||||
typedef enum priority {LOW_PRIORITY,
|
||||
typedef enum duration {
|
||||
SHORT_TERM,
|
||||
PERSISTENT
|
||||
} Duration;
|
||||
|
||||
|
||||
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 STATS 1 /* always include stats because code change is minimal */
|
||||
HIGH_PRIORITY
|
||||
} ThreadPriority;
|
||||
|
||||
|
||||
/* Statistics */
|
||||
#ifdef WIN32 /* TODO: check why STATSONLY fails during compilation */
|
||||
#undef STATS
|
||||
#endif
|
||||
/*! default priority used by TPJobInit */
|
||||
#define DEFAULT_PRIORITY MED_PRIORITY
|
||||
|
||||
|
||||
/*! default minimum used by TPAttrInit */
|
||||
#define DEFAULT_MIN_THREADS 1
|
||||
|
||||
|
||||
/*! default max used by TPAttrInit */
|
||||
#define DEFAULT_MAX_THREADS 10
|
||||
|
||||
|
||||
/*! default jobs per thread used by TPAttrInit */
|
||||
#define DEFAULT_JOBS_PER_THREAD 10
|
||||
|
||||
|
||||
/*! default starvation time used by TPAttrInit */
|
||||
#define DEFAULT_STARVATION_TIME 500
|
||||
|
||||
|
||||
/*! default idle time used by TPAttrInit */
|
||||
#define DEFAULT_IDLE_TIME 10 * 1000
|
||||
|
||||
|
||||
/*! default free routine used TPJobInit */
|
||||
#define DEFAULT_FREE_ROUTINE NULL
|
||||
|
||||
|
||||
/*! default max jobs used TPAttrInit */
|
||||
#define DEFAULT_MAX_JOBS_TOTAL 100
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Statistics.
|
||||
*
|
||||
* Always include stats because code change is minimal.
|
||||
*/
|
||||
#define STATS 1
|
||||
|
||||
#ifdef STATS
|
||||
#define STATSONLY(x) x
|
||||
#else
|
||||
#define STATSONLY(x)
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG 1
|
||||
#endif
|
||||
|
||||
#include "LinkedList.h"
|
||||
#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 */
|
||||
|
||||
|
||||
/*! Default priority */
|
||||
#define DEFAULT_SCHED_PARAM 0
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: free_routine
|
||||
@@ -102,6 +166,7 @@ typedef int PolicyType;
|
||||
*****************************************************************************/
|
||||
typedef void (*free_routine)(void *arg);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ThreadPoolAttr
|
||||
*
|
||||
@@ -111,28 +176,31 @@ typedef void (*free_routine)(void *arg);
|
||||
*****************************************************************************/
|
||||
typedef struct THREADPOOLATTR
|
||||
{
|
||||
int minThreads; /* minThreads, ThreadPool will always maintain at least
|
||||
this many threads */
|
||||
/* minThreads, ThreadPool will always maintain at least this many threads */
|
||||
int minThreads;
|
||||
|
||||
int maxThreads; /* maxThreads, ThreadPool will never have more than this
|
||||
number of threads */
|
||||
/* maxThreads, ThreadPool will never have more than this number of threads */
|
||||
int maxThreads;
|
||||
|
||||
int maxIdleTime; /* maxIdleTime (in milliseconds)
|
||||
this is the maximum time a thread will remain idle
|
||||
before dying */
|
||||
/* maxIdleTime (in milliseconds) this is the maximum time a thread will
|
||||
* remain idle before dying */
|
||||
int maxIdleTime;
|
||||
|
||||
int jobsPerThread; /* jobs per thread to maintain */
|
||||
/* jobs per thread to maintain */
|
||||
int jobsPerThread;
|
||||
|
||||
int maxJobsTotal; /* maximum number of jobs that can be queued totally. */
|
||||
/* maximum number of jobs that can be queued totally. */
|
||||
int maxJobsTotal;
|
||||
|
||||
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 */
|
||||
/* the time a low priority or med priority job waits before getting bumped
|
||||
* up a priority (in milliseconds) */
|
||||
int starvationTime;
|
||||
|
||||
/* scheduling policy to use */
|
||||
PolicyType schedPolicy;
|
||||
} ThreadPoolAttr;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ThreadPool
|
||||
*
|
||||
@@ -144,20 +212,18 @@ typedef struct THREADPOOLJOB
|
||||
start_routine func;
|
||||
void *arg;
|
||||
free_routine free_func;
|
||||
struct timeb requestTime;
|
||||
struct timeval requestTime;
|
||||
int priority;
|
||||
int jobId;
|
||||
} ThreadPoolJob;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ThreadPoolStats
|
||||
*
|
||||
* Description:
|
||||
* Structure to hold statistics
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef STATS
|
||||
|
||||
typedef struct TPOOLSTATS
|
||||
{
|
||||
double totalTimeHQ;
|
||||
@@ -181,18 +247,13 @@ typedef struct TPOOLSTATS
|
||||
int currentJobsMQ;
|
||||
} ThreadPoolStats;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ThreadPool
|
||||
/*!
|
||||
* \brief A thread pool similar to the thread pool in the UPnP SDK.
|
||||
*
|
||||
* Description:
|
||||
* A thread pool similar to the thread pool in the UPnP SDK.
|
||||
* Allows jobs to be scheduled for running by threads in a
|
||||
* thread pool. The thread pool is initialized with a
|
||||
* minimum and maximum thread number as well as a
|
||||
* max idle time
|
||||
* minimum and maximum thread number as well as a max idle time
|
||||
* and a jobs per thread ratio. If a worker thread waits the whole
|
||||
* max idle time without receiving a job and the thread pool
|
||||
* currently has more threads running than the minimum
|
||||
@@ -201,36 +262,29 @@ typedef struct TPOOLSTATS
|
||||
* becomes greater than the set ratio and the thread pool currently has
|
||||
* less than the maximum threads then a new thread will
|
||||
* be created.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
*/
|
||||
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 */
|
||||
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 busyThreads; /* number of threads that are currently executing jobs */
|
||||
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 */
|
||||
|
||||
#ifdef STATS
|
||||
/* statistics */
|
||||
ThreadPoolStats stats;
|
||||
#endif
|
||||
|
||||
} ThreadPool;
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolInit
|
||||
*
|
||||
@@ -267,8 +321,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
|
||||
@@ -290,9 +344,8 @@ int ThreadPoolInit(ThreadPool *tp,
|
||||
* 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
|
||||
@@ -307,8 +360,9 @@ int ThreadPoolAddPersistent (ThreadPool*tp,
|
||||
* 0 on success, nonzero on failure
|
||||
* Always returns 0.
|
||||
*****************************************************************************/
|
||||
int ThreadPoolGetAttr(ThreadPool *tp,
|
||||
ThreadPoolAttr *out);
|
||||
int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolSetAttr
|
||||
*
|
||||
@@ -322,8 +376,8 @@ int ThreadPoolGetAttr(ThreadPool *tp,
|
||||
* 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
|
||||
@@ -342,9 +396,8 @@ int ThreadPoolSetAttr(ThreadPool *tp,
|
||||
* 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
|
||||
@@ -361,8 +414,7 @@ int ThreadPoolAdd (ThreadPool*tp,
|
||||
* 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);
|
||||
|
||||
|
||||
|
||||
@@ -399,6 +451,7 @@ int ThreadPoolShutdown(ThreadPool *tp);
|
||||
*****************************************************************************/
|
||||
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPJobSetPriority
|
||||
*
|
||||
@@ -412,6 +465,7 @@ int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
||||
*****************************************************************************/
|
||||
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPJobSetFreeFunction
|
||||
*
|
||||
@@ -439,6 +493,7 @@ int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
||||
*****************************************************************************/
|
||||
int TPAttrInit(ThreadPoolAttr *attr);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetMaxThreads
|
||||
*
|
||||
@@ -452,6 +507,7 @@ int TPAttrInit(ThreadPoolAttr *attr);
|
||||
*****************************************************************************/
|
||||
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetMinThreads
|
||||
*
|
||||
@@ -465,6 +521,7 @@ int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
||||
*****************************************************************************/
|
||||
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetIdleTime
|
||||
*
|
||||
@@ -477,6 +534,7 @@ int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
||||
*****************************************************************************/
|
||||
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetJobsPerThread
|
||||
*
|
||||
@@ -490,6 +548,7 @@ int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
||||
*****************************************************************************/
|
||||
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetStarvationTime
|
||||
*
|
||||
@@ -503,6 +562,7 @@ int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
||||
*****************************************************************************/
|
||||
int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TPAttrSetSchedPolicy
|
||||
*
|
||||
@@ -530,6 +590,7 @@ int TPAttrSetSchedPolicy(ThreadPoolAttr *attr, PolicyType schedPolicy);
|
||||
*****************************************************************************/
|
||||
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ThreadPoolGetStats
|
||||
*
|
||||
@@ -544,18 +605,20 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
||||
* Always returns 0.
|
||||
*****************************************************************************/
|
||||
#ifdef STATS
|
||||
EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
||||
EXPORT_SPEC int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
||||
|
||||
EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
||||
EXPORT_SPEC void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
||||
#else
|
||||
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
||||
|
||||
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ThreadPool */
|
||||
|
||||
#endif /* THREADPOOL_H */
|
||||
|
||||
|
||||
@@ -29,38 +29,45 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef TIMERTHREAD_H
|
||||
#define TIMERTHREAD_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "FreeList.h"
|
||||
#include "ithread.h"
|
||||
#include "LinkedList.h"
|
||||
#include "FreeList.h"
|
||||
#include "ThreadPool.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define INVALID_EVENT_ID (-10 & 1<<29)
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: TimerThread
|
||||
*
|
||||
* Description:
|
||||
/*!
|
||||
* A timer thread similar to the one in the Upnp SDK that allows
|
||||
* the scheduling of a job to run at a specified time in the future
|
||||
* the scheduling of a job to run at a specified time in the future.
|
||||
*
|
||||
* Because the timer thread uses the thread pool there is no
|
||||
* gurantee of timing, only approximate timing.
|
||||
* Uses ThreadPool, Mutex, Condition, Thread
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
* Uses ThreadPool, Mutex, Condition, Thread.
|
||||
*/
|
||||
typedef struct TIMERTHREAD
|
||||
{
|
||||
ithread_mutex_t mutex;
|
||||
@@ -73,116 +80,88 @@ typedef struct TIMERTHREAD
|
||||
} TimerThread;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: TimerEvent
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
/*!
|
||||
* Struct to contain information for a timer event.
|
||||
* Internal to the TimerThread
|
||||
*
|
||||
*****************************************************************************/
|
||||
* Internal to the 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 */
|
||||
/*! [in] Absolute time for event in seconds since Jan 1, 1970. */
|
||||
time_t eventTime;
|
||||
/*! [in] Long term or short term job. */
|
||||
Duration persistent;
|
||||
int id;
|
||||
} TimerEvent;
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadInit
|
||||
/*!
|
||||
* \brief Initializes and starts timer thread.
|
||||
*
|
||||
* Description:
|
||||
* Initializes and starts timer thread.
|
||||
*
|
||||
* Parameters:
|
||||
* timer - valid timer thread pointer.
|
||||
* tp - valid thread pool to use. Must be
|
||||
* started. Must be valid for lifetime
|
||||
* of timer. Timer must be shutdown
|
||||
* BEFORE thread pool.
|
||||
* Return:
|
||||
* 0 on success, nonzero on failure
|
||||
* Returns error from ThreadPoolAddPersistent on failure.
|
||||
*
|
||||
************************************************************************/
|
||||
int TimerThreadInit(TimerThread *timer,
|
||||
* \return 0 on success, nonzero on failure. Returns error from
|
||||
* ThreadPoolAddPersistent on failure.
|
||||
*/
|
||||
int TimerThreadInit(
|
||||
/*! [in] Valid timer thread pointer. */
|
||||
TimerThread *timer,
|
||||
/*! [in] Valid thread pool to use. Must be started. Must be valid for
|
||||
* lifetime of timer. Timer must be shutdown BEFORE thread pool. */
|
||||
ThreadPool *tp);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadSchedule
|
||||
/*!
|
||||
* \brief Schedules an event to run at a specified time.
|
||||
*
|
||||
* Description:
|
||||
* Schedules an event to run at a specified time.
|
||||
*
|
||||
* Parameters:
|
||||
* timer - valid timer thread pointer.
|
||||
* time_t - time of event.
|
||||
* either in absolute seconds,
|
||||
* or relative seconds in the future.
|
||||
* timeoutType - either ABS_SEC, or REL_SEC.
|
||||
* if REL_SEC, then the event
|
||||
* will be scheduled at the
|
||||
* current time + REL_SEC.
|
||||
* job-> valid Thread pool job with following fields
|
||||
* func - function to schedule
|
||||
* arg - argument to function
|
||||
* priority - priority of job.
|
||||
*
|
||||
* id - id of timer event. (out, can be null)
|
||||
* Return:
|
||||
* 0 on success, nonzero on failure
|
||||
* EOUTOFMEM if not enough memory to schedule job.
|
||||
*
|
||||
************************************************************************/
|
||||
int TimerThreadSchedule(TimerThread* timer,
|
||||
* \return 0 on success, nonzero on failure, EOUTOFMEM if not enough memory
|
||||
* to schedule job.
|
||||
*/
|
||||
int TimerThreadSchedule(
|
||||
/*! [in] Valid timer thread pointer. */
|
||||
TimerThread* timer,
|
||||
/*! [in] time of event. Either in absolute seconds, or relative
|
||||
* seconds in the future. */
|
||||
time_t time,
|
||||
/*! [in] either ABS_SEC, or REL_SEC. If REL_SEC, then the event
|
||||
* will be scheduled at the current time + REL_SEC. */
|
||||
TimeoutType type,
|
||||
/*! [in] Valid Thread pool job with following fields. */
|
||||
ThreadPoolJob *job,
|
||||
/*! [in] . */
|
||||
Duration duration,
|
||||
/*! [in] Id of timer event. (out, can be null). */
|
||||
int *id);
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadRemove
|
||||
|
||||
/*!
|
||||
* \brief Removes an event from the timer Q.
|
||||
*
|
||||
* Description:
|
||||
* Removes an event from the timer Q.
|
||||
* Events can only be removed
|
||||
* before they have been placed in the
|
||||
* thread pool.
|
||||
* Events can only be removed before they have been placed in the thread pool.
|
||||
*
|
||||
* Parameters:
|
||||
* timer - valid timer thread pointer.
|
||||
* id - id of event to remove.
|
||||
* ThreadPoolJob *out - space for thread pool job.
|
||||
* Return:
|
||||
* 0 on success,
|
||||
* INVALID_EVENT_ID on failure
|
||||
*
|
||||
************************************************************************/
|
||||
int TimerThreadRemove(TimerThread *timer,
|
||||
* \return 0 on success, INVALID_EVENT_ID on failure.
|
||||
*/
|
||||
int TimerThreadRemove(
|
||||
/*! [in] Valid timer thread pointer. */
|
||||
TimerThread *timer,
|
||||
/*! [in] Id of event to remove. */
|
||||
int id,
|
||||
/*! [in] Space for thread pool job. */
|
||||
ThreadPoolJob *out);
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadShutdown
|
||||
|
||||
/*!
|
||||
* \brief Shutdown the timer thread.
|
||||
*
|
||||
* Description:
|
||||
* Shutdown the timer thread
|
||||
* Events scheduled in the future will NOT be run.
|
||||
* Timer thread should be shutdown BEFORE it's associated
|
||||
* thread pool.
|
||||
* Returns:
|
||||
* returns 0 if succesfull,
|
||||
* nonzero otherwise.
|
||||
* Always returns 0.
|
||||
***********************************************************************/
|
||||
int TimerThreadShutdown(TimerThread *timer);
|
||||
*
|
||||
* Timer thread should be shutdown BEFORE it's associated thread pool.
|
||||
*
|
||||
* \return 0 if succesfull, nonzero otherwise. Always returns 0.
|
||||
*/
|
||||
int TimerThreadShutdown(
|
||||
/*! [in] Valid timer thread pointer. */
|
||||
TimerThread *timer);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,66 +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 <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
|
||||
@@ -29,22 +29,42 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef ITHREADH
|
||||
#define ITHREADH
|
||||
|
||||
#ifndef ITHREAD_H
|
||||
#define ITHREAD_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(WIN32)
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "UpnpGlobal.h" /* For UPNP_INLINE, EXPORT_SPEC */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <pthread.h>
|
||||
#ifndef WIN32
|
||||
#ifdef WIN32
|
||||
/* Do not #include <unistd.h> */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
#if defined(BSD)
|
||||
#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
|
||||
@@ -76,6 +96,7 @@ extern "C" {
|
||||
***************************************************************************/
|
||||
typedef pthread_t ithread_t;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ithread_attr_t
|
||||
*
|
||||
@@ -163,6 +184,95 @@ typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
||||
***************************************************************************/
|
||||
typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_initialize_library
|
||||
*
|
||||
* Description:
|
||||
* Initializes the library. Does nothing in all implementations, except
|
||||
* when statically linked for WIN32.
|
||||
* Parameters:
|
||||
* none.
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
***************************************************************************/
|
||||
static UPNP_INLINE int ithread_initialize_library(void) {
|
||||
int ret = 0;
|
||||
|
||||
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||
ret = !pthread_win32_process_attach_np();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_cleanup_library
|
||||
*
|
||||
* Description:
|
||||
* Clean up library resources. Does nothing in all implementations, except
|
||||
* when statically linked for WIN32.
|
||||
* Parameters:
|
||||
* none.
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
***************************************************************************/
|
||||
static UPNP_INLINE int ithread_cleanup_library(void) {
|
||||
int ret = 0;
|
||||
|
||||
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||
ret = !pthread_win32_process_detach_np();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_initialize_thread
|
||||
*
|
||||
* Description:
|
||||
* Initializes the thread. Does nothing in all implementations, except
|
||||
* when statically linked for WIN32.
|
||||
* Parameters:
|
||||
* none.
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
***************************************************************************/
|
||||
static UPNP_INLINE int ithread_initialize_thread(void) {
|
||||
int ret = 0;
|
||||
|
||||
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||
ret = !pthread_win32_thread_attach_np();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_cleanup_thread
|
||||
*
|
||||
* Description:
|
||||
* Clean up thread resources. Does nothing in all implementations, except
|
||||
* when statically linked for WIN32.
|
||||
* Parameters:
|
||||
* none.
|
||||
* Returns:
|
||||
* 0 on success, Nonzero on failure.
|
||||
***************************************************************************/
|
||||
static UPNP_INLINE int ithread_cleanup_thread(void) {
|
||||
int ret = 0;
|
||||
|
||||
#if defined(WIN32) && defined(PTW32_STATIC_LIB)
|
||||
ret = !pthread_win32_thread_detach_np();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_mutexattr_init
|
||||
*
|
||||
@@ -499,7 +609,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
#define ithread_cond_init pthread_cond_init
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_cond_signal
|
||||
*
|
||||
@@ -559,22 +668,18 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
* Function: pthread_cond_timedwait
|
||||
*
|
||||
* Description:
|
||||
* Atomically releases the associated mutex and waits on the condition.
|
||||
* If the condition is not signaled in the specified time
|
||||
* than the
|
||||
* Atomically releases the associated mutex and waits on the
|
||||
* condition.
|
||||
* If the condition is not signaled in the specified time than the
|
||||
* call times out and returns.
|
||||
* Associated mutex MUST be locked by thread before entering
|
||||
* this call.
|
||||
* Associated mutex MUST be locked by thread before entering this call.
|
||||
* Mutex is reacquired when call returns.
|
||||
* Parameters:
|
||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
||||
* ithread_cond_t)
|
||||
* ithread_cond_t *cond (must be valid non NULL pointer to ithread_cond_t)
|
||||
* cond must be initialized
|
||||
* ithread_mutex_t *mutex (must be valid non NULL pointer to
|
||||
* ithread_mutex_t)
|
||||
* ithread_mutex_t *mutex (must be valid non NULL pointer to ithread_mutex_t)
|
||||
* Mutex must be locked.
|
||||
* const struct timespec *abstime (absolute time, measured
|
||||
* from Jan 1, 1970)
|
||||
* const struct timespec *abstime (absolute time, measured from Jan 1, 1970)
|
||||
* Returns:
|
||||
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
||||
* See man page for pthread_cond_timedwait
|
||||
@@ -646,6 +751,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
***************************************************************************/
|
||||
#define ithread_exit pthread_exit
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_get_current_thread_id
|
||||
*
|
||||
@@ -669,6 +775,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
***************************************************************************/
|
||||
#define ithread_self pthread_self
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_detach
|
||||
*
|
||||
@@ -682,6 +789,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
***************************************************************************/
|
||||
#define ithread_detach pthread_detach
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: ithread_join
|
||||
*
|
||||
@@ -701,7 +809,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
#define ithread_join pthread_join
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: isleep
|
||||
*
|
||||
@@ -715,7 +822,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
* 0 on success, Nonzero on failure.
|
||||
* See man page for sleep (man 3 sleep)
|
||||
*****************************************************************************/
|
||||
#ifdef WIN32
|
||||
#define isleep(x) Sleep((x)*1000)
|
||||
#else
|
||||
#define isleep sleep
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Function: isleep
|
||||
@@ -730,21 +842,10 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
* 0 on success, Nonzero on failure.
|
||||
* See man page for sleep (man 3 sleep)
|
||||
*****************************************************************************/
|
||||
#define imillisleep(x) usleep(1000*x)
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef UPNP_STATIC_LIB
|
||||
#ifdef LIBUPNP_EXPORTS
|
||||
/* set up declspec for dll export to make functions visible to library users */
|
||||
#define EXPORT_SPEC __declspec(dllexport)
|
||||
#define imillisleep Sleep
|
||||
#else
|
||||
#define EXPORT_SPEC __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define EXPORT_SPEC
|
||||
#endif
|
||||
#else
|
||||
#define EXPORT_SPEC
|
||||
#define imillisleep(x) usleep(1000*x)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -753,9 +854,11 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
||||
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ITHREADH */
|
||||
|
||||
#endif /* ITHREAD_H */
|
||||
|
||||
|
||||
@@ -1,43 +1,55 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "LinkedList.h"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/* Do not #include <sys/param.h> */
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__)
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
static int
|
||||
freeListNode( ListNode * node,
|
||||
LinkedList * list )
|
||||
@@ -532,3 +544,4 @@ ListSize( LinkedList * list )
|
||||
|
||||
return list->size;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,68 +1,69 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "TimerThread.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Function: FreeTimerEvent
|
||||
*
|
||||
* Description:
|
||||
* Deallocates a dynamically allocated TimerEvent.
|
||||
* Parameters:
|
||||
* TimerEvent *event - must be allocated with CreateTimerEvent
|
||||
*****************************************************************************/
|
||||
static void
|
||||
FreeTimerEvent( TimerThread * timer,
|
||||
|
||||
/*!
|
||||
* \brief Deallocates a dynamically allocated TimerEvent.
|
||||
*/
|
||||
static void FreeTimerEvent(
|
||||
/*! [in] Valid timer thread pointer. */
|
||||
TimerThread *timer,
|
||||
/*! [in] Must be allocated with CreateTimerEvent*/
|
||||
TimerEvent *event)
|
||||
{
|
||||
|
||||
assert(timer != NULL);
|
||||
|
||||
FreeListFree(&timer->freeEvents, event);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: TimerThreadWorker
|
||||
|
||||
/*!
|
||||
* \brief Implements timer thread.
|
||||
*
|
||||
* Description:
|
||||
* Implements timer thread.
|
||||
* Waits for next event to occur and schedules
|
||||
* associated job into threadpool.
|
||||
* Internal Only.
|
||||
* Parameters:
|
||||
* void * arg -> is cast to TimerThread *
|
||||
*****************************************************************************/
|
||||
static void *
|
||||
TimerThreadWorker( void *arg )
|
||||
* Waits for next event to occur and schedules associated job into threadpool.
|
||||
*/
|
||||
static void *TimerThreadWorker(
|
||||
/*! [in] arg is cast to (TimerThread *). */
|
||||
void *arg)
|
||||
{
|
||||
TimerThread *timer = ( TimerThread * ) arg;
|
||||
ListNode *head = NULL;
|
||||
@@ -81,19 +82,14 @@ TimerThreadWorker( void *arg )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
|
||||
//mutex should always be locked at top of loop
|
||||
|
||||
//Check for shutdown
|
||||
|
||||
if( timer->shutdown )
|
||||
{
|
||||
|
||||
timer->shutdown = 0;
|
||||
ithread_cond_signal( &timer->condition );
|
||||
ithread_mutex_unlock( &timer->mutex );
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
nextEvent = NULL;
|
||||
@@ -102,7 +98,6 @@ TimerThreadWorker( void *arg )
|
||||
if( timer->eventQ.size > 0 )
|
||||
{
|
||||
head = ListHead( &timer->eventQ );
|
||||
|
||||
nextEvent = ( TimerEvent * ) head->item;
|
||||
nextEventTime = nextEvent->eventTime;
|
||||
}
|
||||
@@ -110,53 +105,41 @@ TimerThreadWorker( void *arg )
|
||||
currentTime = time( NULL );
|
||||
|
||||
//If time has elapsed, schedule job
|
||||
|
||||
if( ( nextEvent != NULL ) && ( currentTime >= nextEventTime ) )
|
||||
{
|
||||
|
||||
if( nextEvent->persistent ) {
|
||||
|
||||
ThreadPoolAddPersistent( timer->tp, &nextEvent->job,
|
||||
&tempId );
|
||||
} else {
|
||||
|
||||
ThreadPoolAdd( timer->tp, &nextEvent->job, &tempId );
|
||||
}
|
||||
|
||||
ListDelNode( &timer->eventQ, head, 0 );
|
||||
FreeTimerEvent( timer, nextEvent );
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if( nextEvent != NULL ) {
|
||||
timeToWait.tv_nsec = 0;
|
||||
timeToWait.tv_sec = nextEvent->eventTime;
|
||||
|
||||
ithread_cond_timedwait( &timer->condition, &timer->mutex,
|
||||
&timeToWait );
|
||||
|
||||
} else {
|
||||
ithread_cond_wait( &timer->condition, &timer->mutex );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: CalculateEventTime
|
||||
|
||||
/*!
|
||||
* \brief Calculates the appropriate timeout in absolute seconds
|
||||
* since Jan 1, 1970.
|
||||
*
|
||||
* Description:
|
||||
* Calculates the appropriate timeout in absolute seconds since
|
||||
* Jan 1, 1970
|
||||
* Internal Only.
|
||||
* Parameters:
|
||||
* time_t *timeout - timeout
|
||||
*
|
||||
*****************************************************************************/
|
||||
static int
|
||||
CalculateEventTime( time_t * timeout,
|
||||
* \return
|
||||
*/
|
||||
static int CalculateEventTime(
|
||||
/*! [in] Timeout. */
|
||||
time_t *timeout,
|
||||
/*! [in] Timeout type. */
|
||||
TimeoutType type)
|
||||
{
|
||||
time_t now;
|
||||
@@ -175,28 +158,21 @@ CalculateEventTime( time_t * timeout,
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: CreateTimerEvent
|
||||
/*!
|
||||
* \brief Creates a Timer Event. (Dynamically allocated).
|
||||
*
|
||||
* Description:
|
||||
* Creates a Timer Event. (Dynamically allocated)
|
||||
* Internal to timer thread.
|
||||
* Parameters:
|
||||
* func - thread function to run.
|
||||
* arg - argument to function.
|
||||
* priority - priority of job.
|
||||
* eventTime - the absoule time of the event
|
||||
* in seconds from Jan, 1970
|
||||
* id - id of job
|
||||
*
|
||||
* Returns:
|
||||
* TimerEvent * on success, NULL on failure.
|
||||
****************************************************************************/
|
||||
static TimerEvent *
|
||||
CreateTimerEvent( TimerThread * timer,
|
||||
* \return (TimerEvent *) on success, NULL on failure.
|
||||
*/
|
||||
static TimerEvent *CreateTimerEvent(
|
||||
/*! [in] Valid timer thread pointer. */
|
||||
TimerThread *timer,
|
||||
/*! [in] . */
|
||||
ThreadPoolJob *job,
|
||||
/*! [in] . */
|
||||
Duration persistent,
|
||||
/*! [in] The absoule time of the event in seconds from Jan, 1970. */
|
||||
time_t eventTime,
|
||||
/*! [in] Id of job. */
|
||||
int id)
|
||||
{
|
||||
TimerEvent *temp = NULL;
|
||||
@@ -215,25 +191,8 @@ CreateTimerEvent( TimerThread * timer,
|
||||
return temp;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadInit
|
||||
*
|
||||
* Description:
|
||||
* Initializes and starts timer thread.
|
||||
*
|
||||
* Parameters:
|
||||
* timer - valid timer thread pointer.
|
||||
* tp - valid thread pool to use. Must be
|
||||
* started. Must be valid for lifetime
|
||||
* of timer. Timer must be shutdown
|
||||
* BEFORE thread pool.
|
||||
* Return:
|
||||
* 0 on success, nonzero on failure
|
||||
* Returns error from ThreadPoolAddPersistent if failure.
|
||||
************************************************************************/
|
||||
int
|
||||
TimerThreadInit( TimerThread * timer,
|
||||
ThreadPool * tp )
|
||||
|
||||
int TimerThreadInit(TimerThread *timer, ThreadPool *tp)
|
||||
{
|
||||
|
||||
int rc = 0;
|
||||
@@ -290,32 +249,9 @@ TimerThreadInit( TimerThread * timer,
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadSchedule
|
||||
*
|
||||
* Description:
|
||||
* Schedules an event to run at a specified time.
|
||||
*
|
||||
* Parameters:
|
||||
* timer - valid timer thread pointer.
|
||||
* time_t - time of event.
|
||||
* either in absolute seconds,
|
||||
* or relative seconds in the future.
|
||||
* timeoutType - either ABS_SEC, or REL_SEC.
|
||||
* if REL_SEC, then the event
|
||||
* will be scheduled at the
|
||||
* current time + REL_SEC.
|
||||
*
|
||||
* func - function to schedule
|
||||
* arg - argument to function
|
||||
* priority - priority of job.
|
||||
* id - id of timer event. (out)
|
||||
* Return:
|
||||
* 0 on success, nonzero on failure
|
||||
* EOUTOFMEM if not enough memory to schedule job
|
||||
************************************************************************/
|
||||
int
|
||||
TimerThreadSchedule( TimerThread * timer,
|
||||
|
||||
int TimerThreadSchedule(
|
||||
TimerThread *timer,
|
||||
time_t timeout,
|
||||
TimeoutType type,
|
||||
ThreadPoolJob *job,
|
||||
@@ -394,26 +330,9 @@ TimerThreadSchedule( TimerThread * timer,
|
||||
return rc;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadRemove
|
||||
*
|
||||
* Description:
|
||||
* Removes an event from the timer Q.
|
||||
* Events can only be removed
|
||||
* before they have been placed in the
|
||||
* thread pool.
|
||||
*
|
||||
* Parameters:
|
||||
* timer - valid timer thread pointer.
|
||||
* id - id of event to remove.
|
||||
* out - space for returned job (Can be NULL)
|
||||
* Return:
|
||||
* 0 on success.
|
||||
* INVALID_EVENT_ID on error.
|
||||
*
|
||||
************************************************************************/
|
||||
int
|
||||
TimerThreadRemove( TimerThread * timer,
|
||||
|
||||
int TimerThreadRemove(
|
||||
TimerThread *timer,
|
||||
int id,
|
||||
ThreadPoolJob *out)
|
||||
{
|
||||
@@ -450,21 +369,8 @@ TimerThreadRemove( TimerThread * timer,
|
||||
return rc;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: TimerThreadShutdown
|
||||
*
|
||||
* Description:
|
||||
* Shutdown the timer thread
|
||||
* Events scheduled in the future will NOT be run.
|
||||
* Timer thread should be shutdown BEFORE it's associated
|
||||
* thread pool.
|
||||
* Returns:
|
||||
* returns 0 if succesfull,
|
||||
* nonzero otherwise.
|
||||
* Always returns 0.
|
||||
***********************************************************************/
|
||||
int
|
||||
TimerThreadShutdown( TimerThread * timer )
|
||||
|
||||
int TimerThreadShutdown(TimerThread *timer)
|
||||
{
|
||||
ListNode *tempNode2 = NULL;
|
||||
ListNode *tempNode = NULL;
|
||||
@@ -517,3 +423,4 @@ TimerThreadShutdown( TimerThread * timer )
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,153 +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 <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <sys/param.h>
|
||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__)
|
||||
#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;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# "Makefile.am" for "libupnp/upnp"
|
||||
#
|
||||
# Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
||||
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||
#
|
||||
|
||||
SUBDIRS = doc . sample
|
||||
@@ -11,10 +11,6 @@ AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/threadutil/inc \
|
||||
-I$(top_srcdir)/ixml/inc
|
||||
|
||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||
|
||||
AM_LDFLAGS = $(PTHREAD_LIBS)
|
||||
|
||||
LDADD = \
|
||||
libupnp.la \
|
||||
$(top_builddir)/threadutil/libthreadutil.la \
|
||||
@@ -23,8 +19,20 @@ LDADD = \
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = \
|
||||
inc/ActionComplete.h \
|
||||
inc/ActionRequest.h \
|
||||
inc/Discovery.h \
|
||||
inc/Event.h \
|
||||
inc/EventSubscribe.h \
|
||||
inc/FileInfo.h \
|
||||
inc/StateVarComplete.h \
|
||||
inc/StateVarRequest.h \
|
||||
inc/SubscriptionRequest.h \
|
||||
inc/UpnpString.h \
|
||||
inc/upnp.h \
|
||||
inc/upnpdebug.h
|
||||
inc/upnpdebug.h \
|
||||
inc/UpnpGlobal.h \
|
||||
inc/UpnpInet.h
|
||||
|
||||
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
||||
if ENABLE_TOOLS
|
||||
@@ -45,12 +53,12 @@ libupnp_la_LDFLAGS = \
|
||||
libupnp_la_SOURCES = \
|
||||
src/inc/config.h \
|
||||
src/inc/client_table.h \
|
||||
src/inc/ClientSubscription.h \
|
||||
src/inc/gena.h \
|
||||
src/inc/gena_ctrlpt.h \
|
||||
src/inc/gena_device.h \
|
||||
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 \
|
||||
@@ -76,10 +84,13 @@ libupnp_la_SOURCES = \
|
||||
src/inc/util.h \
|
||||
src/inc/utilall.h \
|
||||
src/inc/uuid.h \
|
||||
src/inc/VirtualDir.h \
|
||||
src/inc/webserver.h
|
||||
|
||||
# ssdp
|
||||
libupnp_la_SOURCES += \
|
||||
src/ssdp/ssdp_ResultData.c \
|
||||
src/ssdp/ssdp_ResultData.h \
|
||||
src/ssdp/ssdp_device.c \
|
||||
src/ssdp/ssdp_ctrlpt.c \
|
||||
src/ssdp/ssdp_server.c
|
||||
@@ -93,12 +104,13 @@ libupnp_la_SOURCES += \
|
||||
# genlib
|
||||
libupnp_la_SOURCES += \
|
||||
src/genlib/miniserver/miniserver.c \
|
||||
src/genlib/client_table/client_table.c \
|
||||
src/genlib/client_table/ClientSubscription.c \
|
||||
src/genlib/service_table/service_table.c \
|
||||
src/genlib/util/membuffer.c \
|
||||
src/genlib/util/strintmap.c \
|
||||
src/genlib/util/upnp_timeout.c \
|
||||
src/genlib/util/util.c \
|
||||
src/genlib/client_table/client_table.c \
|
||||
src/genlib/net/sock.c \
|
||||
src/genlib/net/http/httpparser.c \
|
||||
src/genlib/net/http/httpreadwrite.c \
|
||||
@@ -114,10 +126,23 @@ libupnp_la_SOURCES += \
|
||||
src/gena/gena_callback2.c
|
||||
|
||||
# api
|
||||
libupnp_la_SOURCES += src/api/upnpapi.c
|
||||
libupnp_la_SOURCES += \
|
||||
src/api/ActionComplete.c \
|
||||
src/api/ActionRequest.c \
|
||||
src/api/Discovery.c \
|
||||
src/api/Event.c \
|
||||
src/api/EventSubscribe.c \
|
||||
src/api/FileInfo.c \
|
||||
src/api/StateVarComplete.c \
|
||||
src/api/StateVarRequest.c \
|
||||
src/api/SubscriptionRequest.c \
|
||||
src/api/UpnpString.c \
|
||||
src/api/upnpapi.c
|
||||
|
||||
if ENABLE_TOOLS
|
||||
libupnp_la_SOURCES += src/api/upnptools.c
|
||||
endif
|
||||
|
||||
if ENABLE_DEBUG
|
||||
libupnp_la_SOURCES += src/api/upnpdebug.c
|
||||
endif
|
||||
@@ -134,6 +159,12 @@ libupnp_la_SOURCES += \
|
||||
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
||||
|
||||
|
||||
# inet_pton (needed on Win32, compiles to nothing elsewhere)
|
||||
libupnp_la_SOURCES += \
|
||||
src/inet_pton.c \
|
||||
src/inc/inet_pton.h
|
||||
|
||||
|
||||
# check / distcheck tests
|
||||
check_PROGRAMS = test_init
|
||||
TESTS = test_init
|
||||
@@ -142,8 +173,7 @@ test_init_SOURCES = test/test_init.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
LICENSE \
|
||||
src/inc/inet_pton.h \
|
||||
src/inet_pton.c \
|
||||
m4/libupnp.m4 \
|
||||
src/win_dll.c
|
||||
|
||||
|
||||
|
||||
173
upnp/inc/ActionComplete.h
Normal file
173
upnp/inc/ActionComplete.h
Normal file
@@ -0,0 +1,173 @@
|
||||
|
||||
|
||||
#ifndef ACTIONCOMPLETE_H
|
||||
#define ACTIONCOMPLETE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionComplete object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* \brief The type of an UpnpActionComplete object.
|
||||
*/
|
||||
typedef struct s_UpnpActionComplete UpnpActionComplete;
|
||||
|
||||
|
||||
#include "ixml.h" /* for IXML_Document */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Constructor.
|
||||
*
|
||||
* \return Pointer to the newly created object.
|
||||
*/
|
||||
EXPORT_SPEC UpnpActionComplete *UpnpActionComplete_new();
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Destructor.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_delete(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Copy Constructor.
|
||||
*/
|
||||
EXPORT_SPEC UpnpActionComplete *UpnpActionComplete_dup(
|
||||
/*! [in] \b this pointer. */
|
||||
const UpnpActionComplete *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Assignment operator.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_assign(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p,
|
||||
/*! [in] \b that pointer. */
|
||||
const UpnpActionComplete *q);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Error code getter.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpActionComplete_get_ErrCode(
|
||||
/*! [in] \b this pointer. */
|
||||
const UpnpActionComplete *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Error code setter.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_set_ErrCode(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p,
|
||||
/*! [in] The error code to set. */
|
||||
int n);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Control URL getter.
|
||||
*
|
||||
* \return The control URL string.
|
||||
*/
|
||||
EXPORT_SPEC const UpnpString *UpnpActionComplete_get_CtrlUrl(
|
||||
/*! [in] \b this pointer. */
|
||||
const UpnpActionComplete *p);
|
||||
|
||||
/*!
|
||||
* \brief Control URL getter as a C string
|
||||
*
|
||||
* \return The control URL string.
|
||||
*/
|
||||
EXPORT_SPEC const char *UpnpActionComplete_get_CtrlUrl_cstr(
|
||||
/*! [in] \b this pointer. */
|
||||
const UpnpActionComplete *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Control URL setter.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_set_CtrlUrl(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p,
|
||||
/*! [in] The control URL string to copy. */
|
||||
const UpnpString *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Set the control URL from a null terminated C string.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_strcpy_CtrlUrl(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p,
|
||||
/*! [in] The null terminated control URL C string to copy. */
|
||||
const char *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief ActionRequest document getter.
|
||||
*
|
||||
* \return A pointer to the document object.
|
||||
*/
|
||||
EXPORT_SPEC IXML_Document *UpnpActionComplete_get_ActionRequest(
|
||||
/*! [in] \b this pointer. */
|
||||
const UpnpActionComplete *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief ActionRequest document setter.
|
||||
*
|
||||
* \note The ActionComplete object takes ownership of the document parameter,
|
||||
* i.e. it is responsible for deleting it upon destruction.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_set_ActionRequest(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p,
|
||||
/*! [in] Document to copy. */
|
||||
IXML_Document *d);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief ActionResult document getter.
|
||||
*/
|
||||
EXPORT_SPEC IXML_Document *UpnpActionComplete_get_ActionResult(
|
||||
/*! [in] \b this pointer. */
|
||||
const UpnpActionComplete *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief ActionResult document setter.
|
||||
*
|
||||
* \note The ActionComplete object takes ownership of the document parameter,
|
||||
* i.e. it is responsible for deleting it upon destruction.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpActionComplete_set_ActionResult(
|
||||
/*! [in] \b this pointer. */
|
||||
UpnpActionComplete *p,
|
||||
/*! [in] Document to copy. */
|
||||
IXML_Document *d);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* ACTIONCOMPLETE_H */
|
||||
|
||||
96
upnp/inc/ActionRequest.h
Normal file
96
upnp/inc/ActionRequest.h
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
|
||||
#ifndef ACTIONREQUEST_H
|
||||
#define ACTIONREQUEST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionRequest object declaration.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Returned as part of a \b UPNP_CONTROL_ACTION_COMPLETE callback. */
|
||||
typedef struct s_UpnpActionRequest UpnpActionRequest;
|
||||
|
||||
|
||||
#include "ixml.h" /* for IXML_Document */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpActionRequest *UpnpActionRequest_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpActionRequest_delete(UpnpActionRequest *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpActionRequest *UpnpActionRequest_dup(const UpnpActionRequest *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpActionRequest_assign(UpnpActionRequest *p, const UpnpActionRequest *q);
|
||||
|
||||
/*! The result of the operation */
|
||||
EXPORT_SPEC int UpnpActionRequest_get_ErrCode(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_ErrCode(UpnpActionRequest *p, int n);
|
||||
|
||||
/*! The socket number of the connection to the requestor */
|
||||
EXPORT_SPEC int UpnpActionRequest_get_Socket(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_Socket(UpnpActionRequest *p, int n);
|
||||
|
||||
/*! The error string in case of error */
|
||||
EXPORT_SPEC const UpnpString *UpnpActionRequest_get_ErrStr(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpActionRequest_get_ErrStr_cstr(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_ErrStr(UpnpActionRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpActionRequest_strcpy_ErrStr(UpnpActionRequest *p, const char *s);
|
||||
|
||||
/*! The Action Name */
|
||||
EXPORT_SPEC const UpnpString *UpnpActionRequest_get_ActionName(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpActionRequest_get_ActionName_cstr(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_ActionName(UpnpActionRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpActionRequest_strcpy_ActionName(UpnpActionRequest *p, const char *s);
|
||||
|
||||
/*! The unique device ID */
|
||||
EXPORT_SPEC const UpnpString *UpnpActionRequest_get_DevUDN(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpActionRequest_get_DevUDN_cstr(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_DevUDN(UpnpActionRequest *p, const UpnpString *s);
|
||||
|
||||
/*! The service ID */
|
||||
EXPORT_SPEC const UpnpString *UpnpActionRequest_get_ServiceID(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpActionRequest_get_ServiceID_cstr(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_ServiceID(UpnpActionRequest *p, const UpnpString *s);
|
||||
|
||||
/*! The DOM document describing the action */
|
||||
EXPORT_SPEC IXML_Document *UpnpActionRequest_get_ActionRequest(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_ActionRequest(UpnpActionRequest *p, IXML_Document *d);
|
||||
|
||||
/*! The DOM document describing the result of the action */
|
||||
EXPORT_SPEC IXML_Document *UpnpActionRequest_get_ActionResult(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_ActionResult(UpnpActionRequest *p, IXML_Document *d);
|
||||
|
||||
/*! The DOM document containing the information from the SOAP header */
|
||||
EXPORT_SPEC IXML_Document *UpnpActionRequest_get_SoapHeader(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_SoapHeader(UpnpActionRequest *p, IXML_Document *d);
|
||||
|
||||
/*! IP address of the control point requesting this action */
|
||||
EXPORT_SPEC const struct sockaddr *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p);
|
||||
EXPORT_SPEC void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, const struct sockaddr *sa);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* ACTIONREQUEST_H */
|
||||
|
||||
112
upnp/inc/Discovery.h
Normal file
112
upnp/inc/Discovery.h
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
|
||||
#ifndef DISCOVERY_H
|
||||
#define DISCOVERY_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpDiscovery object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Returned in a \b UPNP_DISCOVERY_RESULT callback. */
|
||||
typedef struct s_UpnpDiscovery UpnpDiscovery;
|
||||
|
||||
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpDiscovery *UpnpDiscovery_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpDiscovery_delete(UpnpDiscovery *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpDiscovery *UpnpDiscovery_dup(const UpnpDiscovery *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpDiscovery_assign(UpnpDiscovery *p, const UpnpDiscovery *q);
|
||||
|
||||
/*! The result code of the \b UpnpSearchAsync call. */
|
||||
EXPORT_SPEC int UpnpDiscovery_get_ErrCode(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_ErrCode(UpnpDiscovery *p, int n);
|
||||
|
||||
/*! The expiration time of the advertisement. */
|
||||
EXPORT_SPEC int UpnpDiscovery_get_Expires(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_Expires(UpnpDiscovery *p, int n);
|
||||
|
||||
/*! The unique device identifier. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_DeviceID(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_DeviceID_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_DeviceID(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_DeviceID(UpnpDiscovery *p, const char *s);
|
||||
|
||||
/*! The device type. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_DeviceType(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_DeviceType_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_DeviceType(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_DeviceType(UpnpDiscovery *p, const char *s);
|
||||
|
||||
/*! The ServiceType. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_ServiceType(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_ServiceType_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_ServiceType(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_ServiceType(UpnpDiscovery *p, const char *s);
|
||||
|
||||
/*! The service version. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_ServiceVer(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_ServiceVer_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_ServiceVer(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_ServiceVer(UpnpDiscovery *p, const char *s);
|
||||
|
||||
/*! The URL to the UPnP description document for the device. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_Location(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_Location_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_Location(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_Location(UpnpDiscovery *p, const char *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strncpy_Location(UpnpDiscovery *p, const char *s, int n);
|
||||
|
||||
/*! The operating system the device is running. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_Os(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_Os_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_Os(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_Os(UpnpDiscovery *p, const char *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strncpy_Os(UpnpDiscovery *p, const char *s, int n);
|
||||
|
||||
/*! Date when the response was generated. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_Date(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_Date_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_Date(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_Date(UpnpDiscovery *p, const char *s);
|
||||
|
||||
/*! Confirmation that the MAN header was understood by the device. */
|
||||
EXPORT_SPEC const UpnpString *UpnpDiscovery_get_Ext(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC const char *UpnpDiscovery_get_Ext_cstr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_Ext(UpnpDiscovery *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strcpy_Ext(UpnpDiscovery *p, const char *s);
|
||||
EXPORT_SPEC void UpnpDiscovery_strncpy_Ext(UpnpDiscovery *p, const char *s, int n);
|
||||
|
||||
/*! The host address of the device responding to the search. */
|
||||
EXPORT_SPEC const struct sockaddr *UpnpDiscovery_get_DestAddr(const UpnpDiscovery *p);
|
||||
EXPORT_SPEC void UpnpDiscovery_set_DestAddr(UpnpDiscovery *p, const struct sockaddr *sa);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* DISCOVERY_H */
|
||||
|
||||
62
upnp/inc/Event.h
Normal file
62
upnp/inc/Event.h
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEvent object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Returned along with a \b UPNP_EVENT_RECEIVED callback. */
|
||||
typedef struct s_UpnpEvent UpnpEvent;
|
||||
|
||||
|
||||
#include "ixml.h" /* for IXML_Document */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpEvent *UpnpEvent_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpEvent_delete(UpnpEvent *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpEvent *UpnpEvent_dup(const UpnpEvent *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpEvent_assign(UpnpEvent *p, const UpnpEvent *q);
|
||||
|
||||
/*! The event sequence number. */
|
||||
EXPORT_SPEC int UpnpEvent_get_EventKey(const UpnpEvent *p);
|
||||
EXPORT_SPEC void UpnpEvent_set_EventKey(UpnpEvent *p, int n);
|
||||
|
||||
/*! The DOM tree representing the changes generating the event. */
|
||||
EXPORT_SPEC IXML_Document *UpnpEvent_get_ChangedVariables(const UpnpEvent *p);
|
||||
EXPORT_SPEC void UpnpEvent_set_ChangedVariables(UpnpEvent *p, IXML_Document *d);
|
||||
|
||||
/*! The subscription ID for this subscription. */
|
||||
EXPORT_SPEC const UpnpString *UpnpEvent_get_SID(const UpnpEvent *p);
|
||||
EXPORT_SPEC const char *UpnpEvent_get_SID_cstr(const UpnpEvent *p);
|
||||
EXPORT_SPEC void UpnpEvent_set_SID(UpnpEvent *p, const UpnpString *s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* EVENT_H */
|
||||
|
||||
74
upnp/inc/EventSubscribe.h
Normal file
74
upnp/inc/EventSubscribe.h
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
|
||||
#ifndef EVENTSUBSCRIBE_H
|
||||
#define EVENTSUBSCRIBE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEventSubscribe object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Returned along with a \b UPNP_EVENT_SUBSCRIBE_COMPLETE or
|
||||
* \b UPNP_EVENT_UNSUBSCRIBE_COMPLETE callback. */
|
||||
typedef struct s_UpnpEventSubscribe UpnpEventSubscribe;
|
||||
|
||||
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpEventSubscribe *UpnpEventSubscribe_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpEventSubscribe_delete(UpnpEventSubscribe *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpEventSubscribe *UpnpEventSubscribe_dup(const UpnpEventSubscribe *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpEventSubscribe_assign(UpnpEventSubscribe *p, const UpnpEventSubscribe *q);
|
||||
|
||||
/*! The result of the operation. */
|
||||
EXPORT_SPEC int UpnpEventSubscribe_get_ErrCode(const UpnpEventSubscribe *p);
|
||||
EXPORT_SPEC void UpnpEventSubscribe_set_ErrCode(UpnpEventSubscribe *p, int n);
|
||||
|
||||
/*! The actual subscription time (for subscriptions only). */
|
||||
EXPORT_SPEC int UpnpEventSubscribe_get_TimeOut(const UpnpEventSubscribe *p);
|
||||
EXPORT_SPEC void UpnpEventSubscribe_set_TimeOut(UpnpEventSubscribe *p, int n);
|
||||
|
||||
/*! The SID for this subscription. For subscriptions, this only
|
||||
* contains a valid SID if the \b Upnp_EventSubscribe.result field
|
||||
* contains a \b UPNP_E_SUCCESS result code. For unsubscriptions,
|
||||
* this contains the SID from which the subscription is being
|
||||
* unsubscribed. */
|
||||
EXPORT_SPEC const UpnpString *UpnpEventSubscribe_get_SID(const UpnpEventSubscribe *p);
|
||||
EXPORT_SPEC const char *UpnpEventSubscribe_get_SID_cstr(const UpnpEventSubscribe *p);
|
||||
EXPORT_SPEC void UpnpEventSubscribe_set_SID(UpnpEventSubscribe *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpEventSubscribe_strcpy_SID(UpnpEventSubscribe *p, const char *s);
|
||||
|
||||
|
||||
/*! The event URL being subscribed to or removed from. */
|
||||
EXPORT_SPEC const UpnpString *UpnpEventSubscribe_get_PublisherUrl(const UpnpEventSubscribe *p);
|
||||
EXPORT_SPEC const char *UpnpEventSubscribe_get_PublisherUrl_cstr(const UpnpEventSubscribe *p);
|
||||
EXPORT_SPEC void UpnpEventSubscribe_set_PublisherUrl(UpnpEventSubscribe *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpEventSubscribe_strcpy_PublisherUrl(UpnpEventSubscribe *p, const char *s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* EVENTSUBSCRIBE_H */
|
||||
|
||||
84
upnp/inc/FileInfo.h
Normal file
84
upnp/inc/FileInfo.h
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
|
||||
#ifndef FILEINFO_H
|
||||
#define FILEINFO_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpFileInfo object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Detailed description of this class should go here */
|
||||
typedef struct s_UpnpFileInfo UpnpFileInfo;
|
||||
|
||||
|
||||
#include "ixml.h" /* for DOMString */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
|
||||
|
||||
#include <sys/types.h> /* for off_t */
|
||||
#include <time.h> /* for time_t */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpFileInfo *UpnpFileInfo_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpFileInfo_delete(UpnpFileInfo *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpFileInfo *UpnpFileInfo_dup(const UpnpFileInfo *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpFileInfo_assign(UpnpFileInfo *p, const UpnpFileInfo *q);
|
||||
|
||||
/*! The length of the file. A length less than 0 indicates the size
|
||||
* is unknown, and data will be sent until 0 bytes are returned from
|
||||
* a read call. */
|
||||
EXPORT_SPEC off_t UpnpFileInfo_get_FileLength(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC void UpnpFileInfo_set_FileLength(UpnpFileInfo *p, off_t l);
|
||||
|
||||
/*! The time at which the contents of the file was modified;
|
||||
* The time system is always local (not GMT). */
|
||||
EXPORT_SPEC const time_t *UpnpFileInfo_get_LastModified(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC void UpnpFileInfo_set_LastModified(UpnpFileInfo *p, const time_t *t);
|
||||
|
||||
/*! If the file is a directory, \b is_directory contains
|
||||
* a non-zero value. For a regular file, it should be 0. */
|
||||
EXPORT_SPEC int UpnpFileInfo_get_IsDirectory(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC void UpnpFileInfo_set_IsDirectory(UpnpFileInfo *p, int b);
|
||||
|
||||
/*! If the file or directory is readable, this contains
|
||||
* a non-zero value. If unreadable, it should be set to 0. */
|
||||
EXPORT_SPEC int UpnpFileInfo_get_IsReadable(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC void UpnpFileInfo_set_IsReadable(UpnpFileInfo *p, int b);
|
||||
|
||||
/*! The content type of the file. */
|
||||
EXPORT_SPEC const DOMString UpnpFileInfo_get_ContentType(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC const char *UpnpFileInfo_get_ContentType_cstr(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC void UpnpFileInfo_set_ContentType(UpnpFileInfo *p, const DOMString s);
|
||||
|
||||
/*! Additional HTTP headers to return. Each header line should be
|
||||
* followed by "\r\n". */
|
||||
EXPORT_SPEC const DOMString UpnpFileInfo_get_ExtraHeaders(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC const char *UpnpFileInfo_get_ExtraHeaders_cstr(const UpnpFileInfo *p);
|
||||
EXPORT_SPEC void UpnpFileInfo_set_ExtraHeaders(UpnpFileInfo *p, const DOMString s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* FILEINFO_H */
|
||||
|
||||
72
upnp/inc/StateVarComplete.h
Normal file
72
upnp/inc/StateVarComplete.h
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
|
||||
#ifndef STATEVARCOMPLETE_H
|
||||
#define STATEVARCOMPLETE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarComplete object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Represents the reply for the current value of a state variable in an
|
||||
* asynchronous call. */
|
||||
typedef struct s_UpnpStateVarComplete UpnpStateVarComplete;
|
||||
|
||||
|
||||
#include "ixml.h" /* for DOMString */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpStateVarComplete *UpnpStateVarComplete_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpStateVarComplete_delete(UpnpStateVarComplete *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpStateVarComplete *UpnpStateVarComplete_dup(const UpnpStateVarComplete *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpStateVarComplete_assign(UpnpStateVarComplete *p, const UpnpStateVarComplete *q);
|
||||
|
||||
/*! The result of the operation */
|
||||
EXPORT_SPEC int UpnpStateVarComplete_get_ErrCode(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC void UpnpStateVarComplete_set_ErrCode(UpnpStateVarComplete *p, int n);
|
||||
|
||||
/*! The control URL for the service. */
|
||||
EXPORT_SPEC const UpnpString *UpnpStateVarComplete_get_CtrlUrl(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarComplete_get_CtrlUrl_cstr(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC void UpnpStateVarComplete_set_CtrlUrl(UpnpStateVarComplete *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpStateVarComplete_strcpy_CtrlUrl(UpnpStateVarComplete *p, const char *s);
|
||||
|
||||
/*! The name of the variable. */
|
||||
EXPORT_SPEC const UpnpString *UpnpStateVarComplete_get_StateVarName(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarComplete_get_StateVarName_cstr(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC void UpnpStateVarComplete_set_StateVarName(UpnpStateVarComplete *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpStateVarComplete_strcpy_StateVarName(UpnpStateVarComplete *p, const char *s);
|
||||
|
||||
/*! The current value of the variable. This needs to be allocated by
|
||||
* the caller. When finished with it, the SDK frees this \b DOMString. */
|
||||
EXPORT_SPEC const DOMString UpnpStateVarComplete_get_CurrentVal(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarComplete_get_CurrentVal_cstr(const UpnpStateVarComplete *p);
|
||||
EXPORT_SPEC void UpnpStateVarComplete_set_CurrentVal(UpnpStateVarComplete *p, const DOMString s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* STATEVARCOMPLETE_H */
|
||||
|
||||
91
upnp/inc/StateVarRequest.h
Normal file
91
upnp/inc/StateVarRequest.h
Normal file
@@ -0,0 +1,91 @@
|
||||
|
||||
|
||||
#ifndef STATEVARREQUEST_H
|
||||
#define STATEVARREQUEST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarRequest object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Represents the request for current value of a state variable in a service
|
||||
* state table. */
|
||||
typedef struct s_UpnpStateVarRequest UpnpStateVarRequest;
|
||||
|
||||
|
||||
#include "ixml.h" /* for DOMString */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpStateVarRequest *UpnpStateVarRequest_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpStateVarRequest_delete(UpnpStateVarRequest *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpStateVarRequest *UpnpStateVarRequest_dup(const UpnpStateVarRequest *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpStateVarRequest_assign(UpnpStateVarRequest *p, const UpnpStateVarRequest *q);
|
||||
|
||||
/*! The result of the operation */
|
||||
EXPORT_SPEC int UpnpStateVarRequest_get_ErrCode(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_ErrCode(UpnpStateVarRequest *p, int n);
|
||||
|
||||
/*! The socket number of the connection to the requestor */
|
||||
EXPORT_SPEC int UpnpStateVarRequest_get_Socket(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_Socket(UpnpStateVarRequest *p, int n);
|
||||
|
||||
/*! The error string in case of error */
|
||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_ErrStr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_ErrStr_cstr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_ErrStr(UpnpStateVarRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_strcpy_ErrStr(UpnpStateVarRequest *p, const char *s);
|
||||
|
||||
/*! The unique device ID */
|
||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_DevUDN(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_DevUDN_cstr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_DevUDN(UpnpStateVarRequest *p, const UpnpString *s);
|
||||
|
||||
/*! The service ID */
|
||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_ServiceID(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_ServiceID_cstr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_ServiceID(UpnpStateVarRequest *p, const UpnpString *s);
|
||||
|
||||
/*! The name of the variable. */
|
||||
EXPORT_SPEC const UpnpString *UpnpStateVarRequest_get_StateVarName(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_StateVarName_cstr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_StateVarName(UpnpStateVarRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_strcpy_StateVarName(UpnpStateVarRequest *p, const char *s);
|
||||
|
||||
/*! IP address of sender requesting the state variable. */
|
||||
EXPORT_SPEC const struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, const struct sockaddr *sa);
|
||||
|
||||
/*! The current value of the variable. This needs to be allocated by
|
||||
* the caller. When finished with it, the SDK frees this \b DOMString. */
|
||||
EXPORT_SPEC const DOMString UpnpStateVarRequest_get_CurrentVal(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC const char *UpnpStateVarRequest_get_CurrentVal_cstr(const UpnpStateVarRequest *p);
|
||||
EXPORT_SPEC void UpnpStateVarRequest_set_CurrentVal(UpnpStateVarRequest *p, const DOMString s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* STATEVARREQUEST_H */
|
||||
|
||||
66
upnp/inc/SubscriptionRequest.h
Normal file
66
upnp/inc/SubscriptionRequest.h
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
|
||||
#ifndef SUBSCRIPTIONREQUEST_H
|
||||
#define SUBSCRIPTIONREQUEST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpSubscriptionRequest object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/*! Returned along with a \b UPNP_EVENT_SUBSCRIPTION_REQUEST callback. */
|
||||
typedef struct s_UpnpSubscriptionRequest UpnpSubscriptionRequest;
|
||||
|
||||
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*! Constructor */
|
||||
EXPORT_SPEC UpnpSubscriptionRequest *UpnpSubscriptionRequest_new();
|
||||
|
||||
/*! Destructor */
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_delete(UpnpSubscriptionRequest *p);
|
||||
|
||||
/*! Copy Constructor */
|
||||
EXPORT_SPEC UpnpSubscriptionRequest *UpnpSubscriptionRequest_dup(const UpnpSubscriptionRequest *p);
|
||||
|
||||
/*! Assignment operator */
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_assign(UpnpSubscriptionRequest *p, const UpnpSubscriptionRequest *q);
|
||||
|
||||
/*! The identifier for the service being subscribed to. */
|
||||
EXPORT_SPEC const UpnpString *UpnpSubscriptionRequest_get_ServiceId(const UpnpSubscriptionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpSubscriptionRequest_get_ServiceId_cstr(const UpnpSubscriptionRequest *p);
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_set_ServiceId(UpnpSubscriptionRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_strcpy_ServiceId(UpnpSubscriptionRequest *p, const char *s);
|
||||
|
||||
/*! Universal device name. */
|
||||
EXPORT_SPEC const UpnpString *UpnpSubscriptionRequest_get_UDN(const UpnpSubscriptionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpSubscriptionRequest_get_UDN_cstr(const UpnpSubscriptionRequest *p);
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_set_UDN(UpnpSubscriptionRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_strcpy_UDN(UpnpSubscriptionRequest *p, const char *s);
|
||||
|
||||
/*! The assigned subscription ID for this subscription. */
|
||||
EXPORT_SPEC const UpnpString *UpnpSubscriptionRequest_get_SID(const UpnpSubscriptionRequest *p);
|
||||
EXPORT_SPEC const char *UpnpSubscriptionRequest_get_SID_cstr(const UpnpSubscriptionRequest *p);
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_set_SID(UpnpSubscriptionRequest *p, const UpnpString *s);
|
||||
EXPORT_SPEC void UpnpSubscriptionRequest_strcpy_SID(UpnpSubscriptionRequest *p, const char *s);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* SUBSCRIPTIONREQUEST_H */
|
||||
|
||||
120
upnp/inc/UpnpGlobal.h
Normal file
120
upnp/inc/UpnpGlobal.h
Normal file
@@ -0,0 +1,120 @@
|
||||
|
||||
|
||||
#ifndef UPNPGLOBAL_H
|
||||
#define UPNPGLOBAL_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Defines constants that for some reason are not defined on some systems.
|
||||
*/
|
||||
|
||||
|
||||
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
||||
#if defined __GNUC__
|
||||
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
||||
#else
|
||||
#error libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* EXPORT_SPEC
|
||||
*/
|
||||
#ifdef UPNP_STATIC_LIB
|
||||
#define EXPORT_SPEC
|
||||
#else /* UPNP_STATIC_LIB */
|
||||
#ifdef LIBUPNP_EXPORTS
|
||||
/*! set up declspec for dll export to make functions
|
||||
* visible to library users */
|
||||
#define EXPORT_SPEC __declspec(dllexport)
|
||||
#else /* LIBUPNP_EXPORTS */
|
||||
#define EXPORT_SPEC __declspec(dllimport)
|
||||
#endif /* LIBUPNP_EXPORTS */
|
||||
#endif /* UPNP_STATIC_LIB */
|
||||
|
||||
|
||||
/*
|
||||
* UPNP_INLINE
|
||||
* PRId64
|
||||
* PRIzu
|
||||
*/
|
||||
#ifdef UPNP_USE_MSVCPP
|
||||
/* define some things the M$ VC++ doesn't know */
|
||||
#define UPNP_INLINE
|
||||
typedef __int64 int64_t;
|
||||
#define PRId64 "I64d"
|
||||
#define PRIzu "lu"
|
||||
#endif /* UPNP_USE_MSVCPP */
|
||||
|
||||
|
||||
#ifdef UPNP_USE_BCBPP
|
||||
/* define some things Borland Builder doesn't know */
|
||||
#define UPNP_INLINE inline
|
||||
typedef __int64 int64_t;
|
||||
#warning The Borland C compiler is probably broken on PRId64,
|
||||
#warning please someone provide a proper fix here
|
||||
#define PRId64 "I64d"
|
||||
#define PRIzu "zu"
|
||||
#endif /* UPNP_USE_BCBPP */
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UPNP_INLINE inline
|
||||
|
||||
/* Note with PRIzu that in the case of Mingw32, it's the MS C
|
||||
* runtime printf which ends up getting called, not the glibc
|
||||
* printf, so it genuinely doesn't have "zu"
|
||||
*/
|
||||
#define PRIzu "lu"
|
||||
#endif /* __GNUC__ */
|
||||
#else
|
||||
/*!
|
||||
* \brief Export functions on WIN32 DLLs.
|
||||
*
|
||||
* Every funtion that belongs to the library API must use this
|
||||
* definition upon declaration or it will not be exported on WIN32
|
||||
* DLLs.
|
||||
*/
|
||||
#define EXPORT_SPEC
|
||||
|
||||
/*!
|
||||
* \brief Declares an inline function.
|
||||
*
|
||||
* Surprisingly, there are some compilers that do not understand the
|
||||
* inline keyword. This definition makes the use of this keyword
|
||||
* portable to these systems.
|
||||
*/
|
||||
#define UPNP_INLINE inline
|
||||
|
||||
/*!
|
||||
* \brief Supply the PRId64 printf() macro.
|
||||
*
|
||||
* MSVC still does not know about this.
|
||||
*/
|
||||
/* #define PRId64 PRId64 */
|
||||
|
||||
/*!
|
||||
* \brief Supply the PRIzu printf() macro.
|
||||
*
|
||||
* This macro was invented so that we can live a little longer with
|
||||
* MSVC lack of C99. "z" is the correct printf() size specifier for
|
||||
* the size_t type.
|
||||
*/
|
||||
#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*/
|
||||
|
||||
|
||||
#endif /* UPNPGLOBAL_H */
|
||||
|
||||
30
upnp/inc/UpnpInet.h
Normal file
30
upnp/inc/UpnpInet.h
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
#ifndef UPNPINET_H
|
||||
#define UPNPINET_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Provides a platform independent way to include TCP/IP types and functions.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <Ws2tcpip.h>
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
#if (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__)
|
||||
#include <ifaddrs.h>
|
||||
/* Do not move or remove the include below for "sys/socket"!
|
||||
* Will break FreeBSD builds. */
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* UPNPINET_H */
|
||||
|
||||
133
upnp/inc/UpnpString.h
Normal file
133
upnp/inc/UpnpString.h
Normal file
@@ -0,0 +1,133 @@
|
||||
|
||||
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
|
||||
|
||||
/*!
|
||||
* \defgroup UpnpString The UpnpString Class
|
||||
*
|
||||
* \brief Implements string operations in the UPnP library.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*
|
||||
* \version 1.0
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpString object declarartion.
|
||||
*/
|
||||
|
||||
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Type of the string objects inside libupnp.
|
||||
*/
|
||||
typedef struct s_UpnpString UpnpString;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Constructor.
|
||||
*
|
||||
* \return A pointer to a new allocated object.
|
||||
*/
|
||||
EXPORT_SPEC UpnpString *UpnpString_new();
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Destructor.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpString_delete(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
UpnpString *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Copy Constructor.
|
||||
*
|
||||
* \return A pointer to a new allocated copy of the original object.
|
||||
*/
|
||||
EXPORT_SPEC UpnpString *UpnpString_dup(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
const UpnpString *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Assignment operator.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpString_assign(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
UpnpString *p,
|
||||
/*! [in] The \em \b that pointer. */
|
||||
const UpnpString *q);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Returns the length of the string.
|
||||
*
|
||||
* \return The length of the string.
|
||||
* */
|
||||
EXPORT_SPEC int UpnpString_get_Length(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
const UpnpString *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Returns the pointer to char.
|
||||
*
|
||||
* \return The pointer to char.
|
||||
*/
|
||||
EXPORT_SPEC const char *UpnpString_get_String(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
const UpnpString *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Sets the string from a pointer to char.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpString_set_String(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
UpnpString *p,
|
||||
/*! [in] (char *) to copy from. */
|
||||
const char *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Sets the string from a pointer to char using a maximum of N chars.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpString_set_StringN(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
UpnpString *p,
|
||||
/*! [in] (char *) to copy from. */
|
||||
const char *s,
|
||||
/*! Maximum number of chars to copy.*/
|
||||
int n);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Clears the string, sets its size to zero.
|
||||
*/
|
||||
EXPORT_SPEC void UpnpString_clear(
|
||||
/*! [in] The \em \b this pointer. */
|
||||
UpnpString *p);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/* @} UpnpString The UpnpString API */
|
||||
|
||||
|
||||
#endif /* STRING_H */
|
||||
|
||||
3882
upnp/inc/upnp.h
3882
upnp/inc/upnp.h
File diff suppressed because it is too large
Load Diff
@@ -7,12 +7,12 @@
|
||||
* 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,
|
||||
* - 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,
|
||||
* - 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
|
||||
* - 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.
|
||||
*
|
||||
@@ -33,25 +33,34 @@
|
||||
#ifndef UPNP_DEBUG_H
|
||||
#define UPNP_DEBUG_H
|
||||
|
||||
#include "upnp.h"
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#include "ThreadPool.h"
|
||||
#include "upnpconfig.h"
|
||||
#include "UpnpGlobal.h" /* for UPNP_INLINE */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** @name Other debugging features
|
||||
The UPnP SDK contains other features to aid in debugging.
|
||||
/** \name Other debugging features
|
||||
*
|
||||
* The UPnP SDK contains other features to aid in debugging.
|
||||
*/
|
||||
/*@{*/
|
||||
|
||||
/*! @{ */
|
||||
|
||||
/** @name Upnp_LogLevel
|
||||
/** \name Upnp_LogLevel
|
||||
* The user has the option to select 4 different types of debugging levels,
|
||||
* see {\tt UpnpSetLogLevel}.
|
||||
* see \c UpnpSetLogLevel.
|
||||
* The critical level will show only those messages
|
||||
* which can halt the normal processing of the library, like memory
|
||||
* allocation errors. The remaining three levels are just for debugging
|
||||
@@ -60,14 +69,11 @@ extern "C" {
|
||||
* Info Level displays the other important operational information
|
||||
* regarding the working of the library. If the user selects All,
|
||||
* then the library displays all the debugging information that it has.
|
||||
* \begin{itemize}
|
||||
* \item {\tt UPNP_CRITICAL [0]}
|
||||
* \item {\tt UPNP_PACKET [1]}
|
||||
* \item {\tt UPNP_INFO [2]}
|
||||
* \item {\tt UPNP_ALL [3]}
|
||||
* \end{itemize}
|
||||
* \li \c UPNP_CRITICAL [0]
|
||||
* \li \c UPNP_PACKET [1]
|
||||
* \li \c UPNP_INFO [2]
|
||||
* \li \c UPNP_ALL [3]
|
||||
*/
|
||||
|
||||
typedef enum Upnp_Module {
|
||||
SSDP,
|
||||
SOAP,
|
||||
@@ -79,91 +85,69 @@ typedef enum Upnp_Module {
|
||||
HTTP
|
||||
} Dbg_Module;
|
||||
|
||||
/*! @{ */
|
||||
|
||||
/*@{*/
|
||||
typedef enum Upnp_LogLevel_e {
|
||||
UPNP_CRITICAL,
|
||||
UPNP_PACKET,
|
||||
UPNP_INFO,
|
||||
UPNP_ALL
|
||||
} Upnp_LogLevel;
|
||||
/*! @} */
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* Default log level : see {\tt Upnp_LogLevel}
|
||||
* Default log level : see \c Upnp_LogLevel
|
||||
*/
|
||||
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpInitLog
|
||||
/*!
|
||||
* \brief Initialize the log files.
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Description:
|
||||
* This functions initializes the log files
|
||||
*
|
||||
* Returns: int
|
||||
* -1 : If fails
|
||||
* UPNP_E_SUCCESS : if success
|
||||
***************************************************************************/
|
||||
* \return -1 if fails or UPNP_E_SUCCESS if succeeds.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
int UpnpInitLog();
|
||||
int UpnpInitLog(void);
|
||||
#else
|
||||
static UPNP_INLINE int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
||||
static UPNP_INLINE int UpnpInitLog(void)
|
||||
{
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpSetLogLevel
|
||||
*
|
||||
* Parameters: Upnp_LogLevel log_level
|
||||
*
|
||||
* Description:
|
||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
/*!
|
||||
* \brief Set the log level (see \c Upnp_LogLevel).
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
||||
void UpnpSetLogLevel(
|
||||
/*! [in] Log level. */
|
||||
Upnp_LogLevel log_level);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpCloseLog
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Description:
|
||||
* This functions closes the log files
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
/*!
|
||||
* \brief Closes the log files.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpCloseLog();
|
||||
void UpnpCloseLog(void);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpCloseLog() {}
|
||||
static UPNP_INLINE void UpnpCloseLog(void) {}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpSetLogFileNames
|
||||
*
|
||||
* Parameters:
|
||||
* IN const char* ErrFileName: name of the error file
|
||||
* IN const char *InfoFileName: name of the information file
|
||||
* IN int size: Size of the buffer
|
||||
* IN int starLength: This parameter provides the width of the banner
|
||||
*
|
||||
* Description:
|
||||
* This functions takes the buffer and writes the buffer in the file as
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
/*!
|
||||
* \brief Set the name for error and information files, respectively.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpSetLogFileNames(
|
||||
/*! [in] Name of the error file. */
|
||||
const char *ErrFileName,
|
||||
/*! [in] Name of the information file. */
|
||||
const char *InfoFileName);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpSetLogFileNames(
|
||||
@@ -172,24 +156,20 @@ static UPNP_INLINE void UpnpSetLogFileNames(
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpGetDebugFile
|
||||
/*!
|
||||
* \brief Check if the module is turned on for debug and returns the file
|
||||
* descriptor corresponding to the debug level
|
||||
*
|
||||
* 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 function checks if the module is turned on for debug
|
||||
* and returns the file descriptor corresponding to the debug level
|
||||
* Returns: FILE *
|
||||
* NULL : if the module is turn off for debug
|
||||
* else returns the right file descriptor
|
||||
***************************************************************************/
|
||||
* \return NULL if the module is turn off for debug otheriwse returns the
|
||||
* right file descriptor.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module);
|
||||
FILE *UpnpGetDebugFile(
|
||||
/*! [in] The level of the debug logging. It will decide whether debug
|
||||
* statement will go to standard output, or any of the log files. */
|
||||
Upnp_LogLevel level,
|
||||
/*! [in] debug will go in the name of this module. */
|
||||
Dbg_Module module);
|
||||
#else
|
||||
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
||||
{
|
||||
@@ -198,60 +178,47 @@ static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : DebugAtThisLevel
|
||||
/*!
|
||||
* \brief Returns true if debug output should be done in this module.
|
||||
*
|
||||
* 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
|
||||
***************************************************************************/
|
||||
* \return Nonzero value if true, zero if false.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
int DebugAtThisLevel(
|
||||
IN Upnp_LogLevel DLevel,
|
||||
IN Dbg_Module Module);
|
||||
/*! [in] The level of the debug logging. It will decide whether debug
|
||||
* statement will go to standard output, or any of the log files. */
|
||||
Upnp_LogLevel DLevel,
|
||||
/*! [in] Debug will go in the name of this module. */
|
||||
Dbg_Module Module);
|
||||
#else
|
||||
static UPNP_INLINE int DebugAtThisLevel(
|
||||
IN Upnp_LogLevel DLevel,
|
||||
IN Dbg_Module Module) { return 0; }
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpPrintf
|
||||
*
|
||||
* 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
|
||||
* IN char *DbgFileName: Name of the file from where debug statement is
|
||||
* coming
|
||||
* IN int DbgLineNo : Line number of the file from where debug statement
|
||||
* is coming
|
||||
* IN char * FmtStr, ...: Variable number of arguments that will go
|
||||
* in the debug statement
|
||||
*
|
||||
* Description:
|
||||
* This functions prints the debug statement either on the startdard
|
||||
* output or log file along with the information from where this
|
||||
* debug statement is coming
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
/*!
|
||||
* \brief Prints the debug statement either on the standard output or log file
|
||||
* along with the information from where this debug statement is coming.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpPrintf(
|
||||
/*! [in] The level of the debug logging. It will decide whether debug
|
||||
* statement will go to standard output, or any of the log files. */
|
||||
Upnp_LogLevel DLevel,
|
||||
/*! [in] debug will go in the name of this module. */
|
||||
Dbg_Module Module,
|
||||
/*! [in] Name of the file from where debug statement is coming. */
|
||||
const char* DbgFileName,
|
||||
/*! [in] Line number of the file from where debug statement is coming. */
|
||||
int DbgLineNo,
|
||||
/*! [in] Printf like format specification. */
|
||||
const char* FmtStr,
|
||||
/*! [in] Printf like Variable number of arguments that will go in the debug
|
||||
* statement. */
|
||||
...)
|
||||
#if (__GNUC__ >= 3)
|
||||
/* This enables printf like format checking by the compiler */
|
||||
@@ -265,29 +232,44 @@ static UPNP_INLINE void UpnpPrintf(
|
||||
const char* DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char* FmtStr,
|
||||
...) {}
|
||||
...)
|
||||
{
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayBanner
|
||||
*
|
||||
* Parameters:
|
||||
* IN FILE *fd: file descriptor where the banner will be written
|
||||
* IN char **lines: The buffer that will be written
|
||||
* IN int size: Size of the buffer
|
||||
* IN int starLength: This parameter provides the width of the banner
|
||||
*
|
||||
* Description:
|
||||
* This functions takes the buffer and writes the buffer in the file as
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
/*!
|
||||
* \brief Writes the file name and file number from where debug statement is
|
||||
* coming to the log file.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayFileAndLine(
|
||||
/*! [in] File descriptor where line number and file name will be written. */
|
||||
FILE *fd,
|
||||
/*! [in] Name of the file. */
|
||||
const char *DbgFileName,
|
||||
/*! [in] Line number of the file. */
|
||||
int DbgLineNo);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
||||
FILE *fd,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo) {}
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Writes the buffer in the file as per the requested banner
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
/*! [in] file descriptor where the banner will be written. */
|
||||
FILE *fd,
|
||||
/*! [in] The buffer that will be written. */
|
||||
const char **lines,
|
||||
/*! [in] Size of the buffer. */
|
||||
size_t size,
|
||||
/*! [in] This parameter provides the width of the banner. */
|
||||
int starlength);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpDisplayBanner(
|
||||
@@ -298,33 +280,31 @@ static UPNP_INLINE void UpnpDisplayBanner(
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayFileAndLine
|
||||
*
|
||||
* Parameters:
|
||||
* IN FILE *fd: File descriptor where line number and file name will be
|
||||
* written
|
||||
* IN char *DbgFileName: Name of the file
|
||||
* IN int DbgLineNo : Line number of the file
|
||||
*
|
||||
* Description:
|
||||
* This function writes the file name and file number from where
|
||||
* debug statement is coming to the log file
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
/*!
|
||||
* \brief Prints thread pool statistics.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayFileAndLine(
|
||||
FILE *fd,
|
||||
void PrintThreadPoolStats(
|
||||
/*! [in] The thread pool. */
|
||||
ThreadPool *tp,
|
||||
/*! [in] The file name that called this function, use the macro __FILE__. */
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo);
|
||||
/*! [in] The line number that the function was called, use the macro __LINE__. */
|
||||
int DbgLineNo,
|
||||
/*! [in] The message. */
|
||||
const char *msg);
|
||||
#else
|
||||
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
||||
FILE *fd,
|
||||
static UPNP_INLINE void PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo) {}
|
||||
int DbgLineNo,
|
||||
const char *msg)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! @} */
|
||||
|
||||
/*@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -29,201 +29,237 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/** @name Optional Tool APIs
|
||||
* The Linux SDK for UPnP Devices contains some additional, optional
|
||||
* utility APIs that can be helpful in writing applications using the
|
||||
* SDK. These additional APIs can be compiled out in order to save code
|
||||
* size in the SDK. Refer to the README for details.
|
||||
*/
|
||||
|
||||
/*! @{ */
|
||||
|
||||
#ifndef UPNP_TOOLS_H
|
||||
#define UPNP_TOOLS_H
|
||||
|
||||
#include "upnp.h"
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \defgroup UPnPTools Optional Tool API
|
||||
*
|
||||
* \brief Additional, optional utility API that can be helpful in writing
|
||||
* applications.
|
||||
*
|
||||
* This additional API can be compiled out in order to save code size in the
|
||||
* library. Refer to the file README for details.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#include "ixml.h" /* for IXML_Document */
|
||||
|
||||
|
||||
/* Function declarations only if tools compiled into the library */
|
||||
#if UPNP_HAVE_TOOLS
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** {\bf UpnpResolveURL} combines a base URL and a relative URL into
|
||||
* a single absolute URL. The memory for {\bf AbsURL} needs to be
|
||||
* allocated by the caller and must be large enough to hold the
|
||||
* {\bf BaseURL} and {\bf RelURL} combined.
|
||||
|
||||
/*!
|
||||
* \brief Converts an SDK error code into a string error message suitable for
|
||||
* display. The memory returned from this function should NOT be freed.
|
||||
*
|
||||
* @return [int] An integer representing one of the following:
|
||||
* \begin{itemize}
|
||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
||||
* \item {\tt UPNP_E_INVALID_PARAM}: {\bf RelURL} is {\tt NULL}.
|
||||
* \item {\tt UPNP_E_INVALID_URL}: The {\bf BaseURL} / {\bf RelURL}
|
||||
* combination does not form a valid URL.
|
||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
* \end{itemize}
|
||||
* \return An ASCII text string representation of the error message associated
|
||||
* with the error code or the string "Unknown error code"
|
||||
*/
|
||||
|
||||
EXPORT_SPEC int UpnpResolveURL(
|
||||
IN const char * BaseURL, /** The base URL to combine. */
|
||||
IN const char * RelURL, /** The relative URL to {\bf BaseURL}. */
|
||||
OUT char * AbsURL /** A pointer to a buffer to store the
|
||||
absolute URL. */
|
||||
);
|
||||
|
||||
/** {\bf UpnpMakeAction} creates an action request packet based on its input
|
||||
* parameters (status variable name and value pair). Any number of input
|
||||
* parameters can be passed to this function but every input variable name
|
||||
* should have a matching value argument.
|
||||
*
|
||||
* @return [IXML_Document*] The action node of {\bf Upnp_Document} type or
|
||||
* {\tt NULL} if the operation failed.
|
||||
*/
|
||||
|
||||
EXPORT_SPEC IXML_Document* UpnpMakeAction(
|
||||
IN const char * ActionName, /** The action name. */
|
||||
IN const char * ServType, /** The service type. */
|
||||
IN int NumArg, /** Number of argument pairs to be passed. */
|
||||
IN const char * Arg, /** Status variable name and value pair. */
|
||||
IN ... /* Other status variable name and value pairs. */
|
||||
);
|
||||
|
||||
/** {\bf UpnpAddToAction} creates an action request packet based on its input
|
||||
* parameters (status variable name and value pair). This API is specially
|
||||
* suitable inside a loop to add any number input parameters into an existing
|
||||
* action. If no action document exists in the beginning then a
|
||||
* {\bf Upnp_Document} variable initialized with {\tt NULL} should be passed
|
||||
* as a parameter.
|
||||
*
|
||||
* @return [int] An integer representing one of the following:
|
||||
* \begin{itemize}
|
||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
||||
* \item {\tt UPNP_E_INVALID_PARAM}: One or more of the parameters
|
||||
* are invalid.
|
||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
* \end{itemize}
|
||||
*/
|
||||
|
||||
EXPORT_SPEC int UpnpAddToAction(
|
||||
IN OUT IXML_Document ** ActionDoc,
|
||||
/** A pointer to store the action
|
||||
document node. */
|
||||
IN const char * ActionName, /** The action name. */
|
||||
IN const char * ServType, /** The service type. */
|
||||
IN const char * ArgName, /** The status variable name. */
|
||||
IN const char * ArgVal /** The status variable value. */
|
||||
);
|
||||
|
||||
/** {\bf UpnpMakeActionResponse} creates an action response packet based
|
||||
* on its output parameters (status variable name and value pair). Any
|
||||
* number of input parameters can be passed to this function but every output
|
||||
* variable name should have a matching value argument.
|
||||
*
|
||||
* @return [IXML_Document*] The action node of {\bf Upnp_Document} type or
|
||||
* {\tt NULL} if the operation failed.
|
||||
*/
|
||||
|
||||
EXPORT_SPEC IXML_Document* UpnpMakeActionResponse(
|
||||
IN const char * ActionName, /** The action name. */
|
||||
IN const char * ServType, /** The service type. */
|
||||
IN int NumArg, /** The number of argument pairs passed. */
|
||||
IN const char * Arg, /** The status variable name and value pair. */
|
||||
IN ... /* Other status variable name and value pairs. */
|
||||
);
|
||||
|
||||
/** {\bf UpnpAddToActionResponse} creates an action response
|
||||
* packet based on its output parameters (status variable name
|
||||
* and value pair). This API is especially suitable inside
|
||||
* a loop to add any number of input parameters into an existing action
|
||||
* response. If no action document exists in the beginning, a
|
||||
* {\bf Upnp_Document} variable initialized with {\tt NULL} should be passed
|
||||
* as a parameter.
|
||||
*
|
||||
* @return [int] An integer representing one of the following:
|
||||
* \begin{itemize}
|
||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
||||
* \item {\tt UPNP_E_INVALID_PARAM}: One or more of the parameters
|
||||
* are invalid.
|
||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
* \end{itemize}
|
||||
*/
|
||||
|
||||
EXPORT_SPEC int UpnpAddToActionResponse(
|
||||
IN OUT IXML_Document ** ActionResponse,
|
||||
/** Pointer to a document to
|
||||
store the action document
|
||||
node. */
|
||||
IN const char * ActionName, /** The action name. */
|
||||
IN const char * ServType, /** The service type. */
|
||||
IN const char * ArgName, /** The status variable name. */
|
||||
IN const char * ArgVal /** The status variable value. */
|
||||
);
|
||||
|
||||
/** {\bf UpnpAddToPropertySet} can be used when an application needs to
|
||||
* transfer the status of many variables at once. It can be used
|
||||
* (inside a loop) to add some extra status variables into an existing
|
||||
* property set. If the application does not already have a property
|
||||
* set document, the application should create a variable initialized
|
||||
* with {\tt NULL} and pass that as the first parameter.
|
||||
*
|
||||
* @return [int] An integer representing one of the following:
|
||||
* \begin{itemize}
|
||||
* \item {\tt UPNP_E_SUCCESS}: The operation completed successfully.
|
||||
* \item {\tt UPNP_E_INVALID_PARAM}: One or more of the parameters
|
||||
* are invalid.
|
||||
* \item {\tt UPNP_E_OUTOF_MEMORY}: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
* \end{itemize}
|
||||
*
|
||||
*/
|
||||
|
||||
EXPORT_SPEC int UpnpAddToPropertySet(
|
||||
IN OUT IXML_Document **PropSet,
|
||||
/** A pointer to the document containing
|
||||
the property set document node. */
|
||||
IN const char * ArgName, /** The status variable name. */
|
||||
IN const char * ArgVal /** The status variable value. */
|
||||
);
|
||||
|
||||
/** {\bf UpnpCreatePropertySet} creates a property set
|
||||
* message packet. Any number of input parameters can be passed
|
||||
* to this function but every input variable name should have
|
||||
* a matching value input argument.
|
||||
*
|
||||
* @return [IXML_Document*] {\tt NULL} on failure, or the property-set
|
||||
* document node.
|
||||
*
|
||||
*/
|
||||
|
||||
EXPORT_SPEC IXML_Document* UpnpCreatePropertySet(
|
||||
IN int NumArg, /** The number of argument pairs passed. */
|
||||
IN const char* Arg, /** The status variable name and value pair. */
|
||||
IN ...
|
||||
);
|
||||
|
||||
/** {\bf UpnpGetErrorMessage} converts an SDK error code into a
|
||||
* string error message suitable for display. The memory returned
|
||||
* from this function should NOT be freed.
|
||||
*
|
||||
* @return [char*] An ASCII text string representation of the error message
|
||||
* associated with the error code.
|
||||
*/
|
||||
|
||||
EXPORT_SPEC const char *UpnpGetErrorMessage(
|
||||
int errorcode /** The SDK error code to convert. */
|
||||
);
|
||||
/*! [in] The SDK error code to convert. */
|
||||
int errorcode);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Combines a base URL and a relative URL into a single absolute URL.
|
||||
*
|
||||
* The memory for \b AbsURL needs to be allocated by the caller and must
|
||||
* be large enough to hold the \b BaseURL and \b RelURL combined.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||
* \li <tt>UPNP_E_INVALID_PARAM</tt>: \b RelURL is <tt>NULL</tt>.
|
||||
* \li <tt>UPNP_E_INVALID_URL</tt>: The \b BaseURL / \b RelURL
|
||||
* combination does not form a valid URL.
|
||||
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpResolveURL(
|
||||
/*! [in] The base URL to combine. */
|
||||
const char *BaseURL,
|
||||
/*! [in] The relative URL to \b BaseURL. */
|
||||
const char *RelURL,
|
||||
/*! [out] A pointer to a buffer to store the absolute URL. */
|
||||
char *AbsURL);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Creates an action request packet based on its input parameters
|
||||
* (status variable name and value pair).
|
||||
*
|
||||
* Any number of input parameters can be passed to this function but every
|
||||
* input variable name should have a matching value argument.
|
||||
*
|
||||
* It is a wrapper function that calls makeAction() function to create the
|
||||
* action request.
|
||||
*
|
||||
* \return The action node of \b Upnp_Document type or <tt>NULL</tt> if the
|
||||
* operation failed.
|
||||
*/
|
||||
EXPORT_SPEC IXML_Document *UpnpMakeAction(
|
||||
/*! [in] Name of the action request or response. */
|
||||
const char *ActionName,
|
||||
/*! [in] The service type. */
|
||||
const char *ServType,
|
||||
/*! [in] Number of argument pairs to be passed. */
|
||||
int NumArg,
|
||||
/*! [in] pointer to the first argument. */
|
||||
const char *Arg,
|
||||
/*! [in] Argument list. */
|
||||
...);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Ceates an action response packet based on its output parameters
|
||||
* (status variable name and value pair).
|
||||
*
|
||||
* Any number of input parameters can be passed to this function but every
|
||||
* output variable name should have a matching value argument.
|
||||
*
|
||||
* It is a wrapper function that calls makeAction() function to create the
|
||||
* action request.
|
||||
*
|
||||
* \return The action node of \b Upnp_Document type or <tt>NULL</tt> if the
|
||||
* operation failed.
|
||||
*/
|
||||
EXPORT_SPEC IXML_Document *UpnpMakeActionResponse(
|
||||
/*! [in] The action name. */
|
||||
const char *ActionName,
|
||||
/*! [in] The service type.. */
|
||||
const char *ServType,
|
||||
/*! [in] The number of argument pairs passed. */
|
||||
int NumArg,
|
||||
/*! [in] The status variable name and value pair. */
|
||||
const char *Arg,
|
||||
/*! [in] Other status variable name and value pairs. */
|
||||
...);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Adds the argument in the action request.
|
||||
*
|
||||
* This API is specially suitable inside a loop to add any number input
|
||||
* parameters into an existing action. If no action document exists in the
|
||||
* beginning then a <b>Upnp_Document variable initialized with <tt>NULL</tt></b>
|
||||
* should be passed as a parameter.
|
||||
*
|
||||
* It is a wrapper function that calls addToAction() function to add the
|
||||
* argument in the action request.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||
* \li <tt>UPNP_E_INVALID_PARAM</tt>: One or more of the parameters are invalid.
|
||||
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpAddToAction(
|
||||
/*! [in,out] A pointer to store the action document node. */
|
||||
IXML_Document **ActionDoc,
|
||||
/*! [in] The action name. */
|
||||
const char *ActionName,
|
||||
/*! [in] The service type. */
|
||||
const char *ServType,
|
||||
/*! [in] The status variable name. */
|
||||
const char *ArgName,
|
||||
/*! [in] The status variable value. */
|
||||
const char *ArgVal);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Creates an action response packet based on its output parameters
|
||||
* (status variable name and value pair).
|
||||
*
|
||||
* This API is especially suitable inside a loop to add any number of input
|
||||
* parameters into an existing action response. If no action document exists
|
||||
* in the beginning, a \b Upnp_Document variable initialized with <tt>NULL</tt>
|
||||
* should be passed as a parameter.
|
||||
*
|
||||
* It is a wrapper function that calls addToAction() function to add the
|
||||
* argument in the action request.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||
* \li <tt>UPNP_E_INVALID_PARAM</tt>: One or more of the parameters are invalid.
|
||||
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpAddToActionResponse(
|
||||
/*! [in,out] Pointer to a document to store the action document node. */
|
||||
IXML_Document **ActionResponse,
|
||||
/*! [in] The action name. */
|
||||
const char *ActionName,
|
||||
/*! [in] The service type. */
|
||||
const char *ServType,
|
||||
/*! [in] The status variable name. */
|
||||
const char *ArgName,
|
||||
/*! [in] The status variable value. */
|
||||
const char *ArgVal);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Creates a property set message packet.
|
||||
*
|
||||
* Any number of input parameters can be passed to this function but every
|
||||
* input variable name should have a matching value input argument.
|
||||
*
|
||||
* \return <tt>NULL</tt> on failure, or the property-set document node.
|
||||
*/
|
||||
EXPORT_SPEC IXML_Document *UpnpCreatePropertySet(
|
||||
/*! [in] The number of argument pairs passed. */
|
||||
int NumArg,
|
||||
/*! [in] The status variable name and value pair. */
|
||||
const char *Arg,
|
||||
/*! [in] Variable sized list with the rest of the parameters. */
|
||||
...);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Can be used when an application needs to transfer the status of many
|
||||
* variables at once.
|
||||
*
|
||||
* It can be used (inside a loop) to add some extra status variables into an
|
||||
* existing property set. If the application does not already have a property
|
||||
* set document, the application should create a variable initialized with
|
||||
* <tt>NULL</tt> and pass that as the first parameter.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully.
|
||||
* \li <tt>UPNP_E_INVALID_PARAM</tt>: One or more of the parameters are invalid.
|
||||
* \li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to
|
||||
* complete this operation.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpAddToPropertySet(
|
||||
/*! [in,out] A pointer to the document containing the property set document node. */
|
||||
IXML_Document **PropSet,
|
||||
/*! [in] The status variable name. */
|
||||
const char *ArgName,
|
||||
/*! [in] The status variable value. */
|
||||
const char *ArgVal);
|
||||
|
||||
/*! @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*! @} */
|
||||
|
||||
|
||||
#endif /* UPNP_HAVE_TOOLS */
|
||||
|
||||
|
||||
#endif /* UPNP_TOOLS_H */
|
||||
|
||||
|
||||
97
upnp/m4/libupnp.m4
Normal file
97
upnp/m4/libupnp.m4
Normal file
@@ -0,0 +1,97 @@
|
||||
# -*- Autoconf -*-
|
||||
# This file is part of the aMule project.
|
||||
# This file is part of the libupnp library project.
|
||||
#
|
||||
# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl LIBUPNP_CHECK([VERSION = 1.6.6], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
dnl
|
||||
dnl Check for the libupnp library
|
||||
dnl --------------------------------------------------------------------------
|
||||
dnl
|
||||
dnl This macro sets these variables:
|
||||
dnl - LIBUPNP_VERSION
|
||||
dnl Something like "1.6.7"
|
||||
dnl - LIBUPNP_CPPFLAGS
|
||||
dnl Flags to be added to CPPFLAGS
|
||||
dnl - LIBUPNP_CFLAGS
|
||||
dnl Flags to be added to CFLAGS
|
||||
dnl - LIBUPNP_LDFLAGS
|
||||
dnl Flags to be added to LDFLAGS
|
||||
dnl - LIBUPNP_LIBS
|
||||
dnl Library to be added to LIBS
|
||||
dnl
|
||||
dnl The LIBUPNP_CPPFLAGS, LIBUPNP_CFLAGS, LIBUPNP_LDFLAGS and LIBUPNP_LIBS variables are also substituted.
|
||||
dnl
|
||||
AC_DEFUN([LIBUPNP_CHECK],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
m4_define([MIN_LIBUPNP_VERSION], [m4_ifval([$1], [$1], [1.6.6])])dnl
|
||||
|
||||
dnl Test for --with-libupnp-prefix
|
||||
AC_ARG_WITH(
|
||||
[libupnp-prefix],
|
||||
[AS_HELP_STRING(
|
||||
[--with-libupnp-prefix=PREFIX],
|
||||
[UPnP library location])],
|
||||
[export PKG_CONFIG_PATH=$withval/lib/pkgconfig])
|
||||
|
||||
dnl Check for libupnp >= MIN_LIBUPNP_VERSION
|
||||
AS_IF([test $cross_compiling = no], [
|
||||
AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION])
|
||||
AS_IF([test -n "$PKG_CONFIG"], [
|
||||
AS_IF([$PKG_CONFIG libupnp --exists], [
|
||||
LIBUPNP_VERSION=`$PKG_CONFIG libupnp --modversion`
|
||||
AS_IF([$PKG_CONFIG libupnp --atleast-version=MIN_LIBUPNP_VERSION], [
|
||||
result=yes
|
||||
resultstr=" (version $LIBUPNP_VERSION)"
|
||||
LIBUPNP_CPPFLAGS=`$PKG_CONFIG libupnp --cflags-only-I`
|
||||
LIBUPNP_CFLAGS=`$PKG_CONFIG libupnp --cflags-only-other`
|
||||
LIBUPNP_LDFLAGS=`$PKG_CONFIG libupnp --libs-only-L`
|
||||
LIBUPNP_LIBS=`$PKG_CONFIG libupnp --libs-only-other`
|
||||
LIBUPNP_LIBS="$LIBUPNP_LIBS `$PKG_CONFIG libupnp --libs-only-l`"
|
||||
], [
|
||||
result=no
|
||||
resultstr=" (version $LIBUPNP_VERSION is not new enough)"
|
||||
])
|
||||
], [
|
||||
result=no
|
||||
resultstr=" (try to use --with-libupnp-prefix=PREFIX)"
|
||||
])
|
||||
], [
|
||||
result=no
|
||||
resultstr=" (pkg-config not found)"
|
||||
])
|
||||
AC_MSG_RESULT([$result$resultstr])
|
||||
libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr"
|
||||
], [
|
||||
dnl Currently cross-compilation with libupnp is not supported.
|
||||
result=no
|
||||
libupnp_error="cross compiling"
|
||||
])
|
||||
|
||||
dnl Execute the right action.
|
||||
AS_IF([test ${result:-no} = yes], [$2], [$3])
|
||||
|
||||
dnl Exported symbols
|
||||
AC_SUBST([LIBUPNP_CPPFLAGS])dnl
|
||||
AC_SUBST([LIBUPNP_CFLAGS])dnl
|
||||
AC_SUBST([LIBUPNP_LDFLAGS])dnl
|
||||
AC_SUBST([LIBUPNP_LIBS])dnl
|
||||
m4_undefine([MIN_LIBUPNP_VERSION])dnl
|
||||
])
|
||||
@@ -9,10 +9,6 @@ AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/threadutil/inc \
|
||||
-I$(top_srcdir)/ixml/inc
|
||||
|
||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||
|
||||
AM_LDFLAGS = $(PTHREAD_LIBS)
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/upnp/libupnp.la \
|
||||
$(top_builddir)/threadutil/libthreadutil.la \
|
||||
@@ -73,8 +69,9 @@ upnp_tv_combo_SOURCES = \
|
||||
if WITH_DOCUMENTATION
|
||||
examplesdir = $(docdir)/examples
|
||||
examples_DATA = \
|
||||
$(sort \
|
||||
$(upnp_tv_ctrlpt_SOURCES) \
|
||||
$(upnp_tv_device_SOURCES)
|
||||
$(upnp_tv_device_SOURCES))
|
||||
endif
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +1,58 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 SAMPLE_UTIL_H
|
||||
#define SAMPLE_UTIL_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#include "ithread.h"
|
||||
#include "ixml.h" /* for IXML_Document, IXML_Element */
|
||||
#include "upnp.h" /* for Upnp_EventType */
|
||||
#include "upnptools.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "upnptools.h"
|
||||
#include "ithread.h"
|
||||
#include "ixml.h"
|
||||
|
||||
//mutex to control displaying of events
|
||||
/* mutex to control displaying of events */
|
||||
extern ithread_mutex_t display_mutex;
|
||||
|
||||
|
||||
typedef enum {
|
||||
STATE_UPDATE = 0,
|
||||
DEVICE_ADDED = 1,
|
||||
@@ -162,9 +168,13 @@ int SampleUtil_PrintEvent(IN Upnp_EventType EventType,
|
||||
* controlURL -- OUT -- The control URL for the service
|
||||
*
|
||||
********************************************************************************/
|
||||
int SampleUtil_FindAndParseService (IN IXML_Document *DescDoc, IN char* location,
|
||||
IN char *serviceType, OUT char **serviceId,
|
||||
OUT char **eventURL, OUT char **controlURL);
|
||||
int SampleUtil_FindAndParseService (
|
||||
IN IXML_Document *DescDoc,
|
||||
IN const char* location,
|
||||
IN char *serviceType,
|
||||
OUT char **serviceId,
|
||||
OUT char **eventURL,
|
||||
OUT char **controlURL);
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
@@ -196,7 +206,10 @@ extern print_string gPrintFun;
|
||||
* const char * UDN
|
||||
* int newDevice
|
||||
********************************************************************************/
|
||||
typedef void (*state_update)( const char *varName, const char *varValue, const char *UDN,
|
||||
typedef void (*state_update)(
|
||||
const char *varName,
|
||||
const char *varValue,
|
||||
const char *UDN,
|
||||
eventType type);
|
||||
|
||||
//global state update function used by smaple util
|
||||
@@ -224,7 +237,7 @@ int SampleUtil_Initialize(print_string print_function);
|
||||
* Parameters:
|
||||
*
|
||||
********************************************************************************/
|
||||
int SampleUtil_Finish(void);
|
||||
int SampleUtil_Finish();
|
||||
|
||||
/********************************************************************************
|
||||
* SampleUtil_Print
|
||||
@@ -258,11 +271,22 @@ int SampleUtil_RegisterUpdateFunction( state_update update_function );
|
||||
* Parameters:
|
||||
*
|
||||
********************************************************************************/
|
||||
void SampleUtil_StateUpdate( const char *varName, const char *varValue, const char *UDN,
|
||||
void SampleUtil_StateUpdate(
|
||||
const char *varName,
|
||||
const char *varValue,
|
||||
const char *UDN,
|
||||
eventType type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#endif /* UPNPSDK_UTIL_H */
|
||||
|
||||
#endif /* SAMPLE_UTIL_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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "sample_util.h"
|
||||
@@ -130,7 +130,8 @@ TvCtrlPointPrintLongHelp( void )
|
||||
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( "devices, described in the tvdevicedesc.xml description document." );
|
||||
SampleUtil_Print( "It also registers itself as a tv device." );
|
||||
SampleUtil_Print( "" );
|
||||
SampleUtil_Print( "Commands:" );
|
||||
SampleUtil_Print( " Help" );
|
||||
@@ -449,17 +450,18 @@ device_main( int argc, char **argv )
|
||||
|
||||
port = ( unsigned short )portTemp;
|
||||
|
||||
return TvDeviceStart(
|
||||
ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
||||
return TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
||||
}
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
int rc;
|
||||
ithread_t cmdloop_thread;
|
||||
#ifdef WIN32
|
||||
#else
|
||||
int sig;
|
||||
sigset_t sigs_to_catch;
|
||||
#endif
|
||||
int code;
|
||||
|
||||
device_main(argc, argv);
|
||||
@@ -468,11 +470,12 @@ main( int argc, char **argv )
|
||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
||||
return rc;
|
||||
}
|
||||
// start a command loop thread
|
||||
code =
|
||||
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
||||
NULL );
|
||||
/* start a command loop thread */
|
||||
code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL );
|
||||
|
||||
#ifdef WIN32
|
||||
ithread_join(cmdloop_thread, NULL);
|
||||
#else
|
||||
/*
|
||||
Catch Ctrl-C and properly shutdown
|
||||
*/
|
||||
@@ -480,10 +483,9 @@ main( int argc, char **argv )
|
||||
sigaddset( &sigs_to_catch, SIGINT );
|
||||
sigwait( &sigs_to_catch, &sig );
|
||||
|
||||
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
||||
#endif
|
||||
TvDeviceStop();
|
||||
rc = TvCtrlPointStop();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "upnp_tv_ctrlpt.h"
|
||||
|
||||
@@ -138,11 +138,10 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
|
||||
* UDN -- The Unique Device Name for the device to remove
|
||||
*
|
||||
********************************************************************************/
|
||||
int
|
||||
TvCtrlPointRemoveDevice( char *UDN )
|
||||
int TvCtrlPointRemoveDevice(const char *UDN)
|
||||
{
|
||||
struct TvDeviceNode *curdevnode,
|
||||
*prevdevnode;
|
||||
struct TvDeviceNode *curdevnode;
|
||||
struct TvDeviceNode *prevdevnode;
|
||||
|
||||
ithread_mutex_lock( &DeviceListMutex );
|
||||
|
||||
@@ -669,7 +668,7 @@ TvCtrlPointPrintDevice( int devnum )
|
||||
********************************************************************************/
|
||||
void
|
||||
TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
||||
char *location,
|
||||
const char *location,
|
||||
int expires )
|
||||
{
|
||||
char *deviceType = NULL;
|
||||
@@ -682,20 +681,19 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
||||
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
||||
int TimeOut[TV_SERVICE_SERVCOUNT] =
|
||||
{ default_timeout, default_timeout };
|
||||
int TimeOut[TV_SERVICE_SERVCOUNT] = {
|
||||
default_timeout,
|
||||
default_timeout };
|
||||
struct TvDeviceNode *deviceNode;
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
int ret = 1;
|
||||
int found = 0;
|
||||
int service,
|
||||
var;
|
||||
int service;
|
||||
int var;
|
||||
|
||||
ithread_mutex_lock( &DeviceListMutex );
|
||||
|
||||
/*
|
||||
Read key elements from description document
|
||||
*/
|
||||
/* Read key elements from description document */
|
||||
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
||||
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
||||
friendlyName =
|
||||
@@ -703,9 +701,8 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
||||
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
||||
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
||||
|
||||
ret =
|
||||
UpnpResolveURL( ( baseURL ? baseURL : location ), relURL,
|
||||
presURL );
|
||||
ret = UpnpResolveURL(
|
||||
( baseURL ? baseURL : location ), relURL, presURL);
|
||||
|
||||
if( UPNP_E_SUCCESS != ret )
|
||||
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
||||
@@ -939,27 +936,31 @@ TvStateUpdate( char *UDN,
|
||||
* changes -- The DOM document representing the changes
|
||||
*
|
||||
********************************************************************************/
|
||||
void
|
||||
TvCtrlPointHandleEvent( Upnp_SID sid,
|
||||
void TvCtrlPointHandleEvent(
|
||||
const UpnpString *sid,
|
||||
int evntkey,
|
||||
IXML_Document *changes)
|
||||
{
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
int service;
|
||||
const char *aux_sid = NULL;
|
||||
|
||||
ithread_mutex_lock(&DeviceListMutex);
|
||||
|
||||
tmpdevnode = GlobalDeviceList;
|
||||
while (tmpdevnode) {
|
||||
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
||||
if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) ==
|
||||
0 ) {
|
||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) {
|
||||
aux_sid = UpnpString_get_String(sid);
|
||||
if (strcmp(tmpdevnode->device.TvService[service].SID, aux_sid) == 0) {
|
||||
SampleUtil_Print("Received Tv %s Event: %d for SID %s",
|
||||
TvServiceName[service], evntkey, sid );
|
||||
|
||||
TvStateUpdate( tmpdevnode->device.UDN, service, changes,
|
||||
( char ** )&tmpdevnode->device.
|
||||
TvService[service].VariableStrVal );
|
||||
TvServiceName[service],
|
||||
evntkey,
|
||||
aux_sid);
|
||||
TvStateUpdate(
|
||||
tmpdevnode->device.UDN,
|
||||
service,
|
||||
changes,
|
||||
(char **)&tmpdevnode->device.TvService[service].VariableStrVal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -983,9 +984,9 @@ TvCtrlPointHandleEvent( Upnp_SID sid,
|
||||
* timeout -- The new timeout for the subscription
|
||||
*
|
||||
********************************************************************************/
|
||||
void
|
||||
TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
||||
Upnp_SID sid,
|
||||
void TvCtrlPointHandleSubscribeUpdate(
|
||||
const char *eventURL,
|
||||
const Upnp_SID sid,
|
||||
int timeout)
|
||||
{
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
@@ -1014,10 +1015,10 @@ TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
||||
ithread_mutex_unlock( &DeviceListMutex );
|
||||
}
|
||||
|
||||
void
|
||||
TvCtrlPointHandleGetVar( char *controlURL,
|
||||
char *varName,
|
||||
DOMString varValue )
|
||||
void TvCtrlPointHandleGetVar(
|
||||
const char *controlURL,
|
||||
const char *varName,
|
||||
const DOMString varValue)
|
||||
{
|
||||
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
@@ -1028,12 +1029,9 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
||||
tmpdevnode = GlobalDeviceList;
|
||||
while (tmpdevnode) {
|
||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
|
||||
if( strcmp
|
||||
( tmpdevnode->device.TvService[service].ControlURL,
|
||||
controlURL ) == 0 ) {
|
||||
SampleUtil_StateUpdate( varName, varValue,
|
||||
tmpdevnode->device.UDN,
|
||||
GET_VAR_COMPLETE );
|
||||
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL) == 0) {
|
||||
SampleUtil_StateUpdate(
|
||||
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1057,179 +1055,135 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
||||
* Cookie -- Optional data specified during callback registration
|
||||
*
|
||||
********************************************************************************/
|
||||
int
|
||||
TvCtrlPointCallbackEventHandler( Upnp_EventType EventType,
|
||||
void *Event,
|
||||
void *Cookie )
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||
{
|
||||
int errCode = 0;
|
||||
|
||||
SampleUtil_PrintEvent(EventType, Event);
|
||||
|
||||
switch ( EventType ) {
|
||||
/*
|
||||
SSDP Stuff
|
||||
*/
|
||||
/* SSDP Stuff */
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT:
|
||||
{
|
||||
struct Upnp_Discovery *d_event =
|
||||
( struct Upnp_Discovery * )Event;
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
||||
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
IXML_Document *DescDoc = NULL;
|
||||
int ret;
|
||||
const char *location = NULL;
|
||||
int errCode = UpnpDiscovery_get_ErrCode(d_event);
|
||||
|
||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error in Discovery Callback -- %d",
|
||||
d_event->ErrCode );
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Discovery Callback -- %d", errCode);
|
||||
}
|
||||
|
||||
if( ( ret =
|
||||
UpnpDownloadXmlDoc( d_event->Location,
|
||||
&DescDoc ) ) !=
|
||||
UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error obtaining device description from %s -- error = %d",
|
||||
d_event->Location, ret );
|
||||
location = UpnpString_get_String(UpnpDiscovery_get_Location(d_event));
|
||||
errCode = UpnpDownloadXmlDoc(location, &DescDoc);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error obtaining device description from %s -- error = %d",
|
||||
location, errCode);
|
||||
} else {
|
||||
TvCtrlPointAddDevice( DescDoc, d_event->Location,
|
||||
d_event->Expires );
|
||||
TvCtrlPointAddDevice(
|
||||
DescDoc, location, UpnpDiscovery_get_Expires(d_event));
|
||||
}
|
||||
|
||||
if( DescDoc )
|
||||
if (DescDoc) {
|
||||
ixmlDocument_free(DescDoc);
|
||||
|
||||
}
|
||||
TvCtrlPointPrintList();
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||
/*
|
||||
Nothing to do here...
|
||||
*/
|
||||
/* Nothing to do here... */
|
||||
break;
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
||||
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
int errCode = UpnpDiscovery_get_ErrCode(d_event);
|
||||
const char *deviceId = UpnpString_get_String(
|
||||
UpnpDiscovery_get_DeviceID(d_event));
|
||||
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
|
||||
{
|
||||
struct Upnp_Discovery *d_event =
|
||||
( struct Upnp_Discovery * )Event;
|
||||
|
||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Discovery ByeBye Callback -- %d",
|
||||
d_event->ErrCode );
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Discovery ByeBye Callback -- %d", errCode);
|
||||
}
|
||||
|
||||
SampleUtil_Print( "Received ByeBye for Device: %s",
|
||||
d_event->DeviceId );
|
||||
TvCtrlPointRemoveDevice( d_event->DeviceId );
|
||||
|
||||
SampleUtil_Print("Received ByeBye for Device: %s", deviceId);
|
||||
TvCtrlPointRemoveDevice(deviceId);
|
||||
SampleUtil_Print("After byebye:");
|
||||
TvCtrlPointPrintList();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
SOAP Stuff
|
||||
*/
|
||||
case UPNP_CONTROL_ACTION_COMPLETE:
|
||||
{
|
||||
struct Upnp_Action_Complete *a_event =
|
||||
( struct Upnp_Action_Complete * )Event;
|
||||
|
||||
if( a_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Action Complete Callback -- %d",
|
||||
a_event->ErrCode );
|
||||
/* SOAP Stuff */
|
||||
case UPNP_CONTROL_ACTION_COMPLETE: {
|
||||
UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
|
||||
int errCode = UpnpActionComplete_get_ErrCode(a_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Action Complete Callback -- %d",
|
||||
errCode);
|
||||
}
|
||||
|
||||
/*
|
||||
No need for any processing here, just print out results. Service state
|
||||
table updates are handled by events.
|
||||
*/
|
||||
|
||||
/* No need for any processing here, just print out results.
|
||||
* Service state table updates are handled by events. */
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_CONTROL_GET_VAR_COMPLETE:
|
||||
{
|
||||
struct Upnp_State_Var_Complete *sv_event =
|
||||
( struct Upnp_State_Var_Complete * )Event;
|
||||
|
||||
if( sv_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Get Var Complete Callback -- %d",
|
||||
sv_event->ErrCode );
|
||||
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
||||
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
|
||||
int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Get Var Complete Callback -- %d", errCode);
|
||||
} else {
|
||||
TvCtrlPointHandleGetVar( sv_event->CtrlUrl,
|
||||
sv_event->StateVarName,
|
||||
sv_event->CurrentVal );
|
||||
TvCtrlPointHandleGetVar(
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
|
||||
UpnpStateVarComplete_get_CurrentVal(sv_event));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
GENA Stuff
|
||||
*/
|
||||
case UPNP_EVENT_RECEIVED:
|
||||
{
|
||||
struct Upnp_Event *e_event = ( struct Upnp_Event * )Event;
|
||||
|
||||
TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey,
|
||||
e_event->ChangedVariables );
|
||||
/* GENA Stuff */
|
||||
case UPNP_EVENT_RECEIVED: {
|
||||
UpnpEvent *e_event = (UpnpEvent *)Event;
|
||||
TvCtrlPointHandleEvent(
|
||||
UpnpEvent_get_SID(e_event),
|
||||
UpnpEvent_get_EventKey(e_event),
|
||||
UpnpEvent_get_ChangedVariables(e_event));
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_RENEWAL_COMPLETE:
|
||||
{
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
( struct Upnp_Event_Subscribe * )Event;
|
||||
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
|
||||
if( es_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Event Subscribe Callback -- %d",
|
||||
es_event->ErrCode );
|
||||
errCode = UpnpEventSubscribe_get_ErrCode(es_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Event Subscribe Callback -- %d", errCode);
|
||||
} else {
|
||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||
PublisherUrl,
|
||||
es_event->Sid,
|
||||
es_event->TimeOut );
|
||||
TvCtrlPointHandleSubscribeUpdate(
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
|
||||
UpnpEventSubscribe_get_TimeOut(es_event));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
|
||||
{
|
||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
int TimeOut = default_timeout;
|
||||
Upnp_SID newSID;
|
||||
int ret;
|
||||
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
( struct Upnp_Event_Subscribe * )Event;
|
||||
|
||||
ret =
|
||||
UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl,
|
||||
&TimeOut, newSID );
|
||||
|
||||
if( ret == UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Subscribed to EventURL with SID=%s",
|
||||
errCode = UpnpSubscribe(
|
||||
ctrlpt_handle,
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
&TimeOut,
|
||||
newSID);
|
||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||
PublisherUrl, newSID,
|
||||
if (errCode == UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
|
||||
TvCtrlPointHandleSubscribeUpdate(
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
newSID,
|
||||
TimeOut);
|
||||
} else {
|
||||
SampleUtil_Print
|
||||
( "Error Subscribing to EventURL -- %d", ret );
|
||||
SampleUtil_Print("Error Subscribing to EventURL -- %d", errCode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
ignore these cases, since this is not a device
|
||||
*/
|
||||
/* ignore these cases, since this is not a device */
|
||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||
case UPNP_CONTROL_ACTION_REQUEST:
|
||||
@@ -1320,12 +1274,12 @@ TvCtrlPointVerifyTimeouts( int incr )
|
||||
* None
|
||||
*
|
||||
********************************************************************************/
|
||||
void *
|
||||
TvCtrlPointTimerLoop( void *args )
|
||||
static int TvCtrlPointTimerLoopRun = 1;
|
||||
void *TvCtrlPointTimerLoop(void *args)
|
||||
{
|
||||
int incr = 30; // how often to verify the timeouts, in seconds
|
||||
|
||||
while( 1 ) {
|
||||
while (TvCtrlPointTimerLoopRun) {
|
||||
isleep( incr );
|
||||
TvCtrlPointVerifyTimeouts( incr );
|
||||
}
|
||||
@@ -1348,13 +1302,11 @@ TvCtrlPointTimerLoop( void *args )
|
||||
* TV_SUCCESS if everything went well, else TV_ERROR
|
||||
*
|
||||
********************************************************************************/
|
||||
int
|
||||
TvCtrlPointStart( print_string printFunctionPtr,
|
||||
state_update updateFunctionPtr )
|
||||
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr)
|
||||
{
|
||||
ithread_t timer_thread;
|
||||
int rc;
|
||||
short int port = 0;
|
||||
unsigned short port = 0;
|
||||
char *ip_address = NULL;
|
||||
|
||||
SampleUtil_Initialize(printFunctionPtr);
|
||||
@@ -1362,28 +1314,38 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
ithread_mutex_init(&DeviceListMutex, 0);
|
||||
|
||||
SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d",
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port);
|
||||
|
||||
rc = UpnpInit(ip_address, port);
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
if (rc != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("WinCEStart: UpnpInit() Error: %d", rc);
|
||||
//UpnpFinish( );
|
||||
//return TV_ERROR;
|
||||
/*
|
||||
UpnpFinish();
|
||||
return TV_ERROR;
|
||||
*/
|
||||
}
|
||||
if (!ip_address) {
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
if (!port) {
|
||||
port = UpnpGetServerPort();
|
||||
}
|
||||
|
||||
if( NULL == ip_address )
|
||||
ip_address = UpnpGetServerIpAddress( );
|
||||
if( 0 == port )
|
||||
port = UpnpGetServerPort( );
|
||||
|
||||
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"UPnP Initialized\n"
|
||||
"\tipaddress= %s port = %u\n",
|
||||
ip_address, port);
|
||||
|
||||
SampleUtil_Print("Registering Control Point");
|
||||
rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,
|
||||
&ctrlpt_handle, &ctrlpt_handle);
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
if (rc != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||
UpnpFinish();
|
||||
|
||||
return TV_ERROR;
|
||||
}
|
||||
|
||||
@@ -1391,15 +1353,16 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
TvCtrlPointRefresh();
|
||||
|
||||
// start a timer thread
|
||||
/* start a timer thread */
|
||||
ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL);
|
||||
ithread_detach(timer_thread);
|
||||
|
||||
return TV_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
TvCtrlPointStop( void )
|
||||
int TvCtrlPointStop(void)
|
||||
{
|
||||
TvCtrlPointTimerLoopRun = 0;
|
||||
TvCtrlPointRemoveAll();
|
||||
UpnpUnRegisterClient( ctrlpt_handle );
|
||||
UpnpFinish();
|
||||
@@ -1407,3 +1370,4 @@ TvCtrlPointStop( void )
|
||||
|
||||
return TV_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,53 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_TV_CTRLPT_H
|
||||
#define UPNP_TV_CTRLPT_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sample_util.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"
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/* Do not #include <unistd.h> */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define TV_SERVICE_SERVCOUNT 2
|
||||
#define TV_SERVICE_CONTROL 0
|
||||
@@ -108,11 +120,11 @@ extern ithread_mutex_t DeviceListMutex;
|
||||
|
||||
extern UpnpClient_Handle ctrlpt_handle;
|
||||
|
||||
void TvCtrlPointPrintHelp( void );
|
||||
void TvCtrlPointPrintHelp();
|
||||
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
||||
int TvCtrlPointRemoveDevice(char*);
|
||||
int TvCtrlPointRemoveAll( void );
|
||||
int TvCtrlPointRefresh( void );
|
||||
int TvCtrlPointRemoveDevice(const char *);
|
||||
int TvCtrlPointRemoveAll();
|
||||
int TvCtrlPointRefresh();
|
||||
|
||||
|
||||
int TvCtrlPointSendAction(int, int, char *, char **, char **, int);
|
||||
@@ -138,11 +150,11 @@ 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 TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
||||
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
||||
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
||||
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
||||
void TvCtrlPointHandleEvent(const UpnpString *, int, IXML_Document *);
|
||||
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||
void TvCtrlPointVerifyTimeouts(int);
|
||||
void TvCtrlPointPrintCommands( void );
|
||||
|
||||
@@ -1,36 +1,41 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "upnp_tv_device.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#define DEFAULT_WEB_DIR "./web"
|
||||
|
||||
#define DESC_URL_SIZE 200
|
||||
@@ -178,7 +183,6 @@ SetServiceTable( IN int serviceType,
|
||||
}
|
||||
|
||||
return SetActionTable( serviceType, out );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -249,7 +253,6 @@ SetActionTable( IN int serviceType,
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -366,61 +369,68 @@ TvDeviceStateTableInit( IN char *DescDocURL )
|
||||
* sr_event -- The subscription request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
||||
*sr_event )
|
||||
int TvDeviceHandleSubscriptionRequest(IN const UpnpSubscriptionRequest *sr_event)
|
||||
{
|
||||
unsigned int i = 0; //,j=0;
|
||||
|
||||
unsigned int i = 0;
|
||||
//unsigned int j = 0;
|
||||
int cmp1 = 0;
|
||||
int cmp2 = 0;
|
||||
const char *l_serviceId = NULL;
|
||||
const char *l_udn = NULL;
|
||||
const char *l_sid = NULL;
|
||||
// IXML_Document *PropSet = NULL;
|
||||
|
||||
// lock state mutex
|
||||
ithread_mutex_lock( &TVDevMutex );
|
||||
|
||||
for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) {
|
||||
if( ( strcmp( sr_event->UDN, tv_service_table[i].UDN ) == 0 ) &&
|
||||
( strcmp( sr_event->ServiceId, tv_service_table[i].ServiceId )
|
||||
== 0 ) ) {
|
||||
|
||||
/*
|
||||
l_serviceId = UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(sr_event));
|
||||
l_udn = UpnpString_get_String(UpnpSubscriptionRequest_get_UDN(sr_event));
|
||||
l_sid = UpnpString_get_String(UpnpSubscriptionRequest_get_SID(sr_event));
|
||||
for (i = 0; i < TV_SERVICE_SERVCOUNT; ++i) {
|
||||
cmp1 = strcmp(l_udn, tv_service_table[i].UDN);
|
||||
cmp2 = strcmp(l_serviceId, tv_service_table[i].ServiceId);
|
||||
if (cmp1 == 0 && cmp2 == 0) {
|
||||
#if 0
|
||||
PropSet = NULL;
|
||||
|
||||
for (j=0; j< tv_service_table[i].VariableCount; j++)
|
||||
{
|
||||
for (j = 0; j< tv_service_table[i].VariableCount; ++j) {
|
||||
// add each variable to the property set
|
||||
// for initial state dump
|
||||
UpnpAddToPropertySet(&PropSet,
|
||||
UpnpAddToPropertySet(
|
||||
&PropSet,
|
||||
tv_service_table[i].VariableName[j],
|
||||
tv_service_table[i].VariableStrVal[j]);
|
||||
}
|
||||
|
||||
// dump initial state
|
||||
UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,
|
||||
sr_event->ServiceId,
|
||||
PropSet,sr_event->Sid);
|
||||
UpnpAcceptSubscriptionExt(
|
||||
device_handle,
|
||||
l_udn,
|
||||
l_serviceId,
|
||||
PropSet,
|
||||
l_sid);
|
||||
// free document
|
||||
Document_free(PropSet);
|
||||
|
||||
*/
|
||||
|
||||
UpnpAcceptSubscription( device_handle,
|
||||
sr_event->UDN,
|
||||
sr_event->ServiceId,
|
||||
#endif
|
||||
UpnpAcceptSubscription(
|
||||
device_handle,
|
||||
l_udn,
|
||||
l_serviceId,
|
||||
(const char **)tv_service_table[i].
|
||||
VariableName,
|
||||
(const char **)tv_service_table[i].
|
||||
VariableStrVal,
|
||||
tv_service_table[i].VariableCount,
|
||||
sr_event->Sid );
|
||||
|
||||
l_sid);
|
||||
}
|
||||
}
|
||||
|
||||
ithread_mutex_unlock( &TVDevMutex );
|
||||
|
||||
return ( 1 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceHandleGetVarRequest
|
||||
*
|
||||
@@ -434,31 +444,32 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||
*cgv_event )
|
||||
TvDeviceHandleGetVarRequest( INOUT UpnpStateVarRequest *cgv_event )
|
||||
{
|
||||
unsigned int i = 0,
|
||||
j = 0;
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
int getvar_succeeded = 0;
|
||||
|
||||
cgv_event->CurrentVal = NULL;
|
||||
UpnpStateVarRequest_set_CurrentVal(cgv_event, NULL);
|
||||
|
||||
ithread_mutex_lock( &TVDevMutex );
|
||||
|
||||
for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) {
|
||||
// check udn and service id
|
||||
if( ( strcmp( cgv_event->DevUDN, tv_service_table[i].UDN ) == 0 )
|
||||
&&
|
||||
( strcmp( cgv_event->ServiceID, tv_service_table[i].ServiceId )
|
||||
== 0 ) ) {
|
||||
const char *devUDN =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(cgv_event));
|
||||
const char *serviceID =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(cgv_event));
|
||||
if( ( strcmp( devUDN, tv_service_table[i].UDN ) == 0 ) &&
|
||||
( strcmp( serviceID, tv_service_table[i].ServiceId ) == 0 ) ) {
|
||||
// check variable name
|
||||
for( j = 0; j < tv_service_table[i].VariableCount; j++ ) {
|
||||
if( strcmp( cgv_event->StateVarName,
|
||||
tv_service_table[i].VariableName[j] ) == 0 ) {
|
||||
const char *stateVarName =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(cgv_event));
|
||||
if( strcmp( stateVarName, tv_service_table[i].VariableName[j] ) == 0 ) {
|
||||
getvar_succeeded = 1;
|
||||
cgv_event->CurrentVal =
|
||||
ixmlCloneDOMString( tv_service_table[i].
|
||||
VariableStrVal[j] );
|
||||
UpnpStateVarRequest_set_CurrentVal(cgv_event,
|
||||
tv_service_table[i].VariableStrVal[j] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -466,19 +477,19 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||
}
|
||||
|
||||
if( getvar_succeeded ) {
|
||||
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
||||
UpnpStateVarRequest_set_ErrCode(cgv_event, UPNP_E_SUCCESS);
|
||||
} else {
|
||||
SampleUtil_Print
|
||||
( "Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n" );
|
||||
SampleUtil_Print( " Unknown variable name = %s\n",
|
||||
cgv_event->StateVarName );
|
||||
cgv_event->ErrCode = 404;
|
||||
strcpy( cgv_event->ErrStr, "Invalid Variable" );
|
||||
SampleUtil_Print(
|
||||
"Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n"
|
||||
" Unknown variable name = %s\n",
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(cgv_event)) );
|
||||
UpnpStateVarRequest_set_ErrCode(cgv_event, 404);
|
||||
UpnpStateVarRequest_strcpy_ErrStr(cgv_event, "Invalid Variable" );
|
||||
}
|
||||
|
||||
ithread_mutex_unlock( &TVDevMutex );
|
||||
|
||||
return ( cgv_event->ErrCode == UPNP_E_SUCCESS );
|
||||
return UpnpStateVarRequest_get_ErrCode(cgv_event) == UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -494,9 +505,8 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
TvDeviceHandleActionRequest( INOUT UpnpActionRequest *ca_event )
|
||||
{
|
||||
|
||||
/*
|
||||
Defaults if action not found
|
||||
*/
|
||||
@@ -505,51 +515,38 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
int service = -1;
|
||||
int retCode = 0;
|
||||
char *errorString = NULL;
|
||||
const char *devUDN = NULL;
|
||||
const char *serviceID = NULL;
|
||||
const char *actionName = NULL;
|
||||
IXML_Document *actionResult = NULL;
|
||||
|
||||
ca_event->ErrCode = 0;
|
||||
ca_event->ActionResult = NULL;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 0);
|
||||
UpnpActionRequest_set_ActionResult(ca_event, NULL);
|
||||
|
||||
if( ( strcmp( ca_event->DevUDN,
|
||||
tv_service_table[TV_SERVICE_CONTROL].UDN ) == 0 ) &&
|
||||
( strcmp
|
||||
( ca_event->ServiceID,
|
||||
tv_service_table[TV_SERVICE_CONTROL].ServiceId ) == 0 ) ) {
|
||||
/*
|
||||
Request for action in the TvDevice Control Service
|
||||
*/
|
||||
devUDN = UpnpString_get_String(UpnpActionRequest_get_DevUDN( ca_event));
|
||||
serviceID = UpnpString_get_String(UpnpActionRequest_get_ServiceID( ca_event));
|
||||
actionName = UpnpString_get_String(UpnpActionRequest_get_ActionName(ca_event));
|
||||
if( ( strcmp( devUDN, tv_service_table[TV_SERVICE_CONTROL].UDN ) == 0 ) &&
|
||||
( strcmp( serviceID, tv_service_table[TV_SERVICE_CONTROL].ServiceId ) == 0 ) ) {
|
||||
/* Request for action in the TvDevice Control Service */
|
||||
service = TV_SERVICE_CONTROL;
|
||||
} else if( ( strcmp( ca_event->DevUDN,
|
||||
tv_service_table[TV_SERVICE_PICTURE].UDN ) == 0 )
|
||||
&&
|
||||
( strcmp
|
||||
( ca_event->ServiceID,
|
||||
tv_service_table[TV_SERVICE_PICTURE].ServiceId ) ==
|
||||
0 ) ) {
|
||||
/*
|
||||
Request for action in the TvDevice Picture Service
|
||||
*/
|
||||
} else if( ( strcmp( devUDN, tv_service_table[TV_SERVICE_PICTURE].UDN ) == 0 ) &&
|
||||
( strcmp( serviceID, tv_service_table[TV_SERVICE_PICTURE].ServiceId ) == 0 ) ) {
|
||||
/* Request for action in the TvDevice Picture Service */
|
||||
service = TV_SERVICE_PICTURE;
|
||||
}
|
||||
//Find and call appropriate procedure based on action name
|
||||
//Each action name has an associated procedure stored in the
|
||||
//service table. These are set at initialization.
|
||||
|
||||
for( i = 0; ( ( i < TV_MAXACTIONS ) &&
|
||||
( tv_service_table[service].ActionNames[i] != NULL ) );
|
||||
i++ ) {
|
||||
|
||||
if( !strcmp( ca_event->ActionName,
|
||||
tv_service_table[service].ActionNames[i] ) ) {
|
||||
|
||||
if( ( !strcmp( tv_service_table[TV_SERVICE_CONTROL].
|
||||
VariableStrVal[TV_CONTROL_POWER], "1" ) )
|
||||
|| ( !strcmp( ca_event->ActionName, "PowerOn" ) ) ) {
|
||||
retCode =
|
||||
tv_service_table[service].actions[i] ( ca_event->
|
||||
ActionRequest,
|
||||
&ca_event->
|
||||
ActionResult,
|
||||
/* Find and call appropriate procedure based on action name
|
||||
* Each action name has an associated procedure stored in the
|
||||
* service table. These are set at initialization. */
|
||||
for( i = 0; i < TV_MAXACTIONS && tv_service_table[service].ActionNames[i] != NULL; i++ ) {
|
||||
if( !strcmp( actionName, tv_service_table[service].ActionNames[i] ) ) {
|
||||
if( ( !strcmp( tv_service_table[TV_SERVICE_CONTROL].VariableStrVal[TV_CONTROL_POWER], "1" ) ) ||
|
||||
( !strcmp( actionName, "PowerOn" ) ) ) {
|
||||
retCode = tv_service_table[service].actions[i](
|
||||
UpnpActionRequest_get_ActionRequest(ca_event),
|
||||
&actionResult,
|
||||
&errorString );
|
||||
UpnpActionRequest_set_ActionResult(ca_event, actionResult);
|
||||
} else {
|
||||
errorString = "Power is Off";
|
||||
retCode = UPNP_E_INTERNAL_ERROR;
|
||||
@@ -560,25 +557,25 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
}
|
||||
|
||||
if( !action_found ) {
|
||||
ca_event->ActionResult = NULL;
|
||||
strcpy( ca_event->ErrStr, "Invalid Action" );
|
||||
ca_event->ErrCode = 401;
|
||||
UpnpActionRequest_set_ActionResult(ca_event, NULL);
|
||||
UpnpActionRequest_strcpy_ErrStr(ca_event, "Invalid Action" );
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 401);
|
||||
} else {
|
||||
if( retCode == UPNP_E_SUCCESS ) {
|
||||
ca_event->ErrCode = UPNP_E_SUCCESS;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, UPNP_E_SUCCESS);
|
||||
} else {
|
||||
// copy the error string
|
||||
strcpy( ca_event->ErrStr, errorString );
|
||||
UpnpActionRequest_strcpy_ErrStr(ca_event, errorString );
|
||||
switch ( retCode ) {
|
||||
case UPNP_E_INVALID_PARAM:
|
||||
{
|
||||
ca_event->ErrCode = 402;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 402);
|
||||
break;
|
||||
}
|
||||
case UPNP_E_INTERNAL_ERROR:
|
||||
default:
|
||||
{
|
||||
ca_event->ErrCode = 501;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 501);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -586,7 +583,7 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
}
|
||||
}
|
||||
|
||||
return ( ca_event->ErrCode );
|
||||
return UpnpActionRequest_get_ErrCode(ca_event);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -649,7 +646,6 @@ TvDeviceSetServiceTableVar( IN unsigned int service,
|
||||
ithread_mutex_unlock( &TVDevMutex );
|
||||
|
||||
return ( 1 );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -672,7 +668,7 @@ TvDeviceSetPower( IN int on )
|
||||
|
||||
if( on != POWER_ON && on != POWER_OFF ) {
|
||||
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
||||
return ( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -683,7 +679,7 @@ TvDeviceSetPower( IN int on )
|
||||
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
||||
value );
|
||||
|
||||
return ( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -700,9 +696,7 @@ TvDeviceSetPower( IN int on )
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDevicePowerOn( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
( *out ) = NULL;
|
||||
( *errorString ) = NULL;
|
||||
@@ -722,7 +716,6 @@ TvDevicePowerOn( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -779,11 +772,8 @@ TvDevicePowerOff( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetChannel( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int channel = 0;
|
||||
@@ -828,7 +818,6 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -846,13 +835,10 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementChannel( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curchannel,
|
||||
newchannel;
|
||||
int curchannel;
|
||||
int newchannel;
|
||||
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
@@ -914,12 +900,9 @@ IncrementChannel( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseChannel( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementChannel( -1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -936,12 +919,9 @@ TvDeviceDecreaseChannel( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseChannel( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementChannel( 1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -960,13 +940,9 @@ TvDeviceIncreaseChannel( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetVolume( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int volume = 0;
|
||||
|
||||
( *out ) = NULL;
|
||||
@@ -1007,7 +983,6 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1026,10 +1001,7 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementVolume( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curvolume,
|
||||
newvolume;
|
||||
@@ -1066,8 +1038,7 @@ IncrementVolume( IN int incr,
|
||||
TV_CONTROL_VOLUME, value ) ) {
|
||||
if( UpnpAddToActionResponse( out, actionName,
|
||||
TvServiceType[TV_SERVICE_CONTROL],
|
||||
"Volume", value ) != UPNP_E_SUCCESS )
|
||||
{
|
||||
"Volume", value ) != UPNP_E_SUCCESS ) {
|
||||
( *out ) = NULL;
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
@@ -1077,7 +1048,6 @@ IncrementVolume( IN int incr,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1094,13 +1064,9 @@ IncrementVolume( IN int incr,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseVolume( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementVolume( 1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1117,13 +1083,9 @@ TvDeviceIncreaseVolume( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseVolume( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementVolume( -1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1142,13 +1104,9 @@ TvDeviceDecreaseVolume( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetColor( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int color = 0;
|
||||
|
||||
( *out ) = NULL;
|
||||
@@ -1188,7 +1146,6 @@ TvDeviceSetColor( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1205,16 +1162,11 @@ TvDeviceSetColor( IN IXML_Document * in,
|
||||
* IXML_Document **out - action result document
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
|
||||
int
|
||||
IncrementColor( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curcolor,
|
||||
newcolor;
|
||||
|
||||
int curcolor;
|
||||
int newcolor;
|
||||
char *actionName;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1272,11 +1224,8 @@ IncrementColor( IN int incr,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseColor( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementColor( -1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1293,11 +1242,8 @@ TvDeviceDecreaseColor( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseColor( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementColor( 1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1317,13 +1263,9 @@ TvDeviceIncreaseColor( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetTint( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int tint = -1;
|
||||
|
||||
( *out ) = NULL;
|
||||
@@ -1382,14 +1324,10 @@ TvDeviceSetTint( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementTint( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curtint,
|
||||
newtint;
|
||||
|
||||
int curtint;
|
||||
int newtint;
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1432,7 +1370,6 @@ IncrementTint( IN int incr,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1449,11 +1386,8 @@ IncrementTint( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseTint( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementTint( 1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1471,11 +1405,8 @@ TvDeviceIncreaseTint( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseTint( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementTint( -1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1495,11 +1426,8 @@ TvDeviceDecreaseTint( IN IXML_Document * in,
|
||||
*
|
||||
****************************************************************************/
|
||||
int
|
||||
TvDeviceSetContrast( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
int contrast = -1;
|
||||
|
||||
@@ -1560,14 +1488,10 @@ TvDeviceSetContrast( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementContrast( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curcontrast,
|
||||
newcontrast;
|
||||
|
||||
int curcontrast;
|
||||
int newcontrast;
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1629,11 +1553,8 @@ IncrementContrast( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseContrast( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementContrast( 1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1651,9 +1572,7 @@ TvDeviceIncreaseContrast( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseContrast( IXML_Document * in,
|
||||
IXML_Document ** out,
|
||||
char **errorString )
|
||||
TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementContrast( -1, in, out, errorString );
|
||||
}
|
||||
@@ -1671,11 +1590,8 @@ TvDeviceDecreaseContrast( IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetBrightness( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
int brightness = -1;
|
||||
|
||||
@@ -1718,7 +1634,6 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1736,13 +1651,10 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementBrightness( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curbrightness,
|
||||
newbrightness;
|
||||
int curbrightness;
|
||||
int newbrightness;
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1803,9 +1715,7 @@ IncrementBrightness( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementBrightness( 1, in, out, errorString );
|
||||
}
|
||||
@@ -1823,9 +1733,7 @@ TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementBrightness( -1, in, out, errorString );
|
||||
}
|
||||
@@ -1849,29 +1757,19 @@ TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
||||
* Cookie -- Optional data specified during callback registration
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
||||
void *Event,
|
||||
void *Cookie )
|
||||
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||
{
|
||||
|
||||
switch ( EventType ) {
|
||||
|
||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||
|
||||
TvDeviceHandleSubscriptionRequest( ( struct
|
||||
Upnp_Subscription_Request
|
||||
* )Event );
|
||||
TvDeviceHandleSubscriptionRequest((UpnpSubscriptionRequest *)Event);
|
||||
break;
|
||||
|
||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||
TvDeviceHandleGetVarRequest( ( struct Upnp_State_Var_Request
|
||||
* )Event );
|
||||
TvDeviceHandleGetVarRequest( (UpnpStateVarRequest *)Event );
|
||||
break;
|
||||
|
||||
case UPNP_CONTROL_ACTION_REQUEST:
|
||||
TvDeviceHandleActionRequest( ( struct Upnp_Action_Request * )
|
||||
Event );
|
||||
TvDeviceHandleActionRequest( (UpnpActionRequest *)Event );
|
||||
break;
|
||||
|
||||
/*
|
||||
@@ -1890,17 +1788,14 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
||||
break;
|
||||
|
||||
default:
|
||||
SampleUtil_Print
|
||||
( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||
SampleUtil_Print( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||
EventType );
|
||||
}
|
||||
|
||||
/*
|
||||
Print a summary of the event received
|
||||
*/
|
||||
/* Print a summary of the event received */
|
||||
SampleUtil_PrintEvent( EventType, Event );
|
||||
|
||||
return ( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1919,6 +1814,7 @@ TvDeviceStop( )
|
||||
UpnpFinish();
|
||||
SampleUtil_Finish();
|
||||
ithread_mutex_destroy( &TVDevMutex );
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1951,81 +1847,83 @@ TvDeviceStart( char *ip_address,
|
||||
print_string pfun )
|
||||
{
|
||||
int ret = UPNP_E_SUCCESS;
|
||||
|
||||
char desc_doc_url[DESC_URL_SIZE];
|
||||
|
||||
ithread_mutex_init( &TVDevMutex, NULL );
|
||||
|
||||
SampleUtil_Initialize( pfun );
|
||||
|
||||
SampleUtil_Print
|
||||
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
|
||||
ret = UpnpInit( ip_address, port );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
if( ip_address == NULL ) {
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
|
||||
if( port == 0 ) {
|
||||
port = UpnpGetServerPort();
|
||||
}
|
||||
|
||||
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
||||
SampleUtil_Print(
|
||||
"UPnP Initialized\n"
|
||||
"\tipaddress= %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( desc_doc_name == NULL )
|
||||
if( desc_doc_name == NULL ) {
|
||||
desc_doc_name = "tvcombodesc.xml";
|
||||
}
|
||||
|
||||
if( web_dir_path == NULL )
|
||||
if( web_dir_path == NULL ) {
|
||||
web_dir_path = DEFAULT_WEB_DIR;
|
||||
}
|
||||
|
||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||
port, desc_doc_name );
|
||||
|
||||
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
||||
web_dir_path );
|
||||
if( ( ret =
|
||||
UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error specifying webserver root directory -- %s: %d\n",
|
||||
ret = UpnpSetWebServerRootDir( web_dir_path );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n",
|
||||
web_dir_path, ret );
|
||||
UpnpFinish();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print
|
||||
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
||||
SampleUtil_Print(
|
||||
"Registering the RootDevice\n"
|
||||
"\t with desc_doc_url: %s\n",
|
||||
desc_doc_url );
|
||||
|
||||
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
||||
TvDeviceCallbackEventHandler,
|
||||
&device_handle, &device_handle ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler,
|
||||
&device_handle, &device_handle );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||
UpnpFinish();
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
SampleUtil_Print( "RootDevice Registered\n" );
|
||||
|
||||
SampleUtil_Print( "Initializing State Table\n" );
|
||||
SampleUtil_Print(
|
||||
"RootDevice Registered\n"
|
||||
"Initializing State Table\n");
|
||||
TvDeviceStateTableInit( desc_doc_url );
|
||||
SampleUtil_Print("State Table Initialized\n");
|
||||
|
||||
if( ( ret =
|
||||
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
ret = UpnpSendAdvertisement( device_handle, default_advr_expire );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||
UpnpFinish();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print("Advertisements Sent\n");
|
||||
}
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**************************************************************************
|
||||
*
|
||||
* 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"
|
||||
|
||||
|
||||
#include "ithread.h"
|
||||
#include "upnp.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/* Do not #include <unistd.h> */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
//Color constants
|
||||
#define MAX_COLOR 10
|
||||
#define MIN_COLOR 1
|
||||
@@ -146,8 +161,7 @@ extern char *TvServiceType[];
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,
|
||||
char **errorString);
|
||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out, char **errorString);
|
||||
|
||||
/* Structure for storing Tv Service
|
||||
identifiers and state table */
|
||||
@@ -225,7 +239,7 @@ int TvDeviceStateTableInit(char*);
|
||||
* sr_event -- The subscription request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *);
|
||||
int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceHandleGetVarRequest
|
||||
@@ -239,7 +253,7 @@ int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *);
|
||||
* cgv_event -- The control get variable request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *);
|
||||
int TvDeviceHandleGetVarRequest(UpnpStateVarRequest *);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceHandleActionRequest
|
||||
@@ -253,7 +267,7 @@ int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *);
|
||||
* ca_event -- The control action request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceHandleActionRequest(struct Upnp_Action_Request *);
|
||||
int TvDeviceHandleActionRequest(UpnpActionRequest *);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceCallbackEventHandler
|
||||
@@ -311,8 +325,7 @@ int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*);
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDevicePowerOff
|
||||
@@ -327,8 +340,7 @@ int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceSetChannel
|
||||
@@ -345,8 +357,7 @@ int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseChannel
|
||||
@@ -361,8 +372,7 @@ int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseChannel
|
||||
*
|
||||
@@ -376,8 +386,7 @@ int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
/******************************************************************************
|
||||
* TvDeviceSetVolume
|
||||
*
|
||||
@@ -393,8 +402,7 @@ int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseVolume
|
||||
@@ -409,8 +417,7 @@ int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* 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);
|
||||
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@@ -426,8 +433,7 @@ int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
|
||||
//Picture Service Actions
|
||||
@@ -447,8 +453,7 @@ int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@@ -463,8 +468,7 @@ int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* 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);
|
||||
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseColor
|
||||
@@ -478,8 +482,7 @@ int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
* 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);
|
||||
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceSetTint
|
||||
@@ -496,8 +499,7 @@ int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseTint
|
||||
@@ -512,8 +514,7 @@ int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseTint
|
||||
@@ -528,8 +529,7 @@ int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/*****************************************************************************
|
||||
* TvDeviceSetContrast
|
||||
@@ -546,8 +546,7 @@ int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
****************************************************************************/
|
||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseContrast
|
||||
@@ -563,8 +562,7 @@ int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseContrast
|
||||
*
|
||||
@@ -578,8 +576,7 @@ int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceSetBrightness
|
||||
@@ -593,8 +590,7 @@ int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* brightness -- The brightness value to change to.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseBrightness
|
||||
@@ -609,8 +605,7 @@ int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseBrightness
|
||||
@@ -624,8 +619,7 @@ int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
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);
|
||||
|
||||
@@ -1,37 +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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sample_util.h"
|
||||
#include "upnp_tv_ctrlpt.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
@@ -124,108 +127,72 @@ TvCtrlPointPrintLongHelp( void )
|
||||
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, described in the tvdevicedesc.xml description document." );
|
||||
SampleUtil_Print( "This sample control point application automatically searches" );
|
||||
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
||||
SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." );
|
||||
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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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( " 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." );
|
||||
@@ -434,26 +401,29 @@ TvCtrlPointProcessCommand( char *cmdline )
|
||||
return TV_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
main( int argc,
|
||||
char **argv )
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
int rc;
|
||||
ithread_t cmdloop_thread;
|
||||
#ifdef WIN32
|
||||
#else
|
||||
int sig;
|
||||
sigset_t sigs_to_catch;
|
||||
#endif
|
||||
int code;
|
||||
|
||||
|
||||
rc = TvCtrlPointStart( linux_print, NULL );
|
||||
if( rc != TV_SUCCESS ) {
|
||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
||||
exit( rc );
|
||||
return rc;
|
||||
}
|
||||
// start a command loop thread
|
||||
code =
|
||||
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
||||
NULL );
|
||||
/* start a command loop thread */
|
||||
code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL );
|
||||
|
||||
#ifdef WIN32
|
||||
ithread_join(cmdloop_thread, NULL);
|
||||
#else
|
||||
/*
|
||||
Catch Ctrl-C and properly shutdown
|
||||
*/
|
||||
@@ -461,7 +431,11 @@ main( int argc,
|
||||
sigaddset( &sigs_to_catch, SIGINT );
|
||||
sigwait( &sigs_to_catch, &sig );
|
||||
|
||||
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
||||
#endif
|
||||
|
||||
rc = TvCtrlPointStop();
|
||||
exit( rc );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,42 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "upnp_tv_ctrlpt.h"
|
||||
|
||||
/*
|
||||
|
||||
#include "upnp.h"
|
||||
|
||||
|
||||
/*!
|
||||
Mutex for protecting the global device list
|
||||
in a multi-threaded, asynchronous environment.
|
||||
All functions should lock this mutex before reading
|
||||
@@ -48,7 +53,7 @@ char *TvServiceType[] = {
|
||||
};
|
||||
char *TvServiceName[] = { "Control", "Picture" };
|
||||
|
||||
/*
|
||||
/*!
|
||||
Global arrays for storing variable names and counts for
|
||||
TvControl and TvPicture services
|
||||
*/
|
||||
@@ -59,12 +64,12 @@ char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS] = {
|
||||
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
||||
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
||||
|
||||
/*
|
||||
/*!
|
||||
Timeout to request during subscriptions
|
||||
*/
|
||||
int default_timeout = 1801;
|
||||
|
||||
/*
|
||||
/*!
|
||||
The first node in the global device list, or NULL if empty
|
||||
*/
|
||||
struct TvDeviceNode *GlobalDeviceList = NULL;
|
||||
@@ -139,10 +144,10 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
|
||||
*
|
||||
********************************************************************************/
|
||||
int
|
||||
TvCtrlPointRemoveDevice( char *UDN )
|
||||
TvCtrlPointRemoveDevice(const char *UDN)
|
||||
{
|
||||
struct TvDeviceNode *curdevnode,
|
||||
*prevdevnode;
|
||||
struct TvDeviceNode *curdevnode;
|
||||
struct TvDeviceNode *prevdevnode;
|
||||
|
||||
ithread_mutex_lock( &DeviceListMutex );
|
||||
|
||||
@@ -669,7 +674,7 @@ TvCtrlPointPrintDevice( int devnum )
|
||||
********************************************************************************/
|
||||
void
|
||||
TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
||||
char *location,
|
||||
const char *location,
|
||||
int expires )
|
||||
{
|
||||
char *deviceType = NULL;
|
||||
@@ -682,20 +687,19 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
||||
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
||||
int TimeOut[TV_SERVICE_SERVCOUNT] =
|
||||
{ default_timeout, default_timeout };
|
||||
int TimeOut[TV_SERVICE_SERVCOUNT] = {
|
||||
default_timeout,
|
||||
default_timeout };
|
||||
struct TvDeviceNode *deviceNode;
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
int ret = 1;
|
||||
int found = 0;
|
||||
int service,
|
||||
var;
|
||||
int service;
|
||||
int var;
|
||||
|
||||
ithread_mutex_lock( &DeviceListMutex );
|
||||
|
||||
/*
|
||||
Read key elements from description document
|
||||
*/
|
||||
/* Read key elements from description document */
|
||||
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
||||
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
||||
friendlyName =
|
||||
@@ -703,9 +707,8 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
||||
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
||||
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
||||
|
||||
ret =
|
||||
UpnpResolveURL( ( baseURL ? baseURL : location ), relURL,
|
||||
presURL );
|
||||
ret = UpnpResolveURL(
|
||||
( baseURL ? baseURL : location ), relURL, presURL);
|
||||
|
||||
if( UPNP_E_SUCCESS != ret )
|
||||
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
||||
@@ -939,27 +942,31 @@ TvStateUpdate( char *UDN,
|
||||
* changes -- The DOM document representing the changes
|
||||
*
|
||||
********************************************************************************/
|
||||
void
|
||||
TvCtrlPointHandleEvent( Upnp_SID sid,
|
||||
void TvCtrlPointHandleEvent(
|
||||
const UpnpString *sid,
|
||||
int evntkey,
|
||||
IXML_Document *changes)
|
||||
{
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
int service;
|
||||
const char *aux_sid = NULL;
|
||||
|
||||
ithread_mutex_lock(&DeviceListMutex);
|
||||
|
||||
tmpdevnode = GlobalDeviceList;
|
||||
while (tmpdevnode) {
|
||||
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
||||
if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) ==
|
||||
0 ) {
|
||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) {
|
||||
aux_sid = UpnpString_get_String(sid);
|
||||
if (strcmp(tmpdevnode->device.TvService[service].SID, aux_sid) == 0) {
|
||||
SampleUtil_Print("Received Tv %s Event: %d for SID %s",
|
||||
TvServiceName[service], evntkey, sid );
|
||||
|
||||
TvStateUpdate( tmpdevnode->device.UDN, service, changes,
|
||||
( char ** )&tmpdevnode->device.
|
||||
TvService[service].VariableStrVal );
|
||||
TvServiceName[service],
|
||||
evntkey,
|
||||
aux_sid);
|
||||
TvStateUpdate(
|
||||
tmpdevnode->device.UDN,
|
||||
service,
|
||||
changes,
|
||||
(char **)&tmpdevnode->device.TvService[service].VariableStrVal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -983,9 +990,9 @@ TvCtrlPointHandleEvent( Upnp_SID sid,
|
||||
* timeout -- The new timeout for the subscription
|
||||
*
|
||||
********************************************************************************/
|
||||
void
|
||||
TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
||||
Upnp_SID sid,
|
||||
void TvCtrlPointHandleSubscribeUpdate(
|
||||
const char *eventURL,
|
||||
const Upnp_SID sid,
|
||||
int timeout)
|
||||
{
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
@@ -1015,9 +1022,9 @@ TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
||||
}
|
||||
|
||||
void
|
||||
TvCtrlPointHandleGetVar( char *controlURL,
|
||||
char *varName,
|
||||
DOMString varValue )
|
||||
TvCtrlPointHandleGetVar( const char *controlURL,
|
||||
const char *varName,
|
||||
const DOMString varValue )
|
||||
{
|
||||
|
||||
struct TvDeviceNode *tmpdevnode;
|
||||
@@ -1028,12 +1035,9 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
||||
tmpdevnode = GlobalDeviceList;
|
||||
while (tmpdevnode) {
|
||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
|
||||
if( strcmp
|
||||
( tmpdevnode->device.TvService[service].ControlURL,
|
||||
controlURL ) == 0 ) {
|
||||
SampleUtil_StateUpdate( varName, varValue,
|
||||
tmpdevnode->device.UDN,
|
||||
GET_VAR_COMPLETE );
|
||||
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL ) == 0 ) {
|
||||
SampleUtil_StateUpdate(
|
||||
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1057,69 +1061,60 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
||||
* Cookie -- Optional data specified during callback registration
|
||||
*
|
||||
********************************************************************************/
|
||||
int
|
||||
TvCtrlPointCallbackEventHandler( Upnp_EventType EventType,
|
||||
void *Event,
|
||||
void *Cookie )
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||
{
|
||||
int errCode = 0;
|
||||
|
||||
SampleUtil_PrintEvent(EventType, Event);
|
||||
|
||||
switch ( EventType ) {
|
||||
/*
|
||||
SSDP Stuff
|
||||
*/
|
||||
/* SSDP Stuff */
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT:
|
||||
{
|
||||
struct Upnp_Discovery *d_event =
|
||||
( struct Upnp_Discovery * )Event;
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
||||
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
IXML_Document *DescDoc = NULL;
|
||||
int ret;
|
||||
|
||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error in Discovery Callback -- %d",
|
||||
d_event->ErrCode );
|
||||
const char *location = NULL;
|
||||
int errCode = UpnpDiscovery_get_ErrCode(d_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Discovery Callback -- %d", errCode);
|
||||
}
|
||||
|
||||
if( ( ret =
|
||||
UpnpDownloadXmlDoc( d_event->Location,
|
||||
&DescDoc ) ) !=
|
||||
UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error obtaining device description from %s -- error = %d",
|
||||
d_event->Location, ret );
|
||||
location = UpnpString_get_String(UpnpDiscovery_get_Location(d_event));
|
||||
errCode = UpnpDownloadXmlDoc(location, &DescDoc);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error obtaining device description from %s -- error = %d",
|
||||
location, errCode);
|
||||
} else {
|
||||
TvCtrlPointAddDevice( DescDoc, d_event->Location,
|
||||
d_event->Expires );
|
||||
TvCtrlPointAddDevice(
|
||||
DescDoc, location, UpnpDiscovery_get_Expires(d_event));
|
||||
}
|
||||
|
||||
if( DescDoc )
|
||||
if( DescDoc ) {
|
||||
ixmlDocument_free(DescDoc);
|
||||
}
|
||||
|
||||
TvCtrlPointPrintList();
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||
/*
|
||||
Nothing to do here...
|
||||
*/
|
||||
/* Nothing to do here... */
|
||||
break;
|
||||
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
|
||||
{
|
||||
struct Upnp_Discovery *d_event =
|
||||
( struct Upnp_Discovery * )Event;
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
||||
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
int errCode = UpnpDiscovery_get_ErrCode(d_event);
|
||||
const char *deviceId = UpnpString_get_String(
|
||||
UpnpDiscovery_get_DeviceID(d_event));
|
||||
|
||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Discovery ByeBye Callback -- %d",
|
||||
d_event->ErrCode );
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Discovery ByeBye Callback -- %d", errCode);
|
||||
}
|
||||
|
||||
SampleUtil_Print( "Received ByeBye for Device: %s",
|
||||
d_event->DeviceId );
|
||||
TvCtrlPointRemoveDevice( d_event->DeviceId );
|
||||
SampleUtil_Print("Received ByeBye for Device: %s", deviceId);
|
||||
TvCtrlPointRemoveDevice(deviceId);
|
||||
|
||||
SampleUtil_Print("After byebye:");
|
||||
TvCtrlPointPrintList();
|
||||
@@ -1127,109 +1122,92 @@ TvCtrlPointCallbackEventHandler( Upnp_EventType EventType,
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
SOAP Stuff
|
||||
*/
|
||||
case UPNP_CONTROL_ACTION_COMPLETE:
|
||||
{
|
||||
struct Upnp_Action_Complete *a_event =
|
||||
( struct Upnp_Action_Complete * )Event;
|
||||
|
||||
if( a_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Action Complete Callback -- %d",
|
||||
a_event->ErrCode );
|
||||
/* SOAP Stuff */
|
||||
case UPNP_CONTROL_ACTION_COMPLETE: {
|
||||
UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
|
||||
int errCode = UpnpActionComplete_get_ErrCode(a_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Action Complete Callback -- %d",
|
||||
errCode);
|
||||
}
|
||||
|
||||
/*
|
||||
No need for any processing here, just print out results. Service state
|
||||
table updates are handled by events.
|
||||
*/
|
||||
/* No need for any processing here, just print out results.
|
||||
* Service state table updates are handled by events. */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_CONTROL_GET_VAR_COMPLETE:
|
||||
{
|
||||
struct Upnp_State_Var_Complete *sv_event =
|
||||
( struct Upnp_State_Var_Complete * )Event;
|
||||
|
||||
if( sv_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Get Var Complete Callback -- %d",
|
||||
sv_event->ErrCode );
|
||||
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
||||
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
|
||||
int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Get Var Complete Callback -- %d",
|
||||
errCode );
|
||||
} else {
|
||||
TvCtrlPointHandleGetVar( sv_event->CtrlUrl,
|
||||
sv_event->StateVarName,
|
||||
sv_event->CurrentVal );
|
||||
TvCtrlPointHandleGetVar(
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
|
||||
UpnpStateVarComplete_get_CurrentVal(sv_event) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
GENA Stuff
|
||||
*/
|
||||
case UPNP_EVENT_RECEIVED:
|
||||
{
|
||||
struct Upnp_Event *e_event = ( struct Upnp_Event * )Event;
|
||||
|
||||
TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey,
|
||||
e_event->ChangedVariables );
|
||||
/* GENA Stuff */
|
||||
case UPNP_EVENT_RECEIVED: {
|
||||
UpnpEvent *e_event = (UpnpEvent *)Event;
|
||||
TvCtrlPointHandleEvent(
|
||||
UpnpEvent_get_SID(e_event),
|
||||
UpnpEvent_get_EventKey(e_event),
|
||||
UpnpEvent_get_ChangedVariables(e_event));
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_RENEWAL_COMPLETE:
|
||||
{
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
( struct Upnp_Event_Subscribe * )Event;
|
||||
|
||||
if( es_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error in Event Subscribe Callback -- %d",
|
||||
es_event->ErrCode );
|
||||
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
errCode = UpnpEventSubscribe_get_ErrCode(es_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Event Subscribe Callback -- %d",
|
||||
errCode);
|
||||
} else {
|
||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||
PublisherUrl,
|
||||
es_event->Sid,
|
||||
es_event->TimeOut );
|
||||
TvCtrlPointHandleSubscribeUpdate(
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
|
||||
UpnpEventSubscribe_get_TimeOut(es_event));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
|
||||
{
|
||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
int TimeOut = default_timeout;
|
||||
Upnp_SID newSID;
|
||||
int ret;
|
||||
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
( struct Upnp_Event_Subscribe * )Event;
|
||||
|
||||
ret =
|
||||
UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl,
|
||||
&TimeOut, newSID );
|
||||
|
||||
if( ret == UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Subscribed to EventURL with SID=%s",
|
||||
errCode = UpnpSubscribe(
|
||||
ctrlpt_handle,
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
&TimeOut,
|
||||
newSID);
|
||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||
PublisherUrl, newSID,
|
||||
|
||||
if (errCode == UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
|
||||
TvCtrlPointHandleSubscribeUpdate(
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
newSID,
|
||||
TimeOut);
|
||||
} else {
|
||||
SampleUtil_Print
|
||||
( "Error Subscribing to EventURL -- %d", ret );
|
||||
SampleUtil_Print("Error Subscribing to EventURL -- %d", errCode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
ignore these cases, since this is not a device
|
||||
*/
|
||||
/* ignore these cases, since this is not a device */
|
||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||
case UPNP_CONTROL_ACTION_REQUEST:
|
||||
@@ -1320,12 +1298,12 @@ TvCtrlPointVerifyTimeouts( int incr )
|
||||
* None
|
||||
*
|
||||
********************************************************************************/
|
||||
void *
|
||||
TvCtrlPointTimerLoop( void *args )
|
||||
static int TvCtrlPointTimerLoopRun = 1;
|
||||
void *TvCtrlPointTimerLoop(void *args)
|
||||
{
|
||||
int incr = 30; // how often to verify the timeouts, in seconds
|
||||
|
||||
while( 1 ) {
|
||||
while (TvCtrlPointTimerLoopRun) {
|
||||
isleep( incr );
|
||||
TvCtrlPointVerifyTimeouts( incr );
|
||||
}
|
||||
@@ -1348,13 +1326,11 @@ TvCtrlPointTimerLoop( void *args )
|
||||
* TV_SUCCESS if everything went well, else TV_ERROR
|
||||
*
|
||||
********************************************************************************/
|
||||
int
|
||||
TvCtrlPointStart( print_string printFunctionPtr,
|
||||
state_update updateFunctionPtr )
|
||||
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr)
|
||||
{
|
||||
ithread_t timer_thread;
|
||||
int rc;
|
||||
short int port = 0;
|
||||
unsigned short port = 0;
|
||||
char *ip_address = NULL;
|
||||
|
||||
SampleUtil_Initialize(printFunctionPtr);
|
||||
@@ -1362,28 +1338,36 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
ithread_mutex_init(&DeviceListMutex, 0);
|
||||
|
||||
SampleUtil_Print( "Initializing UPnP with ipaddress=%s port=%d",
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port);
|
||||
|
||||
rc = UpnpInit(ip_address, port);
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
if (rc != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("WinCEStart: UpnpInit() Error: %d", rc);
|
||||
UpnpFinish();
|
||||
return TV_ERROR;
|
||||
}
|
||||
|
||||
if( NULL == ip_address )
|
||||
if (!ip_address) {
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
if( 0 == port )
|
||||
}
|
||||
if (!port) {
|
||||
port = UpnpGetServerPort();
|
||||
}
|
||||
|
||||
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port );
|
||||
SampleUtil_Print(
|
||||
"UPnP Initialized\n"
|
||||
"\tipaddress= %s port = %u\n",
|
||||
ip_address, port);
|
||||
|
||||
SampleUtil_Print("Registering Control Point");
|
||||
rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,
|
||||
&ctrlpt_handle, &ctrlpt_handle);
|
||||
if( UPNP_E_SUCCESS != rc ) {
|
||||
if (rc != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||
UpnpFinish();
|
||||
|
||||
return TV_ERROR;
|
||||
}
|
||||
|
||||
@@ -1391,15 +1375,16 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
||||
|
||||
TvCtrlPointRefresh();
|
||||
|
||||
// start a timer thread
|
||||
/* start a timer thread */
|
||||
ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL);
|
||||
ithread_detach(timer_thread);
|
||||
|
||||
return TV_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
TvCtrlPointStop( void )
|
||||
int TvCtrlPointStop(void)
|
||||
{
|
||||
TvCtrlPointTimerLoopRun = 0;
|
||||
TvCtrlPointRemoveAll();
|
||||
UpnpUnRegisterClient( ctrlpt_handle );
|
||||
UpnpFinish();
|
||||
@@ -1407,3 +1392,4 @@ TvCtrlPointStop( void )
|
||||
|
||||
return TV_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,53 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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_TV_CTRLPT_H
|
||||
#define UPNP_TV_CTRLPT_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sample_util.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"
|
||||
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/* Do not #include <unistd.h> */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define TV_SERVICE_SERVCOUNT 2
|
||||
#define TV_SERVICE_CONTROL 0
|
||||
@@ -108,11 +120,11 @@ extern ithread_mutex_t DeviceListMutex;
|
||||
|
||||
extern UpnpClient_Handle ctrlpt_handle;
|
||||
|
||||
void TvCtrlPointPrintHelp( void );
|
||||
void TvCtrlPointPrintHelp();
|
||||
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
||||
int TvCtrlPointRemoveDevice(char*);
|
||||
int TvCtrlPointRemoveAll( void );
|
||||
int TvCtrlPointRefresh( void );
|
||||
int TvCtrlPointRemoveDevice(const char *);
|
||||
int TvCtrlPointRemoveAll();
|
||||
int TvCtrlPointRefresh();
|
||||
|
||||
|
||||
int TvCtrlPointSendAction(int, int, char *, char **, char **, int);
|
||||
@@ -138,11 +150,11 @@ 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 TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
||||
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
||||
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
||||
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
||||
void TvCtrlPointHandleEvent(const UpnpString *, int, IXML_Document *);
|
||||
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||
void TvCtrlPointVerifyTimeouts(int);
|
||||
void TvCtrlPointPrintCommands( void );
|
||||
|
||||
@@ -1,38 +1,42 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sample_util.h"
|
||||
#include "upnp_tv_device.h"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* linux_print
|
||||
*
|
||||
@@ -117,21 +121,22 @@ TvDeviceCommandLoop( void *args )
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
main( IN int argc,
|
||||
IN char **argv )
|
||||
int main( IN int argc, IN char **argv )
|
||||
{
|
||||
|
||||
unsigned int portTemp = 0;
|
||||
char *ip_address = NULL,
|
||||
*desc_doc_name = NULL,
|
||||
*web_dir_path = NULL;
|
||||
int rc;
|
||||
ithread_t cmdloop_thread;
|
||||
int code;
|
||||
unsigned int port = 0;
|
||||
#ifdef WIN32
|
||||
#else
|
||||
int sig;
|
||||
sigset_t sigs_to_catch;
|
||||
|
||||
#endif
|
||||
int code;
|
||||
unsigned int port = 0;
|
||||
int i = 0;
|
||||
|
||||
SampleUtil_Initialize( linux_print );
|
||||
@@ -163,21 +168,20 @@ main( IN int argc,
|
||||
( "\tweb_dir_path: Filesystem path where web files "
|
||||
"related to the device are stored\n" );
|
||||
SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" );
|
||||
exit( 1 );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
port = ( unsigned short )portTemp;
|
||||
|
||||
TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path,
|
||||
linux_print );
|
||||
TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
||||
|
||||
/*
|
||||
start a command loop thread
|
||||
*/
|
||||
code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop,
|
||||
NULL );
|
||||
/* start a command loop thread */
|
||||
code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop, NULL );
|
||||
|
||||
#ifdef WIN32
|
||||
ithread_join(cmdloop_thread, NULL);
|
||||
#else
|
||||
/*
|
||||
Catch Ctrl-C and properly shutdown
|
||||
*/
|
||||
@@ -186,6 +190,9 @@ main( IN int argc,
|
||||
sigwait( &sigs_to_catch, &sig );
|
||||
|
||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
||||
TvDeviceStop( );
|
||||
exit( 0 );
|
||||
#endif
|
||||
rc = TvDeviceStop();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include "upnp_tv_device.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#define DEFAULT_WEB_DIR "./web"
|
||||
|
||||
|
||||
#define DESC_URL_SIZE 200
|
||||
|
||||
|
||||
/*
|
||||
Device type for tv device
|
||||
*/
|
||||
@@ -180,7 +187,6 @@ SetServiceTable( IN int serviceType,
|
||||
}
|
||||
|
||||
return SetActionTable( serviceType, out );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -251,7 +257,6 @@ SetActionTable( IN int serviceType,
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -368,61 +373,68 @@ TvDeviceStateTableInit( IN char *DescDocURL )
|
||||
* sr_event -- The subscription request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
||||
*sr_event )
|
||||
int TvDeviceHandleSubscriptionRequest(IN const UpnpSubscriptionRequest *sr_event)
|
||||
{
|
||||
unsigned int i = 0; //,j=0;
|
||||
|
||||
unsigned int i = 0;
|
||||
//unsigned int j = 0;
|
||||
int cmp1 = 0;
|
||||
int cmp2 = 0;
|
||||
const char *l_serviceId = NULL;
|
||||
const char *l_udn = NULL;
|
||||
const char *l_sid = NULL;
|
||||
// IXML_Document *PropSet = NULL;
|
||||
|
||||
// lock state mutex
|
||||
ithread_mutex_lock( &TVDevMutex );
|
||||
|
||||
for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) {
|
||||
if( ( strcmp( sr_event->UDN, tv_service_table[i].UDN ) == 0 ) &&
|
||||
( strcmp( sr_event->ServiceId, tv_service_table[i].ServiceId )
|
||||
== 0 ) ) {
|
||||
|
||||
/*
|
||||
l_serviceId = UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(sr_event));
|
||||
l_udn = UpnpString_get_String(UpnpSubscriptionRequest_get_UDN(sr_event));
|
||||
l_sid = UpnpString_get_String(UpnpSubscriptionRequest_get_SID(sr_event));
|
||||
for (i = 0; i < TV_SERVICE_SERVCOUNT; ++i) {
|
||||
cmp1 = strcmp(l_udn, tv_service_table[i].UDN);
|
||||
cmp2 = strcmp(l_serviceId, tv_service_table[i].ServiceId);
|
||||
if (cmp1 == 0 && cmp2 == 0) {
|
||||
#if 0
|
||||
PropSet = NULL;
|
||||
|
||||
for (j=0; j< tv_service_table[i].VariableCount; j++)
|
||||
{
|
||||
for (j = 0; j< tv_service_table[i].VariableCount; ++j) {
|
||||
// add each variable to the property set
|
||||
// for initial state dump
|
||||
UpnpAddToPropertySet(&PropSet,
|
||||
UpnpAddToPropertySet(
|
||||
&PropSet,
|
||||
tv_service_table[i].VariableName[j],
|
||||
tv_service_table[i].VariableStrVal[j]);
|
||||
}
|
||||
|
||||
// dump initial state
|
||||
UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,
|
||||
sr_event->ServiceId,
|
||||
PropSet,sr_event->Sid);
|
||||
UpnpAcceptSubscriptionExt(
|
||||
device_handle,
|
||||
l_udn,
|
||||
l_serviceId,
|
||||
PropSet,
|
||||
l_sid);
|
||||
// free document
|
||||
Document_free(PropSet);
|
||||
|
||||
*/
|
||||
|
||||
UpnpAcceptSubscription( device_handle,
|
||||
sr_event->UDN,
|
||||
sr_event->ServiceId,
|
||||
#endif
|
||||
UpnpAcceptSubscription(
|
||||
device_handle,
|
||||
l_udn,
|
||||
l_serviceId,
|
||||
(const char **)tv_service_table[i].
|
||||
VariableName,
|
||||
(const char **)tv_service_table[i].
|
||||
VariableStrVal,
|
||||
tv_service_table[i].VariableCount,
|
||||
sr_event->Sid );
|
||||
|
||||
l_sid);
|
||||
}
|
||||
}
|
||||
|
||||
ithread_mutex_unlock( &TVDevMutex );
|
||||
|
||||
return ( 1 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceHandleGetVarRequest
|
||||
*
|
||||
@@ -436,31 +448,32 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||
*cgv_event )
|
||||
TvDeviceHandleGetVarRequest( INOUT UpnpStateVarRequest *cgv_event )
|
||||
{
|
||||
unsigned int i = 0,
|
||||
j = 0;
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
int getvar_succeeded = 0;
|
||||
|
||||
cgv_event->CurrentVal = NULL;
|
||||
UpnpStateVarRequest_set_CurrentVal(cgv_event, NULL);
|
||||
|
||||
ithread_mutex_lock( &TVDevMutex );
|
||||
|
||||
for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) {
|
||||
// check udn and service id
|
||||
if( ( strcmp( cgv_event->DevUDN, tv_service_table[i].UDN ) == 0 )
|
||||
&&
|
||||
( strcmp( cgv_event->ServiceID, tv_service_table[i].ServiceId )
|
||||
== 0 ) ) {
|
||||
const char *devUDN =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(cgv_event));
|
||||
const char *serviceID =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(cgv_event));
|
||||
if( ( strcmp( devUDN, tv_service_table[i].UDN ) == 0 ) &&
|
||||
( strcmp( serviceID, tv_service_table[i].ServiceId ) == 0 ) ) {
|
||||
// check variable name
|
||||
for( j = 0; j < tv_service_table[i].VariableCount; j++ ) {
|
||||
if( strcmp( cgv_event->StateVarName,
|
||||
tv_service_table[i].VariableName[j] ) == 0 ) {
|
||||
const char *stateVarName =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(cgv_event));
|
||||
if( strcmp( stateVarName, tv_service_table[i].VariableName[j] ) == 0 ) {
|
||||
getvar_succeeded = 1;
|
||||
cgv_event->CurrentVal =
|
||||
ixmlCloneDOMString( tv_service_table[i].
|
||||
VariableStrVal[j] );
|
||||
UpnpStateVarRequest_set_CurrentVal(cgv_event,
|
||||
tv_service_table[i].VariableStrVal[j] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -468,19 +481,19 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||
}
|
||||
|
||||
if( getvar_succeeded ) {
|
||||
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
||||
UpnpStateVarRequest_set_ErrCode(cgv_event, UPNP_E_SUCCESS);
|
||||
} else {
|
||||
SampleUtil_Print
|
||||
( "Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n" );
|
||||
SampleUtil_Print( " Unknown variable name = %s\n",
|
||||
cgv_event->StateVarName );
|
||||
cgv_event->ErrCode = 404;
|
||||
strcpy( cgv_event->ErrStr, "Invalid Variable" );
|
||||
SampleUtil_Print(
|
||||
"Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n"
|
||||
" Unknown variable name = %s\n",
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(cgv_event)) );
|
||||
UpnpStateVarRequest_set_ErrCode(cgv_event, 404);
|
||||
UpnpStateVarRequest_strcpy_ErrStr(cgv_event, "Invalid Variable" );
|
||||
}
|
||||
|
||||
ithread_mutex_unlock( &TVDevMutex );
|
||||
|
||||
return ( cgv_event->ErrCode == UPNP_E_SUCCESS );
|
||||
return UpnpStateVarRequest_get_ErrCode(cgv_event) == UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -496,9 +509,8 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
TvDeviceHandleActionRequest( INOUT UpnpActionRequest *ca_event )
|
||||
{
|
||||
|
||||
/*
|
||||
Defaults if action not found
|
||||
*/
|
||||
@@ -507,51 +519,38 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
int service = -1;
|
||||
int retCode = 0;
|
||||
char *errorString = NULL;
|
||||
const char *devUDN = NULL;
|
||||
const char *serviceID = NULL;
|
||||
const char *actionName = NULL;
|
||||
IXML_Document *actionResult = NULL;
|
||||
|
||||
ca_event->ErrCode = 0;
|
||||
ca_event->ActionResult = NULL;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 0);
|
||||
UpnpActionRequest_set_ActionResult(ca_event, NULL);
|
||||
|
||||
if( ( strcmp( ca_event->DevUDN,
|
||||
tv_service_table[TV_SERVICE_CONTROL].UDN ) == 0 ) &&
|
||||
( strcmp
|
||||
( ca_event->ServiceID,
|
||||
tv_service_table[TV_SERVICE_CONTROL].ServiceId ) == 0 ) ) {
|
||||
/*
|
||||
Request for action in the TvDevice Control Service
|
||||
*/
|
||||
devUDN = UpnpString_get_String(UpnpActionRequest_get_DevUDN( ca_event));
|
||||
serviceID = UpnpString_get_String(UpnpActionRequest_get_ServiceID( ca_event));
|
||||
actionName = UpnpString_get_String(UpnpActionRequest_get_ActionName(ca_event));
|
||||
if( ( strcmp( devUDN, tv_service_table[TV_SERVICE_CONTROL].UDN ) == 0 ) &&
|
||||
( strcmp( serviceID, tv_service_table[TV_SERVICE_CONTROL].ServiceId ) == 0 ) ) {
|
||||
/* Request for action in the TvDevice Control Service */
|
||||
service = TV_SERVICE_CONTROL;
|
||||
} else if( ( strcmp( ca_event->DevUDN,
|
||||
tv_service_table[TV_SERVICE_PICTURE].UDN ) == 0 )
|
||||
&&
|
||||
( strcmp
|
||||
( ca_event->ServiceID,
|
||||
tv_service_table[TV_SERVICE_PICTURE].ServiceId ) ==
|
||||
0 ) ) {
|
||||
/*
|
||||
Request for action in the TvDevice Picture Service
|
||||
*/
|
||||
} else if( ( strcmp( devUDN, tv_service_table[TV_SERVICE_PICTURE].UDN ) == 0 ) &&
|
||||
( strcmp( serviceID, tv_service_table[TV_SERVICE_PICTURE].ServiceId ) == 0 ) ) {
|
||||
/* Request for action in the TvDevice Picture Service */
|
||||
service = TV_SERVICE_PICTURE;
|
||||
}
|
||||
//Find and call appropriate procedure based on action name
|
||||
//Each action name has an associated procedure stored in the
|
||||
//service table. These are set at initialization.
|
||||
|
||||
for( i = 0; ( ( i < TV_MAXACTIONS ) &&
|
||||
( tv_service_table[service].ActionNames[i] != NULL ) );
|
||||
i++ ) {
|
||||
|
||||
if( !strcmp( ca_event->ActionName,
|
||||
tv_service_table[service].ActionNames[i] ) ) {
|
||||
|
||||
if( ( !strcmp( tv_service_table[TV_SERVICE_CONTROL].
|
||||
VariableStrVal[TV_CONTROL_POWER], "1" ) )
|
||||
|| ( !strcmp( ca_event->ActionName, "PowerOn" ) ) ) {
|
||||
retCode =
|
||||
tv_service_table[service].actions[i] ( ca_event->
|
||||
ActionRequest,
|
||||
&ca_event->
|
||||
ActionResult,
|
||||
/* Find and call appropriate procedure based on action name
|
||||
* Each action name has an associated procedure stored in the
|
||||
* service table. These are set at initialization. */
|
||||
for( i = 0; i < TV_MAXACTIONS && tv_service_table[service].ActionNames[i] != NULL; i++ ) {
|
||||
if( !strcmp( actionName, tv_service_table[service].ActionNames[i] ) ) {
|
||||
if( ( !strcmp( tv_service_table[TV_SERVICE_CONTROL].VariableStrVal[TV_CONTROL_POWER], "1" ) ) ||
|
||||
( !strcmp( actionName, "PowerOn" ) ) ) {
|
||||
retCode = tv_service_table[service].actions[i](
|
||||
UpnpActionRequest_get_ActionRequest(ca_event),
|
||||
&actionResult,
|
||||
&errorString );
|
||||
UpnpActionRequest_set_ActionResult(ca_event, actionResult);
|
||||
} else {
|
||||
errorString = "Power is Off";
|
||||
retCode = UPNP_E_INTERNAL_ERROR;
|
||||
@@ -562,25 +561,25 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
}
|
||||
|
||||
if( !action_found ) {
|
||||
ca_event->ActionResult = NULL;
|
||||
strcpy( ca_event->ErrStr, "Invalid Action" );
|
||||
ca_event->ErrCode = 401;
|
||||
UpnpActionRequest_set_ActionResult(ca_event, NULL);
|
||||
UpnpActionRequest_strcpy_ErrStr(ca_event, "Invalid Action" );
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 401);
|
||||
} else {
|
||||
if( retCode == UPNP_E_SUCCESS ) {
|
||||
ca_event->ErrCode = UPNP_E_SUCCESS;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, UPNP_E_SUCCESS);
|
||||
} else {
|
||||
// copy the error string
|
||||
strcpy( ca_event->ErrStr, errorString );
|
||||
UpnpActionRequest_strcpy_ErrStr(ca_event, errorString );
|
||||
switch ( retCode ) {
|
||||
case UPNP_E_INVALID_PARAM:
|
||||
{
|
||||
ca_event->ErrCode = 402;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 402);
|
||||
break;
|
||||
}
|
||||
case UPNP_E_INTERNAL_ERROR:
|
||||
default:
|
||||
{
|
||||
ca_event->ErrCode = 501;
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 501);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -588,7 +587,7 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||
}
|
||||
}
|
||||
|
||||
return ( ca_event->ErrCode );
|
||||
return UpnpActionRequest_get_ErrCode(ca_event);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -651,7 +650,6 @@ TvDeviceSetServiceTableVar( IN unsigned int service,
|
||||
ithread_mutex_unlock( &TVDevMutex );
|
||||
|
||||
return ( 1 );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -674,7 +672,7 @@ TvDeviceSetPower( IN int on )
|
||||
|
||||
if( on != POWER_ON && on != POWER_OFF ) {
|
||||
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
||||
return ( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -685,7 +683,7 @@ TvDeviceSetPower( IN int on )
|
||||
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
||||
value );
|
||||
|
||||
return ( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -702,9 +700,7 @@ TvDeviceSetPower( IN int on )
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDevicePowerOn( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
( *out ) = NULL;
|
||||
( *errorString ) = NULL;
|
||||
@@ -724,7 +720,6 @@ TvDevicePowerOn( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -781,11 +776,8 @@ TvDevicePowerOff( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetChannel( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int channel = 0;
|
||||
@@ -830,7 +822,6 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -848,13 +839,10 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementChannel( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curchannel,
|
||||
newchannel;
|
||||
int curchannel;
|
||||
int newchannel;
|
||||
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
@@ -916,12 +904,9 @@ IncrementChannel( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseChannel( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementChannel( -1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -938,12 +923,9 @@ TvDeviceDecreaseChannel( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseChannel( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementChannel( 1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -962,13 +944,9 @@ TvDeviceIncreaseChannel( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetVolume( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int volume = 0;
|
||||
|
||||
( *out ) = NULL;
|
||||
@@ -1009,7 +987,6 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1028,10 +1005,7 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementVolume( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curvolume,
|
||||
newvolume;
|
||||
@@ -1068,8 +1042,7 @@ IncrementVolume( IN int incr,
|
||||
TV_CONTROL_VOLUME, value ) ) {
|
||||
if( UpnpAddToActionResponse( out, actionName,
|
||||
TvServiceType[TV_SERVICE_CONTROL],
|
||||
"Volume", value ) != UPNP_E_SUCCESS )
|
||||
{
|
||||
"Volume", value ) != UPNP_E_SUCCESS ) {
|
||||
( *out ) = NULL;
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
@@ -1079,7 +1052,6 @@ IncrementVolume( IN int incr,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1096,13 +1068,9 @@ IncrementVolume( IN int incr,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseVolume( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementVolume( 1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1119,13 +1087,9 @@ TvDeviceIncreaseVolume( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseVolume( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementVolume( -1, in, out, errorString );
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1144,13 +1108,9 @@ TvDeviceDecreaseVolume( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetColor( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int color = 0;
|
||||
|
||||
( *out ) = NULL;
|
||||
@@ -1190,7 +1150,6 @@ TvDeviceSetColor( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1207,16 +1166,11 @@ TvDeviceSetColor( IN IXML_Document * in,
|
||||
* IXML_Document **out - action result document
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
|
||||
int
|
||||
IncrementColor( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curcolor,
|
||||
newcolor;
|
||||
|
||||
int curcolor;
|
||||
int newcolor;
|
||||
char *actionName;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1274,11 +1228,8 @@ IncrementColor( IN int incr,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseColor( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementColor( -1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1295,11 +1246,8 @@ TvDeviceDecreaseColor( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseColor( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementColor( 1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1319,13 +1267,9 @@ TvDeviceIncreaseColor( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetTint( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
|
||||
int tint = -1;
|
||||
|
||||
( *out ) = NULL;
|
||||
@@ -1384,14 +1328,10 @@ TvDeviceSetTint( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementTint( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curtint,
|
||||
newtint;
|
||||
|
||||
int curtint;
|
||||
int newtint;
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1434,7 +1374,6 @@ IncrementTint( IN int incr,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1451,11 +1390,8 @@ IncrementTint( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseTint( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementTint( 1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1473,11 +1409,8 @@ TvDeviceIncreaseTint( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseTint( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementTint( -1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1497,11 +1430,8 @@ TvDeviceDecreaseTint( IN IXML_Document * in,
|
||||
*
|
||||
****************************************************************************/
|
||||
int
|
||||
TvDeviceSetContrast( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
int contrast = -1;
|
||||
|
||||
@@ -1562,14 +1492,10 @@ TvDeviceSetContrast( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementContrast( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curcontrast,
|
||||
newcontrast;
|
||||
|
||||
int curcontrast;
|
||||
int newcontrast;
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1631,11 +1557,8 @@ IncrementContrast( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseContrast( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
return IncrementContrast( 1, in, out, errorString );
|
||||
}
|
||||
|
||||
@@ -1653,9 +1576,7 @@ TvDeviceIncreaseContrast( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseContrast( IXML_Document * in,
|
||||
IXML_Document ** out,
|
||||
char **errorString )
|
||||
TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementContrast( -1, in, out, errorString );
|
||||
}
|
||||
@@ -1673,11 +1594,8 @@ TvDeviceDecreaseContrast( IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceSetBrightness( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
|
||||
char *value = NULL;
|
||||
int brightness = -1;
|
||||
|
||||
@@ -1720,7 +1638,6 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
||||
( *errorString ) = "Internal Error";
|
||||
return UPNP_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1738,13 +1655,10 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*****************************************************************************/
|
||||
int
|
||||
IncrementBrightness( IN int incr,
|
||||
IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
int curbrightness,
|
||||
newbrightness;
|
||||
int curbrightness;
|
||||
int newbrightness;
|
||||
char *actionName = NULL;
|
||||
char value[TV_MAX_VAL_LEN];
|
||||
|
||||
@@ -1805,9 +1719,7 @@ IncrementBrightness( IN int incr,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementBrightness( 1, in, out, errorString );
|
||||
}
|
||||
@@ -1825,9 +1737,7 @@ TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
||||
OUT IXML_Document ** out,
|
||||
OUT char **errorString )
|
||||
TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||
{
|
||||
return IncrementBrightness( -1, in, out, errorString );
|
||||
}
|
||||
@@ -1851,29 +1761,19 @@ TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
||||
* Cookie -- Optional data specified during callback registration
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
||||
void *Event,
|
||||
void *Cookie )
|
||||
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||
{
|
||||
|
||||
switch ( EventType ) {
|
||||
|
||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||
|
||||
TvDeviceHandleSubscriptionRequest( ( struct
|
||||
Upnp_Subscription_Request
|
||||
* )Event );
|
||||
TvDeviceHandleSubscriptionRequest((UpnpSubscriptionRequest *)Event);
|
||||
break;
|
||||
|
||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||
TvDeviceHandleGetVarRequest( ( struct Upnp_State_Var_Request
|
||||
* )Event );
|
||||
TvDeviceHandleGetVarRequest( (UpnpStateVarRequest *)Event );
|
||||
break;
|
||||
|
||||
case UPNP_CONTROL_ACTION_REQUEST:
|
||||
TvDeviceHandleActionRequest( ( struct Upnp_Action_Request * )
|
||||
Event );
|
||||
TvDeviceHandleActionRequest( (UpnpActionRequest *)Event );
|
||||
break;
|
||||
|
||||
/*
|
||||
@@ -1892,17 +1792,14 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
||||
break;
|
||||
|
||||
default:
|
||||
SampleUtil_Print
|
||||
( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||
SampleUtil_Print( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||
EventType );
|
||||
}
|
||||
|
||||
/*
|
||||
Print a summary of the event received
|
||||
*/
|
||||
/* Print a summary of the event received */
|
||||
SampleUtil_PrintEvent( EventType, Event );
|
||||
|
||||
return ( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1915,12 +1812,13 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
||||
*
|
||||
*****************************************************************************/
|
||||
int
|
||||
TvDeviceStop( )
|
||||
TvDeviceStop(void)
|
||||
{
|
||||
UpnpUnRegisterRootDevice( device_handle );
|
||||
UpnpFinish();
|
||||
SampleUtil_Finish();
|
||||
ithread_mutex_destroy( &TVDevMutex );
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1953,79 +1851,83 @@ TvDeviceStart( char *ip_address,
|
||||
print_string pfun )
|
||||
{
|
||||
int ret = UPNP_E_SUCCESS;
|
||||
|
||||
char desc_doc_url[DESC_URL_SIZE];
|
||||
|
||||
ithread_mutex_init( &TVDevMutex, NULL );
|
||||
|
||||
SampleUtil_Initialize( pfun );
|
||||
|
||||
SampleUtil_Print
|
||||
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
||||
SampleUtil_Print(
|
||||
"Initializing UPnP Sdk with\n"
|
||||
"\tipaddress = %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
|
||||
ret = UpnpInit( ip_address, port );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||
UpnpFinish();
|
||||
return ret;
|
||||
}
|
||||
|
||||
if( ip_address == NULL ) {
|
||||
ip_address = UpnpGetServerIpAddress();
|
||||
}
|
||||
|
||||
port = UpnpGetServerPort();
|
||||
|
||||
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
||||
SampleUtil_Print(
|
||||
"UPnP Initialized\n"
|
||||
"\tipaddress= %s port = %u\n",
|
||||
ip_address, port );
|
||||
|
||||
if( desc_doc_name == NULL )
|
||||
if( desc_doc_name == NULL ) {
|
||||
desc_doc_name = "tvdevicedesc.xml";
|
||||
}
|
||||
|
||||
if( web_dir_path == NULL )
|
||||
if( web_dir_path == NULL ) {
|
||||
web_dir_path = DEFAULT_WEB_DIR;
|
||||
}
|
||||
|
||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||
port, desc_doc_name );
|
||||
|
||||
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
||||
web_dir_path );
|
||||
if( ( ret =
|
||||
UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print
|
||||
( "Error specifying webserver root directory -- %s: %d\n",
|
||||
ret = UpnpSetWebServerRootDir( web_dir_path );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n",
|
||||
web_dir_path, ret );
|
||||
UpnpFinish();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print
|
||||
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
||||
SampleUtil_Print(
|
||||
"Registering the RootDevice\n"
|
||||
"\t with desc_doc_url: %s\n",
|
||||
desc_doc_url );
|
||||
|
||||
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
||||
TvDeviceCallbackEventHandler,
|
||||
&device_handle, &device_handle ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler,
|
||||
&device_handle, &device_handle );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||
UpnpFinish();
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
SampleUtil_Print( "RootDevice Registered\n" );
|
||||
|
||||
SampleUtil_Print( "Initializing State Table\n" );
|
||||
SampleUtil_Print(
|
||||
"RootDevice Registered\n"
|
||||
"Initializing State Table\n");
|
||||
TvDeviceStateTableInit( desc_doc_url );
|
||||
SampleUtil_Print("State Table Initialized\n");
|
||||
|
||||
if( ( ret =
|
||||
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
||||
!= UPNP_E_SUCCESS ) {
|
||||
ret = UpnpSendAdvertisement( device_handle, default_advr_expire );
|
||||
if( ret != UPNP_E_SUCCESS ) {
|
||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||
UpnpFinish();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SampleUtil_Print("Advertisements Sent\n");
|
||||
}
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**************************************************************************
|
||||
*
|
||||
* 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"
|
||||
|
||||
|
||||
#include "ithread.h"
|
||||
#include "upnp.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
/* Do not #include <unistd.h> */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
//Color constants
|
||||
#define MAX_COLOR 10
|
||||
#define MIN_COLOR 1
|
||||
@@ -146,8 +161,7 @@ extern char *TvServiceType[];
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,
|
||||
char **errorString);
|
||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out, char **errorString);
|
||||
|
||||
/* Structure for storing Tv Service
|
||||
identifiers and state table */
|
||||
@@ -225,7 +239,7 @@ int TvDeviceStateTableInit(char*);
|
||||
* sr_event -- The subscription request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *);
|
||||
int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceHandleGetVarRequest
|
||||
@@ -239,7 +253,7 @@ int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *);
|
||||
* cgv_event -- The control get variable request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *);
|
||||
int TvDeviceHandleGetVarRequest(UpnpStateVarRequest *);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceHandleActionRequest
|
||||
@@ -253,7 +267,7 @@ int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *);
|
||||
* ca_event -- The control action request event structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceHandleActionRequest(struct Upnp_Action_Request *);
|
||||
int TvDeviceHandleActionRequest(UpnpActionRequest *);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceCallbackEventHandler
|
||||
@@ -311,8 +325,7 @@ int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*);
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDevicePowerOff
|
||||
@@ -327,8 +340,7 @@ int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceSetChannel
|
||||
@@ -345,8 +357,7 @@ int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseChannel
|
||||
@@ -361,8 +372,7 @@ int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseChannel
|
||||
*
|
||||
@@ -376,8 +386,7 @@ int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
/******************************************************************************
|
||||
* TvDeviceSetVolume
|
||||
*
|
||||
@@ -393,8 +402,7 @@ int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseVolume
|
||||
@@ -409,8 +417,7 @@ int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* 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);
|
||||
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@@ -426,8 +433,7 @@ int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
|
||||
//Picture Service Actions
|
||||
@@ -447,8 +453,7 @@ int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@@ -463,8 +468,7 @@ int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* 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);
|
||||
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseColor
|
||||
@@ -478,8 +482,7 @@ int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
* 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);
|
||||
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceSetTint
|
||||
@@ -496,8 +499,7 @@ int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseTint
|
||||
@@ -512,8 +514,7 @@ int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseTint
|
||||
@@ -528,8 +529,7 @@ int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/*****************************************************************************
|
||||
* TvDeviceSetContrast
|
||||
@@ -546,8 +546,7 @@ int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
****************************************************************************/
|
||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseContrast
|
||||
@@ -563,8 +562,7 @@ int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseContrast
|
||||
*
|
||||
@@ -578,8 +576,7 @@ int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceSetBrightness
|
||||
@@ -593,8 +590,7 @@ int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* brightness -- The brightness value to change to.
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceIncreaseBrightness
|
||||
@@ -609,8 +605,7 @@ int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||
|
||||
/******************************************************************************
|
||||
* TvDeviceDecreaseBrightness
|
||||
@@ -624,12 +619,11 @@ int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
* char **errorString - errorString (in case action was unsuccessful)
|
||||
*
|
||||
*****************************************************************************/
|
||||
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
||||
OUT char **errorString);
|
||||
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();
|
||||
int TvDeviceStop(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
157
upnp/src/api/ActionComplete.c
Normal file
157
upnp/src/api/ActionComplete.c
Normal file
@@ -0,0 +1,157 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionComplete object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "ActionComplete.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for strlen(), strdup() */
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Internal implementation of the UpnpActionComplete object.
|
||||
*/
|
||||
struct SUpnpActionComplete
|
||||
{
|
||||
/*! The result of the operation */
|
||||
int m_errCode;
|
||||
/*! The control URL for service. */
|
||||
UpnpString *m_ctrlUrl;
|
||||
/*! The DOM document describing the action. */
|
||||
IXML_Document *m_actionRequest;
|
||||
/*! The DOM document describing the result of the action */
|
||||
IXML_Document *m_actionResult;
|
||||
};
|
||||
|
||||
|
||||
UpnpActionComplete *UpnpActionComplete_new()
|
||||
{
|
||||
struct SUpnpActionComplete *p = calloc(1, sizeof (struct SUpnpActionComplete));
|
||||
|
||||
#if 0
|
||||
p->m_errCode = 0;
|
||||
#endif
|
||||
p->m_ctrlUrl = UpnpString_new();
|
||||
#if 0
|
||||
p->m_actionRequest = NULL;
|
||||
p->m_actionResult = NULL;
|
||||
#endif
|
||||
|
||||
return (UpnpActionComplete *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_delete(UpnpActionComplete *p)
|
||||
{
|
||||
struct SUpnpActionComplete *q = (struct SUpnpActionComplete *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_errCode = 0;
|
||||
|
||||
UpnpString_delete(q->m_ctrlUrl);
|
||||
q->m_ctrlUrl = NULL;
|
||||
|
||||
UpnpActionComplete_set_ActionRequest(p, NULL);
|
||||
|
||||
UpnpActionComplete_set_ActionResult(p, NULL);
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpActionComplete *UpnpActionComplete_dup(const UpnpActionComplete *p)
|
||||
{
|
||||
UpnpActionComplete *q = UpnpActionComplete_new();
|
||||
|
||||
UpnpActionComplete_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_assign(UpnpActionComplete *p, const UpnpActionComplete *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpActionComplete_set_ErrCode(p, UpnpActionComplete_get_ErrCode(q));
|
||||
UpnpActionComplete_set_CtrlUrl(p, UpnpActionComplete_get_CtrlUrl(q));
|
||||
UpnpActionComplete_set_ActionRequest(p, UpnpActionComplete_get_ActionRequest(q));
|
||||
UpnpActionComplete_set_ActionResult(p, UpnpActionComplete_get_ActionResult(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpActionComplete_get_ErrCode(const UpnpActionComplete *p)
|
||||
{
|
||||
return ((struct SUpnpActionComplete *)p)->m_errCode;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_set_ErrCode(UpnpActionComplete *p, int n)
|
||||
{
|
||||
((struct SUpnpActionComplete *)p)->m_errCode = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpActionComplete_get_CtrlUrl(const UpnpActionComplete *p)
|
||||
{
|
||||
return ((struct SUpnpActionComplete *)p)->m_ctrlUrl;
|
||||
}
|
||||
|
||||
const char *UpnpActionComplete_get_CtrlUrl_cstr(const UpnpActionComplete *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpActionComplete_get_CtrlUrl(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_set_CtrlUrl(UpnpActionComplete *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionComplete *)p)->m_ctrlUrl);
|
||||
((struct SUpnpActionComplete *)p)->m_ctrlUrl = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_strcpy_CtrlUrl(UpnpActionComplete *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionComplete *)p)->m_ctrlUrl);
|
||||
((struct SUpnpActionComplete *)p)->m_ctrlUrl = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpActionComplete *)p)->m_ctrlUrl, s);
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpActionComplete_get_ActionRequest(const UpnpActionComplete *p)
|
||||
{
|
||||
return ((struct SUpnpActionComplete *)p)->m_actionRequest;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_set_ActionRequest(UpnpActionComplete *p, IXML_Document *d)
|
||||
{
|
||||
ixmlDocument_free(((struct SUpnpActionComplete *)p)->m_actionRequest);
|
||||
((struct SUpnpActionComplete *)p)->m_actionRequest = d;
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpActionComplete_get_ActionResult(const UpnpActionComplete *p)
|
||||
{
|
||||
return ((struct SUpnpActionComplete *)p)->m_actionResult;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionComplete_set_ActionResult(UpnpActionComplete *p, IXML_Document *d)
|
||||
{
|
||||
ixmlDocument_free(((struct SUpnpActionComplete *)p)->m_actionResult);
|
||||
((struct SUpnpActionComplete *)p)->m_actionResult = d;
|
||||
}
|
||||
|
||||
283
upnp/src/api/ActionRequest.c
Normal file
283
upnp/src/api/ActionRequest.c
Normal file
@@ -0,0 +1,283 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionRequest object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "ActionRequest.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for memset(), strlen(), strdup() */
|
||||
|
||||
|
||||
struct SUpnpActionRequest
|
||||
{
|
||||
int m_errCode;
|
||||
int m_socket;
|
||||
UpnpString *m_errStr;
|
||||
UpnpString *m_actionName;
|
||||
UpnpString *m_devUDN;
|
||||
UpnpString *m_serviceID;
|
||||
IXML_Document *m_actionRequest;
|
||||
IXML_Document *m_actionResult;
|
||||
IXML_Document *m_soapHeader;
|
||||
/* Variables should be declared with struct sockaddr_storage,
|
||||
* but users must only see a struct sockaddr pointer */
|
||||
struct sockaddr_storage m_ctrlPtIPAddr;
|
||||
};
|
||||
|
||||
|
||||
UpnpActionRequest *UpnpActionRequest_new()
|
||||
{
|
||||
struct SUpnpActionRequest *p = calloc(1, sizeof (struct SUpnpActionRequest));
|
||||
|
||||
#if 0
|
||||
p->m_errCode = 0;
|
||||
p->m_socket = 0;
|
||||
#endif
|
||||
p->m_errStr = UpnpString_new();
|
||||
p->m_actionName = UpnpString_new();
|
||||
p->m_devUDN = UpnpString_new();
|
||||
p->m_serviceID = UpnpString_new();
|
||||
#if 0
|
||||
p->m_actionRequest = NULL;
|
||||
p->m_actionResult = NULL;
|
||||
p->m_soapHeader = NULL;
|
||||
memset(&p->m_ctrlPtIPAddr, 0, sizeof (struct sockaddr_storage));
|
||||
#endif
|
||||
return (UpnpActionRequest *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_delete(UpnpActionRequest *p)
|
||||
{
|
||||
struct SUpnpActionRequest *q = (struct SUpnpActionRequest *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_errCode = 0;
|
||||
|
||||
q->m_socket = 0;
|
||||
|
||||
UpnpString_delete(q->m_errStr);
|
||||
q->m_errStr = NULL;
|
||||
|
||||
UpnpString_delete(q->m_actionName);
|
||||
q->m_actionName = NULL;
|
||||
|
||||
UpnpString_delete(q->m_devUDN);
|
||||
q->m_devUDN = NULL;
|
||||
|
||||
UpnpString_delete(q->m_serviceID);
|
||||
q->m_serviceID = NULL;
|
||||
|
||||
UpnpActionRequest_set_ActionRequest(p, NULL);
|
||||
|
||||
UpnpActionRequest_set_ActionResult(p, NULL);
|
||||
|
||||
UpnpActionRequest_set_SoapHeader(p, NULL);
|
||||
|
||||
memset(&q->m_ctrlPtIPAddr, 0, sizeof (struct sockaddr_storage));
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpActionRequest *UpnpActionRequest_dup(const UpnpActionRequest *p)
|
||||
{
|
||||
UpnpActionRequest *q = UpnpActionRequest_new();
|
||||
|
||||
UpnpActionRequest_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_assign(UpnpActionRequest *p, const UpnpActionRequest *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpActionRequest_set_ErrCode(p, UpnpActionRequest_get_ErrCode(q));
|
||||
UpnpActionRequest_set_Socket(p, UpnpActionRequest_get_Socket(q));
|
||||
UpnpActionRequest_set_ErrStr(p, UpnpActionRequest_get_ErrStr(q));
|
||||
UpnpActionRequest_set_ActionName(p, UpnpActionRequest_get_ActionName(q));
|
||||
UpnpActionRequest_set_DevUDN(p, UpnpActionRequest_get_DevUDN(q));
|
||||
UpnpActionRequest_set_ServiceID(p, UpnpActionRequest_get_ServiceID(q));
|
||||
UpnpActionRequest_set_ActionRequest(p, UpnpActionRequest_get_ActionRequest(q));
|
||||
UpnpActionRequest_set_ActionResult(p, UpnpActionRequest_get_ActionResult(q));
|
||||
UpnpActionRequest_set_CtrlPtIPAddr(p, UpnpActionRequest_get_CtrlPtIPAddr(q));
|
||||
UpnpActionRequest_set_SoapHeader(p, UpnpActionRequest_get_SoapHeader(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpActionRequest_get_ErrCode(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_errCode;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_ErrCode(UpnpActionRequest *p, int n)
|
||||
{
|
||||
((struct SUpnpActionRequest *)p)->m_errCode = n;
|
||||
}
|
||||
|
||||
|
||||
int UpnpActionRequest_get_Socket(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_socket;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_Socket(UpnpActionRequest *p, int n)
|
||||
{
|
||||
((struct SUpnpActionRequest *)p)->m_socket = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpActionRequest_get_ErrStr(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_errStr;
|
||||
}
|
||||
|
||||
const char *UpnpActionRequest_get_ErrStr_cstr(const UpnpActionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpActionRequest_get_ErrStr(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_ErrStr(UpnpActionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionRequest *)p)->m_errStr);
|
||||
((struct SUpnpActionRequest *)p)->m_errStr = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_strcpy_ErrStr(UpnpActionRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionRequest *)p)->m_errStr);
|
||||
((struct SUpnpActionRequest *)p)->m_errStr = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpActionRequest *)p)->m_errStr, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpActionRequest_get_ActionName(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_actionName;
|
||||
}
|
||||
|
||||
const char *UpnpActionRequest_get_ActionName_cstr(const UpnpActionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpActionRequest_get_ActionName(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_ActionName(UpnpActionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionRequest *)p)->m_actionName);
|
||||
((struct SUpnpActionRequest *)p)->m_actionName = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_strcpy_ActionName(UpnpActionRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionRequest *)p)->m_actionName);
|
||||
((struct SUpnpActionRequest *)p)->m_actionName = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpActionRequest *)p)->m_actionName, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpActionRequest_get_DevUDN(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_devUDN;
|
||||
}
|
||||
|
||||
const char *UpnpActionRequest_get_DevUDN_cstr(const UpnpActionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpActionRequest_get_DevUDN(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_DevUDN(UpnpActionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionRequest *)p)->m_devUDN);
|
||||
((struct SUpnpActionRequest *)p)->m_devUDN = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpActionRequest_get_ServiceID(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_serviceID;
|
||||
}
|
||||
|
||||
const char *UpnpActionRequest_get_ServiceID_cstr(const UpnpActionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpActionRequest_get_ServiceID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_ServiceID(UpnpActionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpActionRequest *)p)->m_serviceID);
|
||||
((struct SUpnpActionRequest *)p)->m_serviceID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpActionRequest_get_ActionRequest(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_actionRequest;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_ActionRequest(UpnpActionRequest *p, IXML_Document *d)
|
||||
{
|
||||
ixmlDocument_free(((struct SUpnpActionRequest *)p)->m_actionRequest);
|
||||
((struct SUpnpActionRequest *)p)->m_actionRequest = d;
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpActionRequest_get_ActionResult(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_actionResult;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_ActionResult(UpnpActionRequest *p, IXML_Document *d)
|
||||
{
|
||||
ixmlDocument_free(((struct SUpnpActionRequest *)p)->m_actionResult);
|
||||
((struct SUpnpActionRequest *)p)->m_actionResult = d;
|
||||
}
|
||||
|
||||
|
||||
const struct sockaddr *UpnpActionRequest_get_CtrlPtIPAddr(const UpnpActionRequest *p)
|
||||
{
|
||||
return (struct sockaddr *)&((struct SUpnpActionRequest *)p)->m_ctrlPtIPAddr;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_CtrlPtIPAddr(UpnpActionRequest *p, const struct sockaddr *ia)
|
||||
{
|
||||
((struct SUpnpActionRequest *)p)->m_ctrlPtIPAddr = *(struct sockaddr_storage *)ia;
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpActionRequest_get_SoapHeader(const UpnpActionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpActionRequest *)p)->m_soapHeader;
|
||||
}
|
||||
|
||||
|
||||
void UpnpActionRequest_set_SoapHeader(UpnpActionRequest *p, IXML_Document *d)
|
||||
{
|
||||
ixmlDocument_free(((struct SUpnpActionRequest *)p)->m_soapHeader);
|
||||
((struct SUpnpActionRequest *)p)->m_soapHeader = d;
|
||||
}
|
||||
|
||||
396
upnp/src/api/Discovery.c
Normal file
396
upnp/src/api/Discovery.c
Normal file
@@ -0,0 +1,396 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpDiscovery object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "Discovery.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for memset() */
|
||||
|
||||
|
||||
struct SUpnpDiscovery
|
||||
{
|
||||
int m_errCode;
|
||||
int m_expires;
|
||||
UpnpString *m_deviceID;
|
||||
UpnpString *m_deviceType;
|
||||
UpnpString *m_serviceType;
|
||||
UpnpString *m_serviceVer;
|
||||
UpnpString *m_location;
|
||||
UpnpString *m_os;
|
||||
UpnpString *m_date;
|
||||
UpnpString *m_ext;
|
||||
/* Variables should be declared with struct sockaddr_storage,
|
||||
* but users must only see a struct sockaddr pointer */
|
||||
struct sockaddr_storage m_destAddr;
|
||||
};
|
||||
|
||||
|
||||
UpnpDiscovery *UpnpDiscovery_new()
|
||||
{
|
||||
struct SUpnpDiscovery *p = calloc(1, sizeof (struct SUpnpDiscovery));
|
||||
|
||||
#if 0
|
||||
p->errCode = 0;
|
||||
p->m_expires = 0;
|
||||
#endif
|
||||
p->m_deviceID = UpnpString_new();
|
||||
p->m_deviceType = UpnpString_new();
|
||||
p->m_serviceType = UpnpString_new();
|
||||
p->m_serviceVer = UpnpString_new();
|
||||
p->m_location = UpnpString_new();
|
||||
p->m_os = UpnpString_new();
|
||||
p->m_date = UpnpString_new();
|
||||
p->m_ext = UpnpString_new();
|
||||
memset(&p->m_destAddr, 0, sizeof(struct sockaddr_storage));
|
||||
|
||||
return (UpnpDiscovery *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_delete(UpnpDiscovery *p)
|
||||
{
|
||||
struct SUpnpDiscovery *q = (struct SUpnpDiscovery *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_errCode = 0;
|
||||
|
||||
q->m_expires = 0;
|
||||
|
||||
UpnpString_delete(q->m_deviceID);
|
||||
q->m_deviceID = NULL;
|
||||
|
||||
UpnpString_delete(q->m_deviceType);
|
||||
q->m_deviceType = NULL;
|
||||
|
||||
UpnpString_delete(q->m_serviceType);
|
||||
q->m_serviceType = NULL;
|
||||
|
||||
UpnpString_delete(q->m_serviceVer);
|
||||
q->m_serviceVer = NULL;
|
||||
|
||||
UpnpString_delete(q->m_location);
|
||||
q->m_location = NULL;
|
||||
|
||||
UpnpString_delete(q->m_os);
|
||||
q->m_os = NULL;
|
||||
|
||||
UpnpString_delete(q->m_date);
|
||||
q->m_date = NULL;
|
||||
|
||||
UpnpString_delete(q->m_ext);
|
||||
q->m_ext = NULL;
|
||||
|
||||
memset(&q->m_destAddr, 0, sizeof(struct sockaddr_storage));
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpDiscovery *UpnpDiscovery_dup(const UpnpDiscovery *p)
|
||||
{
|
||||
UpnpDiscovery *q = UpnpDiscovery_new();
|
||||
|
||||
UpnpDiscovery_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_assign(UpnpDiscovery *p, const UpnpDiscovery *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpDiscovery_set_ErrCode(p, UpnpDiscovery_get_ErrCode(q));
|
||||
UpnpDiscovery_set_Expires(p, UpnpDiscovery_get_Expires(q));
|
||||
UpnpDiscovery_set_DeviceID(p, UpnpDiscovery_get_DeviceID(q));
|
||||
UpnpDiscovery_set_DeviceType(p, UpnpDiscovery_get_DeviceType(q));
|
||||
UpnpDiscovery_set_ServiceType(p, UpnpDiscovery_get_ServiceType(q));
|
||||
UpnpDiscovery_set_ServiceVer(p, UpnpDiscovery_get_ServiceVer(q));
|
||||
UpnpDiscovery_set_Location(p, UpnpDiscovery_get_Location(q));
|
||||
UpnpDiscovery_set_Os(p, UpnpDiscovery_get_Os(q));
|
||||
UpnpDiscovery_set_Date(p, UpnpDiscovery_get_Date(q));
|
||||
UpnpDiscovery_set_Ext(p, UpnpDiscovery_get_Ext(q));
|
||||
UpnpDiscovery_set_DestAddr(p, UpnpDiscovery_get_DestAddr(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpDiscovery_get_ErrCode(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_errCode;
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_ErrCode(UpnpDiscovery *p, int n)
|
||||
{
|
||||
((struct SUpnpDiscovery *)p)->m_errCode = n;
|
||||
}
|
||||
|
||||
|
||||
int UpnpDiscovery_get_Expires(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_expires;
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_Expires(UpnpDiscovery *p, int n)
|
||||
{
|
||||
((struct SUpnpDiscovery *)p)->m_expires = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_DeviceID(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_deviceID;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_DeviceID_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_DeviceID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_DeviceID(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_deviceID);
|
||||
((struct SUpnpDiscovery *)p)->m_deviceID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_DeviceID(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_deviceID);
|
||||
((struct SUpnpDiscovery *)p)->m_deviceID = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_deviceID, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_DeviceType(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_deviceType;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_DeviceType_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_DeviceType(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_DeviceType(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_deviceType);
|
||||
((struct SUpnpDiscovery *)p)->m_deviceType = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_DeviceType(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_deviceType);
|
||||
((struct SUpnpDiscovery *)p)->m_deviceType = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_deviceType, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_ServiceType(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_serviceType;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_ServiceType_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_ServiceType(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_ServiceType(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_serviceType);
|
||||
((struct SUpnpDiscovery *)p)->m_serviceType = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_ServiceType(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_serviceType);
|
||||
((struct SUpnpDiscovery *)p)->m_serviceType = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_serviceType, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_ServiceVer(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_serviceVer;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_ServiceVer_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_ServiceVer(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_ServiceVer(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_serviceVer);
|
||||
((struct SUpnpDiscovery *)p)->m_serviceVer = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_ServiceVer(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_serviceVer);
|
||||
((struct SUpnpDiscovery *)p)->m_serviceVer = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_serviceVer, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_Location(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_location;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_Location_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_Location(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_Location(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_location);
|
||||
((struct SUpnpDiscovery *)p)->m_location = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_Location(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_location);
|
||||
((struct SUpnpDiscovery *)p)->m_location = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_location, s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strncpy_Location(UpnpDiscovery *p, const char *s, int n)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_location);
|
||||
((struct SUpnpDiscovery *)p)->m_location = UpnpString_new();
|
||||
UpnpString_set_StringN(((struct SUpnpDiscovery *)p)->m_location, s, n);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_Os(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_os;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_Os_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_Os(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_Os(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_os);
|
||||
((struct SUpnpDiscovery *)p)->m_os = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_Os(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_os);
|
||||
((struct SUpnpDiscovery *)p)->m_os = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_os, s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strncpy_Os(UpnpDiscovery *p, const char *s, int n)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_os);
|
||||
((struct SUpnpDiscovery *)p)->m_os = UpnpString_new();
|
||||
UpnpString_set_StringN(((struct SUpnpDiscovery *)p)->m_os, s, n);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_Date(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_date;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_Date_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_Date(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_Date(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_date);
|
||||
((struct SUpnpDiscovery *)p)->m_date = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_Date(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_date);
|
||||
((struct SUpnpDiscovery *)p)->m_date = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_date, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpDiscovery_get_Ext(const UpnpDiscovery *p)
|
||||
{
|
||||
return ((struct SUpnpDiscovery *)p)->m_ext;
|
||||
}
|
||||
|
||||
const char *UpnpDiscovery_get_Ext_cstr(const UpnpDiscovery *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpDiscovery_get_Ext(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_Ext(UpnpDiscovery *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_ext);
|
||||
((struct SUpnpDiscovery *)p)->m_ext = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strcpy_Ext(UpnpDiscovery *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_ext);
|
||||
((struct SUpnpDiscovery *)p)->m_ext = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpDiscovery *)p)->m_ext, s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_strncpy_Ext(UpnpDiscovery *p, const char *s, int n)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpDiscovery *)p)->m_ext);
|
||||
((struct SUpnpDiscovery *)p)->m_ext = UpnpString_new();
|
||||
UpnpString_set_StringN(((struct SUpnpDiscovery *)p)->m_ext, s, n);
|
||||
}
|
||||
|
||||
|
||||
const struct sockaddr *UpnpDiscovery_get_DestAddr(const UpnpDiscovery *p)
|
||||
{
|
||||
return (struct sockaddr *)&((struct SUpnpDiscovery *)p)->m_destAddr;
|
||||
}
|
||||
|
||||
|
||||
void UpnpDiscovery_set_DestAddr(UpnpDiscovery *p, const struct sockaddr *sa)
|
||||
{
|
||||
((struct SUpnpDiscovery *)p)->m_destAddr = *(struct sockaddr_storage *)sa;
|
||||
}
|
||||
|
||||
121
upnp/src/api/Event.c
Normal file
121
upnp/src/api/Event.c
Normal file
@@ -0,0 +1,121 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEvent object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "Event.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
|
||||
|
||||
struct SUpnpEvent
|
||||
{
|
||||
int m_eventKey;
|
||||
IXML_Document *m_changedVariables;
|
||||
UpnpString *m_SID;
|
||||
};
|
||||
|
||||
|
||||
UpnpEvent *UpnpEvent_new()
|
||||
{
|
||||
struct SUpnpEvent *p = calloc(1, sizeof (struct SUpnpEvent));
|
||||
|
||||
#if 0
|
||||
p->m_eventKey = 0;
|
||||
p->m_changedVariables = NULL;
|
||||
#endif
|
||||
p->m_SID = UpnpString_new();
|
||||
|
||||
return (UpnpEvent *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEvent_delete(UpnpEvent *p)
|
||||
{
|
||||
struct SUpnpEvent *q = (struct SUpnpEvent *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_eventKey = 0;
|
||||
|
||||
q->m_changedVariables = NULL;
|
||||
|
||||
UpnpString_delete(q->m_SID);
|
||||
q->m_SID = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpEvent *UpnpEvent_dup(const UpnpEvent *p)
|
||||
{
|
||||
UpnpEvent *q = UpnpEvent_new();
|
||||
|
||||
UpnpEvent_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEvent_assign(UpnpEvent *p, const UpnpEvent *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpEvent_set_EventKey(p, UpnpEvent_get_EventKey(q));
|
||||
UpnpEvent_set_ChangedVariables(p, UpnpEvent_get_ChangedVariables(q));
|
||||
UpnpEvent_set_SID(p, UpnpEvent_get_SID(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpEvent_get_EventKey(const UpnpEvent *p)
|
||||
{
|
||||
return ((struct SUpnpEvent *)p)->m_eventKey;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEvent_set_EventKey(UpnpEvent *p, int n)
|
||||
{
|
||||
((struct SUpnpEvent *)p)->m_eventKey = n;
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpEvent_get_ChangedVariables(const UpnpEvent *p)
|
||||
{
|
||||
return ((struct SUpnpEvent *)p)->m_changedVariables;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEvent_set_ChangedVariables(UpnpEvent *p, IXML_Document *d)
|
||||
{
|
||||
ixmlDocument_free(((struct SUpnpEvent *)p)->m_changedVariables);
|
||||
((struct SUpnpEvent *)p)->m_changedVariables = d;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpEvent_get_SID(const UpnpEvent *p)
|
||||
{
|
||||
return ((struct SUpnpEvent *)p)->m_SID;
|
||||
}
|
||||
|
||||
const char *UpnpEvent_get_SID_cstr(const UpnpEvent *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpEvent_get_SID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpEvent_set_SID(UpnpEvent *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpEvent *)p)->m_SID);
|
||||
((struct SUpnpEvent *)p)->m_SID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
159
upnp/src/api/EventSubscribe.c
Normal file
159
upnp/src/api/EventSubscribe.c
Normal file
@@ -0,0 +1,159 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEventSubscribe object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "EventSubscribe.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
|
||||
|
||||
struct SEventSubscribe
|
||||
{
|
||||
int m_errCode;
|
||||
int m_timeOut;
|
||||
UpnpString *m_SID;
|
||||
UpnpString *m_publisherUrl;
|
||||
};
|
||||
|
||||
|
||||
UpnpEventSubscribe *UpnpEventSubscribe_new()
|
||||
{
|
||||
struct SEventSubscribe *p = calloc(1, sizeof (struct SEventSubscribe));
|
||||
#if 0
|
||||
p->errCode = 0;
|
||||
p->timeOut = 0;
|
||||
#endif
|
||||
p->m_SID = UpnpString_new();
|
||||
p->m_publisherUrl = UpnpString_new();
|
||||
|
||||
return (UpnpEventSubscribe *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_delete(UpnpEventSubscribe *p)
|
||||
{
|
||||
struct SEventSubscribe *q = (struct SEventSubscribe *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_errCode = 0;
|
||||
|
||||
q->m_timeOut = 0;
|
||||
|
||||
UpnpString_delete(q->m_publisherUrl);
|
||||
q->m_publisherUrl = NULL;
|
||||
|
||||
UpnpString_delete(q->m_SID);
|
||||
q->m_SID = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpEventSubscribe *UpnpEventSubscribe_dup(const UpnpEventSubscribe *p)
|
||||
{
|
||||
UpnpEventSubscribe *q = UpnpEventSubscribe_new();
|
||||
|
||||
UpnpEventSubscribe_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_assign(UpnpEventSubscribe *p, const UpnpEventSubscribe *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpEventSubscribe_set_ErrCode(p, UpnpEventSubscribe_get_ErrCode(q));
|
||||
UpnpEventSubscribe_set_TimeOut(p, UpnpEventSubscribe_get_TimeOut(q));
|
||||
UpnpEventSubscribe_set_SID(p, UpnpEventSubscribe_get_SID(q));
|
||||
UpnpEventSubscribe_set_PublisherUrl(p, UpnpEventSubscribe_get_PublisherUrl(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpEventSubscribe_get_ErrCode(const UpnpEventSubscribe *p)
|
||||
{
|
||||
return ((struct SEventSubscribe *)p)->m_errCode;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_set_ErrCode(UpnpEventSubscribe *p, int n)
|
||||
{
|
||||
((struct SEventSubscribe *)p)->m_errCode = n;
|
||||
}
|
||||
|
||||
|
||||
int UpnpEventSubscribe_get_TimeOut(const UpnpEventSubscribe *p)
|
||||
{
|
||||
return ((struct SEventSubscribe *)p)->m_timeOut;
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_set_TimeOut(UpnpEventSubscribe *p, int n)
|
||||
{
|
||||
((struct SEventSubscribe *)p)->m_timeOut = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpEventSubscribe_get_SID(const UpnpEventSubscribe *p)
|
||||
{
|
||||
return ((struct SEventSubscribe *)p)->m_SID;
|
||||
}
|
||||
|
||||
const char *UpnpEventSubscribe_get_SID_cstr(const UpnpEventSubscribe *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpEventSubscribe_get_SID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_set_SID(UpnpEventSubscribe *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SEventSubscribe *)p)->m_SID);
|
||||
((struct SEventSubscribe *)p)->m_SID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_strcpy_SID(UpnpEventSubscribe *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SEventSubscribe *)p)->m_SID);
|
||||
((struct SEventSubscribe *)p)->m_SID = UpnpString_new();
|
||||
UpnpString_set_String(((struct SEventSubscribe *)p)->m_SID, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpEventSubscribe_get_PublisherUrl(const UpnpEventSubscribe *p)
|
||||
{
|
||||
return ((struct SEventSubscribe *)p)->m_publisherUrl;
|
||||
}
|
||||
|
||||
const char *UpnpEventSubscribe_get_PublisherUrl_cstr(const UpnpEventSubscribe *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_set_PublisherUrl(UpnpEventSubscribe *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SEventSubscribe *)p)->m_publisherUrl);
|
||||
((struct SEventSubscribe *)p)->m_publisherUrl = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpEventSubscribe_strcpy_PublisherUrl(UpnpEventSubscribe *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SEventSubscribe *)p)->m_publisherUrl);
|
||||
((struct SEventSubscribe *)p)->m_publisherUrl = UpnpString_new();
|
||||
UpnpString_set_String(((struct SEventSubscribe *)p)->m_publisherUrl, s);
|
||||
}
|
||||
|
||||
179
upnp/src/api/FileInfo.c
Normal file
179
upnp/src/api/FileInfo.c
Normal file
@@ -0,0 +1,179 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpFileInfo object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "FileInfo.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for strlen(), strdup() */
|
||||
|
||||
|
||||
struct SUpnpFileInfo
|
||||
{
|
||||
off_t m_fileLength;
|
||||
time_t m_lastModified;
|
||||
int m_isDirectory;
|
||||
int m_isReadable;
|
||||
DOMString m_contentType;
|
||||
DOMString m_extraHeaders;
|
||||
};
|
||||
|
||||
|
||||
UpnpFileInfo *UpnpFileInfo_new()
|
||||
{
|
||||
struct SUpnpFileInfo *p = calloc(1, sizeof (struct SUpnpFileInfo));
|
||||
|
||||
#if 0
|
||||
p->m_fileLength = 0;
|
||||
p->m_lastModified = 0;
|
||||
p->m_isDirectory = 0;
|
||||
p->m_isReadable = 0;
|
||||
p->m_contentType = NULL;
|
||||
p->m_extraHeaders = NULL;
|
||||
#endif
|
||||
|
||||
return (UpnpFileInfo *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_delete(UpnpFileInfo *p)
|
||||
{
|
||||
struct SUpnpFileInfo *q = (struct SUpnpFileInfo *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_fileLength = 0;
|
||||
|
||||
q->m_lastModified = 0;
|
||||
|
||||
q->m_isDirectory = 0;
|
||||
|
||||
q->m_isReadable = 0;
|
||||
|
||||
ixmlFreeDOMString(q->m_contentType);
|
||||
q->m_contentType = NULL;
|
||||
|
||||
ixmlFreeDOMString(q->m_extraHeaders);
|
||||
q->m_extraHeaders = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpFileInfo *UpnpFileInfo_dup(const UpnpFileInfo *p)
|
||||
{
|
||||
UpnpFileInfo *q = UpnpFileInfo_new();
|
||||
|
||||
UpnpFileInfo_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_assign(UpnpFileInfo *p, const UpnpFileInfo *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpFileInfo_set_FileLength(p, UpnpFileInfo_get_FileLength(q));
|
||||
UpnpFileInfo_set_LastModified(p, UpnpFileInfo_get_LastModified(q));
|
||||
UpnpFileInfo_set_IsDirectory(p, UpnpFileInfo_get_IsDirectory(q));
|
||||
UpnpFileInfo_set_IsReadable(p, UpnpFileInfo_get_IsReadable(q));
|
||||
UpnpFileInfo_set_ContentType(p, UpnpFileInfo_get_ContentType(q));
|
||||
UpnpFileInfo_set_ExtraHeaders(p, UpnpFileInfo_get_ExtraHeaders(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
off_t UpnpFileInfo_get_FileLength(const UpnpFileInfo *p)
|
||||
{
|
||||
return ((struct SUpnpFileInfo *)p)->m_fileLength;
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_set_FileLength(UpnpFileInfo *p, off_t l)
|
||||
{
|
||||
((struct SUpnpFileInfo *)p)->m_fileLength = l;
|
||||
}
|
||||
|
||||
|
||||
const time_t *UpnpFileInfo_get_LastModified(const UpnpFileInfo *p)
|
||||
{
|
||||
return &((struct SUpnpFileInfo *)p)->m_lastModified;
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_set_LastModified(UpnpFileInfo *p, const time_t *t)
|
||||
{
|
||||
((struct SUpnpFileInfo *)p)->m_lastModified = *t;
|
||||
}
|
||||
|
||||
|
||||
int UpnpFileInfo_get_IsDirectory(const UpnpFileInfo *p)
|
||||
{
|
||||
return ((struct SUpnpFileInfo *)p)->m_isDirectory;
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_set_IsDirectory(UpnpFileInfo *p, int b)
|
||||
{
|
||||
((struct SUpnpFileInfo *)p)->m_isDirectory = b;
|
||||
}
|
||||
|
||||
|
||||
int UpnpFileInfo_get_IsReadable(const UpnpFileInfo *p)
|
||||
{
|
||||
return ((struct SUpnpFileInfo *)p)->m_isReadable;
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_set_IsReadable(UpnpFileInfo *p, int b)
|
||||
{
|
||||
((struct SUpnpFileInfo *)p)->m_isReadable = b;
|
||||
}
|
||||
|
||||
|
||||
const DOMString UpnpFileInfo_get_ContentType(const UpnpFileInfo *p)
|
||||
{
|
||||
return ((struct SUpnpFileInfo *)p)->m_contentType;
|
||||
}
|
||||
|
||||
const char *UpnpFileInfo_get_ContentType_cstr(const UpnpFileInfo *p)
|
||||
{
|
||||
return (const char *)UpnpFileInfo_get_ContentType(p);
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_set_ContentType(UpnpFileInfo *p, const DOMString s)
|
||||
{
|
||||
ixmlFreeDOMString(((struct SUpnpFileInfo *)p)->m_contentType);
|
||||
((struct SUpnpFileInfo *)p)->m_contentType = ixmlCloneDOMString(s);
|
||||
}
|
||||
|
||||
|
||||
const DOMString UpnpFileInfo_get_ExtraHeaders(const UpnpFileInfo *p)
|
||||
{
|
||||
return ((struct SUpnpFileInfo *)p)->m_extraHeaders;
|
||||
}
|
||||
|
||||
const char *UpnpFileInfo_get_ExtraHeaders_cstr(const UpnpFileInfo *p)
|
||||
{
|
||||
return (const char *)UpnpFileInfo_get_ExtraHeaders(p);
|
||||
}
|
||||
|
||||
|
||||
void UpnpFileInfo_set_ExtraHeaders(UpnpFileInfo *p, const DOMString s)
|
||||
{
|
||||
ixmlFreeDOMString(((struct SUpnpFileInfo *)p)->m_extraHeaders);
|
||||
((struct SUpnpFileInfo *)p)->m_extraHeaders = ixmlCloneDOMString(s);
|
||||
}
|
||||
|
||||
170
upnp/src/api/StateVarComplete.c
Normal file
170
upnp/src/api/StateVarComplete.c
Normal file
@@ -0,0 +1,170 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarComplete object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "StateVarComplete.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for strlen(), strdup() */
|
||||
|
||||
|
||||
struct SUpnpStateVarComplete
|
||||
{
|
||||
int m_errCode;
|
||||
UpnpString *m_ctrlUrl;
|
||||
UpnpString *m_stateVarName;
|
||||
DOMString m_currentVal;
|
||||
};
|
||||
|
||||
|
||||
UpnpStateVarComplete *UpnpStateVarComplete_new()
|
||||
{
|
||||
struct SUpnpStateVarComplete *p = calloc(1, sizeof (struct SUpnpStateVarComplete));
|
||||
|
||||
#if 0
|
||||
p->m_errCode = 0;
|
||||
#endif
|
||||
p->m_ctrlUrl = UpnpString_new();
|
||||
p->m_stateVarName = UpnpString_new();
|
||||
#if 0
|
||||
p->m_currentVal = NULL;
|
||||
#endif
|
||||
|
||||
return (UpnpStateVarComplete *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_delete(UpnpStateVarComplete *p)
|
||||
{
|
||||
struct SUpnpStateVarComplete *q = (struct SUpnpStateVarComplete *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_errCode = 0;
|
||||
|
||||
UpnpString_delete(q->m_ctrlUrl);
|
||||
q->m_ctrlUrl = NULL;
|
||||
|
||||
UpnpString_delete(q->m_stateVarName);
|
||||
q->m_stateVarName = NULL;
|
||||
|
||||
ixmlFreeDOMString(q->m_currentVal);
|
||||
q->m_currentVal = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpStateVarComplete *UpnpStateVarComplete_dup(const UpnpStateVarComplete *p)
|
||||
{
|
||||
UpnpStateVarComplete *q = UpnpStateVarComplete_new();
|
||||
|
||||
UpnpStateVarComplete_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_assign(UpnpStateVarComplete *p, const UpnpStateVarComplete *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpStateVarComplete_set_ErrCode(p, UpnpStateVarComplete_get_ErrCode(q));
|
||||
UpnpStateVarComplete_set_CtrlUrl(p, UpnpStateVarComplete_get_CtrlUrl(q));
|
||||
UpnpStateVarComplete_set_StateVarName(p, UpnpStateVarComplete_get_StateVarName(q));
|
||||
UpnpStateVarComplete_set_CurrentVal(p, UpnpStateVarComplete_get_CurrentVal(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpStateVarComplete_get_ErrCode(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarComplete *)p)->m_errCode;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_set_ErrCode(UpnpStateVarComplete *p, int n)
|
||||
{
|
||||
((struct SUpnpStateVarComplete *)p)->m_errCode = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpStateVarComplete_get_CtrlUrl(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarComplete *)p)->m_ctrlUrl;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarComplete_get_CtrlUrl_cstr(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_set_CtrlUrl(UpnpStateVarComplete *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarComplete *)p)->m_ctrlUrl);
|
||||
((struct SUpnpStateVarComplete *)p)->m_ctrlUrl = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_strcpy_CtrlUrl(UpnpStateVarComplete *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarComplete *)p)->m_ctrlUrl);
|
||||
((struct SUpnpStateVarComplete *)p)->m_ctrlUrl = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpStateVarComplete *)p)->m_ctrlUrl, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpStateVarComplete_get_StateVarName(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarComplete *)p)->m_stateVarName;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarComplete_get_StateVarName_cstr(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_set_StateVarName(UpnpStateVarComplete *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarComplete *)p)->m_stateVarName);
|
||||
((struct SUpnpStateVarComplete *)p)->m_stateVarName = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_strcpy_StateVarName(UpnpStateVarComplete *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarComplete *)p)->m_ctrlUrl);
|
||||
((struct SUpnpStateVarComplete *)p)->m_ctrlUrl = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpStateVarComplete *)p)->m_ctrlUrl, s);
|
||||
}
|
||||
|
||||
|
||||
const DOMString UpnpStateVarComplete_get_CurrentVal(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarComplete *)p)->m_currentVal;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarComplete_get_CurrentVal_cstr(const UpnpStateVarComplete *p)
|
||||
{
|
||||
return (const char *)UpnpStateVarComplete_get_CurrentVal(p);
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarComplete_set_CurrentVal(UpnpStateVarComplete *p, const DOMString s)
|
||||
{
|
||||
ixmlFreeDOMString(((struct SUpnpStateVarComplete *)p)->m_currentVal);
|
||||
((struct SUpnpStateVarComplete *)p)->m_currentVal = ixmlCloneDOMString(s);
|
||||
}
|
||||
|
||||
254
upnp/src/api/StateVarRequest.c
Normal file
254
upnp/src/api/StateVarRequest.c
Normal file
@@ -0,0 +1,254 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarRequest object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "StateVarRequest.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for memset(), strlen(), strdup() */
|
||||
|
||||
|
||||
struct SUpnpStateVarRequest
|
||||
{
|
||||
int m_errCode;
|
||||
int m_socket;
|
||||
UpnpString *m_errStr;
|
||||
UpnpString *m_devUDN;
|
||||
UpnpString *m_serviceID;
|
||||
UpnpString *m_stateVarName;
|
||||
/* Variables should be declared with struct sockaddr_storage,
|
||||
* but users must only see a struct sockaddr pointer */
|
||||
struct sockaddr_storage m_ctrlPtIPAddr;
|
||||
DOMString m_currentVal;
|
||||
};
|
||||
|
||||
|
||||
UpnpStateVarRequest *UpnpStateVarRequest_new()
|
||||
{
|
||||
struct SUpnpStateVarRequest *p = calloc(1, sizeof (struct SUpnpStateVarRequest));
|
||||
|
||||
#if 0
|
||||
p->m_errCode = 0;
|
||||
p->m_socket = 0;
|
||||
#endif
|
||||
p->m_errStr = UpnpString_new();
|
||||
p->m_devUDN = UpnpString_new();
|
||||
p->m_serviceID = UpnpString_new();
|
||||
p->m_stateVarName = UpnpString_new();
|
||||
#if 0
|
||||
memset(&q->m_ctrlPtIPAddr, 0, sizeof (struct sockaddr_storage));
|
||||
p->m_currentVal = NULL;
|
||||
#endif
|
||||
|
||||
return (UpnpStateVarRequest *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_delete(UpnpStateVarRequest *p)
|
||||
{
|
||||
struct SUpnpStateVarRequest *q = (struct SUpnpStateVarRequest *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_errCode = 0;
|
||||
|
||||
q->m_socket = 0;
|
||||
|
||||
UpnpString_delete(q->m_errStr);
|
||||
q->m_errStr = NULL;
|
||||
|
||||
UpnpString_delete(q->m_devUDN);
|
||||
q->m_devUDN = NULL;
|
||||
|
||||
UpnpString_delete(q->m_serviceID);
|
||||
q->m_serviceID = NULL;
|
||||
|
||||
UpnpString_delete(q->m_stateVarName);
|
||||
q->m_stateVarName = NULL;
|
||||
|
||||
memset(&q->m_ctrlPtIPAddr, 0, sizeof (struct sockaddr_storage));
|
||||
|
||||
ixmlFreeDOMString(q->m_currentVal);
|
||||
q->m_currentVal = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpStateVarRequest *UpnpStateVarRequest_dup(const UpnpStateVarRequest *p)
|
||||
{
|
||||
UpnpStateVarRequest *q = UpnpStateVarRequest_new();
|
||||
|
||||
UpnpStateVarRequest_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_assign(UpnpStateVarRequest *p, const UpnpStateVarRequest *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpStateVarRequest_set_ErrCode(p, UpnpStateVarRequest_get_ErrCode(q));
|
||||
UpnpStateVarRequest_set_Socket(p, UpnpStateVarRequest_get_Socket(q));
|
||||
UpnpStateVarRequest_set_ErrStr(p, UpnpStateVarRequest_get_ErrStr(q));
|
||||
UpnpStateVarRequest_set_StateVarName(p, UpnpStateVarRequest_get_StateVarName(q));
|
||||
UpnpStateVarRequest_set_DevUDN(p, UpnpStateVarRequest_get_DevUDN(q));
|
||||
UpnpStateVarRequest_set_ServiceID(p, UpnpStateVarRequest_get_ServiceID(q));
|
||||
UpnpStateVarRequest_set_CtrlPtIPAddr(p, UpnpStateVarRequest_get_CtrlPtIPAddr(q));
|
||||
UpnpStateVarRequest_set_CurrentVal(p, UpnpStateVarRequest_get_CurrentVal(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpStateVarRequest_get_ErrCode(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_errCode;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_ErrCode(UpnpStateVarRequest *p, int n)
|
||||
{
|
||||
((struct SUpnpStateVarRequest *)p)->m_errCode = n;
|
||||
}
|
||||
|
||||
|
||||
int UpnpStateVarRequest_get_Socket(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_socket;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_Socket(UpnpStateVarRequest *p, int n)
|
||||
{
|
||||
((struct SUpnpStateVarRequest *)p)->m_socket = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpStateVarRequest_get_ErrStr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_errStr;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarRequest_get_ErrStr_cstr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpStateVarRequest_get_ErrStr(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_ErrStr(UpnpStateVarRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_errStr);
|
||||
((struct SUpnpStateVarRequest *)p)->m_errStr = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_strcpy_ErrStr(UpnpStateVarRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_errStr);
|
||||
((struct SUpnpStateVarRequest *)p)->m_errStr = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpStateVarRequest *)p)->m_errStr, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpStateVarRequest_get_DevUDN(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_devUDN;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarRequest_get_DevUDN_cstr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_DevUDN(UpnpStateVarRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_devUDN);
|
||||
((struct SUpnpStateVarRequest *)p)->m_devUDN = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpStateVarRequest_get_ServiceID(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_serviceID;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarRequest_get_ServiceID_cstr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_ServiceID(UpnpStateVarRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_serviceID);
|
||||
((struct SUpnpStateVarRequest *)p)->m_serviceID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpStateVarRequest_get_StateVarName(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_stateVarName;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarRequest_get_StateVarName_cstr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_StateVarName(UpnpStateVarRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_stateVarName);
|
||||
((struct SUpnpStateVarRequest *)p)->m_stateVarName = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_strcpy_StateVarName(UpnpStateVarRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpStateVarRequest *)p)->m_errStr);
|
||||
((struct SUpnpStateVarRequest *)p)->m_errStr = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpStateVarRequest *)p)->m_errStr, s);
|
||||
}
|
||||
|
||||
|
||||
const struct sockaddr *UpnpStateVarRequest_get_CtrlPtIPAddr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return (struct sockaddr *)&((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr;
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_CtrlPtIPAddr(UpnpStateVarRequest *p, const struct sockaddr *sa)
|
||||
{
|
||||
((struct SUpnpStateVarRequest *)p)->m_ctrlPtIPAddr = *(struct sockaddr_storage *)sa;
|
||||
}
|
||||
|
||||
|
||||
const DOMString UpnpStateVarRequest_get_CurrentVal(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return ((struct SUpnpStateVarRequest *)p)->m_currentVal;
|
||||
}
|
||||
|
||||
const char *UpnpStateVarRequest_get_CurrentVal_cstr(const UpnpStateVarRequest *p)
|
||||
{
|
||||
return (const char *)UpnpStateVarRequest_get_CurrentVal(p);
|
||||
}
|
||||
|
||||
|
||||
void UpnpStateVarRequest_set_CurrentVal(UpnpStateVarRequest *p, const DOMString s)
|
||||
{
|
||||
ixmlFreeDOMString(((struct SUpnpStateVarRequest *)p)->m_currentVal);
|
||||
((struct SUpnpStateVarRequest *)p)->m_currentVal = ixmlCloneDOMString(s);
|
||||
}
|
||||
|
||||
157
upnp/src/api/SubscriptionRequest.c
Normal file
157
upnp/src/api/SubscriptionRequest.c
Normal file
@@ -0,0 +1,157 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpSubscriptionRequest object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "SubscriptionRequest.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for memset(), strlen(), strdup() */
|
||||
|
||||
|
||||
struct SUpnpSubscriptionRequest
|
||||
{
|
||||
UpnpString *m_serviceId;
|
||||
UpnpString *m_UDN;
|
||||
UpnpString *m_SID;
|
||||
};
|
||||
|
||||
|
||||
UpnpSubscriptionRequest *UpnpSubscriptionRequest_new()
|
||||
{
|
||||
struct SUpnpSubscriptionRequest *p = calloc(1, sizeof (struct SUpnpSubscriptionRequest));
|
||||
|
||||
p->m_serviceId = UpnpString_new();
|
||||
p->m_UDN = UpnpString_new();
|
||||
p->m_SID = UpnpString_new();
|
||||
|
||||
return (UpnpSubscriptionRequest *)p;
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_delete(UpnpSubscriptionRequest *p)
|
||||
{
|
||||
struct SUpnpSubscriptionRequest *q = (struct SUpnpSubscriptionRequest *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
UpnpString_delete(q->m_serviceId);
|
||||
q->m_serviceId = NULL;
|
||||
|
||||
UpnpString_delete(q->m_UDN);
|
||||
q->m_UDN = NULL;
|
||||
|
||||
UpnpString_delete(q->m_SID);
|
||||
q->m_SID = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpSubscriptionRequest *UpnpSubscriptionRequest_dup(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
UpnpSubscriptionRequest *q = UpnpSubscriptionRequest_new();
|
||||
|
||||
UpnpSubscriptionRequest_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_assign(UpnpSubscriptionRequest *p, const UpnpSubscriptionRequest *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpSubscriptionRequest_set_ServiceId(p, UpnpSubscriptionRequest_get_ServiceId(q));
|
||||
UpnpSubscriptionRequest_set_UDN(p, UpnpSubscriptionRequest_get_UDN(q));
|
||||
UpnpSubscriptionRequest_set_SID(p, UpnpSubscriptionRequest_get_SID(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpSubscriptionRequest_get_ServiceId(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpSubscriptionRequest *)p)->m_serviceId;
|
||||
}
|
||||
|
||||
const char *UpnpSubscriptionRequest_get_ServiceId_cstr(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_set_ServiceId(UpnpSubscriptionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_serviceId);
|
||||
((struct SUpnpSubscriptionRequest *)p)->m_serviceId = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_strcpy_ServiceId(UpnpSubscriptionRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_serviceId);
|
||||
((struct SUpnpSubscriptionRequest *)p)->m_serviceId = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpSubscriptionRequest *)p)->m_serviceId, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpSubscriptionRequest_get_UDN(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpSubscriptionRequest *)p)->m_UDN;
|
||||
}
|
||||
|
||||
const char *UpnpSubscriptionRequest_get_UDN_cstr(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpSubscriptionRequest_get_UDN(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_set_UDN(UpnpSubscriptionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_UDN);
|
||||
((struct SUpnpSubscriptionRequest *)p)->m_UDN = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_strcpy_UDN(UpnpSubscriptionRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_UDN);
|
||||
((struct SUpnpSubscriptionRequest *)p)->m_UDN = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpSubscriptionRequest *)p)->m_UDN, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpSubscriptionRequest_get_SID(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
return ((struct SUpnpSubscriptionRequest *)p)->m_SID;
|
||||
}
|
||||
|
||||
const char *UpnpSubscriptionRequest_get_SID_cstr(const UpnpSubscriptionRequest *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpSubscriptionRequest_get_SID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_set_SID(UpnpSubscriptionRequest *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_SID);
|
||||
((struct SUpnpSubscriptionRequest *)p)->m_SID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpSubscriptionRequest_strcpy_SID(UpnpSubscriptionRequest *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SUpnpSubscriptionRequest *)p)->m_SID);
|
||||
((struct SUpnpSubscriptionRequest *)p)->m_SID = UpnpString_new();
|
||||
UpnpString_set_String(((struct SUpnpSubscriptionRequest *)p)->m_SID, s);
|
||||
}
|
||||
|
||||
156
upnp/src/api/UpnpString.c
Normal file
156
upnp/src/api/UpnpString.c
Normal file
@@ -0,0 +1,156 @@
|
||||
|
||||
|
||||
/*!
|
||||
* \addtogroup UpnpString
|
||||
*
|
||||
* Due to its heavy use, this class is coded for efficiency, not for beauty.
|
||||
* Do not use this as example to other classes. Please take a look at any
|
||||
* other one.
|
||||
*
|
||||
* \todo Always alloc a minimum size like 64 bytes or so and when shrinking
|
||||
* do not perform a new memory allocation.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpString object implementation.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for strlen(), strdup() */
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Internal implementation of the class UpnpString.
|
||||
*
|
||||
* \internal
|
||||
*/
|
||||
struct SUpnpString
|
||||
{
|
||||
/*! \brief Length of the string. */
|
||||
int m_length;
|
||||
/*! \brief Pointer to a dynamically allocated area that holds the NULL
|
||||
* terminated string. */
|
||||
char *m_string;
|
||||
};
|
||||
|
||||
|
||||
UpnpString *UpnpString_new()
|
||||
{
|
||||
// All bytes are zero, and so is the length of the string.
|
||||
struct SUpnpString *p = calloc(1, sizeof (struct SUpnpString));
|
||||
if (p == NULL) {
|
||||
goto error_handler1;
|
||||
}
|
||||
#if 0
|
||||
p->m_length = 0;
|
||||
#endif
|
||||
|
||||
// This byte is zero, calloc does initialize it.
|
||||
p->m_string = calloc(1, 1);
|
||||
if (p->m_string == NULL) {
|
||||
goto error_handler2;
|
||||
}
|
||||
|
||||
return (UpnpString *)p;
|
||||
|
||||
//free(p->m_string);
|
||||
error_handler2:
|
||||
free(p);
|
||||
error_handler1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void UpnpString_delete(UpnpString *p)
|
||||
{
|
||||
struct SUpnpString *q = (struct SUpnpString *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_length = 0;
|
||||
|
||||
free(q->m_string);
|
||||
q->m_string = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
UpnpString *UpnpString_dup(const UpnpString *p)
|
||||
{
|
||||
struct SUpnpString *q = calloc(1, sizeof (struct SUpnpString));
|
||||
if (q == NULL) {
|
||||
goto error_handler1;
|
||||
}
|
||||
q->m_length = ((struct SUpnpString *)p)->m_length;
|
||||
q->m_string = strdup(((struct SUpnpString *)p)->m_string);
|
||||
if (q->m_string == NULL) {
|
||||
goto error_handler2;
|
||||
}
|
||||
|
||||
return (UpnpString *)q;
|
||||
|
||||
//free(q->m_string);
|
||||
error_handler2:
|
||||
free(q);
|
||||
error_handler1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void UpnpString_assign(UpnpString *p, const UpnpString *q)
|
||||
{
|
||||
if (p != q) {
|
||||
UpnpString_set_String(p, UpnpString_get_String(q));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpString_get_Length(const UpnpString *p)
|
||||
{
|
||||
return ((struct SUpnpString *)p)->m_length;
|
||||
}
|
||||
|
||||
|
||||
const char *UpnpString_get_String(const UpnpString *p)
|
||||
{
|
||||
return ((struct SUpnpString *)p)->m_string;
|
||||
}
|
||||
|
||||
|
||||
void UpnpString_set_String(UpnpString *p, const char *s)
|
||||
{
|
||||
free(((struct SUpnpString *)p)->m_string);
|
||||
((struct SUpnpString *)p)->m_length = strlen(s);
|
||||
((struct SUpnpString *)p)->m_string = strdup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpString_set_StringN(UpnpString *p, const char *s, int n)
|
||||
{
|
||||
free(((struct SUpnpString *)p)->m_string);
|
||||
((struct SUpnpString *)p)->m_length = n;
|
||||
((struct SUpnpString *)p)->m_string = (char *)malloc(n+1);
|
||||
strncpy(((struct SUpnpString *)p)->m_string, s, n);
|
||||
((struct SUpnpString *)p)->m_string[n] = 0;
|
||||
}
|
||||
|
||||
|
||||
void UpnpString_clear(UpnpString *p)
|
||||
{
|
||||
((struct SUpnpString *)p)->m_length = 0;
|
||||
// No need to realloc now, will do later when needed
|
||||
((struct SUpnpString *)p)->m_string[0] = 0;
|
||||
}
|
||||
|
||||
/* @} UpnpString */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,82 +1,108 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
#include "ithread.h"
|
||||
#include "ixml.h"
|
||||
#include "upnp.h"
|
||||
#include "upnpdebug.h"
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "ithread.h"
|
||||
#include "upnp.h"
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
||||
//Mutex to synchronize all the log file opeartions in the debug mode
|
||||
/*! Mutex to synchronize all the log file opeartions in the debug mode */
|
||||
static ithread_mutex_t GlobalDebugMutex;
|
||||
|
||||
// Global log level
|
||||
/*! Global log level */
|
||||
static Upnp_LogLevel g_log_level = UPNP_DEFAULT_LOG_LEVEL;
|
||||
|
||||
//File handle for the error log file
|
||||
/*! File handle for the error log file */
|
||||
static FILE *ErrFileHnd = NULL;
|
||||
|
||||
//File handle for the information log file
|
||||
/*! File handle for the information log file */
|
||||
static FILE *InfoFileHnd = NULL;
|
||||
|
||||
//Name of the error file
|
||||
/*! Name of the error file */
|
||||
static const char *errFileName = "IUpnpErrFile.txt";
|
||||
|
||||
//Name of the info file
|
||||
/*! Name of the info file */
|
||||
static const char *infoFileName = "IUpnpInfoFile.txt";
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpSetLogFileNames
|
||||
*
|
||||
* Parameters:
|
||||
* IN const char* ErrFileName: name of the error file
|
||||
* IN const char *InfoFileName: name of the information file
|
||||
* IN int size: Size of the buffer
|
||||
* IN int starLength: This parameter provides the width of the banner
|
||||
*
|
||||
* Description:
|
||||
* This functions takes the buffer and writes the buffer in the file as
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
void
|
||||
UpnpSetLogFileNames ( IN const char *ErrFileName,
|
||||
IN const char *InfoFileName )
|
||||
|
||||
int UpnpInitLog(void)
|
||||
{
|
||||
ithread_mutex_init(&GlobalDebugMutex, NULL);
|
||||
if(DEBUG_TARGET == 1) {
|
||||
if((ErrFileHnd = fopen( errFileName, "a")) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if((InfoFileHnd = fopen( infoFileName, "a")) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void UpnpSetLogLevel(Upnp_LogLevel log_level)
|
||||
{
|
||||
g_log_level = log_level;
|
||||
}
|
||||
|
||||
|
||||
void UpnpCloseLog(void)
|
||||
{
|
||||
if (DEBUG_TARGET == 1) {
|
||||
fflush(ErrFileHnd);
|
||||
fflush(InfoFileHnd);
|
||||
fclose(ErrFileHnd);
|
||||
fclose(InfoFileHnd);
|
||||
}
|
||||
ithread_mutex_destroy(&GlobalDebugMutex);
|
||||
}
|
||||
|
||||
|
||||
void UpnpSetLogFileNames(
|
||||
const char *ErrFileName,
|
||||
const char *InfoFileName)
|
||||
{
|
||||
if (ErrFileName) {
|
||||
errFileName = ErrFileName;
|
||||
@@ -87,91 +113,9 @@ UpnpSetLogFileNames ( IN const char *ErrFileName,
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpInitLog
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Description:
|
||||
* This functions initializes the log files
|
||||
*
|
||||
* Returns: int
|
||||
* -1 : If fails
|
||||
* UPNP_E_SUCCESS : if success
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpInitLog()
|
||||
{
|
||||
ithread_mutex_init( &GlobalDebugMutex, NULL );
|
||||
|
||||
if( DEBUG_TARGET == 1 ) {
|
||||
if( ( ErrFileHnd = fopen( errFileName, "a" ) ) == NULL )
|
||||
return -1;
|
||||
if( ( InfoFileHnd = fopen( infoFileName, "a" ) ) == NULL )
|
||||
return -1;
|
||||
}
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpSetLogLevel
|
||||
*
|
||||
* Parameters: Upnp_LogLevel log_level
|
||||
*
|
||||
* Description:
|
||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
void
|
||||
UpnpSetLogLevel (Upnp_LogLevel log_level)
|
||||
{
|
||||
g_log_level = log_level;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpCloseLog
|
||||
*
|
||||
* Parameters: void
|
||||
*
|
||||
* Description:
|
||||
* This functions closes the log files
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
void
|
||||
UpnpCloseLog()
|
||||
{
|
||||
if( DEBUG_TARGET == 1 ) {
|
||||
fflush( ErrFileHnd );
|
||||
fflush( InfoFileHnd );
|
||||
fclose( ErrFileHnd );
|
||||
fclose( InfoFileHnd );
|
||||
}
|
||||
ithread_mutex_destroy( &GlobalDebugMutex );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* 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)
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module)
|
||||
{
|
||||
int ret = DLevel <= g_log_level;
|
||||
ret &=
|
||||
@@ -186,37 +130,14 @@ int DebugAtThisLevel(
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpPrintf
|
||||
*
|
||||
* 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
|
||||
* IN char *DbgFileName: Name of the file from where debug statement is
|
||||
* coming
|
||||
* IN int DbgLineNo : Line number of the file from where debug statement
|
||||
* is coming
|
||||
* IN char * FmtStr, ...: Variable number of arguments that will go
|
||||
* in the debug statement
|
||||
*
|
||||
* Description:
|
||||
* This functions prints the debug statement either on the startdard
|
||||
* output or log file along with the information from where this debug
|
||||
* statement is coming
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpPrintf(
|
||||
IN Upnp_LogLevel DLevel,
|
||||
IN Dbg_Module Module,
|
||||
IN const char *DbgFileName,
|
||||
IN int DbgLineNo,
|
||||
IN const char *FmtStr,
|
||||
Upnp_LogLevel DLevel,
|
||||
Dbg_Module Module,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *FmtStr,
|
||||
...)
|
||||
{
|
||||
va_list ArgList;
|
||||
@@ -249,26 +170,8 @@ void UpnpPrintf(
|
||||
va_end(ArgList);
|
||||
ithread_mutex_unlock(&GlobalDebugMutex);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpGetDebugFile
|
||||
*
|
||||
* 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 function checks if the module is turned on for debug
|
||||
* and returns the file descriptor corresponding to the debug level
|
||||
* Returns: FILE *
|
||||
* 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)
|
||||
{
|
||||
FILE *ret;
|
||||
@@ -287,65 +190,51 @@ FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayFileAndLine
|
||||
*
|
||||
* Parameters:
|
||||
* IN FILE *fd: File descriptor where line number and file name will be
|
||||
* written
|
||||
* IN char *DbgFileName: Name of the file
|
||||
* IN int DbgLineNo : Line number of the file
|
||||
*
|
||||
* Description:
|
||||
* This function writes the file name and file number from where
|
||||
* debug statement is coming to the log file
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayFileAndLine(
|
||||
IN FILE * fd,
|
||||
IN const char *DbgFileName,
|
||||
IN int DbgLineNo)
|
||||
FILE *fd,
|
||||
const char *DbgFileName,
|
||||
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;
|
||||
#define NLINES 2
|
||||
#define MAX_LINE_SIZE 512
|
||||
#define NUMBER_OF_STARS 80
|
||||
const char *lines[NLINES];
|
||||
char buf[NLINES][MAX_LINE_SIZE];
|
||||
int i;
|
||||
|
||||
/* Initialize the pointer array */
|
||||
for (i = 0; i < NLINES; i++) {
|
||||
lines[i] = buf[i];
|
||||
}
|
||||
UpnpDisplayBanner(fd, lines, 2, starlength);
|
||||
|
||||
/* Put the debug lines in the buffer */
|
||||
sprintf(buf[0], "DEBUG - THREAD ID: 0x%lX",
|
||||
#ifdef WIN32
|
||||
(unsigned long int)ithread_self().p
|
||||
#else
|
||||
(unsigned long int)ithread_self()
|
||||
#endif
|
||||
);
|
||||
if (DbgFileName) {
|
||||
sprintf(buf[1],
|
||||
"FILE: %s, LINE: %d",
|
||||
DbgFileName,
|
||||
DbgLineNo);
|
||||
}
|
||||
|
||||
/* Show the lines centered */
|
||||
UpnpDisplayBanner(fd, lines, NLINES, NUMBER_OF_STARS);
|
||||
fflush(fd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function : UpnpDisplayBanner
|
||||
*
|
||||
* Parameters:
|
||||
* IN FILE *fd: file descriptor where the banner will be written
|
||||
* IN char **lines: The buffer that will be written
|
||||
* IN int size: Size of the buffer
|
||||
* IN int starLength: This parameter provides the width of the banner
|
||||
*
|
||||
* Description:
|
||||
* This functions takes the buffer and writes the buffer in the file as
|
||||
* per the requested banner
|
||||
* Returns: void
|
||||
***************************************************************************/
|
||||
#ifdef DEBUG
|
||||
void UpnpDisplayBanner(
|
||||
IN FILE * fd,
|
||||
IN const char **lines,
|
||||
IN size_t size,
|
||||
IN int starLength)
|
||||
FILE * fd,
|
||||
const char **lines,
|
||||
size_t size,
|
||||
int starLength)
|
||||
{
|
||||
int leftMarginLength = starLength / 2 + 1;
|
||||
int rightMarginLength = starLength / 2 + 1;
|
||||
@@ -393,5 +282,47 @@ void UpnpDisplayBanner(
|
||||
free(rightMargin);
|
||||
free(leftMargin);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void PrintThreadPoolStats(
|
||||
ThreadPool *tp,
|
||||
const char *DbgFileName,
|
||||
int DbgLineNo,
|
||||
const char *msg)
|
||||
{
|
||||
ThreadPoolStats stats;
|
||||
ThreadPoolGetStats(tp, &stats);
|
||||
UpnpPrintf(UPNP_INFO, API, DbgFileName, DbgLineNo,
|
||||
"%s\n"
|
||||
"High Jobs pending: %d\n"
|
||||
"Med Jobs Pending: %d\n"
|
||||
"Low Jobs Pending: %d\n"
|
||||
"Average wait in High Q in milliseconds: %lf\n"
|
||||
"Average wait in Med Q in milliseconds: %lf\n"
|
||||
"Average wait in Low Q in milliseconds: %lf\n"
|
||||
"Max Threads Used: %d\n"
|
||||
"Worker Threads: %d\n"
|
||||
"Persistent Threads: %d\n"
|
||||
"Idle Threads: %d\n"
|
||||
"Total Threads: %d\n"
|
||||
"Total Work Time: %lf\n"
|
||||
"Total Idle Time: %lf\n",
|
||||
msg,
|
||||
stats.currentJobsHQ,
|
||||
stats.currentJobsMQ,
|
||||
stats.currentJobsLQ,
|
||||
stats.avgWaitHQ,
|
||||
stats.avgWaitMQ,
|
||||
stats.avgWaitLQ,
|
||||
stats.maxThreads,
|
||||
stats.workerThreads,
|
||||
stats.persistentThreads,
|
||||
stats.idleThreads,
|
||||
stats.totalThreads,
|
||||
stats.totalWorkTime,
|
||||
stats.totalIdleTime);
|
||||
}
|
||||
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
@@ -1,56 +1,83 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
|
||||
#if EXCLUDE_DOM == 0
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
#include "upnp.h"
|
||||
#include "upnptools.h"
|
||||
|
||||
|
||||
#include "uri.h"
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
/*! Maximum action header buffer length. */
|
||||
#define HEADER_LENGTH 2000
|
||||
|
||||
// Structure to maintain a error code and string associated with the
|
||||
// error code
|
||||
struct ErrorString {
|
||||
int rc; /* error code */
|
||||
const char *rcError; /* error description */
|
||||
|
||||
/*!
|
||||
* \brief Structure to maintain a error code and string associated with the
|
||||
* error code.
|
||||
*/
|
||||
struct ErrorString {
|
||||
/*! Error code. */
|
||||
int rc;
|
||||
/*! Error description. */
|
||||
const char *rcError;
|
||||
};
|
||||
|
||||
// Initializing the array of error structures.
|
||||
struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
||||
|
||||
/*!
|
||||
* \brief 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"},
|
||||
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
||||
{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"},
|
||||
{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMOR"},
|
||||
{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMORY"},
|
||||
{UPNP_E_INIT, "UPNP_E_INIT"},
|
||||
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
||||
{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"},
|
||||
@@ -63,7 +90,10 @@ struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
||||
{UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"},
|
||||
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
||||
{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"},
|
||||
{UPNP_E_URL_TOO_BIG, "UPNP_E_URL_TOO_BIG"},
|
||||
{UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"},
|
||||
{UPNP_E_ALREADY_REGISTERED, "UPNP_E_ALREADY_REGISTERED"},
|
||||
{UPNP_E_INVALID_INTERFACE, "UPNP_E_INVALID_INTERFACE"},
|
||||
{UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"},
|
||||
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
||||
{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"},
|
||||
@@ -71,112 +101,91 @@ struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
||||
{UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"},
|
||||
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
||||
{UPNP_E_LISTEN, "UPNP_E_LISTEN"},
|
||||
{UPNP_E_TIMEDOUT, "UPNP_E_TIMEDOUT"},
|
||||
{UPNP_E_SOCKET_ERROR, "UPNP_E_SOCKET_ERROR"},
|
||||
{UPNP_E_FILE_WRITE_ERROR, "UPNP_E_FILE_WRITE_ERROR"},
|
||||
{UPNP_E_CANCELED, "UPNP_E_CANCELED"},
|
||||
{UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"},
|
||||
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
||||
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
||||
{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"},
|
||||
{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"},
|
||||
{UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"},
|
||||
{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"}
|
||||
{UPNP_E_FILE_NOT_FOUND, "UPNP_E_FILE_NOT_FOUND"},
|
||||
{UPNP_E_FILE_READ_ERROR, "UPNP_E_FILE_READ_ERROR"},
|
||||
{UPNP_E_EXT_NOT_XML, "UPNP_E_EXT_NOT_XML"},
|
||||
{UPNP_E_NO_WEB_SERVER, "UPNP_E_NO_WEB_SERVER"},
|
||||
{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"},
|
||||
{UPNP_E_NOT_FOUND, "UPNP_E_NOT_FOUND"},
|
||||
{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"},
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpGetErrorMessage
|
||||
*
|
||||
* Parameters:
|
||||
* IN int rc: error code
|
||||
*
|
||||
* Description:
|
||||
* This functions returns the error string mapped to the error code
|
||||
* Returns: const char *
|
||||
* return either the right string or "Unknown Error"
|
||||
***************************************************************************/
|
||||
const char *
|
||||
UpnpGetErrorMessage( IN int rc )
|
||||
|
||||
const char *UpnpGetErrorMessage(int rc)
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < sizeof( ErrorMessages ) / sizeof( ErrorMessages[0] );
|
||||
i++ ) {
|
||||
if( rc == ErrorMessages[i].rc )
|
||||
for (i = 0; i < sizeof (ErrorMessages) / sizeof (ErrorMessages[0]); ++i) {
|
||||
if (rc == ErrorMessages[i].rc) {
|
||||
return ErrorMessages[i].rcError;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return "Unknown Error";
|
||||
|
||||
return "Unknown error code";
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpResolveURL
|
||||
*
|
||||
* Parameters:
|
||||
* IN char * BaseURL: Base URL string
|
||||
* IN char * RelURL: relative URL string
|
||||
* OUT char * AbsURL: Absolute URL string
|
||||
* Description:
|
||||
* This functions concatinates the base URL and relative URL to generate
|
||||
* the absolute URL
|
||||
* Returns: int
|
||||
* return either UPNP_E_SUCCESS or appropriate error
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpResolveURL( IN const char *BaseURL,
|
||||
IN const char *RelURL,
|
||||
OUT char *AbsURL )
|
||||
|
||||
/*!
|
||||
* \todo There is some unnecessary allocation and deallocation going on here
|
||||
* because of the way resolve_rel_url() was originally written and used. In the
|
||||
* future it would be nice to clean this up.
|
||||
*/
|
||||
int UpnpResolveURL(
|
||||
const char *BaseURL,
|
||||
const char *RelURL,
|
||||
char *AbsURL)
|
||||
{
|
||||
// There is some unnecessary allocation and
|
||||
// deallocation going on here because of the way
|
||||
// resolve_rel_url was originally written and used
|
||||
// in the future it would be nice to clean this up
|
||||
int ret = UPNP_E_SUCCESS;
|
||||
char *tempRel = NULL;
|
||||
|
||||
char *tempRel;
|
||||
|
||||
if( RelURL == NULL )
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
|
||||
tempRel = NULL;
|
||||
if (RelURL == NULL) {
|
||||
ret = UPNP_E_INVALID_PARAM;
|
||||
goto ExitFunction;
|
||||
}
|
||||
|
||||
tempRel = resolve_rel_url((char *)BaseURL, (char *)RelURL);
|
||||
|
||||
if (tempRel) {
|
||||
strcpy(AbsURL, tempRel);
|
||||
free(tempRel);
|
||||
} else {
|
||||
return UPNP_E_INVALID_URL;
|
||||
ret = UPNP_E_INVALID_URL;
|
||||
}
|
||||
|
||||
ExitFunction:
|
||||
return UPNP_E_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : addToAction
|
||||
|
||||
/*!
|
||||
* \brief Adds the argument in the action request or response.
|
||||
*
|
||||
* Parameters:
|
||||
* IN int response: flag to tell if the ActionDoc is for response
|
||||
* or request
|
||||
* INOUT IXML_Document **ActionDoc: request or response document
|
||||
* IN char *ActionName: Name of the action request or response
|
||||
* IN char *ServType: Service type
|
||||
* IN char * ArgName: Name of the argument
|
||||
* IN char * ArgValue: Value of the argument
|
||||
*
|
||||
* Description:
|
||||
* This function adds the argument in the action request or response.
|
||||
* This function creates the action request or response if it is a first
|
||||
* argument else it will add the argument in the document
|
||||
* argument, otherwise it will add the argument in the document.
|
||||
*
|
||||
* Returns: int
|
||||
* returns UPNP_E_SUCCESS if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
static int
|
||||
addToAction( IN int response,
|
||||
INOUT IXML_Document ** ActionDoc,
|
||||
IN const char *ActionName,
|
||||
IN const char *ServType,
|
||||
IN const char *ArgName,
|
||||
IN const char *ArgValue )
|
||||
* \returns UPNP_E_SUCCESS if successful, otherwise the appropriate error.
|
||||
*/
|
||||
static int addToAction(
|
||||
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
||||
int response,
|
||||
/*! [in,out] Request or response document. */
|
||||
IXML_Document **ActionDoc,
|
||||
/*! [in] Name of the action request or response. */
|
||||
const char *ActionName,
|
||||
/*! [in] Service type. */
|
||||
const char *ServType,
|
||||
/*! [in] Name of the argument. */
|
||||
const char *ArgName,
|
||||
/*! [in] Value of the argument. */
|
||||
const char *ArgValue)
|
||||
{
|
||||
char *ActBuff = NULL;
|
||||
IXML_Node *node = NULL;
|
||||
@@ -222,39 +231,32 @@ addToAction( IN int response,
|
||||
Txt = ixmlDocument_createTextNode(*ActionDoc, ArgValue);
|
||||
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||
}
|
||||
|
||||
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
||||
}
|
||||
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : makeAction
|
||||
|
||||
/*!
|
||||
* \brief Creates the action request or response from the argument list.
|
||||
*
|
||||
* Parameters:
|
||||
* IN int response: flag to tell if the ActionDoc is for response
|
||||
* or request
|
||||
* IN char * ActionName: Name of the action request or response
|
||||
* IN char * ServType: Service type
|
||||
* IN int NumArg :Number of arguments in the action request or response
|
||||
* IN char * Arg : pointer to the first argument
|
||||
* IN va_list ArgList: Argument list
|
||||
*
|
||||
* Description:
|
||||
* This function creates the action request or response from the argument
|
||||
* list.
|
||||
* Returns: IXML_Document *
|
||||
* returns action request or response document if successful
|
||||
* else returns NULL
|
||||
***************************************************************************/
|
||||
static IXML_Document *
|
||||
makeAction( IN int response,
|
||||
IN const char *ActionName,
|
||||
IN const char *ServType,
|
||||
IN int NumArg,
|
||||
IN const char *Arg,
|
||||
IN va_list ArgList )
|
||||
* \return Action request or response document if successful, otherwise
|
||||
* returns NULL
|
||||
*/
|
||||
static IXML_Document *makeAction(
|
||||
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
||||
int response,
|
||||
/*! [in] Name of the action request or response. */
|
||||
const char *ActionName,
|
||||
/*! [in] Service type. */
|
||||
const char *ServType,
|
||||
/*! [in] Number of arguments in the action request or response. */
|
||||
int NumArg,
|
||||
/*! [in] pointer to the first argument. */
|
||||
const char *Arg,
|
||||
/*! [in] Argument list. */
|
||||
va_list ArgList)
|
||||
{
|
||||
const char *ArgName;
|
||||
const char *ArgValue;
|
||||
@@ -283,14 +285,12 @@ makeAction( IN int response,
|
||||
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
||||
ActionName, ServType, ActionName);
|
||||
}
|
||||
|
||||
if (ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) {
|
||||
free(ActBuff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free(ActBuff);
|
||||
|
||||
if(ActionDoc == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -300,19 +300,15 @@ makeAction( IN int response,
|
||||
ArgName = Arg;
|
||||
for ( ; ; ) {
|
||||
ArgValue = va_arg(ArgList, const char *);
|
||||
|
||||
if (ArgName != NULL) {
|
||||
node = ixmlNode_getFirstChild((IXML_Node *)ActionDoc);
|
||||
Ele = ixmlDocument_createElement(ActionDoc, ArgName);
|
||||
if (ArgValue) {
|
||||
Txt =
|
||||
ixmlDocument_createTextNode( ActionDoc, ArgValue );
|
||||
Txt = ixmlDocument_createTextNode(ActionDoc, ArgValue);
|
||||
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||
}
|
||||
|
||||
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
||||
}
|
||||
|
||||
if (++Idx < NumArg) {
|
||||
ArgName = va_arg(ArgList, const char *);
|
||||
} else {
|
||||
@@ -325,28 +321,9 @@ makeAction( IN int response,
|
||||
return ActionDoc;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpMakeAction
|
||||
*
|
||||
* Parameters:
|
||||
* IN char * ActionName: Name of the action request or response
|
||||
* IN char * ServType: Service type
|
||||
* IN int NumArg :Number of arguments in the action request or response
|
||||
* IN char * Arg : pointer to the first argument
|
||||
* IN ... : variable argument list
|
||||
* IN va_list ArgList: Argument list
|
||||
*
|
||||
* Description:
|
||||
* This function creates the action request from the argument
|
||||
* list. Its a wrapper function that calls makeAction function to create
|
||||
* the action request.
|
||||
*
|
||||
* Returns: IXML_Document *
|
||||
* returns action request document if successful
|
||||
* else returns NULL
|
||||
***************************************************************************/
|
||||
IXML_Document *
|
||||
UpnpMakeAction( const char *ActionName,
|
||||
|
||||
IXML_Document *UpnpMakeAction(
|
||||
const char *ActionName,
|
||||
const char *ServType,
|
||||
int NumArg,
|
||||
const char *Arg,
|
||||
@@ -362,28 +339,9 @@ UpnpMakeAction( const char *ActionName,
|
||||
return out;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpMakeActionResponse
|
||||
*
|
||||
* Parameters:
|
||||
* IN char * ActionName: Name of the action request or response
|
||||
* IN char * ServType: Service type
|
||||
* IN int NumArg :Number of arguments in the action request or response
|
||||
* IN char * Arg : pointer to the first argument
|
||||
* IN ... : variable argument list
|
||||
* IN va_list ArgList: Argument list
|
||||
*
|
||||
* Description:
|
||||
* This function creates the action response from the argument
|
||||
* list. Its a wrapper function that calls makeAction function to create
|
||||
* the action response.
|
||||
*
|
||||
* Returns: IXML_Document *
|
||||
* returns action response document if successful
|
||||
* else returns NULL
|
||||
***************************************************************************/
|
||||
IXML_Document *
|
||||
UpnpMakeActionResponse( const char *ActionName,
|
||||
|
||||
IXML_Document *UpnpMakeActionResponse(
|
||||
const char *ActionName,
|
||||
const char *ServType,
|
||||
int NumArg,
|
||||
const char *Arg,
|
||||
@@ -399,89 +357,86 @@ UpnpMakeActionResponse( const char *ActionName,
|
||||
return out;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpAddToActionResponse
|
||||
*
|
||||
* Parameters:
|
||||
* INOUT IXML_Document **ActionResponse: action response document
|
||||
* IN char * ActionName: Name of the action request or response
|
||||
* IN char * ServType: Service type
|
||||
* IN int ArgName :Name of argument to be added in the action response
|
||||
* IN char * ArgValue : value of the argument
|
||||
*
|
||||
* Description:
|
||||
* This function adds the argument in the action response. Its a wrapper
|
||||
* function that calls addToAction function to add the argument in the
|
||||
* action response.
|
||||
*
|
||||
* Returns: int
|
||||
* returns UPNP_E_SUCCESS if successful
|
||||
* else returns appropriate error
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpAddToActionResponse( INOUT IXML_Document ** ActionResponse,
|
||||
IN const char *ActionName,
|
||||
IN const char *ServType,
|
||||
IN const char *ArgName,
|
||||
IN const char *ArgValue )
|
||||
{
|
||||
return addToAction( 1, ActionResponse, ActionName, ServType, ArgName,
|
||||
ArgValue );
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpAddToAction
|
||||
*
|
||||
* Parameters:
|
||||
* INOUT IXML_Document **ActionDoc: action request document
|
||||
* IN char * ActionName: Name of the action request or response
|
||||
* IN char * ServType: Service type
|
||||
* IN int ArgName :Name of argument to be added in the action response
|
||||
* IN char * ArgValue : value of the argument
|
||||
*
|
||||
* Description:
|
||||
* This function adds the argument in the action request. Its a wrapper
|
||||
* function that calls addToAction function to add the argument in the
|
||||
* action request.
|
||||
*
|
||||
* Returns: int
|
||||
* returns UPNP_E_SUCCESS if successful
|
||||
* else returns appropriate error
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpAddToAction( IXML_Document ** ActionDoc,
|
||||
int UpnpAddToAction(
|
||||
IXML_Document **ActionDoc,
|
||||
const char *ActionName,
|
||||
const char *ServType,
|
||||
const char *ArgName,
|
||||
const char *ArgValue)
|
||||
{
|
||||
|
||||
return addToAction( 0, ActionDoc, ActionName, ServType, ArgName,
|
||||
ArgValue );
|
||||
return addToAction(0, ActionDoc, ActionName, ServType, ArgName, ArgValue);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpAddToPropertySet
|
||||
*
|
||||
* Parameters:
|
||||
* INOUT IXML_Document **PropSet: propertyset document
|
||||
* IN char *ArgName: Name of the argument
|
||||
* IN char *ArgValue: value of the argument
|
||||
*
|
||||
* Description:
|
||||
* This function adds the argument in the propertyset node
|
||||
*
|
||||
* Returns: int
|
||||
* returns UPNP_E_SUCCESS if successful else returns appropriate error
|
||||
***************************************************************************/
|
||||
int
|
||||
UpnpAddToPropertySet( INOUT IXML_Document ** PropSet,
|
||||
IN const char *ArgName,
|
||||
IN const char *ArgValue )
|
||||
{
|
||||
|
||||
char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas"
|
||||
"-upnp-org:event-1-0\"></e:propertyset>";
|
||||
int UpnpAddToActionResponse(
|
||||
IXML_Document **ActionResponse,
|
||||
const char *ActionName,
|
||||
const char *ServType,
|
||||
const char *ArgName,
|
||||
const char *ArgValue)
|
||||
{
|
||||
return addToAction(1, ActionResponse, ActionName, ServType, ArgName, ArgValue);
|
||||
}
|
||||
|
||||
|
||||
IXML_Document *UpnpCreatePropertySet(
|
||||
int NumArg,
|
||||
const char *Arg,
|
||||
...)
|
||||
{
|
||||
va_list ArgList;
|
||||
int Idx = 0;
|
||||
char BlankDoc[] =
|
||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
|
||||
"</e:propertyset>";
|
||||
const char *ArgName,
|
||||
*ArgValue;
|
||||
IXML_Node *node;
|
||||
IXML_Element *Ele;
|
||||
IXML_Element *Ele1;
|
||||
IXML_Node *Txt;
|
||||
IXML_Document *PropSet;
|
||||
|
||||
if(ixmlParseBufferEx(BlankDoc, &PropSet) != IXML_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (NumArg < 1) {
|
||||
return PropSet;
|
||||
}
|
||||
|
||||
va_start(ArgList, Arg);
|
||||
ArgName = Arg;
|
||||
while (Idx++ != NumArg) {
|
||||
ArgValue = va_arg(ArgList, const char *);
|
||||
if (ArgName != NULL /*&& ArgValue != NULL */) {
|
||||
node = ixmlNode_getFirstChild((IXML_Node *)PropSet);
|
||||
Ele1 = ixmlDocument_createElement(PropSet, "e:property");
|
||||
Ele = ixmlDocument_createElement(PropSet, ArgName);
|
||||
if (ArgValue) {
|
||||
Txt = ixmlDocument_createTextNode(PropSet, ArgValue);
|
||||
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||
}
|
||||
ixmlNode_appendChild((IXML_Node *)Ele1, (IXML_Node *)Ele);
|
||||
ixmlNode_appendChild( node, (IXML_Node *)Ele1);
|
||||
}
|
||||
ArgName = va_arg(ArgList, const char *);
|
||||
}
|
||||
va_end(ArgList);
|
||||
|
||||
return PropSet;
|
||||
}
|
||||
|
||||
|
||||
int UpnpAddToPropertySet(
|
||||
IXML_Document **PropSet,
|
||||
const char *ArgName,
|
||||
const char *ArgValue)
|
||||
{
|
||||
char BlankDoc[] =
|
||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
|
||||
"</e:propertyset>";
|
||||
IXML_Node *node;
|
||||
IXML_Element *Ele;
|
||||
IXML_Element *Ele1;
|
||||
@@ -515,71 +470,6 @@ UpnpAddToPropertySet( INOUT IXML_Document ** PropSet,
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : UpnpCreatePropertySet
|
||||
*
|
||||
* Parameters:
|
||||
* IN int NumArg: Number of argument that will go in the propertyset node
|
||||
* IN char * Args: argument strings
|
||||
*
|
||||
* Description:
|
||||
* This function creates a propertyset node and put all the input
|
||||
* parameters in the node as elements
|
||||
*
|
||||
* Returns: IXML_Document *
|
||||
* returns the document containing propertyset node.
|
||||
***************************************************************************/
|
||||
IXML_Document *
|
||||
UpnpCreatePropertySet( IN int NumArg,
|
||||
IN const char *Arg,
|
||||
... )
|
||||
{
|
||||
va_list ArgList;
|
||||
int Idx = 0;
|
||||
char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas-"
|
||||
"upnp-org:event-1-0\"></e:propertyset>";
|
||||
const char *ArgName,
|
||||
*ArgValue;
|
||||
IXML_Node *node;
|
||||
IXML_Element *Ele;
|
||||
IXML_Element *Ele1;
|
||||
IXML_Node *Txt;
|
||||
IXML_Document *PropSet;
|
||||
|
||||
if( ixmlParseBufferEx( BlankDoc, &PropSet ) != IXML_SUCCESS ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( NumArg < 1 ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
va_start( ArgList, Arg );
|
||||
ArgName = Arg;
|
||||
|
||||
while( Idx++ != NumArg ) {
|
||||
ArgValue = va_arg( ArgList, const char * );
|
||||
|
||||
if( ArgName != NULL /*&& ArgValue != NULL */ ) {
|
||||
node = ixmlNode_getFirstChild( ( IXML_Node * ) PropSet );
|
||||
Ele1 = ixmlDocument_createElement( PropSet, "e:property" );
|
||||
Ele = ixmlDocument_createElement( PropSet, ArgName );
|
||||
if( ArgValue ) {
|
||||
Txt = ixmlDocument_createTextNode( PropSet, ArgValue );
|
||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
||||
}
|
||||
|
||||
ixmlNode_appendChild( ( IXML_Node * ) Ele1,
|
||||
( IXML_Node * ) Ele );
|
||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele1 );
|
||||
}
|
||||
|
||||
ArgName = va_arg( ArgList, const char * );
|
||||
|
||||
}
|
||||
va_end( ArgList );
|
||||
return PropSet;
|
||||
}
|
||||
|
||||
#endif // EXCLUDE_DOM == 0
|
||||
#endif /* EXCLUDE_DOM == 0 */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user