Compare commits
352 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79aa205657 | ||
|
|
9a28fcc95b | ||
|
|
bfbd07cb40 | ||
|
|
255d5ee874 | ||
|
|
2c3bce13bd | ||
|
|
bda942b22a | ||
|
|
ed0ebe1588 | ||
|
|
a39f3a63c3 | ||
|
|
6e7a2bb2dc | ||
|
|
c21a67f2d1 | ||
|
|
c449fd1521 | ||
|
|
594c611a33 | ||
|
|
09f2b6ca30 | ||
|
|
9b3a0999a9 | ||
|
|
d8a27bca96 | ||
|
|
6bee05a517 | ||
|
|
2e96edcbc5 | ||
|
|
ef0aa38958 | ||
|
|
86159bc2a6 | ||
|
|
bd8d6cfc8b | ||
|
|
8434e1e936 | ||
|
|
2765bc39c5 | ||
|
|
75695fcaf1 | ||
|
|
5abd1a3b3e | ||
|
|
6c31683e29 | ||
|
|
d92e26779a | ||
|
|
5d6bcabd45 | ||
|
|
7c524df1d9 | ||
|
|
58c694f57d | ||
|
|
da7f3bf1c1 | ||
|
|
8651174861 | ||
|
|
2dd19e5894 | ||
|
|
e6c548f57a | ||
|
|
32cffb5bb5 | ||
|
|
2b30575ca5 | ||
|
|
d32212a6fd | ||
|
|
508b782c79 | ||
|
|
38d5e58e22 | ||
|
|
ee5bd670d4 | ||
|
|
fcb5e7c438 | ||
|
|
243cd41974 | ||
|
|
853cd32cfe | ||
|
|
f384e54fc6 | ||
|
|
9e12768cdb | ||
|
|
4b47e6a51d | ||
|
|
a5fb5edfc9 | ||
|
|
8bd32d330b | ||
|
|
00eb52cc85 | ||
|
|
ff006272b5 | ||
|
|
852c301c5c | ||
|
|
d270499cd8 | ||
|
|
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 | ||
|
|
1eeaf99b83 | ||
|
|
f6dd5062fe | ||
|
|
7d4a610b93 | ||
|
|
0a074d1989 | ||
|
|
0475a46680 | ||
|
|
2a76749682 | ||
|
|
e4bcf18599 | ||
|
|
c856356414 | ||
|
|
6acffb7ede | ||
|
|
837f31bacd | ||
|
|
5151d45203 | ||
|
|
114389589d | ||
|
|
b817ec5152 | ||
|
|
d9de9a486c | ||
|
|
13ebb40e08 | ||
|
|
b614c81e94 | ||
|
|
53766465a9 | ||
|
|
9bc187d4c6 | ||
|
|
80517f26a6 | ||
|
|
468cb2a908 | ||
|
|
d71db4c57c | ||
|
|
947dfd9a85 | ||
|
|
8f7fd0fc6d | ||
|
|
81635d74c1 | ||
|
|
d8ba182d85 | ||
|
|
0a41ee988b | ||
|
|
907eb0636a | ||
|
|
80fc7c3bb0 | ||
|
|
83fb96fbe2 | ||
|
|
4e1240a0a8 | ||
|
|
2c1dba2942 | ||
|
|
4ceb6c67d1 | ||
|
|
3fa207984a | ||
|
|
b82c9c6009 | ||
|
|
b1f6e83380 | ||
|
|
00a33f5788 | ||
|
|
dfec187e88 | ||
|
|
dee3e96a63 | ||
|
|
23e8160417 | ||
|
|
99e11d4fd5 | ||
|
|
fb4e7f659d | ||
|
|
28799f26c9 | ||
|
|
c1e5e4d6a4 | ||
|
|
c0d9908afe | ||
|
|
e80cc3ac64 | ||
|
|
e04192e1d0 | ||
|
|
bbe85ef599 | ||
|
|
5c0893928c | ||
|
|
948c959be5 | ||
|
|
f8c4d81ee5 | ||
|
|
286a45d4ad | ||
|
|
59e0e015be | ||
|
|
bdda54a66b | ||
|
|
41cb45146c | ||
|
|
2c2a5f7c18 | ||
|
|
047b9534bb | ||
|
|
88076a3c4b | ||
|
|
c3060e0d0b | ||
|
|
2ac3819f8c | ||
|
|
0d451c9c8e | ||
|
|
bbd16d75ed | ||
|
|
a225d3b54e | ||
|
|
08834bf0f0 | ||
|
|
e31fcce11d | ||
|
|
dce8f71256 | ||
|
|
7a359f29e3 | ||
|
|
ed9a594e73 | ||
|
|
039b5fdae6 | ||
|
|
f07bcb749f | ||
|
|
f64c539395 | ||
|
|
cab8e4f799 | ||
|
|
2331839f69 | ||
|
|
363ac6e007 | ||
|
|
5c4e45fb4d | ||
|
|
436bc8fc6d | ||
|
|
c6d3d63223 | ||
|
|
ae7ca6a2cf | ||
|
|
9595ddcf3a | ||
|
|
fd19d54144 | ||
|
|
17db87ab96 | ||
|
|
3b12ced1f8 | ||
|
|
4abbd5a8a4 | ||
|
|
836069f43b | ||
|
|
353a876a54 | ||
|
|
2bc6a1f8dd | ||
|
|
1d9e8712b7 | ||
|
|
819ad1f365 | ||
|
|
e9e8ea5636 | ||
|
|
14f72e1442 | ||
|
|
ae13c481a7 | ||
|
|
38a91fdaec | ||
|
|
87f336c940 | ||
|
|
74d2b0049b | ||
|
|
635d6ffa93 | ||
|
|
8c56f16607 | ||
|
|
5d3ef166c1 | ||
|
|
a4072c19b1 | ||
|
|
1716c7a10d | ||
|
|
83782e8ae2 | ||
|
|
f1cc7db79d | ||
|
|
e69d5a8609 | ||
|
|
16637892e3 | ||
|
|
d19a57c866 | ||
|
|
8c21b2c4d9 | ||
|
|
736efca5dd | ||
|
|
d5449dc948 | ||
|
|
7c49b3b8a4 | ||
|
|
5c03ebe6e1 | ||
|
|
d17eb5fcfc | ||
|
|
8625298899 | ||
|
|
864d3db0ad | ||
|
|
1d4d1ff87e | ||
|
|
a26769b27b | ||
|
|
fbbec55457 | ||
|
|
8245b0d808 | ||
|
|
815d08420a | ||
|
|
1d0ce01f31 | ||
|
|
947896bcee | ||
|
|
7ed934d858 | ||
|
|
4a7708331c | ||
|
|
ab66940a89 | ||
|
|
ebac5fe596 | ||
|
|
11de68d0e3 | ||
|
|
dfe3071af4 | ||
|
|
cd50cb678f | ||
|
|
f13fd3d522 | ||
|
|
927b86545f | ||
|
|
a155612cba | ||
|
|
df3df9eaed | ||
|
|
eefeb86a96 | ||
|
|
0452011b99 | ||
|
|
a20707485d | ||
|
|
ec86a6f92b | ||
|
|
89e7a40fcc | ||
|
|
90c3db2a96 | ||
|
|
cf9ae4f6e5 | ||
|
|
f28f81f820 | ||
|
|
bcaba51f57 | ||
|
|
4c5b61dc55 | ||
|
|
9147c3517e | ||
|
|
cbefc2ff49 | ||
|
|
863e743c41 | ||
|
|
26bde09028 | ||
|
|
bc2941c2a7 | ||
|
|
40186d3e9c | ||
|
|
01d26f8f74 | ||
|
|
b2cb458ee3 | ||
|
|
16da6980d1 | ||
|
|
211973749c | ||
|
|
a22ba2f159 | ||
|
|
142929623d | ||
|
|
3170fbd730 |
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/tv_combo
|
||||||
|
upnp/sample/tv_ctrlpt
|
||||||
|
upnp/sample/tv_device
|
||||||
|
docs/doxygen
|
||||||
|
|
||||||
30
Makefile.am
30
Makefile.am
@@ -1,18 +1,22 @@
|
|||||||
# $Id: Makefile.am,v 1.5 2006/04/29 20:12:50 r3mi Exp $
|
|
||||||
#
|
#
|
||||||
# Top-level "Makefile.am" for libupnp
|
# Top-level "Makefile.am" for libupnp
|
||||||
#
|
#
|
||||||
# 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
|
||||||
|
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-samples
|
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-samples
|
||||||
|
|
||||||
SUBDIRS = ixml threadutil upnp docs/dist
|
SUBDIRS = \
|
||||||
|
ixml \
|
||||||
|
threadutil \
|
||||||
|
upnp \
|
||||||
|
docs/dist
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
|
Doxyfile \
|
||||||
libupnp.pc.in \
|
libupnp.pc.in \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
THANKS \
|
THANKS \
|
||||||
@@ -22,8 +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/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
|
||||||
@@ -31,6 +50,7 @@ EXTRA_DIST = \
|
|||||||
pkgconfigexecdir = $(libdir)/pkgconfig
|
pkgconfigexecdir = $(libdir)/pkgconfig
|
||||||
pkgconfigexec_DATA = libupnp.pc
|
pkgconfigexec_DATA = libupnp.pc
|
||||||
|
|
||||||
|
|
||||||
$(pkgconfigexec_DATA): config.status
|
$(pkgconfigexec_DATA): config.status
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
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.
|
||||||
|
|||||||
43
THANKS
43
THANKS
@@ -6,25 +6,58 @@ suggesting various improvements or submitting actual code.
|
|||||||
Here is a list of these people. Help us keep it complete and
|
Here is a list of these people. Help us keep it complete and
|
||||||
exempt of errors.
|
exempt of errors.
|
||||||
|
|
||||||
|
- Alex (afaucher)
|
||||||
|
- Andre Sodermans (wienerschnitzel)
|
||||||
|
- Anthony Viallard (homer242)
|
||||||
|
- Apostolos Syropoulos
|
||||||
- Arno Willig
|
- Arno Willig
|
||||||
|
- Bob Ciora
|
||||||
|
- Carlo Parata
|
||||||
|
- Carl Benson
|
||||||
|
- Chandra (inactiveneurons)
|
||||||
- Chaos
|
- Chaos
|
||||||
|
- Charles Nepveu (cnepveu)
|
||||||
|
- Chris Pickel
|
||||||
|
- Chuck Thomason (cyt4)
|
||||||
|
- Craig Nelson
|
||||||
|
- David Blanchet
|
||||||
- David Maass
|
- David Maass
|
||||||
- Emil Ljungdahl
|
- Emil Ljungdahl
|
||||||
- Erik Johansson
|
- Erik Johansson
|
||||||
- Eric Tanguy
|
- Eric Tanguy
|
||||||
- Erwan Velu
|
- Erwan Velu
|
||||||
|
- Eugene Christensen
|
||||||
|
- Fabrice Fontaine
|
||||||
- Fredrik Svensson
|
- Fredrik Svensson
|
||||||
|
- Glen Masgai
|
||||||
|
- Hartmut Holzgraefe (hholzgra)
|
||||||
|
- Ingo Hofmann
|
||||||
- Jiri Zouhar
|
- Jiri Zouhar
|
||||||
- John Dennis
|
- John Dennis
|
||||||
- Jonathan (no_dice)
|
- Jonathan Casiot (no_dice)
|
||||||
|
- Josh Carroll
|
||||||
|
- Juergen Lock
|
||||||
|
- Keith Brindley
|
||||||
- Leuk_He
|
- Leuk_He
|
||||||
- Loigu
|
- Loigu
|
||||||
- Luke Kim
|
- Luke Kim (nereusuj)
|
||||||
- Marcelo Roberto Jimenez
|
- Marcelo Roberto Jimenez (mroberto)
|
||||||
- Markus Strobl
|
- Markus Strobl
|
||||||
- Nektarios K. Papadopoulos
|
- Nektarios K. Papadopoulos (npapadop)
|
||||||
|
- Nicholas Kraft
|
||||||
|
- Nick Leverton (leveret)
|
||||||
|
- Obata Akio (obache)
|
||||||
- Oskar Liljeblad
|
- Oskar Liljeblad
|
||||||
- Michael (Oxy)
|
- Michael (oxygenic)
|
||||||
- Paul Vixie
|
- Paul Vixie
|
||||||
|
- Peter Hartley
|
||||||
|
- Rene Hexel
|
||||||
|
- Robert Gingher (robsbox)
|
||||||
|
- Ronan Menard
|
||||||
- Siva Chandran
|
- Siva Chandran
|
||||||
|
- Stefan Sommerfeld (zerocom)
|
||||||
|
- Stéphane Corthésy
|
||||||
|
- Steve Bresson
|
||||||
|
- Timothy Redaelli
|
||||||
|
- Titus Winters
|
||||||
|
|
||||||
|
|||||||
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 ?
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,3 @@ autoreconf --force --install -Wall -Wno-obsolete $* || exit 1
|
|||||||
echo "Now run ./configure and then make."
|
echo "Now run ./configure and then make."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* autoconfig.h. Generated by configure. */
|
/* autoconfig.h. Generated from autoconfig.h.in by configure. */
|
||||||
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
|
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
/* Define to 1 to compile debug code */
|
/* Define to 1 to compile debug code */
|
||||||
@@ -25,9 +25,6 @@
|
|||||||
/* Define to 1 if you have the <limits.h> header file. */
|
/* Define to 1 if you have the <limits.h> header file. */
|
||||||
#define HAVE_LIMITS_H 1
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <malloc.h> header file. */
|
|
||||||
#define HAVE_MALLOC_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#define HAVE_MEMORY_H 1
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
@@ -64,9 +61,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
|
||||||
|
|
||||||
@@ -79,6 +73,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
|
||||||
|
|
||||||
@@ -92,19 +93,19 @@
|
|||||||
#define PACKAGE "libupnp"
|
#define PACKAGE "libupnp"
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
#define PACKAGE_BUGREPORT "virtual_worlds@gmx.de"
|
#define PACKAGE_BUGREPORT "mroberto@users.sourceforge.net"
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
/* Define to the full name of this package. */
|
||||||
#define PACKAGE_NAME "libupnp"
|
#define PACKAGE_NAME "libupnp"
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
/* Define to the full name and version of this package. */
|
||||||
#define PACKAGE_STRING "libupnp 1.4.0"
|
#define PACKAGE_STRING "libupnp 1.6.10"
|
||||||
|
|
||||||
/* 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.0"
|
#define PACKAGE_VERSION "1.6.10"
|
||||||
|
|
||||||
/* 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. */
|
||||||
@@ -113,6 +114,15 @@
|
|||||||
/* 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 */
|
||||||
|
#define UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS 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
|
||||||
|
|
||||||
@@ -128,35 +138,41 @@
|
|||||||
/* 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 0
|
#define UPNP_VERSION_PATCH 10
|
||||||
|
|
||||||
/* see upnpconfig.h */
|
/* see upnpconfig.h */
|
||||||
#define UPNP_VERSION_STRING "1.4.0"
|
#define UPNP_VERSION_STRING "1.6.10"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#define VERSION "1.4.0"
|
#define VERSION "1.6.10"
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
/* File Offset size */
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
||||||
/* #undef _LARGEFILE_SOURCE */
|
#define _LARGEFILE_SOURCE 1
|
||||||
|
|
||||||
/* Define for large files, on AIX-style hosts. */
|
/* Large files support */
|
||||||
/* #undef _LARGE_FILES */
|
#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 */
|
||||||
|
|
||||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
/* Define to `long int' if <sys/types.h> does not define. */
|
||||||
|
/* #undef off_t */
|
||||||
|
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
/* #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,361 +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"
|
|
||||||
|
|
||||||
#define MAX_JOBS_TOTAL 10
|
|
||||||
|
|
||||||
/** @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 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/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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @name DBGONLY
|
|
||||||
The {\bf DBGONLY} macro allows code to be marked so that it
|
|
||||||
is only included in the DEBUG build and not the release. To
|
|
||||||
use this macro, put the code inside of the parentheses:
|
|
||||||
|
|
||||||
{\tt DBGONLY(int i;)}
|
|
||||||
|
|
||||||
This will cause a declaration of the integer {\tt i} only
|
|
||||||
in the debug build.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//@{
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define DBGONLY(x) x
|
|
||||||
#else
|
|
||||||
#define DBGONLY(x)
|
|
||||||
#endif
|
|
||||||
//@}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef EXCLUDE_WEB_SERVER
|
|
||||||
#undef EXCLUDE_MINISERVER
|
|
||||||
#ifdef INTERNAL_WEB_SERVER
|
|
||||||
#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
|
|
||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
|
||||||
#define DEVICEONLY(x) x
|
|
||||||
#else
|
|
||||||
#define DEVICEONLY(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//@}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,35 +1,35 @@
|
|||||||
/* upnp/inc/upnpconfig.h. Generated 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.0"
|
#define UPNP_VERSION_STRING "1.6.10"
|
||||||
|
|
||||||
/** 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 0
|
#define UPNP_VERSION_PATCH 10
|
||||||
|
|
||||||
/** 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 \
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
/** Defined to 1 if the library has been compiled with DEBUG enabled
|
/** Defined to 1 if the library has been compiled with DEBUG enabled
|
||||||
* (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */
|
* (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */
|
||||||
#undef UPNP_HAVE_DEBUG
|
/* #undef UPNP_HAVE_DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/** Defined to 1 if the library has been compiled with client API enabled
|
/** Defined to 1 if the library has been compiled with client API enabled
|
||||||
@@ -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
|
||||||
|
|||||||
301
build/msvc/inttypes.h
Normal file
301
build/msvc/inttypes.h
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
|
||||||
|
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||||
|
//
|
||||||
|
// Copyright (c) 2006 Alexander Chemeris
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// 3. The name of the author may be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _MSC_VER // [
|
||||||
|
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||||
|
#endif // _MSC_VER ]
|
||||||
|
|
||||||
|
#ifndef _MSC_INTTYPES_H_ // [
|
||||||
|
#define _MSC_INTTYPES_H_
|
||||||
|
|
||||||
|
#if _MSC_VER > 1000
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// 7.8 Format conversion of integer types
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
intmax_t quot;
|
||||||
|
intmax_t rem;
|
||||||
|
} imaxdiv_t;
|
||||||
|
|
||||||
|
// 7.8.1 Macros for format specifiers
|
||||||
|
|
||||||
|
// The fprintf macros for signed integers are:
|
||||||
|
#define PRId8 "d"
|
||||||
|
#define PRIi8 "i"
|
||||||
|
#define PRIdLEAST8 "d"
|
||||||
|
#define PRIiLEAST8 "i"
|
||||||
|
#define PRIdFAST8 "d"
|
||||||
|
#define PRIiFAST8 "i"
|
||||||
|
|
||||||
|
#define PRId16 "hd"
|
||||||
|
#define PRIi16 "hi"
|
||||||
|
#define PRIdLEAST16 "hd"
|
||||||
|
#define PRIiLEAST16 "hi"
|
||||||
|
#define PRIdFAST16 "hd"
|
||||||
|
#define PRIiFAST16 "hi"
|
||||||
|
|
||||||
|
#define PRId32 "I32d"
|
||||||
|
#define PRIi32 "I32i"
|
||||||
|
#define PRIdLEAST32 "I32d"
|
||||||
|
#define PRIiLEAST32 "I32i"
|
||||||
|
#define PRIdFAST32 "I32d"
|
||||||
|
#define PRIiFAST32 "I32i"
|
||||||
|
|
||||||
|
#define PRId64 "I64d"
|
||||||
|
#define PRIi64 "I64i"
|
||||||
|
#define PRIdLEAST64 "I64d"
|
||||||
|
#define PRIiLEAST64 "I64i"
|
||||||
|
#define PRIdFAST64 "I64d"
|
||||||
|
#define PRIiFAST64 "I64i"
|
||||||
|
|
||||||
|
#define PRIdMAX "I64d"
|
||||||
|
#define PRIiMAX "I64i"
|
||||||
|
|
||||||
|
#define PRIdPTR "Id"
|
||||||
|
#define PRIiPTR "Ii"
|
||||||
|
|
||||||
|
// The fprintf macros for unsigned integers are:
|
||||||
|
#define PRIo8 "o"
|
||||||
|
#define PRIu8 "u"
|
||||||
|
#define PRIx8 "x"
|
||||||
|
#define PRIX8 "X"
|
||||||
|
#define PRIoLEAST8 "o"
|
||||||
|
#define PRIuLEAST8 "u"
|
||||||
|
#define PRIxLEAST8 "x"
|
||||||
|
#define PRIXLEAST8 "X"
|
||||||
|
#define PRIoFAST8 "o"
|
||||||
|
#define PRIuFAST8 "u"
|
||||||
|
#define PRIxFAST8 "x"
|
||||||
|
#define PRIXFAST8 "X"
|
||||||
|
|
||||||
|
#define PRIo16 "ho"
|
||||||
|
#define PRIu16 "hu"
|
||||||
|
#define PRIx16 "hx"
|
||||||
|
#define PRIX16 "hX"
|
||||||
|
#define PRIoLEAST16 "ho"
|
||||||
|
#define PRIuLEAST16 "hu"
|
||||||
|
#define PRIxLEAST16 "hx"
|
||||||
|
#define PRIXLEAST16 "hX"
|
||||||
|
#define PRIoFAST16 "ho"
|
||||||
|
#define PRIuFAST16 "hu"
|
||||||
|
#define PRIxFAST16 "hx"
|
||||||
|
#define PRIXFAST16 "hX"
|
||||||
|
|
||||||
|
#define PRIo32 "I32o"
|
||||||
|
#define PRIu32 "I32u"
|
||||||
|
#define PRIx32 "I32x"
|
||||||
|
#define PRIX32 "I32X"
|
||||||
|
#define PRIoLEAST32 "I32o"
|
||||||
|
#define PRIuLEAST32 "I32u"
|
||||||
|
#define PRIxLEAST32 "I32x"
|
||||||
|
#define PRIXLEAST32 "I32X"
|
||||||
|
#define PRIoFAST32 "I32o"
|
||||||
|
#define PRIuFAST32 "I32u"
|
||||||
|
#define PRIxFAST32 "I32x"
|
||||||
|
#define PRIXFAST32 "I32X"
|
||||||
|
|
||||||
|
#define PRIo64 "I64o"
|
||||||
|
#define PRIu64 "I64u"
|
||||||
|
#define PRIx64 "I64x"
|
||||||
|
#define PRIX64 "I64X"
|
||||||
|
#define PRIoLEAST64 "I64o"
|
||||||
|
#define PRIuLEAST64 "I64u"
|
||||||
|
#define PRIxLEAST64 "I64x"
|
||||||
|
#define PRIXLEAST64 "I64X"
|
||||||
|
#define PRIoFAST64 "I64o"
|
||||||
|
#define PRIuFAST64 "I64u"
|
||||||
|
#define PRIxFAST64 "I64x"
|
||||||
|
#define PRIXFAST64 "I64X"
|
||||||
|
|
||||||
|
#define PRIoMAX "I64o"
|
||||||
|
#define PRIuMAX "I64u"
|
||||||
|
#define PRIxMAX "I64x"
|
||||||
|
#define PRIXMAX "I64X"
|
||||||
|
|
||||||
|
#define PRIoPTR "Io"
|
||||||
|
#define PRIuPTR "Iu"
|
||||||
|
#define PRIxPTR "Ix"
|
||||||
|
#define PRIXPTR "IX"
|
||||||
|
|
||||||
|
// The fscanf macros for signed integers are:
|
||||||
|
#define SCNd8 "d"
|
||||||
|
#define SCNi8 "i"
|
||||||
|
#define SCNdLEAST8 "d"
|
||||||
|
#define SCNiLEAST8 "i"
|
||||||
|
#define SCNdFAST8 "d"
|
||||||
|
#define SCNiFAST8 "i"
|
||||||
|
|
||||||
|
#define SCNd16 "hd"
|
||||||
|
#define SCNi16 "hi"
|
||||||
|
#define SCNdLEAST16 "hd"
|
||||||
|
#define SCNiLEAST16 "hi"
|
||||||
|
#define SCNdFAST16 "hd"
|
||||||
|
#define SCNiFAST16 "hi"
|
||||||
|
|
||||||
|
#define SCNd32 "ld"
|
||||||
|
#define SCNi32 "li"
|
||||||
|
#define SCNdLEAST32 "ld"
|
||||||
|
#define SCNiLEAST32 "li"
|
||||||
|
#define SCNdFAST32 "ld"
|
||||||
|
#define SCNiFAST32 "li"
|
||||||
|
|
||||||
|
#define SCNd64 "I64d"
|
||||||
|
#define SCNi64 "I64i"
|
||||||
|
#define SCNdLEAST64 "I64d"
|
||||||
|
#define SCNiLEAST64 "I64i"
|
||||||
|
#define SCNdFAST64 "I64d"
|
||||||
|
#define SCNiFAST64 "I64i"
|
||||||
|
|
||||||
|
#define SCNdMAX "I64d"
|
||||||
|
#define SCNiMAX "I64i"
|
||||||
|
|
||||||
|
#ifdef _WIN64 // [
|
||||||
|
# define SCNdPTR "I64d"
|
||||||
|
# define SCNiPTR "I64i"
|
||||||
|
#else // _WIN64 ][
|
||||||
|
# define SCNdPTR "ld"
|
||||||
|
# define SCNiPTR "li"
|
||||||
|
#endif // _WIN64 ]
|
||||||
|
|
||||||
|
// The fscanf macros for unsigned integers are:
|
||||||
|
#define SCNo8 "o"
|
||||||
|
#define SCNu8 "u"
|
||||||
|
#define SCNx8 "x"
|
||||||
|
#define SCNX8 "X"
|
||||||
|
#define SCNoLEAST8 "o"
|
||||||
|
#define SCNuLEAST8 "u"
|
||||||
|
#define SCNxLEAST8 "x"
|
||||||
|
#define SCNXLEAST8 "X"
|
||||||
|
#define SCNoFAST8 "o"
|
||||||
|
#define SCNuFAST8 "u"
|
||||||
|
#define SCNxFAST8 "x"
|
||||||
|
#define SCNXFAST8 "X"
|
||||||
|
|
||||||
|
#define SCNo16 "ho"
|
||||||
|
#define SCNu16 "hu"
|
||||||
|
#define SCNx16 "hx"
|
||||||
|
#define SCNX16 "hX"
|
||||||
|
#define SCNoLEAST16 "ho"
|
||||||
|
#define SCNuLEAST16 "hu"
|
||||||
|
#define SCNxLEAST16 "hx"
|
||||||
|
#define SCNXLEAST16 "hX"
|
||||||
|
#define SCNoFAST16 "ho"
|
||||||
|
#define SCNuFAST16 "hu"
|
||||||
|
#define SCNxFAST16 "hx"
|
||||||
|
#define SCNXFAST16 "hX"
|
||||||
|
|
||||||
|
#define SCNo32 "lo"
|
||||||
|
#define SCNu32 "lu"
|
||||||
|
#define SCNx32 "lx"
|
||||||
|
#define SCNX32 "lX"
|
||||||
|
#define SCNoLEAST32 "lo"
|
||||||
|
#define SCNuLEAST32 "lu"
|
||||||
|
#define SCNxLEAST32 "lx"
|
||||||
|
#define SCNXLEAST32 "lX"
|
||||||
|
#define SCNoFAST32 "lo"
|
||||||
|
#define SCNuFAST32 "lu"
|
||||||
|
#define SCNxFAST32 "lx"
|
||||||
|
#define SCNXFAST32 "lX"
|
||||||
|
|
||||||
|
#define SCNo64 "I64o"
|
||||||
|
#define SCNu64 "I64u"
|
||||||
|
#define SCNx64 "I64x"
|
||||||
|
#define SCNX64 "I64X"
|
||||||
|
#define SCNoLEAST64 "I64o"
|
||||||
|
#define SCNuLEAST64 "I64u"
|
||||||
|
#define SCNxLEAST64 "I64x"
|
||||||
|
#define SCNXLEAST64 "I64X"
|
||||||
|
#define SCNoFAST64 "I64o"
|
||||||
|
#define SCNuFAST64 "I64u"
|
||||||
|
#define SCNxFAST64 "I64x"
|
||||||
|
#define SCNXFAST64 "I64X"
|
||||||
|
|
||||||
|
#define SCNoMAX "I64o"
|
||||||
|
#define SCNuMAX "I64u"
|
||||||
|
#define SCNxMAX "I64x"
|
||||||
|
#define SCNXMAX "I64X"
|
||||||
|
|
||||||
|
#ifdef _WIN64 // [
|
||||||
|
# define SCNoPTR "I64o"
|
||||||
|
# define SCNuPTR "I64u"
|
||||||
|
# define SCNxPTR "I64x"
|
||||||
|
# define SCNXPTR "I64X"
|
||||||
|
#else // _WIN64 ][
|
||||||
|
# define SCNoPTR "lo"
|
||||||
|
# define SCNuPTR "lu"
|
||||||
|
# define SCNxPTR "lx"
|
||||||
|
# define SCNXPTR "lX"
|
||||||
|
#endif // _WIN64 ]
|
||||||
|
|
||||||
|
// 7.8.2 Functions for greatest-width integer types
|
||||||
|
|
||||||
|
// 7.8.2.1 The imaxabs function
|
||||||
|
#define imaxabs _abs64
|
||||||
|
|
||||||
|
// 7.8.2.2 The imaxdiv function
|
||||||
|
|
||||||
|
// This is modified version of div() function from Microsoft's div.c found
|
||||||
|
// in %MSVC.NET%\crt\src\div.c
|
||||||
|
#ifdef STATIC_IMAXDIV // [
|
||||||
|
static
|
||||||
|
#else // STATIC_IMAXDIV ][
|
||||||
|
_inline
|
||||||
|
#endif // STATIC_IMAXDIV ]
|
||||||
|
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
|
||||||
|
{
|
||||||
|
imaxdiv_t result;
|
||||||
|
|
||||||
|
result.quot = numer / denom;
|
||||||
|
result.rem = numer % denom;
|
||||||
|
|
||||||
|
if (numer < 0 && result.rem > 0) {
|
||||||
|
// did division wrong; must fix up
|
||||||
|
++result.quot;
|
||||||
|
result.rem -= denom;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7.8.2.3 The strtoimax and strtoumax functions
|
||||||
|
#define strtoimax _strtoi64
|
||||||
|
#define strtoumax _strtoui64
|
||||||
|
|
||||||
|
// 7.8.2.4 The wcstoimax and wcstoumax functions
|
||||||
|
#define wcstoimax _wcstoi64
|
||||||
|
#define wcstoumax _wcstoui64
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _MSC_INTTYPES_H_ ]
|
||||||
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>
|
||||||
438
configure.ac
438
configure.ac
@@ -1,53 +1,243 @@
|
|||||||
# -*- Autoconf -*-
|
# -*- Autoconf -*-
|
||||||
# $Id: configure.ac,v 1.11 2006/04/09 13:59:44 r3mi Exp $
|
|
||||||
#
|
#
|
||||||
# Top-level configure.ac file for libupnp
|
# Top-level configure.ac file for libupnp
|
||||||
#
|
#
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
#
|
#
|
||||||
# (C) Copyright 2005-2006 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.4.4], [mroberto@users.sourceforge.net])
|
AC_INIT([libupnp], [1.6.10], [mroberto@users.sourceforge.net])
|
||||||
# *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 # *Independently* of the above libupnp package version, the libtool version
|
||||||
# "current:revision:age" (this is NOT the same as the package version), where:
|
dnl # of the 3 libraries need to be updated whenever there is a change released:
|
||||||
# - library code modified: revision++
|
dnl # "current:revision:age" (this is NOT the same as the package version),
|
||||||
# - interfaces changed/added/removed: current++ and revision=0
|
dnl # where:
|
||||||
# - interfaces added: age++
|
dnl # - library code modified: revision++
|
||||||
# - interfaces removed: age=0
|
dnl # - interfaces changed/added/removed: current++ and revision=0
|
||||||
# *please update only once, before a formal release, not for each change*
|
dnl # - interfaces added: age++
|
||||||
#
|
dnl # - interfaces removed: age=0
|
||||||
# For release 1.4.1, we had:
|
dnl # *please update only once, before a formal release, not for each change*
|
||||||
#AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
dnl #
|
||||||
#AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
dnl ############################################################################
|
||||||
#AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
dnl # Release 1.4.1:
|
||||||
#
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
||||||
# "current:revision:age"
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
||||||
#
|
dnl #AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
||||||
# - Code has changed in ixml
|
dnl #
|
||||||
# revision: 2 -> 3
|
dnl ############################################################################
|
||||||
# - Code has changed in threadutil
|
dnl # Release 1.4.6:
|
||||||
# revision: 2 -> 3
|
dnl # "current:revision:age"
|
||||||
# - Interface added in threadutil
|
dnl #
|
||||||
# current: 2 -> 3
|
dnl # - Code has changed in ixml
|
||||||
# revisiion: 3 -> 0
|
dnl # revision: 2 -> 3
|
||||||
# age: 0 -> 1
|
dnl # - Code has changed in threadutil
|
||||||
# - Code has changed in upnp (revision 2 -> 3)
|
dnl # revision: 2 -> 3
|
||||||
# revision: 2 -> 3
|
dnl # - Interface added in threadutil
|
||||||
AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
dnl # current: 2 -> 3
|
||||||
AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
dnl # revisiion: 3 -> 0
|
||||||
AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
dnl # age: 0 -> 1
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 2 -> 3
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.0:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in ixml
|
||||||
|
dnl # revision: 3 -> 4
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 0 -> 1
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 3 -> 4
|
||||||
|
dnl # - Interface changed in upnp
|
||||||
|
dnl # current: 2 -> 3
|
||||||
|
dnl # revision: 4 -> 0
|
||||||
|
dnl # - Interface removed in upnp
|
||||||
|
dnl # age: 0 -> 0
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.1:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 1 -> 2
|
||||||
|
dnl # - Interface added in threadutil
|
||||||
|
dnl # current: 3 -> 4
|
||||||
|
dnl # revision: 2 -> 0
|
||||||
|
dnl # - Interface added in threadutil
|
||||||
|
dnl # age: 1 -> 2
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 0 -> 1
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.2:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 1 -> 2
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.3:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 0 -> 1
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.4:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 1 -> 2
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 2 -> 3
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:3:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.5:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 3 -> 4
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:4:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.6:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 2 -> 3
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 4 -> 5
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:3:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [3:5:0])
|
||||||
|
dnl #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.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 #
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Release 1.6.10:
|
||||||
|
dnl # "current:revision:age"
|
||||||
|
dnl #
|
||||||
|
dnl # - Code has changed inxml
|
||||||
|
dnl # revision: 5 -> 6
|
||||||
|
dnl # - Code has changed in threadutil
|
||||||
|
dnl # revision: 2 -> 3
|
||||||
|
dnl # - Code has changed in upnp
|
||||||
|
dnl # revision: 2 -> 3
|
||||||
|
dnl # - interface has changed in upnp
|
||||||
|
dnl # current: 4 -> 5
|
||||||
|
dnl # revision: 3 -> 0
|
||||||
|
dnl #
|
||||||
|
dnl #AC_SUBST([LT_VERSION_IXML], [2:6:0])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:3:2])
|
||||||
|
dnl #AC_SUBST([LT_VERSION_UPNP], [5:0:0])
|
||||||
|
dnl #
|
||||||
|
############################################################################
|
||||||
|
AC_SUBST([LT_VERSION_IXML], [2:6:0])
|
||||||
|
AC_SUBST([LT_VERSION_THREADUTIL], [5:3:2])
|
||||||
|
AC_SUBST([LT_VERSION_UPNP], [5:0:0])
|
||||||
|
dnl ############################################################################
|
||||||
|
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
||||||
|
dnl # - library code modified: revision++
|
||||||
|
dnl # - interfaces changed/added/removed: current++ and revision=0
|
||||||
|
dnl # - interfaces added: age++
|
||||||
|
dnl # - interfaces removed: age=0
|
||||||
|
dnl # *please update only once, before a formal release, not for each change*
|
||||||
|
dnl ############################################################################
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR(config.aux)
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR(m4)
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
|
AC_CONFIG_SRCDIR([upnp/inc/upnp.h])
|
||||||
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Get canonical host names in host and host_os
|
||||||
|
#
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
#
|
#
|
||||||
# There are 3 configuration files :
|
# There are 3 configuration files :
|
||||||
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
# 1) "./autoconfig.h" is auto-generated and used only internally during build
|
||||||
@@ -67,8 +257,7 @@ AC_REVISION([$Revision: 1.11 $])
|
|||||||
upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' `
|
upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' `
|
||||||
upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `]
|
upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `]
|
||||||
upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `]
|
upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `]
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION",
|
AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION", [see upnpconfig.h])
|
||||||
[see upnpconfig.h])
|
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_MAJOR], $upnpmaj, [see upnpconfig.h])
|
AC_DEFINE_UNQUOTED([UPNP_VERSION_MAJOR], $upnpmaj, [see upnpconfig.h])
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h])
|
AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h])
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h])
|
AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h])
|
||||||
@@ -90,7 +279,6 @@ fi
|
|||||||
#
|
#
|
||||||
# Check for libupnp subsets
|
# Check for libupnp subsets
|
||||||
#
|
#
|
||||||
|
|
||||||
RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)])
|
RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)])
|
||||||
if test "x$enable_client" = xyes ; then
|
if test "x$enable_client" = xyes ; then
|
||||||
AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h])
|
AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h])
|
||||||
@@ -120,27 +308,49 @@ 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([blocking_tcp_connections], [yes], [blocking TCP connections])
|
||||||
|
if test "x$enable_blocking_tcp_connections" = xyes ; then
|
||||||
|
AC_DEFINE(UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS, 1, [see upnpconfig.h])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
# doc installation
|
# doc installation
|
||||||
# autoconf >= 2.60 already defines ${docdir}, but we will not use its
|
# autoconf >= 2.60 already defines ${docdir}, but we will not use its
|
||||||
# default value, which is ${datarootdir}/doc/${PACKAGE_TARNAME}.
|
# default value, which is ${datarootdir}/doc/${PACKAGE_TARNAME}.
|
||||||
# That would give us ${datarootdir}/doc/libupnp, and we want the package
|
# That would give us ${datarootdir}/doc/libupnp, and we want the package
|
||||||
# version on that.
|
# version on that.
|
||||||
|
#
|
||||||
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
||||||
AC_MSG_CHECKING([for documentation directory])
|
AC_MSG_CHECKING([for documentation directory])
|
||||||
AC_ARG_WITH([documentation],
|
AC_ARG_WITH(
|
||||||
AS_HELP_STRING([--with-documentation=directory_name],
|
[documentation],
|
||||||
|
AS_HELP_STRING(
|
||||||
|
[--with-documentation=directory_name],
|
||||||
[where documentation is installed
|
[where documentation is installed
|
||||||
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
@<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@])
|
||||||
AS_HELP_STRING([--without-documentation],
|
AS_HELP_STRING(
|
||||||
|
[--without-documentation],
|
||||||
[do not install the documentation]),
|
[do not install the documentation]),
|
||||||
[],
|
[],
|
||||||
[with_documentation=no])
|
[with_documentation=no])
|
||||||
|
|
||||||
|
#
|
||||||
# If something has been entered after an equal sign, assume it is the directory
|
# If something has been entered after an equal sign, assume it is the directory
|
||||||
|
#
|
||||||
if test x"$with_documentation" != xyes -a x"$with_documentation" != xno; then
|
if test x"$with_documentation" != xyes -a x"$with_documentation" != xno; then
|
||||||
docdir="$with_documentation"
|
docdir="$with_documentation"
|
||||||
fi
|
fi
|
||||||
@@ -159,42 +369,117 @@ AC_PROG_INSTALL
|
|||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_EGREP
|
AC_PROG_EGREP
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default compilation flags
|
# Default compilation flags
|
||||||
#
|
#
|
||||||
|
echo "--------------------- Default compilation flags -------------------------------"
|
||||||
|
echo host is $host
|
||||||
|
echo host_os is $host_os
|
||||||
|
case $host_os in
|
||||||
|
freebsd*)
|
||||||
|
echo "Using FreeBSD specific compiler settings"
|
||||||
|
# Put FreeBSD specific compiler flags here
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Using non-specific system compiler settings"
|
||||||
if test x"$enable_debug" = xyes; then
|
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])
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
AX_CFLAGS_WARN_ALL
|
AX_CFLAGS_WARN_ALL
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Lot's of stuff to ensure large file support
|
# Lot's of stuff to ensure large file support
|
||||||
#
|
#
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
AC_TYPE_OFF_T
|
AC_TYPE_OFF_T
|
||||||
AC_DEFINE(_LARGE_FILE_SOURCE, [], [Large files support])
|
AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support])
|
||||||
AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size])
|
AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h],[],[AC_MSG_ERROR([required header file missing])])
|
AC_CHECK_HEADERS(
|
||||||
|
[ \
|
||||||
|
arpa/inet.h \
|
||||||
|
fcntl.h \
|
||||||
|
inttypes.h \
|
||||||
|
limits.h \
|
||||||
|
netdb.h \
|
||||||
|
netinet/in.h \
|
||||||
|
stdlib.h \
|
||||||
|
string.h \
|
||||||
|
sys/ioctl.h \
|
||||||
|
sys/socket.h \
|
||||||
|
sys/time.h \
|
||||||
|
syslog.h \
|
||||||
|
unistd.h \
|
||||||
|
],
|
||||||
|
[],
|
||||||
|
[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
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
TYPE_SOCKLEN_T
|
# The test for socklen_t was getting it wrong when it exists but is in ws2tcpip.h,
|
||||||
|
# so we use a new test.
|
||||||
|
#TYPE_SOCKLEN_T
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([sys/types.h sys/socket.h ws2tcpip.h])
|
||||||
|
AC_MSG_CHECKING(for socklen_t)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_WS2TCPIP_H
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
],[ socklen_t t = 0; return t; ])
|
||||||
|
],[ac_cv_socklen_t="yes"],[ac_cv_socklen_t="no"])
|
||||||
|
if test "$ac_cv_socklen_t" = "yes"; then
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no, using int])
|
||||||
|
AC_DEFINE(socklen_t, int, [Type for storing the length of struct sockaddr])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -202,25 +487,72 @@ TYPE_SOCKLEN_T
|
|||||||
#
|
#
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
|
#
|
||||||
|
# Solaris needs -lsocket -lnsl -lrt
|
||||||
|
AC_SEARCH_LIBS([bind], [socket])
|
||||||
|
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
||||||
|
AC_SEARCH_LIBS([sched_getparam], [rt])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for POSIX Threads
|
# Checks for POSIX Threads
|
||||||
#
|
#
|
||||||
ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
echo "--------------------------- pthread stuff -------------------------------------"
|
||||||
|
ACX_PTHREAD(
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
||||||
|
#
|
||||||
|
# Update environment variables for pthreads
|
||||||
|
#
|
||||||
|
CC="$PTHREAD_CC"
|
||||||
|
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
#
|
||||||
|
# Determine if pthread_rwlock_t is available
|
||||||
|
#
|
||||||
|
echo "----------------------- pthread_rwlock_t stuff --------------------------------"
|
||||||
|
AC_MSG_CHECKING([if pthread_rwlock_t is available])
|
||||||
|
AC_LANG([C])
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[#include <pthread.h>],
|
||||||
|
[pthread_rwlock_t *x;])],
|
||||||
|
[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
|
||||||
|
AC_MSG_RESULT([yes, supported without any options])],
|
||||||
|
[AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[#define _GNU_SOURCE
|
||||||
|
#include <pthread.h>],
|
||||||
|
[pthread_rwlock_t *x;])],
|
||||||
|
[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||||
|
AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])],
|
||||||
|
[AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t])
|
||||||
|
AC_MSG_RESULT([no, needs to fallback to pthread_mutex])
|
||||||
|
AC_MSG_ERROR([pthread_rwlock_t not available])])])
|
||||||
|
echo "-------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
AC_CONFIG_FILES([Makefile
|
|
||||||
ixml/Makefile
|
ixml/Makefile
|
||||||
ixml/doc/Makefile
|
ixml/doc/Makefile
|
||||||
threadutil/Makefile
|
threadutil/Makefile
|
||||||
upnp/Makefile
|
upnp/Makefile
|
||||||
upnp/doc/Makefile
|
upnp/doc/Makefile
|
||||||
|
upnp/sample/Makefile
|
||||||
docs/dist/Makefile
|
docs/dist/Makefile
|
||||||
libupnp.pc
|
libupnp.pc
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
4
docs/dist/Makefile.am
vendored
4
docs/dist/Makefile.am
vendored
@@ -39,7 +39,7 @@ EXTRA_DIST = \
|
|||||||
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
||||||
./html/upnp/UPNP_E_CANCELED-210.html \
|
./html/upnp/UPNP_E_CANCELED-210.html \
|
||||||
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
||||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \
|
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \
|
||||||
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
||||||
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
||||||
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
||||||
@@ -295,7 +295,7 @@ if WITH_DOCUMENTATION
|
|||||||
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
||||||
./html/upnp/UPNP_E_CANCELED-210.html \
|
./html/upnp/UPNP_E_CANCELED-210.html \
|
||||||
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
||||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \
|
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \
|
||||||
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
||||||
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
||||||
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2691
ixml/inc/ixml.h
2691
ixml/inc/ixml.h
File diff suppressed because it is too large
Load Diff
72
ixml/inc/ixmldebug.h
Normal file
72
ixml/inc/ixmldebug.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#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,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
FmtStr = 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)
|
||||||
|
{
|
||||||
|
tmpRoot = tmpRoot;
|
||||||
|
depth = 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;
|
||||||
}
|
}
|
||||||
@@ -174,7 +139,7 @@ ixmlDocument_createElementEx( IN IXML_Document * doc,
|
|||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the node fields
|
/* set the node fields */
|
||||||
newElement->n.nodeType = eELEMENT_NODE;
|
newElement->n.nodeType = eELEMENT_NODE;
|
||||||
newElement->n.nodeName = strdup(tagName);
|
newElement->n.nodeName = strdup(tagName);
|
||||||
if (newElement->n.nodeName == NULL) {
|
if (newElement->n.nodeName == NULL) {
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -309,7 +229,7 @@ ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
|
|||||||
rc = IXML_INSUFFICIENT_MEMORY;
|
rc = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// initialize the node
|
/* initialize the node */
|
||||||
ixmlNode_init(returnNode);
|
ixmlNode_init(returnNode);
|
||||||
|
|
||||||
returnNode->nodeName = strdup(TEXTNODENAME);
|
returnNode->nodeName = strdup(TEXTNODENAME);
|
||||||
@@ -319,7 +239,7 @@ ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
|
|||||||
rc = IXML_INSUFFICIENT_MEMORY;
|
rc = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// add in node value
|
/* add in node value */
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
returnNode->nodeValue = strdup(data);
|
returnNode->nodeValue = strdup(data);
|
||||||
if (returnNode->nodeValue == NULL) {
|
if (returnNode->nodeValue == NULL) {
|
||||||
@@ -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,10 +293,9 @@ 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 */
|
||||||
attrNode->n.nodeName = strdup(name);
|
attrNode->n.nodeName = strdup(name);
|
||||||
if (attrNode->n.nodeName == NULL) {
|
if (attrNode->n.nodeName == NULL) {
|
||||||
ixmlAttr_free(attrNode);
|
ixmlAttr_free(attrNode);
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -469,7 +343,7 @@ ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
|
|||||||
if (errCode != IXML_SUCCESS) {
|
if (errCode != IXML_SUCCESS) {
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the namespaceURI field
|
/* set the namespaceURI field */
|
||||||
attrNode->n.namespaceURI = strdup(namespaceURI);
|
attrNode->n.namespaceURI = strdup(namespaceURI);
|
||||||
if (attrNode->n.namespaceURI == NULL) {
|
if (attrNode->n.namespaceURI == NULL) {
|
||||||
ixmlAttr_free(attrNode);
|
ixmlAttr_free(attrNode);
|
||||||
@@ -477,7 +351,7 @@ ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
|
|||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the localName and prefix
|
/* set the localName and prefix */
|
||||||
errCode =
|
errCode =
|
||||||
ixmlNode_setNodeName((IXML_Node *)attrNode, qualifiedName);
|
ixmlNode_setNodeName((IXML_Node *)attrNode, qualifiedName);
|
||||||
if (errCode != IXML_SUCCESS) {
|
if (errCode != IXML_SUCCESS) {
|
||||||
@@ -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,77 +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) )
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
#define XINLINE inline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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. */
|
||||||
|
size_t 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 */
|
||||||
|
|
||||||
|
|||||||
368
ixml/src/ixml.c
368
ixml/src/ixml.c
@@ -1,91 +1,99 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// 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;
|
size_t i;
|
||||||
int plen;
|
size_t plen;
|
||||||
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
plen = strlen(p);
|
plen = strlen(p);
|
||||||
|
for (i = 0; i < plen; ++i) {
|
||||||
for( i = 0; i < plen; i++ ) {
|
|
||||||
switch (p[i]) {
|
switch (p[i]) {
|
||||||
case '<':
|
case '<':
|
||||||
ixml_membuf_append_str(buf, "<");
|
ixml_membuf_append_str(buf, "<");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '>':
|
case '>':
|
||||||
ixml_membuf_append_str(buf, ">");
|
ixml_membuf_append_str(buf, ">");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '&':
|
case '&':
|
||||||
ixml_membuf_append_str(buf, "&");
|
ixml_membuf_append_str(buf, "&");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\'':
|
case '\'':
|
||||||
ixml_membuf_append_str(buf, "'");
|
ixml_membuf_append_str(buf, "'");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\"':
|
case '\"':
|
||||||
ixml_membuf_append_str(buf, """);
|
ixml_membuf_append_str(buf, """);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
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 +105,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 +124,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 +133,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 +142,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 */
|
||||||
|
ixmlPrintDomTreeRecursive(
|
||||||
|
ixmlNode_getFirstChild(nodeptr), buf);
|
||||||
|
|
||||||
// output the children
|
/* Done with children. Output the end tag. */
|
||||||
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
|
||||||
( nodeptr ), buf );
|
|
||||||
|
|
||||||
// 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,52 +222,54 @@ 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, "</");
|
||||||
ixml_membuf_append_str(buf, nodeName);
|
ixml_membuf_append_str(buf, nodeName);
|
||||||
ixml_membuf_append_str(buf, ">\r\n");
|
ixml_membuf_append_str(buf, ">\r\n");
|
||||||
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 +277,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,79 +294,57 @@ 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, "</");
|
||||||
ixml_membuf_append_str(buf, nodeName);
|
ixml_membuf_append_str(buf, nodeName);
|
||||||
ixml_membuf_append_str(buf, ">");
|
ixml_membuf_append_str(buf, ">");
|
||||||
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 +357,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 +373,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 +391,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 +407,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 +431,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)
|
||||||
|
{
|
||||||
|
unsigned long 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,59 +125,48 @@ 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;
|
||||||
|
|
||||||
assert(m != NULL);
|
assert(m != NULL);
|
||||||
|
|
||||||
// set value to null
|
/* set value to null */
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
ixml_membuf_destroy(m);
|
ixml_membuf_destroy(m);
|
||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
// alloc mem
|
/* alloc mem */
|
||||||
return_code = ixml_membuf_set_size(m, buf_len);
|
return_code = ixml_membuf_set_size(m, buf_len);
|
||||||
if (return_code != 0) {
|
if (return_code != 0) {
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
// copy
|
|
||||||
memcpy( m->buf, buf, buf_len );
|
|
||||||
m->buf[buf_len] = 0; // null-terminate
|
|
||||||
|
|
||||||
|
/* copy */
|
||||||
|
memcpy(m->buf, buf, buf_len);
|
||||||
|
|
||||||
|
/* 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 )
|
size_t index)
|
||||||
{
|
{
|
||||||
int return_code;
|
int return_code = 0;
|
||||||
|
|
||||||
assert(m != NULL);
|
assert(m != NULL);
|
||||||
|
|
||||||
if( index < 0 || index > ( int )m->length )
|
if (index > 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
|
|
||||||
* Retrieves a node specified by name.
|
|
||||||
* External function.
|
|
||||||
*
|
|
||||||
* Parameter:
|
|
||||||
* name: type nodeName of a node to retrieve.
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* A Node with the specified nodeName, or null if it
|
|
||||||
* does not identify any node in this map.
|
|
||||||
*
|
|
||||||
*=================================================================*/
|
|
||||||
IXML_Node *
|
|
||||||
ixmlNamedNodeMap_getNamedItem( IN IXML_NamedNodeMap * nnMap,
|
|
||||||
IN const char *name )
|
|
||||||
{
|
|
||||||
long index;
|
|
||||||
|
|
||||||
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
IXML_Node *ixmlNamedNodeMap_getNamedItem(
|
||||||
|
IXML_NamedNodeMap *nnMap,
|
||||||
|
const DOMString name)
|
||||||
|
{
|
||||||
|
unsigned long index;
|
||||||
|
|
||||||
|
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, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1099
ixml/src/node.c
1099
ixml/src/node.c
File diff suppressed because it is too large
Load Diff
@@ -1,71 +1,67 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
// if the list ptr is NULL
|
/* if the list ptr is NULL */
|
||||||
if (nList == NULL) {
|
if (nList == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// if index is more than list length
|
/* if index is more than list length */
|
||||||
if (index > ixmlNodeList_length(nList) - 1) {
|
if (index > ixmlNodeList_length(nList) - 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
ixml/test/test_document.sh
Normal file → Executable file
0
ixml/test/test_document.sh
Normal file → Executable file
@@ -6,7 +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}
|
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Version: 1.4.2
|
Version: 1.6.10
|
||||||
Summary: Universal Plug and Play (UPnP) SDK
|
Summary: Universal Plug and Play (UPnP) SDK
|
||||||
Name: libupnp
|
Name: libupnp
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
@@ -77,6 +77,12 @@ make install DESTDIR=$RPM_BUILD_ROOT
|
|||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 19 2007 Marcelo Jimenez <mroberto@users.sourceforge.net> - 1.6.2-1
|
||||||
|
- Update to version 1.6.2
|
||||||
|
|
||||||
|
* Mon Nov 19 2007 Marcelo Jimenez <mroberto@users.sourceforge.net> - 1.4.7-1
|
||||||
|
- Update to version 1.4.7
|
||||||
|
|
||||||
* Fri Feb 02 2007 Eric Tanguy <eric.tanguy@univ-nantes.fr> - 1.4.2-1
|
* Fri Feb 02 2007 Eric Tanguy <eric.tanguy@univ-nantes.fr> - 1.4.2-1
|
||||||
- Update to version 1.4.2
|
- Update to version 1.4.2
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +1,88 @@
|
|||||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
##### http://autoconf-archive.cryp.to/acx_pthread.html
|
||||||
dnl
|
#
|
||||||
dnl @summary figure out how to build C programs using POSIX threads
|
# SYNOPSIS
|
||||||
dnl
|
#
|
||||||
dnl This macro figures out how to build C programs using POSIX threads.
|
# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||||
dnl It sets the PTHREAD_LIBS output variable to the threads library and
|
#
|
||||||
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
|
# DESCRIPTION
|
||||||
dnl C compiler flags that are needed. (The user can also force certain
|
#
|
||||||
dnl compiler flags/libs to be tested by setting these environment
|
# This macro figures out how to build C programs using POSIX threads.
|
||||||
dnl variables.)
|
# It sets the PTHREAD_LIBS output variable to the threads library and
|
||||||
dnl
|
# linker flags, and the PTHREAD_CFLAGS output variable to any special
|
||||||
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
|
# C compiler flags that are needed. (The user can also force certain
|
||||||
dnl multi-threaded programs (defaults to the value of CC otherwise).
|
# compiler flags/libs to be tested by setting these environment
|
||||||
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
|
# variables.)
|
||||||
dnl
|
#
|
||||||
dnl NOTE: You are assumed to not only compile your program with these
|
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||||
dnl flags, but also link it with them as well. e.g. you should link
|
# multi-threaded programs (defaults to the value of CC otherwise).
|
||||||
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
# (This is necessary on AIX to use the special cc_r compiler alias.)
|
||||||
dnl $LIBS
|
#
|
||||||
dnl
|
# NOTE: You are assumed to not only compile your program with these
|
||||||
dnl If you are only building threads programs, you may wish to use
|
# flags, but also link it with them as well. e.g. you should link
|
||||||
dnl these variables in your default LIBS, CFLAGS, and CC:
|
# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
||||||
dnl
|
# $LIBS
|
||||||
dnl LIBS="$PTHREAD_LIBS $LIBS"
|
#
|
||||||
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
# If you are only building threads programs, you may wish to use
|
||||||
dnl CC="$PTHREAD_CC"
|
# these variables in your default LIBS, CFLAGS, and CC:
|
||||||
dnl
|
#
|
||||||
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
# CC="$PTHREAD_CC"
|
||||||
dnl
|
#
|
||||||
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
|
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
||||||
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
||||||
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||||
dnl default action will define HAVE_PTHREAD.
|
#
|
||||||
dnl
|
# ACTION-IF-FOUND is a list of shell commands to run if a threads
|
||||||
dnl Please let the authors know if this macro fails on any platform, or
|
# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
||||||
dnl if you have any other suggestions or comments. This macro was based
|
# run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
||||||
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
|
# default action will define HAVE_PTHREAD.
|
||||||
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
|
#
|
||||||
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
|
# Please let the authors know if this macro fails on any platform, or
|
||||||
dnl We are also grateful for the helpful feedback of numerous users.
|
# if you have any other suggestions or comments. This macro was based
|
||||||
dnl
|
# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
|
||||||
dnl @category InstalledPackages
|
# (with help from M. Frigo), as well as ac_pthread and hb_pthread
|
||||||
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
|
# macros posted by Alejandro Forero Cuervo to the autoconf macro
|
||||||
dnl @version 2005-06-15
|
# repository. We are also grateful for the helpful feedback of
|
||||||
dnl @license GPLWithACException
|
# numerous users.
|
||||||
|
#
|
||||||
|
# LAST MODIFICATION
|
||||||
|
#
|
||||||
|
# 2006-05-29
|
||||||
|
#
|
||||||
|
# COPYLEFT
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright
|
||||||
|
# owner gives unlimited permission to copy, distribute and modify the
|
||||||
|
# configure scripts that are the output of Autoconf when processing
|
||||||
|
# the Macro. You need not follow the terms of the GNU General Public
|
||||||
|
# License when using or distributing such scripts, even though
|
||||||
|
# portions of the text of the Macro appear in them. The GNU General
|
||||||
|
# Public License (GPL) does govern all other use of the material that
|
||||||
|
# constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the
|
||||||
|
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
||||||
|
# make and distribute a modified version of the Autoconf Macro, you
|
||||||
|
# may extend this special exception to the GPL to apply to your
|
||||||
|
# modified version as well.
|
||||||
|
|
||||||
AC_DEFUN([ACX_PTHREAD], [
|
AC_DEFUN([ACX_PTHREAD], [
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
@@ -216,8 +254,12 @@ if test "x$acx_pthread_ok" = xyes; then
|
|||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
CFLAGS="$save_CFLAGS"
|
CFLAGS="$save_CFLAGS"
|
||||||
|
|
||||||
# More AIX lossage: must compile with cc_r
|
# More AIX lossage: must compile with xlc_r or cc_r
|
||||||
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
|
if test x"$GCC" != xyes; then
|
||||||
|
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
||||||
|
else
|
||||||
|
PTHREAD_CC=$CC
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
PTHREAD_CC="$CC"
|
PTHREAD_CC="$CC"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,48 +1,87 @@
|
|||||||
dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
|
##### http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html
|
||||||
dnl
|
#
|
||||||
dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
|
# SYNOPSIS
|
||||||
dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
|
#
|
||||||
dnl optionflag to CFLAGS if it is understood. You can override the
|
# AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
|
||||||
dnl shellvar-default of CFLAGS of course. The order of arguments stems
|
#
|
||||||
dnl from the explicit macros like AX_CFLAGS_WARN_ALL.
|
# DESCRIPTION
|
||||||
dnl
|
#
|
||||||
dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
|
# AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
|
||||||
dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
|
# "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the
|
||||||
dnl (since it is possible to use different compilers for C and C++).
|
# optionflag to CFLAGS if it is understood. You can override the
|
||||||
dnl
|
# shellvar-default of CFLAGS of course. The order of arguments stems
|
||||||
dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
|
# from the explicit macros like AX_CFLAGS_WARN_ALL.
|
||||||
dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
|
#
|
||||||
dnl However, if you use this macro in a few places, it would be great
|
# The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
|
||||||
dnl if you would make up a new function-macro and submit it to the
|
# to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
|
||||||
dnl ac-archive.
|
# (since it is possible to use different compilers for C and C++).
|
||||||
dnl
|
#
|
||||||
dnl - $1 option-to-check-for : required ("-option" as non-value)
|
# The macro is a lot simpler than any special AX_CFLAGS_* macro (or
|
||||||
dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
|
# ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
|
||||||
dnl - $3 action-if-found : add value to shellvariable
|
# However, if you use this macro in a few places, it would be great
|
||||||
dnl - $4 action-if-not-found : nothing
|
# if you would make up a new function-macro and submit it to the
|
||||||
dnl
|
# ac-archive.
|
||||||
dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
|
#
|
||||||
dnl situation and accept a $2=~/-/ as being the old
|
# - $1 option-to-check-for : required ("-option" as non-value)
|
||||||
dnl option-to-check-for.
|
# - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
|
||||||
dnl
|
# - $3 action-if-found : add value to shellvariable
|
||||||
dnl also: there are other variants that emerged from the original macro
|
# - $4 action-if-not-found : nothing
|
||||||
dnl variant which did just test an option to be possibly added.
|
#
|
||||||
dnl However, some compilers accept an option silently, or possibly for
|
# note: in earlier versions, $1-$2 were swapped. We try to detect the
|
||||||
dnl just another option that was not intended. Therefore, we have to do
|
# situation and accept a $2=~/-/ as being the old
|
||||||
dnl a generic test for a compiler family. For gcc we check "-pedantic"
|
# option-to-check-for.
|
||||||
dnl being accepted which is also understood by compilers who just want
|
#
|
||||||
dnl to be compatible with gcc even when not being made from gcc
|
# also: there are other variants that emerged from the original macro
|
||||||
dnl sources.
|
# variant which did just test an option to be possibly added.
|
||||||
dnl
|
# However, some compilers accept an option silently, or possibly for
|
||||||
dnl see also:
|
# just another option that was not intended. Therefore, we have to do
|
||||||
dnl
|
# a generic test for a compiler family. For gcc we check "-pedantic"
|
||||||
dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
|
# being accepted which is also understood by compilers who just want
|
||||||
dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
|
# to be compatible with gcc even when not being made from gcc
|
||||||
dnl
|
# sources.
|
||||||
dnl @category C
|
#
|
||||||
dnl @author Guido Draheim <guidod@gmx.de>
|
# see also:
|
||||||
dnl @version 2003-11-04
|
#
|
||||||
dnl @license GPLWithACException
|
# AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
|
||||||
|
# AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
|
||||||
|
#
|
||||||
|
# LAST MODIFICATION
|
||||||
|
#
|
||||||
|
# 2006-12-12
|
||||||
|
#
|
||||||
|
# COPYLEFT
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright
|
||||||
|
# owner gives unlimited permission to copy, distribute and modify the
|
||||||
|
# configure scripts that are the output of Autoconf when processing
|
||||||
|
# the Macro. You need not follow the terms of the GNU General Public
|
||||||
|
# License when using or distributing such scripts, even though
|
||||||
|
# portions of the text of the Macro appear in them. The GNU General
|
||||||
|
# Public License (GPL) does govern all other use of the material that
|
||||||
|
# constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the
|
||||||
|
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
||||||
|
# make and distribute a modified version of the Autoconf Macro, you
|
||||||
|
# may extend this special exception to the GPL to apply to your
|
||||||
|
# modified version as well.
|
||||||
|
|
||||||
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
|
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
|
||||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||||
@@ -53,7 +92,8 @@ VAR,[VAR="no, unknown"
|
|||||||
AC_LANG_C
|
AC_LANG_C
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
|
||||||
|
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
@@ -85,10 +125,11 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CXX
|
AC_LANG_CPLUSPLUS
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
in "-pedantic -Werror % m4_ifval($2,$2,-option)" dnl GCC
|
||||||
|
"-pedantic % m4_ifval($2,$2,-option) %% no, obsolete" dnl new GCC
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
@@ -122,7 +163,8 @@ VAR,[VAR="no, unknown"
|
|||||||
AC_LANG_C
|
AC_LANG_C
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
|
||||||
|
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
@@ -154,10 +196,11 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
|
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CXX
|
AC_LANG_CPLUSPLUS
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
in "-pedantic -Werror % m4_ifval($1,$1,-option)" dnl GCC
|
||||||
|
"-pedantic % m4_ifval($1,$1,-option) %% no, obsolete" dnl new GCC
|
||||||
#
|
#
|
||||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
AC_TRY_COMPILE([],[return 0;],
|
AC_TRY_COMPILE([],[return 0;],
|
||||||
|
|||||||
@@ -1,27 +1,66 @@
|
|||||||
dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
##### http://autoconf-archive.cryp.to/ax_cflags_warn_all.html
|
||||||
dnl
|
#
|
||||||
dnl Try to find a compiler option that enables most reasonable
|
# SYNOPSIS
|
||||||
dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
#
|
||||||
dnl which is split up into two AX_CFLAGS_WARN_ALL and
|
# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||||
dnl AX_CFLAGS_WARN_ALL_ANSI
|
#
|
||||||
dnl
|
# DESCRIPTION
|
||||||
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
#
|
||||||
dnl result is added to the shellvar being CFLAGS by default.
|
# Try to find a compiler option that enables most reasonable
|
||||||
dnl
|
# warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||||
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
|
# which is split up into two AX_CFLAGS_WARN_ALL and
|
||||||
dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
# AX_CFLAGS_WARN_ALL_ANSI
|
||||||
dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
#
|
||||||
dnl 10.0.0.8) C compiler.
|
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||||
dnl
|
# result is added to the shellvar being CFLAGS by default.
|
||||||
dnl - $1 shell-variable-to-add-to : CFLAGS
|
#
|
||||||
dnl - $2 add-value-if-not-found : nothing
|
# Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||||
dnl - $3 action-if-found : add value to shellvariable
|
# Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
||||||
dnl - $4 action-if-not-found : nothing
|
# compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
||||||
dnl
|
# 10.0.0.8) C compiler.
|
||||||
dnl @category C
|
#
|
||||||
dnl @author Guido Draheim <guidod@gmx.de>
|
# - $1 shell-variable-to-add-to : CFLAGS
|
||||||
dnl @version 2003-01-06
|
# - $2 add-value-if-not-found : nothing
|
||||||
dnl @license GPLWithACException
|
# - $3 action-if-found : add value to shellvariable
|
||||||
|
# - $4 action-if-not-found : nothing
|
||||||
|
#
|
||||||
|
# LAST MODIFICATION
|
||||||
|
#
|
||||||
|
# 2006-12-12
|
||||||
|
#
|
||||||
|
# COPYLEFT
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright
|
||||||
|
# owner gives unlimited permission to copy, distribute and modify the
|
||||||
|
# configure scripts that are the output of Autoconf when processing
|
||||||
|
# the Macro. You need not follow the terms of the GNU General Public
|
||||||
|
# License when using or distributing such scripts, even though
|
||||||
|
# portions of the text of the Macro appear in them. The GNU General
|
||||||
|
# Public License (GPL) does govern all other use of the material that
|
||||||
|
# constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the
|
||||||
|
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
||||||
|
# make and distribute a modified version of the Autoconf Macro, you
|
||||||
|
# may extend this special exception to the GPL to apply to your
|
||||||
|
# modified version as well.
|
||||||
|
|
||||||
AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
|
AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
|
||||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||||
@@ -72,7 +111,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CXX
|
AC_LANG_CPLUSPLUS
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
for ac_arg dnl
|
for ac_arg dnl
|
||||||
in "-pedantic % -Wall" dnl GCC
|
in "-pedantic % -Wall" dnl GCC
|
||||||
@@ -115,4 +154,5 @@ dnl compilers will fail about it. That was needed since a lot of
|
|||||||
dnl compilers will give false positives for some option-syntax
|
dnl compilers will give false positives for some option-syntax
|
||||||
dnl like -Woption or -Xoption as they think of it is a pass-through
|
dnl like -Woption or -Xoption as they think of it is a pass-through
|
||||||
dnl to later compile stages or something. The "%" is used as a
|
dnl to later compile stages or something. The "%" is used as a
|
||||||
dnl delimimiter. A non-option comment can be given after "%%" marks.
|
dnl delimimiter. A non-option comment can be given after "%%" marks
|
||||||
|
dnl which will be shown but not added to the respective C/CXXFLAGS.
|
||||||
|
|||||||
@@ -1,27 +1,66 @@
|
|||||||
dnl @synopsis AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
##### http://autoconf-archive.cryp.to/ax_cflags_warn_all_ansi.html
|
||||||
dnl
|
#
|
||||||
dnl Try to find a compiler option that enables most reasonable
|
# SYNOPSIS
|
||||||
dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
#
|
||||||
dnl which is split up into two AX_CFLAGS_WARN_ALL and
|
# AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])]
|
||||||
dnl AX_CFLAGS_WARN_ALL_ANSI
|
#
|
||||||
dnl
|
# DESCRIPTION
|
||||||
dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
#
|
||||||
dnl result is added to the shellvar being CFLAGS by default.
|
# Try to find a compiler option that enables most reasonable
|
||||||
dnl
|
# warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
|
||||||
dnl Currently this macro knows about GCC, Solaris C compiler, Digital
|
# which is split up into two AX_CFLAGS_WARN_ALL and
|
||||||
dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
# AX_CFLAGS_WARN_ALL_ANSI
|
||||||
dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
#
|
||||||
dnl 10.0.0.8) C compiler.
|
# For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
|
||||||
dnl
|
# result is added to the shellvar being CFLAGS by default.
|
||||||
dnl - $1 shell-variable-to-add-to : CFLAGS
|
#
|
||||||
dnl - $2 add-value-if-not-found : nothing
|
# Currently this macro knows about GCC, Solaris C compiler, Digital
|
||||||
dnl - $3 action-if-found : add value to shellvariable
|
# Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
|
||||||
dnl - $4 action-if-not-found : nothing
|
# compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
|
||||||
dnl
|
# 10.0.0.8) C compiler.
|
||||||
dnl @category C
|
#
|
||||||
dnl @author Guido Draheim <guidod@gmx.de>
|
# - $1 shell-variable-to-add-to : CFLAGS
|
||||||
dnl @version 2003-01-06
|
# - $2 add-value-if-not-found : nothing
|
||||||
dnl @license GPLWithACException
|
# - $3 action-if-found : add value to shellvariable
|
||||||
|
# - $4 action-if-not-found : nothing
|
||||||
|
#
|
||||||
|
# LAST MODIFICATION
|
||||||
|
#
|
||||||
|
# 2006-12-12
|
||||||
|
#
|
||||||
|
# COPYLEFT
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright
|
||||||
|
# owner gives unlimited permission to copy, distribute and modify the
|
||||||
|
# configure scripts that are the output of Autoconf when processing
|
||||||
|
# the Macro. You need not follow the terms of the GNU General Public
|
||||||
|
# License when using or distributing such scripts, even though
|
||||||
|
# portions of the text of the Macro appear in them. The GNU General
|
||||||
|
# Public License (GPL) does govern all other use of the material that
|
||||||
|
# constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the
|
||||||
|
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
||||||
|
# make and distribute a modified version of the Autoconf Macro, you
|
||||||
|
# may extend this special exception to the GPL to apply to your
|
||||||
|
# modified version as well.
|
||||||
|
|
||||||
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
|
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
|
||||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||||
@@ -77,7 +116,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl
|
|||||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
||||||
VAR,[VAR="no, unknown"
|
VAR,[VAR="no, unknown"
|
||||||
AC_LANG_SAVE
|
AC_LANG_SAVE
|
||||||
AC_LANG_CXX
|
AC_LANG_CPLUSPLUS
|
||||||
ac_save_[]FLAGS="$[]FLAGS"
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
# IRIX C compiler:
|
# IRIX C compiler:
|
||||||
# -use_readonly_const is the default for IRIX C,
|
# -use_readonly_const is the default for IRIX C,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ AC_DEFUN([RT_BOOL_ARG_ENABLE],[
|
|||||||
)])
|
)])
|
||||||
test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl
|
test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl
|
||||||
&& enable_[]Name=[$2]
|
&& enable_[]Name=[$2]
|
||||||
AC_MSG_RESULT($enable_[]Name)dnl
|
AC_MSG_RESULT($enable_[]Name)
|
||||||
AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes)
|
AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes)
|
||||||
dnl
|
dnl
|
||||||
m4_popdef([NAME])dnl
|
m4_popdef([NAME])dnl
|
||||||
|
|||||||
@@ -1,13 +1,52 @@
|
|||||||
dnl @synopsis TYPE_SOCKLEN_T
|
##### http://autoconf-archive.cryp.to/type_socklen_t.html
|
||||||
dnl
|
#
|
||||||
dnl Check whether sys/socket.h defines type socklen_t. Please note that
|
# SYNOPSIS
|
||||||
dnl some systems require sys/types.h to be included before sys/socket.h
|
#
|
||||||
dnl can be compiled.
|
# TYPE_SOCKLEN_T
|
||||||
dnl
|
#
|
||||||
dnl @category Misc
|
# DESCRIPTION
|
||||||
dnl @author Lars Brinkhoff <lars@nocrew.org>
|
#
|
||||||
dnl @version 2005-01-11
|
# Check whether sys/socket.h defines type socklen_t. Please note that
|
||||||
dnl @license GPLWithACException
|
# some systems require sys/types.h to be included before sys/socket.h
|
||||||
|
# can be compiled.
|
||||||
|
#
|
||||||
|
# LAST MODIFICATION
|
||||||
|
#
|
||||||
|
# 2005-01-11
|
||||||
|
#
|
||||||
|
# COPYLEFT
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005 Lars Brinkhoff <lars@nocrew.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
# 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright
|
||||||
|
# owner gives unlimited permission to copy, distribute and modify the
|
||||||
|
# configure scripts that are the output of Autoconf when processing
|
||||||
|
# the Macro. You need not follow the terms of the GNU General Public
|
||||||
|
# License when using or distributing such scripts, even though
|
||||||
|
# portions of the text of the Macro appear in them. The GNU General
|
||||||
|
# Public License (GPL) does govern all other use of the material that
|
||||||
|
# constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the
|
||||||
|
# Autoconf Macro released by the Autoconf Macro Archive. When you
|
||||||
|
# make and distribute a modified version of the Autoconf Macro, you
|
||||||
|
# may extend this special exception to the GPL to apply to your
|
||||||
|
# modified version as well.
|
||||||
|
|
||||||
AC_DEFUN([TYPE_SOCKLEN_T],
|
AC_DEFUN([TYPE_SOCKLEN_T],
|
||||||
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
|
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
|
||||||
|
|||||||
14
svnignore
Normal file
14
svnignore
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
.deps
|
||||||
|
.dirstamp
|
||||||
|
.libs
|
||||||
|
.*.swp
|
||||||
|
*~
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
aclocal.m4
|
||||||
|
autoconfig.h*
|
||||||
|
autom4te.cache
|
||||||
|
config*
|
||||||
|
libtool
|
||||||
|
libupnp.pc
|
||||||
|
stamp-h*
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(srcdir)/inc -I$(srcdir)/src/inc
|
AM_CPPFLAGS = -I$(srcdir)/inc -I$(srcdir)/src/inc
|
||||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
|
||||||
|
|
||||||
if ENABLE_DEBUG
|
if ENABLE_DEBUG
|
||||||
AM_CPPFLAGS += -DDEBUG -DSTATS
|
AM_CPPFLAGS += -DDEBUG -DSTATS
|
||||||
@@ -21,12 +20,11 @@ libthreadutil_la_LDFLAGS = -version-info $(LT_VERSION_THREADUTIL)
|
|||||||
|
|
||||||
libthreadutil_la_SOURCES = \
|
libthreadutil_la_SOURCES = \
|
||||||
src/FreeList.c src/LinkedList.c \
|
src/FreeList.c src/LinkedList.c \
|
||||||
src/ThreadPool.c src/TimerThread.c \
|
src/ThreadPool.c src/TimerThread.c
|
||||||
src/iasnprintf.c
|
|
||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = \
|
upnpinclude_HEADERS = \
|
||||||
inc/FreeList.h inc/LinkedList.h \
|
inc/FreeList.h inc/LinkedList.h \
|
||||||
inc/ThreadPool.h inc/TimerThread.h \
|
inc/ThreadPool.h inc/TimerThread.h \
|
||||||
inc/iasnprintf.h inc/ithread.h
|
inc/ithread.h
|
||||||
|
|
||||||
|
|||||||
@@ -1,144 +1,131 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef FREE_LIST_H
|
#ifndef FREE_LIST_H
|
||||||
#define FREE_LIST_H
|
#define FREE_LIST_H
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <malloc.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Name: FreeListNode
|
* Free list node. points to next free item.
|
||||||
*
|
* Memory for node is borrowed from allocated items.
|
||||||
* Description:
|
* \internal
|
||||||
* free list node. points to next free item.
|
*/
|
||||||
* memory for node is borrowed from allocated items.
|
|
||||||
* Internal Use Only.
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef struct FREELISTNODE
|
typedef struct FREELISTNODE
|
||||||
{
|
{
|
||||||
struct FREELISTNODE*next; //pointer to next free node
|
struct FREELISTNODE *next;
|
||||||
} FreeListNode;
|
} FreeListNode;
|
||||||
|
|
||||||
|
/*!
|
||||||
/****************************************************************************
|
|
||||||
* Name: FreeList
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Stores head and size of free list, as well as mutex for protection.
|
* Stores head and size of free list, as well as mutex for protection.
|
||||||
* Internal Use Only.
|
* \internal
|
||||||
*****************************************************************************/
|
*/
|
||||||
typedef struct FREELIST
|
typedef struct FREELIST
|
||||||
{
|
{
|
||||||
FreeListNode *head; //head of free list
|
FreeListNode *head;
|
||||||
size_t element_size; //size of elements in free
|
size_t element_size;
|
||||||
//list
|
int maxFreeListLength;
|
||||||
int maxFreeListLength; //max size of free structures
|
int freeListLength;
|
||||||
//to keep
|
|
||||||
int freeListLength; //current size of free list
|
|
||||||
|
|
||||||
} FreeList;
|
} FreeList;
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: FreeListInit
|
* \brief Initializes Free List.
|
||||||
*
|
*
|
||||||
* Description:
|
* Must be called first and only once for FreeList.
|
||||||
* Initializes Free List. Must be called first.
|
*
|
||||||
* And only once for FreeList.
|
* \return:
|
||||||
* Parameters:
|
* \li \c 0 on success.
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
* \li \c EINVAL on failure.
|
||||||
* size_t - size of elements to store in free list
|
*/
|
||||||
* maxFreeListSize - max size that the free list can grow to
|
int FreeListInit(
|
||||||
* before returning memory to O.S.
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* Returns:
|
FreeList *free_list,
|
||||||
* 0 on success. Nonzero on failure.
|
/*! Size of elements to store in free list. */
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int FreeListInit(FreeList *free_list,
|
|
||||||
size_t elementSize,
|
size_t elementSize,
|
||||||
int maxFreeListSize);
|
/*! Max size that the free list can grow to before returning
|
||||||
|
* memory to O.S. */
|
||||||
|
int maxFreeListLength);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: FreeListAlloc
|
* \brief Allocates chunk of set size.
|
||||||
*
|
*
|
||||||
* Description:
|
* If a free item is available in the list, returnes the stored item,
|
||||||
* Allocates chunk of set size.
|
* otherwise calls the O.S. to allocate memory.
|
||||||
* If a free item is available in the list, returnes the stored item.
|
|
||||||
* Otherwise calls the O.S. to allocate memory.
|
|
||||||
* Parameters:
|
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
|
||||||
* Returns:
|
|
||||||
* Non NULL on success. NULL on failure.
|
|
||||||
*****************************************************************************/
|
|
||||||
void * FreeListAlloc (FreeList *free_list);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: FreeListFree
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Non NULL on success. NULL on failure.
|
||||||
* Returns an item to the Free List.
|
*/
|
||||||
* If the free list is smaller than the max size than
|
void *FreeListAlloc(
|
||||||
* adds the item to the free list.
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* Otherwise returns the item to the O.S.
|
FreeList *free_list);
|
||||||
* Parameters:
|
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
|
||||||
* Returns:
|
|
||||||
* 0 on success. Nonzero on failure.
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int FreeListFree (FreeList *free_list,void * element);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: FreeListDestroy
|
* \brief Returns an item to the Free List.
|
||||||
*
|
*
|
||||||
* Description:
|
* If the free list is smaller than the max size then adds the item to the
|
||||||
* Releases the resources stored with the free list.
|
* free list, otherwise returns the item to the O.S.
|
||||||
* Parameters:
|
*
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
* \return:
|
||||||
* Returns:
|
* \li \c 0 on success.
|
||||||
* 0 on success. Nonzero on failure.
|
* \li \c EINVAL on failure.
|
||||||
* Always returns 0.
|
*/
|
||||||
*****************************************************************************/
|
int FreeListFree(
|
||||||
int FreeListDestroy (FreeList *free_list);
|
/*! Must be valid, non null, pointer to a free list. */
|
||||||
|
FreeList *free_list,
|
||||||
|
/*! Must be a pointer allocated by FreeListAlloc. */
|
||||||
|
void *element);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Releases the resources stored with the free list.
|
||||||
|
*
|
||||||
|
* \return:
|
||||||
|
* \li \c 0 on success.
|
||||||
|
* \li \c EINVAL on failure.
|
||||||
|
*/
|
||||||
|
int FreeListDestroy(
|
||||||
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
|
FreeList *free_list);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // FREE_LIST_H
|
#endif /* FREE_LIST_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,41 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef LINKED_LIST_H
|
#ifndef LINKED_LIST_H
|
||||||
#define LINKED_LIST_H
|
#define LINKED_LIST_H
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
#include "FreeList.h"
|
#include "FreeList.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -44,44 +48,26 @@ extern "C" {
|
|||||||
#define LIST_SUCCESS 1
|
#define LIST_SUCCESS 1
|
||||||
#define LIST_FAIL 0
|
#define LIST_FAIL 0
|
||||||
|
|
||||||
/****************************************************************************
|
/*! Function for freeing list items. */
|
||||||
* Name: free_routine
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Function for freeing list items
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef void (*free_function)(void *arg);
|
typedef void (*free_function)(void *arg);
|
||||||
|
|
||||||
/****************************************************************************
|
/*! Function for comparing list items. Returns 1 if itemA==itemB */
|
||||||
* Name: cmp_routine
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Function for comparing list items
|
|
||||||
* Returns 1 if itemA==itemB
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef int (*cmp_routine)(void *itemA,void *itemB);
|
typedef int (*cmp_routine)(void *itemA,void *itemB);
|
||||||
|
|
||||||
/****************************************************************************
|
/*! Linked list node. Stores generic item and pointers to next and prev.
|
||||||
* Name: ListNode
|
* \internal
|
||||||
*
|
*/
|
||||||
* Description:
|
|
||||||
* linked list node. stores generic item and pointers to next and prev.
|
|
||||||
* Internal Use Only.
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef struct LISTNODE
|
typedef struct LISTNODE
|
||||||
{
|
{
|
||||||
struct LISTNODE *prev; //previous node
|
struct LISTNODE *prev;
|
||||||
struct LISTNODE *next; //next node
|
struct LISTNODE *next;
|
||||||
void *item; //item
|
void *item;
|
||||||
} ListNode;
|
} ListNode;
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Name: LinkedList
|
* Linked list (no protection).
|
||||||
*
|
*
|
||||||
* Description:
|
* Because this is for internal use, parameters are NOT checked for validity.
|
||||||
* linked list (no protection). Internal Use Only.
|
|
||||||
* Because this is for internal use, parameters are NOT checked for
|
|
||||||
* validity.
|
|
||||||
* The first item of the list is stored at node: head->next
|
* The first item of the list is stored at node: head->next
|
||||||
* The last item of the list is stored at node: tail->prev
|
* The last item of the list is stored at node: tail->prev
|
||||||
* If head->next=tail, then list is empty.
|
* If head->next=tail, then list is empty.
|
||||||
@@ -89,242 +75,215 @@ typedef struct LISTNODE
|
|||||||
*
|
*
|
||||||
* LinkedList g;
|
* LinkedList g;
|
||||||
* ListNode *temp = NULL;
|
* ListNode *temp = NULL;
|
||||||
* for (temp = ListHead(g);temp!=NULL;temp = ListNext(g,temp))
|
* for (temp = ListHead(g);temp!=NULL;temp = ListNext(g,temp)) {
|
||||||
* {
|
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
* \internal
|
||||||
|
*/
|
||||||
typedef struct LINKEDLIST
|
typedef struct LINKEDLIST
|
||||||
{
|
{
|
||||||
ListNode head; //head, first item is stored at: head->next
|
/*! head, first item is stored at: head->next */
|
||||||
ListNode tail; //tail, last item is stored at: tail->prev
|
ListNode head;
|
||||||
long size; //size of list
|
/*! tail, last item is stored at: tail->prev */
|
||||||
FreeList freeNodeList; //free list to use
|
ListNode tail;
|
||||||
free_function free_func; //free function to use
|
/*! size of list */
|
||||||
cmp_routine cmp_func; //compare function to use
|
long size;
|
||||||
|
/*! free list to use */
|
||||||
|
FreeList freeNodeList;
|
||||||
|
/*! free function to use */
|
||||||
|
free_function free_func;
|
||||||
|
/*! compare function to use */
|
||||||
|
cmp_routine cmp_func;
|
||||||
} LinkedList;
|
} LinkedList;
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListInit
|
* \brief Initializes LinkedList. Must be called first and only once for List.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return
|
||||||
* Initializes LinkedList. Must be called first.
|
* \li \c 0 on success.
|
||||||
* And only once for List.
|
* \li \c EOUTOFMEM on failure.
|
||||||
* Parameters:
|
*/
|
||||||
* list - must be valid, non null, pointer to a linked list.
|
int ListInit(
|
||||||
* cmp_func - function used to compare items. (May be NULL)
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* free_func - function used to free items. (May be NULL)
|
LinkedList *list,
|
||||||
* Returns:
|
/*! Function used to compare items. (May be NULL). */
|
||||||
* 0 on success, EOUTOFMEM on failure.
|
cmp_routine cmp_func,
|
||||||
*****************************************************************************/
|
/*! Function used to free items. (May be NULL). */
|
||||||
int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func);
|
free_function free_func);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListAddHead
|
* \brief Adds a node to the head of the list. Node gets immediately after
|
||||||
|
* list head.
|
||||||
*
|
*
|
||||||
* Description:
|
|
||||||
* Adds a node to the head of the list.
|
|
||||||
* Node gets immediately after list.head.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* void * item - item to be added
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
|
||||||
* Precondition:
|
* Precondition:
|
||||||
* The list has been initialized.
|
* The list has been initialized.
|
||||||
*****************************************************************************/
|
*
|
||||||
ListNode *ListAddHead(LinkedList *list, void *item);
|
* \return The pointer to the ListNode on success, NULL on failure.
|
||||||
|
*/
|
||||||
|
ListNode *ListAddHead(
|
||||||
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
|
LinkedList *list,
|
||||||
|
/*! Item to be added. */
|
||||||
|
void *item);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListAddTail
|
* \brief Adds a node to the tail of the list. Node gets added immediately
|
||||||
|
* before list.tail.
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Adds a node to the tail of the list.
|
*
|
||||||
* Node gets added immediately before list.tail.
|
* \return The pointer to the ListNode on success, NULL on failure.
|
||||||
* Parameters:
|
*/
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
ListNode *ListAddTail(
|
||||||
* void * item - item to be added
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* Returns:
|
LinkedList *list,
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
/*! Item to be added. */
|
||||||
* Precondition:
|
void *item);
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *ListAddTail(LinkedList *list, void *item);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListAddAfter
|
* \brief Adds a node after the specified node. Node gets added immediately
|
||||||
|
* after bnode.
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Adds a node after the specified node.
|
*
|
||||||
* Node gets added immediately after bnode.
|
* \return The pointer to the ListNode on success, NULL on failure.
|
||||||
* Parameters:
|
*/
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
ListNode *ListAddAfter(
|
||||||
* void * item - item to be added
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* ListNode * bnode - node to add after
|
LinkedList *list,
|
||||||
* Returns:
|
/*! Item to be added. */
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
void *item,
|
||||||
* Precondition:
|
/*! Node to add after. */
|
||||||
* The list has been initialized.
|
ListNode *bnode);
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *ListAddAfter(LinkedList *list, void *item, ListNode *bnode);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Adds a node before the specified node. Node gets added immediately
|
||||||
|
* before anode.
|
||||||
|
*
|
||||||
|
* Precondition: The list has been initialized.
|
||||||
|
*
|
||||||
|
* \return The pointer to the ListNode on success, NULL on failure.
|
||||||
|
*/
|
||||||
|
ListNode *ListAddBefore(
|
||||||
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
|
LinkedList *list,
|
||||||
|
/*! Item to be added. */
|
||||||
|
void *item,
|
||||||
|
/*! Node to add in front of. */
|
||||||
|
ListNode *anode);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListAddBefore
|
* \brief Removes a node from the list. The memory for the node is freed.
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Adds a node before the specified node.
|
*
|
||||||
* Node gets added immediately before anode.
|
* \return The pointer to the item stored in the node or NULL if the item
|
||||||
* Parameters:
|
* is freed.
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
*/
|
||||||
* ListNode * anode - node to add the in front of.
|
void *ListDelNode(
|
||||||
* void * item - item to be added
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* Returns:
|
LinkedList *list,
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
/*! Node to delete. */
|
||||||
* Precondition:
|
ListNode *dnode,
|
||||||
* The list has been initialized.
|
/*! if !0 then item is freed using free function. If 0 (or free
|
||||||
*****************************************************************************/
|
* function is NULL) then item is not freed. */
|
||||||
ListNode *ListAddBefore(LinkedList *list,void *item, ListNode *anode);
|
int freeItem);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Removes all memory associated with list nodes. Does not free
|
||||||
|
* LinkedList *list.
|
||||||
|
*
|
||||||
|
* Precondition: The list has been initialized.
|
||||||
|
*
|
||||||
|
* \return 0 on success, EINVAL on failure.
|
||||||
|
*/
|
||||||
|
int ListDestroy(
|
||||||
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
|
LinkedList *list,
|
||||||
|
/*! if !0 then item is freed using free function. If 0 (or free
|
||||||
|
* function is NULL) then item is not freed. */
|
||||||
|
int freeItem);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListDelNode
|
* \brief Returns the head of the list.
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Removes a node from the list
|
*
|
||||||
* The memory for the node is freed.
|
* \return The head of the list. NULL if list is empty.
|
||||||
* Parameters:
|
*/
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
ListNode *ListHead(
|
||||||
* ListNode *dnode - done to delete.
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* freeItem - if !0 then item is freed using free function.
|
LinkedList *list);
|
||||||
* if 0 (or free function is NULL) then item is not freed
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the item stored in the node or NULL if the item is freed.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
void *ListDelNode(LinkedList *list,ListNode *dnode, int freeItem);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListDestroy
|
* \brief Returns the tail of the list.
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Removes all memory associated with list nodes.
|
|
||||||
* Does not free LinkedList *list.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return The tail of the list. NULL if list is empty.
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
*/
|
||||||
* freeItem - if !0 then items are freed using the free_function.
|
ListNode *ListTail(
|
||||||
* if 0 (or free function is NULL) then items are not freed.
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* Returns:
|
LinkedList *list);
|
||||||
* 0 on success. Always returns 0.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
int ListDestroy(LinkedList *list, int freeItem);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns the next item in the list.
|
||||||
|
*
|
||||||
|
* Precondition: The list has been initialized.
|
||||||
|
*
|
||||||
|
* \return The next item in the list. NULL if there are no more items in list.
|
||||||
|
*/
|
||||||
|
ListNode *ListNext(
|
||||||
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
|
LinkedList *list,
|
||||||
|
/*! Node from the list. */
|
||||||
|
ListNode *node);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListHead
|
* \brief Returns the previous item in the list.
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Returns the head of the list.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return The previous item in the list. NULL if there are no more items in list.
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
*/
|
||||||
*
|
ListNode *ListPrev(
|
||||||
* Returns:
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* The head of the list. NULL if list is empty.
|
LinkedList *list,
|
||||||
* Precondition:
|
/*! Node from the list. */
|
||||||
* The list has been initialized.
|
ListNode *node);
|
||||||
*****************************************************************************/
|
|
||||||
ListNode* ListHead(LinkedList *list);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ListTail
|
* \brief Finds the specified item in the list.
|
||||||
*
|
*
|
||||||
* Description:
|
|
||||||
* Returns the tail of the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The tail of the list. NULL if list is empty.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode* ListTail(LinkedList *list);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: ListNext
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the next item in the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The next item in the list. NULL if there are no more items in list.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode* ListNext(LinkedList *list, ListNode * node);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: ListPrev
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the previous item in the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The previous item in the list. NULL if there are no more items in list.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode* ListPrev(LinkedList *list, ListNode * node);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: ListFind
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Finds the specified item in the list.
|
|
||||||
* Uses the compare function specified in ListInit. If compare function
|
* Uses the compare function specified in ListInit. If compare function
|
||||||
* is NULL then compares items as pointers.
|
* is NULL then compares items as pointers.
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* ListNode *start - the node to start from, NULL if to start from
|
|
||||||
* beginning.
|
|
||||||
* void * item - the item to search for.
|
|
||||||
* Returns:
|
|
||||||
* The node containing the item. NULL if no node contains the item.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode* ListFind(LinkedList *list, ListNode *start, void * item);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Function: ListSize
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Precondition: The list has been initialized.
|
||||||
* Returns the size of the list.
|
*
|
||||||
* Parameters:
|
* \return The node containing the item. NULL if no node contains the item.
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
*/
|
||||||
|
ListNode* ListFind(
|
||||||
* Returns:
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
* The number of items in the list.
|
LinkedList *list,
|
||||||
* Precondition:
|
/*! The node to start from, NULL if to start from beginning. */
|
||||||
* The list has been initialized.
|
ListNode *start,
|
||||||
*****************************************************************************/
|
/*! The item to search for. */
|
||||||
int ListSize(LinkedList* list);
|
void *item);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns the size of the list.
|
||||||
|
*
|
||||||
|
* Precondition: The list has been initialized.
|
||||||
|
*
|
||||||
|
* \return The number of items in the list.
|
||||||
|
*/
|
||||||
|
long ListSize(
|
||||||
|
/*! Must be valid, non null, pointer to a linked list. */
|
||||||
|
LinkedList* list);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //LINKED_LIST_H
|
#endif /* LINKED_LIST_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,207 +1,204 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef THREADPOOL_H
|
#ifndef THREADPOOL_H
|
||||||
#define THREADPOOL_H
|
#define THREADPOOL_H
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "FreeList.h"
|
||||||
|
#include "ithread.h"
|
||||||
|
#include "LinkedList.h"
|
||||||
|
#include "UpnpInet.h"
|
||||||
|
#include "UpnpGlobal.h" /* for UPNP_INLINE, EXPORT_SPEC */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <time.h>
|
||||||
|
struct timezone
|
||||||
|
{
|
||||||
|
int tz_minuteswest; /* minutes W of Greenwich */
|
||||||
|
int tz_dsttime; /* type of dst correction */
|
||||||
|
};
|
||||||
|
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||||
|
#else /* WIN32 */
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/time.h> /* for gettimeofday() */
|
||||||
|
#if defined(__OSX__) || defined(__APPLE__) || defined(__NetBSD__)
|
||||||
|
#include <sys/resource.h> /* for setpriority() */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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 duration {
|
||||||
|
SHORT_TERM,
|
||||||
|
PERSISTENT
|
||||||
|
} Duration;
|
||||||
|
|
||||||
typedef enum priority {LOW_PRIORITY,
|
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
|
/*! default priority used by TPJobInit */
|
||||||
#define DEFAULT_MIN_THREADS 1 //default minimum used by TPAttrInit
|
#define DEFAULT_PRIORITY MED_PRIORITY
|
||||||
#define DEFAULT_MAX_THREADS 10 //default max used by TPAttrInit
|
|
||||||
#define DEFAULT_JOBS_PER_THREAD 10 //default jobs per thread used by TPAttrInit
|
|
||||||
#define DEFAULT_STARVATION_TIME 500 //default starvation time used by TPAttrInit
|
|
||||||
#define DEFAULT_IDLE_TIME 10 * 1000 //default idle time used by TPAttrInit
|
|
||||||
#define DEFAULT_FREE_ROUTINE NULL //default free routine used TPJobInit
|
|
||||||
#define DEFAULT_MAX_JOBS_TOTAL 100 //default max jobs used TPAttrInit
|
|
||||||
|
|
||||||
#define STATS 1 //always include stats because code change is minimal
|
/*! default minimum used by TPAttrInit */
|
||||||
|
#define DEFAULT_MIN_THREADS 1
|
||||||
|
|
||||||
|
/*! default max used by TPAttrInit */
|
||||||
|
#define DEFAULT_MAX_THREADS 10
|
||||||
|
|
||||||
//Statistics
|
/*! default stack size used by TPAttrInit */
|
||||||
#ifdef WIN32 // todo: check why STATSONLY fails during compilation
|
#define DEFAULT_STACK_SIZE 0
|
||||||
#undef STATS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef STATS
|
/*! default jobs per thread used by TPAttrInit */
|
||||||
#define STATSONLY(x) x
|
#define DEFAULT_JOBS_PER_THREAD 10
|
||||||
#else
|
|
||||||
#define STATSONLY(x)
|
/*! default starvation time used by TPAttrInit */
|
||||||
#endif
|
#define DEFAULT_STARVATION_TIME 500
|
||||||
|
|
||||||
|
/*! default idle time used by TPAttrInit */
|
||||||
|
#define DEFAULT_IDLE_TIME 10 * 1000
|
||||||
|
|
||||||
|
/*! default free routine used TPJobInit */
|
||||||
|
#define DEFAULT_FREE_ROUTINE NULL
|
||||||
|
|
||||||
|
/*! default max jobs used TPAttrInit */
|
||||||
|
#define DEFAULT_MAX_JOBS_TOTAL 100
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Statistics.
|
||||||
|
*
|
||||||
|
* Always include stats because code change is minimal.
|
||||||
|
*/
|
||||||
|
#define STATS 1
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//DEBUGGING
|
|
||||||
#ifndef WIN32
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define DBGONLY(x) x
|
|
||||||
#else
|
|
||||||
#define DBGONLY(x)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "LinkedList.h"
|
|
||||||
#include <sys/timeb.h>
|
|
||||||
#include "FreeList.h"
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/timeb.h>
|
|
||||||
#define EXPORT
|
|
||||||
typedef int PolicyType;
|
typedef int PolicyType;
|
||||||
#define DEFAULT_POLICY SCHED_OTHER
|
|
||||||
#define DEFAULT_SCHED_PARAM 0 //default priority
|
|
||||||
|
|
||||||
/****************************************************************************
|
#define DEFAULT_POLICY SCHED_OTHER
|
||||||
* Name: free_routine
|
|
||||||
*
|
/*! Function for freeing a thread argument. */
|
||||||
* Description:
|
|
||||||
* Function for freeing a thread argument
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef void (*free_routine)(void *arg);
|
typedef void (*free_routine)(void *arg);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: ThreadPoolAttr
|
/*! Attributes for thread pool. Used to set and change parameters of thread
|
||||||
*
|
* pool. */
|
||||||
* Description:
|
|
||||||
* Attributes for thread pool. Used to set and change parameters of
|
|
||||||
* thread pool
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef struct THREADPOOLATTR
|
typedef struct THREADPOOLATTR
|
||||||
{
|
{
|
||||||
int minThreads; // minThreads, ThreadPool will always maintain at least
|
/*! ThreadPool will always maintain at least this many threads. */
|
||||||
// this many threads
|
int minThreads;
|
||||||
|
/*! ThreadPool will never have more than this number of threads. */
|
||||||
int maxThreads; // maxThreads, ThreadPool will never have more than this
|
int maxThreads;
|
||||||
// number of threads
|
/*! This is the minimum stack size allocated for each thread. */
|
||||||
|
size_t stackSize;
|
||||||
int maxIdleTime; // maxIdleTime (in milliseconds)
|
/*! This is the maximum time a thread will
|
||||||
// this is the maximum time a thread will remain idle
|
* remain idle before dying (in milliseconds). */
|
||||||
// before dying
|
int maxIdleTime;
|
||||||
|
/*! Jobs per thread to maintain. */
|
||||||
int jobsPerThread; // jobs per thread to maintain
|
int jobsPerThread;
|
||||||
|
/*! Maximum number of jobs that can be queued totally. */
|
||||||
int maxJobsTotal; // maximum number of jobs that can be queued totally.
|
int maxJobsTotal;
|
||||||
|
/*! the time a low priority or med priority job waits before getting
|
||||||
int starvationTime; // the time a low priority or med priority
|
* bumped up a priority (in milliseconds). */
|
||||||
// job waits before getting bumped
|
int starvationTime;
|
||||||
// up a priority (in milliseconds)
|
/*! scheduling policy to use. */
|
||||||
|
PolicyType schedPolicy;
|
||||||
PolicyType schedPolicy; // scheduling policy to use
|
|
||||||
|
|
||||||
} ThreadPoolAttr;
|
} ThreadPoolAttr;
|
||||||
|
|
||||||
/****************************************************************************
|
/*! Internal ThreadPool Job. */
|
||||||
* Name: ThreadPool
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Internal ThreadPool Job
|
|
||||||
*****************************************************************************/
|
|
||||||
typedef struct THREADPOOLJOB
|
typedef struct THREADPOOLJOB
|
||||||
{
|
{
|
||||||
start_routine func; //function
|
start_routine func;
|
||||||
void *arg; //arg
|
void *arg;
|
||||||
free_routine free_func; //free function
|
free_routine free_func;
|
||||||
struct timeb requestTime; //time of request
|
struct timeval requestTime;
|
||||||
int priority; //priority of request
|
int priority;
|
||||||
int jobId; //id
|
int jobId;
|
||||||
} ThreadPoolJob;
|
} ThreadPoolJob;
|
||||||
|
|
||||||
/****************************************************************************
|
/*! Structure to hold statistics. */
|
||||||
* Name: ThreadPoolStats
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Structure to hold statistics
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
STATSONLY(
|
|
||||||
|
|
||||||
typedef struct TPOOLSTATS
|
typedef struct TPOOLSTATS
|
||||||
{
|
{
|
||||||
double totalTimeHQ; //total time spent by all jobs in high priority Q
|
double totalTimeHQ;
|
||||||
int totalJobsHQ; //total jobs in HQ run so far
|
int totalJobsHQ;
|
||||||
double avgWaitHQ; //average wait in HQ
|
double avgWaitHQ;
|
||||||
double totalTimeMQ; //total time spent by all jobs in med priority Q
|
double totalTimeMQ;
|
||||||
int totalJobsMQ; //total jobs in MQ run so far
|
int totalJobsMQ;
|
||||||
double avgWaitMQ; //average wait in MQ
|
double avgWaitMQ;
|
||||||
double totalTimeLQ; //total time spent by all jobs in low priority Q
|
double totalTimeLQ;
|
||||||
int totalJobsLQ; //total jobs in LQ run so far
|
int totalJobsLQ;
|
||||||
double avgWaitLQ; //average wait in LQ
|
double avgWaitLQ;
|
||||||
double totalWorkTime; //total time spent working for all threads
|
double totalWorkTime;
|
||||||
double totalIdleTime; //total time spent idle for all threads
|
double totalIdleTime;
|
||||||
int workerThreads; //number of current workerThreads
|
int workerThreads;
|
||||||
int idleThreads; //number of current idle threads
|
int idleThreads;
|
||||||
int persistentThreads; //number of persistent threads
|
int persistentThreads;
|
||||||
int totalThreads; //total number of current threads
|
int totalThreads;
|
||||||
int maxThreads; //max threads so far
|
int maxThreads;
|
||||||
int currentJobsHQ; // current jobs in Q
|
int currentJobsHQ;
|
||||||
int currentJobsLQ; //current jobs in Q
|
int currentJobsLQ;
|
||||||
int currentJobsMQ; //current jobs in Q
|
int currentJobsMQ;
|
||||||
} ThreadPoolStats;
|
} ThreadPoolStats;
|
||||||
|
|
||||||
)
|
/*!
|
||||||
|
* \brief A thread pool similar to the thread pool in the UPnP SDK.
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: ThreadPool
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -210,352 +207,327 @@ 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
|
/*! Mutex to protect job qs. */
|
||||||
ithread_cond_t condition; //condition variable to signal Q
|
ithread_mutex_t mutex;
|
||||||
ithread_cond_t start_and_shutdown; //condition variable for start
|
/*! Condition variable to signal Q. */
|
||||||
//and stop
|
ithread_cond_t condition;
|
||||||
int lastJobId; //ids for jobs
|
/*! Condition variable for start and stop. */
|
||||||
int shutdown; //whether or not we are shutting down
|
ithread_cond_t start_and_shutdown;
|
||||||
int totalThreads; //total number of threads
|
/*! ids for jobs */
|
||||||
int persistentThreads; //number of persistent threads
|
int lastJobId;
|
||||||
FreeList jobFreeList; //free list of jobs
|
/*! whether or not we are shutting down */
|
||||||
LinkedList lowJobQ; //low priority job Q
|
int shutdown;
|
||||||
LinkedList medJobQ; //med priority job Q
|
/*! total number of threads */
|
||||||
LinkedList highJobQ; //high priority job Q
|
int totalThreads;
|
||||||
ThreadPoolJob *persistentJob; //persistent job
|
/*! number of threads that are currently executing jobs */
|
||||||
|
int busyThreads;
|
||||||
ThreadPoolAttr attr; //thread pool attributes
|
/*! number of persistent threads */
|
||||||
|
int persistentThreads;
|
||||||
//statistics
|
/*! free list of jobs */
|
||||||
STATSONLY(ThreadPoolStats stats;)
|
FreeList jobFreeList;
|
||||||
|
/*! low priority job Q */
|
||||||
|
LinkedList lowJobQ;
|
||||||
|
/*! med priority job Q */
|
||||||
|
LinkedList medJobQ;
|
||||||
|
/*! high priority job Q */
|
||||||
|
LinkedList highJobQ;
|
||||||
|
/*! persistent job */
|
||||||
|
ThreadPoolJob *persistentJob;
|
||||||
|
/*! thread pool attributes */
|
||||||
|
ThreadPoolAttr attr;
|
||||||
|
/*! statistics */
|
||||||
|
ThreadPoolStats stats;
|
||||||
} ThreadPool;
|
} ThreadPool;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initializes and starts ThreadPool. Must be called first and
|
||||||
/****************************************************************************
|
* only once for ThreadPool.
|
||||||
* Function: ThreadPoolInit
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \return
|
||||||
* Initializes and starts ThreadPool. Must be called first.
|
* \li \c 0 on success.
|
||||||
* And only once for ThreadPool.
|
* \li \c EAGAIN if not enough system resources to create minimum threads.
|
||||||
* Parameters:
|
* \li \c INVALID_POLICY if schedPolicy can't be set.
|
||||||
* tp - must be valid, non null, pointer to ThreadPool.
|
* \li \c EMAXTHREADS if minimum threads is greater than maximum threads.
|
||||||
* attr - can be null
|
*/
|
||||||
*
|
int ThreadPoolInit(
|
||||||
* if not null then attr contains the following fields:
|
/*! Must be valid, non null, pointer to ThreadPool. */
|
||||||
*
|
ThreadPool *tp,
|
||||||
* minWorkerThreads - minimum number of worker threads
|
/*! Can be null. if not null then attr contains the following fields:
|
||||||
* thread pool will never have less than this
|
* \li \c minWorkerThreads - minimum number of worker threads thread
|
||||||
* number of threads.
|
* pool will never have less than this number of threads.
|
||||||
* maxWorkerThreads - maximum number of worker threads
|
* \li \c maxWorkerThreads - maximum number of worker threads thread
|
||||||
* thread pool will never have more than this
|
* pool will never have more than this number of threads.
|
||||||
* number of threads.
|
* \li \c maxIdleTime - maximum time that a worker thread will spend
|
||||||
* maxIdleTime - maximum time that a worker thread will spend
|
* idle. If a worker is idle longer than this time and there are more
|
||||||
* idle. If a worker is idle longer than this
|
* than the min number of workers running, then the worker thread
|
||||||
* time and there are more than the min
|
* exits.
|
||||||
* number of workers running, than the
|
* \li \c jobsPerThread - ratio of jobs to thread to try and maintain
|
||||||
* worker thread exits.
|
* if a job is scheduled and the number of jobs per thread is greater
|
||||||
* jobsPerThread - ratio of jobs to thread to try and maintain
|
* than this number,and if less than the maximum number of workers are
|
||||||
* if a job is scheduled and the number of jobs per
|
* running then a new thread is started to help out with efficiency.
|
||||||
* thread is greater than this number,and
|
* \li \c schedPolicy - scheduling policy to try and set (OS dependent).
|
||||||
* if less than the maximum number of
|
*/
|
||||||
* workers are running then a new thread is
|
|
||||||
* started to help out with efficiency.
|
|
||||||
* schedPolicy - scheduling policy to try and set (OS dependent)
|
|
||||||
* Returns:
|
|
||||||
* 0 on success, nonzero on failure.
|
|
||||||
* EAGAIN if not enough system resources to create minimum threads.
|
|
||||||
* INVALID_POLICY if schedPolicy can't be set
|
|
||||||
* EMAXTHREADS if minimum threads is greater than maximum threads
|
|
||||||
*****************************************************************************/
|
|
||||||
int ThreadPoolInit(ThreadPool *tp,
|
|
||||||
ThreadPoolAttr *attr);
|
ThreadPoolAttr *attr);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ThreadPoolAddPersistent
|
* \brief Adds a persistent job to the thread pool.
|
||||||
*
|
*
|
||||||
* Description:
|
* Job will be run as soon as possible. Call will block until job is scheduled.
|
||||||
* Adds a persistent job to the thread pool.
|
|
||||||
* Job will be run as soon as possible.
|
|
||||||
* Call will block until job is scheduled.
|
|
||||||
* Parameters:
|
|
||||||
* tp - valid thread pool pointer
|
|
||||||
* ThreadPoolJob - valid thread pool job with the following fields:
|
|
||||||
*
|
*
|
||||||
* func - ThreadFunction to run
|
* \return
|
||||||
* arg - argument to function.
|
* \li \c 0 on success.
|
||||||
* priority - priority of job.
|
* \li \c EOUTOFMEM not enough memory to add job.
|
||||||
*
|
* \li \c EMAXTHREADS not enough threads to add persistent job.
|
||||||
* Returns:
|
*/
|
||||||
* 0 on success, nonzero on failure
|
int ThreadPoolAddPersistent(
|
||||||
* EOUTOFMEM not enough memory to add job.
|
/*! Valid thread pool pointer. */
|
||||||
* EMAXTHREADS not enough threads to add persistent job.
|
ThreadPool*tp,
|
||||||
*****************************************************************************/
|
/*! Valid thread pool job. */
|
||||||
int ThreadPoolAddPersistent (ThreadPool*tp,
|
|
||||||
ThreadPoolJob *job,
|
ThreadPoolJob *job,
|
||||||
|
/*! . */
|
||||||
int *jobId);
|
int *jobId);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ThreadPoolGetAttr
|
* \brief Gets the current set of attributes associated with the thread pool.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return
|
||||||
* Gets the current set of attributes
|
* \li \c 0 on success, nonzero on failure.
|
||||||
* associated with the thread pool.
|
*/
|
||||||
* Parameters:
|
int ThreadPoolGetAttr(
|
||||||
* tp - valid thread pool pointer
|
/*! valid thread pool pointer. */
|
||||||
* out - non null pointer to store attributes
|
ThreadPool *tp,
|
||||||
* Returns:
|
/*! non null pointer to store attributes. */
|
||||||
* 0 on success, nonzero on failure
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int ThreadPoolGetAttr(ThreadPool *tp,
|
|
||||||
ThreadPoolAttr *out);
|
ThreadPoolAttr *out);
|
||||||
/****************************************************************************
|
|
||||||
* Function: ThreadPoolSetAttr
|
/*!
|
||||||
*
|
* \brief Sets the attributes for the thread pool.
|
||||||
* Description:
|
|
||||||
* Sets the attributes for the thread pool.
|
|
||||||
* Only affects future calculations.
|
* Only affects future calculations.
|
||||||
* Parameters:
|
*
|
||||||
* tp - valid thread pool pointer
|
* \return
|
||||||
* attr - pointer to attributes, null sets attributes to default.
|
* \li \c 0 on success, nonzero on failure.
|
||||||
* Returns:
|
* \li \c INVALID_POLICY if policy can not be set.
|
||||||
* 0 on success, nonzero on failure
|
*/
|
||||||
* Returns INVALID_POLICY if policy can not be set.
|
int ThreadPoolSetAttr(
|
||||||
*****************************************************************************/
|
/*! valid thread pool pointer. */
|
||||||
int ThreadPoolSetAttr(ThreadPool *tp,
|
ThreadPool *tp,
|
||||||
|
/*! pointer to attributes, null sets attributes to default. */
|
||||||
ThreadPoolAttr *attr);
|
ThreadPoolAttr *attr);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ThreadPoolAdd
|
* \brief Adds a job to the thread pool. Job will be run as soon as possible.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return
|
||||||
* Adds a job to the thread pool.
|
* \li \c 0 on success, nonzero on failure.
|
||||||
* Job will be run as soon as possible.
|
* \li \c EOUTOFMEM if not enough memory to add job.
|
||||||
* Parameters:
|
*/
|
||||||
* tp - valid thread pool pointer
|
int ThreadPoolAdd(
|
||||||
* func - ThreadFunction to run
|
/*! valid thread pool pointer. */
|
||||||
* arg - argument to function.
|
ThreadPool*tp,
|
||||||
* priority - priority of job.
|
/*! . */
|
||||||
* poolid - id of job
|
|
||||||
* free_function - function to use when freeing argument
|
|
||||||
* Returns:
|
|
||||||
* 0 on success, nonzero on failure
|
|
||||||
* EOUTOFMEM if not enough memory to add job.
|
|
||||||
*****************************************************************************/
|
|
||||||
int ThreadPoolAdd (ThreadPool*tp,
|
|
||||||
ThreadPoolJob *job,
|
ThreadPoolJob *job,
|
||||||
|
/*! id of job. */
|
||||||
int *jobId);
|
int *jobId);
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ThreadPoolRemove
|
* \brief Removes a job from the thread pool. Can only remove jobs which
|
||||||
|
* are not currently running.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return
|
||||||
* Removes a job from the thread pool.
|
* \li \c 0 on success, nonzero on failure.
|
||||||
* Can only remove jobs which are not
|
* \li \c INVALID_JOB_ID if job not found.
|
||||||
* currently running.
|
*/
|
||||||
* Parameters:
|
int ThreadPoolRemove(
|
||||||
* tp - valid thread pool pointer
|
/*! valid thread pool pointer. */
|
||||||
* jobid - id of job
|
ThreadPool *tp,
|
||||||
* out - space for removed job.
|
/*! id of job. */
|
||||||
* Returns:
|
int jobId,
|
||||||
* 0 on success, nonzero on failure.
|
/*! space for removed job. */
|
||||||
* INVALID_JOB_ID if job not found.
|
ThreadPoolJob *out);
|
||||||
*****************************************************************************/
|
|
||||||
int ThreadPoolRemove(ThreadPool *tp,
|
|
||||||
int jobId, ThreadPoolJob *out);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Shuts the thread pool down. Waits for all threads to finish.
|
||||||
/****************************************************************************
|
* May block indefinitely if jobs do not exit.
|
||||||
* Function: ThreadPoolShutdown
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \return 0 on success, nonzero on failure
|
||||||
* Shuts the thread pool down.
|
*/
|
||||||
* Waits for all threads to finish.
|
int ThreadPoolShutdown(
|
||||||
* May block indefinitely if jobs do not
|
/*! must be valid tp. */
|
||||||
* exit.
|
ThreadPool *tp);
|
||||||
* Parameters:
|
|
||||||
* tp - must be valid tp
|
|
||||||
* Returns:
|
|
||||||
* 0 on success, nonzero on failure
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int ThreadPoolShutdown(ThreadPool *tp);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
/****************************************************************************
|
* \brief Initializes thread pool job. Sets the priority to default defined
|
||||||
* Function: TPJobInit
|
* in ThreadPool.h. Sets the free_routine to default defined in ThreadPool.h.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Initializes thread pool job.
|
*/
|
||||||
* Sets the priority to default defined in ThreadPool.h.
|
int TPJobInit(
|
||||||
* Sets the free_routine to default defined in ThreadPool.h
|
/*! must be valid thread pool attributes. */
|
||||||
* Parameters:
|
ThreadPoolJob *job,
|
||||||
* ThreadPoolJob *job - must be valid thread pool attributes.
|
/*! function to run, must be valid. */
|
||||||
* start_routine func - function to run, must be valid
|
start_routine func,
|
||||||
* void * arg - argument to pass to function.
|
/*! argument to pass to function. */
|
||||||
* Returns:
|
void *arg);
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPJobSetPriority
|
* \brief Sets the max threads for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the max threads for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPJobSetPriority(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* maxThreads - value to set
|
ThreadPoolJob *job,
|
||||||
* Returns:
|
/*! value to set. */
|
||||||
* Always returns 0.
|
ThreadPriority priority);
|
||||||
*****************************************************************************/
|
|
||||||
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPJobSetFreeFunction
|
* \brief Sets the max threads for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the max threads for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPJobSetFreeFunction(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* maxThreads - value to set
|
ThreadPoolJob *job,
|
||||||
* Returns:
|
/*! value to set. */
|
||||||
* Always returns 0.
|
free_routine func);
|
||||||
*****************************************************************************/
|
|
||||||
int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
/****************************************************************************
|
* \brief Initializes thread pool attributes. Sets values to defaults defined
|
||||||
* Function: TPAttrInit
|
* in ThreadPool.h.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Initializes thread pool attributes.
|
*/
|
||||||
* Sets values to defaults defined in ThreadPool.h.
|
int TPAttrInit(
|
||||||
* Parameters:
|
/*! must be valid thread pool attributes. */
|
||||||
* attr - must be valid thread pool attributes.
|
ThreadPoolAttr *attr);
|
||||||
* Returns:
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrInit(ThreadPoolAttr *attr);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPAttrSetMaxThreads
|
* \brief Sets the max threads for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the max threads for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPAttrSetMaxThreads(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* maxThreads - value to set
|
ThreadPoolAttr *attr,
|
||||||
* Returns:
|
/*! value to set. */
|
||||||
* Always returns 0.
|
int maxThreads);
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPAttrSetMinThreads
|
* \brief Sets the min threads for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the min threads for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPAttrSetMinThreads(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* minThreads - value to set
|
ThreadPoolAttr *attr,
|
||||||
* Returns:
|
/*! value to set. */
|
||||||
* Always returns 0.
|
int minThreads);
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPAttrSetIdleTime
|
* \brief Sets the stack size for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the idle time for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPAttrSetStackSize(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* Returns:
|
ThreadPoolAttr *attr,
|
||||||
* Always returns 0.
|
/*! value to set. */
|
||||||
*****************************************************************************/
|
size_t stackSize);
|
||||||
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPAttrSetJobsPerThread
|
* \brief Sets the idle time for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the jobs per thread ratio
|
*/
|
||||||
* Parameters:
|
int TPAttrSetIdleTime(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* jobsPerThread - number of jobs per thread to maintain
|
ThreadPoolAttr *attr,
|
||||||
* Returns:
|
/*! . */
|
||||||
* Always returns 0.
|
int idleTime);
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPAttrSetStarvationTime
|
* \brief Sets the jobs per thread ratio
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the starvation time for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPAttrSetJobsPerThread(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* int starvationTime - milliseconds
|
ThreadPoolAttr *attr,
|
||||||
* Returns:
|
/*! number of jobs per thread to maintain. */
|
||||||
* Always returns 0.
|
int jobsPerThread);
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: TPAttrSetSchedPolicy
|
* \brief Sets the starvation time for the thread pool attributes.
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the scheduling policy for the thread pool attributes.
|
*/
|
||||||
* Parameters:
|
int TPAttrSetStarvationTime(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* PolicyType schedPolicy - must be a valid policy type.
|
ThreadPoolAttr *attr,
|
||||||
* Returns:
|
/*! milliseconds. */
|
||||||
* Always returns 0.
|
int starvationTime);
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrSetSchedPolicy(ThreadPoolAttr *attr, PolicyType schedPolicy);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
/****************************************************************************
|
* \brief Sets the scheduling policy for the thread pool attributes.
|
||||||
* Function: TPAttrSetMaxJobsTotal
|
|
||||||
*
|
*
|
||||||
* Description:
|
* \return Always returns 0.
|
||||||
* Sets the maximum number jobs that can be qeued totally.
|
*/
|
||||||
* Parameters:
|
int TPAttrSetSchedPolicy(
|
||||||
* attr - must be valid thread pool attributes.
|
/*! must be valid thread pool attributes. */
|
||||||
* maxJobsTotal - maximum number of jobs
|
ThreadPoolAttr *attr,
|
||||||
* Returns:
|
/*! must be a valid policy type. */
|
||||||
* Always returns 0.
|
PolicyType schedPolicy);
|
||||||
*****************************************************************************/
|
|
||||||
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: ThreadPoolGetStats
|
* \brief Sets the maximum number jobs that can be qeued totally.
|
||||||
|
*
|
||||||
|
* \return Always returns 0.
|
||||||
|
*/
|
||||||
|
int TPAttrSetMaxJobsTotal(
|
||||||
|
/*! must be valid thread pool attributes. */
|
||||||
|
ThreadPoolAttr *attr,
|
||||||
|
/*! maximum number of jobs. */
|
||||||
|
int maxJobsTotal);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns various statistics about the thread pool.
|
||||||
*
|
*
|
||||||
* Description:
|
|
||||||
* Returns various statistics about the
|
|
||||||
* thread pool.
|
|
||||||
* Only valid if STATS has been defined.
|
* Only valid if STATS has been defined.
|
||||||
* Parameters:
|
*
|
||||||
* ThreadPool *tp - valid initialized threadpool
|
* \return Always returns 0.
|
||||||
* ThreadPoolStats *stats - valid stats, out parameter
|
*/
|
||||||
* Returns:
|
#ifdef STATS
|
||||||
* Always returns 0.
|
EXPORT_SPEC int ThreadPoolGetStats(
|
||||||
*****************************************************************************/
|
/*! Valid initialized threadpool. */
|
||||||
STATSONLY( EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats););
|
ThreadPool *tp,
|
||||||
|
/*! Valid stats, out parameter. */
|
||||||
|
ThreadPoolStats *stats);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE int ThreadPoolGetStats(
|
||||||
|
/*! Valid initialized threadpool. */
|
||||||
|
ThreadPool *tp,
|
||||||
|
/*! Valid stats, out parameter. */
|
||||||
|
ThreadPoolStats *stats) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
STATSONLY(EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats););
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
#ifdef STATS
|
||||||
|
EXPORT_SPEC void ThreadPoolPrintStats(
|
||||||
|
/*! . */
|
||||||
|
ThreadPoolStats *stats);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE void ThreadPoolPrintStats(
|
||||||
|
/*! . */
|
||||||
|
ThreadPoolStats *stats) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //ThreadPool
|
#endif /* THREADPOOL_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +1,44 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef TIMERTHREAD_H
|
#ifndef TIMERTHREAD_H
|
||||||
#define TIMERTHREAD_H
|
#define TIMERTHREAD_H
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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
|
||||||
@@ -43,149 +47,115 @@ extern "C" {
|
|||||||
|
|
||||||
#define INVALID_EVENT_ID (-10 & 1<<29)
|
#define INVALID_EVENT_ID (-10 & 1<<29)
|
||||||
|
|
||||||
//Timeout Types
|
/*! Timeout Types. */
|
||||||
//absolute means in seconds from Jan 1, 1970
|
typedef enum timeoutType {
|
||||||
//relative means in seconds from current time
|
/*! seconds from Jan 1, 1970. */
|
||||||
typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType;
|
ABS_SEC,
|
||||||
|
/*! seconds from current time. */
|
||||||
|
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; //mutex to protect eventQ
|
ithread_mutex_t mutex;
|
||||||
ithread_cond_t condition; //condition variable
|
ithread_cond_t condition;
|
||||||
int lastEventId; //last event id
|
int lastEventId;
|
||||||
LinkedList eventQ; //event q
|
LinkedList eventQ;
|
||||||
int shutdown; //whether or not we are shutdown
|
int shutdown;
|
||||||
FreeList freeEvents; //FreeList for events
|
FreeList freeEvents;
|
||||||
ThreadPool *tp; //ThreadPool to use
|
ThreadPool *tp;
|
||||||
} 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;
|
||||||
int id; //id of job
|
/*! [in] Long term or short term job. */
|
||||||
|
Duration persistent;
|
||||||
|
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);
|
||||||
|
|
||||||
|
/*!
|
||||||
/************************************************************************
|
* \brief Schedules an event to run at a specified time.
|
||||||
* Function: TimerThreadSchedule
|
|
||||||
*
|
*
|
||||||
* 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
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //TIMER_THREAD_H
|
#endif /* TIMER_THREAD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#define EXPORT
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocates enough memory for the
|
|
||||||
* Formatted string, up to max
|
|
||||||
* specified.
|
|
||||||
* With max set to -1, allocates
|
|
||||||
* as much size as needed.
|
|
||||||
* Memory must be freed using free.
|
|
||||||
*/
|
|
||||||
|
|
||||||
EXPORT int iasnprintf(char **ret,
|
|
||||||
int incr,
|
|
||||||
int max,
|
|
||||||
const char * fmt, ...)
|
|
||||||
#ifndef SPARC_SOLARIS
|
|
||||||
#if (__GNUC__ >= 3)
|
|
||||||
__attribute__((format (__printf__, 4, 5)));
|
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
EXPORT void iasnprintfFree(char *);
|
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,68 +1,94 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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 ITHREAD_H
|
||||||
|
#define ITHREAD_H
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(WIN32)
|
||||||
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "UpnpGlobal.h" /* For UPNP_INLINE, EXPORT_SPEC */
|
||||||
|
|
||||||
|
|
||||||
#ifndef ITHREADH
|
|
||||||
#define ITHREADH
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define DEBUG_ONLY(x) x
|
|
||||||
#else
|
|
||||||
#define DEBUG_ONLY(x)
|
|
||||||
#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 PTHREAD_MUTEX_RECURSIVE
|
|
||||||
|
#if defined(BSD)
|
||||||
|
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
|
||||||
/* 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
|
||||||
*/
|
*/
|
||||||
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
|
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
|
||||||
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
|
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
|
||||||
#else
|
#else /* PTHREAD_MUTEX_RECURSIVE */
|
||||||
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
|
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
|
||||||
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
|
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
|
||||||
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
|
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
|
||||||
#endif
|
#endif /* PTHREAD_MUTEX_RECURSIVE */
|
||||||
|
|
||||||
|
|
||||||
|
#define ITHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
|
||||||
|
#define ITHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
|
||||||
|
|
||||||
|
|
||||||
#define ITHREAD_CANCELED PTHREAD_CANCELED
|
#define ITHREAD_CANCELED PTHREAD_CANCELED
|
||||||
|
|
||||||
|
|
||||||
|
#define ITHREAD_STACK_MIN PTHREAD_STACK_MIN
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Name: ithread_t
|
* Name: ithread_t
|
||||||
*
|
*
|
||||||
@@ -73,6 +99,7 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_t ithread_t;
|
typedef pthread_t ithread_t;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ithread_attr_t
|
* Name: ithread_attr_t
|
||||||
*
|
*
|
||||||
@@ -138,6 +165,124 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_condattr_t ithread_condattr_t;
|
typedef pthread_condattr_t ithread_condattr_t;
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: ithread_rwlockattr_t
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Mutex attribute.
|
||||||
|
* typedef to pthread_rwlockattr_t
|
||||||
|
* Internal Use Only
|
||||||
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: ithread_rwlock_t
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Condition attribute.
|
||||||
|
* typedef to pthread_rwlock_t
|
||||||
|
* Internal Use Only
|
||||||
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
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
|
||||||
*
|
*
|
||||||
@@ -152,9 +297,9 @@ extern "C" {
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_mutexattr_init
|
* See man page for pthread_mutexattr_init
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#define ithread_mutexattr_init pthread_mutexattr_init
|
#define ithread_mutexattr_init pthread_mutexattr_init
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_mutexattr_destroy
|
* Function: ithread_mutexattr_destroy
|
||||||
*
|
*
|
||||||
@@ -182,7 +327,7 @@ extern "C" {
|
|||||||
* ITHREAD_MUTEX_ERRORCHECK_NP
|
* ITHREAD_MUTEX_ERRORCHECK_NP
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_mutexattr_t * mutex (must be valid non NULL pointer to
|
* ithread_mutexattr_t * attr (must be valid non NULL pointer to
|
||||||
* ithread_mutexattr_t)
|
* ithread_mutexattr_t)
|
||||||
* int kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP
|
* int kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP
|
||||||
* or ITHREAD_MUTEX_ERRORCHECK_NP)
|
* or ITHREAD_MUTEX_ERRORCHECK_NP)
|
||||||
@@ -191,11 +336,11 @@ extern "C" {
|
|||||||
* Returns EINVAL if the kind is not supported.
|
* Returns EINVAL if the kind is not supported.
|
||||||
* See man page for pthread_mutexattr_setkind_np
|
* See man page for pthread_mutexattr_setkind_np
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
|
||||||
#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
|
||||||
@@ -207,7 +352,7 @@ extern "C" {
|
|||||||
* ITHREAD_MUTEX_ERRORCHECK_NP
|
* ITHREAD_MUTEX_ERRORCHECK_NP
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_mutexattr_t * mutex (must be valid non NULL pointer to
|
* ithread_mutexattr_t * attr (must be valid non NULL pointer to
|
||||||
* pthread_mutexattr_t)
|
* pthread_mutexattr_t)
|
||||||
* int *kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP
|
* int *kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP
|
||||||
* or ITHREAD_MUTEX_ERRORCHECK_NP)
|
* or ITHREAD_MUTEX_ERRORCHECK_NP)
|
||||||
@@ -216,11 +361,11 @@ extern "C" {
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
* See man page for pthread_mutexattr_getkind_np
|
* See man page for pthread_mutexattr_getkind_np
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
|
||||||
#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 */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -240,6 +385,7 @@ extern "C" {
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#define ithread_mutex_init pthread_mutex_init
|
#define ithread_mutex_init pthread_mutex_init
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_mutex_lock
|
* Function: ithread_mutex_lock
|
||||||
*
|
*
|
||||||
@@ -294,6 +440,200 @@ extern "C" {
|
|||||||
#define ithread_mutex_destroy pthread_mutex_destroy
|
#define ithread_mutex_destroy pthread_mutex_destroy
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlockattr_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initializes a rwlock attribute variable to default values.
|
||||||
|
* Parameters:
|
||||||
|
* const ithread_rwlockattr_init *attr (must be valid non NULL pointer to
|
||||||
|
* pthread_rwlockattr_t)
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlockattr_init
|
||||||
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#define ithread_rwlockattr_init pthread_rwlockattr_init
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlockattr_destroy
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Releases any resources held by the rwlock attribute.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlockattr_t *attr (must be valid non NULL pointer to
|
||||||
|
* pthread_rwlockattr_t)
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlockattr_destroy
|
||||||
|
***************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlockatttr_setpshared
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Sets the rwlock type in the attribute.
|
||||||
|
* Valid types are: ITHREAD_PROCESS_PRIVATE
|
||||||
|
* ITHREAD_PROCESS_SHARED
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlockattr_t * attr (must be valid non NULL pointer to
|
||||||
|
* ithread_rwlockattr_t)
|
||||||
|
* int kind (one of ITHREAD_PROCESS_PRIVATE or ITHREAD_PROCESS_SHARED)
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success. Nonzero on failure.
|
||||||
|
* Returns EINVAL if the kind is not supported.
|
||||||
|
* See man page for pthread_rwlockattr_setkind_np
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlockatttr_getpshared
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Gets the rwlock type in the attribute.
|
||||||
|
* Valid types are: ITHREAD_PROCESS_PRIVATE
|
||||||
|
* ITHREAD_PROCESS_SHARED
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlockattr_t * attr (must be valid non NULL pointer to
|
||||||
|
* pthread_rwlockattr_t)
|
||||||
|
* int *kind (one of ITHREAD_PROCESS_PRIVATE or ITHREAD_PROCESS_SHARED)
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success. Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlockatttr_getpshared
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
|
||||||
|
#endif /* UPNP_USE_RWLOCK */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlock_init
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initializes rwlock.
|
||||||
|
* Must be called before use.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
|
* const ithread_rwlockattr_t *rwlock_attr
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlock_init
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#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
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Locks rwlock for reading.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
|
* rwlock must be initialized.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlock_rdlock
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#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
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Locks rwlock for writting.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
|
* rwlock must be initialized.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlock_wrlock
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlock_unlock
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Unlocks rwlock.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
|
* rwlock must be initialized.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success, Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlock_unlock
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Function: ithread_rwlock_destroy
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Releases any resources held by the rwlock.
|
||||||
|
* rwlock can no longer be used after this call.
|
||||||
|
* rwlock is only destroyed when there are no longer any threads waiting on it.
|
||||||
|
* rwlock cannot be destroyed if it is locked.
|
||||||
|
* Parameters:
|
||||||
|
* ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t)
|
||||||
|
* rwlock must be initialized.
|
||||||
|
* Returns:
|
||||||
|
* 0 on success. Nonzero on failure.
|
||||||
|
* Always returns 0.
|
||||||
|
* See man page for pthread_rwlock_destroy
|
||||||
|
*****************************************************************************/
|
||||||
|
#if UPNP_USE_RWLOCK
|
||||||
|
#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 */
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_cond_init
|
* Function: ithread_cond_init
|
||||||
*
|
*
|
||||||
@@ -310,7 +650,6 @@ extern "C" {
|
|||||||
#define ithread_cond_init pthread_cond_init
|
#define ithread_cond_init pthread_cond_init
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_cond_signal
|
* Function: ithread_cond_signal
|
||||||
*
|
*
|
||||||
@@ -370,22 +709,18 @@ extern "C" {
|
|||||||
* 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
|
||||||
@@ -410,6 +745,49 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#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
|
||||||
@@ -419,7 +797,7 @@ extern "C" {
|
|||||||
* 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:
|
||||||
@@ -457,6 +835,7 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_exit pthread_exit
|
#define ithread_exit pthread_exit
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_get_current_thread_id
|
* Function: ithread_get_current_thread_id
|
||||||
*
|
*
|
||||||
@@ -480,6 +859,7 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_self pthread_self
|
#define ithread_self pthread_self
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_detach
|
* Function: ithread_detach
|
||||||
*
|
*
|
||||||
@@ -493,6 +873,7 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_detach pthread_detach
|
#define ithread_detach pthread_detach
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_join
|
* Function: ithread_join
|
||||||
*
|
*
|
||||||
@@ -512,7 +893,6 @@ extern "C" {
|
|||||||
#define ithread_join pthread_join
|
#define ithread_join pthread_join
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
*
|
*
|
||||||
@@ -526,7 +906,12 @@ extern "C" {
|
|||||||
* 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
|
||||||
@@ -541,31 +926,23 @@ extern "C" {
|
|||||||
* 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
|
||||||
|
|
||||||
|
|
||||||
#ifndef PTHREAD_MUTEX_RECURSIVE
|
#if !defined(PTHREAD_MUTEX_RECURSIVE) && !defined(__DragonFly__)
|
||||||
//NK: Added for satisfying the gcc compiler
|
/* NK: Added for satisfying the gcc compiler */
|
||||||
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //ITHREADH
|
|
||||||
|
#endif /* ITHREAD_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,85 +1,54 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// 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 "FreeList.h"
|
#include "FreeList.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/****************************************************************************
|
int FreeListInit(FreeList *free_list, size_t elementSize, int maxFreeListLength)
|
||||||
* Function: FreeListInit
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initializes Free List. Must be called first.
|
|
||||||
* And only once for FreeList.
|
|
||||||
* Parameters:
|
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
|
||||||
* size_t - size of elements to store in free list
|
|
||||||
* maxFreeListSize - max size that the free list can grow to
|
|
||||||
* before returning memory to O.S.
|
|
||||||
* Returns:
|
|
||||||
* 0 on success. Nonzero on failure.
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
FreeListInit( FreeList * free_list,
|
|
||||||
size_t elementSize,
|
|
||||||
int maxFreeListLength )
|
|
||||||
{
|
{
|
||||||
assert(free_list != NULL);
|
assert(free_list != NULL);
|
||||||
|
|
||||||
if (free_list == NULL)
|
if (free_list == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
free_list->element_size = elementSize;
|
free_list->element_size = elementSize;
|
||||||
free_list->maxFreeListLength = maxFreeListLength;
|
free_list->maxFreeListLength = maxFreeListLength;
|
||||||
free_list->head = NULL;
|
free_list->head = NULL;
|
||||||
free_list->freeListLength = 0;
|
free_list->freeListLength = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
void *FreeListAlloc(FreeList *free_list)
|
||||||
* Function: FreeListAlloc
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Allocates chunk of set size.
|
|
||||||
* If a free item is available in the list, returnes the stored item.
|
|
||||||
* Otherwise calls the O.S. to allocate memory.
|
|
||||||
* Parameters:
|
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
|
||||||
* Returns:
|
|
||||||
* Non NULL on success. NULL on failure.
|
|
||||||
*****************************************************************************/
|
|
||||||
void *
|
|
||||||
FreeListAlloc( FreeList * free_list )
|
|
||||||
{
|
{
|
||||||
FreeListNode *ret = NULL;
|
FreeListNode *ret = NULL;
|
||||||
|
|
||||||
@@ -99,79 +68,44 @@ FreeListAlloc( FreeList * free_list )
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
int FreeListFree(FreeList *free_list, void *element)
|
||||||
* Function: FreeListFree
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns an item to the Free List.
|
|
||||||
* If the free list is smaller than the max size than
|
|
||||||
* adds the item to the free list.
|
|
||||||
* Otherwise returns the item to the O.S.
|
|
||||||
* Parameters:
|
|
||||||
* free_list - must be valid, non null, pointer to a free list.
|
|
||||||
* element - must be a pointer allocated by FreeListAlloc
|
|
||||||
* Returns:
|
|
||||||
* 0 on success. Nonzero on failure.
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
FreeListFree( FreeList * free_list,
|
|
||||||
void *element )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
FreeListNode *temp = NULL;
|
FreeListNode *temp = NULL;
|
||||||
|
|
||||||
assert(free_list != NULL);
|
assert(free_list != NULL);
|
||||||
|
|
||||||
if (free_list == NULL)
|
if (free_list == NULL)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
if (element != NULL &&
|
||||||
if( ( element != NULL ) &&
|
free_list->freeListLength + 1 < free_list->maxFreeListLength) {
|
||||||
( ( free_list->freeListLength + 1 ) <
|
|
||||||
free_list->maxFreeListLength ) ) {
|
|
||||||
free_list->freeListLength++;
|
free_list->freeListLength++;
|
||||||
temp = (FreeListNode *)element;
|
temp = (FreeListNode *)element;
|
||||||
temp->next = free_list->head;
|
temp->next = free_list->head;
|
||||||
free_list->head = temp;
|
free_list->head = temp;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
free(element);
|
free(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
int FreeListDestroy(FreeList *free_list)
|
||||||
* Function: FreeListDestroy
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Releases the resources stored with the free list.
|
|
||||||
* Parameters:
|
|
||||||
* free_list - must be valid, non null, pointer to a linked list.
|
|
||||||
* Returns:
|
|
||||||
* 0 on success. Nonzero on failure.
|
|
||||||
* Always returns 0.
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
FreeListDestroy( FreeList * free_list )
|
|
||||||
{
|
{
|
||||||
FreeListNode *temp = NULL;
|
FreeListNode *temp = NULL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
assert(free_list != NULL);
|
assert(free_list != NULL);
|
||||||
|
|
||||||
if( free_list == NULL )
|
if (!free_list)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
while (free_list->head) {
|
while (free_list->head) {
|
||||||
i++;
|
i++;
|
||||||
temp = free_list->head->next;
|
temp = free_list->head->next;
|
||||||
free(free_list->head);
|
free(free_list->head);
|
||||||
free_list->head = temp;
|
free_list->head = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
free_list->freeListLength = 0;
|
free_list->freeListLength = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,67 +1,71 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/**************************************************************************
|
||||||
//
|
*
|
||||||
// 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 __FreeBSD__
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/* Do not #include <sys/param.h> */
|
||||||
|
#else
|
||||||
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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, LinkedList *list)
|
||||||
freeListNode( ListNode * node,
|
|
||||||
LinkedList * list )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
return FreeListFree(&list->freeNodeList, node);
|
return FreeListFree(&list->freeNodeList, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* Function: CreateListNode
|
* \brief Dynamically creates a list node.
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Creates a list node. Dynamically.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* void * item - the item to store
|
* void * item - the item to store
|
||||||
* Returns:
|
* Returns:
|
||||||
* The new node, NULL on failure.
|
* The new node, NULL on failure.
|
||||||
*****************************************************************************/
|
*/
|
||||||
static ListNode *
|
static ListNode *CreateListNode(
|
||||||
CreateListNode( void *item,
|
/*! the item to store. */
|
||||||
|
void *item,
|
||||||
|
/*! The list to add it to. */
|
||||||
LinkedList *list)
|
LinkedList *list)
|
||||||
{
|
{
|
||||||
|
|
||||||
ListNode *temp = NULL;
|
ListNode *temp = NULL;
|
||||||
|
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
@@ -72,49 +76,28 @@ CreateListNode( void *item,
|
|||||||
temp->next = NULL;
|
temp->next = NULL;
|
||||||
temp->item = item;
|
temp->item = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
int ListInit(LinkedList *list, cmp_routine cmp_func, free_function free_func)
|
||||||
* Function: ListInit
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initializes LinkedList. Must be called first.
|
|
||||||
* And only once for List.
|
|
||||||
* Parameters:
|
|
||||||
* list - must be valid, non null, pointer to a linked list.
|
|
||||||
* cmp_func - function used to compare items. (May be NULL)
|
|
||||||
* free_func - function used to free items. (May be NULL)
|
|
||||||
* Returns:
|
|
||||||
* 0 on success, EOUTOFMEM on failure.
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
ListInit( LinkedList * list,
|
|
||||||
cmp_routine cmp_func,
|
|
||||||
free_function free_func )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
int retCode = 0;
|
int retCode = 0;
|
||||||
|
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( list == NULL )
|
if (!list)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
list->size = 0;
|
list->size = 0;
|
||||||
list->cmp_func = cmp_func;
|
list->cmp_func = cmp_func;
|
||||||
list->free_func = free_func;
|
list->free_func = free_func;
|
||||||
|
retCode = FreeListInit(&list->freeNodeList, sizeof(ListNode), FREELISTSIZE);
|
||||||
retCode =
|
|
||||||
FreeListInit( &list->freeNodeList, sizeof( ListNode ),
|
|
||||||
FREELISTSIZE );
|
|
||||||
|
|
||||||
assert(retCode == 0);
|
assert(retCode == 0);
|
||||||
|
|
||||||
list->head.item = NULL;
|
list->head.item = NULL;
|
||||||
list->head.next = &list->tail;
|
list->head.next = &list->tail;
|
||||||
list->head.prev = NULL;
|
list->head.prev = NULL;
|
||||||
|
|
||||||
list->tail.item = NULL;
|
list->tail.item = NULL;
|
||||||
list->tail.prev = &list->head;
|
list->tail.prev = &list->head;
|
||||||
list->tail.next = NULL;
|
list->tail.next = NULL;
|
||||||
@@ -122,23 +105,7 @@ ListInit( LinkedList * list,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListAddHead(LinkedList *list, void *item)
|
||||||
* Function: ListAddHead
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Adds a node to the head of the list.
|
|
||||||
* Node gets immediately after list.head.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* void * item - item to be added
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListAddHead( LinkedList * list,
|
|
||||||
void *item )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
@@ -148,59 +115,24 @@ ListAddHead( LinkedList * list,
|
|||||||
return ListAddAfter(list, item, &list->head);
|
return ListAddAfter(list, item, &list->head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListAddTail(LinkedList *list, void *item)
|
||||||
* Function: ListAddTail
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Adds a node to the tail of the list.
|
|
||||||
* Node gets added immediately before list.tail.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* void * item - item to be added
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListAddTail( LinkedList * list,
|
|
||||||
void *item )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( list == NULL )
|
if (!list)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ListAddBefore(list, item, &list->tail);
|
return ListAddBefore(list, item, &list->tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListAddAfter(LinkedList *list, void *item, ListNode *bnode)
|
||||||
* Function: ListAddAfter
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Adds a node after the specified node.
|
|
||||||
* Node gets added immediately after bnode.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* void * item - item to be added
|
|
||||||
* ListNode * bnode - node to add after
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListAddAfter( LinkedList * list,
|
|
||||||
void *item,
|
|
||||||
ListNode * bnode )
|
|
||||||
{
|
{
|
||||||
ListNode *newNode = NULL;
|
ListNode *newNode = NULL;
|
||||||
|
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( ( list == NULL ) || ( bnode == NULL ) )
|
if (!list || !bnode)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
newNode = CreateListNode(item, list);
|
newNode = CreateListNode(item, list);
|
||||||
if (newNode) {
|
if (newNode) {
|
||||||
ListNode *temp = bnode->next;
|
ListNode *temp = bnode->next;
|
||||||
@@ -210,40 +142,22 @@ ListAddAfter( LinkedList * list,
|
|||||||
newNode->next = temp;
|
newNode->next = temp;
|
||||||
temp->prev = newNode;
|
temp->prev = newNode;
|
||||||
list->size++;
|
list->size++;
|
||||||
|
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListAddBefore(LinkedList *list, void *item, ListNode *anode)
|
||||||
* Function: ListAddBefore
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Adds a node before the specified node.
|
|
||||||
* Node gets added immediately before anode.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* ListNode * anode - node to add the in front of.
|
|
||||||
* void * item - item to be added
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the ListNode on success, NULL on failure.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListAddBefore( LinkedList * list,
|
|
||||||
void *item,
|
|
||||||
ListNode * anode )
|
|
||||||
{
|
{
|
||||||
ListNode *newNode = NULL;
|
ListNode *newNode = NULL;
|
||||||
|
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( ( list == NULL ) || ( anode == NULL ) )
|
if (!list || !anode)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
newNode = CreateListNode(item, list);
|
newNode = CreateListNode(item, list);
|
||||||
|
|
||||||
if (newNode) {
|
if (newNode) {
|
||||||
ListNode *temp = anode->prev;
|
ListNode *temp = anode->prev;
|
||||||
|
|
||||||
@@ -252,30 +166,14 @@ ListAddBefore( LinkedList * list,
|
|||||||
newNode->prev = temp;
|
newNode->prev = temp;
|
||||||
temp->next = newNode;
|
temp->next = newNode;
|
||||||
list->size++;
|
list->size++;
|
||||||
|
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
void *ListDelNode(LinkedList *list, ListNode *dnode, int freeItem)
|
||||||
* Function: ListDelNode
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Removes a node from the list
|
|
||||||
* The memory for the node is freed but the
|
|
||||||
* the memory for the items are not.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* ListNode *dnode - done to delete.
|
|
||||||
* Returns:
|
|
||||||
* The pointer to the item stored in node on success, NULL on failure.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
void *
|
|
||||||
ListDelNode( LinkedList * list,
|
|
||||||
ListNode * dnode,
|
|
||||||
int freeItem )
|
|
||||||
{
|
{
|
||||||
void *temp;
|
void *temp;
|
||||||
|
|
||||||
@@ -283,19 +181,13 @@ ListDelNode( LinkedList * list,
|
|||||||
assert(dnode != &list->head);
|
assert(dnode != &list->head);
|
||||||
assert(dnode != &list->tail);
|
assert(dnode != &list->tail);
|
||||||
|
|
||||||
if( ( list == NULL ) ||
|
if (!list || dnode == &list->head || dnode == &list->tail || !dnode)
|
||||||
( dnode == &list->head ) ||
|
|
||||||
( dnode == &list->tail ) || ( dnode == NULL ) ) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
temp = dnode->item;
|
temp = dnode->item;
|
||||||
dnode->prev->next = dnode->next;
|
dnode->prev->next = dnode->next;
|
||||||
dnode->next->prev = dnode->prev;
|
dnode->next->prev = dnode->prev;
|
||||||
|
|
||||||
freeListNode(dnode, list);
|
freeListNode(dnode, list);
|
||||||
list->size--;
|
list->size--;
|
||||||
|
|
||||||
if (freeItem && list->free_func) {
|
if (freeItem && list->free_func) {
|
||||||
list->free_func(temp);
|
list->free_func(temp);
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
@@ -304,29 +196,12 @@ ListDelNode( LinkedList * list,
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
int ListDestroy(LinkedList *list, int freeItem)
|
||||||
* Function: ListDestroy
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Removes all memory associated with list nodes.
|
|
||||||
* Does not free LinkedList *list.
|
|
||||||
* Items stored in the list are not freed, only nodes are.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* Returns:
|
|
||||||
* 0 on success. Nonzero on failure.
|
|
||||||
* Always returns 0.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
ListDestroy( LinkedList * list,
|
|
||||||
int freeItem )
|
|
||||||
{
|
{
|
||||||
ListNode *dnode = NULL;
|
ListNode *dnode = NULL;
|
||||||
ListNode *temp = NULL;
|
ListNode *temp = NULL;
|
||||||
|
|
||||||
if( list == NULL )
|
if(!list)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
for (dnode = list->head.next; dnode != &list->tail; ) {
|
for (dnode = list->head.next; dnode != &list->tail; ) {
|
||||||
@@ -334,120 +209,57 @@ ListDestroy( LinkedList * list,
|
|||||||
ListDelNode(list, dnode, freeItem);
|
ListDelNode(list, dnode, freeItem);
|
||||||
dnode = temp;
|
dnode = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
list->size = 0;
|
list->size = 0;
|
||||||
FreeListDestroy(&list->freeNodeList);
|
FreeListDestroy(&list->freeNodeList);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListHead(LinkedList *list)
|
||||||
* Function: ListHead
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the head of the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The head of the list. NULL if list is empty.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListHead( LinkedList * list )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( list == NULL )
|
if (!list)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( list->size == 0 )
|
if (!list->size)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return list->head.next;
|
return list->head.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListTail(LinkedList *list)
|
||||||
* Function: ListTail
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the tail of the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The tail of the list. NULL if list is empty.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListTail( LinkedList * list )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( list == NULL )
|
if (!list)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( list->size == 0 )
|
if (!list->size)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return list->tail.prev;
|
return list->tail.prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListNext(LinkedList *list, ListNode *node)
|
||||||
* Function: ListNext
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the next item in the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The next item in the list. NULL if there are no more items in list.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListNext( LinkedList * list,
|
|
||||||
ListNode * node )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
assert(node != NULL);
|
assert(node != NULL);
|
||||||
|
|
||||||
if( ( list == NULL ) || ( node == NULL ) )
|
if (!list || !node)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (node->next == &list->tail)
|
if (node->next == &list->tail)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return node->next;
|
return node->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListPrev(LinkedList *list, ListNode *node)
|
||||||
* Function: ListPrev
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the previous item in the list.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* The previous item in the list. NULL if there are no more items in list.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListPrev( LinkedList * list,
|
|
||||||
ListNode * node )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
assert(node != NULL);
|
assert(node != NULL);
|
||||||
|
|
||||||
if( ( list == NULL ) || ( node == NULL ) )
|
if (!list || !node)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (node->prev == &list->head)
|
if (node->prev == &list->head)
|
||||||
@@ -456,35 +268,13 @@ ListPrev( LinkedList * list,
|
|||||||
return node->prev;
|
return node->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
ListNode *ListFind(LinkedList *list, ListNode *start, void *item)
|
||||||
* Function: ListFind
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Finds the specified item in the list.
|
|
||||||
* Uses the compare function specified in ListInit. If compare function
|
|
||||||
* is NULL then compares items as pointers.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
* ListNode *start - the node to start from, NULL if to start from
|
|
||||||
* beginning.
|
|
||||||
* void * item - the item to search for.
|
|
||||||
* Returns:
|
|
||||||
* The node containing the item. NULL if no node contains the item.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
ListNode *
|
|
||||||
ListFind( LinkedList * list,
|
|
||||||
ListNode * start,
|
|
||||||
void *item )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ListNode *finger = NULL;
|
ListNode *finger = NULL;
|
||||||
|
|
||||||
if( list == NULL )
|
if (!list)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (!start)
|
||||||
if( start == NULL )
|
|
||||||
start = &list->head;
|
start = &list->head;
|
||||||
|
|
||||||
assert(start);
|
assert(start);
|
||||||
@@ -505,29 +295,15 @@ ListFind( LinkedList * list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
long ListSize(LinkedList *list)
|
||||||
* Function: ListSize
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Returns the size of the list.
|
|
||||||
* Parameters:
|
|
||||||
* LinkedList *list - must be valid, non null, pointer to a linked list.
|
|
||||||
|
|
||||||
* Returns:
|
|
||||||
* The number of items in the list.
|
|
||||||
* Precondition:
|
|
||||||
* The list has been initialized.
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
ListSize( LinkedList * list )
|
|
||||||
{
|
{
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
|
|
||||||
if( list == NULL )
|
if (!list)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
return list->size;
|
return list->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,162 +1,127 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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:
|
static void FreeTimerEvent(
|
||||||
* Deallocates a dynamically allocated TimerEvent.
|
/*! [in] Valid timer thread pointer. */
|
||||||
* Parameters:
|
TimerThread *timer,
|
||||||
* TimerEvent *event - must be allocated with CreateTimerEvent
|
/*! [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;
|
||||||
|
|
||||||
TimerEvent *nextEvent = NULL;
|
TimerEvent *nextEvent = NULL;
|
||||||
|
|
||||||
time_t currentTime = 0;
|
time_t currentTime = 0;
|
||||||
time_t nextEventTime = 0;
|
time_t nextEventTime = 0;
|
||||||
struct timespec timeToWait;
|
struct timespec timeToWait;
|
||||||
|
|
||||||
int tempId;
|
int tempId;
|
||||||
|
|
||||||
assert( timer != NULL );
|
assert( timer != NULL );
|
||||||
|
|
||||||
ithread_mutex_lock( &timer->mutex );
|
ithread_mutex_lock( &timer->mutex );
|
||||||
|
while (1) {
|
||||||
while( 1 )
|
/* mutex should always be locked at top of loop */
|
||||||
{
|
/* Check for shutdown. */
|
||||||
|
if (timer->shutdown) {
|
||||||
//mutex should always be locked at top of loop
|
|
||||||
|
|
||||||
//Check for 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;
|
||||||
|
/* Get the next event if possible. */
|
||||||
//Get the next event if possible
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTime = time(NULL);
|
currentTime = time(NULL);
|
||||||
|
/* If time has elapsed, schedule job. */
|
||||||
//If time has elapsed, schedule job
|
if (nextEvent && 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) {
|
||||||
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;
|
||||||
@@ -165,38 +130,30 @@ CalculateEventTime( time_t * timeout,
|
|||||||
|
|
||||||
if (type == ABS_SEC)
|
if (type == ABS_SEC)
|
||||||
return 0;
|
return 0;
|
||||||
else if( type == REL_SEC ) {
|
else /*if (type == REL_SEC) */{
|
||||||
time(&now);
|
time(&now);
|
||||||
( *timeout ) += now;
|
( *timeout ) += now;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/*!
|
||||||
* 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 +172,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;
|
||||||
@@ -287,42 +227,16 @@ TimerThreadInit( TimerThread * timer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int TimerThreadSchedule(
|
||||||
* Function: 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,
|
||||||
Duration duration,
|
Duration duration,
|
||||||
int *id)
|
int *id)
|
||||||
{
|
{
|
||||||
|
|
||||||
int rc = EOUTOFMEM;
|
int rc = EOUTOFMEM;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int tempId = 0;
|
int tempId = 0;
|
||||||
@@ -355,35 +269,25 @@ TimerThreadSchedule( TimerThread * timer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tempNode = ListHead( &timer->eventQ );
|
tempNode = ListHead( &timer->eventQ );
|
||||||
//add job to Q
|
/* add job to Q. Q is ordered by eventTime with the head of the Q being
|
||||||
//Q is ordered by eventTime
|
* the next event. */
|
||||||
//with the head of the Q being the next event
|
|
||||||
|
|
||||||
while( tempNode != NULL ) {
|
while( tempNode != NULL ) {
|
||||||
temp = ( TimerEvent * ) tempNode->item;
|
temp = ( TimerEvent * ) tempNode->item;
|
||||||
if( temp->eventTime >= timeout )
|
if( temp->eventTime >= timeout ) {
|
||||||
{
|
if (ListAddBefore( &timer->eventQ, newEvent, tempNode))
|
||||||
|
|
||||||
if( ListAddBefore( &timer->eventQ, newEvent, tempNode ) !=
|
|
||||||
NULL )
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
tempNode = ListNext( &timer->eventQ, tempNode );
|
tempNode = ListNext( &timer->eventQ, tempNode );
|
||||||
}
|
}
|
||||||
|
/* add to the end of Q. */
|
||||||
//add to the end of Q
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
|
||||||
if( ListAddTail( &timer->eventQ, newEvent ) != NULL )
|
if( ListAddTail( &timer->eventQ, newEvent ) != NULL )
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
//signal change in Q
|
/* signal change in Q. */
|
||||||
if( rc == 0 ) {
|
if( rc == 0 ) {
|
||||||
|
|
||||||
ithread_cond_signal( &timer->condition );
|
ithread_cond_signal( &timer->condition );
|
||||||
} else {
|
} else {
|
||||||
FreeTimerEvent( timer, newEvent );
|
FreeTimerEvent( timer, newEvent );
|
||||||
@@ -394,26 +298,8 @@ TimerThreadSchedule( TimerThread * timer,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int TimerThreadRemove(
|
||||||
* Function: 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 +336,7 @@ TimerThreadRemove( TimerThread * timer,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
int TimerThreadShutdown(TimerThread *timer)
|
||||||
* Function: TimerThreadShutdown
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Shutdown the timer thread
|
|
||||||
* Events scheduled in the future will NOT be run.
|
|
||||||
* Timer thread should be shutdown BEFORE it's associated
|
|
||||||
* thread pool.
|
|
||||||
* Returns:
|
|
||||||
* returns 0 if succesfull,
|
|
||||||
* nonzero otherwise.
|
|
||||||
* Always returns 0.
|
|
||||||
***********************************************************************/
|
|
||||||
int
|
|
||||||
TimerThreadShutdown( TimerThread * timer )
|
|
||||||
{
|
{
|
||||||
ListNode *tempNode2 = NULL;
|
ListNode *tempNode2 = NULL;
|
||||||
ListNode *tempNode = NULL;
|
ListNode *tempNode = NULL;
|
||||||
@@ -480,9 +352,7 @@ TimerThreadShutdown( TimerThread * timer )
|
|||||||
timer->shutdown = 1;
|
timer->shutdown = 1;
|
||||||
tempNode = ListHead( &timer->eventQ );
|
tempNode = ListHead( &timer->eventQ );
|
||||||
|
|
||||||
//Delete nodes in Q
|
/* Delete nodes in Q. Call registered free function on argument. */
|
||||||
//call registered free function
|
|
||||||
//on argument
|
|
||||||
while( tempNode != NULL ) {
|
while( tempNode != NULL ) {
|
||||||
TimerEvent *temp = ( TimerEvent * ) tempNode->item;
|
TimerEvent *temp = ( TimerEvent * ) tempNode->item;
|
||||||
|
|
||||||
@@ -500,20 +370,19 @@ TimerThreadShutdown( TimerThread * timer )
|
|||||||
|
|
||||||
ithread_cond_broadcast( &timer->condition );
|
ithread_cond_broadcast( &timer->condition );
|
||||||
|
|
||||||
while( timer->shutdown ) //wait for timer thread to shutdown
|
while (timer->shutdown) {
|
||||||
{
|
/* wait for timer thread to shutdown. */
|
||||||
ithread_cond_wait( &timer->condition, &timer->mutex );
|
ithread_cond_wait( &timer->condition, &timer->mutex );
|
||||||
}
|
}
|
||||||
|
|
||||||
ithread_mutex_unlock(&timer->mutex);
|
ithread_mutex_unlock(&timer->mutex);
|
||||||
|
|
||||||
//destroy condition
|
/* destroy condition. */
|
||||||
while(ithread_cond_destroy(&timer->condition) != 0) {
|
while(ithread_cond_destroy(&timer->condition) != 0) {
|
||||||
}
|
}
|
||||||
|
/* destroy mutex. */
|
||||||
//destroy mutex
|
|
||||||
while (ithread_mutex_destroy(&timer->mutex) != 0) {
|
while (ithread_mutex_destroy(&timer->mutex) != 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,152 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <stdlib.h>
|
|
||||||
#else
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "iasnprintf.h"
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocates enough memory for the
|
|
||||||
* Formatted string, up to max
|
|
||||||
* specified.
|
|
||||||
* With max set to -1, it allocates as
|
|
||||||
* much size as needed.
|
|
||||||
* Memory must be freed using free.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
iasnprintf( char **ret,
|
|
||||||
int incr,
|
|
||||||
int max,
|
|
||||||
const char *fmt,
|
|
||||||
... )
|
|
||||||
{
|
|
||||||
int size = incr;
|
|
||||||
int retc = 0;
|
|
||||||
va_list ap;
|
|
||||||
char *temp = NULL;
|
|
||||||
|
|
||||||
assert( ret );
|
|
||||||
assert( fmt );
|
|
||||||
( *ret ) = ( char * )malloc( incr );
|
|
||||||
|
|
||||||
if( ( *ret ) == NULL ) return -1;
|
|
||||||
|
|
||||||
while( 1 ) {
|
|
||||||
va_start( ap, fmt );
|
|
||||||
retc = vsnprintf( ( *ret ), size, fmt, ap );
|
|
||||||
va_end( ap );
|
|
||||||
|
|
||||||
if( retc < 0 ) {
|
|
||||||
//size not big enough
|
|
||||||
//and vsnprintf does NOT return the
|
|
||||||
//necessary number of bytes
|
|
||||||
if( ( max != -1 ) && ( size == max ) ) //max reached
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
incr *= 2; //increase increment
|
|
||||||
//increase size and try again
|
|
||||||
if( ( max != -1 ) && ( ( size + incr ) > max ) ) {
|
|
||||||
incr = ( max - size );
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = ( char * )realloc( ( *ret ), size + incr );
|
|
||||||
if( temp == NULL ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
size += incr;
|
|
||||||
( *ret ) = temp;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if( ( retc + 1 ) > size ) {
|
|
||||||
//size not big enough
|
|
||||||
//and vsnprintf
|
|
||||||
//returns the necessary
|
|
||||||
//number of bytes
|
|
||||||
if( ( max != -1 ) && ( retc + 1 > max ) ) {
|
|
||||||
retc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = ( char * )realloc( ( *ret ), retc + 1 );
|
|
||||||
if( temp == NULL ) {
|
|
||||||
retc = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
size = retc + 1;
|
|
||||||
( *ret ) = temp; //size increased try again
|
|
||||||
} else if( ( retc + 1 ) < size ) {
|
|
||||||
//size is bigger than needed
|
|
||||||
//try and reallocate smaller
|
|
||||||
|
|
||||||
temp = ( char * )realloc( ( *ret ), retc + 1 );
|
|
||||||
if( temp != NULL ) {
|
|
||||||
( *ret ) = temp;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} else //size is just right, exit
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( retc < 0 ) {
|
|
||||||
free( ( *ret ) );
|
|
||||||
( *ret ) = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
iasnprintfFree( char *fChar )
|
|
||||||
{
|
|
||||||
free( fChar );
|
|
||||||
fChar = NULL;
|
|
||||||
}
|
|
||||||
158
upnp/Makefile.am
158
upnp/Makefile.am
@@ -1,69 +1,90 @@
|
|||||||
# $Id: Makefile.am,v 1.10 2006/04/08 15:22:22 r3mi Exp $
|
|
||||||
#
|
#
|
||||||
# "Makefile.am" for "libupnp/upnp"
|
# "Makefile.am" for "libupnp/upnp"
|
||||||
#
|
#
|
||||||
# Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
SUBDIRS = doc
|
SUBDIRS = doc . sample
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(srcdir)/inc \
|
AM_CPPFLAGS = \
|
||||||
|
-I$(srcdir)/inc \
|
||||||
-I$(top_srcdir)/threadutil/inc \
|
-I$(top_srcdir)/threadutil/inc \
|
||||||
-I$(top_srcdir)/ixml/inc
|
-I$(top_srcdir)/ixml/inc
|
||||||
|
|
||||||
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
LDADD = \
|
||||||
|
libupnp.la \
|
||||||
AM_LDFLAGS = $(PTHREAD_LIBS)
|
|
||||||
|
|
||||||
LDADD = libupnp.la \
|
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
$(top_builddir)/ixml/libixml.la
|
$(top_builddir)/ixml/libixml.la
|
||||||
|
|
||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = inc/upnp.h
|
upnpinclude_HEADERS = \
|
||||||
|
inc/UpnpString.h \
|
||||||
|
inc/upnp.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
|
||||||
upnpinclude_HEADERS += inc/upnptools.h
|
upnpinclude_HEADERS += inc/upnptools.h
|
||||||
endif
|
endif
|
||||||
if ENABLE_DEBUG
|
|
||||||
upnpinclude_HEADERS += inc/upnpdebug.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libupnp.la
|
lib_LTLIBRARIES = libupnp.la
|
||||||
|
|
||||||
libupnp_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/inc
|
libupnp_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/inc
|
||||||
libupnp_la_LDFLAGS = -version-info $(LT_VERSION_UPNP) \
|
|
||||||
|
libupnp_la_LDFLAGS = \
|
||||||
|
-version-info $(LT_VERSION_UPNP) \
|
||||||
-export-symbols-regex '^Upnp.*' \
|
-export-symbols-regex '^Upnp.*' \
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
$(top_builddir)/ixml/libixml.la
|
$(top_builddir)/ixml/libixml.la
|
||||||
|
|
||||||
libupnp_la_SOURCES = \
|
libupnp_la_SOURCES = \
|
||||||
src/inc/config.h \
|
src/inc/config.h \
|
||||||
src/inc/client_table.h src/inc/global.h \
|
src/inc/client_table.h \
|
||||||
src/inc/md5.h src/inc/ssdplib.h \
|
src/inc/gena.h \
|
||||||
src/inc/unixutil.h src/inc/urlconfig.h \
|
src/inc/gena_ctrlpt.h \
|
||||||
src/inc/gmtdate.h src/inc/membuffer.h \
|
src/inc/gena_device.h \
|
||||||
src/inc/server.h src/inc/statcodes.h \
|
src/inc/global.h \
|
||||||
src/inc/upnpapi.h src/inc/utilall.h \
|
src/inc/gmtdate.h \
|
||||||
src/inc/gena_ctrlpt.h src/inc/http_client.h \
|
src/inc/httpparser.h \
|
||||||
src/inc/miniserver.h src/inc/service_table.h \
|
src/inc/httpreadwrite.h \
|
||||||
src/inc/statuscodes.h src/inc/upnpclosesocket.h \
|
src/inc/md5.h \
|
||||||
src/inc/util.h src/inc/gena_device.h \
|
src/inc/membuffer.h \
|
||||||
src/inc/httpparser.h src/inc/netall.h \
|
src/inc/miniserver.h \
|
||||||
src/inc/soaplib.h src/inc/strintmap.h \
|
src/inc/netall.h \
|
||||||
src/inc/upnp_timeout.h src/inc/uuid.h \
|
src/inc/parsetools.h \
|
||||||
src/inc/gena.h src/inc/httpreadwrite.h \
|
src/inc/server.h \
|
||||||
src/inc/parsetools.h src/inc/sock.h \
|
src/inc/service_table.h \
|
||||||
src/inc/sysdep.h src/inc/uri.h \
|
src/inc/soaplib.h \
|
||||||
|
src/inc/sock.h \
|
||||||
|
src/inc/statcodes.h \
|
||||||
|
src/inc/statuscodes.h \
|
||||||
|
src/inc/strintmap.h \
|
||||||
|
src/inc/ssdplib.h \
|
||||||
|
src/inc/sysdep.h \
|
||||||
|
src/inc/unixutil.h \
|
||||||
|
src/inc/upnpapi.h \
|
||||||
|
src/inc/upnp_timeout.h \
|
||||||
|
src/inc/uri.h \
|
||||||
|
src/inc/urlconfig.h \
|
||||||
|
src/inc/upnputil.h \
|
||||||
|
src/inc/uuid.h \
|
||||||
|
src/inc/VirtualDir.h \
|
||||||
src/inc/webserver.h
|
src/inc/webserver.h
|
||||||
|
|
||||||
# ssdp
|
# ssdp
|
||||||
libupnp_la_SOURCES += src/ssdp/ssdp_device.c src/ssdp/ssdp_ctrlpt.c \
|
libupnp_la_SOURCES += \
|
||||||
|
src/ssdp/ssdp_device.c \
|
||||||
|
src/ssdp/ssdp_ctrlpt.c \
|
||||||
src/ssdp/ssdp_server.c
|
src/ssdp/ssdp_server.c
|
||||||
|
|
||||||
# soap
|
# soap
|
||||||
libupnp_la_SOURCES += src/soap/soap_device.c src/soap/soap_ctrlpt.c \
|
libupnp_la_SOURCES += \
|
||||||
|
src/soap/soap_device.c \
|
||||||
|
src/soap/soap_ctrlpt.c \
|
||||||
src/soap/soap_common.c
|
src/soap/soap_common.c
|
||||||
|
|
||||||
# genlib
|
# genlib
|
||||||
@@ -84,80 +105,55 @@ libupnp_la_SOURCES += \
|
|||||||
src/genlib/net/uri/uri.c
|
src/genlib/net/uri/uri.c
|
||||||
|
|
||||||
# gena
|
# gena
|
||||||
libupnp_la_SOURCES += src/gena/gena_device.c src/gena/gena_ctrlpt.c \
|
libupnp_la_SOURCES += \
|
||||||
|
src/gena/gena_device.c \
|
||||||
|
src/gena/gena_ctrlpt.c \
|
||||||
src/gena/gena_callback2.c
|
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
|
||||||
|
|
||||||
|
|
||||||
# uuid
|
# uuid
|
||||||
libupnp_la_SOURCES += src/uuid/md5.c src/uuid/sysdep.c src/uuid/uuid.c
|
libupnp_la_SOURCES += \
|
||||||
|
src/uuid/md5.c \
|
||||||
|
src/uuid/sysdep.c \
|
||||||
|
src/uuid/uuid.c
|
||||||
|
|
||||||
|
|
||||||
# urlconfig
|
# urlconfig
|
||||||
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
||||||
|
|
||||||
|
|
||||||
# samples
|
# inet_pton (needed on Win32, compiles to nothing elsewhere)
|
||||||
noinst_PROGRAMS =
|
libupnp_la_SOURCES += \
|
||||||
if ENABLE_SAMPLES
|
src/inet_pton.c \
|
||||||
if ENABLE_CLIENT
|
src/inc/inet_pton.h
|
||||||
noinst_PROGRAMS += upnp_tv_ctrlpt
|
|
||||||
upnp_tv_ctrlpt_CPPFLAGS = $(AM_CPPFLAGS) \
|
|
||||||
-I$(srcdir)/sample/common/ \
|
|
||||||
-I$(srcdir)/sample/tvctrlpt
|
|
||||||
endif
|
|
||||||
if ENABLE_DEVICE
|
|
||||||
noinst_PROGRAMS += upnp_tv_device
|
|
||||||
upnp_tv_device_CPPFLAGS = $(AM_CPPFLAGS) \
|
|
||||||
-I$(srcdir)/sample/common/ \
|
|
||||||
-I$(srcdir)/sample/tvdevice
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
upnp_tv_device_SOURCES = \
|
|
||||||
sample/common/sample_util.c \
|
|
||||||
sample/common/sample_util.h \
|
|
||||||
sample/tvdevice/upnp_tv_device.c \
|
|
||||||
sample/tvdevice/upnp_tv_device.h \
|
|
||||||
sample/tvdevice/linux/upnp_tv_device_main.c
|
|
||||||
upnp_tv_ctrlpt_SOURCES = \
|
|
||||||
sample/common/sample_util.c \
|
|
||||||
sample/common/sample_util.h \
|
|
||||||
sample/tvctrlpt/upnp_tv_ctrlpt.c \
|
|
||||||
sample/tvctrlpt/upnp_tv_ctrlpt.h \
|
|
||||||
sample/tvctrlpt/linux/upnp_tv_ctrlpt_main.c
|
|
||||||
|
|
||||||
if WITH_DOCUMENTATION
|
|
||||||
examplesdir = $(docdir)/examples
|
|
||||||
examples_DATA = $(upnp_tv_ctrlpt_SOURCES) $(upnp_tv_device_SOURCES)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# check / distcheck tests
|
# check / distcheck tests
|
||||||
check_PROGRAMS = test_init
|
check_PROGRAMS = test_init
|
||||||
TESTS = test_init
|
TESTS = test_init
|
||||||
|
|
||||||
test_init_SOURCES = test/test_init.c
|
test_init_SOURCES = test/test_init.c
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = LICENSE \
|
EXTRA_DIST = \
|
||||||
sample/tvdevice/web/tvcontrolSCPD.xml \
|
LICENSE \
|
||||||
sample/tvdevice/web/tvdevicedesc.xml \
|
m4/libupnp.m4 \
|
||||||
sample/tvdevice/web/tvdevicepres.html \
|
|
||||||
sample/tvdevice/web/tvpictureSCPD.xml \
|
|
||||||
src/inc/inet_pton.h \
|
|
||||||
src/inet_pton.c \
|
|
||||||
src/win_dll.c
|
src/win_dll.c
|
||||||
|
|
||||||
|
|
||||||
|
CLEANFILES = \
|
||||||
CLEANFILES = IUpnpErrFile.txt IUpnpInfoFile.txt
|
IUpnpErrFile.txt \
|
||||||
|
IUpnpInfoFile.txt
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
124
upnp/inc/UpnpGlobal.h
Normal file
124
upnp/inc/UpnpGlobal.h
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#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.
|
||||||
|
*/
|
||||||
|
#ifdef __STRICT_ANSI__
|
||||||
|
#define UPNP_INLINE __inline__
|
||||||
|
#else
|
||||||
|
#define UPNP_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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 */
|
||||||
|
|
||||||
40
upnp/inc/UpnpInet.h
Normal file
40
upnp/inc/UpnpInet.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
#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 this file in win32. */
|
||||||
|
#include <unistd.h>
|
||||||
|
/* SOCKET is unsigned and is not a file descriptor on win32. */
|
||||||
|
#define SOCKET int
|
||||||
|
/* INVALID_SOCKET is unsigned on win32. */
|
||||||
|
#define INVALID_SOCKET (-1)
|
||||||
|
/* select() returns SOCKET_ERROR on win32. */
|
||||||
|
#define SOCKET_ERROR (-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 declaration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#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 */
|
||||||
|
|
||||||
3811
upnp/inc/upnp.h
3811
upnp/inc/upnp.h
File diff suppressed because it is too large
Load Diff
@@ -1,34 +1,34 @@
|
|||||||
// -*- 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
|
||||||
@@ -90,7 +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 */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +1,45 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// 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_DEBUG_H
|
#ifndef UPNP_DEBUG_H
|
||||||
#define UPNP_DEBUG_H
|
#define UPNP_DEBUG_H
|
||||||
|
|
||||||
#include "upnpconfig.h"
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
// Function declarations only if debug compiled into the library
|
#include "ThreadPool.h"
|
||||||
#if UPNP_HAVE_DEBUG
|
#include "upnpconfig.h"
|
||||||
|
#include "UpnpGlobal.h" /* for UPNP_INLINE */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -44,16 +47,15 @@
|
|||||||
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
|
||||||
@@ -62,197 +64,274 @@ 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 {
|
||||||
|
SSDP,
|
||||||
|
SOAP,
|
||||||
|
GENA,
|
||||||
|
TPOOL,
|
||||||
|
MSERV,
|
||||||
|
DOM,
|
||||||
|
API,
|
||||||
|
HTTP
|
||||||
|
} Dbg_Module;
|
||||||
|
|
||||||
typedef enum Upnp_Module {SSDP,SOAP,GENA,TPOOL,MSERV,DOM,API, HTTP} Dbg_Module;
|
/*@{*/
|
||||||
//@{
|
|
||||||
typedef enum Upnp_LogLevel_e {
|
typedef enum Upnp_LogLevel_e {
|
||||||
UPNP_CRITICAL,
|
UPNP_CRITICAL,
|
||||||
UPNP_PACKET,
|
UPNP_PACKET,
|
||||||
UPNP_INFO,
|
UPNP_INFO,
|
||||||
UPNP_ALL
|
UPNP_ALL
|
||||||
} Upnp_LogLevel;
|
} Upnp_LogLevel;
|
||||||
//@}
|
/*@}*/
|
||||||
|
|
||||||
// for backward compatibility
|
/*!
|
||||||
#define Dbg_Level Upnp_LogLevel
|
* Default log level : see \c Upnp_LogLevel
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default log level : see {\tt Upnp_LogLevel}
|
|
||||||
*/
|
*/
|
||||||
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initialize the log files.
|
||||||
/***************************************************************************
|
|
||||||
* Function : UpnpInitLog
|
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* \return -1 if fails or UPNP_E_SUCCESS if succeeds.
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
int UpnpInitLog(void);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE int UpnpInitLog(void)
|
||||||
|
{
|
||||||
|
return UPNP_E_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Set the log level (see \c Upnp_LogLevel).
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
void UpnpSetLogLevel(
|
||||||
|
/*! [in] Log level. */
|
||||||
|
Upnp_LogLevel log_level);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
log_level = log_level;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Closes the log files.
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
void UpnpCloseLog(void);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE void UpnpCloseLog(void) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Set the name for error and information files, respectively.
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
void UpnpSetLogFileNames(
|
||||||
|
/*! [in] Name of the error file. */
|
||||||
|
const char *ErrFileName,
|
||||||
|
/*! [in] Name of the information file. */
|
||||||
|
const char *InfoFileName);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE void UpnpSetLogFileNames(
|
||||||
|
const char *ErrFileName,
|
||||||
|
const char *InfoFileName)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
ErrFileName = ErrFileName;
|
||||||
|
InfoFileName = InfoFileName;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Check if the module is turned on for debug and returns the file
|
||||||
|
* descriptor corresponding to the debug level
|
||||||
*
|
*
|
||||||
* Description:
|
* \return NULL if the module is turn off for debug otheriwse returns the
|
||||||
* This functions initializes the log files
|
* right file descriptor.
|
||||||
* Returns: int
|
*/
|
||||||
* -1 : If fails
|
#ifdef DEBUG
|
||||||
* UPNP_E_SUCCESS : if success
|
FILE *UpnpGetDebugFile(
|
||||||
***************************************************************************/
|
/*! [in] The level of the debug logging. It will decide whether debug
|
||||||
int UpnpInitLog();
|
* statement will go to standard output, or any of the log files. */
|
||||||
|
Upnp_LogLevel level,
|
||||||
// for backward compatibility
|
/*! [in] debug will go in the name of this module. */
|
||||||
#define InitLog UpnpInitLog
|
Dbg_Module module);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
level = level;
|
||||||
|
module = module;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpSetLogLevel
|
* \brief Returns true if debug output should be done in this module.
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* \return Nonzero value if true, zero if false.
|
||||||
*
|
*/
|
||||||
* Description:
|
#ifdef DEBUG
|
||||||
* This functions set the log level (see {\tt Upnp_LogLevel}
|
int DebugAtThisLevel(
|
||||||
* Returns: void
|
/*! [in] The level of the debug logging. It will decide whether debug
|
||||||
***************************************************************************/
|
* statement will go to standard output, or any of the log files. */
|
||||||
void UpnpSetLogLevel (Upnp_LogLevel);
|
Upnp_LogLevel DLevel,
|
||||||
|
/*! [in] Debug will go in the name of this module. */
|
||||||
|
Dbg_Module Module);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE int DebugAtThisLevel(
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
DLevel = DLevel;
|
||||||
|
Module = Module;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpCloseLog
|
* \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: void
|
*/
|
||||||
*
|
#ifdef DEBUG
|
||||||
* Description:
|
void UpnpPrintf(
|
||||||
* This functions closes the log files
|
/*! [in] The level of the debug logging. It will decide whether debug
|
||||||
* Returns: void
|
* statement will go to standard output, or any of the log files. */
|
||||||
***************************************************************************/
|
Upnp_LogLevel DLevel,
|
||||||
void UpnpCloseLog();
|
/*! [in] debug will go in the name of this module. */
|
||||||
|
Dbg_Module Module,
|
||||||
// for backward compatibility
|
/*! [in] Name of the file from where debug statement is coming. */
|
||||||
#define CloseLog UpnpCloseLog
|
const char* DbgFileName,
|
||||||
|
/*! [in] Line number of the file from where debug statement is coming. */
|
||||||
|
int DbgLineNo,
|
||||||
/***************************************************************************
|
/*! [in] Printf like format specification. */
|
||||||
* Function : UpnpSetLogFileNames
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN const char* ErrFileName: name of the error file
|
|
||||||
* IN const char *InfoFileName: name of the information file
|
|
||||||
* IN int size: Size of the buffer
|
|
||||||
* IN int starLength: This parameter provides the width of the banner
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* This functions takes the buffer and writes the buffer in the file as
|
|
||||||
* per the requested banner
|
|
||||||
* Returns: void
|
|
||||||
***************************************************************************/
|
|
||||||
void UpnpSetLogFileNames (const char* ErrFileName, const char* InfoFileName);
|
|
||||||
|
|
||||||
// for backward compatibility
|
|
||||||
#define SetLogFileNames UpnpSetLogFileNames
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* Function : UpnpGetDebugFile
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN Dbg_Level DLevel: The level of the debug logging. It will decide
|
|
||||||
* whether debug statement will go to standard output,
|
|
||||||
* or any of the log files.
|
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
***************************************************************************/
|
|
||||||
FILE* UpnpGetDebugFile (Upnp_LogLevel level, Dbg_Module module);
|
|
||||||
|
|
||||||
// for backward compatibility
|
|
||||||
#define GetDebugFile UpnpGetDebugFile
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* Function : UpnpPrintf
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN Dbg_Level DLevel: The level of the debug logging. It will decide
|
|
||||||
* whether debug statement will go to standard output,
|
|
||||||
* or any of the log files.
|
|
||||||
* IN Dbg_Module Module: debug will go in the name of this module
|
|
||||||
* 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
|
|
||||||
***************************************************************************/
|
|
||||||
void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module,
|
|
||||||
const char* DbgFileName, int DbgLineNo,
|
|
||||||
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 */
|
||||||
__attribute__((format (__printf__, 5, 6)))
|
__attribute__((format (__printf__, 5, 6)))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
#else /* DEBUG */
|
||||||
|
static UPNP_INLINE void UpnpPrintf(
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
const char* DbgFileName,
|
||||||
|
int DbgLineNo,
|
||||||
|
const char* FmtStr,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
DLevel = DLevel;
|
||||||
|
Module = Module;
|
||||||
|
DbgFileName = DbgFileName;
|
||||||
|
DbgLineNo = DbgLineNo;
|
||||||
|
FmtStr = FmtStr;
|
||||||
|
}
|
||||||
|
#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(
|
||||||
void UpnpDisplayBanner (FILE *fd,
|
FILE *fd,
|
||||||
const char** lines, size_t size, int starlength);
|
const char *DbgFileName,
|
||||||
|
int DbgLineNo)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
fd = fd;
|
||||||
|
DbgFileName = DbgFileName;
|
||||||
|
DbgLineNo = DbgLineNo;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*!
|
||||||
* Function : UpnpDisplayFileAndLine
|
* \brief Writes the buffer in the file as per the requested banner
|
||||||
*
|
*/
|
||||||
* Parameters:
|
#ifdef DEBUG
|
||||||
* IN FILE *fd: File descriptor where line number and file name will be
|
void UpnpDisplayBanner(
|
||||||
* written
|
/*! [in] file descriptor where the banner will be written. */
|
||||||
* IN char *DbgFileName: Name of the file
|
FILE *fd,
|
||||||
* IN int DbgLineNo : Line number of the file
|
/*! [in] The buffer that will be written. */
|
||||||
*
|
const char **lines,
|
||||||
* Description:
|
/*! [in] Size of the buffer. */
|
||||||
* This function writes the file name and file number from where
|
size_t size,
|
||||||
* debug statement is coming to the log file
|
/*! [in] This parameter provides the width of the banner. */
|
||||||
* Returns: void
|
size_t starlength);
|
||||||
***************************************************************************/
|
#else
|
||||||
void UpnpDisplayFileAndLine (FILE *fd, const char *DbgFileName, int DbgLineNo);
|
static UPNP_INLINE void UpnpDisplayBanner(
|
||||||
|
FILE *fd,
|
||||||
|
const char **lines,
|
||||||
|
size_t size,
|
||||||
|
int starlength)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
fd = fd;
|
||||||
|
lines = lines;
|
||||||
|
size = size;
|
||||||
|
starlength = starlength;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//@}
|
/*!
|
||||||
|
* \brief Prints thread pool statistics.
|
||||||
|
*/
|
||||||
|
#ifdef DEBUG
|
||||||
|
void PrintThreadPoolStats(
|
||||||
|
/*! [in] The thread pool. */
|
||||||
|
ThreadPool *tp,
|
||||||
|
/*! [in] The file name that called this function, use the macro __FILE__. */
|
||||||
|
const char *DbgFileName,
|
||||||
|
/*! [in] The line number that the function was called, use the macro __LINE__. */
|
||||||
|
int DbgLineNo,
|
||||||
|
/*! [in] The message. */
|
||||||
|
const char *msg);
|
||||||
|
#else
|
||||||
|
static UPNP_INLINE void PrintThreadPoolStats(
|
||||||
|
ThreadPool *tp,
|
||||||
|
const char *DbgFileName,
|
||||||
|
int DbgLineNo,
|
||||||
|
const char *msg)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
tp = tp;
|
||||||
|
DbgFileName = DbgFileName;
|
||||||
|
DbgLineNo = DbgLineNo;
|
||||||
|
msg = msg;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // UPNP_HAVE_DEBUG
|
#endif /* UPNP_DEBUG_H */
|
||||||
|
|
||||||
#endif // UPNP_DEBUG_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,230 +1,289 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
// All rights reserved.
|
* All rights reserved.
|
||||||
//
|
*
|
||||||
// Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
//
|
*
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
// and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
// may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission.
|
* without specific prior written permission.
|
||||||
//
|
*
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
*
|
||||||
///////////////////////////////////////////////////////////////////////////
|
******************************************************************************/
|
||||||
|
|
||||||
/** @name Optional Tool APIs
|
|
||||||
* 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"
|
|
||||||
|
|
||||||
// Function declarations only if tools compiled into the library
|
/*!
|
||||||
|
* \file
|
||||||
|
*
|
||||||
|
* \defgroup UPnPTools Optional Tool API
|
||||||
|
*
|
||||||
|
* \brief Additional, optional utility API that can be helpful in writing
|
||||||
|
* applications.
|
||||||
|
*
|
||||||
|
* This additional API can be compiled out in order to save code size in the
|
||||||
|
* library. Refer to the file README for details.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ixml.h" /* for IXML_Document */
|
||||||
|
|
||||||
|
|
||||||
|
/* Function declarations only if tools compiled into the library */
|
||||||
#if UPNP_HAVE_TOOLS
|
#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 Combines a base URL and a relative URL into a single absolute URL.
|
||||||
|
*
|
||||||
|
* The memory for \b AbsURL becomes owned by the caller and should be freed
|
||||||
|
* later.
|
||||||
|
*
|
||||||
|
* \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 UpnpResolveURL2(
|
||||||
|
/*! [in] The base URL to combine. */
|
||||||
|
const char *BaseURL,
|
||||||
|
/*! [in] The relative URL to \b BaseURL. */
|
||||||
|
const char *RelURL,
|
||||||
|
/*! [out] A pointer to a pointer to a buffer to store the
|
||||||
|
* absolute URL. Must be freed later by the caller. */
|
||||||
|
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_TOOLS_H
|
/*! @} */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* UPNP_HAVE_TOOLS */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* UPNP_TOOLS_H */
|
||||||
|
|
||||||
|
|||||||
97
upnp/m4/libupnp.m4
Normal file
97
upnp/m4/libupnp.m4
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
# -*- Autoconf -*-
|
||||||
|
# This file is part of the aMule project.
|
||||||
|
# This file is part of the libupnp library project.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
#
|
||||||
|
|
||||||
|
dnl --------------------------------------------------------------------------
|
||||||
|
dnl LIBUPNP_CHECK([VERSION = 1.6.6], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||||
|
dnl
|
||||||
|
dnl Check for the libupnp library
|
||||||
|
dnl --------------------------------------------------------------------------
|
||||||
|
dnl
|
||||||
|
dnl This macro sets these variables:
|
||||||
|
dnl - LIBUPNP_VERSION
|
||||||
|
dnl Something like "1.6.7"
|
||||||
|
dnl - LIBUPNP_CPPFLAGS
|
||||||
|
dnl Flags to be added to CPPFLAGS
|
||||||
|
dnl - LIBUPNP_CFLAGS
|
||||||
|
dnl Flags to be added to CFLAGS
|
||||||
|
dnl - LIBUPNP_LDFLAGS
|
||||||
|
dnl Flags to be added to LDFLAGS
|
||||||
|
dnl - LIBUPNP_LIBS
|
||||||
|
dnl Library to be added to LIBS
|
||||||
|
dnl
|
||||||
|
dnl The LIBUPNP_CPPFLAGS, LIBUPNP_CFLAGS, LIBUPNP_LDFLAGS and LIBUPNP_LIBS variables are also substituted.
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([LIBUPNP_CHECK],
|
||||||
|
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||||
|
m4_define([MIN_LIBUPNP_VERSION], [m4_ifval([$1], [$1], [1.6.6])])dnl
|
||||||
|
|
||||||
|
dnl Test for --with-libupnp-prefix
|
||||||
|
AC_ARG_WITH(
|
||||||
|
[libupnp-prefix],
|
||||||
|
[AS_HELP_STRING(
|
||||||
|
[--with-libupnp-prefix=PREFIX],
|
||||||
|
[UPnP library location])],
|
||||||
|
[export PKG_CONFIG_PATH=$withval/lib/pkgconfig])
|
||||||
|
|
||||||
|
dnl Check for libupnp >= MIN_LIBUPNP_VERSION
|
||||||
|
AS_IF([test $cross_compiling = no], [
|
||||||
|
AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION])
|
||||||
|
AS_IF([test -n "$PKG_CONFIG"], [
|
||||||
|
AS_IF([$PKG_CONFIG libupnp --exists], [
|
||||||
|
LIBUPNP_VERSION=`$PKG_CONFIG libupnp --modversion`
|
||||||
|
AS_IF([$PKG_CONFIG libupnp --atleast-version=MIN_LIBUPNP_VERSION], [
|
||||||
|
result=yes
|
||||||
|
resultstr=" (version $LIBUPNP_VERSION)"
|
||||||
|
LIBUPNP_CPPFLAGS=`$PKG_CONFIG libupnp --cflags-only-I`
|
||||||
|
LIBUPNP_CFLAGS=`$PKG_CONFIG libupnp --cflags-only-other`
|
||||||
|
LIBUPNP_LDFLAGS=`$PKG_CONFIG libupnp --libs-only-L`
|
||||||
|
LIBUPNP_LIBS=`$PKG_CONFIG libupnp --libs-only-other`
|
||||||
|
LIBUPNP_LIBS="$LIBUPNP_LIBS `$PKG_CONFIG libupnp --libs-only-l`"
|
||||||
|
], [
|
||||||
|
result=no
|
||||||
|
resultstr=" (version $LIBUPNP_VERSION is not new enough)"
|
||||||
|
])
|
||||||
|
], [
|
||||||
|
result=no
|
||||||
|
resultstr=" (try to use --with-libupnp-prefix=PREFIX)"
|
||||||
|
])
|
||||||
|
], [
|
||||||
|
result=no
|
||||||
|
resultstr=" (pkg-config not found)"
|
||||||
|
])
|
||||||
|
AC_MSG_RESULT([$result$resultstr])
|
||||||
|
libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr"
|
||||||
|
], [
|
||||||
|
dnl Currently cross-compilation with libupnp is not supported.
|
||||||
|
result=no
|
||||||
|
libupnp_error="cross compiling"
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Execute the right action.
|
||||||
|
AS_IF([test ${result:-no} = yes], [$2], [$3])
|
||||||
|
|
||||||
|
dnl Exported symbols
|
||||||
|
AC_SUBST([LIBUPNP_CPPFLAGS])dnl
|
||||||
|
AC_SUBST([LIBUPNP_CFLAGS])dnl
|
||||||
|
AC_SUBST([LIBUPNP_LDFLAGS])dnl
|
||||||
|
AC_SUBST([LIBUPNP_LIBS])dnl
|
||||||
|
m4_undefine([MIN_LIBUPNP_VERSION])dnl
|
||||||
|
])
|
||||||
84
upnp/sample/Makefile.am
Normal file
84
upnp/sample/Makefile.am
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
#
|
||||||
|
# "Makefile.am" for "libupnp/upnp/sample"
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
|
||||||
|
#
|
||||||
|
|
||||||
|
AM_CPPFLAGS = \
|
||||||
|
-I$(top_srcdir)/upnp/inc \
|
||||||
|
-I$(top_srcdir)/threadutil/inc \
|
||||||
|
-I$(top_srcdir)/ixml/inc
|
||||||
|
|
||||||
|
LDADD = \
|
||||||
|
$(top_builddir)/upnp/libupnp.la \
|
||||||
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
|
$(top_builddir)/ixml/libixml.la
|
||||||
|
|
||||||
|
|
||||||
|
# samples
|
||||||
|
noinst_PROGRAMS =
|
||||||
|
if ENABLE_SAMPLES
|
||||||
|
if ENABLE_CLIENT
|
||||||
|
noinst_PROGRAMS += tv_ctrlpt
|
||||||
|
tv_ctrlpt_CPPFLAGS = \
|
||||||
|
$(AM_CPPFLAGS) \
|
||||||
|
-I$(srcdir)/common/ \
|
||||||
|
-I$(srcdir)/tvctrlpt
|
||||||
|
if ENABLE_DEVICE
|
||||||
|
noinst_PROGRAMS += tv_combo
|
||||||
|
tv_combo_CPPFLAGS = $(AM_CPPFLAGS) \
|
||||||
|
-I$(srcdir)/common/ \
|
||||||
|
-I$(srcdir)/tvcombo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if ENABLE_DEVICE
|
||||||
|
noinst_PROGRAMS += tv_device
|
||||||
|
tv_device_CPPFLAGS = \
|
||||||
|
$(AM_CPPFLAGS) \
|
||||||
|
-I$(srcdir)/common/ \
|
||||||
|
-I$(srcdir)/tvdevice
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
tv_device_SOURCES = \
|
||||||
|
common/sample_util.c \
|
||||||
|
common/sample_util.h \
|
||||||
|
common/tv_device.c \
|
||||||
|
common/tv_device.h \
|
||||||
|
linux/tv_device_main.c
|
||||||
|
|
||||||
|
|
||||||
|
tv_ctrlpt_SOURCES = \
|
||||||
|
common/sample_util.c \
|
||||||
|
common/sample_util.h \
|
||||||
|
common/tv_ctrlpt.c \
|
||||||
|
common/tv_ctrlpt.h \
|
||||||
|
linux/tv_ctrlpt_main.c
|
||||||
|
|
||||||
|
tv_combo_SOURCES = \
|
||||||
|
common/sample_util.c \
|
||||||
|
common/sample_util.h \
|
||||||
|
common/tv_ctrlpt.c \
|
||||||
|
common/tv_ctrlpt.h \
|
||||||
|
common/tv_device.c \
|
||||||
|
common/tv_device.h \
|
||||||
|
linux/tv_combo_main.c
|
||||||
|
|
||||||
|
|
||||||
|
if WITH_DOCUMENTATION
|
||||||
|
examplesdir = $(docdir)/examples
|
||||||
|
examples_DATA = \
|
||||||
|
$(sort \
|
||||||
|
$(tv_ctrlpt_SOURCES) \
|
||||||
|
$(tv_device_SOURCES))
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
web/tvcombodesc.xml \
|
||||||
|
web/tvcontrolSCPD.xml \
|
||||||
|
web/tvdevicedesc.xml \
|
||||||
|
web/tvdevicepres.html \
|
||||||
|
web/tvpictureSCPD.xml
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,50 +1,64 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
/*******************************************************************************
|
||||||
//
|
*
|
||||||
// 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
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
#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"
|
#ifdef SAMPLE_UTIL_C
|
||||||
#include "ithread.h"
|
/*! Service types for tv services. */
|
||||||
#include "ixml.h"
|
const char *TvServiceType[] = {
|
||||||
|
"urn:schemas-upnp-org:service:tvcontrol:1",
|
||||||
|
"urn:schemas-upnp-org:service:tvpicture:1"
|
||||||
|
};
|
||||||
|
#else /* SAMPLE_UTIL_C */
|
||||||
|
extern const char *TvServiceType[];
|
||||||
|
#endif /* SAMPLE_UTIL_C */
|
||||||
|
|
||||||
//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 {
|
||||||
@@ -54,215 +68,196 @@ typedef enum {
|
|||||||
GET_VAR_COMPLETE = 3
|
GET_VAR_COMPLETE = 3
|
||||||
} eventType;
|
} eventType;
|
||||||
|
|
||||||
|
/*!
|
||||||
/********************************************************************************
|
* \brief Given a DOM node such as <Channel>11</Channel>, this routine
|
||||||
* SampleUtil_GetElementValue
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Given a DOM node such as <Channel>11</Channel>, this routine
|
|
||||||
* extracts the value (e.g., 11) from the node and returns it as
|
* extracts the value (e.g., 11) from the node and returns it as
|
||||||
* a string. The string must be freed by the caller using
|
* a string. The string must be freed by the caller using free.
|
||||||
* free.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return The DOM node as a string.
|
||||||
* node -- The DOM node from which to extract the value
|
*/
|
||||||
*
|
char *SampleUtil_GetElementValue(
|
||||||
********************************************************************************/
|
/*! [in] The DOM node from which to extract the value. */
|
||||||
char * SampleUtil_GetElementValue(IN IXML_Element *element);
|
IXML_Element *element);
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_GetFirstServiceList
|
* \brief Given a DOM node representing a UPnP Device Description Document,
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Given a DOM node representing a UPnP Device Description Document,
|
|
||||||
* this routine parses the document and finds the first service list
|
* this routine parses the document and finds the first service list
|
||||||
* (i.e., the service list for the root device). The service list
|
* (i.e., the service list for the root device). The service list
|
||||||
* is returned as a DOM node list. The NodeList must be freed using
|
* is returned as a DOM node list. The NodeList must be freed using
|
||||||
* NodeList_free.
|
* NodeList_free.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* \return The service list is returned as a DOM node list.
|
||||||
* node -- The DOM node from which to extract the service list
|
*/
|
||||||
*
|
IXML_NodeList *SampleUtil_GetFirstServiceList(
|
||||||
********************************************************************************/
|
/*! [in] The DOM node from which to extract the service list. */
|
||||||
|
IXML_Document *doc);
|
||||||
|
|
||||||
IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document * doc);
|
/*!
|
||||||
|
* \brief Given a document node, this routine searches for the first element
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* SampleUtil_GetFirstDocumentItem
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Given a document node, this routine searches for the first element
|
|
||||||
* named by the input string item, and returns its value as a string.
|
* named by the input string item, and returns its value as a string.
|
||||||
* String must be freed by caller using free.
|
* String must be freed by caller using free.
|
||||||
* Parameters:
|
*/
|
||||||
* doc -- The DOM document from which to extract the value
|
char *SampleUtil_GetFirstDocumentItem(
|
||||||
* item -- The item to search for
|
/*! [in] The DOM document from which to extract the value. */
|
||||||
*
|
IXML_Document *doc,
|
||||||
********************************************************************************/
|
/*! [in] The item to search for. */
|
||||||
char * SampleUtil_GetFirstDocumentItem(IN IXML_Document *doc, IN const char *item);
|
const char *item);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Given a DOM element, this routine searches for the first element
|
||||||
/********************************************************************************
|
|
||||||
* SampleUtil_GetFirstElementItem
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Given a DOM element, this routine searches for the first element
|
|
||||||
* named by the input string item, and returns its value as a string.
|
* named by the input string item, and returns its value as a string.
|
||||||
* The string must be freed using free.
|
* The string must be freed using free.
|
||||||
* Parameters:
|
*/
|
||||||
* node -- The DOM element from which to extract the value
|
char *SampleUtil_GetFirstElementItem(
|
||||||
* item -- The item to search for
|
/*! [in] The DOM element from which to extract the value. */
|
||||||
*
|
IXML_Element *element,
|
||||||
********************************************************************************/
|
/*! [in] The item to search for. */
|
||||||
char * SampleUtil_GetFirstElementItem(IN IXML_Element *element, IN const char *item);
|
const char *item);
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_PrintEventType
|
* \brief Prints a callback event type as a string.
|
||||||
*
|
*/
|
||||||
* Description:
|
void SampleUtil_PrintEventType(
|
||||||
* Prints a callback event type as a string.
|
/*! [in] The callback event. */
|
||||||
*
|
Upnp_EventType S);
|
||||||
* Parameters:
|
|
||||||
* S -- The callback event
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
void SampleUtil_PrintEventType(IN Upnp_EventType S);
|
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_PrintEvent
|
* \brief Prints callback event structure details.
|
||||||
*
|
*/
|
||||||
* Description:
|
int SampleUtil_PrintEvent(
|
||||||
* Prints callback event structure details.
|
/*! [in] The type of callback event. */
|
||||||
*
|
Upnp_EventType EventType,
|
||||||
* Parameters:
|
/*! [in] The callback event structure. */
|
||||||
* EventType -- The type of callback event
|
void *Event);
|
||||||
* Event -- The callback event structure
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
int SampleUtil_PrintEvent(IN Upnp_EventType EventType,
|
|
||||||
IN void *Event);
|
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_FindAndParseService
|
* \brief This routine finds the first occurance of a service in a DOM
|
||||||
*
|
* representation of a description document and parses it. Note that this
|
||||||
* Description:
|
* function currently assumes that the eventURL and controlURL values in
|
||||||
* This routine finds the first occurance of a service in a DOM representation
|
* the service definitions are full URLs. Relative URLs are not handled here.
|
||||||
* of a description document and parses it. Note that this function currently
|
*/
|
||||||
* assumes that the eventURL and controlURL values in the service definitions
|
int SampleUtil_FindAndParseService (
|
||||||
* are full URLs. Relative URLs are not handled here.
|
/*! [in] The DOM description document. */
|
||||||
*
|
IXML_Document *DescDoc,
|
||||||
* Parameters:
|
/*! [in] The location of the description document. */
|
||||||
* DescDoc -- The DOM description document
|
const char *location,
|
||||||
* location -- The location of the description document
|
/*! [in] The type of service to search for. */
|
||||||
* serviceSearchType -- The type of service to search for
|
const char *serviceType,
|
||||||
* serviceId -- OUT -- The service ID
|
/*! [out] The service ID. */
|
||||||
* eventURL -- OUT -- The event URL for the service
|
char **serviceId,
|
||||||
* controlURL -- OUT -- The control URL for the service
|
/*! [out] The event URL for the service. */
|
||||||
*
|
char **eventURL,
|
||||||
********************************************************************************/
|
/*! [out] The control URL for the service. */
|
||||||
int SampleUtil_FindAndParseService (IN IXML_Document *DescDoc, IN char* location,
|
char **controlURL);
|
||||||
IN char *serviceType, OUT char **serviceId,
|
|
||||||
OUT char **eventURL, OUT char **controlURL);
|
|
||||||
|
|
||||||
|
/*!
|
||||||
/********************************************************************************
|
* \brief Prototype for displaying strings. All printing done by the device,
|
||||||
* print_string
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Prototype for displaying strings. All printing done by the device,
|
|
||||||
* control point, and sample util, ultimately use this to display strings
|
* control point, and sample util, ultimately use this to display strings
|
||||||
* to the user.
|
* to the user.
|
||||||
*
|
*/
|
||||||
* Parameters:
|
typedef void (*print_string)(
|
||||||
* const char * string.
|
/*! [in] Format. */
|
||||||
*
|
const char *string,
|
||||||
********************************************************************************/
|
/*! [in] Arguments. */
|
||||||
typedef void (*print_string)(const char *string);
|
...)
|
||||||
|
#if (__GNUC__ >= 3)
|
||||||
|
/* This enables printf like format checking by the compiler */
|
||||||
|
__attribute__((format (__printf__, 1, 2)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
//global print function used by sample util
|
/*! global print function used by sample util */
|
||||||
extern print_string gPrintFun;
|
extern print_string gPrintFun;
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* state_update
|
* \brief Prototype for passing back state changes.
|
||||||
*
|
*/
|
||||||
* Description:
|
typedef void (*state_update)(
|
||||||
* Prototype for passing back state changes
|
/*! [in] . */
|
||||||
*
|
const char *varName,
|
||||||
* Parameters:
|
/*! [in] . */
|
||||||
* const char * varName
|
const char *varValue,
|
||||||
* const char * varValue
|
/*! [in] . */
|
||||||
* const char * UDN
|
const char *UDN,
|
||||||
* int newDevice
|
/*! [in] . */
|
||||||
********************************************************************************/
|
|
||||||
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 */
|
||||||
extern state_update gStateUpdateFun;
|
extern state_update gStateUpdateFun;
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_Initialize
|
* \brief Initializes the sample util. Must be called before any sample util
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initializes the sample util. Must be called before any sample util
|
|
||||||
* functions. May be called multiple times.
|
* functions. May be called multiple times.
|
||||||
*
|
*/
|
||||||
* Parameters:
|
int SampleUtil_Initialize(
|
||||||
* print_function - print function to use in SampleUtil_Print
|
/*! [in] Print function to use in SampleUtil_Print. */
|
||||||
*
|
print_string print_function);
|
||||||
********************************************************************************/
|
|
||||||
int SampleUtil_Initialize(print_string print_function);
|
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_Finish
|
* \brief Releases Resources held by sample util.
|
||||||
*
|
*/
|
||||||
* Description:
|
int SampleUtil_Finish();
|
||||||
* Releases Resources held by sample util.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
int SampleUtil_Finish(void);
|
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_Print
|
* \brief Function emulating printf that ultimately calls the registered print
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Function emulating printf that ultimately calls the registered print
|
|
||||||
* function with the formatted string.
|
* function with the formatted string.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Provides platform-specific print functionality. This function should be
|
||||||
* fmt - format (see printf)
|
* called when you want to print content suitable for console output (i.e.,
|
||||||
* . . . - variable number of args. (see printf)
|
* in a large text box or on a screen). If your device/operating system is
|
||||||
|
* not supported here, you should add a port.
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
* \return The same as printf.
|
||||||
int SampleUtil_Print( char *fmt, ... );
|
*/
|
||||||
|
int SampleUtil_Print(
|
||||||
|
/*! [in] Format (see printf). */
|
||||||
|
const char *fmt,
|
||||||
|
/*! [in] Format data. */
|
||||||
|
...)
|
||||||
|
#if (__GNUC__ >= 3)
|
||||||
|
/* This enables printf like format checking by the compiler */
|
||||||
|
__attribute__((format (__printf__, 1, 2)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_RegisterUpdateFunction
|
* \brief
|
||||||
*
|
*/
|
||||||
* Description:
|
int SampleUtil_RegisterUpdateFunction(
|
||||||
*
|
/*! [in] . */
|
||||||
* Parameters:
|
state_update update_function);
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
int SampleUtil_RegisterUpdateFunction( state_update update_function );
|
|
||||||
|
|
||||||
/********************************************************************************
|
/*!
|
||||||
* SampleUtil_StateUpdate
|
* \brief
|
||||||
*
|
*/
|
||||||
* Description:
|
void SampleUtil_StateUpdate(
|
||||||
*
|
/*! [in] . */
|
||||||
* Parameters:
|
const char *varName,
|
||||||
*
|
/*! [in] . */
|
||||||
********************************************************************************/
|
const char *varValue,
|
||||||
void SampleUtil_StateUpdate( const char *varName, const char *varValue, const char *UDN,
|
/*! [in] . */
|
||||||
|
const char *UDN,
|
||||||
|
/*! [in] . */
|
||||||
eventType type);
|
eventType type);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Prints a string to standard out.
|
||||||
|
*/
|
||||||
|
void linux_print(const char *format, ...)
|
||||||
|
#if (__GNUC__ >= 3)
|
||||||
|
/* This enables printf like format checking by the compiler */
|
||||||
|
__attribute__((format (__printf__, 1, 2)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* UPNPSDK_UTIL_H */
|
#endif /* SAMPLE_UTIL_H */
|
||||||
|
|
||||||
|
|||||||
1570
upnp/sample/common/tv_ctrlpt.c
Normal file
1570
upnp/sample/common/tv_ctrlpt.c
Normal file
File diff suppressed because it is too large
Load Diff
222
upnp/sample/common/tv_ctrlpt.h
Normal file
222
upnp/sample/common/tv_ctrlpt.h
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UPNP_TV_CTRLPT_H
|
||||||
|
#define UPNP_TV_CTRLPT_H
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
|
||||||
|
#include "ithread.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
#include "UpnpString.h"
|
||||||
|
#include "upnptools.h"
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/* Do not #include <unistd.h> */
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TV_SERVICE_SERVCOUNT 2
|
||||||
|
#define TV_SERVICE_CONTROL 0
|
||||||
|
#define TV_SERVICE_PICTURE 1
|
||||||
|
|
||||||
|
#define TV_CONTROL_VARCOUNT 3
|
||||||
|
#define TV_CONTROL_POWER 0
|
||||||
|
#define TV_CONTROL_CHANNEL 1
|
||||||
|
#define TV_CONTROL_VOLUME 2
|
||||||
|
|
||||||
|
#define TV_PICTURE_VARCOUNT 4
|
||||||
|
#define TV_PICTURE_COLOR 0
|
||||||
|
#define TV_PICTURE_TINT 1
|
||||||
|
#define TV_PICTURE_CONTRAST 2
|
||||||
|
#define TV_PICTURE_BRIGHTNESS 3
|
||||||
|
|
||||||
|
#define TV_MAX_VAL_LEN 5
|
||||||
|
|
||||||
|
#define TV_SUCCESS 0
|
||||||
|
#define TV_ERROR (-1)
|
||||||
|
#define TV_WARNING 1
|
||||||
|
|
||||||
|
/* This should be the maximum VARCOUNT from above */
|
||||||
|
#define TV_MAXVARS TV_PICTURE_VARCOUNT
|
||||||
|
|
||||||
|
extern const char *TvServiceName[];
|
||||||
|
extern const char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS];
|
||||||
|
extern char TvVarCount[];
|
||||||
|
|
||||||
|
struct tv_service {
|
||||||
|
char ServiceId[NAME_SIZE];
|
||||||
|
char ServiceType[NAME_SIZE];
|
||||||
|
char *VariableStrVal[TV_MAXVARS];
|
||||||
|
char EventURL[NAME_SIZE];
|
||||||
|
char ControlURL[NAME_SIZE];
|
||||||
|
char SID[NAME_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct TvDeviceNode *GlobalDeviceList;
|
||||||
|
|
||||||
|
struct TvDevice {
|
||||||
|
char UDN[250];
|
||||||
|
char DescDocURL[250];
|
||||||
|
char FriendlyName[250];
|
||||||
|
char PresURL[250];
|
||||||
|
int AdvrTimeOut;
|
||||||
|
struct tv_service TvService[TV_SERVICE_SERVCOUNT];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TvDeviceNode {
|
||||||
|
struct TvDevice device;
|
||||||
|
struct TvDeviceNode *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern ithread_mutex_t DeviceListMutex;
|
||||||
|
|
||||||
|
extern UpnpClient_Handle ctrlpt_handle;
|
||||||
|
|
||||||
|
void TvCtrlPointPrintHelp(void);
|
||||||
|
int TvCtrlPointDeleteNode(struct TvDeviceNode *);
|
||||||
|
int TvCtrlPointRemoveDevice(const char *);
|
||||||
|
int TvCtrlPointRemoveAll(void);
|
||||||
|
int TvCtrlPointRefresh(void);
|
||||||
|
|
||||||
|
int TvCtrlPointSendAction(int, int, const char *, const char **, char **, int);
|
||||||
|
int TvCtrlPointSendActionNumericArg(int devnum, int service, const char *actionName, const char *paramName, int paramValue);
|
||||||
|
int TvCtrlPointSendPowerOn(int devnum);
|
||||||
|
int TvCtrlPointSendPowerOff(int devnum);
|
||||||
|
int TvCtrlPointSendSetChannel(int, int);
|
||||||
|
int TvCtrlPointSendSetVolume(int, int);
|
||||||
|
int TvCtrlPointSendSetColor(int, int);
|
||||||
|
int TvCtrlPointSendSetTint(int, int);
|
||||||
|
int TvCtrlPointSendSetContrast(int, int);
|
||||||
|
int TvCtrlPointSendSetBrightness(int, int);
|
||||||
|
|
||||||
|
int TvCtrlPointGetVar(int, int, const char *);
|
||||||
|
int TvCtrlPointGetPower(int devnum);
|
||||||
|
int TvCtrlPointGetChannel(int);
|
||||||
|
int TvCtrlPointGetVolume(int);
|
||||||
|
int TvCtrlPointGetColor(int);
|
||||||
|
int TvCtrlPointGetTint(int);
|
||||||
|
int TvCtrlPointGetContrast(int);
|
||||||
|
int TvCtrlPointGetBrightness(int);
|
||||||
|
|
||||||
|
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
||||||
|
int TvCtrlPointPrintList(void);
|
||||||
|
int TvCtrlPointPrintDevice(int);
|
||||||
|
void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
||||||
|
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Update a Tv state table. Called when an event is received.
|
||||||
|
*
|
||||||
|
* Note: this function is NOT thread save. It must be called from another
|
||||||
|
* function that has locked the global device list.
|
||||||
|
**/
|
||||||
|
void TvStateUpdate(
|
||||||
|
/*! [in] The UDN of the parent device. */
|
||||||
|
char *UDN,
|
||||||
|
/*! [in] The service state table to update. */
|
||||||
|
int Service,
|
||||||
|
/*! [out] DOM document representing the XML received with the event. */
|
||||||
|
IXML_Document *ChangedVariables,
|
||||||
|
/*! [out] pointer to the state table for the Tv service to update. */
|
||||||
|
char **State);
|
||||||
|
|
||||||
|
void TvCtrlPointHandleEvent(const char *, int, IXML_Document *);
|
||||||
|
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
||||||
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Checks the advertisement each device in the global device list.
|
||||||
|
*
|
||||||
|
* If an advertisement expires, the device is removed from the list.
|
||||||
|
*
|
||||||
|
* If an advertisement is about to expire, a search request is sent for that
|
||||||
|
* device.
|
||||||
|
*/
|
||||||
|
void TvCtrlPointVerifyTimeouts(
|
||||||
|
/*! [in] The increment to subtract from the timeouts each time the
|
||||||
|
* function is called. */
|
||||||
|
int incr);
|
||||||
|
|
||||||
|
void TvCtrlPointPrintCommands(void);
|
||||||
|
void* TvCtrlPointCommandLoop(void *);
|
||||||
|
int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr, int combo);
|
||||||
|
int TvCtrlPointStop(void);
|
||||||
|
int TvCtrlPointProcessCommand(char *cmdline);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Print help info for this application.
|
||||||
|
*/
|
||||||
|
void TvCtrlPointPrintShortHelp(void);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Print long help info for this application.
|
||||||
|
*/
|
||||||
|
void TvCtrlPointPrintLongHelp(void);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \briefPrint the list of valid command line commands to the user
|
||||||
|
*/
|
||||||
|
void TvCtrlPointPrintCommands(void);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Function that receives commands from the user at the command prompt
|
||||||
|
* during the lifetime of the device, and calls the appropriate
|
||||||
|
* functions for those commands.
|
||||||
|
*/
|
||||||
|
void *TvCtrlPointCommandLoop(void *args);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief
|
||||||
|
*/
|
||||||
|
int TvCtrlPointProcessCommand(char *cmdline);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* UPNP_TV_CTRLPT_H */
|
||||||
|
|
||||||
1510
upnp/sample/common/tv_device.c
Normal file
1510
upnp/sample/common/tv_device.c
Normal file
File diff suppressed because it is too large
Load Diff
566
upnp/sample/common/tv_device.h
Normal file
566
upnp/sample/common/tv_device.h
Normal file
@@ -0,0 +1,566 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UPNP_TV_DEVICE_H
|
||||||
|
#define UPNP_TV_DEVICE_H
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
|
||||||
|
#include "ithread.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
/* Do not #include <unistd.h> */
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! Color constants */
|
||||||
|
#define MAX_COLOR 10
|
||||||
|
#define MIN_COLOR 1
|
||||||
|
|
||||||
|
/*! Brightness constants */
|
||||||
|
#define MAX_BRIGHTNESS 10
|
||||||
|
#define MIN_BRIGHTNESS 1
|
||||||
|
|
||||||
|
/*! Power constants */
|
||||||
|
#define POWER_ON 1
|
||||||
|
#define POWER_OFF 0
|
||||||
|
|
||||||
|
/*! Tint constants */
|
||||||
|
#define MAX_TINT 10
|
||||||
|
#define MIN_TINT 1
|
||||||
|
|
||||||
|
/*! Volume constants */
|
||||||
|
#define MAX_VOLUME 10
|
||||||
|
#define MIN_VOLUME 1
|
||||||
|
|
||||||
|
/*! Contrast constants */
|
||||||
|
#define MAX_CONTRAST 10
|
||||||
|
#define MIN_CONTRAST 1
|
||||||
|
|
||||||
|
/*! Channel constants */
|
||||||
|
#define MAX_CHANNEL 100
|
||||||
|
#define MIN_CHANNEL 1
|
||||||
|
|
||||||
|
/*! Number of services. */
|
||||||
|
#define TV_SERVICE_SERVCOUNT 2
|
||||||
|
|
||||||
|
/*! Index of control service */
|
||||||
|
#define TV_SERVICE_CONTROL 0
|
||||||
|
|
||||||
|
/*! Index of picture service */
|
||||||
|
#define TV_SERVICE_PICTURE 1
|
||||||
|
|
||||||
|
/*! Number of control variables */
|
||||||
|
#define TV_CONTROL_VARCOUNT 3
|
||||||
|
|
||||||
|
/*! Index of power variable */
|
||||||
|
#define TV_CONTROL_POWER 0
|
||||||
|
|
||||||
|
/*! Index of channel variable */
|
||||||
|
#define TV_CONTROL_CHANNEL 1
|
||||||
|
|
||||||
|
/*! Index of volume variable */
|
||||||
|
#define TV_CONTROL_VOLUME 2
|
||||||
|
|
||||||
|
/*! Number of picture variables */
|
||||||
|
#define TV_PICTURE_VARCOUNT 4
|
||||||
|
|
||||||
|
/*! Index of color variable */
|
||||||
|
#define TV_PICTURE_COLOR 0
|
||||||
|
|
||||||
|
/*! Index of tint variable */
|
||||||
|
#define TV_PICTURE_TINT 1
|
||||||
|
|
||||||
|
/*! Index of contrast variable */
|
||||||
|
#define TV_PICTURE_CONTRAST 2
|
||||||
|
|
||||||
|
/*! Index of brightness variable */
|
||||||
|
#define TV_PICTURE_BRIGHTNESS 3
|
||||||
|
|
||||||
|
/*! Max value length */
|
||||||
|
#define TV_MAX_VAL_LEN 5
|
||||||
|
|
||||||
|
/*! Max actions */
|
||||||
|
#define TV_MAXACTIONS 12
|
||||||
|
|
||||||
|
/*! This should be the maximum VARCOUNT from above */
|
||||||
|
#define TV_MAXVARS TV_PICTURE_VARCOUNT
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Prototype for all actions. For each action that a service
|
||||||
|
* implements, there is a corresponding function with this prototype.
|
||||||
|
*
|
||||||
|
* Pointers to these functions, along with action names, are stored
|
||||||
|
* in the service table. When an action request comes in the action
|
||||||
|
* name is matched, and the appropriate function is called.
|
||||||
|
* Each function returns UPNP_E_SUCCESS, on success, and a nonzero
|
||||||
|
* error code on failure.
|
||||||
|
*/
|
||||||
|
typedef int (*upnp_action)(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *request,
|
||||||
|
/*! [out] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] Error string in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*! Structure for storing Tv Service identifiers and state table. */
|
||||||
|
struct TvService {
|
||||||
|
/*! Universally Unique Device Name. */
|
||||||
|
char UDN[NAME_SIZE];
|
||||||
|
/*! . */
|
||||||
|
char ServiceId[NAME_SIZE];
|
||||||
|
/*! . */
|
||||||
|
char ServiceType[NAME_SIZE];
|
||||||
|
/*! . */
|
||||||
|
const char *VariableName[TV_MAXVARS];
|
||||||
|
/*! . */
|
||||||
|
char *VariableStrVal[TV_MAXVARS];
|
||||||
|
/*! . */
|
||||||
|
const char *ActionNames[TV_MAXACTIONS];
|
||||||
|
/*! . */
|
||||||
|
upnp_action actions[TV_MAXACTIONS];
|
||||||
|
/*! . */
|
||||||
|
int VariableCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! Array of service structures */
|
||||||
|
extern struct TvService tv_service_table[];
|
||||||
|
|
||||||
|
/*! Device handle returned from sdk */
|
||||||
|
extern UpnpDevice_Handle device_handle;
|
||||||
|
|
||||||
|
/*! Mutex for protecting the global state table data
|
||||||
|
* in a multi-threaded, asynchronous environment.
|
||||||
|
* All functions should lock this mutex before reading
|
||||||
|
* or writing the state table data. */
|
||||||
|
extern ithread_mutex_t TVDevMutex;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initializes the action table for the specified service.
|
||||||
|
*
|
||||||
|
* Note that knowledge of the service description is assumed.
|
||||||
|
* Action names are hardcoded.
|
||||||
|
*/
|
||||||
|
int SetActionTable(
|
||||||
|
/*! [in] one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE. */
|
||||||
|
int serviceType,
|
||||||
|
/*! [in,out] service containing action table to set. */
|
||||||
|
struct TvService *out);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initialize the device state table for this TvDevice, pulling
|
||||||
|
* identifier info from the description Document.
|
||||||
|
*
|
||||||
|
* Note that knowledge of the service description is assumed.
|
||||||
|
* State table variables and default values are currently hardcoded in
|
||||||
|
* this file rather than being read from service description documents.
|
||||||
|
*/
|
||||||
|
int TvDeviceStateTableInit(
|
||||||
|
/*! [in] The description document URL. */
|
||||||
|
char *DescDocURL);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Called during a subscription request callback.
|
||||||
|
*
|
||||||
|
* If the subscription request is for this device and either its
|
||||||
|
* control service or picture service, then accept it.
|
||||||
|
*/
|
||||||
|
int TvDeviceHandleSubscriptionRequest(
|
||||||
|
/*! [in] The subscription request event structure. */
|
||||||
|
struct Upnp_Subscription_Request *sr_event);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Called during a get variable request callback.
|
||||||
|
*
|
||||||
|
* If the request is for this device and either its control service or
|
||||||
|
* picture service, then respond with the variable value.
|
||||||
|
*/
|
||||||
|
int TvDeviceHandleGetVarRequest(
|
||||||
|
/*! [in,out] The control get variable request event structure. */
|
||||||
|
struct Upnp_State_Var_Request *cgv_event);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Called during an action request callback.
|
||||||
|
*
|
||||||
|
* If the request is for this device and either its control service
|
||||||
|
* or picture service, then perform the action and respond.
|
||||||
|
*/
|
||||||
|
int TvDeviceHandleActionRequest(
|
||||||
|
/*! [in,out] The control action request event structure. */
|
||||||
|
struct Upnp_Action_Request *ca_event);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief The callback handler registered with the SDK while registering
|
||||||
|
* root device.
|
||||||
|
*
|
||||||
|
* Dispatches the request to the appropriate procedure
|
||||||
|
* based on the value of EventType. The four requests handled by the
|
||||||
|
* device are:
|
||||||
|
* \li 1) Event Subscription requests.
|
||||||
|
* \li 2) Get Variable requests.
|
||||||
|
* \li 3) Action requests.
|
||||||
|
*/
|
||||||
|
int TvDeviceCallbackEventHandler(
|
||||||
|
/*! [in] The type of callback event. */
|
||||||
|
Upnp_EventType,
|
||||||
|
/*! [in] Data structure containing event data. */
|
||||||
|
void *Event,
|
||||||
|
/*! [in] Optional data specified during callback registration. */
|
||||||
|
void *Cookie);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Update the TvDevice service state table, and notify all subscribed
|
||||||
|
* control points of the updated state.
|
||||||
|
*
|
||||||
|
* Note that since this function blocks on the mutex TVDevMutex,
|
||||||
|
* to avoid a hang this function should not be called within any other
|
||||||
|
* function that currently has this mutex locked.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetServiceTableVar(
|
||||||
|
/*! [in] The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE). */
|
||||||
|
unsigned int service,
|
||||||
|
/*! [in] The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL,
|
||||||
|
* TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT,
|
||||||
|
* TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS). */
|
||||||
|
int variable,
|
||||||
|
/*! [in] The string representation of the new value. */
|
||||||
|
char *value);
|
||||||
|
|
||||||
|
/* Control Service Actions */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Turn the power on.
|
||||||
|
*/
|
||||||
|
int TvDevicePowerOn(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Turn the power off.
|
||||||
|
*/
|
||||||
|
int TvDevicePowerOff(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Change the channel, update the TvDevice control service
|
||||||
|
* state table, and notify all subscribed control points of the
|
||||||
|
* updated state.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetChannel(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Increase the channel.
|
||||||
|
*/
|
||||||
|
int TvDeviceIncreaseChannel(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Decrease the channel.
|
||||||
|
*/
|
||||||
|
int TvDeviceDecreaseChannel(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Change the volume, update the TvDevice control service
|
||||||
|
* state table, and notify all subscribed control points of the
|
||||||
|
* updated state.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetVolume(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Increase the volume.
|
||||||
|
*/
|
||||||
|
int TvDeviceIncreaseVolume(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Decrease the volume.
|
||||||
|
*/
|
||||||
|
int TvDeviceDecreaseVolume(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*Picture Service Actions */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Change the color, update the TvDevice picture service
|
||||||
|
* state table, and notify all subscribed control points of the
|
||||||
|
* updated state.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetColor(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Increase the color.
|
||||||
|
*/
|
||||||
|
int TvDeviceIncreaseColor(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Decrease the color.
|
||||||
|
*/
|
||||||
|
int TvDeviceDecreaseColor(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Change the tint, update the TvDevice picture service
|
||||||
|
* state table, and notify all subscribed control points of the
|
||||||
|
* updated state.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetTint(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Increase tint.
|
||||||
|
*/
|
||||||
|
int TvDeviceIncreaseTint(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Decrease tint.
|
||||||
|
*/
|
||||||
|
int TvDeviceDecreaseTint(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Change the contrast, update the TvDevice picture service
|
||||||
|
* state table, and notify all subscribed control points of the
|
||||||
|
* updated state.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetContrast(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Increase the contrast.
|
||||||
|
*/
|
||||||
|
int TvDeviceIncreaseContrast(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Decrease the contrast.
|
||||||
|
*/
|
||||||
|
int TvDeviceDecreaseContrast(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Change the brightness, update the TvDevice picture service
|
||||||
|
* state table, and notify all subscribed control points of the
|
||||||
|
* updated state.
|
||||||
|
*/
|
||||||
|
int TvDeviceSetBrightness(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Increase brightnesss.
|
||||||
|
*/
|
||||||
|
int TvDeviceIncreaseBrightness(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Decrease brightnesss.
|
||||||
|
*/
|
||||||
|
int TvDeviceDecreaseBrightness(
|
||||||
|
/*! [in] Document of action request. */
|
||||||
|
IXML_Document *in,
|
||||||
|
/*! [in] Action result. */
|
||||||
|
IXML_Document **out,
|
||||||
|
/*! [out] ErrorString in case action was unsuccessful. */
|
||||||
|
const char **errorString);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Initializes the UPnP Sdk, registers the device, and sends out
|
||||||
|
* advertisements.
|
||||||
|
*/
|
||||||
|
int TvDeviceStart(
|
||||||
|
/*! [in] ip address to initialize the sdk (may be NULL)
|
||||||
|
* if null, then the first non null loopback address is used. */
|
||||||
|
char *ip_address,
|
||||||
|
/*! [in] port number to initialize the sdk (may be 0)
|
||||||
|
* if zero, then a random number is used. */
|
||||||
|
unsigned short port,
|
||||||
|
/*! [in] name of description document.
|
||||||
|
* may be NULL. Default is tvdevicedesc.xml. */
|
||||||
|
const char *desc_doc_name,
|
||||||
|
/*! [in] path of web directory.
|
||||||
|
* may be NULL. Default is ./web (for Linux) or ../tvdevice/web. */
|
||||||
|
const char *web_dir_path,
|
||||||
|
/*! [in] print function to use. */
|
||||||
|
print_string pfun,
|
||||||
|
/*! [in] Non-zero if called from the combo application. */
|
||||||
|
int combo);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Stops the device. Uninitializes the sdk.
|
||||||
|
*/
|
||||||
|
int TvDeviceStop(void);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Function that receives commands from the user at the command prompt
|
||||||
|
* during the lifetime of the device, and calls the appropriate
|
||||||
|
* functions for those commands. Only one command, exit, is currently
|
||||||
|
* defined.
|
||||||
|
*/
|
||||||
|
void *TvDeviceCommandLoop(void *args);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Main entry point for tv device application.
|
||||||
|
*
|
||||||
|
* Initializes and registers with the sdk.
|
||||||
|
* Initializes the state stables of the service.
|
||||||
|
* Starts the command loop.
|
||||||
|
*
|
||||||
|
* Accepts the following optional arguments:
|
||||||
|
* \li \c -ip ipaddress
|
||||||
|
* \li \c -port port
|
||||||
|
* \li \c -desc desc_doc_name
|
||||||
|
* \li \c -webdir web_dir_path
|
||||||
|
* \li \c -help
|
||||||
|
*/
|
||||||
|
int device_main(int argc, char *argv[]);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
72
upnp/sample/linux/tv_combo_main.c
Normal file
72
upnp/sample/linux/tv_combo_main.c
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
#include "tv_ctrlpt.h"
|
||||||
|
#include "tv_device.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
ithread_t cmdloop_thread;
|
||||||
|
#ifdef WIN32
|
||||||
|
#else
|
||||||
|
int sig;
|
||||||
|
sigset_t sigs_to_catch;
|
||||||
|
#endif
|
||||||
|
int code;
|
||||||
|
|
||||||
|
device_main(argc, argv);
|
||||||
|
rc = TvCtrlPointStart(linux_print, NULL, 1);
|
||||||
|
if (rc != TV_SUCCESS) {
|
||||||
|
SampleUtil_Print("Error starting UPnP TV Control Point\n");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
/* start a command loop thread */
|
||||||
|
code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL);
|
||||||
|
#ifdef WIN32
|
||||||
|
ithread_join(cmdloop_thread, NULL);
|
||||||
|
#else
|
||||||
|
/* Catch Ctrl-C and properly shutdown */
|
||||||
|
sigemptyset(&sigs_to_catch);
|
||||||
|
sigaddset(&sigs_to_catch, SIGINT);
|
||||||
|
sigwait(&sigs_to_catch, &sig);
|
||||||
|
SampleUtil_Print("Shutting down on signal %d...\n", sig);
|
||||||
|
#endif
|
||||||
|
TvDeviceStop();
|
||||||
|
rc = TvCtrlPointStop();
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
72
upnp/sample/linux/tv_ctrlpt_main.c
Normal file
72
upnp/sample/linux/tv_ctrlpt_main.c
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
#include "tv_ctrlpt.h"
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
ithread_t cmdloop_thread;
|
||||||
|
#ifdef WIN32
|
||||||
|
#else
|
||||||
|
int sig;
|
||||||
|
sigset_t sigs_to_catch;
|
||||||
|
#endif
|
||||||
|
int code;
|
||||||
|
|
||||||
|
rc = TvCtrlPointStart(linux_print, NULL, 0);
|
||||||
|
if (rc != TV_SUCCESS) {
|
||||||
|
SampleUtil_Print("Error starting UPnP TV Control Point\n");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
/* start a command loop thread */
|
||||||
|
code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL);
|
||||||
|
#ifdef WIN32
|
||||||
|
ithread_join(cmdloop_thread, NULL);
|
||||||
|
#else
|
||||||
|
/* Catch Ctrl-C and properly shutdown */
|
||||||
|
sigemptyset(&sigs_to_catch);
|
||||||
|
sigaddset(&sigs_to_catch, SIGINT);
|
||||||
|
sigwait(&sigs_to_catch, &sig);
|
||||||
|
SampleUtil_Print("Shutting down on signal %d...\n", sig);
|
||||||
|
#endif
|
||||||
|
rc = TvCtrlPointStop();
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
argc = argc;
|
||||||
|
argv = argv;
|
||||||
|
}
|
||||||
|
|
||||||
65
upnp/sample/linux/tv_device_main.c
Normal file
65
upnp/sample/linux/tv_device_main.c
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither name of Intel Corporation nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "sample_util.h"
|
||||||
|
#include "tv_device.h"
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
ithread_t cmdloop_thread;
|
||||||
|
#ifdef WIN32
|
||||||
|
#else
|
||||||
|
int sig;
|
||||||
|
sigset_t sigs_to_catch;
|
||||||
|
#endif
|
||||||
|
int code;
|
||||||
|
|
||||||
|
device_main(argc, argv);
|
||||||
|
/* start a command loop thread */
|
||||||
|
code = ithread_create(&cmdloop_thread, NULL, TvDeviceCommandLoop, NULL);
|
||||||
|
#ifdef WIN32
|
||||||
|
ithread_join(cmdloop_thread, NULL);
|
||||||
|
#else
|
||||||
|
/* Catch Ctrl-C and properly shutdown */
|
||||||
|
sigemptyset(&sigs_to_catch);
|
||||||
|
sigaddset(&sigs_to_catch, SIGINT);
|
||||||
|
sigwait(&sigs_to_catch, &sig);
|
||||||
|
SampleUtil_Print("Shutting down on signal %d...\n", sig);
|
||||||
|
#endif
|
||||||
|
rc = TvDeviceStop();
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,467 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "sample_util.h"
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
Tags for valid commands issued at the command prompt
|
|
||||||
*/
|
|
||||||
enum cmdloop_tvcmds {
|
|
||||||
PRTHELP = 0, PRTFULLHELP, POWON, POWOFF,
|
|
||||||
SETCHAN, SETVOL, SETCOL, SETTINT, SETCONT, SETBRT,
|
|
||||||
CTRLACTION, PICTACTION, CTRLGETVAR, PICTGETVAR,
|
|
||||||
PRTDEV, LSTDEV, REFRESH, EXITCMD
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
Data structure for parsing commands from the command line
|
|
||||||
*/
|
|
||||||
struct cmdloop_commands {
|
|
||||||
char *str; // the string
|
|
||||||
int cmdnum; // the command
|
|
||||||
int numargs; // the number of arguments
|
|
||||||
char *args; // the args
|
|
||||||
} cmdloop_commands;
|
|
||||||
|
|
||||||
/*
|
|
||||||
Mappings between command text names, command tag,
|
|
||||||
and required command arguments for command line
|
|
||||||
commands
|
|
||||||
*/
|
|
||||||
static struct cmdloop_commands cmdloop_cmdlist[] = {
|
|
||||||
{"Help", PRTHELP, 1, ""},
|
|
||||||
{"HelpFull", PRTFULLHELP, 1, ""},
|
|
||||||
{"ListDev", LSTDEV, 1, ""},
|
|
||||||
{"Refresh", REFRESH, 1, ""},
|
|
||||||
{"PrintDev", PRTDEV, 2, "<devnum>"},
|
|
||||||
{"PowerOn", POWON, 2, "<devnum>"},
|
|
||||||
{"PowerOff", POWOFF, 2, "<devnum>"},
|
|
||||||
{"SetChannel", SETCHAN, 3, "<devnum> <channel (int)>"},
|
|
||||||
{"SetVolume", SETVOL, 3, "<devnum> <volume (int)>"},
|
|
||||||
{"SetColor", SETCOL, 3, "<devnum> <color (int)>"},
|
|
||||||
{"SetTint", SETTINT, 3, "<devnum> <tint (int)>"},
|
|
||||||
{"SetContrast", SETCONT, 3, "<devnum> <contrast (int)>"},
|
|
||||||
{"SetBrightness", SETBRT, 3, "<devnum> <brightness (int)>"},
|
|
||||||
{"CtrlAction", CTRLACTION, 2, "<devnum> <action (string)>"},
|
|
||||||
{"PictAction", PICTACTION, 2, "<devnum> <action (string)>"},
|
|
||||||
{"CtrlGetVar", CTRLGETVAR, 2, "<devnum> <varname (string)>"},
|
|
||||||
{"PictGetVar", PICTGETVAR, 2, "<devnum> <varname (string)>"},
|
|
||||||
{"Exit", EXITCMD, 1, ""}
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
linux_print( const char *string )
|
|
||||||
{
|
|
||||||
puts( string );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* TvCtrlPointPrintHelp
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Print help info for this application.
|
|
||||||
********************************************************************************/
|
|
||||||
void
|
|
||||||
TvCtrlPointPrintShortHelp( void )
|
|
||||||
{
|
|
||||||
SampleUtil_Print( "Commands:" );
|
|
||||||
SampleUtil_Print( " Help" );
|
|
||||||
SampleUtil_Print( " HelpFull" );
|
|
||||||
SampleUtil_Print( " ListDev" );
|
|
||||||
SampleUtil_Print( " Refresh" );
|
|
||||||
SampleUtil_Print( " PrintDev <devnum>" );
|
|
||||||
SampleUtil_Print( " PowerOn <devnum>" );
|
|
||||||
SampleUtil_Print( " PowerOff <devnum>" );
|
|
||||||
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
|
||||||
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
|
||||||
SampleUtil_Print( " SetColor <devnum> <color>" );
|
|
||||||
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
|
||||||
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
|
||||||
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
|
||||||
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " PictAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " CtrlGetVar <devnum> <varname>" );
|
|
||||||
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
|
||||||
SampleUtil_Print( " Exit" );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
TvCtrlPointPrintLongHelp( void )
|
|
||||||
{
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
SampleUtil_Print( "******************************" );
|
|
||||||
SampleUtil_Print( "* TV Control Point Help Info *" );
|
|
||||||
SampleUtil_Print( "******************************" );
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "This sample control point application automatically searches" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "for and subscribes to the services of television device emulator" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "devices, described in the tvdevicedesc.xml description document." );
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
SampleUtil_Print( "Commands:" );
|
|
||||||
SampleUtil_Print( " Help" );
|
|
||||||
SampleUtil_Print( " Print this help info." );
|
|
||||||
SampleUtil_Print( " ListDev" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Print the current list of TV Device Emulators that this" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " control point is aware of. Each device is preceded by a" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device number which corresponds to the devnum argument of" );
|
|
||||||
SampleUtil_Print( " commands listed below." );
|
|
||||||
SampleUtil_Print( " Refresh" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Delete all of the devices from the device list and issue new" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " search request to rebuild the list from scratch." );
|
|
||||||
SampleUtil_Print( " PrintDev <devnum>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Print the state table for the device <devnum>." );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " e.g., 'PrintDev 1' prints the state table for the first" );
|
|
||||||
SampleUtil_Print( " device in the device list." );
|
|
||||||
SampleUtil_Print( " PowerOn <devnum>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the PowerOn action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>." );
|
|
||||||
SampleUtil_Print( " PowerOff <devnum>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the PowerOff action to the Control Service of" );
|
|
||||||
SampleUtil_Print( " device <devnum>." );
|
|
||||||
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the SetChannel action to the Control Service of" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the channel to be changed" );
|
|
||||||
SampleUtil_Print( " to <channel>." );
|
|
||||||
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the SetVolume action to the Control Service of" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the volume to be changed" );
|
|
||||||
SampleUtil_Print( " to <volume>." );
|
|
||||||
SampleUtil_Print( " SetColor <devnum> <color>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the SetColor action to the Control Service of" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the color to be changed" );
|
|
||||||
SampleUtil_Print( " to <color>." );
|
|
||||||
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the SetTint action to the Control Service of" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the tint to be changed" );
|
|
||||||
SampleUtil_Print( " to <tint>." );
|
|
||||||
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the SetContrast action to the Control Service of" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the contrast to be changed" );
|
|
||||||
SampleUtil_Print( " to <contrast>." );
|
|
||||||
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends the SetBrightness action to the Control Service of" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " device <devnum>, requesting the brightness to be changed" );
|
|
||||||
SampleUtil_Print( " to <brightness>." );
|
|
||||||
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends an action request specified by the string <action>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " to the Control Service of device <devnum>. This command" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " only works for actions that have no arguments." );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " (e.g., \"CtrlAction 1 IncreaseChannel\")" );
|
|
||||||
SampleUtil_Print( " PictAction <devnum> <action>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Sends an action request specified by the string <action>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " to the Picture Service of device <devnum>. This command" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " only works for actions that have no arguments." );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " (e.g., \"PictAction 1 DecreaseContrast\")" );
|
|
||||||
SampleUtil_Print( " CtrlGetVar <devnum> <varname>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Requests the value of a variable specified by the string <varname>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " from the Control Service of device <devnum>." );
|
|
||||||
SampleUtil_Print( " (e.g., \"CtrlGetVar 1 Volume\")" );
|
|
||||||
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " Requests the value of a variable specified by the string <varname>" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( " from the Picture Service of device <devnum>." );
|
|
||||||
SampleUtil_Print( " (e.g., \"PictGetVar 1 Tint\")" );
|
|
||||||
SampleUtil_Print( " Exit" );
|
|
||||||
SampleUtil_Print( " Exits the control point application." );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* TvCtrlPointPrintCommands
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Print the list of valid command line commands to the user
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
void
|
|
||||||
TvCtrlPointPrintCommands( )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands );
|
|
||||||
|
|
||||||
SampleUtil_Print( "Valid Commands:" );
|
|
||||||
for( i = 0; i < numofcmds; i++ ) {
|
|
||||||
SampleUtil_Print( " %-14s %s", cmdloop_cmdlist[i].str,
|
|
||||||
cmdloop_cmdlist[i].args );
|
|
||||||
}
|
|
||||||
SampleUtil_Print( "" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
|
||||||
* TvCtrlPointCommandLoop
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Function that receives commands from the user at the command prompt
|
|
||||||
* during the lifetime of the control point, and calls the appropriate
|
|
||||||
* functions for those commands.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
********************************************************************************/
|
|
||||||
void *
|
|
||||||
TvCtrlPointCommandLoop( void *args )
|
|
||||||
{
|
|
||||||
char cmdline[100];
|
|
||||||
|
|
||||||
while( 1 ) {
|
|
||||||
SampleUtil_Print( "\n>> " );
|
|
||||||
fgets( cmdline, 100, stdin );
|
|
||||||
TvCtrlPointProcessCommand( cmdline );
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
TvCtrlPointProcessCommand( char *cmdline )
|
|
||||||
{
|
|
||||||
char cmd[100];
|
|
||||||
char strarg[100];
|
|
||||||
int arg_val_err = -99999;
|
|
||||||
int arg1 = arg_val_err;
|
|
||||||
int arg2 = arg_val_err;
|
|
||||||
int cmdnum = -1;
|
|
||||||
int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands );
|
|
||||||
int cmdfound = 0;
|
|
||||||
int i,
|
|
||||||
rc;
|
|
||||||
int invalidargs = 0;
|
|
||||||
int validargs;
|
|
||||||
|
|
||||||
validargs = sscanf( cmdline, "%s %d %d", cmd, &arg1, &arg2 );
|
|
||||||
|
|
||||||
for( i = 0; i < numofcmds; i++ ) {
|
|
||||||
if( strcasecmp( cmd, cmdloop_cmdlist[i].str ) == 0 ) {
|
|
||||||
cmdnum = cmdloop_cmdlist[i].cmdnum;
|
|
||||||
cmdfound++;
|
|
||||||
if( validargs != cmdloop_cmdlist[i].numargs )
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !cmdfound ) {
|
|
||||||
SampleUtil_Print( "Command not found; try 'Help'" );
|
|
||||||
return TV_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( invalidargs ) {
|
|
||||||
SampleUtil_Print( "Invalid arguments; try 'Help'" );
|
|
||||||
return TV_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( cmdnum ) {
|
|
||||||
case PRTHELP:
|
|
||||||
TvCtrlPointPrintShortHelp( );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PRTFULLHELP:
|
|
||||||
TvCtrlPointPrintLongHelp( );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case POWON:
|
|
||||||
TvCtrlPointSendPowerOn( arg1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case POWOFF:
|
|
||||||
TvCtrlPointSendPowerOff( arg1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETCHAN:
|
|
||||||
TvCtrlPointSendSetChannel( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETVOL:
|
|
||||||
TvCtrlPointSendSetVolume( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETCOL:
|
|
||||||
TvCtrlPointSendSetColor( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINT:
|
|
||||||
TvCtrlPointSendSetTint( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETCONT:
|
|
||||||
TvCtrlPointSendSetContrast( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETBRT:
|
|
||||||
TvCtrlPointSendSetBrightness( arg1, arg2 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CTRLACTION:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointSendAction( TV_SERVICE_CONTROL, arg1, strarg,
|
|
||||||
NULL, NULL, 0 );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PICTACTION:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointSendAction( TV_SERVICE_PICTURE, arg1, strarg,
|
|
||||||
NULL, NULL, 0 );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CTRLGETVAR:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointGetVar( TV_SERVICE_CONTROL, arg1, strarg );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PICTGETVAR:
|
|
||||||
/*
|
|
||||||
re-parse commandline since second arg is string
|
|
||||||
*/
|
|
||||||
validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg );
|
|
||||||
if( 3 == validargs )
|
|
||||||
TvCtrlPointGetVar( TV_SERVICE_PICTURE, arg1, strarg );
|
|
||||||
else
|
|
||||||
invalidargs++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PRTDEV:
|
|
||||||
TvCtrlPointPrintDevice( arg1 );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LSTDEV:
|
|
||||||
TvCtrlPointPrintList( );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case REFRESH:
|
|
||||||
TvCtrlPointRefresh( );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EXITCMD:
|
|
||||||
rc = TvCtrlPointStop( );
|
|
||||||
exit( rc );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
SampleUtil_Print( "Command not implemented; see 'Help'" );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( invalidargs )
|
|
||||||
SampleUtil_Print( "Invalid args in command; see 'Help'" );
|
|
||||||
|
|
||||||
return TV_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main( int argc,
|
|
||||||
char **argv )
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
ithread_t cmdloop_thread;
|
|
||||||
int sig;
|
|
||||||
sigset_t sigs_to_catch;
|
|
||||||
int code;
|
|
||||||
|
|
||||||
rc = TvCtrlPointStart( linux_print, NULL );
|
|
||||||
if( rc != TV_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
|
||||||
exit( rc );
|
|
||||||
}
|
|
||||||
// start a command loop thread
|
|
||||||
code =
|
|
||||||
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
/*
|
|
||||||
Catch Ctrl-C and properly shutdown
|
|
||||||
*/
|
|
||||||
sigemptyset( &sigs_to_catch );
|
|
||||||
sigaddset( &sigs_to_catch, SIGINT );
|
|
||||||
sigwait( &sigs_to_catch, &sig );
|
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
|
||||||
rc = TvCtrlPointStop( );
|
|
||||||
exit( rc );
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,158 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_CTRLPT_H
|
|
||||||
#define UPNP_TV_CTRLPT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnptools.h"
|
|
||||||
#include "sample_util.h"
|
|
||||||
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
|
||||||
#define TV_SERVICE_CONTROL 0
|
|
||||||
#define TV_SERVICE_PICTURE 1
|
|
||||||
|
|
||||||
#define TV_CONTROL_VARCOUNT 3
|
|
||||||
#define TV_CONTROL_POWER 0
|
|
||||||
#define TV_CONTROL_CHANNEL 1
|
|
||||||
#define TV_CONTROL_VOLUME 2
|
|
||||||
|
|
||||||
#define TV_PICTURE_VARCOUNT 4
|
|
||||||
#define TV_PICTURE_COLOR 0
|
|
||||||
#define TV_PICTURE_TINT 1
|
|
||||||
#define TV_PICTURE_CONTRAST 2
|
|
||||||
#define TV_PICTURE_BRIGHTNESS 3
|
|
||||||
|
|
||||||
#define TV_MAX_VAL_LEN 5
|
|
||||||
|
|
||||||
#define TV_SUCCESS 0
|
|
||||||
#define TV_ERROR (-1)
|
|
||||||
#define TV_WARNING 1
|
|
||||||
|
|
||||||
/* This should be the maximum VARCOUNT from above */
|
|
||||||
#define TV_MAXVARS TV_PICTURE_VARCOUNT
|
|
||||||
|
|
||||||
extern char TvDeviceType[];
|
|
||||||
extern char *TvServiceType[];
|
|
||||||
extern char *TvServiceName[];
|
|
||||||
extern char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS];
|
|
||||||
extern char TvVarCount[];
|
|
||||||
|
|
||||||
struct tv_service {
|
|
||||||
char ServiceId[NAME_SIZE];
|
|
||||||
char ServiceType[NAME_SIZE];
|
|
||||||
char *VariableStrVal[TV_MAXVARS];
|
|
||||||
char EventURL[NAME_SIZE];
|
|
||||||
char ControlURL[NAME_SIZE];
|
|
||||||
char SID[NAME_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct TvDeviceNode *GlobalDeviceList;
|
|
||||||
|
|
||||||
struct TvDevice {
|
|
||||||
char UDN[250];
|
|
||||||
char DescDocURL[250];
|
|
||||||
char FriendlyName[250];
|
|
||||||
char PresURL[250];
|
|
||||||
int AdvrTimeOut;
|
|
||||||
struct tv_service TvService[TV_SERVICE_SERVCOUNT];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TvDeviceNode {
|
|
||||||
struct TvDevice device;
|
|
||||||
struct TvDeviceNode *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern ithread_mutex_t DeviceListMutex;
|
|
||||||
|
|
||||||
extern UpnpClient_Handle ctrlpt_handle;
|
|
||||||
|
|
||||||
void TvCtrlPointPrintHelp( void );
|
|
||||||
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
|
||||||
int TvCtrlPointRemoveDevice(char*);
|
|
||||||
int TvCtrlPointRemoveAll( void );
|
|
||||||
int TvCtrlPointRefresh( void );
|
|
||||||
|
|
||||||
|
|
||||||
int TvCtrlPointSendAction(int, int, char *, char **, char **, int);
|
|
||||||
int TvCtrlPointSendActionNumericArg(int devnum, int service, char *actionName, char *paramName, int paramValue);
|
|
||||||
int TvCtrlPointSendPowerOn(int devnum);
|
|
||||||
int TvCtrlPointSendPowerOff(int devnum);
|
|
||||||
int TvCtrlPointSendSetChannel(int, int);
|
|
||||||
int TvCtrlPointSendSetVolume(int, int);
|
|
||||||
int TvCtrlPointSendSetColor(int, int);
|
|
||||||
int TvCtrlPointSendSetTint(int, int);
|
|
||||||
int TvCtrlPointSendSetContrast(int, int);
|
|
||||||
int TvCtrlPointSendSetBrightness(int, int);
|
|
||||||
|
|
||||||
int TvCtrlPointGetVar(int, int, char*);
|
|
||||||
int TvCtrlPointGetPower(int devnum);
|
|
||||||
int TvCtrlPointGetChannel(int);
|
|
||||||
int TvCtrlPointGetVolume(int);
|
|
||||||
int TvCtrlPointGetColor(int);
|
|
||||||
int TvCtrlPointGetTint(int);
|
|
||||||
int TvCtrlPointGetContrast(int);
|
|
||||||
int TvCtrlPointGetBrightness(int);
|
|
||||||
|
|
||||||
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
|
||||||
int TvCtrlPointPrintList( void );
|
|
||||||
int TvCtrlPointPrintDevice(int);
|
|
||||||
void TvCtrlPointAddDevice (IXML_Document *, char *, int);
|
|
||||||
void TvCtrlPointHandleGetVar(char *,char *,DOMString);
|
|
||||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
|
||||||
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
|
||||||
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
|
||||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
|
||||||
void TvCtrlPointVerifyTimeouts(int);
|
|
||||||
void TvCtrlPointPrintCommands( void );
|
|
||||||
void* TvCtrlPointCommandLoop( void* );
|
|
||||||
int TvCtrlPointStart( print_string printFunctionPtr, state_update updateFunctionPtr );
|
|
||||||
int TvCtrlPointStop( void );
|
|
||||||
int TvCtrlPointProcessCommand( char *cmdline );
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif //UPNP_TV_CTRLPT_H
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "sample_util.h"
|
|
||||||
#include "upnp_tv_device.h"
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* linux_print
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Prints a string to standard out.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
void
|
|
||||||
linux_print( const char *string )
|
|
||||||
{
|
|
||||||
printf( "%s", string );
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceCommandLoop
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Function that receives commands from the user at the command prompt
|
|
||||||
* during the lifetime of the device, and calls the appropriate
|
|
||||||
* functions for those commands. Only one command, exit, is currently
|
|
||||||
* defined.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
void *
|
|
||||||
TvDeviceCommandLoop( void *args )
|
|
||||||
{
|
|
||||||
int stoploop = 0;
|
|
||||||
char cmdline[100];
|
|
||||||
char cmd[100];
|
|
||||||
|
|
||||||
while( !stoploop ) {
|
|
||||||
sprintf( cmdline, " " );
|
|
||||||
sprintf( cmd, " " );
|
|
||||||
|
|
||||||
SampleUtil_Print( "\n>> " );
|
|
||||||
|
|
||||||
// Get a command line
|
|
||||||
fgets( cmdline, 100, stdin );
|
|
||||||
|
|
||||||
sscanf( cmdline, "%s", cmd );
|
|
||||||
|
|
||||||
if( strcasecmp( cmd, "exit" ) == 0 ) {
|
|
||||||
SampleUtil_Print( "Shutting down...\n" );
|
|
||||||
TvDeviceStop( );
|
|
||||||
exit( 0 );
|
|
||||||
} else {
|
|
||||||
SampleUtil_Print( "\n Unknown command: %s\n\n", cmd );
|
|
||||||
SampleUtil_Print( " Valid Commands:\n" );
|
|
||||||
SampleUtil_Print( " Exit\n\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* main
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Main entry point for tv device application.
|
|
||||||
* Initializes and registers with the sdk.
|
|
||||||
* Initializes the state stables of the service.
|
|
||||||
* Starts the command loop.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* int argc - count of arguments
|
|
||||||
* char ** argv -arguments. The application
|
|
||||||
* accepts the following optional arguments:
|
|
||||||
*
|
|
||||||
* -ip ipaddress
|
|
||||||
* -port port
|
|
||||||
* -desc desc_doc_name
|
|
||||||
* -webdir web_dir_path"
|
|
||||||
* -help
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int
|
|
||||||
main( IN int argc,
|
|
||||||
IN char **argv )
|
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int portTemp = 0;
|
|
||||||
char *ip_address = NULL,
|
|
||||||
*desc_doc_name = NULL,
|
|
||||||
*web_dir_path = NULL;
|
|
||||||
ithread_t cmdloop_thread;
|
|
||||||
int code;
|
|
||||||
unsigned int port = 0;
|
|
||||||
int sig;
|
|
||||||
sigset_t sigs_to_catch;
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
SampleUtil_Initialize( linux_print );
|
|
||||||
|
|
||||||
//Parse options
|
|
||||||
for( i = 1; i < argc; i++ ) {
|
|
||||||
if( strcmp( argv[i], "-ip" ) == 0 ) {
|
|
||||||
ip_address = argv[++i];
|
|
||||||
} else if( strcmp( argv[i], "-port" ) == 0 ) {
|
|
||||||
sscanf( argv[++i], "%u", &portTemp );
|
|
||||||
} else if( strcmp( argv[i], "-desc" ) == 0 ) {
|
|
||||||
desc_doc_name = argv[++i];
|
|
||||||
} else if( strcmp( argv[i], "-webdir" ) == 0 ) {
|
|
||||||
web_dir_path = argv[++i];
|
|
||||||
} else if( strcmp( argv[i], "-help" ) == 0 ) {
|
|
||||||
SampleUtil_Print( "Usage: %s -ip ipaddress -port port"
|
|
||||||
" -desc desc_doc_name -webdir web_dir_path"
|
|
||||||
" -help (this message)\n", argv[0] );
|
|
||||||
SampleUtil_Print( "\tipaddress: IP address of the device"
|
|
||||||
" (must match desc. doc)\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: 192.168.0.4\n" );
|
|
||||||
SampleUtil_Print( "\tport: Port number to use for "
|
|
||||||
"receiving UPnP messages (must match desc. doc)\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: 5431\n" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "\tdesc_doc_name: name of device description document\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: tvdevicedesc.xml\n" );
|
|
||||||
SampleUtil_Print
|
|
||||||
( "\tweb_dir_path: Filesystem path where web files "
|
|
||||||
"related to the device are stored\n" );
|
|
||||||
SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" );
|
|
||||||
exit( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
port = ( unsigned short )portTemp;
|
|
||||||
|
|
||||||
TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path,
|
|
||||||
linux_print );
|
|
||||||
|
|
||||||
/*
|
|
||||||
start a command loop thread
|
|
||||||
*/
|
|
||||||
code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop,
|
|
||||||
NULL );
|
|
||||||
|
|
||||||
/*
|
|
||||||
Catch Ctrl-C and properly shutdown
|
|
||||||
*/
|
|
||||||
sigemptyset( &sigs_to_catch );
|
|
||||||
sigaddset( &sigs_to_catch, SIGINT );
|
|
||||||
sigwait( &sigs_to_catch, &sig );
|
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
|
||||||
TvDeviceStop( );
|
|
||||||
exit( 0 );
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,638 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Copyright (c) 2000-2003 Intel Corporation
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
// * Neither name of Intel Corporation nor the names of its contributors
|
|
||||||
// may be used to endorse or promote products derived from this software
|
|
||||||
// without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
|
||||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
||||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_DEVICE_H
|
|
||||||
#define UPNP_TV_DEVICE_H
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "sample_util.h"
|
|
||||||
|
|
||||||
//Color constants
|
|
||||||
#define MAX_COLOR 10
|
|
||||||
#define MIN_COLOR 1
|
|
||||||
|
|
||||||
//Brightness constants
|
|
||||||
#define MAX_BRIGHTNESS 10
|
|
||||||
#define MIN_BRIGHTNESS 1
|
|
||||||
|
|
||||||
//Power constants
|
|
||||||
#define POWER_ON 1
|
|
||||||
#define POWER_OFF 0
|
|
||||||
|
|
||||||
//Tint constants
|
|
||||||
#define MAX_TINT 10
|
|
||||||
#define MIN_TINT 1
|
|
||||||
|
|
||||||
//Volume constants
|
|
||||||
#define MAX_VOLUME 10
|
|
||||||
#define MIN_VOLUME 1
|
|
||||||
|
|
||||||
//Contrast constants
|
|
||||||
#define MAX_CONTRAST 10
|
|
||||||
#define MIN_CONTRAST 1
|
|
||||||
|
|
||||||
//Channel constants
|
|
||||||
#define MAX_CHANNEL 100
|
|
||||||
#define MIN_CHANNEL 1
|
|
||||||
|
|
||||||
//Number of services.
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
|
||||||
|
|
||||||
//Index of control service
|
|
||||||
#define TV_SERVICE_CONTROL 0
|
|
||||||
|
|
||||||
//Index of picture service
|
|
||||||
#define TV_SERVICE_PICTURE 1
|
|
||||||
|
|
||||||
//Number of control variables
|
|
||||||
#define TV_CONTROL_VARCOUNT 3
|
|
||||||
|
|
||||||
//Index of power variable
|
|
||||||
#define TV_CONTROL_POWER 0
|
|
||||||
|
|
||||||
//Index of channel variable
|
|
||||||
#define TV_CONTROL_CHANNEL 1
|
|
||||||
|
|
||||||
//Index of volume variable
|
|
||||||
#define TV_CONTROL_VOLUME 2
|
|
||||||
|
|
||||||
//Number of picture variables
|
|
||||||
#define TV_PICTURE_VARCOUNT 4
|
|
||||||
|
|
||||||
//Index of color variable
|
|
||||||
#define TV_PICTURE_COLOR 0
|
|
||||||
|
|
||||||
//Index of tint variable
|
|
||||||
#define TV_PICTURE_TINT 1
|
|
||||||
|
|
||||||
//Index of contrast variable
|
|
||||||
#define TV_PICTURE_CONTRAST 2
|
|
||||||
|
|
||||||
//Index of brightness variable
|
|
||||||
#define TV_PICTURE_BRIGHTNESS 3
|
|
||||||
|
|
||||||
//Max value length
|
|
||||||
#define TV_MAX_VAL_LEN 5
|
|
||||||
|
|
||||||
//Max actions
|
|
||||||
#define TV_MAXACTIONS 12
|
|
||||||
|
|
||||||
/* This should be the maximum VARCOUNT from above */
|
|
||||||
#define TV_MAXVARS TV_PICTURE_VARCOUNT
|
|
||||||
|
|
||||||
|
|
||||||
extern char TvDeviceType[];
|
|
||||||
|
|
||||||
extern char *TvServiceType[];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* upnp_action
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Prototype for all actions. For each action that a service
|
|
||||||
* implements, there is a corresponding function with this prototype.
|
|
||||||
* Pointers to these functions, along with action names, are stored
|
|
||||||
* in the service table. When an action request comes in the action
|
|
||||||
* name is matched, and the appropriate function is called.
|
|
||||||
* Each function returns UPNP_E_SUCCESS, on success, and a nonzero
|
|
||||||
* error code on failure.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * request - document of action request
|
|
||||||
* IXML_Document **out - action result
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,
|
|
||||||
char **errorString);
|
|
||||||
|
|
||||||
/* Structure for storing Tv Service
|
|
||||||
identifiers and state table */
|
|
||||||
struct TvService {
|
|
||||||
|
|
||||||
char UDN[NAME_SIZE]; /* Universally Unique Device Name */
|
|
||||||
char ServiceId[NAME_SIZE];
|
|
||||||
char ServiceType[NAME_SIZE];
|
|
||||||
char *VariableName[TV_MAXVARS];
|
|
||||||
char *VariableStrVal[TV_MAXVARS];
|
|
||||||
char *ActionNames[TV_MAXACTIONS];
|
|
||||||
upnp_action actions[TV_MAXACTIONS];
|
|
||||||
unsigned int VariableCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Array of service structures
|
|
||||||
extern struct TvService tv_service_table[];
|
|
||||||
|
|
||||||
//Device handle returned from sdk
|
|
||||||
extern UpnpDevice_Handle device_handle;
|
|
||||||
|
|
||||||
|
|
||||||
/* Mutex for protecting the global state table data
|
|
||||||
in a multi-threaded, asynchronous environment.
|
|
||||||
All functions should lock this mutex before reading
|
|
||||||
or writing the state table data. */
|
|
||||||
extern ithread_mutex_t TVDevMutex;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* SetActionTable
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initializes the action table for the specified service.
|
|
||||||
* Note that
|
|
||||||
* knowledge of the service description is
|
|
||||||
* assumed. Action names are hardcoded.
|
|
||||||
* Parameters:
|
|
||||||
* int serviceType - one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE
|
|
||||||
* struct TvService *out - service containing action table to set.
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int SetActionTable(int serviceType, struct TvService * out);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceStateTableInit
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initialize the device state table for
|
|
||||||
* this TvDevice, pulling identifier info
|
|
||||||
* from the description Document. Note that
|
|
||||||
* knowledge of the service description is
|
|
||||||
* assumed. State table variables and default
|
|
||||||
* values are currently hardcoded in this file
|
|
||||||
* rather than being read from service description
|
|
||||||
* documents.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* DescDocURL -- The description document URL
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceStateTableInit(char*);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceHandleSubscriptionRequest
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called during a subscription request callback. If the
|
|
||||||
* subscription request is for this device and either its
|
|
||||||
* control service or picture service, then accept it.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* sr_event -- The subscription request event structure
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceHandleGetVarRequest
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called during a get variable request callback. If the
|
|
||||||
* request is for this device and either its control service
|
|
||||||
* or picture service, then respond with the variable value.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* cgv_event -- The control get variable request event structure
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceHandleActionRequest
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Called during an action request callback. If the
|
|
||||||
* request is for this device and either its control service
|
|
||||||
* or picture service, then perform the action and respond.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* ca_event -- The control action request event structure
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceHandleActionRequest(struct Upnp_Action_Request *);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceCallbackEventHandler
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* The callback handler registered with the SDK while registering
|
|
||||||
* root device. Dispatches the request to the appropriate procedure
|
|
||||||
* based on the value of EventType. The four requests handled by the
|
|
||||||
* device are:
|
|
||||||
* 1) Event Subscription requests.
|
|
||||||
* 2) Get Variable requests.
|
|
||||||
* 3) Action requests.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* EventType -- The type of callback event
|
|
||||||
* Event -- Data structure containing event data
|
|
||||||
* Cookie -- Optional data specified during callback registration
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceCallbackEventHandler(Upnp_EventType, void*, void*);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetServiceTableVar
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Update the TvDevice service state table, and notify all subscribed
|
|
||||||
* control points of the updated state. Note that since this function
|
|
||||||
* blocks on the mutex TVDevMutex, to avoid a hang this function should
|
|
||||||
* not be called within any other function that currently has this mutex
|
|
||||||
* locked.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* service -- The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE)
|
|
||||||
* variable -- The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL,
|
|
||||||
* TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT,
|
|
||||||
* TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS)
|
|
||||||
* value -- The string representation of the new value
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*);
|
|
||||||
|
|
||||||
//Control Service Actions
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDevicePowerOn
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Turn the power on.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - document of action request
|
|
||||||
* IXML_Document **out - action result
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDevicePowerOff
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Turn the power off.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - document of action request
|
|
||||||
* IXML_Document **out - action result
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetChannel
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the channel, update the TvDevice control service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseChannel
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase the channel.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseChannel
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the channel.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetVolume
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the volume, update the TvDevice control service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseVolume
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase the volume.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseVolume
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the volume.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
//Picture Service Actions
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetColor
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the color, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseColor
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase the color.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseColor
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the color.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetTint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the tint, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseTint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase tint.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseTint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease tint.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* TvDeviceSetContrast
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the contrast, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseContrast
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
*
|
|
||||||
* Increase the contrast.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseContrast
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease the contrast.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceSetBrightness
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Change the brightness, update the TvDevice picture service
|
|
||||||
* state table, and notify all subscribed control points of the
|
|
||||||
* updated state.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* brightness -- The brightness value to change to.
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceIncreaseBrightness
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Increase brightness.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
/******************************************************************************
|
|
||||||
* TvDeviceDecreaseBrightness
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Decrease brightnesss.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IXML_Document * in - action request document
|
|
||||||
* IXML_Document **out - action result document
|
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|
||||||
OUT char **errorString);
|
|
||||||
|
|
||||||
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
|
||||||
char *web_dir_path, print_string pfun);
|
|
||||||
int TvDeviceStop();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
37
upnp/sample/web/tvcombodesc.xml
Normal file
37
upnp/sample/web/tvcombodesc.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<root xmlns="urn:schemas-upnp-org:device-1-0">
|
||||||
|
<specVersion>
|
||||||
|
<major>1</major>
|
||||||
|
<minor>0</minor>
|
||||||
|
</specVersion>
|
||||||
|
<device>
|
||||||
|
<deviceType>urn:schemas-upnp-org:device:tvdevice:1</deviceType>
|
||||||
|
<friendlyName>UPnP Television Emulator</friendlyName>
|
||||||
|
<manufacturer>TV Manufacturer Name</manufacturer>
|
||||||
|
<manufacturerURL>http://www.manufacturer.com</manufacturerURL>
|
||||||
|
<modelDescription>UPnP Television Device Emulator 1.0</modelDescription>
|
||||||
|
<modelName>TVEmulator</modelName>
|
||||||
|
<modelNumber>1.0</modelNumber>
|
||||||
|
<modelURL>http://www.manufacturer.com/TVEmulator/</modelURL>
|
||||||
|
<serialNumber>123456789001</serialNumber>
|
||||||
|
<UDN>uuid:Upnp-TVEmulator-1_0-1234567890002</UDN>
|
||||||
|
<UPC>123456789</UPC>
|
||||||
|
<serviceList>
|
||||||
|
<service>
|
||||||
|
<serviceType>urn:schemas-upnp-org:service:tvcontrol:1</serviceType>
|
||||||
|
<serviceId>urn:upnp-org:serviceId:tvcontrol1</serviceId>
|
||||||
|
<controlURL>/upnp/control/tvcontrol1</controlURL>
|
||||||
|
<eventSubURL>/upnp/event/tvcontrol1</eventSubURL>
|
||||||
|
<SCPDURL>/tvcontrolSCPD.xml</SCPDURL>
|
||||||
|
</service>
|
||||||
|
<service>
|
||||||
|
<serviceType>urn:schemas-upnp-org:service:tvpicture:1</serviceType>
|
||||||
|
<serviceId>urn:upnp-org:serviceId:tvpicture1</serviceId>
|
||||||
|
<controlURL>/upnp/control/tvpicture1</controlURL>
|
||||||
|
<eventSubURL>/upnp/event/tvpicture1</eventSubURL>
|
||||||
|
<SCPDURL>/tvpictureSCPD.xml</SCPDURL>
|
||||||
|
</service>
|
||||||
|
</serviceList>
|
||||||
|
<presentationURL>/tvdevicepres.html</presentationURL>
|
||||||
|
</device>
|
||||||
|
</root>
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
</specVersion>
|
</specVersion>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<actionList>
|
<actionList>
|
||||||
|
|
||||||
<action>
|
<action>
|
||||||
@@ -38,6 +37,12 @@
|
|||||||
<name>SetChannel</name>
|
<name>SetChannel</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
|
||||||
|
<argument>
|
||||||
|
<name>Channel</name>
|
||||||
|
<relatedStateVariable>Channel</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewChannel</name>
|
<name>NewChannel</name>
|
||||||
<retval />
|
<retval />
|
||||||
@@ -45,11 +50,6 @@
|
|||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
<argument>
|
|
||||||
<name>Channel</name>
|
|
||||||
<relatedStateVariable>Channel</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -80,6 +80,11 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetVolume</name>
|
<name>SetVolume</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
<argument>
|
||||||
|
<name>Volume</name>
|
||||||
|
<relatedStateVariable>Volume</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewVolume</name>
|
<name>NewVolume</name>
|
||||||
@@ -87,11 +92,6 @@
|
|||||||
<relatedStateVariable>Volume</relatedStateVariable>
|
<relatedStateVariable>Volume</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
<argument>
|
|
||||||
<name>Volume</name>
|
|
||||||
<relatedStateVariable>Volume</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -124,9 +124,6 @@
|
|||||||
|
|
||||||
</actionList>
|
</actionList>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<serviceStateTable>
|
<serviceStateTable>
|
||||||
|
|
||||||
<stateVariable sendEvents="yes">
|
<stateVariable sendEvents="yes">
|
||||||
@@ -12,6 +12,12 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetColor</name>
|
<name>SetColor</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
<argument>
|
||||||
|
<name>Color</name>
|
||||||
|
<relatedStateVariable>Color</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
|
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewColor</name>
|
<name>NewColor</name>
|
||||||
<retval />
|
<retval />
|
||||||
@@ -19,11 +25,6 @@
|
|||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
<argument>
|
|
||||||
<name>Color</name>
|
|
||||||
<relatedStateVariable>Color</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -54,6 +55,11 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetTint</name>
|
<name>SetTint</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
<argument>
|
||||||
|
<name>Tint</name>
|
||||||
|
<relatedStateVariable>Tint</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewTint</name>
|
<name>NewTint</name>
|
||||||
<retval />
|
<retval />
|
||||||
@@ -61,11 +67,6 @@
|
|||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
<argument>
|
|
||||||
<name>Tint</name>
|
|
||||||
<relatedStateVariable>Tint</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -96,17 +97,17 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetContrast</name>
|
<name>SetContrast</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
<argument>
|
||||||
|
<name>Contrast</name>
|
||||||
|
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewContrast</name>
|
<name>NewContrast</name>
|
||||||
<retval />
|
<retval />
|
||||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
<relatedStateVariable>Contrast</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
<argument>
|
|
||||||
<name>Contrast</name>
|
|
||||||
<relatedStateVariable>Contrast</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -137,19 +138,17 @@
|
|||||||
<action>
|
<action>
|
||||||
<name>SetBrightness</name>
|
<name>SetBrightness</name>
|
||||||
<argumentList>
|
<argumentList>
|
||||||
|
<argument>
|
||||||
|
<name>Brightness</name>
|
||||||
|
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||||
|
<direction>in</direction>
|
||||||
|
</argument>
|
||||||
<argument>
|
<argument>
|
||||||
<name>NewBrightness</name>
|
<name>NewBrightness</name>
|
||||||
<retval />
|
<retval />
|
||||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
<relatedStateVariable>Brightness</relatedStateVariable>
|
||||||
<direction>out</direction>
|
<direction>out</direction>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
<argument>
|
|
||||||
<name>Brightness</name>
|
|
||||||
<relatedStateVariable>Brightness</relatedStateVariable>
|
|
||||||
<direction>in</direction>
|
|
||||||
</argument>
|
|
||||||
</argumentList>
|
</argumentList>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
@@ -182,7 +181,6 @@
|
|||||||
</actionList>
|
</actionList>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<serviceStateTable>
|
<serviceStateTable>
|
||||||
|
|
||||||
<stateVariable sendEvents="yes">
|
<stateVariable sendEvents="yes">
|
||||||
213
upnp/src/api/UpnpString.c
Normal file
213
upnp/src/api/UpnpString.c
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \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);
|
||||||
|
#elif defined(WIN32)
|
||||||
|
static char *strndup(const char *__string, size_t __n)
|
||||||
|
{
|
||||||
|
size_t strsize = strnlen(__string,__n);
|
||||||
|
char *newstr = (char *) malloc(strsize + 1);
|
||||||
|
strncpy(newstr,__string,__n);
|
||||||
|
return(newstr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Internal implementation of the class UpnpString.
|
||||||
|
*
|
||||||
|
* \internal
|
||||||
|
*/
|
||||||
|
struct SUpnpString
|
||||||
|
{
|
||||||
|
/*! \brief Length of the string. */
|
||||||
|
size_t 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
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user