Compare commits
465 Commits
main
...
branch-1.6
Author | SHA1 | Date | |
---|---|---|---|
|
bc335f5df7 | ||
|
cf31814e55 | ||
|
3b0fd070fd | ||
|
9f69fb1b80 | ||
|
c124ae6507 | ||
|
51a01cdba1 | ||
|
6905714a7e | ||
|
72460df747 | ||
|
a596abfbe3 | ||
|
fbbb24f406 | ||
|
0508fb0d6e | ||
|
848d66e69d | ||
|
04fb684323 | ||
|
faaef39a3c | ||
|
a1193f385e | ||
|
c20f2bd3a1 | ||
|
3fc0f9ad1d | ||
|
2211cc14e6 | ||
|
bf60dc06e0 | ||
|
908785fba7 | ||
|
1a28e8ff51 | ||
|
89ad5e6779 | ||
|
062ac0c926 | ||
|
06aa3b17c4 | ||
|
9f444a680e | ||
|
8e3a71905b | ||
|
72c29ef1f6 | ||
|
f6a3102b48 | ||
|
9a9c4e829e | ||
|
7a571f513e | ||
|
f10730f616 | ||
|
c70f5ce323 | ||
|
a3c540bc9b | ||
|
7b1aa4c9e3 | ||
|
907c7c2621 | ||
|
25c27b8af7 | ||
|
dcbbc30f5c | ||
|
3509991872 | ||
|
6279b7fa5f | ||
|
6cd1f11154 | ||
|
f015a132e8 | ||
|
40e90e89fc | ||
|
40ddff1096 | ||
|
692813d03e | ||
|
d9e90499b7 | ||
|
6db2271ac3 | ||
|
4d21d45da7 | ||
|
708ea30806 | ||
|
39dfad2cba | ||
|
3d7c1dbd59 | ||
|
e52e7e0bd3 | ||
|
d5d680d131 | ||
|
7ee266076d | ||
|
90fad896c4 | ||
|
0ea9c438e5 | ||
|
c661180d15 | ||
|
1a98394781 | ||
|
89fe655aee | ||
|
d72bb5cff5 | ||
|
e02753736a | ||
|
1c21e6e54f | ||
|
a383cbb8e2 | ||
|
34a77cc095 | ||
|
e10bc2ec0c | ||
|
777c936f4c | ||
|
04c1bf3fb0 | ||
|
ab792e4223 | ||
|
d0b16d056e | ||
|
dc4eda529f | ||
|
c154c63cdc | ||
|
49af91fe48 | ||
|
df27ba505f | ||
|
9a33782ab5 | ||
|
e0e81e6cd2 | ||
|
02afbb09c9 | ||
|
804088d859 | ||
|
679ebeec48 | ||
|
19ec877b2a | ||
|
01d7c05fb8 | ||
|
952492b44e | ||
|
a04c36f47e | ||
|
e13ffe3bf8 | ||
|
d3d17da6e5 | ||
|
e0444b26e6 | ||
|
cb07623dde | ||
|
c9f3e26f24 | ||
|
a3d038c885 | ||
|
731512b0e5 | ||
|
76eb3f869b | ||
|
b116d10f37 | ||
|
1a083479a9 | ||
|
850e6b4849 | ||
|
d48d73720b | ||
|
b7f83bb7c6 | ||
|
05fb3f8026 | ||
|
7178f300bb | ||
|
f7a801c3ae | ||
|
f299d6597a | ||
|
35819a7a44 | ||
|
f1c4ffefda | ||
|
a692e591de | ||
|
ad7272d2b5 | ||
|
86bef09787 | ||
|
c40d2bc0c9 | ||
|
8e39b2af85 | ||
|
2eb3e069ba | ||
|
db532afb9b | ||
|
1b38cc963a | ||
|
c67187ac94 | ||
|
d45f3c28cf | ||
|
06660b6383 | ||
|
41412c16ef | ||
|
04e5767ea0 | ||
|
5944960e17 | ||
|
d952ebfb44 | ||
|
56b44fee91 | ||
|
ff635f92c0 | ||
|
19a23dafba | ||
|
bd7f83feb5 | ||
|
e4678168fa | ||
|
a0dc3482dc | ||
|
87d1d3c3ec | ||
|
194397b6d6 | ||
|
b78eaf4e43 | ||
|
a54d6e7e83 | ||
|
18bf3b1c9c | ||
|
bb140000c0 | ||
|
7aef73d7eb | ||
|
77c73884b8 | ||
|
72eecacf56 | ||
|
601332f88f | ||
|
4605314569 | ||
|
e95b4cc53a | ||
|
e722d8c375 | ||
|
29ee36b1ca | ||
|
2fb791c9bb | ||
|
d909297aa7 | ||
|
9b616a08df | ||
|
3ab8d536a0 | ||
|
4f34a12a83 | ||
|
97a17ff5ad | ||
|
9965f02727 | ||
|
861a538cea | ||
|
c12d33aca6 | ||
|
4c3532585d | ||
|
71ab707e81 | ||
|
cec9d55c4c | ||
|
56c26b5199 | ||
|
0469388b73 | ||
|
268abf72fb | ||
|
288ef35cee | ||
|
7ef089b09a | ||
|
c13b1f7e37 | ||
|
3e7bf14488 | ||
|
a8bcbe9491 | ||
|
1a1570fe0f | ||
|
30badb44c7 | ||
|
3504b13eae | ||
|
d6f1e4112e | ||
|
e5887c9036 | ||
|
eeab71082f | ||
|
f6e88d5b0a | ||
|
add51536fc | ||
|
40864da7c1 | ||
|
5caaf3ad07 | ||
|
26c3f87eca | ||
|
20372ccef6 | ||
|
47c86542bc | ||
|
da244683cf | ||
|
7301f46269 | ||
|
bd203e780e | ||
|
69f3fe2330 | ||
|
52df3081df | ||
|
71e77a5b27 | ||
|
a79a149e6a | ||
|
0693adc7dc | ||
|
076f8e5be6 | ||
|
60f9df425b | ||
|
fa83dd4a00 | ||
|
795de3e077 | ||
|
a567576100 | ||
|
bc473d5e68 | ||
|
2940cbf94a | ||
|
d87c966ec5 | ||
|
e88d9dbedc | ||
|
33fcfeb79f | ||
|
a9c24fc7f3 | ||
|
537581d8ad | ||
|
66ea2ab11d | ||
|
4ca0b382ea | ||
|
c155d3c68f | ||
|
03bd7759cd | ||
|
80a65e5f61 | ||
|
3b33626e2f | ||
|
b35761e893 | ||
|
631259dcfc | ||
|
98e4f938d6 | ||
|
92c93a8010 | ||
|
e40e6b49d4 | ||
|
cec07d641a | ||
|
6c6fb3707f | ||
|
92ea719804 | ||
|
fed316ff3e | ||
|
8eb7d1c1a5 | ||
|
2b263b6574 | ||
|
e16cb4b225 | ||
|
0996d23318 | ||
|
11f9a2bafe | ||
|
8aca337de7 | ||
|
a78a048577 | ||
|
7338411c08 | ||
|
3a9ae348bc | ||
|
840669b253 | ||
|
e30e7bd586 | ||
|
0d3412bb24 | ||
|
e52dafda3b | ||
|
bab22c694b | ||
|
74665acd57 | ||
|
b1629b8ac8 | ||
|
32e510b45a | ||
|
063d472f80 | ||
|
0bbe9f62df | ||
|
fdb8b9ef2f | ||
|
6c125feea0 | ||
|
c4e9757bcf | ||
|
639d3a5a03 | ||
|
f46683fd0e | ||
|
abfa841318 | ||
|
3c4ff99cdb | ||
|
541679d651 | ||
|
cb1188d2bc | ||
|
189ce59dbe | ||
|
4815e52586 | ||
|
9051731a93 | ||
|
39fd869db8 | ||
|
8997e7fff6 | ||
|
7e8d1787c9 | ||
|
70d2a7c9e7 | ||
|
40e6e4503c | ||
|
4b0c8d52b8 | ||
|
c05bbec6ec | ||
|
d5af7efeb8 | ||
|
c8af5ec806 | ||
|
1ee8cd9e1a | ||
|
a0ebf23785 | ||
|
cdf35baa34 | ||
|
6d7702d3a7 | ||
|
6af93e6ca6 | ||
|
2ce88f80f0 | ||
|
f67ed1949b | ||
|
04d64a893b | ||
|
704dca3df1 | ||
|
b2a88aa70b | ||
|
bb5a80c05b | ||
|
7e8e5621a8 | ||
|
462505ff62 | ||
|
d6418b3e17 | ||
|
e8106e4f05 | ||
|
3dd133a03c | ||
|
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 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -118,7 +118,3 @@ docs/doxygen
|
||||
/build/vc10/out.vc10.Win32
|
||||
/build/vc10/out.vc10.x64
|
||||
/pthreads
|
||||
/build/vc10/ipch
|
||||
/build/vc10/IUpnpErrFile.txt
|
||||
/build/vc10/IUpnpInfoFile.txt
|
||||
/build/vc10/*.opensdf
|
||||
|
360
ChangeLog
360
ChangeLog
@ -1,363 +1,3 @@
|
||||
*******************************************************************************
|
||||
Version 1.8.0
|
||||
*******************************************************************************
|
||||
|
||||
2014-01-15 Peng <howtofly(at)gmail.com>
|
||||
|
||||
Fix memory leaks.
|
||||
|
||||
|
||||
2013-04-27 Thijs Schreijer <thijs(at)thijsschreijer.nl>
|
||||
|
||||
Renamed SCRIPTSUPPORT to IXML_HAVE_SCRIPTSUPPORT for consistency. Also
|
||||
updated autoconfig and automake files, so it also works on non-windows.
|
||||
Option is enabled by default, because it adds an element to the node
|
||||
structure. Not using an available field is better than accidentally
|
||||
using an unavailable field.
|
||||
|
||||
2012-07-11 Thijs Schreijer <thijs(at)thijsschreijer.nl>
|
||||
|
||||
Changed param to const UpnpAcceptSubscriptionExt() for consistency
|
||||
|
||||
2012-06-07 Thijs Schreijer <thijs(at)thijsschreijer.nl>
|
||||
|
||||
updated ixmlDocument_createAttributeEx() and ixmlDocument_createAttribute()
|
||||
to use parameter DOMString instead of char * (same but now consistent)
|
||||
|
||||
2012-05-06 Thijs Schreijer <thijs(at)thijsschreijer.nl>
|
||||
|
||||
Added script support (directive SCRIPTSUPPORT) for better support of
|
||||
garbage collected script languages. The node element gets a custom tag
|
||||
through ixmlNode_setCTag() and ixmlNode_getCTag(). And a callback upon
|
||||
releasing the node resources can be set using ixmlSetBeforeFree()
|
||||
See updated readme for usage.
|
||||
|
||||
2012-03-24 Fabrice Fontaine <fabrice.fontaine(at)orange.com>
|
||||
|
||||
SF Bug Tracker id 3510595 - UpnpDownloadXmlDoc : can't get the file
|
||||
|
||||
Submitted: Marco Virgulti ( mvirg83 ) - 2012-03-23 10:08:08 PDT
|
||||
|
||||
There is a problem, perhaps, during downloading a document by
|
||||
UpnpDownloadXmlDoc. During debugging i've found that in an not exported
|
||||
api (unfortunately i forgot the code line...) where it is setted a
|
||||
local variable "int timeout" to -1 then passed directly to another
|
||||
function for sending data through tcp socket. I patched this setting it
|
||||
to 0 (there is an IF section that exits if timeout < 0). It is normal
|
||||
behavior or it is a bug?
|
||||
|
||||
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||
|
||||
Check for NULL pointer in TemplateSource.h
|
||||
|
||||
calloc can return NULL so check for NULL pointer in CLASS##_new and
|
||||
CLASS##_dup.
|
||||
|
||||
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||
|
||||
Replace strcpy with strncpy in get_hoststr
|
||||
|
||||
Replace strcpy with strncpy to avoid buffer overflow.
|
||||
|
||||
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||
|
||||
Memory leak fix in handle_query_variable
|
||||
|
||||
variable was never freed.
|
||||
|
||||
2011-02-07 Chandra Penke <chandrapenke(at)mcntech.com>
|
||||
|
||||
Add HTTPS support using OpenSSL. HTTPS support is optional and can
|
||||
be enabled by passing the --enable-open-ssl argument to the
|
||||
configure script.
|
||||
|
||||
The following methods are introduced to the public API:
|
||||
UpnpInitOpenSslContext
|
||||
|
||||
When enabled, HTTPS can be used by using "https://" instead of
|
||||
"http://" when passing URLs to the HTTP Client API.
|
||||
|
||||
2011-02-07 Chandra Penke <chandrapenke(at)mcntech.com>
|
||||
|
||||
Refactor HTTP Client API to be more generic.
|
||||
|
||||
The following features are added:
|
||||
|
||||
- Support for persistent HTTP connections (reusing HTTP
|
||||
connections). Tthis is still a work in progress and relies on
|
||||
applications to interpret the 'Connection' header
|
||||
appropriately.
|
||||
|
||||
- Support for specifying request headers when making
|
||||
requests. Useful for interacting with web services that require
|
||||
custom headers.
|
||||
|
||||
- Support for retrieving response headers (this is a API only
|
||||
change, some more work needs to be done to implement the actual
|
||||
functionality. Specifically copy_msg_headers in httpreadwrite.c
|
||||
needs to be implemented)
|
||||
|
||||
- Common API for all HTTP methods.
|
||||
|
||||
- Support for PUT, and DELETE methods.
|
||||
|
||||
The following methods are introduced to the public HTTP Client API
|
||||
|
||||
UpnpOpenHttpConnection, UpnpCloseHttpConnection, UpnpMakeHttpRequest,
|
||||
UpnpWriteHttpRequest, UpnpEndHttpRequest, UpnpGetHttpResponse,
|
||||
UpnpReadHttpResponse.
|
||||
|
||||
Removed a lot of duplicate code in httpreadwrite.c
|
||||
|
||||
2011-01-17 Chandra Penke <chandrapenke(at)mcntech.com>
|
||||
|
||||
Include upnpconfig.h in FileInfo.h to automatically include large
|
||||
file macros
|
||||
|
||||
2011-01-17 Chandra Penke <chandrapenke(at)mcntech.com>
|
||||
|
||||
Fix for warnings Apple systems related to macros defined in list.h.
|
||||
|
||||
In list.h, in apple systems, undefine the macros prior to defining them.
|
||||
|
||||
2011-01-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
|
||||
Fix for UpnpFileInfo_get_LastModified() in http_MakeMessage().
|
||||
|
||||
UpnpFileInfo_get_LastModified() returns time_t, and http_MakeMessage()
|
||||
takes a "time_t *". Thanks to Chandra Penke for pointing the bug.
|
||||
|
||||
2010-11-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
|
||||
Template object for ssdp_ResultData.
|
||||
|
||||
2010-11-10 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||
|
||||
Support for "polling" select in sock_read_write.
|
||||
|
||||
Currently, in sock_read_write function, if the timeout is 0, pupnp
|
||||
realizes a "blocking" select (with an infinite timeout). With this
|
||||
patch, if timeout is set to 0, pupnp will realize a "polling" select
|
||||
and returns immediately if it can not read or write on the socket. This
|
||||
is very useful for GENA notifications when pupnp is trying to send
|
||||
events to a disconnected Control Point. "Blocking" select can now be
|
||||
done by putting a negative timeout value.
|
||||
|
||||
2010-09-18 Chandra Penke <chandrapenke(at)mcntech.com>
|
||||
|
||||
This is a minor build fix. The new Template*.h files added in the latest
|
||||
code need to be exported. Patch against the latest sources is attached.
|
||||
|
||||
2010-08-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* upnp/src/api/Discovery.c: Fix a serious bug and memory leak in
|
||||
UpnpDiscovery_strcpy_DeviceType(). Thanks to David Blanchet for the
|
||||
patch.
|
||||
|
||||
2010-04-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
Separation of the ClientSubscription object.
|
||||
|
||||
2010-04-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
Protect the object destructors agains null pointers on deletion, which
|
||||
should be something valid.
|
||||
|
||||
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
SF Patch Tracker [ 2987390 ] upnp_debug vs. ixml_debug
|
||||
Thanks for the load of updates, I'm still assimilating them ! Could I make
|
||||
a suggestion though? The addition of printNodes(IXML_Node) to upnpdebug a
|
||||
dds a new dependency on ixml.h for anything using upnpdebug.h. I'm making
|
||||
quite a bit of use of upnpdebug in porting things to version 1.8.0, and I'd
|
||||
prefer it if printNodes could be added to ixmldebug.h instead. I'm attach
|
||||
ing a patch, what do you think ?
|
||||
|
||||
Nick
|
||||
|
||||
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Forward port of svn revision 505:
|
||||
SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
|
||||
Submitted By: zephyrus ( zephyrus00jp )
|
||||
|
||||
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2969188 ] 1.8.0: patch for FreeBSD compilation
|
||||
Submitted By: Nick Leverton (leveret)
|
||||
Fix the order of header inclusion for FreeBSD.
|
||||
|
||||
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Forward port of svn revision 502:
|
||||
SF Patch Tracker [ 2836704 ] Search for nested serviceList (not
|
||||
stopping at the first lis
|
||||
Submitted By: zephyrus ( zephyrus00jp )
|
||||
|
||||
Internet Gateway Device description contains nested serviceList (rootdevice
|
||||
-> servicelist, subdevice
|
||||
and subdevice has the lower-level serviceList, etc..)
|
||||
|
||||
Unfrotunately, the sample code sample_util.c used by tv_device sample,
|
||||
etc.
|
||||
has a code that looks for only the first top-level serviceList.
|
||||
This results in the failure to read all the services of an IGD xml
|
||||
description.
|
||||
|
||||
Attached patch modifies this behavior and looks for the service by
|
||||
visiting all the serviceList in xml document in turn.
|
||||
|
||||
With the modified patch (ad additional modification), I could
|
||||
simulate an IGD device and created a modified control program for that.
|
||||
|
||||
Patch against 1.6.6
|
||||
|
||||
TIA.
|
||||
|
||||
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2973319 ] Problem in commit 499
|
||||
Submitted By: Nick Leverton (leveret)
|
||||
Afraid that this doesn't compile, it seems retval should be retVal in two
|
||||
places.
|
||||
|
||||
2010-03-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Fix for the ithread_mutex_unlock() logic in UpnpInit().
|
||||
Thanks for Nicholas Kraft.
|
||||
|
||||
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2962606 ] Autorenewal errors: invalid SID,
|
||||
too-short renewal interval
|
||||
Submitted By: Nick Leverton (leveret)
|
||||
|
||||
Auto-renewals send an invalid SID due to a missing UpnpString_get_String
|
||||
call. They also send a renewal interval of 0 instead of copying it from
|
||||
the original subscription.
|
||||
|
||||
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2964685 ] patch for avoiding inet_ntoa (1.8.0)
|
||||
Submitted By: Nick Leverton (leveret)
|
||||
|
||||
Seems like SF's tracker won't let me add a patch to someone else's issue ?!
|
||||
This refers to https://sourceforge.net/support/tracker.php?aid=2724578
|
||||
|
||||
The calls to inet_ntoa are in getlocalhostname(), which is called from
|
||||
UpnpInit when it is returning the bound IP address.
|
||||
UpnpInit/getlocalhostname hasn't been updated to IPv6, I presume this is
|
||||
deliberate so that it doesn't start returning IPv6 addresses and
|
||||
overwriting the caller's IPv4-sized allocation.
|
||||
|
||||
The attached patch just updates getlocalhostname to use inet_ntop instead
|
||||
of inet_ntoa, and also documents the fact that UpnpInit is IPv4 only whilst
|
||||
UpnpInnit2 is both IPv4 and IPv6.
|
||||
|
||||
A fuller solution might be to change UpnpInit to use some variant on
|
||||
UpnpGetIfInfo. UpnpInit could still be left as IPv4 only if desired -
|
||||
perhaps UpnpGetIfInfo could take an option for the desired address family.
|
||||
getlocalhostname and its own copy of the interface scanning code would then
|
||||
be redundant. I don't have IPv6 capability here though so I'm reluctant to
|
||||
change the IPv6 code, as I have no way to test it.
|
||||
|
||||
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2724578 ] patch for avoiding memory leaks when
|
||||
add devices
|
||||
|
||||
each time a device been added, UpnpInit() is called, on exit, UpnpFinish()
|
||||
is called, but the memories allocated by ThreadPoolInit() may lost because
|
||||
there's no code to call ThreadPoolShutdown() to release the memories. And
|
||||
inet_ntoa() is not thread safe, so in my patch, I substitute inet_ntoa()
|
||||
with inet_ntop().
|
||||
|
||||
2010-03-14 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2964687 ] Add new string based accessors to upnp
|
||||
object API
|
||||
|
||||
As per email to pupnp-devel, this is the patch to add the _strget_
|
||||
accessors for string-like objects in the interface.
|
||||
|
||||
Will add a further patch shortly to udpate the sample programs.
|
||||
|
||||
2008-06-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Nicholas Kraft's patch to fix some IPv6 copy/paste issues. He
|
||||
reported to be getting infinite loops with the svn code.
|
||||
|
||||
2008-06-13 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Bug Tracker [ 1984541 ]
|
||||
ixmlDocumenttoString does not render the namespace tag.
|
||||
Submitted By: Beliveau - belivo
|
||||
|
||||
Undoing the patch that fixed this problem. In fact, there was no
|
||||
problem and the patch was wrong.
|
||||
|
||||
2008-06-11 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Ingo Hofmann's patch for "Content-Type in Subscription responses".
|
||||
Adds charset="utf-8" attribute to the CONTENT-TYPE header line.
|
||||
|
||||
Hi,
|
||||
|
||||
I have found an inconsistency regarding the text/xml content-type
|
||||
returned by libupnp. It looks like only subscription responses send
|
||||
"text/xml" where all other messages contain "text/xml; charset="utf-8"".
|
||||
Since I'm working on an DLNA device the latter behaviour is mandatory.
|
||||
I changed the according lines in gena_device.c (see attached patch).
|
||||
I'm not sure if it would be ok for other device to have the charset
|
||||
field but it would help me a lot :)
|
||||
|
||||
Best regards,
|
||||
Ingo
|
||||
|
||||
2008-06-04 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Bug Tracker [ 1984541 ]
|
||||
ixmlDocumenttoString does not render the namespace tag.
|
||||
Submitted By: Beliveau - belivo
|
||||
|
||||
The problem occurs when converting a xml document using
|
||||
ixmlDocumenttoString containing a namespace tag created with
|
||||
ixmlDocument_createElementNS. The namespace tag doesn't get rendered.
|
||||
|
||||
example: The following code fragment prints:
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<root></root>
|
||||
|
||||
instead of:
|
||||
<?xml version="1.0"?>
|
||||
<root xmlns="urn:schemas-upnp-org:device-1-0"></root>
|
||||
|
||||
Code:
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <upnp/ixml.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
IXML_Document* wDoc = ixmlDocument_createDocument();
|
||||
IXML_Element* wRoot = ixmlDocument_createElementNS(wDoc,
|
||||
"urn:schemas-upnp-org:device-1-0", "root");
|
||||
ixmlNode_appendChild((IXML_Node *)wDoc,(IXML_Node *)wRoot);
|
||||
DOMString wString = ixmlDocumenttoString(wDoc);
|
||||
printf(wString);
|
||||
free(wString);
|
||||
ixmlDocument_free(wDoc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
The problem was in the printing routine, not in the library data
|
||||
structure.
|
||||
|
||||
2008-05-31 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Charles Nepveu's suggestion of not allocating a thread for
|
||||
MiniServer when it is not compiled.
|
||||
|
||||
2008-05-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Ported Peter Hartley's patch to compile with mingw.
|
||||
|
||||
2008-05-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Added some debug capability to ixml.
|
||||
|
||||
2008-05-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Merged Charles Nepveu's IPv6 work. libupnp now is IPv6 enabled.
|
||||
|
||||
2008-02-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Breaking API so that we now hide internal data structures.
|
||||
|
||||
2008-02-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* Rewrote Peter Hartley's patch to include a new extra header field in
|
||||
FileInfo.
|
||||
|
||||
*******************************************************************************
|
||||
Version 1.6.20
|
||||
*******************************************************************************
|
||||
|
4
Doxyfile
4
Doxyfile
@ -31,7 +31,7 @@ PROJECT_NAME = libUPnP
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.8.0
|
||||
PROJECT_NUMBER = 1.6.20
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# undefined via #undef or recursively expanded use the := operator
|
||||
# instead of the = operator.
|
||||
|
||||
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS SCRIPTSUPPORT EXCLUDE_GENA=0 EXCLUDE_DOM=0
|
||||
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0 EXCLUDE_DOM=0
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||
# this tag can be used to specify a list of macro names that should be expanded.
|
||||
|
52
README
52
README
@ -17,7 +17,6 @@ sections:
|
||||
6. Product Release Notes
|
||||
7. New Features
|
||||
8. Support and Contact Information
|
||||
9. IXML support for scriptinglanguages
|
||||
|
||||
|
||||
1) Release Contents
|
||||
@ -344,54 +343,3 @@ us know.
|
||||
* Other brands, names, and trademarks are the property of their respective
|
||||
owners.
|
||||
|
||||
|
||||
9. IXML support for scriptinglanguages
|
||||
-------------------------------------------
|
||||
The treestructure of XML documents created by IXML is hard to maintain when
|
||||
creating a binding for a scripting language. Even when many elements may
|
||||
never be used on the script side, it requires copying the entire tree
|
||||
structure once you start accessing elements several levels deep.
|
||||
Hence scriptsupport was added. To enable it compile while
|
||||
IXML_HAVE_SCRIPTSUPPORT has been defined (enabled by default).
|
||||
This allows control using only a list instead of a tree-like
|
||||
structure, and only nodes actually accessed need to be created instead of
|
||||
all the nodes in the tree.
|
||||
|
||||
Here's how its supposed to work;
|
||||
* The scriptsupport allows you to add a callback when a node is freed on
|
||||
the C side, so appropriate action can be taken on the script side, see
|
||||
function ixmlSetBeforeFree().
|
||||
* Instead of recreating the tree structure, an intermediate object should
|
||||
be created only for the nodes actually accessed. The object should be
|
||||
containing a pointer to the node and a 'valid flag' which is initially
|
||||
set to TRUE (the valid flag, can simply be the pointer to the node being
|
||||
NULL or not). Before creating the intermediate object, the custom tag
|
||||
'ctag' can be used to check whether one was already created.
|
||||
* the node object gets an extra 'void* ctag' field, a custom tag to make a
|
||||
cross reference to the script side intermediate object. It can be set
|
||||
using ixmlNode_setCTag(), and read using ixmlNode_getCTag(). Whenever
|
||||
a new intermediate object is created, the ctag of the coirresponding
|
||||
node should be set to point to this intermediate object.
|
||||
* The tree structure traversal is done on the C side (looking up parents,
|
||||
children and siblings)
|
||||
* Every intermediate object created should be kept in a list (preferably a
|
||||
key-value list, where the key is the pointer to the node and the value is
|
||||
the pointer to the intermediate object)
|
||||
* when the callback is called, the node should be looked up in the list,
|
||||
the flag set to false, the pointer to the C-side node be cleared and on
|
||||
the C-side the ctag should be cleared.
|
||||
* whenever the intermediate object is accessed and its flag is set to False,
|
||||
an error should be thrown that the XML document has been closed.
|
||||
|
||||
Freeing resources can be done in 2 ways, C side by simply calling the free
|
||||
node methods, or script side by the garbage collector of the scriptengine.
|
||||
Scriptside steps;
|
||||
* if the valid flag is set to False (XML document is closed), then the
|
||||
intermediate object can be destroyed, no further action
|
||||
* if the node has a parent, then the intermediate object can be destroyed
|
||||
after the ctag on the corresponding node has been cleared. Nothing needs
|
||||
to be freed on the C-side.
|
||||
* if the node has no parent, then the node must be freed on the C side by
|
||||
calling the corresponding free node methods. This will result in a chain
|
||||
of callbacks closing the node and all underlying nodes.
|
||||
|
||||
|
8
TODO
8
TODO
@ -4,11 +4,3 @@ To Be Done
|
||||
|
||||
- non-regression testing
|
||||
|
||||
- Why is NUM_HANDLE defined to 200 when we can register only:
|
||||
A) One client(1)
|
||||
B) An IPv4 and IPv6 device (2)
|
||||
NUM_HANDLE should be 3
|
||||
|
||||
- A sane way to implement the virtual directory callback initialization and checking
|
||||
against NULL pointers.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* autoconfig.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 to compile debug code */
|
||||
#define DEBUG 1
|
||||
/* #undef DEBUG */
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
@ -82,18 +82,15 @@
|
||||
/* Define to 1 if you have the <ws2tcpip.h> header file. */
|
||||
/* #undef HAVE_WS2TCPIP_H */
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define IXML_HAVE_SCRIPTSUPPORT 1
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define to 1 to prevent compilation of assert() */
|
||||
/* #undef NDEBUG */
|
||||
#define NDEBUG 1
|
||||
|
||||
/* Define to 1 to prevent some debug code */
|
||||
/* #undef NO_DEBUG */
|
||||
#define NO_DEBUG 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
@ -108,7 +105,7 @@
|
||||
#define PACKAGE_NAME "libupnp"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libupnp 1.8.0"
|
||||
#define PACKAGE_STRING "libupnp 1.6.20"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libupnp"
|
||||
@ -117,7 +114,7 @@
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "1.8.0"
|
||||
#define PACKAGE_VERSION "1.6.20"
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
@ -135,9 +132,6 @@
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_ENABLE_NOTIFICATION_REORDERING 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
/* #undef UPNP_ENABLE_OPEN_SSL */
|
||||
|
||||
/* see upnpconfig.h */
|
||||
/* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */
|
||||
|
||||
@ -145,7 +139,7 @@
|
||||
#define UPNP_HAVE_CLIENT 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_HAVE_DEBUG 1
|
||||
/* #undef UPNP_HAVE_DEBUG */
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_HAVE_DEVICE 1
|
||||
@ -175,16 +169,16 @@
|
||||
#define UPNP_VERSION_MAJOR 1
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_MINOR 8
|
||||
#define UPNP_VERSION_MINOR 6
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_PATCH 0
|
||||
#define UPNP_VERSION_PATCH 20
|
||||
|
||||
/* see upnpconfig.h */
|
||||
#define UPNP_VERSION_STRING "1.8.0"
|
||||
#define UPNP_VERSION_STRING "1.6.20"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "1.8.0"
|
||||
#define VERSION "1.6.20"
|
||||
|
||||
/* File Offset size */
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
@ -40,16 +40,16 @@
|
||||
***************************************************************************/
|
||||
|
||||
/** The library version (string) e.g. "1.3.0" */
|
||||
#define UPNP_VERSION_STRING "1.8.0"
|
||||
#define UPNP_VERSION_STRING "1.6.20"
|
||||
|
||||
/** Major version of the library */
|
||||
#define UPNP_VERSION_MAJOR 1
|
||||
|
||||
/** Minor version of the library */
|
||||
#define UPNP_VERSION_MINOR 8
|
||||
#define UPNP_VERSION_MINOR 6
|
||||
|
||||
/** Patch version of the library */
|
||||
#define UPNP_VERSION_PATCH 0
|
||||
#define UPNP_VERSION_PATCH 20
|
||||
|
||||
/** The library version (numeric) e.g. 10300 means version 1.3.0 */
|
||||
#define UPNP_VERSION \
|
||||
@ -82,7 +82,7 @@
|
||||
|
||||
/** Defined to 1 if the library has been compiled with DEBUG enabled
|
||||
* (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */
|
||||
#define UPNP_HAVE_DEBUG 1
|
||||
/* #undef UPNP_HAVE_DEBUG */
|
||||
|
||||
|
||||
/** Defined to 1 if the library has been compiled with client API enabled
|
||||
@ -132,9 +132,5 @@
|
||||
* header (i.e. configure --enable-unspecified_server) */
|
||||
/* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */
|
||||
|
||||
/** Defined to 1 if the library has been compiled with OpenSSL support
|
||||
* (i.e. configure --enable-open_ssl) */
|
||||
/* #undef UPNP_ENABLE_OPEN_SSL */
|
||||
|
||||
#endif /* UPNP_CONFIG_H */
|
||||
|
||||
|
3
build/vc10/.gitignore
vendored
3
build/vc10/.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
|
||||
*.suo
|
||||
*.user
|
||||
*.sdf
|
||||
*.user
|
@ -158,7 +158,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;IXML_HAVE_SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
@ -206,7 +206,7 @@
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;RELEASE;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;IXML_HAVE_SCRIPTSUPPORT;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@ -251,7 +251,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;DEBUG;WIN32;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>DEBUG;WIN32;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
@ -296,7 +296,7 @@
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug Lib|Win32">
|
||||
@ -174,7 +174,7 @@
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;NDEBUG;RELEASE;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@ -292,7 +292,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;DEBUG;WIN32;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
@ -300,6 +300,7 @@
|
||||
</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<BrowseInformation>
|
||||
</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
@ -317,6 +318,7 @@
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\..\pthreads\;..\..\pthreads\lib;$(OutDir)..\lib\ixml;$(OutDir)..\lib\threadutil;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
@ -404,7 +406,7 @@
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;DEBUG;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;DEBUG;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
@ -493,7 +495,7 @@
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>IXML_HAVE_SCRIPTSUPPORT;WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;RELEASE;_WINDOWS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_NONSTDC_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL;_SCL_SECURE_NO_WARNINGS;_SCL_SECURE_NO_DEPRECATE;_AFX_SECURE_NO_WARNINGS;_AFX_SECURE_NO_DEPRECATE;_SECURE_ATL;_ATL_NO_COM_SUPPORT;_ATL_SECURE_NO_WARNINGS;_ATL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@ -572,20 +574,31 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\upnp\src\api\ActionComplete.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\ActionRequest.c" />
|
||||
<ClCompile Include="..\..\ixml\src\attr.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\client_table\client_table.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\client_table\ClientSubscription.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\Discovery.c" />
|
||||
<ClCompile Include="..\..\ixml\src\document.c" />
|
||||
<ClCompile Include="..\..\ixml\src\element.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\Event.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\EventSubscribe.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\FileInfo.c" />
|
||||
<ClCompile Include="..\..\threadutil\src\FreeList.c" />
|
||||
<ClCompile Include="..\..\upnp\src\gena\gena_callback2.c" />
|
||||
<ClCompile Include="..\..\upnp\src\gena\gena_ctrlpt.c" />
|
||||
<ClCompile Include="..\..\upnp\src\gena\gena_device.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpparser.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpreadwrite.c" />
|
||||
<ClCompile Include="..\..\ixml\src\ixml.c" />
|
||||
<ClCompile Include="..\..\ixml\src\ixmlmembuf.c" />
|
||||
<ClCompile Include="..\..\ixml\src\ixmlparser.c" />
|
||||
<ClCompile Include="..\..\threadutil\src\LinkedList.c" />
|
||||
<ClCompile Include="..\..\upnp\src\uuid\md5.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\util\membuffer.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\miniserver\miniserver.c" />
|
||||
<ClCompile Include="..\..\ixml\src\namedNodeMap.c" />
|
||||
<ClCompile Include="..\..\ixml\src\node.c" />
|
||||
<ClCompile Include="..\..\ixml\src\nodeList.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\net\http\parsetools.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\service_table\service_table.c" />
|
||||
<ClCompile Include="..\..\upnp\src\soap\soap_common.c" />
|
||||
@ -602,6 +615,8 @@
|
||||
<ClCompile Include="..\..\upnp\src\genlib\util\strintmap.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\SubscriptionRequest.c" />
|
||||
<ClCompile Include="..\..\upnp\src\uuid\sysdep.c" />
|
||||
<ClCompile Include="..\..\threadutil\src\ThreadPool.c" />
|
||||
<ClCompile Include="..\..\threadutil\src\TimerThread.c" />
|
||||
<ClCompile Include="..\..\upnp\src\genlib\util\upnp_timeout.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\upnpapi.c" />
|
||||
<ClCompile Include="..\..\upnp\src\api\upnpdebug.c" />
|
||||
|
@ -17,6 +17,9 @@
|
||||
<ClCompile Include="..\..\upnp\src\api\ActionRequest.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\attr.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\upnp\src\genlib\client_table\client_table.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
@ -26,6 +29,12 @@
|
||||
<ClCompile Include="..\..\upnp\src\api\Discovery.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\document.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\element.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\upnp\src\api\Event.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
@ -35,6 +44,9 @@
|
||||
<ClCompile Include="..\..\upnp\src\api\FileInfo.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\threadutil\src\FreeList.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\upnp\src\gena\gena_callback2.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
@ -50,6 +62,18 @@
|
||||
<ClCompile Include="..\..\upnp\src\genlib\net\http\httpreadwrite.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\ixml.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\ixmlmembuf.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\ixmlparser.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\threadutil\src\LinkedList.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\upnp\src\uuid\md5.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
@ -59,6 +83,15 @@
|
||||
<ClCompile Include="..\..\upnp\src\genlib\miniserver\miniserver.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\namedNodeMap.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\node.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ixml\src\nodeList.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\upnp\src\genlib\net\http\parsetools.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
@ -107,6 +140,12 @@
|
||||
<ClCompile Include="..\..\upnp\src\uuid\sysdep.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\threadutil\src\ThreadPool.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\threadutil\src\TimerThread.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\upnp\src\genlib\util\upnp_timeout.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
|
@ -163,6 +163,7 @@
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(ProjectName).pdb</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
@ -171,6 +172,7 @@
|
||||
<AdditionalDependencies>pthreadVC2.lib;ixml.lib;threadutil.lib;libupnp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\pthreads\;..\..\pthreads\lib;$(OutDir)..\lib\libupnp;$(OutDir)..\lib\threadutil;$(OutDir)..\lib\ixml;$(OutDir)..\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
|
@ -218,14 +218,6 @@
|
||||
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"
|
||||
>
|
||||
@ -234,14 +226,6 @@
|
||||
RelativePath="..\..\upnp\src\genlib\client_table\client_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\client_table\ClientSubscription.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\Discovery.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\document.c"
|
||||
>
|
||||
@ -250,18 +234,6 @@
|
||||
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"
|
||||
>
|
||||
@ -362,10 +334,6 @@
|
||||
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"
|
||||
>
|
||||
@ -374,22 +342,10 @@
|
||||
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"
|
||||
>
|
||||
@ -451,14 +407,6 @@
|
||||
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"
|
||||
>
|
||||
@ -467,22 +415,6 @@
|
||||
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"
|
||||
>
|
||||
@ -567,14 +499,6 @@
|
||||
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"
|
||||
>
|
||||
@ -583,10 +507,6 @@
|
||||
RelativePath="..\..\upnp\src\inc\strintmap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\SubscriptionRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\sysdep.h"
|
||||
>
|
||||
|
@ -764,14 +764,6 @@
|
||||
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"
|
||||
>
|
||||
@ -780,14 +772,6 @@
|
||||
RelativePath="..\..\upnp\src\genlib\client_table\client_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\genlib\client_table\ClientSubscription.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\api\Discovery.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\ixml\src\document.c"
|
||||
>
|
||||
@ -796,18 +780,6 @@
|
||||
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"
|
||||
>
|
||||
@ -904,10 +876,6 @@
|
||||
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"
|
||||
>
|
||||
@ -916,22 +884,10 @@
|
||||
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"
|
||||
>
|
||||
@ -993,14 +949,6 @@
|
||||
Name="headers"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\ActionComplete.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\ActionRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\inc\autoconfig.h"
|
||||
>
|
||||
@ -1017,22 +965,6 @@
|
||||
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"
|
||||
>
|
||||
@ -1113,14 +1045,6 @@
|
||||
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"
|
||||
>
|
||||
@ -1133,10 +1057,6 @@
|
||||
RelativePath="..\..\upnp\src\inc\strintmap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\inc\SubscriptionRequest.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\upnp\src\inc\sysdep.h"
|
||||
>
|
||||
|
59
configure.ac
59
configure.ac
@ -9,7 +9,7 @@
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
|
||||
AC_INIT([libupnp], [1.8.0], [mroberto@users.sourceforge.net])
|
||||
AC_INIT([libupnp], [1.6.20], [mroberto@users.sourceforge.net])
|
||||
dnl ############################################################################
|
||||
dnl # *Independently* of the above libupnp package version, the libtool version
|
||||
dnl # of the 3 libraries need to be updated whenever there is a change released:
|
||||
@ -316,26 +316,44 @@ dnl ############################################################################
|
||||
dnl # Release 1.6.18:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # -
|
||||
dnl # - Code has changed in ixml
|
||||
dnl # revision: 7 -> 8
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 2 -> 3
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 1 -> 2
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:8:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:3:0])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [9:2:3])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.19:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Code has changed in threadutil
|
||||
dnl # revision: 3 -> 4
|
||||
dnl # - Code has changed in upnp
|
||||
dnl # revision: 2 -> 3
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:8:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:4:0])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [9:3:3])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.6.20:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # -
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [::])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [::])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [::])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
dnl # Release 1.8.0:
|
||||
dnl # "current:revision:age"
|
||||
dnl #
|
||||
dnl # - Start from a new ground.
|
||||
dnl #
|
||||
dnl #AC_SUBST([LT_VERSION_IXML], [10:0:0])
|
||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [10:0:0])
|
||||
dnl #AC_SUBST([LT_VERSION_UPNP], [10:0:0])
|
||||
dnl #
|
||||
dnl ############################################################################
|
||||
AC_SUBST([LT_VERSION_IXML], [10:0:0])
|
||||
AC_SUBST([LT_VERSION_THREADUTIL], [10:0:0])
|
||||
AC_SUBST([LT_VERSION_UPNP], [10:0:0])
|
||||
AC_SUBST([LT_VERSION_IXML], [2:8:0])
|
||||
AC_SUBST([LT_VERSION_THREADUTIL], [6:4:0])
|
||||
AC_SUBST([LT_VERSION_UPNP], [9:3:3])
|
||||
dnl ############################################################################
|
||||
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
||||
dnl # - library code modified: revision++
|
||||
@ -462,11 +480,6 @@ if test "x$enable_unspecified_server" = xyes ; then
|
||||
AC_DEFINE(UPNP_ENABLE_UNSPECIFIED_SERVER, 1, [see upnpconfig.h])
|
||||
fi
|
||||
|
||||
RT_BOOL_ARG_ENABLE([open_ssl], [no], [open-ssl support])
|
||||
if test "x$enable_open_ssl" = xyes ; then
|
||||
AC_DEFINE(UPNP_ENABLE_OPEN_SSL, 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])
|
||||
@ -477,11 +490,6 @@ 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([scriptsupport], [yes], [script support for IXML document tree, see ixml.h])
|
||||
if test "x$enable_scriptsupport" = xyes ; then
|
||||
AC_DEFINE(IXML_HAVE_SCRIPTSUPPORT, 1, [see upnpconfig.h])
|
||||
fi
|
||||
|
||||
|
||||
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
||||
|
||||
@ -706,7 +714,6 @@ AC_CONFIG_FILES([
|
||||
upnp/Makefile
|
||||
upnp/doc/Makefile
|
||||
upnp/sample/Makefile
|
||||
upnp/unittest/Makefile
|
||||
docs/dist/Makefile
|
||||
libupnp.pc
|
||||
])
|
||||
|
@ -19,10 +19,6 @@ else
|
||||
AM_CPPFLAGS += -DNDEBUG
|
||||
endif
|
||||
|
||||
if ENABLE_SCRIPTSUPPORT
|
||||
AM_CPPFLAGS += -DIXML_HAVE_SCRIPTSUPPORT
|
||||
endif
|
||||
|
||||
lib_LTLIBRARIES = libixml.la
|
||||
|
||||
libixml_la_LDFLAGS = -version-info $(LT_VERSION_IXML) \
|
||||
|
@ -158,13 +158,6 @@ typedef struct _IXML_Document *Docptr;
|
||||
|
||||
typedef struct _IXML_Node *Nodeptr;
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
/*!
|
||||
* \brief Signature for GC support method, called before a node is freed.
|
||||
*/
|
||||
typedef void (*IXML_BeforeFreeNode_t) (Nodeptr obj);
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Data structure common to all types of nodes.
|
||||
@ -185,9 +178,6 @@ typedef struct _IXML_Node
|
||||
Nodeptr nextSibling;
|
||||
Nodeptr firstAttr;
|
||||
Docptr ownerDocument;
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
void* ctag; /* custom tag */
|
||||
#endif
|
||||
} IXML_Node;
|
||||
|
||||
|
||||
@ -273,8 +263,6 @@ extern "C" {
|
||||
* The \b Node interface forms the primary datatype for all other DOM
|
||||
* objects. Every other interface is derived from this interface, inheriting
|
||||
* its functionality. For more information, refer to DOM2-Core page 34.
|
||||
* (Note: within the IXML library the NamedNodeMap and NodeList interfaces are
|
||||
* the only interfaces that are not DOM objects and hence do not inherit from Node)
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
@ -326,8 +314,7 @@ EXPORT_SPEC int ixmlNode_setNodeValue(
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Retrieves the type of a \b Node. Note that not all possible
|
||||
* return values are actually implemented.
|
||||
* \brief Retrieves the type of a \b Node.
|
||||
*
|
||||
* \return An enum IXML_NODE_TYPE representing the type of the \b Node.
|
||||
*/
|
||||
@ -638,29 +625,9 @@ EXPORT_SPEC BOOL ixmlNode_hasAttributes(
|
||||
* \brief Frees a \b Node and all \b Nodes in its subtree.
|
||||
*/
|
||||
EXPORT_SPEC void ixmlNode_free(
|
||||
/*! [in] The \b Node tree to free. Before it is freed, the handler
|
||||
* set by \b ixmlSetBeforeFree will be called, the order will be
|
||||
* top-down.
|
||||
*/
|
||||
/*! [in] The \b Node tree to free. */
|
||||
IXML_Node *nodeptr);
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
/*!
|
||||
* \brief Sets the custom tag for the node.
|
||||
*/
|
||||
EXPORT_SPEC void ixmlNode_setCTag(
|
||||
/*! [in] The \b Node to which to attach the tag. */
|
||||
IXML_Node *nodeptr,
|
||||
/*! [in] The \b tag to attach. */
|
||||
void *ctag);
|
||||
|
||||
/*!
|
||||
* \brief Gets the custom tag for the node.
|
||||
*/
|
||||
EXPORT_SPEC void* ixmlNode_getCTag(
|
||||
/*! [in] The \b Node from which to get the tag. */
|
||||
IXML_Node *nodeptr);
|
||||
#endif
|
||||
/* @} Interface Node */
|
||||
|
||||
|
||||
@ -904,7 +871,7 @@ EXPORT_SPEC IXML_Attr *ixmlDocument_createAttribute(
|
||||
/*! [in] The owner \b Document of the new node. */
|
||||
IXML_Document *doc,
|
||||
/*! [in] The name of the new attribute. */
|
||||
const DOMString name);
|
||||
const char *name);
|
||||
|
||||
|
||||
/*!
|
||||
@ -925,7 +892,7 @@ EXPORT_SPEC int ixmlDocument_createAttributeEx(
|
||||
/*! [in] The owner \b Document of the new node. */
|
||||
IXML_Document *doc,
|
||||
/*! [in] The name of the new attribute. */
|
||||
const DOMString name,
|
||||
const char *name,
|
||||
/*! [out] A pointer to a \b Attr where the new object will be stored. */
|
||||
IXML_Attr **attrNode);
|
||||
|
||||
@ -1770,18 +1737,6 @@ EXPORT_SPEC void ixmlRelaxParser(
|
||||
*/
|
||||
char errorChar);
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
/*!
|
||||
* \brief Sets the handler to call before a node is freed.
|
||||
*/
|
||||
EXPORT_SPEC void ixmlSetBeforeFree(
|
||||
/*! [in] If \b hndlr is set to a function, it will be called before any
|
||||
* node is freed, with the node as its parameter. This allows scripting
|
||||
* languages to do their garbage collection, without maintaining their
|
||||
* own tree structure.
|
||||
*/
|
||||
IXML_BeforeFreeNode_t hndlr);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Parses an XML text buffer converting it into an IXML DOM representation.
|
||||
|
@ -281,7 +281,7 @@ IXML_Node *ixmlDocument_createTextNode(
|
||||
|
||||
int ixmlDocument_createAttributeEx(
|
||||
IXML_Document *doc,
|
||||
const DOMString name,
|
||||
const char *name,
|
||||
IXML_Attr **rtAttr)
|
||||
{
|
||||
IXML_Attr *attrNode = NULL;
|
||||
@ -322,7 +322,7 @@ ErrorHandler:
|
||||
|
||||
IXML_Attr *ixmlDocument_createAttribute(
|
||||
IXML_Document *doc,
|
||||
const DOMString name)
|
||||
const char *name)
|
||||
{
|
||||
IXML_Attr *attrNode = NULL;
|
||||
|
||||
|
@ -120,25 +120,6 @@ void Parser_setErrorChar(
|
||||
/*! [in] The character to become the error character. */
|
||||
char c);
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
/*!
|
||||
* \brief Sets the handler to call before a node is freed.
|
||||
*
|
||||
* If \b hndlr is set to a function, it will be called before any
|
||||
* node is freed, with the node as its parameter. This allows scripting
|
||||
* languages to do their garbage collection, without maintaining their
|
||||
* own tree structure.
|
||||
*/
|
||||
void Parser_setBeforeFree(
|
||||
/*! [in] The handler callback to call before each node to be freed. */
|
||||
IXML_BeforeFreeNode_t hndlr);
|
||||
|
||||
/*!
|
||||
* \brief Gets the handler to call before a node is freed.
|
||||
*/
|
||||
IXML_BeforeFreeNode_t Parser_getBeforeFree();
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Fees a node contents.
|
||||
|
@ -417,13 +417,6 @@ void ixmlRelaxParser(char errorChar)
|
||||
Parser_setErrorChar(errorChar);
|
||||
}
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
void ixmlSetBeforeFree(IXML_BeforeFreeNode_t hndlr)
|
||||
{
|
||||
Parser_setBeforeFree(hndlr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
|
||||
{
|
||||
|
@ -55,9 +55,6 @@
|
||||
|
||||
|
||||
static char g_error_char = '\0';
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
static IXML_BeforeFreeNode_t Before_Free_callback;
|
||||
#endif
|
||||
|
||||
|
||||
static const char LESSTHAN = '<';
|
||||
@ -2501,17 +2498,6 @@ void Parser_setErrorChar(char c)
|
||||
g_error_char = c;
|
||||
}
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
void Parser_setBeforeFree(IXML_BeforeFreeNode_t hndlr)
|
||||
{
|
||||
Before_Free_callback = hndlr;
|
||||
}
|
||||
|
||||
IXML_BeforeFreeNode_t Parser_getBeforeFree()
|
||||
{
|
||||
return Before_Free_callback;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Initializes a xml parser.
|
||||
|
@ -107,10 +107,6 @@ static void ixmlNode_freeSingleNode(
|
||||
void ixmlNode_free(IXML_Node *nodeptr)
|
||||
{
|
||||
if (nodeptr != NULL) {
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
IXML_BeforeFreeNode_t hndlr = Parser_getBeforeFree();
|
||||
if (hndlr != NULL) hndlr(nodeptr);
|
||||
#endif
|
||||
ixmlNode_free(nodeptr->firstChild);
|
||||
ixmlNode_free(nodeptr->nextSibling);
|
||||
ixmlNode_free(nodeptr->firstAttr);
|
||||
@ -1384,17 +1380,3 @@ ErrorHandler:
|
||||
return IXML_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
#ifdef IXML_HAVE_SCRIPTSUPPORT
|
||||
void ixmlNode_setCTag(IXML_Node *nodeptr, void *ctag)
|
||||
{
|
||||
if (nodeptr != NULL) nodeptr->ctag = ctag;
|
||||
}
|
||||
|
||||
void* ixmlNode_getCTag(IXML_Node *nodeptr)
|
||||
{
|
||||
if (nodeptr != NULL)
|
||||
return nodeptr->ctag;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
Version: 1.8.0
|
||||
Version: 1.6.20
|
||||
Summary: Universal Plug and Play (UPnP) SDK
|
||||
Name: libupnp
|
||||
Release: 1%{?dist}
|
||||
|
@ -29,6 +29,11 @@ libthreadutil_la_SOURCES = \
|
||||
src/TimerThread.c
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = \
|
||||
inc/ithread.h
|
||||
|
||||
upnpinclude_HEADERS = \
|
||||
inc/ithread.h \
|
||||
inc/FreeList.h \
|
||||
inc/LinkedList.h \
|
||||
inc/ThreadPool.h \
|
||||
inc/TimerThread.h
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
||||
#
|
||||
|
||||
SUBDIRS = doc . sample unittest
|
||||
SUBDIRS = doc . sample
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(srcdir)/inc \
|
||||
@ -19,21 +19,6 @@ LDADD = \
|
||||
|
||||
upnpincludedir = $(includedir)/upnp
|
||||
upnpinclude_HEADERS = \
|
||||
inc/ActionComplete.h \
|
||||
inc/ActionRequest.h \
|
||||
inc/Callback.h \
|
||||
inc/Discovery.h \
|
||||
inc/Event.h \
|
||||
inc/EventSubscribe.h \
|
||||
inc/FileInfo.h \
|
||||
inc/list.h \
|
||||
inc/poison.h \
|
||||
inc/StateVarComplete.h \
|
||||
inc/StateVarRequest.h \
|
||||
inc/SubscriptionRequest.h \
|
||||
inc/TemplateInclude.h \
|
||||
inc/TemplateSource.h \
|
||||
inc/TemplateUndef.h \
|
||||
inc/UpnpString.h \
|
||||
inc/upnp.h \
|
||||
inc/upnpdebug.h \
|
||||
@ -62,7 +47,6 @@ libupnp_la_LDFLAGS = \
|
||||
libupnp_la_SOURCES = \
|
||||
src/inc/config.h \
|
||||
src/inc/client_table.h \
|
||||
src/inc/ClientSubscription.h \
|
||||
src/inc/gena.h \
|
||||
src/inc/gena_ctrlpt.h \
|
||||
src/inc/gena_device.h \
|
||||
@ -97,8 +81,7 @@ libupnp_la_SOURCES = \
|
||||
# ssdp
|
||||
if ENABLE_SSDP
|
||||
libupnp_la_SOURCES += \
|
||||
src/ssdp/ssdp_ResultData.c \
|
||||
src/ssdp/ssdp_ResultData.h \
|
||||
src/ssdp/ssdp_ResultData.h \
|
||||
src/ssdp/ssdp_device.c \
|
||||
src/ssdp/ssdp_ctrlpt.c \
|
||||
src/ssdp/ssdp_server.c
|
||||
@ -115,13 +98,12 @@ endif
|
||||
# genlib
|
||||
libupnp_la_SOURCES += \
|
||||
src/genlib/miniserver/miniserver.c \
|
||||
src/genlib/client_table/client_table.c \
|
||||
src/genlib/client_table/ClientSubscription.c \
|
||||
src/genlib/service_table/service_table.c \
|
||||
src/genlib/util/membuffer.c \
|
||||
src/genlib/util/strintmap.c \
|
||||
src/genlib/util/upnp_timeout.c \
|
||||
src/genlib/util/util.c \
|
||||
src/genlib/client_table/client_table.c \
|
||||
src/genlib/net/sock.c \
|
||||
src/genlib/net/http/httpparser.c \
|
||||
src/genlib/net/http/httpreadwrite.c \
|
||||
@ -140,15 +122,6 @@ endif
|
||||
|
||||
# api
|
||||
libupnp_la_SOURCES += \
|
||||
src/api/ActionComplete.c \
|
||||
src/api/ActionRequest.c \
|
||||
src/api/Discovery.c \
|
||||
src/api/Event.c \
|
||||
src/api/EventSubscribe.c \
|
||||
src/api/FileInfo.c \
|
||||
src/api/StateVarComplete.c \
|
||||
src/api/StateVarRequest.c \
|
||||
src/api/SubscriptionRequest.c \
|
||||
src/api/UpnpString.c \
|
||||
src/api/upnpapi.c
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
|
||||
#ifndef ACTIONCOMPLETE_H
|
||||
#define ACTIONCOMPLETE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionComplete object declaration.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#define CLASS UpnpActionComplete
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, CtrlUrl) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ActionRequest, IXML_Document *) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ActionResult, IXML_Document *) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* ACTIONCOMPLETE_H */
|
||||
|
@ -1,36 +0,0 @@
|
||||
|
||||
#ifndef ACTIONREQUEST_H
|
||||
#define ACTIONREQUEST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionRequest object declaration.
|
||||
*
|
||||
* Returned as part of a \b UPNP_CONTROL_ACTION_COMPLETE callback.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "UpnpInet.h" /* for struct sockaddr_storage */
|
||||
|
||||
#define CLASS UpnpActionRequest
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, Socket, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ErrStr) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ActionName) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, DevUDN) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceID) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ActionRequest, IXML_Document *) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ActionResult, IXML_Document *) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, SoapHeader, IXML_Document *) \
|
||||
EXPAND_CLASS_MEMBER_BUFFER(CLASS, CtrlPtIPAddr, struct sockaddr_storage) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* ACTIONREQUEST_H */
|
||||
|
@ -1,153 +0,0 @@
|
||||
|
||||
#ifndef CALLBACK_H
|
||||
#define CALLBACK_H
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief The reason code for an event callback.
|
||||
*
|
||||
* The \b Event parameter will be different depending on the reason for the
|
||||
* callback. The descriptions for each event type describe the contents of the
|
||||
* \b Event parameter.
|
||||
*/
|
||||
enum Upnp_EventType_e {
|
||||
/*
|
||||
* Control callbacks
|
||||
*/
|
||||
|
||||
/*! Received by a device when a control point issues a control
|
||||
* request. The \b Event parameter contains a pointer to a \b
|
||||
* UpnpActionRequest structure containing the action. The application
|
||||
* stores the results of the action in this structure. */
|
||||
UPNP_CONTROL_ACTION_REQUEST,
|
||||
|
||||
/*! A \b UpnpSendActionAsync call completed. The \b Event
|
||||
* parameter contains a pointer to a \b UpnpActionComplete structure
|
||||
* with the results of the action. */
|
||||
UPNP_CONTROL_ACTION_COMPLETE,
|
||||
|
||||
/*! Received by a device when a query for a single service variable
|
||||
* arrives. The \b Event parameter contains a pointer to a \b
|
||||
* UpnpStateVarRequest structure containing the name of the variable
|
||||
* and value. */
|
||||
UPNP_CONTROL_GET_VAR_REQUEST,
|
||||
|
||||
/*! A \b UpnpGetServiceVarStatus call completed. The \b Event
|
||||
* parameter contains a pointer to a \b UpnpStateVarComplete structure
|
||||
* containing the value for the variable. */
|
||||
UPNP_CONTROL_GET_VAR_COMPLETE,
|
||||
|
||||
/*
|
||||
* Discovery callbacks
|
||||
*/
|
||||
|
||||
/*! Received by a control point when a new device or service is available.
|
||||
* The \b Event parameter contains a pointer to a \b
|
||||
* UpnpDiscovery structure with the information about the device
|
||||
* or service. */
|
||||
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE,
|
||||
|
||||
/*! Received by a control point when a device or service shuts down. The \b
|
||||
* Event parameter contains a pointer to a \b UpnpDiscovery
|
||||
* structure containing the information about the device or
|
||||
* service. */
|
||||
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE,
|
||||
|
||||
/*! Received by a control point when a matching device or service responds.
|
||||
* The \b Event parameter contains a pointer to a \b
|
||||
* UpnpDiscovery structure containing the information about
|
||||
* the reply to the search request. */
|
||||
UPNP_DISCOVERY_SEARCH_RESULT,
|
||||
|
||||
/*! Received by a control point when the search timeout expires. The
|
||||
* SDK generates no more callbacks for this search after this
|
||||
* event. The \b Event parameter is \c NULL. */
|
||||
UPNP_DISCOVERY_SEARCH_TIMEOUT,
|
||||
|
||||
/*
|
||||
* Eventing callbacks
|
||||
*/
|
||||
|
||||
/*! Received by a device when a subscription arrives.
|
||||
* The \b Event parameter contains a pointer to a \b
|
||||
* UpnpSubscriptionRequest structure. At this point, the
|
||||
* subscription has already been accepted. \b UpnpAcceptSubscription
|
||||
* needs to be called to confirm the subscription and transmit the
|
||||
* initial state table. This can be done during this callback. The SDK
|
||||
* generates no events for a subscription unless the device
|
||||
* application calls \b UpnpAcceptSubscription.
|
||||
*/
|
||||
UPNP_EVENT_SUBSCRIPTION_REQUEST,
|
||||
|
||||
/*! Received by a control point when an event arrives. The \b
|
||||
* Event parameter contains a \b UpnpEvent structure
|
||||
* with the information about the event. */
|
||||
UPNP_EVENT_RECEIVED,
|
||||
|
||||
/*! A \b UpnpRenewSubscriptionAsync call completed. The status of
|
||||
* the renewal is in the \b Event parameter as a \b
|
||||
* Upnp_Event_Subscription structure. */
|
||||
UPNP_EVENT_RENEWAL_COMPLETE,
|
||||
|
||||
/*! A \b UpnpSubscribeAsync call completed. The status of the
|
||||
* subscription is in the \b Event parameter as a \b
|
||||
* Upnp_Event_Subscription structure. */
|
||||
UPNP_EVENT_SUBSCRIBE_COMPLETE,
|
||||
|
||||
/*! A \b UpnpUnSubscribeAsync call completed. The status of the
|
||||
* subscription is in the \b Event parameter as a \b
|
||||
* UpnpEventSubscribe structure. */
|
||||
UPNP_EVENT_UNSUBSCRIBE_COMPLETE,
|
||||
|
||||
/*! The auto-renewal of a client subscription failed.
|
||||
* The \b Event parameter is a \b UpnpEventSubscribe structure
|
||||
* with the error code set appropriately. The subscription is no longer
|
||||
* valid. */
|
||||
UPNP_EVENT_AUTORENEWAL_FAILED,
|
||||
|
||||
/*! A client subscription has expired. This will only occur
|
||||
* if auto-renewal of subscriptions is disabled.
|
||||
* The \b Event parameter is a \b UpnpEventSubscribe
|
||||
* structure. The subscription is no longer valid. */
|
||||
UPNP_EVENT_SUBSCRIPTION_EXPIRED
|
||||
};
|
||||
|
||||
typedef enum Upnp_EventType_e Upnp_EventType;
|
||||
|
||||
/*!
|
||||
* All callback functions share the same prototype, documented below.
|
||||
* Note that any memory passed to the callback function
|
||||
* is valid only during the callback and should be copied if it
|
||||
* needs to persist. This callback function needs to be thread
|
||||
* safe. The context of the callback is always on a valid thread
|
||||
* context and standard synchronization methods can be used. Note,
|
||||
* however, because of this the callback cannot call SDK functions
|
||||
* unless explicitly noted.
|
||||
*
|
||||
* \verbatim
|
||||
int CallbackFxn(Upnp_EventType EventType, void *Event, void *Cookie);
|
||||
\endverbatim
|
||||
*
|
||||
* where \b EventType is the event that triggered the callback,
|
||||
* \b Event is a structure that denotes event-specific information for that
|
||||
* event, and \b Cookie is the user data passed when the callback was
|
||||
* registered.
|
||||
*
|
||||
* See \b Upnp_EventType for more information on the callback values and
|
||||
* the associated \b Event parameter.
|
||||
*
|
||||
* The return value of the callback is currently ignored. It may be used
|
||||
* in the future to communicate results back to the SDK.
|
||||
*/
|
||||
typedef int (*Upnp_FunPtr)(
|
||||
/*! [in] .*/
|
||||
Upnp_EventType EventType,
|
||||
/*! [in] .*/
|
||||
const void *Event,
|
||||
/*! [in] .*/
|
||||
void *Cookie);
|
||||
|
||||
#endif /* CALLBACK_H */
|
@ -1,35 +0,0 @@
|
||||
|
||||
#ifndef DISCOVERY_H
|
||||
#define DISCOVERY_H
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpDiscovery object declararion.
|
||||
*
|
||||
* Returned in a \b UPNP_DISCOVERY_RESULT callback.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "UpnpInet.h" /* for struct sockaddr_storage */
|
||||
|
||||
#define CLASS UpnpDiscovery
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, Expires, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, DeviceID) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, DeviceType) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceType) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceVer) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, Location) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, Os) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, Date) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, Ext) \
|
||||
EXPAND_CLASS_MEMBER_BUFFER(CLASS, DestAddr, struct sockaddr_storage) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
#endif /* DISCOVERY_H */
|
||||
|
@ -1,27 +0,0 @@
|
||||
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEvent object declararion.
|
||||
*
|
||||
* Returned along with a \b UPNP_EVENT_RECEIVED callback.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#define CLASS UpnpEvent
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, EventKey, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ChangedVariables, IXML_Document *) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* EVENT_H */
|
||||
|
@ -1,29 +0,0 @@
|
||||
|
||||
#ifndef EVENTSUBSCRIBE_H
|
||||
#define EVENTSUBSCRIBE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEventSubscribe object declararion.
|
||||
*
|
||||
* Returned along with a \b UPNP_EVENT_SUBSCRIBE_COMPLETE or
|
||||
* \b UPNP_EVENT_UNSUBSCRIBE_COMPLETE callback.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#define CLASS UpnpEventSubscribe
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TimeOut, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, PublisherUrl) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* EVENTSUBSCRIBE_H */
|
||||
|
@ -1,35 +0,0 @@
|
||||
|
||||
#ifndef FILEINFO_H
|
||||
#define FILEINFO_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpFileInfo object declararion.
|
||||
*
|
||||
* Detailed description of this class should go here
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "upnpconfig.h"
|
||||
|
||||
#include <sys/types.h> /* for off_t */
|
||||
#include <time.h> /* for time_t */
|
||||
|
||||
#define CLASS UpnpFileInfo
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, FileLength, off_t) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, LastModified, time_t) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, IsDirectory, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, IsReadable, int) \
|
||||
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, ContentType) \
|
||||
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, ExtraHeaders) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* FILEINFO_H */
|
||||
|
@ -1,29 +0,0 @@
|
||||
|
||||
#ifndef STATEVARCOMPLETE_H
|
||||
#define STATEVARCOMPLETE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarComplete object declararion.
|
||||
*
|
||||
* Represents the reply for the current value of a state variable in an
|
||||
* asynchronous call.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#define CLASS UpnpStateVarComplete
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, CtrlUrl) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, StateVarName) \
|
||||
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, CurrentVal) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* STATEVARCOMPLETE_H */
|
||||
|
@ -1,35 +0,0 @@
|
||||
|
||||
#ifndef STATEVARREQUEST_H
|
||||
#define STATEVARREQUEST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarRequest object declararion.
|
||||
*
|
||||
* Represents the request for current value of a state variable in a service
|
||||
* state table.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "UpnpInet.h" /* for struct sockaddr_storage */
|
||||
|
||||
#define CLASS UpnpStateVarRequest
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, ErrCode, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, Socket, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ErrStr) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, DevUDN) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceID) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, StateVarName) \
|
||||
EXPAND_CLASS_MEMBER_BUFFER(CLASS, CtrlPtIPAddr, struct sockaddr_storage) \
|
||||
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, CurrentVal) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* STATEVARREQUEST_H */
|
||||
|
@ -1,28 +0,0 @@
|
||||
|
||||
|
||||
#ifndef SUBSCRIPTIONREQUEST_H
|
||||
#define SUBSCRIPTIONREQUEST_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpSubscriptionRequest object declararion.
|
||||
*
|
||||
* Returned along with a \b UPNP_EVENT_SUBSCRIPTION_REQUEST callback.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#define CLASS UpnpSubscriptionRequest
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ServiceId) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, UDN) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* SUBSCRIPTIONREQUEST_H */
|
||||
|
@ -1,165 +0,0 @@
|
||||
/*
|
||||
* C Template objects.
|
||||
*
|
||||
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#ifndef TEMPLATEINCLUDE_H
|
||||
#define TEMPLATEINCLUDE_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Templates for include files of objects.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* - In the include file Token.h:
|
||||
* #include "Token_def.h"
|
||||
* #include "TemplateInclude.h"
|
||||
*
|
||||
* - In the source file Token.c:
|
||||
* #include "Token.h"
|
||||
* #include "TemplateSource.h"
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_COMMON(CLASS) \
|
||||
TEMPLATE_PROTOTYPE_COMMON_AUX(CLASS)
|
||||
#define TEMPLATE_PROTOTYPE_COMMON_AUX(CLASS) \
|
||||
/*!
|
||||
* DOC_##CLASS
|
||||
*/ \
|
||||
typedef struct s_##CLASS CLASS; \
|
||||
\
|
||||
/*! Constructor */ \
|
||||
EXPORT_SPEC CLASS *CLASS##_new(); \
|
||||
\
|
||||
/*! Destructor */ \
|
||||
EXPORT_SPEC void CLASS##_delete(CLASS *p); \
|
||||
\
|
||||
/*! Copy Constructor */ \
|
||||
EXPORT_SPEC CLASS *CLASS##_dup(const CLASS *p); \
|
||||
\
|
||||
/*! Assignment operator */ \
|
||||
EXPORT_SPEC int CLASS##_assign(CLASS *p, const CLASS *q); \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_INT(CLASS, MEMBER, TYPE) \
|
||||
TEMPLATE_PROTOTYPE_INT_AUX(CLASS, MEMBER, TYPE)
|
||||
#define TEMPLATE_PROTOTYPE_INT_AUX(CLASS, MEMBER, TYPE) \
|
||||
/*! DOC_##CLASS##_##MEMBER */ \
|
||||
EXPORT_SPEC TYPE CLASS##_get_##MEMBER(const CLASS *p); \
|
||||
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, TYPE n); \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_BUFFER(CLASS, MEMBER, TYPE) \
|
||||
TEMPLATE_PROTOTYPE_BUFFER_AUX(CLASS, MEMBER, TYPE)
|
||||
#define TEMPLATE_PROTOTYPE_BUFFER_AUX(CLASS, MEMBER, TYPE) \
|
||||
/*! DOC_##CLASS_##MEMBER */ \
|
||||
EXPORT_SPEC const TYPE *CLASS##_get_##MEMBER(const CLASS *p); \
|
||||
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const TYPE *buf); \
|
||||
EXPORT_SPEC void CLASS##_clear_##MEMBER(CLASS *p); \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_LIST(CLASS, MEMBER) \
|
||||
TEMPLATE_PROTOTYPE_LIST_AUX(CLASS, MEMBER)
|
||||
#define TEMPLATE_PROTOTYPE_LIST_AUX(CLASS, MEMBER) \
|
||||
/*! DOC_##CLASS_##MEMBER */ \
|
||||
EXPORT_SPEC const struct list_head *CLASS##_get_##MEMBER(const CLASS *p); \
|
||||
EXPORT_SPEC void CLASS##_add_to_list_##MEMBER(CLASS *p, struct list_head *head); \
|
||||
EXPORT_SPEC void CLASS##_remove_from_list_##MEMBER(CLASS *p); \
|
||||
EXPORT_SPEC void CLASS##_replace_in_list_##MEMBER(CLASS *p, struct list_head *new); \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_OBJECT(CLASS, MEMBER, TYPE) \
|
||||
TEMPLATE_PROTOTYPE_OBJECT_AUX(CLASS, MEMBER, TYPE)
|
||||
#define TEMPLATE_PROTOTYPE_OBJECT_AUX(CLASS, MEMBER, TYPE) \
|
||||
/*! DOC_##CLASS##_##MEMBER */ \
|
||||
EXPORT_SPEC const TYPE *CLASS##_get_##MEMBER(const CLASS *p); \
|
||||
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const TYPE *n); \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_STRING(CLASS, MEMBER) \
|
||||
TEMPLATE_PROTOTYPE_STRING_AUX(CLASS, MEMBER)
|
||||
#define TEMPLATE_PROTOTYPE_STRING_AUX(CLASS, MEMBER) \
|
||||
/*! DOC_##CLASS##_##MEMBER */ \
|
||||
EXPORT_SPEC const UpnpString *CLASS##_get_##MEMBER(const CLASS *p); \
|
||||
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const UpnpString *s); \
|
||||
EXPORT_SPEC size_t CLASS##_get_##MEMBER##_Length(const CLASS *p); \
|
||||
EXPORT_SPEC const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p); \
|
||||
EXPORT_SPEC int CLASS##_strcpy_##MEMBER(CLASS *p, const char *s); \
|
||||
EXPORT_SPEC int CLASS##_strncpy_##MEMBER(CLASS *p, const char *s, size_t n); \
|
||||
EXPORT_SPEC void CLASS##_clear_##MEMBER(CLASS *p); \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_PROTOTYPE_DOMSTRING(CLASS, MEMBER) \
|
||||
TEMPLATE_PROTOTYPE_DOMSTRING_AUX(CLASS, MEMBER)
|
||||
#define TEMPLATE_PROTOTYPE_DOMSTRING_AUX(CLASS, MEMBER) \
|
||||
/*! DOC_##CLASS_##MEMBER */ \
|
||||
EXPORT_SPEC const DOMString CLASS##_get_##MEMBER(const CLASS *p); \
|
||||
EXPORT_SPEC int CLASS##_set_##MEMBER(CLASS *p, const DOMString s); \
|
||||
EXPORT_SPEC const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p); \
|
||||
|
||||
|
||||
#endif /* TEMPLATEINCLUDE_H */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Actual source starts here.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#include <stdlib.h> /* for size_t */
|
||||
|
||||
|
||||
#include "ixml.h" /* for DOMString, IXML_Document */
|
||||
#include "list.h" /* for struct list_head */
|
||||
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
|
||||
#include "UpnpString.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
TEMPLATE_PROTOTYPE_COMMON(CLASS)
|
||||
|
||||
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_PROTOTYPE_INT(CLASS, MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_PROTOTYPE_BUFFER(CLASS, MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_PROTOTYPE_LIST(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_PROTOTYPE_OBJECT(CLASS, MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_PROTOTYPE_STRING(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_PROTOTYPE_DOMSTRING(CLASS, MEMBER)
|
||||
|
||||
EXPAND_CLASS_MEMBERS(CLASS)
|
||||
|
||||
#include "TemplateUndef.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#ifdef TEMPLATE_GENERATE_SOURCE
|
||||
#include "TemplateSource.h"
|
||||
#endif /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
/* Cleanup the template mess. */
|
||||
#undef PREFIX
|
||||
#undef CLASS
|
||||
#undef EXPAND_CLASS_MEMBERS
|
||||
|
@ -1,340 +0,0 @@
|
||||
/*
|
||||
* C Template objects.
|
||||
*
|
||||
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#ifndef TEMPLATESOURCE_H
|
||||
#define TEMPLATESOURCE_H
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Templates for source files of objects.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* - In the include file Token.h:
|
||||
* #include "Token_def.h"
|
||||
* #include "TemplateInclude.h"
|
||||
*
|
||||
* - In the source file Token.c:
|
||||
* #include "Token.h"
|
||||
* #include "TemplateSource.h"
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_DEFINITION_INT(MEMBER, TYPE) TYPE m_##MEMBER;
|
||||
#define TEMPLATE_DEFINITION_BUFFER(MEMBER, TYPE) TYPE m_##MEMBER;
|
||||
#define TEMPLATE_DEFINITION_LIST(MEMBER) struct list_head m_##MEMBER;
|
||||
#define TEMPLATE_DEFINITION_OBJECT(MEMBER, TYPE) TYPE *m_##MEMBER;
|
||||
#define TEMPLATE_DEFINITION_STRING(MEMBER) UpnpString *m_##MEMBER;
|
||||
#define TEMPLATE_DEFINITION_DOMSTRING(MEMBER) DOMString m_##MEMBER;
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_CONSTRUCTOR_INT(MEMBER, TYPE) /* p->m_##MEMBER = 0; */
|
||||
#define TEMPLATE_CONSTRUCTOR_BUFFER(MEMBER, TYPE) \
|
||||
/* memset(&p->m_##MEMBER, 0, sizeof (TYPE)); */
|
||||
#define TEMPLATE_CONSTRUCTOR_LIST(MEMBER, TYPE) INIT_LIST_HEAD(&p->m_##MEMBER);
|
||||
#define TEMPLATE_CONSTRUCTOR_OBJECT(MEMBER, TYPE) p->m_##MEMBER = TYPE##_new();
|
||||
#define TEMPLATE_CONSTRUCTOR_STRING(MEMBER) p->m_##MEMBER = UpnpString_new();
|
||||
#define TEMPLATE_CONSTRUCTOR_DOMSTRING(MEMBER) p->m_##MEMBER = NULL;
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_DESTRUCTOR_INT(MEMBER, TYPE) p->m_##MEMBER = 0;
|
||||
#define TEMPLATE_DESTRUCTOR_BUFFER(MEMBER, TYPE) memset(&p->m_##MEMBER, 0, sizeof (TYPE));
|
||||
#define TEMPLATE_DESTRUCTOR_LIST(MEMBER) list_del(&p->m_##MEMBER);
|
||||
#define TEMPLATE_DESTRUCTOR_OBJECT(MEMBER, TYPE) TYPE##_delete(p->m_##MEMBER); p->m_##MEMBER = NULL;
|
||||
#define TEMPLATE_DESTRUCTOR_STRING(MEMBER) UpnpString_delete(p->m_##MEMBER); p->m_##MEMBER = NULL;
|
||||
#define TEMPLATE_DESTRUCTOR_DOMSTRING(MEMBER) ixmlFreeDOMString(p->m_##MEMBER); p->m_##MEMBER = NULL;
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_ASSIGNMENT(CLASS, MEMBER) ok = ok && CLASS##_set_##MEMBER(p, CLASS##_get_##MEMBER(q));
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_METHODS_INT(CLASS, MEMBER, TYPE) \
|
||||
TEMPLATE_METHODS_INT_AUX(CLASS, MEMBER, TYPE)
|
||||
#define TEMPLATE_METHODS_INT_AUX(CLASS, MEMBER, TYPE) \
|
||||
TYPE CLASS##_get_##MEMBER(const CLASS *p) \
|
||||
{ \
|
||||
return ((struct S##CLASS *)p)->m_##MEMBER; \
|
||||
} \
|
||||
\
|
||||
int CLASS##_set_##MEMBER(CLASS *p, TYPE n) \
|
||||
{ \
|
||||
((struct S##CLASS *)p)->m_##MEMBER = n; \
|
||||
return 1; \
|
||||
} \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_METHODS_BUFFER(CLASS, MEMBER, TYPE) \
|
||||
TEMPLATE_METHODS_BUFFER_AUX(CLASS, MEMBER, TYPE)
|
||||
#define TEMPLATE_METHODS_BUFFER_AUX(CLASS, MEMBER, TYPE) \
|
||||
const TYPE *CLASS##_get_##MEMBER(const CLASS *p) \
|
||||
{ \
|
||||
return (TYPE *)&((struct S##CLASS *)p)->m_##MEMBER; \
|
||||
} \
|
||||
\
|
||||
int CLASS##_set_##MEMBER(CLASS *p, const TYPE *buf) \
|
||||
{ \
|
||||
((struct S##CLASS *)p)->m_##MEMBER = *(TYPE *)buf; \
|
||||
return 1; \
|
||||
} \
|
||||
\
|
||||
void CLASS##_clear_##MEMBER(CLASS *p) \
|
||||
{ \
|
||||
memset(&((struct S##CLASS *)p)->m_##MEMBER, 0, sizeof(TYPE)); \
|
||||
} \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_METHODS_LIST(CLASS, MEMBER) \
|
||||
TEMPLATE_METHODS_LIST_AUX(CLASS, MEMBER)
|
||||
#define TEMPLATE_METHODS_LIST_AUX(CLASS, MEMBER) \
|
||||
const struct list_head *CLASS##_get_##MEMBER(const CLASS *p) \
|
||||
{ \
|
||||
return (struct list_head *)&((struct S##CLASS *)p)->m_##MEMBER; \
|
||||
} \
|
||||
\
|
||||
void CLASS##_add_to_list_##MEMBER(CLASS *p, struct list_head *head) \
|
||||
{ \
|
||||
list_add(&((struct S##CLASS *)p)->m_##MEMBER, head); \
|
||||
} \
|
||||
\
|
||||
void CLASS##_remove_from_list_##MEMBER(CLASS *p) \
|
||||
{ \
|
||||
list_del_init(&((struct S##CLASS *)p)->m_##MEMBER); \
|
||||
} \
|
||||
\
|
||||
void CLASS##_replace_in_list_##MEMBER(CLASS *p, struct list_head *new) \
|
||||
{ \
|
||||
list_replace_init(&((struct S##CLASS *)p)->m_##MEMBER, new); \
|
||||
} \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_METHODS_OBJECT(CLASS, MEMBER, TYPE) \
|
||||
TEMPLATE_METHODS_OBJECT_AUX(CLASS, MEMBER, TYPE)
|
||||
#define TEMPLATE_METHODS_OBJECT_AUX(CLASS, MEMBER, TYPE) \
|
||||
const TYPE *CLASS##_get_##MEMBER(const CLASS *p) \
|
||||
{ \
|
||||
return ((struct S##CLASS *)p)->m_##MEMBER; \
|
||||
} \
|
||||
\
|
||||
int CLASS##_set_##MEMBER(CLASS *p, const TYPE *s) \
|
||||
{ \
|
||||
TYPE *q = TYPE##_dup(s); \
|
||||
if (!q) return 0; \
|
||||
TYPE##_delete(((struct S##CLASS *)p)->m_##MEMBER); \
|
||||
((struct S##CLASS *)p)->m_##MEMBER = q; \
|
||||
return 1; \
|
||||
} \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_METHODS_STRING(CLASS, MEMBER) \
|
||||
TEMPLATE_METHODS_STRING_AUX(CLASS, MEMBER)
|
||||
#define TEMPLATE_METHODS_STRING_AUX(CLASS, MEMBER) \
|
||||
const UpnpString *CLASS##_get_##MEMBER(const CLASS *p) \
|
||||
{ \
|
||||
return ((struct S##CLASS *)p)->m_##MEMBER; \
|
||||
} \
|
||||
\
|
||||
int CLASS##_set_##MEMBER(CLASS *p, const UpnpString *s) \
|
||||
{ \
|
||||
const char *q = UpnpString_get_String(s); \
|
||||
return UpnpString_set_String(((struct S##CLASS *)p)->m_##MEMBER, q); \
|
||||
} \
|
||||
\
|
||||
size_t CLASS##_get_##MEMBER##_Length(const CLASS *p) \
|
||||
{ \
|
||||
return UpnpString_get_Length(CLASS##_get_##MEMBER(p)); \
|
||||
} \
|
||||
const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p) \
|
||||
{ \
|
||||
return UpnpString_get_String(CLASS##_get_##MEMBER(p)); \
|
||||
} \
|
||||
\
|
||||
int CLASS##_strcpy_##MEMBER(CLASS *p, const char *s) \
|
||||
{ \
|
||||
return UpnpString_set_String(((struct S##CLASS *)p)->m_##MEMBER, s); \
|
||||
} \
|
||||
\
|
||||
int CLASS##_strncpy_##MEMBER(CLASS *p, const char *s, size_t n) \
|
||||
{ \
|
||||
return UpnpString_set_StringN(((struct S##CLASS *)p)->m_##MEMBER, s, n); \
|
||||
} \
|
||||
\
|
||||
void CLASS##_clear_##MEMBER(CLASS *p) \
|
||||
{ \
|
||||
UpnpString_clear(((struct S##CLASS *)p)->m_##MEMBER); \
|
||||
} \
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_METHODS_DOMSTRING(CLASS, MEMBER) \
|
||||
TEMPLATE_METHODS_DOMSTRING_AUX(CLASS, MEMBER)
|
||||
#define TEMPLATE_METHODS_DOMSTRING_AUX(CLASS, MEMBER) \
|
||||
const DOMString CLASS##_get_##MEMBER(const CLASS *p) \
|
||||
{ \
|
||||
return ((struct S##CLASS *)p)->m_##MEMBER; \
|
||||
} \
|
||||
\
|
||||
int CLASS##_set_##MEMBER(CLASS *p, const DOMString s) \
|
||||
{ \
|
||||
DOMString q = ixmlCloneDOMString(s); \
|
||||
if (!q) return 0; \
|
||||
ixmlFreeDOMString(((struct S##CLASS *)p)->m_##MEMBER); \
|
||||
((struct S##CLASS *)p)->m_##MEMBER = q; \
|
||||
return 1; \
|
||||
} \
|
||||
\
|
||||
const char *CLASS##_get_##MEMBER##_cstr(const CLASS *p) \
|
||||
{ \
|
||||
return (const char *)CLASS##_get_##MEMBER(p); \
|
||||
} \
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Actual source starts here.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
#include <string.h> /* for strlen(), strdup() */
|
||||
|
||||
/******************************************************************************/
|
||||
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_DEFINITION_INT(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_DEFINITION_BUFFER(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_DEFINITION_LIST(MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_DEFINITION_OBJECT(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_DEFINITION_STRING(MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_DEFINITION_DOMSTRING(MEMBER)
|
||||
|
||||
#define TEMPLATE_DECLARATION_STRUCT(CLASS) \
|
||||
TEMPLATE_DECLARATION_STRUCT_AUX(CLASS)
|
||||
#define TEMPLATE_DECLARATION_STRUCT_AUX(CLASS) \
|
||||
struct S##CLASS { \
|
||||
EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
};
|
||||
|
||||
TEMPLATE_DECLARATION_STRUCT(CLASS)
|
||||
|
||||
#include "TemplateUndef.h"
|
||||
|
||||
/******************************************************************************/
|
||||
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_CONSTRUCTOR_INT(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_CONSTRUCTOR_BUFFER(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_CONSTRUCTOR_LIST(MEMBER, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_CONSTRUCTOR_OBJECT(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_CONSTRUCTOR_STRING(MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_CONSTRUCTOR_DOMSTRING(MEMBER)
|
||||
|
||||
#define TEMPLATE_DEFINITION_CONSTRUCTOR(CLASS) \
|
||||
TEMPLATE_DEFINITION_CONSTRUCTOR_AUX(CLASS)
|
||||
#define TEMPLATE_DEFINITION_CONSTRUCTOR_AUX(CLASS) \
|
||||
CLASS *CLASS##_new() \
|
||||
{ \
|
||||
struct S##CLASS *p = calloc(1, sizeof (struct S##CLASS)); \
|
||||
\
|
||||
if (!p) return NULL; \
|
||||
\
|
||||
EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
\
|
||||
return (CLASS *)p; \
|
||||
}
|
||||
|
||||
TEMPLATE_DEFINITION_CONSTRUCTOR(CLASS)
|
||||
|
||||
#include "TemplateUndef.h"
|
||||
|
||||
/******************************************************************************/
|
||||
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_DESTRUCTOR_INT(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_DESTRUCTOR_BUFFER(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_DESTRUCTOR_LIST(MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_DESTRUCTOR_OBJECT(MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_DESTRUCTOR_STRING(MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_DESTRUCTOR_DOMSTRING(MEMBER)
|
||||
|
||||
#define TEMPLATE_DEFINITION_DESTRUCTOR(CLASS) \
|
||||
TEMPLATE_DEFINITION_DESTRUCTOR_AUX(CLASS)
|
||||
#define TEMPLATE_DEFINITION_DESTRUCTOR_AUX(CLASS) \
|
||||
void CLASS##_delete(CLASS *q) \
|
||||
{ \
|
||||
struct S##CLASS *p = (struct S##CLASS *)q; \
|
||||
\
|
||||
if (!p) return; \
|
||||
\
|
||||
EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
\
|
||||
free(p); \
|
||||
}
|
||||
|
||||
TEMPLATE_DEFINITION_DESTRUCTOR(CLASS)
|
||||
|
||||
#include "TemplateUndef.h"
|
||||
|
||||
/******************************************************************************/
|
||||
#define TEMPLATE_DEFINITION_COPY_CONSTRUCTOR(CLASS) \
|
||||
TEMPLATE_DEFINITION_COPY_CONSTRUCTOR_AUX(CLASS)
|
||||
#define TEMPLATE_DEFINITION_COPY_CONSTRUCTOR_AUX(CLASS) \
|
||||
CLASS *CLASS##_dup(const CLASS *q) \
|
||||
{ \
|
||||
CLASS *p = CLASS##_new(); \
|
||||
\
|
||||
if (!p) return NULL; \
|
||||
\
|
||||
CLASS##_assign(p, q); \
|
||||
\
|
||||
return p; \
|
||||
}
|
||||
|
||||
TEMPLATE_DEFINITION_COPY_CONSTRUCTOR(CLASS)
|
||||
|
||||
/******************************************************************************/
|
||||
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) /* Do not assing. */
|
||||
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_ASSIGNMENT(CLASS, MEMBER)
|
||||
|
||||
#define TEMPLATE_DEFINITION_ASSIGNMENT(CLASS) \
|
||||
TEMPLATE_DEFINITION_ASSIGNMENT_AUX(CLASS)
|
||||
#define TEMPLATE_DEFINITION_ASSIGNMENT_AUX(CLASS) \
|
||||
int CLASS##_assign(CLASS *p, const CLASS *q) \
|
||||
{ \
|
||||
int ok = 1; \
|
||||
if (p != q) { \
|
||||
EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
} \
|
||||
return ok; \
|
||||
}
|
||||
|
||||
TEMPLATE_DEFINITION_ASSIGNMENT(CLASS)
|
||||
|
||||
#include "TemplateUndef.h"
|
||||
|
||||
/******************************************************************************/
|
||||
#define EXPAND_CLASS_MEMBER_INT(CLASS, MEMBER, TYPE) TEMPLATE_METHODS_INT(CLASS, MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_BUFFER(CLASS, MEMBER, TYPE) TEMPLATE_METHODS_BUFFER(CLASS, MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_LIST(CLASS, MEMBER) TEMPLATE_METHODS_LIST(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_OBJECT(CLASS, MEMBER, TYPE) TEMPLATE_METHODS_OBJECT(CLASS, MEMBER, TYPE)
|
||||
#define EXPAND_CLASS_MEMBER_STRING(CLASS, MEMBER) TEMPLATE_METHODS_STRING(CLASS, MEMBER)
|
||||
#define EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, MEMBER) TEMPLATE_METHODS_DOMSTRING(CLASS, MEMBER)
|
||||
|
||||
EXPAND_CLASS_MEMBERS(CLASS)
|
||||
|
||||
#include "TemplateUndef.h"
|
||||
|
||||
|
||||
#endif /* TEMPLATESOURCE_H */
|
||||
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* C Template objects.
|
||||
*
|
||||
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*/
|
||||
|
||||
#undef EXPAND_CLASS_MEMBER_INT
|
||||
#undef EXPAND_CLASS_MEMBER_BUFFER
|
||||
#undef EXPAND_CLASS_MEMBER_LIST
|
||||
#undef EXPAND_CLASS_MEMBER_OBJECT
|
||||
#undef EXPAND_CLASS_MEMBER_STRING
|
||||
#undef EXPAND_CLASS_MEMBER_DOMSTRING
|
||||
|
720
upnp/inc/list.h
720
upnp/inc/list.h
@ -1,720 +0,0 @@
|
||||
#ifndef _LINUX_LIST_H
|
||||
#define _LINUX_LIST_H
|
||||
|
||||
#if 0
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/poison.h>
|
||||
#include <linux/prefetch.h>
|
||||
#include <asm/system.h>
|
||||
#endif
|
||||
#include "poison.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Apple systems define these macros in system headers, so we undef
|
||||
* them prior to inclusion of this file */
|
||||
#undef LIST_HEAD
|
||||
#undef LIST_HEAD_INIT
|
||||
#undef INIT_LIST_HEAD
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple doubly linked list implementation.
|
||||
*
|
||||
* Some of the internal functions ("__xxx") are useful when
|
||||
* manipulating whole lists rather than single entries, as
|
||||
* sometimes we already know the next/prev entries and we can
|
||||
* generate better code by using them directly rather than
|
||||
* using the generic single-entry routines.
|
||||
*/
|
||||
|
||||
struct list_head {
|
||||
struct list_head *next, *prev;
|
||||
};
|
||||
|
||||
#define LIST_HEAD_INIT(name) { &(name), &(name) }
|
||||
|
||||
#define LIST_HEAD(name) \
|
||||
struct list_head name = LIST_HEAD_INIT(name)
|
||||
|
||||
static UPNP_INLINE void INIT_LIST_HEAD(struct list_head *list)
|
||||
{
|
||||
list->next = list;
|
||||
list->prev = list;
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert a new entry between two known consecutive entries.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
*/
|
||||
#ifndef CONFIG_DEBUG_LIST
|
||||
static UPNP_INLINE void __list_add(struct list_head *new_,
|
||||
struct list_head *prev,
|
||||
struct list_head *next)
|
||||
{
|
||||
next->prev = new_;
|
||||
new_->next = next;
|
||||
new_->prev = prev;
|
||||
prev->next = new_;
|
||||
}
|
||||
#else
|
||||
extern void __list_add(struct list_head *new_,
|
||||
struct list_head *prev,
|
||||
struct list_head *next);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* list_add - add a new entry
|
||||
* @new_: new entry to be added
|
||||
* @head: list head to add it after
|
||||
*
|
||||
* Insert a new entry after the specified head.
|
||||
* This is good for implementing stacks.
|
||||
*/
|
||||
static UPNP_INLINE void list_add(struct list_head *new_, struct list_head *head)
|
||||
{
|
||||
__list_add(new_, head, head->next);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* list_add_tail - add a new entry
|
||||
* @new_: new entry to be added
|
||||
* @head: list head to add it before
|
||||
*
|
||||
* Insert a new entry before the specified head.
|
||||
* This is useful for implementing queues.
|
||||
*/
|
||||
static UPNP_INLINE void list_add_tail(struct list_head *new_, struct list_head *head)
|
||||
{
|
||||
__list_add(new_, head->prev, head);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete a list entry by making the prev/next entries
|
||||
* point to each other.
|
||||
*
|
||||
* This is only for internal list manipulation where we know
|
||||
* the prev/next entries already!
|
||||
*/
|
||||
static UPNP_INLINE void __list_del(struct list_head * prev, struct list_head * next)
|
||||
{
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_del - deletes entry from list.
|
||||
* @entry: the element to delete from the list.
|
||||
* Note: list_empty() on entry does not return true after this, the entry is
|
||||
* in an undefined state.
|
||||
*/
|
||||
#ifndef CONFIG_DEBUG_LIST
|
||||
static UPNP_INLINE void list_del(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
entry->next = (struct list_head *)LIST_POISON1;
|
||||
entry->prev = (struct list_head *)LIST_POISON2;
|
||||
}
|
||||
#else
|
||||
extern void list_del(struct list_head *entry);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* list_replace - replace old entry by new one
|
||||
* @old : the element to be replaced
|
||||
* @new_ : the new element to insert
|
||||
*
|
||||
* If @old was empty, it will be overwritten.
|
||||
*/
|
||||
static UPNP_INLINE void list_replace(struct list_head *old,
|
||||
struct list_head *new_)
|
||||
{
|
||||
new_->next = old->next;
|
||||
new_->next->prev = new_;
|
||||
new_->prev = old->prev;
|
||||
new_->prev->next = new_;
|
||||
}
|
||||
|
||||
static UPNP_INLINE void list_replace_init(struct list_head *old,
|
||||
struct list_head *new_)
|
||||
{
|
||||
list_replace(old, new_);
|
||||
INIT_LIST_HEAD(old);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_del_init - deletes entry from list and reinitialize it.
|
||||
* @entry: the element to delete from the list.
|
||||
*/
|
||||
static UPNP_INLINE void list_del_init(struct list_head *entry)
|
||||
{
|
||||
__list_del(entry->prev, entry->next);
|
||||
INIT_LIST_HEAD(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_move - delete from one list and add as another's head
|
||||
* @list: the entry to move
|
||||
* @head: the head that will precede our entry
|
||||
*/
|
||||
static UPNP_INLINE void list_move(struct list_head *list, struct list_head *head)
|
||||
{
|
||||
__list_del(list->prev, list->next);
|
||||
list_add(list, head);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_move_tail - delete from one list and add as another's tail
|
||||
* @list: the entry to move
|
||||
* @head: the head that will follow our entry
|
||||
*/
|
||||
static UPNP_INLINE void list_move_tail(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
__list_del(list->prev, list->next);
|
||||
list_add_tail(list, head);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_is_last - tests whether @list is the last entry in list @head
|
||||
* @list: the entry to test
|
||||
* @head: the head of the list
|
||||
*/
|
||||
static UPNP_INLINE int list_is_last(const struct list_head *list,
|
||||
const struct list_head *head)
|
||||
{
|
||||
return list->next == head;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_empty - tests whether a list is empty
|
||||
* @head: the list to test.
|
||||
*/
|
||||
static UPNP_INLINE int list_empty(const struct list_head *head)
|
||||
{
|
||||
return head->next == head;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_empty_careful - tests whether a list is empty and not being modified
|
||||
* @head: the list to test
|
||||
*
|
||||
* Description:
|
||||
* tests whether a list is empty _and_ checks that no other CPU might be
|
||||
* in the process of modifying either member (next or prev)
|
||||
*
|
||||
* NOTE: using list_empty_careful() without synchronization
|
||||
* can only be safe if the only activity that can happen
|
||||
* to the list entry is list_del_init(). Eg. it cannot be used
|
||||
* if another CPU could re-list_add() it.
|
||||
*/
|
||||
static UPNP_INLINE int list_empty_careful(const struct list_head *head)
|
||||
{
|
||||
struct list_head *next = head->next;
|
||||
return (next == head) && (next == head->prev);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_rotate_left - rotate the list to the left
|
||||
* @head: the head of the list
|
||||
*/
|
||||
static UPNP_INLINE void list_rotate_left(struct list_head *head)
|
||||
{
|
||||
struct list_head *first;
|
||||
|
||||
if (!list_empty(head)) {
|
||||
first = head->next;
|
||||
list_move_tail(first, head);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list_is_singular - tests whether a list has just one entry.
|
||||
* @head: the list to test.
|
||||
*/
|
||||
static UPNP_INLINE int list_is_singular(const struct list_head *head)
|
||||
{
|
||||
return !list_empty(head) && (head->next == head->prev);
|
||||
}
|
||||
|
||||
static UPNP_INLINE void __list_cut_position(struct list_head *list,
|
||||
struct list_head *head, struct list_head *entry)
|
||||
{
|
||||
struct list_head *new_first = entry->next;
|
||||
list->next = head->next;
|
||||
list->next->prev = list;
|
||||
list->prev = entry;
|
||||
entry->next = list;
|
||||
head->next = new_first;
|
||||
new_first->prev = head;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_cut_position - cut a list into two
|
||||
* @list: a new list to add all removed entries
|
||||
* @head: a list with entries
|
||||
* @entry: an entry within head, could be the head itself
|
||||
* and if so we won't cut the list
|
||||
*
|
||||
* This helper moves the initial part of @head, up to and
|
||||
* including @entry, from @head to @list. You should
|
||||
* pass on @entry an element you know is on @head. @list
|
||||
* should be an empty list or a list you do not care about
|
||||
* losing its data.
|
||||
*
|
||||
*/
|
||||
static UPNP_INLINE void list_cut_position(struct list_head *list,
|
||||
struct list_head *head, struct list_head *entry)
|
||||
{
|
||||
if (list_empty(head))
|
||||
return;
|
||||
if (list_is_singular(head) &&
|
||||
(head->next != entry && head != entry))
|
||||
return;
|
||||
if (entry == head)
|
||||
INIT_LIST_HEAD(list);
|
||||
else
|
||||
__list_cut_position(list, head, entry);
|
||||
}
|
||||
|
||||
static UPNP_INLINE void __list_splice(const struct list_head *list,
|
||||
struct list_head *prev,
|
||||
struct list_head *next)
|
||||
{
|
||||
struct list_head *first = list->next;
|
||||
struct list_head *last = list->prev;
|
||||
|
||||
first->prev = prev;
|
||||
prev->next = first;
|
||||
|
||||
last->next = next;
|
||||
next->prev = last;
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice - join two lists, this is designed for stacks
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*/
|
||||
static UPNP_INLINE void list_splice(const struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list))
|
||||
__list_splice(list, head, head->next);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice_tail - join two lists, each list being a queue
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*/
|
||||
static UPNP_INLINE void list_splice_tail(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list))
|
||||
__list_splice(list, head->prev, head);
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice_init - join two lists and reinitialise the emptied list.
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*
|
||||
* The list at @list is reinitialised
|
||||
*/
|
||||
static UPNP_INLINE void list_splice_init(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list)) {
|
||||
__list_splice(list, head, head->next);
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list_splice_tail_init - join two lists and reinitialise the emptied list
|
||||
* @list: the new list to add.
|
||||
* @head: the place to add it in the first list.
|
||||
*
|
||||
* Each of the lists is a queue.
|
||||
* The list at @list is reinitialised
|
||||
*/
|
||||
static UPNP_INLINE void list_splice_tail_init(struct list_head *list,
|
||||
struct list_head *head)
|
||||
{
|
||||
if (!list_empty(list)) {
|
||||
__list_splice(list, head->prev, head);
|
||||
INIT_LIST_HEAD(list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list_entry - get the struct for this entry
|
||||
* @ptr: the &struct list_head pointer.
|
||||
* @type: the type of the struct this is embedded in.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*/
|
||||
#define list_entry(ptr, type, member) \
|
||||
container_of(ptr, type, member)
|
||||
|
||||
/**
|
||||
* list_first_entry - get the first element from a list
|
||||
* @ptr: the list head to take the element from.
|
||||
* @type: the type of the struct this is embedded in.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Note, that list is expected to be not empty.
|
||||
*/
|
||||
#define list_first_entry(ptr, type, member) \
|
||||
list_entry((ptr)->next, type, member)
|
||||
|
||||
/**
|
||||
* list_for_each - iterate over a list
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each(pos, head) \
|
||||
for (pos = (head)->next; prefetch(pos->next), pos != (head); \
|
||||
pos = pos->next)
|
||||
|
||||
/**
|
||||
* __list_for_each - iterate over a list
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
*
|
||||
* This variant differs from list_for_each() in that it's the
|
||||
* simplest possible list iteration code, no prefetching is done.
|
||||
* Use this for code that knows the list to be very short (empty
|
||||
* or 1 entry) most of the time.
|
||||
*/
|
||||
#define __list_for_each(pos, head) \
|
||||
for (pos = (head)->next; pos != (head); pos = pos->next)
|
||||
|
||||
/**
|
||||
* list_for_each_prev - iterate over a list backwards
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each_prev(pos, head) \
|
||||
for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
|
||||
pos = pos->prev)
|
||||
|
||||
/**
|
||||
* list_for_each_safe - iterate over a list safe against removal of list entry
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
* @n: another &struct list_head to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each_safe(pos, n, head) \
|
||||
for (pos = (head)->next, n = pos->next; pos != (head); \
|
||||
pos = n, n = pos->next)
|
||||
|
||||
/**
|
||||
* list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
|
||||
* @pos: the &struct list_head to use as a loop cursor.
|
||||
* @n: another &struct list_head to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
*/
|
||||
#define list_for_each_prev_safe(pos, n, head) \
|
||||
for (pos = (head)->prev, n = pos->prev; \
|
||||
prefetch(pos->prev), pos != (head); \
|
||||
pos = n, n = pos->prev)
|
||||
|
||||
/**
|
||||
* list_for_each_entry - iterate over list of given type
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*/
|
||||
#define list_for_each_entry(pos, head, member) \
|
||||
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
||||
prefetch(pos->member.next), &pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_reverse - iterate backwards over list of given type.
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*/
|
||||
#define list_for_each_entry_reverse(pos, head, member) \
|
||||
for (pos = list_entry((head)->prev, typeof(*pos), member); \
|
||||
prefetch(pos->member.prev), &pos->member != (head); \
|
||||
pos = list_entry(pos->member.prev, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
* list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
|
||||
* @pos: the type * to use as a start point
|
||||
* @head: the head of the list
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Prepares a pos entry for use as a start point in list_for_each_entry_continue().
|
||||
*/
|
||||
#define list_prepare_entry(pos, head, member) \
|
||||
((pos) ? : list_entry(head, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_continue - continue iteration over list of given type
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Continue to iterate over list of given type, continuing after
|
||||
* the current position.
|
||||
*/
|
||||
#define list_for_each_entry_continue(pos, head, member) \
|
||||
for (pos = list_entry(pos->member.next, typeof(*pos), member); \
|
||||
prefetch(pos->member.next), &pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_continue_reverse - iterate backwards from the given point
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Start to iterate over list of given type backwards, continuing after
|
||||
* the current position.
|
||||
*/
|
||||
#define list_for_each_entry_continue_reverse(pos, head, member) \
|
||||
for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
|
||||
prefetch(pos->member.prev), &pos->member != (head); \
|
||||
pos = list_entry(pos->member.prev, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_from - iterate over list of given type from the current point
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Iterate over list of given type, continuing from current position.
|
||||
*/
|
||||
#define list_for_each_entry_from(pos, head, member) \
|
||||
for (; prefetch(pos->member.next), &pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @n: another type * to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*/
|
||||
#define list_for_each_entry_safe(pos, n, head, member) \
|
||||
for (pos = list_entry((head)->next, typeof(*pos), member), \
|
||||
n = list_entry(pos->member.next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_safe_continue - continue list iteration safe against removal
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @n: another type * to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Iterate over list of given type, continuing after current point,
|
||||
* safe against removal of list entry.
|
||||
*/
|
||||
#define list_for_each_entry_safe_continue(pos, n, head, member) \
|
||||
for (pos = list_entry(pos->member.next, typeof(*pos), member), \
|
||||
n = list_entry(pos->member.next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_safe_from - iterate over list from current point safe against removal
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @n: another type * to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Iterate over list of given type from current point, safe against
|
||||
* removal of list entry.
|
||||
*/
|
||||
#define list_for_each_entry_safe_from(pos, n, head, member) \
|
||||
for (n = list_entry(pos->member.next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = n, n = list_entry(n->member.next, typeof(*n), member))
|
||||
|
||||
/**
|
||||
* list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
|
||||
* @pos: the type * to use as a loop cursor.
|
||||
* @n: another type * to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the list_struct within the struct.
|
||||
*
|
||||
* Iterate backwards over list of given type, safe against removal
|
||||
* of list entry.
|
||||
*/
|
||||
#define list_for_each_entry_safe_reverse(pos, n, head, member) \
|
||||
for (pos = list_entry((head)->prev, typeof(*pos), member), \
|
||||
n = list_entry(pos->member.prev, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
|
||||
|
||||
/*
|
||||
* Double linked lists with a single pointer list head.
|
||||
* Mostly useful for hash tables where the two pointer list head is
|
||||
* too wasteful.
|
||||
* You lose the ability to access the tail in O(1).
|
||||
*/
|
||||
|
||||
struct hlist_head {
|
||||
struct hlist_node *first;
|
||||
};
|
||||
|
||||
struct hlist_node {
|
||||
struct hlist_node *next, **pprev;
|
||||
};
|
||||
|
||||
#define HLIST_HEAD_INIT { .first = NULL }
|
||||
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
|
||||
#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
|
||||
static UPNP_INLINE void INIT_HLIST_NODE(struct hlist_node *h)
|
||||
{
|
||||
h->next = NULL;
|
||||
h->pprev = NULL;
|
||||
}
|
||||
|
||||
static UPNP_INLINE int hlist_unhashed(const struct hlist_node *h)
|
||||
{
|
||||
return !h->pprev;
|
||||
}
|
||||
|
||||
static UPNP_INLINE int hlist_empty(const struct hlist_head *h)
|
||||
{
|
||||
return !h->first;
|
||||
}
|
||||
|
||||
static UPNP_INLINE void __hlist_del(struct hlist_node *n)
|
||||
{
|
||||
struct hlist_node *next = n->next;
|
||||
struct hlist_node **pprev = n->pprev;
|
||||
*pprev = next;
|
||||
if (next)
|
||||
next->pprev = pprev;
|
||||
}
|
||||
|
||||
static UPNP_INLINE void hlist_del(struct hlist_node *n)
|
||||
{
|
||||
__hlist_del(n);
|
||||
n->next = (struct hlist_node *)LIST_POISON1;
|
||||
n->pprev = (struct hlist_node **)LIST_POISON2;
|
||||
}
|
||||
|
||||
static UPNP_INLINE void hlist_del_init(struct hlist_node *n)
|
||||
{
|
||||
if (!hlist_unhashed(n)) {
|
||||
__hlist_del(n);
|
||||
INIT_HLIST_NODE(n);
|
||||
}
|
||||
}
|
||||
|
||||
static UPNP_INLINE void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
|
||||
{
|
||||
struct hlist_node *first = h->first;
|
||||
n->next = first;
|
||||
if (first)
|
||||
first->pprev = &n->next;
|
||||
h->first = n;
|
||||
n->pprev = &h->first;
|
||||
}
|
||||
|
||||
/* next must be != NULL */
|
||||
static UPNP_INLINE void hlist_add_before(struct hlist_node *n,
|
||||
struct hlist_node *next)
|
||||
{
|
||||
n->pprev = next->pprev;
|
||||
n->next = next;
|
||||
next->pprev = &n->next;
|
||||
*(n->pprev) = n;
|
||||
}
|
||||
|
||||
static UPNP_INLINE void hlist_add_after(struct hlist_node *n,
|
||||
struct hlist_node *next)
|
||||
{
|
||||
next->next = n->next;
|
||||
n->next = next;
|
||||
next->pprev = &n->next;
|
||||
|
||||
if(next->next)
|
||||
next->next->pprev = &next->next;
|
||||
}
|
||||
|
||||
/*
|
||||
* Move a list from one list head to another. Fixup the pprev
|
||||
* reference of the first entry if it exists.
|
||||
*/
|
||||
static UPNP_INLINE void hlist_move_list(struct hlist_head *old,
|
||||
struct hlist_head *new_)
|
||||
{
|
||||
new_->first = old->first;
|
||||
if (new_->first)
|
||||
new_->first->pprev = &new_->first;
|
||||
old->first = NULL;
|
||||
}
|
||||
|
||||
#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
|
||||
|
||||
#define hlist_for_each(pos, head) \
|
||||
for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
|
||||
pos = pos->next)
|
||||
|
||||
#define hlist_for_each_safe(pos, n, head) \
|
||||
for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
|
||||
pos = n)
|
||||
|
||||
/**
|
||||
* hlist_for_each_entry - iterate over list of given type
|
||||
* @tpos: the type * to use as a loop cursor.
|
||||
* @pos: the &struct hlist_node to use as a loop cursor.
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the hlist_node within the struct.
|
||||
*/
|
||||
#define hlist_for_each_entry(tpos, pos, head, member) \
|
||||
for (pos = (head)->first; \
|
||||
pos && ({ prefetch(pos->next); 1;}) && \
|
||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
|
||||
pos = pos->next)
|
||||
|
||||
/**
|
||||
* hlist_for_each_entry_continue - iterate over a hlist continuing after current point
|
||||
* @tpos: the type * to use as a loop cursor.
|
||||
* @pos: the &struct hlist_node to use as a loop cursor.
|
||||
* @member: the name of the hlist_node within the struct.
|
||||
*/
|
||||
#define hlist_for_each_entry_continue(tpos, pos, member) \
|
||||
for (pos = (pos)->next; \
|
||||
pos && ({ prefetch(pos->next); 1;}) && \
|
||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
|
||||
pos = pos->next)
|
||||
|
||||
/**
|
||||
* hlist_for_each_entry_from - iterate over a hlist continuing from current point
|
||||
* @tpos: the type * to use as a loop cursor.
|
||||
* @pos: the &struct hlist_node to use as a loop cursor.
|
||||
* @member: the name of the hlist_node within the struct.
|
||||
*/
|
||||
#define hlist_for_each_entry_from(tpos, pos, member) \
|
||||
for (; pos && ({ prefetch(pos->next); 1;}) && \
|
||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
|
||||
pos = pos->next)
|
||||
|
||||
/**
|
||||
* hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
|
||||
* @tpos: the type * to use as a loop cursor.
|
||||
* @pos: the &struct hlist_node to use as a loop cursor.
|
||||
* @n: another &struct hlist_node to use as temporary storage
|
||||
* @head: the head for your list.
|
||||
* @member: the name of the hlist_node within the struct.
|
||||
*/
|
||||
#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
|
||||
for (pos = (head)->first; \
|
||||
pos && ({ n = pos->next; 1; }) && \
|
||||
({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
|
||||
pos = n)
|
||||
|
||||
#endif
|
@ -1,89 +0,0 @@
|
||||
#ifndef _LINUX_POISON_H
|
||||
#define _LINUX_POISON_H
|
||||
|
||||
/********** include/linux/list.h **********/
|
||||
|
||||
/*
|
||||
* Architectures might want to move the poison pointer offset
|
||||
* into some well-recognized area such as 0xdead000000000000,
|
||||
* that is also not mappable by user-space exploits:
|
||||
*/
|
||||
#ifdef CONFIG_ILLEGAL_POINTER_VALUE
|
||||
# define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL)
|
||||
#else
|
||||
# define POISON_POINTER_DELTA 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These are non-NULL pointers that will result in page faults
|
||||
* under normal circumstances, used to verify that nobody uses
|
||||
* non-initialized list entries.
|
||||
*/
|
||||
#define LIST_POISON1 ((void *) (0x00100100 + POISON_POINTER_DELTA))
|
||||
#define LIST_POISON2 ((void *) (0x00200200 + POISON_POINTER_DELTA))
|
||||
|
||||
/********** include/linux/timer.h **********/
|
||||
/*
|
||||
* Magic number "tsta" to indicate a static timer initializer
|
||||
* for the object debugging code.
|
||||
*/
|
||||
#define TIMER_ENTRY_STATIC ((void *) 0x74737461)
|
||||
|
||||
/********** mm/debug-pagealloc.c **********/
|
||||
#define PAGE_POISON 0xaa
|
||||
|
||||
/********** mm/slab.c **********/
|
||||
/*
|
||||
* Magic nums for obj red zoning.
|
||||
* Placed in the first word before and the first word after an obj.
|
||||
*/
|
||||
#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */
|
||||
#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */
|
||||
|
||||
#define SLUB_RED_INACTIVE 0xbb
|
||||
#define SLUB_RED_ACTIVE 0xcc
|
||||
|
||||
/* ...and for poisoning */
|
||||
#define POISON_INUSE 0x5a /* for use-uninitialised poisoning */
|
||||
#define POISON_FREE 0x6b /* for use-after-free poisoning */
|
||||
#define POISON_END 0xa5 /* end-byte of poisoning */
|
||||
|
||||
/********** arch/$ARCH/mm/init.c **********/
|
||||
#define POISON_FREE_INITMEM 0xcc
|
||||
|
||||
/********** arch/ia64/hp/common/sba_iommu.c **********/
|
||||
/*
|
||||
* arch/ia64/hp/common/sba_iommu.c uses a 16-byte poison string with a
|
||||
* value of "SBAIOMMU POISON\0" for spill-over poisoning.
|
||||
*/
|
||||
|
||||
/********** fs/jbd/journal.c **********/
|
||||
#define JBD_POISON_FREE 0x5b
|
||||
#define JBD2_POISON_FREE 0x5c
|
||||
|
||||
/********** drivers/base/dmapool.c **********/
|
||||
#define POOL_POISON_FREED 0xa7 /* !inuse */
|
||||
#define POOL_POISON_ALLOCATED 0xa9 /* !initted */
|
||||
|
||||
/********** drivers/atm/ **********/
|
||||
#define ATM_POISON_FREE 0x12
|
||||
#define ATM_POISON 0xdeadbeef
|
||||
|
||||
/********** net/ **********/
|
||||
#define NEIGHBOR_DEAD 0xdeadbeef
|
||||
#define NETFILTER_LINK_POISON 0xdead57ac
|
||||
|
||||
/********** kernel/mutexes **********/
|
||||
#define MUTEX_DEBUG_INIT 0x11
|
||||
#define MUTEX_DEBUG_FREE 0x22
|
||||
|
||||
/********** lib/flex_array.c **********/
|
||||
#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */
|
||||
|
||||
/********** security/ **********/
|
||||
#define KEY_DESTROY 0xbd
|
||||
|
||||
/********** sound/oss/ **********/
|
||||
#define OSS_POISON_FREE 0xAB
|
||||
|
||||
#endif
|
704
upnp/inc/upnp.h
704
upnp/inc/upnp.h
@ -61,10 +61,6 @@
|
||||
/* Other systems ??? */
|
||||
#endif
|
||||
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
#define LINE_SIZE (size_t)180
|
||||
#define NAME_SIZE (size_t)256
|
||||
#define MNFT_NAME_SIZE 64
|
||||
@ -384,6 +380,7 @@
|
||||
|
||||
/* @} ErrorCodes */
|
||||
|
||||
#if UPNP_VERSION >= 10800
|
||||
/*
|
||||
* Opaque data structures. The following includes are data structures that
|
||||
* must be externally visible. Since version 1.8.0, only an opaque typedef
|
||||
@ -403,6 +400,7 @@
|
||||
#include "StateVarComplete.h"
|
||||
#include "StateVarRequest.h"
|
||||
#include "SubscriptionRequest.h"
|
||||
#endif /* UPNP_VERSION >= 10800 */
|
||||
|
||||
/*!
|
||||
* \name Constants and Types
|
||||
@ -435,6 +433,117 @@ typedef int UpnpClient_Handle;
|
||||
*/
|
||||
typedef int UpnpDevice_Handle;
|
||||
|
||||
/*!
|
||||
* \brief The reason code for an event callback.
|
||||
*
|
||||
* The \b Event parameter will be different depending on the reason for the
|
||||
* callback. The descriptions for each event type describe the contents of the
|
||||
* \b Event parameter.
|
||||
*/
|
||||
enum Upnp_EventType_e {
|
||||
/*
|
||||
* Control callbacks
|
||||
*/
|
||||
|
||||
/*! Received by a device when a control point issues a control
|
||||
* request. The \b Event parameter contains a pointer to a \b
|
||||
* UpnpActionRequest structure containing the action. The application
|
||||
* stores the results of the action in this structure. */
|
||||
UPNP_CONTROL_ACTION_REQUEST,
|
||||
|
||||
/*! A \b UpnpSendActionAsync call completed. The \b Event
|
||||
* parameter contains a pointer to a \b UpnpActionComplete structure
|
||||
* with the results of the action. */
|
||||
UPNP_CONTROL_ACTION_COMPLETE,
|
||||
|
||||
/*! Received by a device when a query for a single service variable
|
||||
* arrives. The \b Event parameter contains a pointer to a \b
|
||||
* UpnpStateVarRequest structure containing the name of the variable
|
||||
* and value. */
|
||||
UPNP_CONTROL_GET_VAR_REQUEST,
|
||||
|
||||
/*! A \b UpnpGetServiceVarStatus call completed. The \b Event
|
||||
* parameter contains a pointer to a \b UpnpStateVarComplete structure
|
||||
* containing the value for the variable. */
|
||||
UPNP_CONTROL_GET_VAR_COMPLETE,
|
||||
|
||||
/*
|
||||
* Discovery callbacks
|
||||
*/
|
||||
|
||||
/*! Received by a control point when a new device or service is available.
|
||||
* The \b Event parameter contains a pointer to a \b
|
||||
* UpnpDiscovery structure with the information about the device
|
||||
* or service. */
|
||||
UPNP_DISCOVERY_ADVERTISEMENT_ALIVE,
|
||||
|
||||
/*! Received by a control point when a device or service shuts down. The \b
|
||||
* Event parameter contains a pointer to a \b UpnpDiscovery
|
||||
* structure containing the information about the device or
|
||||
* service. */
|
||||
UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE,
|
||||
|
||||
/*! Received by a control point when a matching device or service responds.
|
||||
* The \b Event parameter contains a pointer to a \b
|
||||
* UpnpDiscovery structure containing the information about
|
||||
* the reply to the search request. */
|
||||
UPNP_DISCOVERY_SEARCH_RESULT,
|
||||
|
||||
/*! Received by a control point when the search timeout expires. The
|
||||
* SDK generates no more callbacks for this search after this
|
||||
* event. The \b Event parameter is \c NULL. */
|
||||
UPNP_DISCOVERY_SEARCH_TIMEOUT,
|
||||
|
||||
/*
|
||||
* Eventing callbacks
|
||||
*/
|
||||
|
||||
/*! Received by a device when a subscription arrives.
|
||||
* The \b Event parameter contains a pointer to a \b
|
||||
* UpnpSubscriptionRequest structure. At this point, the
|
||||
* subscription has already been accepted. \b UpnpAcceptSubscription
|
||||
* needs to be called to confirm the subscription and transmit the
|
||||
* initial state table. This can be done during this callback. The SDK
|
||||
* generates no events for a subscription unless the device
|
||||
* application calls \b UpnpAcceptSubscription.
|
||||
*/
|
||||
UPNP_EVENT_SUBSCRIPTION_REQUEST,
|
||||
|
||||
/*! Received by a control point when an event arrives. The \b
|
||||
* Event parameter contains a \b UpnpEvent structure
|
||||
* with the information about the event. */
|
||||
UPNP_EVENT_RECEIVED,
|
||||
|
||||
/*! A \b UpnpRenewSubscriptionAsync call completed. The status of
|
||||
* the renewal is in the \b Event parameter as a \b
|
||||
* Upnp_Event_Subscription structure. */
|
||||
UPNP_EVENT_RENEWAL_COMPLETE,
|
||||
|
||||
/*! A \b UpnpSubscribeAsync call completed. The status of the
|
||||
* subscription is in the \b Event parameter as a \b
|
||||
* Upnp_Event_Subscription structure. */
|
||||
UPNP_EVENT_SUBSCRIBE_COMPLETE,
|
||||
|
||||
/*! A \b UpnpUnSubscribeAsync call completed. The status of the
|
||||
* subscription is in the \b Event parameter as a \b
|
||||
* UpnpEventSubscribe structure. */
|
||||
UPNP_EVENT_UNSUBSCRIBE_COMPLETE,
|
||||
|
||||
/*! The auto-renewal of a client subscription failed.
|
||||
* The \b Event parameter is a \b UpnpEventSubscribe structure
|
||||
* with the error code set appropriately. The subscription is no longer
|
||||
* valid. */
|
||||
UPNP_EVENT_AUTORENEWAL_FAILED,
|
||||
|
||||
/*! A client subscription has expired. This will only occur
|
||||
* if auto-renewal of subscriptions is disabled.
|
||||
* The \b Event parameter is a \b UpnpEventSubscribe
|
||||
* structure. The subscription is no longer valid. */
|
||||
UPNP_EVENT_SUBSCRIPTION_EXPIRED
|
||||
};
|
||||
|
||||
typedef enum Upnp_EventType_e Upnp_EventType;
|
||||
|
||||
/*!
|
||||
* \brief Holds the subscription identifier for a subscription between a
|
||||
* client and a device.
|
||||
@ -490,7 +599,264 @@ enum Upnp_DescType_e {
|
||||
|
||||
typedef enum Upnp_DescType_e Upnp_DescType;
|
||||
|
||||
#include "Callback.h"
|
||||
#if UPNP_VERSION < 10800
|
||||
/** Returned as part of a {\bf UPNP_CONTROL_ACTION_COMPLETE} callback. */
|
||||
|
||||
struct Upnp_Action_Request
|
||||
{
|
||||
/** The result of the operation. */
|
||||
int ErrCode;
|
||||
|
||||
/** The socket number of the connection to the requestor. */
|
||||
int Socket;
|
||||
|
||||
/** The error string in case of error. */
|
||||
char ErrStr[LINE_SIZE];
|
||||
|
||||
/** The Action Name. */
|
||||
char ActionName[NAME_SIZE];
|
||||
|
||||
/** The unique device ID. */
|
||||
char DevUDN[NAME_SIZE];
|
||||
|
||||
/** The service ID. */
|
||||
char ServiceID[NAME_SIZE];
|
||||
|
||||
/** The DOM document describing the action. */
|
||||
IXML_Document *ActionRequest;
|
||||
|
||||
/** The DOM document describing the result of the action. */
|
||||
IXML_Document *ActionResult;
|
||||
|
||||
/** IP address of the control point requesting this action. */
|
||||
struct sockaddr_storage CtrlPtIPAddr;
|
||||
|
||||
/** The DOM document containing the information from the
|
||||
the SOAP header. */
|
||||
IXML_Document *SoapHeader;
|
||||
};
|
||||
|
||||
struct Upnp_Action_Complete
|
||||
{
|
||||
/** The result of the operation. */
|
||||
int ErrCode;
|
||||
|
||||
/** The control URL for service. */
|
||||
char CtrlUrl[NAME_SIZE];
|
||||
|
||||
/** The DOM document describing the action. */
|
||||
IXML_Document *ActionRequest;
|
||||
|
||||
/** The DOM document describing the result of the action. */
|
||||
IXML_Document *ActionResult;
|
||||
|
||||
};
|
||||
|
||||
/** Represents the request for current value of a state variable in a service
|
||||
* state table. */
|
||||
|
||||
struct Upnp_State_Var_Request
|
||||
{
|
||||
/** The result of the operation. */
|
||||
int ErrCode;
|
||||
|
||||
/** The socket number of the connection to the requestor. */
|
||||
int Socket;
|
||||
|
||||
/** The error string in case of error. */
|
||||
char ErrStr[LINE_SIZE];
|
||||
|
||||
/** The unique device ID. */
|
||||
char DevUDN[NAME_SIZE];
|
||||
|
||||
/** The service ID. */
|
||||
char ServiceID[NAME_SIZE];
|
||||
|
||||
/** The name of the variable. */
|
||||
char StateVarName[NAME_SIZE];
|
||||
|
||||
/** IP address of sender requesting the state variable. */
|
||||
struct sockaddr_storage CtrlPtIPAddr;
|
||||
|
||||
/** The current value of the variable. This needs to be allocated by
|
||||
* the caller. When finished with it, the SDK frees this {\bf DOMString}. */
|
||||
DOMString CurrentVal;
|
||||
};
|
||||
|
||||
/** Represents the reply for the current value of a state variable in an
|
||||
asynchronous call. */
|
||||
|
||||
struct Upnp_State_Var_Complete
|
||||
{
|
||||
/** The result of the operation. */
|
||||
int ErrCode;
|
||||
|
||||
/** The control URL for the service. */
|
||||
char CtrlUrl[NAME_SIZE];
|
||||
|
||||
/** The name of the variable. */
|
||||
char StateVarName[NAME_SIZE];
|
||||
|
||||
/** The current value of the variable or error string in case of error. */
|
||||
DOMString CurrentVal;
|
||||
};
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_RECEIVED} callback. */
|
||||
|
||||
struct Upnp_Event
|
||||
{
|
||||
/** The subscription ID for this subscription. */
|
||||
Upnp_SID Sid;
|
||||
|
||||
/** The event sequence number. */
|
||||
int EventKey;
|
||||
|
||||
/** The DOM tree representing the changes generating the event. */
|
||||
IXML_Document *ChangedVariables;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* This typedef is required by Doc++ to parse the last entry of the
|
||||
* Upnp_Discovery structure correctly.
|
||||
*/
|
||||
|
||||
|
||||
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
|
||||
struct Upnp_Discovery
|
||||
{
|
||||
/** The result code of the {\bf UpnpSearchAsync} call. */
|
||||
int ErrCode;
|
||||
|
||||
/** The expiration time of the advertisement. */
|
||||
int Expires;
|
||||
|
||||
/** The unique device identifier. */
|
||||
char DeviceId[LINE_SIZE];
|
||||
|
||||
/** The device type. */
|
||||
char DeviceType[LINE_SIZE];
|
||||
|
||||
/** The service type. */
|
||||
char ServiceType[LINE_SIZE];
|
||||
|
||||
/** The service version. */
|
||||
char ServiceVer[LINE_SIZE];
|
||||
|
||||
/** The URL to the UPnP description document for the device. */
|
||||
char Location[LINE_SIZE];
|
||||
|
||||
/** The operating system the device is running. */
|
||||
char Os[LINE_SIZE];
|
||||
|
||||
/** Date when the response was generated. */
|
||||
char Date[LINE_SIZE];
|
||||
|
||||
/** Confirmation that the MAN header was understood by the device. */
|
||||
char Ext[LINE_SIZE];
|
||||
|
||||
/** The host address of the device responding to the search. */
|
||||
struct sockaddr_storage DestAddr;
|
||||
};
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf
|
||||
* UPNP_EVENT_UNSUBSCRIBE_COMPLETE} callback. */
|
||||
|
||||
struct Upnp_Event_Subscribe {
|
||||
|
||||
/** The SID for this subscription. For subscriptions, this only
|
||||
* contains a valid SID if the {\bf Upnp_EventSubscribe.result} field
|
||||
* contains a {\tt UPNP_E_SUCCESS} result code. For unsubscriptions,
|
||||
* this contains the SID from which the subscription is being
|
||||
* unsubscribed. */
|
||||
|
||||
Upnp_SID Sid;
|
||||
|
||||
/** The result of the operation. */
|
||||
int ErrCode;
|
||||
|
||||
/** The event URL being subscribed to or removed from. */
|
||||
char PublisherUrl[NAME_SIZE];
|
||||
|
||||
/** The actual subscription time (for subscriptions only). */
|
||||
int TimeOut;
|
||||
|
||||
};
|
||||
|
||||
/** Returned along with a {\bf UPNP_EVENT_SUBSCRIPTION_REQUEST}
|
||||
* callback. */
|
||||
|
||||
struct Upnp_Subscription_Request
|
||||
{
|
||||
/** The identifier for the service being subscribed to. */
|
||||
char *ServiceId;
|
||||
|
||||
/** Universal device name. */
|
||||
char *UDN;
|
||||
|
||||
/** The assigned subscription ID for this subscription. */
|
||||
Upnp_SID Sid;
|
||||
|
||||
};
|
||||
|
||||
struct File_Info
|
||||
{
|
||||
/** The length of the file. A length less than 0 indicates the size
|
||||
* is unknown, and data will be sent until 0 bytes are returned from
|
||||
* a read call. */
|
||||
off_t file_length;
|
||||
|
||||
/** The time at which the contents of the file was modified;
|
||||
* The time system is always local (not GMT). */
|
||||
time_t last_modified;
|
||||
|
||||
/** If the file is a directory, {\bf is_directory} contains
|
||||
* a non-zero value. For a regular file, it should be 0. */
|
||||
int is_directory;
|
||||
|
||||
/** If the file or directory is readable, this contains
|
||||
* a non-zero value. If unreadable, it should be set to 0. */
|
||||
int is_readable;
|
||||
|
||||
/** The content type of the file. This string needs to be allocated
|
||||
* by the caller using {\bf ixmlCloneDOMString}. When finished
|
||||
* with it, the SDK frees the {\bf DOMString}. */
|
||||
DOMString content_type;
|
||||
};
|
||||
#endif /* UPNP_VERSION < 10800 */
|
||||
|
||||
/*!
|
||||
* All callback functions share the same prototype, documented below.
|
||||
* Note that any memory passed to the callback function
|
||||
* is valid only during the callback and should be copied if it
|
||||
* needs to persist. This callback function needs to be thread
|
||||
* safe. The context of the callback is always on a valid thread
|
||||
* context and standard synchronization methods can be used. Note,
|
||||
* however, because of this the callback cannot call SDK functions
|
||||
* unless explicitly noted.
|
||||
*
|
||||
* \verbatim
|
||||
int CallbackFxn(Upnp_EventType EventType, void *Event, void *Cookie);
|
||||
\endverbatim
|
||||
*
|
||||
* where \b EventType is the event that triggered the callback,
|
||||
* \b Event is a structure that denotes event-specific information for that
|
||||
* event, and \b Cookie is the user data passed when the callback was
|
||||
* registered.
|
||||
*
|
||||
* See \b Upnp_EventType for more information on the callback values and
|
||||
* the associated \b Event parameter.
|
||||
*
|
||||
* The return value of the callback is currently ignored. It may be used
|
||||
* in the future to communicate results back to the SDK.
|
||||
*/
|
||||
typedef int (*Upnp_FunPtr)(
|
||||
/*! [in] .*/
|
||||
Upnp_EventType EventType,
|
||||
/*! [in] .*/
|
||||
void *Event,
|
||||
/*! [in] .*/
|
||||
void *Cookie);
|
||||
|
||||
/* @} Constants and Types */
|
||||
|
||||
@ -588,29 +954,6 @@ EXPORT_SPEC int UpnpInit2(
|
||||
unsigned short DestPort);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Initializes the OpenSSL library, and the OpenSSL context for use
|
||||
* with pupnp
|
||||
*
|
||||
* \note This method is only enabled if pupnp is compiled with open-ssl support.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INIT: The SDK is already initialized.
|
||||
* \li \c UPNP_E_INIT_FAILED: The SDK initialization
|
||||
* failed for an unknown reason.
|
||||
*/
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
EXPORT_SPEC int UpnpInitSslContext(
|
||||
/*! If set to 1 initializes the OpenSSL library. Otherwise the application
|
||||
* is responsible for initializing it. If set to 1, then OpenSSL is intialized
|
||||
* with all error strings, and all ciphers loaded. */
|
||||
int initOpenSslLib,
|
||||
/*! The SSL_METHOD to use to create the context. See OpenSSL docs
|
||||
* for more info */
|
||||
const SSL_METHOD *sslMethod);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Terminates the Linux SDK for UPnP Devices.
|
||||
*
|
||||
@ -1492,7 +1835,7 @@ EXPORT_SPEC int UpnpAcceptSubscriptionExt(
|
||||
* Plug and Play Device Architecture specification. */
|
||||
IXML_Document *PropSet,
|
||||
/*! [in] The subscription ID of the newly registered control point. */
|
||||
const Upnp_SID SubsId);
|
||||
Upnp_SID SubsId);
|
||||
|
||||
/*!
|
||||
* \brief Sends out an event change notification to all control points
|
||||
@ -1912,19 +2255,6 @@ EXPORT_SPEC int UpnpUnSubscribeAsync(
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Different HTTP methods.
|
||||
*/
|
||||
enum Upnp_HttpMethod_e {
|
||||
UPNP_HTTPMETHOD_PUT = 0,
|
||||
UPNP_HTTPMETHOD_DELETE = 1,
|
||||
UPNP_HTTPMETHOD_GET = 2,
|
||||
UPNP_HTTPMETHOD_HEAD = 3,
|
||||
UPNP_HTTPMETHOD_POST = 4
|
||||
};
|
||||
|
||||
typedef enum Upnp_HttpMethod_e Upnp_HttpMethod;
|
||||
|
||||
/*!
|
||||
* \brief Downloads a file specified in a URL.
|
||||
*
|
||||
@ -1966,12 +2296,10 @@ EXPORT_SPEC int UpnpDownloadUrlItem(
|
||||
* The SDK allocates the memory for \b handle and \b contentType, the
|
||||
* application is responsible for freeing this memory.
|
||||
*
|
||||
* \note Memory for \b contentType is freed when freeing the memory
|
||||
* for handle.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle,
|
||||
* \b contentType, \b contentLength or \b httpStatus
|
||||
* is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
@ -2003,7 +2331,7 @@ EXPORT_SPEC int UpnpOpenHttpGet(
|
||||
int *httpStatus,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the server, failing which, an error is reported
|
||||
* back to the user. If value is negative, timeout is infinite. */
|
||||
* back to the user. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
@ -2012,12 +2340,10 @@ EXPORT_SPEC int UpnpOpenHttpGet(
|
||||
* The SDK allocates the memory for \b handle and \b contentType, the
|
||||
* application is responsible for freeing this memory.
|
||||
*
|
||||
* \note Memory for \b contentType is freed when freeing the memory
|
||||
* for handle.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle,
|
||||
* \b contentType, \b contentLength or \b httpStatus
|
||||
* is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
@ -2051,7 +2377,7 @@ EXPORT_SPEC int UpnpOpenHttpGetProxy(
|
||||
int *httpStatus,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the server, failing which, an error is reported
|
||||
* back to the user. If value is negative, timeout is infinite. */
|
||||
* back to the user. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
@ -2101,7 +2427,7 @@ EXPORT_SPEC int UpnpOpenHttpGetEx(
|
||||
int highRange,
|
||||
/*! [in] A time out value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported back
|
||||
* to the user. If value is negative, timeout is infinite. */
|
||||
* to the user. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
@ -2130,7 +2456,7 @@ EXPORT_SPEC int UpnpReadHttpGet(
|
||||
size_t *size,
|
||||
/*! [in] The time out value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported back to
|
||||
* the user. If value is negative, timeout is infinite. */
|
||||
* the user. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
@ -2179,7 +2505,7 @@ EXPORT_SPEC int UpnpCloseHttpGet(
|
||||
* and sends the POST request to the server if the connection to the server
|
||||
* succeeds.
|
||||
*
|
||||
* The SDK allocates the memory for \b handle, the
|
||||
* The SDK allocates the memory for \b handle and \b contentType, the
|
||||
* application is responsible for freeing this memory.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
@ -2205,13 +2531,12 @@ EXPORT_SPEC int UpnpOpenHttpPost(
|
||||
/*! [in,out] A pointer in which to store the handle for this connection. This
|
||||
* handle is required for futher operations over this connection. */
|
||||
void **handle,
|
||||
/*! [in] A buffer to store the media type of content being sent. Can be NULL. */
|
||||
/*! [in] A buffer to store the media type of content being sent. */
|
||||
const char *contentType,
|
||||
/*! [in] The length of the content, in bytes, being posted. */
|
||||
int contentLength,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
* is expected from the receiver, failing which, an error is reported. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
@ -2236,8 +2561,7 @@ EXPORT_SPEC int UpnpWriteHttpPost(
|
||||
/*! [in] The size, in bytes of \b buf. */
|
||||
size_t *size,
|
||||
/*! [in] A timeout value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported. If
|
||||
* value is negative, timeout is infinite. */
|
||||
* expected from the server, failing which, an error is reported. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
@ -2260,238 +2584,9 @@ EXPORT_SPEC int UpnpCloseHttpPost(
|
||||
/*! [in,out] A pointer to a buffer to store the final status of the connection. */
|
||||
int *httpStatus,
|
||||
/*! [in] A time out value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported. If
|
||||
* value is negative, timeout is infinite. */
|
||||
* expected from the server, failing which, an error is reported. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Opens a connection to the server.
|
||||
*
|
||||
* The SDK allocates the memory for \b handle, the
|
||||
* application is responsible for freeing this memory.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b url, or \b handle
|
||||
* is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
|
||||
* resources or an error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpOpenHttpConnection(
|
||||
/*! [in] The URL which contains the host, and the scheme to make the connection. */
|
||||
const char *url,
|
||||
/*! [in,out] A pointer in which to store the handle for this connection. This
|
||||
* handle is required for futher operations over this connection. */
|
||||
void **handle,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Makes a HTTP request using a connection previously created by
|
||||
* \b UpnpOpenHttpConnection.
|
||||
*
|
||||
* \note Trying to make another request while a request is already being processed
|
||||
* results in undefined behavior. It's up to the user to end a previous
|
||||
* request by calling \b UpnpEndHttpRequest.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle
|
||||
* or \b contentType is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
|
||||
* resources or an error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpMakeHttpRequest(
|
||||
/* ![in] The method to use to make the request. */
|
||||
Upnp_HttpMethod method,
|
||||
/*! [in] The URL to use to make the request. The URL should use the same
|
||||
* scheme used to create the connection, but the host can be different
|
||||
* if the request is being proxied. */
|
||||
const char *url,
|
||||
/*! [in] The handle to the connection. */
|
||||
void *handle,
|
||||
/*! [in] Headers to be used for the request. Each header should be terminated by a CRLF as specified
|
||||
* in the HTTP specification. If NULL then the default headers will be used. */
|
||||
UpnpString *headers,
|
||||
/*! [in] The media type of content being sent. Can be NULL. */
|
||||
const char *contentType,
|
||||
/*! [in] The length of the content being sent, in bytes. Set to \b UPNP_USING_CHUNKED to use
|
||||
* chunked encoding, or \b UPNP_UNTIL_CLOSE to avoid specifying the content length to the server.
|
||||
* In this case the request is considered unfinished until the connection is closed. */
|
||||
int contentLength,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Writes the content of a HTTP request initiated by a \b UpnpMakeHttpRequest call.
|
||||
* The end of the content should be indicated by a call to \b UpnpEndHttpRequest
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
|
||||
* or \b size is not a valid pointer.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpWriteHttpRequest(
|
||||
/*! [in] The handle of the connection created by the call to
|
||||
* \b UpnpOpenHttpConnection. */
|
||||
void *handle,
|
||||
/*! [in] The buffer containing date to be written. */
|
||||
char *buf,
|
||||
/*! [in] The size, in bytes of \b buf. */
|
||||
size_t *size,
|
||||
/*! [in] A timeout value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported. If
|
||||
* value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Indicates the end of a HTTP request previously made by
|
||||
* \b UpnpMakeHttpRequest.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
|
||||
* resources or an error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpEndHttpRequest(
|
||||
/*! [in] The handle to the connection. */
|
||||
void *handle,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Gets the response from the server using a connection previously created
|
||||
* by \b UpnpOpenHttpConnection
|
||||
*
|
||||
* \note Memory for \b contentType is only valid until the next call to the HTTP API
|
||||
* for the same connection.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b handle,
|
||||
* is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_NETWORK_ERROR: A network error occurred.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
|
||||
* from a socket.
|
||||
* \li \c UPNP_E_SOCKET_BIND: An error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
|
||||
* remote server.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpGetHttpResponse(
|
||||
/*! [in] The handle of the connection created by the call to
|
||||
* \b UpnpOpenHttpConnection. */
|
||||
void *handle,
|
||||
/*! [in] Headers sent by the server for the response. If NULL then the
|
||||
* headers are not copied. */
|
||||
UpnpString *headers,
|
||||
/*! [out] A buffer to store the media type of the item. */
|
||||
char **contentType,
|
||||
/*! [out] A pointer to store the length of the item. */
|
||||
int *contentLength,
|
||||
/*! [out] The status returned on receiving a response message. */
|
||||
int *httpStatus,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the server, failing which, an error is reported
|
||||
* back to the user. If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Reads the content of a response using a connection previously created
|
||||
* by \b UpnpOpenHttpConnection.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
|
||||
* or \b size is not a valid pointer.
|
||||
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
|
||||
* remote server.
|
||||
* \li \c UPNP_E_BAD_HTTPMSG: Either the request or response was in
|
||||
* the incorrect format.
|
||||
* \li \c UPNP_E_CANCELED: another thread called UpnpCancelHttpGet.
|
||||
*
|
||||
* Note: In case of return values, the status code parameter of the passed
|
||||
* in handle value may provide additional information on the return
|
||||
* value.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpReadHttpResponse(
|
||||
/*! [in] The handle of the connection created by the call to
|
||||
* \b UpnpOpenHttpConnection. */
|
||||
void *handle,
|
||||
/*! [in,out] The buffer to store the read item. */
|
||||
char *buf,
|
||||
/*! [in,out] The size of the buffer to be read. */
|
||||
size_t *size,
|
||||
/*! [in] The time out value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported back to
|
||||
* the user. If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
/*!
|
||||
* \brief Closes the connection created with \b UpnpOpenHttpConnection
|
||||
* and frees any memory associated with the connection.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: \b handle, or is not a valid pointer.
|
||||
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
|
||||
* from a socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpCloseHttpConnection(
|
||||
/*! [in] The handle of the connection to close, created by the call to
|
||||
* \b UpnpOpenHttpPost. */
|
||||
void *handle);
|
||||
|
||||
/*!
|
||||
* \brief Downloads an XML document specified in a URL.
|
||||
*
|
||||
@ -2573,7 +2668,12 @@ typedef int (*VDCallback_GetInfo)(
|
||||
/*! [in] The name of the file to query. */
|
||||
const char *filename,
|
||||
/*! [out] Pointer to a structure to store the information on the file. */
|
||||
UpnpFileInfo *info);
|
||||
#if UPNP_VERSION < 10800
|
||||
struct File_Info *info
|
||||
#else
|
||||
UpnpFileInfo *info
|
||||
#endif /* UPNP_VERSION < 10800 */
|
||||
);
|
||||
|
||||
/*!
|
||||
* \brief Sets the get_info callback function to be used to access a virtual
|
||||
@ -2690,6 +2790,21 @@ typedef int (*VDCallback_Close)(
|
||||
*/
|
||||
EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback);
|
||||
|
||||
/*!
|
||||
* \brief The {\bf UpnpVirtualDirCallbacks} structure contains the pointers to
|
||||
* file-related callback functions a device application can register to
|
||||
* virtualize URLs.
|
||||
*/
|
||||
struct UpnpVirtualDirCallbacks
|
||||
{
|
||||
VDCallback_GetInfo get_info;
|
||||
VDCallback_Open open;
|
||||
VDCallback_Read read;
|
||||
VDCallback_Write write;
|
||||
VDCallback_Seek seek;
|
||||
VDCallback_Close close;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Enables or disables the webserver.
|
||||
*
|
||||
@ -2710,6 +2825,17 @@ EXPORT_SPEC int UpnpEnableWebserver(
|
||||
*/
|
||||
EXPORT_SPEC int UpnpIsWebserverEnabled(void);
|
||||
|
||||
/*!
|
||||
* \brief Sets the callback functions to be used to access a virtual directory.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: one of the callbacks is not valid.
|
||||
*/
|
||||
EXPORT_SPEC int UpnpSetVirtualDirCallbacks(
|
||||
/*! [in] A structure that contains the callback functions. */
|
||||
struct UpnpVirtualDirCallbacks *callbacks );
|
||||
|
||||
/*!
|
||||
* \brief Adds a virtual directory mapping.
|
||||
*
|
||||
|
@ -131,9 +131,5 @@
|
||||
* header (i.e. configure --enable-unspecified_server) */
|
||||
#undef UPNP_ENABLE_UNSPECIFIED_SERVER
|
||||
|
||||
/** Defined to 1 if the library has been compiled with OpenSSL support
|
||||
* (i.e. configure --enable-open_ssl) */
|
||||
#undef UPNP_ENABLE_OPEN_SSL
|
||||
|
||||
#endif /* UPNP_CONFIG_H */
|
||||
|
||||
|
@ -314,7 +314,7 @@ void SampleUtil_PrintEventType(Upnp_EventType S)
|
||||
}
|
||||
}
|
||||
|
||||
int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
int SampleUtil_PrintEvent(Upnp_EventType EventType, void *Event)
|
||||
{
|
||||
ithread_mutex_lock(&display_mutex);
|
||||
|
||||
@ -327,28 +327,18 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
||||
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
SampleUtil_Print(
|
||||
"ErrCode = %d\n"
|
||||
"Expires = %d\n"
|
||||
"DeviceId = %s\n"
|
||||
"DeviceType = %s\n"
|
||||
"ServiceType = %s\n"
|
||||
"ServiceVer = %s\n"
|
||||
"Location = %s\n"
|
||||
"OS = %s\n"
|
||||
"Date = %s\n"
|
||||
"Ext = %s\n",
|
||||
UpnpDiscovery_get_ErrCode(d_event),
|
||||
UpnpDiscovery_get_Expires(d_event),
|
||||
UpnpString_get_String(UpnpDiscovery_get_DeviceID(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_DeviceType(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_ServiceType(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_ServiceVer(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_Location(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_Os(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_Date(d_event)),
|
||||
UpnpString_get_String(UpnpDiscovery_get_Ext(d_event)));
|
||||
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(d_event->ErrCode), d_event->ErrCode);
|
||||
SampleUtil_Print("Expires = %d\n", d_event->Expires);
|
||||
SampleUtil_Print("DeviceId = %s\n", d_event->DeviceId);
|
||||
SampleUtil_Print("DeviceType = %s\n", d_event->DeviceType);
|
||||
SampleUtil_Print("ServiceType = %s\n", d_event->ServiceType);
|
||||
SampleUtil_Print("ServiceVer = %s\n", d_event->ServiceVer);
|
||||
SampleUtil_Print("Location = %s\n", d_event->Location);
|
||||
SampleUtil_Print("OS = %s\n", d_event->Os);
|
||||
SampleUtil_Print("Ext = %s\n", d_event->Ext);
|
||||
break;
|
||||
}
|
||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||
@ -356,25 +346,18 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
break;
|
||||
/* SOAP */
|
||||
case UPNP_CONTROL_ACTION_REQUEST: {
|
||||
UpnpActionRequest *a_event = (UpnpActionRequest *)Event;
|
||||
IXML_Document *actionRequestDoc = NULL;
|
||||
IXML_Document *actionResultDoc = NULL;
|
||||
struct Upnp_Action_Request *a_event =
|
||||
(struct Upnp_Action_Request *)Event;
|
||||
char *xmlbuff = NULL;
|
||||
|
||||
SampleUtil_Print(
|
||||
"ErrCode = %d\n"
|
||||
"ErrStr = %s\n"
|
||||
"ActionName = %s\n"
|
||||
"UDN = %s\n"
|
||||
"ServiceID = %s\n",
|
||||
UpnpActionRequest_get_ErrCode(a_event),
|
||||
UpnpString_get_String(UpnpActionRequest_get_ErrStr(a_event)),
|
||||
UpnpString_get_String(UpnpActionRequest_get_ActionName(a_event)),
|
||||
UpnpString_get_String(UpnpActionRequest_get_DevUDN(a_event)),
|
||||
UpnpString_get_String(UpnpActionRequest_get_ServiceID(a_event)));
|
||||
actionRequestDoc = UpnpActionRequest_get_ActionRequest(a_event);
|
||||
if (actionRequestDoc) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)actionRequestDoc);
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(a_event->ErrCode), a_event->ErrCode);
|
||||
SampleUtil_Print("ErrStr = %s\n", a_event->ErrStr);
|
||||
SampleUtil_Print("ActionName = %s\n", a_event->ActionName);
|
||||
SampleUtil_Print("UDN = %s\n", a_event->DevUDN);
|
||||
SampleUtil_Print("ServiceID = %s\n", a_event->ServiceID);
|
||||
if (a_event->ActionRequest) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
|
||||
if (xmlbuff) {
|
||||
SampleUtil_Print("ActRequest = %s\n", xmlbuff);
|
||||
ixmlFreeDOMString(xmlbuff);
|
||||
@ -383,9 +366,8 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
} else {
|
||||
SampleUtil_Print("ActRequest = (null)\n");
|
||||
}
|
||||
actionResultDoc = UpnpActionRequest_get_ActionResult(a_event);
|
||||
if (actionResultDoc) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)actionResultDoc);
|
||||
if (a_event->ActionResult) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
|
||||
if (xmlbuff) {
|
||||
SampleUtil_Print("ActResult = %s\n", xmlbuff);
|
||||
ixmlFreeDOMString(xmlbuff);
|
||||
@ -397,22 +379,15 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
break;
|
||||
}
|
||||
case UPNP_CONTROL_ACTION_COMPLETE: {
|
||||
UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
|
||||
struct Upnp_Action_Complete *a_event =
|
||||
(struct Upnp_Action_Complete *)Event;
|
||||
char *xmlbuff = NULL;
|
||||
int errCode = UpnpActionComplete_get_ErrCode(a_event);
|
||||
const char *ctrlURL = UpnpString_get_String(
|
||||
UpnpActionComplete_get_CtrlUrl(a_event));
|
||||
IXML_Document *actionRequest =
|
||||
UpnpActionComplete_get_ActionRequest(a_event);
|
||||
IXML_Document *actionResult =
|
||||
UpnpActionComplete_get_ActionResult(a_event);
|
||||
|
||||
SampleUtil_Print(
|
||||
"ErrCode = %d\n"
|
||||
"CtrlUrl = %s\n",
|
||||
errCode, ctrlURL);
|
||||
if (actionRequest) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)actionRequest);
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(a_event->ErrCode), a_event->ErrCode);
|
||||
SampleUtil_Print("CtrlUrl = %s\n", a_event->CtrlUrl);
|
||||
if (a_event->ActionRequest) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
|
||||
if (xmlbuff) {
|
||||
SampleUtil_Print("ActRequest = %s\n", xmlbuff);
|
||||
ixmlFreeDOMString(xmlbuff);
|
||||
@ -421,8 +396,8 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
} else {
|
||||
SampleUtil_Print("ActRequest = (null)\n");
|
||||
}
|
||||
if (actionResult) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)actionResult);
|
||||
if (a_event->ActionResult) {
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
|
||||
if (xmlbuff) {
|
||||
SampleUtil_Print("ActResult = %s\n", xmlbuff);
|
||||
ixmlFreeDOMString(xmlbuff);
|
||||
@ -434,106 +409,83 @@ int SampleUtil_PrintEvent(Upnp_EventType EventType, const void *Event)
|
||||
break;
|
||||
}
|
||||
case UPNP_CONTROL_GET_VAR_REQUEST: {
|
||||
UpnpStateVarRequest *sv_event = (UpnpStateVarRequest *)Event;
|
||||
struct Upnp_State_Var_Request *sv_event =
|
||||
(struct Upnp_State_Var_Request *)Event;
|
||||
|
||||
SampleUtil_Print(
|
||||
"ErrCode = %d\n"
|
||||
"ErrStr = %s\n"
|
||||
"UDN = %s\n"
|
||||
"ServiceID = %s\n"
|
||||
"StateVarName= %s\n"
|
||||
"CurrentVal = %s\n",
|
||||
UpnpStateVarRequest_get_ErrCode(sv_event),
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_ErrStr(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(sv_event)),
|
||||
UpnpStateVarRequest_get_CurrentVal(sv_event));
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(sv_event->ErrCode), sv_event->ErrCode);
|
||||
SampleUtil_Print("ErrStr = %s\n", sv_event->ErrStr);
|
||||
SampleUtil_Print("UDN = %s\n", sv_event->DevUDN);
|
||||
SampleUtil_Print("ServiceID = %s\n", sv_event->ServiceID);
|
||||
SampleUtil_Print("StateVarName= %s\n", sv_event->StateVarName);
|
||||
SampleUtil_Print("CurrentVal = %s\n", sv_event->CurrentVal);
|
||||
break;
|
||||
}
|
||||
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
||||
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
|
||||
struct Upnp_State_Var_Complete *sv_event =
|
||||
(struct Upnp_State_Var_Complete *)Event;
|
||||
|
||||
SampleUtil_Print(
|
||||
"ErrCode = %d\n"
|
||||
"CtrlUrl = %s\n"
|
||||
"StateVarName= %s\n"
|
||||
"CurrentVal = %s\n",
|
||||
UpnpStateVarComplete_get_ErrCode(sv_event),
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
|
||||
UpnpStateVarComplete_get_CurrentVal(sv_event));
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(sv_event->ErrCode), sv_event->ErrCode);
|
||||
SampleUtil_Print("CtrlUrl = %s\n", sv_event->CtrlUrl);
|
||||
SampleUtil_Print("StateVarName= %s\n", sv_event->StateVarName);
|
||||
SampleUtil_Print("CurrentVal = %s\n", sv_event->CurrentVal);
|
||||
break;
|
||||
}
|
||||
/* GENA */
|
||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST: {
|
||||
UpnpSubscriptionRequest *sr_event = (UpnpSubscriptionRequest *)Event;
|
||||
struct Upnp_Subscription_Request *sr_event =
|
||||
(struct Upnp_Subscription_Request *)Event;
|
||||
|
||||
SampleUtil_Print(
|
||||
"ServiceID = %s\n"
|
||||
"UDN = %s\n"
|
||||
"SID = %s\n",
|
||||
UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(sr_event)),
|
||||
UpnpString_get_String(UpnpSubscriptionRequest_get_UDN(sr_event)),
|
||||
UpnpString_get_String(UpnpSubscriptionRequest_get_SID(sr_event)));
|
||||
SampleUtil_Print("ServiceID = %s\n", sr_event->ServiceId);
|
||||
SampleUtil_Print("UDN = %s\n", sr_event->UDN);
|
||||
SampleUtil_Print("SID = %s\n", sr_event->Sid);
|
||||
break;
|
||||
}
|
||||
case UPNP_EVENT_RECEIVED: {
|
||||
UpnpEvent *e_event = (UpnpEvent *)Event;
|
||||
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
|
||||
char *xmlbuff = NULL;
|
||||
|
||||
xmlbuff = ixmlPrintNode(
|
||||
(IXML_Node *)UpnpEvent_get_ChangedVariables(e_event));
|
||||
SampleUtil_Print(
|
||||
"SID = %s\n"
|
||||
"EventKey = %d\n"
|
||||
"ChangedVars = %s\n",
|
||||
UpnpString_get_String(UpnpEvent_get_SID(e_event)),
|
||||
UpnpEvent_get_EventKey(e_event),
|
||||
xmlbuff);
|
||||
SampleUtil_Print("SID = %s\n", e_event->Sid);
|
||||
SampleUtil_Print("EventKey = %d\n", e_event->EventKey);
|
||||
xmlbuff = ixmlPrintNode((IXML_Node *)e_event->ChangedVariables);
|
||||
SampleUtil_Print("ChangedVars = %s\n", xmlbuff);
|
||||
ixmlFreeDOMString(xmlbuff);
|
||||
xmlbuff = NULL;
|
||||
break;
|
||||
}
|
||||
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
(struct Upnp_Event_Subscribe *)Event;
|
||||
|
||||
SampleUtil_Print(
|
||||
"SID = %s\n"
|
||||
"ErrCode = %d\n"
|
||||
"TimeOut = %d\n",
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
|
||||
UpnpEventSubscribe_get_ErrCode(es_event),
|
||||
UpnpEventSubscribe_get_TimeOut(es_event));
|
||||
SampleUtil_Print("SID = %s\n", es_event->Sid);
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
|
||||
SampleUtil_Print("TimeOut = %d\n", es_event->TimeOut);
|
||||
break;
|
||||
}
|
||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
(struct Upnp_Event_Subscribe *)Event;
|
||||
|
||||
SampleUtil_Print(
|
||||
"SID = %s\n"
|
||||
"ErrCode = %d\n"
|
||||
"PublisherURL= %s\n"
|
||||
"TimeOut = %d\n",
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
|
||||
UpnpEventSubscribe_get_ErrCode(es_event),
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
UpnpEventSubscribe_get_TimeOut(es_event));
|
||||
SampleUtil_Print("SID = %s\n", es_event->Sid);
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
|
||||
SampleUtil_Print("PublisherURL= %s\n", es_event->PublisherUrl);
|
||||
SampleUtil_Print("TimeOut = %d\n", es_event->TimeOut);
|
||||
break;
|
||||
}
|
||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
struct Upnp_Event_Subscribe *es_event =
|
||||
(struct Upnp_Event_Subscribe *)Event;
|
||||
|
||||
SampleUtil_Print(
|
||||
"SID = %s\n"
|
||||
"ErrCode = %d\n"
|
||||
"PublisherURL= %s\n"
|
||||
"TimeOut = %d\n",
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
|
||||
UpnpEventSubscribe_get_ErrCode(es_event),
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
UpnpEventSubscribe_get_TimeOut(es_event));
|
||||
SampleUtil_Print("SID = %s\n", es_event->Sid);
|
||||
SampleUtil_Print("ErrCode = %s(%d)\n",
|
||||
UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
|
||||
SampleUtil_Print("PublisherURL= %s\n", es_event->PublisherUrl);
|
||||
SampleUtil_Print("TimeOut = %d\n", es_event->TimeOut);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ int SampleUtil_PrintEvent(
|
||||
/*! [in] The type of callback event. */
|
||||
Upnp_EventType EventType,
|
||||
/*! [in] The callback event structure. */
|
||||
const void *Event);
|
||||
void *Event);
|
||||
|
||||
/*!
|
||||
* \brief This routine finds the first occurance of a service in a DOM
|
||||
|
@ -1002,34 +1002,30 @@ void TvCtrlPointHandleGetVar(
|
||||
* Cookie -- Optional data specified during callback registration
|
||||
*
|
||||
********************************************************************************/
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, const void *Event, void *Cookie)
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie)
|
||||
{
|
||||
int errCode = 0;
|
||||
/*int errCode = 0;*/
|
||||
|
||||
SampleUtil_PrintEvent(EventType, Event);
|
||||
switch ( EventType ) {
|
||||
/* SSDP Stuff */
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
||||
const UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||
IXML_Document *DescDoc = NULL;
|
||||
const char *location = NULL;
|
||||
int errCode = UpnpDiscovery_get_ErrCode(d_event);
|
||||
int ret;
|
||||
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Discovery Callback -- %d\n", errCode);
|
||||
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Error in Discovery Callback -- %d\n",
|
||||
d_event->ErrCode);
|
||||
}
|
||||
|
||||
location = UpnpString_get_String(UpnpDiscovery_get_Location(d_event));
|
||||
errCode = UpnpDownloadXmlDoc(location, &DescDoc);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error obtaining device description from %s -- error = %d\n",
|
||||
location, errCode);
|
||||
ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc);
|
||||
if (ret != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Error obtaining device description from %s -- error = %d\n",
|
||||
d_event->Location, ret);
|
||||
} else {
|
||||
TvCtrlPointAddDevice(
|
||||
DescDoc, location, UpnpDiscovery_get_Expires(d_event));
|
||||
DescDoc, d_event->Location, d_event->Expires);
|
||||
}
|
||||
if (DescDoc) {
|
||||
ixmlDocument_free(DescDoc);
|
||||
@ -1041,92 +1037,90 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, const void *Event,
|
||||
/* Nothing to do here... */
|
||||
break;
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
||||
UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
|
||||
int errCode = UpnpDiscovery_get_ErrCode(d_event);
|
||||
const char *deviceId = UpnpString_get_String(
|
||||
UpnpDiscovery_get_DeviceID(d_event));
|
||||
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
||||
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Discovery ByeBye Callback -- %d\n", errCode);
|
||||
if (d_event->ErrCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Error in Discovery ByeBye Callback -- %d\n",
|
||||
d_event->ErrCode);
|
||||
}
|
||||
SampleUtil_Print("Received ByeBye for Device: %s\n", deviceId);
|
||||
TvCtrlPointRemoveDevice(deviceId);
|
||||
SampleUtil_Print("Received ByeBye for Device: %s\n", d_event->DeviceId);
|
||||
TvCtrlPointRemoveDevice(d_event->DeviceId);
|
||||
SampleUtil_Print("After byebye:\n");
|
||||
TvCtrlPointPrintList();
|
||||
break;
|
||||
}
|
||||
/* SOAP Stuff */
|
||||
case UPNP_CONTROL_ACTION_COMPLETE: {
|
||||
UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
|
||||
int errCode = UpnpActionComplete_get_ErrCode(a_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)Event;
|
||||
|
||||
if (a_event->ErrCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Error in Action Complete Callback -- %d\n",
|
||||
errCode);
|
||||
a_event->ErrCode);
|
||||
}
|
||||
/* No need for any processing here, just print out results.
|
||||
* Service state table updates are handled by events. */
|
||||
break;
|
||||
}
|
||||
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
||||
UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
|
||||
int errCode = UpnpStateVarComplete_get_ErrCode(sv_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Get Var Complete Callback -- %d\n", errCode);
|
||||
struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
|
||||
|
||||
if (sv_event->ErrCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Error in Get Var Complete Callback -- %d\n",
|
||||
sv_event->ErrCode);
|
||||
} else {
|
||||
TvCtrlPointHandleGetVar(
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_CtrlUrl(sv_event)),
|
||||
UpnpString_get_String(UpnpStateVarComplete_get_StateVarName(sv_event)),
|
||||
UpnpStateVarComplete_get_CurrentVal(sv_event));
|
||||
sv_event->CtrlUrl,
|
||||
sv_event->StateVarName,
|
||||
sv_event->CurrentVal);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* GENA Stuff */
|
||||
case UPNP_EVENT_RECEIVED: {
|
||||
UpnpEvent *e_event = (UpnpEvent *)Event;
|
||||
struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
|
||||
|
||||
TvCtrlPointHandleEvent(
|
||||
UpnpEvent_get_SID_cstr(e_event),
|
||||
UpnpEvent_get_EventKey(e_event),
|
||||
UpnpEvent_get_ChangedVariables(e_event));
|
||||
e_event->Sid,
|
||||
e_event->EventKey,
|
||||
e_event->ChangedVariables);
|
||||
break;
|
||||
}
|
||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
||||
|
||||
errCode = UpnpEventSubscribe_get_ErrCode(es_event);
|
||||
if (errCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print(
|
||||
"Error in Event Subscribe Callback -- %d\n", errCode);
|
||||
if (es_event->ErrCode != UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Error in Event Subscribe Callback -- %d\n",
|
||||
es_event->ErrCode);
|
||||
} else {
|
||||
TvCtrlPointHandleSubscribeUpdate(
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_SID(es_event)),
|
||||
UpnpEventSubscribe_get_TimeOut(es_event));
|
||||
es_event->PublisherUrl,
|
||||
es_event->Sid,
|
||||
es_event->TimeOut);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
||||
UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
|
||||
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
||||
int TimeOut = default_timeout;
|
||||
Upnp_SID newSID;
|
||||
int ret;
|
||||
|
||||
errCode = UpnpSubscribe(
|
||||
ret = UpnpSubscribe(
|
||||
ctrlpt_handle,
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
es_event->PublisherUrl,
|
||||
&TimeOut,
|
||||
newSID);
|
||||
if (errCode == UPNP_E_SUCCESS) {
|
||||
if (ret == UPNP_E_SUCCESS) {
|
||||
SampleUtil_Print("Subscribed to EventURL with SID=%s\n", newSID);
|
||||
TvCtrlPointHandleSubscribeUpdate(
|
||||
UpnpString_get_String(UpnpEventSubscribe_get_PublisherUrl(es_event)),
|
||||
es_event->PublisherUrl,
|
||||
newSID,
|
||||
TimeOut);
|
||||
} else {
|
||||
SampleUtil_Print("Error Subscribing to EventURL -- %d\n", errCode);
|
||||
SampleUtil_Print("Error Subscribing to EventURL -- %d\n", ret);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void TvStateUpdate(
|
||||
|
||||
void TvCtrlPointHandleEvent(const char *, int, IXML_Document *);
|
||||
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, const void *, void *);
|
||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||
|
||||
/*!
|
||||
* \brief Checks the advertisement each device in the global device list.
|
||||
|
@ -288,7 +288,7 @@ error_handler:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *sr_event)
|
||||
int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *sr_event)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
int cmp1 = 0;
|
||||
@ -300,9 +300,9 @@ int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *sr_event)
|
||||
/* lock state mutex */
|
||||
ithread_mutex_lock(&TVDevMutex);
|
||||
|
||||
l_serviceId = UpnpString_get_String(UpnpSubscriptionRequest_get_ServiceId(sr_event));
|
||||
l_udn = UpnpSubscriptionRequest_get_UDN_cstr(sr_event);
|
||||
l_sid = UpnpSubscriptionRequest_get_SID_cstr(sr_event);
|
||||
l_serviceId = sr_event->ServiceId;
|
||||
l_udn = sr_event->UDN;
|
||||
l_sid = sr_event->Sid;
|
||||
for (i = 0; i < TV_SERVICE_SERVCOUNT; ++i) {
|
||||
cmp1 = strcmp(l_udn, tv_service_table[i].UDN);
|
||||
cmp2 = strcmp(l_serviceId, tv_service_table[i].ServiceId);
|
||||
@ -345,32 +345,30 @@ int TvDeviceHandleSubscriptionRequest(const UpnpSubscriptionRequest *sr_event)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int TvDeviceHandleGetVarRequest(UpnpStateVarRequest *cgv_event)
|
||||
int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *cgv_event)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
int j = 0;
|
||||
int getvar_succeeded = 0;
|
||||
|
||||
UpnpStateVarRequest_set_CurrentVal(cgv_event, NULL);
|
||||
cgv_event->CurrentVal = NULL;
|
||||
|
||||
ithread_mutex_lock(&TVDevMutex);
|
||||
|
||||
for (i = 0; i < TV_SERVICE_SERVCOUNT; i++) {
|
||||
/* check udn and service id */
|
||||
const char *devUDN =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_DevUDN(cgv_event));
|
||||
const char *serviceID =
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_ServiceID(cgv_event));
|
||||
const char *devUDN = cgv_event->DevUDN;
|
||||
const char *serviceID = cgv_event->ServiceID;
|
||||
if (strcmp(devUDN, tv_service_table[i].UDN) == 0 &&
|
||||
strcmp(serviceID, tv_service_table[i].ServiceId) == 0) {
|
||||
/* check variable name */
|
||||
for (j = 0; j < tv_service_table[i].VariableCount; j++) {
|
||||
const char *stateVarName = UpnpString_get_String(
|
||||
UpnpStateVarRequest_get_StateVarName(cgv_event));
|
||||
const char *stateVarName =
|
||||
cgv_event->StateVarName;
|
||||
if (strcmp(stateVarName,
|
||||
tv_service_table[i].VariableName[j]) == 0) {
|
||||
getvar_succeeded = 1;
|
||||
UpnpStateVarRequest_set_CurrentVal(cgv_event,
|
||||
cgv_event->CurrentVal = ixmlCloneDOMString(
|
||||
tv_service_table[i].VariableStrVal[j]);
|
||||
break;
|
||||
}
|
||||
@ -378,21 +376,21 @@ int TvDeviceHandleGetVarRequest(UpnpStateVarRequest *cgv_event)
|
||||
}
|
||||
}
|
||||
if (getvar_succeeded) {
|
||||
UpnpStateVarRequest_set_ErrCode(cgv_event, UPNP_E_SUCCESS);
|
||||
cgv_event->ErrCode = UPNP_E_SUCCESS;
|
||||
} else {
|
||||
SampleUtil_Print("Error in UPNP_CONTROL_GET_VAR_REQUEST callback:\n"
|
||||
" Unknown variable name = %s\n",
|
||||
UpnpString_get_String(UpnpStateVarRequest_get_StateVarName(cgv_event)));
|
||||
UpnpStateVarRequest_set_ErrCode(cgv_event, 404);
|
||||
UpnpStateVarRequest_strcpy_ErrStr(cgv_event, "Invalid Variable");
|
||||
cgv_event->StateVarName);
|
||||
cgv_event->ErrCode = 404;
|
||||
strcpy(cgv_event->ErrStr, "Invalid Variable");
|
||||
}
|
||||
|
||||
ithread_mutex_unlock(&TVDevMutex);
|
||||
|
||||
return UpnpStateVarRequest_get_ErrCode(cgv_event) == UPNP_E_SUCCESS;
|
||||
return cgv_event->ErrCode == UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
|
||||
int TvDeviceHandleActionRequest(struct Upnp_Action_Request *ca_event)
|
||||
{
|
||||
/* Defaults if action not found. */
|
||||
int action_found = 0;
|
||||
@ -403,14 +401,13 @@ int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
|
||||
const char *devUDN = NULL;
|
||||
const char *serviceID = NULL;
|
||||
const char *actionName = NULL;
|
||||
IXML_Document *actionResult = NULL;
|
||||
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 0);
|
||||
UpnpActionRequest_set_ActionResult(ca_event, NULL);
|
||||
ca_event->ErrCode = 0;
|
||||
ca_event->ActionResult = NULL;
|
||||
|
||||
devUDN = UpnpString_get_String(UpnpActionRequest_get_DevUDN( ca_event));
|
||||
serviceID = UpnpString_get_String(UpnpActionRequest_get_ServiceID( ca_event));
|
||||
actionName = UpnpString_get_String(UpnpActionRequest_get_ActionName(ca_event));
|
||||
devUDN = ca_event->DevUDN;
|
||||
serviceID = ca_event->ServiceID;
|
||||
actionName = ca_event->ActionName;
|
||||
if (strcmp(devUDN, tv_service_table[TV_SERVICE_CONTROL].UDN) == 0 &&
|
||||
strcmp(serviceID, tv_service_table[TV_SERVICE_CONTROL].ServiceId) == 0) {
|
||||
/* Request for action in the TvDevice Control Service. */
|
||||
@ -431,10 +428,9 @@ int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
|
||||
VariableStrVal[TV_CONTROL_POWER], "1") ||
|
||||
!strcmp(actionName, "PowerOn")) {
|
||||
retCode = tv_service_table[service].actions[i](
|
||||
UpnpActionRequest_get_ActionRequest(ca_event),
|
||||
&actionResult,
|
||||
ca_event->ActionRequest,
|
||||
&ca_event->ActionResult,
|
||||
&errorString);
|
||||
UpnpActionRequest_set_ActionResult(ca_event, actionResult);
|
||||
} else {
|
||||
errorString = "Power is Off";
|
||||
retCode = UPNP_E_INTERNAL_ERROR;
|
||||
@ -445,28 +441,28 @@ int TvDeviceHandleActionRequest(UpnpActionRequest *ca_event)
|
||||
}
|
||||
|
||||
if (!action_found) {
|
||||
UpnpActionRequest_set_ActionResult(ca_event, NULL);
|
||||
UpnpActionRequest_strcpy_ErrStr(ca_event, "Invalid Action");
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 401);
|
||||
ca_event->ActionResult = NULL;
|
||||
strcpy(ca_event->ErrStr, "Invalid Action");
|
||||
ca_event->ErrCode = 401;
|
||||
} else {
|
||||
if (retCode == UPNP_E_SUCCESS) {
|
||||
UpnpActionRequest_set_ErrCode(ca_event, UPNP_E_SUCCESS);
|
||||
ca_event->ErrCode = UPNP_E_SUCCESS;
|
||||
} else {
|
||||
/* copy the error string */
|
||||
UpnpActionRequest_strcpy_ErrStr(ca_event, errorString);
|
||||
strcpy(ca_event->ErrStr, errorString);
|
||||
switch (retCode) {
|
||||
case UPNP_E_INVALID_PARAM:
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 402);
|
||||
ca_event->ErrCode = 402;
|
||||
break;
|
||||
case UPNP_E_INTERNAL_ERROR:
|
||||
default:
|
||||
UpnpActionRequest_set_ErrCode(ca_event, 501);
|
||||
ca_event->ErrCode = 501;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return UpnpActionRequest_get_ErrCode(ca_event);
|
||||
return ca_event->ErrCode;
|
||||
}
|
||||
|
||||
int TvDeviceSetServiceTableVar(unsigned int service, int variable, char *value)
|
||||
@ -1262,17 +1258,22 @@ int TvDeviceDecreaseBrightness(IXML_Document * in, IXML_Document ** out,
|
||||
return IncrementBrightness(-1, in, out, errorString);
|
||||
}
|
||||
|
||||
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, const void *Event, void *Cookie)
|
||||
int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event,
|
||||
void *Cookie)
|
||||
{
|
||||
switch (EventType) {
|
||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||
TvDeviceHandleSubscriptionRequest((UpnpSubscriptionRequest *)Event);
|
||||
TvDeviceHandleSubscriptionRequest((struct
|
||||
Upnp_Subscription_Request *)
|
||||
Event);
|
||||
break;
|
||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||
TvDeviceHandleGetVarRequest((UpnpStateVarRequest *)Event);
|
||||
TvDeviceHandleGetVarRequest((struct Upnp_State_Var_Request *)
|
||||
Event);
|
||||
break;
|
||||
case UPNP_CONTROL_ACTION_REQUEST:
|
||||
TvDeviceHandleActionRequest((UpnpActionRequest *)Event);
|
||||
TvDeviceHandleActionRequest((struct Upnp_Action_Request *)
|
||||
Event);
|
||||
break;
|
||||
/* ignore these cases, since this is not a control point */
|
||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||
|
@ -214,7 +214,7 @@ int TvDeviceStateTableInit(
|
||||
*/
|
||||
int TvDeviceHandleSubscriptionRequest(
|
||||
/*! [in] The subscription request event structure. */
|
||||
const UpnpSubscriptionRequest *sr_event);
|
||||
struct Upnp_Subscription_Request *sr_event);
|
||||
|
||||
/*!
|
||||
* \brief Called during a get variable request callback.
|
||||
@ -224,7 +224,7 @@ int TvDeviceHandleSubscriptionRequest(
|
||||
*/
|
||||
int TvDeviceHandleGetVarRequest(
|
||||
/*! [in,out] The control get variable request event structure. */
|
||||
UpnpStateVarRequest *cgv_event);
|
||||
struct Upnp_State_Var_Request *cgv_event);
|
||||
|
||||
/*!
|
||||
* \brief Called during an action request callback.
|
||||
@ -234,7 +234,7 @@ int TvDeviceHandleGetVarRequest(
|
||||
*/
|
||||
int TvDeviceHandleActionRequest(
|
||||
/*! [in,out] The control action request event structure. */
|
||||
UpnpActionRequest *ca_event);
|
||||
struct Upnp_Action_Request *ca_event);
|
||||
|
||||
/*!
|
||||
* \brief The callback handler registered with the SDK while registering
|
||||
@ -251,7 +251,7 @@ int TvDeviceCallbackEventHandler(
|
||||
/*! [in] The type of callback event. */
|
||||
Upnp_EventType,
|
||||
/*! [in] Data structure containing event data. */
|
||||
const void *Event,
|
||||
void *Event,
|
||||
/*! [in] Optional data specified during callback registration. */
|
||||
void *Cookie);
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionComplete object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "ActionComplete.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpActionRequest object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "ActionRequest.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpDiscovery object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "Discovery.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEvent object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "Event.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpEventSubscribe object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "EventSubscribe.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpFileInfo object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "FileInfo.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarComplete object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "StateVarComplete.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpStateVarRequest object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "StateVarRequest.h"
|
||||
|
@ -1,14 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief UpnpSubscriptionRequest object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "SubscriptionRequest.h"
|
||||
|
@ -78,10 +78,6 @@
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
#ifndef IN6_IS_ADDR_GLOBAL
|
||||
#define IN6_IS_ADDR_GLOBAL(a) \
|
||||
((((__const uint32_t *) (a))[0] & htonl((uint32_t)0x70000000)) \
|
||||
@ -184,12 +180,6 @@ int UpnpSdkDeviceregisteredV6 = 0;
|
||||
Upnp_SID gUpnpSdkNLSuuid;
|
||||
#endif /* UPNP_HAVE_OPTSSDP */
|
||||
|
||||
/*! Global variable used as to store the OpenSSL context object
|
||||
* to be used for all SSL/TLS connections
|
||||
*/
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
SSL_CTX *gSslCtx = NULL;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief (Windows Only) Initializes the Windows Winsock library.
|
||||
@ -544,24 +534,6 @@ exit_function:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
int UpnpInitSslContext(int initOpenSslLib, const SSL_METHOD *sslMethod)
|
||||
{
|
||||
if (gSslCtx)
|
||||
return UPNP_E_INIT;
|
||||
if (initOpenSslLib) {
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
OpenSSL_add_all_algorithms();
|
||||
}
|
||||
gSslCtx = SSL_CTX_new(sslMethod);
|
||||
if (!gSslCtx) {
|
||||
return UPNP_E_INIT_FAILED;
|
||||
}
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
/*!
|
||||
* \brief Prints thread pool statistics.
|
||||
@ -631,12 +603,7 @@ int UpnpFinish(void)
|
||||
UpnpClient_Handle client_handle;
|
||||
#endif
|
||||
struct Handle_Info *temp;
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
if (gSslCtx) {
|
||||
SSL_CTX_free(gSslCtx);
|
||||
gSslCtx = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (UpnpSdkInit != 1)
|
||||
return UPNP_E_FINISH;
|
||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__,
|
||||
@ -2527,7 +2494,7 @@ int UpnpAcceptSubscriptionExt(
|
||||
const char *DevID_const,
|
||||
const char *ServName_const,
|
||||
IXML_Document *PropSet,
|
||||
const Upnp_SID SubsId)
|
||||
Upnp_SID SubsId)
|
||||
{
|
||||
int ret = 0;
|
||||
int line = 0;
|
||||
@ -3068,12 +3035,8 @@ int UpnpOpenHttpPost(
|
||||
int contentLength,
|
||||
int timeout)
|
||||
{
|
||||
int status = http_OpenHttpConnection(url, handle, timeout);
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
return http_MakeHttpRequest(HTTPMETHOD_POST, url, handle, NULL, contentType,
|
||||
contentLength, timeout);
|
||||
}
|
||||
return status;
|
||||
return http_OpenHttpPost(
|
||||
url, handle, contentType, contentLength, timeout);
|
||||
}
|
||||
|
||||
|
||||
@ -3083,7 +3046,7 @@ int UpnpWriteHttpPost(
|
||||
size_t *size,
|
||||
int timeout)
|
||||
{
|
||||
return http_WriteHttpRequest(handle, buf, size, timeout);
|
||||
return http_WriteHttpPost(handle, buf, size, timeout);
|
||||
}
|
||||
|
||||
|
||||
@ -3092,56 +3055,35 @@ int UpnpCloseHttpPost(
|
||||
int *httpStatus,
|
||||
int timeout)
|
||||
{
|
||||
int status = http_EndHttpRequest(handle, timeout);
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = http_GetHttpResponse(handle, NULL, NULL, NULL, httpStatus, timeout);
|
||||
}
|
||||
status = http_CloseHttpConnection(handle);
|
||||
return status;}
|
||||
return http_CloseHttpPost(handle, httpStatus, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpOpenHttpGet(
|
||||
const char *url,
|
||||
void **handle,
|
||||
const char *url_str,
|
||||
void **Handle,
|
||||
char **contentType,
|
||||
int *contentLength,
|
||||
int *httpStatus,
|
||||
int timeout)
|
||||
{
|
||||
int status = UpnpOpenHttpConnection(url, handle, timeout);
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = UpnpMakeHttpRequest(HTTPMETHOD_GET, url, *handle, NULL, NULL, 0, timeout);
|
||||
}
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = UpnpEndHttpRequest(*handle, timeout);
|
||||
}
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = UpnpGetHttpResponse(*handle, NULL, contentType, contentLength, httpStatus, timeout);
|
||||
}
|
||||
return status;
|
||||
return http_OpenHttpGet(
|
||||
url_str, Handle, contentType, contentLength, httpStatus, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpOpenHttpGetProxy(
|
||||
const char *url,
|
||||
const char *url_str,
|
||||
const char *proxy_str,
|
||||
void **handle,
|
||||
void **Handle,
|
||||
char **contentType,
|
||||
int *contentLength,
|
||||
int *httpStatus,
|
||||
int timeout)
|
||||
{
|
||||
int status = UpnpOpenHttpConnection(proxy_str, handle, timeout);
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = UpnpMakeHttpRequest(HTTPMETHOD_GET, url, *handle, NULL, NULL, 0, timeout);
|
||||
}
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = UpnpEndHttpRequest(*handle, timeout);
|
||||
}
|
||||
if (status == UPNP_E_SUCCESS) {
|
||||
status = UpnpGetHttpResponse(*handle, NULL, contentType, contentLength, httpStatus, timeout);
|
||||
}
|
||||
return status;
|
||||
return http_OpenHttpGetProxy(
|
||||
url_str, proxy_str, Handle, contentType, contentLength,
|
||||
httpStatus, timeout);
|
||||
}
|
||||
|
||||
|
||||
@ -3169,13 +3111,13 @@ int UpnpCancelHttpGet(void *Handle)
|
||||
|
||||
int UpnpCloseHttpGet(void *Handle)
|
||||
{
|
||||
return UpnpCloseHttpConnection(Handle);
|
||||
return http_CloseHttpGet(Handle);
|
||||
}
|
||||
|
||||
|
||||
int UpnpReadHttpGet(void *Handle, char *buf, size_t *size, int timeout)
|
||||
{
|
||||
return http_ReadHttpResponse(Handle, buf, size, timeout);
|
||||
return http_ReadHttpGet(Handle, buf, size, timeout);
|
||||
}
|
||||
|
||||
|
||||
@ -3185,57 +3127,6 @@ int UpnpHttpGetProgress(void *Handle, size_t *length, size_t *total)
|
||||
}
|
||||
|
||||
|
||||
int UpnpOpenHttpConnection(const char *url,
|
||||
void **handle, int timeout)
|
||||
{
|
||||
return http_OpenHttpConnection(url, handle, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpMakeHttpRequest(Upnp_HttpMethod method, const char *url,
|
||||
void *handle, UpnpString *headers,
|
||||
const char *contentType, int contentLength,
|
||||
int timeout)
|
||||
{
|
||||
return http_MakeHttpRequest(method, url, handle, headers, contentType,
|
||||
contentLength, timeout);
|
||||
}
|
||||
|
||||
int UpnpWriteHttpRequest(void *handle, char *buf,
|
||||
size_t *size, int timeout)
|
||||
{
|
||||
return http_WriteHttpRequest(handle, buf, size, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpEndHttpRequest(void *handle, int timeout)
|
||||
{
|
||||
return http_EndHttpRequest(handle, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpGetHttpResponse(void *handle, UpnpString *headers,
|
||||
char **contentType, int *contentLength, int *httpStatus,
|
||||
int timeout)
|
||||
{
|
||||
return http_GetHttpResponse(handle, headers, contentType, contentLength,
|
||||
httpStatus, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpReadHttpResponse(void *handle, char *buf,
|
||||
size_t *size, int timeout)
|
||||
{
|
||||
return http_ReadHttpResponse(handle, buf, size, timeout);
|
||||
}
|
||||
|
||||
|
||||
int UpnpCloseHttpConnection(void *handle)
|
||||
{
|
||||
return http_CloseHttpConnection(handle);
|
||||
}
|
||||
|
||||
|
||||
int UpnpDownloadUrlItem(const char *url, char **outBuf, char *contentType)
|
||||
{
|
||||
int ret_code;
|
||||
@ -3706,7 +3597,7 @@ int UpnpGetIfInfo(const char *IfName)
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
|
||||
{
|
||||
int errCode = 0;
|
||||
/*int errCode = 0;*/
|
||||
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside UpnpThreadDistribution \n");
|
||||
@ -3714,85 +3605,92 @@ void UpnpThreadDistribution(struct UpnpNonblockParam *Param)
|
||||
switch (Param->FunName) {
|
||||
#if EXCLUDE_GENA == 0
|
||||
case SUBSCRIBE: {
|
||||
UpnpEventSubscribe *evt = UpnpEventSubscribe_new();
|
||||
struct Upnp_Event_Subscribe Evt;
|
||||
UpnpString *Sid = UpnpString_new();
|
||||
|
||||
UpnpEventSubscribe_strcpy_PublisherUrl(evt, Param->Url);
|
||||
errCode = genaSubscribe(
|
||||
UpnpString *Url = UpnpString_new();
|
||||
UpnpString_set_String(Url, Param->Url);
|
||||
memset(&Evt, 0, sizeof(Evt));
|
||||
Evt.ErrCode = genaSubscribe(
|
||||
Param->Handle,
|
||||
UpnpEventSubscribe_get_PublisherUrl(evt),
|
||||
Url,
|
||||
(int *)&Param->TimeOut,
|
||||
Sid);
|
||||
UpnpEventSubscribe_set_ErrCode(evt, errCode);
|
||||
UpnpEventSubscribe_set_TimeOut(evt, Param->TimeOut);
|
||||
UpnpEventSubscribe_set_SID(evt, Sid);
|
||||
Param->Fun(UPNP_EVENT_SUBSCRIBE_COMPLETE, evt, Param->Cookie);
|
||||
UpnpString_delete(Sid);
|
||||
UpnpEventSubscribe_delete(evt);
|
||||
strncpy(Evt.PublisherUrl, Param->Url,
|
||||
sizeof(Evt.PublisherUrl) - 1);
|
||||
Evt.TimeOut = Param->TimeOut;
|
||||
strncpy((char *)Evt.Sid, UpnpString_get_String(Sid),
|
||||
sizeof(Evt.Sid) - 1);
|
||||
Param->Fun(UPNP_EVENT_SUBSCRIBE_COMPLETE, &Evt, Param->Cookie);
|
||||
UpnpString_delete(Sid);
|
||||
UpnpString_delete(Url);
|
||||
free(Param);
|
||||
break;
|
||||
}
|
||||
case UNSUBSCRIBE: {
|
||||
UpnpEventSubscribe *evt = UpnpEventSubscribe_new();
|
||||
UpnpEventSubscribe_strcpy_SID(evt, Param->SubsId);
|
||||
errCode = genaUnSubscribe(
|
||||
struct Upnp_Event_Subscribe Evt;
|
||||
UpnpString *Sid = UpnpString_new();
|
||||
UpnpString_set_String(Sid, Param->SubsId);
|
||||
memset(&Evt, 0, sizeof(Evt));
|
||||
Evt.ErrCode = genaUnSubscribe(
|
||||
Param->Handle,
|
||||
UpnpEventSubscribe_get_SID(evt));
|
||||
UpnpEventSubscribe_set_ErrCode(evt, errCode);
|
||||
UpnpEventSubscribe_strcpy_PublisherUrl(evt, "");
|
||||
UpnpEventSubscribe_set_TimeOut(evt, 0);
|
||||
Param->Fun(UPNP_EVENT_UNSUBSCRIBE_COMPLETE, evt, Param->Cookie);
|
||||
UpnpEventSubscribe_delete(evt);
|
||||
Sid);
|
||||
strncpy((char *)Evt.Sid, UpnpString_get_String(Sid),
|
||||
sizeof(Evt.Sid) - 1);
|
||||
strncpy(Evt.PublisherUrl, "", sizeof(Evt.PublisherUrl) - 1);
|
||||
Evt.TimeOut = 0;
|
||||
Param->Fun(UPNP_EVENT_UNSUBSCRIBE_COMPLETE, &Evt, Param->Cookie);
|
||||
UpnpString_delete(Sid);
|
||||
free(Param);
|
||||
break;
|
||||
}
|
||||
case RENEW: {
|
||||
UpnpEventSubscribe *evt = UpnpEventSubscribe_new();
|
||||
UpnpEventSubscribe_strcpy_SID(evt, Param->SubsId);
|
||||
errCode = genaRenewSubscription(
|
||||
struct Upnp_Event_Subscribe Evt;
|
||||
UpnpString *Sid = UpnpString_new();
|
||||
UpnpString_set_String(Sid, Param->SubsId);
|
||||
memset(&Evt, 0, sizeof(Evt));
|
||||
Evt.ErrCode = genaRenewSubscription(
|
||||
Param->Handle,
|
||||
UpnpEventSubscribe_get_SID(evt),
|
||||
Sid,
|
||||
&Param->TimeOut);
|
||||
UpnpEventSubscribe_set_ErrCode(evt, errCode);
|
||||
UpnpEventSubscribe_set_TimeOut(evt, Param->TimeOut);
|
||||
Param->Fun(UPNP_EVENT_RENEWAL_COMPLETE, evt, Param->Cookie);
|
||||
UpnpEventSubscribe_delete(evt);
|
||||
Evt.TimeOut = Param->TimeOut;
|
||||
strncpy((char *)Evt.Sid, UpnpString_get_String(Sid),
|
||||
sizeof(Evt.Sid) - 1);
|
||||
Param->Fun(UPNP_EVENT_RENEWAL_COMPLETE, &Evt, Param->Cookie);
|
||||
UpnpString_delete(Sid);
|
||||
free(Param);
|
||||
break;
|
||||
}
|
||||
#endif /* EXCLUDE_GENA == 0 */
|
||||
#if EXCLUDE_SOAP == 0
|
||||
case ACTION: {
|
||||
UpnpActionComplete *Evt = UpnpActionComplete_new();
|
||||
IXML_Document *actionResult = NULL;
|
||||
int errCode = SoapSendAction(
|
||||
struct Upnp_Action_Complete Evt;
|
||||
memset(&Evt, 0, sizeof(Evt));
|
||||
Evt.ActionResult = NULL;
|
||||
Evt.ErrCode = SoapSendAction(
|
||||
Param->Url,
|
||||
Param->ServiceType,
|
||||
Param->Act,
|
||||
&actionResult);
|
||||
UpnpActionComplete_set_ErrCode(Evt, errCode);
|
||||
UpnpActionComplete_set_ActionRequest(Evt, Param->Act);
|
||||
UpnpActionComplete_set_ActionResult(Evt, actionResult);
|
||||
UpnpActionComplete_strcpy_CtrlUrl(Evt, Param->Url);
|
||||
Param->Fun(UPNP_CONTROL_ACTION_COMPLETE, Evt, Param->Cookie);
|
||||
Param->Act, &Evt.ActionResult);
|
||||
Evt.ActionRequest = Param->Act;
|
||||
strncpy(Evt.CtrlUrl, Param->Url, sizeof(Evt.CtrlUrl) - 1);
|
||||
Param->Fun(UPNP_CONTROL_ACTION_COMPLETE, &Evt, Param->Cookie);
|
||||
ixmlDocument_free(Evt.ActionRequest);
|
||||
ixmlDocument_free(Evt.ActionResult);
|
||||
free(Param);
|
||||
UpnpActionComplete_delete(Evt);
|
||||
break;
|
||||
}
|
||||
case STATUS: {
|
||||
UpnpStateVarComplete *Evt = UpnpStateVarComplete_new();
|
||||
DOMString currentVal = NULL;
|
||||
int errCode = SoapGetServiceVarStatus(
|
||||
struct Upnp_State_Var_Complete Evt;
|
||||
memset(&Evt, 0, sizeof(Evt));
|
||||
Evt.ErrCode = SoapGetServiceVarStatus(
|
||||
Param->Url,
|
||||
Param->VarName,
|
||||
¤tVal);
|
||||
UpnpStateVarComplete_set_ErrCode(Evt, errCode);
|
||||
UpnpStateVarComplete_strcpy_CtrlUrl(Evt, Param->Url);
|
||||
UpnpStateVarComplete_strcpy_StateVarName(Evt, Param->VarName);
|
||||
UpnpStateVarComplete_set_CurrentVal(Evt, currentVal);
|
||||
Param->Fun(UPNP_CONTROL_GET_VAR_COMPLETE, Evt, Param->Cookie);
|
||||
&Evt.CurrentVal);
|
||||
strncpy(Evt.StateVarName, Param->VarName,
|
||||
sizeof(Evt.StateVarName) - 1);
|
||||
strncpy(Evt.CtrlUrl, Param->Url, sizeof(Evt.CtrlUrl) - 1);
|
||||
Param->Fun(UPNP_CONTROL_GET_VAR_COMPLETE, &Evt, Param->Cookie);
|
||||
free(Evt.CurrentVal);
|
||||
free(Param);
|
||||
UpnpStateVarComplete_delete(Evt);
|
||||
break;
|
||||
}
|
||||
#endif /* EXCLUDE_SOAP == 0 */
|
||||
@ -4297,6 +4195,27 @@ int UpnpIsWebserverEnabled(void)
|
||||
return bWebServerState == (WebServerState)WEB_SERVER_ENABLED;
|
||||
}
|
||||
|
||||
int UpnpSetVirtualDirCallbacks(struct UpnpVirtualDirCallbacks *callbacks)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if( UpnpSdkInit != 1 ) {
|
||||
/* SDK is not initialized */
|
||||
return UPNP_E_FINISH;
|
||||
}
|
||||
|
||||
if( callbacks == NULL )
|
||||
return UPNP_E_INVALID_PARAM;
|
||||
|
||||
ret = UpnpVirtualDir_set_GetInfoCallback(callbacks->get_info) == UPNP_E_SUCCESS
|
||||
&& UpnpVirtualDir_set_OpenCallback(callbacks->open) == UPNP_E_SUCCESS
|
||||
&& UpnpVirtualDir_set_ReadCallback(callbacks->read) == UPNP_E_SUCCESS
|
||||
&& UpnpVirtualDir_set_WriteCallback(callbacks->write) == UPNP_E_SUCCESS
|
||||
&& UpnpVirtualDir_set_SeekCallback(callbacks->seek) == UPNP_E_SUCCESS
|
||||
&& UpnpVirtualDir_set_CloseCallback(callbacks->close) == UPNP_E_SUCCESS;
|
||||
|
||||
return ret ? UPNP_E_SUCCESS : UPNP_E_INVALID_PARAM;
|
||||
}
|
||||
|
||||
int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -43,7 +43,6 @@
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
|
||||
|
||||
#include "EventSubscribe.h"
|
||||
#include "gena.h"
|
||||
#include "httpparser.h"
|
||||
#include "httpreadwrite.h"
|
||||
@ -69,7 +68,7 @@ static void GenaAutoRenewSubscription(
|
||||
IN void *input)
|
||||
{
|
||||
upnp_timeout *event = (upnp_timeout *) input;
|
||||
UpnpEventSubscribe *sub_struct = (UpnpEventSubscribe *)event->Event;
|
||||
struct Upnp_Event_Subscribe *sub_struct = (struct Upnp_Event_Subscribe *)event->Event;
|
||||
void *cookie;
|
||||
Upnp_FunPtr callback_fun;
|
||||
struct Handle_Info *handle_info;
|
||||
@ -77,21 +76,23 @@ static void GenaAutoRenewSubscription(
|
||||
int eventType = 0;
|
||||
int timeout = 0;
|
||||
int errCode = 0;
|
||||
UpnpString *tmpSID = UpnpString_new();
|
||||
|
||||
if (AUTO_RENEW_TIME == 0) {
|
||||
UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, "GENA SUB EXPIRED");
|
||||
UpnpEventSubscribe_set_ErrCode(sub_struct, UPNP_E_SUCCESS);
|
||||
sub_struct->ErrCode = UPNP_E_SUCCESS;
|
||||
send_callback = 1;
|
||||
eventType = UPNP_EVENT_SUBSCRIPTION_EXPIRED;
|
||||
} else {
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "GENA AUTO RENEW");
|
||||
timeout = UpnpEventSubscribe_get_TimeOut(sub_struct);
|
||||
timeout = sub_struct->TimeOut;
|
||||
UpnpString_set_String(tmpSID, sub_struct->Sid);
|
||||
errCode = genaRenewSubscription(
|
||||
event->handle,
|
||||
UpnpEventSubscribe_get_SID(sub_struct),
|
||||
tmpSID,
|
||||
&timeout);
|
||||
UpnpEventSubscribe_set_ErrCode(sub_struct, errCode);
|
||||
UpnpEventSubscribe_set_TimeOut(sub_struct, timeout);
|
||||
sub_struct->ErrCode = errCode;
|
||||
sub_struct->TimeOut = timeout;
|
||||
if (errCode != UPNP_E_SUCCESS &&
|
||||
errCode != GENA_E_BAD_SID &&
|
||||
errCode != GENA_E_BAD_HANDLE) {
|
||||
@ -119,6 +120,7 @@ static void GenaAutoRenewSubscription(
|
||||
free_upnp_timeout(event);
|
||||
|
||||
end_function:
|
||||
UpnpString_delete(tmpSID);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -135,12 +137,14 @@ static int ScheduleGenaAutoRenew(
|
||||
/*! [in] The time out value of the subscription. */
|
||||
IN int TimeOut,
|
||||
/*! [in] Subscription being renewed. */
|
||||
IN GenlibClientSubscription *sub)
|
||||
IN ClientSubscription *sub)
|
||||
{
|
||||
UpnpEventSubscribe *RenewEventStruct = NULL;
|
||||
struct Upnp_Event_Subscribe *RenewEventStruct = NULL;
|
||||
upnp_timeout *RenewEvent = NULL;
|
||||
int return_code = GENA_SUCCESS;
|
||||
ThreadPoolJob job;
|
||||
const UpnpString *tmpSID = UpnpClientSubscription_get_SID(sub);
|
||||
const UpnpString *tmpEventURL = UpnpClientSubscription_get_EventURL(sub);
|
||||
|
||||
memset(&job, 0, sizeof(job));
|
||||
|
||||
@ -149,11 +153,12 @@ static int ScheduleGenaAutoRenew(
|
||||
goto end_function;
|
||||
}
|
||||
|
||||
RenewEventStruct = UpnpEventSubscribe_new();
|
||||
RenewEventStruct = (struct Upnp_Event_Subscribe *)malloc(sizeof (struct Upnp_Event_Subscribe));
|
||||
if (RenewEventStruct == NULL) {
|
||||
return_code = UPNP_E_OUTOF_MEMORY;
|
||||
goto end_function;
|
||||
}
|
||||
memset(RenewEventStruct, 0, sizeof(struct Upnp_Event_Subscribe));
|
||||
|
||||
RenewEvent = (upnp_timeout *) malloc(sizeof(upnp_timeout));
|
||||
if (RenewEvent == NULL) {
|
||||
@ -164,10 +169,12 @@ static int ScheduleGenaAutoRenew(
|
||||
memset(RenewEvent, 0, sizeof(upnp_timeout));
|
||||
|
||||
/* schedule expire event */
|
||||
UpnpEventSubscribe_set_ErrCode(RenewEventStruct, UPNP_E_SUCCESS);
|
||||
UpnpEventSubscribe_set_TimeOut(RenewEventStruct, TimeOut);
|
||||
UpnpEventSubscribe_set_SID(RenewEventStruct, GenlibClientSubscription_get_SID(sub));
|
||||
UpnpEventSubscribe_set_PublisherUrl(RenewEventStruct, GenlibClientSubscription_get_EventURL(sub));
|
||||
RenewEventStruct->ErrCode = UPNP_E_SUCCESS;
|
||||
RenewEventStruct->TimeOut = TimeOut;
|
||||
strncpy(RenewEventStruct->Sid, UpnpString_get_String(tmpSID),
|
||||
sizeof(RenewEventStruct->Sid) - 1);
|
||||
strncpy(RenewEventStruct->PublisherUrl,
|
||||
UpnpString_get_String(tmpEventURL), NAME_SIZE - 1);
|
||||
|
||||
/* RenewEvent->EventType=UPNP_EVENT_SUBSCRIPTION_EXPIRE; */
|
||||
RenewEvent->handle = client_handle;
|
||||
@ -190,12 +197,11 @@ static int ScheduleGenaAutoRenew(
|
||||
goto end_function;
|
||||
}
|
||||
|
||||
GenlibClientSubscription_set_RenewEventId(sub, RenewEvent->eventId);
|
||||
UpnpClientSubscription_set_RenewEventId(sub, RenewEvent->eventId);
|
||||
|
||||
return_code = GENA_SUCCESS;
|
||||
|
||||
end_function:
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
@ -410,7 +416,7 @@ static int gena_subscribe(
|
||||
|
||||
int genaUnregisterClient(UpnpClient_Handle client_handle)
|
||||
{
|
||||
GenlibClientSubscription *sub_copy = GenlibClientSubscription_new();
|
||||
ClientSubscription *sub_copy = UpnpClientSubscription_new();
|
||||
int return_code = UPNP_E_SUCCESS;
|
||||
struct Handle_Info *handle_info = NULL;
|
||||
http_parser_t response;
|
||||
@ -427,16 +433,16 @@ int genaUnregisterClient(UpnpClient_Handle client_handle)
|
||||
return_code = UPNP_E_SUCCESS;
|
||||
break;
|
||||
}
|
||||
GenlibClientSubscription_assign(sub_copy, handle_info->ClientSubList);
|
||||
UpnpClientSubscription_assign(sub_copy, handle_info->ClientSubList);
|
||||
RemoveClientSubClientSID(
|
||||
&handle_info->ClientSubList,
|
||||
GenlibClientSubscription_get_SID(sub_copy));
|
||||
UpnpClientSubscription_get_SID(sub_copy));
|
||||
|
||||
HandleUnlock();
|
||||
|
||||
return_code = gena_unsubscribe(
|
||||
GenlibClientSubscription_get_EventURL(sub_copy),
|
||||
GenlibClientSubscription_get_ActualSID(sub_copy),
|
||||
UpnpClientSubscription_get_EventURL(sub_copy),
|
||||
UpnpClientSubscription_get_ActualSID(sub_copy),
|
||||
&response);
|
||||
if (return_code == 0) {
|
||||
httpmsg_destroy(&response.msg);
|
||||
@ -448,7 +454,7 @@ int genaUnregisterClient(UpnpClient_Handle client_handle)
|
||||
HandleUnlock();
|
||||
|
||||
exit_function:
|
||||
GenlibClientSubscription_delete(sub_copy);
|
||||
UpnpClientSubscription_delete(sub_copy);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
@ -458,10 +464,10 @@ int genaUnSubscribe(
|
||||
UpnpClient_Handle client_handle,
|
||||
const UpnpString *in_sid)
|
||||
{
|
||||
GenlibClientSubscription *sub = NULL;
|
||||
ClientSubscription *sub = NULL;
|
||||
int return_code = GENA_SUCCESS;
|
||||
struct Handle_Info *handle_info;
|
||||
GenlibClientSubscription *sub_copy = GenlibClientSubscription_new();
|
||||
ClientSubscription *sub_copy = UpnpClientSubscription_new();
|
||||
http_parser_t response;
|
||||
|
||||
/* validate handle and sid */
|
||||
@ -477,12 +483,12 @@ int genaUnSubscribe(
|
||||
return_code = GENA_E_BAD_SID;
|
||||
goto exit_function;
|
||||
}
|
||||
GenlibClientSubscription_assign(sub_copy, sub);
|
||||
UpnpClientSubscription_assign(sub_copy, sub);
|
||||
HandleUnlock();
|
||||
|
||||
return_code = gena_unsubscribe(
|
||||
GenlibClientSubscription_get_EventURL(sub_copy),
|
||||
GenlibClientSubscription_get_ActualSID(sub_copy),
|
||||
UpnpClientSubscription_get_EventURL(sub_copy),
|
||||
UpnpClientSubscription_get_ActualSID(sub_copy),
|
||||
&response);
|
||||
if (return_code == 0) {
|
||||
httpmsg_destroy(&response.msg);
|
||||
@ -499,7 +505,7 @@ int genaUnSubscribe(
|
||||
HandleUnlock();
|
||||
|
||||
exit_function:
|
||||
GenlibClientSubscription_delete(sub_copy);
|
||||
UpnpClientSubscription_delete(sub_copy);
|
||||
return return_code;
|
||||
}
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
@ -513,7 +519,7 @@ int genaSubscribe(
|
||||
UpnpString *out_sid)
|
||||
{
|
||||
int return_code = GENA_SUCCESS;
|
||||
GenlibClientSubscription *newSubscription = GenlibClientSubscription_new();
|
||||
ClientSubscription *newSubscription = UpnpClientSubscription_new();
|
||||
uuid_upnp uid;
|
||||
Upnp_SID temp_sid;
|
||||
Upnp_SID temp_sid2;
|
||||
@ -572,11 +578,11 @@ int genaSubscribe(
|
||||
return_code = UPNP_E_OUTOF_MEMORY;
|
||||
goto error_handler;
|
||||
}
|
||||
GenlibClientSubscription_set_RenewEventId(newSubscription, -1);
|
||||
GenlibClientSubscription_set_SID(newSubscription, out_sid);
|
||||
GenlibClientSubscription_set_ActualSID(newSubscription, ActualSID);
|
||||
GenlibClientSubscription_set_EventURL(newSubscription, EventURL);
|
||||
GenlibClientSubscription_set_Next(newSubscription, handle_info->ClientSubList);
|
||||
UpnpClientSubscription_set_RenewEventId(newSubscription, -1);
|
||||
UpnpClientSubscription_set_SID(newSubscription, out_sid);
|
||||
UpnpClientSubscription_set_ActualSID(newSubscription, ActualSID);
|
||||
UpnpClientSubscription_set_EventURL(newSubscription, EventURL);
|
||||
UpnpClientSubscription_set_Next(newSubscription, handle_info->ClientSubList);
|
||||
handle_info->ClientSubList = newSubscription;
|
||||
|
||||
/* schedule expiration event */
|
||||
@ -586,7 +592,7 @@ error_handler:
|
||||
UpnpString_delete(ActualSID);
|
||||
UpnpString_delete(EventURL);
|
||||
if (return_code != UPNP_E_SUCCESS)
|
||||
GenlibClientSubscription_delete(newSubscription);
|
||||
UpnpClientSubscription_delete(newSubscription);
|
||||
HandleUnlock();
|
||||
SubscribeUnlock();
|
||||
|
||||
@ -601,8 +607,8 @@ int genaRenewSubscription(
|
||||
int *TimeOut)
|
||||
{
|
||||
int return_code = GENA_SUCCESS;
|
||||
GenlibClientSubscription *sub = NULL;
|
||||
GenlibClientSubscription *sub_copy = GenlibClientSubscription_new();
|
||||
ClientSubscription *sub = NULL;
|
||||
ClientSubscription *sub_copy = UpnpClientSubscription_new();
|
||||
struct Handle_Info *handle_info;
|
||||
UpnpString *ActualSID = UpnpString_new();
|
||||
ThreadPoolJob tempJob;
|
||||
@ -628,22 +634,22 @@ int genaRenewSubscription(
|
||||
/* remove old events */
|
||||
if (TimerThreadRemove(
|
||||
&gTimerThread,
|
||||
GenlibClientSubscription_get_RenewEventId(sub),
|
||||
UpnpClientSubscription_get_RenewEventId(sub),
|
||||
&tempJob) == 0 ) {
|
||||
free_upnp_timeout((upnp_timeout *)tempJob.arg);
|
||||
}
|
||||
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "REMOVED AUTO RENEW EVENT");
|
||||
|
||||
GenlibClientSubscription_set_RenewEventId(sub, -1);
|
||||
GenlibClientSubscription_assign(sub_copy, sub);
|
||||
UpnpClientSubscription_set_RenewEventId(sub, -1);
|
||||
UpnpClientSubscription_assign(sub_copy, sub);
|
||||
|
||||
HandleUnlock();
|
||||
|
||||
return_code = gena_subscribe(
|
||||
GenlibClientSubscription_get_EventURL(sub_copy),
|
||||
UpnpClientSubscription_get_EventURL(sub_copy),
|
||||
TimeOut,
|
||||
GenlibClientSubscription_get_ActualSID(sub_copy),
|
||||
UpnpClientSubscription_get_ActualSID(sub_copy),
|
||||
ActualSID);
|
||||
|
||||
HandleLock();
|
||||
@ -674,21 +680,21 @@ int genaRenewSubscription(
|
||||
}
|
||||
|
||||
/* store actual sid */
|
||||
GenlibClientSubscription_set_ActualSID(sub, ActualSID);
|
||||
UpnpClientSubscription_set_ActualSID(sub, ActualSID);
|
||||
|
||||
/* start renew subscription timer */
|
||||
return_code = ScheduleGenaAutoRenew(client_handle, *TimeOut, sub);
|
||||
if (return_code != GENA_SUCCESS) {
|
||||
RemoveClientSubClientSID(
|
||||
&handle_info->ClientSubList,
|
||||
GenlibClientSubscription_get_SID(sub));
|
||||
UpnpClientSubscription_get_SID(sub));
|
||||
}
|
||||
free_client_subscription(sub_copy);
|
||||
HandleUnlock();
|
||||
|
||||
exit_function:
|
||||
UpnpString_delete(ActualSID);
|
||||
GenlibClientSubscription_delete(sub_copy);
|
||||
UpnpClientSubscription_delete(sub_copy);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
@ -697,15 +703,16 @@ void gena_process_notification_event(
|
||||
SOCKINFO *info,
|
||||
http_message_t *event)
|
||||
{
|
||||
UpnpEvent *event_struct = UpnpEvent_new();
|
||||
struct Upnp_Event event_struct;
|
||||
IXML_Document *ChangedVars = NULL;
|
||||
int eventKey;
|
||||
token sid;
|
||||
GenlibClientSubscription *subscription = NULL;
|
||||
ClientSubscription *subscription = NULL;
|
||||
struct Handle_Info *handle_info;
|
||||
void *cookie;
|
||||
Upnp_FunPtr callback;
|
||||
UpnpClient_Handle client_handle;
|
||||
const UpnpString *tmpSID = NULL;
|
||||
|
||||
memptr sid_hdr;
|
||||
memptr nt_hdr,
|
||||
@ -802,9 +809,12 @@ void gena_process_notification_event(
|
||||
error_respond(info, HTTP_OK, event);
|
||||
|
||||
/* fill event struct */
|
||||
UpnpEvent_set_EventKey(event_struct, eventKey);
|
||||
UpnpEvent_set_ChangedVariables(event_struct, ChangedVars);
|
||||
UpnpEvent_set_SID(event_struct, GenlibClientSubscription_get_SID(subscription));
|
||||
tmpSID = UpnpClientSubscription_get_SID(subscription);
|
||||
memset(event_struct.Sid, 0, sizeof(event_struct.Sid));
|
||||
strncpy(event_struct.Sid, UpnpString_get_String(tmpSID),
|
||||
sizeof(event_struct.Sid) - 1);
|
||||
event_struct.EventKey = eventKey;
|
||||
event_struct.ChangedVariables = ChangedVars;
|
||||
|
||||
/* copy callback */
|
||||
callback = handle_info->Callback;
|
||||
@ -816,11 +826,10 @@ void gena_process_notification_event(
|
||||
/* In future, should find a way of mainting */
|
||||
/* that the handle is not unregistered in the middle of a */
|
||||
/* callback */
|
||||
callback(UPNP_EVENT_RECEIVED, event_struct, cookie);
|
||||
callback(UPNP_EVENT_RECEIVED, &event_struct, cookie);
|
||||
|
||||
exit_function:
|
||||
ixmlDocument_free(ChangedVars);
|
||||
UpnpEvent_delete(event_struct);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1187,7 +1187,7 @@ void gena_process_subscription_request(
|
||||
SOCKINFO *info,
|
||||
http_message_t *request)
|
||||
{
|
||||
UpnpSubscriptionRequest *request_struct = UpnpSubscriptionRequest_new();
|
||||
struct Upnp_Subscription_Request request_struct;
|
||||
Upnp_SID temp_sid;
|
||||
int return_code = 1;
|
||||
int time_out = 1801;
|
||||
@ -1204,6 +1204,8 @@ void gena_process_subscription_request(
|
||||
memptr timeout_hdr;
|
||||
int rc = 0;
|
||||
|
||||
memset(&request_struct, 0, sizeof(request_struct));
|
||||
|
||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__,
|
||||
"Subscription Request Received:\n");
|
||||
|
||||
@ -1349,9 +1351,10 @@ void gena_process_subscription_request(
|
||||
service->TotalSubscriptions++;
|
||||
|
||||
/* finally generate callback for init table dump */
|
||||
UpnpSubscriptionRequest_strcpy_ServiceId(request_struct, service->serviceId);
|
||||
UpnpSubscriptionRequest_strcpy_UDN(request_struct, service->UDN);
|
||||
UpnpSubscriptionRequest_strcpy_SID(request_struct, sub->sid);
|
||||
request_struct.ServiceId = service->serviceId;
|
||||
request_struct.UDN = service->UDN;
|
||||
strncpy((char *)request_struct.Sid, sub->sid,
|
||||
sizeof(request_struct.Sid) - 1);
|
||||
|
||||
/* copy callback */
|
||||
callback_fun = handle_info->Callback;
|
||||
@ -1362,10 +1365,10 @@ void gena_process_subscription_request(
|
||||
/* make call back with request struct */
|
||||
/* in the future should find a way of mainting that the handle */
|
||||
/* is not unregistered in the middle of a callback */
|
||||
callback_fun(UPNP_EVENT_SUBSCRIPTION_REQUEST, request_struct, cookie);
|
||||
callback_fun(UPNP_EVENT_SUBSCRIPTION_REQUEST, &request_struct, cookie);
|
||||
|
||||
exit_function:
|
||||
UpnpSubscriptionRequest_delete(request_struct);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief GenlibClientSubscription object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "ClientSubscription.h"
|
||||
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
@ -1,3 +1,34 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 France Telecom 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Purpose: This file defines the functions for clients. It defines
|
||||
@ -14,19 +45,199 @@
|
||||
|
||||
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
|
||||
#if EXCLUDE_GENA == 0
|
||||
|
||||
#include <stdlib.h> /* for calloc(), free() */
|
||||
|
||||
|
||||
void free_client_subscription(GenlibClientSubscription *sub)
|
||||
struct SClientSubscription {
|
||||
int m_renewEventId;
|
||||
UpnpString *m_SID;
|
||||
UpnpString *m_actualSID;
|
||||
UpnpString *m_eventURL;
|
||||
struct SClientSubscription *m_next;
|
||||
};
|
||||
|
||||
|
||||
/** Constructor */
|
||||
ClientSubscription *UpnpClientSubscription_new()
|
||||
{
|
||||
struct SClientSubscription *p = calloc(1, sizeof (struct SClientSubscription));
|
||||
#if 0
|
||||
p->renewEventId = 0;
|
||||
#endif
|
||||
p->m_SID = UpnpString_new();
|
||||
p->m_actualSID = UpnpString_new();
|
||||
p->m_eventURL = UpnpString_new();
|
||||
p->m_next = NULL;
|
||||
|
||||
return (ClientSubscription *)p;
|
||||
}
|
||||
|
||||
|
||||
/** Destructor */
|
||||
void UpnpClientSubscription_delete(ClientSubscription *p)
|
||||
{
|
||||
struct SClientSubscription *q = (struct SClientSubscription *)p;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
q->m_renewEventId = 0;
|
||||
|
||||
UpnpString_delete(q->m_SID);
|
||||
q->m_SID = NULL;
|
||||
|
||||
UpnpString_delete(q->m_actualSID);
|
||||
q->m_actualSID = NULL;
|
||||
|
||||
UpnpString_delete(q->m_eventURL);
|
||||
q->m_eventURL = NULL;
|
||||
|
||||
q->m_next = NULL;
|
||||
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
/** Copy Constructor */
|
||||
ClientSubscription *UpnpClientSubscription_dup(const ClientSubscription *p)
|
||||
{
|
||||
ClientSubscription *q = UpnpClientSubscription_new();
|
||||
|
||||
UpnpClientSubscription_assign(q, p);
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
/** Assignment operator */
|
||||
void UpnpClientSubscription_assign(ClientSubscription *q, const ClientSubscription *p)
|
||||
{
|
||||
if (q != p) {
|
||||
/* Do not copy RenewEventId */
|
||||
((struct SClientSubscription *)q)->m_renewEventId = -1;
|
||||
UpnpClientSubscription_set_SID(q, UpnpClientSubscription_get_SID(p));
|
||||
UpnpClientSubscription_set_ActualSID(q, UpnpClientSubscription_get_ActualSID(p));
|
||||
UpnpClientSubscription_set_EventURL(q, UpnpClientSubscription_get_EventURL(p));
|
||||
/* Do not copy m_next */
|
||||
((struct SClientSubscription *)q)->m_next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int UpnpClientSubscription_get_RenewEventId(const ClientSubscription *p)
|
||||
{
|
||||
return ((struct SClientSubscription *)p)->m_renewEventId;
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_set_RenewEventId(ClientSubscription *p, int n)
|
||||
{
|
||||
((struct SClientSubscription *)p)->m_renewEventId = n;
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpClientSubscription_get_SID(const ClientSubscription *p)
|
||||
{
|
||||
return ((struct SClientSubscription *)p)->m_SID;
|
||||
}
|
||||
|
||||
const char *UpnpClientSubscription_get_SID_cstr(const ClientSubscription *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpClientSubscription_get_SID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_set_SID(ClientSubscription *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
|
||||
((struct SClientSubscription *)p)->m_SID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_strcpy_SID(ClientSubscription *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
|
||||
((struct SClientSubscription *)p)->m_SID = UpnpString_new();
|
||||
UpnpString_set_String(((struct SClientSubscription *)p)->m_SID, s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const UpnpString *UpnpClientSubscription_get_ActualSID(const ClientSubscription *p)
|
||||
{
|
||||
return ((struct SClientSubscription *)p)->m_actualSID;
|
||||
}
|
||||
|
||||
|
||||
const char *UpnpClientSubscription_get_ActualSID_cstr(const ClientSubscription *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpClientSubscription_get_ActualSID(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_set_ActualSID(ClientSubscription *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
|
||||
((struct SClientSubscription *)p)->m_actualSID = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_strcpy_ActualSID(ClientSubscription *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
|
||||
((struct SClientSubscription *)p)->m_actualSID = UpnpString_new();
|
||||
UpnpString_set_String(((struct SClientSubscription *)p)->m_actualSID, s);
|
||||
}
|
||||
|
||||
|
||||
const UpnpString *UpnpClientSubscription_get_EventURL(const ClientSubscription *p)
|
||||
{
|
||||
return ((struct SClientSubscription *)p)->m_eventURL;
|
||||
}
|
||||
|
||||
|
||||
const char *UpnpClientSubscription_get_EventURL_cstr(const ClientSubscription *p)
|
||||
{
|
||||
return UpnpString_get_String(UpnpClientSubscription_get_EventURL(p));
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_set_EventURL(ClientSubscription *p, const UpnpString *s)
|
||||
{
|
||||
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
|
||||
((struct SClientSubscription *)p)->m_eventURL = UpnpString_dup(s);
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_strcpy_EventURL(ClientSubscription *p, const char *s)
|
||||
{
|
||||
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
|
||||
((struct SClientSubscription *)p)->m_eventURL = UpnpString_new();
|
||||
UpnpString_set_String(((struct SClientSubscription *)p)->m_eventURL, s);
|
||||
}
|
||||
|
||||
|
||||
ClientSubscription *UpnpClientSubscription_get_Next(const ClientSubscription *p)
|
||||
{
|
||||
return (ClientSubscription *)(((struct SClientSubscription *)p)->m_next);
|
||||
}
|
||||
|
||||
|
||||
void UpnpClientSubscription_set_Next(ClientSubscription *p, ClientSubscription *q)
|
||||
{
|
||||
((struct SClientSubscription *)p)->m_next = (struct SClientSubscription *)q;
|
||||
}
|
||||
|
||||
|
||||
void free_client_subscription(ClientSubscription *sub)
|
||||
{
|
||||
upnp_timeout *event;
|
||||
ThreadPoolJob tempJob;
|
||||
if (sub) {
|
||||
int renewEventId = GenlibClientSubscription_get_RenewEventId(sub);
|
||||
GenlibClientSubscription_strcpy_ActualSID(sub, "");
|
||||
GenlibClientSubscription_strcpy_EventURL(sub, "");
|
||||
int renewEventId = UpnpClientSubscription_get_RenewEventId(sub);
|
||||
UpnpClientSubscription_strcpy_ActualSID(sub, "");
|
||||
UpnpClientSubscription_strcpy_EventURL(sub, "");
|
||||
if (renewEventId != -1) {
|
||||
/* do not remove timer event of copy */
|
||||
/* invalid timer event id */
|
||||
@ -35,62 +246,62 @@ void free_client_subscription(GenlibClientSubscription *sub)
|
||||
free_upnp_timeout(event);
|
||||
}
|
||||
}
|
||||
GenlibClientSubscription_set_RenewEventId(sub, -1);
|
||||
UpnpClientSubscription_set_RenewEventId(sub, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void freeClientSubList(GenlibClientSubscription *list)
|
||||
void freeClientSubList(ClientSubscription *list)
|
||||
{
|
||||
GenlibClientSubscription *next;
|
||||
ClientSubscription *next;
|
||||
while (list) {
|
||||
free_client_subscription(list);
|
||||
next = GenlibClientSubscription_get_Next(list);
|
||||
GenlibClientSubscription_delete(list);
|
||||
next = UpnpClientSubscription_get_Next(list);
|
||||
UpnpClientSubscription_delete(list);
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RemoveClientSubClientSID(GenlibClientSubscription **head, const UpnpString *sid)
|
||||
void RemoveClientSubClientSID(ClientSubscription **head, const UpnpString *sid)
|
||||
{
|
||||
GenlibClientSubscription *finger = *head;
|
||||
GenlibClientSubscription *previous = NULL;
|
||||
ClientSubscription *finger = *head;
|
||||
ClientSubscription *previous = NULL;
|
||||
int found = 0;
|
||||
while (finger) {
|
||||
found = !strcmp(
|
||||
UpnpString_get_String(sid),
|
||||
GenlibClientSubscription_get_SID_cstr(finger));
|
||||
UpnpClientSubscription_get_SID_cstr(finger));
|
||||
if (found) {
|
||||
if (previous) {
|
||||
GenlibClientSubscription_set_Next(previous,
|
||||
GenlibClientSubscription_get_Next(finger));
|
||||
UpnpClientSubscription_set_Next(previous,
|
||||
UpnpClientSubscription_get_Next(finger));
|
||||
} else {
|
||||
*head = GenlibClientSubscription_get_Next(finger);
|
||||
*head = UpnpClientSubscription_get_Next(finger);
|
||||
}
|
||||
GenlibClientSubscription_set_Next(finger, NULL);
|
||||
UpnpClientSubscription_set_Next(finger, NULL);
|
||||
freeClientSubList(finger);
|
||||
finger = NULL;
|
||||
} else {
|
||||
previous = finger;
|
||||
finger = GenlibClientSubscription_get_Next(finger);
|
||||
finger = UpnpClientSubscription_get_Next(finger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GenlibClientSubscription *GetClientSubClientSID(GenlibClientSubscription *head, const UpnpString *sid)
|
||||
ClientSubscription *GetClientSubClientSID(ClientSubscription *head, const UpnpString *sid)
|
||||
{
|
||||
GenlibClientSubscription *next = head;
|
||||
ClientSubscription *next = head;
|
||||
int found = 0;
|
||||
while (next) {
|
||||
found = !strcmp(
|
||||
GenlibClientSubscription_get_SID_cstr(next),
|
||||
UpnpClientSubscription_get_SID_cstr(next),
|
||||
UpnpString_get_String(sid));
|
||||
if(found) {
|
||||
break;
|
||||
} else {
|
||||
next = GenlibClientSubscription_get_Next(next);
|
||||
next = UpnpClientSubscription_get_Next(next);
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,22 +309,22 @@ GenlibClientSubscription *GetClientSubClientSID(GenlibClientSubscription *head,
|
||||
}
|
||||
|
||||
|
||||
GenlibClientSubscription *GetClientSubActualSID(GenlibClientSubscription *head, token *sid)
|
||||
ClientSubscription *GetClientSubActualSID(ClientSubscription *head, token *sid)
|
||||
{
|
||||
GenlibClientSubscription *next = head;
|
||||
ClientSubscription *next = head;
|
||||
while (next) {
|
||||
if (!memcmp(
|
||||
GenlibClientSubscription_get_ActualSID_cstr(next),
|
||||
UpnpClientSubscription_get_ActualSID_cstr(next),
|
||||
sid->buff, sid->size)) {
|
||||
break;
|
||||
} else {
|
||||
next = GenlibClientSubscription_get_Next(next);
|
||||
next = UpnpClientSubscription_get_Next(next);
|
||||
}
|
||||
}
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
|
||||
#endif /* EXCLUDE_GENA */
|
||||
#endif /* INCLUDE_CLIENT_APIS */
|
||||
|
||||
|
@ -55,9 +55,8 @@
|
||||
|
||||
/* entity positions */
|
||||
|
||||
#define NUM_HTTP_METHODS 11
|
||||
#define NUM_HTTP_METHODS 9
|
||||
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
||||
{"DELETE", HTTPMETHOD_DELETE},
|
||||
{"GET", HTTPMETHOD_GET},
|
||||
{"HEAD", HTTPMETHOD_HEAD},
|
||||
{"M-POST", HTTPMETHOD_MPOST},
|
||||
@ -67,7 +66,6 @@ static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
||||
{"SUBSCRIBE", HTTPMETHOD_SUBSCRIBE},
|
||||
{"UNSUBSCRIBE", HTTPMETHOD_UNSUBSCRIBE},
|
||||
{"POST", SOAPMETHOD_POST},
|
||||
{"PUT", HTTPMETHOD_PUT}
|
||||
};
|
||||
|
||||
#define NUM_HTTP_HEADER_NAMES 33
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -43,8 +43,6 @@
|
||||
|
||||
#include "webserver.h"
|
||||
|
||||
|
||||
#include "FileInfo.h"
|
||||
#include "httpparser.h"
|
||||
#include "httpreadwrite.h"
|
||||
#include "ithread.h"
|
||||
@ -315,7 +313,7 @@ static UPNP_INLINE int get_content_type(
|
||||
/*! [in] . */
|
||||
const char *filename,
|
||||
/*! [out] . */
|
||||
OUT UpnpFileInfo *fileInfo)
|
||||
DOMString *content_type)
|
||||
{
|
||||
const char *extension;
|
||||
const char *type;
|
||||
@ -325,7 +323,7 @@ static UPNP_INLINE int get_content_type(
|
||||
size_t length = 0;
|
||||
int rc = 0;
|
||||
|
||||
UpnpFileInfo_set_ContentType(fileInfo, NULL);
|
||||
(*content_type) = NULL;
|
||||
/* get ext */
|
||||
extension = strrchr(filename, '.');
|
||||
if (extension != NULL)
|
||||
@ -345,9 +343,9 @@ static UPNP_INLINE int get_content_type(
|
||||
free(temp);
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
UpnpFileInfo_set_ContentType(fileInfo, temp);
|
||||
(*content_type) = ixmlCloneDOMString(temp);
|
||||
free(temp);
|
||||
if (!UpnpFileInfo_get_ContentType(fileInfo))
|
||||
if (!(*content_type))
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
|
||||
return 0;
|
||||
@ -520,41 +518,39 @@ static int get_file_info(
|
||||
/*! [out] File information object having file attributes such as filelength,
|
||||
* when was the file last modified, whether a file or a directory and
|
||||
* whether the file or directory is readable. */
|
||||
OUT UpnpFileInfo *info)
|
||||
struct File_Info *info)
|
||||
{
|
||||
int code;
|
||||
struct stat s;
|
||||
FILE *fp;
|
||||
int rc = 0;
|
||||
time_t aux_LastModified;
|
||||
struct tm date;
|
||||
char buffer[ASCTIME_R_BUFFER_SIZE];
|
||||
|
||||
UpnpFileInfo_set_ContentType(info, NULL);
|
||||
ixmlFreeDOMString(info->content_type);
|
||||
info->content_type = NULL;
|
||||
code = stat(filename, &s);
|
||||
if (code == -1)
|
||||
return -1;
|
||||
if (S_ISDIR(s.st_mode))
|
||||
UpnpFileInfo_set_IsDirectory(info, TRUE);
|
||||
info->is_directory = TRUE;
|
||||
else if (S_ISREG(s.st_mode))
|
||||
UpnpFileInfo_set_IsDirectory(info, FALSE);
|
||||
info->is_directory = FALSE;
|
||||
else
|
||||
return -1;
|
||||
/* check readable */
|
||||
fp = fopen(filename, "r");
|
||||
UpnpFileInfo_set_IsReadable(info, fp != NULL);
|
||||
info->is_readable = (fp != NULL);
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
UpnpFileInfo_set_FileLength(info, s.st_size);
|
||||
UpnpFileInfo_set_LastModified(info, s.st_mtime);
|
||||
rc = get_content_type(filename, info);
|
||||
aux_LastModified = UpnpFileInfo_get_LastModified(info);
|
||||
info->file_length = s.st_size;
|
||||
info->last_modified = s.st_mtime;
|
||||
rc = get_content_type(filename, &info->content_type);
|
||||
UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
"file info: %s, length: %lld, last_mod=%s readable=%d\n",
|
||||
filename,
|
||||
(long long)UpnpFileInfo_get_FileLength(info),
|
||||
web_server_asctime_r(http_gmtime_r(&aux_LastModified, &date), buffer),
|
||||
UpnpFileInfo_get_IsReadable(info));
|
||||
filename, (long long)info->file_length,
|
||||
web_server_asctime_r(http_gmtime_r(&info->last_modified, &date), buffer),
|
||||
info->is_readable);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -592,14 +588,15 @@ static UPNP_INLINE int get_alias(
|
||||
struct xml_alias_t *alias,
|
||||
/*! [out] File information object which will be filled up if the file
|
||||
* comparison succeeds. */
|
||||
UpnpFileInfo *info)
|
||||
struct File_Info *info)
|
||||
{
|
||||
int cmp = strcmp(alias->name.buf, request_file);
|
||||
if (cmp == 0) {
|
||||
UpnpFileInfo_set_FileLength(info, (off_t)alias->doc.length);
|
||||
UpnpFileInfo_set_IsDirectory(info, FALSE);
|
||||
UpnpFileInfo_set_IsReadable(info, TRUE);
|
||||
UpnpFileInfo_set_LastModified(info, alias->last_modified);
|
||||
/* fill up info */
|
||||
info->file_length = (off_t)alias->doc.length;
|
||||
info->is_readable = TRUE;
|
||||
info->is_directory = FALSE;
|
||||
info->last_modified = alias->last_modified;
|
||||
}
|
||||
|
||||
return cmp == 0;
|
||||
@ -1041,8 +1038,7 @@ static int process_request(
|
||||
int err_code;
|
||||
|
||||
char *request_doc;
|
||||
UpnpFileInfo *finfo;
|
||||
time_t aux_LastModified;
|
||||
struct File_Info finfo;
|
||||
int using_alias;
|
||||
int using_virtual_dir;
|
||||
uri_type *url;
|
||||
@ -1062,7 +1058,7 @@ static int process_request(
|
||||
/* init */
|
||||
memset(&finfo, 0, sizeof(finfo));
|
||||
request_doc = NULL;
|
||||
finfo = UpnpFileInfo_new();
|
||||
finfo.content_type = NULL;
|
||||
alias_grabbed = FALSE;
|
||||
err_code = HTTP_INTERNAL_SERVER_ERROR; /* default error */
|
||||
using_virtual_dir = FALSE;
|
||||
@ -1102,11 +1098,12 @@ static int process_request(
|
||||
if (is_valid_alias(&gAliasDoc)) {
|
||||
alias_grab(alias);
|
||||
alias_grabbed = TRUE;
|
||||
using_alias = get_alias(request_doc, alias, finfo);
|
||||
using_alias = get_alias(request_doc, alias, &finfo);
|
||||
if (using_alias == TRUE) {
|
||||
UpnpFileInfo_set_ContentType(finfo,
|
||||
"text/xml; charset=\"utf-8\"");
|
||||
if (UpnpFileInfo_get_ContentType(finfo) == NULL) {
|
||||
finfo.content_type =
|
||||
ixmlCloneDOMString("text/xml");
|
||||
|
||||
if (finfo.content_type == NULL) {
|
||||
goto error_handler;
|
||||
}
|
||||
}
|
||||
@ -1116,12 +1113,12 @@ static int process_request(
|
||||
if (req->method != HTTPMETHOD_POST) {
|
||||
/* get file info */
|
||||
if (virtualDirCallback.
|
||||
get_info(filename->buf, finfo) != 0) {
|
||||
get_info(filename->buf, &finfo) != 0) {
|
||||
err_code = HTTP_NOT_FOUND;
|
||||
goto error_handler;
|
||||
}
|
||||
/* try index.html if req is a dir */
|
||||
if (UpnpFileInfo_get_IsDirectory(finfo)) {
|
||||
if (finfo.is_directory) {
|
||||
if (filename->buf[filename->length - 1] == '/') {
|
||||
temp_str = "index.html";
|
||||
} else {
|
||||
@ -1132,14 +1129,16 @@ static int process_request(
|
||||
goto error_handler;
|
||||
}
|
||||
/* get info */
|
||||
if (virtualDirCallback.get_info(filename->buf, finfo) != UPNP_E_SUCCESS ||
|
||||
UpnpFileInfo_get_IsDirectory(finfo)) {
|
||||
if ((virtualDirCallback.
|
||||
get_info(filename->buf,
|
||||
&finfo) != UPNP_E_SUCCESS)
|
||||
|| finfo.is_directory) {
|
||||
err_code = HTTP_NOT_FOUND;
|
||||
goto error_handler;
|
||||
}
|
||||
}
|
||||
/* not readable */
|
||||
if (!UpnpFileInfo_get_IsReadable(finfo)) {
|
||||
if (!finfo.is_readable) {
|
||||
err_code = HTTP_FORBIDDEN;
|
||||
goto error_handler;
|
||||
}
|
||||
@ -1169,12 +1168,12 @@ static int process_request(
|
||||
}
|
||||
if (req->method != HTTPMETHOD_POST) {
|
||||
/* get info on file */
|
||||
if (get_file_info(filename->buf, finfo) != 0) {
|
||||
if (get_file_info(filename->buf, &finfo) != 0) {
|
||||
err_code = HTTP_NOT_FOUND;
|
||||
goto error_handler;
|
||||
}
|
||||
/* try index.html if req is a dir */
|
||||
if (UpnpFileInfo_get_IsDirectory(finfo)) {
|
||||
if (finfo.is_directory) {
|
||||
if (filename->buf[filename->length - 1] == '/') {
|
||||
temp_str = "index.html";
|
||||
} else {
|
||||
@ -1185,14 +1184,14 @@ static int process_request(
|
||||
goto error_handler;
|
||||
}
|
||||
/* get info */
|
||||
if (get_file_info(filename->buf, finfo) != 0 ||
|
||||
UpnpFileInfo_get_IsDirectory(finfo)) {
|
||||
if (get_file_info(filename->buf, &finfo) != 0 ||
|
||||
finfo.is_directory) {
|
||||
err_code = HTTP_NOT_FOUND;
|
||||
goto error_handler;
|
||||
}
|
||||
}
|
||||
/* not readable */
|
||||
if (!UpnpFileInfo_get_IsReadable(finfo)) {
|
||||
if (!finfo.is_readable) {
|
||||
err_code = HTTP_FORBIDDEN;
|
||||
goto error_handler;
|
||||
}
|
||||
@ -1203,11 +1202,11 @@ static int process_request(
|
||||
/* goto error_handler; */
|
||||
/* } */
|
||||
}
|
||||
RespInstr->ReadSendSize = UpnpFileInfo_get_FileLength(finfo);
|
||||
RespInstr->ReadSendSize = finfo.file_length;
|
||||
/* Check other header field. */
|
||||
code = CheckOtherHTTPHeaders(req, RespInstr,
|
||||
UpnpFileInfo_get_FileLength(finfo));
|
||||
if (code != HTTP_OK) {
|
||||
if ((code =
|
||||
CheckOtherHTTPHeaders(req, RespInstr,
|
||||
finfo.file_length)) != HTTP_OK) {
|
||||
err_code = code;
|
||||
goto error_handler;
|
||||
}
|
||||
@ -1216,13 +1215,13 @@ static int process_request(
|
||||
err_code = HTTP_OK;
|
||||
goto error_handler;
|
||||
}
|
||||
extra_headers = UpnpFileInfo_get_ExtraHeaders(finfo);
|
||||
/*extra_headers = UpnpFileInfo_get_ExtraHeaders(finfo); */
|
||||
if (!extra_headers) {
|
||||
extra_headers = "";
|
||||
}
|
||||
|
||||
/* Check if chunked encoding should be used. */
|
||||
if (using_virtual_dir && UpnpFileInfo_get_FileLength(finfo) == UPNP_USING_CHUNKED) {
|
||||
if (using_virtual_dir && finfo.file_length == UPNP_USING_CHUNKED) {
|
||||
/* Chunked encoding is only supported by HTTP 1.1 clients */
|
||||
if (resp_major == 1 && resp_minor == 1) {
|
||||
RespInstr->IsChunkActive = 1;
|
||||
@ -1235,18 +1234,17 @@ static int process_request(
|
||||
}
|
||||
}
|
||||
|
||||
aux_LastModified = UpnpFileInfo_get_LastModified(finfo);
|
||||
if (RespInstr->IsRangeActive && RespInstr->IsChunkActive) {
|
||||
/* Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT */
|
||||
/* Transfer-Encoding: chunked */
|
||||
if (http_MakeMessage(headers, resp_major, resp_minor,
|
||||
"R" "T" "GKLD" "s" "tcS" "Xc" "sCc",
|
||||
HTTP_PARTIAL_CONTENT, /* status code */
|
||||
UpnpFileInfo_get_ContentType(finfo), /* content type */
|
||||
finfo.content_type, /* content type */
|
||||
RespInstr, /* range info */
|
||||
RespInstr, /* language info */
|
||||
"LAST-MODIFIED: ",
|
||||
&aux_LastModified,
|
||||
&finfo.last_modified,
|
||||
X_USER_AGENT, extra_headers) != 0) {
|
||||
goto error_handler;
|
||||
}
|
||||
@ -1256,11 +1254,11 @@ static int process_request(
|
||||
"R" "N" "T" "GLD" "s" "tcS" "Xc" "sCc",
|
||||
HTTP_PARTIAL_CONTENT, /* status code */
|
||||
RespInstr->ReadSendSize, /* content length */
|
||||
UpnpFileInfo_get_ContentType(finfo), /* content type */
|
||||
finfo.content_type, /* content type */
|
||||
RespInstr, /* range info */
|
||||
RespInstr, /* language info */
|
||||
"LAST-MODIFIED: ",
|
||||
&aux_LastModified,
|
||||
&finfo.last_modified,
|
||||
X_USER_AGENT, extra_headers) != 0) {
|
||||
goto error_handler;
|
||||
}
|
||||
@ -1269,10 +1267,10 @@ static int process_request(
|
||||
if (http_MakeMessage(headers, resp_major, resp_minor,
|
||||
"RK" "TLD" "s" "tcS" "Xc" "sCc",
|
||||
HTTP_OK, /* status code */
|
||||
UpnpFileInfo_get_ContentType(finfo), /* content type */
|
||||
finfo.content_type, /* content type */
|
||||
RespInstr, /* language info */
|
||||
"LAST-MODIFIED: ",
|
||||
&aux_LastModified,
|
||||
&finfo.last_modified,
|
||||
X_USER_AGENT, extra_headers) != 0) {
|
||||
goto error_handler;
|
||||
}
|
||||
@ -1283,10 +1281,10 @@ static int process_request(
|
||||
"R" "N" "TLD" "s" "tcS" "Xc" "sCc",
|
||||
HTTP_OK, /* status code */
|
||||
RespInstr->ReadSendSize, /* content length */
|
||||
UpnpFileInfo_get_ContentType(finfo), /* content type */
|
||||
finfo.content_type, /* content type */
|
||||
RespInstr, /* language info */
|
||||
"LAST-MODIFIED: ",
|
||||
&aux_LastModified,
|
||||
&finfo.last_modified,
|
||||
X_USER_AGENT,
|
||||
extra_headers) != 0) {
|
||||
goto error_handler;
|
||||
@ -1295,10 +1293,10 @@ static int process_request(
|
||||
if (http_MakeMessage(headers, resp_major, resp_minor,
|
||||
"R" "TLD" "s" "tcS" "Xc" "sCc",
|
||||
HTTP_OK, /* status code */
|
||||
UpnpFileInfo_get_ContentType(finfo), /* content type */
|
||||
finfo.content_type, /* content type */
|
||||
RespInstr, /* language info */
|
||||
"LAST-MODIFIED: ",
|
||||
&aux_LastModified,
|
||||
&finfo.last_modified,
|
||||
X_USER_AGENT,
|
||||
extra_headers) != 0) {
|
||||
goto error_handler;
|
||||
@ -1325,7 +1323,7 @@ static int process_request(
|
||||
|
||||
error_handler:
|
||||
free(request_doc);
|
||||
UpnpFileInfo_delete(finfo);
|
||||
ixmlFreeDOMString(finfo.content_type);
|
||||
if (err_code != HTTP_OK && alias_grabbed) {
|
||||
alias_release(alias);
|
||||
}
|
||||
@ -1356,7 +1354,7 @@ static int http_RecvPostMessage(
|
||||
{
|
||||
size_t Data_Buf_Size = 1024;
|
||||
char Buf[1024];
|
||||
int Timeout = -1;
|
||||
int Timeout = 0;
|
||||
FILE *Fp;
|
||||
parse_status_t status = PARSE_OK;
|
||||
int ok_on_close = FALSE;
|
||||
@ -1467,7 +1465,7 @@ void web_server_callback(http_parser_t *parser, INOUT http_message_t *req,
|
||||
SOCKINFO *info)
|
||||
{
|
||||
int ret;
|
||||
int timeout = -1;
|
||||
int timeout = 0;
|
||||
enum resp_type rtype = 0;
|
||||
membuffer headers;
|
||||
membuffer filename;
|
||||
|
@ -57,19 +57,10 @@
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_NOSIGNAL
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
/* OpenSSL context defined in upnpapi.c */
|
||||
extern SSL_CTX *gSslCtx;
|
||||
#endif
|
||||
|
||||
int sock_init(SOCKINFO *info, SOCKET sockfd)
|
||||
{
|
||||
assert(info);
|
||||
@ -96,38 +87,12 @@ int sock_init_with_ip(SOCKINFO *info, SOCKET sockfd,
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
int sock_ssl_connect(SOCKINFO *info)
|
||||
{
|
||||
int status = 0;
|
||||
info->ssl = SSL_new(gSslCtx);
|
||||
if (!info->ssl) {
|
||||
return UPNP_E_SOCKET_ERROR;
|
||||
}
|
||||
status = SSL_set_fd(info->ssl, info->socket);
|
||||
if (status == 1) {
|
||||
status = SSL_connect(info->ssl);
|
||||
}
|
||||
if (status == 1) {
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
return UPNP_E_SOCKET_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
int sock_destroy(SOCKINFO *info, int ShutdownMethod)
|
||||
{
|
||||
int ret = UPNP_E_SUCCESS;
|
||||
char errorBuffer[ERROR_BUFFER_LEN];
|
||||
|
||||
if (info->socket != INVALID_SOCKET) {
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
if (info->ssl) {
|
||||
SSL_shutdown(info->ssl);
|
||||
SSL_free(info->ssl);
|
||||
info->ssl = NULL;
|
||||
}
|
||||
#endif
|
||||
if (shutdown(info->socket, ShutdownMethod) == -1) {
|
||||
strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN);
|
||||
UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
@ -174,6 +139,8 @@ static int sock_read_write(
|
||||
size_t byte_left = (size_t)0;
|
||||
ssize_t num_written;
|
||||
|
||||
if (*timeoutSecs < 0)
|
||||
return UPNP_E_TIMEDOUT;
|
||||
FD_ZERO(&readSet);
|
||||
FD_ZERO(&writeSet);
|
||||
if (bRead)
|
||||
@ -183,7 +150,7 @@ static int sock_read_write(
|
||||
timeout.tv_sec = *timeoutSecs;
|
||||
timeout.tv_usec = 0;
|
||||
while (TRUE) {
|
||||
if (*timeoutSecs < 0)
|
||||
if (*timeoutSecs == 0)
|
||||
retCode = select(sockfd + 1, &readSet, &writeSet,
|
||||
NULL, NULL);
|
||||
else
|
||||
@ -208,36 +175,16 @@ static int sock_read_write(
|
||||
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
|
||||
#endif
|
||||
if (bRead) {
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
if (info->ssl) {
|
||||
numBytes = (long)SSL_read(info->ssl,
|
||||
buffer, (size_t)bufsize);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
/* read data. */
|
||||
numBytes = (long)recv(sockfd, buffer, bufsize, MSG_NOSIGNAL);
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
byte_left = bufsize;
|
||||
bytes_sent = 0;
|
||||
while (byte_left != (size_t)0) {
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
if (info->ssl) {
|
||||
num_written = SSL_write(info->ssl,
|
||||
buffer + bytes_sent, byte_left);
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
/* write data. */
|
||||
num_written = send(sockfd,
|
||||
buffer + bytes_sent, byte_left,
|
||||
MSG_DONTROUTE | MSG_NOSIGNAL);
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
}
|
||||
#endif
|
||||
if (num_written == -1) {
|
||||
#ifdef SO_NOSIGPIPE
|
||||
setsockopt(sockfd, SOL_SOCKET,
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||
* Copyright (c) 2012 France Telecom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -325,7 +325,6 @@ static int parse_hostport(
|
||||
const char *in,
|
||||
/*! [out] Output parameter where the host and port are represented as
|
||||
* an internet address. */
|
||||
unsigned short int defaultPort,
|
||||
hostport_type *out)
|
||||
{
|
||||
char workbuf[256];
|
||||
@ -421,7 +420,7 @@ found:
|
||||
return UPNP_E_INVALID_URL;
|
||||
} else
|
||||
/* Port was not specified, use default port. */
|
||||
port = defaultPort;
|
||||
port = 80u;
|
||||
/* The length of the host and port string can be calculated by */
|
||||
/* subtracting pointers. */
|
||||
hostport_size = (size_t)c - (size_t)workbuf;
|
||||
@ -709,7 +708,6 @@ int parse_uri(const char *in, size_t max, uri_type *out)
|
||||
int begin_path = 0;
|
||||
size_t begin_hostport = (size_t)0;
|
||||
size_t begin_fragment = (size_t)0;
|
||||
unsigned short int defaultPort = 80;
|
||||
|
||||
begin_hostport = parse_scheme(in, max, &out->scheme);
|
||||
if (begin_hostport) {
|
||||
@ -724,11 +722,7 @@ int parse_uri(const char *in, size_t max, uri_type *out)
|
||||
in[begin_hostport] == '/' &&
|
||||
in[begin_hostport + (size_t)1] == '/') {
|
||||
begin_hostport += (size_t)2;
|
||||
if (token_string_casecmp(&out->scheme, "https") == 0) {
|
||||
defaultPort = 443;
|
||||
}
|
||||
begin_path = parse_hostport(&in[begin_hostport],
|
||||
defaultPort,
|
||||
&out->hostport);
|
||||
if (begin_path >= 0) {
|
||||
begin_path += (int)begin_hostport;
|
||||
|
@ -1,28 +0,0 @@
|
||||
|
||||
|
||||
#ifndef CLIENTSUBSCRIPTION_H
|
||||
#define CLIENTSUBSCRIPTION_H
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief GenlibClientSubscription object declararion.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#define CLASS GenlibClientSubscription
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, RenewEventId, int) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, SID) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, ActualSID) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, EventURL) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, Next, GenlibClientSubscription *) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
|
||||
#endif /* CLIENTSUBSCRIPTION_H */
|
||||
|
@ -13,7 +13,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include "ClientSubscription.h"
|
||||
#include "service_table.h"
|
||||
#include "upnp.h"
|
||||
#include "UpnpString.h"
|
||||
@ -33,6 +32,154 @@ extern TimerThread gTimerThread;
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
|
||||
|
||||
typedef struct s_ClientSubscription ClientSubscription;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Constructor.
|
||||
*/
|
||||
ClientSubscription *UpnpClientSubscription_new();
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Destructor.
|
||||
*/
|
||||
void UpnpClientSubscription_delete(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Copy Constructor.
|
||||
*/
|
||||
ClientSubscription *UpnpClientSubscription_dup(
|
||||
/*! [in] The \b this pointer. */
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Assignment operator.
|
||||
*/
|
||||
void UpnpClientSubscription_assign(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *q,
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
int UpnpClientSubscription_get_RenewEventId(
|
||||
/*! [in] The \b this pointer. */
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_set_RenewEventId(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
/*! [in] . */
|
||||
int n);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
const UpnpString *UpnpClientSubscription_get_SID(
|
||||
/*! [in] The \b this pointer. */
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_set_SID(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
const UpnpString *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_strcpy_SID(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
const char *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
const UpnpString *UpnpClientSubscription_get_ActualSID(
|
||||
/*! [in] The \b this pointer. */
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_set_ActualSID(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
const UpnpString *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_strcpy_ActualSID(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
const char *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
const UpnpString *UpnpClientSubscription_get_EventURL(
|
||||
/*! [in] The \b this pointer. */
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_set_EventURL(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
const UpnpString *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_strcpy_EventURL(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
const char *s);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
ClientSubscription *UpnpClientSubscription_get_Next(
|
||||
/*! [in] The \b this pointer. */
|
||||
const ClientSubscription *p);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
void UpnpClientSubscription_set_Next(
|
||||
/*! [in] The \b this pointer. */
|
||||
ClientSubscription *p,
|
||||
ClientSubscription *q);
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Free memory allocated for client subscription data.
|
||||
*
|
||||
@ -40,7 +187,7 @@ extern TimerThread gTimerThread;
|
||||
*/
|
||||
void free_client_subscription(
|
||||
/*! [in] Client subscription to be freed. */
|
||||
GenlibClientSubscription *sub);
|
||||
ClientSubscription *sub);
|
||||
|
||||
|
||||
/*!
|
||||
@ -48,7 +195,7 @@ void free_client_subscription(
|
||||
*/
|
||||
void freeClientSubList(
|
||||
/*! [in] Client subscription list to be freed. */
|
||||
GenlibClientSubscription *list);
|
||||
ClientSubscription *list);
|
||||
|
||||
|
||||
/*!
|
||||
@ -58,7 +205,7 @@ void freeClientSubList(
|
||||
*/
|
||||
void RemoveClientSubClientSID(
|
||||
/*! [in] Head of the subscription list. */
|
||||
GenlibClientSubscription **head,
|
||||
ClientSubscription **head,
|
||||
/*! [in] Subscription ID to be mactched. */
|
||||
const UpnpString *sid);
|
||||
|
||||
@ -69,9 +216,9 @@ void RemoveClientSubClientSID(
|
||||
*
|
||||
* \return The matching subscription.
|
||||
*/
|
||||
GenlibClientSubscription *GetClientSubClientSID(
|
||||
ClientSubscription *GetClientSubClientSID(
|
||||
/*! [in] Head of the subscription list. */
|
||||
GenlibClientSubscription *head,
|
||||
ClientSubscription *head,
|
||||
/*! [in] Subscription ID to be mactched. */
|
||||
const UpnpString *sid);
|
||||
|
||||
@ -82,9 +229,9 @@ GenlibClientSubscription *GetClientSubClientSID(
|
||||
*
|
||||
* \return The matching subscription.
|
||||
*/
|
||||
GenlibClientSubscription *GetClientSubActualSID(
|
||||
ClientSubscription *GetClientSubActualSID(
|
||||
/*! [in] Head of the subscription list. */
|
||||
GenlibClientSubscription *head,
|
||||
ClientSubscription *head,
|
||||
/*! [in] Subscription ID to be mactched. */
|
||||
token *sid);
|
||||
|
||||
|
@ -86,20 +86,16 @@ typedef enum
|
||||
|
||||
/* end of private section. */
|
||||
|
||||
/* method in a HTTP request.
|
||||
* IMPORTANT: The enum values of the standard HTTP method should match
|
||||
* those of Upnp_HttpMethod enum defined in upnp.h */
|
||||
/* method in a HTTP request. */
|
||||
typedef enum
|
||||
{
|
||||
HTTPMETHOD_PUT = 0,
|
||||
HTTPMETHOD_DELETE = 1,
|
||||
HTTPMETHOD_GET = 2,
|
||||
HTTPMETHOD_HEAD = 3,
|
||||
HTTPMETHOD_POST = 4,
|
||||
HTTPMETHOD_POST,
|
||||
HTTPMETHOD_MPOST,
|
||||
HTTPMETHOD_SUBSCRIBE,
|
||||
HTTPMETHOD_UNSUBSCRIBE,
|
||||
HTTPMETHOD_NOTIFY,
|
||||
HTTPMETHOD_GET,
|
||||
HTTPMETHOD_HEAD,
|
||||
HTTPMETHOD_MSEARCH,
|
||||
HTTPMETHOD_UNKNOWN,
|
||||
SOAPMETHOD_POST,
|
||||
|
@ -229,6 +229,111 @@ int http_Download(
|
||||
OUT char* content_type );
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_WriteHttpPost
|
||||
*
|
||||
* Parameters:
|
||||
* IN void *Handle: Handle to the http post object
|
||||
* IN char *buf: Buffer to send to peer, if format used
|
||||
* is not UPNP_USING_CHUNKED,
|
||||
* IN size_t *size: Size of the data to be sent.
|
||||
* IN int timeout: time out value
|
||||
*
|
||||
* Description:
|
||||
* Formats data if format used is UPNP_USING_CHUNKED.
|
||||
* Writes data on the socket connected to the peer.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* -1 - On Socket Error.
|
||||
************************************************************************/
|
||||
int http_WriteHttpPost(IN void *Handle,
|
||||
IN char *buf,
|
||||
IN size_t *size,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_CloseHttpPost
|
||||
*
|
||||
* Parameters:
|
||||
* IN void *Handle; Handle to the http post object
|
||||
* IN OUT int *httpStatus; HTTP status returned on receiving a
|
||||
* response message
|
||||
* IN int timeout; time out value
|
||||
*
|
||||
* Description:
|
||||
* Sends remaining data if using UPNP_USING_CHUNKED
|
||||
* format. Receives any more messages. Destroys socket and any socket
|
||||
* associated memory. Frees handle associated with the HTTP POST msg.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
************************************************************************/
|
||||
int http_CloseHttpPost(IN void *Handle,
|
||||
IN OUT int *httpStatus,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_OpenHttpPost
|
||||
*
|
||||
* Parameters:
|
||||
* IN const char *url_str; String as a URL
|
||||
* IN OUT void **Handle; Pointer to buffer to store HTTP
|
||||
* post handle
|
||||
* IN const char *contentType; Type of content
|
||||
* IN int contentLength; length of content
|
||||
* IN int timeout; time out value
|
||||
*
|
||||
* Description:
|
||||
* Makes the HTTP POST message, connects to the peer,
|
||||
* sends the HTTP POST request. Adds the post handle to buffer of
|
||||
* such handles
|
||||
*
|
||||
* Return : int;
|
||||
* UPNP_E_SUCCESS - On success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* UPNP_E_OUTOF_MEMORY
|
||||
* UPNP_E_SOCKET_ERROR
|
||||
* UPNP_E_SOCKET_CONNECT
|
||||
************************************************************************/
|
||||
int http_OpenHttpPost(IN const char *url_str,
|
||||
IN OUT void **Handle,
|
||||
IN const char *contentType,
|
||||
IN int contentLength,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_ReadHttpGet
|
||||
*
|
||||
* Parameters:
|
||||
* IN void *Handle; Handle to the HTTP get object
|
||||
* IN OUT char *buf; Buffer to get the read and parsed data
|
||||
* IN OUT size_t *size; Size of the buffer passed
|
||||
* IN int timeout; time out value
|
||||
*
|
||||
* Description:
|
||||
* Parses already existing data, then gets new data.
|
||||
* Parses and extracts information from the new data.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
* UPNP_E_BAD_RESPONSE
|
||||
* UPNP_E_BAD_HTTPMSG
|
||||
* UPNP_E_CANCELED
|
||||
************************************************************************/
|
||||
int http_ReadHttpGet(
|
||||
IN void *Handle,
|
||||
IN OUT char *buf,
|
||||
IN OUT size_t *size,
|
||||
IN int timeout);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_HttpGetProgress
|
||||
*
|
||||
@ -249,242 +354,79 @@ int http_HttpGetProgress(
|
||||
OUT size_t *length,
|
||||
OUT size_t *total);
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_CloseHttpGet
|
||||
*
|
||||
* Parameters:
|
||||
* IN void *Handle; Handle to HTTP get object
|
||||
*
|
||||
* Description:
|
||||
* Clears the handle allocated for the HTTP GET operation
|
||||
* Clears socket states and memory allocated for socket operations.
|
||||
*
|
||||
* Return: int
|
||||
* UPNP_E_SUCCESS - On Success
|
||||
* UPNP_E_INVALID_PARAM - Invalid Parameter
|
||||
************************************************************************/
|
||||
int http_CloseHttpGet(IN void *Handle);
|
||||
|
||||
/*!
|
||||
* \brief Opens a connection to the server.
|
||||
* \brief Makes the HTTP GET message, connects to the peer,
|
||||
* sends the HTTP GET request, gets the response and parses the response.
|
||||
*
|
||||
* The SDK allocates the memory for \b handle, the
|
||||
* application is responsible for freeing this memory.
|
||||
* If a proxy URL is defined then the connection is made there.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b url, or \b handle
|
||||
* is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
|
||||
* resources or an error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
* \return integer
|
||||
* \li \c UPNP_E_SUCCESS - On Success
|
||||
* \li \c UPNP_E_INVALID_PARAM - Invalid Paramters
|
||||
* \li \c UPNP_E_OUTOF_MEMORY
|
||||
* \li \c UPNP_E_SOCKET_ERROR
|
||||
* \li \c UPNP_E_BAD_RESPONSE
|
||||
*/
|
||||
EXPORT_SPEC int http_OpenHttpConnection(
|
||||
/*! [in] The URL which contains the host, and the scheme to make the connection. */
|
||||
const char *url,
|
||||
/*! [in,out] A pointer in which to store the handle for this connection. This
|
||||
* handle is required for futher operations over this connection. */
|
||||
void **handle,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Makes a HTTP request using a connection previously created by
|
||||
* \b UpnpOpenHttpConnection.
|
||||
*
|
||||
* \note Trying to make another request while a request is already being processed
|
||||
* results in undefined behavior. It's up to the user to end a previous
|
||||
* request by calling \b UpnpEndHttpRequest.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b url, \b handle
|
||||
* or \b contentType is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
|
||||
* resources or an error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int http_MakeHttpRequest(
|
||||
/* ![in] The method to use to make the request. */
|
||||
Upnp_HttpMethod method,
|
||||
/*! [in] The URL to use to make the request. The URL should use the same
|
||||
* host and scheme used to create the connection. */
|
||||
const char *url,
|
||||
/*! [in] The handle to the connection. */
|
||||
void *handle,
|
||||
/*! [in] Headers to be used for the request. Each header should be terminated by a CRLF as specified
|
||||
* in the HTTP specification. If NULL then the default headers will be used. */
|
||||
UpnpString *headers,
|
||||
/*! [in] The media type of content being sent. Can be NULL. */
|
||||
const char *contentType,
|
||||
/*! [in] The length of the content being sent, in bytes. Set to \b UPNP_USING_CHUNKED to use
|
||||
* chunked encoding, or \b UPNP_UNTIL_CLOSE to avoid specifying the content length to the server.
|
||||
* In this case the request is considered unfinished until the connection is closed. */
|
||||
int contentLength,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Writes the content of a HTTP request initiated by a \b UpnpMakeHttpRequest call.
|
||||
* The end of the content should be indicated by a call to \b UpnpEndHttpRequest
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
|
||||
* or \b size is not a valid pointer.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int http_WriteHttpRequest(
|
||||
/*! [in] The handle of the connection created by the call to
|
||||
* \b UpnpOpenHttpConnection. */
|
||||
void *handle,
|
||||
/*! [in] The buffer containing date to be written. */
|
||||
char *buf,
|
||||
/*! [in] The size, in bytes of \b buf. */
|
||||
size_t *size,
|
||||
/*! [in] A timeout value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported. If
|
||||
* value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Indicates the end of a HTTP request previously made by
|
||||
* \b UpnpMakeHttpRequest.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: \b handle is not a valid pointer.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_SOCKET_ERROR: Error occured allocating a socket and
|
||||
* resources or an error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int http_EndHttpRequest(
|
||||
/*! [in] The handle to the connection. */
|
||||
void *handle,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the receiver, failing which, an error is reported.
|
||||
* If value is negative, timeout is infinite. */
|
||||
int timeout);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Gets the response from the server using a connection previously created
|
||||
* by \b UpnpOpenHttpConnection
|
||||
*
|
||||
* \note Memory for \b contentType is only valid until the next call to the HTTP API
|
||||
* for the same connection.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b handle,
|
||||
* \b contentType, \b contentLength or \b httpStatus
|
||||
* is not a valid pointer.
|
||||
* \li \c UPNP_E_INVALID_URL: The \b url is not a valid
|
||||
* URL.
|
||||
* \li \c UPNP_E_OUTOF_MEMORY: Insufficient resources exist to
|
||||
* download this file.
|
||||
* \li \c UPNP_E_NETWORK_ERROR: A network error occurred.
|
||||
* \li \c UPNP_E_SOCKET_WRITE: An error or timeout occurred writing
|
||||
* to a socket.
|
||||
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
|
||||
* from a socket.
|
||||
* \li \c UPNP_E_SOCKET_BIND: An error occurred binding a socket.
|
||||
* \li \c UPNP_E_SOCKET_CONNECT: An error occurred connecting a
|
||||
* socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
|
||||
* remote server.
|
||||
*/
|
||||
EXPORT_SPEC int http_GetHttpResponse(
|
||||
/*! [in] The handle of the connection created by the call to
|
||||
* \b UpnpOpenHttpConnection. */
|
||||
void *handle,
|
||||
/*! [in] Headers sent by the server for the response. If NULL then the
|
||||
* headers are not copied. */
|
||||
UpnpString *headers,
|
||||
/*! [out] A buffer to store the media type of the item. */
|
||||
int http_OpenHttpGet(
|
||||
/* [in] String as a URL. */
|
||||
const char *url_str,
|
||||
/* [in,out] Pointer to buffer to store HTTP post handle. */
|
||||
void **Handle,
|
||||
/* [in,out] Type of content. */
|
||||
char **contentType,
|
||||
/*! [out] A pointer to store the length of the item. */
|
||||
/* [out] length of content. */
|
||||
int *contentLength,
|
||||
/*! [out] The status returned on receiving a response message. */
|
||||
/* [out] HTTP status returned on receiving a response message. */
|
||||
int *httpStatus,
|
||||
/*! [in] The time out value sent with the request during which a response
|
||||
* is expected from the server, failing which, an error is reported
|
||||
* back to the user. If value is negative, timeout is infinite. */
|
||||
/* [in] time out value. */
|
||||
int timeout);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Reads the content of a response using a connection previously created
|
||||
* by \b UpnpOpenHttpConnection.
|
||||
* \brief Makes the HTTP GET message, connects to the peer,
|
||||
* sends the HTTP GET request, gets the response and parses the response.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: Either \b handle, \b buf
|
||||
* or \b size is not a valid pointer.
|
||||
* \li \c UPNP_E_BAD_RESPONSE: A bad response was received from the
|
||||
* remote server.
|
||||
* \li \c UPNP_E_BAD_HTTPMSG: Either the request or response was in
|
||||
* the incorrect format.
|
||||
* \li \c UPNP_E_CANCELED: another thread called UpnpCancelHttpGet.
|
||||
* If a proxy URL is defined then the connection is made there.
|
||||
*
|
||||
* Note: In case of return values, the status code parameter of the passed
|
||||
* in handle value may provide additional information on the return
|
||||
* value.
|
||||
* \return integer
|
||||
* \li \c UPNP_E_SUCCESS - On Success
|
||||
* \li \c UPNP_E_INVALID_PARAM - Invalid Paramters
|
||||
* \li \c UPNP_E_OUTOF_MEMORY
|
||||
* \li \c UPNP_E_SOCKET_ERROR
|
||||
* \li \c UPNP_E_BAD_RESPONSE
|
||||
*/
|
||||
EXPORT_SPEC int http_ReadHttpResponse(
|
||||
/*! [in] The handle of the connection created by the call to
|
||||
* \b UpnpOpenHttpConnection. */
|
||||
void *handle,
|
||||
/*! [in,out] The buffer to store the read item. */
|
||||
char *buf,
|
||||
/*! [in,out] The size of the buffer to be read. */
|
||||
size_t *size,
|
||||
/*! [in] The time out value sent with the request during which a response is
|
||||
* expected from the server, failing which, an error is reported back to
|
||||
* the user. If value is negative, timeout is infinite. */
|
||||
int http_OpenHttpGetProxy(
|
||||
/* [in] String as a URL. */
|
||||
const char *url_str,
|
||||
/* [in] String as a URL. */
|
||||
const char *proxy_str,
|
||||
/* [in,out] Pointer to buffer to store HTTP post handle. */
|
||||
void **Handle,
|
||||
/* [in,out] Type of content. */
|
||||
char **contentType,
|
||||
/* [out] length of content. */
|
||||
int *contentLength,
|
||||
/* [out] HTTP status returned on receiving a response message. */
|
||||
int *httpStatus,
|
||||
/* [in] time out value. */
|
||||
int timeout);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Closes the connection created with \b UpnpOpenHttpConnection
|
||||
* and frees any memory associated with the connection.
|
||||
*
|
||||
* \return An integer representing one of the following:
|
||||
* \li \c UPNP_E_SUCCESS: The operation completed successfully.
|
||||
* \li \c UPNP_E_INVALID_PARAM: \b handle, or is not a valid pointer.
|
||||
* \li \c UPNP_E_SOCKET_READ: An error or timeout occurred reading
|
||||
* from a socket.
|
||||
* \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently
|
||||
* allocated.
|
||||
*/
|
||||
EXPORT_SPEC int http_CloseHttpConnection(
|
||||
/*! [in] The handle of the connection to close, created by the call to
|
||||
* \b UpnpOpenHttpPost. */
|
||||
void *handle);
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Function: http_SendStatusResponse
|
||||
*
|
||||
|
@ -41,12 +41,8 @@
|
||||
* \file
|
||||
*/
|
||||
|
||||
#include "upnpconfig.h"
|
||||
#include "UpnpInet.h" /* for SOCKET, netinet/in */
|
||||
#include "UpnpGlobal.h" /* for UPNP_INLINE */
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
#include <openssl/ssl.h>
|
||||
#endif
|
||||
|
||||
/* The following are not defined under winsock.h */
|
||||
#ifndef SD_RECEIVE
|
||||
@ -62,9 +58,6 @@ typedef struct
|
||||
SOCKET socket;
|
||||
/*! The following two fields are filled only in incoming requests. */
|
||||
struct sockaddr_storage foreign_sockaddr;
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
SSL *ssl;
|
||||
#endif
|
||||
} SOCKINFO;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -120,20 +113,6 @@ int sock_init_with_ip(
|
||||
/*! [in] Remote socket address. */
|
||||
struct sockaddr *foreign_sockaddr);
|
||||
|
||||
/*!
|
||||
* \brief Associates an SSL object with the socket and begins
|
||||
* the client-side SSL/TLS handshake.
|
||||
*
|
||||
* \return Integer:
|
||||
* \li \c UPNP_E_SUCCESS
|
||||
* \li \c UPNP_E_SOCKET_ERROR
|
||||
*/
|
||||
#ifdef UPNP_ENABLE_OPEN_SSL
|
||||
int sock_ssl_connect(
|
||||
/*! [out] Socket Information Object. */
|
||||
SOCKINFO* info);
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \brief Shutsdown the socket using the ShutdownMethod to indicate whether
|
||||
* sends and receives on the socket will be dis-allowed.
|
||||
|
@ -113,7 +113,7 @@ struct Handle_Info
|
||||
/* Client only */
|
||||
#ifdef INCLUDE_CLIENT_APIS
|
||||
/*! Client subscription list. */
|
||||
GenlibClientSubscription *ClientSubList;
|
||||
ClientSubscription *ClientSubList;
|
||||
/*! Active SSDP searches. */
|
||||
LinkedList SsdpSearchList;
|
||||
#endif
|
||||
|
@ -39,7 +39,6 @@
|
||||
#ifdef INCLUDE_DEVICE_APIS
|
||||
#if EXCLUDE_SOAP == 0
|
||||
|
||||
#include "ActionRequest.h"
|
||||
#include "httpparser.h"
|
||||
#include "httpreadwrite.h"
|
||||
#include "parsetools.h"
|
||||
@ -298,52 +297,46 @@ static UPNP_INLINE void handle_query_variable(
|
||||
/*! [in] Node containing variable name. */
|
||||
IXML_Node *req_node)
|
||||
{
|
||||
UpnpStateVarRequest *variable = UpnpStateVarRequest_new();
|
||||
struct Upnp_State_Var_Request variable;
|
||||
const char *err_str;
|
||||
int err_code;
|
||||
const DOMString var_name;
|
||||
|
||||
/* set default error */
|
||||
err_code = SOAP_INVALID_VAR;
|
||||
err_str = Soap_Invalid_Var;
|
||||
|
||||
if (variable == NULL) {
|
||||
err_code = SOAP_MEMORY_OUT;
|
||||
err_str = Soap_Memory_out;
|
||||
goto error_handler;
|
||||
}
|
||||
|
||||
UpnpStateVarRequest_set_ErrCode(variable, UPNP_E_SUCCESS);
|
||||
UpnpStateVarRequest_strcpy_DevUDN(variable, soap_info->dev_udn);
|
||||
UpnpStateVarRequest_strcpy_ServiceID(variable, soap_info->service_id);
|
||||
variable.ErrCode = UPNP_E_SUCCESS;
|
||||
linecopy(variable.ErrStr, "");
|
||||
namecopy(variable.DevUDN, soap_info->dev_udn);
|
||||
namecopy(variable.ServiceID, soap_info->service_id);
|
||||
var_name = ixmlNode_getNodeValue(req_node);
|
||||
UpnpStateVarRequest_strcpy_StateVarName(variable, var_name);
|
||||
UpnpStateVarRequest_set_CtrlPtIPAddr(variable, &info->foreign_sockaddr);
|
||||
namecopy(variable.StateVarName, var_name);
|
||||
variable.CtrlPtIPAddr = info->foreign_sockaddr;
|
||||
variable.CurrentVal = NULL;
|
||||
|
||||
/* send event */
|
||||
soap_info->callback(UPNP_CONTROL_GET_VAR_REQUEST, variable,
|
||||
soap_info->callback(UPNP_CONTROL_GET_VAR_REQUEST, &variable,
|
||||
soap_info->cookie);
|
||||
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||
"Return from callback for var request\n");
|
||||
"Return from callback for var request\n");
|
||||
/* validate, and handle result */
|
||||
if (UpnpStateVarRequest_get_CurrentVal(variable) == NULL)
|
||||
goto error_handler;
|
||||
if (UpnpStateVarRequest_get_ErrCode(variable) != UPNP_E_SUCCESS) {
|
||||
if (UpnpString_get_Length(UpnpStateVarRequest_get_ErrStr(variable)) > 0) {
|
||||
err_code = UpnpStateVarRequest_get_ErrCode(variable);
|
||||
err_str = UpnpStateVarRequest_get_ErrStr_cstr(variable);
|
||||
if (variable.CurrentVal == NULL) {
|
||||
send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var,
|
||||
request);
|
||||
return;
|
||||
}
|
||||
if (variable.ErrCode != UPNP_E_SUCCESS) {
|
||||
if (strlen(variable.ErrStr) == 0) {
|
||||
err_code = SOAP_INVALID_VAR;
|
||||
err_str = Soap_Invalid_Var;
|
||||
} else {
|
||||
err_code = variable.ErrCode;
|
||||
err_str = variable.ErrStr;
|
||||
}
|
||||
goto error_handler;
|
||||
send_error_response(info, err_code, err_str, request);
|
||||
ixmlFreeDOMString(variable.CurrentVal);
|
||||
return;
|
||||
}
|
||||
/* send response */
|
||||
send_var_query_response(info, UpnpStateVarRequest_get_CurrentVal(variable), request);
|
||||
err_code = 0;
|
||||
|
||||
/* error handling and cleanup */
|
||||
error_handler:
|
||||
UpnpStateVarRequest_delete(variable);
|
||||
if (err_code != 0)
|
||||
send_error_response(info, err_code, err_str, request);
|
||||
send_var_query_response(info, variable.CurrentVal, request);
|
||||
ixmlFreeDOMString(variable.CurrentVal);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -360,12 +353,12 @@ static void handle_invoke_action(
|
||||
IXML_Node *req_node)
|
||||
{
|
||||
char save_char;
|
||||
UpnpActionRequest *action = UpnpActionRequest_new();
|
||||
IXML_Document *actionRequestDoc = NULL;
|
||||
IXML_Document *actionResultDoc = NULL;
|
||||
IXML_Document *req_doc = NULL;
|
||||
struct Upnp_Action_Request action;
|
||||
int err_code;
|
||||
const char *err_str;
|
||||
memptr action_name;
|
||||
action.ActionResult = NULL;
|
||||
DOMString act_node = NULL;
|
||||
|
||||
/* null-terminate */
|
||||
@ -379,7 +372,7 @@ static void handle_invoke_action(
|
||||
err_str = Soap_Memory_out;
|
||||
goto error_handler;
|
||||
}
|
||||
err_code = ixmlParseBufferEx(act_node, &actionRequestDoc);
|
||||
err_code = ixmlParseBufferEx(act_node, &req_doc);
|
||||
if (err_code != IXML_SUCCESS) {
|
||||
if (IXML_INSUFFICIENT_MEMORY == err_code) {
|
||||
err_code = SOAP_MEMORY_OUT;
|
||||
@ -390,46 +383,45 @@ static void handle_invoke_action(
|
||||
}
|
||||
goto error_handler;
|
||||
}
|
||||
UpnpActionRequest_set_ErrCode(action, UPNP_E_SUCCESS);
|
||||
UpnpActionRequest_strcpy_ActionName(action, action_name.buf);
|
||||
UpnpActionRequest_strcpy_DevUDN(action, soap_info->dev_udn);
|
||||
UpnpActionRequest_strcpy_ServiceID(action, soap_info->service_id);
|
||||
UpnpActionRequest_set_ActionRequest(action, actionRequestDoc);
|
||||
UpnpActionRequest_set_ActionResult(action, NULL);
|
||||
UpnpActionRequest_set_CtrlPtIPAddr(action, &info->foreign_sockaddr);
|
||||
|
||||
action.ErrCode = UPNP_E_SUCCESS;
|
||||
linecopy(action.ErrStr, "");
|
||||
namecopy(action.ActionName, action_name.buf);
|
||||
namecopy(action.DevUDN, soap_info->dev_udn);
|
||||
namecopy(action.ServiceID, soap_info->service_id);
|
||||
action.ActionRequest = req_doc;
|
||||
action.ActionResult = NULL;
|
||||
action.CtrlPtIPAddr = info->foreign_sockaddr;
|
||||
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__, "Calling Callback\n");
|
||||
soap_info->callback(UPNP_CONTROL_ACTION_REQUEST, action, soap_info->cookie);
|
||||
err_code = UpnpActionRequest_get_ErrCode(action);
|
||||
if (err_code != UPNP_E_SUCCESS) {
|
||||
err_str = UpnpActionRequest_get_ErrStr_cstr(action);
|
||||
if (strlen(err_str) <= 0) {
|
||||
soap_info->callback(UPNP_CONTROL_ACTION_REQUEST, &action, soap_info->cookie);
|
||||
if (action.ErrCode != UPNP_E_SUCCESS) {
|
||||
if (strlen(action.ErrStr) <= 0) {
|
||||
err_code = SOAP_ACTION_FAILED;
|
||||
err_str = Soap_Action_Failed;
|
||||
} else {
|
||||
err_code = action.ErrCode;
|
||||
err_str = action.ErrStr;
|
||||
}
|
||||
goto error_handler;
|
||||
}
|
||||
/* validate, and handle action error */
|
||||
actionResultDoc = UpnpActionRequest_get_ActionResult(action);
|
||||
if (actionResultDoc == NULL) {
|
||||
if (action.ActionResult == NULL) {
|
||||
err_code = SOAP_ACTION_FAILED;
|
||||
err_str = Soap_Action_Failed;
|
||||
goto error_handler;
|
||||
}
|
||||
/* send response */
|
||||
send_action_response(info, actionResultDoc, request);
|
||||
send_action_response(info, action.ActionResult, request);
|
||||
err_code = 0;
|
||||
|
||||
/* error handling and cleanup */
|
||||
error_handler:
|
||||
ixmlDocument_free(actionResultDoc);
|
||||
ixmlDocument_free(actionRequestDoc);
|
||||
ixmlDocument_free(action.ActionResult);
|
||||
ixmlDocument_free(req_doc);
|
||||
ixmlFreeDOMString(act_node);
|
||||
/* restore */
|
||||
action_name.buf[action_name.length] = save_char;
|
||||
if (err_code != 0)
|
||||
send_error_response(info, err_code, err_str, request);
|
||||
UpnpActionRequest_delete(action);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1,22 +0,0 @@
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief SSDPResultData object implementation.
|
||||
*
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "ssdp_ResultData.h"
|
||||
|
||||
void SSDPResultData_Callback(const SSDPResultData *p)
|
||||
{
|
||||
Upnp_FunPtr callback = SSDPResultData_get_CtrlptCallback(p);
|
||||
callback(UPNP_DISCOVERY_SEARCH_RESULT,
|
||||
SSDPResultData_get_Param(p),
|
||||
SSDPResultData_get_Cookie(p));
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#ifndef SSDP_RESULTDATA_H
|
||||
#define SSDP_RESULTDATA_H
|
||||
|
||||
@ -14,37 +13,14 @@
|
||||
* \author Marcelo Roberto Jimenez
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef TEMPLATE_GENERATE_SOURCE
|
||||
#undef TEMPLATE_GENERATE_SOURCE
|
||||
|
||||
#include "Discovery.h" /* for UpnpDiscovery */
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#else /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
#include "Discovery.h" /* for UpnpDiscovery */
|
||||
|
||||
#endif /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#include "Callback.h" /* for Upnp_FunPtr */
|
||||
|
||||
#define CLASS SSDPResultData
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_OBJECT(CLASS, Param, UpnpDiscovery) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, Cookie, void *) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, CtrlptCallback, Upnp_FunPtr) \
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
/*! */
|
||||
void SSDPResultData_Callback(const SSDPResultData *p);
|
||||
/*! Structure to contain Discovery response. */
|
||||
typedef struct resultData
|
||||
{
|
||||
struct Upnp_Discovery param;
|
||||
void *cookie;
|
||||
Upnp_FunPtr ctrlpt_callback;
|
||||
} ResultData;
|
||||
|
||||
/* @} SSDPlib */
|
||||
|
||||
#endif /* SSDP_RESULTDATA_H */
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
* Copyright (C) 2012 France Telecom All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -69,10 +70,11 @@ static void send_search_result(
|
||||
/* [in] Search reply from the device. */
|
||||
IN void *data)
|
||||
{
|
||||
SSDPResultData *temp = (SSDPResultData *)data;
|
||||
ResultData *temp = (ResultData *) data;
|
||||
|
||||
SSDPResultData_Callback(temp);
|
||||
SSDPResultData_delete(temp);
|
||||
temp->ctrlpt_callback(UPNP_DISCOVERY_SEARCH_RESULT, &temp->param,
|
||||
temp->cookie);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_addr,
|
||||
@ -83,9 +85,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
memptr hdr_value;
|
||||
/* byebye or alive */
|
||||
int is_byebye;
|
||||
UpnpDiscovery *param = UpnpDiscovery_new();
|
||||
int expires;
|
||||
int ret;
|
||||
struct Upnp_Discovery param;
|
||||
SsdpEvent event;
|
||||
int nt_found;
|
||||
int usn_found;
|
||||
@ -97,7 +97,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
ListNode *node = NULL;
|
||||
SsdpSearchArg *searchArg = NULL;
|
||||
int matched = 0;
|
||||
SSDPResultData *threadData = NULL;
|
||||
ResultData *threadData = NULL;
|
||||
ThreadPoolJob job;
|
||||
|
||||
memset(&job, 0, sizeof(job));
|
||||
@ -107,7 +107,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
|
||||
if (GetClientHandleInfo(&handle, &ctrlpt_info) != HND_CLIENT) {
|
||||
HandleUnlock();
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
return;
|
||||
}
|
||||
/* copy */
|
||||
ctrlpt_callback = ctrlpt_info->Callback;
|
||||
@ -116,43 +116,45 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
/* search timeout */
|
||||
if (timeout) {
|
||||
ctrlpt_callback(UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie);
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
return;
|
||||
}
|
||||
|
||||
UpnpDiscovery_set_ErrCode(param, UPNP_E_SUCCESS);
|
||||
param.ErrCode = UPNP_E_SUCCESS;
|
||||
/* MAX-AGE, assume error */
|
||||
expires = -1;
|
||||
UpnpDiscovery_set_Expires(param, expires);
|
||||
param.Expires = -1;
|
||||
if (httpmsg_find_hdr(hmsg, HDR_CACHE_CONTROL, &hdr_value) != NULL) {
|
||||
ret = matchstr(hdr_value.buf, hdr_value.length,
|
||||
"%imax-age = %d%0", &expires);
|
||||
UpnpDiscovery_set_Expires(param, expires);
|
||||
if (ret != PARSE_OK)
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
if (matchstr(hdr_value.buf, hdr_value.length,
|
||||
"%imax-age = %d%0", ¶m.Expires) != PARSE_OK)
|
||||
return;
|
||||
}
|
||||
/* DATE */
|
||||
param.Date[0] = '\0';
|
||||
if (httpmsg_find_hdr(hmsg, HDR_DATE, &hdr_value) != NULL) {
|
||||
UpnpDiscovery_strcpy_Date(param, hdr_value.buf);
|
||||
linecopylen(param.Date, hdr_value.buf, hdr_value.length);
|
||||
}
|
||||
/* dest addr */
|
||||
UpnpDiscovery_set_DestAddr(param, dest_addr);
|
||||
memcpy(¶m.DestAddr, dest_addr, sizeof(struct sockaddr_storage));
|
||||
/* EXT */
|
||||
param.Ext[0] = '\0';
|
||||
if (httpmsg_find_hdr(hmsg, HDR_EXT, &hdr_value) != NULL) {
|
||||
UpnpDiscovery_strncpy_Ext(param, hdr_value.buf,
|
||||
hdr_value.length);
|
||||
linecopylen(param.Ext, hdr_value.buf, hdr_value.length);
|
||||
}
|
||||
/* LOCATION */
|
||||
param.Location[0] = '\0';
|
||||
if (httpmsg_find_hdr(hmsg, HDR_LOCATION, &hdr_value) != NULL) {
|
||||
UpnpDiscovery_strncpy_Location(param, hdr_value.buf,
|
||||
hdr_value.length);
|
||||
linecopylen(param.Location, hdr_value.buf, hdr_value.length);
|
||||
}
|
||||
/* SERVER / USER-AGENT */
|
||||
param.Os[0] = '\0';
|
||||
if (httpmsg_find_hdr(hmsg, HDR_SERVER, &hdr_value) != NULL ||
|
||||
httpmsg_find_hdr(hmsg, HDR_USER_AGENT, &hdr_value) != NULL) {
|
||||
UpnpDiscovery_strncpy_Os(param, hdr_value.buf,
|
||||
hdr_value.length);
|
||||
linecopylen(param.Os, hdr_value.buf, hdr_value.length);
|
||||
}
|
||||
/* clear everything */
|
||||
memset(param.DeviceId, 0, sizeof(param.DeviceId));
|
||||
memset(param.DeviceType, 0, sizeof(param.DeviceType));
|
||||
memset(param.ServiceType, 0, sizeof(param.ServiceType));
|
||||
/* not used; version is in ServiceType */
|
||||
param.ServiceVer[0] = '\0';
|
||||
event.UDN[0] = '\0';
|
||||
event.DeviceType[0] = '\0';
|
||||
event.ServiceType[0] = '\0';
|
||||
@ -171,30 +173,29 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
hdr_value.buf[hdr_value.length] = save_char;
|
||||
}
|
||||
if (nt_found || usn_found) {
|
||||
UpnpDiscovery_strcpy_DeviceID(param, event.UDN);
|
||||
UpnpDiscovery_strcpy_DeviceType(param, event.DeviceType);
|
||||
UpnpDiscovery_strcpy_ServiceType(param, event.ServiceType);
|
||||
strncpy(param.DeviceId, event.UDN, sizeof(param.DeviceId) - 1);
|
||||
strncpy(param.DeviceType, event.DeviceType,
|
||||
sizeof(param.DeviceType) - 1);
|
||||
strncpy(param.ServiceType, event.ServiceType,
|
||||
sizeof(param.ServiceType) - 1);
|
||||
}
|
||||
/* ADVERT. OR BYEBYE */
|
||||
if (hmsg->is_request) {
|
||||
/* use NTS hdr to determine advert., or byebye */
|
||||
if (httpmsg_find_hdr(hmsg, HDR_NTS, &hdr_value) == NULL) {
|
||||
/* error; NTS header not found */
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
return; /* error; NTS header not found */
|
||||
}
|
||||
if (memptr_cmp(&hdr_value, "ssdp:alive") == 0) {
|
||||
is_byebye = FALSE;
|
||||
} else if (memptr_cmp(&hdr_value, "ssdp:byebye") == 0) {
|
||||
is_byebye = TRUE;
|
||||
} else {
|
||||
/* bad value */
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
return; /* bad value */
|
||||
}
|
||||
if (is_byebye) {
|
||||
/* check device byebye */
|
||||
if (!nt_found || !usn_found) {
|
||||
/* bad byebye */
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
return; /* bad byebye */
|
||||
}
|
||||
event_type = UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE;
|
||||
} else {
|
||||
@ -203,15 +204,13 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
* only. Expires should be greater than 1800 (30 mins) */
|
||||
if (!nt_found ||
|
||||
!usn_found ||
|
||||
UpnpString_get_Length(UpnpDiscovery_get_Location(param)) == 0 ||
|
||||
UpnpDiscovery_get_Expires(param) <= 0) {
|
||||
/* bad advertisement */
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
strlen(param.Location) == 0 || param.Expires <= 0) {
|
||||
return; /* bad advertisement */
|
||||
}
|
||||
event_type = UPNP_DISCOVERY_ADVERTISEMENT_ALIVE;
|
||||
}
|
||||
/* call callback */
|
||||
ctrlpt_callback(event_type, param, ctrlpt_cookie);
|
||||
ctrlpt_callback(event_type, ¶m, ctrlpt_cookie);
|
||||
} else {
|
||||
/* reply (to a SEARCH) */
|
||||
/* only checking to see if there is a valid ST header */
|
||||
@ -224,17 +223,15 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
hdr_value.buf[hdr_value.length] = save_char;
|
||||
}
|
||||
if (hmsg->status_code != HTTP_OK ||
|
||||
UpnpDiscovery_get_Expires(param) <= 0 ||
|
||||
UpnpString_get_Length(UpnpDiscovery_get_Location(param)) == 0 ||
|
||||
!usn_found || !st_found) {
|
||||
/* bad reply */
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
param.Expires <= 0 ||
|
||||
strlen(param.Location) == 0 || !usn_found || !st_found) {
|
||||
return; /* bad reply */
|
||||
}
|
||||
/* check each current search */
|
||||
HandleLock();
|
||||
if (GetClientHandleInfo(&handle, &ctrlpt_info) != HND_CLIENT) {
|
||||
HandleUnlock();
|
||||
goto end_ssdp_handle_ctrlpt_msg;
|
||||
return;
|
||||
}
|
||||
node = ListHead(&ctrlpt_info->SsdpSearchList);
|
||||
/* temporary add null termination */
|
||||
@ -280,15 +277,13 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
}
|
||||
if (matched) {
|
||||
/* schedule call back */
|
||||
threadData = SSDPResultData_new();
|
||||
threadData =
|
||||
(ResultData *) malloc(sizeof(ResultData));
|
||||
if (threadData != NULL) {
|
||||
SSDPResultData_set_Param(threadData,
|
||||
param);
|
||||
SSDPResultData_set_Cookie(threadData,
|
||||
searchArg->
|
||||
cookie);
|
||||
SSDPResultData_set_CtrlptCallback
|
||||
(threadData, ctrlpt_callback);
|
||||
threadData->param = param;
|
||||
threadData->cookie = searchArg->cookie;
|
||||
threadData->ctrlpt_callback =
|
||||
ctrlpt_callback;
|
||||
TPJobInit(&job, (start_routine)
|
||||
send_search_result,
|
||||
threadData);
|
||||
@ -297,7 +292,7 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
(free_routine)
|
||||
free);
|
||||
if (ThreadPoolAdd(&gRecvThreadPool, &job, NULL) != 0) {
|
||||
SSDPResultData_delete(threadData);
|
||||
free(threadData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -305,11 +300,8 @@ void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_
|
||||
}
|
||||
|
||||
HandleUnlock();
|
||||
/*ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, param, cookie ); */
|
||||
/*ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, ¶m, cookie ); */
|
||||
}
|
||||
|
||||
end_ssdp_handle_ctrlpt_msg:
|
||||
UpnpDiscovery_delete(param);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# "Makefile.am" for "libupnp/upnp/unittest"
|
||||
#
|
||||
# Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
|
||||
#
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/upnp/inc \
|
||||
-I$(top_srcdir)/threadutil/inc \
|
||||
-I$(top_srcdir)/ixml/inc \
|
||||
-I$(top_srcdir)/upnp/src/inc
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/upnp/libupnp.la \
|
||||
$(top_builddir)/threadutil/libthreadutil.la \
|
||||
$(top_builddir)/ixml/libixml.la
|
||||
|
||||
#unittest
|
||||
noinst_PROGRAMS = unittest
|
||||
|
||||
unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
unittest_SOURCES = \
|
||||
main.c \
|
||||
templates/FirstObject.c \
|
||||
templates/FirstObject.h \
|
||||
templates/templates.c \
|
||||
templates/templates.h \
|
||||
templates/SecondObject.c \
|
||||
templates/SecondObject.h \
|
||||
templates/TheStruct.h
|
||||
|
@ -1,29 +0,0 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "templates/templates.h"
|
||||
|
||||
int (*tests[])(void) = {
|
||||
templates,
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int i;
|
||||
int n = (sizeof tests) / (sizeof tests[0]);
|
||||
int result;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
result = tests[i]();
|
||||
printf("Test number %3d: %s.\n", i + 1, !result ? "PASS" : "FAIL");
|
||||
ret += result;
|
||||
}
|
||||
printf("\n"
|
||||
"Failed in %d tests.\n"
|
||||
"Passed in %d tests.\n",
|
||||
ret, n - ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,6 +0,0 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "FirstObject.h"
|
||||
|
@ -1,44 +0,0 @@
|
||||
|
||||
#ifndef FIRSTOBJECT_H
|
||||
#define FIRSTOBJECT_H
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Object used in unit testing of object templates.
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef TEMPLATE_GENERATE_SOURCE
|
||||
#undef TEMPLATE_GENERATE_SOURCE
|
||||
|
||||
#include "SecondObject.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#else /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
#include "SecondObject.h"
|
||||
|
||||
#endif /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#include "TheStruct.h"
|
||||
|
||||
#define CLASS UnitFirstObject
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TheInteger, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TheUnsignedLong, unsigned long) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TheCharPointer, char *) \
|
||||
EXPAND_CLASS_MEMBER_BUFFER(CLASS, TheBuffer, struct TheStruct) \
|
||||
EXPAND_CLASS_MEMBER_LIST(CLASS, TheList) \
|
||||
EXPAND_CLASS_MEMBER_OBJECT(CLASS, TheSecondObject, UnitSecondObject) \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, TheString) \
|
||||
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, TheDomString)
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
#endif /* FIRSTOBJECT_H */
|
||||
|
@ -1,6 +0,0 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#include "SecondObject.h"
|
||||
|
@ -1,44 +0,0 @@
|
||||
|
||||
#ifndef SECONDOBJECT_H
|
||||
#define SECONDOBJECT_H
|
||||
|
||||
/*!
|
||||
* \file
|
||||
*
|
||||
* \brief Object used in unit testing of object templates.
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef TEMPLATE_GENERATE_SOURCE
|
||||
#undef TEMPLATE_GENERATE_SOURCE
|
||||
|
||||
/*#include "ThirdObject.h"*/
|
||||
|
||||
#define TEMPLATE_GENERATE_SOURCE
|
||||
#else /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
/*#include "ThirdObject.h"*/
|
||||
|
||||
#endif /* TEMPLATE_GENERATE_SOURCE */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#include "TheStruct.h"
|
||||
|
||||
#define CLASS UnitSecondObject
|
||||
|
||||
#define EXPAND_CLASS_MEMBERS(CLASS) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TheInteger, int) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TheUnsignedLong, unsigned long) \
|
||||
EXPAND_CLASS_MEMBER_INT(CLASS, TheCharPointer, char *) \
|
||||
EXPAND_CLASS_MEMBER_BUFFER(CLASS, TheBuffer, struct TheStruct) \
|
||||
EXPAND_CLASS_MEMBER_LIST(CLASS, TheList) \
|
||||
/* EXPAND_CLASS_MEMBER_OBJECT(CLASS, TheThirdObject, ThirdObject) */ \
|
||||
EXPAND_CLASS_MEMBER_STRING(CLASS, TheString) \
|
||||
EXPAND_CLASS_MEMBER_DOMSTRING(CLASS, TheDomString)
|
||||
|
||||
#include "TemplateInclude.h"
|
||||
|
||||
#endif /* SECONDOBJECT_H */
|
||||
|
@ -1,11 +0,0 @@
|
||||
|
||||
#ifndef THESTRUCT_H
|
||||
#define THESTRUCT_H
|
||||
|
||||
struct TheStruct {
|
||||
int a;
|
||||
long b;
|
||||
};
|
||||
|
||||
#endif /* THESTRUCT_H */
|
||||
|
@ -1,33 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
#
|
||||
# The purpose of this file is to make it easier to find problems in
|
||||
# Template Objects compilation.
|
||||
#
|
||||
# Because Template Objects are a result of preprocessing, the are normally
|
||||
# invisible to the human eye. So, we paint him! Using the C pre-processor.
|
||||
#
|
||||
# The issue is that compilation error messages give all errors at the same
|
||||
# lines. Using a combination of the pre-processor and indent, we are able
|
||||
# to produce a good readable code, so that we can debug the templates.
|
||||
#
|
||||
|
||||
if [[ "$1" == "" ]]; then
|
||||
echo "Error: no file name given, please enter the C file name."
|
||||
exit -1
|
||||
fi
|
||||
|
||||
FILENAME=$(basename $1 .c)
|
||||
|
||||
top_srcdir=../../..
|
||||
|
||||
INCLUDES=
|
||||
INCLUDES="${INCLUDES} -I${top_srcdir}"
|
||||
INCLUDES="${INCLUDES} -I${top_srcdir}/ixml/inc"
|
||||
INCLUDES="${INCLUDES} -I${top_srcdir}/threadutil/inc" \
|
||||
INCLUDES="${INCLUDES} -I${top_srcdir}/upnp/inc" \
|
||||
INCLUDES="${INCLUDES} -I${top_srcdir}/upnp/src/inc"
|
||||
|
||||
gcc ${INCLUDES} -E ${FILENAME}.c | grep -v ^# | indent -linux > ${FILENAME}.pp.c
|
||||
gcc ${INCLUDES} -Wall -c ${FILENAME}.pp.c
|
||||
|
@ -1,13 +0,0 @@
|
||||
|
||||
#include "templates.h"
|
||||
|
||||
#include "FirstObject.h"
|
||||
#include "SecondObject.h"
|
||||
|
||||
int templates(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
|
||||
#ifndef TEMPLATES_H
|
||||
#define TEMPLATES_H
|
||||
|
||||
int templates(void);
|
||||
|
||||
#endif /* TEMPLATES_H */
|
||||
|
Loading…
Reference in New Issue
Block a user