Compare commits
149 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ac867bbb1 | ||
|
|
9052ca95be | ||
|
|
ef7edf6cf8 | ||
|
|
c65ec8a720 | ||
|
|
2d22e997e1 | ||
|
|
96dc968f18 | ||
|
|
8e846368e0 | ||
|
|
d6671c464f | ||
|
|
699dd3c82e | ||
|
|
9be360bcd1 | ||
|
|
593b8d0a2b | ||
|
|
890c1b6ef8 | ||
|
|
c127a3a87e | ||
|
|
bd5758186c | ||
|
|
cc472bc2cd | ||
|
|
6128296e5f | ||
|
|
d84c6a7e9f | ||
|
|
113ebd1f91 | ||
|
|
bf1450bf81 | ||
|
|
56b9c75056 | ||
|
|
2bdc9e075e | ||
|
|
923eee2393 | ||
|
|
f74746ff3f | ||
|
|
8401a59ed5 | ||
|
|
5b40cfa272 | ||
|
|
fcda28ba75 | ||
|
|
7cd434225f | ||
|
|
78e5ba89fa | ||
|
|
ebb8f209b0 | ||
|
|
73afd667e1 | ||
|
|
cc294a6cf1 | ||
|
|
458a9416c6 | ||
|
|
b9eeb89250 | ||
|
|
a6e68b481d | ||
|
|
a19a896e88 | ||
|
|
cdee5b7cde | ||
|
|
dec78c8ef1 | ||
|
|
fb62a5d42a | ||
|
|
a9b5081a08 | ||
|
|
3886a697b5 | ||
|
|
3dab2bd00a | ||
|
|
95f7a7eeef | ||
|
|
ca50c2153e | ||
|
|
c73d870f46 | ||
|
|
ab54cb3dc5 | ||
|
|
c33b11d09f | ||
|
|
4966423d96 | ||
|
|
2fb55d3874 | ||
|
|
d2238615e3 | ||
|
|
2fcbe6df52 | ||
|
|
467f9987a1 | ||
|
|
8fbecaee5e | ||
|
|
55d581481f | ||
|
|
a0b405f902 | ||
|
|
b37f9ac64a | ||
|
|
2dad42679d | ||
|
|
ea00f0f222 | ||
|
|
f3ae1b4116 | ||
|
|
67009170d1 | ||
|
|
2b399b1791 | ||
|
|
0bec9ec1ae | ||
|
|
25a4bd6d25 | ||
|
|
5755ac022f | ||
|
|
0158f52ee2 | ||
|
|
0db4a6beac | ||
|
|
575e5fc196 | ||
|
|
0e45dd9b8f | ||
|
|
ae516b6bd3 | ||
|
|
7137f6e261 | ||
|
|
92b241b560 | ||
|
|
2b3ab1799b | ||
|
|
4657e57766 | ||
|
|
21660334e4 | ||
|
|
97af8b6fdb | ||
|
|
934bd2682f | ||
|
|
b8e9628140 | ||
|
|
b3b7a91a64 | ||
|
|
ebc941f265 | ||
|
|
842a6ce5c8 | ||
|
|
2d978c32b8 | ||
|
|
e386dd0d68 | ||
|
|
5a2cc884c1 | ||
|
|
a362d06dff | ||
|
|
0e73448ea8 | ||
|
|
a7966b6597 | ||
|
|
2d5c6310a9 | ||
|
|
c9bcee536e | ||
|
|
1605744278 | ||
|
|
ce0d2833a3 | ||
|
|
74db05ff1e | ||
|
|
9468e0224a | ||
|
|
cb89781a55 | ||
|
|
3de0765893 | ||
|
|
ce0e5b664f | ||
|
|
eec36896c3 | ||
|
|
00cf8052de | ||
|
|
74b8730f0f | ||
|
|
1b45bec411 | ||
|
|
21163f491d | ||
|
|
a54e07bfb2 | ||
|
|
0dea692199 | ||
|
|
dc457414d1 | ||
|
|
e1d09004eb | ||
|
|
640fa8b1be | ||
|
|
2bcbdffd89 | ||
|
|
6c8a4dd361 | ||
|
|
e9941f7ac8 | ||
|
|
5a465a5cf2 | ||
|
|
6aa2419cfd | ||
|
|
712ed6d2ff | ||
|
|
53d5e61b33 | ||
|
|
324931ca8f | ||
|
|
edc0638640 | ||
|
|
e1ea72a5fb | ||
|
|
5eb55e0fb2 | ||
|
|
9226dd833b | ||
|
|
25c908c558 | ||
|
|
16e91b5dcc | ||
|
|
01d17e5c4b | ||
|
|
a1d707ac81 | ||
|
|
4ad6ea3545 | ||
|
|
70a0aff4e7 | ||
|
|
aaacf65f41 | ||
|
|
cd8ce90e19 | ||
|
|
812d019d12 | ||
|
|
881b212690 | ||
|
|
223c0e8816 | ||
|
|
ceca478180 | ||
|
|
7963e97469 | ||
|
|
0080c080cd | ||
|
|
405451e34c | ||
|
|
a772b1a754 | ||
|
|
ffc4668e0b | ||
|
|
56a7f038dc | ||
|
|
3ba4e34662 | ||
|
|
515233ca56 | ||
|
|
423808a095 | ||
|
|
f22a69b487 | ||
|
|
bcf5a5c5e0 | ||
|
|
e0c9de0b1d | ||
|
|
94e4a3bdda | ||
|
|
b7b3bb7d05 | ||
|
|
f0161c7274 | ||
|
|
4b40e94b03 | ||
|
|
1c9632dcc3 | ||
|
|
cc0c2ffc50 | ||
|
|
f812b124d7 | ||
|
|
a785465222 | ||
|
|
078f3f8faf |
105
.gitignore
vendored
Normal file
105
.gitignore
vendored
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
#
|
||||||
|
# NOTE! Don't add files that are generated in specific
|
||||||
|
# subdirectories here. Add them in the ".gitignore" file
|
||||||
|
# in that subdirectory instead.
|
||||||
|
#
|
||||||
|
# NOTE! Please use 'git ls-files -i --exclude-standard'
|
||||||
|
# command after changing this file, to see if there are
|
||||||
|
# any tracked files which get ignored after the change.
|
||||||
|
#
|
||||||
|
# Normal rules
|
||||||
|
#
|
||||||
|
.*
|
||||||
|
*.o
|
||||||
|
*.o.*
|
||||||
|
*.a
|
||||||
|
*.s
|
||||||
|
*.ko
|
||||||
|
*.so
|
||||||
|
*.so.dbg
|
||||||
|
*.mod.c
|
||||||
|
*.i
|
||||||
|
*.lst
|
||||||
|
*.symtypes
|
||||||
|
*.order
|
||||||
|
modules.builtin
|
||||||
|
*.elf
|
||||||
|
*.bin
|
||||||
|
*.gz
|
||||||
|
*.bz2
|
||||||
|
*.lzma
|
||||||
|
*.patch
|
||||||
|
*.gcno
|
||||||
|
|
||||||
|
#
|
||||||
|
# Top-level generic files
|
||||||
|
#
|
||||||
|
/tags
|
||||||
|
/TAGS
|
||||||
|
/linux
|
||||||
|
/vmlinux
|
||||||
|
/vmlinuz
|
||||||
|
/System.map
|
||||||
|
/Module.markers
|
||||||
|
/Module.symvers
|
||||||
|
|
||||||
|
#
|
||||||
|
# git files that we don't want to ignore even it they are dot-files
|
||||||
|
#
|
||||||
|
!.gitignore
|
||||||
|
!.mailmap
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generated include files
|
||||||
|
#
|
||||||
|
include/config
|
||||||
|
include/linux/version.h
|
||||||
|
include/generated
|
||||||
|
|
||||||
|
# stgit generated dirs
|
||||||
|
patches-*
|
||||||
|
|
||||||
|
# quilt's files
|
||||||
|
patches
|
||||||
|
series
|
||||||
|
|
||||||
|
# cscope files
|
||||||
|
cscope.*
|
||||||
|
ncscope.*
|
||||||
|
|
||||||
|
# gnu global files
|
||||||
|
GPATH
|
||||||
|
GRTAGS
|
||||||
|
GSYMS
|
||||||
|
GTAGS
|
||||||
|
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
\#*#
|
||||||
|
*.lo
|
||||||
|
*.la
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
aclocal.m4
|
||||||
|
autoconfig.h
|
||||||
|
autoconfig.h.in
|
||||||
|
autom4te.cache/
|
||||||
|
build-aux/
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
configure
|
||||||
|
libtool
|
||||||
|
libupnp.pc
|
||||||
|
m4/libtool.m4
|
||||||
|
m4/ltoptions.m4
|
||||||
|
m4/ltsugar.m4
|
||||||
|
m4/ltversion.m4
|
||||||
|
m4/lt~obsolete.m4
|
||||||
|
stamp-h1
|
||||||
|
upnp/inc/stamp-h2
|
||||||
|
upnp/inc/upnpconfig.h
|
||||||
|
upnp/sample/upnp_tv_combo
|
||||||
|
upnp/sample/upnp_tv_ctrlpt
|
||||||
|
upnp/sample/upnp_tv_device
|
||||||
|
docs/doxygen
|
||||||
|
|
||||||
12
Doxyfile
12
Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = libUPnP
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 1.4.7
|
PROJECT_NUMBER = 1.6.9
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# 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
|
# Doxygen will generate a detailed section even if there is only a brief
|
||||||
# description.
|
# description.
|
||||||
|
|
||||||
ALWAYS_DETAILED_SEC = NO
|
ALWAYS_DETAILED_SEC = YES
|
||||||
|
|
||||||
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
|
# 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
|
# 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.
|
# to NO (the default) then the documentation will be excluded.
|
||||||
# Set it to YES to include the internal documentation.
|
# 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
|
# 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
|
# 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
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# 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
|
# 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
|
# 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
|
# compilation will be performed. Macro expansion can be done in a controlled
|
||||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
# 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
|
# 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
|
# 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
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of 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
|
# 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.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
|||||||
21
Makefile.am
21
Makefile.am
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Top-level "Makefile.am" for libupnp
|
# Top-level "Makefile.am" for libupnp
|
||||||
#
|
#
|
||||||
# Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
@@ -16,6 +16,7 @@ SUBDIRS = \
|
|||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
|
Doxyfile \
|
||||||
libupnp.pc.in \
|
libupnp.pc.in \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
THANKS \
|
THANKS \
|
||||||
@@ -25,9 +26,23 @@ EXTRA_DIST = \
|
|||||||
build/libupnp.dsp \
|
build/libupnp.dsp \
|
||||||
build/libupnp.dsw \
|
build/libupnp.dsw \
|
||||||
build/inc/autoconfig.h \
|
build/inc/autoconfig.h \
|
||||||
build/inc/config.h \
|
|
||||||
build/inc/upnpconfig.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
|
# This variable must have 'exec' in its name, in order to be installed
|
||||||
|
|||||||
2
README
2
README
@@ -1,7 +1,7 @@
|
|||||||
Portable SDK for UPnP* Devices (libupnp)
|
Portable SDK for UPnP* Devices (libupnp)
|
||||||
|
|
||||||
Copyright (c) 2000-2003 Intel Corporation - All Rights Reserved.
|
Copyright (c) 2000-2003 Intel Corporation - All Rights Reserved.
|
||||||
Copyright (c) 2005-2006 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
Copyright (c) 2005-2006 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||||
Copyright (c) 2006 Michel Pfeiffer and others <virtual_worlds@gmx.de>
|
Copyright (c) 2006 Michel Pfeiffer and others <virtual_worlds@gmx.de>
|
||||||
|
|
||||||
See LICENSE for details.
|
See LICENSE for details.
|
||||||
|
|||||||
14
THANKS
14
THANKS
@@ -7,11 +7,20 @@ Here is a list of these people. Help us keep it complete and
|
|||||||
exempt of errors.
|
exempt of errors.
|
||||||
|
|
||||||
- Alex (afaucher)
|
- Alex (afaucher)
|
||||||
|
- Andre Sodermans (wienerschnitzel)
|
||||||
|
- Anthony Viallard (homer242)
|
||||||
|
- Apostolos Syropoulos
|
||||||
- Arno Willig
|
- Arno Willig
|
||||||
- Bob Ciora
|
- Bob Ciora
|
||||||
|
- Carlo Parata
|
||||||
|
- Carl Benson
|
||||||
|
- Chandra (inactiveneurons)
|
||||||
- Chaos
|
- Chaos
|
||||||
|
- Charles Nepveu (cnepveu)
|
||||||
- Chris Pickel
|
- Chris Pickel
|
||||||
|
- Chuck Thomason (cyt4)
|
||||||
- Craig Nelson
|
- Craig Nelson
|
||||||
|
- David Blanchet
|
||||||
- David Maass
|
- David Maass
|
||||||
- Emil Ljungdahl
|
- Emil Ljungdahl
|
||||||
- Erik Johansson
|
- Erik Johansson
|
||||||
@@ -30,16 +39,19 @@ exempt of errors.
|
|||||||
- Keith Brindley
|
- Keith Brindley
|
||||||
- Leuk_He
|
- Leuk_He
|
||||||
- Loigu
|
- Loigu
|
||||||
- Luke Kim
|
- Luke Kim (nereusuj)
|
||||||
- Marcelo Roberto Jimenez (mroberto)
|
- Marcelo Roberto Jimenez (mroberto)
|
||||||
- Markus Strobl
|
- Markus Strobl
|
||||||
- Nektarios K. Papadopoulos (npapadop)
|
- Nektarios K. Papadopoulos (npapadop)
|
||||||
|
- Nicholas Kraft
|
||||||
|
- Nick Leverton (leveret)
|
||||||
- Oskar Liljeblad
|
- Oskar Liljeblad
|
||||||
- Michael (oxygenic)
|
- Michael (oxygenic)
|
||||||
- Paul Vixie
|
- Paul Vixie
|
||||||
- Peter Hartley
|
- Peter Hartley
|
||||||
- Rene Hexel
|
- Rene Hexel
|
||||||
- Robert Gingher (robsbox)
|
- Robert Gingher (robsbox)
|
||||||
|
- Ronan Menard
|
||||||
- Siva Chandran
|
- Siva Chandran
|
||||||
- Stéphane Corthésy
|
- Stéphane Corthésy
|
||||||
- Steve Bresson
|
- Steve Bresson
|
||||||
|
|||||||
23
TODO
23
TODO
@@ -2,28 +2,5 @@
|
|||||||
To Be Done
|
To Be Done
|
||||||
==========
|
==========
|
||||||
|
|
||||||
- add FreeBSD patches
|
|
||||||
( http://sf.net/tracker/index.php?func=detail&aid=1332618&group_id=7189&atid=307189 ?)
|
|
||||||
|
|
||||||
- non-regression testing
|
- non-regression testing
|
||||||
|
|
||||||
- replace doc++ by Doxygen for documentation generation
|
|
||||||
|
|
||||||
- incorporate public patches and fix reported bugs :
|
|
||||||
http://sourceforge.net/tracker/?group_id=7189&atid=107189 and
|
|
||||||
http://sourceforge.net/tracker/?group_id=7189&atid=307189
|
|
||||||
|
|
||||||
- RPM packaging (a preliminary one here :
|
|
||||||
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=176617 )
|
|
||||||
|
|
||||||
- make API clean for large files and 64 bits
|
|
||||||
|
|
||||||
|
|
||||||
To Be Decided
|
|
||||||
=============
|
|
||||||
|
|
||||||
- IPV6 support ?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,9 +67,6 @@
|
|||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
#define HAVE_SYS_STAT_H 1
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/timeb.h> header file. */
|
|
||||||
#define HAVE_SYS_TIMEB_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
#define HAVE_SYS_TIME_H 1
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
@@ -82,6 +79,13 @@
|
|||||||
/* Define to 1 if you have the `vprintf' function. */
|
/* Define to 1 if you have the `vprintf' function. */
|
||||||
#define HAVE_VPRINTF 1
|
#define HAVE_VPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ws2tcpip.h> header file. */
|
||||||
|
/* #undef HAVE_WS2TCPIP_H */
|
||||||
|
|
||||||
|
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||||
|
*/
|
||||||
|
#define LT_OBJDIR ".libs/"
|
||||||
|
|
||||||
/* Define to 1 to prevent compilation of assert() */
|
/* Define to 1 to prevent compilation of assert() */
|
||||||
#define NDEBUG 1
|
#define NDEBUG 1
|
||||||
|
|
||||||
@@ -101,13 +105,13 @@
|
|||||||
#define PACKAGE_NAME "libupnp"
|
#define PACKAGE_NAME "libupnp"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "libupnp 1.4.7"
|
#define PACKAGE_STRING "libupnp 1.6.9"
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
/* Define to the one symbol short name of this package. */
|
||||||
#define PACKAGE_TARNAME "libupnp"
|
#define PACKAGE_TARNAME "libupnp"
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
/* Define to the version of this package. */
|
||||||
#define PACKAGE_VERSION "1.4.7"
|
#define PACKAGE_VERSION "1.6.9"
|
||||||
|
|
||||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||||
your system. */
|
your system. */
|
||||||
@@ -116,6 +120,12 @@
|
|||||||
/* Define to 1 if you have the ANSI C header files. */
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* see upnpconfig.h */
|
||||||
|
/* #undef UPNP_ENABLE_IPV6 */
|
||||||
|
|
||||||
|
/* see upnpconfig.h */
|
||||||
|
#define UPNP_ENABLE_NOTIFICATION_REORDERING 1
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_HAVE_CLIENT 1
|
#define UPNP_HAVE_CLIENT 1
|
||||||
|
|
||||||
@@ -131,20 +141,23 @@
|
|||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_HAVE_WEBSERVER 1
|
#define UPNP_HAVE_WEBSERVER 1
|
||||||
|
|
||||||
|
/* Do not use pthread_rwlock_t */
|
||||||
|
#define UPNP_USE_RWLOCK 1
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_MAJOR 1
|
#define UPNP_VERSION_MAJOR 1
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_MINOR 4
|
#define UPNP_VERSION_MINOR 6
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_PATCH 7
|
#define UPNP_VERSION_PATCH 9
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_STRING "1.4.7"
|
#define UPNP_VERSION_STRING "1.6.9"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "1.4.7"
|
#define VERSION "1.6.9"
|
||||||
|
|
||||||
/* File Offset size */
|
/* File Offset size */
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
@@ -153,7 +166,7 @@
|
|||||||
/* #undef _LARGEFILE_SOURCE */
|
/* #undef _LARGEFILE_SOURCE */
|
||||||
|
|
||||||
/* Large files support */
|
/* Large files support */
|
||||||
#define _LARGE_FILE_SOURCE
|
#define _LARGE_FILE_SOURCE /**/
|
||||||
|
|
||||||
/* Define to empty if `const' does not conform to ANSI C. */
|
/* Define to empty if `const' does not conform to ANSI C. */
|
||||||
/* #undef const */
|
/* #undef const */
|
||||||
@@ -164,5 +177,5 @@
|
|||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
/* #undef size_t */
|
/* #undef size_t */
|
||||||
|
|
||||||
/* Substitute for socklen_t */
|
/* Type for storing the length of struct sockaddr */
|
||||||
/* #undef socklen_t */
|
/* #undef socklen_t */
|
||||||
|
|||||||
@@ -1,343 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef INTERNAL_CONFIG_H
|
|
||||||
#define INTERNAL_CONFIG_H
|
|
||||||
|
|
||||||
#include "autoconfig.h"
|
|
||||||
|
|
||||||
|
|
||||||
/** @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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* for making connections to other control points and devices. It is not
|
|
||||||
* recommended that this value be below 10, since the threads are
|
|
||||||
* 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
|
|
||||||
* The {\tt MAX_JOBS_TOTAL} constant determines the maximum number of jobs
|
|
||||||
* that can be queued. If this limit is reached further jobs will be thrown
|
|
||||||
* to avoid memory exhaustion. The default value 100.
|
|
||||||
* (Added by Axis.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MAX_JOBS_TOTAL 100
|
|
||||||
//@}
|
|
||||||
|
|
||||||
/** @name DEFAULT_SOAP_CONTENT_LENGTH
|
|
||||||
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
|
||||||
* This prevents devices that have a misbehaving web server to send
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* subscription renewal not making it to the device in time, causing the
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
* the values below to 0, that component will not be included in the final
|
|
||||||
* SDK.
|
|
||||||
* \begin{itemize}
|
|
||||||
* \item {\tt EXCLUDE_SOAP[0,1]}
|
|
||||||
* \item {\tt EXCLUDE_GENA[0,1]}
|
|
||||||
* \item {\tt EXCLUDE_SSDP[0,1]}
|
|
||||||
* \item {\tt EXCLUDE_DOM [0,1]}
|
|
||||||
* \item {\tt EXCLUDE_MINISERVER[0,1]}
|
|
||||||
* \item {\tt EXCLUDE_WEB_SERVER[0,1]}
|
|
||||||
* \item {\tt EXCLUDE_JNI[0,1]}
|
|
||||||
* \end{itemize}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
//@{
|
|
||||||
#define EXCLUDE_SSDP 0
|
|
||||||
#define EXCLUDE_SOAP 0
|
|
||||||
#define EXCLUDE_GENA 0
|
|
||||||
#define EXCLUDE_DOM 0
|
|
||||||
#define EXCLUDE_MINISERVER 0
|
|
||||||
#define EXCLUDE_WEB_SERVER 0
|
|
||||||
#ifdef USE_JNI
|
|
||||||
# define EXCLUDE_JNI 0
|
|
||||||
#else
|
|
||||||
# define EXCLUDE_JNI 1
|
|
||||||
#endif
|
|
||||||
//@}
|
|
||||||
|
|
||||||
|
|
||||||
/** @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>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DEBUG_ALL 1
|
|
||||||
#define DEBUG_SSDP 0
|
|
||||||
#define DEBUG_SOAP 0
|
|
||||||
#define DEBUG_GENA 0
|
|
||||||
#define DEBUG_TPOOL 0
|
|
||||||
#define DEBUG_MSERV 0
|
|
||||||
#define DEBUG_DOM 0
|
|
||||||
#define DEBUG_HTTP 0
|
|
||||||
#define DEBUG_API 0
|
|
||||||
|
|
||||||
//@} // Compile time configuration options
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* Do not change, Internal purpose only!!!
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
//@{
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set additional defines based on requested configuration
|
|
||||||
*/
|
|
||||||
|
|
||||||
// configure --enable-client
|
|
||||||
#if UPNP_HAVE_CLIENT
|
|
||||||
# define INCLUDE_CLIENT_APIS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// configure --enable-device
|
|
||||||
#if UPNP_HAVE_DEVICE
|
|
||||||
# define INCLUDE_DEVICE_APIS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 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
|
|
||||||
# define EXCLUDE_WEB_SERVER 0
|
|
||||||
# define EXCLUDE_MINISERVER 0
|
|
||||||
#else
|
|
||||||
# define EXCLUDE_WEB_SERVER 1
|
|
||||||
# define EXCLUDE_MINISERVER 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1
|
|
||||||
# undef EXCLUDE_MINISERVER
|
|
||||||
# define EXCLUDE_MINISERVER 1
|
|
||||||
# if INTERNAL_WEB_SERVER
|
|
||||||
# error "conflicting settings: use configure --disable-webserver"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0
|
|
||||||
# undef EXCLUDE_MINISERVER
|
|
||||||
# define EXCLUDE_MINISERVER 0
|
|
||||||
# if EXCLUDE_WEB_SERVER == 0 && !defined INTERNAL_WEB_SERVER
|
|
||||||
# error "conflicting settings : use configure --enable-webserver"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
|
||||||
# define CLIENTONLY(x) x
|
|
||||||
#else
|
|
||||||
# define CLIENTONLY(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//@}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
/* upnp/inc/upnpconfig.h. Generated from upnpconfig.h.in by configure. */
|
/* upnp/inc/upnpconfig.h. Generated from upnpconfig.h.in by configure. */
|
||||||
// -*- C -*-
|
/* -*- C -*- */
|
||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2006 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
* Copyright (c) 2006 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef UPNP_CONFIG_H
|
#ifndef UPNP_CONFIG_H
|
||||||
#define UPNP_CONFIG_H
|
#define UPNP_CONFIG_H
|
||||||
@@ -40,16 +40,16 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
/** The library version (string) e.g. "1.3.0" */
|
/** The library version (string) e.g. "1.3.0" */
|
||||||
#define UPNP_VERSION_STRING "1.4.7"
|
#define UPNP_VERSION_STRING "1.6.9"
|
||||||
|
|
||||||
/** Major version of the library */
|
/** Major version of the library */
|
||||||
#define UPNP_VERSION_MAJOR 1
|
#define UPNP_VERSION_MAJOR 1
|
||||||
|
|
||||||
/** Minor version of the library */
|
/** Minor version of the library */
|
||||||
#define UPNP_VERSION_MINOR 4
|
#define UPNP_VERSION_MINOR 6
|
||||||
|
|
||||||
/** Patch version of the library */
|
/** Patch version of the library */
|
||||||
#define UPNP_VERSION_PATCH 7
|
#define UPNP_VERSION_PATCH 9
|
||||||
|
|
||||||
/** The library version (numeric) e.g. 10300 means version 1.3.0 */
|
/** The library version (numeric) e.g. 10300 means version 1.3.0 */
|
||||||
#define UPNP_VERSION \
|
#define UPNP_VERSION \
|
||||||
@@ -91,7 +91,9 @@
|
|||||||
* (i.e. configure --enable-tools) : <upnp/upnptools.h> file is available */
|
* (i.e. configure --enable-tools) : <upnp/upnptools.h> file is available */
|
||||||
#define UPNP_HAVE_TOOLS 1
|
#define UPNP_HAVE_TOOLS 1
|
||||||
|
|
||||||
|
/** Defined to 1 if the library has been compiled with ipv6 support
|
||||||
|
* (i.e. configure --enable-ipv6) */
|
||||||
|
/* #undef UPNP_ENABLE_IPV6 */
|
||||||
|
|
||||||
#endif // UPNP_CONFIG_H
|
#endif /* UPNP_CONFIG_H */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,17 @@
|
|||||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||||
|
|
||||||
CFG=libupnp - Win32 Debug
|
CFG=libupnp - Win32 Debug
|
||||||
!MESSAGE Dies ist kein g<EFBFBD>ltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<EFBFBD>hren Sie den Befehl
|
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libupnp.mak".
|
!MESSAGE NMAKE /f "libupnp.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Sie k<EFBFBD>nnen beim Ausf<EFBFBD>hren von NMAKE eine Konfiguration angeben
|
!MESSAGE Sie können beim Ausf?hren von NMAKE eine Konfiguration angeben
|
||||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "libupnp.mak" CFG="libupnp - Win32 Debug"
|
!MESSAGE NMAKE /f "libupnp.mak" CFG="libupnp - Win32 Debug"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE F<EFBFBD>r die Konfiguration stehen zur Auswahl:
|
!MESSAGE Für die Konfiguration stehen zur Auswahl:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "libupnp - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
|
!MESSAGE "libupnp - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
|
||||||
!MESSAGE "libupnp - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
|
!MESSAGE "libupnp - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
|
||||||
@@ -389,10 +389,6 @@ SOURCE=..\upnp\src\inc\upnpapi.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\upnp\src\inc\upnpclosesocket.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\upnp\src\inc\uri.h
|
SOURCE=..\upnp\src\inc\uri.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
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
|
||||||
650
build/vc8/libupnp.vcproj
Normal file
650
build/vc8/libupnp.vcproj
Normal file
@@ -0,0 +1,650 @@
|
|||||||
|
<?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\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
|
||||||
646
build/vc9/libupnp.vcproj
Normal file
646
build/vc9/libupnp.vcproj
Normal file
@@ -0,0 +1,646 @@
|
|||||||
|
<?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\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>
|
||||||
158
configure.ac
158
configure.ac
@@ -4,12 +4,12 @@
|
|||||||
#
|
#
|
||||||
# Process this file with autoconf to produce a configure script.
|
# 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_PREREQ(2.60)
|
||||||
|
|
||||||
AC_INIT([libupnp], [1.6.4], [mroberto@users.sourceforge.net])
|
AC_INIT([libupnp], [1.6.9], [mroberto@users.sourceforge.net])
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
dnl # *Independently* of the above libupnp package version, the libtool version
|
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 # of the 3 libraries need to be updated whenever there is a change released:
|
||||||
@@ -120,9 +120,83 @@ dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
|
|||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:3:0])
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:3:0])
|
||||||
dnl #
|
dnl #
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
dnl # Release 1.6.5:
|
||||||
AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
|
dnl # "current:revision:age"
|
||||||
AC_SUBST([LT_VERSION_UPNP], [3:3:0])
|
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.6.7:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 3 -> 4
|
||||||
|
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 # - Interfaces removed in upnp:
|
||||||
|
dnl # age: -> 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], [3:5:0])
|
||||||
|
dnl #
|
||||||
|
dnl # Obs.: 1.6.7 was released with a version error, the correct nubers should
|
||||||
|
dnl # have been:
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [4:0:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.8:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in ixml
|
||||||
|
dnl # revision: 4 -> 5
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 0 -> 1
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 0 -> 1
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:5:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:1:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [4:1:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.9:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 1 -> 2
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 1 -> 2
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:5:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:2:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [4:2:0])
|
||||||
|
dnl #
|
||||||
|
############################################################################
|
||||||
|
AC_SUBST([LT_VERSION_IXML], [2:5:0])
|
||||||
|
AC_SUBST([LT_VERSION_THREADUTIL], [5:2:2])
|
||||||
|
AC_SUBST([LT_VERSION_UPNP], [4:2:0])
|
||||||
dnl ############################################################################
|
dnl ############################################################################
|
||||||
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
||||||
dnl # - library code modified: revision++
|
dnl # - library code modified: revision++
|
||||||
@@ -216,6 +290,16 @@ if test "x$enable_tools" = xyes ; then
|
|||||||
AC_DEFINE(UPNP_HAVE_TOOLS, 1, [see upnpconfig.h])
|
AC_DEFINE(UPNP_HAVE_TOOLS, 1, [see upnpconfig.h])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
RT_BOOL_ARG_ENABLE([ipv6], [no], [ipv6 support])
|
||||||
|
if test "x$enable_ipv6" = xyes ; then
|
||||||
|
AC_DEFINE(UPNP_ENABLE_IPV6, 1, [see upnpconfig.h])
|
||||||
|
fi
|
||||||
|
|
||||||
|
RT_BOOL_ARG_ENABLE([notification_reordering], [yes], [GENA notification reordering in gena_device.c])
|
||||||
|
if test "x$enable_notification_reordering" = xyes ; then
|
||||||
|
AC_DEFINE(UPNP_ENABLE_NOTIFICATION_REORDERING, 1, [see upnpconfig.h])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
||||||
|
|
||||||
@@ -277,7 +361,9 @@ freebsd*)
|
|||||||
echo "Using non-specific system compiler settings"
|
echo "Using non-specific system compiler settings"
|
||||||
if test x"$enable_debug" = xyes; then
|
if test x"$enable_debug" = xyes; then
|
||||||
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
# 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
|
else
|
||||||
# add optimise for size
|
# add optimise for size
|
||||||
AX_CFLAGS_GCC_OPTION([-Os])
|
AX_CFLAGS_GCC_OPTION([-Os])
|
||||||
@@ -299,9 +385,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
|
AC_HEADER_STDC
|
||||||
|
if test "$ac_cv_win32" = "no"; then
|
||||||
# libupnp code doesn't use autoconf variables yet,
|
# libupnp code doesn't use autoconf variables yet,
|
||||||
# so just abort if a header file is not found.
|
# so just abort if a header file is not found.
|
||||||
AC_CHECK_HEADERS(
|
AC_CHECK_HEADERS(
|
||||||
@@ -317,19 +420,43 @@ AC_CHECK_HEADERS(
|
|||||||
sys/ioctl.h \
|
sys/ioctl.h \
|
||||||
sys/socket.h \
|
sys/socket.h \
|
||||||
sys/time.h \
|
sys/time.h \
|
||||||
sys/timeb.h \
|
|
||||||
syslog.h \
|
syslog.h \
|
||||||
unistd.h \
|
unistd.h \
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
[AC_MSG_ERROR([required header file missing])])
|
[AC_MSG_ERROR([required header file missing])])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for typedefs, structures, and compiler characteristics
|
# Checks for typedefs, structures, and compiler characteristics
|
||||||
#
|
#
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -338,6 +465,11 @@ TYPE_SOCKLEN_T
|
|||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
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])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -394,3 +526,11 @@ AC_CONFIG_FILES([
|
|||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
#
|
||||||
|
# Files copied for windows compilation.
|
||||||
|
#
|
||||||
|
echo "configure: copying \"autoconfig.h\" to \"build/inc/autoconfig.h\""
|
||||||
|
cp autoconfig.h build/inc/autoconfig.h
|
||||||
|
echo "configure: copying \"upnp/inc/upnpconfig.h\" to \"build/inc/upnpconfig.h\""
|
||||||
|
cp upnp/inc/upnpconfig.h build/inc/upnpconfig.h
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# "Makefile.am" for "libupnp/ixml"
|
# "Makefile.am" for "libupnp/ixml"
|
||||||
#
|
#
|
||||||
# (C) Copyright 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
# (C) Copyright 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
SUBDIRS = doc
|
SUBDIRS = doc
|
||||||
@@ -24,15 +24,23 @@ libixml_la_LDFLAGS = -version-info $(LT_VERSION_IXML) \
|
|||||||
-export-symbols-regex '^ixml.*'
|
-export-symbols-regex '^ixml.*'
|
||||||
|
|
||||||
libixml_la_SOURCES = \
|
libixml_la_SOURCES = \
|
||||||
src/ixml.c src/node.c src/ixmlparser.c \
|
src/attr.c \
|
||||||
src/ixmlmembuf.c src/nodeList.c \
|
src/document.c \
|
||||||
src/element.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/namedNodeMap.c \
|
||||||
src/inc/ixmlmembuf.h src/inc/ixmlparser.h
|
src/node.c \
|
||||||
|
src/nodeList.c
|
||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = inc/ixml.h
|
upnpinclude_HEADERS = \
|
||||||
|
inc/ixml.h \
|
||||||
|
inc/ixmldebug.h
|
||||||
|
|
||||||
check_PROGRAMS = test_document
|
check_PROGRAMS = test_document
|
||||||
TESTS = test/test_document.sh
|
TESTS = test/test_document.sh
|
||||||
@@ -47,4 +55,3 @@ dist-hook:
|
|||||||
clean-local:
|
clean-local:
|
||||||
@if [ -d bin ] ; then rm -rf bin ; fi
|
@if [ -d bin ] ; then rm -rf bin ; fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2640
ixml/inc/ixml.h
2640
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
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* Function: Attr_init
|
#include <string.h>
|
||||||
* Initializes an attribute node
|
|
||||||
* External function.
|
|
||||||
*
|
void ixmlAttr_init(IN IXML_Attr *attr)
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlAttr_init( IN IXML_Attr * attr )
|
|
||||||
{
|
{
|
||||||
if (attr != NULL) {
|
if (attr != NULL) {
|
||||||
memset(attr, 0, sizeof (IXML_Attr));
|
memset(attr, 0, sizeof (IXML_Attr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* Function: Attr_free
|
void ixmlAttr_free(IN IXML_Attr *attr)
|
||||||
* Frees an attribute node.
|
|
||||||
* external function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlAttr_free( IN IXML_Attr * attr )
|
|
||||||
{
|
{
|
||||||
if (attr != NULL) {
|
if (attr != NULL) {
|
||||||
ixmlNode_free((IXML_Node *)attr);
|
ixmlNode_free((IXML_Node *)attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,119 +1,97 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ixmldebug.h"
|
||||||
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
|
||||||
|
|
||||||
/*================================================================
|
void ixmlDocument_init(IXML_Document *doc)
|
||||||
* ixmlDocument_init
|
|
||||||
* It initialize the document structure.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlDocument_init( IN IXML_Document * doc )
|
|
||||||
{
|
{
|
||||||
memset(doc, 0, sizeof(IXML_Document));
|
memset(doc, 0, sizeof(IXML_Document));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_free
|
void ixmlDocument_free(IXML_Document *doc)
|
||||||
* It frees the whole document tree.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlDocument_free( IN IXML_Document * doc )
|
|
||||||
{
|
{
|
||||||
if (doc != NULL) {
|
if (doc != NULL) {
|
||||||
ixmlNode_free((IXML_Node *)doc);
|
ixmlNode_free((IXML_Node *)doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_setOwnerDocument
|
/*!
|
||||||
*
|
* When this function is called first time, nodeptr is the root of the subtree,
|
||||||
* When this function is called first time, nodeptr is the root
|
* so it is not necessay to do two steps recursion.
|
||||||
* of the subtree, so it is not necessay to do two steps
|
|
||||||
* recursion.
|
|
||||||
*
|
*
|
||||||
* Internal function called by ixmlDocument_importNode
|
* Internal function called by ixmlDocument_importNode
|
||||||
*
|
*/
|
||||||
*=================================================================*/
|
static void ixmlDocument_setOwnerDocument(
|
||||||
void
|
/*! [in] The document node. */
|
||||||
ixmlDocument_setOwnerDocument( IN IXML_Document * doc,
|
IXML_Document *doc,
|
||||||
IN IXML_Node * nodeptr )
|
/*! [in] \todo documentation. */
|
||||||
|
IXML_Node *nodeptr)
|
||||||
{
|
{
|
||||||
if (nodeptr != NULL) {
|
if (nodeptr != NULL) {
|
||||||
nodeptr->ownerDocument = doc;
|
nodeptr->ownerDocument = doc;
|
||||||
ixmlDocument_setOwnerDocument( doc,
|
ixmlDocument_setOwnerDocument(
|
||||||
ixmlNode_getFirstChild( nodeptr ) );
|
doc, ixmlNode_getFirstChild(nodeptr));
|
||||||
ixmlDocument_setOwnerDocument( doc,
|
ixmlDocument_setOwnerDocument(
|
||||||
ixmlNode_getNextSibling
|
doc, ixmlNode_getNextSibling(nodeptr));
|
||||||
( 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
|
int ixmlDocument_importNode(
|
||||||
* by the importing document, with attribute values identical to
|
IXML_Document *doc,
|
||||||
* the source node's nodeName and nodeType, plus the attributes
|
IXML_Node *importNode,
|
||||||
* related to namespaces (prefix, localName, and namespaceURI).
|
BOOL deep,
|
||||||
* As in the cloneNode operation on a node, the source node is
|
IXML_Node **rtNode)
|
||||||
* not altered.
|
|
||||||
*
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
int
|
|
||||||
ixmlDocument_importNode( IN IXML_Document * doc,
|
|
||||||
IN IXML_Node * importNode,
|
|
||||||
IN BOOL deep,
|
|
||||||
OUT IXML_Node ** rtNode )
|
|
||||||
{
|
{
|
||||||
unsigned short nodeType;
|
unsigned short nodeType;
|
||||||
IXML_Node *newNode;
|
IXML_Node *newNode;
|
||||||
|
|
||||||
*rtNode = NULL;
|
*rtNode = NULL;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( importNode == NULL ) ) {
|
if (doc == NULL || importNode == NULL) {
|
||||||
return IXML_INVALID_PARAMETER;
|
return IXML_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,29 +111,16 @@ ixmlDocument_importNode( IN IXML_Document * doc,
|
|||||||
return IXML_SUCCESS;
|
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;
|
int errCode = IXML_SUCCESS;
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
if (doc == NULL || tagName == NULL) {
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
@@ -188,46 +153,23 @@ ixmlDocument_createElementEx( IN IXML_Document * doc,
|
|||||||
|
|
||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtElement = newElement;
|
*rtElement = newElement;
|
||||||
return errCode;
|
|
||||||
|
|
||||||
|
return errCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createElement
|
IXML_Element *ixmlDocument_createElement(
|
||||||
* Creates an element of the type specified.
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString tagName)
|
||||||
* 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 *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
|
|
||||||
ixmlDocument_createElementEx(doc, tagName, &newElement);
|
ixmlDocument_createElementEx(doc, tagName, &newElement);
|
||||||
return newElement;
|
return newElement;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createDocumentEx
|
int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
IXML_Document *doc;
|
IXML_Document *doc;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
@@ -257,49 +199,27 @@ ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
|
|||||||
return errCode;
|
return errCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createDocument
|
IXML_Document *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 *doc = NULL;
|
IXML_Document *doc = NULL;
|
||||||
|
|
||||||
ixmlDocument_createDocumentEx(&doc);
|
ixmlDocument_createDocumentEx(&doc);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createTextNodeEx
|
int ixmlDocument_createTextNodeEx(
|
||||||
* Creates an text node.
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString data,
|
||||||
* Parameters:
|
IXML_Node **textNode)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
IXML_Node *returnNode;
|
IXML_Node *returnNode;
|
||||||
int rc = IXML_SUCCESS;
|
int rc = IXML_SUCCESS;
|
||||||
|
|
||||||
returnNode = NULL;
|
returnNode = NULL;
|
||||||
if( ( doc == NULL ) || ( data == NULL ) ) {
|
if (doc == NULL || data == NULL) {
|
||||||
rc = IXML_INVALID_PARAMETER;
|
rc = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
@@ -336,22 +256,12 @@ ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*textNode = returnNode;
|
*textNode = returnNode;
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createTextNode
|
IXML_Node *ixmlDocument_createTextNode(
|
||||||
* Creates an text node.
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString data)
|
||||||
* 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 *returnNode = NULL;
|
IXML_Node *returnNode = NULL;
|
||||||
|
|
||||||
@@ -360,21 +270,11 @@ ixmlDocument_createTextNode( IN IXML_Document * doc,
|
|||||||
return returnNode;
|
return returnNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createAttributeEx
|
int ixmlDocument_createAttributeEx(
|
||||||
* Creates an attribute of the given name.
|
IXML_Document *doc,
|
||||||
* External function.
|
const char *name,
|
||||||
* Parameters:
|
IXML_Attr **rtAttr)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
IXML_Attr *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
@@ -385,7 +285,7 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
|||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( name == NULL ) ) {
|
if (doc == NULL || name == NULL) {
|
||||||
ixmlAttr_free(attrNode);
|
ixmlAttr_free(attrNode);
|
||||||
attrNode = NULL;
|
attrNode = NULL;
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
@@ -393,7 +293,6 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ixmlAttr_init(attrNode);
|
ixmlAttr_init(attrNode);
|
||||||
|
|
||||||
attrNode->n.nodeType = eATTRIBUTE_NODE;
|
attrNode->n.nodeType = eATTRIBUTE_NODE;
|
||||||
|
|
||||||
// set the node fields
|
// set the node fields
|
||||||
@@ -410,56 +309,31 @@ ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtAttr = attrNode;
|
*rtAttr = attrNode;
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createAttribute
|
IXML_Attr *ixmlDocument_createAttribute(
|
||||||
* Creates an attribute of the given name.
|
IXML_Document *doc,
|
||||||
* External function.
|
const char *name)
|
||||||
* 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 *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
|
|
||||||
ixmlDocument_createAttributeEx(doc, name, &attrNode);
|
ixmlDocument_createAttributeEx(doc, name, &attrNode);
|
||||||
return attrNode;
|
|
||||||
|
|
||||||
|
return attrNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createAttributeNSEx
|
int ixmlDocument_createAttributeNSEx(
|
||||||
* Creates an attrbute of the given name and namespace URI
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString namespaceURI,
|
||||||
* Parameters:
|
const DOMString qualifiedName,
|
||||||
* namespaceURI: the namespace fo the attribute to create
|
IXML_Attr **rtAttr )
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
IXML_Attr *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|
||||||
|| ( qualifiedName == NULL ) ) {
|
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
@@ -489,68 +363,43 @@ ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtAttr = attrNode;
|
*rtAttr = attrNode;
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createAttributeNS
|
IXML_Attr *ixmlDocument_createAttributeNS(
|
||||||
* Creates an attrbute of the given name and namespace URI
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString namespaceURI,
|
||||||
* Parameters:
|
const DOMString qualifiedName)
|
||||||
* 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 *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
|
|
||||||
ixmlDocument_createAttributeNSEx( doc, namespaceURI, qualifiedName,
|
ixmlDocument_createAttributeNSEx(
|
||||||
&attrNode );
|
doc, namespaceURI, qualifiedName, &attrNode);
|
||||||
|
|
||||||
return attrNode;
|
return attrNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createCDATASectionEx
|
int ixmlDocument_createCDATASectionEx(
|
||||||
* Creates an CDATASection node whose value is the specified string
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString data,
|
||||||
* Parameters:
|
IXML_CDATASection **rtCD)
|
||||||
* 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 errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
IXML_CDATASection *cDSectionNode = NULL;
|
IXML_CDATASection *cDSectionNode = NULL;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( data == NULL ) ) {
|
if(doc == NULL || data == NULL) {
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
cDSectionNode =
|
cDSectionNode = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection));
|
||||||
( IXML_CDATASection * ) malloc( sizeof( IXML_CDATASection ) );
|
|
||||||
if (cDSectionNode == NULL) {
|
if (cDSectionNode == NULL) {
|
||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlCDATASection_init(cDSectionNode);
|
ixmlCDATASection_init(cDSectionNode);
|
||||||
|
|
||||||
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
|
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
|
||||||
cDSectionNode->n.nodeName = strdup(CDATANODENAME);
|
cDSectionNode->n.nodeName = strdup(CDATANODENAME);
|
||||||
if (cDSectionNode->n.nodeName == NULL) {
|
if (cDSectionNode->n.nodeName == NULL) {
|
||||||
@@ -573,80 +422,58 @@ ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtCD = cDSectionNode;
|
*rtCD = cDSectionNode;
|
||||||
return errCode;
|
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;
|
IXML_CDATASection *cDSectionNode = NULL;
|
||||||
|
|
||||||
ixmlDocument_createCDATASectionEx(doc, data, &cDSectionNode);
|
ixmlDocument_createCDATASectionEx(doc, data, &cDSectionNode);
|
||||||
|
|
||||||
return cDSectionNode;
|
return cDSectionNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_createElementNSEx
|
int ixmlDocument_createElementNSEx(
|
||||||
* Creates an element of the given qualified name and namespace URI.
|
IXML_Document *doc,
|
||||||
* External function.
|
const DOMString namespaceURI,
|
||||||
* Parameters:
|
const DOMString qualifiedName,
|
||||||
* namespaceURI: the namespace URI of the element to create.
|
IXML_Element **rtElement)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
int errCode = IXML_SUCCESS;
|
int ret = IXML_SUCCESS;
|
||||||
|
int line = 0;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|
||||||
|| ( qualifiedName == NULL ) ) {
|
line = __LINE__;
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
ret = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
errCode =
|
ret = ixmlDocument_createElementEx(doc, qualifiedName, &newElement);
|
||||||
ixmlDocument_createElementEx( doc, qualifiedName, &newElement );
|
if (ret != IXML_SUCCESS) {
|
||||||
if( errCode != IXML_SUCCESS ) {
|
line = __LINE__;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the namespaceURI field
|
// set the namespaceURI field
|
||||||
newElement->n.namespaceURI = strdup(namespaceURI);
|
newElement->n.namespaceURI = strdup(namespaceURI);
|
||||||
if (newElement->n.namespaceURI == NULL) {
|
if (newElement->n.namespaceURI == NULL) {
|
||||||
|
line = __LINE__;
|
||||||
ixmlElement_free(newElement);
|
ixmlElement_free(newElement);
|
||||||
newElement = NULL;
|
newElement = NULL;
|
||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
ret = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the localName and prefix
|
// set the localName and prefix
|
||||||
errCode =
|
ret = ixmlNode_setNodeName((IXML_Node *)newElement, qualifiedName);
|
||||||
ixmlNode_setNodeName( ( IXML_Node * ) newElement, qualifiedName );
|
if (ret != IXML_SUCCESS) {
|
||||||
if( errCode != IXML_SUCCESS ) {
|
line = __LINE__;
|
||||||
ixmlElement_free(newElement);
|
ixmlElement_free(newElement);
|
||||||
newElement = NULL;
|
newElement = NULL;
|
||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
ret = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -654,115 +481,70 @@ ixmlDocument_createElementNSEx( IN IXML_Document * doc,
|
|||||||
|
|
||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtElement = newElement;
|
*rtElement = newElement;
|
||||||
return errCode;
|
if (ret != IXML_SUCCESS) {
|
||||||
|
IxmlPrintf(__FILE__, line, "ixmlDocument_createElementNSEx", "Error %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
return ret;
|
||||||
* ixmlDocument_createElementNS
|
}
|
||||||
* Creates an element of the given qualified name and namespace URI.
|
|
||||||
* External function.
|
|
||||||
* Parameters:
|
IXML_Element *ixmlDocument_createElementNS(
|
||||||
* namespaceURI: the namespace URI of the element to create.
|
IXML_Document *doc,
|
||||||
* qualifiedName: the qualified name of the element to instantiate.
|
const DOMString namespaceURI,
|
||||||
* Return Value:
|
const DOMString qualifiedName)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
|
|
||||||
ixmlDocument_createElementNSEx( doc, namespaceURI, qualifiedName,
|
ixmlDocument_createElementNSEx(doc, namespaceURI, qualifiedName, &newElement);
|
||||||
&newElement );
|
|
||||||
return newElement;
|
return newElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_getElementsByTagName
|
IXML_NodeList *ixmlDocument_getElementsByTagName(
|
||||||
* Returns a nodeList of all the Elements with a given tag name
|
IXML_Document *doc,
|
||||||
* in the order in which they are encountered in a preorder traversal
|
const DOMString tagName)
|
||||||
* 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 *returnNodeList = NULL;
|
IXML_NodeList *returnNodeList = NULL;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
if (doc == NULL || tagName == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_getElementsByTagName( ( IXML_Node * ) doc, tagName,
|
ixmlNode_getElementsByTagName((IXML_Node *)doc, tagName, &returnNodeList);
|
||||||
&returnNodeList );
|
|
||||||
return returnNodeList;
|
return returnNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_getElementsByTagNameNS
|
IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
|
||||||
* Returns a nodeList of all the Elements with a given local name and
|
IXML_Document *doc,
|
||||||
* namespace URI in the order in which they are encountered in a
|
const DOMString namespaceURI,
|
||||||
* preorder traversal of the document tree.
|
const DOMString localName)
|
||||||
* 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 *returnNodeList = NULL;
|
IXML_NodeList *returnNodeList = NULL;
|
||||||
|
|
||||||
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
if (doc == NULL || namespaceURI == NULL || localName == NULL) {
|
||||||
|| ( localName == NULL ) ) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_getElementsByTagNameNS( ( IXML_Node * ) doc, namespaceURI,
|
ixmlNode_getElementsByTagNameNS(
|
||||||
localName, &returnNodeList );
|
(IXML_Node *)doc, namespaceURI, localName, &returnNodeList);
|
||||||
|
|
||||||
return returnNodeList;
|
return returnNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDocument_getElementById
|
IXML_Element *ixmlDocument_getElementById(
|
||||||
* Returns the element whose ID is given by tagName. If no such
|
IXML_Document *doc,
|
||||||
* element exists, returns null.
|
const DOMString tagName)
|
||||||
* 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 *rtElement = NULL;
|
IXML_Element *rtElement = NULL;
|
||||||
IXML_Node *nodeptr = (IXML_Node *)doc;
|
IXML_Node *nodeptr = (IXML_Node *)doc;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if( ( nodeptr == NULL ) || ( tagName == NULL ) ) {
|
if (nodeptr == NULL || tagName == NULL) {
|
||||||
return rtElement;
|
return rtElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,29 +558,26 @@ ixmlDocument_getElementById( IN IXML_Document * doc,
|
|||||||
rtElement = (IXML_Element *)nodeptr;
|
rtElement = (IXML_Element *)nodeptr;
|
||||||
return rtElement;
|
return rtElement;
|
||||||
} else {
|
} else {
|
||||||
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
rtElement = ixmlDocument_getElementById(
|
||||||
ixmlNode_getFirstChild
|
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
|
||||||
( nodeptr ),
|
|
||||||
tagName );
|
tagName );
|
||||||
if (rtElement == NULL) {
|
if (rtElement == NULL) {
|
||||||
rtElement = ixmlDocument_getElementById( ( IXML_Document
|
rtElement = ixmlDocument_getElementById(
|
||||||
* )
|
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
|
||||||
ixmlNode_getNextSibling
|
|
||||||
( nodeptr ),
|
|
||||||
tagName);
|
tagName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
rtElement = ixmlDocument_getElementById(
|
||||||
ixmlNode_getFirstChild
|
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
|
||||||
( nodeptr ), tagName );
|
tagName);
|
||||||
if (rtElement == NULL) {
|
if (rtElement == NULL) {
|
||||||
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
rtElement = ixmlDocument_getElementById(
|
||||||
ixmlNode_getNextSibling
|
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
|
||||||
( nodeptr ),
|
|
||||||
tagName);
|
tagName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rtElement;
|
return rtElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,73 +1,173 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IXML_MEMBUF_H
|
||||||
|
#define IXML_MEMBUF_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _IXML_MEMBUF_H
|
|
||||||
#define _IXML_MEMBUF_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h> /* for size_t */
|
||||||
|
|
||||||
|
|
||||||
#define MINVAL(a, b) ( (a) < (b) ? (a) : (b) )
|
#define MINVAL(a, b) ( (a) < (b) ? (a) : (b) )
|
||||||
#define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) )
|
#define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) )
|
||||||
|
|
||||||
|
|
||||||
#define MEMBUF_DEF_SIZE_INC 20
|
#define MEMBUF_DEF_SIZE_INC 20
|
||||||
|
|
||||||
|
|
||||||
typedef struct // ixml_membuf
|
/*!
|
||||||
|
* \brief The ixml_membuf type.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
size_t length;
|
size_t length;
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
size_t size_inc;
|
size_t size_inc;
|
||||||
|
|
||||||
} ixml_membuf;
|
} ixml_membuf;
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
//////////////// functions /////////////////////////
|
/*!
|
||||||
//--------------------------------------------------
|
* \brief ixml_membuf initialization routine.
|
||||||
/*
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif // __cplusplus
|
|
||||||
*/
|
*/
|
||||||
|
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
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef IXMLPARSER_H
|
||||||
|
#define IXMLPARSER_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _IXMLPARSER_H
|
|
||||||
#define _IXMLPARSER_H
|
|
||||||
|
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
#include "ixmlmembuf.h"
|
#include "ixmlmembuf.h"
|
||||||
|
|
||||||
// Parser definitions
|
|
||||||
|
/* Parser definitions */
|
||||||
#define QUOT """
|
#define QUOT """
|
||||||
#define LT "<"
|
#define LT "<"
|
||||||
#define GT ">"
|
#define GT ">"
|
||||||
@@ -44,6 +52,7 @@
|
|||||||
#define ESC_HEX "&#x"
|
#define ESC_HEX "&#x"
|
||||||
#define ESC_DEC "&#"
|
#define ESC_DEC "&#"
|
||||||
|
|
||||||
|
|
||||||
typedef struct _IXML_NamespaceURI
|
typedef struct _IXML_NamespaceURI
|
||||||
{
|
{
|
||||||
char *nsURI;
|
char *nsURI;
|
||||||
@@ -69,52 +78,192 @@ typedef enum
|
|||||||
eCONTENT,
|
eCONTENT,
|
||||||
} PARSER_STATE;
|
} PARSER_STATE;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _Parser
|
typedef struct _Parser
|
||||||
{
|
{
|
||||||
char *dataBuffer; //data buffer
|
/*! Data buffer. */
|
||||||
char *curPtr; //ptr to the token parsed
|
char *dataBuffer;
|
||||||
char *savePtr; //Saves for backup
|
/*! Pointer to the token parsed. */
|
||||||
|
char *curPtr;
|
||||||
|
/*! Saves for backup. */
|
||||||
|
char *savePtr;
|
||||||
ixml_membuf lastElem;
|
ixml_membuf lastElem;
|
||||||
ixml_membuf tokenBuf;
|
ixml_membuf tokenBuf;
|
||||||
|
|
||||||
IXML_Node *pNeedPrefixNode;
|
IXML_Node *pNeedPrefixNode;
|
||||||
IXML_ElementStack *pCurElement;
|
IXML_ElementStack *pCurElement;
|
||||||
IXML_Node *currentNodePtr;
|
IXML_Node *currentNodePtr;
|
||||||
PARSER_STATE state;
|
PARSER_STATE state;
|
||||||
|
|
||||||
BOOL bHasTopLevel;
|
BOOL bHasTopLevel;
|
||||||
|
|
||||||
} Parser;
|
} 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);
|
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);
|
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);
|
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
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ixmldebug.h"
|
||||||
#include "ixmlmembuf.h"
|
#include "ixmlmembuf.h"
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* copy_with_escape
|
#include <stdlib.h> /* for free() */
|
||||||
*
|
#include <string.h>
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
static void
|
/*!
|
||||||
copy_with_escape( INOUT ixml_membuf * buf,
|
* \brief Appends a string to a buffer, substituting some characters by escape
|
||||||
IN const char *p )
|
* 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 i;
|
||||||
int plen;
|
int plen;
|
||||||
|
|
||||||
if( p == NULL )
|
if (p == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plen = strlen( p );
|
plen = strlen( p );
|
||||||
|
|
||||||
@@ -73,19 +87,21 @@ copy_with_escape( INOUT ixml_membuf * buf,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ixml_membuf_append(buf, &p[i]);
|
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.
|
* Internal to parser only.
|
||||||
*
|
*/
|
||||||
*=================================================================*/
|
static void ixmlPrintDomTreeRecursive(
|
||||||
void
|
/*! [in] \todo documentation. */
|
||||||
ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
IXML_Node *nodeptr,
|
||||||
IN ixml_membuf * buf )
|
/*! [in] \todo documentation. */
|
||||||
|
ixml_membuf *buf)
|
||||||
{
|
{
|
||||||
const char *nodeName = NULL;
|
const char *nodeName = NULL;
|
||||||
const char *nodeValue = NULL;
|
const char *nodeValue = NULL;
|
||||||
@@ -97,7 +113,6 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
|||||||
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
||||||
|
|
||||||
switch (ixmlNode_getNodeType(nodeptr)) {
|
switch (ixmlNode_getNodeType(nodeptr)) {
|
||||||
|
|
||||||
case eTEXT_NODE:
|
case eTEXT_NODE:
|
||||||
copy_with_escape(buf, nodeValue);
|
copy_with_escape(buf, nodeValue);
|
||||||
break;
|
break;
|
||||||
@@ -117,8 +132,8 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case eDOCUMENT_NODE:
|
case eDOCUMENT_NODE:
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
ixmlPrintDomTreeRecursive(
|
||||||
( nodeptr ), buf );
|
ixmlNode_getFirstChild(nodeptr), buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eATTRIBUTE_NODE:
|
case eATTRIBUTE_NODE:
|
||||||
@@ -126,7 +141,6 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
|||||||
ixml_membuf_append_str(buf, "=\"");
|
ixml_membuf_append_str(buf, "=\"");
|
||||||
copy_with_escape(buf, nodeValue);
|
copy_with_escape(buf, nodeValue);
|
||||||
ixml_membuf_append_str(buf, "\"");
|
ixml_membuf_append_str(buf, "\"");
|
||||||
|
|
||||||
if (nodeptr->nextSibling != NULL) {
|
if (nodeptr->nextSibling != NULL) {
|
||||||
ixml_membuf_append_str(buf, " ");
|
ixml_membuf_append_str(buf, " ");
|
||||||
ixmlPrintDomTreeRecursive(nodeptr->nextSibling, buf);
|
ixmlPrintDomTreeRecursive(nodeptr->nextSibling, buf);
|
||||||
@@ -136,71 +150,69 @@ ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
|||||||
case eELEMENT_NODE:
|
case eELEMENT_NODE:
|
||||||
ixml_membuf_append_str(buf, "<");
|
ixml_membuf_append_str(buf, "<");
|
||||||
ixml_membuf_append_str(buf, nodeName);
|
ixml_membuf_append_str(buf, nodeName);
|
||||||
|
|
||||||
if (nodeptr->firstAttr != NULL) {
|
if (nodeptr->firstAttr != NULL) {
|
||||||
ixml_membuf_append_str(buf, " ");
|
ixml_membuf_append_str(buf, " ");
|
||||||
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
child = ixmlNode_getFirstChild(nodeptr);
|
child = ixmlNode_getFirstChild(nodeptr);
|
||||||
if( ( child != NULL )
|
if (child != NULL &&
|
||||||
&& ( ixmlNode_getNodeType( child ) ==
|
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
||||||
eELEMENT_NODE ) ) {
|
|
||||||
ixml_membuf_append_str(buf, ">\r\n");
|
ixml_membuf_append_str(buf, ">\r\n");
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str(buf, ">");
|
ixml_membuf_append_str(buf, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the children
|
// output the children
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
ixmlPrintDomTreeRecursive(
|
||||||
( nodeptr ), buf );
|
ixmlNode_getFirstChild(nodeptr), buf);
|
||||||
|
|
||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str(buf, "</");
|
ixml_membuf_append_str(buf, "</");
|
||||||
ixml_membuf_append_str(buf, nodeName);
|
ixml_membuf_append_str(buf, nodeName);
|
||||||
|
|
||||||
sibling = ixmlNode_getNextSibling(nodeptr);
|
sibling = ixmlNode_getNextSibling(nodeptr);
|
||||||
if( sibling != NULL
|
if (sibling != NULL &&
|
||||||
&& ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) {
|
ixmlNode_getNodeType(sibling) == eTEXT_NODE) {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">\r\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
}
|
}
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling
|
ixmlPrintDomTreeRecursive(
|
||||||
( nodeptr ), buf );
|
ixmlNode_getNextSibling(nodeptr), buf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTreeRecursive",
|
||||||
|
"Warning, unknown node type %d\n",
|
||||||
|
ixmlNode_getNodeType(nodeptr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlPrintDomTree
|
/*!
|
||||||
* Print a DOM tree.
|
* \brief 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.
|
|
||||||
*
|
*
|
||||||
*=================================================================*/
|
* Element, and Attribute nodes are handled differently. We don't want to print
|
||||||
void
|
* the Element and Attribute nodes' sibling.
|
||||||
ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
*/
|
||||||
IN ixml_membuf * buf )
|
static void ixmlPrintDomTree(
|
||||||
|
/*! [in] \todo documentation. */
|
||||||
|
IXML_Node *nodeptr,
|
||||||
|
/*! [in] \todo documentation. */
|
||||||
|
ixml_membuf *buf)
|
||||||
{
|
{
|
||||||
const char *nodeName = NULL;
|
const char *nodeName = NULL;
|
||||||
const char *nodeValue = NULL;
|
const char *nodeValue = NULL;
|
||||||
IXML_Node *child = NULL;
|
IXML_Node *child = NULL;
|
||||||
|
|
||||||
if( ( nodeptr == NULL ) || ( buf == NULL ) ) {
|
if (nodeptr == NULL || buf == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeName = (const char *)ixmlNode_getNodeName(nodeptr);
|
nodeName = (const char *)ixmlNode_getNodeName(nodeptr);
|
||||||
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
||||||
|
|
||||||
switch (ixmlNode_getNodeType(nodeptr)) {
|
switch (ixmlNode_getNodeType(nodeptr)) {
|
||||||
|
|
||||||
case eTEXT_NODE:
|
case eTEXT_NODE:
|
||||||
case eCDATA_SECTION_NODE:
|
case eCDATA_SECTION_NODE:
|
||||||
case ePROCESSING_INSTRUCTION_NODE:
|
case ePROCESSING_INSTRUCTION_NODE:
|
||||||
@@ -218,23 +230,21 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
|||||||
case eELEMENT_NODE:
|
case eELEMENT_NODE:
|
||||||
ixml_membuf_append_str(buf, "<");
|
ixml_membuf_append_str(buf, "<");
|
||||||
ixml_membuf_append_str(buf, nodeName);
|
ixml_membuf_append_str(buf, nodeName);
|
||||||
|
|
||||||
if (nodeptr->firstAttr != NULL) {
|
if (nodeptr->firstAttr != NULL) {
|
||||||
ixml_membuf_append_str(buf, " ");
|
ixml_membuf_append_str(buf, " ");
|
||||||
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
child = ixmlNode_getFirstChild(nodeptr);
|
child = ixmlNode_getFirstChild(nodeptr);
|
||||||
if( ( child != NULL )
|
if (child != NULL &&
|
||||||
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
||||||
ixml_membuf_append_str(buf, ">\r\n");
|
ixml_membuf_append_str(buf, ">\r\n");
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str(buf, ">");
|
ixml_membuf_append_str(buf, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the children
|
// output the children
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ),
|
ixmlPrintDomTreeRecursive(
|
||||||
buf );
|
ixmlNode_getFirstChild(nodeptr), buf);
|
||||||
|
|
||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str(buf, "</");
|
ixml_membuf_append_str(buf, "</");
|
||||||
@@ -243,27 +253,31 @@ ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTree",
|
||||||
|
"Warning, unknown node type %d\n",
|
||||||
|
ixmlNode_getNodeType(nodeptr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlDomTreetoString
|
/*!
|
||||||
* Converts a DOM tree into a text string
|
* \brief 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.
|
|
||||||
*
|
*
|
||||||
*=================================================================*/
|
* Element, and Attribute nodes are handled differently. We don't want to print
|
||||||
void
|
* the Element and Attribute nodes' sibling.
|
||||||
ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
*/
|
||||||
IN ixml_membuf * buf )
|
static void ixmlDomTreetoString(
|
||||||
|
/*! [in] \todo documentation. */
|
||||||
|
IXML_Node *nodeptr,
|
||||||
|
/*! [in] \todo documentation. */
|
||||||
|
ixml_membuf *buf)
|
||||||
{
|
{
|
||||||
const char *nodeName = NULL;
|
const char *nodeName = NULL;
|
||||||
const char *nodeValue = NULL;
|
const char *nodeValue = NULL;
|
||||||
IXML_Node *child = NULL;
|
IXML_Node *child = NULL;
|
||||||
|
|
||||||
if( ( nodeptr == NULL ) || ( buf == NULL ) ) {
|
if (nodeptr == NULL || buf == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +285,6 @@ ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
|||||||
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
nodeValue = ixmlNode_getNodeValue(nodeptr);
|
||||||
|
|
||||||
switch (ixmlNode_getNodeType(nodeptr)) {
|
switch (ixmlNode_getNodeType(nodeptr)) {
|
||||||
|
|
||||||
case eTEXT_NODE:
|
case eTEXT_NODE:
|
||||||
case eCDATA_SECTION_NODE:
|
case eCDATA_SECTION_NODE:
|
||||||
case ePROCESSING_INSTRUCTION_NODE:
|
case ePROCESSING_INSTRUCTION_NODE:
|
||||||
@@ -289,23 +302,20 @@ ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
|||||||
case eELEMENT_NODE:
|
case eELEMENT_NODE:
|
||||||
ixml_membuf_append_str(buf, "<");
|
ixml_membuf_append_str(buf, "<");
|
||||||
ixml_membuf_append_str(buf, nodeName);
|
ixml_membuf_append_str(buf, nodeName);
|
||||||
|
|
||||||
if (nodeptr->firstAttr != NULL) {
|
if (nodeptr->firstAttr != NULL) {
|
||||||
ixml_membuf_append_str(buf, " ");
|
ixml_membuf_append_str(buf, " ");
|
||||||
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
child = ixmlNode_getFirstChild(nodeptr);
|
child = ixmlNode_getFirstChild(nodeptr);
|
||||||
if( ( child != NULL )
|
if (child != NULL &&
|
||||||
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
||||||
ixml_membuf_append_str(buf, ">");
|
ixml_membuf_append_str(buf, ">");
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str(buf, ">");
|
ixml_membuf_append_str(buf, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the children
|
// output the children
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ),
|
ixmlPrintDomTreeRecursive(ixmlNode_getFirstChild(nodeptr), buf);
|
||||||
buf );
|
|
||||||
|
|
||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str(buf, "</");
|
ixml_membuf_append_str(buf, "</");
|
||||||
@@ -314,54 +324,35 @@ ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTreeRecursive",
|
||||||
|
"Warning, unknown node type %d\n",
|
||||||
|
ixmlNode_getNodeType(nodeptr));
|
||||||
break;
|
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 IXML_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Parser_LoadDocument(doc, xmlFile, TRUE);
|
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;
|
IXML_Document *doc = NULL;
|
||||||
|
|
||||||
ixmlLoadDocumentEx(xmlFile, &doc);
|
ixmlLoadDocumentEx(xmlFile, &doc);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlPrintDocument
|
|
||||||
* Prints entire document, prepending XML prolog first.
|
|
||||||
* Puts lots of white spaces.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
|
|
||||||
DOMString
|
DOMString ixmlPrintDocument(IXML_Document *doc)
|
||||||
ixmlPrintDocument(IXML_Document *doc)
|
|
||||||
{
|
{
|
||||||
IXML_Node* rootNode = (IXML_Node *)doc;
|
IXML_Node* rootNode = (IXML_Node *)doc;
|
||||||
ixml_membuf memBuf;
|
ixml_membuf memBuf;
|
||||||
@@ -374,20 +365,13 @@ ixmlPrintDocument(IXML_Document *doc)
|
|||||||
ixml_membuf_init(buf);
|
ixml_membuf_init(buf);
|
||||||
ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n");
|
ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n");
|
||||||
ixmlPrintDomTree(rootNode, buf);
|
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 memBuf;
|
||||||
ixml_membuf *buf = &memBuf;
|
ixml_membuf *buf = &memBuf;
|
||||||
|
|
||||||
@@ -397,20 +381,12 @@ ixmlPrintNode( IN IXML_Node * node )
|
|||||||
|
|
||||||
ixml_membuf_init(buf);
|
ixml_membuf_init(buf);
|
||||||
ixmlPrintDomTree(node, 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
|
DOMString ixmlDocumenttoString(IXML_Document *doc)
|
||||||
ixmlDocumenttoString(IXML_Document *doc)
|
|
||||||
{
|
{
|
||||||
IXML_Node* rootNode = (IXML_Node *)doc;
|
IXML_Node* rootNode = (IXML_Node *)doc;
|
||||||
ixml_membuf memBuf;
|
ixml_membuf memBuf;
|
||||||
@@ -423,20 +399,13 @@ ixmlDocumenttoString(IXML_Document *doc)
|
|||||||
ixml_membuf_init(buf);
|
ixml_membuf_init(buf);
|
||||||
ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n");
|
ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n");
|
||||||
ixmlDomTreetoString(rootNode, buf);
|
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 memBuf;
|
||||||
ixml_membuf *buf = &memBuf;
|
ixml_membuf *buf = &memBuf;
|
||||||
|
|
||||||
@@ -446,35 +415,20 @@ ixmlNodetoString( IN IXML_Node * node )
|
|||||||
|
|
||||||
ixml_membuf_init(buf);
|
ixml_membuf_init(buf);
|
||||||
ixmlDomTreetoString(node, buf);
|
ixmlDomTreetoString(node, buf);
|
||||||
return buf->buf;
|
|
||||||
|
|
||||||
|
return buf->buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlRelaxParser
|
void ixmlRelaxParser(char errorChar)
|
||||||
* Makes the XML parser more tolerant to malformed text.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlRelaxParser(char errorChar)
|
|
||||||
{
|
{
|
||||||
Parser_setErrorChar(errorChar);
|
Parser_setErrorChar(errorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*================================================================
|
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
|
||||||
* ixmlParseBufferEx
|
|
||||||
* Parse xml file stored in buffer.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
int
|
|
||||||
ixmlParseBufferEx( IN const char *buffer,
|
|
||||||
IXML_Document ** retDoc )
|
|
||||||
{
|
{
|
||||||
|
if (buffer == NULL || retDoc == NULL) {
|
||||||
if( ( buffer == NULL ) || ( retDoc == NULL ) ) {
|
|
||||||
return IXML_INVALID_PARAMETER;
|
return IXML_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,47 +439,31 @@ ixmlParseBufferEx( IN const char *buffer,
|
|||||||
return Parser_LoadDocument(retDoc, buffer, FALSE);
|
return Parser_LoadDocument(retDoc, buffer, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlParseBuffer
|
IXML_Document *ixmlParseBuffer(const char *buffer)
|
||||||
* Parse xml file stored in buffer.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
IXML_Document *
|
|
||||||
ixmlParseBuffer( IN const char *buffer )
|
|
||||||
{
|
{
|
||||||
IXML_Document *doc = NULL;
|
IXML_Document *doc = NULL;
|
||||||
|
|
||||||
ixmlParseBufferEx(buffer, &doc);
|
ixmlParseBufferEx(buffer, &doc);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlCloneDOMString
|
DOMString ixmlCloneDOMString(const DOMString src)
|
||||||
* Clones a DOM String.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
DOMString
|
|
||||||
ixmlCloneDOMString( IN const DOMString src )
|
|
||||||
{
|
{
|
||||||
if (src == NULL) {
|
if (src == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( strdup( src ) );
|
return strdup(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlFreeDOMString
|
void ixmlFreeDOMString(DOMString buf)
|
||||||
* Frees a DOM String.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlFreeDOMString( IN DOMString buf )
|
|
||||||
{
|
{
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
free(buf);
|
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
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ixmlmembuf.h"
|
||||||
|
#include "ixml.h"
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ixmlmembuf.h"
|
|
||||||
#include "ixml.h"
|
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixml_membuf_set_size
|
/*!
|
||||||
*
|
* \brief Increases or decreases buffer capacity so that at least 'new_length'
|
||||||
* Increases or decreases buffer cap so that at least
|
* bytes can be stored.
|
||||||
* 'new_length' bytes can be stored
|
|
||||||
*
|
*
|
||||||
* On error, m's fields do not change.
|
* On error, m's fields do not change.
|
||||||
*
|
*
|
||||||
* returns:
|
* \return
|
||||||
* UPNP_E_SUCCESS
|
* \li UPNP_E_SUCCESS
|
||||||
* UPNP_E_OUTOF_MEMORY
|
* \li UPNP_E_OUTOF_MEMORY
|
||||||
*
|
*/
|
||||||
*=================================================================*/
|
static int ixml_membuf_set_size(
|
||||||
static int
|
/*! [in,out] The memory buffer. */
|
||||||
ixml_membuf_set_size( INOUT ixml_membuf * m,
|
INOUT ixml_membuf *m,
|
||||||
|
/*! [in] The new lenght. */
|
||||||
IN size_t new_length)
|
IN size_t new_length)
|
||||||
{
|
{
|
||||||
size_t diff;
|
size_t diff;
|
||||||
size_t alloc_len;
|
size_t alloc_len;
|
||||||
char *temp_buf;
|
char *temp_buf;
|
||||||
|
|
||||||
if( new_length >= m->length ) // increase length
|
if (new_length >= m->length) {
|
||||||
{
|
/* increase length */
|
||||||
// need more mem?
|
/* need more mem? */
|
||||||
if (new_length <= m->capacity) {
|
if (new_length <= m->capacity) {
|
||||||
return 0; // have enough mem; done
|
/* have enough mem; done */
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff = new_length - m->length;
|
diff = new_length - m->length;
|
||||||
alloc_len = MAXVAL(m->size_inc, diff) + m->capacity;
|
alloc_len = MAXVAL(m->size_inc, diff) + m->capacity;
|
||||||
} else // decrease length
|
} else {
|
||||||
{
|
// decrease length
|
||||||
assert(new_length <= m->length);
|
assert(new_length <= m->length);
|
||||||
|
|
||||||
// if diff is 0..m->size_inc, don't free
|
// if diff is 0..m->size_inc, don't free
|
||||||
if ((m->capacity - new_length) <= m->size_inc) {
|
if ((m->capacity - new_length) <= m->size_inc) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc_len = new_length + m->size_inc;
|
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);
|
temp_buf = realloc(m->buf, alloc_len + 1);
|
||||||
if (temp_buf == NULL) {
|
if (temp_buf == NULL) {
|
||||||
// try smaller size
|
/* try smaller size */
|
||||||
alloc_len = new_length;
|
alloc_len = new_length;
|
||||||
temp_buf = realloc(m->buf, alloc_len + 1);
|
temp_buf = realloc(m->buf, alloc_len + 1);
|
||||||
|
|
||||||
if (temp_buf == NULL) {
|
if (temp_buf == NULL) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// save
|
/* save */
|
||||||
m->buf = temp_buf;
|
m->buf = temp_buf;
|
||||||
m->capacity = alloc_len;
|
m->capacity = alloc_len;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* membuffer_init
|
void ixml_membuf_init(ixml_membuf *m)
|
||||||
*
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixml_membuf_init( INOUT ixml_membuf * m )
|
|
||||||
{
|
{
|
||||||
assert(m != NULL);
|
assert(m != NULL);
|
||||||
|
|
||||||
@@ -111,13 +114,8 @@ ixml_membuf_init( INOUT ixml_membuf * m )
|
|||||||
m->capacity = 0;
|
m->capacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* membuffer_destroy
|
void ixml_membuf_destroy(ixml_membuf *m)
|
||||||
*
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixml_membuf_destroy( INOUT ixml_membuf * m )
|
|
||||||
{
|
{
|
||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
return;
|
return;
|
||||||
@@ -127,15 +125,11 @@ ixml_membuf_destroy( INOUT ixml_membuf * m )
|
|||||||
ixml_membuf_init(m);
|
ixml_membuf_init(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixml_membuf_assign
|
int ixml_membuf_assign(
|
||||||
*
|
ixml_membuf *m,
|
||||||
*
|
const void *buf,
|
||||||
*=================================================================*/
|
size_t buf_len)
|
||||||
int
|
|
||||||
ixml_membuf_assign( INOUT ixml_membuf * m,
|
|
||||||
IN const void *buf,
|
|
||||||
IN size_t buf_len )
|
|
||||||
{
|
{
|
||||||
int return_code;
|
int return_code;
|
||||||
|
|
||||||
@@ -151,35 +145,28 @@ ixml_membuf_assign( INOUT ixml_membuf * m,
|
|||||||
if (return_code != 0) {
|
if (return_code != 0) {
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
memcpy(m->buf, buf, buf_len);
|
memcpy(m->buf, buf, buf_len);
|
||||||
m->buf[buf_len] = 0; // null-terminate
|
|
||||||
|
|
||||||
|
// null-terminate
|
||||||
|
m->buf[buf_len] = 0;
|
||||||
m->length = buf_len;
|
m->length = buf_len;
|
||||||
|
|
||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixml_membuf_assign_str
|
int ixml_membuf_assign_str(
|
||||||
*
|
ixml_membuf *m,
|
||||||
*
|
const char *c_str)
|
||||||
*=================================================================*/
|
|
||||||
int
|
|
||||||
ixml_membuf_assign_str( INOUT ixml_membuf * m,
|
|
||||||
IN const char *c_str )
|
|
||||||
{
|
{
|
||||||
return ixml_membuf_assign(m, c_str, strlen(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)
|
IN const void *buf)
|
||||||
{
|
{
|
||||||
assert(m != NULL);
|
assert(m != NULL);
|
||||||
@@ -187,50 +174,45 @@ ixml_membuf_append( INOUT ixml_membuf * m,
|
|||||||
return ixml_membuf_insert(m, buf, 1, m->length);
|
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)
|
IN const char *c_str)
|
||||||
{
|
{
|
||||||
return ixml_membuf_insert(m, c_str, strlen(c_str), m->length);
|
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 const void *buf,
|
||||||
IN size_t buf_len,
|
IN size_t buf_len,
|
||||||
int index)
|
int index)
|
||||||
{
|
{
|
||||||
int return_code;
|
int return_code = 0;
|
||||||
|
|
||||||
assert(m != NULL);
|
assert(m != NULL);
|
||||||
|
|
||||||
if( index < 0 || index > ( int )m->length )
|
if (index < 0 || index > (int)m->length) {
|
||||||
return IXML_INDEX_SIZE_ERR;
|
return IXML_INDEX_SIZE_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
if (buf == NULL || buf_len == 0) {
|
if (buf == NULL || buf_len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// alloc mem
|
/* alloc mem */
|
||||||
return_code = ixml_membuf_set_size(m, m->length + buf_len);
|
return_code = ixml_membuf_set_size(m, m->length + buf_len);
|
||||||
if (return_code != 0) {
|
if (return_code != 0) {
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
// insert data
|
/* insert data */
|
||||||
// move data to right of insertion point
|
/* move data to right of insertion point */
|
||||||
memmove(m->buf + index + buf_len, m->buf + index, m->length - index);
|
memmove(m->buf + index + buf_len, m->buf + index, m->length - index);
|
||||||
memcpy(m->buf + index, buf, buf_len);
|
memcpy(m->buf + index, buf, buf_len);
|
||||||
m->length += buf_len;
|
m->length += buf_len;
|
||||||
m->buf[m->length] = 0; // null-terminate
|
/* Null terminate */
|
||||||
|
m->buf[m->length] = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,53 +1,62 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* NamedNodeMap_getItemNumber
|
#include <assert.h>
|
||||||
* return the item number of a item in NamedNodeMap.
|
#include <stdlib.h> /* for free(), malloc() */
|
||||||
* Internal to parser only.
|
#include <string.h>
|
||||||
* Parameters:
|
|
||||||
* name: the name of the item to find
|
|
||||||
*
|
/*!
|
||||||
*=================================================================*/
|
* \brief Return the item number of a item in NamedNodeMap.
|
||||||
unsigned long
|
*/
|
||||||
ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
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)
|
IN const char *name)
|
||||||
{
|
{
|
||||||
IXML_Node *tempNode;
|
IXML_Node *tempNode;
|
||||||
unsigned long returnItemNo = 0;
|
unsigned long returnItemNo = 0;
|
||||||
|
|
||||||
assert(nnMap != NULL && name != NULL);
|
assert(nnMap != NULL && name != NULL);
|
||||||
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
if (nnMap == NULL || name == NULL) {
|
||||||
return IXML_INVALID_ITEM_NUMBER;
|
return IXML_INVALID_ITEM_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +65,6 @@ ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
|||||||
if (strcmp(name, tempNode->nodeName) == 0) {
|
if (strcmp(name, tempNode->nodeName) == 0) {
|
||||||
return returnItemNo;
|
return returnItemNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempNode = tempNode->nextSibling;
|
tempNode = tempNode->nextSibling;
|
||||||
returnItemNo++;
|
returnItemNo++;
|
||||||
}
|
}
|
||||||
@@ -64,39 +72,22 @@ ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
|||||||
return IXML_INVALID_ITEM_NUMBER;
|
return IXML_INVALID_ITEM_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* NamedNodeMap_init
|
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap)
|
||||||
* Initializes a NamedNodeMap object.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlNamedNodeMap_init( IN IXML_NamedNodeMap * nnMap )
|
|
||||||
{
|
{
|
||||||
assert(nnMap != NULL);
|
assert(nnMap != NULL);
|
||||||
|
|
||||||
memset(nnMap, 0, sizeof (IXML_NamedNodeMap));
|
memset(nnMap, 0, sizeof (IXML_NamedNodeMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* NamedNodeMap_getNamedItem
|
IXML_Node *ixmlNamedNodeMap_getNamedItem(
|
||||||
* Retrieves a node specified by name.
|
IXML_NamedNodeMap *nnMap,
|
||||||
* External function.
|
const DOMString name)
|
||||||
*
|
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
long index;
|
long index;
|
||||||
|
|
||||||
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
if (nnMap == NULL || name == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,26 +95,13 @@ ixmlNamedNodeMap_getNamedItem( IN IXML_NamedNodeMap * nnMap,
|
|||||||
if (index == IXML_INVALID_ITEM_NUMBER) {
|
if (index == IXML_INVALID_ITEM_NUMBER) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
return ( ixmlNamedNodeMap_item( nnMap, ( unsigned long )index ) );
|
return ixmlNamedNodeMap_item(nnMap, (unsigned long)index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* NamedNodeMap_item
|
IXML_Node *ixmlNamedNodeMap_item(
|
||||||
* Returns the indexth item in the map. If index is greater than or
|
IN IXML_NamedNodeMap *nnMap,
|
||||||
* 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,
|
|
||||||
IN unsigned long index )
|
IN unsigned long index )
|
||||||
{
|
{
|
||||||
IXML_Node *tempNode;
|
IXML_Node *tempNode;
|
||||||
@@ -145,16 +123,8 @@ ixmlNamedNodeMap_item( IN IXML_NamedNodeMap * nnMap,
|
|||||||
return tempNode;
|
return tempNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* NamedNodeMap_getLength
|
unsigned long ixmlNamedNodeMap_getLength(IXML_NamedNodeMap *nnMap)
|
||||||
* Return the number of Nodes in this map.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
unsigned long
|
|
||||||
ixmlNamedNodeMap_getLength( IN IXML_NamedNodeMap * nnMap )
|
|
||||||
{
|
{
|
||||||
IXML_Node *tempNode;
|
IXML_Node *tempNode;
|
||||||
unsigned long length = 0;
|
unsigned long length = 0;
|
||||||
@@ -165,17 +135,12 @@ ixmlNamedNodeMap_getLength( IN IXML_NamedNodeMap * nnMap )
|
|||||||
tempNode = tempNode->nextSibling;
|
tempNode = tempNode->nextSibling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlNamedNodeMap_free
|
void ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap)
|
||||||
* frees a NamedNodeMap.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlNamedNodeMap_free( IXML_NamedNodeMap * nnMap )
|
|
||||||
{
|
{
|
||||||
IXML_NamedNodeMap *pNext;
|
IXML_NamedNodeMap *pNext;
|
||||||
|
|
||||||
@@ -186,38 +151,27 @@ ixmlNamedNodeMap_free( IXML_NamedNodeMap * nnMap )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* NamedNodeMap_addToNamedNodeMap
|
int ixmlNamedNodeMap_addToNamedNodeMap(
|
||||||
* add a node to a NamedNodeMap.
|
IXML_NamedNodeMap **nnMap,
|
||||||
* Internal to parser only.
|
IXML_Node *add)
|
||||||
* Parameters:
|
|
||||||
* add: the node to add into NamedNodeMap.
|
|
||||||
* Return:
|
|
||||||
* IXML_SUCCESS or failure.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
int
|
|
||||||
ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap,
|
|
||||||
IN IXML_Node * add )
|
|
||||||
{
|
{
|
||||||
IXML_NamedNodeMap *traverse = NULL,
|
IXML_NamedNodeMap *traverse = NULL;
|
||||||
*p = NULL;
|
IXML_NamedNodeMap *p = NULL;
|
||||||
IXML_NamedNodeMap *newItem = NULL;
|
IXML_NamedNodeMap *newItem = NULL;
|
||||||
|
|
||||||
if(add == NULL) {
|
if(add == NULL) {
|
||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *nnMap == NULL ) // nodelist is empty
|
if (*nnMap == NULL) {
|
||||||
{
|
// nodelist is empty
|
||||||
*nnMap =
|
*nnMap = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap));
|
||||||
( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) );
|
|
||||||
if (*nnMap == NULL) {
|
if (*nnMap == NULL) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
ixmlNamedNodeMap_init(*nnMap);
|
ixmlNamedNodeMap_init(*nnMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*nnMap)->nodeItem == NULL) {
|
if ((*nnMap)->nodeItem == NULL) {
|
||||||
(*nnMap)->nodeItem = add;
|
(*nnMap)->nodeItem = add;
|
||||||
} else {
|
} else {
|
||||||
@@ -227,9 +181,7 @@ ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap,
|
|||||||
p = traverse;
|
p = traverse;
|
||||||
traverse = traverse->next;
|
traverse = traverse->next;
|
||||||
}
|
}
|
||||||
|
newItem = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap));
|
||||||
newItem =
|
|
||||||
( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) );
|
|
||||||
if (newItem == NULL) {
|
if (newItem == NULL) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
@@ -240,3 +192,4 @@ ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap,
|
|||||||
|
|
||||||
return IXML_SUCCESS;
|
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
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlNodeList_init
|
#include <assert.h>
|
||||||
* initializes a nodelist
|
#include <string.h>
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
void ixmlNodeList_init(IXML_NodeList *nList)
|
||||||
void
|
|
||||||
ixmlNodeList_init( IXML_NodeList * nList )
|
|
||||||
{
|
{
|
||||||
assert(nList != NULL);
|
assert(nList != NULL);
|
||||||
|
|
||||||
memset(nList, 0, sizeof (IXML_NodeList));
|
memset(nList, 0, sizeof (IXML_NodeList));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlNodeList_item
|
IXML_Node *ixmlNodeList_item(
|
||||||
* Returns the indexth item in the collection. If index is greater
|
IXML_NodeList *nList,
|
||||||
* than or equal to the number of nodes in the list, this returns
|
|
||||||
* null.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
IXML_Node *
|
|
||||||
ixmlNodeList_item( IXML_NodeList * nList,
|
|
||||||
unsigned long index)
|
unsigned long index)
|
||||||
{
|
{
|
||||||
IXML_NodeList *next;
|
IXML_NodeList *next;
|
||||||
@@ -75,24 +71,19 @@ ixmlNodeList_item( IXML_NodeList * nList,
|
|||||||
next = next->next;
|
next = next->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( next == NULL ) return NULL;
|
if (next == NULL) {
|
||||||
|
return NULL;
|
||||||
return next->nodeItem;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
return next->nodeItem;
|
||||||
* ixmlNodeList_addToNodeList
|
}
|
||||||
* Add a node to nodelist
|
|
||||||
* Internal to parser only.
|
int ixmlNodeList_addToNodeList(
|
||||||
*
|
IXML_NodeList **nList,
|
||||||
*=================================================================*/
|
IXML_Node *add)
|
||||||
int
|
|
||||||
ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
|
||||||
IN IXML_Node * add )
|
|
||||||
{
|
{
|
||||||
IXML_NodeList *traverse,
|
IXML_NodeList *traverse = NULL;
|
||||||
*p = NULL;
|
IXML_NodeList *p = NULL;
|
||||||
IXML_NodeList *newListItem;
|
IXML_NodeList *newListItem;
|
||||||
|
|
||||||
assert(add != NULL);
|
assert(add != NULL);
|
||||||
@@ -101,8 +92,8 @@ ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
|||||||
return IXML_FAILED;
|
return IXML_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *nList == NULL ) // nodelist is empty
|
if (*nList == NULL) {
|
||||||
{
|
// nodelist is empty
|
||||||
*nList = (IXML_NodeList *)malloc(sizeof (IXML_NodeList));
|
*nList = (IXML_NodeList *)malloc(sizeof (IXML_NodeList));
|
||||||
if (*nList == NULL) {
|
if (*nList == NULL) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
@@ -120,8 +111,7 @@ ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
|||||||
traverse = traverse->next;
|
traverse = traverse->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
newListItem =
|
newListItem = (IXML_NodeList *)malloc(sizeof (IXML_NodeList));
|
||||||
( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) );
|
|
||||||
if (newListItem == NULL) {
|
if (newListItem == NULL) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
@@ -133,15 +123,8 @@ ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
|||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlNodeList_length
|
unsigned long ixmlNodeList_length(IXML_NodeList *nList)
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
IXML_NodeList *list;
|
IXML_NodeList *list;
|
||||||
unsigned long length = 0;
|
unsigned long length = 0;
|
||||||
@@ -155,22 +138,15 @@ ixmlNodeList_length( IN IXML_NodeList * nList )
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*================================================================
|
|
||||||
* ixmlNodeList_free
|
void ixmlNodeList_free(IXML_NodeList *nList)
|
||||||
* frees a nodeList
|
|
||||||
* External function
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
void
|
|
||||||
ixmlNodeList_free( IN IXML_NodeList * nList )
|
|
||||||
{
|
{
|
||||||
IXML_NodeList *next;
|
IXML_NodeList *next;
|
||||||
|
|
||||||
while (nList != NULL) {
|
while (nList != NULL) {
|
||||||
next = nList->next;
|
next = nList->next;
|
||||||
|
|
||||||
free(nList);
|
free(nList);
|
||||||
nList = next;
|
nList = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ includedir=@includedir@
|
|||||||
Name: libupnp
|
Name: libupnp
|
||||||
Description: Linux SDK for UPnP Devices
|
Description: Linux SDK for UPnP Devices
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
||||||
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Version: 1.6.4
|
Version: 1.6.9
|
||||||
Summary: Universal Plug and Play (UPnP) SDK
|
Summary: Universal Plug and Play (UPnP) SDK
|
||||||
Name: libupnp
|
Name: libupnp
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|||||||
@@ -29,14 +29,24 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FREE_LIST_H
|
#ifndef FREE_LIST_H
|
||||||
#define FREE_LIST_H
|
#define FREE_LIST_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -29,21 +29,32 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef LINKED_LIST_H
|
#ifndef LINKED_LIST_H
|
||||||
#define LINKED_LIST_H
|
#define LINKED_LIST_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "FreeList.h"
|
#include "FreeList.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define EOUTOFMEM (-7 & 1<<29)
|
#define EOUTOFMEM (-7 & 1<<29)
|
||||||
|
|
||||||
|
|
||||||
#define FREELISTSIZE 100
|
#define FREELISTSIZE 100
|
||||||
#define LIST_SUCCESS 1
|
#define LIST_SUCCESS 1
|
||||||
#define LIST_FAIL 0
|
#define LIST_FAIL 0
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: free_routine
|
* Name: free_routine
|
||||||
*
|
*
|
||||||
@@ -52,6 +63,7 @@ extern "C" {
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef void (*free_function)(void *arg);
|
typedef void (*free_function)(void *arg);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: cmp_routine
|
* Name: cmp_routine
|
||||||
*
|
*
|
||||||
@@ -61,6 +73,7 @@ typedef void (*free_function)(void *arg);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef int (*cmp_routine)(void *itemA,void *itemB);
|
typedef int (*cmp_routine)(void *itemA,void *itemB);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ListNode
|
* Name: ListNode
|
||||||
*
|
*
|
||||||
@@ -75,6 +88,7 @@ typedef struct LISTNODE
|
|||||||
void *item;
|
void *item;
|
||||||
} ListNode;
|
} ListNode;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: LinkedList
|
* Name: LinkedList
|
||||||
*
|
*
|
||||||
@@ -104,6 +118,7 @@ typedef struct LINKEDLIST
|
|||||||
cmp_routine cmp_func; /* compare function to use */
|
cmp_routine cmp_func; /* compare function to use */
|
||||||
} LinkedList;
|
} LinkedList;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListInit
|
* Function: ListInit
|
||||||
*
|
*
|
||||||
@@ -119,6 +134,7 @@ typedef struct LINKEDLIST
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func);
|
int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListAddHead
|
* Function: ListAddHead
|
||||||
*
|
*
|
||||||
@@ -135,6 +151,7 @@ int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode *ListAddHead(LinkedList *list, void *item);
|
ListNode *ListAddHead(LinkedList *list, void *item);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListAddTail
|
* Function: ListAddTail
|
||||||
*
|
*
|
||||||
@@ -151,6 +168,7 @@ ListNode *ListAddHead(LinkedList *list, void *item);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode *ListAddTail(LinkedList *list, void *item);
|
ListNode *ListAddTail(LinkedList *list, void *item);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListAddAfter
|
* Function: ListAddAfter
|
||||||
*
|
*
|
||||||
@@ -205,6 +223,7 @@ ListNode *ListAddBefore(LinkedList *list,void *item, ListNode *anode);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void *ListDelNode(LinkedList *list,ListNode *dnode, int freeItem);
|
void *ListDelNode(LinkedList *list,ListNode *dnode, int freeItem);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListDestroy
|
* Function: ListDestroy
|
||||||
*
|
*
|
||||||
@@ -240,6 +259,7 @@ int ListDestroy(LinkedList *list, int freeItem);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode* ListHead(LinkedList *list);
|
ListNode* ListHead(LinkedList *list);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListTail
|
* Function: ListTail
|
||||||
*
|
*
|
||||||
@@ -256,6 +276,7 @@ ListNode* ListHead(LinkedList *list);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode* ListTail(LinkedList *list);
|
ListNode* ListTail(LinkedList *list);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListNext
|
* Function: ListNext
|
||||||
*
|
*
|
||||||
@@ -272,6 +293,7 @@ ListNode* ListTail(LinkedList *list);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode* ListNext(LinkedList *list, ListNode * node);
|
ListNode* ListNext(LinkedList *list, ListNode * node);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListPrev
|
* Function: ListPrev
|
||||||
*
|
*
|
||||||
@@ -288,6 +310,7 @@ ListNode* ListNext(LinkedList *list, ListNode * node);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode* ListPrev(LinkedList *list, ListNode * node);
|
ListNode* ListPrev(LinkedList *list, ListNode * node);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListFind
|
* Function: ListFind
|
||||||
*
|
*
|
||||||
@@ -307,6 +330,7 @@ ListNode* ListPrev(LinkedList *list, ListNode * node);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ListNode* ListFind(LinkedList *list, ListNode *start, void * item);
|
ListNode* ListFind(LinkedList *list, ListNode *start, void * item);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ListSize
|
* Function: ListSize
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -29,67 +29,134 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef THREADPOOL_H
|
#ifndef THREADPOOL_H
|
||||||
#define THREADPOOL_H
|
#define THREADPOOL_H
|
||||||
|
|
||||||
#ifdef UPNP_USE_MSVCPP
|
|
||||||
#define UPNP_INLINE
|
/*!
|
||||||
#else
|
* \file
|
||||||
#define UPNP_INLINE inline
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Size of job free list */
|
|
||||||
|
/*! Size of job free list */
|
||||||
#define JOBFREELISTSIZE 100
|
#define JOBFREELISTSIZE 100
|
||||||
|
|
||||||
|
|
||||||
#define INFINITE_THREADS -1
|
#define INFINITE_THREADS -1
|
||||||
|
|
||||||
|
|
||||||
#define EMAXTHREADS (-8 & 1<<29)
|
#define EMAXTHREADS (-8 & 1<<29)
|
||||||
|
|
||||||
/* Invalid Policy */
|
|
||||||
|
/*! Invalid Policy */
|
||||||
#define INVALID_POLICY (-9 & 1<<29)
|
#define INVALID_POLICY (-9 & 1<<29)
|
||||||
|
|
||||||
/* Invalid JOB Id */
|
|
||||||
|
/*! Invalid JOB Id */
|
||||||
#define INVALID_JOB_ID (-2 & 1<<29)
|
#define INVALID_JOB_ID (-2 & 1<<29)
|
||||||
|
|
||||||
typedef enum duration {SHORT_TERM,PERSISTENT} Duration;
|
|
||||||
|
|
||||||
typedef enum priority {LOW_PRIORITY,
|
typedef enum duration {
|
||||||
|
SHORT_TERM,
|
||||||
|
PERSISTENT
|
||||||
|
} Duration;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum priority {
|
||||||
|
LOW_PRIORITY,
|
||||||
MED_PRIORITY,
|
MED_PRIORITY,
|
||||||
HIGH_PRIORITY} ThreadPriority;
|
HIGH_PRIORITY
|
||||||
|
} ThreadPriority;
|
||||||
|
|
||||||
#define DEFAULT_PRIORITY MED_PRIORITY /* default priority used by TPJobInit */
|
|
||||||
#define DEFAULT_MIN_THREADS 1 /* default minimum used by TPAttrInit */
|
|
||||||
#define DEFAULT_MAX_THREADS 10 /* default max used by TPAttrInit */
|
|
||||||
#define DEFAULT_JOBS_PER_THREAD 10 /* default jobs per thread used by TPAttrInit */
|
|
||||||
#define DEFAULT_STARVATION_TIME 500 /* default starvation time used by TPAttrInit */
|
|
||||||
#define DEFAULT_IDLE_TIME 10 * 1000 /* default idle time used by TPAttrInit */
|
|
||||||
#define DEFAULT_FREE_ROUTINE NULL /* default free routine used TPJobInit */
|
|
||||||
#define DEFAULT_MAX_JOBS_TOTAL 100 /* default max jobs used TPAttrInit */
|
|
||||||
|
|
||||||
/* Statistics */
|
/*! default priority used by TPJobInit */
|
||||||
/* always include stats because code change is minimal */
|
#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 stack size used by TPAttrInit */
|
||||||
|
#define DEFAULT_STACK_SIZE 0
|
||||||
|
|
||||||
|
|
||||||
|
/*! 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
|
#define STATS 1
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "LinkedList.h"
|
|
||||||
#include <sys/time.h> /* for gettimeofday() */
|
|
||||||
#include "FreeList.h"
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#define EXPORT
|
|
||||||
|
|
||||||
typedef int PolicyType;
|
typedef int PolicyType;
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_POLICY SCHED_OTHER
|
#define DEFAULT_POLICY SCHED_OTHER
|
||||||
#define DEFAULT_SCHED_PARAM 0 /* default priority */
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: free_routine
|
* Name: free_routine
|
||||||
@@ -99,6 +166,7 @@ typedef int PolicyType;
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef void (*free_routine)(void *arg);
|
typedef void (*free_routine)(void *arg);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ThreadPoolAttr
|
* Name: ThreadPoolAttr
|
||||||
*
|
*
|
||||||
@@ -114,6 +182,10 @@ typedef struct THREADPOOLATTR
|
|||||||
/* 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 maxThreads;
|
||||||
|
|
||||||
|
/* stackSize (in bytes), this is the minimum stack size allocated for each
|
||||||
|
* thread */
|
||||||
|
size_t stackSize;
|
||||||
|
|
||||||
/* maxIdleTime (in milliseconds) this is the maximum time a thread will
|
/* maxIdleTime (in milliseconds) this is the maximum time a thread will
|
||||||
* remain idle before dying */
|
* remain idle before dying */
|
||||||
int maxIdleTime;
|
int maxIdleTime;
|
||||||
@@ -132,6 +204,7 @@ typedef struct THREADPOOLATTR
|
|||||||
PolicyType schedPolicy;
|
PolicyType schedPolicy;
|
||||||
} ThreadPoolAttr;
|
} ThreadPoolAttr;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ThreadPool
|
* Name: ThreadPool
|
||||||
*
|
*
|
||||||
@@ -148,13 +221,13 @@ typedef struct THREADPOOLJOB
|
|||||||
int jobId;
|
int jobId;
|
||||||
} ThreadPoolJob;
|
} ThreadPoolJob;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ThreadPoolStats
|
* Name: ThreadPoolStats
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Structure to hold statistics
|
* Structure to hold statistics
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
typedef struct TPOOLSTATS
|
typedef struct TPOOLSTATS
|
||||||
{
|
{
|
||||||
double totalTimeHQ;
|
double totalTimeHQ;
|
||||||
@@ -179,15 +252,12 @@ typedef struct TPOOLSTATS
|
|||||||
} ThreadPoolStats;
|
} ThreadPoolStats;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* 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
|
* Allows jobs to be scheduled for running by threads in a
|
||||||
* thread pool. The thread pool is initialized with a
|
* thread pool. The thread pool is initialized with a
|
||||||
* minimum and maximum thread number as well as a
|
* minimum and maximum thread number as well as a max idle time
|
||||||
* max idle time
|
|
||||||
* and a jobs per thread ratio. If a worker thread waits the whole
|
* and a jobs per thread ratio. If a worker thread waits the whole
|
||||||
* max idle time without receiving a job and the thread pool
|
* max idle time without receiving a job and the thread pool
|
||||||
* currently has more threads running than the minimum
|
* currently has more threads running than the minimum
|
||||||
@@ -196,25 +266,22 @@ typedef struct TPOOLSTATS
|
|||||||
* becomes greater than the set ratio and the thread pool currently has
|
* becomes greater than the set ratio and the thread pool currently has
|
||||||
* less than the maximum threads then a new thread will
|
* less than the maximum threads then a new thread will
|
||||||
* be created.
|
* be created.
|
||||||
*
|
*/
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
typedef struct THREADPOOL
|
typedef struct THREADPOOL
|
||||||
{
|
{
|
||||||
ithread_mutex_t mutex; /* mutex to protect job qs */
|
ithread_mutex_t mutex; /* mutex to protect job qs */
|
||||||
ithread_cond_t condition; /* condition variable to signal Q */
|
ithread_cond_t condition; /* condition variable to signal Q */
|
||||||
ithread_cond_t start_and_shutdown; /* condition variable for start
|
ithread_cond_t start_and_shutdown; /* condition variable for start and stop */
|
||||||
and stop */
|
|
||||||
int lastJobId; /* ids for jobs */
|
int lastJobId; /* ids for jobs */
|
||||||
int shutdown; /* whether or not we are shutting down */
|
int shutdown; /* whether or not we are shutting down */
|
||||||
int totalThreads; /* total number of threads */
|
int totalThreads; /* total number of threads */
|
||||||
|
int busyThreads; /* number of threads that are currently executing jobs */
|
||||||
int persistentThreads; /* number of persistent threads */
|
int persistentThreads; /* number of persistent threads */
|
||||||
FreeList jobFreeList; /* free list of jobs */
|
FreeList jobFreeList; /* free list of jobs */
|
||||||
LinkedList lowJobQ; /* low priority job Q */
|
LinkedList lowJobQ; /* low priority job Q */
|
||||||
LinkedList medJobQ; /* med priority job Q */
|
LinkedList medJobQ; /* med priority job Q */
|
||||||
LinkedList highJobQ; /* high priority job Q */
|
LinkedList highJobQ; /* high priority job Q */
|
||||||
ThreadPoolJob *persistentJob; /* persistent job */
|
ThreadPoolJob *persistentJob; /* persistent job */
|
||||||
|
|
||||||
ThreadPoolAttr attr; /* thread pool attributes */
|
ThreadPoolAttr attr; /* thread pool attributes */
|
||||||
|
|
||||||
/* statistics */
|
/* statistics */
|
||||||
@@ -222,7 +289,6 @@ typedef struct THREADPOOL
|
|||||||
} ThreadPool;
|
} ThreadPool;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolInit
|
* Function: ThreadPoolInit
|
||||||
*
|
*
|
||||||
@@ -261,6 +327,7 @@ typedef struct THREADPOOL
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolAddPersistent
|
* Function: ThreadPoolAddPersistent
|
||||||
*
|
*
|
||||||
@@ -283,6 +350,7 @@ int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolGetAttr
|
* Function: ThreadPoolGetAttr
|
||||||
*
|
*
|
||||||
@@ -297,6 +365,8 @@ int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolSetAttr
|
* Function: ThreadPoolSetAttr
|
||||||
*
|
*
|
||||||
@@ -312,6 +382,7 @@ int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolAdd
|
* Function: ThreadPoolAdd
|
||||||
*
|
*
|
||||||
@@ -331,6 +402,7 @@ int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolRemove
|
* Function: ThreadPoolRemove
|
||||||
*
|
*
|
||||||
@@ -383,6 +455,7 @@ int ThreadPoolShutdown(ThreadPool *tp);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPJobSetPriority
|
* Function: TPJobSetPriority
|
||||||
*
|
*
|
||||||
@@ -396,6 +469,7 @@ int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPJobSetFreeFunction
|
* Function: TPJobSetFreeFunction
|
||||||
*
|
*
|
||||||
@@ -409,6 +483,7 @@ int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrInit
|
* Function: TPAttrInit
|
||||||
*
|
*
|
||||||
@@ -422,6 +497,7 @@ int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrInit(ThreadPoolAttr *attr);
|
int TPAttrInit(ThreadPoolAttr *attr);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetMaxThreads
|
* Function: TPAttrSetMaxThreads
|
||||||
*
|
*
|
||||||
@@ -435,6 +511,7 @@ int TPAttrInit(ThreadPoolAttr *attr);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetMinThreads
|
* Function: TPAttrSetMinThreads
|
||||||
*
|
*
|
||||||
@@ -448,6 +525,21 @@ int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: TPAttrSetStackSize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Sets the stack size for the thread pool attributes.
|
||||||
|
* Parameters:
|
||||||
|
* attr - must be valid thread pool attributes.
|
||||||
|
* stackSize - value to set
|
||||||
|
* Returns:
|
||||||
|
* Always returns 0.
|
||||||
|
*****************************************************************************/
|
||||||
|
int TPAttrSetStackSize(ThreadPoolAttr *attr, size_t stackSize);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetIdleTime
|
* Function: TPAttrSetIdleTime
|
||||||
*
|
*
|
||||||
@@ -460,6 +552,7 @@ int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetJobsPerThread
|
* Function: TPAttrSetJobsPerThread
|
||||||
*
|
*
|
||||||
@@ -473,6 +566,7 @@ int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetStarvationTime
|
* Function: TPAttrSetStarvationTime
|
||||||
*
|
*
|
||||||
@@ -486,6 +580,7 @@ int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime);
|
int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetSchedPolicy
|
* Function: TPAttrSetSchedPolicy
|
||||||
*
|
*
|
||||||
@@ -513,6 +608,7 @@ int TPAttrSetSchedPolicy(ThreadPoolAttr *attr, PolicyType schedPolicy);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolGetStats
|
* Function: ThreadPoolGetStats
|
||||||
*
|
*
|
||||||
@@ -527,18 +623,20 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef STATS
|
#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
|
#else
|
||||||
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
||||||
|
|
||||||
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ThreadPool */
|
|
||||||
|
#endif /* THREADPOOL_H */
|
||||||
|
|
||||||
|
|||||||
@@ -29,38 +29,45 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef TIMERTHREAD_H
|
#ifndef TIMERTHREAD_H
|
||||||
#define TIMERTHREAD_H
|
#define TIMERTHREAD_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "FreeList.h"
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include "LinkedList.h"
|
#include "LinkedList.h"
|
||||||
#include "FreeList.h"
|
|
||||||
#include "ThreadPool.h"
|
#include "ThreadPool.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define INVALID_EVENT_ID (-10 & 1<<29)
|
#define INVALID_EVENT_ID (-10 & 1<<29)
|
||||||
|
|
||||||
|
|
||||||
/* Timeout Types */
|
/* Timeout Types */
|
||||||
/* absolute means in seconds from Jan 1, 1970 */
|
/* absolute means in seconds from Jan 1, 1970 */
|
||||||
/* relative means in seconds from current time */
|
/* relative means in seconds from current time */
|
||||||
typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Name: TimerThread
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* A timer thread similar to the one in the Upnp SDK that allows
|
* 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
|
* Because the timer thread uses the thread pool there is no
|
||||||
* gurantee of timing, only approximate timing.
|
* gurantee of timing, only approximate timing.
|
||||||
* Uses ThreadPool, Mutex, Condition, Thread
|
|
||||||
*
|
*
|
||||||
*
|
* Uses ThreadPool, Mutex, Condition, Thread.
|
||||||
*****************************************************************************/
|
*/
|
||||||
typedef struct TIMERTHREAD
|
typedef struct TIMERTHREAD
|
||||||
{
|
{
|
||||||
ithread_mutex_t mutex;
|
ithread_mutex_t mutex;
|
||||||
@@ -73,116 +80,88 @@ typedef struct TIMERTHREAD
|
|||||||
} TimerThread;
|
} TimerThread;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Name: TimerEvent
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Struct to contain information for a timer event.
|
* Struct to contain information for a timer event.
|
||||||
* Internal to the TimerThread
|
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
* Internal to the TimerThread.
|
||||||
|
*/
|
||||||
typedef struct TIMEREVENT
|
typedef struct TIMEREVENT
|
||||||
{
|
{
|
||||||
ThreadPoolJob job;
|
ThreadPoolJob job;
|
||||||
time_t eventTime; /* absolute time for event in seconds since Jan 1, 1970 */
|
/*! [in] Absolute time for event in seconds since Jan 1, 1970. */
|
||||||
Duration persistent; /* long term or short term job */
|
time_t eventTime;
|
||||||
|
/*! [in] Long term or short term job. */
|
||||||
|
Duration persistent;
|
||||||
int id;
|
int id;
|
||||||
} TimerEvent;
|
} TimerEvent;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initializes and starts timer thread.
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadInit
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \return 0 on success, nonzero on failure. Returns error from
|
||||||
* Initializes and starts timer thread.
|
* ThreadPoolAddPersistent on failure.
|
||||||
*
|
*/
|
||||||
* Parameters:
|
int TimerThreadInit(
|
||||||
* timer - valid timer thread pointer.
|
/*! [in] Valid timer thread pointer. */
|
||||||
* tp - valid thread pool to use. Must be
|
TimerThread *timer,
|
||||||
* started. Must be valid for lifetime
|
/*! [in] Valid thread pool to use. Must be started. Must be valid for
|
||||||
* of timer. Timer must be shutdown
|
* lifetime of timer. Timer must be shutdown BEFORE thread pool. */
|
||||||
* BEFORE thread pool.
|
|
||||||
* Return:
|
|
||||||
* 0 on success, nonzero on failure
|
|
||||||
* Returns error from ThreadPoolAddPersistent on failure.
|
|
||||||
*
|
|
||||||
************************************************************************/
|
|
||||||
int TimerThreadInit(TimerThread *timer,
|
|
||||||
ThreadPool *tp);
|
ThreadPool *tp);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function: TimerThreadSchedule
|
* \brief Schedules an event to run at a specified time.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return 0 on success, nonzero on failure, EOUTOFMEM if not enough memory
|
||||||
* Schedules an event to run at a specified time.
|
* to schedule job.
|
||||||
*
|
*/
|
||||||
* Parameters:
|
int TimerThreadSchedule(
|
||||||
* timer - valid timer thread pointer.
|
/*! [in] Valid timer thread pointer. */
|
||||||
* time_t - time of event.
|
TimerThread* timer,
|
||||||
* either in absolute seconds,
|
/*! [in] time of event. Either in absolute seconds, or relative
|
||||||
* or relative seconds in the future.
|
* 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,
|
|
||||||
time_t time,
|
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,
|
TimeoutType type,
|
||||||
|
/*! [in] Valid Thread pool job with following fields. */
|
||||||
ThreadPoolJob *job,
|
ThreadPoolJob *job,
|
||||||
|
/*! [in] . */
|
||||||
Duration duration,
|
Duration duration,
|
||||||
|
/*! [in] Id of timer event. (out, can be null). */
|
||||||
int *id);
|
int *id);
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadRemove
|
/*!
|
||||||
|
* \brief Removes an event from the timer Q.
|
||||||
*
|
*
|
||||||
* Description:
|
* Events can only be removed before they have been placed in the thread pool.
|
||||||
* Removes an event from the timer Q.
|
|
||||||
* Events can only be removed
|
|
||||||
* before they have been placed in the
|
|
||||||
* thread pool.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return 0 on success, INVALID_EVENT_ID on failure.
|
||||||
* timer - valid timer thread pointer.
|
*/
|
||||||
* id - id of event to remove.
|
int TimerThreadRemove(
|
||||||
* ThreadPoolJob *out - space for thread pool job.
|
/*! [in] Valid timer thread pointer. */
|
||||||
* Return:
|
TimerThread *timer,
|
||||||
* 0 on success,
|
/*! [in] Id of event to remove. */
|
||||||
* INVALID_EVENT_ID on failure
|
|
||||||
*
|
|
||||||
************************************************************************/
|
|
||||||
int TimerThreadRemove(TimerThread *timer,
|
|
||||||
int id,
|
int id,
|
||||||
|
/*! [in] Space for thread pool job. */
|
||||||
ThreadPoolJob *out);
|
ThreadPoolJob *out);
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadShutdown
|
/*!
|
||||||
|
* \brief Shutdown the timer thread.
|
||||||
*
|
*
|
||||||
* Description:
|
|
||||||
* Shutdown the timer thread
|
|
||||||
* Events scheduled in the future will NOT be run.
|
* Events scheduled in the future will NOT be run.
|
||||||
* Timer thread should be shutdown BEFORE it's associated
|
*
|
||||||
* thread pool.
|
* Timer thread should be shutdown BEFORE it's associated thread pool.
|
||||||
* Returns:
|
*
|
||||||
* returns 0 if succesfull,
|
* \return 0 if succesfull, nonzero otherwise. Always returns 0.
|
||||||
* nonzero otherwise.
|
*/
|
||||||
* Always returns 0.
|
int TimerThreadShutdown(
|
||||||
***********************************************************************/
|
/*! [in] Valid timer thread pointer. */
|
||||||
int TimerThreadShutdown(TimerThread *timer);
|
TimerThread *timer);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#ifndef WIN32
|
#ifdef WIN32
|
||||||
|
/* Do not #include <unistd.h> */
|
||||||
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
|
#if defined(BSD)
|
||||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||||
/* This system has SuS2-compliant mutex attributes.
|
/* This system has SuS2-compliant mutex attributes.
|
||||||
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
||||||
@@ -66,6 +86,9 @@ extern "C" {
|
|||||||
#define ITHREAD_CANCELED PTHREAD_CANCELED
|
#define ITHREAD_CANCELED PTHREAD_CANCELED
|
||||||
|
|
||||||
|
|
||||||
|
#define ITHREAD_STACK_MIN PTHREAD_STACK_MIN
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Name: ithread_t
|
* Name: ithread_t
|
||||||
*
|
*
|
||||||
@@ -76,6 +99,7 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_t ithread_t;
|
typedef pthread_t ithread_t;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ithread_attr_t
|
* Name: ithread_attr_t
|
||||||
*
|
*
|
||||||
@@ -150,7 +174,9 @@ typedef pthread_condattr_t ithread_condattr_t;
|
|||||||
* typedef to pthread_rwlockattr_t
|
* typedef to pthread_rwlockattr_t
|
||||||
* Internal Use Only
|
* Internal Use Only
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -161,7 +187,101 @@ typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
|||||||
* typedef to pthread_rwlock_t
|
* typedef to pthread_rwlock_t
|
||||||
* Internal Use Only
|
* Internal Use Only
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
typedef pthread_rwlock_t ithread_rwlock_t;
|
typedef pthread_rwlock_t ithread_rwlock_t;
|
||||||
|
#else
|
||||||
|
/* Read-write locks aren't available: use mutex instead. */
|
||||||
|
typedef ithread_mutex_t ithread_rwlock_t;
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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
|
* Function: ithread_mutexattr_init
|
||||||
@@ -220,7 +340,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define ithread_mutexattr_setkind_np pthread_mutexattr_settype
|
#define ithread_mutexattr_setkind_np pthread_mutexattr_settype
|
||||||
#else
|
#else
|
||||||
#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np
|
#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np
|
||||||
#endif
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_mutexattr_getkind_np
|
* Function: ithread_mutexattr_getkind_np
|
||||||
@@ -245,7 +365,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
|
#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
|
||||||
#else
|
#else
|
||||||
#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np
|
#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np
|
||||||
#endif
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -333,7 +453,9 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlockattr_init
|
* See man page for pthread_rwlockattr_init
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlockattr_init pthread_rwlockattr_init
|
#define ithread_rwlockattr_init pthread_rwlockattr_init
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -349,7 +471,9 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlockattr_destroy
|
* See man page for pthread_rwlockattr_destroy
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
|
#define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -370,7 +494,9 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Returns EINVAL if the kind is not supported.
|
* Returns EINVAL if the kind is not supported.
|
||||||
* See man page for pthread_rwlockattr_setkind_np
|
* See man page for pthread_rwlockattr_setkind_np
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
|
#define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -391,7 +517,9 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlockatttr_getpshared
|
* See man page for pthread_rwlockatttr_getpshared
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
|
#define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -409,8 +537,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlock_init
|
* See man page for pthread_rwlock_init
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlock_init pthread_rwlock_init
|
#define ithread_rwlock_init pthread_rwlock_init
|
||||||
|
#else
|
||||||
|
/* Read-write locks aren't available: use mutex instead. */
|
||||||
|
#define ithread_rwlock_init ithread_mutex_init
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_rwlock_rdlock
|
* Function: ithread_rwlock_rdlock
|
||||||
@@ -426,8 +558,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlock_rdlock
|
* See man page for pthread_rwlock_rdlock
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlock_rdlock pthread_rwlock_rdlock
|
#define ithread_rwlock_rdlock pthread_rwlock_rdlock
|
||||||
|
#else
|
||||||
|
/* Read-write locks aren't available: use mutex instead. */
|
||||||
|
#define ithread_rwlock_rdlock ithread_mutex_lock
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_rwlock_wrlock
|
* Function: ithread_rwlock_wrlock
|
||||||
@@ -443,7 +579,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlock_wrlock
|
* See man page for pthread_rwlock_wrlock
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlock_wrlock pthread_rwlock_wrlock
|
#define ithread_rwlock_wrlock pthread_rwlock_wrlock
|
||||||
|
#else
|
||||||
|
/* Read-write locks aren't available: use mutex instead. */
|
||||||
|
#define ithread_rwlock_wrlock ithread_mutex_lock
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -461,7 +602,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlock_unlock
|
* See man page for pthread_rwlock_unlock
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlock_unlock pthread_rwlock_unlock
|
#define ithread_rwlock_unlock pthread_rwlock_unlock
|
||||||
|
#else
|
||||||
|
/* Read-write locks aren't available: use mutex instead. */
|
||||||
|
#define ithread_rwlock_unlock ithread_mutex_unlock
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -480,7 +626,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_rwlock_destroy
|
* See man page for pthread_rwlock_destroy
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
#define ithread_rwlock_destroy pthread_rwlock_destroy
|
#define ithread_rwlock_destroy pthread_rwlock_destroy
|
||||||
|
#else
|
||||||
|
/* Read-write locks aren't available: use mutex instead. */
|
||||||
|
#define ithread_rwlock_destroy ithread_mutex_destroy
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -499,7 +650,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define ithread_cond_init pthread_cond_init
|
#define ithread_cond_init pthread_cond_init
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_cond_signal
|
* Function: ithread_cond_signal
|
||||||
*
|
*
|
||||||
@@ -559,22 +709,18 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* Function: pthread_cond_timedwait
|
* Function: pthread_cond_timedwait
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Atomically releases the associated mutex and waits on the condition.
|
* Atomically releases the associated mutex and waits on the
|
||||||
* If the condition is not signaled in the specified time
|
* condition.
|
||||||
* than the
|
* If the condition is not signaled in the specified time than the
|
||||||
* call times out and returns.
|
* call times out and returns.
|
||||||
* Associated mutex MUST be locked by thread before entering
|
* Associated mutex MUST be locked by thread before entering this call.
|
||||||
* this call.
|
|
||||||
* Mutex is reacquired when call returns.
|
* Mutex is reacquired when call returns.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t * cond (must be valid non NULL pointer to
|
* ithread_cond_t *cond (must be valid non NULL pointer to ithread_cond_t)
|
||||||
* ithread_cond_t)
|
|
||||||
* cond must be initialized
|
* cond must be initialized
|
||||||
* ithread_mutex_t *mutex (must be valid non NULL pointer to
|
* ithread_mutex_t *mutex (must be valid non NULL pointer to ithread_mutex_t)
|
||||||
* ithread_mutex_t)
|
|
||||||
* Mutex must be locked.
|
* Mutex must be locked.
|
||||||
* const struct timespec *abstime (absolute time, measured
|
* const struct timespec *abstime (absolute time, measured from Jan 1, 1970)
|
||||||
* from Jan 1, 1970)
|
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
||||||
* See man page for pthread_cond_timedwait
|
* See man page for pthread_cond_timedwait
|
||||||
@@ -599,6 +745,49 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_cond_destroy pthread_cond_destroy
|
#define ithread_cond_destroy pthread_cond_destroy
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_attr_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialises thread attribute object.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_attr_t *attr (must be valid non NULL pointer to
|
||||||
|
* ithread_attr_t)
|
||||||
|
* Returns:
|
||||||
|
* 0 on success. Nonzero on failure.
|
||||||
|
* See man page for pthread_attr_init
|
||||||
|
***************************************************************************/
|
||||||
|
#define ithread_attr_init pthread_attr_init
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_attr_destroy
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Destroys thread attribute object.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_attr_t *attr (must be valid non NULL pointer to
|
||||||
|
* ithread_attr_t)
|
||||||
|
* Returns:
|
||||||
|
* 0 on success. Nonzero on failure.
|
||||||
|
* See man page for pthread_attr_destroy
|
||||||
|
***************************************************************************/
|
||||||
|
#define ithread_attr_destroy pthread_attr_destroy
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_attr_setstacksize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Sets stack size of a thread attribute object.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_attr_t *attr (must be valid non NULL pointer to
|
||||||
|
* ithread_attr_t)
|
||||||
|
* size_t stacksize (value of stacksize must be greater than
|
||||||
|
* ITHREAD_STACK_MIN and lower than system-imposed limits
|
||||||
|
* Returns:
|
||||||
|
* 0 on success. Nonzero on failure.
|
||||||
|
* See man page for pthread_attr_setstacksize
|
||||||
|
***************************************************************************/
|
||||||
|
#define ithread_attr_setstacksize pthread_attr_setstacksize
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_create
|
* Function: ithread_create
|
||||||
@@ -608,7 +797,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* and argument.
|
* and argument.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_t * thread (must be valid non NULL pointer to pthread_t)
|
* ithread_t * thread (must be valid non NULL pointer to pthread_t)
|
||||||
* ithread_attr_t *attr, IGNORED
|
* ithread_attr_t *attr
|
||||||
* void * (start_routine) (void *arg) (start routine)
|
* void * (start_routine) (void *arg) (start routine)
|
||||||
* void * arg - argument.
|
* void * arg - argument.
|
||||||
* Returns:
|
* Returns:
|
||||||
@@ -646,6 +835,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_exit pthread_exit
|
#define ithread_exit pthread_exit
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_get_current_thread_id
|
* Function: ithread_get_current_thread_id
|
||||||
*
|
*
|
||||||
@@ -669,6 +859,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_self pthread_self
|
#define ithread_self pthread_self
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_detach
|
* Function: ithread_detach
|
||||||
*
|
*
|
||||||
@@ -682,6 +873,7 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_detach pthread_detach
|
#define ithread_detach pthread_detach
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_join
|
* Function: ithread_join
|
||||||
*
|
*
|
||||||
@@ -701,7 +893,6 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
#define ithread_join pthread_join
|
#define ithread_join pthread_join
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
*
|
*
|
||||||
@@ -715,7 +906,12 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* 0 on success, Nonzero on failure.
|
* 0 on success, Nonzero on failure.
|
||||||
* See man page for sleep (man 3 sleep)
|
* See man page for sleep (man 3 sleep)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
#ifdef WIN32
|
||||||
|
#define isleep(x) Sleep((x)*1000)
|
||||||
|
#else
|
||||||
#define isleep sleep
|
#define isleep sleep
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
@@ -730,21 +926,10 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
* 0 on success, Nonzero on failure.
|
* 0 on success, Nonzero on failure.
|
||||||
* See man page for sleep (man 3 sleep)
|
* See man page for sleep (man 3 sleep)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#define imillisleep(x) usleep(1000*x)
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef UPNP_STATIC_LIB
|
#define imillisleep Sleep
|
||||||
#ifdef LIBUPNP_EXPORTS
|
|
||||||
/* set up declspec for dll export to make functions visible to library users */
|
|
||||||
#define EXPORT_SPEC __declspec(dllexport)
|
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC __declspec(dllimport)
|
#define imillisleep(x) usleep(1000*x)
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define EXPORT_SPEC
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define EXPORT_SPEC
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -753,9 +938,11 @@ typedef pthread_rwlock_t ithread_rwlock_t;
|
|||||||
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ITHREADH */
|
|
||||||
|
#endif /* ITHREAD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +1,55 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "LinkedList.h"
|
#include "LinkedList.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/* Do not #include <sys/param.h> */
|
||||||
|
#else
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
|
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
freeListNode( ListNode * node,
|
freeListNode( ListNode * node,
|
||||||
LinkedList * list )
|
LinkedList * list )
|
||||||
@@ -532,3 +544,4 @@ ListSize( LinkedList * list )
|
|||||||
|
|
||||||
return list->size;
|
return list->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,68 +1,69 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "TimerThread.h"
|
#include "TimerThread.h"
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: FreeTimerEvent
|
/*!
|
||||||
*
|
* \brief Deallocates a dynamically allocated TimerEvent.
|
||||||
* Description:
|
*/
|
||||||
* Deallocates a dynamically allocated TimerEvent.
|
static void FreeTimerEvent(
|
||||||
* Parameters:
|
/*! [in] Valid timer thread pointer. */
|
||||||
* TimerEvent *event - must be allocated with CreateTimerEvent
|
TimerThread *timer,
|
||||||
*****************************************************************************/
|
/*! [in] Must be allocated with CreateTimerEvent*/
|
||||||
static void
|
|
||||||
FreeTimerEvent( TimerThread * timer,
|
|
||||||
TimerEvent *event)
|
TimerEvent *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
assert(timer != NULL);
|
assert(timer != NULL);
|
||||||
|
|
||||||
FreeListFree(&timer->freeEvents, event);
|
FreeListFree(&timer->freeEvents, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: TimerThreadWorker
|
/*!
|
||||||
|
* \brief Implements timer thread.
|
||||||
*
|
*
|
||||||
* Description:
|
* Waits for next event to occur and schedules associated job into threadpool.
|
||||||
* Implements timer thread.
|
*/
|
||||||
* Waits for next event to occur and schedules
|
static void *TimerThreadWorker(
|
||||||
* associated job into threadpool.
|
/*! [in] arg is cast to (TimerThread *). */
|
||||||
* Internal Only.
|
void *arg)
|
||||||
* Parameters:
|
|
||||||
* void * arg -> is cast to TimerThread *
|
|
||||||
*****************************************************************************/
|
|
||||||
static void *
|
|
||||||
TimerThreadWorker( void *arg )
|
|
||||||
{
|
{
|
||||||
TimerThread *timer = ( TimerThread * ) arg;
|
TimerThread *timer = ( TimerThread * ) arg;
|
||||||
ListNode *head = NULL;
|
ListNode *head = NULL;
|
||||||
@@ -81,19 +82,14 @@ TimerThreadWorker( void *arg )
|
|||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
|
|
||||||
//mutex should always be locked at top of loop
|
//mutex should always be locked at top of loop
|
||||||
|
|
||||||
//Check for shutdown
|
//Check for shutdown
|
||||||
|
|
||||||
if( timer->shutdown )
|
if( timer->shutdown )
|
||||||
{
|
{
|
||||||
|
|
||||||
timer->shutdown = 0;
|
timer->shutdown = 0;
|
||||||
ithread_cond_signal( &timer->condition );
|
ithread_cond_signal( &timer->condition );
|
||||||
ithread_mutex_unlock( &timer->mutex );
|
ithread_mutex_unlock( &timer->mutex );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nextEvent = NULL;
|
nextEvent = NULL;
|
||||||
@@ -102,7 +98,6 @@ TimerThreadWorker( void *arg )
|
|||||||
if( timer->eventQ.size > 0 )
|
if( timer->eventQ.size > 0 )
|
||||||
{
|
{
|
||||||
head = ListHead( &timer->eventQ );
|
head = ListHead( &timer->eventQ );
|
||||||
|
|
||||||
nextEvent = ( TimerEvent * ) head->item;
|
nextEvent = ( TimerEvent * ) head->item;
|
||||||
nextEventTime = nextEvent->eventTime;
|
nextEventTime = nextEvent->eventTime;
|
||||||
}
|
}
|
||||||
@@ -110,53 +105,41 @@ TimerThreadWorker( void *arg )
|
|||||||
currentTime = time( NULL );
|
currentTime = time( NULL );
|
||||||
|
|
||||||
//If time has elapsed, schedule job
|
//If time has elapsed, schedule job
|
||||||
|
|
||||||
if( ( nextEvent != NULL ) && ( currentTime >= nextEventTime ) )
|
if( ( nextEvent != NULL ) && ( currentTime >= nextEventTime ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( nextEvent->persistent ) {
|
if( nextEvent->persistent ) {
|
||||||
|
|
||||||
ThreadPoolAddPersistent( timer->tp, &nextEvent->job,
|
ThreadPoolAddPersistent( timer->tp, &nextEvent->job,
|
||||||
&tempId );
|
&tempId );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ThreadPoolAdd( timer->tp, &nextEvent->job, &tempId );
|
ThreadPoolAdd( timer->tp, &nextEvent->job, &tempId );
|
||||||
}
|
}
|
||||||
|
|
||||||
ListDelNode( &timer->eventQ, head, 0 );
|
ListDelNode( &timer->eventQ, head, 0 );
|
||||||
FreeTimerEvent( timer, nextEvent );
|
FreeTimerEvent( timer, nextEvent );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( nextEvent != NULL ) {
|
if( nextEvent != NULL ) {
|
||||||
timeToWait.tv_nsec = 0;
|
timeToWait.tv_nsec = 0;
|
||||||
timeToWait.tv_sec = nextEvent->eventTime;
|
timeToWait.tv_sec = nextEvent->eventTime;
|
||||||
|
|
||||||
ithread_cond_timedwait( &timer->condition, &timer->mutex,
|
ithread_cond_timedwait( &timer->condition, &timer->mutex,
|
||||||
&timeToWait );
|
&timeToWait );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ithread_cond_wait( &timer->condition, &timer->mutex );
|
ithread_cond_wait( &timer->condition, &timer->mutex );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: CalculateEventTime
|
/*!
|
||||||
|
* \brief Calculates the appropriate timeout in absolute seconds
|
||||||
|
* since Jan 1, 1970.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return
|
||||||
* Calculates the appropriate timeout in absolute seconds since
|
*/
|
||||||
* Jan 1, 1970
|
static int CalculateEventTime(
|
||||||
* Internal Only.
|
/*! [in] Timeout. */
|
||||||
* Parameters:
|
time_t *timeout,
|
||||||
* time_t *timeout - timeout
|
/*! [in] Timeout type. */
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
static int
|
|
||||||
CalculateEventTime( time_t * timeout,
|
|
||||||
TimeoutType type)
|
TimeoutType type)
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
@@ -175,28 +158,21 @@ CalculateEventTime( time_t * timeout,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: CreateTimerEvent
|
* \brief Creates a Timer Event. (Dynamically allocated).
|
||||||
*
|
*
|
||||||
* Description:
|
* \return (TimerEvent *) on success, NULL on failure.
|
||||||
* Creates a Timer Event. (Dynamically allocated)
|
*/
|
||||||
* Internal to timer thread.
|
static TimerEvent *CreateTimerEvent(
|
||||||
* Parameters:
|
/*! [in] Valid timer thread pointer. */
|
||||||
* func - thread function to run.
|
TimerThread *timer,
|
||||||
* arg - argument to function.
|
/*! [in] . */
|
||||||
* 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,
|
|
||||||
ThreadPoolJob *job,
|
ThreadPoolJob *job,
|
||||||
|
/*! [in] . */
|
||||||
Duration persistent,
|
Duration persistent,
|
||||||
|
/*! [in] The absoule time of the event in seconds from Jan, 1970. */
|
||||||
time_t eventTime,
|
time_t eventTime,
|
||||||
|
/*! [in] Id of job. */
|
||||||
int id)
|
int id)
|
||||||
{
|
{
|
||||||
TimerEvent *temp = NULL;
|
TimerEvent *temp = NULL;
|
||||||
@@ -215,25 +191,8 @@ CreateTimerEvent( TimerThread * timer,
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadInit
|
int TimerThreadInit(TimerThread *timer, ThreadPool *tp)
|
||||||
*
|
|
||||||
* 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 rc = 0;
|
int rc = 0;
|
||||||
@@ -290,32 +249,9 @@ TimerThreadInit( TimerThread * timer,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadSchedule
|
int TimerThreadSchedule(
|
||||||
*
|
TimerThread *timer,
|
||||||
* 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,
|
|
||||||
time_t timeout,
|
time_t timeout,
|
||||||
TimeoutType type,
|
TimeoutType type,
|
||||||
ThreadPoolJob *job,
|
ThreadPoolJob *job,
|
||||||
@@ -394,26 +330,9 @@ TimerThreadSchedule( TimerThread * timer,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadRemove
|
int TimerThreadRemove(
|
||||||
*
|
TimerThread *timer,
|
||||||
* 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 id,
|
int id,
|
||||||
ThreadPoolJob *out)
|
ThreadPoolJob *out)
|
||||||
{
|
{
|
||||||
@@ -450,21 +369,8 @@ TimerThreadRemove( TimerThread * timer,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: TimerThreadShutdown
|
int TimerThreadShutdown(TimerThread *timer)
|
||||||
*
|
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
ListNode *tempNode2 = NULL;
|
ListNode *tempNode2 = NULL;
|
||||||
ListNode *tempNode = NULL;
|
ListNode *tempNode = NULL;
|
||||||
@@ -517,3 +423,4 @@ TimerThreadShutdown( TimerThread * timer )
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# "Makefile.am" for "libupnp/upnp"
|
# "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
|
SUBDIRS = doc . sample
|
||||||
@@ -19,8 +19,11 @@ LDADD = \
|
|||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = \
|
upnpinclude_HEADERS = \
|
||||||
|
inc/UpnpString.h \
|
||||||
inc/upnp.h \
|
inc/upnp.h \
|
||||||
inc/upnpdebug.h
|
inc/upnpdebug.h \
|
||||||
|
inc/UpnpGlobal.h \
|
||||||
|
inc/UpnpInet.h
|
||||||
|
|
||||||
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
||||||
if ENABLE_TOOLS
|
if ENABLE_TOOLS
|
||||||
@@ -46,7 +49,6 @@ libupnp_la_SOURCES = \
|
|||||||
src/inc/gena_device.h \
|
src/inc/gena_device.h \
|
||||||
src/inc/global.h \
|
src/inc/global.h \
|
||||||
src/inc/gmtdate.h \
|
src/inc/gmtdate.h \
|
||||||
src/inc/http_client.h \
|
|
||||||
src/inc/httpparser.h \
|
src/inc/httpparser.h \
|
||||||
src/inc/httpreadwrite.h \
|
src/inc/httpreadwrite.h \
|
||||||
src/inc/md5.h \
|
src/inc/md5.h \
|
||||||
@@ -65,13 +67,12 @@ libupnp_la_SOURCES = \
|
|||||||
src/inc/sysdep.h \
|
src/inc/sysdep.h \
|
||||||
src/inc/unixutil.h \
|
src/inc/unixutil.h \
|
||||||
src/inc/upnpapi.h \
|
src/inc/upnpapi.h \
|
||||||
src/inc/upnpclosesocket.h \
|
|
||||||
src/inc/upnp_timeout.h \
|
src/inc/upnp_timeout.h \
|
||||||
src/inc/uri.h \
|
src/inc/uri.h \
|
||||||
src/inc/urlconfig.h \
|
src/inc/urlconfig.h \
|
||||||
src/inc/util.h \
|
src/inc/upnputil.h \
|
||||||
src/inc/utilall.h \
|
|
||||||
src/inc/uuid.h \
|
src/inc/uuid.h \
|
||||||
|
src/inc/VirtualDir.h \
|
||||||
src/inc/webserver.h
|
src/inc/webserver.h
|
||||||
|
|
||||||
# ssdp
|
# ssdp
|
||||||
@@ -110,10 +111,14 @@ libupnp_la_SOURCES += \
|
|||||||
src/gena/gena_callback2.c
|
src/gena/gena_callback2.c
|
||||||
|
|
||||||
# api
|
# api
|
||||||
libupnp_la_SOURCES += src/api/upnpapi.c
|
libupnp_la_SOURCES += \
|
||||||
|
src/api/UpnpString.c \
|
||||||
|
src/api/upnpapi.c
|
||||||
|
|
||||||
if ENABLE_TOOLS
|
if ENABLE_TOOLS
|
||||||
libupnp_la_SOURCES += src/api/upnptools.c
|
libupnp_la_SOURCES += src/api/upnptools.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_DEBUG
|
if ENABLE_DEBUG
|
||||||
libupnp_la_SOURCES += src/api/upnpdebug.c
|
libupnp_la_SOURCES += src/api/upnpdebug.c
|
||||||
endif
|
endif
|
||||||
@@ -130,6 +135,12 @@ libupnp_la_SOURCES += \
|
|||||||
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
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 / distcheck tests
|
||||||
check_PROGRAMS = test_init
|
check_PROGRAMS = test_init
|
||||||
TESTS = test_init
|
TESTS = test_init
|
||||||
@@ -138,8 +149,7 @@ test_init_SOURCES = test/test_init.c
|
|||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
src/inc/inet_pton.h \
|
m4/libupnp.m4 \
|
||||||
src/inet_pton.c \
|
|
||||||
src/win_dll.c
|
src/win_dll.c
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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 */
|
||||||
|
|
||||||
38
upnp/inc/UpnpInet.h
Normal file
38
upnp/inc/UpnpInet.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#ifndef UPNPINET_H
|
||||||
|
#define UPNPINET_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* \brief Provides a platform independent way to include TCP/IP types and functions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <Ws2tcpip.h>
|
||||||
|
|
||||||
|
#define UpnpCloseSocket closesocket
|
||||||
|
#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>
|
||||||
|
|
||||||
|
#include <unistd.h> /* for close(). Do not include in WIN32. */
|
||||||
|
#define SOCKET int
|
||||||
|
#define INVALID_SOCKET ((SOCKET)(-1))
|
||||||
|
#define UpnpCloseSocket close
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* UPNPINET_H */
|
||||||
|
|
||||||
171
upnp/inc/UpnpString.h
Normal file
171
upnp/inc/UpnpString.h
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h> /* for size_t */
|
||||||
|
|
||||||
|
|
||||||
|
#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 size_t UpnpString_get_Length(
|
||||||
|
/*! [in] The \em \b this pointer. */
|
||||||
|
const UpnpString *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Truncates the string to the specified lenght, or does nothing
|
||||||
|
* if the current lenght is less than or equal to the requested length.
|
||||||
|
* */
|
||||||
|
EXPORT_SPEC void UpnpString_set_Length(
|
||||||
|
/*! [in] The \em \b this pointer. */
|
||||||
|
UpnpString *p,
|
||||||
|
/*! [in] The requested length. */
|
||||||
|
size_t n);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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 int 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 int 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.*/
|
||||||
|
size_t n);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Clears the string, sets its size to zero.
|
||||||
|
*/
|
||||||
|
EXPORT_SPEC void UpnpString_clear(
|
||||||
|
/*! [in] The \em \b this pointer. */
|
||||||
|
UpnpString *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Compares two strings for equality. Case matters.
|
||||||
|
*
|
||||||
|
* \return The result of strcmp().
|
||||||
|
*/
|
||||||
|
EXPORT_SPEC int UpnpString_cmp(
|
||||||
|
/*! [in] The \em \b the first string. */
|
||||||
|
UpnpString *p,
|
||||||
|
/*! [in] The \em \b the second string. */
|
||||||
|
UpnpString *q);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Compares two strings for equality. Case does not matter.
|
||||||
|
*
|
||||||
|
* \return The result of strcasecmp().
|
||||||
|
*/
|
||||||
|
EXPORT_SPEC int UpnpString_casecmp(
|
||||||
|
/*! [in] The \em \b the first string. */
|
||||||
|
UpnpString *p,
|
||||||
|
/*! [in] The \em \b the second string. */
|
||||||
|
UpnpString *q);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
/* @} UpnpString The UpnpString API */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* STRING_H */
|
||||||
|
|
||||||
3671
upnp/inc/upnp.h
3671
upnp/inc/upnp.h
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/* -*- C -*- */
|
/* -*- C -*- */
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
* Copyright (c) 2006 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -90,6 +90,9 @@
|
|||||||
* (i.e. configure --enable-tools) : <upnp/upnptools.h> file is available */
|
* (i.e. configure --enable-tools) : <upnp/upnptools.h> file is available */
|
||||||
#undef UPNP_HAVE_TOOLS
|
#undef UPNP_HAVE_TOOLS
|
||||||
|
|
||||||
|
/** Defined to 1 if the library has been compiled with ipv6 support
|
||||||
|
* (i.e. configure --enable-ipv6) */
|
||||||
|
#undef UPNP_ENABLE_IPV6
|
||||||
|
|
||||||
#endif /* UPNP_CONFIG_H */
|
#endif /* UPNP_CONFIG_H */
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -33,25 +33,34 @@
|
|||||||
#ifndef UPNP_DEBUG_H
|
#ifndef UPNP_DEBUG_H
|
||||||
#define UPNP_DEBUG_H
|
#define UPNP_DEBUG_H
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ThreadPool.h"
|
||||||
#include "upnpconfig.h"
|
#include "upnpconfig.h"
|
||||||
|
#include "UpnpGlobal.h" /* for UPNP_INLINE */
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** @name Other debugging features
|
/** \name Other debugging features
|
||||||
The UPnP SDK contains other features to aid in debugging.
|
*
|
||||||
|
* The UPnP SDK contains other features to aid in debugging.
|
||||||
*/
|
*/
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
/*! @{ */
|
/** \name Upnp_LogLevel
|
||||||
|
|
||||||
/** @name Upnp_LogLevel
|
|
||||||
* The user has the option to select 4 different types of debugging levels,
|
* The user has the option to select 4 different types of debugging levels,
|
||||||
* see {\tt UpnpSetLogLevel}.
|
* see \c UpnpSetLogLevel.
|
||||||
* The critical level will show only those messages
|
* The critical level will show only those messages
|
||||||
* which can halt the normal processing of the library, like memory
|
* which can halt the normal processing of the library, like memory
|
||||||
* allocation errors. The remaining three levels are just for debugging
|
* allocation errors. The remaining three levels are just for debugging
|
||||||
@@ -60,14 +69,11 @@ extern "C" {
|
|||||||
* Info Level displays the other important operational information
|
* Info Level displays the other important operational information
|
||||||
* regarding the working of the library. If the user selects All,
|
* regarding the working of the library. If the user selects All,
|
||||||
* then the library displays all the debugging information that it has.
|
* then the library displays all the debugging information that it has.
|
||||||
* \begin{itemize}
|
* \li \c UPNP_CRITICAL [0]
|
||||||
* \item {\tt UPNP_CRITICAL [0]}
|
* \li \c UPNP_PACKET [1]
|
||||||
* \item {\tt UPNP_PACKET [1]}
|
* \li \c UPNP_INFO [2]
|
||||||
* \item {\tt UPNP_INFO [2]}
|
* \li \c UPNP_ALL [3]
|
||||||
* \item {\tt UPNP_ALL [3]}
|
|
||||||
* \end{itemize}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum Upnp_Module {
|
typedef enum Upnp_Module {
|
||||||
SSDP,
|
SSDP,
|
||||||
SOAP,
|
SOAP,
|
||||||
@@ -79,91 +85,69 @@ typedef enum Upnp_Module {
|
|||||||
HTTP
|
HTTP
|
||||||
} Dbg_Module;
|
} Dbg_Module;
|
||||||
|
|
||||||
/*! @{ */
|
|
||||||
|
/*@{*/
|
||||||
typedef enum Upnp_LogLevel_e {
|
typedef enum Upnp_LogLevel_e {
|
||||||
UPNP_CRITICAL,
|
UPNP_CRITICAL,
|
||||||
UPNP_PACKET,
|
UPNP_PACKET,
|
||||||
UPNP_INFO,
|
UPNP_INFO,
|
||||||
UPNP_ALL
|
UPNP_ALL
|
||||||
} Upnp_LogLevel;
|
} Upnp_LogLevel;
|
||||||
/*! @} */
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default log level : see {\tt Upnp_LogLevel}
|
* Default log level : see \c Upnp_LogLevel
|
||||||
*/
|
*/
|
||||||
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpInitLog
|
* \brief Initialize the log files.
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* \return -1 if fails or UPNP_E_SUCCESS if succeeds.
|
||||||
*
|
*/
|
||||||
* Description:
|
|
||||||
* This functions initializes the log files
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* -1 : If fails
|
|
||||||
* UPNP_E_SUCCESS : if success
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int UpnpInitLog();
|
int UpnpInitLog(void);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
static UPNP_INLINE int UpnpInitLog(void)
|
||||||
|
{
|
||||||
|
return UPNP_E_SUCCESS;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpSetLogLevel
|
* \brief Set the log level (see \c Upnp_LogLevel).
|
||||||
*
|
*/
|
||||||
* Parameters: Upnp_LogLevel log_level
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
|
||||||
* Returns: void
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
void UpnpSetLogLevel(
|
||||||
|
/*! [in] Log level. */
|
||||||
|
Upnp_LogLevel log_level);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpCloseLog
|
* \brief Closes the log files.
|
||||||
*
|
*/
|
||||||
* Parameters: void
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This functions closes the log files
|
|
||||||
* Returns: void
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpCloseLog();
|
void UpnpCloseLog(void);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpCloseLog() {}
|
static UPNP_INLINE void UpnpCloseLog(void) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpSetLogFileNames
|
* \brief Set the name for error and information files, respectively.
|
||||||
*
|
*/
|
||||||
* 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
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpSetLogFileNames(
|
void UpnpSetLogFileNames(
|
||||||
|
/*! [in] Name of the error file. */
|
||||||
const char *ErrFileName,
|
const char *ErrFileName,
|
||||||
|
/*! [in] Name of the information file. */
|
||||||
const char *InfoFileName);
|
const char *InfoFileName);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpSetLogFileNames(
|
static UPNP_INLINE void UpnpSetLogFileNames(
|
||||||
@@ -172,24 +156,20 @@ static UPNP_INLINE void UpnpSetLogFileNames(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpGetDebugFile
|
* \brief Check if the module is turned on for debug and returns the file
|
||||||
|
* descriptor corresponding to the debug level
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return NULL if the module is turn off for debug otheriwse returns the
|
||||||
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
* right file descriptor.
|
||||||
* 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
|
#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
|
#else
|
||||||
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : DebugAtThisLevel
|
* \brief Returns true if debug output should be done in this module.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return Nonzero value if true, zero if false.
|
||||||
* 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
|
#ifdef DEBUG
|
||||||
int DebugAtThisLevel(
|
int DebugAtThisLevel(
|
||||||
IN Upnp_LogLevel DLevel,
|
/*! [in] The level of the debug logging. It will decide whether debug
|
||||||
IN Dbg_Module Module);
|
* 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
|
#else
|
||||||
static UPNP_INLINE int DebugAtThisLevel(
|
static UPNP_INLINE int DebugAtThisLevel(
|
||||||
IN Upnp_LogLevel DLevel,
|
Upnp_LogLevel DLevel,
|
||||||
IN Dbg_Module Module) { return 0; }
|
Dbg_Module Module)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpPrintf
|
* \brief Prints the debug statement either on the standard output or log file
|
||||||
*
|
* along with the information from where this debug statement is coming.
|
||||||
* 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
|
#ifdef DEBUG
|
||||||
void UpnpPrintf(
|
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,
|
Upnp_LogLevel DLevel,
|
||||||
|
/*! [in] debug will go in the name of this module. */
|
||||||
Dbg_Module Module,
|
Dbg_Module Module,
|
||||||
|
/*! [in] Name of the file from where debug statement is coming. */
|
||||||
const char* DbgFileName,
|
const char* DbgFileName,
|
||||||
|
/*! [in] Line number of the file from where debug statement is coming. */
|
||||||
int DbgLineNo,
|
int DbgLineNo,
|
||||||
|
/*! [in] Printf like format specification. */
|
||||||
const char* FmtStr,
|
const char* FmtStr,
|
||||||
|
/*! [in] Printf like Variable number of arguments that will go in the debug
|
||||||
|
* statement. */
|
||||||
...)
|
...)
|
||||||
#if (__GNUC__ >= 3)
|
#if (__GNUC__ >= 3)
|
||||||
/* This enables printf like format checking by the compiler */
|
/* This enables printf like format checking by the compiler */
|
||||||
@@ -265,29 +232,44 @@ static UPNP_INLINE void UpnpPrintf(
|
|||||||
const char* DbgFileName,
|
const char* DbgFileName,
|
||||||
int DbgLineNo,
|
int DbgLineNo,
|
||||||
const char* FmtStr,
|
const char* FmtStr,
|
||||||
...) {}
|
...)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpDisplayBanner
|
* \brief Writes the file name and file number from where debug statement is
|
||||||
*
|
* coming to the log file.
|
||||||
* Parameters:
|
*/
|
||||||
* IN FILE *fd: file descriptor where the banner will be written
|
#ifdef DEBUG
|
||||||
* IN char **lines: The buffer that will be written
|
void UpnpDisplayFileAndLine(
|
||||||
* IN int size: Size of the buffer
|
/*! [in] File descriptor where line number and file name will be written. */
|
||||||
* IN int starLength: This parameter provides the width of the banner
|
FILE *fd,
|
||||||
*
|
/*! [in] Name of the file. */
|
||||||
* Description:
|
const char *DbgFileName,
|
||||||
* This functions takes the buffer and writes the buffer in the file as
|
/*! [in] Line number of the file. */
|
||||||
* per the requested banner
|
int DbgLineNo);
|
||||||
* Returns: void
|
#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
|
#ifdef DEBUG
|
||||||
void UpnpDisplayBanner(
|
void UpnpDisplayBanner(
|
||||||
|
/*! [in] file descriptor where the banner will be written. */
|
||||||
FILE *fd,
|
FILE *fd,
|
||||||
|
/*! [in] The buffer that will be written. */
|
||||||
const char **lines,
|
const char **lines,
|
||||||
|
/*! [in] Size of the buffer. */
|
||||||
size_t size,
|
size_t size,
|
||||||
|
/*! [in] This parameter provides the width of the banner. */
|
||||||
int starlength);
|
int starlength);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpDisplayBanner(
|
static UPNP_INLINE void UpnpDisplayBanner(
|
||||||
@@ -298,33 +280,31 @@ static UPNP_INLINE void UpnpDisplayBanner(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpDisplayFileAndLine
|
* \brief Prints thread pool statistics.
|
||||||
*
|
*/
|
||||||
* 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
|
#ifdef DEBUG
|
||||||
void UpnpDisplayFileAndLine(
|
void PrintThreadPoolStats(
|
||||||
FILE *fd,
|
/*! [in] The thread pool. */
|
||||||
|
ThreadPool *tp,
|
||||||
|
/*! [in] The file name that called this function, use the macro __FILE__. */
|
||||||
const char *DbgFileName,
|
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
|
#else
|
||||||
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
static UPNP_INLINE void PrintThreadPoolStats(
|
||||||
FILE *fd,
|
ThreadPool *tp,
|
||||||
const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
int DbgLineNo) {}
|
int DbgLineNo,
|
||||||
|
const char *msg)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*! @} */
|
|
||||||
|
/*@}*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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
|
#ifndef UPNP_TOOLS_H
|
||||||
#define 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 */
|
/* Function declarations only if tools compiled into the library */
|
||||||
#if UPNP_HAVE_TOOLS
|
#if UPNP_HAVE_TOOLS
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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
|
* \brief Converts an SDK error code into a string error message suitable for
|
||||||
* {\bf BaseURL} and {\bf RelURL} combined.
|
* display. The memory returned from this function should NOT be freed.
|
||||||
*
|
*
|
||||||
* @return [int] An integer representing one of the following:
|
* \return An ASCII text string representation of the error message associated
|
||||||
* \begin{itemize}
|
* with the error code or the string "Unknown error code"
|
||||||
* \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}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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(
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*! @} */
|
||||||
|
|
||||||
|
|
||||||
#endif /* UPNP_HAVE_TOOLS */
|
#endif /* UPNP_HAVE_TOOLS */
|
||||||
|
|
||||||
|
|
||||||
#endif /* UPNP_TOOLS_H */
|
#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
|
||||||
|
])
|
||||||
@@ -69,8 +69,9 @@ upnp_tv_combo_SOURCES = \
|
|||||||
if WITH_DOCUMENTATION
|
if WITH_DOCUMENTATION
|
||||||
examplesdir = $(docdir)/examples
|
examplesdir = $(docdir)/examples
|
||||||
examples_DATA = \
|
examples_DATA = \
|
||||||
|
$(sort \
|
||||||
$(upnp_tv_ctrlpt_SOURCES) \
|
$(upnp_tv_ctrlpt_SOURCES) \
|
||||||
$(upnp_tv_device_SOURCES)
|
$(upnp_tv_device_SOURCES))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +1,58 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef SAMPLE_UTIL_H
|
#ifndef SAMPLE_UTIL_H
|
||||||
#define SAMPLE_UTIL_H
|
#define SAMPLE_UTIL_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
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 <stdlib.h>
|
||||||
|
|
||||||
#include <string.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;
|
extern ithread_mutex_t display_mutex;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STATE_UPDATE = 0,
|
STATE_UPDATE = 0,
|
||||||
DEVICE_ADDED = 1,
|
DEVICE_ADDED = 1,
|
||||||
@@ -162,9 +168,13 @@ int SampleUtil_PrintEvent(IN Upnp_EventType EventType,
|
|||||||
* controlURL -- OUT -- The control URL for the service
|
* controlURL -- OUT -- The control URL for the service
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int SampleUtil_FindAndParseService (IN IXML_Document *DescDoc, IN char* location,
|
int SampleUtil_FindAndParseService (
|
||||||
IN char *serviceType, OUT char **serviceId,
|
IN IXML_Document *DescDoc,
|
||||||
OUT char **eventURL, OUT char **controlURL);
|
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
|
* const char * UDN
|
||||||
* int newDevice
|
* 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);
|
eventType type);
|
||||||
|
|
||||||
//global state update function used by smaple util
|
//global state update function used by smaple util
|
||||||
@@ -224,7 +237,7 @@ int SampleUtil_Initialize(print_string print_function);
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int SampleUtil_Finish(void);
|
int SampleUtil_Finish();
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* SampleUtil_Print
|
* SampleUtil_Print
|
||||||
@@ -258,11 +271,22 @@ int SampleUtil_RegisterUpdateFunction( state_update update_function );
|
|||||||
* Parameters:
|
* 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);
|
eventType type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* UPNPSDK_UTIL_H */
|
|
||||||
|
#endif /* SAMPLE_UTIL_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "sample_util.h"
|
#include "sample_util.h"
|
||||||
@@ -130,7 +130,8 @@ TvCtrlPointPrintLongHelp( void )
|
|||||||
SampleUtil_Print( "" );
|
SampleUtil_Print( "" );
|
||||||
SampleUtil_Print( "This sample control point application automatically searches" );
|
SampleUtil_Print( "This sample control point application automatically searches" );
|
||||||
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
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( "" );
|
||||||
SampleUtil_Print( "Commands:" );
|
SampleUtil_Print( "Commands:" );
|
||||||
SampleUtil_Print( " Help" );
|
SampleUtil_Print( " Help" );
|
||||||
@@ -449,17 +450,18 @@ device_main( int argc, char **argv )
|
|||||||
|
|
||||||
port = ( unsigned short )portTemp;
|
port = ( unsigned short )portTemp;
|
||||||
|
|
||||||
return TvDeviceStart(
|
return TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
||||||
ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int main( int argc, char **argv )
|
||||||
main( int argc, char **argv )
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ithread_t cmdloop_thread;
|
ithread_t cmdloop_thread;
|
||||||
|
#ifdef WIN32
|
||||||
|
#else
|
||||||
int sig;
|
int sig;
|
||||||
sigset_t sigs_to_catch;
|
sigset_t sigs_to_catch;
|
||||||
|
#endif
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
device_main(argc, argv);
|
device_main(argc, argv);
|
||||||
@@ -468,11 +470,12 @@ main( int argc, char **argv )
|
|||||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
// start a command loop thread
|
/* start a command loop thread */
|
||||||
code =
|
code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL );
|
||||||
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
ithread_join(cmdloop_thread, NULL);
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
Catch Ctrl-C and properly shutdown
|
Catch Ctrl-C and properly shutdown
|
||||||
*/
|
*/
|
||||||
@@ -480,10 +483,9 @@ main( int argc, char **argv )
|
|||||||
sigaddset( &sigs_to_catch, SIGINT );
|
sigaddset( &sigs_to_catch, SIGINT );
|
||||||
sigwait( &sigs_to_catch, &sig );
|
sigwait( &sigs_to_catch, &sig );
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
||||||
|
#endif
|
||||||
TvDeviceStop();
|
TvDeviceStop();
|
||||||
rc = TvCtrlPointStop();
|
rc = TvCtrlPointStop();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,42 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
#include "upnp_tv_ctrlpt.h"
|
||||||
|
|
||||||
/*
|
|
||||||
|
#include "upnp.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
Mutex for protecting the global device list
|
Mutex for protecting the global device list
|
||||||
in a multi-threaded, asynchronous environment.
|
in a multi-threaded, asynchronous environment.
|
||||||
All functions should lock this mutex before reading
|
All functions should lock this mutex before reading
|
||||||
@@ -48,7 +53,7 @@ char *TvServiceType[] = {
|
|||||||
};
|
};
|
||||||
char *TvServiceName[] = { "Control", "Picture" };
|
char *TvServiceName[] = { "Control", "Picture" };
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
Global arrays for storing variable names and counts for
|
Global arrays for storing variable names and counts for
|
||||||
TvControl and TvPicture services
|
TvControl and TvPicture services
|
||||||
*/
|
*/
|
||||||
@@ -59,12 +64,12 @@ char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS] = {
|
|||||||
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
||||||
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
Timeout to request during subscriptions
|
Timeout to request during subscriptions
|
||||||
*/
|
*/
|
||||||
int default_timeout = 1801;
|
int default_timeout = 1801;
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
The first node in the global device list, or NULL if empty
|
The first node in the global device list, or NULL if empty
|
||||||
*/
|
*/
|
||||||
struct TvDeviceNode *GlobalDeviceList = NULL;
|
struct TvDeviceNode *GlobalDeviceList = NULL;
|
||||||
@@ -138,11 +143,10 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
|
|||||||
* UDN -- The Unique Device Name for the device to remove
|
* UDN -- The Unique Device Name for the device to remove
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int TvCtrlPointRemoveDevice(const char *UDN)
|
||||||
TvCtrlPointRemoveDevice( char *UDN )
|
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *curdevnode,
|
struct TvDeviceNode *curdevnode;
|
||||||
*prevdevnode;
|
struct TvDeviceNode *prevdevnode;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
@@ -669,7 +673,7 @@ TvCtrlPointPrintDevice( int devnum )
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void
|
||||||
TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
||||||
char *location,
|
const char *location,
|
||||||
int expires )
|
int expires )
|
||||||
{
|
{
|
||||||
char *deviceType = NULL;
|
char *deviceType = NULL;
|
||||||
@@ -682,20 +686,19 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
|||||||
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
||||||
int TimeOut[TV_SERVICE_SERVCOUNT] =
|
int TimeOut[TV_SERVICE_SERVCOUNT] = {
|
||||||
{ default_timeout, default_timeout };
|
default_timeout,
|
||||||
|
default_timeout };
|
||||||
struct TvDeviceNode *deviceNode;
|
struct TvDeviceNode *deviceNode;
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int service,
|
int service;
|
||||||
var;
|
int var;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
/*
|
/* Read key elements from description document */
|
||||||
Read key elements from description document
|
|
||||||
*/
|
|
||||||
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
||||||
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
||||||
friendlyName =
|
friendlyName =
|
||||||
@@ -703,9 +706,8 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
|||||||
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
||||||
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
||||||
|
|
||||||
ret =
|
ret = UpnpResolveURL(
|
||||||
UpnpResolveURL( ( baseURL ? baseURL : location ), relURL,
|
( baseURL ? baseURL : location ), relURL, presURL);
|
||||||
presURL );
|
|
||||||
|
|
||||||
if( UPNP_E_SUCCESS != ret )
|
if( UPNP_E_SUCCESS != ret )
|
||||||
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
||||||
@@ -939,8 +941,8 @@ TvStateUpdate( char *UDN,
|
|||||||
* changes -- The DOM document representing the changes
|
* changes -- The DOM document representing the changes
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void TvCtrlPointHandleEvent(
|
||||||
TvCtrlPointHandleEvent( Upnp_SID sid,
|
const char *sid,
|
||||||
int evntkey,
|
int evntkey,
|
||||||
IXML_Document *changes)
|
IXML_Document *changes)
|
||||||
{
|
{
|
||||||
@@ -951,15 +953,17 @@ TvCtrlPointHandleEvent( Upnp_SID sid,
|
|||||||
|
|
||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while (tmpdevnode) {
|
while (tmpdevnode) {
|
||||||
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) {
|
||||||
if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) ==
|
if (strcmp(tmpdevnode->device.TvService[service].SID, sid) == 0) {
|
||||||
0 ) {
|
|
||||||
SampleUtil_Print("Received Tv %s Event: %d for SID %s",
|
SampleUtil_Print("Received Tv %s Event: %d for SID %s",
|
||||||
TvServiceName[service], evntkey, sid );
|
TvServiceName[service],
|
||||||
|
evntkey,
|
||||||
TvStateUpdate( tmpdevnode->device.UDN, service, changes,
|
sid);
|
||||||
( char ** )&tmpdevnode->device.
|
TvStateUpdate(
|
||||||
TvService[service].VariableStrVal );
|
tmpdevnode->device.UDN,
|
||||||
|
service,
|
||||||
|
changes,
|
||||||
|
(char **)&tmpdevnode->device.TvService[service].VariableStrVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -983,9 +987,9 @@ TvCtrlPointHandleEvent( Upnp_SID sid,
|
|||||||
* timeout -- The new timeout for the subscription
|
* timeout -- The new timeout for the subscription
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void TvCtrlPointHandleSubscribeUpdate(
|
||||||
TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
const char *eventURL,
|
||||||
Upnp_SID sid,
|
const Upnp_SID sid,
|
||||||
int timeout)
|
int timeout)
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1014,10 +1018,10 @@ TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
|||||||
ithread_mutex_unlock( &DeviceListMutex );
|
ithread_mutex_unlock( &DeviceListMutex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TvCtrlPointHandleGetVar(
|
||||||
TvCtrlPointHandleGetVar( char *controlURL,
|
const char *controlURL,
|
||||||
char *varName,
|
const char *varName,
|
||||||
DOMString varValue )
|
const DOMString varValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1028,12 +1032,9 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
|||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while (tmpdevnode) {
|
while (tmpdevnode) {
|
||||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
|
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
|
||||||
if( strcmp
|
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL) == 0) {
|
||||||
( tmpdevnode->device.TvService[service].ControlURL,
|
SampleUtil_StateUpdate(
|
||||||
controlURL ) == 0 ) {
|
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE);
|
||||||
SampleUtil_StateUpdate( varName, varValue,
|
|
||||||
tmpdevnode->device.UDN,
|
|
||||||
GET_VAR_COMPLETE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1057,179 +1058,130 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* Cookie -- Optional data specified during callback registration
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||||
TvCtrlPointCallbackEventHandler( Upnp_EventType EventType,
|
|
||||||
void *Event,
|
|
||||||
void *Cookie )
|
|
||||||
{
|
{
|
||||||
SampleUtil_PrintEvent( EventType, Event );
|
/*int errCode = 0;*/
|
||||||
|
|
||||||
|
SampleUtil_PrintEvent(EventType, Event);
|
||||||
switch ( EventType ) {
|
switch ( EventType ) {
|
||||||
/*
|
/* SSDP Stuff */
|
||||||
SSDP Stuff
|
|
||||||
*/
|
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||||
case UPNP_DISCOVERY_SEARCH_RESULT:
|
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
||||||
{
|
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||||
struct Upnp_Discovery *d_event =
|
|
||||||
( struct Upnp_Discovery * )Event;
|
|
||||||
IXML_Document *DescDoc = NULL;
|
IXML_Document *DescDoc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print( "Error in Discovery Callback -- %d",
|
SampleUtil_Print(
|
||||||
d_event->ErrCode );
|
"Error in Discovery Callback -- %d", d_event->ErrCode);
|
||||||
}
|
}
|
||||||
|
ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc);
|
||||||
if( ( ret =
|
if (ret != UPNP_E_SUCCESS) {
|
||||||
UpnpDownloadXmlDoc( d_event->Location,
|
SampleUtil_Print(
|
||||||
&DescDoc ) ) !=
|
"Error obtaining device description from %s -- error = %d",
|
||||||
UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print
|
|
||||||
( "Error obtaining device description from %s -- error = %d",
|
|
||||||
d_event->Location, ret);
|
d_event->Location, ret);
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointAddDevice( DescDoc, d_event->Location,
|
TvCtrlPointAddDevice(
|
||||||
d_event->Expires );
|
DescDoc, d_event->Location, d_event->Expires);
|
||||||
}
|
}
|
||||||
|
if (DescDoc) {
|
||||||
if( DescDoc )
|
|
||||||
ixmlDocument_free(DescDoc);
|
ixmlDocument_free(DescDoc);
|
||||||
|
}
|
||||||
TvCtrlPointPrintList();
|
TvCtrlPointPrintList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||||
/*
|
/* Nothing to do here... */
|
||||||
Nothing to do here...
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
|
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
|
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||||
{
|
|
||||||
struct Upnp_Discovery *d_event =
|
|
||||||
( struct Upnp_Discovery * )Event;
|
|
||||||
|
|
||||||
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Discovery ByeBye Callback -- %d",
|
"Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
|
||||||
d_event->ErrCode );
|
|
||||||
}
|
}
|
||||||
|
SampleUtil_Print("Received ByeBye for Device: %s", d_event->DeviceId);
|
||||||
SampleUtil_Print( "Received ByeBye for Device: %s",
|
|
||||||
d_event->DeviceId );
|
|
||||||
TvCtrlPointRemoveDevice(d_event->DeviceId);
|
TvCtrlPointRemoveDevice(d_event->DeviceId);
|
||||||
|
|
||||||
SampleUtil_Print("After byebye:");
|
SampleUtil_Print("After byebye:");
|
||||||
TvCtrlPointPrintList();
|
TvCtrlPointPrintList();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* SOAP Stuff */
|
||||||
/*
|
case UPNP_CONTROL_ACTION_COMPLETE: {
|
||||||
SOAP Stuff
|
struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)Event;
|
||||||
*/
|
|
||||||
case UPNP_CONTROL_ACTION_COMPLETE:
|
|
||||||
{
|
|
||||||
struct Upnp_Action_Complete *a_event =
|
|
||||||
( struct Upnp_Action_Complete * )Event;
|
|
||||||
|
|
||||||
if (a_event->ErrCode != UPNP_E_SUCCESS) {
|
if (a_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Action Complete Callback -- %d",
|
"Error in Action Complete Callback -- %d", a_event->ErrCode);
|
||||||
a_event->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;
|
break;
|
||||||
}
|
}
|
||||||
|
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
||||||
case UPNP_CONTROL_GET_VAR_COMPLETE:
|
struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
|
||||||
{
|
|
||||||
struct Upnp_State_Var_Complete *sv_event =
|
|
||||||
( struct Upnp_State_Var_Complete * )Event;
|
|
||||||
|
|
||||||
if (sv_event->ErrCode != UPNP_E_SUCCESS) {
|
if (sv_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Get Var Complete Callback -- %d",
|
"Error in Get Var Complete Callback -- %d", sv_event->ErrCode);
|
||||||
sv_event->ErrCode );
|
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleGetVar( sv_event->CtrlUrl,
|
TvCtrlPointHandleGetVar(
|
||||||
|
sv_event->CtrlUrl,
|
||||||
sv_event->StateVarName,
|
sv_event->StateVarName,
|
||||||
sv_event->CurrentVal);
|
sv_event->CurrentVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* GENA Stuff */
|
||||||
/*
|
case UPNP_EVENT_RECEIVED: {
|
||||||
GENA Stuff
|
|
||||||
*/
|
|
||||||
case UPNP_EVENT_RECEIVED:
|
|
||||||
{
|
|
||||||
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
|
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
|
||||||
|
|
||||||
TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey,
|
TvCtrlPointHandleEvent(
|
||||||
|
e_event->Sid,
|
||||||
|
e_event->EventKey,
|
||||||
e_event->ChangedVariables);
|
e_event->ChangedVariables);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_RENEWAL_COMPLETE:
|
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
||||||
{
|
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
||||||
struct Upnp_Event_Subscribe *es_event =
|
|
||||||
( struct Upnp_Event_Subscribe * )Event;
|
|
||||||
|
|
||||||
if (es_event->ErrCode != UPNP_E_SUCCESS) {
|
if (es_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Event Subscribe Callback -- %d",
|
"Error in Event Subscribe Callback -- %d", es_event->ErrCode);
|
||||||
es_event->ErrCode );
|
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
TvCtrlPointHandleSubscribeUpdate(
|
||||||
PublisherUrl,
|
es_event->PublisherUrl,
|
||||||
es_event->Sid,
|
es_event->Sid,
|
||||||
es_event->TimeOut);
|
es_event->TimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
|
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
||||||
{
|
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
||||||
int TimeOut = default_timeout;
|
int TimeOut = default_timeout;
|
||||||
Upnp_SID newSID;
|
Upnp_SID newSID;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
struct Upnp_Event_Subscribe *es_event =
|
ret = UpnpSubscribe(
|
||||||
( struct Upnp_Event_Subscribe * )Event;
|
ctrlpt_handle,
|
||||||
|
es_event->PublisherUrl,
|
||||||
ret =
|
&TimeOut,
|
||||||
UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl,
|
|
||||||
&TimeOut, newSID );
|
|
||||||
|
|
||||||
if( ret == UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Subscribed to EventURL with SID=%s",
|
|
||||||
newSID);
|
newSID);
|
||||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
if (ret == UPNP_E_SUCCESS) {
|
||||||
PublisherUrl, newSID,
|
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
|
||||||
|
TvCtrlPointHandleSubscribeUpdate(
|
||||||
|
es_event->PublisherUrl,
|
||||||
|
newSID,
|
||||||
TimeOut);
|
TimeOut);
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print
|
SampleUtil_Print("Error Subscribing to EventURL -- %d", ret);
|
||||||
( "Error Subscribing to EventURL -- %d", ret );
|
|
||||||
}
|
}
|
||||||
break;
|
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_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||||
case UPNP_CONTROL_ACTION_REQUEST:
|
case UPNP_CONTROL_ACTION_REQUEST:
|
||||||
@@ -1320,12 +1272,12 @@ TvCtrlPointVerifyTimeouts( int incr )
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void *
|
static int TvCtrlPointTimerLoopRun = 1;
|
||||||
TvCtrlPointTimerLoop( void *args )
|
void *TvCtrlPointTimerLoop(void *args)
|
||||||
{
|
{
|
||||||
int incr = 30; // how often to verify the timeouts, in seconds
|
int incr = 30; // how often to verify the timeouts, in seconds
|
||||||
|
|
||||||
while( 1 ) {
|
while (TvCtrlPointTimerLoopRun) {
|
||||||
isleep( incr );
|
isleep( incr );
|
||||||
TvCtrlPointVerifyTimeouts( incr );
|
TvCtrlPointVerifyTimeouts( incr );
|
||||||
}
|
}
|
||||||
@@ -1348,13 +1300,11 @@ TvCtrlPointTimerLoop( void *args )
|
|||||||
* TV_SUCCESS if everything went well, else TV_ERROR
|
* TV_SUCCESS if everything went well, else TV_ERROR
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr)
|
||||||
TvCtrlPointStart( print_string printFunctionPtr,
|
|
||||||
state_update updateFunctionPtr )
|
|
||||||
{
|
{
|
||||||
ithread_t timer_thread;
|
ithread_t timer_thread;
|
||||||
int rc;
|
int rc;
|
||||||
short int port = 0;
|
unsigned short port = 0;
|
||||||
char *ip_address = NULL;
|
char *ip_address = NULL;
|
||||||
|
|
||||||
SampleUtil_Initialize(printFunctionPtr);
|
SampleUtil_Initialize(printFunctionPtr);
|
||||||
@@ -1362,28 +1312,40 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
|||||||
|
|
||||||
ithread_mutex_init(&DeviceListMutex, 0);
|
ithread_mutex_init(&DeviceListMutex, 0);
|
||||||
|
|
||||||
SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d",
|
SampleUtil_Print(
|
||||||
ip_address, port );
|
"Initializing UPnP Sdk with\n"
|
||||||
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
port);
|
||||||
|
|
||||||
rc = UpnpInit(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);
|
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 )
|
SampleUtil_Print(
|
||||||
ip_address = UpnpGetServerIpAddress( );
|
"UPnP Initialized\n"
|
||||||
if( 0 == port )
|
"\tipaddress = %s port = %u\n",
|
||||||
port = UpnpGetServerPort( );
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
port);
|
||||||
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port );
|
|
||||||
|
|
||||||
SampleUtil_Print("Registering Control Point");
|
SampleUtil_Print("Registering Control Point");
|
||||||
rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,
|
rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,
|
||||||
&ctrlpt_handle, &ctrlpt_handle);
|
&ctrlpt_handle, &ctrlpt_handle);
|
||||||
if( UPNP_E_SUCCESS != rc ) {
|
if (rc != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return TV_ERROR;
|
return TV_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,15 +1353,16 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
|||||||
|
|
||||||
TvCtrlPointRefresh();
|
TvCtrlPointRefresh();
|
||||||
|
|
||||||
// start a timer thread
|
/* start a timer thread */
|
||||||
ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL);
|
ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL);
|
||||||
|
ithread_detach(timer_thread);
|
||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int TvCtrlPointStop(void)
|
||||||
TvCtrlPointStop( void )
|
|
||||||
{
|
{
|
||||||
|
TvCtrlPointTimerLoopRun = 0;
|
||||||
TvCtrlPointRemoveAll();
|
TvCtrlPointRemoveAll();
|
||||||
UpnpUnRegisterClient( ctrlpt_handle );
|
UpnpUnRegisterClient( ctrlpt_handle );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
@@ -1407,3 +1370,4 @@ TvCtrlPointStop( void )
|
|||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,66 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_CTRLPT_H
|
#ifndef UPNP_TV_CTRLPT_H
|
||||||
#define UPNP_TV_CTRLPT_H
|
#define UPNP_TV_CTRLPT_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include <unistd.h>
|
#include "upnp.h"
|
||||||
#include <stdarg.h>
|
#include "UpnpString.h"
|
||||||
#include <stdlib.h>
|
#include "upnptools.h"
|
||||||
|
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnptools.h"
|
#ifdef WIN32
|
||||||
#include "sample_util.h"
|
/* Do not #include <unistd.h> */
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
#define TV_SERVICE_SERVCOUNT 2
|
||||||
#define TV_SERVICE_CONTROL 0
|
#define TV_SERVICE_CONTROL 0
|
||||||
@@ -110,7 +123,7 @@ extern UpnpClient_Handle ctrlpt_handle;
|
|||||||
|
|
||||||
void TvCtrlPointPrintHelp(void);
|
void TvCtrlPointPrintHelp(void);
|
||||||
int TvCtrlPointDeleteNode(struct TvDeviceNode *);
|
int TvCtrlPointDeleteNode(struct TvDeviceNode *);
|
||||||
int TvCtrlPointRemoveDevice(char*);
|
int TvCtrlPointRemoveDevice(const char *);
|
||||||
int TvCtrlPointRemoveAll(void);
|
int TvCtrlPointRemoveAll(void);
|
||||||
int TvCtrlPointRefresh(void);
|
int TvCtrlPointRefresh(void);
|
||||||
|
|
||||||
@@ -138,11 +151,11 @@ int TvCtrlPointGetBrightness(int);
|
|||||||
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
||||||
int TvCtrlPointPrintList(void);
|
int TvCtrlPointPrintList(void);
|
||||||
int TvCtrlPointPrintDevice(int);
|
int TvCtrlPointPrintDevice(int);
|
||||||
void TvCtrlPointAddDevice (IXML_Document *, char *, int);
|
void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
||||||
void TvCtrlPointHandleGetVar(char *,char *,DOMString);
|
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
||||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
||||||
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
void TvCtrlPointHandleEvent(const char *, int, IXML_Document *);
|
||||||
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
||||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||||
void TvCtrlPointVerifyTimeouts(int);
|
void TvCtrlPointVerifyTimeouts(int);
|
||||||
void TvCtrlPointPrintCommands(void);
|
void TvCtrlPointPrintCommands(void);
|
||||||
|
|||||||
@@ -1,40 +1,47 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_device.h"
|
#include "upnp_tv_device.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_WEB_DIR "./web"
|
#define DEFAULT_WEB_DIR "./web"
|
||||||
|
|
||||||
|
|
||||||
#define DESC_URL_SIZE 200
|
#define DESC_URL_SIZE 200
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Device type for tv device
|
Device type for tv device
|
||||||
*/
|
*/
|
||||||
@@ -178,7 +185,6 @@ SetServiceTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SetActionTable( serviceType, out );
|
return SetActionTable( serviceType, out );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -249,7 +255,6 @@ SetActionTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -366,61 +371,66 @@ TvDeviceStateTableInit( IN char *DescDocURL )
|
|||||||
* sr_event -- The subscription request event structure
|
* sr_event -- The subscription request event structure
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceHandleSubscriptionRequest(IN struct Upnp_Subscription_Request *sr_event)
|
||||||
TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|
||||||
*sr_event )
|
|
||||||
{
|
{
|
||||||
unsigned int i = 0; //,j=0;
|
unsigned int i = 0;
|
||||||
|
int cmp1 = 0;
|
||||||
// IXML_Document *PropSet=NULL;
|
int cmp2 = 0;
|
||||||
|
const char *l_serviceId = NULL;
|
||||||
|
const char *l_udn = NULL;
|
||||||
|
const char *l_sid = NULL;
|
||||||
|
|
||||||
// lock state mutex
|
// lock state mutex
|
||||||
ithread_mutex_lock(&TVDevMutex);
|
ithread_mutex_lock(&TVDevMutex);
|
||||||
|
|
||||||
for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) {
|
l_serviceId = sr_event->ServiceId;
|
||||||
if( ( strcmp( sr_event->UDN, tv_service_table[i].UDN ) == 0 ) &&
|
l_udn = sr_event->UDN;
|
||||||
( strcmp( sr_event->ServiceId, tv_service_table[i].ServiceId )
|
l_sid = sr_event->Sid;
|
||||||
== 0 ) ) {
|
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;
|
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
|
// add each variable to the property set
|
||||||
// for initial state dump
|
// for initial state dump
|
||||||
UpnpAddToPropertySet(&PropSet,
|
UpnpAddToPropertySet(
|
||||||
|
&PropSet,
|
||||||
tv_service_table[i].VariableName[j],
|
tv_service_table[i].VariableName[j],
|
||||||
tv_service_table[i].VariableStrVal[j]);
|
tv_service_table[i].VariableStrVal[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump initial state
|
// dump initial state
|
||||||
UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,
|
UpnpAcceptSubscriptionExt(
|
||||||
sr_event->ServiceId,
|
device_handle,
|
||||||
PropSet,sr_event->Sid);
|
l_udn,
|
||||||
|
l_serviceId,
|
||||||
|
PropSet,
|
||||||
|
l_sid);
|
||||||
// free document
|
// free document
|
||||||
Document_free(PropSet);
|
Document_free(PropSet);
|
||||||
|
#endif
|
||||||
*/
|
UpnpAcceptSubscription(
|
||||||
|
device_handle,
|
||||||
UpnpAcceptSubscription( device_handle,
|
l_udn,
|
||||||
sr_event->UDN,
|
l_serviceId,
|
||||||
sr_event->ServiceId,
|
|
||||||
(const char **)tv_service_table[i].
|
(const char **)tv_service_table[i].
|
||||||
VariableName,
|
VariableName,
|
||||||
(const char **)tv_service_table[i].
|
(const char **)tv_service_table[i].
|
||||||
VariableStrVal,
|
VariableStrVal,
|
||||||
tv_service_table[i].VariableCount,
|
tv_service_table[i].VariableCount,
|
||||||
sr_event->Sid );
|
l_sid);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ithread_mutex_unlock(&TVDevMutex);
|
ithread_mutex_unlock(&TVDevMutex);
|
||||||
|
|
||||||
return ( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceHandleGetVarRequest
|
* TvDeviceHandleGetVarRequest
|
||||||
*
|
*
|
||||||
@@ -433,12 +443,10 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|||||||
* cgv_event -- The control get variable request event structure
|
* cgv_event -- The control get variable request event structure
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceHandleGetVarRequest(INOUT struct Upnp_State_Var_Request *cgv_event)
|
||||||
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|
||||||
*cgv_event )
|
|
||||||
{
|
{
|
||||||
unsigned int i = 0,
|
unsigned int i = 0;
|
||||||
j = 0;
|
unsigned int j = 0;
|
||||||
int getvar_succeeded = 0;
|
int getvar_succeeded = 0;
|
||||||
|
|
||||||
cgv_event->CurrentVal = NULL;
|
cgv_event->CurrentVal = NULL;
|
||||||
@@ -447,30 +455,32 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
|
|
||||||
for (i = 0; i < TV_SERVICE_SERVCOUNT; i++) {
|
for (i = 0; i < TV_SERVICE_SERVCOUNT; i++) {
|
||||||
// check udn and service id
|
// check udn and service id
|
||||||
if( ( strcmp( cgv_event->DevUDN, tv_service_table[i].UDN ) == 0 )
|
const char *devUDN =
|
||||||
&&
|
cgv_event->DevUDN;
|
||||||
( strcmp( cgv_event->ServiceID, tv_service_table[i].ServiceId )
|
const char *serviceID =
|
||||||
== 0 ) ) {
|
cgv_event->ServiceID;
|
||||||
|
if (strcmp(devUDN, tv_service_table[i].UDN) == 0 &&
|
||||||
|
strcmp(serviceID, tv_service_table[i].ServiceId) == 0) {
|
||||||
// check variable name
|
// check variable name
|
||||||
for (j = 0; j < tv_service_table[i].VariableCount; j++) {
|
for (j = 0; j < tv_service_table[i].VariableCount; j++) {
|
||||||
if( strcmp( cgv_event->StateVarName,
|
const char *stateVarName =
|
||||||
|
cgv_event->StateVarName;
|
||||||
|
if (strcmp(stateVarName,
|
||||||
tv_service_table[i].VariableName[j]) == 0) {
|
tv_service_table[i].VariableName[j]) == 0) {
|
||||||
getvar_succeeded = 1;
|
getvar_succeeded = 1;
|
||||||
cgv_event->CurrentVal =
|
cgv_event->CurrentVal = ixmlCloneDOMString(
|
||||||
ixmlCloneDOMString( tv_service_table[i].
|
tv_service_table[i].VariableStrVal[j]);
|
||||||
VariableStrVal[j] );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getvar_succeeded) {
|
if (getvar_succeeded) {
|
||||||
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n" );
|
"Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n"
|
||||||
SampleUtil_Print( " Unknown variable name = %s\n",
|
" Unknown variable name = %s\n",
|
||||||
cgv_event->StateVarName);
|
cgv_event->StateVarName);
|
||||||
cgv_event->ErrCode = 404;
|
cgv_event->ErrCode = 404;
|
||||||
strcpy(cgv_event->ErrStr, "Invalid Variable");
|
strcpy(cgv_event->ErrStr, "Invalid Variable");
|
||||||
@@ -478,7 +488,7 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
|
|
||||||
ithread_mutex_unlock(&TVDevMutex);
|
ithread_mutex_unlock(&TVDevMutex);
|
||||||
|
|
||||||
return ( cgv_event->ErrCode == UPNP_E_SUCCESS );
|
return cgv_event->ErrCode == UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -493,62 +503,46 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
* ca_event -- The control action request event structure
|
* ca_event -- The control action request event structure
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceHandleActionRequest(INOUT struct Upnp_Action_Request *ca_event)
|
||||||
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
|
||||||
{
|
{
|
||||||
|
/* Defaults if action not found. */
|
||||||
/*
|
|
||||||
Defaults if action not found
|
|
||||||
*/
|
|
||||||
int action_found = 0;
|
int action_found = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int service = -1;
|
int service = -1;
|
||||||
int retCode = 0;
|
int retCode = 0;
|
||||||
char *errorString = NULL;
|
char *errorString = NULL;
|
||||||
|
const char *devUDN = NULL;
|
||||||
|
const char *serviceID = NULL;
|
||||||
|
const char *actionName = NULL;
|
||||||
|
|
||||||
ca_event->ErrCode = 0;
|
ca_event->ErrCode = 0;
|
||||||
ca_event->ActionResult = NULL;
|
ca_event->ActionResult = NULL;
|
||||||
|
|
||||||
if( ( strcmp( ca_event->DevUDN,
|
devUDN = ca_event->DevUDN;
|
||||||
tv_service_table[TV_SERVICE_CONTROL].UDN ) == 0 ) &&
|
serviceID = ca_event->ServiceID;
|
||||||
( strcmp
|
actionName = ca_event->ActionName;
|
||||||
( ca_event->ServiceID,
|
if (strcmp(devUDN, tv_service_table[TV_SERVICE_CONTROL].UDN) == 0 &&
|
||||||
tv_service_table[TV_SERVICE_CONTROL].ServiceId ) == 0 ) ) {
|
strcmp(serviceID, tv_service_table[TV_SERVICE_CONTROL].ServiceId) == 0) {
|
||||||
/*
|
/* Request for action in the TvDevice Control Service. */
|
||||||
Request for action in the TvDevice Control Service
|
|
||||||
*/
|
|
||||||
service = TV_SERVICE_CONTROL;
|
service = TV_SERVICE_CONTROL;
|
||||||
} else if( ( strcmp( ca_event->DevUDN,
|
} else if (strcmp(devUDN, tv_service_table[TV_SERVICE_PICTURE].UDN) == 0 &&
|
||||||
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. */
|
||||||
( strcmp
|
|
||||||
( ca_event->ServiceID,
|
|
||||||
tv_service_table[TV_SERVICE_PICTURE].ServiceId ) ==
|
|
||||||
0 ) ) {
|
|
||||||
/*
|
|
||||||
Request for action in the TvDevice Picture Service
|
|
||||||
*/
|
|
||||||
service = TV_SERVICE_PICTURE;
|
service = TV_SERVICE_PICTURE;
|
||||||
}
|
}
|
||||||
//Find and call appropriate procedure based on action name
|
/* Find and call appropriate procedure based on action name.
|
||||||
//Each action name has an associated procedure stored in the
|
* Each action name has an associated procedure stored in the
|
||||||
//service table. These are set at initialization.
|
* service table. These are set at initialization. */
|
||||||
|
for (i = 0;
|
||||||
for( i = 0; ( ( i < TV_MAXACTIONS ) &&
|
i < TV_MAXACTIONS && tv_service_table[service].ActionNames[i] != NULL;
|
||||||
( tv_service_table[service].ActionNames[i] != NULL ) );
|
|
||||||
i++) {
|
i++) {
|
||||||
|
if (!strcmp(actionName, tv_service_table[service].ActionNames[i])) {
|
||||||
if( !strcmp( ca_event->ActionName,
|
if (!strcmp(tv_service_table[TV_SERVICE_CONTROL].
|
||||||
tv_service_table[service].ActionNames[i] ) ) {
|
VariableStrVal[TV_CONTROL_POWER], "1") ||
|
||||||
|
!strcmp(actionName, "PowerOn")) {
|
||||||
if( ( !strcmp( tv_service_table[TV_SERVICE_CONTROL].
|
retCode = tv_service_table[service].actions[i](
|
||||||
VariableStrVal[TV_CONTROL_POWER], "1" ) )
|
ca_event->ActionRequest,
|
||||||
|| ( !strcmp( ca_event->ActionName, "PowerOn" ) ) ) {
|
&ca_event->ActionResult,
|
||||||
retCode =
|
|
||||||
tv_service_table[service].actions[i] ( ca_event->
|
|
||||||
ActionRequest,
|
|
||||||
&ca_event->
|
|
||||||
ActionResult,
|
|
||||||
&errorString);
|
&errorString);
|
||||||
} else {
|
} else {
|
||||||
errorString = "Power is Off";
|
errorString = "Power is Off";
|
||||||
@@ -571,22 +565,17 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
|||||||
strcpy(ca_event->ErrStr, errorString);
|
strcpy(ca_event->ErrStr, errorString);
|
||||||
switch (retCode) {
|
switch (retCode) {
|
||||||
case UPNP_E_INVALID_PARAM:
|
case UPNP_E_INVALID_PARAM:
|
||||||
{
|
|
||||||
ca_event->ErrCode = 402;
|
ca_event->ErrCode = 402;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case UPNP_E_INTERNAL_ERROR:
|
case UPNP_E_INTERNAL_ERROR:
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
ca_event->ErrCode = 501;
|
ca_event->ErrCode = 501;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( ca_event->ErrCode );
|
return ca_event->ErrCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -649,7 +638,6 @@ TvDeviceSetServiceTableVar( IN unsigned int service,
|
|||||||
ithread_mutex_unlock( &TVDevMutex );
|
ithread_mutex_unlock( &TVDevMutex );
|
||||||
|
|
||||||
return ( 1 );
|
return ( 1 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -672,7 +660,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
|
|
||||||
if( on != POWER_ON && on != POWER_OFF ) {
|
if( on != POWER_ON && on != POWER_OFF ) {
|
||||||
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
||||||
return ( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -683,7 +671,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
||||||
value );
|
value );
|
||||||
|
|
||||||
return ( ret );
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -700,9 +688,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDevicePowerOn( IN IXML_Document * in,
|
TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
( *errorString ) = NULL;
|
( *errorString ) = NULL;
|
||||||
@@ -722,7 +708,6 @@ TvDevicePowerOn( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -779,11 +764,8 @@ TvDevicePowerOff( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetChannel( IN IXML_Document * in,
|
TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
@@ -828,7 +810,6 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -846,13 +827,10 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementChannel( IN int incr,
|
IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curchannel,
|
int curchannel;
|
||||||
newchannel;
|
int newchannel;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
@@ -914,12 +892,9 @@ IncrementChannel( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseChannel( IN IXML_Document * in,
|
TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementChannel( -1, in, out, errorString );
|
return IncrementChannel( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -936,12 +911,9 @@ TvDeviceDecreaseChannel( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseChannel( IN IXML_Document * in,
|
TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementChannel( 1, in, out, errorString );
|
return IncrementChannel( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -960,13 +932,9 @@ TvDeviceIncreaseChannel( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetVolume( IN IXML_Document * in,
|
TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int volume = 0;
|
int volume = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1007,7 +975,6 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1026,10 +993,7 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementVolume( IN int incr,
|
IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curvolume,
|
int curvolume,
|
||||||
newvolume;
|
newvolume;
|
||||||
@@ -1066,8 +1030,7 @@ IncrementVolume( IN int incr,
|
|||||||
TV_CONTROL_VOLUME, value ) ) {
|
TV_CONTROL_VOLUME, value ) ) {
|
||||||
if( UpnpAddToActionResponse( out, actionName,
|
if( UpnpAddToActionResponse( out, actionName,
|
||||||
TvServiceType[TV_SERVICE_CONTROL],
|
TvServiceType[TV_SERVICE_CONTROL],
|
||||||
"Volume", value ) != UPNP_E_SUCCESS )
|
"Volume", value ) != UPNP_E_SUCCESS ) {
|
||||||
{
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
@@ -1077,7 +1040,6 @@ IncrementVolume( IN int incr,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1094,13 +1056,9 @@ IncrementVolume( IN int incr,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseVolume( IN IXML_Document * in,
|
TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementVolume( 1, in, out, errorString );
|
return IncrementVolume( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1117,13 +1075,9 @@ TvDeviceIncreaseVolume( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseVolume( IN IXML_Document * in,
|
TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementVolume( -1, in, out, errorString );
|
return IncrementVolume( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1142,13 +1096,9 @@ TvDeviceDecreaseVolume( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetColor( IN IXML_Document * in,
|
TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int color = 0;
|
int color = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1188,7 +1138,6 @@ TvDeviceSetColor( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1205,16 +1154,11 @@ TvDeviceSetColor( IN IXML_Document * in,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
IncrementColor( IN int incr,
|
IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curcolor,
|
int curcolor;
|
||||||
newcolor;
|
int newcolor;
|
||||||
|
|
||||||
char *actionName;
|
char *actionName;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1272,11 +1216,8 @@ IncrementColor( IN int incr,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseColor( IN IXML_Document * in,
|
TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementColor( -1, in, out, errorString );
|
return IncrementColor( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1293,11 +1234,8 @@ TvDeviceDecreaseColor( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseColor( IN IXML_Document * in,
|
TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementColor( 1, in, out, errorString );
|
return IncrementColor( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1317,13 +1255,9 @@ TvDeviceIncreaseColor( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetTint( IN IXML_Document * in,
|
TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int tint = -1;
|
int tint = -1;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1382,14 +1316,10 @@ TvDeviceSetTint( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementTint( IN int incr,
|
IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curtint,
|
int curtint;
|
||||||
newtint;
|
int newtint;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1432,7 +1362,6 @@ IncrementTint( IN int incr,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1449,11 +1378,8 @@ IncrementTint( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseTint( IN IXML_Document * in,
|
TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementTint( 1, in, out, errorString );
|
return IncrementTint( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1471,11 +1397,8 @@ TvDeviceIncreaseTint( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseTint( IN IXML_Document * in,
|
TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementTint( -1, in, out, errorString );
|
return IncrementTint( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1495,11 +1418,8 @@ TvDeviceDecreaseTint( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetContrast( IN IXML_Document * in,
|
TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
int contrast = -1;
|
int contrast = -1;
|
||||||
|
|
||||||
@@ -1560,14 +1480,10 @@ TvDeviceSetContrast( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementContrast( IN int incr,
|
IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curcontrast,
|
int curcontrast;
|
||||||
newcontrast;
|
int newcontrast;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1629,11 +1545,8 @@ IncrementContrast( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseContrast( IN IXML_Document * in,
|
TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementContrast( 1, in, out, errorString );
|
return IncrementContrast( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1651,9 +1564,7 @@ TvDeviceIncreaseContrast( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseContrast( IXML_Document * in,
|
TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IXML_Document ** out,
|
|
||||||
char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementContrast( -1, in, out, errorString );
|
return IncrementContrast( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1671,11 +1582,8 @@ TvDeviceDecreaseContrast( IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetBrightness( IN IXML_Document * in,
|
TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
int brightness = -1;
|
int brightness = -1;
|
||||||
|
|
||||||
@@ -1718,7 +1626,6 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1736,13 +1643,10 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementBrightness( IN int incr,
|
IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curbrightness,
|
int curbrightness;
|
||||||
newbrightness;
|
int newbrightness;
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1803,9 +1707,7 @@ IncrementBrightness( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementBrightness( 1, in, out, errorString );
|
return IncrementBrightness( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1823,9 +1725,7 @@ TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementBrightness( -1, in, out, errorString );
|
return IncrementBrightness( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1849,29 +1749,19 @@ TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* Cookie -- Optional data specified during callback registration
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||||
TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
|
||||||
void *Event,
|
|
||||||
void *Cookie )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (EventType) {
|
switch (EventType) {
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
|
TvDeviceHandleSubscriptionRequest((struct Upnp_Subscription_Request *)Event);
|
||||||
TvDeviceHandleSubscriptionRequest( ( struct
|
|
||||||
Upnp_Subscription_Request
|
|
||||||
* )Event );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||||
TvDeviceHandleGetVarRequest( ( struct Upnp_State_Var_Request
|
TvDeviceHandleGetVarRequest((struct Upnp_State_Var_Request *)Event);
|
||||||
* )Event );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPNP_CONTROL_ACTION_REQUEST:
|
case UPNP_CONTROL_ACTION_REQUEST:
|
||||||
TvDeviceHandleActionRequest( ( struct Upnp_Action_Request * )
|
TvDeviceHandleActionRequest((struct Upnp_Action_Request *)Event);
|
||||||
Event );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1890,17 +1780,14 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SampleUtil_Print
|
SampleUtil_Print("Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||||
( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
|
||||||
EventType);
|
EventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Print a summary of the event received */
|
||||||
Print a summary of the event received
|
|
||||||
*/
|
|
||||||
SampleUtil_PrintEvent(EventType, Event);
|
SampleUtil_PrintEvent(EventType, Event);
|
||||||
|
|
||||||
return ( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1912,13 +1799,13 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceStop(void)
|
||||||
TvDeviceStop( )
|
|
||||||
{
|
{
|
||||||
UpnpUnRegisterRootDevice( device_handle );
|
UpnpUnRegisterRootDevice( device_handle );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
SampleUtil_Finish();
|
SampleUtil_Finish();
|
||||||
ithread_mutex_destroy( &TVDevMutex );
|
ithread_mutex_destroy( &TVDevMutex );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1951,81 +1838,85 @@ TvDeviceStart( char *ip_address,
|
|||||||
print_string pfun )
|
print_string pfun )
|
||||||
{
|
{
|
||||||
int ret = UPNP_E_SUCCESS;
|
int ret = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
char desc_doc_url[DESC_URL_SIZE];
|
char desc_doc_url[DESC_URL_SIZE];
|
||||||
|
|
||||||
ithread_mutex_init( &TVDevMutex, NULL );
|
ithread_mutex_init( &TVDevMutex, NULL );
|
||||||
|
|
||||||
SampleUtil_Initialize( pfun );
|
SampleUtil_Initialize( pfun );
|
||||||
|
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
"Initializing UPnP Sdk with\n"
|
||||||
ip_address, port );
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
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 );
|
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ip_address == NULL ) {
|
|
||||||
ip_address = UpnpGetServerIpAddress();
|
ip_address = UpnpGetServerIpAddress();
|
||||||
}
|
|
||||||
|
|
||||||
if( port == 0 ) {
|
|
||||||
port = UpnpGetServerPort();
|
port = UpnpGetServerPort();
|
||||||
|
|
||||||
|
SampleUtil_Print(
|
||||||
|
"UPnP Initialized\n"
|
||||||
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
port);
|
||||||
|
|
||||||
|
if( desc_doc_name == NULL ) {
|
||||||
|
desc_doc_name = "tvcombodesc.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
if( web_dir_path == NULL ) {
|
||||||
ip_address, port );
|
|
||||||
|
|
||||||
if( desc_doc_name == NULL )
|
|
||||||
desc_doc_name = "tvcombodesc.xml";
|
|
||||||
|
|
||||||
if( web_dir_path == NULL )
|
|
||||||
web_dir_path = DEFAULT_WEB_DIR;
|
web_dir_path = DEFAULT_WEB_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||||
port, desc_doc_name );
|
port, desc_doc_name );
|
||||||
|
|
||||||
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
||||||
web_dir_path );
|
web_dir_path );
|
||||||
if( ( ret =
|
ret = UpnpSetWebServerRootDir( web_dir_path );
|
||||||
UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) {
|
if( ret != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n",
|
||||||
( "Error specifying webserver root directory -- %s: %d\n",
|
|
||||||
web_dir_path, ret );
|
web_dir_path, ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
"Registering the RootDevice\n"
|
||||||
|
"\t with desc_doc_url: %s\n",
|
||||||
desc_doc_url );
|
desc_doc_url );
|
||||||
|
|
||||||
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler,
|
||||||
TvDeviceCallbackEventHandler,
|
&device_handle, &device_handle );
|
||||||
&device_handle, &device_handle ) )
|
if( ret != UPNP_E_SUCCESS ) {
|
||||||
!= UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print( "RootDevice Registered\n" );
|
SampleUtil_Print(
|
||||||
|
"RootDevice Registered\n"
|
||||||
SampleUtil_Print( "Initializing State Table\n" );
|
"Initializing State Table\n");
|
||||||
TvDeviceStateTableInit( desc_doc_url );
|
TvDeviceStateTableInit( desc_doc_url );
|
||||||
SampleUtil_Print("State Table Initialized\n");
|
SampleUtil_Print("State Table Initialized\n");
|
||||||
|
ret = UpnpSendAdvertisement( device_handle, default_advr_expire );
|
||||||
if( ( ret =
|
if( ret != UPNP_E_SUCCESS ) {
|
||||||
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
|
||||||
!= UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print("Advertisements Sent\n");
|
SampleUtil_Print("Advertisements Sent\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,66 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_DEVICE_H
|
#ifndef UPNP_TV_DEVICE_H
|
||||||
#define UPNP_TV_DEVICE_H
|
#define UPNP_TV_DEVICE_H
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "sample_util.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
|
//Color constants
|
||||||
#define MAX_COLOR 10
|
#define MAX_COLOR 10
|
||||||
#define MIN_COLOR 1
|
#define MIN_COLOR 1
|
||||||
@@ -146,8 +161,7 @@ extern char *TvServiceType[];
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,
|
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out, char **errorString);
|
||||||
char **errorString);
|
|
||||||
|
|
||||||
/* Structure for storing Tv Service
|
/* Structure for storing Tv Service
|
||||||
identifiers and state table */
|
identifiers and state table */
|
||||||
@@ -311,8 +325,7 @@ int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*);
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDevicePowerOff
|
* TvDevicePowerOff
|
||||||
@@ -327,8 +340,7 @@ int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetChannel
|
* TvDeviceSetChannel
|
||||||
@@ -345,8 +357,7 @@ int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseChannel
|
* TvDeviceIncreaseChannel
|
||||||
@@ -361,8 +372,7 @@ int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseChannel
|
* TvDeviceDecreaseChannel
|
||||||
*
|
*
|
||||||
@@ -376,8 +386,7 @@ int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetVolume
|
* TvDeviceSetVolume
|
||||||
*
|
*
|
||||||
@@ -393,8 +402,7 @@ int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseVolume
|
* TvDeviceIncreaseVolume
|
||||||
@@ -409,8 +417,7 @@ int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
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)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
//Picture Service Actions
|
//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)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -463,8 +468,7 @@ int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseColor
|
* TvDeviceDecreaseColor
|
||||||
@@ -478,8 +482,7 @@ int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetTint
|
* TvDeviceSetTint
|
||||||
@@ -496,8 +499,7 @@ int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseTint
|
* TvDeviceIncreaseTint
|
||||||
@@ -512,8 +514,7 @@ int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseTint
|
* TvDeviceDecreaseTint
|
||||||
@@ -528,8 +529,7 @@ int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* TvDeviceSetContrast
|
* TvDeviceSetContrast
|
||||||
@@ -546,8 +546,7 @@ int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseContrast
|
* TvDeviceIncreaseContrast
|
||||||
@@ -563,8 +562,7 @@ int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseContrast
|
* TvDeviceDecreaseContrast
|
||||||
*
|
*
|
||||||
@@ -578,8 +576,7 @@ int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetBrightness
|
* TvDeviceSetBrightness
|
||||||
@@ -593,8 +590,7 @@ int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* brightness -- The brightness value to change to.
|
* brightness -- The brightness value to change to.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseBrightness
|
* TvDeviceIncreaseBrightness
|
||||||
@@ -609,8 +605,7 @@ int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseBrightness
|
* TvDeviceDecreaseBrightness
|
||||||
@@ -624,12 +619,11 @@ int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
||||||
char *web_dir_path, print_string pfun);
|
char *web_dir_path, print_string pfun);
|
||||||
int TvDeviceStop();
|
int TvDeviceStop(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,40 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "sample_util.h"
|
#include "sample_util.h"
|
||||||
#include "upnp_tv_ctrlpt.h"
|
#include "upnp_tv_ctrlpt.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -124,108 +127,72 @@ TvCtrlPointPrintLongHelp( void )
|
|||||||
SampleUtil_Print( "* TV Control Point Help Info *" );
|
SampleUtil_Print( "* TV Control Point Help Info *" );
|
||||||
SampleUtil_Print( "******************************" );
|
SampleUtil_Print( "******************************" );
|
||||||
SampleUtil_Print( "" );
|
SampleUtil_Print( "" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( "This sample control point application automatically searches" );
|
||||||
( "This sample control point application automatically searches" );
|
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." );
|
||||||
( "for and subscribes to the services of television device emulator" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "devices, described in the tvdevicedesc.xml description document." );
|
|
||||||
SampleUtil_Print( "" );
|
SampleUtil_Print( "" );
|
||||||
SampleUtil_Print( "Commands:" );
|
SampleUtil_Print( "Commands:" );
|
||||||
SampleUtil_Print( " Help" );
|
SampleUtil_Print( " Help" );
|
||||||
SampleUtil_Print( " Print this help info." );
|
SampleUtil_Print( " Print this help info." );
|
||||||
SampleUtil_Print( " ListDev" );
|
SampleUtil_Print( " ListDev" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Print the current list of TV Device Emulators that this" );
|
||||||
( " 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
|
SampleUtil_Print( " device number which corresponds to the devnum argument of" );
|
||||||
( " 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( " commands listed below." );
|
||||||
SampleUtil_Print( " Refresh" );
|
SampleUtil_Print( " Refresh" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Delete all of the devices from the device list and issue new" );
|
||||||
( " Delete all of the devices from the device list and issue new" );
|
SampleUtil_Print( " search request to rebuild the list from scratch." );
|
||||||
SampleUtil_Print
|
|
||||||
( " search request to rebuild the list from scratch." );
|
|
||||||
SampleUtil_Print( " PrintDev <devnum>" );
|
SampleUtil_Print( " PrintDev <devnum>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Print the state table for the device <devnum>." );
|
||||||
( " Print the state table for the device <devnum>." );
|
SampleUtil_Print( " e.g., 'PrintDev 1' prints the state table for the first" );
|
||||||
SampleUtil_Print
|
|
||||||
( " e.g., 'PrintDev 1' prints the state table for the first" );
|
|
||||||
SampleUtil_Print( " device in the device list." );
|
SampleUtil_Print( " device in the device list." );
|
||||||
SampleUtil_Print( " PowerOn <devnum>" );
|
SampleUtil_Print( " PowerOn <devnum>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the PowerOn action to the Control Service of" );
|
||||||
( " Sends the PowerOn action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>." );
|
SampleUtil_Print( " device <devnum>." );
|
||||||
SampleUtil_Print( " PowerOff <devnum>" );
|
SampleUtil_Print( " PowerOff <devnum>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the PowerOff action to the Control Service of" );
|
||||||
( " Sends the PowerOff action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>." );
|
SampleUtil_Print( " device <devnum>." );
|
||||||
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the SetChannel action to the Control Service of" );
|
||||||
( " Sends the SetChannel action to the Control Service of" );
|
SampleUtil_Print( " device <devnum>, requesting the channel to be changed" );
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the channel to be changed" );
|
|
||||||
SampleUtil_Print( " to <channel>." );
|
SampleUtil_Print( " to <channel>." );
|
||||||
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the SetVolume action to the Control Service of" );
|
||||||
( " Sends the SetVolume action to the Control Service of" );
|
SampleUtil_Print( " device <devnum>, requesting the volume to be changed" );
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the volume to be changed" );
|
|
||||||
SampleUtil_Print( " to <volume>." );
|
SampleUtil_Print( " to <volume>." );
|
||||||
SampleUtil_Print( " SetColor <devnum> <color>" );
|
SampleUtil_Print( " SetColor <devnum> <color>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the SetColor action to the Control Service of" );
|
||||||
( " Sends the SetColor action to the Control Service of" );
|
SampleUtil_Print( " device <devnum>, requesting the color to be changed" );
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the color to be changed" );
|
|
||||||
SampleUtil_Print( " to <color>." );
|
SampleUtil_Print( " to <color>." );
|
||||||
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the SetTint action to the Control Service of" );
|
||||||
( " Sends the SetTint action to the Control Service of" );
|
SampleUtil_Print( " device <devnum>, requesting the tint to be changed" );
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the tint to be changed" );
|
|
||||||
SampleUtil_Print( " to <tint>." );
|
SampleUtil_Print( " to <tint>." );
|
||||||
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the SetContrast action to the Control Service of" );
|
||||||
( " Sends the SetContrast action to the Control Service of" );
|
SampleUtil_Print( " device <devnum>, requesting the contrast to be changed" );
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the contrast to be changed" );
|
|
||||||
SampleUtil_Print( " to <contrast>." );
|
SampleUtil_Print( " to <contrast>." );
|
||||||
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends the SetBrightness action to the Control Service of" );
|
||||||
( " Sends the SetBrightness action to the Control Service of" );
|
SampleUtil_Print( " device <devnum>, requesting the brightness to be changed" );
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the brightness to be changed" );
|
|
||||||
SampleUtil_Print( " to <brightness>." );
|
SampleUtil_Print( " to <brightness>." );
|
||||||
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends an action request specified by the string <action>" );
|
||||||
( " Sends an action request specified by the string <action>" );
|
SampleUtil_Print( " to the Control Service of device <devnum>. This command" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " only works for actions that have no arguments." );
|
||||||
( " to the Control Service of device <devnum>. This command" );
|
SampleUtil_Print( " (e.g., \"CtrlAction 1 IncreaseChannel\")" );
|
||||||
SampleUtil_Print
|
|
||||||
( " only works for actions that have no arguments." );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " (e.g., \"CtrlAction 1 IncreaseChannel\")" );
|
|
||||||
SampleUtil_Print( " PictAction <devnum> <action>" );
|
SampleUtil_Print( " PictAction <devnum> <action>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Sends an action request specified by the string <action>" );
|
||||||
( " Sends an action request specified by the string <action>" );
|
SampleUtil_Print( " to the Picture Service of device <devnum>. This command" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " only works for actions that have no arguments." );
|
||||||
( " to the Picture Service of device <devnum>. This command" );
|
SampleUtil_Print( " (e.g., \"PictAction 1 DecreaseContrast\")" );
|
||||||
SampleUtil_Print
|
|
||||||
( " only works for actions that have no arguments." );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " (e.g., \"PictAction 1 DecreaseContrast\")" );
|
|
||||||
SampleUtil_Print( " CtrlGetVar <devnum> <varname>" );
|
SampleUtil_Print( " CtrlGetVar <devnum> <varname>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Requests the value of a variable specified by the string <varname>" );
|
||||||
( " Requests the value of a variable specified by the string <varname>" );
|
SampleUtil_Print( " from the Control Service of device <devnum>." );
|
||||||
SampleUtil_Print
|
|
||||||
( " from the Control Service of device <devnum>." );
|
|
||||||
SampleUtil_Print( " (e.g., \"CtrlGetVar 1 Volume\")" );
|
SampleUtil_Print( " (e.g., \"CtrlGetVar 1 Volume\")" );
|
||||||
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
||||||
SampleUtil_Print
|
SampleUtil_Print( " Requests the value of a variable specified by the string <varname>" );
|
||||||
( " Requests the value of a variable specified by the string <varname>" );
|
SampleUtil_Print( " from the Picture Service of device <devnum>." );
|
||||||
SampleUtil_Print
|
|
||||||
( " from the Picture Service of device <devnum>." );
|
|
||||||
SampleUtil_Print( " (e.g., \"PictGetVar 1 Tint\")" );
|
SampleUtil_Print( " (e.g., \"PictGetVar 1 Tint\")" );
|
||||||
SampleUtil_Print( " Exit" );
|
SampleUtil_Print( " Exit" );
|
||||||
SampleUtil_Print( " Exits the control point application." );
|
SampleUtil_Print( " Exits the control point application." );
|
||||||
@@ -434,26 +401,29 @@ TvCtrlPointProcessCommand( char *cmdline )
|
|||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int main( int argc, char **argv )
|
||||||
main( int argc,
|
|
||||||
char **argv )
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ithread_t cmdloop_thread;
|
ithread_t cmdloop_thread;
|
||||||
|
#ifdef WIN32
|
||||||
|
#else
|
||||||
int sig;
|
int sig;
|
||||||
sigset_t sigs_to_catch;
|
sigset_t sigs_to_catch;
|
||||||
|
#endif
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
|
|
||||||
rc = TvCtrlPointStart( linux_print, NULL );
|
rc = TvCtrlPointStart( linux_print, NULL );
|
||||||
if( rc != TV_SUCCESS ) {
|
if( rc != TV_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
||||||
exit( rc );
|
return rc;
|
||||||
}
|
}
|
||||||
// start a command loop thread
|
/* start a command loop thread */
|
||||||
code =
|
code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL );
|
||||||
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
ithread_join(cmdloop_thread, NULL);
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
Catch Ctrl-C and properly shutdown
|
Catch Ctrl-C and properly shutdown
|
||||||
*/
|
*/
|
||||||
@@ -461,7 +431,11 @@ main( int argc,
|
|||||||
sigaddset( &sigs_to_catch, SIGINT );
|
sigaddset( &sigs_to_catch, SIGINT );
|
||||||
sigwait( &sigs_to_catch, &sig );
|
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();
|
rc = TvCtrlPointStop();
|
||||||
exit( rc );
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,42 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
#include "upnp_tv_ctrlpt.h"
|
||||||
|
|
||||||
/*
|
|
||||||
|
#include "upnp.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
Mutex for protecting the global device list
|
Mutex for protecting the global device list
|
||||||
in a multi-threaded, asynchronous environment.
|
in a multi-threaded, asynchronous environment.
|
||||||
All functions should lock this mutex before reading
|
All functions should lock this mutex before reading
|
||||||
@@ -48,7 +53,7 @@ char *TvServiceType[] = {
|
|||||||
};
|
};
|
||||||
char *TvServiceName[] = { "Control", "Picture" };
|
char *TvServiceName[] = { "Control", "Picture" };
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
Global arrays for storing variable names and counts for
|
Global arrays for storing variable names and counts for
|
||||||
TvControl and TvPicture services
|
TvControl and TvPicture services
|
||||||
*/
|
*/
|
||||||
@@ -59,12 +64,12 @@ char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS] = {
|
|||||||
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
||||||
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
Timeout to request during subscriptions
|
Timeout to request during subscriptions
|
||||||
*/
|
*/
|
||||||
int default_timeout = 1801;
|
int default_timeout = 1801;
|
||||||
|
|
||||||
/*
|
/*!
|
||||||
The first node in the global device list, or NULL if empty
|
The first node in the global device list, or NULL if empty
|
||||||
*/
|
*/
|
||||||
struct TvDeviceNode *GlobalDeviceList = NULL;
|
struct TvDeviceNode *GlobalDeviceList = NULL;
|
||||||
@@ -138,11 +143,10 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
|
|||||||
* UDN -- The Unique Device Name for the device to remove
|
* UDN -- The Unique Device Name for the device to remove
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int TvCtrlPointRemoveDevice(const char *UDN)
|
||||||
TvCtrlPointRemoveDevice( char *UDN )
|
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *curdevnode,
|
struct TvDeviceNode *curdevnode;
|
||||||
*prevdevnode;
|
struct TvDeviceNode *prevdevnode;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
@@ -669,7 +673,7 @@ TvCtrlPointPrintDevice( int devnum )
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void
|
||||||
TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
||||||
char *location,
|
const char *location,
|
||||||
int expires )
|
int expires )
|
||||||
{
|
{
|
||||||
char *deviceType = NULL;
|
char *deviceType = NULL;
|
||||||
@@ -682,20 +686,19 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
|||||||
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
||||||
int TimeOut[TV_SERVICE_SERVCOUNT] =
|
int TimeOut[TV_SERVICE_SERVCOUNT] = {
|
||||||
{ default_timeout, default_timeout };
|
default_timeout,
|
||||||
|
default_timeout };
|
||||||
struct TvDeviceNode *deviceNode;
|
struct TvDeviceNode *deviceNode;
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int service,
|
int service;
|
||||||
var;
|
int var;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
/*
|
/* Read key elements from description document */
|
||||||
Read key elements from description document
|
|
||||||
*/
|
|
||||||
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
||||||
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
||||||
friendlyName =
|
friendlyName =
|
||||||
@@ -703,9 +706,8 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
|||||||
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
||||||
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
||||||
|
|
||||||
ret =
|
ret = UpnpResolveURL(
|
||||||
UpnpResolveURL( ( baseURL ? baseURL : location ), relURL,
|
( baseURL ? baseURL : location ), relURL, presURL);
|
||||||
presURL );
|
|
||||||
|
|
||||||
if( UPNP_E_SUCCESS != ret )
|
if( UPNP_E_SUCCESS != ret )
|
||||||
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
||||||
@@ -939,8 +941,8 @@ TvStateUpdate( char *UDN,
|
|||||||
* changes -- The DOM document representing the changes
|
* changes -- The DOM document representing the changes
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void TvCtrlPointHandleEvent(
|
||||||
TvCtrlPointHandleEvent( Upnp_SID sid,
|
const char *sid,
|
||||||
int evntkey,
|
int evntkey,
|
||||||
IXML_Document *changes)
|
IXML_Document *changes)
|
||||||
{
|
{
|
||||||
@@ -951,15 +953,17 @@ TvCtrlPointHandleEvent( Upnp_SID sid,
|
|||||||
|
|
||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while (tmpdevnode) {
|
while (tmpdevnode) {
|
||||||
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) {
|
||||||
if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) ==
|
if (strcmp(tmpdevnode->device.TvService[service].SID, sid) == 0) {
|
||||||
0 ) {
|
|
||||||
SampleUtil_Print("Received Tv %s Event: %d for SID %s",
|
SampleUtil_Print("Received Tv %s Event: %d for SID %s",
|
||||||
TvServiceName[service], evntkey, sid );
|
TvServiceName[service],
|
||||||
|
evntkey,
|
||||||
TvStateUpdate( tmpdevnode->device.UDN, service, changes,
|
sid);
|
||||||
( char ** )&tmpdevnode->device.
|
TvStateUpdate(
|
||||||
TvService[service].VariableStrVal );
|
tmpdevnode->device.UDN,
|
||||||
|
service,
|
||||||
|
changes,
|
||||||
|
(char **)&tmpdevnode->device.TvService[service].VariableStrVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -983,9 +987,9 @@ TvCtrlPointHandleEvent( Upnp_SID sid,
|
|||||||
* timeout -- The new timeout for the subscription
|
* timeout -- The new timeout for the subscription
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void TvCtrlPointHandleSubscribeUpdate(
|
||||||
TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
const char *eventURL,
|
||||||
Upnp_SID sid,
|
const Upnp_SID sid,
|
||||||
int timeout)
|
int timeout)
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1014,10 +1018,10 @@ TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
|||||||
ithread_mutex_unlock( &DeviceListMutex );
|
ithread_mutex_unlock( &DeviceListMutex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void TvCtrlPointHandleGetVar(
|
||||||
TvCtrlPointHandleGetVar( char *controlURL,
|
const char *controlURL,
|
||||||
char *varName,
|
const char *varName,
|
||||||
DOMString varValue )
|
const DOMString varValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1028,12 +1032,9 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
|||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while (tmpdevnode) {
|
while (tmpdevnode) {
|
||||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
|
for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) {
|
||||||
if( strcmp
|
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL) == 0) {
|
||||||
( tmpdevnode->device.TvService[service].ControlURL,
|
SampleUtil_StateUpdate(
|
||||||
controlURL ) == 0 ) {
|
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE);
|
||||||
SampleUtil_StateUpdate( varName, varValue,
|
|
||||||
tmpdevnode->device.UDN,
|
|
||||||
GET_VAR_COMPLETE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1057,179 +1058,130 @@ TvCtrlPointHandleGetVar( char *controlURL,
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* Cookie -- Optional data specified during callback registration
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||||
TvCtrlPointCallbackEventHandler( Upnp_EventType EventType,
|
|
||||||
void *Event,
|
|
||||||
void *Cookie )
|
|
||||||
{
|
{
|
||||||
SampleUtil_PrintEvent( EventType, Event );
|
/*int errCode = 0;*/
|
||||||
|
|
||||||
|
SampleUtil_PrintEvent(EventType, Event);
|
||||||
switch ( EventType ) {
|
switch ( EventType ) {
|
||||||
/*
|
/* SSDP Stuff */
|
||||||
SSDP Stuff
|
|
||||||
*/
|
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||||
case UPNP_DISCOVERY_SEARCH_RESULT:
|
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
||||||
{
|
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||||
struct Upnp_Discovery *d_event =
|
|
||||||
( struct Upnp_Discovery * )Event;
|
|
||||||
IXML_Document *DescDoc = NULL;
|
IXML_Document *DescDoc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print( "Error in Discovery Callback -- %d",
|
SampleUtil_Print(
|
||||||
d_event->ErrCode );
|
"Error in Discovery Callback -- %d", d_event->ErrCode);
|
||||||
}
|
}
|
||||||
|
ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc);
|
||||||
if( ( ret =
|
if (ret != UPNP_E_SUCCESS) {
|
||||||
UpnpDownloadXmlDoc( d_event->Location,
|
SampleUtil_Print(
|
||||||
&DescDoc ) ) !=
|
"Error obtaining device description from %s -- error = %d",
|
||||||
UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print
|
|
||||||
( "Error obtaining device description from %s -- error = %d",
|
|
||||||
d_event->Location, ret);
|
d_event->Location, ret);
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointAddDevice( DescDoc, d_event->Location,
|
TvCtrlPointAddDevice(
|
||||||
d_event->Expires );
|
DescDoc, d_event->Location, d_event->Expires);
|
||||||
}
|
}
|
||||||
|
if (DescDoc) {
|
||||||
if( DescDoc )
|
|
||||||
ixmlDocument_free(DescDoc);
|
ixmlDocument_free(DescDoc);
|
||||||
|
}
|
||||||
TvCtrlPointPrintList();
|
TvCtrlPointPrintList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||||
/*
|
/* Nothing to do here... */
|
||||||
Nothing to do here...
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
|
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
|
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||||
{
|
|
||||||
struct Upnp_Discovery *d_event =
|
|
||||||
( struct Upnp_Discovery * )Event;
|
|
||||||
|
|
||||||
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Discovery ByeBye Callback -- %d",
|
"Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
|
||||||
d_event->ErrCode );
|
|
||||||
}
|
}
|
||||||
|
SampleUtil_Print("Received ByeBye for Device: %s", d_event->DeviceId);
|
||||||
SampleUtil_Print( "Received ByeBye for Device: %s",
|
|
||||||
d_event->DeviceId );
|
|
||||||
TvCtrlPointRemoveDevice(d_event->DeviceId);
|
TvCtrlPointRemoveDevice(d_event->DeviceId);
|
||||||
|
|
||||||
SampleUtil_Print("After byebye:");
|
SampleUtil_Print("After byebye:");
|
||||||
TvCtrlPointPrintList();
|
TvCtrlPointPrintList();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* SOAP Stuff */
|
||||||
/*
|
case UPNP_CONTROL_ACTION_COMPLETE: {
|
||||||
SOAP Stuff
|
struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)Event;
|
||||||
*/
|
|
||||||
case UPNP_CONTROL_ACTION_COMPLETE:
|
|
||||||
{
|
|
||||||
struct Upnp_Action_Complete *a_event =
|
|
||||||
( struct Upnp_Action_Complete * )Event;
|
|
||||||
|
|
||||||
if (a_event->ErrCode != UPNP_E_SUCCESS) {
|
if (a_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Action Complete Callback -- %d",
|
"Error in Action Complete Callback -- %d", a_event->ErrCode);
|
||||||
a_event->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;
|
break;
|
||||||
}
|
}
|
||||||
|
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
||||||
case UPNP_CONTROL_GET_VAR_COMPLETE:
|
struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
|
||||||
{
|
|
||||||
struct Upnp_State_Var_Complete *sv_event =
|
|
||||||
( struct Upnp_State_Var_Complete * )Event;
|
|
||||||
|
|
||||||
if (sv_event->ErrCode != UPNP_E_SUCCESS) {
|
if (sv_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Get Var Complete Callback -- %d",
|
"Error in Get Var Complete Callback -- %d", sv_event->ErrCode);
|
||||||
sv_event->ErrCode );
|
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleGetVar( sv_event->CtrlUrl,
|
TvCtrlPointHandleGetVar(
|
||||||
|
sv_event->CtrlUrl,
|
||||||
sv_event->StateVarName,
|
sv_event->StateVarName,
|
||||||
sv_event->CurrentVal);
|
sv_event->CurrentVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* GENA Stuff */
|
||||||
/*
|
case UPNP_EVENT_RECEIVED: {
|
||||||
GENA Stuff
|
|
||||||
*/
|
|
||||||
case UPNP_EVENT_RECEIVED:
|
|
||||||
{
|
|
||||||
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
|
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
|
||||||
|
|
||||||
TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey,
|
TvCtrlPointHandleEvent(
|
||||||
|
e_event->Sid,
|
||||||
|
e_event->EventKey,
|
||||||
e_event->ChangedVariables);
|
e_event->ChangedVariables);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_RENEWAL_COMPLETE:
|
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
||||||
{
|
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
||||||
struct Upnp_Event_Subscribe *es_event =
|
|
||||||
( struct Upnp_Event_Subscribe * )Event;
|
|
||||||
|
|
||||||
if (es_event->ErrCode != UPNP_E_SUCCESS) {
|
if (es_event->ErrCode != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in Event Subscribe Callback -- %d",
|
"Error in Event Subscribe Callback -- %d", es_event->ErrCode);
|
||||||
es_event->ErrCode );
|
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
TvCtrlPointHandleSubscribeUpdate(
|
||||||
PublisherUrl,
|
es_event->PublisherUrl,
|
||||||
es_event->Sid,
|
es_event->Sid,
|
||||||
es_event->TimeOut);
|
es_event->TimeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
|
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
||||||
{
|
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
||||||
int TimeOut = default_timeout;
|
int TimeOut = default_timeout;
|
||||||
Upnp_SID newSID;
|
Upnp_SID newSID;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
struct Upnp_Event_Subscribe *es_event =
|
ret = UpnpSubscribe(
|
||||||
( struct Upnp_Event_Subscribe * )Event;
|
ctrlpt_handle,
|
||||||
|
es_event->PublisherUrl,
|
||||||
ret =
|
&TimeOut,
|
||||||
UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl,
|
|
||||||
&TimeOut, newSID );
|
|
||||||
|
|
||||||
if( ret == UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Subscribed to EventURL with SID=%s",
|
|
||||||
newSID);
|
newSID);
|
||||||
TvCtrlPointHandleSubscribeUpdate( es_event->
|
if (ret == UPNP_E_SUCCESS) {
|
||||||
PublisherUrl, newSID,
|
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
|
||||||
|
TvCtrlPointHandleSubscribeUpdate(
|
||||||
|
es_event->PublisherUrl,
|
||||||
|
newSID,
|
||||||
TimeOut);
|
TimeOut);
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print
|
SampleUtil_Print("Error Subscribing to EventURL -- %d", ret);
|
||||||
( "Error Subscribing to EventURL -- %d", ret );
|
|
||||||
}
|
}
|
||||||
break;
|
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_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||||
case UPNP_CONTROL_ACTION_REQUEST:
|
case UPNP_CONTROL_ACTION_REQUEST:
|
||||||
@@ -1320,12 +1272,12 @@ TvCtrlPointVerifyTimeouts( int incr )
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void *
|
static int TvCtrlPointTimerLoopRun = 1;
|
||||||
TvCtrlPointTimerLoop( void *args )
|
void *TvCtrlPointTimerLoop(void *args)
|
||||||
{
|
{
|
||||||
int incr = 30; // how often to verify the timeouts, in seconds
|
int incr = 30; // how often to verify the timeouts, in seconds
|
||||||
|
|
||||||
while( 1 ) {
|
while (TvCtrlPointTimerLoopRun) {
|
||||||
isleep( incr );
|
isleep( incr );
|
||||||
TvCtrlPointVerifyTimeouts( incr );
|
TvCtrlPointVerifyTimeouts( incr );
|
||||||
}
|
}
|
||||||
@@ -1348,13 +1300,11 @@ TvCtrlPointTimerLoop( void *args )
|
|||||||
* TV_SUCCESS if everything went well, else TV_ERROR
|
* TV_SUCCESS if everything went well, else TV_ERROR
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr)
|
||||||
TvCtrlPointStart( print_string printFunctionPtr,
|
|
||||||
state_update updateFunctionPtr )
|
|
||||||
{
|
{
|
||||||
ithread_t timer_thread;
|
ithread_t timer_thread;
|
||||||
int rc;
|
int rc;
|
||||||
short int port = 0;
|
unsigned short port = 0;
|
||||||
char *ip_address = NULL;
|
char *ip_address = NULL;
|
||||||
|
|
||||||
SampleUtil_Initialize(printFunctionPtr);
|
SampleUtil_Initialize(printFunctionPtr);
|
||||||
@@ -1362,28 +1312,38 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
|||||||
|
|
||||||
ithread_mutex_init(&DeviceListMutex, 0);
|
ithread_mutex_init(&DeviceListMutex, 0);
|
||||||
|
|
||||||
SampleUtil_Print( "Initializing UPnP with ipaddress=%s port=%d",
|
SampleUtil_Print(
|
||||||
ip_address, port );
|
"Initializing UPnP Sdk with\n"
|
||||||
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
port);
|
||||||
|
|
||||||
rc = UpnpInit(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);
|
SampleUtil_Print("WinCEStart: UpnpInit() Error: %d", rc);
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
return TV_ERROR;
|
return TV_ERROR;
|
||||||
}
|
}
|
||||||
|
if (!ip_address) {
|
||||||
if( NULL == ip_address )
|
|
||||||
ip_address = UpnpGetServerIpAddress();
|
ip_address = UpnpGetServerIpAddress();
|
||||||
if( 0 == port )
|
}
|
||||||
|
if (!port) {
|
||||||
port = UpnpGetServerPort();
|
port = UpnpGetServerPort();
|
||||||
|
}
|
||||||
|
|
||||||
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port );
|
SampleUtil_Print(
|
||||||
|
"UPnP Initialized\n"
|
||||||
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
port);
|
||||||
|
|
||||||
SampleUtil_Print("Registering Control Point");
|
SampleUtil_Print("Registering Control Point");
|
||||||
rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,
|
rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler,
|
||||||
&ctrlpt_handle, &ctrlpt_handle);
|
&ctrlpt_handle, &ctrlpt_handle);
|
||||||
if( UPNP_E_SUCCESS != rc ) {
|
if (rc != UPNP_E_SUCCESS) {
|
||||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return TV_ERROR;
|
return TV_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,15 +1351,16 @@ TvCtrlPointStart( print_string printFunctionPtr,
|
|||||||
|
|
||||||
TvCtrlPointRefresh();
|
TvCtrlPointRefresh();
|
||||||
|
|
||||||
// start a timer thread
|
/* start a timer thread */
|
||||||
ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL);
|
ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL);
|
||||||
|
ithread_detach(timer_thread);
|
||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int TvCtrlPointStop(void)
|
||||||
TvCtrlPointStop( void )
|
|
||||||
{
|
{
|
||||||
|
TvCtrlPointTimerLoopRun = 0;
|
||||||
TvCtrlPointRemoveAll();
|
TvCtrlPointRemoveAll();
|
||||||
UpnpUnRegisterClient( ctrlpt_handle );
|
UpnpUnRegisterClient( ctrlpt_handle );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
@@ -1407,3 +1368,4 @@ TvCtrlPointStop( void )
|
|||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,66 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_CTRLPT_H
|
#ifndef UPNP_TV_CTRLPT_H
|
||||||
#define UPNP_TV_CTRLPT_H
|
#define UPNP_TV_CTRLPT_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include <unistd.h>
|
#include "upnp.h"
|
||||||
#include <stdarg.h>
|
#include "UpnpString.h"
|
||||||
#include <stdlib.h>
|
#include "upnptools.h"
|
||||||
|
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnptools.h"
|
#ifdef WIN32
|
||||||
#include "sample_util.h"
|
/* Do not #include <unistd.h> */
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
#define TV_SERVICE_SERVCOUNT 2
|
||||||
#define TV_SERVICE_CONTROL 0
|
#define TV_SERVICE_CONTROL 0
|
||||||
@@ -110,7 +123,7 @@ extern UpnpClient_Handle ctrlpt_handle;
|
|||||||
|
|
||||||
void TvCtrlPointPrintHelp(void);
|
void TvCtrlPointPrintHelp(void);
|
||||||
int TvCtrlPointDeleteNode(struct TvDeviceNode *);
|
int TvCtrlPointDeleteNode(struct TvDeviceNode *);
|
||||||
int TvCtrlPointRemoveDevice(char*);
|
int TvCtrlPointRemoveDevice(const char *);
|
||||||
int TvCtrlPointRemoveAll(void);
|
int TvCtrlPointRemoveAll(void);
|
||||||
int TvCtrlPointRefresh(void);
|
int TvCtrlPointRefresh(void);
|
||||||
|
|
||||||
@@ -138,11 +151,11 @@ int TvCtrlPointGetBrightness(int);
|
|||||||
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
||||||
int TvCtrlPointPrintList(void);
|
int TvCtrlPointPrintList(void);
|
||||||
int TvCtrlPointPrintDevice(int);
|
int TvCtrlPointPrintDevice(int);
|
||||||
void TvCtrlPointAddDevice (IXML_Document *, char *, int);
|
void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
||||||
void TvCtrlPointHandleGetVar(char *,char *,DOMString);
|
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
||||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
||||||
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
void TvCtrlPointHandleEvent(const char *, int, IXML_Document *);
|
||||||
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
||||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||||
void TvCtrlPointVerifyTimeouts(int);
|
void TvCtrlPointVerifyTimeouts(int);
|
||||||
void TvCtrlPointPrintCommands(void);
|
void TvCtrlPointPrintCommands(void);
|
||||||
|
|||||||
@@ -1,38 +1,42 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "sample_util.h"
|
#include "sample_util.h"
|
||||||
#include "upnp_tv_device.h"
|
#include "upnp_tv_device.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* linux_print
|
* linux_print
|
||||||
*
|
*
|
||||||
@@ -117,21 +121,22 @@ TvDeviceCommandLoop( void *args )
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int main( IN int argc, IN char **argv )
|
||||||
main( IN int argc,
|
|
||||||
IN char **argv )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int portTemp = 0;
|
unsigned int portTemp = 0;
|
||||||
char *ip_address = NULL,
|
char *ip_address = NULL,
|
||||||
*desc_doc_name = NULL,
|
*desc_doc_name = NULL,
|
||||||
*web_dir_path = NULL;
|
*web_dir_path = NULL;
|
||||||
|
int rc;
|
||||||
ithread_t cmdloop_thread;
|
ithread_t cmdloop_thread;
|
||||||
int code;
|
#ifdef WIN32
|
||||||
unsigned int port = 0;
|
#else
|
||||||
int sig;
|
int sig;
|
||||||
sigset_t sigs_to_catch;
|
sigset_t sigs_to_catch;
|
||||||
|
#endif
|
||||||
|
int code;
|
||||||
|
unsigned int port = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
SampleUtil_Initialize( linux_print );
|
SampleUtil_Initialize( linux_print );
|
||||||
@@ -163,21 +168,20 @@ main( IN int argc,
|
|||||||
( "\tweb_dir_path: Filesystem path where web files "
|
( "\tweb_dir_path: Filesystem path where web files "
|
||||||
"related to the device are stored\n" );
|
"related to the device are stored\n" );
|
||||||
SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" );
|
SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" );
|
||||||
exit( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
port = ( unsigned short )portTemp;
|
port = ( unsigned short )portTemp;
|
||||||
|
|
||||||
TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path,
|
TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
||||||
linux_print );
|
|
||||||
|
|
||||||
/*
|
/* start a command loop thread */
|
||||||
start a command loop thread
|
code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop, NULL );
|
||||||
*/
|
|
||||||
code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
ithread_join(cmdloop_thread, NULL);
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
Catch Ctrl-C and properly shutdown
|
Catch Ctrl-C and properly shutdown
|
||||||
*/
|
*/
|
||||||
@@ -186,6 +190,9 @@ main( IN int argc,
|
|||||||
sigwait( &sigs_to_catch, &sig );
|
sigwait( &sigs_to_catch, &sig );
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
||||||
TvDeviceStop( );
|
#endif
|
||||||
exit( 0 );
|
rc = TvDeviceStop();
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +1,47 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_device.h"
|
#include "upnp_tv_device.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_WEB_DIR "./web"
|
#define DEFAULT_WEB_DIR "./web"
|
||||||
|
|
||||||
|
|
||||||
#define DESC_URL_SIZE 200
|
#define DESC_URL_SIZE 200
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Device type for tv device
|
Device type for tv device
|
||||||
*/
|
*/
|
||||||
@@ -180,7 +187,6 @@ SetServiceTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SetActionTable( serviceType, out );
|
return SetActionTable( serviceType, out );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -251,7 +257,6 @@ SetActionTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -368,61 +373,66 @@ TvDeviceStateTableInit( IN char *DescDocURL )
|
|||||||
* sr_event -- The subscription request event structure
|
* sr_event -- The subscription request event structure
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceHandleSubscriptionRequest(IN struct Upnp_Subscription_Request *sr_event)
|
||||||
TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|
||||||
*sr_event )
|
|
||||||
{
|
{
|
||||||
unsigned int i = 0; //,j=0;
|
unsigned int i = 0;
|
||||||
|
int cmp1 = 0;
|
||||||
// IXML_Document *PropSet=NULL;
|
int cmp2 = 0;
|
||||||
|
const char *l_serviceId = NULL;
|
||||||
|
const char *l_udn = NULL;
|
||||||
|
const char *l_sid = NULL;
|
||||||
|
|
||||||
// lock state mutex
|
// lock state mutex
|
||||||
ithread_mutex_lock(&TVDevMutex);
|
ithread_mutex_lock(&TVDevMutex);
|
||||||
|
|
||||||
for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) {
|
l_serviceId = sr_event->ServiceId;
|
||||||
if( ( strcmp( sr_event->UDN, tv_service_table[i].UDN ) == 0 ) &&
|
l_udn = sr_event->UDN;
|
||||||
( strcmp( sr_event->ServiceId, tv_service_table[i].ServiceId )
|
l_sid = sr_event->Sid;
|
||||||
== 0 ) ) {
|
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;
|
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
|
// add each variable to the property set
|
||||||
// for initial state dump
|
// for initial state dump
|
||||||
UpnpAddToPropertySet(&PropSet,
|
UpnpAddToPropertySet(
|
||||||
|
&PropSet,
|
||||||
tv_service_table[i].VariableName[j],
|
tv_service_table[i].VariableName[j],
|
||||||
tv_service_table[i].VariableStrVal[j]);
|
tv_service_table[i].VariableStrVal[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dump initial state
|
// dump initial state
|
||||||
UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,
|
UpnpAcceptSubscriptionExt(
|
||||||
sr_event->ServiceId,
|
device_handle,
|
||||||
PropSet,sr_event->Sid);
|
l_udn,
|
||||||
|
l_serviceId,
|
||||||
|
PropSet,
|
||||||
|
l_sid);
|
||||||
// free document
|
// free document
|
||||||
Document_free(PropSet);
|
Document_free(PropSet);
|
||||||
|
#endif
|
||||||
*/
|
UpnpAcceptSubscription(
|
||||||
|
device_handle,
|
||||||
UpnpAcceptSubscription( device_handle,
|
l_udn,
|
||||||
sr_event->UDN,
|
l_serviceId,
|
||||||
sr_event->ServiceId,
|
|
||||||
(const char **)tv_service_table[i].
|
(const char **)tv_service_table[i].
|
||||||
VariableName,
|
VariableName,
|
||||||
(const char **)tv_service_table[i].
|
(const char **)tv_service_table[i].
|
||||||
VariableStrVal,
|
VariableStrVal,
|
||||||
tv_service_table[i].VariableCount,
|
tv_service_table[i].VariableCount,
|
||||||
sr_event->Sid );
|
l_sid);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ithread_mutex_unlock(&TVDevMutex);
|
ithread_mutex_unlock(&TVDevMutex);
|
||||||
|
|
||||||
return ( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceHandleGetVarRequest
|
* TvDeviceHandleGetVarRequest
|
||||||
*
|
*
|
||||||
@@ -435,12 +445,10 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|||||||
* cgv_event -- The control get variable request event structure
|
* cgv_event -- The control get variable request event structure
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceHandleGetVarRequest(INOUT struct Upnp_State_Var_Request *cgv_event)
|
||||||
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|
||||||
*cgv_event )
|
|
||||||
{
|
{
|
||||||
unsigned int i = 0,
|
unsigned int i = 0;
|
||||||
j = 0;
|
unsigned int j = 0;
|
||||||
int getvar_succeeded = 0;
|
int getvar_succeeded = 0;
|
||||||
|
|
||||||
cgv_event->CurrentVal = NULL;
|
cgv_event->CurrentVal = NULL;
|
||||||
@@ -449,30 +457,32 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
|
|
||||||
for (i = 0; i < TV_SERVICE_SERVCOUNT; i++) {
|
for (i = 0; i < TV_SERVICE_SERVCOUNT; i++) {
|
||||||
// check udn and service id
|
// check udn and service id
|
||||||
if( ( strcmp( cgv_event->DevUDN, tv_service_table[i].UDN ) == 0 )
|
const char *devUDN =
|
||||||
&&
|
cgv_event->DevUDN;
|
||||||
( strcmp( cgv_event->ServiceID, tv_service_table[i].ServiceId )
|
const char *serviceID =
|
||||||
== 0 ) ) {
|
cgv_event->ServiceID;
|
||||||
|
if (strcmp(devUDN, tv_service_table[i].UDN) == 0 &&
|
||||||
|
strcmp(serviceID, tv_service_table[i].ServiceId) == 0) {
|
||||||
// check variable name
|
// check variable name
|
||||||
for (j = 0; j < tv_service_table[i].VariableCount; j++) {
|
for (j = 0; j < tv_service_table[i].VariableCount; j++) {
|
||||||
if( strcmp( cgv_event->StateVarName,
|
const char *stateVarName =
|
||||||
|
cgv_event->StateVarName;
|
||||||
|
if (strcmp(stateVarName,
|
||||||
tv_service_table[i].VariableName[j]) == 0) {
|
tv_service_table[i].VariableName[j]) == 0) {
|
||||||
getvar_succeeded = 1;
|
getvar_succeeded = 1;
|
||||||
cgv_event->CurrentVal =
|
cgv_event->CurrentVal = ixmlCloneDOMString(
|
||||||
ixmlCloneDOMString( tv_service_table[i].
|
tv_service_table[i].VariableStrVal[j]);
|
||||||
VariableStrVal[j] );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getvar_succeeded) {
|
if (getvar_succeeded) {
|
||||||
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n" );
|
"Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n"
|
||||||
SampleUtil_Print( " Unknown variable name = %s\n",
|
" Unknown variable name = %s\n",
|
||||||
cgv_event->StateVarName);
|
cgv_event->StateVarName);
|
||||||
cgv_event->ErrCode = 404;
|
cgv_event->ErrCode = 404;
|
||||||
strcpy(cgv_event->ErrStr, "Invalid Variable");
|
strcpy(cgv_event->ErrStr, "Invalid Variable");
|
||||||
@@ -480,7 +490,7 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
|
|
||||||
ithread_mutex_unlock(&TVDevMutex);
|
ithread_mutex_unlock(&TVDevMutex);
|
||||||
|
|
||||||
return ( cgv_event->ErrCode == UPNP_E_SUCCESS );
|
return cgv_event->ErrCode == UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -495,62 +505,46 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
* ca_event -- The control action request event structure
|
* ca_event -- The control action request event structure
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceHandleActionRequest(INOUT struct Upnp_Action_Request *ca_event)
|
||||||
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
|
||||||
{
|
{
|
||||||
|
/* Defaults if action not found. */
|
||||||
/*
|
|
||||||
Defaults if action not found
|
|
||||||
*/
|
|
||||||
int action_found = 0;
|
int action_found = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int service = -1;
|
int service = -1;
|
||||||
int retCode = 0;
|
int retCode = 0;
|
||||||
char *errorString = NULL;
|
char *errorString = NULL;
|
||||||
|
const char *devUDN = NULL;
|
||||||
|
const char *serviceID = NULL;
|
||||||
|
const char *actionName = NULL;
|
||||||
|
|
||||||
ca_event->ErrCode = 0;
|
ca_event->ErrCode = 0;
|
||||||
ca_event->ActionResult = NULL;
|
ca_event->ActionResult = NULL;
|
||||||
|
|
||||||
if( ( strcmp( ca_event->DevUDN,
|
devUDN = ca_event->DevUDN;
|
||||||
tv_service_table[TV_SERVICE_CONTROL].UDN ) == 0 ) &&
|
serviceID = ca_event->ServiceID;
|
||||||
( strcmp
|
actionName = ca_event->ActionName;
|
||||||
( ca_event->ServiceID,
|
if (strcmp(devUDN, tv_service_table[TV_SERVICE_CONTROL].UDN) == 0 &&
|
||||||
tv_service_table[TV_SERVICE_CONTROL].ServiceId ) == 0 ) ) {
|
strcmp(serviceID, tv_service_table[TV_SERVICE_CONTROL].ServiceId) == 0) {
|
||||||
/*
|
/* Request for action in the TvDevice Control Service. */
|
||||||
Request for action in the TvDevice Control Service
|
|
||||||
*/
|
|
||||||
service = TV_SERVICE_CONTROL;
|
service = TV_SERVICE_CONTROL;
|
||||||
} else if( ( strcmp( ca_event->DevUDN,
|
} else if (strcmp(devUDN, tv_service_table[TV_SERVICE_PICTURE].UDN) == 0 &&
|
||||||
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. */
|
||||||
( strcmp
|
|
||||||
( ca_event->ServiceID,
|
|
||||||
tv_service_table[TV_SERVICE_PICTURE].ServiceId ) ==
|
|
||||||
0 ) ) {
|
|
||||||
/*
|
|
||||||
Request for action in the TvDevice Picture Service
|
|
||||||
*/
|
|
||||||
service = TV_SERVICE_PICTURE;
|
service = TV_SERVICE_PICTURE;
|
||||||
}
|
}
|
||||||
//Find and call appropriate procedure based on action name
|
/* Find and call appropriate procedure based on action name.
|
||||||
//Each action name has an associated procedure stored in the
|
* Each action name has an associated procedure stored in the
|
||||||
//service table. These are set at initialization.
|
* service table. These are set at initialization. */
|
||||||
|
for (i = 0;
|
||||||
for( i = 0; ( ( i < TV_MAXACTIONS ) &&
|
i < TV_MAXACTIONS && tv_service_table[service].ActionNames[i] != NULL;
|
||||||
( tv_service_table[service].ActionNames[i] != NULL ) );
|
|
||||||
i++) {
|
i++) {
|
||||||
|
if (!strcmp(actionName, tv_service_table[service].ActionNames[i])) {
|
||||||
if( !strcmp( ca_event->ActionName,
|
if (!strcmp(tv_service_table[TV_SERVICE_CONTROL].
|
||||||
tv_service_table[service].ActionNames[i] ) ) {
|
VariableStrVal[TV_CONTROL_POWER], "1") ||
|
||||||
|
!strcmp(actionName, "PowerOn")) {
|
||||||
if( ( !strcmp( tv_service_table[TV_SERVICE_CONTROL].
|
retCode = tv_service_table[service].actions[i](
|
||||||
VariableStrVal[TV_CONTROL_POWER], "1" ) )
|
ca_event->ActionRequest,
|
||||||
|| ( !strcmp( ca_event->ActionName, "PowerOn" ) ) ) {
|
&ca_event->ActionResult,
|
||||||
retCode =
|
|
||||||
tv_service_table[service].actions[i] ( ca_event->
|
|
||||||
ActionRequest,
|
|
||||||
&ca_event->
|
|
||||||
ActionResult,
|
|
||||||
&errorString);
|
&errorString);
|
||||||
} else {
|
} else {
|
||||||
errorString = "Power is Off";
|
errorString = "Power is Off";
|
||||||
@@ -573,22 +567,17 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
|||||||
strcpy(ca_event->ErrStr, errorString);
|
strcpy(ca_event->ErrStr, errorString);
|
||||||
switch (retCode) {
|
switch (retCode) {
|
||||||
case UPNP_E_INVALID_PARAM:
|
case UPNP_E_INVALID_PARAM:
|
||||||
{
|
|
||||||
ca_event->ErrCode = 402;
|
ca_event->ErrCode = 402;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case UPNP_E_INTERNAL_ERROR:
|
case UPNP_E_INTERNAL_ERROR:
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
ca_event->ErrCode = 501;
|
ca_event->ErrCode = 501;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( ca_event->ErrCode );
|
return ca_event->ErrCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -651,7 +640,6 @@ TvDeviceSetServiceTableVar( IN unsigned int service,
|
|||||||
ithread_mutex_unlock( &TVDevMutex );
|
ithread_mutex_unlock( &TVDevMutex );
|
||||||
|
|
||||||
return ( 1 );
|
return ( 1 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -674,7 +662,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
|
|
||||||
if( on != POWER_ON && on != POWER_OFF ) {
|
if( on != POWER_ON && on != POWER_OFF ) {
|
||||||
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
||||||
return ( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -685,7 +673,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
||||||
value );
|
value );
|
||||||
|
|
||||||
return ( ret );
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -702,9 +690,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDevicePowerOn( IN IXML_Document * in,
|
TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
( *errorString ) = NULL;
|
( *errorString ) = NULL;
|
||||||
@@ -724,7 +710,6 @@ TvDevicePowerOn( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -781,11 +766,8 @@ TvDevicePowerOff( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetChannel( IN IXML_Document * in,
|
TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
@@ -830,7 +812,6 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -848,13 +829,10 @@ TvDeviceSetChannel( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementChannel( IN int incr,
|
IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curchannel,
|
int curchannel;
|
||||||
newchannel;
|
int newchannel;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
@@ -916,12 +894,9 @@ IncrementChannel( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseChannel( IN IXML_Document * in,
|
TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementChannel( -1, in, out, errorString );
|
return IncrementChannel( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -938,12 +913,9 @@ TvDeviceDecreaseChannel( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseChannel( IN IXML_Document * in,
|
TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementChannel( 1, in, out, errorString );
|
return IncrementChannel( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -962,13 +934,9 @@ TvDeviceIncreaseChannel( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetVolume( IN IXML_Document * in,
|
TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int volume = 0;
|
int volume = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1009,7 +977,6 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1028,10 +995,7 @@ TvDeviceSetVolume( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementVolume( IN int incr,
|
IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curvolume,
|
int curvolume,
|
||||||
newvolume;
|
newvolume;
|
||||||
@@ -1068,8 +1032,7 @@ IncrementVolume( IN int incr,
|
|||||||
TV_CONTROL_VOLUME, value ) ) {
|
TV_CONTROL_VOLUME, value ) ) {
|
||||||
if( UpnpAddToActionResponse( out, actionName,
|
if( UpnpAddToActionResponse( out, actionName,
|
||||||
TvServiceType[TV_SERVICE_CONTROL],
|
TvServiceType[TV_SERVICE_CONTROL],
|
||||||
"Volume", value ) != UPNP_E_SUCCESS )
|
"Volume", value ) != UPNP_E_SUCCESS ) {
|
||||||
{
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
@@ -1079,7 +1042,6 @@ IncrementVolume( IN int incr,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1096,13 +1058,9 @@ IncrementVolume( IN int incr,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseVolume( IN IXML_Document * in,
|
TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementVolume( 1, in, out, errorString );
|
return IncrementVolume( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1119,13 +1077,9 @@ TvDeviceIncreaseVolume( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseVolume( IN IXML_Document * in,
|
TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementVolume( -1, in, out, errorString );
|
return IncrementVolume( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1144,13 +1098,9 @@ TvDeviceDecreaseVolume( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetColor( IN IXML_Document * in,
|
TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int color = 0;
|
int color = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1190,7 +1140,6 @@ TvDeviceSetColor( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1207,16 +1156,11 @@ TvDeviceSetColor( IN IXML_Document * in,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
IncrementColor( IN int incr,
|
IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curcolor,
|
int curcolor;
|
||||||
newcolor;
|
int newcolor;
|
||||||
|
|
||||||
char *actionName;
|
char *actionName;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1274,11 +1218,8 @@ IncrementColor( IN int incr,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseColor( IN IXML_Document * in,
|
TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementColor( -1, in, out, errorString );
|
return IncrementColor( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,11 +1236,8 @@ TvDeviceDecreaseColor( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseColor( IN IXML_Document * in,
|
TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementColor( 1, in, out, errorString );
|
return IncrementColor( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1319,13 +1257,9 @@ TvDeviceIncreaseColor( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetTint( IN IXML_Document * in,
|
TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
|
|
||||||
int tint = -1;
|
int tint = -1;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1384,14 +1318,10 @@ TvDeviceSetTint( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementTint( IN int incr,
|
IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curtint,
|
int curtint;
|
||||||
newtint;
|
int newtint;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1434,7 +1364,6 @@ IncrementTint( IN int incr,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1451,11 +1380,8 @@ IncrementTint( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseTint( IN IXML_Document * in,
|
TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementTint( 1, in, out, errorString );
|
return IncrementTint( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1473,11 +1399,8 @@ TvDeviceIncreaseTint( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseTint( IN IXML_Document * in,
|
TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementTint( -1, in, out, errorString );
|
return IncrementTint( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1497,11 +1420,8 @@ TvDeviceDecreaseTint( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetContrast( IN IXML_Document * in,
|
TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
int contrast = -1;
|
int contrast = -1;
|
||||||
|
|
||||||
@@ -1562,14 +1482,10 @@ TvDeviceSetContrast( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementContrast( IN int incr,
|
IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curcontrast,
|
int curcontrast;
|
||||||
newcontrast;
|
int newcontrast;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1631,11 +1547,8 @@ IncrementContrast( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseContrast( IN IXML_Document * in,
|
TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return IncrementContrast( 1, in, out, errorString );
|
return IncrementContrast( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1653,9 +1566,7 @@ TvDeviceIncreaseContrast( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseContrast( IXML_Document * in,
|
TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IXML_Document ** out,
|
|
||||||
char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementContrast( -1, in, out, errorString );
|
return IncrementContrast( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1673,11 +1584,8 @@ TvDeviceDecreaseContrast( IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceSetBrightness( IN IXML_Document * in,
|
TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
int brightness = -1;
|
int brightness = -1;
|
||||||
|
|
||||||
@@ -1720,7 +1628,6 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1738,13 +1645,10 @@ TvDeviceSetBrightness( IN IXML_Document * in,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
IncrementBrightness( IN int incr,
|
IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
IN IXML_Document * in,
|
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
int curbrightness,
|
int curbrightness;
|
||||||
newbrightness;
|
int newbrightness;
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1805,9 +1709,7 @@ IncrementBrightness( IN int incr,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementBrightness( 1, in, out, errorString );
|
return IncrementBrightness( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1825,9 +1727,7 @@ TvDeviceIncreaseBrightness( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
||||||
OUT IXML_Document ** out,
|
|
||||||
OUT char **errorString )
|
|
||||||
{
|
{
|
||||||
return IncrementBrightness( -1, in, out, errorString );
|
return IncrementBrightness( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1851,29 +1751,19 @@ TvDeviceDecreaseBrightness( IN IXML_Document * in,
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* Cookie -- Optional data specified during callback registration
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||||
TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
|
||||||
void *Event,
|
|
||||||
void *Cookie )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (EventType) {
|
switch (EventType) {
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
|
TvDeviceHandleSubscriptionRequest((struct Upnp_Subscription_Request *)Event);
|
||||||
TvDeviceHandleSubscriptionRequest( ( struct
|
|
||||||
Upnp_Subscription_Request
|
|
||||||
* )Event );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||||
TvDeviceHandleGetVarRequest( ( struct Upnp_State_Var_Request
|
TvDeviceHandleGetVarRequest((struct Upnp_State_Var_Request *)Event);
|
||||||
* )Event );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPNP_CONTROL_ACTION_REQUEST:
|
case UPNP_CONTROL_ACTION_REQUEST:
|
||||||
TvDeviceHandleActionRequest( ( struct Upnp_Action_Request * )
|
TvDeviceHandleActionRequest((struct Upnp_Action_Request *)Event);
|
||||||
Event );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1892,17 +1782,14 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SampleUtil_Print
|
SampleUtil_Print("Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||||
( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
|
||||||
EventType);
|
EventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Print a summary of the event received */
|
||||||
Print a summary of the event received
|
|
||||||
*/
|
|
||||||
SampleUtil_PrintEvent(EventType, Event);
|
SampleUtil_PrintEvent(EventType, Event);
|
||||||
|
|
||||||
return ( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1914,13 +1801,13 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType,
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int TvDeviceStop(void)
|
||||||
TvDeviceStop( )
|
|
||||||
{
|
{
|
||||||
UpnpUnRegisterRootDevice( device_handle );
|
UpnpUnRegisterRootDevice( device_handle );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
SampleUtil_Finish();
|
SampleUtil_Finish();
|
||||||
ithread_mutex_destroy( &TVDevMutex );
|
ithread_mutex_destroy( &TVDevMutex );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1953,79 +1840,85 @@ TvDeviceStart( char *ip_address,
|
|||||||
print_string pfun )
|
print_string pfun )
|
||||||
{
|
{
|
||||||
int ret = UPNP_E_SUCCESS;
|
int ret = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
char desc_doc_url[DESC_URL_SIZE];
|
char desc_doc_url[DESC_URL_SIZE];
|
||||||
|
|
||||||
ithread_mutex_init( &TVDevMutex, NULL );
|
ithread_mutex_init( &TVDevMutex, NULL );
|
||||||
|
|
||||||
SampleUtil_Initialize( pfun );
|
SampleUtil_Initialize( pfun );
|
||||||
|
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
"Initializing UPnP Sdk with\n"
|
||||||
ip_address, port );
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
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 );
|
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ip_address == NULL ) {
|
|
||||||
ip_address = UpnpGetServerIpAddress();
|
ip_address = UpnpGetServerIpAddress();
|
||||||
}
|
|
||||||
|
|
||||||
port = UpnpGetServerPort();
|
port = UpnpGetServerPort();
|
||||||
|
|
||||||
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
SampleUtil_Print(
|
||||||
ip_address, port );
|
"UPnP Initialized\n"
|
||||||
|
"\tipaddress = %s port = %u\n",
|
||||||
|
ip_address ? ip_address : "{NULL}",
|
||||||
|
port);
|
||||||
|
|
||||||
if( desc_doc_name == NULL )
|
if( desc_doc_name == NULL ) {
|
||||||
desc_doc_name = "tvdevicedesc.xml";
|
desc_doc_name = "tvdevicedesc.xml";
|
||||||
|
}
|
||||||
|
|
||||||
if( web_dir_path == NULL )
|
if( web_dir_path == NULL ) {
|
||||||
web_dir_path = DEFAULT_WEB_DIR;
|
web_dir_path = DEFAULT_WEB_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||||
port, desc_doc_name );
|
port, desc_doc_name );
|
||||||
|
|
||||||
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
||||||
web_dir_path );
|
web_dir_path );
|
||||||
if( ( ret =
|
ret = UpnpSetWebServerRootDir( web_dir_path );
|
||||||
UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) {
|
if( ret != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print
|
SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n",
|
||||||
( "Error specifying webserver root directory -- %s: %d\n",
|
|
||||||
web_dir_path, ret );
|
web_dir_path, ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print
|
SampleUtil_Print(
|
||||||
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
"Registering the RootDevice\n"
|
||||||
|
"\t with desc_doc_url: %s\n",
|
||||||
desc_doc_url );
|
desc_doc_url );
|
||||||
|
|
||||||
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler,
|
||||||
TvDeviceCallbackEventHandler,
|
&device_handle, &device_handle );
|
||||||
&device_handle, &device_handle ) )
|
if( ret != UPNP_E_SUCCESS ) {
|
||||||
!= UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print( "RootDevice Registered\n" );
|
SampleUtil_Print(
|
||||||
|
"RootDevice Registered\n"
|
||||||
SampleUtil_Print( "Initializing State Table\n" );
|
"Initializing State Table\n");
|
||||||
TvDeviceStateTableInit( desc_doc_url );
|
TvDeviceStateTableInit( desc_doc_url );
|
||||||
SampleUtil_Print("State Table Initialized\n");
|
SampleUtil_Print("State Table Initialized\n");
|
||||||
|
ret = UpnpSendAdvertisement( device_handle, default_advr_expire );
|
||||||
if( ( ret =
|
if( ret != UPNP_E_SUCCESS ) {
|
||||||
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
|
||||||
!= UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||||
UpnpFinish();
|
UpnpFinish();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print("Advertisements Sent\n");
|
SampleUtil_Print("Advertisements Sent\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,66 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_DEVICE_H
|
#ifndef UPNP_TV_DEVICE_H
|
||||||
#define UPNP_TV_DEVICE_H
|
#define UPNP_TV_DEVICE_H
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "sample_util.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
|
//Color constants
|
||||||
#define MAX_COLOR 10
|
#define MAX_COLOR 10
|
||||||
#define MIN_COLOR 1
|
#define MIN_COLOR 1
|
||||||
@@ -146,8 +161,7 @@ extern char *TvServiceType[];
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,
|
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out, char **errorString);
|
||||||
char **errorString);
|
|
||||||
|
|
||||||
/* Structure for storing Tv Service
|
/* Structure for storing Tv Service
|
||||||
identifiers and state table */
|
identifiers and state table */
|
||||||
@@ -311,8 +325,7 @@ int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*);
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDevicePowerOff
|
* TvDevicePowerOff
|
||||||
@@ -327,8 +340,7 @@ int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetChannel
|
* TvDeviceSetChannel
|
||||||
@@ -345,8 +357,7 @@ int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseChannel
|
* TvDeviceIncreaseChannel
|
||||||
@@ -361,8 +372,7 @@ int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseChannel
|
* TvDeviceDecreaseChannel
|
||||||
*
|
*
|
||||||
@@ -376,8 +386,7 @@ int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetVolume
|
* TvDeviceSetVolume
|
||||||
*
|
*
|
||||||
@@ -393,8 +402,7 @@ int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseVolume
|
* TvDeviceIncreaseVolume
|
||||||
@@ -409,8 +417,7 @@ int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
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)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
//Picture Service Actions
|
//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)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -463,8 +468,7 @@ int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseColor
|
* TvDeviceDecreaseColor
|
||||||
@@ -478,8 +482,7 @@ int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetTint
|
* TvDeviceSetTint
|
||||||
@@ -496,8 +499,7 @@ int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseTint
|
* TvDeviceIncreaseTint
|
||||||
@@ -512,8 +514,7 @@ int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseTint
|
* TvDeviceDecreaseTint
|
||||||
@@ -528,8 +529,7 @@ int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* TvDeviceSetContrast
|
* TvDeviceSetContrast
|
||||||
@@ -546,8 +546,7 @@ int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseContrast
|
* TvDeviceIncreaseContrast
|
||||||
@@ -563,8 +562,7 @@ int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseContrast
|
* TvDeviceDecreaseContrast
|
||||||
*
|
*
|
||||||
@@ -578,8 +576,7 @@ int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceSetBrightness
|
* TvDeviceSetBrightness
|
||||||
@@ -593,8 +590,7 @@ int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* brightness -- The brightness value to change to.
|
* brightness -- The brightness value to change to.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceIncreaseBrightness
|
* TvDeviceIncreaseBrightness
|
||||||
@@ -609,8 +605,7 @@ int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceDecreaseBrightness
|
* TvDeviceDecreaseBrightness
|
||||||
@@ -624,12 +619,11 @@ int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString);
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
||||||
char *web_dir_path, print_string pfun);
|
char *web_dir_path, print_string pfun);
|
||||||
int TvDeviceStop();
|
int TvDeviceStop(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
205
upnp/src/api/UpnpString.c
Normal file
205
upnp/src/api/UpnpString.c
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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() */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define strcasecmp stricmp
|
||||||
|
#else
|
||||||
|
/* Other systems have strncasecmp */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* strndup() is a GNU extension. Other systems must fix it with elif's. */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
extern char *strndup(__const char *__string, size_t __n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t UpnpString_get_Length(const UpnpString *p)
|
||||||
|
{
|
||||||
|
return ((struct SUpnpString *)p)->m_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpString_set_Length(UpnpString *p, size_t n)
|
||||||
|
{
|
||||||
|
if (((struct SUpnpString *)p)->m_length > n) {
|
||||||
|
((struct SUpnpString *)p)->m_length = n;
|
||||||
|
/* No need to realloc now, will do later when needed. */
|
||||||
|
((struct SUpnpString *)p)->m_string[n] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *UpnpString_get_String(const UpnpString *p)
|
||||||
|
{
|
||||||
|
return ((struct SUpnpString *)p)->m_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpString_set_String(UpnpString *p, const char *s)
|
||||||
|
{
|
||||||
|
char *q = strdup(s);
|
||||||
|
if (!q) goto error_handler1;
|
||||||
|
free(((struct SUpnpString *)p)->m_string);
|
||||||
|
((struct SUpnpString *)p)->m_length = strlen(q);
|
||||||
|
((struct SUpnpString *)p)->m_string = q;
|
||||||
|
|
||||||
|
error_handler1:
|
||||||
|
return q != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpString_set_StringN(UpnpString *p, const char *s, size_t n)
|
||||||
|
{
|
||||||
|
char *q = strndup(s, n);
|
||||||
|
if (!q) goto error_handler1;
|
||||||
|
free(((struct SUpnpString *)p)->m_string);
|
||||||
|
((struct SUpnpString *)p)->m_length = strlen(q);
|
||||||
|
((struct SUpnpString *)p)->m_string = q;
|
||||||
|
|
||||||
|
error_handler1:
|
||||||
|
return q != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpString_cmp(UpnpString *p, UpnpString *q)
|
||||||
|
{
|
||||||
|
const char *cp = UpnpString_get_String(p);
|
||||||
|
const char *cq = UpnpString_get_String(q);
|
||||||
|
|
||||||
|
return strcmp(cp, cq);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpString_casecmp(UpnpString *p, UpnpString *q)
|
||||||
|
{
|
||||||
|
const char *cp = UpnpString_get_String(p);
|
||||||
|
const char *cq = UpnpString_get_String(q);
|
||||||
|
|
||||||
|
return strcasecmp(cp, cq);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @} UpnpString */
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,82 +1,108 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "ithread.h"
|
||||||
|
#include "ixml.h"
|
||||||
|
#include "upnp.h"
|
||||||
#include "upnpdebug.h"
|
#include "upnpdebug.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "ithread.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.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;
|
static ithread_mutex_t GlobalDebugMutex;
|
||||||
|
|
||||||
// Global log level
|
/*! Global log level */
|
||||||
static Upnp_LogLevel g_log_level = UPNP_DEFAULT_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;
|
static FILE *ErrFileHnd = NULL;
|
||||||
|
|
||||||
//File handle for the information log file
|
/*! File handle for the information log file */
|
||||||
static FILE *InfoFileHnd = NULL;
|
static FILE *InfoFileHnd = NULL;
|
||||||
|
|
||||||
//Name of the error file
|
/*! Name of the error file */
|
||||||
static const char *errFileName = "IUpnpErrFile.txt";
|
static const char *errFileName = "IUpnpErrFile.txt";
|
||||||
|
|
||||||
//Name of the info file
|
/*! Name of the info file */
|
||||||
static const char *infoFileName = "IUpnpInfoFile.txt";
|
static const char *infoFileName = "IUpnpInfoFile.txt";
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* Function : UpnpSetLogFileNames
|
int UpnpInitLog(void)
|
||||||
*
|
{
|
||||||
* Parameters:
|
ithread_mutex_init(&GlobalDebugMutex, NULL);
|
||||||
* IN const char* ErrFileName: name of the error file
|
if(DEBUG_TARGET == 1) {
|
||||||
* IN const char *InfoFileName: name of the information file
|
if((ErrFileHnd = fopen( errFileName, "a")) == NULL) {
|
||||||
* IN int size: Size of the buffer
|
return -1;
|
||||||
* IN int starLength: This parameter provides the width of the banner
|
}
|
||||||
*
|
if((InfoFileHnd = fopen( infoFileName, "a")) == NULL) {
|
||||||
* Description:
|
return -1;
|
||||||
* This functions takes the buffer and writes the buffer in the file as
|
}
|
||||||
* per the requested banner
|
}
|
||||||
* Returns: void
|
return UPNP_E_SUCCESS;
|
||||||
***************************************************************************/
|
}
|
||||||
void
|
|
||||||
UpnpSetLogFileNames ( IN const char *ErrFileName,
|
|
||||||
IN const char *InfoFileName )
|
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) {
|
if (ErrFileName) {
|
||||||
errFileName = 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(
|
int DebugAtThisLevel(
|
||||||
IN Upnp_LogLevel DLevel,
|
Upnp_LogLevel DLevel,
|
||||||
IN Dbg_Module Module)
|
Dbg_Module Module)
|
||||||
{
|
{
|
||||||
int ret = DLevel <= g_log_level;
|
int ret = DLevel <= g_log_level;
|
||||||
ret &=
|
ret &=
|
||||||
@@ -186,37 +130,14 @@ int DebugAtThisLevel(
|
|||||||
|
|
||||||
return ret;
|
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(
|
void UpnpPrintf(
|
||||||
IN Upnp_LogLevel DLevel,
|
Upnp_LogLevel DLevel,
|
||||||
IN Dbg_Module Module,
|
Dbg_Module Module,
|
||||||
IN const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
IN int DbgLineNo,
|
int DbgLineNo,
|
||||||
IN const char *FmtStr,
|
const char *FmtStr,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list ArgList;
|
va_list ArgList;
|
||||||
@@ -249,26 +170,8 @@ void UpnpPrintf(
|
|||||||
va_end(ArgList);
|
va_end(ArgList);
|
||||||
ithread_mutex_unlock(&GlobalDebugMutex);
|
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 *GetDebugFile(Upnp_LogLevel DLevel, Dbg_Module Module)
|
||||||
{
|
{
|
||||||
FILE *ret;
|
FILE *ret;
|
||||||
@@ -287,65 +190,51 @@ FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
|||||||
|
|
||||||
return ret;
|
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(
|
void UpnpDisplayFileAndLine(
|
||||||
IN FILE * fd,
|
FILE *fd,
|
||||||
IN const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
IN int DbgLineNo)
|
int DbgLineNo)
|
||||||
{
|
{
|
||||||
int starlength = 66;
|
#define NLINES 2
|
||||||
const char *lines[2];
|
#define MAX_LINE_SIZE 512
|
||||||
char FileAndLine[500];
|
#define NUMBER_OF_STARS 80
|
||||||
lines[0] = "DEBUG";
|
const char *lines[NLINES];
|
||||||
if (DbgFileName) {
|
char buf[NLINES][MAX_LINE_SIZE];
|
||||||
sprintf(FileAndLine,
|
int i;
|
||||||
"FILE: %s, LINE: %d",
|
|
||||||
DbgFileName, DbgLineNo);
|
/* Initialize the pointer array */
|
||||||
lines[1] = FileAndLine;
|
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);
|
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(
|
void UpnpDisplayBanner(
|
||||||
IN FILE * fd,
|
FILE * fd,
|
||||||
IN const char **lines,
|
const char **lines,
|
||||||
IN size_t size,
|
size_t size,
|
||||||
IN int starLength)
|
int starLength)
|
||||||
{
|
{
|
||||||
int leftMarginLength = starLength / 2 + 1;
|
int leftMarginLength = starLength / 2 + 1;
|
||||||
int rightMarginLength = starLength / 2 + 1;
|
int rightMarginLength = starLength / 2 + 1;
|
||||||
@@ -393,5 +282,47 @@ void UpnpDisplayBanner(
|
|||||||
free(rightMargin);
|
free(rightMargin);
|
||||||
free(leftMargin);
|
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
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if EXCLUDE_DOM == 0
|
#if EXCLUDE_DOM == 0
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
|
#include "upnp.h"
|
||||||
#include "upnptools.h"
|
#include "upnptools.h"
|
||||||
|
|
||||||
|
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*! Maximum action header buffer length. */
|
||||||
#define HEADER_LENGTH 2000
|
#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_HANDLE, "UPNP_E_INVALID_HANDLE"},
|
||||||
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
||||||
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
||||||
{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"},
|
{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_INIT, "UPNP_E_INIT"},
|
||||||
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
||||||
{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"},
|
{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_INVALID_ACTION, "UPNP_E_INVALID_ACTION"},
|
||||||
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
||||||
{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"},
|
{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_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_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"},
|
||||||
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
||||||
{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"},
|
{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_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"},
|
||||||
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
||||||
{UPNP_E_LISTEN, "UPNP_E_LISTEN"},
|
{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_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"},
|
||||||
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
||||||
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
||||||
{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_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_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
|
const char *UpnpGetErrorMessage(int rc)
|
||||||
*
|
|
||||||
* 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 )
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < sizeof( ErrorMessages ) / sizeof( ErrorMessages[0] );
|
for (i = 0; i < sizeof (ErrorMessages) / sizeof (ErrorMessages[0]); ++i) {
|
||||||
i++ ) {
|
if (rc == ErrorMessages[i].rc) {
|
||||||
if( rc == ErrorMessages[i].rc )
|
|
||||||
return ErrorMessages[i].rcError;
|
return ErrorMessages[i].rcError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown Error";
|
return "Unknown error code";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpResolveURL
|
/*!
|
||||||
*
|
* \todo There is some unnecessary allocation and deallocation going on here
|
||||||
* Parameters:
|
* because of the way resolve_rel_url() was originally written and used. In the
|
||||||
* IN char * BaseURL: Base URL string
|
* future it would be nice to clean this up.
|
||||||
* IN char * RelURL: relative URL string
|
*/
|
||||||
* OUT char * AbsURL: Absolute URL string
|
int UpnpResolveURL(
|
||||||
* Description:
|
const char *BaseURL,
|
||||||
* This functions concatinates the base URL and relative URL to generate
|
const char *RelURL,
|
||||||
* the absolute URL
|
char *AbsURL)
|
||||||
* Returns: int
|
|
||||||
* return either UPNP_E_SUCCESS or appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
int
|
|
||||||
UpnpResolveURL( IN const char *BaseURL,
|
|
||||||
IN const char *RelURL,
|
|
||||||
OUT char *AbsURL )
|
|
||||||
{
|
{
|
||||||
// There is some unnecessary allocation and
|
int ret = UPNP_E_SUCCESS;
|
||||||
// deallocation going on here because of the way
|
char *tempRel = NULL;
|
||||||
// resolve_rel_url was originally written and used
|
|
||||||
// in the future it would be nice to clean this up
|
|
||||||
|
|
||||||
char *tempRel;
|
if (RelURL == NULL) {
|
||||||
|
ret = UPNP_E_INVALID_PARAM;
|
||||||
if( RelURL == NULL )
|
goto ExitFunction;
|
||||||
return UPNP_E_INVALID_PARAM;
|
}
|
||||||
|
|
||||||
tempRel = NULL;
|
|
||||||
|
|
||||||
tempRel = resolve_rel_url((char *)BaseURL, (char *)RelURL);
|
tempRel = resolve_rel_url((char *)BaseURL, (char *)RelURL);
|
||||||
|
|
||||||
if (tempRel) {
|
if (tempRel) {
|
||||||
strcpy(AbsURL, tempRel);
|
strcpy(AbsURL, tempRel);
|
||||||
free(tempRel);
|
free(tempRel);
|
||||||
} else {
|
} else {
|
||||||
return UPNP_E_INVALID_URL;
|
ret = UPNP_E_INVALID_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExitFunction:
|
||||||
return UPNP_E_SUCCESS;
|
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
|
* 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, otherwise the appropriate error.
|
||||||
* returns UPNP_E_SUCCESS if successful else returns appropriate error
|
*/
|
||||||
***************************************************************************/
|
static int addToAction(
|
||||||
static int
|
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
||||||
addToAction( IN int response,
|
int response,
|
||||||
INOUT IXML_Document ** ActionDoc,
|
/*! [in,out] Request or response document. */
|
||||||
IN const char *ActionName,
|
IXML_Document **ActionDoc,
|
||||||
IN const char *ServType,
|
/*! [in] Name of the action request or response. */
|
||||||
IN const char *ArgName,
|
const char *ActionName,
|
||||||
IN const char *ArgValue )
|
/*! [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;
|
char *ActBuff = NULL;
|
||||||
IXML_Node *node = NULL;
|
IXML_Node *node = NULL;
|
||||||
@@ -222,39 +231,32 @@ addToAction( IN int response,
|
|||||||
Txt = ixmlDocument_createTextNode(*ActionDoc, ArgValue);
|
Txt = ixmlDocument_createTextNode(*ActionDoc, ArgValue);
|
||||||
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : makeAction
|
/*!
|
||||||
|
* \brief Creates the action request or response from the argument list.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return Action request or response document if successful, otherwise
|
||||||
* IN int response: flag to tell if the ActionDoc is for response
|
* returns NULL
|
||||||
* or request
|
*/
|
||||||
* IN char * ActionName: Name of the action request or response
|
static IXML_Document *makeAction(
|
||||||
* IN char * ServType: Service type
|
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
||||||
* IN int NumArg :Number of arguments in the action request or response
|
int response,
|
||||||
* IN char * Arg : pointer to the first argument
|
/*! [in] Name of the action request or response. */
|
||||||
* IN va_list ArgList: Argument list
|
const char *ActionName,
|
||||||
*
|
/*! [in] Service type. */
|
||||||
* Description:
|
const char *ServType,
|
||||||
* This function creates the action request or response from the argument
|
/*! [in] Number of arguments in the action request or response. */
|
||||||
* list.
|
int NumArg,
|
||||||
* Returns: IXML_Document *
|
/*! [in] pointer to the first argument. */
|
||||||
* returns action request or response document if successful
|
const char *Arg,
|
||||||
* else returns NULL
|
/*! [in] Argument list. */
|
||||||
***************************************************************************/
|
va_list ArgList)
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
const char *ArgName;
|
const char *ArgName;
|
||||||
const char *ArgValue;
|
const char *ArgValue;
|
||||||
@@ -283,14 +285,12 @@ makeAction( IN int response,
|
|||||||
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
||||||
ActionName, ServType, ActionName);
|
ActionName, ServType, ActionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) {
|
if (ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) {
|
||||||
free(ActBuff);
|
free(ActBuff);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ActBuff);
|
free(ActBuff);
|
||||||
|
|
||||||
if(ActionDoc == NULL) {
|
if(ActionDoc == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -300,19 +300,15 @@ makeAction( IN int response,
|
|||||||
ArgName = Arg;
|
ArgName = Arg;
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
ArgValue = va_arg(ArgList, const char *);
|
ArgValue = va_arg(ArgList, const char *);
|
||||||
|
|
||||||
if (ArgName != NULL) {
|
if (ArgName != NULL) {
|
||||||
node = ixmlNode_getFirstChild((IXML_Node *)ActionDoc);
|
node = ixmlNode_getFirstChild((IXML_Node *)ActionDoc);
|
||||||
Ele = ixmlDocument_createElement(ActionDoc, ArgName);
|
Ele = ixmlDocument_createElement(ActionDoc, ArgName);
|
||||||
if (ArgValue) {
|
if (ArgValue) {
|
||||||
Txt =
|
Txt = ixmlDocument_createTextNode(ActionDoc, ArgValue);
|
||||||
ixmlDocument_createTextNode( ActionDoc, ArgValue );
|
|
||||||
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
ixmlNode_appendChild(node, (IXML_Node *)Ele);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++Idx < NumArg) {
|
if (++Idx < NumArg) {
|
||||||
ArgName = va_arg(ArgList, const char *);
|
ArgName = va_arg(ArgList, const char *);
|
||||||
} else {
|
} else {
|
||||||
@@ -325,28 +321,9 @@ makeAction( IN int response,
|
|||||||
return ActionDoc;
|
return ActionDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpMakeAction
|
IXML_Document *UpnpMakeAction(
|
||||||
*
|
const char *ActionName,
|
||||||
* 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,
|
|
||||||
const char *ServType,
|
const char *ServType,
|
||||||
int NumArg,
|
int NumArg,
|
||||||
const char *Arg,
|
const char *Arg,
|
||||||
@@ -362,28 +339,9 @@ UpnpMakeAction( const char *ActionName,
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : UpnpMakeActionResponse
|
IXML_Document *UpnpMakeActionResponse(
|
||||||
*
|
const char *ActionName,
|
||||||
* 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,
|
|
||||||
const char *ServType,
|
const char *ServType,
|
||||||
int NumArg,
|
int NumArg,
|
||||||
const char *Arg,
|
const char *Arg,
|
||||||
@@ -399,89 +357,86 @@ UpnpMakeActionResponse( const char *ActionName,
|
|||||||
return out;
|
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************
|
int UpnpAddToAction(
|
||||||
* Function : UpnpAddToAction
|
IXML_Document **ActionDoc,
|
||||||
*
|
|
||||||
* 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,
|
|
||||||
const char *ActionName,
|
const char *ActionName,
|
||||||
const char *ServType,
|
const char *ServType,
|
||||||
const char *ArgName,
|
const char *ArgName,
|
||||||
const char *ArgValue)
|
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"
|
int UpnpAddToActionResponse(
|
||||||
"-upnp-org:event-1-0\"></e:propertyset>";
|
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_Node *node;
|
||||||
IXML_Element *Ele;
|
IXML_Element *Ele;
|
||||||
IXML_Element *Ele1;
|
IXML_Element *Ele1;
|
||||||
@@ -515,71 +470,6 @@ UpnpAddToPropertySet( INOUT IXML_Document ** PropSet,
|
|||||||
return UPNP_E_SUCCESS;
|
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 ) {
|
#endif /* EXCLUDE_DOM == 0 */
|
||||||
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
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,33 +1,33 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file defines the functions for clients. It defines
|
* Purpose: This file defines the functions for clients. It defines
|
||||||
@@ -36,174 +36,294 @@
|
|||||||
* client
|
* client
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "client_table.h"
|
#include "client_table.h"
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : copy_client_subscription
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* client_subscription * in ; - source client subscription
|
|
||||||
* client_subscription * out ; - destination client subscription
|
|
||||||
*
|
|
||||||
* Description : Make a copy of the client subscription data
|
|
||||||
*
|
|
||||||
* Return : int ;
|
|
||||||
* UPNP_E_OUTOF_MEMORY - On Failure to allocate memory
|
|
||||||
* HTTP_SUCCESS - On Success
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
CLIENTONLY( int copy_client_subscription( client_subscription * in,
|
|
||||||
client_subscription * out ) {
|
|
||||||
int len = strlen( in->ActualSID ) + 1;
|
|
||||||
int len1 = strlen( in->EventURL ) + 1;
|
|
||||||
memcpy( out->sid, in->sid, SID_SIZE );
|
|
||||||
out->sid[SID_SIZE] = 0;
|
|
||||||
out->ActualSID = ( char * )malloc( len );
|
|
||||||
if( out->ActualSID == NULL )
|
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
|
||||||
out->EventURL = ( char * )malloc( len1 );
|
|
||||||
if( out->EventURL == NULL ) {
|
|
||||||
free(out->ActualSID);
|
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
|
||||||
}
|
|
||||||
memcpy( out->ActualSID, in->ActualSID, len );
|
|
||||||
memcpy( out->EventURL, in->EventURL, len1 );
|
|
||||||
//copies do not get RenewEvent Ids or next
|
|
||||||
out->RenewEventId = -1; out->next = NULL; return HTTP_SUCCESS;}
|
|
||||||
|
|
||||||
/************************************************************************
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
* Function : free_client_subscription
|
|
||||||
*
|
|
||||||
* Parameters :
|
#include <stdlib.h> // for calloc(), free()
|
||||||
* client_subscription * sub ; - Client subscription to be freed
|
|
||||||
*
|
|
||||||
* Description : Free memory allocated for client subscription data.
|
struct SClientSubscription {
|
||||||
* Remove timer thread associated with this subscription event.
|
int m_renewEventId;
|
||||||
*
|
UpnpString *m_SID;
|
||||||
* Return : void ;
|
UpnpString *m_actualSID;
|
||||||
*
|
UpnpString *m_eventURL;
|
||||||
* Note :
|
struct SClientSubscription *m_next;
|
||||||
************************************************************************/
|
};
|
||||||
void free_client_subscription( client_subscription * sub ) {
|
|
||||||
upnp_timeout * event; ThreadPoolJob tempJob; if( sub ) {
|
|
||||||
if( sub->ActualSID )
|
/** Constructor */
|
||||||
free( sub->ActualSID ); if( sub->EventURL )
|
ClientSubscription *UpnpClientSubscription_new()
|
||||||
free( sub->EventURL ); if( sub->RenewEventId != -1 ) //do not remove timer event of copy
|
{
|
||||||
|
struct SClientSubscription *p = calloc(1, sizeof (struct SClientSubscription));
|
||||||
|
#if 0
|
||||||
|
p->renewEventId = 0;
|
||||||
|
#endif
|
||||||
|
p->m_SID = UpnpString_new();
|
||||||
|
p->m_actualSID = UpnpString_new();
|
||||||
|
p->m_eventURL = UpnpString_new();
|
||||||
|
p->m_next = NULL;
|
||||||
|
|
||||||
|
return (ClientSubscription *)p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Destructor */
|
||||||
|
void UpnpClientSubscription_delete(ClientSubscription *p)
|
||||||
|
{
|
||||||
|
struct SClientSubscription *q = (struct SClientSubscription *)p;
|
||||||
|
|
||||||
|
if (!q) return;
|
||||||
|
|
||||||
|
q->m_renewEventId = 0;
|
||||||
|
|
||||||
|
UpnpString_delete(q->m_SID);
|
||||||
|
q->m_SID = NULL;
|
||||||
|
|
||||||
|
UpnpString_delete(q->m_actualSID);
|
||||||
|
q->m_actualSID = NULL;
|
||||||
|
|
||||||
|
UpnpString_delete(q->m_eventURL);
|
||||||
|
q->m_eventURL = NULL;
|
||||||
|
|
||||||
|
q->m_next = NULL;
|
||||||
|
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Copy Constructor */
|
||||||
|
ClientSubscription *UpnpClientSubscription_dup(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
ClientSubscription *q = UpnpClientSubscription_new();
|
||||||
|
|
||||||
|
UpnpClientSubscription_assign(q, p);
|
||||||
|
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Assignment operator */
|
||||||
|
void UpnpClientSubscription_assign(ClientSubscription *q, const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
if (q != p) {
|
||||||
|
// Do not copy RenewEventId
|
||||||
|
((struct SClientSubscription *)q)->m_renewEventId = -1;
|
||||||
|
UpnpClientSubscription_set_SID(q, UpnpClientSubscription_get_SID(p));
|
||||||
|
UpnpClientSubscription_set_ActualSID(q, UpnpClientSubscription_get_ActualSID(p));
|
||||||
|
UpnpClientSubscription_set_EventURL(q, UpnpClientSubscription_get_EventURL(p));
|
||||||
|
// Do not copy m_next
|
||||||
|
((struct SClientSubscription *)q)->m_next = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UpnpClientSubscription_get_RenewEventId(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return ((struct SClientSubscription *)p)->m_renewEventId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_set_RenewEventId(ClientSubscription *p, int n)
|
||||||
|
{
|
||||||
|
((struct SClientSubscription *)p)->m_renewEventId = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const UpnpString *UpnpClientSubscription_get_SID(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return ((struct SClientSubscription *)p)->m_SID;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *UpnpClientSubscription_get_SID_cstr(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return UpnpString_get_String(UpnpClientSubscription_get_SID(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_set_SID(ClientSubscription *p, const UpnpString *s)
|
||||||
|
{
|
||||||
|
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
|
||||||
|
((struct SClientSubscription *)p)->m_SID = UpnpString_dup(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_strcpy_SID(ClientSubscription *p, const char *s)
|
||||||
|
{
|
||||||
|
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
|
||||||
|
((struct SClientSubscription *)p)->m_SID = UpnpString_new();
|
||||||
|
UpnpString_set_String(((struct SClientSubscription *)p)->m_SID, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const UpnpString *UpnpClientSubscription_get_ActualSID(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return ((struct SClientSubscription *)p)->m_actualSID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *UpnpClientSubscription_get_ActualSID_cstr(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return UpnpString_get_String(UpnpClientSubscription_get_ActualSID(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_set_ActualSID(ClientSubscription *p, const UpnpString *s)
|
||||||
|
{
|
||||||
|
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
|
||||||
|
((struct SClientSubscription *)p)->m_actualSID = UpnpString_dup(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_strcpy_ActualSID(ClientSubscription *p, const char *s)
|
||||||
|
{
|
||||||
|
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
|
||||||
|
((struct SClientSubscription *)p)->m_actualSID = UpnpString_new();
|
||||||
|
UpnpString_set_String(((struct SClientSubscription *)p)->m_actualSID, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const UpnpString *UpnpClientSubscription_get_EventURL(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return ((struct SClientSubscription *)p)->m_eventURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *UpnpClientSubscription_get_EventURL_cstr(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return UpnpString_get_String(UpnpClientSubscription_get_EventURL(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_set_EventURL(ClientSubscription *p, const UpnpString *s)
|
||||||
|
{
|
||||||
|
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
|
||||||
|
((struct SClientSubscription *)p)->m_eventURL = UpnpString_dup(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_strcpy_EventURL(ClientSubscription *p, const char *s)
|
||||||
|
{
|
||||||
|
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
|
||||||
|
((struct SClientSubscription *)p)->m_eventURL = UpnpString_new();
|
||||||
|
UpnpString_set_String(((struct SClientSubscription *)p)->m_eventURL, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ClientSubscription *UpnpClientSubscription_get_Next(const ClientSubscription *p)
|
||||||
|
{
|
||||||
|
return (ClientSubscription *)(((struct SClientSubscription *)p)->m_next);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpnpClientSubscription_set_Next(ClientSubscription *p, ClientSubscription *q)
|
||||||
|
{
|
||||||
|
((struct SClientSubscription *)p)->m_next = (struct SClientSubscription *)q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void free_client_subscription(ClientSubscription *sub)
|
||||||
|
{
|
||||||
|
upnp_timeout *event;
|
||||||
|
ThreadPoolJob tempJob;
|
||||||
|
if (sub) {
|
||||||
|
int renewEventId = UpnpClientSubscription_get_RenewEventId(sub);
|
||||||
|
UpnpClientSubscription_strcpy_ActualSID(sub, "");
|
||||||
|
UpnpClientSubscription_strcpy_EventURL(sub, "");
|
||||||
|
if (renewEventId != -1) {
|
||||||
|
// do not remove timer event of copy
|
||||||
// invalid timer event id
|
// invalid timer event id
|
||||||
{
|
if (TimerThreadRemove(&gTimerThread, renewEventId, &tempJob) == 0) {
|
||||||
if( TimerThreadRemove
|
|
||||||
( &gTimerThread, sub->RenewEventId, &tempJob ) == 0 ) {
|
|
||||||
event = (upnp_timeout *)tempJob.arg;
|
event = (upnp_timeout *)tempJob.arg;
|
||||||
free_upnp_timeout( event );}
|
free_upnp_timeout(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UpnpClientSubscription_set_RenewEventId(sub, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub->RenewEventId = -1;}
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************
|
void freeClientSubList(ClientSubscription *list)
|
||||||
* Function : freeClientSubList
|
{
|
||||||
*
|
ClientSubscription *next;
|
||||||
* Parameters :
|
while (list) {
|
||||||
* client_subscription * list ; Client subscription
|
|
||||||
*
|
|
||||||
* Description : Free the client subscription table.
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void freeClientSubList( client_subscription * list ) {
|
|
||||||
client_subscription * next; while( list ) {
|
|
||||||
free_client_subscription(list);
|
free_client_subscription(list);
|
||||||
next = list->next; free( list ); list = next;}
|
next = UpnpClientSubscription_get_Next(list);
|
||||||
|
UpnpClientSubscription_delete(list);
|
||||||
|
list = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : RemoveClientSubClientSID
|
void RemoveClientSubClientSID(ClientSubscription **head, const UpnpString *sid)
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* client_subscription **head ; Head of the subscription list
|
|
||||||
* const Upnp_SID sid ; Subscription ID to be mactched
|
|
||||||
*
|
|
||||||
* Description : Remove the client subscription matching the
|
|
||||||
* subscritpion id represented by the const Upnp_SID sid parameter
|
|
||||||
* from the table and update the table.
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void RemoveClientSubClientSID( client_subscription ** head,
|
|
||||||
const Upnp_SID sid ) {
|
|
||||||
client_subscription * finger = ( *head );
|
|
||||||
client_subscription * previous = NULL; while( finger ) {
|
|
||||||
if( !( strcmp( sid, finger->sid ) ) ) {
|
|
||||||
if( previous )
|
|
||||||
previous->next = finger->next;
|
|
||||||
else
|
|
||||||
( *head ) = finger->next;
|
|
||||||
finger->next = NULL;
|
|
||||||
freeClientSubList( finger ); finger = NULL;}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
previous = finger; finger = finger->next;}
|
ClientSubscription *finger = *head;
|
||||||
|
ClientSubscription *previous = NULL;
|
||||||
|
int found = 0;
|
||||||
|
while (finger) {
|
||||||
|
found = !strcmp(
|
||||||
|
UpnpString_get_String(sid),
|
||||||
|
UpnpClientSubscription_get_SID_cstr(finger));
|
||||||
|
if (found) {
|
||||||
|
if (previous) {
|
||||||
|
UpnpClientSubscription_set_Next(previous,
|
||||||
|
UpnpClientSubscription_get_Next(finger));
|
||||||
|
} else {
|
||||||
|
*head = UpnpClientSubscription_get_Next(finger);
|
||||||
|
}
|
||||||
|
UpnpClientSubscription_set_Next(finger, NULL);
|
||||||
|
freeClientSubList(finger);
|
||||||
|
finger = NULL;
|
||||||
|
} else {
|
||||||
|
previous = finger;
|
||||||
|
finger = UpnpClientSubscription_get_Next(finger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : GetClientSubClientSID
|
ClientSubscription *GetClientSubClientSID(ClientSubscription *head, const UpnpString *sid)
|
||||||
*
|
{
|
||||||
* Parameters :
|
ClientSubscription *next = head;
|
||||||
* client_subscription *head ; Head of the subscription list
|
int found = 0;
|
||||||
* const Upnp_SID sid ; Subscription ID to be matched
|
while (next) {
|
||||||
*
|
found = !strcmp(
|
||||||
* Description : Return the client subscription from the client table
|
UpnpClientSubscription_get_SID_cstr(next),
|
||||||
* that matches const Upnp_SID sid subscrition id value.
|
UpnpString_get_String(sid));
|
||||||
*
|
if(found) {
|
||||||
* Return : client_subscription * ; The matching subscription
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
client_subscription *
|
|
||||||
GetClientSubClientSID( client_subscription * head,
|
|
||||||
const Upnp_SID sid ) {
|
|
||||||
client_subscription * next = head; while( next ) {
|
|
||||||
if( !strcmp( next->sid, sid ) )
|
|
||||||
break;
|
break;
|
||||||
else
|
} else {
|
||||||
{
|
next = UpnpClientSubscription_get_Next(next);
|
||||||
next = next->next;}
|
}
|
||||||
}
|
}
|
||||||
return next;}
|
|
||||||
|
|
||||||
/************************************************************************
|
return next;
|
||||||
* Function : GetClientSubActualSID
|
}
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* client_subscription *head ; Head of the subscription list
|
|
||||||
* token * sid ; Subscription ID to be matched
|
|
||||||
*
|
|
||||||
* Description : Returns the client subscription from the client
|
|
||||||
* subscription table that has the matching token * sid buffer
|
|
||||||
* value.
|
|
||||||
*
|
|
||||||
* Return : client_subscription * ; The matching subscription
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
client_subscription *
|
|
||||||
GetClientSubActualSID( client_subscription * head,
|
|
||||||
token * sid ) {
|
|
||||||
client_subscription * next = head; while( next ) {
|
|
||||||
|
|
||||||
if( !memcmp( next->ActualSID, sid->buff, sid->size ) )
|
|
||||||
|
ClientSubscription *GetClientSubActualSID(ClientSubscription *head, token *sid)
|
||||||
|
{
|
||||||
|
ClientSubscription *next = head;
|
||||||
|
while (next) {
|
||||||
|
if (!memcmp(
|
||||||
|
UpnpClientSubscription_get_ActualSID_cstr(next),
|
||||||
|
sid->buff, sid->size)) {
|
||||||
break;
|
break;
|
||||||
else
|
} else {
|
||||||
{
|
next = UpnpClientSubscription_get_Next(next);
|
||||||
next = next->next;}
|
}
|
||||||
}
|
}
|
||||||
return next;}
|
|
||||||
|
|
||||||
)
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,52 +1,65 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* \brief Contains functions for scanner and parser for http messages.
|
||||||
|
*/
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Purpose: This file contains functions for scanner and parser for http
|
|
||||||
* messages.
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
#define _GNU_SOURCE // For strcasestr() in string.h
|
#define _GNU_SOURCE // For strcasestr() in string.h
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include "strintmap.h"
|
#include "strintmap.h"
|
||||||
#include "httpparser.h"
|
#include "httpparser.h"
|
||||||
#include "statcodes.h"
|
#include "statcodes.h"
|
||||||
#include "unixutil.h"
|
#include "unixutil.h"
|
||||||
|
#include "upnpdebug.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* entity positions */
|
||||||
|
|
||||||
// entity positions
|
|
||||||
|
|
||||||
#define NUM_HTTP_METHODS 9
|
#define NUM_HTTP_METHODS 9
|
||||||
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
||||||
@@ -59,7 +72,6 @@ static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
|||||||
{"SUBSCRIBE", HTTPMETHOD_SUBSCRIBE},
|
{"SUBSCRIBE", HTTPMETHOD_SUBSCRIBE},
|
||||||
{"UNSUBSCRIBE", HTTPMETHOD_UNSUBSCRIBE},
|
{"UNSUBSCRIBE", HTTPMETHOD_UNSUBSCRIBE},
|
||||||
{"POST", SOAPMETHOD_POST},
|
{"POST", SOAPMETHOD_POST},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_HTTP_HEADER_NAMES 33
|
#define NUM_HTTP_HEADER_NAMES 33
|
||||||
@@ -100,9 +112,7 @@ str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
/************* scanner *************/
|
/************* scanner *************/
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
#define TOKCHAR_CR 0xD
|
#define TOKCHAR_CR 0xD
|
||||||
@@ -121,9 +131,7 @@ str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES] = {
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE void
|
static UPNP_INLINE void scanner_init(OUT scanner_t *scanner, IN membuffer *bufptr)
|
||||||
scanner_init( OUT scanner_t * scanner,
|
|
||||||
IN membuffer * bufptr )
|
|
||||||
{
|
{
|
||||||
scanner->cursor = 0;
|
scanner->cursor = 0;
|
||||||
scanner->msg = bufptr;
|
scanner->msg = bufptr;
|
||||||
@@ -142,8 +150,7 @@ scanner_init( OUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static UPNP_INLINE xboolean is_separator_char(IN char c)
|
||||||
is_separator_char( IN char c )
|
|
||||||
{
|
{
|
||||||
return strchr(" \t()<>@,;:\\\"/[]?={}", c) != NULL;
|
return strchr(" \t()<>@,;:\\\"/[]?={}", c) != NULL;
|
||||||
}
|
}
|
||||||
@@ -160,10 +167,9 @@ is_separator_char( IN char c )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static UPNP_INLINE xboolean is_identifier_char(IN char c)
|
||||||
is_identifier_char( IN char c )
|
|
||||||
{
|
{
|
||||||
return ( c >= 32 && c <= 126 ) && !is_separator_char( c );
|
return c >= 32 && c <= 126 && !is_separator_char(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -178,10 +184,9 @@ is_identifier_char( IN char c )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static UPNP_INLINE xboolean is_control_char(IN char c)
|
||||||
is_control_char( IN char c )
|
|
||||||
{
|
{
|
||||||
return ( ( c >= 0 && c <= 31 ) || ( c == 127 ) );
|
return (c >= 0 && c <= 31) || c == 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -196,8 +201,7 @@ is_control_char( IN char c )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE xboolean
|
static UPNP_INLINE xboolean is_qdtext_char(IN char cc)
|
||||||
is_qdtext_char( IN char cc )
|
|
||||||
{
|
{
|
||||||
unsigned char c = ( unsigned char )cc;
|
unsigned char c = ( unsigned char )cc;
|
||||||
|
|
||||||
@@ -231,8 +235,8 @@ is_qdtext_char( IN char cc )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static parse_status_t
|
static parse_status_t scanner_get_token(
|
||||||
scanner_get_token( INOUT scanner_t * scanner,
|
INOUT scanner_t *scanner,
|
||||||
OUT memptr *token,
|
OUT memptr *token,
|
||||||
OUT token_type_t *tok_type)
|
OUT token_type_t *tok_type)
|
||||||
{
|
{
|
||||||
@@ -375,52 +379,11 @@ scanner_get_token( INOUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE char *
|
static UPNP_INLINE char *scanner_get_str(IN scanner_t * scanner)
|
||||||
scanner_get_str( IN scanner_t * scanner )
|
|
||||||
{
|
{
|
||||||
return scanner->msg->buf + scanner->cursor;
|
return scanner->msg->buf + scanner->cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : scanner_pushback
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* INOUT scanner_t* scanner ; Scanner Object
|
|
||||||
* IN size_t pushback_bytes ; Bytes to be moved back
|
|
||||||
*
|
|
||||||
* Description : Move back by a certain number of bytes.
|
|
||||||
* This is used to put back one or more tokens back into the input
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
#warning The only use of the function 'scanner_pushback()' in the code is commented out.
|
|
||||||
#warning 'scanner_pushback()' is a candidate for removal.
|
|
||||||
static UPNP_INLINE void
|
|
||||||
scanner_pushback( INOUT scanner_t * scanner,
|
|
||||||
IN size_t pushback_bytes )
|
|
||||||
{
|
|
||||||
scanner->cursor -= pushback_bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/************* end of scanner **************/
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/************* parser **************/
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/************* http_message_t **************/
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : httpmsg_compare
|
* Function : httpmsg_compare
|
||||||
@@ -435,14 +398,13 @@ scanner_pushback( INOUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static int
|
static int httpmsg_compare(void *param1, void *param2)
|
||||||
httpmsg_compare( void *param1,
|
|
||||||
void *param2 )
|
|
||||||
{
|
{
|
||||||
assert( param1 != NULL );
|
assert( param1 != NULL );
|
||||||
assert( param2 != NULL );
|
assert( param2 != NULL );
|
||||||
|
|
||||||
return ( ( http_header_t * ) param1 )->name_id ==
|
return
|
||||||
|
((http_header_t *)param1)->name_id ==
|
||||||
((http_header_t *)param2)->name_id;
|
((http_header_t *)param2)->name_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,8 +420,7 @@ httpmsg_compare( void *param1,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static void
|
static void httpheader_free(void *msg)
|
||||||
httpheader_free( void *msg )
|
|
||||||
{
|
{
|
||||||
http_header_t *hdr = ( http_header_t * ) msg;
|
http_header_t *hdr = ( http_header_t * ) msg;
|
||||||
|
|
||||||
@@ -480,8 +441,7 @@ httpheader_free( void *msg )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void
|
void httpmsg_init(INOUT http_message_t *msg)
|
||||||
httpmsg_init( INOUT http_message_t * msg )
|
|
||||||
{
|
{
|
||||||
msg->initialized = 1;
|
msg->initialized = 1;
|
||||||
msg->entity.buf = NULL;
|
msg->entity.buf = NULL;
|
||||||
@@ -503,8 +463,7 @@ httpmsg_init( INOUT http_message_t * msg )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
void
|
void httpmsg_destroy( INOUT http_message_t * msg )
|
||||||
httpmsg_destroy( INOUT http_message_t * msg )
|
|
||||||
{
|
{
|
||||||
assert( msg != NULL );
|
assert( msg != NULL );
|
||||||
|
|
||||||
@@ -532,8 +491,8 @@ httpmsg_destroy( INOUT http_message_t * msg )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
http_header_t *
|
http_header_t *httpmsg_find_hdr_str(
|
||||||
httpmsg_find_hdr_str( IN http_message_t * msg,
|
IN http_message_t *msg,
|
||||||
IN const char *header_name)
|
IN const char *header_name)
|
||||||
{
|
{
|
||||||
http_header_t *header;
|
http_header_t *header;
|
||||||
@@ -569,27 +528,21 @@ httpmsg_find_hdr_str( IN http_message_t * msg,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
http_header_t *
|
http_header_t *httpmsg_find_hdr(
|
||||||
httpmsg_find_hdr( IN http_message_t * msg,
|
IN http_message_t *msg,
|
||||||
IN int header_name_id,
|
IN int header_name_id,
|
||||||
OUT memptr *value)
|
OUT memptr *value)
|
||||||
{
|
{
|
||||||
http_header_t header; // temp header for searching
|
http_header_t header; // temp header for searching
|
||||||
|
|
||||||
ListNode *node;
|
ListNode *node;
|
||||||
|
|
||||||
http_header_t *data;
|
http_header_t *data;
|
||||||
|
|
||||||
header.name_id = header_name_id;
|
header.name_id = header_name_id;
|
||||||
|
|
||||||
node = ListFind( &msg->headers, NULL, &header );
|
node = ListFind( &msg->headers, NULL, &header );
|
||||||
|
|
||||||
if( node == NULL ) {
|
if( node == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = ( http_header_t * ) node->item;
|
data = ( http_header_t * ) node->item;
|
||||||
|
|
||||||
if( value != NULL ) {
|
if( value != NULL ) {
|
||||||
value->buf = data->value.buf;
|
value->buf = data->value.buf;
|
||||||
value->length = data->value.length;
|
value->length = data->value.length;
|
||||||
@@ -598,12 +551,6 @@ httpmsg_find_hdr( IN http_message_t * msg,
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/************* http_parser_t **************/
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : skip_blank_lines
|
* Function : skip_blank_lines
|
||||||
*
|
*
|
||||||
@@ -616,23 +563,20 @@ httpmsg_find_hdr( IN http_message_t * msg,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE int
|
static UPNP_INLINE int skip_blank_lines(INOUT scanner_t *scanner)
|
||||||
skip_blank_lines( INOUT scanner_t * scanner )
|
|
||||||
{
|
{
|
||||||
memptr token;
|
memptr token;
|
||||||
token_type_t tok_type;
|
token_type_t tok_type;
|
||||||
parse_status_t status;
|
parse_status_t status;
|
||||||
|
|
||||||
// skip ws, crlf
|
/* skip ws, crlf */
|
||||||
do {
|
do {
|
||||||
status = scanner_get_token(scanner, &token, &tok_type);
|
status = scanner_get_token(scanner, &token, &tok_type);
|
||||||
} while (status == PARSE_OK &&
|
} while (status == PARSE_OK &&
|
||||||
(tok_type == TT_WHITESPACE || tok_type == TT_CRLF));
|
(tok_type == TT_WHITESPACE || tok_type == TT_CRLF));
|
||||||
|
|
||||||
if (status == PARSE_OK) {
|
if (status == PARSE_OK) {
|
||||||
// pushback a non-whitespace token
|
/* pushback a non-whitespace token */
|
||||||
scanner->cursor -= token.length;
|
scanner->cursor -= token.length;
|
||||||
//scanner_pushback( scanner, token.length );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@@ -653,8 +597,7 @@ skip_blank_lines( INOUT scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE int
|
static UPNP_INLINE int skip_lws(INOUT scanner_t *scanner)
|
||||||
skip_lws( INOUT scanner_t * scanner )
|
|
||||||
{
|
{
|
||||||
memptr token;
|
memptr token;
|
||||||
token_type_t tok_type;
|
token_type_t tok_type;
|
||||||
@@ -708,8 +651,8 @@ skip_lws( INOUT scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE parse_status_t
|
static UPNP_INLINE parse_status_t match_non_ws_string(
|
||||||
match_non_ws_string( INOUT scanner_t * scanner,
|
INOUT scanner_t *scanner,
|
||||||
OUT memptr *str)
|
OUT memptr *str)
|
||||||
{
|
{
|
||||||
memptr token;
|
memptr token;
|
||||||
@@ -774,8 +717,8 @@ match_non_ws_string( INOUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE parse_status_t
|
static UPNP_INLINE parse_status_t match_raw_value(
|
||||||
match_raw_value( INOUT scanner_t * scanner,
|
INOUT scanner_t * scanner,
|
||||||
OUT memptr *raw_value)
|
OUT memptr *raw_value)
|
||||||
{
|
{
|
||||||
memptr token;
|
memptr token;
|
||||||
@@ -865,8 +808,8 @@ match_raw_value( INOUT scanner_t * scanner,
|
|||||||
* PARSE_FAILURE -- bad input
|
* PARSE_FAILURE -- bad input
|
||||||
* PARSE_INCOMPLETE
|
* PARSE_INCOMPLETE
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static UPNP_INLINE int
|
static UPNP_INLINE int match_int(
|
||||||
match_int( INOUT scanner_t * scanner,
|
INOUT scanner_t *scanner,
|
||||||
IN int base,
|
IN int base,
|
||||||
OUT int *value)
|
OUT int *value)
|
||||||
{
|
{
|
||||||
@@ -952,31 +895,6 @@ read_until_crlf( INOUT scanner_t * scanner,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: skip_to_end_of_header
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* INOUT scanner_t* scanner ; Scanner Object
|
|
||||||
*
|
|
||||||
* Description: Skip to end of header
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* PARSE_OK
|
|
||||||
* PARSE_FAILURE
|
|
||||||
* PARSE_INCOMPLETE
|
|
||||||
************************************************************************/
|
|
||||||
#warning There are currently no uses of the function 'skip_to_end_of_header()' in the code.
|
|
||||||
#warning 'skip_to_end_of_header()' is a candidate for removal.
|
|
||||||
static UPNP_INLINE int
|
|
||||||
skip_to_end_of_header( INOUT scanner_t * scanner )
|
|
||||||
{
|
|
||||||
memptr dummy_raw_value;
|
|
||||||
parse_status_t status;
|
|
||||||
|
|
||||||
status = match_raw_value( scanner, &dummy_raw_value );
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: match_char
|
* Function: match_char
|
||||||
*
|
*
|
||||||
@@ -1522,7 +1440,9 @@ parser_parse_responseline( INOUT http_parser_t * parser )
|
|||||||
|
|
||||||
if( num_scanned != 3 ||
|
if( num_scanned != 3 ||
|
||||||
hmsg->major_version < 0 ||
|
hmsg->major_version < 0 ||
|
||||||
hmsg->minor_version < 0 || hmsg->status_code < 0 ) {
|
/* HTTP version equals to 1.0 should fail as required by the
|
||||||
|
* UPnP certification tool */
|
||||||
|
hmsg->minor_version < 1 || hmsg->status_code < 0 ) {
|
||||||
// bad response line
|
// bad response line
|
||||||
return PARSE_FAILURE;
|
return PARSE_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -1729,140 +1649,6 @@ parser_parse_headers( INOUT http_parser_t * parser )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
#ifdef HIGHLY_UNLIKELY
|
|
||||||
// **************
|
|
||||||
static parse_status_t
|
|
||||||
parser_parse_headers_old( INOUT http_parser_t * parser )
|
|
||||||
{
|
|
||||||
parse_status_t status;
|
|
||||||
memptr token;
|
|
||||||
memptr hdr_value;
|
|
||||||
token_type_t tok_type;
|
|
||||||
scanner_t *scanner = &parser->scanner;
|
|
||||||
size_t save_pos;
|
|
||||||
http_header_t *header;
|
|
||||||
int header_id;
|
|
||||||
int ret = 0;
|
|
||||||
int index;
|
|
||||||
http_header_t *orig_header;
|
|
||||||
char save_char;
|
|
||||||
int ret2,
|
|
||||||
ret3;
|
|
||||||
|
|
||||||
assert( parser->position == POS_HEADERS ||
|
|
||||||
parser->ent_position == ENTREAD_CHUNKY_HEADERS );
|
|
||||||
|
|
||||||
while( TRUE ) {
|
|
||||||
save_pos = scanner->cursor;
|
|
||||||
|
|
||||||
//
|
|
||||||
// check end of headers
|
|
||||||
//
|
|
||||||
status = scanner_get_token( scanner, &token, &tok_type );
|
|
||||||
if( status != PARSE_OK ) {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( tok_type == TT_CRLF ) {
|
|
||||||
// end of headers
|
|
||||||
parser->position = POS_ENTITY; // read entity next
|
|
||||||
return PARSE_OK;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// not end; read header
|
|
||||||
//
|
|
||||||
if( tok_type != TT_IDENTIFIER ) {
|
|
||||||
return PARSE_FAILURE; // didn't see header name
|
|
||||||
}
|
|
||||||
|
|
||||||
status = match( scanner, " : %R%c", &hdr_value );
|
|
||||||
if( status != PARSE_OK ) {
|
|
||||||
// pushback tokens; useful only on INCOMPLETE error
|
|
||||||
scanner->cursor = save_pos;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// add header
|
|
||||||
//
|
|
||||||
|
|
||||||
// find header
|
|
||||||
index = map_str_to_int( token.buf, token.length, Http_Header_Names,
|
|
||||||
NUM_HTTP_HEADER_NAMES, FALSE );
|
|
||||||
if( index != -1 ) {
|
|
||||||
header_id = Http_Header_Names[index].id;
|
|
||||||
|
|
||||||
orig_header =
|
|
||||||
httpmsg_find_hdr( &parser->msg, header_id, NULL );
|
|
||||||
} else {
|
|
||||||
header_id = HDR_UNKNOWN;
|
|
||||||
|
|
||||||
save_char = token.buf[token.length];
|
|
||||||
token.buf[token.length] = '\0';
|
|
||||||
|
|
||||||
orig_header = httpmsg_find_hdr_str( &parser->msg, token.buf );
|
|
||||||
|
|
||||||
token.buf[token.length] = save_char; // restore
|
|
||||||
}
|
|
||||||
|
|
||||||
if( orig_header == NULL ) {
|
|
||||||
//
|
|
||||||
// add new header
|
|
||||||
//
|
|
||||||
|
|
||||||
header = ( http_header_t * ) malloc( sizeof( http_header_t ) );
|
|
||||||
if( header == NULL ) {
|
|
||||||
parser->http_error_code = HTTP_INTERNAL_SERVER_ERROR;
|
|
||||||
return PARSE_FAILURE;
|
|
||||||
}
|
|
||||||
membuffer_init( &header->multi_hdr_buf );
|
|
||||||
|
|
||||||
header->name = token;
|
|
||||||
header->value = hdr_value;
|
|
||||||
header->name_id = header_id;
|
|
||||||
|
|
||||||
ret = dlist_append( &parser->msg.headers, header );
|
|
||||||
if( ret == UPNP_E_OUTOF_MEMORY ) {
|
|
||||||
parser->http_error_code = HTTP_INTERNAL_SERVER_ERROR;
|
|
||||||
return PARSE_FAILURE;
|
|
||||||
}
|
|
||||||
} else if( hdr_value.length > 0 ) {
|
|
||||||
//
|
|
||||||
// append value to existing header
|
|
||||||
//
|
|
||||||
|
|
||||||
if( orig_header->multi_hdr_buf.buf == NULL ) {
|
|
||||||
// store in buffer
|
|
||||||
ret = membuffer_append( &orig_header->multi_hdr_buf,
|
|
||||||
orig_header->value.buf,
|
|
||||||
orig_header->value.length );
|
|
||||||
}
|
|
||||||
// append space
|
|
||||||
ret2 =
|
|
||||||
membuffer_append( &orig_header->multi_hdr_buf, ", ", 2 );
|
|
||||||
|
|
||||||
// append continuation of header value
|
|
||||||
ret3 = membuffer_append( &orig_header->multi_hdr_buf,
|
|
||||||
hdr_value.buf, hdr_value.length );
|
|
||||||
|
|
||||||
if( ret == UPNP_E_OUTOF_MEMORY ||
|
|
||||||
ret2 == UPNP_E_OUTOF_MEMORY ||
|
|
||||||
ret3 == UPNP_E_OUTOF_MEMORY ) {
|
|
||||||
// not enuf mem
|
|
||||||
parser->http_error_code = HTTP_INTERNAL_SERVER_ERROR;
|
|
||||||
return PARSE_FAILURE;
|
|
||||||
}
|
|
||||||
// header value points to allocated buf
|
|
||||||
orig_header->value.buf = orig_header->multi_hdr_buf.buf;
|
|
||||||
orig_header->value.length = orig_header->multi_hdr_buf.length;
|
|
||||||
}
|
|
||||||
} // end while
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// ******************************
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: parser_parse_entity_using_clen
|
* Function: parser_parse_entity_using_clen
|
||||||
*
|
*
|
||||||
@@ -1884,9 +1670,9 @@ parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
|||||||
assert( parser->ent_position == ENTREAD_USING_CLEN );
|
assert( parser->ent_position == ENTREAD_USING_CLEN );
|
||||||
|
|
||||||
// determine entity (i.e. body) length so far
|
// determine entity (i.e. body) length so far
|
||||||
//entity_length = parser->msg.msg.length - parser->entity_start_position;
|
|
||||||
parser->msg.entity.length =
|
parser->msg.entity.length =
|
||||||
parser->msg.msg.length - parser->entity_start_position;
|
parser->msg.msg.length - parser->entity_start_position +
|
||||||
|
parser->msg.entity_offset;
|
||||||
|
|
||||||
if( parser->msg.entity.length < parser->content_length ) {
|
if( parser->msg.entity.length < parser->content_length ) {
|
||||||
// more data to be read
|
// more data to be read
|
||||||
@@ -1894,7 +1680,8 @@ parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
|||||||
} else {
|
} else {
|
||||||
if( parser->msg.entity.length > parser->content_length ) {
|
if( parser->msg.entity.length > parser->content_length ) {
|
||||||
// silently discard extra data
|
// silently discard extra data
|
||||||
parser->msg.msg.buf[parser->entity_start_position +
|
parser->msg.msg.buf[parser->entity_start_position -
|
||||||
|
parser->msg.entity_offset +
|
||||||
parser->content_length] = '\0';
|
parser->content_length] = '\0';
|
||||||
}
|
}
|
||||||
// save entity length
|
// save entity length
|
||||||
@@ -2279,6 +2066,7 @@ parser_response_init( OUT http_parser_t * parser,
|
|||||||
parser_init( parser );
|
parser_init( parser );
|
||||||
parser->msg.is_request = FALSE;
|
parser->msg.is_request = FALSE;
|
||||||
parser->msg.request_method = request_method;
|
parser->msg.request_method = request_method;
|
||||||
|
parser->msg.entity_offset = 0;
|
||||||
parser->position = POS_RESPONSE_LINE;
|
parser->position = POS_RESPONSE_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2374,10 +2162,6 @@ parser_append( INOUT http_parser_t * parser,
|
|||||||
return parser_parse( parser );
|
return parser_parse( parser );
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
********** end of parser ***********
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function: raw_to_int
|
* Function: raw_to_int
|
||||||
*
|
*
|
||||||
@@ -2390,9 +2174,7 @@ parser_append( INOUT http_parser_t * parser,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* int
|
* int
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int raw_to_int(IN memptr *raw_value, IN int base)
|
||||||
raw_to_int( IN memptr * raw_value,
|
|
||||||
IN int base )
|
|
||||||
{
|
{
|
||||||
long num;
|
long num;
|
||||||
char *end_ptr;
|
char *end_ptr;
|
||||||
@@ -2429,9 +2211,7 @@ raw_to_int( IN memptr * raw_value,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* int - index at which the substring is found.
|
* int - index at which the substring is found.
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int raw_find_str(IN memptr *raw_value, IN const char *str)
|
||||||
raw_find_str( IN memptr *raw_value,
|
|
||||||
IN const char *str )
|
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@@ -2474,8 +2254,7 @@ raw_find_str( IN memptr *raw_value,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* const char* ptr - Ptr to the HTTP Method
|
* const char* ptr - Ptr to the HTTP Method
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
const char *
|
const char *method_to_str(IN http_method_t method)
|
||||||
method_to_str( IN http_method_t method )
|
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
@@ -2486,26 +2265,15 @@ method_to_str( IN http_method_t method )
|
|||||||
return index == -1 ? NULL : Http_Method_Table[index].name;
|
return index == -1 ? NULL : Http_Method_Table[index].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function: print_http_headers
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* http_message_t* hmsg ; HTTP Message object
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* void
|
|
||||||
************************************************************************/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void
|
void print_http_headers(http_message_t *hmsg)
|
||||||
print_http_headers( http_message_t * hmsg )
|
|
||||||
{
|
{
|
||||||
ListNode *node;
|
ListNode *node;
|
||||||
// NNS: dlist_node *node;
|
/* NNS: dlist_node *node; */
|
||||||
http_header_t *header;
|
http_header_t *header;
|
||||||
|
|
||||||
// print start line
|
/* print start line */
|
||||||
if( hmsg->is_request ) {
|
if( hmsg->is_request ) {
|
||||||
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
||||||
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
||||||
@@ -2516,19 +2284,19 @@ print_http_headers( http_message_t * hmsg )
|
|||||||
(int)hmsg->status_msg.length, hmsg->status_msg.buf);
|
(int)hmsg->status_msg.length, hmsg->status_msg.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print headers
|
/* print headers */
|
||||||
node = ListHead( &hmsg->headers );
|
node = ListHead( &hmsg->headers );
|
||||||
// NNS: node = dlist_first_node( &hmsg->headers );
|
/* NNS: node = dlist_first_node( &hmsg->headers ); */
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
header = ( http_header_t * ) node->item;
|
header = ( http_header_t * ) node->item;
|
||||||
// NNS: header = (http_header_t *)node->data;
|
/* NNS: header = (http_header_t *)node->data; */
|
||||||
printf( "hdr name: %.*s, value: %.*s\n",
|
printf( "hdr name: %.*s, value: %.*s\n",
|
||||||
(int)header->name.length, header->name.buf,
|
(int)header->name.length, header->name.buf,
|
||||||
(int)header->value.length, header->value.buf );
|
(int)header->value.length, header->value.buf );
|
||||||
|
|
||||||
node = ListNext( &hmsg->headers, node );
|
node = ListNext( &hmsg->headers, node );
|
||||||
// NNS: node = dlist_next( &hmsg->headers, node );
|
/* NNS: node = dlist_next( &hmsg->headers, node ); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "util.h"
|
#include "upnputil.h"
|
||||||
#include "membuffer.h"
|
#include "membuffer.h"
|
||||||
#include "httpparser.h"
|
#include "httpparser.h"
|
||||||
#include "statcodes.h"
|
#include "statcodes.h"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "util.h"
|
#include "upnputil.h"
|
||||||
#include "statcodes.h"
|
#include "statcodes.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,117 +1,68 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Purpose: This file implements the sockets functionality
|
* \file
|
||||||
************************************************************************/
|
*
|
||||||
|
* \brief Implements the sockets functionality.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "sock.h"
|
||||||
|
|
||||||
|
#include "unixutil.h" /* for socklen_t, EAFNOSUPPORT */
|
||||||
|
#include "upnp.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "sock.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
#ifndef WIN32
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#else
|
|
||||||
#include <winsock2.h>
|
|
||||||
#endif
|
|
||||||
#include "unixutil.h"
|
|
||||||
|
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
#define MSG_NOSIGNAL 0
|
#define MSG_NOSIGNAL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
int sock_init(OUT SOCKINFO *info, IN SOCKET sockfd)
|
||||||
* Function : sock_init
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* OUT SOCKINFO* info ; Socket Information Object
|
|
||||||
* IN int sockfd ; Socket Descriptor
|
|
||||||
*
|
|
||||||
* Description : Assign the passed in socket descriptor to socket
|
|
||||||
* descriptor in the SOCKINFO structure.
|
|
||||||
*
|
|
||||||
* Return : int;
|
|
||||||
* UPNP_E_SUCCESS
|
|
||||||
* UPNP_E_OUTOF_MEMORY
|
|
||||||
* UPNP_E_SOCKET_ERROR
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int
|
|
||||||
sock_init( OUT SOCKINFO * info,
|
|
||||||
IN int sockfd )
|
|
||||||
{
|
{
|
||||||
assert(info);
|
assert(info);
|
||||||
|
|
||||||
memset(info, 0, sizeof(SOCKINFO));
|
memset(info, 0, sizeof(SOCKINFO));
|
||||||
|
|
||||||
info->socket = sockfd;
|
info->socket = sockfd;
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int sock_init_with_ip(OUT SOCKINFO *info, IN SOCKET sockfd,
|
||||||
* Function : sock_init_with_ip
|
IN struct sockaddr *foreign_sockaddr)
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* OUT SOCKINFO* info ; Socket Information Object
|
|
||||||
* IN int sockfd ; Socket Descriptor
|
|
||||||
* IN struct in_addr foreign_ip_addr ; Remote IP Address
|
|
||||||
* IN unsigned short foreign_ip_port ; Remote Port number
|
|
||||||
*
|
|
||||||
* Description : Calls the sock_init function and assigns the passed in
|
|
||||||
* IP address and port to the IP address and port in the SOCKINFO
|
|
||||||
* structure.
|
|
||||||
*
|
|
||||||
* Return : int;
|
|
||||||
* UPNP_E_SUCCESS
|
|
||||||
* UPNP_E_OUTOF_MEMORY
|
|
||||||
* UPNP_E_SOCKET_ERROR
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int
|
|
||||||
sock_init_with_ip( OUT SOCKINFO * info,
|
|
||||||
IN int sockfd,
|
|
||||||
IN struct in_addr foreign_ip_addr,
|
|
||||||
IN unsigned short foreign_ip_port )
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -120,68 +71,46 @@ sock_init_with_ip( OUT SOCKINFO * info,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->foreign_ip_addr = foreign_ip_addr;
|
memcpy(&info->foreign_sockaddr, foreign_sockaddr,
|
||||||
info->foreign_ip_port = foreign_ip_port;
|
sizeof(info->foreign_sockaddr));
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int sock_destroy(INOUT SOCKINFO *info, int ShutdownMethod)
|
||||||
* Function : sock_destroy
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* INOUT SOCKINFO* info ; Socket Information Object
|
|
||||||
* int ShutdownMethod ; How to shutdown the socket. Used by
|
|
||||||
* sockets's shutdown()
|
|
||||||
*
|
|
||||||
* Description : Shutsdown the socket using the ShutdownMethod to
|
|
||||||
* indicate whether sends and receives on the socket will be
|
|
||||||
* dis-allowed. After shutting down the socket, closesocket is called
|
|
||||||
* to release system resources used by the socket calls.
|
|
||||||
*
|
|
||||||
* Return : int;
|
|
||||||
* UPNP_E_SOCKET_ERROR on failure
|
|
||||||
* UPNP_E_SUCCESS on success
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int
|
|
||||||
sock_destroy( INOUT SOCKINFO * info,
|
|
||||||
int ShutdownMethod )
|
|
||||||
{
|
{
|
||||||
|
int ret = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
|
if (info->socket != -1) {
|
||||||
shutdown(info->socket, ShutdownMethod);
|
shutdown(info->socket, ShutdownMethod);
|
||||||
if( UpnpCloseSocket( info->socket ) == -1 ) {
|
if (sock_close(info->socket) == -1) {
|
||||||
return UPNP_E_SOCKET_ERROR;
|
ret = UPNP_E_SOCKET_ERROR;
|
||||||
|
}
|
||||||
|
info->socket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : sock_read_write
|
* \brief Receives or sends data. Also returns the time taken to receive or
|
||||||
|
* send data.
|
||||||
*
|
*
|
||||||
* Parameters :
|
* \return
|
||||||
* IN SOCKINFO *info ; Socket Information Object
|
* \li \c numBytes - On Success, no of bytes received or sent or
|
||||||
* OUT char* buffer ; Buffer to get data to or send data from
|
* \li \c UPNP_E_TIMEDOUT - Timeout
|
||||||
* IN size_t bufsize ; Size of the buffer
|
* \li \c UPNP_E_SOCKET_ERROR - Error on socket calls
|
||||||
* IN int *timeoutSecs ; timeout value
|
*/
|
||||||
* IN xboolean bRead ; Boolean value specifying read or write option
|
static int sock_read_write(
|
||||||
*
|
/*! Socket Information Object. */
|
||||||
* Description : Receives or sends data. Also returns the time taken
|
IN SOCKINFO *info,
|
||||||
* to receive or send data.
|
/*! Buffer to get data to or send data from. */
|
||||||
*
|
|
||||||
* Return :int ;
|
|
||||||
* numBytes - On Success, no of bytes received or sent
|
|
||||||
* UPNP_E_TIMEDOUT - Timeout
|
|
||||||
* UPNP_E_SOCKET_ERROR - Error on socket calls
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
static int
|
|
||||||
sock_read_write( IN SOCKINFO * info,
|
|
||||||
OUT char *buffer,
|
OUT char *buffer,
|
||||||
|
/*! Size of the buffer. */
|
||||||
IN size_t bufsize,
|
IN size_t bufsize,
|
||||||
|
/*! timeout value. */
|
||||||
IN int *timeoutSecs,
|
IN int *timeoutSecs,
|
||||||
|
/*! Boolean value specifying read or write option. */
|
||||||
IN xboolean bRead)
|
IN xboolean bRead)
|
||||||
{
|
{
|
||||||
int retCode;
|
int retCode;
|
||||||
@@ -190,47 +119,41 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
int numBytes;
|
int numBytes;
|
||||||
time_t start_time = time(NULL);
|
time_t start_time = time(NULL);
|
||||||
int sockfd = info->socket;
|
SOCKET sockfd = info->socket;
|
||||||
long bytes_sent = 0,
|
long bytes_sent = 0, byte_left = 0, num_written;
|
||||||
byte_left = 0,
|
|
||||||
num_written;
|
|
||||||
|
|
||||||
if (*timeoutSecs < 0) {
|
if (*timeoutSecs < 0) {
|
||||||
return UPNP_E_TIMEDOUT;
|
return UPNP_E_TIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
FD_ZERO(&readSet);
|
FD_ZERO(&readSet);
|
||||||
FD_ZERO(&writeSet);
|
FD_ZERO(&writeSet);
|
||||||
if (bRead) {
|
if (bRead) {
|
||||||
FD_SET( ( unsigned )sockfd, &readSet );
|
FD_SET(sockfd, &readSet);
|
||||||
} else {
|
} else {
|
||||||
FD_SET( ( unsigned )sockfd, &writeSet );
|
FD_SET(sockfd, &writeSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.tv_sec = *timeoutSecs;
|
timeout.tv_sec = *timeoutSecs;
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (*timeoutSecs == 0) {
|
if (*timeoutSecs == 0) {
|
||||||
retCode =
|
retCode = select(sockfd + 1, &readSet, &writeSet,
|
||||||
select( sockfd + 1, &readSet, &writeSet, NULL, NULL );
|
NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
retCode =
|
retCode = select(sockfd + 1, &readSet, &writeSet,
|
||||||
select( sockfd + 1, &readSet, &writeSet, NULL, &timeout );
|
NULL, &timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retCode == 0) {
|
if (retCode == 0) {
|
||||||
return UPNP_E_TIMEDOUT;
|
return UPNP_E_TIMEDOUT;
|
||||||
}
|
}
|
||||||
if (retCode == -1) {
|
if (retCode == -1) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
return UPNP_E_SOCKET_ERROR; // error
|
return UPNP_E_SOCKET_ERROR;
|
||||||
} else {
|
} else {
|
||||||
break; // read or write
|
/* read or write. */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SO_NOSIGPIPE
|
#ifdef SO_NOSIGPIPE
|
||||||
{
|
{
|
||||||
int old;
|
int old;
|
||||||
@@ -239,41 +162,37 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
getsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, &olen);
|
getsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, &olen);
|
||||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
|
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bRead) {
|
if (bRead) {
|
||||||
// read data
|
/* read data. */
|
||||||
numBytes = recv(sockfd, buffer, bufsize, MSG_NOSIGNAL);
|
numBytes = recv(sockfd, buffer, bufsize, MSG_NOSIGNAL);
|
||||||
} else {
|
} else {
|
||||||
byte_left = bufsize;
|
byte_left = bufsize;
|
||||||
bytes_sent = 0;
|
bytes_sent = 0;
|
||||||
while (byte_left > 0) {
|
while (byte_left > 0) {
|
||||||
// write data
|
/* write data. */
|
||||||
num_written =
|
num_written = send(sockfd,
|
||||||
send( sockfd, buffer + bytes_sent, byte_left,
|
buffer + bytes_sent, byte_left,
|
||||||
MSG_DONTROUTE | MSG_NOSIGNAL);
|
MSG_DONTROUTE | MSG_NOSIGNAL);
|
||||||
if (num_written == -1) {
|
if (num_written == -1) {
|
||||||
#ifdef SO_NOSIGPIPE
|
#ifdef SO_NOSIGPIPE
|
||||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
setsockopt(sockfd, SOL_SOCKET,
|
||||||
|
SO_NOSIGPIPE, &old, olen);
|
||||||
#endif
|
#endif
|
||||||
return num_written;
|
return num_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte_left = byte_left - num_written;
|
byte_left = byte_left - num_written;
|
||||||
bytes_sent += num_written;
|
bytes_sent += num_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
numBytes = bytes_sent;
|
numBytes = bytes_sent;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SO_NOSIGPIPE
|
#ifdef SO_NOSIGPIPE
|
||||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (numBytes < 0) {
|
if (numBytes < 0) {
|
||||||
return UPNP_E_SOCKET_ERROR;
|
return UPNP_E_SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
// subtract time used for reading/writing
|
/* subtract time used for reading/writing. */
|
||||||
if (*timeoutSecs != 0) {
|
if (*timeoutSecs != 0) {
|
||||||
*timeoutSecs -= time(NULL) - start_time;
|
*timeoutSecs -= time(NULL) - start_time;
|
||||||
}
|
}
|
||||||
@@ -281,54 +200,15 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
return numBytes;
|
return numBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int sock_read(IN SOCKINFO *info, OUT char *buffer, IN size_t bufsize,
|
||||||
* Function : sock_read
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* IN SOCKINFO *info ; Socket Information Object
|
|
||||||
* OUT char* buffer ; Buffer to get data to
|
|
||||||
* IN size_t bufsize ; Size of the buffer
|
|
||||||
* IN int *timeoutSecs ; timeout value
|
|
||||||
*
|
|
||||||
* Description : Calls sock_read_write() for reading data on the
|
|
||||||
* socket
|
|
||||||
*
|
|
||||||
* Return : int;
|
|
||||||
* Values returned by sock_read_write()
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int
|
|
||||||
sock_read( IN SOCKINFO * info,
|
|
||||||
OUT char *buffer,
|
|
||||||
IN size_t bufsize,
|
|
||||||
INOUT int *timeoutSecs)
|
INOUT int *timeoutSecs)
|
||||||
{
|
{
|
||||||
return sock_read_write(info, buffer, bufsize, timeoutSecs, TRUE);
|
return sock_read_write(info, buffer, bufsize, timeoutSecs, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int sock_write(IN SOCKINFO *info, IN char *buffer, IN size_t bufsize,
|
||||||
* Function : sock_write
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* IN SOCKINFO *info ; Socket Information Object
|
|
||||||
* IN char* buffer ; Buffer to send data from
|
|
||||||
* IN size_t bufsize ; Size of the buffer
|
|
||||||
* IN int *timeoutSecs ; timeout value
|
|
||||||
*
|
|
||||||
* Description : Calls sock_read_write() for writing data on the
|
|
||||||
* socket
|
|
||||||
*
|
|
||||||
* Return : int;
|
|
||||||
* sock_read_write()
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int
|
|
||||||
sock_write( IN SOCKINFO * info,
|
|
||||||
IN char *buffer,
|
|
||||||
IN size_t bufsize,
|
|
||||||
INOUT int *timeoutSecs)
|
INOUT int *timeoutSecs)
|
||||||
{
|
{
|
||||||
return sock_read_write(info, buffer, bufsize, timeoutSecs, FALSE);
|
return sock_read_write(info, buffer, bufsize, timeoutSecs, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,33 +1,34 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file defines the functions for services. It defines
|
* Purpose: This file defines the functions for services. It defines
|
||||||
@@ -116,25 +117,8 @@ RemoveSubscriptionSID( Upnp_SID sid,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : GetSubscriptionSID
|
subscription *GetSubscriptionSID(const Upnp_SID sid, service_info *service)
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* Upnp_SID sid ; subscription ID
|
|
||||||
* service_info * service ; service object providing the list of
|
|
||||||
* subscriptions
|
|
||||||
*
|
|
||||||
* Description : Return the subscription from the service table
|
|
||||||
* that matches const Upnp_SID sid value.
|
|
||||||
*
|
|
||||||
* Return : subscription * - Pointer to the matching subscription
|
|
||||||
* node;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
subscription *
|
|
||||||
GetSubscriptionSID( Upnp_SID sid,
|
|
||||||
service_info * service )
|
|
||||||
{
|
{
|
||||||
subscription *next = service->subscriptionList;
|
subscription *next = service->subscriptionList;
|
||||||
subscription *previous = NULL;
|
subscription *previous = NULL;
|
||||||
@@ -169,24 +153,8 @@ GetSubscriptionSID( Upnp_SID sid,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : GetNextSubscription
|
subscription *GetNextSubscription(service_info *service, subscription *current)
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* service_info * service ; service object providing the list of
|
|
||||||
* subscriptions
|
|
||||||
* subscription *current ; current subscription object
|
|
||||||
*
|
|
||||||
* Description : Get current and valid subscription from the service
|
|
||||||
* table.
|
|
||||||
*
|
|
||||||
* Return : subscription * - Pointer to the next subscription node;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
subscription *
|
|
||||||
GetNextSubscription( service_info * service,
|
|
||||||
subscription * current )
|
|
||||||
{
|
{
|
||||||
time_t current_time;
|
time_t current_time;
|
||||||
subscription *next = NULL;
|
subscription *next = NULL;
|
||||||
@@ -218,22 +186,8 @@ GetNextSubscription( service_info * service,
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : GetFirstSubscription
|
subscription *GetFirstSubscription(service_info *service)
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* service_info *service ; service object providing the list of
|
|
||||||
* subscriptions
|
|
||||||
*
|
|
||||||
* Description : Gets pointer to the first subscription node in the
|
|
||||||
* service table.
|
|
||||||
*
|
|
||||||
* Return : subscription * - pointer to the first subscription node ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
subscription *
|
|
||||||
GetFirstSubscription( service_info * service )
|
|
||||||
{
|
{
|
||||||
subscription temp;
|
subscription temp;
|
||||||
subscription *next = NULL;
|
subscription *next = NULL;
|
||||||
@@ -242,24 +196,12 @@ GetFirstSubscription( service_info * service )
|
|||||||
next = GetNextSubscription(service, &temp);
|
next = GetNextSubscription(service, &temp);
|
||||||
service->subscriptionList = temp.next;
|
service->subscriptionList = temp.next;
|
||||||
// service->subscriptionList = next;
|
// service->subscriptionList = next;
|
||||||
|
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : freeSubscription
|
void freeSubscription(subscription *sub)
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* subscription * sub ; subscription to be freed
|
|
||||||
*
|
|
||||||
* Description : Free's the memory allocated for storing the URL of
|
|
||||||
* the subscription.
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void
|
|
||||||
freeSubscription( subscription * sub )
|
|
||||||
{
|
{
|
||||||
if (sub) {
|
if (sub) {
|
||||||
free_URL_list(&sub->DeliveryURLs);
|
free_URL_list(&sub->DeliveryURLs);
|
||||||
@@ -929,8 +871,10 @@ getServiceList( IXML_Node * node,
|
|||||||
( *end ) = current;
|
( *end ) = current;
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
} else
|
} else {
|
||||||
|
( *end ) = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,6 +920,7 @@ getAllServiceList( IXML_Node * node,
|
|||||||
if( head ) {
|
if( head ) {
|
||||||
end->next =
|
end->next =
|
||||||
getServiceList( currentDevice, &next_end, URLBase );
|
getServiceList( currentDevice, &next_end, URLBase );
|
||||||
|
if ( next_end )
|
||||||
end = next_end;
|
end = next_end;
|
||||||
} else
|
} else
|
||||||
head = getServiceList( currentDevice, &end, URLBase );
|
head = getServiceList( currentDevice, &end, URLBase );
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file contains functions that operate on memory and
|
* Purpose: This file contains functions that operate on memory and
|
||||||
@@ -491,6 +491,8 @@ membuffer_delete( INOUT membuffer * m,
|
|||||||
|
|
||||||
assert( m != NULL );
|
assert( m != NULL );
|
||||||
|
|
||||||
|
if (!m) return;
|
||||||
|
|
||||||
if( m->length == 0 ) {
|
if( m->length == 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,65 +1,59 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* \brief Contains a function for freeing the memory associated with a upnp
|
||||||
|
* time out event.
|
||||||
|
*/
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Purpose: This file contains a function for freeing the memory associated
|
|
||||||
* wuth a upnp time out event.
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_timeout.h"
|
#include "upnp_timeout.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/************************************************************************
|
#include <stdlib.h> /* for free() */
|
||||||
* Function : free_upnp_timeout
|
|
||||||
*
|
|
||||||
* Parameters :
|
void free_upnp_timeout(upnp_timeout *event)
|
||||||
* upnp_timeout *event ; Event which needs to be freed
|
|
||||||
*
|
|
||||||
* Description : Free memory associated with event and memory for any
|
|
||||||
* sub-elements
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void
|
|
||||||
free_upnp_timeout( upnp_timeout * event )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
if( event->Event )
|
if (event->Event) {
|
||||||
free(event->Event);
|
free(event->Event);
|
||||||
|
}
|
||||||
free(event);
|
free(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,42 +1,47 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file contains functions for copying strings based on
|
* Purpose: This file contains functions for copying strings based on
|
||||||
* different options.
|
* different options.
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "util.h"
|
#include "upnputil.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : linecopy
|
* Function : linecopy
|
||||||
|
|||||||
69
upnp/src/inc/VirtualDir.h
Normal file
69
upnp/src/inc/VirtualDir.h
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#ifndef VIRTUALDIR_H
|
||||||
|
#define VIRTUALDIR_H
|
||||||
|
|
||||||
|
|
||||||
|
/** The \b VirtualDirCallbacks structure contains the pointers to
|
||||||
|
* file-related callback functions a device application can register to
|
||||||
|
* virtualize URLs.
|
||||||
|
*/
|
||||||
|
struct VirtualDirCallbacks
|
||||||
|
{
|
||||||
|
/** Called by the web server to query information on a file. The callback
|
||||||
|
* should return 0 on success or -1 on an error. */
|
||||||
|
VDCallback_GetInfo get_info;
|
||||||
|
|
||||||
|
/** Called by the web server to open a file. The callback should return
|
||||||
|
* a valid handle if the file can be opened. Otherwise, it should return
|
||||||
|
* \c NULL to signify an error. */
|
||||||
|
VDCallback_Open open;
|
||||||
|
|
||||||
|
/** Called by the web server to perform a sequential read from an open
|
||||||
|
* file. The callback should copy \b buflen bytes from the file into
|
||||||
|
* the buffer.
|
||||||
|
* @return An integer representing one of the following:
|
||||||
|
* \li <tt> 0</tt>: The file contains no more data (EOF).
|
||||||
|
* \li <tt> > 0</tt>: A successful read of the number of bytes in the
|
||||||
|
* return code.
|
||||||
|
* \li <tt> < 0</tt>: An error occurred reading the file.
|
||||||
|
*/
|
||||||
|
VDCallback_Read read;
|
||||||
|
|
||||||
|
/** Called by the web server to perform a sequential write to an open
|
||||||
|
* file. The callback should write \b buflen bytes into the file from
|
||||||
|
* the buffer. It should return the actual number of bytes written,
|
||||||
|
* which might be less than \b buflen in the case of a write error.
|
||||||
|
*/
|
||||||
|
VDCallback_Write write;
|
||||||
|
|
||||||
|
/** Called by the web server to move the file pointer, or offset, into
|
||||||
|
* an open file. The \b origin parameter determines where to start
|
||||||
|
* moving the file pointer. A value of \c SEEK_CUR moves the
|
||||||
|
* file pointer relative to where it is. The \b offset parameter can
|
||||||
|
* be either positive (move forward) or negative (move backward).
|
||||||
|
* \c SEEK_END moves relative to the end of the file. A positive
|
||||||
|
* \b offset extends the file. A negative \b offset moves backward
|
||||||
|
* in the file. Finally, \c SEEK_SET moves to an absolute position in
|
||||||
|
* the file. In this case, \b offset must be positive. The callback
|
||||||
|
* should return 0 on a successful seek or a non-zero value on an error.
|
||||||
|
*/
|
||||||
|
VDCallback_Seek seek;
|
||||||
|
|
||||||
|
/** Called by the web server to close a file opened via the \b open
|
||||||
|
* callback. It should return 0 on success, or a non-zero value on an
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
VDCallback_Close close;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct virtual_Dir_List
|
||||||
|
{
|
||||||
|
struct virtual_Dir_List *next;
|
||||||
|
char dirName[NAME_SIZE];
|
||||||
|
} virtualDirList;
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* VIRTUALDIR_H */
|
||||||
|
|
||||||
@@ -1,167 +1,248 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// 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 _CLIENT_TABLE
|
#ifndef CLIENT_TABLE_H
|
||||||
#define _CLIENT_TABLE
|
#define CLIENT_TABLE_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "service_table.h"
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
|
#include "UpnpString.h"
|
||||||
|
#include "upnp_timeout.h"
|
||||||
|
#include "uri.h"
|
||||||
|
#include "TimerThread.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include <malloc.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "uri.h"
|
|
||||||
#include "service_table.h"
|
|
||||||
|
|
||||||
#include "TimerThread.h"
|
|
||||||
#include "upnp_timeout.h"
|
|
||||||
|
|
||||||
extern TimerThread gTimerThread;
|
extern TimerThread gTimerThread;
|
||||||
|
|
||||||
CLIENTONLY(
|
|
||||||
typedef struct CLIENT_SUBSCRIPTION {
|
|
||||||
Upnp_SID sid;
|
|
||||||
char * ActualSID;
|
|
||||||
char * EventURL;
|
|
||||||
int RenewEventId;
|
|
||||||
struct CLIENT_SUBSCRIPTION * next;
|
|
||||||
} client_subscription;
|
|
||||||
|
|
||||||
/************************************************************************
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
* Function : copy_client_subscription
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* client_subscription * in ; - source client subscription
|
|
||||||
* client_subscription * out ; - destination client subscription
|
|
||||||
*
|
|
||||||
* Description : Make a copy of the client subscription data
|
|
||||||
*
|
|
||||||
* Return : int ;
|
|
||||||
* UPNP_E_OUTOF_MEMORY - On Failure to allocate memory
|
|
||||||
* HTTP_SUCCESS - On Success
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
int copy_client_subscription(client_subscription * in, client_subscription * out);
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : free_client_subscription
|
typedef struct s_ClientSubscription ClientSubscription;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Constructor.
|
||||||
|
*/
|
||||||
|
ClientSubscription *UpnpClientSubscription_new();
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Destructor.
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_delete(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Copy Constructor.
|
||||||
|
*/
|
||||||
|
ClientSubscription *UpnpClientSubscription_dup(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Assignment operator.
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_assign(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *q,
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
int UpnpClientSubscription_get_RenewEventId(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_set_RenewEventId(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
/*! [in] . */
|
||||||
|
int n);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
const UpnpString *UpnpClientSubscription_get_SID(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_set_SID(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
const UpnpString *s);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_strcpy_SID(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
const char *s);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
const UpnpString *UpnpClientSubscription_get_ActualSID(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_set_ActualSID(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
const UpnpString *s);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_strcpy_ActualSID(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
const char *s);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
const UpnpString *UpnpClientSubscription_get_EventURL(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_set_EventURL(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
const UpnpString *s);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_strcpy_EventURL(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
const char *s);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
ClientSubscription *UpnpClientSubscription_get_Next(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
const ClientSubscription *p);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
void UpnpClientSubscription_set_Next(
|
||||||
|
/*! [in] The \b this pointer. */
|
||||||
|
ClientSubscription *p,
|
||||||
|
ClientSubscription *q);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Free memory allocated for client subscription data.
|
||||||
*
|
*
|
||||||
* Parameters :
|
|
||||||
* client_subscription * sub ; - Client subscription to be freed
|
|
||||||
*
|
|
||||||
* Description : Free memory allocated for client subscription data.
|
|
||||||
* Remove timer thread associated with this subscription event.
|
* Remove timer thread associated with this subscription event.
|
||||||
*
|
*/
|
||||||
* Return : void ;
|
void free_client_subscription(
|
||||||
*
|
/*! [in] Client subscription to be freed. */
|
||||||
* Note :
|
ClientSubscription *sub);
|
||||||
************************************************************************/
|
|
||||||
void free_client_subscription(client_subscription * sub);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : freeClientSubList
|
* \brief Free the client subscription table.
|
||||||
*
|
*/
|
||||||
* Parameters :
|
void freeClientSubList(
|
||||||
* client_subscription * list ; Client subscription
|
/*! [in] Client subscription list to be freed. */
|
||||||
*
|
ClientSubscription *list);
|
||||||
* Description : Free the client subscription table.
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void freeClientSubList(client_subscription * list);
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : RemoveClientSubClientSID
|
|
||||||
*
|
|
||||||
* Parameters :
|
|
||||||
* client_subscription **head ; Head of the subscription list
|
|
||||||
* const Upnp_SID sid ; Subscription ID to be mactched
|
|
||||||
*
|
|
||||||
* Description : Remove the client subscription matching the
|
|
||||||
* subscritpion id represented by the const Upnp_SID sid parameter
|
|
||||||
* from the table and update the table.
|
|
||||||
*
|
|
||||||
* Return : void ;
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
void RemoveClientSubClientSID(client_subscription **head,
|
|
||||||
const Upnp_SID sid);
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : GetClientSubClientSID
|
* \brief Remove the client subscription matching the subscritpion id
|
||||||
*
|
* represented by the const Upnp_SID sid parameter from the table and
|
||||||
* Parameters :
|
* update the table.
|
||||||
* client_subscription *head ; Head of the subscription list
|
*/
|
||||||
* const Upnp_SID sid ; Subscription ID to be matched
|
void RemoveClientSubClientSID(
|
||||||
*
|
/*! [in] Head of the subscription list. */
|
||||||
* Description : Return the client subscription from the client table
|
ClientSubscription **head,
|
||||||
* that matches const Upnp_SID sid subscrition id value.
|
/*! [in] Subscription ID to be mactched. */
|
||||||
*
|
const UpnpString *sid);
|
||||||
* Return : client_subscription * ; The matching subscription
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
************************************************************************/
|
|
||||||
client_subscription * GetClientSubClientSID(client_subscription *head
|
|
||||||
, const Upnp_SID sid);
|
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : GetClientSubActualSID
|
/*!
|
||||||
|
* \brief Return the client subscription from the client table that matches
|
||||||
|
* const Upnp_SID sid subscrition id value.
|
||||||
*
|
*
|
||||||
* Parameters :
|
* \return The matching subscription.
|
||||||
* client_subscription *head ; Head of the subscription list
|
*/
|
||||||
* token * sid ; Subscription ID to be matched
|
ClientSubscription *GetClientSubClientSID(
|
||||||
|
/*! [in] Head of the subscription list. */
|
||||||
|
ClientSubscription *head,
|
||||||
|
/*! [in] Subscription ID to be mactched. */
|
||||||
|
const UpnpString *sid);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns the client subscription from the client subscription table
|
||||||
|
* that has the matching token *sid buffer value.
|
||||||
*
|
*
|
||||||
* Description : Returns the client subscription from the client
|
* \return The matching subscription.
|
||||||
* subscription table that has the matching token * sid buffer
|
*/
|
||||||
* value.
|
ClientSubscription *GetClientSubActualSID(
|
||||||
*
|
/*! [in] Head of the subscription list. */
|
||||||
* Return : client_subscription * ; The matching subscription
|
ClientSubscription *head,
|
||||||
*
|
/*! [in] Subscription ID to be mactched. */
|
||||||
* Note :
|
token *sid);
|
||||||
************************************************************************/
|
|
||||||
client_subscription * GetClientSubActualSID(client_subscription *head
|
|
||||||
, token * sid);
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
)
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CLIENT_TABLE_H */
|
||||||
|
|
||||||
#endif /* _CLIENT_TABLE */
|
|
||||||
|
|||||||
@@ -1,86 +1,101 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
**************************************************************************/
|
||||||
|
|
||||||
#ifndef INTERNAL_CONFIG_H
|
#ifndef INTERNAL_CONFIG_H
|
||||||
#define INTERNAL_CONFIG_H
|
#define INTERNAL_CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
#include "autoconfig.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
|
* The Linux SDK for UPnP Devices contains some compile-time parameters
|
||||||
* that effect the behavior of the SDK. All configuration options are
|
* that effect the behavior of the SDK. All configuration options are
|
||||||
* located in {\tt src/inc/config.h}.
|
* 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
|
* The {\tt THREAD_IDLE_TIME} constant determines when a thread will be
|
||||||
* removed from the thread pool and returned to the operating system. When
|
* 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
|
* 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
|
* the thread will be released from the thread pool. The default value is
|
||||||
* 5000 milliseconds (5 seconds).
|
* 5000 milliseconds (5 seconds).
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define THREAD_IDLE_TIME 5000
|
#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
|
* 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
|
* allocated to the thread pool inside the SDK. The thread pool will
|
||||||
* try and maintain this jobs/thread ratio. When the jobs/thread ratio
|
* 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
|
* 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.
|
* allocated to the thread pool. The default ratio is 10 jobs/thread.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define JOBS_PER_THREAD 10
|
#define JOBS_PER_THREAD 10
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name MIN_THREADS
|
|
||||||
|
/*!
|
||||||
|
* \name MIN_THREADS
|
||||||
|
*
|
||||||
* The {\tt MIN_THREADS} constant defines the minimum number of threads the
|
* The {\tt MIN_THREADS} constant defines the minimum number of threads the
|
||||||
* thread pool inside the SDK will create. The thread pool will
|
* thread pool inside the SDK will create. The thread pool will
|
||||||
* always have this number of threads. These threads are used
|
* always have this number of threads. These threads are used
|
||||||
* for both callbacks into applications built on top of the SDK and also
|
* for both callbacks into applications built on top of the SDK and also
|
||||||
* for making connections to other control points and devices. This number
|
* for making connections to other control points and devices. This number
|
||||||
* includes persistent threads. The default value is two threads.
|
* includes persistent threads. The default value is two threads.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MIN_THREADS 2
|
#define MIN_THREADS 2
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name MAX_THREADS
|
|
||||||
|
/*!
|
||||||
|
* \name MAX_THREADS
|
||||||
|
*
|
||||||
* The {\tt MAX_THREADS} constant defines the maximum number of threads the
|
* The {\tt MAX_THREADS} constant defines the maximum number of threads the
|
||||||
* thread pool inside the SDK will create. These threads are used
|
* thread pool inside the SDK will create. These threads are used
|
||||||
* for both callbacks into applications built on top of the library and also
|
* for both callbacks into applications built on top of the library and also
|
||||||
@@ -89,60 +104,111 @@
|
|||||||
* necessary for correct operation. This value can be increased for greater
|
* necessary for correct operation. This value can be increased for greater
|
||||||
* performance in operation at the expense of greater memory overhead. The
|
* performance in operation at the expense of greater memory overhead. The
|
||||||
* default value is 12.
|
* default value is 12.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MAX_THREADS 12
|
#define MAX_THREADS 12
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name MAX_JOBS_TOTAL
|
|
||||||
|
/*!
|
||||||
|
* \name THREAD_STACK_SIZE
|
||||||
|
*
|
||||||
|
* The {\tt THREAD_STACK_SIZE} constant defines the minimum stack size (in
|
||||||
|
* bytes) allocated for the stack of each thread 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 for making connections
|
||||||
|
* to other control points and devices. This value will not be used if it
|
||||||
|
* is lower than ITHREAD_STACK_MIN or greater than a system-imposed limit.
|
||||||
|
* This value can be used to lower memory overhead in embedded systems.
|
||||||
|
* The default value is 0 (so it is not used by default).
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define THREAD_STACK_SIZE 0
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
|
||||||
|
/*! \name MAX_JOBS_TOTAL
|
||||||
|
*
|
||||||
* The {\tt MAX_JOBS_TOTAL} constant determines the maximum number of jobs
|
* 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
|
* that can be queued. If this limit is reached further jobs will be thrown
|
||||||
* to avoid memory exhaustion. The default value 100.
|
* to avoid memory exhaustion. The default value 100.
|
||||||
* (Added by Axis.)
|
* (Added by Axis.)
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MAX_JOBS_TOTAL 100
|
#define MAX_JOBS_TOTAL 100
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name DEFAULT_SOAP_CONTENT_LENGTH
|
|
||||||
|
/*!
|
||||||
|
* \name DEFAULT_SOAP_CONTENT_LENGTH
|
||||||
|
*
|
||||||
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
* SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.
|
||||||
* This prevents devices that have a misbehaving web server to send
|
* This prevents devices that have a misbehaving web server to send
|
||||||
* a large amount of data to the control point causing it to crash.
|
* a large amount of data to the control point causing it to crash.
|
||||||
* This can be adjusted dynamically with {\tt UpnpSetMaxContentLength}.
|
* This can be adjusted dynamically with {\tt UpnpSetMaxContentLength}.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
//@{
|
|
||||||
#define DEFAULT_SOAP_CONTENT_LENGTH 16000
|
#define DEFAULT_SOAP_CONTENT_LENGTH 16000
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name NUM_SSDP_COPY
|
|
||||||
|
/*!
|
||||||
|
* \name NUM_SSDP_COPY
|
||||||
|
*
|
||||||
* This configuration parameter determines how many copies of each SSDP
|
* This configuration parameter determines how many copies of each SSDP
|
||||||
* advertisement and search packets will be sent. By default it will send two
|
* advertisement and search packets will be sent. By default it will send two
|
||||||
* copies of every packet.
|
* copies of every packet.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
//@{
|
|
||||||
#define NUM_SSDP_COPY 2
|
#define NUM_SSDP_COPY 2
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name SSDP_PAUSE
|
|
||||||
|
/*!
|
||||||
|
* \name SSDP_PAUSE
|
||||||
|
*
|
||||||
* This configuration parameter determines the pause between identical SSDP
|
* This configuration parameter determines the pause between identical SSDP
|
||||||
* advertisement and search packets. The pause is measured in milliseconds
|
* advertisement and search packets. The pause is measured in milliseconds
|
||||||
* and defaults to 100.
|
* and defaults to 100.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
//@{
|
|
||||||
#define SSDP_PAUSE 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
|
* This configuration parameter sets the maximum buffer size for the
|
||||||
* webserver. The default value is 1MB.
|
* webserver. The default value is 1MB.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
//@{
|
|
||||||
#define WEB_SERVER_BUF_SIZE (1024*1024)
|
#define WEB_SERVER_BUF_SIZE (1024*1024)
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name AUTO_RENEW_TIME
|
/*!
|
||||||
|
* \name WEB_SERVER_CONTENT_LANGUAGE
|
||||||
|
*
|
||||||
|
* This configuration parameter sets the value of the Content-Language
|
||||||
|
* header for the webserver. Thanks to this parameter, the use can advertize
|
||||||
|
* the language used by the device in the description (friendlyName) and
|
||||||
|
* presentation steps of UPnP. The default value is empty string so no
|
||||||
|
* Content-Language header is added.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define WEB_SERVER_CONTENT_LANGUAGE ""
|
||||||
|
/* @} */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \name AUTO_RENEW_TIME
|
||||||
|
*
|
||||||
* The {\tt AUTO_RENEW_TIME} is the time, in seconds, before a subscription
|
* The {\tt AUTO_RENEW_TIME} is the time, in seconds, before a subscription
|
||||||
* expires that the SDK automatically resubscribes. The default
|
* expires that the SDK automatically resubscribes. The default
|
||||||
* value is 10 seconds. Setting this value too low can result in the
|
* value is 10 seconds. Setting this value too low can result in the
|
||||||
@@ -150,71 +216,87 @@
|
|||||||
* subscription to timeout. In order to avoid continually resubscribing
|
* subscription to timeout. In order to avoid continually resubscribing
|
||||||
* the minimum subscription time is five seconds more than the auto renew
|
* the minimum subscription time is five seconds more than the auto renew
|
||||||
* time.
|
* time.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define AUTO_RENEW_TIME 10
|
#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
|
* The {\tt CP_MINIMUM_SUBSCRIPTION_TIME} is the minimum subscription time
|
||||||
* allowed for a control point using the SDK. Subscribing for less than
|
* allowed for a control point using the SDK. Subscribing for less than
|
||||||
* this time automatically results in a subscription for this amount. The
|
* 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
|
* default value is 5 seconds more than the {\tt AUTO_RENEW_TIME}, or 15
|
||||||
* seconds.
|
* seconds.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define CP_MINIMUM_SUBSCRIPTION_TIME (AUTO_RENEW_TIME + 5)
|
#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
|
* The {\tt MAX_SEARCH_TIME} is the maximum time
|
||||||
* allowed for an SSDP search by a control point. Searching for greater than
|
* 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
|
* this time automatically results in a search for this amount. The default
|
||||||
* value is 80 seconds.
|
* value is 80 seconds.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MAX_SEARCH_TIME 80
|
#define MAX_SEARCH_TIME 80
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name MIN_SEARCH_TIME
|
|
||||||
|
/*!
|
||||||
|
* \name MIN_SEARCH_TIME
|
||||||
|
*
|
||||||
* The {\tt MIN_SEARCH_TIME} is the minimumm time
|
* The {\tt MIN_SEARCH_TIME} is the minimumm time
|
||||||
* allowed for an SSDP search by a control point. Searching for less than
|
* 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
|
* this time automatically results in a search for this amount. The default
|
||||||
* value is 2 seconds.
|
* value is 2 seconds.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define MIN_SEARCH_TIME 2
|
#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
|
* The {\tt AUTO_ADVERTISEMENT_TIME} is the time, in seconds, before an
|
||||||
* device advertisements expires before a renewed advertisement is sent.
|
* device advertisements expires before a renewed advertisement is sent.
|
||||||
* The default time is 30 seconds.
|
* The default time is 30 seconds.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define AUTO_ADVERTISEMENT_TIME 30
|
#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
|
* 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
|
* at an interval equal to half of the expiration time of SSDP packets
|
||||||
* minus the AUTO_ADVERTISEMENT_TIME. This is used to increase
|
* minus the AUTO_ADVERTISEMENT_TIME. This is used to increase
|
||||||
* the probability of SSDP packets reaching to control points.
|
* the probability of SSDP packets reaching to control points.
|
||||||
* It is recommended that this flag be turned on for embedded wireless
|
* It is recommended that this flag be turned on for embedded wireless
|
||||||
* devices.
|
* devices.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define SSDP_PACKET_DISTRIBUTE 1
|
#define SSDP_PACKET_DISTRIBUTE 1
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
/** @name Module Exclusion
|
|
||||||
|
/*!
|
||||||
|
* \name Module Exclusion
|
||||||
|
*
|
||||||
* Depending on the requirements, the user can selectively discard any of
|
* Depending on the requirements, the user can selectively discard any of
|
||||||
* the major modules like SOAP, GENA, SSDP or the Internal web server. By
|
* the major modules like SOAP, GENA, SSDP or the Internal web server. By
|
||||||
* default everything is included inside the SDK. By setting any of
|
* default everything is included inside the SDK. By setting any of
|
||||||
@@ -230,9 +312,8 @@
|
|||||||
* \item {\tt EXCLUDE_JNI[0,1]}
|
* \item {\tt EXCLUDE_JNI[0,1]}
|
||||||
* \end{itemize}
|
* \end{itemize}
|
||||||
*
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define EXCLUDE_SSDP 0
|
#define EXCLUDE_SSDP 0
|
||||||
#define EXCLUDE_SOAP 0
|
#define EXCLUDE_SOAP 0
|
||||||
#define EXCLUDE_GENA 0
|
#define EXCLUDE_GENA 0
|
||||||
@@ -244,24 +325,28 @@
|
|||||||
#else
|
#else
|
||||||
# define EXCLUDE_JNI 1
|
# define EXCLUDE_JNI 1
|
||||||
#endif
|
#endif
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
|
|
||||||
/** @name DEBUG_TARGET
|
/*!
|
||||||
|
* \name DEBUG_TARGET
|
||||||
|
*
|
||||||
* The user has the option to redirect the library output debug messages
|
* 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
|
* 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
|
* debug level 0 will go to {\tt upnp.err} and messages with debug level
|
||||||
* greater than zero will be redirected to {\tt upnp.out}.
|
* greater than zero will be redirected to {\tt upnp.out}.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//@{
|
|
||||||
#define DEBUG_TARGET 1
|
#define DEBUG_TARGET 1
|
||||||
//@}
|
/* @} */
|
||||||
|
|
||||||
|
|
||||||
/** @name Other debugging features
|
/*!
|
||||||
The UPnP SDK contains other features to aid in debugging:
|
* \name Other debugging features
|
||||||
see <upnp/inc/upnpdebug.h>
|
*
|
||||||
|
* The UPnP SDK contains other features to aid in debugging:
|
||||||
|
* see <upnp/inc/upnpdebug.h>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEBUG_ALL 1
|
#define DEBUG_ALL 1
|
||||||
@@ -274,36 +359,44 @@
|
|||||||
#define DEBUG_HTTP 0
|
#define DEBUG_HTTP 0
|
||||||
#define DEBUG_API 0
|
#define DEBUG_API 0
|
||||||
|
|
||||||
//@} // Compile time configuration options
|
|
||||||
|
/*
|
||||||
|
* @} Compile time configuration options
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Do not change, Internal purpose only!!!
|
* Do not change, Internal purpose only!!!
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
//@{
|
/*!
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set additional defines based on requested configuration
|
* Set additional defines based on requested configuration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// configure --enable-client
|
|
||||||
|
/* configure --enable-client */
|
||||||
#if UPNP_HAVE_CLIENT
|
#if UPNP_HAVE_CLIENT
|
||||||
# define INCLUDE_CLIENT_APIS 1
|
# define INCLUDE_CLIENT_APIS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// configure --enable-device
|
|
||||||
|
/* configure --enable-device */
|
||||||
#if UPNP_HAVE_DEVICE
|
#if UPNP_HAVE_DEVICE
|
||||||
# define INCLUDE_DEVICE_APIS 1
|
# define INCLUDE_DEVICE_APIS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// configure --enable-webserver --enable-device
|
|
||||||
|
/* configure --enable-webserver --enable-device */
|
||||||
#if UPNP_HAVE_WEBSERVER
|
#if UPNP_HAVE_WEBSERVER
|
||||||
# define INTERNAL_WEB_SERVER 1
|
# define INTERNAL_WEB_SERVER 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef EXCLUDE_WEB_SERVER
|
#undef EXCLUDE_WEB_SERVER
|
||||||
#undef EXCLUDE_MINISERVER
|
#undef EXCLUDE_MINISERVER
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
#ifdef INTERNAL_WEB_SERVER
|
||||||
@@ -314,6 +407,7 @@
|
|||||||
# define EXCLUDE_MINISERVER 1
|
# define EXCLUDE_MINISERVER 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1
|
#if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1
|
||||||
# undef EXCLUDE_MINISERVER
|
# undef EXCLUDE_MINISERVER
|
||||||
# define EXCLUDE_MINISERVER 1
|
# define EXCLUDE_MINISERVER 1
|
||||||
@@ -322,6 +416,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0
|
#if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0
|
||||||
# undef EXCLUDE_MINISERVER
|
# undef EXCLUDE_MINISERVER
|
||||||
# define EXCLUDE_MINISERVER 0
|
# define EXCLUDE_MINISERVER 0
|
||||||
@@ -331,13 +426,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#endif /* INTERNAL_CONFIG_H */
|
||||||
# define CLIENTONLY(x) x
|
|
||||||
#else
|
|
||||||
# define CLIENTONLY(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//@}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +1,83 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GENA_H
|
||||||
|
#define GENA_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _GENA_
|
|
||||||
#define _GENA_
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "service_table.h"
|
|
||||||
#include "miniserver.h"
|
|
||||||
#include "uri.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include "ThreadPool.h"
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
#include "client_table.h"
|
#include "client_table.h"
|
||||||
#include "httpparser.h"
|
#include "httpparser.h"
|
||||||
|
#include "miniserver.h"
|
||||||
|
#include "service_table.h"
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
#include "ThreadPool.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
#include "UpnpString.h"
|
||||||
|
#include "uri.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN_C extern "C"
|
#define EXTERN_C extern "C"
|
||||||
#else
|
#else /* __cplusplus */
|
||||||
#ifndef EXTERN_C
|
#ifndef EXTERN_C
|
||||||
#define EXTERN_C
|
#define EXTERN_C
|
||||||
#endif
|
#endif /* EXTERN_C */
|
||||||
#endif
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief XML version comment. Not used because it is not interopeable with
|
||||||
|
* other UPnP vendors.
|
||||||
|
*/
|
||||||
#define XML_VERSION "<?xml version='1.0' encoding='ISO-8859-1' ?>\n"
|
#define XML_VERSION "<?xml version='1.0' encoding='ISO-8859-1' ?>\n"
|
||||||
#define XML_PROPERTYSET_HEADER \
|
#define XML_PROPERTYSET_HEADER \
|
||||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n"
|
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n"
|
||||||
|
|
||||||
|
|
||||||
#define UNABLE_MEMORY "HTTP/1.1 500 Internal Server Error\r\n\r\n"
|
#define UNABLE_MEMORY "HTTP/1.1 500 Internal Server Error\r\n\r\n"
|
||||||
#define UNABLE_SERVICE_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
|
#define UNABLE_SERVICE_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
|
||||||
#define UNABLE_SERVICE_NOT_ACCEPT \
|
#define UNABLE_SERVICE_NOT_ACCEPT "HTTP/1.1 503 Service Not Available\r\n\r\n"
|
||||||
"HTTP/1.1 503 Service Not Available\r\n\r\n"
|
|
||||||
|
|
||||||
|
|
||||||
#define NOT_IMPLEMENTED "HTTP/1.1 501 Not Implemented\r\n\r\n"
|
#define NOT_IMPLEMENTED "HTTP/1.1 501 Not Implemented\r\n\r\n"
|
||||||
@@ -74,6 +92,8 @@
|
|||||||
#define MAX_SECONDS 10
|
#define MAX_SECONDS 10
|
||||||
#define MAX_EVENTS 20
|
#define MAX_EVENTS 20
|
||||||
#define MAX_PORT_SIZE 10
|
#define MAX_PORT_SIZE 10
|
||||||
|
|
||||||
|
|
||||||
#define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
#define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
||||||
#define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
|
#define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
|
||||||
#define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
|
#define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
|
||||||
@@ -82,16 +102,23 @@
|
|||||||
#define GENA_E_NOTIFY_UNACCEPTED UPNP_E_NOTIFY_UNACCEPTED
|
#define GENA_E_NOTIFY_UNACCEPTED UPNP_E_NOTIFY_UNACCEPTED
|
||||||
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
|
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
|
||||||
#define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
|
#define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
|
||||||
|
|
||||||
|
|
||||||
#define XML_ERROR -5
|
#define XML_ERROR -5
|
||||||
#define XML_SUCCESS UPNP_E_SUCCESS
|
#define XML_SUCCESS UPNP_E_SUCCESS
|
||||||
#define GENA_SUCCESS UPNP_E_SUCCESS
|
#define GENA_SUCCESS UPNP_E_SUCCESS
|
||||||
|
|
||||||
|
|
||||||
#define CALLBACK_SUCCESS 0
|
#define CALLBACK_SUCCESS 0
|
||||||
#define DEFAULT_TIMEOUT 1801
|
#define DEFAULT_TIMEOUT 1801
|
||||||
|
|
||||||
|
|
||||||
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||||
|
|
||||||
// Lock the subscription
|
|
||||||
|
/*!
|
||||||
|
* \brief Locks the subscription.
|
||||||
|
*/
|
||||||
#define SubscribeLock() \
|
#define SubscribeLock() \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||||
"Trying Subscribe Lock"); \
|
"Trying Subscribe Lock"); \
|
||||||
@@ -99,7 +126,10 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
|
|||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||||
"Subscribe Lock");
|
"Subscribe Lock");
|
||||||
|
|
||||||
// Unlock the subscription
|
|
||||||
|
/*!
|
||||||
|
* \brief Unlocks the subscription.
|
||||||
|
*/
|
||||||
#define SubscribeUnlock() \
|
#define SubscribeUnlock() \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||||
"Trying Subscribe UnLock"); \
|
"Trying Subscribe UnLock"); \
|
||||||
@@ -108,7 +138,9 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
|
|||||||
"Subscribe UnLock");
|
"Subscribe UnLock");
|
||||||
|
|
||||||
|
|
||||||
// Structure to send NOTIFY message to all subscribed control points
|
/*!
|
||||||
|
* Structure to send NOTIFY message to all subscribed control points
|
||||||
|
*/
|
||||||
typedef struct NOTIFY_THREAD_STRUCT {
|
typedef struct NOTIFY_THREAD_STRUCT {
|
||||||
char *headers;
|
char *headers;
|
||||||
DOMString propertySet;
|
DOMString propertySet;
|
||||||
@@ -121,282 +153,233 @@ typedef struct NOTIFY_THREAD_STRUCT {
|
|||||||
} notify_thread_struct;
|
} notify_thread_struct;
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : genaCallback
|
* \brief This is the callback function called by the miniserver to handle
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN http_parser_t *parser: represents the parse state of the request
|
|
||||||
* IN http_message_t* request: HTTP message containing GENA request
|
|
||||||
* INOUT SOCKINFO *info: Structure containing information about the socket
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This is the callback function called by the miniserver to handle
|
|
||||||
* incoming GENA requests.
|
* incoming GENA requests.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
*/
|
||||||
***************************************************************************/
|
EXTERN_C void genaCallback(
|
||||||
EXTERN_C void genaCallback (IN http_parser_t *parser,
|
/*! [in] represents the parse state of the request */
|
||||||
IN http_message_t* request,
|
http_parser_t *parser,
|
||||||
IN SOCKINFO *info);
|
/*! [in] HTTP message containing GENA request */
|
||||||
|
http_message_t* request,
|
||||||
|
/*! [in,out] Structure containing information about the socket */
|
||||||
|
SOCKINFO *info);
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : genaSubscribe
|
/*!
|
||||||
|
* \brief This function subscribes to a PublisherURL (also mentioned as EventURL
|
||||||
|
* in some places).
|
||||||
*
|
*
|
||||||
* Parameters:
|
* It sends SUBSCRIBE http request to service processes request. Finally adds a
|
||||||
* IN UpnpClient_Handle client_handle:
|
* Subscription to the clients subscription list, if service responds with OK.
|
||||||
* IN char * PublisherURL: NULL Terminated, of the form :
|
|
||||||
* "http://134.134.156.80:4000/RedBulb/Event"
|
|
||||||
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
|
||||||
* in the OUT case: actual Duration granted
|
|
||||||
* by Service, -1 for infinite
|
|
||||||
* OUT Upnp_SID out_sid:sid of subscription, memory passed in by caller
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
|
||||||
* This function subscribes to a PublisherURL ( also mentioned as EventURL
|
* appropriate error code
|
||||||
* some places). It sends SUBSCRIBE http request to service processes
|
*/
|
||||||
* request. Finally adds a Subscription to
|
|
||||||
* the clients subscription list, if service responds with OK
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* return UPNP_E_SUCCESS if service response is OK else
|
|
||||||
* returns appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaSubscribe(
|
EXTERN_C int genaSubscribe(
|
||||||
|
/*! [in] The client handle. */
|
||||||
UpnpClient_Handle client_handle,
|
UpnpClient_Handle client_handle,
|
||||||
char * PublisherURL,
|
/*! [in] Of the form: "http://134.134.156.80:4000/RedBulb/Event */
|
||||||
|
const UpnpString *PublisherURL,
|
||||||
|
/*! [in,out] requested Duration:
|
||||||
|
* \li if -1, then "infinite".
|
||||||
|
* \li in the OUT case: actual Duration granted by Service,
|
||||||
|
* -1 for infinite. */
|
||||||
int *TimeOut,
|
int *TimeOut,
|
||||||
Upnp_SID out_sid );
|
/*! [out] sid of subscription, memory passed in by caller. */
|
||||||
#endif
|
UpnpString *out_sid);
|
||||||
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : genaUnSubscribe
|
* \brief Unsubscribes a SID.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* It first validates the SID and client_handle,copies the subscription, sends
|
||||||
* IN UpnpClient_Handle client_handle: UPnP client handle
|
* UNSUBSCRIBE http request to service processes request and finally removes
|
||||||
* IN SID in_sid: The subscription ID
|
* the subscription.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
|
||||||
* This function unsubscribes a SID. It first validates the SID and
|
* appropriate error code.
|
||||||
* client_handle,copies the subscription, sends UNSUBSCRIBE http request
|
*/
|
||||||
* to service processes request and finally removes the subscription
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* return UPNP_E_SUCCESS if service response is OK else
|
|
||||||
* returns appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaUnSubscribe(
|
EXTERN_C int genaUnSubscribe(
|
||||||
|
/*! [in] UPnP client handle. */
|
||||||
UpnpClient_Handle client_handle,
|
UpnpClient_Handle client_handle,
|
||||||
const Upnp_SID in_sid);
|
/*! [in] The subscription ID. */
|
||||||
#endif
|
const UpnpString *in_sid);
|
||||||
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : genaUnregisterClient
|
/*!
|
||||||
|
* \brief Unsubcribes all the outstanding subscriptions and cleans the
|
||||||
|
* subscription list.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* This function is called when control point unregisters.
|
||||||
* IN UpnpClient_Handle client_handle: Handle containing all the control
|
|
||||||
* point related information
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \returns UPNP_E_SUCCESS if successful, otherwise returns the appropriate
|
||||||
* This function unsubcribes all the outstanding subscriptions and cleans
|
* error code.
|
||||||
* the subscription list. This function is called when control point
|
*/
|
||||||
* unregisters.
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
EXTERN_C int genaUnregisterClient(
|
||||||
#endif
|
/*! [in] Handle containing all the control point related information. */
|
||||||
|
UpnpClient_Handle client_handle);
|
||||||
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
|
|
||||||
//server
|
|
||||||
/************************************************************************
|
/*
|
||||||
* Function : genaUnregisterDevice
|
* DEVICE
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Cleans the service table of the device.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return UPNP_E_SUCCESS if successful, otherwise returns GENA_E_BAD_HANDLE
|
||||||
* IN UpnpDevice_Handle device_handle: Handle of the root device
|
*/
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function cleans the service table of the device.
|
|
||||||
*
|
|
||||||
* Returns: int
|
|
||||||
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
|
||||||
****************************************************************************/
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
EXTERN_C int genaUnregisterDevice(
|
||||||
#endif
|
/*! [in] Handle of the root device */
|
||||||
|
UpnpDevice_Handle device_handle);
|
||||||
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : genaRenewSubscription
|
* \brief Renews a SID.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* It first validates the SID and client_handle and copies the subscription.
|
||||||
* IN UpnpClient_Handle client_handle: Client handle
|
* It sends RENEW (modified SUBSCRIBE) http request to service and processes
|
||||||
* IN const Upnp_SID in_sid: subscription ID
|
|
||||||
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
|
||||||
* in the OUT case: actual Duration granted
|
|
||||||
* by Service, -1 for infinite
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This function renews a SID. It first validates the SID and
|
|
||||||
* client_handle and copies the subscription. It sends RENEW
|
|
||||||
* (modified SUBSCRIBE) http request to service and processes
|
|
||||||
* the response.
|
* the response.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* \return UPNP_E_SUCCESS if service response is OK, otherwise the
|
||||||
* return UPNP_E_SUCCESS if service response is OK else
|
* appropriate error code.
|
||||||
* returns appropriate error
|
*/
|
||||||
***************************************************************************/
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaRenewSubscription(
|
EXTERN_C int genaRenewSubscription(
|
||||||
IN UpnpClient_Handle client_handle,
|
/*! [in] Client handle. */
|
||||||
IN const Upnp_SID in_sid,
|
UpnpClient_Handle client_handle,
|
||||||
OUT int * TimeOut);
|
/*! [in] Subscription ID. */
|
||||||
#endif
|
const UpnpString *in_sid,
|
||||||
/****************************************************************************
|
/*! [in,out] requested Duration, if -1, then "infinite". In the OUT case:
|
||||||
* Function : genaNotifyAll
|
* actual Duration granted by Service, -1 for infinite. */
|
||||||
|
int *TimeOut);
|
||||||
|
#endif /* INCLUDE_CLIENT_APIS */
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Sends a notification to all the subscribed control points.
|
||||||
*
|
*
|
||||||
* Parameters :
|
* \return int
|
||||||
* IN UpnpDevice_Handle device_handle : Device handle
|
|
||||||
* IN char *UDN : Device udn
|
|
||||||
* IN char *servId : Service ID
|
|
||||||
* IN char **VarNames : array of varible names
|
|
||||||
* IN char **VarValues : array of variable values
|
|
||||||
* IN int var_count : number of variables
|
|
||||||
*
|
*
|
||||||
* Description : This function sends a notification to all the subscribed
|
* \note This function is similar to the genaNotifyAllExt. The only difference
|
||||||
* control points
|
|
||||||
*
|
|
||||||
* Return : int
|
|
||||||
*
|
|
||||||
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
|
||||||
* is it takes event variable array instead of xml document.
|
* is it takes event variable array instead of xml document.
|
||||||
****************************************************************************/
|
*/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaNotifyAll(
|
EXTERN_C int genaNotifyAll(
|
||||||
|
/*! [in] Device handle. */
|
||||||
UpnpDevice_Handle device_handle,
|
UpnpDevice_Handle device_handle,
|
||||||
|
/*! [in] Device udn. */
|
||||||
char *UDN,
|
char *UDN,
|
||||||
|
/*! [in] Service ID. */
|
||||||
char *servId,
|
char *servId,
|
||||||
|
/*! [in] Array of varible names. */
|
||||||
char **VarNames,
|
char **VarNames,
|
||||||
|
/*! [in] Array of variable values. */
|
||||||
char **VarValues,
|
char **VarValues,
|
||||||
|
/*! [in] Number of variables. */
|
||||||
int var_count);
|
int var_count);
|
||||||
#endif
|
#endif /* INCLUDE_DEVICE_APIS */
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function : genaNotifyAllExt
|
/*!
|
||||||
|
* \brief Sends a notification to all the subscribed control points.
|
||||||
*
|
*
|
||||||
* Parameters :
|
* \return int
|
||||||
* IN UpnpDevice_Handle device_handle : Device handle
|
|
||||||
* IN char *UDN : Device udn
|
|
||||||
* IN char *servId : Service ID
|
|
||||||
* IN IXML_Document *PropSet : XML document Event varible property set
|
|
||||||
*
|
*
|
||||||
* Description : This function sends a notification to all the subscribed
|
* \note This function is similar to the genaNotifyAll. the only difference
|
||||||
* control points
|
* is it takes the document instead of event variable array.
|
||||||
*
|
*/
|
||||||
* Return : int
|
|
||||||
*
|
|
||||||
* Note : This function is similar to the genaNotifyAll. the only difference
|
|
||||||
* is it takes the document instead of event variable array
|
|
||||||
****************************************************************************/
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaNotifyAllExt(
|
EXTERN_C int genaNotifyAllExt(
|
||||||
|
/*! [in] Device handle. */
|
||||||
UpnpDevice_Handle device_handle,
|
UpnpDevice_Handle device_handle,
|
||||||
|
/*! [in] Device udn. */
|
||||||
char *UDN,
|
char *UDN,
|
||||||
|
/*! [in] Service ID. */
|
||||||
char *servId,
|
char *servId,
|
||||||
IN IXML_Document *PropSet);
|
/*! [in] XML document Event varible property set. */
|
||||||
#endif
|
IXML_Document *PropSet);
|
||||||
|
#endif /* INCLUDE_DEVICE_APIS */
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function : genaInitNotify
|
/*!
|
||||||
|
* \brief Sends the intial state table dump to newly subscribed control point.
|
||||||
*
|
*
|
||||||
* Parameters :
|
* \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
|
||||||
* IN UpnpDevice_Handle device_handle : Device handle
|
|
||||||
* IN char *UDN : Device udn
|
|
||||||
* IN char *servId : Service ID
|
|
||||||
* IN char **VarNames : Array of variable names
|
|
||||||
* IN char **VarValues : Array of variable values
|
|
||||||
* IN int var_count : array size
|
|
||||||
* IN Upnp_SID sid : subscription ID
|
|
||||||
*
|
*
|
||||||
* Description : This function sends the intial state table dump to
|
* \note No other event will be sent to this control point before the
|
||||||
* newly subscribed control point.
|
|
||||||
*
|
|
||||||
* Return : int
|
|
||||||
* returns GENA_E_SUCCESS if successful else returns appropriate error
|
|
||||||
*
|
|
||||||
* Note : No other event will be sent to this control point before the
|
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
****************************************************************************/
|
*/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
EXTERN_C int genaInitNotify(
|
||||||
IN char *UDN,
|
/*! [in] Device handle. */
|
||||||
IN char *servId,
|
UpnpDevice_Handle device_handle,
|
||||||
IN char **VarNames,
|
/*! [in] Device udn. */
|
||||||
IN char **VarValues,
|
char *UDN,
|
||||||
IN int var_count,
|
/*! [in] Service ID. */
|
||||||
IN Upnp_SID sid);
|
char *servId,
|
||||||
#endif
|
/*! [in] Array of variable names. */
|
||||||
|
char **VarNames,
|
||||||
|
/*! [in] Array of variable values. */
|
||||||
|
char **VarValues,
|
||||||
|
/*! [in] Array size. */
|
||||||
|
int var_count,
|
||||||
|
/*! [in] Subscription ID. */
|
||||||
|
const Upnp_SID sid);
|
||||||
|
#endif /* INCLUDE_DEVICE_APIS */
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function : genaInitNotifyExt
|
/*!
|
||||||
|
* \brief Similar to the genaInitNofity. The only difference is that it
|
||||||
|
* takes the xml document for the state table and sends the intial state
|
||||||
|
* table dump to newly subscribed control point.
|
||||||
*
|
*
|
||||||
* Parameters :
|
* \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
|
||||||
* IN UpnpDevice_Handle device_handle : Device handle
|
|
||||||
* IN char *UDN : Device udn
|
|
||||||
* IN char *servId : Service ID
|
|
||||||
* IN IXML_Document *PropSet : Document of the state table
|
|
||||||
* IN Upnp_SID sid : subscription ID
|
|
||||||
*
|
*
|
||||||
* Description : This function is similar to the genaInitNofity. The only
|
* \note No other event will be sent to this control point before the
|
||||||
* difference is that it takes the xml document for the state table and
|
|
||||||
* sends the intial state table dump to newly subscribed control point.
|
|
||||||
*
|
|
||||||
* Return : int
|
|
||||||
* returns GENA_E_SUCCESS if successful else returns appropriate error
|
|
||||||
*
|
|
||||||
* Note : No other event will be sent to this control point before the
|
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
****************************************************************************/
|
*/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaInitNotifyExt(
|
EXTERN_C int genaInitNotifyExt(
|
||||||
IN UpnpDevice_Handle device_handle,
|
/*! [in] Device handle. */
|
||||||
IN char *UDN,
|
UpnpDevice_Handle device_handle,
|
||||||
IN char *servId,
|
/*! [in] Device udn. */
|
||||||
IN IXML_Document *PropSet,
|
char *UDN,
|
||||||
IN Upnp_SID sid);
|
/*! [in] Service ID. */
|
||||||
#endif
|
char *servId,
|
||||||
|
/*! [in] Document of the state table. */
|
||||||
|
IXML_Document *PropSet,
|
||||||
|
/*! [in] subscription ID. */
|
||||||
|
const Upnp_SID sid);
|
||||||
|
#endif /* INCLUDE_DEVICE_APIS */
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/*!
|
||||||
* Function : error_respond
|
* \brief Sends an error message to the control point in the case of incorrect
|
||||||
|
* GENA requests.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
|
||||||
* IN SOCKINFO *info: Structure containing information about the socket
|
*/
|
||||||
* IN int error_code: error code that will be in the GENA response
|
void error_respond(
|
||||||
* IN http_message_t* hmsg: GENA request Packet
|
/*! [in] Structure containing information about the socket. */
|
||||||
*
|
SOCKINFO *info,
|
||||||
* Description:
|
/*! [in] error code that will be in the GENA response. */
|
||||||
* This function send an error message to the control point in the case
|
int error_code,
|
||||||
* incorrect GENA requests.
|
/*! [in] GENA request Packet. */
|
||||||
*
|
http_message_t* hmsg);
|
||||||
* Returns: int
|
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
|
||||||
***************************************************************************/
|
|
||||||
void error_respond( IN SOCKINFO *info, IN int error_code,
|
|
||||||
IN http_message_t* hmsg );
|
|
||||||
|
|
||||||
|
|
||||||
#endif // GENA
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* GENA_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,49 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GENA_CTRLPT_H
|
||||||
|
#define GENA_CTRLPT_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* Function : gena_process_notification_event
|
/*!
|
||||||
|
* \brief This function processes NOTIFY events that are sent by devices.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN SOCKINFO *info: Socket structure containing the device socket
|
* IN SOCKINFO *info: Socket structure containing the device socket
|
||||||
@@ -40,13 +51,14 @@
|
|||||||
* IN http_message_t *event: The http message contains the GENA
|
* IN http_message_t *event: The http message contains the GENA
|
||||||
* notification
|
* notification
|
||||||
*
|
*
|
||||||
* Description:
|
* \note called by genacallback()
|
||||||
* This function processes NOTIFY events that are sent by devices.
|
*/
|
||||||
* called by genacallback()
|
void gena_process_notification_event(
|
||||||
*
|
/*! [in] Socket info of the device. */
|
||||||
* Returns: void
|
SOCKINFO *info,
|
||||||
*
|
/*! [in] The http message contains the GENA notification. */
|
||||||
* Note : called by genacallback()
|
http_message_t *event);
|
||||||
****************************************************************************/
|
|
||||||
void gena_process_notification_event( INOUT SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
#endif /* GENA_CTRLPT_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,88 +1,79 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GENA_DEVICE_H
|
||||||
|
#define GENA_DEVICE_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function : gena_process_subscription_request
|
/*!
|
||||||
*
|
* \brief Handles a subscription request from a ctrl point. The socket is not
|
||||||
* Parameters :
|
* closed on return.
|
||||||
* IN SOCKINFO *info : socket info of the device
|
*/
|
||||||
* IN http_message_t* request : SUBSCRIPTION request from the control
|
void gena_process_subscription_request(
|
||||||
* point
|
/*! [in] Socket info of the device. */
|
||||||
*
|
SOCKINFO *info,
|
||||||
* Description : This function handles a subscription request from a
|
/*! [in] Subscription request from the control point. */
|
||||||
* ctrl point. The socket is not closed on return.
|
http_message_t *request);
|
||||||
*
|
|
||||||
* Return : void
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
****************************************************************************/
|
|
||||||
void gena_process_subscription_request( IN SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function : gena_process_subscription_renewal_request
|
* \brief Handles a subscription renewal request from a ctrl point.
|
||||||
*
|
* The connection is not destroyed on return.
|
||||||
* Parameters :
|
*/
|
||||||
* IN SOCKINFO *info : socket info of the device
|
void gena_process_subscription_renewal_request(
|
||||||
* IN http_message_t* request : subscription renewal request from the
|
/*! [in] Socket info of the device. */
|
||||||
* control point
|
SOCKINFO *info,
|
||||||
*
|
/*! [in] Subscription renewal request from the control point. */
|
||||||
* Description : This function handles a subscription renewal request
|
http_message_t *request);
|
||||||
* from a ctrl point. The connection is not destroyed on return.
|
|
||||||
*
|
|
||||||
* Return : void
|
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
****************************************************************************/
|
|
||||||
void gena_process_subscription_renewal_request( IN SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function : gena_process_unsubscribe_request
|
* \brief Handles a subscription cancellation request from a ctrl point.
|
||||||
*
|
* The connection is not destroyed on return.
|
||||||
* Parameters :
|
*/
|
||||||
* IN SOCKINFO *info : socket info of the device
|
void gena_process_unsubscribe_request(
|
||||||
* IN http_message_t* request : UNSUBSCRIBE request from the control
|
/*! [in] Socket info of the device. */
|
||||||
* point
|
SOCKINFO *info,
|
||||||
*
|
/*! [in] UNSUBSCRIBE request from the control point. */
|
||||||
* Description : This function Handles a subscription cancellation request
|
http_message_t *request);
|
||||||
* from a ctrl point. The connection is not destroyed on return.
|
|
||||||
*
|
|
||||||
* Return : void
|
#endif /* GENA_DEVICE_H */
|
||||||
*
|
|
||||||
* Note :
|
|
||||||
****************************************************************************/
|
|
||||||
void gena_process_unsubscribe_request( IN SOCKINFO *info,
|
|
||||||
IN http_message_t* request );
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user