Compare commits
	
		
			243 Commits
		
	
	
		
			release-1.
			...
			release-1.
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 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 | 
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -98,8 +98,8 @@ m4/lt~obsolete.m4 | ||||
| stamp-h1 | ||||
| upnp/inc/stamp-h2 | ||||
| upnp/inc/upnpconfig.h | ||||
| upnp/sample/upnp_tv_combo | ||||
| upnp/sample/upnp_tv_ctrlpt | ||||
| upnp/sample/upnp_tv_device | ||||
| upnp/sample/tv_combo | ||||
| upnp/sample/tv_ctrlpt | ||||
| upnp/sample/tv_device | ||||
| docs/doxygen | ||||
|  | ||||
|   | ||||
							
								
								
									
										2
									
								
								Doxyfile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								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.6.9 | ||||
| PROJECT_NUMBER         = 1.6.17 | ||||
|  | ||||
| # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)  | ||||
| # base path where the generated documentation will be put.  | ||||
|   | ||||
							
								
								
									
										11
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README
									
									
									
									
									
								
							| @@ -227,17 +227,18 @@ To build the samples (note: this is the default behaviour): | ||||
| % ./configure --enable-samples | ||||
| % make | ||||
|  | ||||
| will build the sample device "$(LIBUPNP)/upnp/upnp_tv_device" and | ||||
| sample control point "$(LIBUPNP)/upnp/upnp_tv_ctrlpt".  | ||||
| will build the sample device "$(LIBUPNP)/upnp/tv_device" and | ||||
| sample control point "$(LIBUPNP)/upnp/tv_ctrlpt".  | ||||
| Note : the sample device won't be built if --disable-device has been  | ||||
| configured, and the sample control point won't be build if --disable-client  | ||||
| has been configured. | ||||
|  | ||||
| To run the sample device, you need the "$(LIBUPNP)/upnp/sample/tvdevice/web"  | ||||
| sub-directory. Example : | ||||
| To run the sample device, you need to create a tvdevice directory and move | ||||
| the web directory there, giving: "$(LIBUPNP)/upnp/sample/tvdevice/web". | ||||
| To run the sample invoke from the command line as follows: | ||||
|  | ||||
| % cd $(LIBUPNP)/upnp/sample/tvdevice | ||||
| % ../../upnp_tv_device | ||||
| % ../tv_device | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										14
									
								
								THANKS
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								THANKS
									
									
									
									
									
								
							| @@ -14,7 +14,7 @@ exempt of errors. | ||||
| - Bob Ciora | ||||
| - Carlo Parata | ||||
| - Carl Benson | ||||
| - Chandra (inactiveneurons) | ||||
| - Chandra Penke (inactiveneurons) | ||||
| - Chaos | ||||
| - Charles Nepveu (cnepveu) | ||||
| - Chris Pickel | ||||
| @@ -27,15 +27,18 @@ exempt of errors. | ||||
| - Eric Tanguy | ||||
| - Erwan Velu | ||||
| - Eugene Christensen | ||||
| - Fabrice Fontaine | ||||
| - Fabrice Fontaine (ffontaine) | ||||
| - Fredrik Svensson | ||||
| - Glen Masgai | ||||
| - Hartmut Holzgraefe - hholzgra | ||||
| - Hartmut Holzgraefe (hholzgra) | ||||
| - Iain Denniston (ectotropic) | ||||
| - Ingo Hofmann | ||||
| - Ivan Romanov (ivanromanov) | ||||
| - Jiri Zouhar | ||||
| - John Dennis | ||||
| - Jonathan Casiot (no_dice) | ||||
| - Josh Carroll | ||||
| - Juergen Lock | ||||
| - Keith Brindley | ||||
| - Leuk_He | ||||
| - Loigu | ||||
| @@ -45,6 +48,7 @@ exempt of errors. | ||||
| - Nektarios K. Papadopoulos (npapadop) | ||||
| - Nicholas Kraft | ||||
| - Nick Leverton (leveret) | ||||
| - Obata Akio (obache) | ||||
| - Oskar Liljeblad | ||||
| - Michael (oxygenic) | ||||
| - Paul Vixie | ||||
| @@ -53,8 +57,12 @@ exempt of errors. | ||||
| - Robert Gingher (robsbox) | ||||
| - Ronan Menard | ||||
| - Siva Chandran | ||||
| - Stefan Sommerfeld (zerocom) | ||||
| - Stéphane Corthésy | ||||
| - Steve Bresson | ||||
| - Timothy Redaelli | ||||
| - Titus Winters | ||||
| - Tom (tomdev2) | ||||
| - Yoichi Nakayama (yoichi) | ||||
| - zephyrus (zephyrus00jp) | ||||
|  | ||||
|   | ||||
| @@ -19,15 +19,9 @@ | ||||
| /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ | ||||
| #define HAVE_FSEEKO 1 | ||||
|  | ||||
| /* Define to 1 if you have the `ftime' function. */ | ||||
| #define HAVE_FTIME 1 | ||||
|  | ||||
| /* Define to 1 if you have the <inttypes.h> header file. */ | ||||
| #define HAVE_INTTYPES_H 1 | ||||
|  | ||||
| /* Define to 1 if you have the `compat' library (-lcompat). */ | ||||
| /* #undef HAVE_LIBCOMPAT */ | ||||
|  | ||||
| /* Define to 1 if you have the <limits.h> header file. */ | ||||
| #define HAVE_LIMITS_H 1 | ||||
|  | ||||
| @@ -55,6 +49,12 @@ | ||||
| /* Define to 1 if you have the <string.h> header file. */ | ||||
| #define HAVE_STRING_H 1 | ||||
|  | ||||
| /* Defines if strndup is available on your system */ | ||||
| #define HAVE_STRNDUP 1 | ||||
|  | ||||
| /* Defines if strnlen is available on your system */ | ||||
| #define HAVE_STRNLEN 1 | ||||
|  | ||||
| /* Define to 1 if you have the <syslog.h> header file. */ | ||||
| #define HAVE_SYSLOG_H 1 | ||||
|  | ||||
| @@ -105,13 +105,16 @@ | ||||
| #define PACKAGE_NAME "libupnp" | ||||
|  | ||||
| /* Define to the full name and version of this package. */ | ||||
| #define PACKAGE_STRING "libupnp 1.6.9" | ||||
| #define PACKAGE_STRING "libupnp 1.6.17" | ||||
|  | ||||
| /* Define to the one symbol short name of this package. */ | ||||
| #define PACKAGE_TARNAME "libupnp" | ||||
|  | ||||
| /* Define to the home page for this package. */ | ||||
| #define PACKAGE_URL "" | ||||
|  | ||||
| /* Define to the version of this package. */ | ||||
| #define PACKAGE_VERSION "1.6.9" | ||||
| #define PACKAGE_VERSION "1.6.17" | ||||
|  | ||||
| /* Define to necessary symbol if this constant uses a non-standard name on | ||||
|    your system. */ | ||||
| @@ -120,12 +123,18 @@ | ||||
| /* Define to 1 if you have the ANSI C header files. */ | ||||
| #define STDC_HEADERS 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| /* #undef UPNP_ENABLE_IPV6 */ | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_ENABLE_NOTIFICATION_REORDERING 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| /* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */ | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_CLIENT 1 | ||||
|  | ||||
| @@ -135,6 +144,18 @@ | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_DEVICE 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_GENA 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_OPTSSDP 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_SOAP 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_SSDP 1 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_HAVE_TOOLS 1 | ||||
|  | ||||
| @@ -151,19 +172,19 @@ | ||||
| #define UPNP_VERSION_MINOR 6 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_VERSION_PATCH 9 | ||||
| #define UPNP_VERSION_PATCH 17 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_VERSION_STRING "1.6.9" | ||||
| #define UPNP_VERSION_STRING "1.6.17" | ||||
|  | ||||
| /* Version number of package */ | ||||
| #define VERSION "1.6.9" | ||||
| #define VERSION "1.6.17" | ||||
|  | ||||
| /* File Offset size */ | ||||
| #define _FILE_OFFSET_BITS 64 | ||||
|  | ||||
| /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | ||||
| /* #undef _LARGEFILE_SOURCE */ | ||||
| #define _LARGEFILE_SOURCE 1 | ||||
|  | ||||
| /* Large files support */ | ||||
| #define _LARGE_FILE_SOURCE /**/ | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
|  ***************************************************************************/  | ||||
|  | ||||
| /** The library version (string) e.g. "1.3.0" */ | ||||
| #define UPNP_VERSION_STRING "1.6.9" | ||||
| #define UPNP_VERSION_STRING "1.6.17" | ||||
|  | ||||
| /** Major version of the library */ | ||||
| #define UPNP_VERSION_MAJOR 1 | ||||
| @@ -49,7 +49,7 @@ | ||||
| #define UPNP_VERSION_MINOR 6 | ||||
|  | ||||
| /** Patch version of the library */ | ||||
| #define UPNP_VERSION_PATCH 9 | ||||
| #define UPNP_VERSION_PATCH 17 | ||||
|  | ||||
| /** The library version (numeric) e.g. 10300 means version 1.3.0 */ | ||||
| #define UPNP_VERSION	\ | ||||
| @@ -57,6 +57,19 @@ | ||||
|  | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Large file support | ||||
|  ***************************************************************************/ | ||||
|  | ||||
| /** File Offset size */ | ||||
| #define _FILE_OFFSET_BITS 64 | ||||
|  | ||||
| /** Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | ||||
| #define _LARGEFILE_SOURCE 1 | ||||
|  | ||||
| /** Large files support */ | ||||
| #define _LARGE_FILE_SOURCE /**/ | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Library optional features | ||||
|  ***************************************************************************/ | ||||
| @@ -87,6 +100,26 @@ | ||||
| #define UPNP_HAVE_WEBSERVER 1 | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with the SSDP part enabled | ||||
|  *  (i.e. configure --enable-ssdp) */ | ||||
| #define UPNP_HAVE_SSDP 1 | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with optional SSDP headers | ||||
|  *  support (i.e. configure --enable-optssdp) */ | ||||
| #define UPNP_HAVE_OPTSSDP 1 | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with the SOAP part enabled | ||||
|  *  (i.e. configure --enable-soap) */ | ||||
| #define UPNP_HAVE_SOAP 1 | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with the GENA part enabled | ||||
|  *  (i.e. configure --enable-gena) */ | ||||
| #define UPNP_HAVE_GENA 1 | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with helper API | ||||
|  *  (i.e. configure --enable-tools) : <upnp/upnptools.h> file is available */ | ||||
| #define UPNP_HAVE_TOOLS 1 | ||||
| @@ -95,5 +128,9 @@ | ||||
|  *  (i.e. configure --enable-ipv6) */ | ||||
| /* #undef UPNP_ENABLE_IPV6 */ | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with unspecified SERVER | ||||
|  * header (i.e. configure --enable-unspecified_server) */ | ||||
| /* #undef UPNP_ENABLE_UNSPECIFIED_SERVER */ | ||||
|  | ||||
| #endif /* UPNP_CONFIG_H */ | ||||
|  | ||||
|   | ||||
| @@ -103,8 +103,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc" | ||||
| 				PreprocessorDefinitions="WIN32;IXML_INLINE=" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;IXML_INLINE=" | ||||
| 				RuntimeLibrary="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
|   | ||||
| @@ -50,7 +50,7 @@ | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| @@ -80,8 +80,8 @@ | ||||
| 				OutputFile="$(OutDir)\libupnp.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				ProgramDatabaseFile=".\Release/libupnp.pdb" | ||||
| 				ImportLibrary=".\Release/libupnp.lib" | ||||
| 				ProgramDatabaseFile="$(OutDir)\libupnp.pdb" | ||||
| 				ImportLibrary="$(OutDir)\libupnp.lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -96,7 +96,7 @@ | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile=".\Release/libupnp.bsc" | ||||
| 				OutputFile="$(OutDir)\libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| @@ -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,10 +226,6 @@ | ||||
| 				RelativePath="..\..\upnp\src\genlib\client_table\client_table.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\Discovery.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\document.c" | ||||
| 				> | ||||
| @@ -246,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" | ||||
| 				> | ||||
| @@ -358,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" | ||||
| 				> | ||||
| @@ -370,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" | ||||
| 				> | ||||
| @@ -447,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" | ||||
| 				> | ||||
| @@ -463,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" | ||||
| 				> | ||||
| @@ -563,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" | ||||
| 				> | ||||
| @@ -579,10 +507,6 @@ | ||||
| 				RelativePath="..\..\upnp\src\inc\strintmap.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\SubscriptionRequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\sysdep.h" | ||||
| 				> | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;UPNP_USE_MSVCPP" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| @@ -80,9 +80,9 @@ | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| @@ -103,6 +103,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="WIN32;UPNP_USE_MSVCPP" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| @@ -118,18 +120,11 @@ | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 				Name="VCLibrarianTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| @@ -139,12 +134,6 @@ | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvcombo;..\..\upnp\sample\tvcombo\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;UPNP_USE_MSVCPP" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| @@ -91,8 +91,8 @@ | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| @@ -114,6 +114,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvcombo;..\..\upnp\sample\tvcombo\linux" | ||||
| 				PreprocessorDefinitions="WIN32;UPNP_USE_MSVCPP" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| @@ -130,6 +132,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| @@ -174,15 +178,15 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\linux\upnp_tv_combo_main.c" | ||||
| 				RelativePath="..\..\upnp\sample\linux\tv_combo_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt;..\..\upnp\sample\tvctrlpt\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;UPNP_USE_MSVCPP" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| @@ -91,8 +91,8 @@ | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| @@ -114,6 +114,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt;..\..\upnp\sample\tvctrlpt\linux" | ||||
| 				PreprocessorDefinitions="WIN32;UPNP_USE_MSVCPP" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| @@ -130,6 +132,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib  libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| @@ -174,11 +178,11 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\linux\upnp_tv_ctrlpt_main.c" | ||||
| 				RelativePath="..\..\upnp\sample\linux\tv_ctrlpt_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;UPNP_USE_MSVCPP" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| @@ -91,8 +91,8 @@ | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| @@ -114,6 +114,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;UPNP_USE_MSVCPP" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| @@ -130,6 +132,8 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| @@ -174,11 +178,11 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\linux\upnp_tv_device_main.c" | ||||
| 				RelativePath="..\..\upnp\sample\linux\tv_device_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
|   | ||||
| @@ -11,16 +11,20 @@ | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 		<Platform | ||||
| 			Name="x64" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| @@ -41,12 +45,16 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -59,6 +67,75 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| @@ -78,11 +155,12 @@ | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| @@ -102,13 +180,19 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -121,6 +205,354 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			EnableManagedIncrementalBuild="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
|   | ||||
| @@ -28,34 +28,112 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvcombo", "tvcombo.vcproj", | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug Lib|Win32 = Debug Lib|Win32 | ||||
| 		Debug Lib|x64 = Debug Lib|x64 | ||||
| 		Debug|Win32 = Debug|Win32 | ||||
| 		Debug|x64 = Debug|x64 | ||||
| 		Release Lib|Win32 = Release Lib|Win32 | ||||
| 		Release Lib|x64 = Release Lib|x64 | ||||
| 		Release|Win32 = Release|Win32 | ||||
| 		Release|x64 = Release|x64 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug Lib|x64.Build.0 = Debug Lib|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release Lib|Win32.Build.0 = Release Lib|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release Lib|x64.ActiveCfg = Release Lib|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release Lib|x64.Build.0 = Release Lib|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|x64.Build.0 = Release|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug Lib|x64.Build.0 = Debug Lib|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release Lib|Win32.Build.0 = Release Lib|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release Lib|x64.ActiveCfg = Release Lib|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release Lib|x64.Build.0 = Release Lib|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|x64.Build.0 = Release|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug Lib|x64.Build.0 = Debug Lib|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release Lib|Win32.Build.0 = Release Lib|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release Lib|x64.ActiveCfg = Release Lib|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release Lib|x64.Build.0 = Release Lib|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|x64.Build.0 = Release|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug Lib|x64.Build.0 = Debug Lib|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release Lib|Win32.Build.0 = Release Lib|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release Lib|x64.ActiveCfg = Release Lib|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release Lib|x64.Build.0 = Release Lib|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|x64.Build.0 = Release|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug Lib|x64.Build.0 = Debug Lib|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release Lib|Win32.Build.0 = Release Lib|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release Lib|x64.ActiveCfg = Release Lib|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release Lib|x64.Build.0 = Release Lib|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|x64.Build.0 = Release|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug Lib|Win32.ActiveCfg = Debug Lib|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug Lib|Win32.Build.0 = Debug Lib|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug Lib|x64.ActiveCfg = Debug Lib|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug Lib|x64.Build.0 = Debug Lib|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release Lib|Win32.ActiveCfg = Release Lib|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release Lib|Win32.Build.0 = Release Lib|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release Lib|x64.ActiveCfg = Release Lib|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release Lib|x64.Build.0 = Release Lib|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|x64.Build.0 = Release|x64 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9,00" | ||||
| 	Version="9.00" | ||||
| 	Name="libupnp" | ||||
| 	ProjectGUID="{6227F51A-1498-4C4A-B213-F6FDED605125}" | ||||
| 	RootNamespace="libupnp" | ||||
| @@ -11,19 +11,22 @@ | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 		<Platform | ||||
| 			Name="x64" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| @@ -49,19 +52,23 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include,..\ixml\src\inc,..\ixml\inc,..\threadutil\inc,..\upnp\inc,..\upnp\src\inc,.\inc" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				WholeProgramOptimization="true" | ||||
| 				AdditionalIncludeDirectories="..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile=".\Release/libupnp.pch" | ||||
| 				AssemblerListingLocation=".\Release/" | ||||
| 				ObjectFile=".\Release/" | ||||
| 				ProgramDataBaseFileName=".\Release/" | ||||
| 				BrowseInformation="1" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -76,14 +83,20 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib" | ||||
| 				OutputFile=".\Release/libupnp.dll" | ||||
| 				AdditionalDependencies="pthreadvc2.lib ws2_32.lib iphlpapi.lib ixml.lib threadutil.lib" | ||||
| 				OutputFile="$(OutDir)\$(ProjectName).dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				ProgramDatabaseFile=".\Release/libupnp.pdb" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="2" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				LinkTimeCodeGeneration="1" | ||||
| 				RandomizedBaseAddress="1" | ||||
| 				DataExecutionPrevention="0" | ||||
| 				ImportLibrary=".\Release/libupnp.lib" | ||||
| 				ImportLibrary="$(TargetDir)$(TargetName).lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -111,11 +124,115 @@ | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			Name="Release|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="3" | ||||
| 				TypeLibraryName=".\Release/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				WholeProgramOptimization="true" | ||||
| 				AdditionalIncludeDirectories=""$(SolutionDir)\..\inc";"$(SolutionDir)\..\msvc";"$(SolutionDir)\..\..\upnp\inc";"$(SolutionDir)\..\..\upnp\src\inc";"$(SolutionDir)\..\..\ixml\inc";"$(SolutionDir)\..\..\ixml\src\inc";"$(SolutionDir)\..\..\threadutil\inc";"$(SolutionDir)\..\..\pthreads";"$(SolutionDir)\..\..\pthreads\include"" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadvc2.lib ws2_32.lib iphlpapi.lib ixml.lib threadutil.lib" | ||||
| 				OutputFile="$(OutDir)\$(ProjectName).dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="2" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				LinkTimeCodeGeneration="1" | ||||
| 				RandomizedBaseAddress="1" | ||||
| 				DataExecutionPrevention="0" | ||||
| 				ImportLibrary="$(TargetDir)$(TargetName).lib" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile=".\Release/libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| @@ -144,19 +261,20 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				AdditionalIncludeDirectories="..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				PrecompiledHeaderFile="$(OutDir)\libupnp.pch" | ||||
| 				AssemblerListingLocation="$(OutDir)\" | ||||
| 				ObjectFile="$(OutDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\" | ||||
| 				BrowseInformation="1" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -171,15 +289,17 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib $(TargetDir)..\ixml\ixml.lib" | ||||
| 				OutputFile="$(OutDir)\libupnp.dll" | ||||
| 				LinkIncremental="2" | ||||
| 				AdditionalDependencies="pthreadvc2.lib ws2_32.lib iphlpapi.lib ixml.lib threadutil.lib" | ||||
| 				OutputFile="$(OutDir)\$(ProjectName).dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\libupnp.pdb" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="2" | ||||
| 				RandomizedBaseAddress="1" | ||||
| 				DataExecutionPrevention="0" | ||||
| 				ImportLibrary="$(OutDir)\libupnp.lib" | ||||
| 				ImportLibrary="$(TargetDir)$(TargetName).lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -206,6 +326,436 @@ | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="2" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="3" | ||||
| 				TypeLibraryName=".\Debug/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories=""$(SolutionDir)\..\inc";"$(SolutionDir)\..\msvc";"$(SolutionDir)\..\..\upnp\inc";"$(SolutionDir)\..\..\upnp\src\inc";"$(SolutionDir)\..\..\ixml\inc";"$(SolutionDir)\..\..\ixml\src\inc";"$(SolutionDir)\..\..\threadutil\inc";"$(SolutionDir)\..\..\pthreads";"$(SolutionDir)\..\..\pthreads\include"" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadvc2.lib ws2_32.lib iphlpapi.lib ixml.lib threadutil.lib" | ||||
| 				OutputFile="$(OutDir)\$(ProjectName).dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="2" | ||||
| 				RandomizedBaseAddress="1" | ||||
| 				DataExecutionPrevention="0" | ||||
| 				ImportLibrary="$(TargetDir)$(TargetName).lib" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile="$(OutDir)\libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Debug/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile="$(OutDir)\libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="3" | ||||
| 				TypeLibraryName=".\Debug/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories=""$(SolutionDir)\..\inc";"$(SolutionDir)\..\msvc";"$(SolutionDir)\..\..\upnp\inc";"$(SolutionDir)\..\..\upnp\src\inc";"$(SolutionDir)\..\..\ixml\inc";"$(SolutionDir)\..\..\ixml\src\inc";"$(SolutionDir)\..\..\threadutil\inc";"$(SolutionDir)\..\..\pthreads";"$(SolutionDir)\..\..\pthreads\include"" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile="$(OutDir)\libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Release/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				WholeProgramOptimization="true" | ||||
| 				AdditionalIncludeDirectories="..\inc;..\msvc;..\..\upnp\inc;..\..\upnp\src\inc;..\..\ixml\inc;..\..\ixml\src\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile=".\Release/libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="3" | ||||
| 				TypeLibraryName=".\Release/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				WholeProgramOptimization="true" | ||||
| 				AdditionalIncludeDirectories=""$(SolutionDir)\..\inc";"$(SolutionDir)\..\msvc";"$(SolutionDir)\..\..\upnp\inc";"$(SolutionDir)\..\..\upnp\src\inc";"$(SolutionDir)\..\..\ixml\inc";"$(SolutionDir)\..\..\ixml\src\inc";"$(SolutionDir)\..\..\threadutil\inc";"$(SolutionDir)\..\..\pthreads";"$(SolutionDir)\..\..\pthreads\include"" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile="" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ObjectFile="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				BrowseInformation="0" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile=".\Release/libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| @@ -214,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" | ||||
| 				> | ||||
| @@ -230,10 +772,6 @@ | ||||
| 				RelativePath="..\..\upnp\src\genlib\client_table\client_table.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\Discovery.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\document.c" | ||||
| 				> | ||||
| @@ -242,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" | ||||
| 				> | ||||
| @@ -278,10 +804,6 @@ | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\httpreadwrite.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inet_pton.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixml.c" | ||||
| 				> | ||||
| @@ -354,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" | ||||
| 				> | ||||
| @@ -366,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" | ||||
| 				> | ||||
| @@ -444,11 +950,11 @@ | ||||
| 			Filter="h;hpp;hxx;hm;inl" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\ActionComplete.h" | ||||
| 				RelativePath="..\inc\autoconfig.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\ActionRequest.h" | ||||
| 				RelativePath="..\..\upnp\inc\Callback.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| @@ -459,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" | ||||
| 				> | ||||
| @@ -495,10 +985,6 @@ | ||||
| 				RelativePath="..\..\upnp\src\inc\gmtdate.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\http_client.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\httpparser.h" | ||||
| 				> | ||||
| @@ -508,7 +994,7 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\inet_pton.h" | ||||
| 				RelativePath="..\msvc\inttypes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| @@ -559,28 +1045,32 @@ | ||||
| 				RelativePath="..\..\upnp\src\inc\statcodes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\StateVarComplete.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\StateVarRequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\statuscodes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\msvc\stdint.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\strintmap.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\SubscriptionRequest.h" | ||||
| 				RelativePath="..\..\upnp\src\inc\sysdep.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\sysdep.h" | ||||
| 				RelativePath="..\..\upnp\inc\TemplateInclude.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\TemplateSource.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\TemplateUndef.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| @@ -599,10 +1089,30 @@ | ||||
| 				RelativePath="..\..\upnp\src\inc\upnpapi.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\inc\upnpconfig.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnpdebug.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpGlobal.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpInet.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpIntTypes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpStdInt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpString.h" | ||||
| 				> | ||||
| @@ -611,6 +1121,14 @@ | ||||
| 				RelativePath="..\..\upnp\inc\upnptools.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpUniStd.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnputil.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\uri.h" | ||||
| 				> | ||||
| @@ -619,27 +1137,19 @@ | ||||
| 				RelativePath="..\..\upnp\src\inc\urlconfig.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\utilall.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\uuid.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\VirtualDir.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\webserver.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath="..\..\..\..\libupnp_win32.patch" | ||||
| 			> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9,00" | ||||
| 	Version="9.00" | ||||
| 	Name="threadutil" | ||||
| 	ProjectGUID="{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}" | ||||
| 	RootNamespace="threadutil" | ||||
| @@ -11,14 +11,17 @@ | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 		<Platform | ||||
| 			Name="x64" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| @@ -40,13 +43,15 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -60,8 +65,73 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\lib" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| @@ -81,9 +151,9 @@ | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| @@ -105,11 +175,15 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| @@ -124,18 +198,12 @@ | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| @@ -146,7 +214,341 @@ | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\lib\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="0" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\pthreads;..\..\pthreads\include" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| @@ -204,12 +606,6 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9,00" | ||||
| 	Version="9.00" | ||||
| 	Name="tvcombo" | ||||
| 	ProjectGUID="{6365804B-22C6-4D5E-91F3-0C052EB55B4F}" | ||||
| 	RootNamespace="tvcombo" | ||||
| @@ -11,16 +11,19 @@ | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 		<Platform | ||||
| 			Name="x64" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| @@ -40,13 +43,15 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -60,9 +65,12 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib $(TargetDir)..\libupnp\libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(TargetDir)..\ixml";"$(TargetDir)..\threadutil";"$(TargetDir)..\libupnp"" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -88,11 +96,89 @@ | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| @@ -114,8 +200,13 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;RELEASE;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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| @@ -131,7 +222,12 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| @@ -158,6 +254,406 @@ | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;RELEASE;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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| @@ -172,24 +668,18 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\linux\upnp_tv_combo_main.c" | ||||
| 				RelativePath="..\..\upnp\sample\linux\tv_combo_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| @@ -200,11 +690,11 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.h" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.h" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
|   | ||||
| @@ -11,14 +11,17 @@ | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 		<Platform | ||||
| 			Name="x64" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| @@ -40,13 +43,16 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -59,9 +65,12 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";".\out.vc9.$(ConfigurationName)\ixml";".\out.vc9.$(ConfigurationName)\threadutil";".\out.vc9.$(ConfigurationName)\libupnp"" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -86,10 +95,88 @@ | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| @@ -113,10 +200,16 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;RELEASE;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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -129,7 +222,12 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| @@ -156,6 +254,406 @@ | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;RELEASE;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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| @@ -170,11 +668,11 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\linux\upnp_tv_ctrlpt_main.c" | ||||
| 				RelativePath="..\..\upnp\sample\linux\tv_ctrlpt_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| @@ -188,16 +686,10 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.h" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
|   | ||||
| @@ -11,14 +11,17 @@ | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 		<Platform | ||||
| 			Name="x64" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| @@ -40,13 +43,16 @@ | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -59,9 +65,12 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";".\out.vc9.$(ConfigurationName)\ixml";".\out.vc9.$(ConfigurationName)\threadutil";".\out.vc9.$(ConfigurationName)\libupnp"" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| @@ -86,10 +95,88 @@ | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG;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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| @@ -113,10 +200,16 @@ | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;RELEASE;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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| @@ -129,7 +222,12 @@ | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| @@ -156,6 +254,406 @@ | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="WIN32;RELEASE;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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				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" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release Lib|x64" | ||||
| 			OutputDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\bin\" | ||||
| 			IntermediateDirectory="$(SolutionDir)\out.vc9.$(PlatformName)\$(ConfigurationName)\tmp\" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				TargetEnvironment="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				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" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				AssemblerListingLocation="$(IntDir)\" | ||||
| 				ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib ws2_32.lib iphlpapi.lib " | ||||
| 				LinkIncremental="1" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\;..\..\pthreads\lib;$(OutDir)\..\lib;$(OutDir)\..\bin" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" | ||||
| 				SubSystem="1" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="17" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| @@ -170,11 +668,11 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.c" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\linux\upnp_tv_device_main.c" | ||||
| 				RelativePath="..\..\upnp\sample\linux\tv_device_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| @@ -188,16 +686,10 @@ | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.h" | ||||
| 				RelativePath="..\..\upnp\sample\common\tv_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
|   | ||||
							
								
								
									
										172
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										172
									
								
								configure.ac
									
									
									
									
									
								
							| @@ -9,7 +9,7 @@ | ||||
|  | ||||
| AC_PREREQ(2.60) | ||||
|  | ||||
| AC_INIT([libupnp], [1.6.9], [mroberto@users.sourceforge.net]) | ||||
| AC_INIT([libupnp], [1.6.17], [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: | ||||
| @@ -193,10 +193,129 @@ dnl #AC_SUBST([LT_VERSION_IXML],       [2:5:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:2:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [4:2:0]) | ||||
| dnl # | ||||
|  ############################################################################ | ||||
| AC_SUBST([LT_VERSION_IXML],       [2:5:0]) | ||||
| AC_SUBST([LT_VERSION_THREADUTIL], [5:2:2]) | ||||
| AC_SUBST([LT_VERSION_UPNP],       [4:2:0]) | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.10: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in ixml  | ||||
| dnl #	revision: 5 -> 6 | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # - interface has changed in upnp | ||||
| dnl #   current: 4 -> 5 | ||||
| dnl #   revision: 3 -> 0 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0]) | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.11: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 3 -> 4 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 3 -> 4 | ||||
| dnl # - interface has changed in upnp | ||||
| dnl #   current: 5 -> 6 | ||||
| dnl #   revision: 4 -> 0 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:4:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [6:0:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.12: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - interface added in threadutil | ||||
| dnl #   current: 5 -> 6 | ||||
| dnl #   revision: 4 - > 0 | ||||
| dnl #   age: 2 -> 3 | ||||
| dnl # - interfaces removed in threadutil | ||||
| dnl #   age: 3 -> 0 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [6:0:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.13: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 0 -> 1 | ||||
| dnl # - interface added in upnp | ||||
| dnl #   current: 6 -> 7 | ||||
| dnl #   revision: 1 - > 0 | ||||
| dnl #   age: 0 -> 1 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [7:0:1]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.14: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 0 -> 1 | ||||
| dnl # - interface added in upnp | ||||
| dnl #   current: 7 -> 8 | ||||
| dnl #   revision: 1 - > 0 | ||||
| dnl #   age: 1 -> 2 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [8:0:2]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.15: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 0 -> 1 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:6:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:0:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [8:1:2]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.16: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in ixml | ||||
| dnl #	revision: 6 -> 7 | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #   revision: 0 -> 1 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 1 -> 2 | ||||
| dnl # - interface changed/added/removed in upnp | ||||
| dnl #   current++(9); revision = 0 | ||||
| dnl # - interface added in upnp | ||||
| dnl #   age++(3) | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:7:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:1:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [9:0:3]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.17: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #   revision: 1 -> 2 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #   revision: 0 -> 1 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:7:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [6:2:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [9:1:3]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| AC_SUBST([LT_VERSION_IXML],       [2:7:0]) | ||||
| AC_SUBST([LT_VERSION_THREADUTIL], [6:2:0]) | ||||
| AC_SUBST([LT_VERSION_UPNP],       [9:1:3]) | ||||
| dnl ############################################################################ | ||||
| dnl # Repeating the algorithm to place it closer to the modificatin place: | ||||
| dnl # 	- library code modified:		revision++ | ||||
| @@ -284,6 +403,29 @@ if test "x$enable_webserver" = xyes ; then | ||||
| 	AC_DEFINE(UPNP_HAVE_WEBSERVER, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([ssdp], [yes], [SSDP part]) | ||||
| if test "x$enable_ssdp" = xyes ; then | ||||
|         AC_DEFINE(UPNP_HAVE_SSDP, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([optssdp], [yes], [optionnal SSDP headers support)]) | ||||
| if test "x$enable_optssdp" = xyes ; then | ||||
|         AC_DEFINE(UPNP_HAVE_OPTSSDP, 1, [see upnpconfig.h]) | ||||
| 	enable_uuid=yes | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([soap], [yes], [SOAP part]) | ||||
| if test "x$enable_soap" = xyes ; then | ||||
|         AC_DEFINE(UPNP_HAVE_SOAP, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([gena], [yes], [GENA part]) | ||||
| if test "x$enable_gena" = xyes ; then | ||||
|         AC_DEFINE(UPNP_HAVE_GENA, 1, [see upnpconfig.h]) | ||||
| 	enable_uuid=yes | ||||
| fi | ||||
|  | ||||
| AM_CONDITIONAL(ENABLE_UUID, test x"$enable_uuid" = xyes) | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([tools], [yes], [helper APIs in upnptools.h]) | ||||
| if test "x$enable_tools" = xyes ; then | ||||
| @@ -295,11 +437,21 @@ if test "x$enable_ipv6" = xyes ; then | ||||
|         AC_DEFINE(UPNP_ENABLE_IPV6, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([unspecified_server], [no], [unspecified SERVER header]) | ||||
| if test "x$enable_unspecified_server" = xyes ; then | ||||
|         AC_DEFINE(UPNP_ENABLE_UNSPECIFIED_SERVER, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([notification_reordering], [yes], [GENA notification reordering in gena_device.c]) | ||||
| if test "x$enable_notification_reordering" = xyes ; then | ||||
|         AC_DEFINE(UPNP_ENABLE_NOTIFICATION_REORDERING, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([blocking_tcp_connections], [yes], [blocking TCP connections]) | ||||
| if test "x$enable_blocking_tcp_connections" = xyes ; then | ||||
|         AC_DEFINE(UPNP_ENABLE_BLOCKING_TCP_CONNECTIONS, 1, [see upnpconfig.h]) | ||||
| fi | ||||
|  | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code]) | ||||
|  | ||||
| @@ -360,10 +512,11 @@ freebsd*) | ||||
| *) | ||||
| 	echo "Using non-specific system compiler settings" | ||||
| 	if test x"$enable_debug" = xyes; then | ||||
| 		# AC_PROG_CC already sets CFLAGS to "-g -O2" by default | ||||
| 		# AC_PROG_CC already sets CFLAGS to "-g -O2" by default, | ||||
| 		# but only if CFLAGS was not previously set. | ||||
| 		#: | ||||
| 		# Use -O0 in debug so that variables do not get optimized out | ||||
| 		AX_CFLAGS_GCC_OPTION([-O0]) | ||||
| 		AX_CFLAGS_GCC_OPTION([-O0, -g]) | ||||
| 	else | ||||
| 		# add optimise for size | ||||
| 		AX_CFLAGS_GCC_OPTION([-Os]) | ||||
| @@ -464,7 +617,10 @@ fi | ||||
| # | ||||
| AC_FUNC_VPRINTF | ||||
| AC_FUNC_FSEEKO | ||||
| AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)]) | ||||
| AC_CHECK_FUNC(strnlen, | ||||
| 	AC_DEFINE(HAVE_STRNLEN, 1, [Defines if strnlen is available on your system])) | ||||
| AC_CHECK_FUNC(strndup, | ||||
| 	AC_DEFINE(HAVE_STRNDUP, 1, [Defines if strndup is available on your system])) | ||||
| # | ||||
| # Solaris needs -lsocket -lnsl -lrt | ||||
| AC_SEARCH_LIBS([bind],           [socket]) | ||||
|   | ||||
| @@ -738,7 +738,7 @@ EXPORT_SPEC int ixmlDocument_createDocumentEx( | ||||
|  * \return A pointer to the new \b Document object with the nodeName set to | ||||
|  *  	"#document" or \c NULL on failure. | ||||
|  */ | ||||
| EXPORT_SPEC IXML_Document *ixmlDocument_createDocument(); | ||||
| EXPORT_SPEC IXML_Document *ixmlDocument_createDocument(void); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|   | ||||
| @@ -41,7 +41,10 @@ void IxmlPrintf( | ||||
| #else /* DEBUG */ | ||||
| static UPNP_INLINE void IxmlPrintf( | ||||
| 	const char *FmtStr, | ||||
| 	...) {} | ||||
| 	...) | ||||
| { | ||||
| 	FmtStr = FmtStr; | ||||
| } | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|  | ||||
| @@ -59,6 +62,8 @@ static UPNP_INLINE void printNodes( | ||||
| 	IXML_Node *tmpRoot, | ||||
| 	int depth) | ||||
| { | ||||
| 	tmpRoot = tmpRoot; | ||||
| 	depth = depth; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -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:  | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -139,10 +140,11 @@ int ixmlDocument_createElementEx( | ||||
| 		errCode = IXML_INSUFFICIENT_MEMORY; | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// set the node fields  | ||||
| 	/* set the node fields */ | ||||
| 	newElement->n.nodeType = eELEMENT_NODE; | ||||
| 	newElement->n.nodeName = strdup(tagName); | ||||
| 	if (newElement->n.nodeName == NULL) { | ||||
| 		free(newElement->tagName); | ||||
| 		ixmlElement_free(newElement); | ||||
| 		newElement = NULL; | ||||
| 		errCode = IXML_INSUFFICIENT_MEMORY; | ||||
| @@ -163,8 +165,14 @@ IXML_Element *ixmlDocument_createElement( | ||||
| 	const DOMString tagName) | ||||
| { | ||||
| 	IXML_Element *newElement = NULL; | ||||
| 	int ret = IXML_SUCCESS; | ||||
|  | ||||
| 	ixmlDocument_createElementEx(doc, tagName, &newElement); | ||||
| 	ret = ixmlDocument_createElementEx(doc, tagName, &newElement); | ||||
| 	if (ret != IXML_SUCCESS) { | ||||
|                 IxmlPrintf(__FILE__, __LINE__, "ixmlDocument_createElement", | ||||
| 			"Error %d\n", ret); | ||||
| 		return NULL; | ||||
|         } | ||||
| 	return newElement; | ||||
| } | ||||
|  | ||||
| @@ -183,7 +191,7 @@ int ixmlDocument_createDocumentEx(IXML_Document **rtDoc) | ||||
|  | ||||
| 	ixmlDocument_init(doc); | ||||
|  | ||||
| 	doc->n.nodeName = strdup(DOCUMENTNODENAME); | ||||
| 	doc->n.nodeName = strdup((const char*)DOCUMENTNODENAME); | ||||
| 	if (doc->n.nodeName == NULL) { | ||||
| 		ixmlDocument_free(doc); | ||||
| 		doc = NULL; | ||||
| @@ -229,17 +237,17 @@ int ixmlDocument_createTextNodeEx( | ||||
| 		rc = IXML_INSUFFICIENT_MEMORY; | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// initialize the node | ||||
| 	/* initialize the node */ | ||||
| 	ixmlNode_init(returnNode); | ||||
|  | ||||
| 	returnNode->nodeName = strdup(TEXTNODENAME); | ||||
| 	returnNode->nodeName = strdup((const char*)TEXTNODENAME); | ||||
| 	if (returnNode->nodeName == NULL) { | ||||
| 		ixmlNode_free(returnNode); | ||||
| 		returnNode = NULL; | ||||
| 		rc = IXML_INSUFFICIENT_MEMORY; | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// add in node value | ||||
| 	/* add in node value */ | ||||
| 	if (data != NULL) { | ||||
| 		returnNode->nodeValue = strdup(data); | ||||
| 		if (returnNode->nodeValue == NULL) { | ||||
| @@ -295,7 +303,7 @@ int ixmlDocument_createAttributeEx( | ||||
| 	ixmlAttr_init(attrNode); | ||||
| 	attrNode->n.nodeType = eATTRIBUTE_NODE; | ||||
|  | ||||
| 	// set the node fields | ||||
| 	/* set the node fields */ | ||||
| 	attrNode->n.nodeName = strdup(name); | ||||
| 	if (attrNode->n.nodeName == NULL) { | ||||
| 		ixmlAttr_free(attrNode); | ||||
| @@ -318,7 +326,8 @@ IXML_Attr *ixmlDocument_createAttribute( | ||||
| { | ||||
| 	IXML_Attr *attrNode = NULL; | ||||
|  | ||||
| 	ixmlDocument_createAttributeEx(doc, name, &attrNode); | ||||
| 	if(ixmlDocument_createAttributeEx(doc, name, &attrNode) != IXML_SUCCESS) | ||||
| 		return NULL; | ||||
|  | ||||
| 	return attrNode; | ||||
| } | ||||
| @@ -343,7 +352,7 @@ int ixmlDocument_createAttributeNSEx( | ||||
| 	if (errCode != IXML_SUCCESS) { | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// set the namespaceURI field  | ||||
| 	/* set the namespaceURI field */ | ||||
| 	attrNode->n.namespaceURI = strdup(namespaceURI); | ||||
| 	if (attrNode->n.namespaceURI == NULL) { | ||||
| 		ixmlAttr_free(attrNode); | ||||
| @@ -351,7 +360,7 @@ int ixmlDocument_createAttributeNSEx( | ||||
| 		errCode = IXML_INSUFFICIENT_MEMORY; | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// set the localName and prefix  | ||||
| 	/* set the localName and prefix */ | ||||
| 	errCode = | ||||
| 		ixmlNode_setNodeName((IXML_Node *)attrNode, qualifiedName); | ||||
| 	if (errCode != IXML_SUCCESS) { | ||||
| @@ -401,7 +410,7 @@ int ixmlDocument_createCDATASectionEx( | ||||
|  | ||||
| 	ixmlCDATASection_init(cDSectionNode); | ||||
| 	cDSectionNode->n.nodeType = eCDATA_SECTION_NODE; | ||||
| 	cDSectionNode->n.nodeName = strdup(CDATANODENAME); | ||||
| 	cDSectionNode->n.nodeName = strdup((const char*)CDATANODENAME); | ||||
| 	if (cDSectionNode->n.nodeName == NULL) { | ||||
| 		ixmlCDATASection_free(cDSectionNode); | ||||
| 		cDSectionNode = NULL; | ||||
| @@ -458,7 +467,7 @@ int ixmlDocument_createElementNSEx( | ||||
| 		line = __LINE__; | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// set the namespaceURI field  | ||||
| 	/* set the namespaceURI field */ | ||||
| 	newElement->n.namespaceURI = strdup(namespaceURI); | ||||
| 	if (newElement->n.namespaceURI == NULL) { | ||||
| 		line = __LINE__; | ||||
| @@ -467,7 +476,7 @@ int ixmlDocument_createElementNSEx( | ||||
| 		ret = IXML_INSUFFICIENT_MEMORY; | ||||
| 		goto ErrorHandler; | ||||
| 	} | ||||
| 	// set the localName and prefix  | ||||
| 	/* set the localName and prefix */ | ||||
| 	ret = ixmlNode_setNodeName((IXML_Node *)newElement, qualifiedName); | ||||
| 	if (ret != IXML_SUCCESS) { | ||||
| 		line = __LINE__; | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -110,7 +111,7 @@ int ixmlElement_setAttribute( | ||||
| { | ||||
| 	IXML_Node *attrNode; | ||||
| 	IXML_Attr *newAttrNode; | ||||
| 	short errCode = IXML_SUCCESS; | ||||
| 	int errCode = IXML_SUCCESS; | ||||
|  | ||||
| 	if (element == NULL || name == NULL || value == NULL) { | ||||
| 		errCode = IXML_INVALID_PARAMETER; | ||||
| @@ -208,7 +209,8 @@ IXML_Attr *ixmlElement_getAttributeNode(IXML_Element *element, const DOMString n | ||||
|  | ||||
| 	attrNode = element->n.firstAttr; | ||||
| 	while (attrNode != NULL) { | ||||
| 		if (strcmp(attrNode->nodeName, name) == 0) { // found it | ||||
| 		if (strcmp(attrNode->nodeName, name) == 0) { | ||||
| 			/* found it */ | ||||
| 			break; | ||||
| 		} else { | ||||
| 			attrNode = attrNode->nextSibling; | ||||
| @@ -231,53 +233,42 @@ int ixmlElement_setAttributeNode( | ||||
| 	IXML_Node *preSib = NULL; | ||||
| 	IXML_Node *nextSib = NULL; | ||||
|  | ||||
| 	if (element == NULL || newAttr == NULL) { | ||||
| 	if (!element || !newAttr) | ||||
| 		return IXML_INVALID_PARAMETER; | ||||
| 	} | ||||
|  | ||||
| 	if (newAttr->n.ownerDocument != element->n.ownerDocument) { | ||||
| 	if (newAttr->n.ownerDocument != element->n.ownerDocument) | ||||
| 		return IXML_WRONG_DOCUMENT_ERR; | ||||
| 	} | ||||
|  | ||||
| 	if (newAttr->ownerElement != NULL) { | ||||
| 	if (newAttr->ownerElement) | ||||
| 		return IXML_INUSE_ATTRIBUTE_ERR; | ||||
| 	} | ||||
|  | ||||
| 	newAttr->ownerElement = element; | ||||
| 	node = (IXML_Node *)newAttr; | ||||
|  | ||||
| 	attrNode = element->n.firstAttr; | ||||
| 	while (attrNode != NULL) { | ||||
| 		if (strcmp(attrNode->nodeName, node->nodeName) == 0) { | ||||
| 	while (attrNode) { | ||||
| 		if (!strcmp(attrNode->nodeName, node->nodeName)) | ||||
| 			/* Found it */ | ||||
| 			break; | ||||
| 		} else { | ||||
| 		else | ||||
| 			attrNode = attrNode->nextSibling; | ||||
| 	} | ||||
| 	} | ||||
|  | ||||
| 	if (attrNode != NULL) { | ||||
| 	if (attrNode) { | ||||
| 		/* Already present, will replace by newAttr */ | ||||
| 		preSib = attrNode->prevSibling; | ||||
| 		nextSib = attrNode->nextSibling; | ||||
| 		if (preSib != NULL) { | ||||
| 		if (preSib) | ||||
| 			preSib->nextSibling = node; | ||||
| 		} | ||||
| 		if (nextSib != NULL) { | ||||
| 		if (nextSib) | ||||
| 			nextSib->prevSibling = node; | ||||
| 		} | ||||
| 		if (element->n.firstAttr == attrNode) { | ||||
| 		if (element->n.firstAttr == attrNode) | ||||
| 			element->n.firstAttr = node; | ||||
| 		} | ||||
| 		if (rtAttr != NULL) { | ||||
| 		if (rtAttr) | ||||
| 			*rtAttr = (IXML_Attr *)attrNode; | ||||
| 		} | ||||
| 		else | ||||
| 			ixmlAttr_free((IXML_Attr *)attrNode); | ||||
| 	} else { | ||||
| 		/* Add this attribute */ | ||||
| 		if (element->n.firstAttr != NULL) { | ||||
| 		if (element->n.firstAttr) { | ||||
| 			prevAttr = element->n.firstAttr; | ||||
| 			nextAttr = prevAttr->nextSibling; | ||||
| 			while (nextAttr != NULL) { | ||||
| 			while (nextAttr) { | ||||
| 				prevAttr = nextAttr; | ||||
| 				nextAttr = prevAttr->nextSibling; | ||||
| 			} | ||||
| @@ -289,11 +280,9 @@ int ixmlElement_setAttributeNode( | ||||
| 			node->prevSibling = NULL; | ||||
| 			node->nextSibling = NULL; | ||||
| 		} | ||||
|  | ||||
| 		if (rtAttr != NULL) { | ||||
| 		if (rtAttr) | ||||
| 			*rtAttr = NULL; | ||||
| 	} | ||||
| 	} | ||||
|  | ||||
| 	return IXML_SUCCESS; | ||||
| } | ||||
| @@ -442,7 +431,7 @@ int ixmlElement_setAttributeNS( | ||||
|  | ||||
| 	/* see DOM 2 spec page 59 */ | ||||
| 	if ((newAttrNode.prefix != NULL && namespaceURI == NULL) || | ||||
| 	    (strcmp(newAttrNode.prefix, "xml") == 0 && | ||||
| 	    (newAttrNode.prefix != NULL && strcmp(newAttrNode.prefix, "xml") == 0 && | ||||
| 	     strcmp(namespaceURI, "http://www.w3.org/XML/1998/namespace") != 0) || | ||||
| 	    (strcmp(qualifiedName, "xmlns") == 0 && | ||||
| 	     strcmp(namespaceURI, "http://www.w3.org/2000/xmlns/") != 0)) { | ||||
| @@ -489,15 +478,18 @@ int ixmlElement_setAttributeNS( | ||||
| 			qualifiedName, | ||||
| 			&newAttr); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			Parser_freeNodeContent(&newAttrNode); | ||||
| 			return rc; | ||||
| 		} | ||||
| 		newAttr->n.nodeValue = strdup(value); | ||||
| 		if (newAttr->n.nodeValue == NULL) { | ||||
| 			ixmlAttr_free(newAttr); | ||||
| 			Parser_freeNodeContent(&newAttrNode); | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
| 		if (ixmlElement_setAttributeNodeNS(element, newAttr, NULL) != IXML_SUCCESS) { | ||||
| 		if (ixmlElement_setAttributeNodeNS(element, newAttr, &newAttr) != IXML_SUCCESS) { | ||||
| 			ixmlAttr_free(newAttr); | ||||
| 			Parser_freeNodeContent(&newAttrNode); | ||||
| 			return IXML_FAILED; | ||||
| 		} | ||||
| 	} | ||||
| @@ -555,7 +547,7 @@ IXML_Attr *ixmlElement_getAttributeNodeNS( | ||||
| 	while (attrNode != NULL) { | ||||
| 		if (strcmp(attrNode->localName, localName) == 0 && | ||||
| 		    strcmp(attrNode->namespaceURI, namespaceURI) == 0) { | ||||
| 			// found it | ||||
| 			/* found it */ | ||||
| 			break; | ||||
| 		} else { | ||||
| 			attrNode = attrNode->nextSibling; | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -49,7 +50,7 @@ | ||||
| #define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) ) | ||||
|  | ||||
|  | ||||
| #define MEMBUF_DEF_SIZE_INC 20 | ||||
| #define MEMBUF_DEF_SIZE_INC 20u | ||||
|  | ||||
|  | ||||
| /*! | ||||
| @@ -166,7 +167,7 @@ int ixml_membuf_insert( | ||||
| 	size_t buf_len, | ||||
| 	/*! [in] The point of insertion relative to the beggining of the | ||||
| 	 * ixml_membuf internal buffer. */ | ||||
| 	int index); | ||||
| 	size_t index); | ||||
|  | ||||
|  | ||||
| #endif /* IXML_MEMBUF_H */ | ||||
|   | ||||
| @@ -54,37 +54,29 @@ static void copy_with_escape( | ||||
| 	/*! [in] The string to copy from. */ | ||||
| 	const char *p) | ||||
| { | ||||
| 	int i; | ||||
| 	int plen; | ||||
| 	size_t i; | ||||
| 	size_t plen; | ||||
|  | ||||
| 	if (p == NULL) { | ||||
| 	if (p == NULL) | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	plen = strlen(p); | ||||
|  | ||||
| 	for (i = 0; i < plen; i++) { | ||||
| 	for (i = (size_t)0; i < plen; ++i) { | ||||
| 		switch (p[i]) { | ||||
| 		case '<': | ||||
| 			ixml_membuf_append_str(buf, "<"); | ||||
| 			break; | ||||
|  | ||||
| 		case '>': | ||||
| 			ixml_membuf_append_str(buf, ">"); | ||||
| 			break; | ||||
|  | ||||
| 		case '&': | ||||
| 			ixml_membuf_append_str(buf, "&"); | ||||
| 			break; | ||||
|  | ||||
| 		case '\'': | ||||
| 			ixml_membuf_append_str(buf, "'"); | ||||
| 			break; | ||||
|  | ||||
| 		case '\"': | ||||
| 			ixml_membuf_append_str(buf, """); | ||||
| 			break; | ||||
|  | ||||
| 		default: | ||||
| 			ixml_membuf_append(buf, &p[i]); | ||||
| 			break; | ||||
| @@ -161,11 +153,11 @@ static void ixmlPrintDomTreeRecursive( | ||||
| 			} else { | ||||
| 				ixml_membuf_append_str(buf, ">"); | ||||
| 			} | ||||
| 			//  output the children | ||||
| 			/* output the children */ | ||||
| 			ixmlPrintDomTreeRecursive( | ||||
| 				ixmlNode_getFirstChild(nodeptr), buf); | ||||
|  | ||||
| 			// Done with children.  Output the end tag. | ||||
| 			/* Done with children.  Output the end tag. */ | ||||
| 			ixml_membuf_append_str(buf, "</"); | ||||
| 			ixml_membuf_append_str(buf, nodeName); | ||||
|  | ||||
| @@ -183,7 +175,7 @@ static void ixmlPrintDomTreeRecursive( | ||||
| 		default: | ||||
| 			IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTreeRecursive", | ||||
| 				"Warning, unknown node type %d\n", | ||||
| 				ixmlNode_getNodeType(nodeptr)); | ||||
| 				(int)ixmlNode_getNodeType(nodeptr)); | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| @@ -242,11 +234,11 @@ static void ixmlPrintDomTree( | ||||
| 			ixml_membuf_append_str(buf, ">"); | ||||
| 		} | ||||
|  | ||||
| 		// output the children | ||||
| 		/* output the children */ | ||||
| 		ixmlPrintDomTreeRecursive( | ||||
| 			ixmlNode_getFirstChild(nodeptr), buf); | ||||
|  | ||||
| 		// Done with children. Output the end tag. | ||||
| 		/* Done with children. Output the end tag. */ | ||||
| 		ixml_membuf_append_str(buf, "</"); | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		ixml_membuf_append_str(buf, ">\r\n"); | ||||
| @@ -255,7 +247,7 @@ static void ixmlPrintDomTree( | ||||
| 	default: | ||||
| 		IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTree", | ||||
| 			"Warning, unknown node type %d\n", | ||||
| 			ixmlNode_getNodeType(nodeptr)); | ||||
| 			(int)ixmlNode_getNodeType(nodeptr)); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
| @@ -314,10 +306,10 @@ static void ixmlDomTreetoString( | ||||
| 			ixml_membuf_append_str(buf, ">"); | ||||
| 		} | ||||
|  | ||||
| 		//  output the children | ||||
| 		/* output the children */ | ||||
| 		ixmlPrintDomTreeRecursive(ixmlNode_getFirstChild(nodeptr), buf); | ||||
|  | ||||
| 		// Done with children.  Output the end tag. | ||||
| 		/* Done with children. Output the end tag. */ | ||||
| 		ixml_membuf_append_str(buf, "</"); | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		ixml_membuf_append_str(buf, ">"); | ||||
| @@ -326,7 +318,7 @@ static void ixmlDomTreetoString( | ||||
| 	default: | ||||
| 		IxmlPrintf(__FILE__, __LINE__, "ixmlPrintDomTreeRecursive", | ||||
| 			"Warning, unknown node type %d\n", | ||||
| 			ixmlNode_getNodeType(nodeptr)); | ||||
| 			(int)ixmlNode_getNodeType(nodeptr)); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -41,7 +41,7 @@ void IxmlPrintf( | ||||
|  | ||||
| void printNodes(IXML_Node *tmpRoot, int depth) | ||||
| { | ||||
|     int i; | ||||
|     unsigned long i; | ||||
|     IXML_NodeList *NodeList1; | ||||
|     IXML_Node *ChildNode1; | ||||
|     unsigned short NodeType; | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -75,10 +76,10 @@ static int ixml_membuf_set_size( | ||||
| 		diff = new_length - m->length; | ||||
| 		alloc_len = MAXVAL(m->size_inc, diff) + m->capacity; | ||||
| 	} else { | ||||
| 		// decrease length | ||||
| 		/* decrease length */ | ||||
| 		assert(new_length <= m->length); | ||||
|  | ||||
| 		// if diff is 0..m->size_inc, don't free | ||||
| 		/* if diff is 0..m->size_inc, don't free */ | ||||
| 		if ((m->capacity - new_length) <= m->size_inc) { | ||||
| 			return 0; | ||||
| 		} | ||||
| @@ -87,11 +88,11 @@ static int ixml_membuf_set_size( | ||||
|  | ||||
| 	assert(alloc_len >= new_length); | ||||
|  | ||||
| 	temp_buf = realloc(m->buf, alloc_len + 1); | ||||
| 	temp_buf = realloc(m->buf, alloc_len + (size_t)1); | ||||
| 	if (temp_buf == NULL) { | ||||
| 		/* try smaller size */ | ||||
| 		alloc_len = new_length; | ||||
| 		temp_buf = realloc(m->buf, alloc_len + 1); | ||||
| 		temp_buf = realloc(m->buf, alloc_len + (size_t)1); | ||||
| 		if (temp_buf == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
| @@ -110,8 +111,8 @@ void ixml_membuf_init(ixml_membuf *m) | ||||
|  | ||||
| 	m->size_inc = MEMBUF_DEF_SIZE_INC; | ||||
| 	m->buf = NULL; | ||||
| 	m->length = 0; | ||||
| 	m->capacity = 0; | ||||
| 	m->length = (size_t)0; | ||||
| 	m->capacity = (size_t)0; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -135,21 +136,21 @@ int ixml_membuf_assign( | ||||
|  | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| 	// set value to null | ||||
| 	/* set value to null */ | ||||
| 	if (buf == NULL) { | ||||
| 		ixml_membuf_destroy(m); | ||||
| 		return IXML_SUCCESS; | ||||
| 	} | ||||
| 	// alloc mem | ||||
| 	/* alloc mem */ | ||||
| 	return_code = ixml_membuf_set_size(m, buf_len); | ||||
| 	if (return_code != 0) { | ||||
| 		return return_code; | ||||
| 	} | ||||
|  | ||||
| 	// copy | ||||
| 	/* copy */ | ||||
| 	memcpy(m->buf, buf, buf_len); | ||||
|  | ||||
| 	// null-terminate | ||||
| 	/* null-terminate */ | ||||
| 	m->buf[buf_len] = 0; | ||||
| 	m->length = buf_len; | ||||
|  | ||||
| @@ -171,7 +172,7 @@ int ixml_membuf_append( | ||||
| { | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| 	return ixml_membuf_insert(m, buf, 1, m->length); | ||||
| 	return ixml_membuf_insert(m, buf, (size_t)1, m->length); | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -187,17 +188,17 @@ int ixml_membuf_insert( | ||||
| 	INOUT ixml_membuf *m, | ||||
| 	IN const void *buf, | ||||
| 	IN size_t buf_len, | ||||
| 	int index) | ||||
| 	size_t index) | ||||
| { | ||||
| 	int return_code = 0; | ||||
|  | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| 	if (index < 0 || index > (int)m->length) { | ||||
| 	if (index > m->length) { | ||||
| 		return IXML_INDEX_SIZE_ERR; | ||||
| 	} | ||||
|  | ||||
| 	if (buf == NULL || buf_len == 0) { | ||||
| 	if (buf == NULL || buf_len == (size_t)0) { | ||||
| 		return 0; | ||||
| 	} | ||||
| 	/* alloc mem */ | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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:  | ||||
| @@ -53,11 +54,11 @@ static unsigned long ixmlNamedNodeMap_getItemNumber( | ||||
| 	IN const char *name) | ||||
| { | ||||
| 	IXML_Node *tempNode; | ||||
| 	unsigned long returnItemNo = 0; | ||||
| 	unsigned long returnItemNo = 0lu; | ||||
|  | ||||
| 	assert(nnMap != NULL && name != NULL); | ||||
| 	if (nnMap == NULL || name == NULL) { | ||||
| 		return IXML_INVALID_ITEM_NUMBER; | ||||
| 		return (unsigned long)IXML_INVALID_ITEM_NUMBER; | ||||
| 	} | ||||
|  | ||||
| 	tempNode = nnMap->nodeItem; | ||||
| @@ -69,7 +70,7 @@ static unsigned long ixmlNamedNodeMap_getItemNumber( | ||||
| 		returnItemNo++; | ||||
| 	} | ||||
|  | ||||
| 	return IXML_INVALID_ITEM_NUMBER; | ||||
| 	return (unsigned long)IXML_INVALID_ITEM_NUMBER; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -85,17 +86,17 @@ IXML_Node *ixmlNamedNodeMap_getNamedItem( | ||||
| 	IXML_NamedNodeMap *nnMap, | ||||
| 	const DOMString name) | ||||
| { | ||||
| 	long index; | ||||
| 	unsigned long index; | ||||
|  | ||||
| 	if (nnMap == NULL || name == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	index = ixmlNamedNodeMap_getItemNumber(nnMap, name); | ||||
| 	if (index == IXML_INVALID_ITEM_NUMBER) { | ||||
| 	if (index == (unsigned long)IXML_INVALID_ITEM_NUMBER) { | ||||
| 		return NULL; | ||||
| 	} else { | ||||
| 		return ixmlNamedNodeMap_item(nnMap, (unsigned long)index); | ||||
| 		return ixmlNamedNodeMap_item(nnMap, index); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -111,12 +112,12 @@ IXML_Node *ixmlNamedNodeMap_item( | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	if (index > ixmlNamedNodeMap_getLength(nnMap) - 1) { | ||||
| 	if (index > ixmlNamedNodeMap_getLength(nnMap) - 1lu) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	tempNode = nnMap->nodeItem; | ||||
| 	for (i = 0; i < index && tempNode != NULL; ++i) { | ||||
| 	for (i = 0u; i < index && tempNode != NULL; ++i) { | ||||
| 		tempNode = tempNode->nextSibling; | ||||
| 	} | ||||
|  | ||||
| @@ -127,11 +128,11 @@ IXML_Node *ixmlNamedNodeMap_item( | ||||
| unsigned long ixmlNamedNodeMap_getLength(IXML_NamedNodeMap *nnMap) | ||||
| { | ||||
| 	IXML_Node *tempNode; | ||||
| 	unsigned long length = 0; | ||||
| 	unsigned long length = 0lu; | ||||
|  | ||||
| 	if (nnMap != NULL) { | ||||
| 		tempNode = nnMap->nodeItem; | ||||
| 		for (length = 0; tempNode != NULL; ++length) { | ||||
| 		for (length = 0lu; tempNode != NULL; ++length) { | ||||
| 			tempNode = tempNode->nextSibling; | ||||
| 		} | ||||
| 	} | ||||
| @@ -165,7 +166,7 @@ int ixmlNamedNodeMap_addToNamedNodeMap( | ||||
| 	} | ||||
|  | ||||
| 	if (*nnMap == NULL) { | ||||
| 		// nodelist is empty | ||||
| 		/* nodelist is empty */ | ||||
| 		*nnMap = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap)); | ||||
| 		if (*nnMap == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
|   | ||||
							
								
								
									
										123
									
								
								ixml/src/node.c
									
									
									
									
									
								
							
							
						
						
									
										123
									
								
								ixml/src/node.c
									
									
									
									
									
								
							| @@ -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:  | ||||
| @@ -90,9 +91,13 @@ static void ixmlNode_freeSingleNode( | ||||
| 		if (nodeptr->localName != NULL) { | ||||
| 			free(nodeptr->localName); | ||||
| 		} | ||||
| 		if (nodeptr->nodeType == eELEMENT_NODE) { | ||||
| 		switch (nodeptr->nodeType ) { | ||||
| 		case eELEMENT_NODE: | ||||
| 			element = (IXML_Element *)nodeptr; | ||||
| 			free(element->tagName); | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 		free(nodeptr); | ||||
| 	} | ||||
| @@ -280,7 +285,7 @@ unsigned short ixmlNode_getNodeType(IXML_Node *nodeptr) | ||||
| 	if (nodeptr != NULL) { | ||||
| 		return nodeptr->nodeType; | ||||
| 	} else { | ||||
| 		return eINVALID_NODE; | ||||
| 		return (unsigned short)eINVALID_NODE; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @@ -397,6 +402,7 @@ static BOOL ixmlNode_isParent( | ||||
|  | ||||
| 	assert(nodeptr != NULL && toFind != NULL); | ||||
|  | ||||
| 	if (nodeptr != NULL && toFind != NULL) | ||||
| 		found = toFind->parentNode == nodeptr; | ||||
|  | ||||
| 	return found; | ||||
| @@ -422,17 +428,22 @@ static BOOL ixmlNode_allowChildren( | ||||
| 	case eTEXT_NODE: | ||||
| 	case eCDATA_SECTION_NODE: | ||||
| 		return FALSE; | ||||
| 		break; | ||||
|  | ||||
| 	case eELEMENT_NODE: | ||||
| 		if (newChild->nodeType == eATTRIBUTE_NODE || | ||||
| 		    newChild->nodeType == eDOCUMENT_NODE) { | ||||
| 		switch (newChild->nodeType) { | ||||
| 		case eATTRIBUTE_NODE: | ||||
| 		case eDOCUMENT_NODE: | ||||
| 			return FALSE; | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 	break; | ||||
|  | ||||
| 	case eDOCUMENT_NODE: | ||||
| 		if (newChild->nodeType != eELEMENT_NODE) { | ||||
| 		switch (newChild->nodeType) { | ||||
| 		case eELEMENT_NODE: | ||||
| 			break; | ||||
| 		default: | ||||
| 			return FALSE; | ||||
| 		} | ||||
|  | ||||
| @@ -500,7 +511,7 @@ int ixmlNode_insertBefore( | ||||
|  | ||||
| 	if (refChild != NULL) { | ||||
| 		if (ixmlNode_isParent(nodeptr, newChild) == TRUE) { | ||||
| 			ixmlNode_removeChild(nodeptr, newChild, NULL); | ||||
| 			ixmlNode_removeChild(nodeptr, newChild, &newChild); | ||||
| 			newChild->nextSibling = NULL; | ||||
| 			newChild->prevSibling = NULL; | ||||
| 		} | ||||
| @@ -542,11 +553,11 @@ int ixmlNode_replaceChild( | ||||
| 	if (ixmlNode_allowChildren(nodeptr, newChild) == FALSE) { | ||||
| 		return IXML_HIERARCHY_REQUEST_ERR; | ||||
| 	} | ||||
| 	// if newChild was created from a different document  | ||||
| 	/* if newChild was created from a different document */ | ||||
| 	if (nodeptr->ownerDocument != newChild->ownerDocument) { | ||||
| 		return IXML_WRONG_DOCUMENT_ERR; | ||||
| 	} | ||||
| 	// if refChild is not a child of nodeptr | ||||
| 	/* if refChild is not a child of nodeptr */ | ||||
| 	if (ixmlNode_isParent(nodeptr, oldChild) != TRUE) { | ||||
| 		return IXML_NOT_FOUND_ERR; | ||||
| 	} | ||||
| @@ -566,29 +577,23 @@ int ixmlNode_removeChild( | ||||
| 	IXML_Node *oldChild, | ||||
| 	IXML_Node **returnNode) | ||||
| { | ||||
| 	if (nodeptr == NULL || oldChild == NULL) { | ||||
| 	if (!nodeptr || !oldChild) | ||||
| 		return IXML_INVALID_PARAMETER; | ||||
| 	} | ||||
|  | ||||
| 	if (ixmlNode_isParent(nodeptr, oldChild) == FALSE ) { | ||||
| 	if (!ixmlNode_isParent(nodeptr, oldChild)) | ||||
| 		return IXML_NOT_FOUND_ERR; | ||||
| 	} | ||||
|  | ||||
| 	if (oldChild->prevSibling != NULL) { | ||||
| 	if (oldChild->prevSibling) | ||||
| 		oldChild->prevSibling->nextSibling = oldChild->nextSibling; | ||||
| 	} | ||||
| 	if (nodeptr->firstChild == oldChild) { | ||||
| 	if (nodeptr->firstChild == oldChild) | ||||
| 		nodeptr->firstChild = oldChild->nextSibling; | ||||
| 	} | ||||
| 	if (oldChild->nextSibling != NULL) { | ||||
| 	if (oldChild->nextSibling) | ||||
| 		oldChild->nextSibling->prevSibling = oldChild->prevSibling; | ||||
| 	} | ||||
| 	oldChild->nextSibling = NULL; | ||||
| 	oldChild->prevSibling = NULL; | ||||
| 	oldChild->parentNode = NULL; | ||||
| 	if (returnNode != NULL) { | ||||
| 	if (returnNode) | ||||
| 		*returnNode = oldChild; | ||||
| 	} | ||||
| 	else | ||||
| 		ixmlNode_free(oldChild); | ||||
|  | ||||
| 	return IXML_SUCCESS; | ||||
| } | ||||
| @@ -617,7 +622,7 @@ int ixmlNode_appendChild(IXML_Node *nodeptr, IXML_Node *newChild) | ||||
| 	} | ||||
|  | ||||
| 	if (ixmlNode_isParent(nodeptr, newChild) == TRUE ) { | ||||
| 		ixmlNode_removeChild(nodeptr, newChild, NULL); | ||||
| 		ixmlNode_removeChild(nodeptr, newChild, &newChild); | ||||
| 	} | ||||
| 	/* set the parent node pointer */ | ||||
| 	newChild->parentNode = nodeptr; | ||||
| @@ -650,6 +655,7 @@ static IXML_Node *ixmlNode_cloneTextNode( | ||||
| 	IXML_Node *nodeptr) | ||||
| { | ||||
| 	IXML_Node *newNode = NULL; | ||||
| 	int rc; | ||||
|  | ||||
| 	assert(nodeptr != NULL); | ||||
|  | ||||
| @@ -658,8 +664,16 @@ static IXML_Node *ixmlNode_cloneTextNode( | ||||
| 		return NULL; | ||||
| 	} else { | ||||
| 		ixmlNode_init(newNode); | ||||
| 		ixmlNode_setNodeName(newNode, nodeptr->nodeName); | ||||
| 		ixmlNode_setNodeValue(newNode, nodeptr->nodeValue); | ||||
| 		rc = ixmlNode_setNodeName(newNode, nodeptr->nodeName); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			ixmlNode_free(newNode); | ||||
| 			return NULL; | ||||
| 		} | ||||
| 		rc = ixmlNode_setNodeValue(newNode, nodeptr->nodeValue); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			ixmlNode_free(newNode); | ||||
| 			return NULL; | ||||
| 		} | ||||
| 		newNode->nodeType = eTEXT_NODE; | ||||
| 	} | ||||
|  | ||||
| @@ -678,15 +692,24 @@ static IXML_CDATASection *ixmlNode_cloneCDATASect( | ||||
| 	IXML_CDATASection *newCDATA = NULL; | ||||
| 	IXML_Node *newNode; | ||||
| 	IXML_Node *srcNode; | ||||
| 	int rc; | ||||
|  | ||||
| 	assert(nodeptr != NULL); | ||||
| 	newCDATA = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection)); | ||||
| 	if (newCDATA != NULL) { | ||||
| 		newNode = (IXML_Node *)newCDATA; | ||||
| 		ixmlNode_init(newNode); | ||||
| 		ixmlCDATASection_init(newCDATA); | ||||
| 		srcNode = (IXML_Node *)nodeptr; | ||||
| 		ixmlNode_setNodeName(newNode, srcNode->nodeName); | ||||
| 		ixmlNode_setNodeValue(newNode, srcNode->nodeValue); | ||||
| 		rc = ixmlNode_setNodeName(newNode, srcNode->nodeName); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			ixmlCDATASection_free(newCDATA); | ||||
| 			return NULL; | ||||
| 		} | ||||
| 		rc = ixmlNode_setNodeValue(newNode, srcNode->nodeValue); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			ixmlCDATASection_free(newCDATA); | ||||
| 			return NULL; | ||||
| 		} | ||||
| 		newNode->nodeType = eCDATA_SECTION_NODE; | ||||
| 	} | ||||
|  | ||||
| @@ -761,34 +784,29 @@ static IXML_Element *ixmlNode_cloneElement( | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns a clone of a document node. | ||||
|  * \brief Returns a new document node. | ||||
|  * | ||||
|  * \return A clone of a document node. | ||||
|  * Currently, the IXML_Document struct is just a node, so this function | ||||
|  * just mallocs the IXML_Document, sets the node type and name. | ||||
|  * | ||||
|  * \return A new document node. | ||||
|  */ | ||||
| static IXML_Document *ixmlNode_cloneDoc( | ||||
| 	/*! [in] The \b Node to clone. */ | ||||
| 	IXML_Document *nodeptr) | ||||
| static IXML_Document *ixmlNode_newDoc(void) | ||||
| { | ||||
| 	IXML_Document *newDoc; | ||||
| 	IXML_Node *docNode; | ||||
| 	int rc; | ||||
|  | ||||
| 	assert(nodeptr != NULL); | ||||
|  | ||||
| 	newDoc = (IXML_Document *)malloc(sizeof (IXML_Document)); | ||||
| 	if (newDoc == NULL) { | ||||
| 	if (!newDoc) | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	ixmlDocument_init(newDoc); | ||||
| 	docNode = (IXML_Node *)newDoc; | ||||
|  | ||||
| 	rc = ixmlNode_setNodeName(docNode, DOCUMENTNODENAME); | ||||
| 	if (rc != IXML_SUCCESS) { | ||||
| 		ixmlDocument_free(newDoc); | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	newDoc->n.nodeType = eDOCUMENT_NODE; | ||||
|  | ||||
| 	return newDoc; | ||||
| @@ -916,6 +934,8 @@ static IXML_Node *ixmlNode_cloneNodeTreeRecursive( | ||||
| 		switch (nodeptr->nodeType) { | ||||
| 		case eELEMENT_NODE: | ||||
| 			newElement = ixmlNode_cloneElement((IXML_Element *)nodeptr); | ||||
| 			if (newElement == NULL) | ||||
| 				return NULL; | ||||
| 			newElement->n.firstAttr = ixmlNode_cloneNodeTreeRecursive( | ||||
| 				nodeptr->firstAttr, deep); | ||||
| 			if (deep) { | ||||
| @@ -936,6 +956,8 @@ static IXML_Node *ixmlNode_cloneNodeTreeRecursive( | ||||
|  | ||||
| 		case eATTRIBUTE_NODE: | ||||
| 			newAttr = ixmlNode_cloneAttr((IXML_Attr *)nodeptr); | ||||
| 			if (newAttr == NULL) | ||||
| 				return NULL; | ||||
| 			nextSib = ixmlNode_cloneNodeTreeRecursive(nodeptr->nextSibling, deep); | ||||
| 			newAttr->n.nextSibling = nextSib; | ||||
| 			if (nextSib != NULL) { | ||||
| @@ -954,7 +976,9 @@ static IXML_Node *ixmlNode_cloneNodeTreeRecursive( | ||||
| 			break; | ||||
|  | ||||
| 		case eDOCUMENT_NODE: | ||||
| 			newDoc = ixmlNode_cloneDoc((IXML_Document *)nodeptr); | ||||
| 			newDoc = ixmlNode_newDoc(); | ||||
| 			if (newDoc == NULL) | ||||
| 				return NULL; | ||||
| 			newNode = (IXML_Node *)newDoc; | ||||
| 			if (deep) { | ||||
| 				newNode->firstChild = ixmlNode_cloneNodeTreeRecursive( | ||||
| @@ -1001,6 +1025,8 @@ static IXML_Node *ixmlNode_cloneNodeTree( | ||||
| 	switch (nodeptr->nodeType) { | ||||
| 	case eELEMENT_NODE: | ||||
| 		newElement = ixmlNode_cloneElement((IXML_Element *)nodeptr); | ||||
| 		if (newElement == NULL) | ||||
| 			return NULL; | ||||
| 		newElement->n.firstAttr = ixmlNode_cloneNodeTreeRecursive(nodeptr->firstAttr, deep); | ||||
| 		if (deep) { | ||||
| 			newElement->n.firstChild = ixmlNode_cloneNodeTreeRecursive( | ||||
| @@ -1041,6 +1067,7 @@ static IXML_Node *ixmlNode_cloneNodeTree( | ||||
| 	} | ||||
|  | ||||
| 	/* by spec, the duplicate node has no parent */ | ||||
| 	if (newNode != NULL) | ||||
| 		newNode->parentNode = NULL; | ||||
|  | ||||
| 	return newNode; | ||||
| @@ -1112,7 +1139,8 @@ IXML_NamedNodeMap *ixmlNode_getAttributes(IXML_Node *nodeptr) | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	if(nodeptr->nodeType == eELEMENT_NODE) { | ||||
| 	switch(nodeptr->nodeType) { | ||||
| 	case eELEMENT_NODE: | ||||
| 		returnNamedNodeMap = (IXML_NamedNodeMap *)malloc(sizeof(IXML_NamedNodeMap)); | ||||
| 		if(returnNamedNodeMap == NULL) { | ||||
| 			return NULL; | ||||
| @@ -1130,7 +1158,7 @@ IXML_NamedNodeMap *ixmlNode_getAttributes(IXML_Node *nodeptr) | ||||
| 			tempNode = tempNode->nextSibling; | ||||
| 		} | ||||
| 		return returnNamedNodeMap; | ||||
| 	} else { | ||||
| 	default: | ||||
| 		/* if not an ELEMENT_NODE */ | ||||
| 		return NULL; | ||||
| 	} | ||||
| @@ -1150,8 +1178,13 @@ BOOL ixmlNode_hasChildNodes(IXML_Node *nodeptr) | ||||
| BOOL ixmlNode_hasAttributes(IXML_Node *nodeptr) | ||||
| { | ||||
| 	if (nodeptr != NULL) { | ||||
| 		if (nodeptr->nodeType == eELEMENT_NODE && nodeptr->firstAttr != NULL) { | ||||
| 		switch (nodeptr->nodeType) { | ||||
| 		case eELEMENT_NODE: | ||||
| 			if (nodeptr->firstAttr != NULL) | ||||
| 				return TRUE; | ||||
| 			break; | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -57,17 +58,17 @@ IXML_Node *ixmlNodeList_item( | ||||
| 	IXML_NodeList *next; | ||||
| 	unsigned int i; | ||||
|  | ||||
| 	// if the list ptr is NULL | ||||
| 	/* if the list ptr is NULL */ | ||||
| 	if (nList == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	// if index is more than list length | ||||
| 	if (index > ixmlNodeList_length(nList) - 1) { | ||||
| 	/* if index is more than list length */ | ||||
| 	if (index > ixmlNodeList_length(nList) - 1lu) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	next = nList; | ||||
| 	for (i = 0; i < index && next != NULL; ++i) { | ||||
| 	for (i = 0u; i < index && next != NULL; ++i) { | ||||
| 		next = next->next; | ||||
| 	} | ||||
|  | ||||
| @@ -93,7 +94,7 @@ int ixmlNodeList_addToNodeList( | ||||
| 	} | ||||
|  | ||||
| 	if (*nList == NULL) { | ||||
| 		// nodelist is empty | ||||
| 		/* nodelist is empty */ | ||||
| 		*nList = (IXML_NodeList *)malloc(sizeof (IXML_NodeList)); | ||||
| 		if (*nList == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| @@ -127,7 +128,7 @@ int ixmlNodeList_addToNodeList( | ||||
| unsigned long ixmlNodeList_length(IXML_NodeList *nList) | ||||
| { | ||||
| 	IXML_NodeList *list; | ||||
| 	unsigned long length = 0; | ||||
| 	unsigned long length = 0lu; | ||||
|  | ||||
| 	list = nList; | ||||
| 	while (list != NULL) { | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| Version: 1.6.9 | ||||
| Version: 1.6.17 | ||||
| Summary: Universal Plug and Play (UPnP) SDK | ||||
| Name: libupnp | ||||
| Release: 1%{?dist} | ||||
|   | ||||
| @@ -1,8 +1,7 @@ | ||||
| # $Id: Makefile.am,v 1.2 2006/02/27 21:38:56 r3mi Exp $ | ||||
| # | ||||
| # "Makefile.am" for "libupnp/threadutil" | ||||
| # | ||||
| # (C) Copyright 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net> | ||||
| # (C) Copyright 2005 Remi Turboult <r3mi@users.sourceforge.net> | ||||
| # | ||||
|  | ||||
| AM_CPPFLAGS		= -I$(srcdir)/inc -I$(srcdir)/src/inc | ||||
| @@ -19,12 +18,21 @@ lib_LTLIBRARIES		= libthreadutil.la | ||||
| libthreadutil_la_LDFLAGS = -version-info $(LT_VERSION_THREADUTIL) | ||||
|  | ||||
| libthreadutil_la_SOURCES = \ | ||||
| 			src/FreeList.c src/LinkedList.c \ | ||||
| 			src/ThreadPool.c src/TimerThread.c | ||||
| 			inc/FreeList.h \ | ||||
| 			src/FreeList.c \ | ||||
| 			inc/LinkedList.h \ | ||||
| 			src/LinkedList.c \ | ||||
| 			inc/ThreadPool.h \ | ||||
| 			src/ThreadPool.c \ | ||||
| 			inc/TimerThread.h \ | ||||
| 			src/TimerThread.c | ||||
|  | ||||
| upnpincludedir		= $(includedir)/upnp | ||||
| upnpinclude_HEADERS	= \ | ||||
| 			inc/FreeList.h inc/LinkedList.h \ | ||||
| 			inc/ThreadPool.h inc/TimerThread.h \ | ||||
| 			inc/ithread.h | ||||
|  | ||||
| upnpinclude_HEADERS	= \ | ||||
| 			inc/ithread.h \ | ||||
| 			inc/FreeList.h \ | ||||
| 			inc/LinkedList.h \ | ||||
| 			inc/ThreadPool.h \ | ||||
| 			inc/TimerThread.h | ||||
|  | ||||
|   | ||||
| @@ -29,118 +29,99 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef FREE_LIST_H | ||||
| #define FREE_LIST_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
|  | ||||
|  | ||||
| #include <errno.h> | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: FreeListNode | ||||
|  * | ||||
|  *  Description: | ||||
|  *      free list node. points to next free item. | ||||
|  *      memory for node is borrowed from allocated items. | ||||
|  *      Internal Use Only. | ||||
|  *****************************************************************************/ | ||||
| /*! | ||||
|  * Free list node. points to next free item. | ||||
|  * Memory for node is borrowed from allocated items. | ||||
|  * \internal | ||||
|  */ | ||||
| typedef struct FREELISTNODE | ||||
| { | ||||
| 	struct FREELISTNODE *next; | ||||
| } FreeListNode; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: FreeList | ||||
|  * | ||||
|  *  Description: | ||||
| /*! | ||||
|  * Stores head and size of free list, as well as mutex for protection. | ||||
|  *      Internal Use Only. | ||||
|  *****************************************************************************/ | ||||
|  * \internal | ||||
|  */ | ||||
| typedef struct FREELIST | ||||
| { | ||||
| 	FreeListNode *head; | ||||
| 	size_t element_size; | ||||
|  	int maxFreeListLength; | ||||
| 	int freeListLength; | ||||
|          | ||||
| } FreeList; | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListInit | ||||
| /*! | ||||
|  * \brief Initializes Free List. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes Free List. Must be called first. | ||||
|  *      And only once for FreeList. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *      size_t -     size of elements to store in free list | ||||
|  *      maxFreeListSize - max size that the free list can grow to | ||||
|  *                        before returning memory to O.S. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int FreeListInit(FreeList *free_list,  | ||||
|  * Must be called first and only once for FreeList. | ||||
|  * | ||||
|  * \return: | ||||
|  *	\li \c 0 on success. | ||||
|  *	\li \c EINVAL on failure. | ||||
|  */ | ||||
| int FreeListInit( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	FreeList *free_list, | ||||
| 	/*! Size of elements to store in free list. */ | ||||
| 	size_t elementSize, | ||||
| 				 int maxFreeListSize); | ||||
| 	/*! Max size that the free list can grow to before returning | ||||
| 	 * memory to O.S. */ | ||||
| 	int maxFreeListLength); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListAlloc | ||||
| /*! | ||||
|  * \brief Allocates chunk of set size. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Allocates chunk of set size. | ||||
|  *      If a free item is available in the list, returnes the stored item. | ||||
|  *      Otherwise calls the O.S. to allocate memory. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *  Returns: | ||||
|  *      Non NULL on success. NULL on failure. | ||||
|  *****************************************************************************/ | ||||
| void * FreeListAlloc (FreeList *free_list); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListFree | ||||
|  * If a free item is available in the list, returnes the stored item, | ||||
|  * otherwise calls the O.S. to allocate memory. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns an item to the Free List. | ||||
|  *      If the free list is smaller than the max size than | ||||
|  *      adds the item to the free list. | ||||
|  *      Otherwise returns the item to the O.S. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int FreeListFree (FreeList *free_list,void * element); | ||||
|  * \return Non NULL on success. NULL on failure. | ||||
|  */ | ||||
| void *FreeListAlloc( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	FreeList *free_list); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListDestroy | ||||
| /*! | ||||
|  * \brief Returns an item to the Free List. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Releases the resources stored with the free list. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int FreeListDestroy (FreeList *free_list); | ||||
|  * If the free list is smaller than the max size then adds the item to the | ||||
|  * free list, otherwise returns the item to the O.S. | ||||
|  * | ||||
|  * \return: | ||||
|  *	\li \c 0 on success. | ||||
|  *	\li \c EINVAL on failure. | ||||
|  */ | ||||
| int FreeListFree( | ||||
| 	/*! Must be valid, non null, pointer to a free list. */ | ||||
| 	FreeList *free_list, | ||||
| 	/*! Must be a pointer allocated by FreeListAlloc. */ | ||||
| 	void *element); | ||||
|  | ||||
| /*! | ||||
|  * \brief Releases the resources stored with the free list. | ||||
|  * | ||||
|  * \return: | ||||
|  *	\li \c 0 on success. | ||||
|  *	\li \c EINVAL on failure. | ||||
|  */ | ||||
| int FreeListDestroy( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	FreeList *free_list); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|   | ||||
| @@ -29,58 +29,34 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef LINKED_LIST_H | ||||
| #define LINKED_LIST_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "FreeList.h" | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define EOUTOFMEM (-7 & 1<<29) | ||||
|  | ||||
|  | ||||
| #define FREELISTSIZE 100 | ||||
| #define LIST_SUCCESS 1 | ||||
| #define LIST_FAIL 0 | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: free_routine | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Function for freeing list items | ||||
|  *****************************************************************************/ | ||||
| /*! Function for freeing list items. */ | ||||
| typedef void (*free_function)(void *arg); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: cmp_routine | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Function for comparing list items | ||||
|  *     Returns 1 if itemA==itemB | ||||
|  *****************************************************************************/ | ||||
| /*! Function for comparing list items. Returns 1 if itemA==itemB */ | ||||
| typedef int (*cmp_routine)(void *itemA,void *itemB); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ListNode | ||||
|  * | ||||
|  *  Description: | ||||
|  *      linked list node. stores generic item and pointers to next and prev. | ||||
|  *      Internal Use Only. | ||||
|  *****************************************************************************/ | ||||
| /*! Linked list node. Stores generic item and pointers to next and prev. | ||||
|  * \internal | ||||
|  */ | ||||
| typedef struct LISTNODE | ||||
| { | ||||
| 	struct LISTNODE *prev; | ||||
| @@ -88,14 +64,10 @@ typedef struct LISTNODE | ||||
| 	void *item; | ||||
| } ListNode; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: LinkedList | ||||
| /*! | ||||
|  * Linked list (no protection). | ||||
|  * | ||||
|  *  Description: | ||||
|  *      linked list (no protection). Internal Use Only. | ||||
|  *      Because this is for internal use, parameters are NOT checked for  | ||||
|  *      validity. | ||||
|  * Because this is for internal use, parameters are NOT checked for validity. | ||||
|  * The first item of the list is stored at node: head->next | ||||
|  * The last item of the list is stored at node: tail->prev | ||||
|  * If head->next=tail, then list is empty. | ||||
| @@ -103,249 +75,211 @@ typedef struct LISTNODE | ||||
|  * | ||||
|  *	LinkedList g; | ||||
|  *	ListNode *temp = NULL; | ||||
|  *       for (temp = ListHead(g);temp!=NULL;temp = ListNext(g,temp)) | ||||
|  *       { | ||||
|  *	for (temp = ListHead(g);temp!=NULL;temp = ListNext(g,temp)) { | ||||
|  *	} | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
|  * \internal | ||||
|  */ | ||||
| typedef struct LINKEDLIST | ||||
| { | ||||
|   ListNode head; /* head, first item is stored at: head->next */ | ||||
|   ListNode tail; /* tail, last item is stored at: tail->prev  */ | ||||
|   long size;     /* size of list */ | ||||
|   FreeList freeNodeList;   /* free list to use */ | ||||
|   free_function free_func; /* free function to use */ | ||||
|   cmp_routine cmp_func;    /* compare function to use */ | ||||
| 	/*! head, first item is stored at: head->next */ | ||||
| 	ListNode head; | ||||
| 	/*! tail, last item is stored at: tail->prev  */ | ||||
| 	ListNode tail; | ||||
| 	/*! size of list */ | ||||
| 	long size; | ||||
| 	/*! free list to use */ | ||||
| 	FreeList freeNodeList; | ||||
| 	/*! free function to use */ | ||||
| 	free_function free_func; | ||||
| 	/*! compare function to use */ | ||||
| 	cmp_routine cmp_func; | ||||
| } LinkedList; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListInit | ||||
| /*! | ||||
|  * \brief Initializes LinkedList. Must be called first and only once for List. | ||||
|  *  | ||||
|  *  Description: | ||||
|  *      Initializes LinkedList. Must be called first. | ||||
|  *      And only once for List. | ||||
|  *  Parameters: | ||||
|  *      list  - must be valid, non null, pointer to a linked list. | ||||
|  *      cmp_func - function used to compare items. (May be NULL) | ||||
|  *      free_func - function used to free items. (May be NULL) | ||||
|  *  Returns: | ||||
|  *      0 on success, EOUTOFMEM on failure. | ||||
|  *****************************************************************************/ | ||||
| int ListInit(LinkedList *list,cmp_routine cmp_func, free_function free_func); | ||||
|  *  \return | ||||
|  *	\li \c 0 on success. | ||||
|  *	\li \c EOUTOFMEM on failure. | ||||
|  */ | ||||
| int ListInit( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Function used to compare items. (May be NULL). */ | ||||
| 	cmp_routine cmp_func, | ||||
| 	/*! Function used to free items. (May be NULL). */ | ||||
| 	free_function free_func); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddHead | ||||
| /*! | ||||
|  * \brief Adds a node to the head of the list. Node gets immediately after | ||||
|  * list head. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node to the head of the list. | ||||
|  *      Node gets immediately after list.head. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      void * item - item to be added | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode *ListAddHead(LinkedList *list, void *item); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddTail | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node to the tail of the list. | ||||
|  *      Node gets added immediately before list.tail. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      void * item - item to be added | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode *ListAddTail(LinkedList *list, void *item); | ||||
|  * \return The pointer to the ListNode on success, NULL on failure. | ||||
|  */ | ||||
| ListNode *ListAddHead( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Item to be added. */ | ||||
| 	void *item); | ||||
|  | ||||
| /*! | ||||
|  * \brief Adds a node to the tail of the list. Node gets added immediately | ||||
|  * before list.tail. | ||||
|  * | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The pointer to the ListNode on success, NULL on failure. | ||||
|  */ | ||||
| ListNode *ListAddTail( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Item to be added. */ | ||||
| 	void *item); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddAfter | ||||
| /*! | ||||
|  * \brief Adds a node after the specified node. Node gets added immediately | ||||
|  * after bnode. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node after the specified node. | ||||
|  *      Node gets added immediately after bnode. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      void * item - item to be added | ||||
|  *      ListNode * bnode - node to add after | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode *ListAddAfter(LinkedList *list, void *item, ListNode *bnode); | ||||
|  *  Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The pointer to the ListNode on success, NULL on failure. | ||||
|  */ | ||||
| ListNode *ListAddAfter( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Item to be added. */ | ||||
| 	void *item, | ||||
| 	/*! Node to add after. */ | ||||
| 	ListNode *bnode); | ||||
|  | ||||
| /*! | ||||
|  * \brief Adds a node before the specified node. Node gets added immediately | ||||
|  * before anode. | ||||
|  * | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The pointer to the ListNode on success, NULL on failure. | ||||
|  */ | ||||
| ListNode *ListAddBefore( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Item to be added. */ | ||||
| 	void *item, | ||||
| 	/*! Node to add in front of. */ | ||||
| 	ListNode *anode); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddBefore | ||||
| /*! | ||||
|  * \brief Removes a node from the list. The memory for the node is freed. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node before the specified node. | ||||
|  *      Node gets added immediately before anode. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      ListNode * anode  - node to add the in front of. | ||||
|  *      void * item - item to be added | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode *ListAddBefore(LinkedList *list,void *item, ListNode *anode); | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The pointer to the item stored in the node or NULL if the item | ||||
|  * is freed. | ||||
|  */ | ||||
| void *ListDelNode( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Node to delete. */ | ||||
| 	ListNode *dnode, | ||||
| 	/*! if !0 then item is freed using free function. If 0 (or free | ||||
| 	 * function is NULL) then item is not freed. */ | ||||
| 	int freeItem); | ||||
|  | ||||
| /*! | ||||
|  * \brief Removes all memory associated with list nodes. Does not free | ||||
|  * LinkedList *list. | ||||
|  * | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return 0 on success, EINVAL on failure. | ||||
|  */ | ||||
| int ListDestroy( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! if !0 then item is freed using free function. If 0 (or free | ||||
| 	 * function is NULL) then item is not freed. */ | ||||
| 	int freeItem); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListDelNode | ||||
| /*! | ||||
|  * \brief Returns the head of the list. | ||||
|  *     | ||||
|  *  Description: | ||||
|  *      Removes a node from the list | ||||
|  *      The memory for the node is freed. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      ListNode *dnode - done to delete. | ||||
|  *      freeItem - if !0 then item is freed using free function. | ||||
|  *                 if 0 (or free function is NULL) then item is not freed | ||||
|  *  Returns: | ||||
|  *      The pointer to the item stored in the node or NULL if the item is freed. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| void *ListDelNode(LinkedList *list,ListNode *dnode, int freeItem); | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The head of the list. NULL if list is empty. | ||||
|  */ | ||||
| ListNode *ListHead( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list); | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the tail of the list. | ||||
|  *     | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The tail of the list. NULL if list is empty. | ||||
|  */ | ||||
| ListNode *ListTail( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListDestroy | ||||
| /*! | ||||
|  * \brief Returns the next item in the list. | ||||
|  *     | ||||
|  *  Description: | ||||
|  *      Removes all memory associated with list nodes.  | ||||
|  *      Does not free LinkedList *list.  | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      freeItem - if !0 then items are freed using the free_function. | ||||
|  *                 if 0 (or free function is NULL) then items are not freed. | ||||
|  *  Returns: | ||||
|  *      0 on success. Always returns 0. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| int ListDestroy(LinkedList *list, int freeItem); | ||||
|  * \return The next item in the list. NULL if there are no more items in list. | ||||
|  */ | ||||
| ListNode *ListNext( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Node from the list. */ | ||||
| 	ListNode *node); | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the previous item in the list. | ||||
|  *     | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The previous item in the list. NULL if there are no more items in list. | ||||
|  */ | ||||
| ListNode *ListPrev( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! Node from the list. */ | ||||
| 	ListNode *node); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListHead | ||||
| /*! | ||||
|  * \brief Finds the specified item in the list. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the head of the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The head of the list. NULL if list is empty. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode* ListHead(LinkedList *list); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListTail | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the tail of the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The tail of the list. NULL if list is empty. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode* ListTail(LinkedList *list); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListNext | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the next item in the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The next item in the list. NULL if there are no more items in list. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode* ListNext(LinkedList *list, ListNode * node); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListPrev | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the previous item in the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The previous item in the list. NULL if there are no more items in list. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode* ListPrev(LinkedList *list, ListNode * node); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListFind | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Finds the specified item in the list. | ||||
|  * Uses the compare function specified in ListInit. If compare function | ||||
|  * is NULL then compares items as pointers. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      ListNode *start - the node to start from, NULL if to start from  | ||||
|  *                        beginning. | ||||
|  *      void * item - the item to search for. | ||||
|  *  Returns: | ||||
|  *      The node containing the item. NULL if no node contains the item. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode* ListFind(LinkedList *list, ListNode *start, void * item); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListSize | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Returns the size of the list. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|   | ||||
|  *  Returns: | ||||
|  *      The number of items in the list. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| int ListSize(LinkedList* list); | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The node containing the item. NULL if no node contains the item. | ||||
|  */ | ||||
| ListNode* ListFind( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList *list, | ||||
| 	/*! The node to start from, NULL if to start from beginning. */ | ||||
| 	ListNode *start, | ||||
| 	/*! The item to search for. */ | ||||
| 	void *item); | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the size of the list. | ||||
|  * | ||||
|  * Precondition: The list has been initialized. | ||||
|  * | ||||
|  * \return The number of items in the list. | ||||
|  */ | ||||
| long ListSize( | ||||
| 	/*! Must be valid, non null, pointer to a linked list. */ | ||||
| 	LinkedList* list); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -29,26 +30,21 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef THREADPOOL_H | ||||
| #define THREADPOOL_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "FreeList.h" | ||||
| #include "ithread.h" | ||||
| #include "LinkedList.h" | ||||
| #include "UpnpInet.h" | ||||
| #include "UpnpGlobal.h" /* for UPNP_INLINE, EXPORT_SPEC */ | ||||
|  | ||||
|  | ||||
| #include <errno.h> | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#include <time.h> | ||||
| 	struct timezone | ||||
| @@ -63,82 +59,63 @@ | ||||
| 	#if defined(__OSX__) || defined(__APPLE__) || defined(__NetBSD__) | ||||
| 		#include <sys/resource.h>	/* for setpriority() */ | ||||
| 	#endif | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! Size of job free list */ | ||||
| #define JOBFREELISTSIZE 100 | ||||
|  | ||||
|  | ||||
| #define INFINITE_THREADS -1 | ||||
|  | ||||
|  | ||||
| #define EMAXTHREADS (-8 & 1<<29) | ||||
|  | ||||
|  | ||||
| /*! Invalid Policy */ | ||||
| #define INVALID_POLICY (-9 & 1<<29) | ||||
|  | ||||
|  | ||||
| /*! Invalid JOB Id */ | ||||
| #define INVALID_JOB_ID (-2 & 1<<29) | ||||
|  | ||||
|  | ||||
| typedef enum duration { | ||||
| 	SHORT_TERM, | ||||
| 	PERSISTENT | ||||
| } Duration; | ||||
|  | ||||
|  | ||||
| typedef enum priority { | ||||
| 	LOW_PRIORITY, | ||||
| 	MED_PRIORITY, | ||||
| 	HIGH_PRIORITY | ||||
| } ThreadPriority; | ||||
|  | ||||
|  | ||||
| /*! default priority used by TPJobInit */ | ||||
| #define DEFAULT_PRIORITY MED_PRIORITY | ||||
|  | ||||
|  | ||||
| /*! default minimum used by TPAttrInit */ | ||||
| #define DEFAULT_MIN_THREADS 1 | ||||
|  | ||||
|  | ||||
| /*! default max used by TPAttrInit */ | ||||
| #define DEFAULT_MAX_THREADS 10 | ||||
|  | ||||
|  | ||||
| /*! default stack size used by TPAttrInit */ | ||||
| #define DEFAULT_STACK_SIZE 0 | ||||
|  | ||||
| #define DEFAULT_STACK_SIZE 0u | ||||
|  | ||||
| /*! default jobs per thread used by TPAttrInit */ | ||||
| #define DEFAULT_JOBS_PER_THREAD 10 | ||||
|  | ||||
|  | ||||
| /*! default starvation time used by TPAttrInit */ | ||||
| #define DEFAULT_STARVATION_TIME	500 | ||||
|  | ||||
|  | ||||
| /*! default idle time used by TPAttrInit */ | ||||
| #define DEFAULT_IDLE_TIME 10 * 1000 | ||||
|  | ||||
|  | ||||
| /*! default free routine used TPJobInit */ | ||||
| #define DEFAULT_FREE_ROUTINE NULL | ||||
|  | ||||
|  | ||||
| /*! default max jobs used TPAttrInit */ | ||||
| #define DEFAULT_MAX_JOBS_TOTAL 100 | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Statistics. | ||||
|  * | ||||
| @@ -146,88 +123,54 @@ typedef enum priority { | ||||
|  */ | ||||
| #define STATS 1 | ||||
|  | ||||
|  | ||||
| #ifdef _DEBUG | ||||
| 	#define DEBUG 1 | ||||
| #endif | ||||
|  | ||||
|  | ||||
| typedef int PolicyType; | ||||
|  | ||||
|  | ||||
| #define DEFAULT_POLICY SCHED_OTHER | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: free_routine | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Function for freeing a thread argument | ||||
|  *****************************************************************************/ | ||||
| /*! Function for freeing a thread argument. */ | ||||
| typedef void (*free_routine)(void *arg); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPoolAttr | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Attributes for thread pool. Used to set and change parameters of | ||||
|  *     thread pool | ||||
|  *****************************************************************************/ | ||||
| /*! Attributes for thread pool. Used to set and change parameters of thread | ||||
|  * pool. */ | ||||
| typedef struct THREADPOOLATTR | ||||
| { | ||||
| 	/* minThreads, ThreadPool will always maintain at least this many threads */ | ||||
| 	/*! ThreadPool will always maintain at least this many threads. */ | ||||
| 	int minThreads; | ||||
|  | ||||
| 	/* maxThreads, ThreadPool will never have more than this number of threads */ | ||||
| 	/*! ThreadPool will never have more than this number of threads. */ | ||||
| 	int maxThreads; | ||||
|  | ||||
| 	/* stackSize (in bytes), this is the minimum stack size allocated for each | ||||
| 	 * thread */ | ||||
| 	/*! This is the minimum stack size allocated for each thread. */ | ||||
| 	size_t stackSize; | ||||
|  | ||||
| 	/* maxIdleTime (in milliseconds) this is the maximum time a thread will | ||||
| 	 * remain idle before dying */ | ||||
| 	/*! This is the maximum time a thread will | ||||
| 	 * remain idle before dying (in milliseconds). */ | ||||
| 	int maxIdleTime; | ||||
|  | ||||
| 	/* jobs per thread to maintain */ | ||||
| 	/*! Jobs per thread to maintain. */ | ||||
| 	int jobsPerThread; | ||||
|  | ||||
| 	/* maximum number of jobs that can be queued totally. */ | ||||
| 	/*! Maximum number of jobs that can be queued totally. */ | ||||
| 	int maxJobsTotal; | ||||
|  | ||||
| 	/* the time a low priority or med priority job waits before getting bumped | ||||
| 	 * up a priority (in milliseconds) */ | ||||
| 	/*! the time a low priority or med priority job waits before getting | ||||
| 	 * bumped up a priority (in milliseconds). */ | ||||
| 	int starvationTime; | ||||
|  | ||||
| 	/* scheduling policy to use */ | ||||
| 	/*! scheduling policy to use. */ | ||||
| 	PolicyType schedPolicy; | ||||
| } ThreadPoolAttr; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPool | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Internal ThreadPool Job | ||||
|  *****************************************************************************/ | ||||
| /*! Internal ThreadPool Job. */ | ||||
| typedef struct THREADPOOLJOB | ||||
| { | ||||
| 	start_routine func; | ||||
| 	void *arg; | ||||
| 	free_routine free_func; | ||||
| 	struct timeval requestTime; | ||||
| 	int priority; | ||||
| 	ThreadPriority priority; | ||||
| 	int jobId; | ||||
| } ThreadPoolJob; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPoolStats | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Structure to hold statistics | ||||
|  *****************************************************************************/ | ||||
| /*! Structure to hold statistics. */ | ||||
| typedef struct TPOOLSTATS | ||||
| { | ||||
| 	double totalTimeHQ; | ||||
| @@ -251,7 +194,6 @@ typedef struct TPOOLSTATS | ||||
| 	int currentJobsMQ; | ||||
| } ThreadPoolStats; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief A thread pool similar to the thread pool in the UPnP SDK. | ||||
|  * | ||||
| @@ -269,374 +211,326 @@ typedef struct TPOOLSTATS | ||||
|  */ | ||||
| typedef struct THREADPOOL | ||||
| { | ||||
| 	ithread_mutex_t mutex;		/* mutex to protect job qs */ | ||||
| 	ithread_cond_t condition;	/* condition variable to signal Q */ | ||||
| 	ithread_cond_t start_and_shutdown; /* condition variable for start and stop */ | ||||
| 	int lastJobId;			/* ids for jobs */ | ||||
| 	int shutdown;			/* whether or not we are shutting down */ | ||||
| 	int totalThreads;		/* total number of threads */ | ||||
| 	int busyThreads;		/* number of threads that are currently executing jobs */ | ||||
| 	int persistentThreads;		/* number of persistent threads */ | ||||
| 	FreeList jobFreeList;		/* free list of jobs */ | ||||
| 	LinkedList lowJobQ;		/* low priority job Q */ | ||||
| 	LinkedList medJobQ;		/* med priority job Q */ | ||||
| 	LinkedList highJobQ;		/* high priority job Q */ | ||||
| 	ThreadPoolJob *persistentJob;	/* persistent job */ | ||||
| 	ThreadPoolAttr attr;		/* thread pool attributes */ | ||||
|  | ||||
| 	/* statistics */ | ||||
| 	/*! Mutex to protect job qs. */ | ||||
| 	ithread_mutex_t mutex; | ||||
| 	/*! Condition variable to signal Q. */ | ||||
| 	ithread_cond_t condition; | ||||
| 	/*! Condition variable for start and stop. */ | ||||
| 	ithread_cond_t start_and_shutdown; | ||||
| 	/*! ids for jobs */ | ||||
| 	int lastJobId; | ||||
| 	/*! whether or not we are shutting down */ | ||||
| 	int shutdown; | ||||
| 	/*! total number of threads */ | ||||
| 	int totalThreads; | ||||
| 	/*! flag that's set when waiting for a new worker thread to start */ | ||||
| 	int pendingWorkerThreadStart; | ||||
| 	/*! number of threads that are currently executing jobs */ | ||||
| 	int busyThreads; | ||||
| 	/*! number of persistent threads */ | ||||
| 	int persistentThreads; | ||||
| 	/*! free list of jobs */ | ||||
| 	FreeList jobFreeList; | ||||
| 	/*! low priority job Q */ | ||||
| 	LinkedList lowJobQ; | ||||
| 	/*! med priority job Q */ | ||||
| 	LinkedList medJobQ; | ||||
| 	/*! high priority job Q */ | ||||
| 	LinkedList highJobQ; | ||||
| 	/*! persistent job */ | ||||
| 	ThreadPoolJob *persistentJob; | ||||
| 	/*! thread pool attributes */ | ||||
| 	ThreadPoolAttr attr; | ||||
| 	/*! statistics */ | ||||
| 	ThreadPoolStats stats; | ||||
| } ThreadPool; | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes and starts ThreadPool. Must be called first and | ||||
|  * only once for ThreadPool. | ||||
|  * | ||||
|  * \return | ||||
|  * \li \c 0 on success. | ||||
|  * \li \c EAGAIN if not enough system resources to create minimum threads. | ||||
|  * \li \c INVALID_POLICY if schedPolicy can't be set. | ||||
|  * \li \c EMAXTHREADS if minimum threads is greater than maximum threads. | ||||
|  */ | ||||
| int ThreadPoolInit( | ||||
| 	/*! Must be valid, non null, pointer to ThreadPool. */ | ||||
| 	ThreadPool *tp, | ||||
| 	/*! Can be null. if not null then attr contains the following fields: | ||||
| 	 * \li \c minWorkerThreads - minimum number of worker threads thread | ||||
| 	 * pool will never have less than this number of threads. | ||||
| 	 * \li \c maxWorkerThreads - maximum number of worker threads thread | ||||
| 	 * pool will never have more than this number of threads. | ||||
| 	 * \li \c maxIdleTime - maximum time that a worker thread will spend | ||||
| 	 * idle. If a worker is idle longer than this time and there are more | ||||
| 	 * than the min number of workers running, then the worker thread | ||||
| 	 * exits. | ||||
| 	 * \li \c jobsPerThread - ratio of jobs to thread to try and maintain | ||||
| 	 * if a job is scheduled and the number of jobs per thread is greater | ||||
| 	 * than this number,and if less than the maximum number of workers are | ||||
| 	 * running then a new thread is started to help out with efficiency. | ||||
| 	 * \li \c schedPolicy - scheduling policy to try and set (OS dependent). | ||||
| 	 */ | ||||
| 	ThreadPoolAttr *attr); | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolInit | ||||
| /*! | ||||
|  * \brief Adds a persistent job to the thread pool. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes and starts ThreadPool. Must be called first. | ||||
|  *      And only once for ThreadPool. | ||||
|  *  Parameters: | ||||
|  *      tp  - must be valid, non null, pointer to ThreadPool. | ||||
|  *      attr - can be null | ||||
|  * Job will be run as soon as possible. Call will block until job is scheduled. | ||||
|  *  | ||||
|  *       if not null then attr contains the following fields: | ||||
|  * | ||||
|  *      minWorkerThreads - minimum number of worker threads | ||||
|  *                                 thread pool will never have less than this | ||||
|  *                                  number of threads. | ||||
|  *      maxWorkerThreads - maximum number of worker threads | ||||
|  *                         thread pool will never have more than this | ||||
|  *                         number of threads. | ||||
|  *      maxIdleTime      - maximum time that a worker thread will spend | ||||
|  *                         idle. If a worker is idle longer than this | ||||
|  *                         time and there are more than the min | ||||
|  *                         number of workers running, than the | ||||
|  *                         worker thread exits. | ||||
|  *      jobsPerThread    - ratio of jobs to thread to try and maintain | ||||
|  *                         if a job is scheduled and the number of jobs per | ||||
|  *                         thread is greater than this number,and   | ||||
|  *                         if less than the maximum number of | ||||
|  *                         workers are running then a new thread is  | ||||
|  *                         started to help out with efficiency. | ||||
|  *      schedPolicy      - scheduling policy to try and set (OS dependent) | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure. | ||||
|  *      EAGAIN if not enough system resources to create minimum threads. | ||||
|  *      INVALID_POLICY if schedPolicy can't be set | ||||
|  *      EMAXTHREADS if minimum threads is greater than maximum threads | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr); | ||||
|  * \return | ||||
|  *	\li \c 0 on success. | ||||
|  *	\li \c EOUTOFMEM not enough memory to add job. | ||||
|  *	\li \c EMAXTHREADS not enough threads to add persistent job. | ||||
|  */ | ||||
| int ThreadPoolAddPersistent( | ||||
| 	/*! Valid thread pool pointer. */ | ||||
| 	ThreadPool*tp, | ||||
| 	/*! Valid thread pool job. */ | ||||
| 	ThreadPoolJob *job, | ||||
| 	/*! . */ | ||||
| 	int *jobId); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolAddPersistent | ||||
| /*! | ||||
|  * \brief Gets the current set of attributes associated with the thread pool. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a persistent job to the thread pool. | ||||
|  *      Job will be run as soon as possible. | ||||
|  *      Call will block until job is scheduled. | ||||
|  *  Parameters: | ||||
|  *      tp - valid thread pool pointer | ||||
|  *      ThreadPoolJob - valid thread pool job with the following fields: | ||||
|  * | ||||
|  *        func - ThreadFunction to run | ||||
|  *        arg - argument to function. | ||||
|  *        priority - priority of job. | ||||
|  *  | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      EOUTOFMEM not enough memory to add job. | ||||
|  *      EMAXTHREADS not enough threads to add persistent job. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId); | ||||
|  * \return | ||||
|  * 	\li \c 0 on success, nonzero on failure. | ||||
|  */ | ||||
| int ThreadPoolGetAttr( | ||||
| 	/*! valid thread pool pointer. */ | ||||
| 	ThreadPool *tp, | ||||
| 	/*! non null pointer to store attributes. */ | ||||
| 	ThreadPoolAttr *out); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolGetAttr | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Gets the current set of attributes | ||||
|  *      associated with the thread pool. | ||||
|  *  Parameters: | ||||
|  *      tp - valid thread pool pointer | ||||
|  *      out - non null pointer to store attributes | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolSetAttr | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the attributes for the thread pool. | ||||
| /*! | ||||
|  * \brief Sets the attributes for the thread pool. | ||||
|  * Only affects future calculations. | ||||
|  *  Parameters: | ||||
|  *      tp - valid thread pool pointer | ||||
|  *      attr - pointer to attributes, null sets attributes to default. | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      Returns INVALID_POLICY if policy can not be set. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolAdd | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a job to the thread pool. | ||||
|  *      Job will be run as soon as possible. | ||||
|  *  Parameters: | ||||
|  *      tp - valid thread pool pointer | ||||
|  *      func - ThreadFunction to run | ||||
|  *      arg - argument to function. | ||||
|  *      priority - priority of job. | ||||
|  *      poolid - id of job | ||||
|  *      free_function - function to use when freeing argument  | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      EOUTOFMEM if not enough memory to add job. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId); | ||||
|  * \return | ||||
|  * 	\li \c 0 on success, nonzero on failure. | ||||
|  * 	\li \c INVALID_POLICY if policy can not be set. | ||||
|  */ | ||||
| int ThreadPoolSetAttr( | ||||
| 	/*! valid thread pool pointer. */ | ||||
| 	ThreadPool *tp, | ||||
| 	/*! pointer to attributes, null sets attributes to default. */ | ||||
| 	ThreadPoolAttr *attr); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolRemove | ||||
| /*! | ||||
|  * \brief Adds a job to the thread pool. Job will be run as soon as possible. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Removes a job from the thread pool. | ||||
|  *      Can only remove jobs which are not | ||||
|  *      currently running. | ||||
|  *  Parameters: | ||||
|  *      tp - valid thread pool pointer | ||||
|  *      jobid - id of job | ||||
|  *      out - space for removed job. | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure. | ||||
|  *      INVALID_JOB_ID if job not found.  | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolRemove(ThreadPool *tp, int jobId, ThreadPoolJob *out); | ||||
|  * \return | ||||
|  * 	\li \c 0 on success, nonzero on failure. | ||||
|  * 	\li \c EOUTOFMEM if not enough memory to add job. | ||||
|  */ | ||||
| int ThreadPoolAdd( | ||||
| 	/*! valid thread pool pointer. */ | ||||
| 	ThreadPool*tp, | ||||
| 	/*! . */ | ||||
| 	ThreadPoolJob *job, | ||||
| 	/*! id of job. */ | ||||
| 	int *jobId); | ||||
|  | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolShutdown | ||||
| /*! | ||||
|  * \brief Removes a job from the thread pool. Can only remove jobs which | ||||
|  * are not currently running. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Shuts the thread pool down. | ||||
|  *      Waits for all threads to finish.  | ||||
|  *      May block indefinitely if jobs do not | ||||
|  *      exit. | ||||
|  *  Parameters: | ||||
|  *      tp - must be valid tp      | ||||
|  *  Returns: | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolShutdown(ThreadPool *tp); | ||||
|  * \return | ||||
|  * 	\li \c 0 on success, nonzero on failure. | ||||
|  * 	\li \c INVALID_JOB_ID if job not found.  | ||||
|  */ | ||||
| int ThreadPoolRemove( | ||||
| 	/*! valid thread pool pointer. */ | ||||
| 	ThreadPool *tp, | ||||
| 	/*! id of job. */ | ||||
| 	int jobId, | ||||
| 	/*! space for removed job. */ | ||||
| 	ThreadPoolJob *out); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPJobInit | ||||
| /*! | ||||
|  * \brief Shuts the thread pool down. Waits for all threads to finish. | ||||
|  * May block indefinitely if jobs do not exit. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes thread pool job. | ||||
|  *      Sets the priority to default defined in ThreadPool.h. | ||||
|  *      Sets the free_routine to default defined in ThreadPool.h | ||||
|  *  Parameters: | ||||
|  *      ThreadPoolJob *job - must be valid thread pool attributes.     | ||||
|  *      start_routine func - function to run, must be valid | ||||
|  *      void * arg - argument to pass to function. | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg); | ||||
|  * \return 0 on success, nonzero on failure | ||||
|  */ | ||||
| int ThreadPoolShutdown( | ||||
| 	/*! must be valid tp. */ | ||||
| 	ThreadPool *tp); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPJobSetPriority | ||||
| /*! | ||||
|  * \brief Initializes thread pool job. Sets the priority to default defined | ||||
|  * in ThreadPool.h. Sets the free_routine to default defined in ThreadPool.h. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the max threads for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.  | ||||
|  *      maxThreads - value to set | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPJobInit( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolJob *job, | ||||
| 	/*! function to run, must be valid. */ | ||||
| 	start_routine func, | ||||
| 	/*! argument to pass to function. */ | ||||
| 	void *arg); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPJobSetFreeFunction | ||||
| /*! | ||||
|  * \brief Sets the max threads for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the max threads for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.  | ||||
|  *      maxThreads - value to set | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPJobSetPriority( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolJob *job, | ||||
| 	/*! value to set. */ | ||||
| 	ThreadPriority priority); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrInit | ||||
| /*! | ||||
|  * \brief Sets the max threads for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes thread pool attributes. | ||||
|  *      Sets values to defaults defined in ThreadPool.h. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.     | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrInit(ThreadPoolAttr *attr); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPJobSetFreeFunction( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolJob *job, | ||||
| 	/*! value to set. */ | ||||
| 	free_routine func); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetMaxThreads | ||||
| /*! | ||||
|  * \brief Initializes thread pool attributes. Sets values to defaults defined | ||||
|  * in ThreadPool.h. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the max threads for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.  | ||||
|  *      maxThreads - value to set | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrInit( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetMinThreads | ||||
| /*! | ||||
|  * \brief Sets the max threads for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the min threads for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.  | ||||
|  *      minThreads - value to set | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetMaxThreads( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! value to set. */ | ||||
| 	int maxThreads); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetStackSize | ||||
| /*! | ||||
|  * \brief Sets the min threads for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the stack size for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes. | ||||
|  *      stackSize - value to set | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetStackSize(ThreadPoolAttr *attr, size_t stackSize); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetMinThreads( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! value to set. */ | ||||
| 	int minThreads); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetIdleTime | ||||
| /*! | ||||
|  * \brief Sets the stack size for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the idle time for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.     | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetStackSize( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! value to set. */ | ||||
| 	size_t stackSize); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetJobsPerThread | ||||
| /*! | ||||
|  * \brief Sets the idle time for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the jobs per thread ratio | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes. | ||||
|  *      jobsPerThread - number of jobs per thread to maintain | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetIdleTime( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! . */ | ||||
| 	int idleTime); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetStarvationTime | ||||
| /*! | ||||
|  * \brief Sets the jobs per thread ratio | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the starvation time for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.     | ||||
|  *      int starvationTime - milliseconds | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetJobsPerThread( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! number of jobs per thread to maintain. */ | ||||
| 	int jobsPerThread); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetSchedPolicy | ||||
| /*! | ||||
|  * \brief Sets the starvation time for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the scheduling policy for the thread pool attributes. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes.     | ||||
|  *      PolicyType schedPolicy - must be a valid policy type. | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetSchedPolicy(ThreadPoolAttr *attr, PolicyType schedPolicy); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetStarvationTime( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! milliseconds. */ | ||||
| 	int starvationTime); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetMaxJobsTotal | ||||
| /*! | ||||
|  * \brief Sets the scheduling policy for the thread pool attributes. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the maximum number jobs that can be qeued totally. | ||||
|  *  Parameters: | ||||
|  *      attr - must be valid thread pool attributes. | ||||
|  *      maxJobsTotal - maximum number of jobs | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal); | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetSchedPolicy( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! must be a valid policy type. */ | ||||
| 	PolicyType schedPolicy); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolGetStats | ||||
| /*! | ||||
|  * \brief Sets the maximum number jobs that can be qeued totally. | ||||
|  * | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| int TPAttrSetMaxJobsTotal( | ||||
| 	/*! must be valid thread pool attributes. */ | ||||
| 	ThreadPoolAttr *attr, | ||||
| 	/*! maximum number of jobs. */ | ||||
| 	int maxJobsTotal); | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns various statistics about the thread pool. | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns various statistics about the | ||||
|  *      thread pool. | ||||
|  * Only valid if STATS has been defined. | ||||
|  *  Parameters: | ||||
|  *      ThreadPool *tp - valid initialized threadpool     | ||||
|  *      ThreadPoolStats *stats - valid stats, out parameter | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
|  * | ||||
|  * \return Always returns 0. | ||||
|  */ | ||||
| #ifdef STATS | ||||
| 	EXPORT_SPEC int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats); | ||||
|  | ||||
| 	EXPORT_SPEC void ThreadPoolPrintStats(ThreadPoolStats *stats); | ||||
| 	EXPORT_SPEC int ThreadPoolGetStats( | ||||
| 		/*! Valid initialized threadpool. */ | ||||
| 		ThreadPool *tp, | ||||
| 		/*! Valid stats, out parameter. */ | ||||
| 		ThreadPoolStats *stats); | ||||
| #else | ||||
| 	static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {} | ||||
|  | ||||
| 	static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {} | ||||
| 	static UPNP_INLINE int ThreadPoolGetStats( | ||||
| 		/*! Valid initialized threadpool. */ | ||||
| 		ThreadPool *tp, | ||||
| 		/*! Valid stats, out parameter. */ | ||||
| 		ThreadPoolStats *stats) {} | ||||
| #endif | ||||
|  | ||||
| /*! | ||||
|  * \brief | ||||
|  */ | ||||
| #ifdef STATS | ||||
| 	EXPORT_SPEC void ThreadPoolPrintStats( | ||||
| 		/*! . */ | ||||
| 		ThreadPoolStats *stats); | ||||
| #else | ||||
| 	static UPNP_INLINE void ThreadPoolPrintStats( | ||||
| 		/*! . */ | ||||
| 		ThreadPoolStats *stats) {} | ||||
| #endif | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #endif /* THREADPOOL_H */ | ||||
|  | ||||
|   | ||||
| @@ -29,35 +29,31 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef TIMERTHREAD_H | ||||
| #define TIMERTHREAD_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "FreeList.h" | ||||
| #include "ithread.h" | ||||
| #include "LinkedList.h" | ||||
| #include "ThreadPool.h" | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define INVALID_EVENT_ID (-10 & 1<<29) | ||||
|  | ||||
|  | ||||
| /* Timeout Types */ | ||||
| /* absolute means in seconds from Jan 1, 1970 */ | ||||
| /* relative means in seconds from current time */ | ||||
| typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType; | ||||
|  | ||||
| /*! Timeout Types. */ | ||||
| typedef enum timeoutType { | ||||
| 	/*! seconds from Jan 1, 1970. */ | ||||
| 	ABS_SEC, | ||||
| 	/*! seconds from current time. */ | ||||
| 	REL_SEC | ||||
| } TimeoutType; | ||||
|  | ||||
| /*! | ||||
|  * A timer thread similar to the one in the Upnp SDK that allows | ||||
| @@ -79,7 +75,6 @@ typedef struct TIMERTHREAD | ||||
| 	ThreadPool *tp; | ||||
| } TimerThread; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * Struct to contain information for a timer event. | ||||
|  * | ||||
| @@ -95,7 +90,6 @@ typedef struct TIMEREVENT | ||||
| 	int id; | ||||
| } TimerEvent; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes and starts timer thread. | ||||
|  * | ||||
| @@ -109,7 +103,6 @@ int TimerThreadInit( | ||||
| 	 * lifetime of timer. Timer must be shutdown BEFORE thread pool. */ | ||||
| 	ThreadPool *tp); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Schedules an event to run at a specified time. | ||||
|  * | ||||
| @@ -132,7 +125,6 @@ int TimerThreadSchedule( | ||||
| 	/*! [in] Id of timer event. (out, can be null). */ | ||||
| 	int *id); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Removes an event from the timer Q. | ||||
|  * | ||||
| @@ -148,7 +140,6 @@ int TimerThreadRemove( | ||||
| 	/*! [in] Space for thread pool job. */ | ||||
| 	ThreadPoolJob *out); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Shutdown the timer thread. | ||||
|  * | ||||
| @@ -162,7 +153,6 @@ int TimerThreadShutdown( | ||||
| 	/*! [in] Valid timer thread pointer. */ | ||||
| 	TimerThread *timer); | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -1,7 +1,11 @@ | ||||
| #ifndef ITHREAD_H | ||||
| #define ITHREAD_H | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * 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:  | ||||
| @@ -29,43 +33,29 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef ITHREAD_H | ||||
| #define ITHREAD_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #if !defined(WIN32) | ||||
| 	#include <sys/param.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include "UpnpGlobal.h" /* For UPNP_INLINE, EXPORT_SPEC */ | ||||
|  | ||||
| #include "UpnpUniStd.h" /* for close() */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include <pthread.h> | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if defined(BSD) | ||||
| 	#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef PTHREAD_MUTEX_RECURSIVE | ||||
| #if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__) | ||||
| 	/* This system has SuS2-compliant mutex attributes. | ||||
| 	 * E.g. on Cygwin, where we don't have the old nonportable (NP) symbols | ||||
| 	 */ | ||||
| @@ -87,7 +77,8 @@ extern "C" { | ||||
|  | ||||
|  | ||||
| #define ITHREAD_STACK_MIN PTHREAD_STACK_MIN | ||||
|  | ||||
| #define ITHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED | ||||
| #define ITHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Name: ithread_t | ||||
| @@ -336,7 +327,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) { | ||||
|  *      Returns EINVAL if the kind is not supported. | ||||
|  *      See man page for pthread_mutexattr_setkind_np | ||||
|  *****************************************************************************/ | ||||
| #ifdef PTHREAD_MUTEX_RECURSIVE | ||||
| #if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__) | ||||
| 	#define ithread_mutexattr_setkind_np pthread_mutexattr_settype | ||||
| #else | ||||
| 	#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np | ||||
| @@ -361,7 +352,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) { | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_mutexattr_getkind_np | ||||
|  *****************************************************************************/ | ||||
| #ifdef PTHREAD_MUTEX_RECURSIVE | ||||
| #if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__) | ||||
| 	#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype | ||||
| #else | ||||
| 	#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np | ||||
| @@ -789,6 +780,22 @@ static UPNP_INLINE int ithread_cleanup_thread(void) { | ||||
|    ***************************************************************************/ | ||||
| #define ithread_attr_setstacksize pthread_attr_setstacksize | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Function: ithread_attr_setdetachstate | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Sets detach state of a thread attribute object. | ||||
|    *  Parameters: | ||||
|    *      ithread_attr_t *attr (must be valid non NULL pointer to | ||||
|    *      ithread_attr_t) | ||||
|    *      int detachstate (value of detachstate must be ITHREAD_CREATE_DETACHED | ||||
|    *      or ITHREAD_CREATE_JOINABLE) | ||||
|    *  Returns: | ||||
|    *      0 on success. Nonzero on failure. | ||||
|    *      See man page for pthread_attr_setdetachstate | ||||
|    ***************************************************************************/ | ||||
| #define ithread_attr_setdetachstate pthread_attr_setdetachstate | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Function: ithread_create | ||||
|    * | ||||
| @@ -933,7 +940,8 @@ static UPNP_INLINE int ithread_cleanup_thread(void) { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifndef PTHREAD_MUTEX_RECURSIVE | ||||
| #if !defined(PTHREAD_MUTEX_RECURSIVE) && !defined(__DragonFly__) && !defined(UPNP_USE_MSVCPP) | ||||
| /* !defined(UPNP_USE_MSVCPP) should probably also have pthreads version check - but it's not clear if that is possible */ | ||||
| /* NK: Added for satisfying the gcc compiler */ | ||||
| EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind); | ||||
| #endif | ||||
|   | ||||
| @@ -1,85 +1,54 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
| #include "FreeList.h" | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListInit | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes Free List. Must be called first. | ||||
|  *      And only once for FreeList. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *      size_t -     size of elements to store in free list | ||||
|  *      maxFreeListSize - max size that the free list can grow to | ||||
|  *                        before returning memory to O.S. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| FreeListInit( FreeList * free_list, | ||||
|               size_t elementSize, | ||||
|               int maxFreeListLength ) | ||||
| int FreeListInit(FreeList *free_list, size_t elementSize, int maxFreeListLength) | ||||
| { | ||||
| 	assert(free_list != NULL); | ||||
|  | ||||
| 	if (free_list == NULL) | ||||
| 		return EINVAL; | ||||
|  | ||||
| 	free_list->element_size = elementSize; | ||||
| 	free_list->maxFreeListLength = maxFreeListLength; | ||||
| 	free_list->head = NULL; | ||||
| 	free_list->freeListLength = 0; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListAlloc | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Allocates chunk of set size. | ||||
|  *      If a free item is available in the list, returnes the stored item. | ||||
|  *      Otherwise calls the O.S. to allocate memory. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *  Returns: | ||||
|  *      Non NULL on success. NULL on failure. | ||||
|  *****************************************************************************/ | ||||
| void * | ||||
| FreeListAlloc( FreeList * free_list ) | ||||
| void *FreeListAlloc(FreeList *free_list) | ||||
| { | ||||
| 	FreeListNode *ret = NULL; | ||||
|  | ||||
| @@ -99,79 +68,44 @@ FreeListAlloc( FreeList * free_list ) | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListFree | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns an item to the Free List. | ||||
|  *      If the free list is smaller than the max size than | ||||
|  *      adds the item to the free list. | ||||
|  *      Otherwise returns the item to the O.S. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a free list. | ||||
|  *      element - must be a pointer allocated by FreeListAlloc | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| FreeListFree( FreeList * free_list, | ||||
|               void *element ) | ||||
| int FreeListFree(FreeList *free_list, void *element) | ||||
| { | ||||
|  | ||||
| 	FreeListNode *temp = NULL; | ||||
|  | ||||
| 	assert(free_list != NULL); | ||||
|  | ||||
| 	if (free_list == NULL) | ||||
| 		return EINVAL; | ||||
|  | ||||
|     if( ( element != NULL ) && | ||||
|         ( ( free_list->freeListLength + 1 ) < | ||||
|           free_list->maxFreeListLength ) ) { | ||||
| 	if (element != NULL && | ||||
| 	    free_list->freeListLength + 1 < free_list->maxFreeListLength) { | ||||
| 		free_list->freeListLength++; | ||||
| 		temp = (FreeListNode *)element; | ||||
| 		temp->next = free_list->head; | ||||
| 		free_list->head = temp; | ||||
|  | ||||
| 	} else { | ||||
|  | ||||
| 		free(element); | ||||
| 	} | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: FreeListDestroy | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Releases the resources stored with the free list. | ||||
|  *  Parameters: | ||||
|  *      free_list  - must be valid, non null, pointer to a linked list. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| FreeListDestroy( FreeList * free_list ) | ||||
| int FreeListDestroy(FreeList *free_list) | ||||
| { | ||||
| 	FreeListNode *temp = NULL; | ||||
| 	int i = 0; | ||||
|  | ||||
| 	assert(free_list != NULL); | ||||
|  | ||||
|     if( free_list == NULL ) | ||||
| 	if (!free_list) | ||||
| 		return EINVAL; | ||||
|  | ||||
| 	while (free_list->head) { | ||||
| 		i++; | ||||
| 		temp = free_list->head->next; | ||||
| 		free(free_list->head); | ||||
| 		free_list->head = temp; | ||||
| 	} | ||||
|  | ||||
| 	free_list->freeListLength = 0; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -29,52 +30,43 @@ | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "LinkedList.h" | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <sys/param.h> */ | ||||
| #else | ||||
| 	#include <sys/param.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__) | ||||
| 	#include <stdlib.h> | ||||
| #else | ||||
| 	#include <malloc.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
|  | ||||
|  | ||||
| static int | ||||
| freeListNode( ListNode * node, | ||||
|               LinkedList * list ) | ||||
| static int freeListNode(ListNode *node, LinkedList *list) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
|  | ||||
| 	return FreeListFree(&list->freeNodeList, node); | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: CreateListNode | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Creates a list node. Dynamically. | ||||
| /*! | ||||
|  * \brief Dynamically creates a list node. | ||||
|  *       | ||||
|  *  Parameters: | ||||
|  *      void * item - the item to store | ||||
|  *  Returns: | ||||
|  *      The new node, NULL on failure. | ||||
|  *****************************************************************************/ | ||||
| static ListNode * | ||||
| CreateListNode( void *item, | ||||
|  */ | ||||
| static ListNode *CreateListNode( | ||||
| 	/*! the item to store. */ | ||||
| 	void *item, | ||||
| 	/*! The list to add it to. */ | ||||
| 	LinkedList *list) | ||||
| { | ||||
|  | ||||
| 	ListNode *temp = NULL; | ||||
|  | ||||
| 	assert(list != NULL); | ||||
| @@ -85,73 +77,36 @@ CreateListNode( void *item, | ||||
| 		temp->next = NULL; | ||||
| 		temp->item = item; | ||||
| 	} | ||||
|  | ||||
| 	return temp; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListInit | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes LinkedList. Must be called first. | ||||
|  *      And only once for List. | ||||
|  *  Parameters: | ||||
|  *      list  - must be valid, non null, pointer to a linked list. | ||||
|  *      cmp_func - function used to compare items. (May be NULL) | ||||
|  *      free_func - function used to free items. (May be NULL) | ||||
|  *  Returns: | ||||
|  *      0 on success, EOUTOFMEM on failure. | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| ListInit( LinkedList * list, | ||||
|           cmp_routine cmp_func, | ||||
|           free_function free_func ) | ||||
| int ListInit(LinkedList *list, cmp_routine cmp_func, free_function free_func) | ||||
| { | ||||
|  | ||||
| 	int retCode = 0; | ||||
|  | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if (!list) | ||||
| 		return EINVAL; | ||||
|  | ||||
| 	list->size = 0; | ||||
| 	list->cmp_func = cmp_func; | ||||
| 	list->free_func = free_func; | ||||
|  | ||||
|     retCode = | ||||
|         FreeListInit( &list->freeNodeList, sizeof( ListNode ), | ||||
|                       FREELISTSIZE ); | ||||
| 	retCode = FreeListInit(&list->freeNodeList, sizeof(ListNode), FREELISTSIZE); | ||||
|  | ||||
| 	assert(retCode == 0); | ||||
|  | ||||
| 	list->head.item = NULL; | ||||
| 	list->head.next = &list->tail; | ||||
| 	list->head.prev = NULL; | ||||
|  | ||||
| 	list->tail.item = NULL; | ||||
| 	list->tail.prev = &list->head; | ||||
| 	list->tail.next = NULL; | ||||
|  | ||||
|     return 0; | ||||
| 	return retCode; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddHead | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node to the head of the list. | ||||
|  *      Node gets immediately after list.head. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      void * item - item to be added | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListAddHead( LinkedList * list, | ||||
|              void *item ) | ||||
| ListNode *ListAddHead(LinkedList *list, void *item) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
|  | ||||
| @@ -161,59 +116,24 @@ ListAddHead( LinkedList * list, | ||||
| 	return ListAddAfter(list, item, &list->head); | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddTail | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node to the tail of the list. | ||||
|  *      Node gets added immediately before list.tail. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      void * item - item to be added | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListAddTail( LinkedList * list, | ||||
|              void *item ) | ||||
| ListNode *ListAddTail(LinkedList *list, void *item) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if (!list) | ||||
| 		return NULL; | ||||
|  | ||||
| 	return ListAddBefore(list, item, &list->tail); | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddAfter | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node after the specified node. | ||||
|  *      Node gets added immediately after bnode. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      void * item - item to be added | ||||
|  *      ListNode * bnode - node to add after | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListAddAfter( LinkedList * list, | ||||
|               void *item, | ||||
|               ListNode * bnode ) | ||||
| ListNode *ListAddAfter(LinkedList *list, void *item, ListNode *bnode) | ||||
| { | ||||
| 	ListNode *newNode = NULL; | ||||
|  | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( ( list == NULL ) || ( bnode == NULL ) ) | ||||
| 	if (!list || !bnode) | ||||
| 		return NULL; | ||||
|  | ||||
| 	newNode = CreateListNode(item, list); | ||||
| 	if (newNode) { | ||||
| 		ListNode *temp = bnode->next; | ||||
| @@ -223,40 +143,22 @@ ListAddAfter( LinkedList * list, | ||||
| 		newNode->next = temp; | ||||
| 		temp->prev = newNode; | ||||
| 		list->size++; | ||||
|  | ||||
| 		return newNode; | ||||
| 	} | ||||
|  | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListAddBefore | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Adds a node before the specified node. | ||||
|  *      Node gets added immediately before anode. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      ListNode * anode  - node to add the in front of. | ||||
|  *      void * item - item to be added | ||||
|  *  Returns: | ||||
|  *      The pointer to the ListNode on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListAddBefore( LinkedList * list, | ||||
|                void *item, | ||||
|                ListNode * anode ) | ||||
| ListNode *ListAddBefore(LinkedList *list, void *item, ListNode *anode) | ||||
| { | ||||
| 	ListNode *newNode = NULL; | ||||
|  | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( ( list == NULL ) || ( anode == NULL ) ) | ||||
| 	if (!list || !anode) | ||||
| 		return NULL; | ||||
|  | ||||
| 	newNode = CreateListNode(item, list); | ||||
|  | ||||
| 	if (newNode) { | ||||
| 		ListNode *temp = anode->prev; | ||||
|  | ||||
| @@ -265,30 +167,14 @@ ListAddBefore( LinkedList * list, | ||||
| 		newNode->prev = temp; | ||||
| 		temp->next = newNode; | ||||
| 		list->size++; | ||||
|  | ||||
| 		return newNode; | ||||
| 	} | ||||
|  | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListDelNode | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Removes a node from the list | ||||
|  *      The memory for the node is freed but the | ||||
|  *      the memory for the items are not. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      ListNode *dnode - done to delete. | ||||
|  *  Returns: | ||||
|  *      The pointer to the item stored in node on success, NULL on failure. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| void * | ||||
| ListDelNode( LinkedList * list, | ||||
|              ListNode * dnode, | ||||
|              int freeItem ) | ||||
| void *ListDelNode(LinkedList *list, ListNode *dnode, int freeItem) | ||||
| { | ||||
| 	void *temp; | ||||
|  | ||||
| @@ -296,19 +182,13 @@ ListDelNode( LinkedList * list, | ||||
| 	assert(dnode != &list->head); | ||||
| 	assert(dnode != &list->tail); | ||||
|  | ||||
|     if( ( list == NULL ) || | ||||
|         ( dnode == &list->head ) || | ||||
|         ( dnode == &list->tail ) || ( dnode == NULL ) ) { | ||||
| 	if (!list || dnode == &list->head || dnode == &list->tail || !dnode) | ||||
| 		return NULL; | ||||
|     } | ||||
|  | ||||
| 	temp = dnode->item; | ||||
| 	dnode->prev->next = dnode->next; | ||||
| 	dnode->next->prev = dnode->prev; | ||||
|  | ||||
| 	freeListNode(dnode, list); | ||||
| 	list->size--; | ||||
|  | ||||
| 	if (freeItem && list->free_func) { | ||||
| 		list->free_func(temp); | ||||
| 		temp = NULL; | ||||
| @@ -317,29 +197,12 @@ ListDelNode( LinkedList * list, | ||||
| 	return temp; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListDestroy | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Removes all memory associated with list nodes.  | ||||
|  *      Does not free LinkedList *list.  | ||||
|  *      Items stored in the list are not freed, only nodes are. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| ListDestroy( LinkedList * list, | ||||
|              int freeItem ) | ||||
| int ListDestroy(LinkedList *list, int freeItem) | ||||
| { | ||||
| 	ListNode *dnode = NULL; | ||||
| 	ListNode *temp = NULL; | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if(!list) | ||||
| 		return EINVAL; | ||||
|  | ||||
| 	for (dnode = list->head.next; dnode != &list->tail; ) { | ||||
| @@ -347,120 +210,57 @@ ListDestroy( LinkedList * list, | ||||
| 		ListDelNode(list, dnode, freeItem); | ||||
| 		dnode = temp; | ||||
| 	} | ||||
|  | ||||
| 	list->size = 0; | ||||
| 	FreeListDestroy(&list->freeNodeList); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListHead | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the head of the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The head of the list. NULL if list is empty. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListHead( LinkedList * list ) | ||||
| ListNode *ListHead(LinkedList *list) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if (!list) | ||||
| 		return NULL; | ||||
|  | ||||
|     if( list->size == 0 ) | ||||
| 	if (!list->size) | ||||
| 		return NULL; | ||||
| 	else | ||||
| 		return list->head.next; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListTail | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the tail of the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The tail of the list. NULL if list is empty. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListTail( LinkedList * list ) | ||||
| ListNode *ListTail(LinkedList *list) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if (!list) | ||||
| 		return NULL; | ||||
|  | ||||
|     if( list->size == 0 ) | ||||
| 	if (!list->size) | ||||
| 		return NULL; | ||||
| 	else | ||||
| 		return list->tail.prev; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListNext | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the next item in the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The next item in the list. NULL if there are no more items in list. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListNext( LinkedList * list, | ||||
|           ListNode * node ) | ||||
| ListNode *ListNext(LinkedList *list, ListNode *node) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
| 	assert(node != NULL); | ||||
|  | ||||
|     if( ( list == NULL ) || ( node == NULL ) ) | ||||
| 	if (!list || !node) | ||||
| 		return NULL; | ||||
|  | ||||
| 	if (node->next == &list->tail) | ||||
| 		return NULL; | ||||
| 	else | ||||
| 		return node->next; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListPrev | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Returns the previous item in the list. | ||||
|  *     | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *   | ||||
|  *  Returns: | ||||
|  *      The previous item in the list. NULL if there are no more items in list. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListPrev( LinkedList * list, | ||||
|           ListNode * node ) | ||||
| ListNode *ListPrev(LinkedList *list, ListNode *node) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
| 	assert(node != NULL); | ||||
|  | ||||
|     if( ( list == NULL ) || ( node == NULL ) ) | ||||
| 	if (!list || !node) | ||||
| 		return NULL; | ||||
|  | ||||
| 	if (node->prev == &list->head) | ||||
| @@ -469,35 +269,13 @@ ListPrev( LinkedList * list, | ||||
| 		return node->prev; | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListFind | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Finds the specified item in the list. | ||||
|  *      Uses the compare function specified in ListInit. If compare function | ||||
|  *      is NULL then compares items as pointers. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|  *      ListNode *start - the node to start from, NULL if to start from  | ||||
|  *                        beginning. | ||||
|  *      void * item - the item to search for. | ||||
|  *  Returns: | ||||
|  *      The node containing the item. NULL if no node contains the item. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| ListNode * | ||||
| ListFind( LinkedList * list, | ||||
|           ListNode * start, | ||||
|           void *item ) | ||||
| ListNode *ListFind(LinkedList *list, ListNode *start, void *item) | ||||
| { | ||||
|  | ||||
| 	ListNode *finger = NULL; | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if (!list) | ||||
| 		return NULL; | ||||
|  | ||||
|     if( start == NULL ) | ||||
| 	if (!start) | ||||
| 		start = &list->head; | ||||
|  | ||||
| 	assert(start); | ||||
| @@ -518,28 +296,13 @@ ListFind( LinkedList * list, | ||||
| 	} | ||||
|  | ||||
| 	return NULL; | ||||
|  | ||||
| } | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ListSize | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Returns the size of the list. | ||||
|  *  Parameters: | ||||
|  *      LinkedList *list  - must be valid, non null, pointer to a linked list. | ||||
|   | ||||
|  *  Returns: | ||||
|  *      The number of items in the list. | ||||
|  *  Precondition: | ||||
|  *      The list has been initialized. | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| ListSize( LinkedList * list ) | ||||
| long ListSize(LinkedList *list) | ||||
| { | ||||
| 	assert(list != NULL); | ||||
|  | ||||
|     if( list == NULL ) | ||||
| 	if (!list) | ||||
| 		return EINVAL; | ||||
|  | ||||
| 	return list->size; | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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:  | ||||
| @@ -29,18 +30,14 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "TimerThread.h" | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Deallocates a dynamically allocated TimerEvent. | ||||
|  */ | ||||
| @@ -55,7 +52,6 @@ static void FreeTimerEvent( | ||||
| 	FreeListFree(&timer->freeEvents, event); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Implements timer thread. | ||||
|  * | ||||
| @@ -67,46 +63,38 @@ static void *TimerThreadWorker( | ||||
| { | ||||
|     TimerThread *timer = ( TimerThread * ) arg; | ||||
|     ListNode *head = NULL; | ||||
|  | ||||
|     TimerEvent *nextEvent = NULL; | ||||
|  | ||||
|     time_t currentTime = 0; | ||||
|     time_t nextEventTime = 0; | ||||
|     struct timespec timeToWait; | ||||
|  | ||||
|     int tempId; | ||||
|  | ||||
|     assert( timer != NULL ); | ||||
|  | ||||
|     ithread_mutex_lock( &timer->mutex ); | ||||
|  | ||||
|     while( 1 ) | ||||
|     { | ||||
|         //mutex should always be locked at top of loop | ||||
|         //Check for shutdown | ||||
|         if( timer->shutdown ) | ||||
|         { | ||||
|     while (1) { | ||||
|         /* mutex should always be locked at top of loop */ | ||||
| 	/* Check for shutdown. */ | ||||
|         if (timer->shutdown) { | ||||
|             timer->shutdown = 0; | ||||
|             ithread_cond_signal( &timer->condition ); | ||||
|             ithread_mutex_unlock( &timer->mutex ); | ||||
|             return NULL; | ||||
|         } | ||||
|  | ||||
|         nextEvent = NULL; | ||||
|  | ||||
|         //Get the next event if possible | ||||
|         if( timer->eventQ.size > 0 ) | ||||
|         { | ||||
|         /* Get the next event if possible. */ | ||||
|         if (timer->eventQ.size > 0) { | ||||
|             head = ListHead( &timer->eventQ ); | ||||
|             if (head == NULL) { | ||||
|                 ithread_mutex_unlock( &timer->mutex ); | ||||
|                 return NULL; | ||||
|             } | ||||
|             nextEvent = ( TimerEvent * ) head->item; | ||||
|             nextEventTime = nextEvent->eventTime; | ||||
|         } | ||||
|  | ||||
|         currentTime = time(NULL); | ||||
|  | ||||
|         //If time has elapsed, schedule job | ||||
|         if( ( nextEvent != NULL ) && ( currentTime >= nextEventTime ) ) | ||||
|         { | ||||
|         /* If time has elapsed, schedule job. */ | ||||
|         if (nextEvent && currentTime >= nextEventTime) { | ||||
|             if( nextEvent->persistent ) { | ||||
|                 ThreadPoolAddPersistent( timer->tp, &nextEvent->job, | ||||
|                                          &tempId ); | ||||
| @@ -117,8 +105,7 @@ static void *TimerThreadWorker( | ||||
|             FreeTimerEvent( timer, nextEvent ); | ||||
|             continue; | ||||
|         } | ||||
|  | ||||
|         if( nextEvent != NULL ) { | ||||
|         if (nextEvent) { | ||||
|             timeToWait.tv_nsec = 0; | ||||
|             timeToWait.tv_sec = nextEvent->eventTime; | ||||
|             ithread_cond_timedwait( &timer->condition, &timer->mutex, | ||||
| @@ -146,16 +133,16 @@ static int CalculateEventTime( | ||||
|  | ||||
|     assert( timeout != NULL ); | ||||
|  | ||||
|     if( type == ABS_SEC ) | ||||
|     switch (type) { | ||||
|     case ABS_SEC: | ||||
|         return 0; | ||||
|     else if( type == REL_SEC ) { | ||||
|     default: /* REL_SEC) */ | ||||
|         time(&now); | ||||
|         ( *timeout ) += now; | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     return -1; | ||||
|  | ||||
| } | ||||
|  | ||||
| /*! | ||||
| @@ -246,10 +233,8 @@ int TimerThreadInit(TimerThread *timer, ThreadPool *tp) | ||||
|     } | ||||
|  | ||||
|     return rc; | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| int TimerThreadSchedule( | ||||
| 	TimerThread *timer, | ||||
| 	time_t timeout, | ||||
| @@ -258,7 +243,6 @@ int TimerThreadSchedule( | ||||
| 	Duration duration, | ||||
| 	int *id) | ||||
| { | ||||
|  | ||||
|     int rc = EOUTOFMEM; | ||||
|     int found = 0; | ||||
|     int tempId = 0; | ||||
| @@ -291,35 +275,25 @@ int TimerThreadSchedule( | ||||
|     } | ||||
|  | ||||
|     tempNode = ListHead( &timer->eventQ ); | ||||
|     //add job to Q | ||||
|     //Q is ordered by eventTime | ||||
|     //with the head of the Q being the next event | ||||
|  | ||||
|     /* add job to Q. Q is ordered by eventTime with the head of the Q being | ||||
|      * the next event. */ | ||||
|     while( tempNode != NULL ) { | ||||
|         temp = ( TimerEvent * ) tempNode->item; | ||||
|         if( temp->eventTime >= timeout ) | ||||
|         { | ||||
|  | ||||
|             if( ListAddBefore( &timer->eventQ, newEvent, tempNode ) != | ||||
|                 NULL ) | ||||
|         if( temp->eventTime >= timeout ) { | ||||
|             if (ListAddBefore( &timer->eventQ, newEvent, tempNode)) | ||||
|                 rc = 0; | ||||
|             found = 1; | ||||
|             break; | ||||
|  | ||||
|         } | ||||
|         tempNode = ListNext( &timer->eventQ, tempNode ); | ||||
|     } | ||||
|  | ||||
|     //add to the end of Q | ||||
|     /* add to the end of Q. */ | ||||
|     if (!found) { | ||||
|  | ||||
|         if( ListAddTail( &timer->eventQ, newEvent ) != NULL ) | ||||
|             rc = 0; | ||||
|  | ||||
|     } | ||||
|     //signal change in Q | ||||
|     /* signal change in Q. */ | ||||
|     if( rc == 0 ) { | ||||
|  | ||||
|         ithread_cond_signal( &timer->condition ); | ||||
|     } else { | ||||
|         FreeTimerEvent( timer, newEvent ); | ||||
| @@ -330,7 +304,6 @@ int TimerThreadSchedule( | ||||
|     return rc; | ||||
| } | ||||
|  | ||||
|  | ||||
| int TimerThreadRemove( | ||||
| 	TimerThread *timer, | ||||
| 	int id, | ||||
| @@ -369,7 +342,6 @@ int TimerThreadRemove( | ||||
|     return rc; | ||||
| } | ||||
|  | ||||
|  | ||||
| int TimerThreadShutdown(TimerThread *timer) | ||||
| { | ||||
|     ListNode *tempNode2 = NULL; | ||||
| @@ -386,9 +358,7 @@ int TimerThreadShutdown(TimerThread *timer) | ||||
|     timer->shutdown = 1; | ||||
|     tempNode = ListHead( &timer->eventQ ); | ||||
|  | ||||
|     //Delete nodes in Q | ||||
|     //call registered free function  | ||||
|     //on argument | ||||
|     /* Delete nodes in Q. Call registered free function on argument. */ | ||||
|     while( tempNode != NULL ) { | ||||
|         TimerEvent *temp = ( TimerEvent * ) tempNode->item; | ||||
|  | ||||
| @@ -406,18 +376,16 @@ int TimerThreadShutdown(TimerThread *timer) | ||||
|  | ||||
|     ithread_cond_broadcast( &timer->condition ); | ||||
|  | ||||
|     while( timer->shutdown )    //wait for timer thread to shutdown | ||||
|     { | ||||
|     while (timer->shutdown) { | ||||
| 	/* wait for timer thread to shutdown. */ | ||||
|         ithread_cond_wait( &timer->condition, &timer->mutex ); | ||||
|     } | ||||
|  | ||||
|     ithread_mutex_unlock(&timer->mutex); | ||||
|  | ||||
|     //destroy condition | ||||
|     /* destroy condition. */ | ||||
|     while(ithread_cond_destroy(&timer->condition) != 0) { | ||||
|     } | ||||
|  | ||||
|     //destroy mutex | ||||
|     /* destroy mutex. */ | ||||
|     while (ithread_mutex_destroy(&timer->mutex) != 0) { | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -23,7 +23,10 @@ upnpinclude_HEADERS = \ | ||||
| 	inc/upnp.h \ | ||||
| 	inc/upnpdebug.h \ | ||||
| 	inc/UpnpGlobal.h \ | ||||
| 	inc/UpnpInet.h | ||||
| 	inc/UpnpInet.h \ | ||||
| 	inc/UpnpIntTypes.h \ | ||||
| 	inc/UpnpStdInt.h \ | ||||
| 	inc/UpnpUniStd.h | ||||
|  | ||||
| nodist_upnpinclude_HEADERS = inc/upnpconfig.h  | ||||
| if ENABLE_TOOLS | ||||
| @@ -76,16 +79,21 @@ libupnp_la_SOURCES = \ | ||||
| 	src/inc/webserver.h | ||||
|  | ||||
| # ssdp | ||||
| if ENABLE_SSDP | ||||
| libupnp_la_SOURCES += \ | ||||
|         src/ssdp/ssdp_ResultData.h \ | ||||
| 	src/ssdp/ssdp_device.c \ | ||||
| 	src/ssdp/ssdp_ctrlpt.c \ | ||||
| 	src/ssdp/ssdp_server.c | ||||
| endif | ||||
|  | ||||
| # soap | ||||
| if ENABLE_SOAP | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/soap/soap_device.c \ | ||||
| 	src/soap/soap_ctrlpt.c \ | ||||
| 	src/soap/soap_common.c | ||||
| endif | ||||
|  | ||||
| # genlib | ||||
| libupnp_la_SOURCES += \ | ||||
| @@ -105,10 +113,12 @@ libupnp_la_SOURCES += \ | ||||
| 	src/genlib/net/uri/uri.c | ||||
|  | ||||
| # gena | ||||
| if ENABLE_GENA | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/gena/gena_device.c \ | ||||
| 	src/gena/gena_ctrlpt.c \ | ||||
| 	src/gena/gena_callback2.c | ||||
| endif | ||||
|  | ||||
| # api | ||||
| libupnp_la_SOURCES += \ | ||||
| @@ -125,10 +135,12 @@ endif | ||||
|  | ||||
|  | ||||
| # uuid | ||||
| if ENABLE_UUID | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/uuid/md5.c \ | ||||
| 	src/uuid/sysdep.c \ | ||||
| 	src/uuid/uuid.c | ||||
| endif | ||||
|  | ||||
|  | ||||
| # urlconfig | ||||
|   | ||||
| @@ -1,16 +1,12 @@ | ||||
|  | ||||
|  | ||||
| #ifndef UPNPGLOBAL_H | ||||
| #define UPNPGLOBAL_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * \brief Defines constants that for some reason are not defined on some systems. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64 | ||||
| 	#if defined __GNUC__ | ||||
| 		#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE | ||||
| @@ -19,7 +15,6 @@ | ||||
| 	#endif | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* | ||||
| 	 * EXPORT_SPEC | ||||
| @@ -36,21 +31,23 @@ | ||||
| 		#endif /* LIBUPNP_EXPORTS */ | ||||
| 	#endif /* UPNP_STATIC_LIB */ | ||||
|  | ||||
|  | ||||
| 	/* | ||||
| 	 * UPNP_INLINE | ||||
| 	 * PRId64 | ||||
| 	 * PRIzd | ||||
| 	 * PRIzu | ||||
| 	 * PRIzx | ||||
| 	 */ | ||||
| 	#ifdef UPNP_USE_MSVCPP | ||||
| 		/* define some things the M$ VC++ doesn't know */ | ||||
| 		#define UPNP_INLINE | ||||
| 		#define UPNP_INLINE _inline | ||||
| 		typedef __int64 int64_t; | ||||
| 		#define PRId64 "I64d" | ||||
| 		#define PRIzd "ld" | ||||
| 		#define PRIzu "lu" | ||||
| 		#define PRIzx "lx" | ||||
| 	#endif /* UPNP_USE_MSVCPP */ | ||||
|  | ||||
|  | ||||
| 	#ifdef UPNP_USE_BCBPP | ||||
| 		/* define some things Borland Builder doesn't know */ | ||||
| 		#define UPNP_INLINE inline | ||||
| @@ -58,18 +55,20 @@ | ||||
| 		#warning The Borland C compiler is probably broken on PRId64, | ||||
| 		#warning please someone provide a proper fix here | ||||
| 		#define PRId64 "I64d" | ||||
| 		#define PRIzd "zd" | ||||
| 		#define PRIzu "zu" | ||||
| 		#define PRIzx "zx" | ||||
| 	#endif /* UPNP_USE_BCBPP */ | ||||
|  | ||||
|  | ||||
| 	#ifdef __GNUC__ | ||||
| 		#define UPNP_INLINE inline | ||||
|  | ||||
| 		/* Note with PRIzu that in the case of Mingw32, it's the MS C | ||||
| 		 * runtime printf which ends up getting called, not the glibc | ||||
| 		 * printf, so it genuinely doesn't have "zu" | ||||
| 		 */ | ||||
| 		#define PRIzd "ld" | ||||
| 		#define PRIzu "lu" | ||||
| 		#define PRIzx "lx" | ||||
| 	#endif /* __GNUC__ */ | ||||
| #else | ||||
| 	/*!  | ||||
| @@ -88,7 +87,11 @@ | ||||
| 	 * inline keyword. This definition makes the use of this keyword | ||||
| 	 * portable to these systems. | ||||
| 	 */ | ||||
| 	#ifdef __STRICT_ANSI__ | ||||
| 		#define UPNP_INLINE __inline__ | ||||
| 	#else | ||||
| 		#define UPNP_INLINE inline | ||||
| 	#endif | ||||
|  | ||||
| 	/*! | ||||
| 	 * \brief Supply the PRId64 printf() macro. | ||||
| @@ -98,16 +101,17 @@ | ||||
| 	/* #define PRId64 PRId64 */ | ||||
|  | ||||
| 	/*! | ||||
| 	 * \brief Supply the PRIzu printf() macro. | ||||
| 	 * \brief Supply the PRIz* printf() macros. | ||||
| 	 * | ||||
| 	 * This macro was invented so that we can live a little longer with | ||||
| 	 * These macros were invented so that we can live a little longer with | ||||
| 	 * MSVC lack of C99. "z" is the correct printf() size specifier for | ||||
| 	 * the size_t type. | ||||
| 	 */ | ||||
| 	#define PRIzd "zd" | ||||
| 	#define PRIzu "zu" | ||||
| 	#define PRIzx "zx" | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Defining this macro here gives some interesting information about unused | ||||
|  * functions in the code. Of course, this should never go uncommented on a | ||||
| @@ -115,6 +119,4 @@ | ||||
|  */ | ||||
| /*#define inline*/ | ||||
|  | ||||
|  | ||||
| #endif /* UPNPGLOBAL_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,38 +1,67 @@ | ||||
|  | ||||
|  | ||||
| #ifndef UPNPINET_H | ||||
| #define UPNPINET_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \addtogroup Sock | ||||
|  *  | ||||
|  * @{ | ||||
|  *  | ||||
|  * \file | ||||
|  * | ||||
|  * \brief Provides a platform independent way to include TCP/IP types and functions. | ||||
|  */ | ||||
|  | ||||
| #include "UpnpUniStd.h" /* for close() */ | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#include <iphlpapi.h> | ||||
| 	#include <stdarg.h> | ||||
| 	#ifndef UPNP_USE_MSVCPP | ||||
| 		/* Removed: not required (and cause compilation issues) */ | ||||
| 		#include <winbase.h> | ||||
| 		#include <windef.h> | ||||
| 	#endif | ||||
| 	#include <winsock2.h> | ||||
| 	#include <Ws2tcpip.h> | ||||
| 	#include <iphlpapi.h> | ||||
| 	#include <ws2tcpip.h> | ||||
|  | ||||
| 	#define UpnpCloseSocket closesocket | ||||
|  | ||||
| 	#if(_WIN32_WINNT < 0x0600) | ||||
| 		typedef short sa_family_t; | ||||
| 	#else | ||||
| 		typedef ADDRESS_FAMILY sa_family_t; | ||||
| 	#endif | ||||
|  | ||||
| #else /* WIN32 */ | ||||
| 	#include <sys/param.h> | ||||
| 	#if (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__) | ||||
| 	#if defined(__sun) | ||||
| 		#include <fcntl.h> | ||||
| 		#include <sys/sockio.h> | ||||
| 	#elif (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__) | ||||
| 		#include <ifaddrs.h> | ||||
| 		/* Do not move or remove the include below for "sys/socket"! | ||||
| 		 * Will break FreeBSD builds. */ | ||||
| 		#include <sys/socket.h> | ||||
| 	#endif | ||||
| 	#include <arpa/inet.h>  /* for inet_pton() */ | ||||
| 	#include <net/if.h> | ||||
| 	#include <netinet/in.h> | ||||
|  | ||||
| 	#include <unistd.h> /* for close(). Do not include in WIN32. */ | ||||
| 	#define SOCKET int | ||||
| 	#define INVALID_SOCKET ((SOCKET)(-1)) | ||||
| 	#define UpnpCloseSocket close | ||||
| #endif | ||||
| 	/*! This typedef makes the code slightly more WIN32 tolerant. | ||||
| 	 * On WIN32 systems, SOCKET is unsigned and is not a file | ||||
| 	 * descriptor. */ | ||||
| 	typedef int SOCKET; | ||||
|  | ||||
| 	/*! INVALID_SOCKET is unsigned on win32. */ | ||||
| 	#define INVALID_SOCKET (-1) | ||||
|  | ||||
| 	/*! select() returns SOCKET_ERROR on win32. */ | ||||
| 	#define SOCKET_ERROR (-1) | ||||
|  | ||||
| 	/*! Alias to close() to make code more WIN32 tolerant. */ | ||||
| 	#define UpnpCloseSocket close | ||||
| #endif /* WIN32 */ | ||||
|  | ||||
| /* @} Sock */ | ||||
|  | ||||
| #endif /* UPNPINET_H */ | ||||
|  | ||||
|   | ||||
							
								
								
									
										11
									
								
								upnp/inc/UpnpIntTypes.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								upnp/inc/UpnpIntTypes.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| #ifndef UPNPINTTYPES_H | ||||
| #define UPNPINTTYPES_H | ||||
|  | ||||
| #if !defined(UPNP_USE_BCBPP) | ||||
|  | ||||
| /* Printf format for integers. */ | ||||
| #include <inttypes.h> | ||||
|  | ||||
| #endif /* !defined(UPNP_USE_BCBPP) */ | ||||
|  | ||||
| #endif /* UPNPINTTYPES_H */ | ||||
							
								
								
									
										20
									
								
								upnp/inc/UpnpStdInt.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								upnp/inc/UpnpStdInt.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| #ifndef UPNPSTDINT_H | ||||
| #define UPNPSTDINT_H | ||||
|  | ||||
| #if !defined(UPNP_USE_BCBPP) | ||||
|  | ||||
| /* Sized integer types. */ | ||||
| #include <stdint.h> | ||||
|  | ||||
| #ifdef UPNP_USE_MSVCPP | ||||
| 	/* no ssize_t defined for VC */ | ||||
| 	#ifdef  _WIN64 | ||||
| 		typedef int64_t ssize_t; | ||||
| 	#else | ||||
| 		typedef int32_t ssize_t; | ||||
| 	#endif | ||||
| #endif | ||||
|  | ||||
| #endif /* !defined(UPNP_USE_BCBPP) */ | ||||
|  | ||||
| #endif /* UPNPSTDINT_H */ | ||||
| @@ -17,7 +17,7 @@ | ||||
|  * | ||||
|  * \file | ||||
|  * | ||||
|  * \brief UpnpString object declarartion. | ||||
|  * \brief UpnpString object declaration. | ||||
|  */ | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										10
									
								
								upnp/inc/UpnpUniStd.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								upnp/inc/UpnpUniStd.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #ifndef UPNPUNISTD_H | ||||
| #define UPNPUNISTD_H | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> on WIN32. */ | ||||
| #else /* WIN32 */ | ||||
| 	#include <unistd.h> /* for close() */ | ||||
| #endif /* WIN32 */ | ||||
|  | ||||
| #endif /* UPNPUNISTD_H */ | ||||
							
								
								
									
										284
									
								
								upnp/inc/upnp.h
									
									
									
									
									
								
							
							
						
						
									
										284
									
								
								upnp/inc/upnp.h
									
									
									
									
									
								
							| @@ -1,7 +1,11 @@ | ||||
| #ifndef UPNP_H | ||||
| #define UPNP_H | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * Copyright (C) 2011-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:  | ||||
| @@ -29,48 +33,36 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef UPNP_H | ||||
| #define UPNP_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * \defgroup UPnPAPI UPnP API | ||||
|  *  | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ixml.h" | ||||
| #include "upnpconfig.h" | ||||
| #include "UpnpGlobal.h" | ||||
| #include "UpnpInet.h" | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * \todo Document the exact reason of these include files and solve this | ||||
|  * include mess in an include file like UpnpTime.h | ||||
|  */ | ||||
| #ifdef WIN32 | ||||
| 	#include <time.h> | ||||
| 	#ifdef UPNP_USE_MSVCPP | ||||
| 		#include <sys/types.h>	/* needed for off_t */ | ||||
| 	#endif | ||||
| #elif (defined(BSD) && BSD >= 199306) | ||||
| 	#include <time.h> | ||||
| #else | ||||
| 	/* Other systems ??? */ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <sys/param.h> */ | ||||
| #else | ||||
| 	#include <sys/param.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define LINE_SIZE  180 | ||||
| #define NAME_SIZE  256 | ||||
| #define LINE_SIZE  (size_t)180 | ||||
| #define NAME_SIZE  (size_t)256 | ||||
| #define MNFT_NAME_SIZE  64 | ||||
| #define MODL_NAME_SIZE  32 | ||||
| #define SERL_NUMR_SIZE  64 | ||||
| @@ -79,7 +71,6 @@ | ||||
| #define UPNP_USING_CHUNKED	-3 | ||||
| #define UPNP_UNTIL_CLOSE	-4 | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Error codes  | ||||
|  * | ||||
| @@ -141,8 +132,9 @@ | ||||
| #define UPNP_E_BUFFER_TOO_SMALL		-106 | ||||
|  | ||||
| /*! | ||||
|  * \brief The description document passed to \b UpnpRegisterRootDevice or | ||||
|  * \b UpnpRegisterRootDevice2 is invalid. | ||||
|  * \brief The description document passed to \b UpnpRegisterRootDevice, | ||||
|  * \b UpnpRegisterRootDevice2 \b UpnpRegisterRootDevice3 or | ||||
|  * \b UpnpRegisterRootDevice4 is invalid. | ||||
|  */ | ||||
| #define UPNP_E_INVALID_DESC		-107 | ||||
|  | ||||
| @@ -388,19 +380,6 @@ | ||||
|  | ||||
| /* @} ErrorCodes */ | ||||
|  | ||||
| #ifndef OUT | ||||
| #define OUT | ||||
| #endif | ||||
|  | ||||
| #ifndef IN | ||||
| #define IN | ||||
| #endif | ||||
|  | ||||
| #ifndef INOUT | ||||
| #define INOUT | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if UPNP_VERSION >= 10800 | ||||
| /*  | ||||
|  * Opaque data structures. The following includes are data structures that | ||||
| @@ -423,7 +402,6 @@ | ||||
| #include "SubscriptionRequest.h" | ||||
| #endif /* UPNP_VERSION >= 10800 */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Constants and Types | ||||
|  * | ||||
| @@ -447,7 +425,8 @@ typedef int  UpnpClient_Handle; | ||||
|  | ||||
| /*! | ||||
|  * \brief Returned when a device application registers with | ||||
|  * \b UpnpRegisterRootDevice or \b UpnpRegisterRootDevice2. | ||||
|  * \b UpnpRegisterRootDevice, \b UpnpRegisterRootDevice2, | ||||
|  * \b UpnpRegisterRootDevice3 or \b UpnpRegisterRootDevice4. | ||||
|  * | ||||
|  * Device handles can only be used with functions that operate with a device | ||||
|  * handle. | ||||
| @@ -620,7 +599,6 @@ enum Upnp_DescType_e { | ||||
|  | ||||
| typedef enum Upnp_DescType_e Upnp_DescType; | ||||
|  | ||||
|  | ||||
| #if UPNP_VERSION < 10800 | ||||
| /** Returned as part of a {\bf UPNP_CONTROL_ACTION_COMPLETE} callback.  */ | ||||
|  | ||||
| @@ -778,7 +756,7 @@ struct Upnp_Discovery | ||||
| 	char Ext[LINE_SIZE];            | ||||
| 				      | ||||
| 	/** The host address of the device responding to the search. */ | ||||
| 	struct sockaddr_in DestAddr;  | ||||
| 	struct sockaddr_storage DestAddr; | ||||
| }; | ||||
|  | ||||
| /** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf | ||||
| @@ -821,7 +799,6 @@ struct Upnp_Subscription_Request | ||||
|  | ||||
| }; | ||||
|  | ||||
|  | ||||
| struct File_Info | ||||
| { | ||||
| 	/** The length of the file. A length less than 0 indicates the size  | ||||
| @@ -848,7 +825,6 @@ struct File_Info | ||||
| }; | ||||
| #endif /* UPNP_VERSION < 10800 */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  *  All callback functions share the same prototype, documented below. | ||||
|  *  Note that any memory passed to the callback function | ||||
| @@ -884,19 +860,16 @@ typedef int (*Upnp_FunPtr)( | ||||
|  | ||||
| /* @} Constants and Types */ | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Initialization and Registration | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes the Linux SDK for UPnP Devices (IPv4 only). | ||||
|  * | ||||
| @@ -938,7 +911,6 @@ EXPORT_SPEC int UpnpInit( | ||||
| 	 * \c NULL will pick an arbitrary free port. */ | ||||
| 	unsigned short DestPort); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6). | ||||
|  * | ||||
| @@ -982,7 +954,6 @@ EXPORT_SPEC int UpnpInit2( | ||||
| 	unsigned short DestPort); | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Terminates the Linux SDK for UPnP Devices. | ||||
|  * | ||||
| @@ -1004,7 +975,6 @@ EXPORT_SPEC int UpnpInit2( | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpFinish(void); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the internal server IPv4 UPnP listening port. | ||||
|  * | ||||
| @@ -1018,7 +988,6 @@ EXPORT_SPEC int UpnpFinish(void); | ||||
|  */ | ||||
| EXPORT_SPEC unsigned short UpnpGetServerPort(void); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the internal server IPv6 UPnP listening port. | ||||
|  * | ||||
| @@ -1046,7 +1015,6 @@ EXPORT_SPEC unsigned short UpnpGetServerPort6(void); | ||||
|  */ | ||||
| EXPORT_SPEC char *UpnpGetServerIpAddress(void); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the local IPv6 listening ip address. | ||||
|  * | ||||
| @@ -1198,7 +1166,6 @@ EXPORT_SPEC int UpnpRegisterRootDevice2( | ||||
| 	/*! [out] Pointer to a variable to store the new device handle. */ | ||||
| 	UpnpDevice_Handle* Hnd); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Registers a device application for a specific address family with | ||||
|  * the UPnP library. | ||||
| @@ -1246,12 +1213,65 @@ EXPORT_SPEC int UpnpRegisterRootDevice3( | ||||
| 	UpnpDevice_Handle *Hnd, | ||||
| 	/*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or | ||||
| 	 * AF_INET6 for an IPv6 device. Defaults to AF_INET. */ | ||||
| 	const int  AddressFamily); | ||||
|  | ||||
| 	int  AddressFamily); | ||||
|  | ||||
| /*! | ||||
|  * \brief Unregisters a root device registered with \b UpnpRegisterRootDevice or | ||||
|  * \b UpnpRegisterRootDevice2. | ||||
|  * \brief Registers a device application for a specific address family with | ||||
|  * the UPnP library. This function can also be used to specify a dedicated | ||||
|  * description URL to be returned for legacy CPs. | ||||
|  * | ||||
|  * A device application cannot make any other API calls until it registers | ||||
|  * using this function. Device applications can also register as control | ||||
|  * points (see \b UpnpRegisterClient to get a control point handle to perform | ||||
|  * control point functionality). | ||||
|  * | ||||
|  * This is synchronous and does not generate any callbacks. Callbacks can occur | ||||
|  * as soon as this function returns. | ||||
|  * | ||||
|  * \return An integer representing one of the following: | ||||
|  *     \li \c UPNP_E_SUCCESS: The operation completed successfully. | ||||
|  *     \li \c UPNP_E_FINISH: The SDK is already terminated or | ||||
|  *                                is not initialized. | ||||
|  *     \li \c UPNP_E_INVALID_DESC: The description document was not | ||||
|  *             a valid device description. | ||||
|  *     \li \c UPNP_E_INVALID_URL: The URL for the description document | ||||
|  *             is not valid. | ||||
|  *     \li \c UPNP_E_INVALID_PARAM: Either \b Callback or \b Hnd | ||||
|  *             is not a valid pointer or \b DescURL is \c NULL. | ||||
|  *     \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 the | ||||
|  *             socket. | ||||
|  *     \li \c UPNP_E_OUTOF_SOCKET: Too many sockets are currently | ||||
|  *             allocated. | ||||
|  *     \li \c UPNP_E_OUTOF_MEMORY: There are insufficient resources to | ||||
|  *             register this root device. | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpRegisterRootDevice4( | ||||
| 	/*! [in] Pointer to a string containing the description URL for this root | ||||
| 	 * device instance. */ | ||||
| 	const char *DescUrl, | ||||
| 	/*! [in] Pointer to the callback function for receiving asynchronous events. */ | ||||
| 	Upnp_FunPtr Callback, | ||||
| 	/*! [in] Pointer to user data returned with the callback function when invoked. */ | ||||
| 	const void *Cookie, | ||||
| 	/*! [out] Pointer to a variable to store the new device handle. */ | ||||
| 	UpnpDevice_Handle *Hnd, | ||||
| 	/*! [in] Address family of this device. Can be AF_INET for an IPv4 device, or | ||||
| 	 * AF_INET6 for an IPv6 device. Defaults to AF_INET. */ | ||||
| 	int  AddressFamily, | ||||
| 	/*! [in] Pointer to a string containing the description URL to be returned for | ||||
| 	 * legacy CPs for this root device instance. */ | ||||
| 	const char *LowerDescUrl); | ||||
|  | ||||
| /*! | ||||
|  * \brief Unregisters a root device registered with \b UpnpRegisterRootDevice, | ||||
|  * \b UpnpRegisterRootDevice2, \b UpnpRegisterRootDevice3 or | ||||
|  * \b UpnpRegisterRootDevice4. | ||||
|  * | ||||
|  * After this call, the \b UpnpDevice_Handle is no longer valid. For all | ||||
|  * advertisements that have not yet expired, the SDK sends a device unavailable | ||||
| @@ -1268,6 +1288,34 @@ EXPORT_SPEC int UpnpUnRegisterRootDevice( | ||||
| 	/*! [in] The handle of the root device instance to unregister. */ | ||||
| 	UpnpDevice_Handle Hnd); | ||||
|  | ||||
| /*! | ||||
|  * \brief Unregisters a root device registered with \b UpnpRegisterRootDevice, | ||||
|  * \b UpnpRegisterRootDevice2, \b UpnpRegisterRootDevice3 or | ||||
|  * \b UpnpRegisterRootDevice4. | ||||
|  * | ||||
|  * After this call, the \b UpnpDevice_Handle is no longer valid. For all | ||||
|  * advertisements that have not yet expired, the SDK sends a device unavailable | ||||
|  * message automatically. | ||||
|  * | ||||
|  * This is a synchronous call and generates no callbacks. Once this call | ||||
|  * returns, the SDK will no longer generate callbacks to the application. | ||||
|  * | ||||
|  * This function allow a device to specify the SSDP extensions defined by UPnP | ||||
|  * Low Power. | ||||
|  * | ||||
|  * \return An integer representing one of the following: | ||||
|  *     \li \c UPNP_E_SUCCESS: The operation completed successfully. | ||||
|  *     \li \c UPNP_E_INVALID_HANDLE: The handle is not a valid device handle. | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpUnRegisterRootDeviceLowPower( | ||||
|         /*! [in] The handle of the root device instance to unregister. */ | ||||
|         UpnpDevice_Handle Hnd, | ||||
|         /*! PowerState as defined by UPnP Low Power. */ | ||||
|         int PowerState, | ||||
|         /*! SleepPeriod as defined by UPnP Low Power. */ | ||||
|         int SleepPeriod, | ||||
|         /*! RegistrationState as defined by UPnP Low Power. */ | ||||
|         int RegistrationState); | ||||
|  | ||||
| /*! | ||||
|  * \brief Registers a control point application with the UPnP Library. | ||||
| @@ -1295,7 +1343,6 @@ EXPORT_SPEC int UpnpRegisterClient( | ||||
| 	/*! [out] Pointer to a variable to store the new control point handle. */ | ||||
| 	UpnpClient_Handle *Hnd); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Unregisters a control point application, unsubscribing all active | ||||
|  * subscriptions. | ||||
| @@ -1316,7 +1363,6 @@ EXPORT_SPEC int UpnpUnRegisterClient( | ||||
| 	/*! [in] The handle of the control point instance to unregister. */ | ||||
| 	UpnpClient_Handle Hnd); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \deprecated Use \b UpnpSetMaxContentLength instead. | ||||
|  * | ||||
| @@ -1328,8 +1374,7 @@ EXPORT_SPEC int UpnpSetContentLength( | ||||
| 	 * length needs to be set. */ | ||||
| 	UpnpClient_Handle Hnd, | ||||
| 	/*! [in] Permissible content length */ | ||||
| 	int contentLength); | ||||
|  | ||||
| 	size_t contentLength); | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the maximum content-length that the SDK will process on an | ||||
| @@ -1352,10 +1397,8 @@ EXPORT_SPEC int UpnpSetMaxContentLength( | ||||
| 	 * in bytes. */ | ||||
| 	size_t contentLength); | ||||
|  | ||||
|  | ||||
| /* @} Initialization and Registration */ | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  ****************************************************************************** | ||||
|  *                                                                            * | ||||
| @@ -1364,14 +1407,12 @@ EXPORT_SPEC int UpnpSetMaxContentLength( | ||||
|  ****************************************************************************** | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Discovery | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Searches for devices matching the given search target. | ||||
|  * | ||||
| @@ -1430,10 +1471,38 @@ EXPORT_SPEC int UpnpSendAdvertisement( | ||||
| 	/*! The expiration age, in seconds, of the announcements. */ | ||||
| 	int Exp); | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends out the discovery announcements for all devices and services | ||||
|  * for a device. | ||||
|  * | ||||
|  * Each announcement is made with the same expiration time. | ||||
|  * | ||||
|  * This is a synchronous call. | ||||
|  * | ||||
|  * This function allow a device to specify the SSDP extensions defined by UPnP | ||||
|  * Low Power. | ||||
|  * | ||||
|  * \return An integer representing one of the following: | ||||
|  *     \li \c UPNP_E_SUCCESS: The operation completed successfully. | ||||
|  *     \li \c UPNP_E_INVALID_HANDLE: The handle is not a valid | ||||
|  *             device handle. | ||||
|  *     \li \c UPNP_E_OUTOF_MEMORY: There are insufficient resources to | ||||
|  *             send future advertisements. | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpSendAdvertisementLowPower( | ||||
|         /*! The device handle for which to send out the announcements. */ | ||||
|         UpnpDevice_Handle Hnd, | ||||
|         /*! The expiration age, in seconds, of the announcements. */ | ||||
|         int Exp, | ||||
|         /*! PowerState as defined by UPnP Low Power. */ | ||||
|         int PowerState, | ||||
|         /*! SleepPeriod as defined by UPnP Low Power. */ | ||||
|         int SleepPeriod, | ||||
|         /*! RegistrationState as defined by UPnP Low Power. */ | ||||
|         int RegistrationState); | ||||
|  | ||||
| /* @} Discovery */ | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  ****************************************************************************** | ||||
|  *                                                                            * | ||||
| @@ -1442,14 +1511,12 @@ EXPORT_SPEC int UpnpSendAdvertisement( | ||||
|  ****************************************************************************** | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Control | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Queries the state of a state variable of a service on another device. | ||||
|  * | ||||
| @@ -1487,7 +1554,6 @@ EXPORT_SPEC int UpnpGetServiceVarStatus( | ||||
| 	 * \b ixmlFreeDOMString. */ | ||||
| 	DOMString *StVarVal); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Queries the state of a variable of a service, generating a callback | ||||
|  * when the operation is complete. | ||||
| @@ -1518,7 +1584,6 @@ EXPORT_SPEC int UpnpGetServiceVarStatusAsync( | ||||
| 	/*! [in] Pointer to user data to pass to the callback function when invoked. */ | ||||
| 	const void *Cookie); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends a message to change a state variable in a service. | ||||
|  * | ||||
| @@ -1557,7 +1622,6 @@ EXPORT_SPEC int UpnpSendAction( | ||||
| 	 * this document and the caller needs to free it. */ | ||||
| 	IXML_Document **RespNode); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends a message to change a state variable in a service. | ||||
|  * | ||||
| @@ -1599,7 +1663,6 @@ EXPORT_SPEC int UpnpSendActionEx( | ||||
| 	 * this document and the caller needs to free it. */ | ||||
| 	IXML_Document **RespNode); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends a message to change a state variable in a service, generating a | ||||
|  * callback when the operation is complete. | ||||
| @@ -1639,7 +1702,6 @@ EXPORT_SPEC int UpnpSendActionAsync( | ||||
| 	 * invoked. */ | ||||
| 	const void *Cookie); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends a message to change a state variable in a service, generating a | ||||
|  * callback when the operation is complete. | ||||
| @@ -1682,10 +1744,8 @@ EXPORT_SPEC int UpnpSendActionExAsync( | ||||
| 	 * invoked. */ | ||||
| 	const void *Cookie); | ||||
|  | ||||
|  | ||||
| /*! @} Control */ | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  ****************************************************************************** | ||||
|  *                                                                            * | ||||
| @@ -1694,14 +1754,12 @@ EXPORT_SPEC int UpnpSendActionExAsync( | ||||
|  ****************************************************************************** | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Eventing | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Accepts a subscription request and sends out the current state of the | ||||
|  * eventable variables for a service. | ||||
| @@ -1743,7 +1801,6 @@ EXPORT_SPEC int UpnpAcceptSubscription( | ||||
| 	/*! [in] The subscription ID of the newly registered control point. */ | ||||
| 	const Upnp_SID SubsId); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Similar to \b UpnpAcceptSubscription() except that it takes a DOM | ||||
|  * document for the variables to event rather than an array of strings. | ||||
| @@ -1780,7 +1837,6 @@ EXPORT_SPEC int UpnpAcceptSubscriptionExt( | ||||
| 	/*! [in] The subscription ID of the newly registered control point. */ | ||||
| 	Upnp_SID SubsId); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends out an event change notification to all control points | ||||
|  * subscribed to a particular service. | ||||
| @@ -1816,7 +1872,6 @@ EXPORT_SPEC int UpnpNotify( | ||||
| 	/*! [in] The count of variables included in this notification. */ | ||||
| 	int cVariables); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Similar to \b UpnpNotify except that it takes a DOM document for the | ||||
|  * event rather than an array of strings. | ||||
| @@ -1850,7 +1905,6 @@ EXPORT_SPEC int UpnpNotifyExt( | ||||
| 	 * Plug and Play Device Architecture specification. */ | ||||
| 	IXML_Document *PropSet); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Renews a subscription that is about to expire. | ||||
|  * | ||||
| @@ -1888,7 +1942,6 @@ EXPORT_SPEC int UpnpRenewSubscription( | ||||
| 	/*! [in] The ID for the subscription to renew. */ | ||||
| 	const Upnp_SID SubsId); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Renews a subscription that is about to expire, generating a callback | ||||
|  * when the operation is complete. | ||||
| @@ -1950,7 +2003,6 @@ EXPORT_SPEC int UpnpRenewSubscriptionAsync( | ||||
| 	/*! [in] Pointer to user data passed to the callback function when invoked. */ | ||||
| 	const void *Cookie); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the maximum number of subscriptions accepted per service. | ||||
|  * | ||||
| @@ -1971,7 +2023,6 @@ EXPORT_SPEC int UpnpSetMaxSubscriptions( | ||||
| 	/*! The maximum number of subscriptions to be allowed per service. */ | ||||
| 	int MaxSubscriptions); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the maximum time-out accepted for a subscription request or | ||||
|  * renewal. | ||||
| @@ -1993,7 +2044,6 @@ EXPORT_SPEC int UpnpSetMaxSubscriptionTimeOut( | ||||
| 	/*! The maximum subscription time-out to be accepted. */ | ||||
| 	int MaxSubscriptionTimeOut); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Registers a control point to receive event notifications from another | ||||
|  * device. | ||||
| @@ -2035,7 +2085,6 @@ EXPORT_SPEC int UpnpSubscribe( | ||||
| 	/*! [out] Pointer to a variable to receive the subscription ID (SID). */ | ||||
| 	Upnp_SID SubsId); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Performs the same operation as \b UpnpSubscribe, but returns | ||||
|  * immediately and calls the registered callback function when the operation | ||||
| @@ -2097,7 +2146,6 @@ EXPORT_SPEC int UpnpSubscribeAsync( | ||||
| 	/*! A user data value passed to the callback function when invoked. */ | ||||
| 	const void *Cookie); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Removes the subscription of a control point from a service previously | ||||
|  * subscribed to using \b UpnpSubscribe or \b UpnpSubscribeAsync. | ||||
| @@ -2133,7 +2181,6 @@ EXPORT_SPEC int UpnpUnSubscribe( | ||||
| 	/*! [in] The ID returned when the control point subscribed to the service. */ | ||||
| 	const Upnp_SID SubsId); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Removes a subscription of a control point from a service previously | ||||
|  * subscribed to using \b UpnpSubscribe or \b UpnpSubscribeAsync, generating | ||||
| @@ -2191,11 +2238,9 @@ EXPORT_SPEC int UpnpUnSubscribeAsync( | ||||
| 	/*! [in] Pointer to user data to pass to the callback function when invoked. */ | ||||
| 	const void *Cookie); | ||||
|  | ||||
|  | ||||
| /*! @} Eventing */ | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  ****************************************************************************** | ||||
|  *                                                                            * | ||||
| @@ -2245,7 +2290,6 @@ EXPORT_SPEC int UpnpDownloadUrlItem( | ||||
| 	 * \c LINE_SIZE bytes in size. */ | ||||
| 	char *contentType); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Gets a file specified in a URL. | ||||
|  * | ||||
| @@ -2290,7 +2334,6 @@ EXPORT_SPEC int UpnpOpenHttpGet( | ||||
| 	 * back to the user. */		  | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Gets a file specified in a URL through the specified proxy. | ||||
|  * | ||||
| @@ -2337,7 +2380,6 @@ EXPORT_SPEC int UpnpOpenHttpGetProxy( | ||||
| 	 * back to the user. */		  | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Gets specified number of bytes from a file specified in the URL. | ||||
|  * | ||||
| @@ -2388,7 +2430,6 @@ EXPORT_SPEC int UpnpOpenHttpGetEx( | ||||
| 	 * to the user. */	 | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Gets specified number of bytes from a file specified in a URL.  | ||||
|  * | ||||
| @@ -2412,13 +2453,12 @@ EXPORT_SPEC int UpnpReadHttpGet( | ||||
| 	/*! [in,out] The buffer to store the read item. */ | ||||
| 	char *buf, | ||||
| 	/*! [in,out] The size of the buffer to be read. */ | ||||
| 	unsigned int *size, | ||||
| 	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. */ | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Retrieve progress information of a http-get transfer.  | ||||
|  * | ||||
| @@ -2431,10 +2471,9 @@ EXPORT_SPEC int UpnpHttpGetProgress( | ||||
| 	/*! [in] The token created by the call to \b UpnpOpenHttpGet. */ | ||||
| 	void *handle, | ||||
| 	/*! [out] The number of bytes received. */ | ||||
| 	unsigned int *length, | ||||
| 	size_t *length, | ||||
| 	/*! [out] The content length. */ | ||||
| 	unsigned int *total); | ||||
|  | ||||
| 	size_t *total); | ||||
|  | ||||
| /*! | ||||
|  * \brief Set the cancel flag of the \b handle parameter.  | ||||
| @@ -2461,7 +2500,6 @@ EXPORT_SPEC int UpnpCloseHttpGet( | ||||
| 	 * \b UpnpOpenHttpGet. */ | ||||
| 	void *handle); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Makes an HTTP POST request message, opens a connection to the server | ||||
|  * and sends the POST request to the server if the connection to the server | ||||
| @@ -2501,7 +2539,6 @@ EXPORT_SPEC int UpnpOpenHttpPost( | ||||
| 	 * is expected from the receiver, failing which, an error is reported. */ | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends a request to a server to copy the contents of a buffer to the | ||||
|  * URI specified in the \b UpnpOpenHttpPost call. | ||||
| @@ -2522,12 +2559,11 @@ EXPORT_SPEC int UpnpWriteHttpPost( | ||||
| 	/*! [in] The buffer to be posted. */ | ||||
| 	char *buf, | ||||
| 	/*! [in] The size, in bytes of \b buf. */ | ||||
| 	unsigned int *size, | ||||
| 	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. */		  | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends and receives any pending data, closes the connection with the | ||||
|  * server, and frees memory allocated during the \b UpnpOpenHttpPost call. | ||||
| @@ -2551,7 +2587,6 @@ EXPORT_SPEC int UpnpCloseHttpPost( | ||||
| 	 * expected from the server, failing which, an error is reported. */		  | ||||
| 	int timeout); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Downloads an XML document specified in a URL. | ||||
|  * | ||||
| @@ -2585,7 +2620,6 @@ EXPORT_SPEC int UpnpDownloadXmlDoc( | ||||
| 	/*! [out] A pointer in which to store the XML document. */ | ||||
| 	IXML_Document **xmlDoc); | ||||
|  | ||||
|  | ||||
| /*! @} Control Point HTTP API */ | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -2622,13 +2656,11 @@ EXPORT_SPEC int UpnpSetWebServerRootDir( | ||||
| 	/*! [in] Path of the root directory of the web server. */ | ||||
| 	const char *rootDir); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief The type of handle returned by the web server for open requests. | ||||
|  */ | ||||
| typedef void *UpnpWebFileHandle; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Get-info callback function prototype. | ||||
|  */ | ||||
| @@ -2643,7 +2675,6 @@ typedef int (*VDCallback_GetInfo)( | ||||
| #endif /* UPNP_VERSION < 10800 */ | ||||
| 		); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the get_info callback function to be used to access a virtual | ||||
|  * directory. | ||||
| @@ -2654,7 +2685,6 @@ typedef int (*VDCallback_GetInfo)( | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Open callback function prototype. | ||||
|  */ | ||||
| @@ -2665,7 +2695,6 @@ typedef UpnpWebFileHandle (*VDCallback_Open)( | ||||
| 		 * Valid values are \c UPNP_READ or \c UPNP_WRITE. */ | ||||
| 		enum UpnpOpenFileMode Mode); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the open callback function to be used to access a virtual | ||||
|  * directory. | ||||
| @@ -2676,7 +2705,6 @@ typedef UpnpWebFileHandle (*VDCallback_Open)( | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Read callback function prototype. | ||||
|  */ | ||||
| @@ -2688,7 +2716,6 @@ typedef int (*VDCallback_Read)( | ||||
| 	/*! [in] The size of the buffer (i.e. the number of bytes to read). */ | ||||
| 	size_t buflen); | ||||
|  | ||||
|  | ||||
| /*!  | ||||
|  * \brief Sets the read callback function to be used to access a virtual | ||||
|  * directory. | ||||
| @@ -2699,7 +2726,6 @@ typedef int (*VDCallback_Read)( | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Write callback function prototype. | ||||
|  */ | ||||
| @@ -2711,7 +2737,6 @@ typedef	int (*VDCallback_Write)( | ||||
| 	/*! [in] The number of bytes to write. */ | ||||
| 	size_t buflen); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the write callback function to be used to access a virtual | ||||
|  * directory. | ||||
| @@ -2722,7 +2747,6 @@ typedef	int (*VDCallback_Write)( | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Seek callback function prototype. | ||||
|  */ | ||||
| @@ -2739,7 +2763,6 @@ typedef int (*VDCallback_Seek) ( | ||||
| 	 * specify an absolute offset. */ | ||||
| 	int origin); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the seek callback function to be used to access a virtual | ||||
|  * directory. | ||||
| @@ -2750,7 +2773,6 @@ typedef int (*VDCallback_Seek) ( | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Close callback function prototype. | ||||
|  */ | ||||
| @@ -2758,7 +2780,6 @@ typedef int (*VDCallback_Close)( | ||||
| 		/*! [in] The handle of the file to close. */ | ||||
| 		UpnpWebFileHandle fileHnd); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the close callback function to be used to access a virtual | ||||
|  * directory. | ||||
| @@ -2769,6 +2790,20 @@ 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. | ||||
| @@ -2781,7 +2816,6 @@ EXPORT_SPEC int UpnpEnableWebserver( | ||||
| 	/*! [in] \c TRUE to enable, \c FALSE to disable. */ | ||||
| 	int enable); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns \c TRUE if the webserver is enabled, or \c FALSE if it is not. | ||||
|  * | ||||
| @@ -2791,6 +2825,16 @@ 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. | ||||
| @@ -2810,7 +2854,6 @@ EXPORT_SPEC int UpnpAddVirtualDir( | ||||
| 	/*! [in] The name of the new directory mapping to add. */ | ||||
| 	const char *dirName); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Removes a virtual directory mapping made with \b UpnpAddVirtualDir. | ||||
|  * | ||||
| @@ -2822,24 +2865,17 @@ EXPORT_SPEC int UpnpRemoveVirtualDir( | ||||
| 	/*! [in] The name of the virtual directory mapping to remove. */ | ||||
| 	const char *dirName); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Removes all virtual directory mappings. | ||||
|  */ | ||||
| EXPORT_SPEC void UpnpRemoveAllVirtualDirs(void); | ||||
|  | ||||
|  | ||||
| /* @} Web Server API */ | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| /* @} UPnPAPI UPnP API */ | ||||
|  | ||||
|  | ||||
| #endif /* UPNP_H */ | ||||
|  | ||||
|   | ||||
| @@ -56,6 +56,19 @@ | ||||
|  | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Large file support | ||||
|  ***************************************************************************/ | ||||
|  | ||||
| /** File Offset size */ | ||||
| #undef _FILE_OFFSET_BITS | ||||
|  | ||||
| /** Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ | ||||
| #undef _LARGEFILE_SOURCE | ||||
|  | ||||
| /** Large files support */ | ||||
| #undef _LARGE_FILE_SOURCE | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Library optional features | ||||
|  ***************************************************************************/ | ||||
| @@ -86,6 +99,26 @@ | ||||
| #undef UPNP_HAVE_WEBSERVER | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with the SSDP part enabled | ||||
|  *  (i.e. configure --enable-ssdp) */ | ||||
| #undef UPNP_HAVE_SSDP | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with optional SSDP headers | ||||
|  *  support (i.e. configure --enable-optssdp) */ | ||||
| #undef UPNP_HAVE_OPTSSDP | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with the SOAP part enabled | ||||
|  *  (i.e. configure --enable-soap) */ | ||||
| #undef UPNP_HAVE_SOAP | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with the GENA part enabled | ||||
|  *  (i.e. configure --enable-gena) */ | ||||
| #undef UPNP_HAVE_GENA | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with helper API | ||||
|  *  (i.e. configure --enable-tools) : <upnp/upnptools.h> file is available */ | ||||
| #undef UPNP_HAVE_TOOLS | ||||
| @@ -94,5 +127,9 @@ | ||||
|  *  (i.e. configure --enable-ipv6) */ | ||||
| #undef UPNP_ENABLE_IPV6 | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with unspecified SERVER | ||||
|  * header (i.e. configure --enable-unspecified_server) */ | ||||
| #undef UPNP_ENABLE_UNSPECIFIED_SERVER | ||||
|  | ||||
| #endif /* UPNP_CONFIG_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation | ||||
|  * Copyright (c) 2006 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net> | ||||
|  * Copyright (c) 2006 Rémi Turboult <r3mi@users.sourceforge.net> | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
| @@ -33,32 +33,27 @@ | ||||
| #ifndef UPNP_DEBUG_H | ||||
| #define UPNP_DEBUG_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ThreadPool.h" | ||||
| #include "upnpconfig.h" | ||||
| #include "UpnpGlobal.h"		/* for UPNP_INLINE */ | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /** \name Other debugging features | ||||
| /*! \name Other debugging features | ||||
|  * | ||||
|  * The UPnP SDK contains other features to aid in debugging. | ||||
|  */ | ||||
| /*@{*/ | ||||
|  | ||||
| /** \name Upnp_LogLevel | ||||
| /*! \name Upnp_LogLevel | ||||
|  *  The user has the option to select 4 different types of debugging levels, | ||||
|  *  see \c UpnpSetLogLevel.  | ||||
|  *  The critical level will show only those messages  | ||||
| @@ -85,7 +80,6 @@ typedef enum Upnp_Module { | ||||
| 	HTTP | ||||
| } Dbg_Module; | ||||
|  | ||||
|  | ||||
| /*@{*/ | ||||
| typedef enum Upnp_LogLevel_e { | ||||
| 	UPNP_CRITICAL, | ||||
| @@ -95,14 +89,11 @@ typedef enum Upnp_LogLevel_e { | ||||
| } Upnp_LogLevel; | ||||
| /*@}*/ | ||||
|  | ||||
|  | ||||
| /** | ||||
| /*! | ||||
|  * Default log level : see \c Upnp_LogLevel | ||||
|  */ | ||||
| #define UPNP_DEFAULT_LOG_LEVEL	UPNP_ALL | ||||
|  | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Initialize the log files. | ||||
|  * | ||||
| @@ -116,8 +107,6 @@ static UPNP_INLINE int UpnpInitLog(void) | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Set the log level (see \c Upnp_LogLevel). | ||||
|  */ | ||||
| @@ -126,20 +115,24 @@ void UpnpSetLogLevel( | ||||
| 	/*! [in] Log level. */ | ||||
| 	Upnp_LogLevel log_level); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {} | ||||
| static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) | ||||
| { | ||||
| 	return; | ||||
| 	log_level = log_level; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Closes the log files. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpCloseLog(void); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpCloseLog(void) {} | ||||
| static UPNP_INLINE void UpnpCloseLog(void) | ||||
| { | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Set the name for error and information files, respectively. | ||||
|  */ | ||||
| @@ -150,12 +143,15 @@ void UpnpSetLogFileNames( | ||||
| 	/*! [in] Name of the information file. */ | ||||
| 	const char *InfoFileName); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpSetLogFileNames( | ||||
| 	const char *ErrFileName, | ||||
| 	const char *InfoFileName) {} | ||||
| static UPNP_INLINE void UpnpSetLogFileNames(const char *ErrFileName, | ||||
| 	const char *InfoFileName) | ||||
| { | ||||
| 	return; | ||||
| 	ErrFileName = ErrFileName; | ||||
| 	InfoFileName = InfoFileName; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Check if the module is turned on for debug and returns the file | ||||
|  * descriptor corresponding to the debug level | ||||
| @@ -174,10 +170,11 @@ FILE *UpnpGetDebugFile( | ||||
| static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module) | ||||
| { | ||||
| 	return NULL; | ||||
| 	level = level; | ||||
| 	module = module; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns true if debug output should be done in this module. | ||||
|  * | ||||
| @@ -191,15 +188,14 @@ int DebugAtThisLevel( | ||||
| 	/*! [in] Debug will go in the name of this module. */ | ||||
| 	Dbg_Module Module); | ||||
| #else | ||||
| static UPNP_INLINE int DebugAtThisLevel( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	Dbg_Module Module) | ||||
| static UPNP_INLINE int DebugAtThisLevel(Upnp_LogLevel DLevel, Dbg_Module Module) | ||||
| { | ||||
| 	return 0; | ||||
| 	DLevel = DLevel; | ||||
| 	Module = Module; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Prints the debug statement either on the standard output or log file | ||||
|  * along with the information from where this debug statement is coming. | ||||
| @@ -217,47 +213,51 @@ void UpnpPrintf( | ||||
| 	int DbgLineNo, | ||||
| 	/*! [in] Printf like format specification. */ | ||||
| 	const char *FmtStr, | ||||
| 	/*! [in] Printf like Variable number of arguments that will go in the debug | ||||
| 	 * statement. */ | ||||
| 	/*! [in] Printf like Variable number of arguments that will go in the | ||||
| 	 * debug statement. */ | ||||
| 	...) | ||||
| #if (__GNUC__ >= 3) | ||||
| 	/* This enables printf like format checking by the compiler */ | ||||
| 	/* This enables printf like format checking by the compiler. */ | ||||
| 	__attribute__ ((format(__printf__, 5, 6))) | ||||
| #endif | ||||
| 	; | ||||
| #else /* DEBUG */ | ||||
| static UPNP_INLINE void UpnpPrintf( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	Dbg_Module Module, | ||||
| 	const char* DbgFileName, | ||||
| 	int DbgLineNo, | ||||
| 	const char* FmtStr, | ||||
| 	...) | ||||
| static UPNP_INLINE void UpnpPrintf(Upnp_LogLevel DLevel, Dbg_Module Module, | ||||
| 	const char *DbgFileName, int DbgLineNo, const char *FmtStr, ...) | ||||
| { | ||||
| 	return; | ||||
| 	DLevel = DLevel; | ||||
| 	Module = Module; | ||||
| 	DbgFileName = DbgFileName; | ||||
| 	DbgLineNo = DbgLineNo; | ||||
| 	FmtStr = FmtStr; | ||||
| } | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Writes the file name and file number from where debug statement is | ||||
|  * coming to the log file. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpDisplayFileAndLine( | ||||
| 	/*! [in] File descriptor where line number and file name will be written. */ | ||||
| 	/*! [in] File descriptor where line number and file name will be | ||||
| 	 * written. */ | ||||
| 	FILE * fd, | ||||
| 	/*! [in] Name of the file. */ | ||||
| 	const char *DbgFileName, | ||||
| 	/*! [in] Line number of the file. */ | ||||
| 	int DbgLineNo); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpDisplayFileAndLine( | ||||
| 	FILE *fd, | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo) {} | ||||
| static UPNP_INLINE void UpnpDisplayFileAndLine(FILE *fd, | ||||
| 	const char *DbgFileName, int DbgLineNo) | ||||
| { | ||||
| 	return; | ||||
| 	fd = fd; | ||||
| 	DbgFileName = DbgFileName; | ||||
| 	DbgLineNo = DbgLineNo; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Writes the buffer in the file as per the requested banner | ||||
|  */ | ||||
| @@ -270,40 +270,19 @@ void UpnpDisplayBanner( | ||||
| 	/*! [in] Size of the buffer. */ | ||||
| 	size_t size, | ||||
| 	/*! [in] This parameter provides the width of the banner. */ | ||||
| 	int starlength); | ||||
| 	size_t starlength); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpDisplayBanner( | ||||
| 	FILE *fd, | ||||
| 	const char **lines, | ||||
| 	size_t size, | ||||
| 	int starlength) {} | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Prints thread pool statistics. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void PrintThreadPoolStats( | ||||
| 	/*! [in] The thread pool. */ | ||||
| 	ThreadPool *tp,  | ||||
| 	/*! [in] The file name that called this function, use the macro __FILE__. */ | ||||
| 	const char *DbgFileName, | ||||
| 	/*! [in] The line number that the function was called, use the macro __LINE__. */ | ||||
| 	int DbgLineNo, | ||||
| 	/*! [in] The message. */ | ||||
| 	const char *msg); | ||||
| #else | ||||
| static UPNP_INLINE void PrintThreadPoolStats( | ||||
| 	ThreadPool *tp,  | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo, | ||||
| 	const char *msg) | ||||
| static UPNP_INLINE void UpnpDisplayBanner(FILE *fd, const char **lines, | ||||
| 	size_t size, int starlength) | ||||
| { | ||||
| 	return; | ||||
| 	fd = fd; | ||||
| 	lines = lines; | ||||
| 	size = size; | ||||
| 	starlength = starlength; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*@}*/ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| @@ -311,4 +290,3 @@ static UPNP_INLINE void PrintThreadPoolStats( | ||||
| #endif | ||||
|  | ||||
| #endif /* UPNP_DEBUG_H */ | ||||
|  | ||||
|   | ||||
| @@ -50,6 +50,7 @@ | ||||
|  | ||||
|  | ||||
| #include "ixml.h" /* for IXML_Document */ | ||||
| #include "upnpconfig.h"	/* for UPNP_HAVE_TOOLS */ | ||||
|  | ||||
|  | ||||
| /* Function declarations only if tools compiled into the library */ | ||||
| @@ -96,6 +97,30 @@ EXPORT_SPEC int UpnpResolveURL( | ||||
| 	char *AbsURL); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Combines a base URL and a relative URL into a single absolute URL. | ||||
|  * | ||||
|  * The memory for \b AbsURL becomes owned by the caller and should be freed | ||||
|  * later. | ||||
|  * | ||||
|  * \return An integer representing one of the following: | ||||
|  *	\li <tt>UPNP_E_SUCCESS</tt>: The operation completed successfully. | ||||
|  *	\li <tt>UPNP_E_INVALID_PARAM</tt>: \b RelURL is <tt>NULL</tt>. | ||||
|  *	\li <tt>UPNP_E_INVALID_URL</tt>: The \b BaseURL / \b RelURL  | ||||
|  *              combination does not form a valid URL. | ||||
|  *	\li <tt>UPNP_E_OUTOF_MEMORY</tt>: Insufficient resources exist to  | ||||
|  *              complete this operation. | ||||
|  */ | ||||
| EXPORT_SPEC int UpnpResolveURL2( | ||||
| 	/*! [in] The base URL to combine. */ | ||||
| 	const char *BaseURL, | ||||
| 	/*! [in] The relative URL to \b BaseURL. */ | ||||
| 	const char *RelURL, | ||||
| 	/*! [out] A pointer to a pointer to a buffer to store the | ||||
| 	 * absolute URL. Must be freed later by the caller. */ | ||||
| 	char **AbsURL); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Creates an action request packet based on its input parameters | ||||
|  * (status variable name and value pair). | ||||
|   | ||||
| @@ -14,67 +14,62 @@ LDADD = \ | ||||
| 	$(top_builddir)/threadutil/libthreadutil.la \ | ||||
| 	$(top_builddir)/ixml/libixml.la | ||||
|  | ||||
|  | ||||
| # samples | ||||
| noinst_PROGRAMS = | ||||
| if ENABLE_SAMPLES | ||||
| if ENABLE_CLIENT | ||||
| noinst_PROGRAMS += upnp_tv_ctrlpt | ||||
| upnp_tv_ctrlpt_CPPFLAGS = \ | ||||
| noinst_PROGRAMS += tv_ctrlpt | ||||
| tv_ctrlpt_CPPFLAGS = \ | ||||
| 	$(AM_CPPFLAGS) \ | ||||
| 	-I$(srcdir)/common/ \ | ||||
| 	-I$(srcdir)/tvctrlpt | ||||
| if ENABLE_DEVICE | ||||
| noinst_PROGRAMS += upnp_tv_combo | ||||
| upnp_tv_combo_CPPFLAGS = $(AM_CPPFLAGS) \ | ||||
| noinst_PROGRAMS += tv_combo | ||||
| tv_combo_CPPFLAGS = $(AM_CPPFLAGS) \ | ||||
| 	-I$(srcdir)/common/ \ | ||||
| 	-I$(srcdir)/tvcombo | ||||
| endif | ||||
| endif | ||||
| if ENABLE_DEVICE | ||||
| noinst_PROGRAMS += upnp_tv_device | ||||
| upnp_tv_device_CPPFLAGS = \ | ||||
| noinst_PROGRAMS += tv_device | ||||
| tv_device_CPPFLAGS = \ | ||||
| 	$(AM_CPPFLAGS) \ | ||||
| 	-I$(srcdir)/common/ \ | ||||
| 	-I$(srcdir)/tvdevice | ||||
| endif | ||||
| endif | ||||
|  | ||||
|  | ||||
| upnp_tv_device_SOURCES = \ | ||||
| tv_device_SOURCES = \ | ||||
| 	common/sample_util.c \ | ||||
| 	common/sample_util.h \ | ||||
| 	tvdevice/upnp_tv_device.c \ | ||||
| 	tvdevice/upnp_tv_device.h \ | ||||
| 	tvdevice/linux/upnp_tv_device_main.c | ||||
| 	common/tv_device.c \ | ||||
| 	common/tv_device.h \ | ||||
| 	linux/tv_device_main.c | ||||
|  | ||||
|  | ||||
| upnp_tv_ctrlpt_SOURCES = \ | ||||
| tv_ctrlpt_SOURCES = \ | ||||
| 	common/sample_util.c \ | ||||
| 	common/sample_util.h \ | ||||
| 	tvctrlpt/upnp_tv_ctrlpt.c \ | ||||
| 	tvctrlpt/upnp_tv_ctrlpt.h \ | ||||
| 	tvctrlpt/linux/upnp_tv_ctrlpt_main.c | ||||
| 	common/tv_ctrlpt.c \ | ||||
| 	common/tv_ctrlpt.h \ | ||||
| 	linux/tv_ctrlpt_main.c | ||||
|  | ||||
| upnp_tv_combo_SOURCES = \ | ||||
| tv_combo_SOURCES = \ | ||||
| 	common/sample_util.c \ | ||||
| 	common/sample_util.h \ | ||||
| 	tvcombo/upnp_tv_ctrlpt.c \ | ||||
| 	tvcombo/upnp_tv_ctrlpt.h \ | ||||
| 	tvcombo/upnp_tv_device.c \ | ||||
| 	tvcombo/upnp_tv_device.h \ | ||||
| 	tvcombo/linux/upnp_tv_combo_main.c | ||||
|  | ||||
| 	common/tv_ctrlpt.c \ | ||||
| 	common/tv_ctrlpt.h \ | ||||
| 	common/tv_device.c \ | ||||
| 	common/tv_device.h \ | ||||
| 	linux/tv_combo_main.c | ||||
|  | ||||
| if WITH_DOCUMENTATION | ||||
| examplesdir = $(docdir)/examples | ||||
| examples_DATA = \ | ||||
| 		$(sort \ | ||||
| 			$(upnp_tv_ctrlpt_SOURCES) \ | ||||
| 			$(upnp_tv_device_SOURCES)) | ||||
| 			$(tv_ctrlpt_SOURCES) \ | ||||
| 			$(tv_device_SOURCES)) | ||||
| endif | ||||
|  | ||||
|  | ||||
| EXTRA_DIST = \ | ||||
| 	web/tvcombodesc.xml \ | ||||
| 	web/tvcontrolSCPD.xml \ | ||||
|   | ||||
| @@ -29,20 +29,25 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| /*! | ||||
|  * \addtogroup UpnpSamples | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
| #define SAMPLE_UTIL_C | ||||
|  | ||||
| #include "sample_util.h" | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| #if !UPNP_HAVE_TOOLS | ||||
| #	error "Need upnptools.h to compile samples ; try ./configure --enable-tools" | ||||
| #endif | ||||
|  | ||||
|  | ||||
| static int initialize_init = 1; | ||||
| static int initialize_register = 1; | ||||
|  | ||||
| @@ -54,18 +59,6 @@ state_update gStateUpdateFun = NULL; | ||||
| /*! mutex to control displaying of events */ | ||||
| ithread_mutex_t display_mutex; | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_Initialize | ||||
|  * | ||||
|  * Description:  | ||||
|  *     Initializes the sample util. Must be called before any sample util  | ||||
|  *     functions. May be called multiple times. | ||||
|  *     But the initialization is done only once. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   print_function - print function to use in SampleUtil_Print | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| int SampleUtil_Initialize(print_string print_function) | ||||
| { | ||||
| 	if (initialize_init) { | ||||
| @@ -75,26 +68,17 @@ int SampleUtil_Initialize(print_string print_function) | ||||
| 		ithread_mutexattr_setkind_np(&attr, ITHREAD_MUTEX_RECURSIVE_NP); | ||||
| 		ithread_mutex_init(&display_mutex, &attr); | ||||
| 		ithread_mutexattr_destroy(&attr); | ||||
|  | ||||
| 		/* To shut up valgrind mutex warning. */ | ||||
| 		ithread_mutex_lock(&display_mutex); | ||||
| 		gPrintFun = print_function; | ||||
| 		ithread_mutex_unlock(&display_mutex); | ||||
|  | ||||
| 		/* Finished initializing. */ | ||||
| 		initialize_init = 0; | ||||
| 	} | ||||
|  | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_RegisterUpdateFunction | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| int SampleUtil_RegisterUpdateFunction(state_update update_function) | ||||
| { | ||||
| 	if (initialize_register) { | ||||
| @@ -105,15 +89,6 @@ int SampleUtil_RegisterUpdateFunction(state_update update_function) | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_Finish | ||||
|  * | ||||
|  * Description:  | ||||
|  *     Releases Resources held by sample util. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| int SampleUtil_Finish() | ||||
| { | ||||
| 	ithread_mutex_destroy(&display_mutex); | ||||
| @@ -125,46 +100,18 @@ int SampleUtil_Finish() | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_GetElementValue | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a DOM node such as <Channel>11</Channel>, this routine | ||||
|  *       extracts the value (e.g., 11) from the node and returns it as  | ||||
|  *       a string. The string must be freed by the caller using  | ||||
|  *       free. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   node -- The DOM node from which to extract the value | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| char *SampleUtil_GetElementValue(IN IXML_Element *element) | ||||
| char *SampleUtil_GetElementValue(IXML_Element *element) | ||||
| { | ||||
| 	IXML_Node *child = ixmlNode_getFirstChild((IXML_Node *)element); | ||||
| 	char *temp = NULL; | ||||
|  | ||||
| 	if (child != 0 && ixmlNode_getNodeType(child) == eTEXT_NODE) { | ||||
| 	if (child != 0 && ixmlNode_getNodeType(child) == eTEXT_NODE) | ||||
| 		temp = strdup(ixmlNode_getNodeValue(child)); | ||||
| 	} | ||||
|  | ||||
| 	return temp; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_GetFirstServiceList | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a DOM node representing a UPnP Device Description Document, | ||||
|  *       this routine parses the document and finds the first service list | ||||
|  *       (i.e., the service list for the root device).  The service list | ||||
|  *       is returned as a DOM node list. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   node -- The DOM node from which to extract the service list | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document *doc) | ||||
| IXML_NodeList *SampleUtil_GetFirstServiceList(IXML_Document *doc) | ||||
| { | ||||
| 	IXML_NodeList *ServiceList = NULL; | ||||
| 	IXML_NodeList *servlistnodelist = NULL; | ||||
| @@ -176,39 +123,41 @@ IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document *doc) | ||||
| 		/* we only care about the first service list, from the root | ||||
| 		 * device */ | ||||
| 		servlistnode = ixmlNodeList_item(servlistnodelist, 0); | ||||
|  | ||||
| 		/* create as list of DOM nodes */ | ||||
| 		ServiceList = ixmlElement_getElementsByTagName( | ||||
| 			(IXML_Element *)servlistnode, "service"); | ||||
| 	} | ||||
| 	if (servlistnodelist) { | ||||
| 	if (servlistnodelist) | ||||
| 		ixmlNodeList_free(servlistnodelist); | ||||
| 	} | ||||
|  | ||||
| 	return ServiceList; | ||||
| } | ||||
|  | ||||
| #define OLD_FIND_SERVICE_CODE | ||||
| #ifdef OLD_FIND_SERVICE_CODE | ||||
| #else | ||||
| /* | ||||
|  * Obtain the service list  | ||||
|  *    n == 0 the first | ||||
|  *    n == 1 the next in the device list, etc.. | ||||
|  *  | ||||
|  */ | ||||
| IXML_NodeList *SampleUtil_GetNthServiceList(IN IXML_Document *doc , int n) | ||||
| static IXML_NodeList *SampleUtil_GetNthServiceList( | ||||
| 	/*! [in] . */ | ||||
| 	IXML_Document *doc, | ||||
| 	/*! [in] . */ | ||||
| 	unsigned int n) | ||||
| { | ||||
| 	IXML_NodeList *ServiceList = NULL; | ||||
| 	IXML_NodeList *servlistnodelist = NULL; | ||||
| 	IXML_Node *servlistnode = NULL; | ||||
|  | ||||
| 	/*   | ||||
| 	 *  ixmlDocument_getElementsByTagName() | ||||
| 	/*  ixmlDocument_getElementsByTagName() | ||||
| 	 *  Returns a NodeList of all Elements that match the given | ||||
| 	 *  tag name in the order in which they were encountered in a preorder | ||||
| 	 *  traversal of the Document tree.   | ||||
| 	 * | ||||
| 	 *  return (NodeList*) A pointer to a NodeList containing the  | ||||
| 	 *                      matching items or NULL on an error. | ||||
| 	 */ | ||||
| 	 *                      matching items or NULL on an error. 	 */ | ||||
| 	SampleUtil_Print("SampleUtil_GetNthServiceList called : n = %d\n", n); | ||||
| 	servlistnodelist = | ||||
| 		ixmlDocument_getElementsByTagName(doc, "serviceList"); | ||||
| @@ -223,38 +172,24 @@ IXML_NodeList *SampleUtil_GetNthServiceList(IN IXML_Document *doc , int n) | ||||
| 		 *  numerical index. | ||||
| 		 * | ||||
| 		 *  return (Node*) A pointer to a Node or NULL if there was an  | ||||
| 		 *                  error. | ||||
| 		 */ | ||||
| 		 *                  error. */ | ||||
| 		servlistnode = ixmlNodeList_item(servlistnodelist, n); | ||||
|  | ||||
| 		assert(servlistnode != 0); | ||||
|  | ||||
| 		if (!servlistnode) { | ||||
| 			/* create as list of DOM nodes */ | ||||
| 			ServiceList = ixmlElement_getElementsByTagName( | ||||
| 				(IXML_Element *)servlistnode, "service"); | ||||
| 		} else | ||||
| 			SampleUtil_Print("%s(%d): ixmlNodeList_item(nodeList, n) returned NULL\n", | ||||
| 				__FILE__, __LINE__); | ||||
| 	} | ||||
|  | ||||
| 	if (servlistnodelist) { | ||||
| 	if (servlistnodelist) | ||||
| 		ixmlNodeList_free(servlistnodelist); | ||||
| 	} | ||||
|  | ||||
| 	return ServiceList; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_GetFirstDocumentItem | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a document node, this routine searches for the first element | ||||
|  *       named by the input string item, and returns its value as a string. | ||||
|  *       String must be freed by caller using free. | ||||
|  * Parameters: | ||||
|  *   doc -- The DOM document from which to extract the value | ||||
|  *   item -- The item to search for | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| char *SampleUtil_GetFirstDocumentItem( | ||||
| 	IN IXML_Document *doc, IN const char *item) | ||||
| char *SampleUtil_GetFirstDocumentItem(IXML_Document *doc, const char *item) | ||||
| { | ||||
| 	IXML_NodeList *nodeList = NULL; | ||||
| 	IXML_Node *textNode = NULL; | ||||
| @@ -267,52 +202,32 @@ char *SampleUtil_GetFirstDocumentItem( | ||||
| 		if (tmpNode) { | ||||
| 			textNode = ixmlNode_getFirstChild(tmpNode); | ||||
| 			if (!textNode) { | ||||
| 				SampleUtil_Print("sample_util.c: (bug) " | ||||
| 					"ixmlNode_getFirstChild(tmpNode) " | ||||
| 					"returned NULL\n");  | ||||
| 				SampleUtil_Print("%s(%d): (BUG) ixmlNode_getFirstChild(tmpNode) returned NULL\n", | ||||
| 					__FILE__, __LINE__);  | ||||
| 				ret = strdup(""); | ||||
| 				goto epilogue; | ||||
| 			} | ||||
| 			if (!ixmlNode_getNodeValue(textNode)) { | ||||
| 				SampleUtil_Print("ixmlNode_getNodeValue " | ||||
| 					"returned NULL\n");  | ||||
| 				ret = strdup(""); | ||||
| 				goto epilogue; | ||||
| 			} else { | ||||
| 			ret = strdup(ixmlNode_getNodeValue(textNode)); | ||||
| 			if (!ret) { | ||||
| 				SampleUtil_Print("%s(%d): ixmlNode_getNodeValue returned NULL\n", | ||||
| 					__FILE__, __LINE__);  | ||||
| 				ret = strdup(""); | ||||
| 			} | ||||
| 		} else { | ||||
| 			SampleUtil_Print("ixmlNode_getFirstChild(tmpNode) " | ||||
| 				"returned NULL\n"); | ||||
| 			goto epilogue; | ||||
| 		} | ||||
| 	} else { | ||||
| 		SampleUtil_Print("Error finding %s in XML Node\n", item); | ||||
| 		goto epilogue; | ||||
| 	} | ||||
| 		} else | ||||
| 			SampleUtil_Print("%s(%d): ixmlNodeList_item(nodeList, 0) returned NULL\n", | ||||
| 				__FILE__, __LINE__); | ||||
| 	} else | ||||
| 		SampleUtil_Print("%s(%d): Error finding %s in XML Node\n", | ||||
| 			__FILE__, __LINE__, item); | ||||
|  | ||||
| epilogue: | ||||
| 	if (nodeList) { | ||||
| 	if (nodeList) | ||||
| 		ixmlNodeList_free(nodeList); | ||||
| 	} | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_GetFirstElementItem | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a DOM element, this routine searches for the first element | ||||
|  *       named by the input string item, and returns its value as a string. | ||||
|  *       The string must be freed using free. | ||||
|  * Parameters: | ||||
|  *   node -- The DOM element from which to extract the value | ||||
|  *   item -- The item to search for | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| char *SampleUtil_GetFirstElementItem( | ||||
| 	IN IXML_Element *element, IN const char *item) | ||||
| char *SampleUtil_GetFirstElementItem(IXML_Element *element, const char *item) | ||||
| { | ||||
| 	IXML_NodeList *nodeList = NULL; | ||||
| 	IXML_Node *textNode = NULL; | ||||
| @@ -321,24 +236,23 @@ char *SampleUtil_GetFirstElementItem( | ||||
|  | ||||
| 	nodeList = ixmlElement_getElementsByTagName(element, (char *)item); | ||||
| 	if (nodeList == NULL) { | ||||
| 		SampleUtil_Print( "Error finding %s in XML Node\n", item); | ||||
|  | ||||
| 		SampleUtil_Print("%s(%d): Error finding %s in XML Node\n", | ||||
| 			__FILE__, __LINE__, item); | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	tmpNode = ixmlNodeList_item(nodeList, 0); | ||||
| 	if (tmpNode) { | ||||
| 		SampleUtil_Print("Error finding %s value in XML Node\n", item); | ||||
| 	if (!tmpNode) { | ||||
| 		SampleUtil_Print("%s(%d): Error finding %s value in XML Node\n", | ||||
| 			__FILE__, __LINE__, item); | ||||
| 		ixmlNodeList_free(nodeList); | ||||
|  | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	textNode = ixmlNode_getFirstChild(tmpNode); | ||||
| 	ret = strdup(ixmlNode_getNodeValue(textNode)); | ||||
| 	if (!ret) { | ||||
| 		SampleUtil_Print("Error allocating memory for %s in XML Node\n", | ||||
| 			item); | ||||
| 		SampleUtil_Print("%s(%d): Error allocating memory for %s in XML Node\n", | ||||
| 			__FILE__, __LINE__, item); | ||||
| 		ixmlNodeList_free(nodeList); | ||||
|  | ||||
| 		return NULL; | ||||
| 	} | ||||
| 	ixmlNodeList_free(nodeList); | ||||
| @@ -346,17 +260,7 @@ char *SampleUtil_GetFirstElementItem( | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_PrintEventType | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prints a callback event type as a string. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   S -- The callback event | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| void SampleUtil_PrintEventType(IN Upnp_EventType S) | ||||
| void SampleUtil_PrintEventType(Upnp_EventType S) | ||||
| { | ||||
| 	switch (S) { | ||||
| 	/* Discovery */ | ||||
| @@ -410,18 +314,7 @@ void SampleUtil_PrintEventType(IN Upnp_EventType S) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_PrintEvent | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prints callback event structure details. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   EventType -- The type of callback event | ||||
|  *   Event -- The callback event structure | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| int SampleUtil_PrintEvent(IN Upnp_EventType EventType, IN void *Event) | ||||
| int SampleUtil_PrintEvent(Upnp_EventType EventType, void *Event) | ||||
| { | ||||
| 	ithread_mutex_lock(&display_mutex); | ||||
|  | ||||
| @@ -539,7 +432,6 @@ int SampleUtil_PrintEvent(IN Upnp_EventType EventType, IN void *Event) | ||||
| 		SampleUtil_Print("CurrentVal  =  %s\n", sv_event->CurrentVal); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
| 	/* GENA */ | ||||
| 	case UPNP_EVENT_SUBSCRIPTION_REQUEST: { | ||||
| 		struct Upnp_Subscription_Request *sr_event = | ||||
| @@ -607,31 +499,17 @@ int SampleUtil_PrintEvent(IN Upnp_EventType EventType, IN void *Event) | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_FindAndParseService | ||||
|  * | ||||
|  * Description:  | ||||
|  *       This routine finds the first occurance of a service in a DOM representation | ||||
|  *       of a description document and parses it.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   DescDoc -- The DOM description document | ||||
|  *   location -- The location of the description document | ||||
|  *   serviceSearchType -- The type of service to search for | ||||
|  *   serviceId -- OUT -- The service ID | ||||
|  *   eventURL -- OUT -- The event URL for the service | ||||
|  *   controlURL -- OUT -- The control URL for the service | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| int SampleUtil_FindAndParseService( | ||||
| 	IN IXML_Document *DescDoc, IN const char *location, IN char *serviceType, | ||||
| 	OUT char **serviceId, OUT char **eventURL, OUT char **controlURL) | ||||
| int SampleUtil_FindAndParseService(IXML_Document *DescDoc, const char *location, | ||||
| 	const char *serviceType, char **serviceId, char **eventURL, char **controlURL) | ||||
| { | ||||
| 	int i; | ||||
| 	int length; | ||||
| 	unsigned int i; | ||||
| 	unsigned long length; | ||||
| 	int found = 0; | ||||
| 	int ret; | ||||
| 	int sindex = 0; | ||||
| #ifdef OLD_FIND_SERVICE_CODE | ||||
| #else /* OLD_FIND_SERVICE_CODE */ | ||||
| 	unsigned int sindex = 0; | ||||
| #endif /* OLD_FIND_SERVICE_CODE */ | ||||
| 	char *tempServiceType = NULL; | ||||
| 	char *baseURL = NULL; | ||||
| 	const char *base = NULL; | ||||
| @@ -641,13 +519,13 @@ int SampleUtil_FindAndParseService( | ||||
| 	IXML_Element *service = NULL; | ||||
|  | ||||
| 	baseURL = SampleUtil_GetFirstDocumentItem(DescDoc, "URLBase"); | ||||
| 	if (baseURL) { | ||||
| 	if (baseURL) | ||||
| 		base = baseURL; | ||||
| 	} else { | ||||
| 	else | ||||
| 		base = location; | ||||
| 	} | ||||
|  | ||||
| 	/* Top level */ | ||||
| #ifdef OLD_FIND_SERVICE_CODE | ||||
| 	serviceList = SampleUtil_GetFirstServiceList(DescDoc); | ||||
| #else /* OLD_FIND_SERVICE_CODE */ | ||||
| 	for (sindex = 0; | ||||
| 	     (serviceList = SampleUtil_GetNthServiceList(DescDoc , sindex)) != NULL; | ||||
| 	     sindex++) { | ||||
| @@ -655,40 +533,32 @@ int SampleUtil_FindAndParseService( | ||||
| 		relcontrolURL = NULL; | ||||
| 		releventURL = NULL; | ||||
| 		service = NULL; | ||||
|  | ||||
| 		/* serviceList = SampleUtil_GetFirstServiceList( DescDoc ); */ | ||||
| #endif /* OLD_FIND_SERVICE_CODE */ | ||||
| 		length = ixmlNodeList_length(serviceList); | ||||
| 		for (i = 0; i < length; i++) { | ||||
| 			service = (IXML_Element *)ixmlNodeList_item(serviceList, i); | ||||
| 			tempServiceType = | ||||
| 				SampleUtil_GetFirstElementItem( | ||||
| 			tempServiceType = SampleUtil_GetFirstElementItem( | ||||
| 				(IXML_Element *)service, "serviceType"); | ||||
| 			if (strcmp(tempServiceType, serviceType) == 0) { | ||||
| 			if (tempServiceType && strcmp(tempServiceType, serviceType) == 0) { | ||||
| 				SampleUtil_Print("Found service: %s\n", serviceType); | ||||
| 				*serviceId = | ||||
| 					SampleUtil_GetFirstElementItem(service, "serviceId"); | ||||
| 				*serviceId = SampleUtil_GetFirstElementItem(service, "serviceId"); | ||||
| 				SampleUtil_Print("serviceId: %s\n", *serviceId); | ||||
| 				relcontrolURL = | ||||
| 					SampleUtil_GetFirstElementItem(service, "controlURL"); | ||||
| 				releventURL = | ||||
| 					SampleUtil_GetFirstElementItem(service, "eventSubURL"); | ||||
| 				*controlURL = | ||||
| 					malloc(strlen(base) + strlen(relcontrolURL)+1); | ||||
| 				relcontrolURL = SampleUtil_GetFirstElementItem(service, "controlURL"); | ||||
| 				releventURL = SampleUtil_GetFirstElementItem(service, "eventSubURL"); | ||||
| 				*controlURL = malloc(strlen(base) + strlen(relcontrolURL) + 1); | ||||
| 				if (*controlURL) { | ||||
| 					ret = UpnpResolveURL(base, relcontrolURL, *controlURL); | ||||
| 					if (ret != UPNP_E_SUCCESS) { | ||||
| 					if (ret != UPNP_E_SUCCESS) | ||||
| 						SampleUtil_Print("Error generating controlURL from %s + %s\n", | ||||
| 							base, relcontrolURL); | ||||
| 				} | ||||
| 				} | ||||
| 				*eventURL = malloc(strlen(base) + strlen(releventURL) + 1); | ||||
| 				if (*eventURL) { | ||||
| 					ret = UpnpResolveURL(base, releventURL, *eventURL); | ||||
| 					if (ret != UPNP_E_SUCCESS) { | ||||
| 					if (ret != UPNP_E_SUCCESS) | ||||
| 						SampleUtil_Print("Error generating eventURL from %s + %s\n", | ||||
| 							base, releventURL); | ||||
| 				} | ||||
| 				} | ||||
| 				free(relcontrolURL); | ||||
| 				free(releventURL); | ||||
| 				relcontrolURL = NULL; | ||||
| @@ -701,30 +571,19 @@ int SampleUtil_FindAndParseService( | ||||
| 		} | ||||
| 		free(tempServiceType); | ||||
| 		tempServiceType = NULL; | ||||
| 		if (serviceList) { | ||||
| 		if (serviceList) | ||||
| 			ixmlNodeList_free(serviceList); | ||||
| 		} | ||||
| 		serviceList = NULL; | ||||
| #ifdef OLD_FIND_SERVICE_CODE | ||||
| #else /* OLD_FIND_SERVICE_CODE */ | ||||
| 	} | ||||
| #endif /* OLD_FIND_SERVICE_CODE */ | ||||
| 	free(baseURL); | ||||
|  | ||||
| 	return found; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_Print | ||||
|  * | ||||
|  * Description:  | ||||
|  *      Provides platform-specific print functionality.  This function should be | ||||
|  *      called when you want to print content suitable for console output (i.e., | ||||
|  *      in a large text box or on a screen).  If your device/operating system is  | ||||
|  *      not supported here, you should add a port. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *		Same as printf() | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| int SampleUtil_Print(char *fmt, ...) | ||||
| int SampleUtil_Print(const char *fmt, ...) | ||||
| { | ||||
| #define MAX_BUF (8 * 1024) | ||||
| 	va_list ap; | ||||
| @@ -737,30 +596,33 @@ int SampleUtil_Print(char *fmt, ...) | ||||
| 	va_start(ap, fmt); | ||||
| 	rc = vsnprintf(buf, MAX_BUF, fmt, ap); | ||||
| 	va_end(ap); | ||||
|  | ||||
| 	if (gPrintFun) { | ||||
| 		gPrintFun(buf); | ||||
| 	} | ||||
| 	if (gPrintFun) | ||||
| 		gPrintFun("%s", buf); | ||||
|  | ||||
| 	ithread_mutex_unlock(&display_mutex); | ||||
|  | ||||
| 	return rc; | ||||
| } | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * SampleUtil_StateUpdate | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
| void SampleUtil_StateUpdate(const char *varName, const char *varValue, | ||||
| 	const char *UDN, eventType type) | ||||
| { | ||||
| 	/* TBD: Add mutex here? */ | ||||
| 	if (gStateUpdateFun) { | ||||
| 	if (gStateUpdateFun) | ||||
| 		gStateUpdateFun(varName, varValue, UDN, type); | ||||
| } | ||||
|  | ||||
| /*! | ||||
|  * \brief Prints a string to standard out. | ||||
|  */ | ||||
| void linux_print(const char *format, ...) | ||||
| { | ||||
| 	va_list argList; | ||||
|  | ||||
| 	va_start(argList, format); | ||||
| 	vfprintf(stdout, format, argList); | ||||
| 	fflush(stdout); | ||||
| 	va_end(argList); | ||||
| } | ||||
|  | ||||
| /*! @} UpnpSamples */ | ||||
|   | ||||
| @@ -1,3 +1,6 @@ | ||||
| #ifndef SAMPLE_UTIL_H | ||||
| #define SAMPLE_UTIL_H | ||||
|  | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
| @@ -29,30 +32,39 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef SAMPLE_UTIL_H | ||||
| #define SAMPLE_UTIL_H | ||||
|  | ||||
| /*! | ||||
|  * \defgroup UpnpSamples Sample Code | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "ixml.h" /* for IXML_Document, IXML_Element */ | ||||
| #include "upnp.h" /* for Upnp_EventType */ | ||||
| #include "upnptools.h" | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #ifdef SAMPLE_UTIL_C | ||||
| 	/*! Service types for tv services. */ | ||||
| 	const char *TvServiceType[] = { | ||||
| 		"urn:schemas-upnp-org:service:tvcontrol:1", | ||||
| 		"urn:schemas-upnp-org:service:tvpicture:1" | ||||
| 	}; | ||||
| #else /* SAMPLE_UTIL_C */ | ||||
| 	extern const char *TvServiceType[]; | ||||
| #endif /* SAMPLE_UTIL_C */ | ||||
|  | ||||
| /* mutex to control displaying of events */ | ||||
| extern ithread_mutex_t display_mutex; | ||||
|  | ||||
|  | ||||
| typedef enum { | ||||
| 	STATE_UPDATE = 0, | ||||
| 	DEVICE_ADDED = 1, | ||||
| @@ -60,233 +72,198 @@ typedef enum { | ||||
| 	GET_VAR_COMPLETE = 3 | ||||
| } eventType; | ||||
|  | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_GetElementValue | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a DOM node such as <Channel>11</Channel>, this routine | ||||
| /*! | ||||
|  * \brief Given a DOM node such as <Channel>11</Channel>, this routine | ||||
|  * extracts the value (e.g., 11) from the node and returns it as  | ||||
|  *       a string. The string must be freed by the caller using  | ||||
|  *       free. | ||||
|  * a string. The string must be freed by the caller using free. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   node -- The DOM node from which to extract the value | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| char *SampleUtil_GetElementValue(IN IXML_Element *element); | ||||
|  * \return The DOM node as a string. | ||||
|  */ | ||||
| char *SampleUtil_GetElementValue( | ||||
| 	/*! [in] The DOM node from which to extract the value. */ | ||||
| 	IXML_Element *element); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_GetFirstServiceList | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a DOM node representing a UPnP Device Description Document, | ||||
| /*! | ||||
|  * \brief Given a DOM node representing a UPnP Device Description Document, | ||||
|  * this routine parses the document and finds the first service list | ||||
|  * (i.e., the service list for the root device).  The service list | ||||
|  * is returned as a DOM node list. The NodeList must be freed using | ||||
|  * NodeList_free. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   node -- The DOM node from which to extract the service list | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
|  * \return The service list is returned as a DOM node list. | ||||
|  */ | ||||
| IXML_NodeList *SampleUtil_GetFirstServiceList( | ||||
| 	/*! [in] The DOM node from which to extract the service list. */ | ||||
| 	IXML_Document *doc);  | ||||
|  | ||||
| IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document *doc);  | ||||
|  | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_GetFirstDocumentItem | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a document node, this routine searches for the first element | ||||
| /*! | ||||
|  * \brief Given a document node, this routine searches for the first element | ||||
|  * named by the input string item, and returns its value as a string. | ||||
|  * String must be freed by caller using free. | ||||
|  * Parameters: | ||||
|  *   doc -- The DOM document from which to extract the value | ||||
|  *   item -- The item to search for | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| char *SampleUtil_GetFirstDocumentItem(IN IXML_Document *doc, IN const char *item);  | ||||
|  */ | ||||
| char *SampleUtil_GetFirstDocumentItem( | ||||
| 	/*! [in] The DOM document from which to extract the value. */ | ||||
| 	IXML_Document *doc, | ||||
| 	/*! [in] The item to search for. */ | ||||
| 	const char *item);  | ||||
|  | ||||
|  | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_GetFirstElementItem | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Given a DOM element, this routine searches for the first element | ||||
| /*! | ||||
|  * \brief Given a DOM element, this routine searches for the first element | ||||
|  * named by the input string item, and returns its value as a string. | ||||
|  * The string must be freed using free. | ||||
|  * Parameters: | ||||
|  *   node -- The DOM element from which to extract the value | ||||
|  *   item -- The item to search for | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| char *SampleUtil_GetFirstElementItem(IN IXML_Element *element, IN const char *item);  | ||||
|  */ | ||||
| char *SampleUtil_GetFirstElementItem( | ||||
| 	/*! [in] The DOM element from which to extract the value. */ | ||||
| 	IXML_Element *element, | ||||
| 	/*! [in] The item to search for. */ | ||||
| 	const char *item);  | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_PrintEventType | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prints a callback event type as a string. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   S -- The callback event | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void SampleUtil_PrintEventType(IN Upnp_EventType S); | ||||
| /*! | ||||
|  * \brief Prints a callback event type as a string. | ||||
|  */ | ||||
| void SampleUtil_PrintEventType( | ||||
| 	/*! [in] The callback event. */ | ||||
| 	Upnp_EventType S); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_PrintEvent | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prints callback event structure details. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   EventType -- The type of callback event | ||||
|  *   Event -- The callback event structure | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_PrintEvent(IN Upnp_EventType EventType,  | ||||
| 			  IN void *Event); | ||||
| /*! | ||||
|  * \brief Prints callback event structure details. | ||||
|  */ | ||||
| int SampleUtil_PrintEvent( | ||||
| 	/*! [in] The type of callback event. */ | ||||
| 	Upnp_EventType EventType,  | ||||
| 	/*! [in] The callback event structure. */ | ||||
| 	void *Event); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_FindAndParseService | ||||
|  * | ||||
|  * Description:  | ||||
|  *       This routine finds the first occurance of a service in a DOM representation | ||||
|  *       of a description document and parses it.  Note that this function currently | ||||
|  *       assumes that the eventURL and controlURL values in the service definitions | ||||
|  *       are full URLs.  Relative URLs are not handled here. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   DescDoc -- The DOM description document | ||||
|  *   location -- The location of the description document | ||||
|  *   serviceSearchType -- The type of service to search for | ||||
|  *   serviceId -- OUT -- The service ID | ||||
|  *   eventURL -- OUT -- The event URL for the service | ||||
|  *   controlURL -- OUT -- The control URL for the service | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| /*! | ||||
|  * \brief This routine finds the first occurance of a service in a DOM | ||||
|  * representation of a description document and parses it.  Note that this | ||||
|  * function currently assumes that the eventURL and controlURL values in | ||||
|  * the service definitions are full URLs.  Relative URLs are not handled here. | ||||
|  */ | ||||
| int SampleUtil_FindAndParseService ( | ||||
| 	IN IXML_Document *DescDoc, | ||||
| 	IN const char* location,  | ||||
| 	IN char *serviceType, | ||||
| 	OUT char **serviceId,  | ||||
| 	OUT char **eventURL, | ||||
| 	OUT char **controlURL); | ||||
| 	/*! [in] The DOM description document. */ | ||||
| 	IXML_Document *DescDoc, | ||||
| 	/*! [in] The location of the description document. */ | ||||
| 	const char *location,  | ||||
| 	/*! [in] The type of service to search for. */ | ||||
| 	const char *serviceType, | ||||
| 	/*! [out] The service ID. */ | ||||
| 	char **serviceId,  | ||||
| 	/*! [out] The event URL for the service. */ | ||||
| 	char **eventURL, | ||||
| 	/*! [out] The control URL for the service. */ | ||||
| 	char **controlURL); | ||||
|  | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * print_string | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prototype for displaying strings. All printing done by the device, | ||||
| /*! | ||||
|  * \brief Prototype for displaying strings. All printing done by the device, | ||||
|  * control point, and sample util, ultimately use this to display strings  | ||||
|  * to the user. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   const char * string. | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| typedef void (*print_string)(const char *string); | ||||
|  */ | ||||
| typedef void (*print_string)( | ||||
| 	/*! [in] Format. */ | ||||
| 	const char *string, | ||||
| 	/*! [in] Arguments. */ | ||||
| 	...) | ||||
| #if (__GNUC__ >= 3) | ||||
| 	/* This enables printf like format checking by the compiler */ | ||||
| 	__attribute__((format (__printf__, 1, 2))) | ||||
| #endif | ||||
| ; | ||||
|  | ||||
| //global print function used by sample util | ||||
| /*! global print function used by sample util */ | ||||
| extern print_string gPrintFun; | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * state_update | ||||
|  * | ||||
|  * Description:  | ||||
|  *     Prototype for passing back state changes | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   const char * varName | ||||
|  *   const char * varValue | ||||
|  *   const char * UDN | ||||
|  *   int          newDevice | ||||
|  ********************************************************************************/ | ||||
| /*! | ||||
|  * \brief Prototype for passing back state changes. | ||||
|  */ | ||||
| typedef void (*state_update)( | ||||
| 	/*! [in] . */ | ||||
| 	const char *varName, | ||||
| 	/*! [in] . */ | ||||
| 	const char *varValue, | ||||
| 	/*! [in] . */ | ||||
| 	const char *UDN, | ||||
| 	/*! [in] . */ | ||||
| 	eventType type); | ||||
|  | ||||
| //global state update function used by smaple util | ||||
| /*! global state update function used by smaple util */ | ||||
| extern state_update gStateUpdateFun; | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_Initialize | ||||
|  * | ||||
|  * Description:  | ||||
|  *     Initializes the sample util. Must be called before any sample util  | ||||
| /*! | ||||
|  * \brief Initializes the sample util. Must be called before any sample util | ||||
|  * functions. May be called multiple times. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   print_function - print function to use in SampleUtil_Print | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_Initialize(print_string print_function); | ||||
|  */ | ||||
| int SampleUtil_Initialize( | ||||
| 	/*! [in] Print function to use in SampleUtil_Print. */ | ||||
| 	print_string print_function); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_Finish | ||||
|  * | ||||
|  * Description:  | ||||
|  *     Releases Resources held by sample util. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| /*! | ||||
|  * \brief Releases Resources held by sample util. | ||||
|  */ | ||||
| int SampleUtil_Finish(); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_Print | ||||
|  * | ||||
|  * Description:  | ||||
|  *     Function emulating printf that ultimately calls the registered print  | ||||
| /*! | ||||
|  * \brief Function emulating printf that ultimately calls the registered print | ||||
|  * function with the formatted string. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   fmt - format (see printf) | ||||
|  *   . . .  - variable number of args. (see printf) | ||||
|  * Provides platform-specific print functionality.  This function should be | ||||
|  * called when you want to print content suitable for console output (i.e., | ||||
|  * in a large text box or on a screen).  If your device/operating system is  | ||||
|  * not supported here, you should add a port. | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_Print(char *fmt, ...); | ||||
|  * \return The same as printf. | ||||
|  */ | ||||
| int SampleUtil_Print( | ||||
| 	/*! [in] Format (see printf). */ | ||||
| 	const char *fmt, | ||||
| 	/*! [in] Format data. */ | ||||
| 	...) | ||||
| #if (__GNUC__ >= 3) | ||||
| 	/* This enables printf like format checking by the compiler */ | ||||
| 	__attribute__((format (__printf__, 1, 2))) | ||||
| #endif | ||||
| ; | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_RegisterUpdateFunction | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_RegisterUpdateFunction(state_update update_function); | ||||
| /*! | ||||
|  * \brief | ||||
|  */ | ||||
| int SampleUtil_RegisterUpdateFunction( | ||||
| 	/*! [in] . */ | ||||
| 	state_update update_function); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_StateUpdate | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| /*! | ||||
|  * \brief | ||||
|  */ | ||||
| void SampleUtil_StateUpdate( | ||||
| 	/*! [in] . */ | ||||
| 	const char *varName, | ||||
| 	/*! [in] . */ | ||||
| 	const char *varValue, | ||||
| 	/*! [in] . */ | ||||
| 	const char *UDN, | ||||
| 	/*! [in] . */ | ||||
| 	eventType type); | ||||
|  | ||||
| /*! | ||||
|  * \brief Prints a string to standard out. | ||||
|  */ | ||||
| void linux_print(const char *format, ...) | ||||
| #if (__GNUC__ >= 3) | ||||
| 	/* This enables printf like format checking by the compiler */ | ||||
| 	__attribute__((format (__printf__, 1, 2))) | ||||
| #endif | ||||
| ; | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| }; | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#define snprintf	_snprintf | ||||
| 	#define strcasecmp	stricmp | ||||
| #endif | ||||
|  | ||||
| /*! @} UpnpSamples */ | ||||
|  | ||||
| #endif /* SAMPLE_UTIL_H */ | ||||
|  | ||||
|   | ||||
							
								
								
									
										1585
									
								
								upnp/sample/common/tv_ctrlpt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1585
									
								
								upnp/sample/common/tv_ctrlpt.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,3 +1,6 @@ | ||||
| #ifndef UPNP_TV_CTRLPT_H | ||||
| #define UPNP_TV_CTRLPT_H | ||||
| 
 | ||||
| /**************************************************************************
 | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
| @@ -29,38 +32,31 @@ | ||||
|  * | ||||
|  **************************************************************************/ | ||||
| 
 | ||||
| 
 | ||||
| #ifndef UPNP_TV_CTRLPT_H | ||||
| #define UPNP_TV_CTRLPT_H | ||||
| 
 | ||||
| /*!
 | ||||
|  * \addtogroup UpnpSamples | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \name Contro Point Sample API | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  */ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #include "sample_util.h" | ||||
| 
 | ||||
| 
 | ||||
| #include "ithread.h" | ||||
| #include "upnp.h" | ||||
| #include "UpnpString.h" | ||||
| #include "upnptools.h" | ||||
| 
 | ||||
| 
 | ||||
| #include <signal.h> | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| 
 | ||||
| 
 | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #define TV_SERVICE_SERVCOUNT	2 | ||||
| #define TV_SERVICE_CONTROL	0 | ||||
| @@ -86,10 +82,8 @@ extern "C" { | ||||
| /* This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS		TV_PICTURE_VARCOUNT | ||||
| 
 | ||||
| extern char TvDeviceType[]; | ||||
| extern char *TvServiceType[]; | ||||
| extern char *TvServiceName[]; | ||||
| extern char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS]; | ||||
| extern const char *TvServiceName[]; | ||||
| extern const char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS]; | ||||
| extern char TvVarCount[]; | ||||
| 
 | ||||
| struct tv_service { | ||||
| @@ -127,9 +121,8 @@ int		TvCtrlPointRemoveDevice(const char *); | ||||
| int		TvCtrlPointRemoveAll(void); | ||||
| int		TvCtrlPointRefresh(void); | ||||
| 
 | ||||
| 
 | ||||
| int		TvCtrlPointSendAction(int, int, char *, char **, char **, int); | ||||
| int		TvCtrlPointSendActionNumericArg(int devnum, int service, char *actionName, char *paramName, int paramValue); | ||||
| int		TvCtrlPointSendAction(int, int, const char *, const char **, char **, int); | ||||
| int		TvCtrlPointSendActionNumericArg(int devnum, int service, const char *actionName, const char *paramName, int paramValue); | ||||
| int		TvCtrlPointSendPowerOn(int devnum); | ||||
| int		TvCtrlPointSendPowerOff(int devnum); | ||||
| int		TvCtrlPointSendSetChannel(int, int); | ||||
| @@ -139,7 +132,7 @@ int		TvCtrlPointSendSetTint(int, int); | ||||
| int		TvCtrlPointSendSetContrast(int, int); | ||||
| int		TvCtrlPointSendSetBrightness(int, int); | ||||
| 
 | ||||
| int		TvCtrlPointGetVar(int, int, char*); | ||||
| int		TvCtrlPointGetVar(int, int, const char *); | ||||
| int		TvCtrlPointGetPower(int devnum); | ||||
| int		TvCtrlPointGetChannel(int); | ||||
| int		TvCtrlPointGetVolume(int); | ||||
| @@ -153,19 +146,80 @@ int		TvCtrlPointPrintList(void); | ||||
| int		TvCtrlPointPrintDevice(int); | ||||
| void	TvCtrlPointAddDevice(IXML_Document *, const char *, int);  | ||||
| void    TvCtrlPointHandleGetVar(const char *, const char *, const DOMString); | ||||
| void	TvStateUpdate(char*,int, IXML_Document * , char **); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief Update a Tv state table. Called when an event is received. | ||||
|  * | ||||
|  * Note: this function is NOT thread save. It must be called from another | ||||
|  * function that has locked the global device list. | ||||
|  **/ | ||||
| void TvStateUpdate( | ||||
| 	/*! [in] The UDN of the parent device. */ | ||||
| 	char *UDN, | ||||
| 	/*! [in] The service state table to update. */ | ||||
| 	int Service, | ||||
| 	/*! [out] DOM document representing the XML received with the event. */ | ||||
| 	IXML_Document *ChangedVariables, | ||||
| 	/*! [out] pointer to the state table for the Tv  service to update. */ | ||||
| 	char **State); | ||||
| 
 | ||||
| void	TvCtrlPointHandleEvent(const char *, int, IXML_Document *);  | ||||
| void	TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);  | ||||
| int		TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *); | ||||
| void	TvCtrlPointVerifyTimeouts(int); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief Checks the advertisement each device in the global device list. | ||||
|  * | ||||
|  * If an advertisement expires, the device is removed from the list. | ||||
|  * | ||||
|  * If an advertisement is about to expire, a search request is sent for that | ||||
|  * device. | ||||
|  */ | ||||
| void TvCtrlPointVerifyTimeouts( | ||||
| 	/*! [in] The increment to subtract from the timeouts each time the
 | ||||
| 	 * function is called. */ | ||||
| 	int incr); | ||||
| 
 | ||||
| void	TvCtrlPointPrintCommands(void); | ||||
| void*	TvCtrlPointCommandLoop(void *); | ||||
| int		TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr); | ||||
| int		TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr, int combo); | ||||
| int		TvCtrlPointStop(void); | ||||
| int		TvCtrlPointProcessCommand(char *cmdline); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief Print help info for this application. | ||||
|  */ | ||||
| void TvCtrlPointPrintShortHelp(void); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief Print long help info for this application. | ||||
|  */ | ||||
| void TvCtrlPointPrintLongHelp(void); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \briefPrint the list of valid command line commands to the user | ||||
|  */ | ||||
| void TvCtrlPointPrintCommands(void); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief Function that receives commands from the user at the command prompt | ||||
|  * during the lifetime of the device, and calls the appropriate | ||||
|  * functions for those commands. | ||||
|  */ | ||||
| void *TvCtrlPointCommandLoop(void *args); | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief | ||||
|  */ | ||||
| int TvCtrlPointProcessCommand(char *cmdline); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| }; | ||||
| #endif | ||||
| 
 | ||||
| #endif //UPNP_TV_CTRLPT_H
 | ||||
| 
 | ||||
| /*! @} Device Sample */ | ||||
| 
 | ||||
| /*! @} UpnpSamples */ | ||||
| 
 | ||||
| #endif /* UPNP_TV_CTRLPT_H */ | ||||
							
								
								
									
										1463
									
								
								upnp/sample/common/tv_device.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1463
									
								
								upnp/sample/common/tv_device.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										571
									
								
								upnp/sample/common/tv_device.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										571
									
								
								upnp/sample/common/tv_device.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,571 @@ | ||||
| #ifndef UPNP_TV_DEVICE_H | ||||
| #define UPNP_TV_DEVICE_H | ||||
|  | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
| /*! | ||||
|  * \addtogroup UpnpSamples | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \name Device Sample API | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <signal.h> | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #include "sample_util.h" | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "upnp.h" | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| /*! Color constants */ | ||||
| #define MAX_COLOR 10 | ||||
| #define MIN_COLOR 1 | ||||
|  | ||||
| /*! Brightness constants */ | ||||
| #define MAX_BRIGHTNESS 10 | ||||
| #define MIN_BRIGHTNESS 1 | ||||
|  | ||||
| /*! Power constants */ | ||||
| #define POWER_ON 1 | ||||
| #define POWER_OFF 0 | ||||
|  | ||||
| /*! Tint constants */ | ||||
| #define MAX_TINT 10 | ||||
| #define MIN_TINT 1 | ||||
|  | ||||
| /*! Volume constants */ | ||||
| #define MAX_VOLUME 10 | ||||
| #define MIN_VOLUME 1 | ||||
|  | ||||
| /*! Contrast constants */ | ||||
| #define MAX_CONTRAST 10 | ||||
| #define MIN_CONTRAST 1 | ||||
|  | ||||
| /*! Channel constants */ | ||||
| #define MAX_CHANNEL 100 | ||||
| #define MIN_CHANNEL 1 | ||||
|  | ||||
| /*! Number of services. */ | ||||
| #define TV_SERVICE_SERVCOUNT  2 | ||||
|  | ||||
| /*! Index of control service */ | ||||
| #define TV_SERVICE_CONTROL    0 | ||||
|  | ||||
| /*! Index of picture service */ | ||||
| #define TV_SERVICE_PICTURE    1 | ||||
|  | ||||
| /*! Number of control variables */ | ||||
| #define TV_CONTROL_VARCOUNT   3 | ||||
|  | ||||
| /*! Index of power variable */ | ||||
| #define TV_CONTROL_POWER      0 | ||||
|  | ||||
| /*! Index of channel variable */ | ||||
| #define TV_CONTROL_CHANNEL    1 | ||||
|  | ||||
| /*! Index of volume variable */ | ||||
| #define TV_CONTROL_VOLUME     2 | ||||
|  | ||||
| /*! Number of picture variables */ | ||||
| #define TV_PICTURE_VARCOUNT   4 | ||||
|  | ||||
| /*! Index of color variable */ | ||||
| #define TV_PICTURE_COLOR      0 | ||||
|  | ||||
| /*! Index of tint variable */ | ||||
| #define TV_PICTURE_TINT       1 | ||||
|  | ||||
| /*! Index of contrast variable */ | ||||
| #define TV_PICTURE_CONTRAST   2 | ||||
|  | ||||
| /*! Index of brightness variable */ | ||||
| #define TV_PICTURE_BRIGHTNESS 3 | ||||
|  | ||||
| /*! Max value length */ | ||||
| #define TV_MAX_VAL_LEN 5 | ||||
|  | ||||
| /*! Max actions */ | ||||
| #define TV_MAXACTIONS 12 | ||||
|  | ||||
| /*! This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS TV_PICTURE_VARCOUNT | ||||
|  | ||||
| /*! | ||||
|  * \brief Prototype for all actions. For each action that a service  | ||||
|  * implements, there is a corresponding function with this prototype. | ||||
|  * | ||||
|  * Pointers to these functions, along with action names, are stored | ||||
|  * in the service table. When an action request comes in the action | ||||
|  * name is matched, and the appropriate function is called. | ||||
|  * Each function returns UPNP_E_SUCCESS, on success, and a nonzero  | ||||
|  * error code on failure. | ||||
|  */ | ||||
| typedef int (*upnp_action)( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *request, | ||||
| 	/*! [out] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] Error string in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! Structure for storing Tv Service identifiers and state table. */ | ||||
| struct TvService { | ||||
| 	/*! Universally Unique Device Name. */ | ||||
| 	char UDN[NAME_SIZE]; | ||||
| 	/*! . */ | ||||
| 	char ServiceId[NAME_SIZE]; | ||||
| 	/*! . */ | ||||
| 	char ServiceType[NAME_SIZE]; | ||||
| 	/*! . */ | ||||
| 	const char *VariableName[TV_MAXVARS];  | ||||
| 	/*! . */ | ||||
| 	char *VariableStrVal[TV_MAXVARS]; | ||||
| 	/*! . */ | ||||
| 	const char *ActionNames[TV_MAXACTIONS]; | ||||
| 	/*! . */ | ||||
| 	upnp_action actions[TV_MAXACTIONS]; | ||||
| 	/*! . */ | ||||
| 	int VariableCount; | ||||
| }; | ||||
|  | ||||
| /*! Array of service structures */ | ||||
| extern struct TvService tv_service_table[]; | ||||
|  | ||||
| /*! Device handle returned from sdk */ | ||||
| extern UpnpDevice_Handle device_handle; | ||||
|  | ||||
| /*! Mutex for protecting the global state table data | ||||
|  * in a multi-threaded, asynchronous environment. | ||||
|  * All functions should lock this mutex before reading | ||||
|  * or writing the state table data. */ | ||||
| extern ithread_mutex_t TVDevMutex; | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes the action table for the specified service. | ||||
|  * | ||||
|  * Note that knowledge of the service description is assumed. | ||||
|  * Action names are hardcoded. | ||||
|  */ | ||||
| int SetActionTable( | ||||
| 	/*! [in] one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE. */ | ||||
| 	int serviceType, | ||||
| 	/*! [in,out] service containing action table to set. */ | ||||
| 	struct TvService *out); | ||||
|  | ||||
| /*! | ||||
|  * \brief Initialize the device state table for this TvDevice, pulling | ||||
|  * identifier info from the description Document. | ||||
|  * | ||||
|  * Note that knowledge of the service description is assumed. | ||||
|  * State table variables and default values are currently hardcoded in | ||||
|  * this file rather than being read from service description documents. | ||||
|  */ | ||||
| int TvDeviceStateTableInit( | ||||
| 	/*! [in] The description document URL. */ | ||||
| 	char *DescDocURL); | ||||
|  | ||||
| /*! | ||||
|  * \brief Called during a subscription request callback. | ||||
|  * | ||||
|  * If the subscription request is for this device and either its | ||||
|  * control service or picture service, then accept it. | ||||
|  */ | ||||
| int TvDeviceHandleSubscriptionRequest( | ||||
| 	/*! [in] The subscription request event structure. */ | ||||
| 	struct Upnp_Subscription_Request *sr_event); | ||||
|  | ||||
| /*! | ||||
|  * \brief Called during a get variable request callback. | ||||
|  * | ||||
|  * If the request is for this device and either its control service or | ||||
|  * picture service, then respond with the variable value. | ||||
|  */ | ||||
| int TvDeviceHandleGetVarRequest( | ||||
| 	/*! [in,out] The control get variable request event structure. */ | ||||
| 	struct Upnp_State_Var_Request *cgv_event); | ||||
|  | ||||
| /*! | ||||
|  * \brief Called during an action request callback. | ||||
|  * | ||||
|  * If the request is for this device and either its control service | ||||
|  * or picture service, then perform the action and respond. | ||||
|  */ | ||||
| int TvDeviceHandleActionRequest( | ||||
| 	/*! [in,out] The control action request event structure. */ | ||||
| 	struct Upnp_Action_Request *ca_event); | ||||
|  | ||||
| /*! | ||||
|  * \brief The callback handler registered with the SDK while registering | ||||
|  * root device. | ||||
|  * | ||||
|  * Dispatches the request to the appropriate procedure | ||||
|  * based on the value of EventType. The four requests handled by the  | ||||
|  * device are:  | ||||
|  *	\li 1) Event Subscription requests.   | ||||
|  *	\li 2) Get Variable requests.  | ||||
|  *	\li 3) Action requests. | ||||
|  */ | ||||
| int TvDeviceCallbackEventHandler( | ||||
| 	/*! [in] The type of callback event. */ | ||||
| 	Upnp_EventType, | ||||
| 	/*! [in] Data structure containing event data. */ | ||||
| 	void *Event, | ||||
| 	/*! [in] Optional data specified during callback registration. */ | ||||
| 	void *Cookie); | ||||
|  | ||||
| /*! | ||||
|  * \brief Update the TvDevice service state table, and notify all subscribed | ||||
|  * control points of the updated state. | ||||
|  * | ||||
|  * Note that since this function blocks on the mutex TVDevMutex, | ||||
|  * to avoid a hang this function should not be called within any other | ||||
|  * function that currently has this mutex locked. | ||||
|  */ | ||||
| int TvDeviceSetServiceTableVar( | ||||
| 	/*! [in] The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE). */ | ||||
| 	unsigned int service, | ||||
| 	/*! [in] The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL, | ||||
| 	 * TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT, | ||||
| 	 * TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS). */ | ||||
| 	int variable, | ||||
| 	/*! [in] The string representation of the new value. */ | ||||
| 	char *value); | ||||
|  | ||||
| /* Control Service Actions */ | ||||
|  | ||||
| /*! | ||||
|  * \brief Turn the power on. | ||||
|  */ | ||||
| int TvDevicePowerOn( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Turn the power off. | ||||
|  */ | ||||
| int TvDevicePowerOff( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Change the channel, update the TvDevice control service | ||||
|  * state table, and notify all subscribed control points of the | ||||
|  * updated state. | ||||
|  */ | ||||
| int TvDeviceSetChannel( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Increase the channel.   | ||||
|  */ | ||||
| int TvDeviceIncreaseChannel( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Decrease the channel.   | ||||
|  */ | ||||
| int TvDeviceDecreaseChannel( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Change the volume, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  */ | ||||
| int TvDeviceSetVolume( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Increase the volume.  | ||||
|  */ | ||||
| int TvDeviceIncreaseVolume( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Decrease the volume. | ||||
|  */ | ||||
| int TvDeviceDecreaseVolume( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*Picture Service Actions */ | ||||
|  | ||||
| /*! | ||||
|  * \brief Change the color, update the TvDevice picture service | ||||
|  * state table, and notify all subscribed control points of the | ||||
|  * updated state. | ||||
|  */ | ||||
| int TvDeviceSetColor( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Increase the color. | ||||
|  */ | ||||
| int TvDeviceIncreaseColor( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Decrease the color.   | ||||
|  */ | ||||
| int TvDeviceDecreaseColor( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Change the tint, update the TvDevice picture service | ||||
|  * state table, and notify all subscribed control points of the | ||||
|  * updated state. | ||||
|  */ | ||||
| int TvDeviceSetTint( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Increase tint. | ||||
|  */ | ||||
| int TvDeviceIncreaseTint( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Decrease tint. | ||||
|  */ | ||||
| int TvDeviceDecreaseTint( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Change the contrast, update the TvDevice picture service | ||||
|  * state table, and notify all subscribed control points of the | ||||
|  * updated state. | ||||
|  */ | ||||
| int TvDeviceSetContrast( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Increase the contrast. | ||||
|  */ | ||||
| int TvDeviceIncreaseContrast( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Decrease the contrast. | ||||
|  */ | ||||
| int TvDeviceDecreaseContrast( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Change the brightness, update the TvDevice picture service | ||||
|  * state table, and notify all subscribed control points of the | ||||
|  * updated state. | ||||
|  */ | ||||
| int TvDeviceSetBrightness( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Increase brightnesss. | ||||
|  */ | ||||
| int TvDeviceIncreaseBrightness( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Decrease brightnesss. | ||||
|  */ | ||||
| int TvDeviceDecreaseBrightness( | ||||
| 	/*! [in] Document of action request. */ | ||||
| 	IXML_Document *in, | ||||
| 	/*! [in] Action result. */ | ||||
| 	IXML_Document **out, | ||||
| 	/*! [out] ErrorString in case action was unsuccessful. */ | ||||
| 	const char **errorString); | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes the UPnP Sdk, registers the device, and sends out | ||||
|  * advertisements. | ||||
|  */ | ||||
| int TvDeviceStart( | ||||
| 	/*! [in] ip address to initialize the sdk (may be NULL) | ||||
| 	 * if null, then the first non null loopback address is used. */ | ||||
| 	char *ip_address, | ||||
| 	/*! [in] port number to initialize the sdk (may be 0) | ||||
| 	 * if zero, then a random number is used. */ | ||||
| 	unsigned short port, | ||||
| 	/*! [in] name of description document. | ||||
| 	 * may be NULL. Default is tvdevicedesc.xml. */ | ||||
| 	const char *desc_doc_name, | ||||
| 	/*! [in] path of web directory. | ||||
| 	 * may be NULL. Default is ./web (for Linux) or ../tvdevice/web. */ | ||||
| 	const char *web_dir_path, | ||||
| 	/*! [in] print function to use. */ | ||||
| 	print_string pfun, | ||||
| 	/*! [in] Non-zero if called from the combo application. */ | ||||
| 	int combo); | ||||
|  | ||||
| /*! | ||||
|  * \brief Stops the device. Uninitializes the sdk. | ||||
|  */ | ||||
| int TvDeviceStop(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Function that receives commands from the user at the command prompt | ||||
|  * during the lifetime of the device, and calls the appropriate | ||||
|  * functions for those commands. Only one command, exit, is currently | ||||
|  * defined. | ||||
|  */ | ||||
| void *TvDeviceCommandLoop(void *args); | ||||
|  | ||||
| /*! | ||||
|  * \brief Main entry point for tv device application. | ||||
|  * | ||||
|  * Initializes and registers with the sdk. | ||||
|  * Initializes the state stables of the service. | ||||
|  * Starts the command loop. | ||||
|  * | ||||
|  * Accepts the following optional arguments: | ||||
|  *	\li \c -ip ipaddress | ||||
|  *	\li \c -port port | ||||
|  *	\li \c -desc desc_doc_name | ||||
|  *	\li \c -webdir web_dir_path | ||||
|  *	\li \c -help | ||||
|  */ | ||||
| int device_main(int argc, char *argv[]); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| /*! @} Control Point Sample API */ | ||||
|  | ||||
| /*! @} UpnpSamples */ | ||||
|  | ||||
| #endif /* UPNP_TV_DEVICE_H */ | ||||
							
								
								
									
										72
									
								
								upnp/sample/linux/tv_combo_main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								upnp/sample/linux/tv_combo_main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,72 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #include "sample_util.h" | ||||
| #include "tv_ctrlpt.h" | ||||
| #include "tv_device.h" | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
| 	int rc; | ||||
| 	ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
| 	int sig; | ||||
| 	sigset_t sigs_to_catch; | ||||
| #endif | ||||
| 	int code; | ||||
|  | ||||
| 	device_main(argc, argv); | ||||
| 	rc = TvCtrlPointStart(linux_print, NULL, 1); | ||||
| 	if (rc != TV_SUCCESS) { | ||||
| 		SampleUtil_Print("Error starting UPnP TV Control Point\n"); | ||||
| 		return rc; | ||||
| 	} | ||||
| 	/* start a command loop thread */ | ||||
| 	code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL); | ||||
| #ifdef WIN32 | ||||
| 	ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
| 	/* Catch Ctrl-C and properly shutdown */ | ||||
| 	sigemptyset(&sigs_to_catch); | ||||
| 	sigaddset(&sigs_to_catch, SIGINT); | ||||
| 	sigwait(&sigs_to_catch, &sig); | ||||
| 	SampleUtil_Print("Shutting down on signal %d...\n", sig); | ||||
| #endif | ||||
| 	TvDeviceStop(); | ||||
| 	rc = TvCtrlPointStop(); | ||||
|  | ||||
| 	return rc; | ||||
| } | ||||
|  | ||||
							
								
								
									
										72
									
								
								upnp/sample/linux/tv_ctrlpt_main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								upnp/sample/linux/tv_ctrlpt_main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,72 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #include "sample_util.h" | ||||
| #include "tv_ctrlpt.h" | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| int main(int argc, char **argv) | ||||
| { | ||||
| 	int rc; | ||||
| 	ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
| 	int sig; | ||||
| 	sigset_t sigs_to_catch; | ||||
| #endif | ||||
| 	int code; | ||||
|  | ||||
| 	rc = TvCtrlPointStart(linux_print, NULL, 0); | ||||
| 	if (rc != TV_SUCCESS) { | ||||
| 		SampleUtil_Print("Error starting UPnP TV Control Point\n"); | ||||
| 		return rc; | ||||
| 	} | ||||
| 	/* start a command loop thread */ | ||||
| 	code = ithread_create(&cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL); | ||||
| #ifdef WIN32 | ||||
| 	ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
| 	/* Catch Ctrl-C and properly shutdown */ | ||||
| 	sigemptyset(&sigs_to_catch); | ||||
| 	sigaddset(&sigs_to_catch, SIGINT); | ||||
| 	sigwait(&sigs_to_catch, &sig); | ||||
| 	SampleUtil_Print("Shutting down on signal %d...\n", sig); | ||||
| #endif | ||||
| 	rc = TvCtrlPointStop(); | ||||
|  | ||||
| 	return rc; | ||||
| 	argc = argc; | ||||
| 	argv = argv; | ||||
| } | ||||
|  | ||||
							
								
								
									
										69
									
								
								upnp/sample/linux/tv_device_main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								upnp/sample/linux/tv_device_main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #include "sample_util.h" | ||||
| #include "tv_device.h" | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
|  | ||||
| int main(int argc, char *argv[]) | ||||
| { | ||||
| 	int rc; | ||||
| 	ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
| 	int sig; | ||||
| 	sigset_t sigs_to_catch; | ||||
| #endif | ||||
| 	int code; | ||||
|  | ||||
| 	rc = device_main(argc, argv); | ||||
| 	if (rc != UPNP_E_SUCCESS) { | ||||
| 		return rc; | ||||
| 	} | ||||
|  | ||||
| 	/* start a command loop thread */ | ||||
| 	code = ithread_create(&cmdloop_thread, NULL, TvDeviceCommandLoop, NULL); | ||||
| #ifdef WIN32 | ||||
| 	ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
| 	/* Catch Ctrl-C and properly shutdown */ | ||||
| 	sigemptyset(&sigs_to_catch); | ||||
| 	sigaddset(&sigs_to_catch, SIGINT); | ||||
| 	sigwait(&sigs_to_catch, &sig); | ||||
| 	SampleUtil_Print("Shutting down on signal %d...\n", sig); | ||||
| #endif | ||||
| 	rc = TvDeviceStop(); | ||||
|  | ||||
| 	return rc; | ||||
| } | ||||
|  | ||||
| @@ -1,491 +0,0 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "sample_util.h" | ||||
| #include "upnp_tv_ctrlpt.h" | ||||
| #include "upnp_tv_device.h" | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| /* | ||||
|    Tags for valid commands issued at the command prompt  | ||||
|  */ | ||||
| enum cmdloop_tvcmds { | ||||
|     PRTHELP = 0, PRTFULLHELP, POWON, POWOFF, | ||||
|     SETCHAN, SETVOL, SETCOL, SETTINT, SETCONT, SETBRT, | ||||
|     CTRLACTION, PICTACTION, CTRLGETVAR, PICTGETVAR, | ||||
|     PRTDEV, LSTDEV, REFRESH, EXITCMD | ||||
| }; | ||||
|  | ||||
| /* | ||||
|    Data structure for parsing commands from the command line  | ||||
|  */ | ||||
| struct cmdloop_commands { | ||||
|     char *str;                  // the string  | ||||
|     int cmdnum;                 // the command | ||||
|     int numargs;                // the number of arguments | ||||
|     char *args;                 // the args | ||||
| } cmdloop_commands; | ||||
|  | ||||
| /* | ||||
|    Mappings between command text names, command tag, | ||||
|    and required command arguments for command line | ||||
|    commands  | ||||
|  */ | ||||
| static struct cmdloop_commands cmdloop_cmdlist[] = { | ||||
|     {"Help", PRTHELP, 1, ""}, | ||||
|     {"HelpFull", PRTFULLHELP, 1, ""}, | ||||
|     {"ListDev", LSTDEV, 1, ""}, | ||||
|     {"Refresh", REFRESH, 1, ""}, | ||||
|     {"PrintDev", PRTDEV, 2, "<devnum>"}, | ||||
|     {"PowerOn", POWON, 2, "<devnum>"}, | ||||
|     {"PowerOff", POWOFF, 2, "<devnum>"}, | ||||
|     {"SetChannel", SETCHAN, 3, "<devnum> <channel (int)>"}, | ||||
|     {"SetVolume", SETVOL, 3, "<devnum> <volume (int)>"}, | ||||
|     {"SetColor", SETCOL, 3, "<devnum> <color (int)>"}, | ||||
|     {"SetTint", SETTINT, 3, "<devnum> <tint (int)>"}, | ||||
|     {"SetContrast", SETCONT, 3, "<devnum> <contrast (int)>"}, | ||||
|     {"SetBrightness", SETBRT, 3, "<devnum> <brightness (int)>"}, | ||||
|     {"CtrlAction", CTRLACTION, 2, "<devnum> <action (string)>"}, | ||||
|     {"PictAction", PICTACTION, 2, "<devnum> <action (string)>"}, | ||||
|     {"CtrlGetVar", CTRLGETVAR, 2, "<devnum> <varname (string)>"}, | ||||
|     {"PictGetVar", PICTGETVAR, 2, "<devnum> <varname (string)>"}, | ||||
|     {"Exit", EXITCMD, 1, ""} | ||||
| }; | ||||
|  | ||||
| void | ||||
| linux_print( const char *string ) | ||||
| { | ||||
|     puts( string ); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * TvCtrlPointPrintHelp | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Print help info for this application. | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointPrintShortHelp( void ) | ||||
| { | ||||
|     SampleUtil_Print( "Commands:" ); | ||||
|     SampleUtil_Print( "  Help" ); | ||||
|     SampleUtil_Print( "  HelpFull" ); | ||||
|     SampleUtil_Print( "  ListDev" ); | ||||
|     SampleUtil_Print( "  Refresh" ); | ||||
|     SampleUtil_Print( "  PrintDev      <devnum>" ); | ||||
|     SampleUtil_Print( "  PowerOn       <devnum>" ); | ||||
|     SampleUtil_Print( "  PowerOff      <devnum>" ); | ||||
|     SampleUtil_Print( "  SetChannel    <devnum> <channel>" ); | ||||
|     SampleUtil_Print( "  SetVolume     <devnum> <volume>" ); | ||||
|     SampleUtil_Print( "  SetColor      <devnum> <color>" ); | ||||
|     SampleUtil_Print( "  SetTint       <devnum> <tint>" ); | ||||
|     SampleUtil_Print( "  SetContrast   <devnum> <contrast>" ); | ||||
|     SampleUtil_Print( "  SetBrightness <devnum> <brightness>" ); | ||||
|     SampleUtil_Print( "  CtrlAction    <devnum> <action>" ); | ||||
|     SampleUtil_Print( "  PictAction    <devnum> <action>" ); | ||||
|     SampleUtil_Print( "  CtrlGetVar    <devnum> <varname>" ); | ||||
|     SampleUtil_Print( "  PictGetVar    <devnum> <action>" ); | ||||
|     SampleUtil_Print( "  Exit" ); | ||||
| } | ||||
|  | ||||
| void | ||||
| TvCtrlPointPrintLongHelp( void ) | ||||
| { | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "******************************" ); | ||||
|     SampleUtil_Print( "* TV Control Point Help Info *" ); | ||||
|     SampleUtil_Print( "******************************" ); | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "This sample control point application automatically searches" ); | ||||
|     SampleUtil_Print( "for and subscribes to the services of television device emulator" ); | ||||
|     SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." ); | ||||
|     SampleUtil_Print( "It also registers itself as a tv device." ); | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "Commands:" ); | ||||
|     SampleUtil_Print( "  Help" ); | ||||
|     SampleUtil_Print( "       Print this help info." ); | ||||
|     SampleUtil_Print( "  ListDev" ); | ||||
|     SampleUtil_Print( "       Print the current list of TV Device Emulators that this" ); | ||||
|     SampleUtil_Print( "         control point is aware of.  Each device is preceded by a" ); | ||||
|     SampleUtil_Print( "         device number which corresponds to the devnum argument of" ); | ||||
|     SampleUtil_Print( "         commands listed below." ); | ||||
|     SampleUtil_Print( "  Refresh" ); | ||||
|     SampleUtil_Print( "       Delete all of the devices from the device list and issue new" ); | ||||
|     SampleUtil_Print( "         search request to rebuild the list from scratch." ); | ||||
|     SampleUtil_Print( "  PrintDev       <devnum>" ); | ||||
|     SampleUtil_Print( "       Print the state table for the device <devnum>." ); | ||||
|     SampleUtil_Print( "         e.g., 'PrintDev 1' prints the state table for the first" ); | ||||
|     SampleUtil_Print( "         device in the device list." ); | ||||
|     SampleUtil_Print( "  PowerOn        <devnum>" ); | ||||
|     SampleUtil_Print( "       Sends the PowerOn action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>." ); | ||||
|     SampleUtil_Print( "  PowerOff       <devnum>" ); | ||||
|     SampleUtil_Print( "       Sends the PowerOff action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>." ); | ||||
|     SampleUtil_Print( "  SetChannel     <devnum> <channel>" ); | ||||
|     SampleUtil_Print( "       Sends the SetChannel action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the channel to be changed" ); | ||||
|     SampleUtil_Print( "         to <channel>." ); | ||||
|     SampleUtil_Print( "  SetVolume      <devnum> <volume>" ); | ||||
|     SampleUtil_Print( "       Sends the SetVolume action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the volume to be changed" ); | ||||
|     SampleUtil_Print( "         to <volume>." ); | ||||
|     SampleUtil_Print( "  SetColor       <devnum> <color>" ); | ||||
|     SampleUtil_Print( "       Sends the SetColor action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the color to be changed" ); | ||||
|     SampleUtil_Print( "         to <color>." ); | ||||
|     SampleUtil_Print( "  SetTint        <devnum> <tint>" ); | ||||
|     SampleUtil_Print( "       Sends the SetTint action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the tint to be changed" ); | ||||
|     SampleUtil_Print( "         to <tint>." ); | ||||
|     SampleUtil_Print( "  SetContrast    <devnum> <contrast>" ); | ||||
|     SampleUtil_Print( "       Sends the SetContrast action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the contrast to be changed" ); | ||||
|     SampleUtil_Print( "         to <contrast>." ); | ||||
|     SampleUtil_Print( "  SetBrightness  <devnum> <brightness>" ); | ||||
|     SampleUtil_Print( "       Sends the SetBrightness action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the brightness to be changed" ); | ||||
|     SampleUtil_Print( "         to <brightness>." ); | ||||
|     SampleUtil_Print( "  CtrlAction     <devnum> <action>" ); | ||||
|     SampleUtil_Print( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print( "         to the Control Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print( "         (e.g., \"CtrlAction 1 IncreaseChannel\")" ); | ||||
|     SampleUtil_Print( "  PictAction     <devnum> <action>" ); | ||||
|     SampleUtil_Print( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print( "         to the Picture Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print( "         (e.g., \"PictAction 1 DecreaseContrast\")" ); | ||||
|     SampleUtil_Print( "  CtrlGetVar     <devnum> <varname>" ); | ||||
|     SampleUtil_Print( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print( "         from the Control Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "         (e.g., \"CtrlGetVar 1 Volume\")" ); | ||||
|     SampleUtil_Print( "  PictGetVar     <devnum> <action>" ); | ||||
|     SampleUtil_Print( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print( "         from the Picture Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "         (e.g., \"PictGetVar 1 Tint\")" ); | ||||
|     SampleUtil_Print( "  Exit" ); | ||||
|     SampleUtil_Print( "       Exits the control point application." ); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * TvCtrlPointPrintCommands | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Print the list of valid command line commands to the user | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   None | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointPrintCommands() | ||||
| { | ||||
|     int i; | ||||
|     int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands ); | ||||
|  | ||||
|     SampleUtil_Print( "Valid Commands:" ); | ||||
|     for( i = 0; i < numofcmds; i++ ) { | ||||
|         SampleUtil_Print( "  %-14s %s", cmdloop_cmdlist[i].str, | ||||
|                           cmdloop_cmdlist[i].args ); | ||||
|     } | ||||
|     SampleUtil_Print( "" ); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * TvCtrlPointCommandLoop | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Function that receives commands from the user at the command prompt | ||||
|  *       during the lifetime of the control point, and calls the appropriate | ||||
|  *       functions for those commands. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    None | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void * | ||||
| TvCtrlPointCommandLoop( void *args ) | ||||
| { | ||||
|     char cmdline[100]; | ||||
|  | ||||
|     while( 1 ) { | ||||
|         SampleUtil_Print( "\n>> " ); | ||||
|         fgets( cmdline, 100, stdin ); | ||||
|         TvCtrlPointProcessCommand( cmdline ); | ||||
|     } | ||||
|  | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| int | ||||
| TvCtrlPointProcessCommand( char *cmdline ) | ||||
| { | ||||
|     char cmd[100]; | ||||
|     char strarg[100]; | ||||
|     int arg_val_err = -99999; | ||||
|     int arg1 = arg_val_err; | ||||
|     int arg2 = arg_val_err; | ||||
|     int cmdnum = -1; | ||||
|     int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands ); | ||||
|     int cmdfound = 0; | ||||
|     int i, | ||||
|       rc; | ||||
|     int invalidargs = 0; | ||||
|     int validargs; | ||||
|  | ||||
|     validargs = sscanf( cmdline, "%s %d %d", cmd, &arg1, &arg2 ); | ||||
|  | ||||
|     for( i = 0; i < numofcmds; i++ ) { | ||||
|         if( strcasecmp( cmd, cmdloop_cmdlist[i].str ) == 0 ) { | ||||
|             cmdnum = cmdloop_cmdlist[i].cmdnum; | ||||
|             cmdfound++; | ||||
|             if( validargs != cmdloop_cmdlist[i].numargs ) | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if( !cmdfound ) { | ||||
|         SampleUtil_Print( "Command not found; try 'Help'" ); | ||||
|         return TV_SUCCESS; | ||||
|     } | ||||
|  | ||||
|     if( invalidargs ) { | ||||
|         SampleUtil_Print( "Invalid arguments; try 'Help'" ); | ||||
|         return TV_SUCCESS; | ||||
|     } | ||||
|  | ||||
|     switch ( cmdnum ) { | ||||
|         case PRTHELP: | ||||
|             TvCtrlPointPrintShortHelp(); | ||||
|             break; | ||||
|  | ||||
|         case PRTFULLHELP: | ||||
|             TvCtrlPointPrintLongHelp(); | ||||
|             break; | ||||
|  | ||||
|         case POWON: | ||||
|             TvCtrlPointSendPowerOn( arg1 ); | ||||
|             break; | ||||
|  | ||||
|         case POWOFF: | ||||
|             TvCtrlPointSendPowerOff( arg1 ); | ||||
|             break; | ||||
|  | ||||
|         case SETCHAN: | ||||
|             TvCtrlPointSendSetChannel( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETVOL: | ||||
|             TvCtrlPointSendSetVolume( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETCOL: | ||||
|             TvCtrlPointSendSetColor( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETTINT: | ||||
|             TvCtrlPointSendSetTint( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETCONT: | ||||
|             TvCtrlPointSendSetContrast( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETBRT: | ||||
|             TvCtrlPointSendSetBrightness( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case CTRLACTION: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointSendAction( TV_SERVICE_CONTROL, arg1, strarg, | ||||
|                                        NULL, NULL, 0 ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case PICTACTION: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointSendAction( TV_SERVICE_PICTURE, arg1, strarg, | ||||
|                                        NULL, NULL, 0 ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case CTRLGETVAR: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointGetVar( TV_SERVICE_CONTROL, arg1, strarg ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case PICTGETVAR: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointGetVar( TV_SERVICE_PICTURE, arg1, strarg ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case PRTDEV: | ||||
|             TvCtrlPointPrintDevice( arg1 ); | ||||
|             break; | ||||
|  | ||||
|         case LSTDEV: | ||||
|             TvCtrlPointPrintList(); | ||||
|             break; | ||||
|  | ||||
|         case REFRESH: | ||||
|             TvCtrlPointRefresh(); | ||||
|             break; | ||||
|  | ||||
|         case EXITCMD: | ||||
|             rc = TvCtrlPointStop(); | ||||
|             exit( rc ); | ||||
|             break; | ||||
|  | ||||
|         default: | ||||
|             SampleUtil_Print( "Command not implemented; see 'Help'" ); | ||||
|             break; | ||||
|     } | ||||
|  | ||||
|     if( invalidargs ) | ||||
|         SampleUtil_Print( "Invalid args in command; see 'Help'" ); | ||||
|  | ||||
|     return TV_SUCCESS; | ||||
| } | ||||
|  | ||||
| int | ||||
| device_main( int argc, char **argv ) | ||||
| { | ||||
|  | ||||
|     unsigned int portTemp = 0; | ||||
|     char *ip_address = NULL, | ||||
|      *desc_doc_name = NULL, | ||||
|      *web_dir_path = NULL; | ||||
|     unsigned int port = 0; | ||||
|  | ||||
|     int i = 0; | ||||
|  | ||||
|     SampleUtil_Initialize( linux_print ); | ||||
|  | ||||
|     // Parse options | ||||
|     for( i = 1; i < argc; i++ ) { | ||||
|         if( strcmp( argv[i], "-ip" ) == 0 ) { | ||||
|             ip_address = argv[++i]; | ||||
|         } else if( strcmp( argv[i], "-port" ) == 0 ) { | ||||
|             sscanf( argv[++i], "%u", &portTemp ); | ||||
|         } else if( strcmp( argv[i], "-desc" ) == 0 ) { | ||||
|             desc_doc_name = argv[++i]; | ||||
|         } else if( strcmp( argv[i], "-webdir" ) == 0 ) { | ||||
|             web_dir_path = argv[++i]; | ||||
|         } else if( strcmp( argv[i], "-help" ) == 0 ) { | ||||
|             SampleUtil_Print( "Usage: %s -ip ipaddress -port port" | ||||
|                               " -desc desc_doc_name -webdir web_dir_path" | ||||
|                               " -help (this message)\n", argv[0] ); | ||||
|             SampleUtil_Print( "\tipaddress:     IP address of the device" | ||||
|                               " (must match desc. doc)\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: 192.168.0.4\n" ); | ||||
|             SampleUtil_Print( "\tport:          Port number to use for " | ||||
|                               "receiving UPnP messages (must match desc. doc)\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: 5431\n" ); | ||||
|             SampleUtil_Print | ||||
|                 ( "\tdesc_doc_name: name of device description document\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: tvcombodesc.xml\n" ); | ||||
|             SampleUtil_Print | ||||
|                 ( "\tweb_dir_path: Filesystem path where web files " | ||||
|                   "related to the device are stored\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: /upnp/sample/web\n" ); | ||||
|             return 1; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     port = ( unsigned short )portTemp; | ||||
|  | ||||
|     return TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print ); | ||||
| } | ||||
|  | ||||
| int main( int argc, char **argv ) | ||||
| { | ||||
|     int rc; | ||||
|     ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
|     int sig; | ||||
|     sigset_t sigs_to_catch; | ||||
| #endif | ||||
|     int code; | ||||
|  | ||||
|     device_main(argc, argv); | ||||
|     rc = TvCtrlPointStart( linux_print, NULL ); | ||||
|     if( rc != TV_SUCCESS ) { | ||||
|         SampleUtil_Print( "Error starting UPnP TV Control Point" ); | ||||
|         return rc; | ||||
|     } | ||||
|     /* start a command loop thread */ | ||||
|     code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL ); | ||||
|  | ||||
| #ifdef WIN32 | ||||
|     ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
|     /* | ||||
|        Catch Ctrl-C and properly shutdown  | ||||
|      */ | ||||
|     sigemptyset( &sigs_to_catch ); | ||||
|     sigaddset( &sigs_to_catch, SIGINT ); | ||||
|     sigwait( &sigs_to_catch, &sig ); | ||||
|  | ||||
|     SampleUtil_Print( "Shutting down on signal %d...\n", sig ); | ||||
| #endif | ||||
|     TvDeviceStop(); | ||||
|     rc = TvCtrlPointStop(); | ||||
|     return rc; | ||||
| } | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,171 +0,0 @@ | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef UPNP_TV_CTRLPT_H | ||||
| #define UPNP_TV_CTRLPT_H | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include "sample_util.h" | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "upnp.h" | ||||
| #include "UpnpString.h" | ||||
| #include "upnptools.h" | ||||
|  | ||||
|  | ||||
| #include <signal.h> | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define TV_SERVICE_SERVCOUNT	2 | ||||
| #define TV_SERVICE_CONTROL		0 | ||||
| #define TV_SERVICE_PICTURE		1 | ||||
|  | ||||
| #define TV_CONTROL_VARCOUNT		3 | ||||
| #define TV_CONTROL_POWER		0 | ||||
| #define TV_CONTROL_CHANNEL		1 | ||||
| #define TV_CONTROL_VOLUME		2 | ||||
|  | ||||
| #define TV_PICTURE_VARCOUNT		4 | ||||
| #define TV_PICTURE_COLOR		0 | ||||
| #define TV_PICTURE_TINT			1 | ||||
| #define TV_PICTURE_CONTRAST		2 | ||||
| #define TV_PICTURE_BRIGHTNESS	3 | ||||
|  | ||||
| #define TV_MAX_VAL_LEN			5 | ||||
|  | ||||
| #define TV_SUCCESS			0 | ||||
| #define TV_ERROR			(-1) | ||||
| #define TV_WARNING			1 | ||||
|  | ||||
| /* This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS			TV_PICTURE_VARCOUNT | ||||
|  | ||||
| extern char TvDeviceType[]; | ||||
| extern char *TvServiceType[]; | ||||
| extern char *TvServiceName[]; | ||||
| extern char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS]; | ||||
| extern char TvVarCount[]; | ||||
|  | ||||
| struct tv_service { | ||||
|     char ServiceId[NAME_SIZE]; | ||||
|     char ServiceType[NAME_SIZE]; | ||||
|     char *VariableStrVal[TV_MAXVARS]; | ||||
|     char EventURL[NAME_SIZE]; | ||||
|     char ControlURL[NAME_SIZE]; | ||||
|     char SID[NAME_SIZE]; | ||||
| }; | ||||
|  | ||||
| extern struct TvDeviceNode *GlobalDeviceList; | ||||
|  | ||||
| struct TvDevice { | ||||
|     char UDN[250]; | ||||
|     char DescDocURL[250]; | ||||
|     char FriendlyName[250]; | ||||
|     char PresURL[250]; | ||||
|     int  AdvrTimeOut; | ||||
|     struct tv_service TvService[TV_SERVICE_SERVCOUNT]; | ||||
| }; | ||||
|  | ||||
| struct TvDeviceNode { | ||||
|     struct TvDevice device; | ||||
|     struct TvDeviceNode *next; | ||||
| }; | ||||
|  | ||||
| extern ithread_mutex_t DeviceListMutex; | ||||
|  | ||||
| extern UpnpClient_Handle ctrlpt_handle; | ||||
|  | ||||
| void	TvCtrlPointPrintHelp(void); | ||||
| int		TvCtrlPointDeleteNode(struct TvDeviceNode *); | ||||
| int		TvCtrlPointRemoveDevice(const char *); | ||||
| int		TvCtrlPointRemoveAll(void); | ||||
| int		TvCtrlPointRefresh(void); | ||||
|  | ||||
|  | ||||
| int		TvCtrlPointSendAction(int, int, char *, char **, char **, int); | ||||
| int		TvCtrlPointSendActionNumericArg(int devnum, int service, char *actionName, char *paramName, int paramValue); | ||||
| int		TvCtrlPointSendPowerOn(int devnum); | ||||
| int		TvCtrlPointSendPowerOff(int devnum); | ||||
| int		TvCtrlPointSendSetChannel(int, int); | ||||
| int		TvCtrlPointSendSetVolume(int, int); | ||||
| int		TvCtrlPointSendSetColor(int, int); | ||||
| int		TvCtrlPointSendSetTint(int, int); | ||||
| int		TvCtrlPointSendSetContrast(int, int); | ||||
| int		TvCtrlPointSendSetBrightness(int, int); | ||||
|  | ||||
| int		TvCtrlPointGetVar(int, int, char*); | ||||
| int		TvCtrlPointGetPower(int devnum); | ||||
| int		TvCtrlPointGetChannel(int); | ||||
| int		TvCtrlPointGetVolume(int); | ||||
| int		TvCtrlPointGetColor(int); | ||||
| int		TvCtrlPointGetTint(int); | ||||
| int		TvCtrlPointGetContrast(int); | ||||
| int		TvCtrlPointGetBrightness(int); | ||||
|  | ||||
| int		TvCtrlPointGetDevice(int, struct TvDeviceNode **); | ||||
| int		TvCtrlPointPrintList(void); | ||||
| int		TvCtrlPointPrintDevice(int); | ||||
| void	TvCtrlPointAddDevice(IXML_Document *, const char *, int);  | ||||
| void    TvCtrlPointHandleGetVar(const char *, const char *, const DOMString); | ||||
| void	TvStateUpdate(char*,int, IXML_Document * , char **); | ||||
| void	TvCtrlPointHandleEvent(const char *, int, IXML_Document *);  | ||||
| void	TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);  | ||||
| int		TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *); | ||||
| void	TvCtrlPointVerifyTimeouts(int); | ||||
| void	TvCtrlPointPrintCommands(void); | ||||
| void*	TvCtrlPointCommandLoop(void *); | ||||
| int		TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr); | ||||
| int		TvCtrlPointStop(void); | ||||
| int		TvCtrlPointProcessCommand(char *cmdline); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| }; | ||||
| #endif | ||||
|  | ||||
| #endif //UPNP_TV_CTRLPT_H | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,632 +0,0 @@ | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef UPNP_TV_DEVICE_H | ||||
| #define UPNP_TV_DEVICE_H | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <signal.h> | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include "sample_util.h" | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "upnp.h" | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| //Color constants | ||||
| #define MAX_COLOR 10 | ||||
| #define MIN_COLOR 1 | ||||
|  | ||||
| //Brightness constants | ||||
| #define MAX_BRIGHTNESS 10 | ||||
| #define MIN_BRIGHTNESS 1 | ||||
|  | ||||
| //Power constants | ||||
| #define POWER_ON 1 | ||||
| #define POWER_OFF 0 | ||||
|  | ||||
| //Tint constants | ||||
| #define MAX_TINT 10 | ||||
| #define MIN_TINT 1 | ||||
|  | ||||
| //Volume constants | ||||
| #define MAX_VOLUME 10 | ||||
| #define MIN_VOLUME 1 | ||||
|  | ||||
| //Contrast constants | ||||
| #define MAX_CONTRAST 10 | ||||
| #define MIN_CONTRAST 1 | ||||
|  | ||||
| //Channel constants | ||||
| #define MAX_CHANNEL 100 | ||||
| #define MIN_CHANNEL 1 | ||||
|  | ||||
| //Number of services. | ||||
| #define TV_SERVICE_SERVCOUNT  2 | ||||
|  | ||||
| //Index of control service | ||||
| #define TV_SERVICE_CONTROL    0 | ||||
|  | ||||
| //Index of picture service | ||||
| #define TV_SERVICE_PICTURE    1 | ||||
|  | ||||
| //Number of control variables | ||||
| #define TV_CONTROL_VARCOUNT   3 | ||||
|  | ||||
| //Index of power variable | ||||
| #define TV_CONTROL_POWER      0 | ||||
|  | ||||
| //Index of channel variable | ||||
| #define TV_CONTROL_CHANNEL    1 | ||||
|  | ||||
| //Index of volume variable | ||||
| #define TV_CONTROL_VOLUME     2 | ||||
|  | ||||
| //Number of picture variables | ||||
| #define TV_PICTURE_VARCOUNT   4 | ||||
|  | ||||
| //Index of color variable | ||||
| #define TV_PICTURE_COLOR      0 | ||||
|  | ||||
| //Index of tint variable | ||||
| #define TV_PICTURE_TINT       1 | ||||
|  | ||||
| //Index of contrast variable | ||||
| #define TV_PICTURE_CONTRAST   2 | ||||
|  | ||||
| //Index of brightness variable | ||||
| #define TV_PICTURE_BRIGHTNESS 3 | ||||
|  | ||||
| //Max value length | ||||
| #define TV_MAX_VAL_LEN 5 | ||||
|  | ||||
| //Max actions | ||||
| #define TV_MAXACTIONS 12 | ||||
|  | ||||
| /* This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS TV_PICTURE_VARCOUNT | ||||
|  | ||||
|  | ||||
| extern char TvDeviceType[]; | ||||
|  | ||||
| extern char *TvServiceType[]; | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * upnp_action | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prototype for all actions. For each action that a service  | ||||
|  *       implements, there is a corresponding function with this prototype. | ||||
|  *       Pointers to these functions, along with action names, are stored | ||||
|  *       in the service table. When an action request comes in the action | ||||
|  *       name is matched, and the appropriate function is called. | ||||
|  *       Each function returns UPNP_E_SUCCESS, on success, and a nonzero  | ||||
|  *       error code on failure. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * request - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out, char **errorString); | ||||
|  | ||||
| /* Structure for storing Tv Service | ||||
|    identifiers and state table */ | ||||
| struct TvService { | ||||
|    | ||||
|   char UDN[NAME_SIZE]; /* Universally Unique Device Name */ | ||||
|   char ServiceId[NAME_SIZE]; | ||||
|   char ServiceType[NAME_SIZE]; | ||||
|   char *VariableName[TV_MAXVARS];  | ||||
|   char *VariableStrVal[TV_MAXVARS]; | ||||
|   char *ActionNames[TV_MAXACTIONS]; | ||||
|   upnp_action actions[TV_MAXACTIONS]; | ||||
|   unsigned int  VariableCount; | ||||
| }; | ||||
|  | ||||
| //Array of service structures | ||||
| extern struct TvService tv_service_table[]; | ||||
|  | ||||
| //Device handle returned from sdk | ||||
| extern UpnpDevice_Handle device_handle; | ||||
|  | ||||
|  | ||||
| /* Mutex for protecting the global state table data | ||||
|    in a multi-threaded, asynchronous environment. | ||||
|    All functions should lock this mutex before reading | ||||
|    or writing the state table data. */ | ||||
| extern ithread_mutex_t TVDevMutex; | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * SetActionTable | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Initializes the action table for the specified service. | ||||
|  *       Note that  | ||||
|  *       knowledge of the service description is | ||||
|  *       assumed.  Action names are hardcoded. | ||||
|  * Parameters: | ||||
|  *   int serviceType - one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE | ||||
|  *   struct TvService *out - service containing action table to set. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int SetActionTable(int serviceType, struct TvService *out); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceStateTableInit | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Initialize the device state table for  | ||||
|  * 	 this TvDevice, pulling identifier info | ||||
|  *       from the description Document.  Note that  | ||||
|  *       knowledge of the service description is | ||||
|  *       assumed.  State table variables and default | ||||
|  *       values are currently hardcoded in this file | ||||
|  *       rather than being read from service description | ||||
|  *       documents. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   DescDocURL -- The description document URL | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceStateTableInit(char*); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleSubscriptionRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during a subscription request callback.  If the | ||||
|  *       subscription request is for this device and either its | ||||
|  *       control service or picture service, then accept it. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   sr_event -- The subscription request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleGetVarRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during a get variable request callback.  If the | ||||
|  *       request is for this device and either its control service | ||||
|  *       or picture service, then respond with the variable value. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   cgv_event -- The control get variable request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleActionRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during an action request callback.  If the | ||||
|  *       request is for this device and either its control service | ||||
|  *       or picture service, then perform the action and respond. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   ca_event -- The control action request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleActionRequest(struct Upnp_Action_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceCallbackEventHandler | ||||
|  * | ||||
|  * Description:  | ||||
|  *       The callback handler registered with the SDK while registering | ||||
|  *       root device.  Dispatches the request to the appropriate procedure | ||||
|  *       based on the value of EventType. The four requests handled by the  | ||||
|  *       device are:  | ||||
|  *                   1) Event Subscription requests.   | ||||
|  *                   2) Get Variable requests.  | ||||
|  *                   3) Action requests. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *   EventType -- The type of callback event | ||||
|  *   Event -- Data structure containing event data | ||||
|  *   Cookie -- Optional data specified during callback registration | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceCallbackEventHandler(Upnp_EventType, void*, void*); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetServiceTableVar | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Update the TvDevice service state table, and notify all subscribed  | ||||
|  *       control points of the updated state.  Note that since this function | ||||
|  *       blocks on the mutex TVDevMutex, to avoid a hang this function should  | ||||
|  *       not be called within any other function that currently has this mutex  | ||||
|  *       locked. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   service -- The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE) | ||||
|  *   variable -- The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL, | ||||
|  *                   TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT, | ||||
|  *                   TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS) | ||||
|  *   value -- The string representation of the new value | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*); | ||||
|  | ||||
| //Control Service Actions | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDevicePowerOn | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Turn the power on. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDevicePowerOff | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Turn the power off. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *     | ||||
|  *    IXML_Document * in - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the channel, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *     | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the channel.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the channel.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the volume, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the volume.  | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the volume. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
|  | ||||
| //Picture Service Actions | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the color, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the color. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the color.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the tint, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase tint. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease tint. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * TvDeviceSetContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the contrast, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  ****************************************************************************/ | ||||
| int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  *      Increase the contrast. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *        | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  *      Decrease the contrast. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *           | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the brightness, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   brightness -- The brightness value to change to. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase brightness. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease brightnesss. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name, | ||||
| 				  char *web_dir_path, print_string pfun); | ||||
| int TvDeviceStop(void); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
| @@ -1,441 +0,0 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "sample_util.h" | ||||
| #include "upnp_tv_ctrlpt.h" | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| /* | ||||
|    Tags for valid commands issued at the command prompt  | ||||
|  */ | ||||
| enum cmdloop_tvcmds { | ||||
|     PRTHELP = 0, PRTFULLHELP, POWON, POWOFF, | ||||
|     SETCHAN, SETVOL, SETCOL, SETTINT, SETCONT, SETBRT, | ||||
|     CTRLACTION, PICTACTION, CTRLGETVAR, PICTGETVAR, | ||||
|     PRTDEV, LSTDEV, REFRESH, EXITCMD | ||||
| }; | ||||
|  | ||||
| /* | ||||
|    Data structure for parsing commands from the command line  | ||||
|  */ | ||||
| struct cmdloop_commands { | ||||
|     char *str;                  // the string  | ||||
|     int cmdnum;                 // the command | ||||
|     int numargs;                // the number of arguments | ||||
|     char *args;                 // the args | ||||
| } cmdloop_commands; | ||||
|  | ||||
| /* | ||||
|    Mappings between command text names, command tag, | ||||
|    and required command arguments for command line | ||||
|    commands  | ||||
|  */ | ||||
| static struct cmdloop_commands cmdloop_cmdlist[] = { | ||||
|     {"Help", PRTHELP, 1, ""}, | ||||
|     {"HelpFull", PRTFULLHELP, 1, ""}, | ||||
|     {"ListDev", LSTDEV, 1, ""}, | ||||
|     {"Refresh", REFRESH, 1, ""}, | ||||
|     {"PrintDev", PRTDEV, 2, "<devnum>"}, | ||||
|     {"PowerOn", POWON, 2, "<devnum>"}, | ||||
|     {"PowerOff", POWOFF, 2, "<devnum>"}, | ||||
|     {"SetChannel", SETCHAN, 3, "<devnum> <channel (int)>"}, | ||||
|     {"SetVolume", SETVOL, 3, "<devnum> <volume (int)>"}, | ||||
|     {"SetColor", SETCOL, 3, "<devnum> <color (int)>"}, | ||||
|     {"SetTint", SETTINT, 3, "<devnum> <tint (int)>"}, | ||||
|     {"SetContrast", SETCONT, 3, "<devnum> <contrast (int)>"}, | ||||
|     {"SetBrightness", SETBRT, 3, "<devnum> <brightness (int)>"}, | ||||
|     {"CtrlAction", CTRLACTION, 2, "<devnum> <action (string)>"}, | ||||
|     {"PictAction", PICTACTION, 2, "<devnum> <action (string)>"}, | ||||
|     {"CtrlGetVar", CTRLGETVAR, 2, "<devnum> <varname (string)>"}, | ||||
|     {"PictGetVar", PICTGETVAR, 2, "<devnum> <varname (string)>"}, | ||||
|     {"Exit", EXITCMD, 1, ""} | ||||
| }; | ||||
|  | ||||
| void | ||||
| linux_print( const char *string ) | ||||
| { | ||||
|     puts( string ); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * TvCtrlPointPrintHelp | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Print help info for this application. | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointPrintShortHelp( void ) | ||||
| { | ||||
|     SampleUtil_Print( "Commands:" ); | ||||
|     SampleUtil_Print( "  Help" ); | ||||
|     SampleUtil_Print( "  HelpFull" ); | ||||
|     SampleUtil_Print( "  ListDev" ); | ||||
|     SampleUtil_Print( "  Refresh" ); | ||||
|     SampleUtil_Print( "  PrintDev      <devnum>" ); | ||||
|     SampleUtil_Print( "  PowerOn       <devnum>" ); | ||||
|     SampleUtil_Print( "  PowerOff      <devnum>" ); | ||||
|     SampleUtil_Print( "  SetChannel    <devnum> <channel>" ); | ||||
|     SampleUtil_Print( "  SetVolume     <devnum> <volume>" ); | ||||
|     SampleUtil_Print( "  SetColor      <devnum> <color>" ); | ||||
|     SampleUtil_Print( "  SetTint       <devnum> <tint>" ); | ||||
|     SampleUtil_Print( "  SetContrast   <devnum> <contrast>" ); | ||||
|     SampleUtil_Print( "  SetBrightness <devnum> <brightness>" ); | ||||
|     SampleUtil_Print( "  CtrlAction    <devnum> <action>" ); | ||||
|     SampleUtil_Print( "  PictAction    <devnum> <action>" ); | ||||
|     SampleUtil_Print( "  CtrlGetVar    <devnum> <varname>" ); | ||||
|     SampleUtil_Print( "  PictGetVar    <devnum> <action>" ); | ||||
|     SampleUtil_Print( "  Exit" ); | ||||
| } | ||||
|  | ||||
| void | ||||
| TvCtrlPointPrintLongHelp( void ) | ||||
| { | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "******************************" ); | ||||
|     SampleUtil_Print( "* TV Control Point Help Info *" ); | ||||
|     SampleUtil_Print( "******************************" ); | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "This sample control point application automatically searches" ); | ||||
|     SampleUtil_Print( "for and subscribes to the services of television device emulator" ); | ||||
|     SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." ); | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "Commands:" ); | ||||
|     SampleUtil_Print( "  Help" ); | ||||
|     SampleUtil_Print( "       Print this help info." ); | ||||
|     SampleUtil_Print( "  ListDev" ); | ||||
|     SampleUtil_Print( "       Print the current list of TV Device Emulators that this" ); | ||||
|     SampleUtil_Print( "         control point is aware of.  Each device is preceded by a" ); | ||||
|     SampleUtil_Print( "         device number which corresponds to the devnum argument of" ); | ||||
|     SampleUtil_Print( "         commands listed below." ); | ||||
|     SampleUtil_Print( "  Refresh" ); | ||||
|     SampleUtil_Print( "       Delete all of the devices from the device list and issue new" ); | ||||
|     SampleUtil_Print( "         search request to rebuild the list from scratch." ); | ||||
|     SampleUtil_Print( "  PrintDev       <devnum>" ); | ||||
|     SampleUtil_Print( "       Print the state table for the device <devnum>." ); | ||||
|     SampleUtil_Print( "         e.g., 'PrintDev 1' prints the state table for the first" ); | ||||
|     SampleUtil_Print( "         device in the device list." ); | ||||
|     SampleUtil_Print( "  PowerOn        <devnum>" ); | ||||
|     SampleUtil_Print( "       Sends the PowerOn action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>." ); | ||||
|     SampleUtil_Print( "  PowerOff       <devnum>" ); | ||||
|     SampleUtil_Print( "       Sends the PowerOff action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>." ); | ||||
|     SampleUtil_Print( "  SetChannel     <devnum> <channel>" ); | ||||
|     SampleUtil_Print( "       Sends the SetChannel action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the channel to be changed" ); | ||||
|     SampleUtil_Print( "         to <channel>." ); | ||||
|     SampleUtil_Print( "  SetVolume      <devnum> <volume>" ); | ||||
|     SampleUtil_Print( "       Sends the SetVolume action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the volume to be changed" ); | ||||
|     SampleUtil_Print( "         to <volume>." ); | ||||
|     SampleUtil_Print( "  SetColor       <devnum> <color>" ); | ||||
|     SampleUtil_Print( "       Sends the SetColor action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the color to be changed" ); | ||||
|     SampleUtil_Print( "         to <color>." ); | ||||
|     SampleUtil_Print( "  SetTint        <devnum> <tint>" ); | ||||
|     SampleUtil_Print( "       Sends the SetTint action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the tint to be changed" ); | ||||
|     SampleUtil_Print( "         to <tint>." ); | ||||
|     SampleUtil_Print( "  SetContrast    <devnum> <contrast>" ); | ||||
|     SampleUtil_Print( "       Sends the SetContrast action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the contrast to be changed" ); | ||||
|     SampleUtil_Print( "         to <contrast>." ); | ||||
|     SampleUtil_Print( "  SetBrightness  <devnum> <brightness>" ); | ||||
|     SampleUtil_Print( "       Sends the SetBrightness action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the brightness to be changed" ); | ||||
|     SampleUtil_Print( "         to <brightness>." ); | ||||
|     SampleUtil_Print( "  CtrlAction     <devnum> <action>" ); | ||||
|     SampleUtil_Print( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print( "         to the Control Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print( "         (e.g., \"CtrlAction 1 IncreaseChannel\")" ); | ||||
|     SampleUtil_Print( "  PictAction     <devnum> <action>" ); | ||||
|     SampleUtil_Print( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print( "         to the Picture Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print( "         (e.g., \"PictAction 1 DecreaseContrast\")" ); | ||||
|     SampleUtil_Print( "  CtrlGetVar     <devnum> <varname>" ); | ||||
|     SampleUtil_Print( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print( "         from the Control Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "         (e.g., \"CtrlGetVar 1 Volume\")" ); | ||||
|     SampleUtil_Print( "  PictGetVar     <devnum> <action>" ); | ||||
|     SampleUtil_Print( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print( "         from the Picture Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "         (e.g., \"PictGetVar 1 Tint\")" ); | ||||
|     SampleUtil_Print( "  Exit" ); | ||||
|     SampleUtil_Print( "       Exits the control point application." ); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * TvCtrlPointPrintCommands | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Print the list of valid command line commands to the user | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   None | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointPrintCommands() | ||||
| { | ||||
|     int i; | ||||
|     int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands ); | ||||
|  | ||||
|     SampleUtil_Print( "Valid Commands:" ); | ||||
|     for( i = 0; i < numofcmds; i++ ) { | ||||
|         SampleUtil_Print( "  %-14s %s", cmdloop_cmdlist[i].str, | ||||
|                           cmdloop_cmdlist[i].args ); | ||||
|     } | ||||
|     SampleUtil_Print( "" ); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * TvCtrlPointCommandLoop | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Function that receives commands from the user at the command prompt | ||||
|  *       during the lifetime of the control point, and calls the appropriate | ||||
|  *       functions for those commands. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    None | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void * | ||||
| TvCtrlPointCommandLoop( void *args ) | ||||
| { | ||||
|     char cmdline[100]; | ||||
|  | ||||
|     while( 1 ) { | ||||
|         SampleUtil_Print( "\n>> " ); | ||||
|         fgets( cmdline, 100, stdin ); | ||||
|         TvCtrlPointProcessCommand( cmdline ); | ||||
|     } | ||||
|  | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| int | ||||
| TvCtrlPointProcessCommand( char *cmdline ) | ||||
| { | ||||
|     char cmd[100]; | ||||
|     char strarg[100]; | ||||
|     int arg_val_err = -99999; | ||||
|     int arg1 = arg_val_err; | ||||
|     int arg2 = arg_val_err; | ||||
|     int cmdnum = -1; | ||||
|     int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands ); | ||||
|     int cmdfound = 0; | ||||
|     int i, | ||||
|       rc; | ||||
|     int invalidargs = 0; | ||||
|     int validargs; | ||||
|  | ||||
|     validargs = sscanf( cmdline, "%s %d %d", cmd, &arg1, &arg2 ); | ||||
|  | ||||
|     for( i = 0; i < numofcmds; i++ ) { | ||||
|         if( strcasecmp( cmd, cmdloop_cmdlist[i].str ) == 0 ) { | ||||
|             cmdnum = cmdloop_cmdlist[i].cmdnum; | ||||
|             cmdfound++; | ||||
|             if( validargs != cmdloop_cmdlist[i].numargs ) | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if( !cmdfound ) { | ||||
|         SampleUtil_Print( "Command not found; try 'Help'" ); | ||||
|         return TV_SUCCESS; | ||||
|     } | ||||
|  | ||||
|     if( invalidargs ) { | ||||
|         SampleUtil_Print( "Invalid arguments; try 'Help'" ); | ||||
|         return TV_SUCCESS; | ||||
|     } | ||||
|  | ||||
|     switch ( cmdnum ) { | ||||
|         case PRTHELP: | ||||
|             TvCtrlPointPrintShortHelp(); | ||||
|             break; | ||||
|  | ||||
|         case PRTFULLHELP: | ||||
|             TvCtrlPointPrintLongHelp(); | ||||
|             break; | ||||
|  | ||||
|         case POWON: | ||||
|             TvCtrlPointSendPowerOn( arg1 ); | ||||
|             break; | ||||
|  | ||||
|         case POWOFF: | ||||
|             TvCtrlPointSendPowerOff( arg1 ); | ||||
|             break; | ||||
|  | ||||
|         case SETCHAN: | ||||
|             TvCtrlPointSendSetChannel( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETVOL: | ||||
|             TvCtrlPointSendSetVolume( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETCOL: | ||||
|             TvCtrlPointSendSetColor( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETTINT: | ||||
|             TvCtrlPointSendSetTint( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETCONT: | ||||
|             TvCtrlPointSendSetContrast( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case SETBRT: | ||||
|             TvCtrlPointSendSetBrightness( arg1, arg2 ); | ||||
|             break; | ||||
|  | ||||
|         case CTRLACTION: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointSendAction( TV_SERVICE_CONTROL, arg1, strarg, | ||||
|                                        NULL, NULL, 0 ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case PICTACTION: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointSendAction( TV_SERVICE_PICTURE, arg1, strarg, | ||||
|                                        NULL, NULL, 0 ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case CTRLGETVAR: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointGetVar( TV_SERVICE_CONTROL, arg1, strarg ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case PICTGETVAR: | ||||
|             /* | ||||
|                re-parse commandline since second arg is string  | ||||
|              */ | ||||
|             validargs = sscanf( cmdline, "%s %d %s", cmd, &arg1, strarg ); | ||||
|             if( 3 == validargs ) | ||||
|                 TvCtrlPointGetVar( TV_SERVICE_PICTURE, arg1, strarg ); | ||||
|             else | ||||
|                 invalidargs++; | ||||
|             break; | ||||
|  | ||||
|         case PRTDEV: | ||||
|             TvCtrlPointPrintDevice( arg1 ); | ||||
|             break; | ||||
|  | ||||
|         case LSTDEV: | ||||
|             TvCtrlPointPrintList(); | ||||
|             break; | ||||
|  | ||||
|         case REFRESH: | ||||
|             TvCtrlPointRefresh(); | ||||
|             break; | ||||
|  | ||||
|         case EXITCMD: | ||||
|             rc = TvCtrlPointStop(); | ||||
|             exit( rc ); | ||||
|             break; | ||||
|  | ||||
|         default: | ||||
|             SampleUtil_Print( "Command not implemented; see 'Help'" ); | ||||
|             break; | ||||
|     } | ||||
|  | ||||
|     if( invalidargs ) | ||||
|         SampleUtil_Print( "Invalid args in command; see 'Help'" ); | ||||
|  | ||||
|     return TV_SUCCESS; | ||||
| } | ||||
|  | ||||
| int main( int argc, char **argv ) | ||||
| { | ||||
|     int rc; | ||||
|     ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
|     int sig; | ||||
|     sigset_t sigs_to_catch; | ||||
| #endif | ||||
|     int code; | ||||
|  | ||||
|  | ||||
|     rc = TvCtrlPointStart( linux_print, NULL ); | ||||
|     if( rc != TV_SUCCESS ) { | ||||
|         SampleUtil_Print( "Error starting UPnP TV Control Point" ); | ||||
|         return rc; | ||||
|     } | ||||
|     /* start a command loop thread */ | ||||
|     code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL ); | ||||
|  | ||||
| #ifdef WIN32 | ||||
|     ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
|     /* | ||||
|        Catch Ctrl-C and properly shutdown  | ||||
|      */ | ||||
|     sigemptyset( &sigs_to_catch ); | ||||
|     sigaddset( &sigs_to_catch, SIGINT ); | ||||
|     sigwait( &sigs_to_catch, &sig ); | ||||
|  | ||||
|     SampleUtil_Print( "Shutting down on signal %d...\n", sig ); | ||||
| #endif | ||||
|  | ||||
|     rc = TvCtrlPointStop(); | ||||
|  | ||||
|     return rc; | ||||
| } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,198 +0,0 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "sample_util.h" | ||||
| #include "upnp_tv_device.h" | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * linux_print | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prints a string to standard out. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    None | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| void | ||||
| linux_print( const char *string ) | ||||
| { | ||||
|     printf( "%s", string ); | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceCommandLoop | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Function that receives commands from the user at the command prompt | ||||
|  *       during the lifetime of the device, and calls the appropriate | ||||
|  *       functions for those commands. Only one command, exit, is currently | ||||
|  *       defined. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    None | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| void * | ||||
| TvDeviceCommandLoop( void *args ) | ||||
| { | ||||
|     int stoploop = 0; | ||||
|     char cmdline[100]; | ||||
|     char cmd[100]; | ||||
|  | ||||
|     while( !stoploop ) { | ||||
|         sprintf( cmdline, " " ); | ||||
|         sprintf( cmd, " " ); | ||||
|  | ||||
|         SampleUtil_Print( "\n>> " ); | ||||
|  | ||||
|         // Get a command line | ||||
|         fgets( cmdline, 100, stdin ); | ||||
|  | ||||
|         sscanf( cmdline, "%s", cmd ); | ||||
|  | ||||
|         if( strcasecmp( cmd, "exit" ) == 0 ) { | ||||
|             SampleUtil_Print( "Shutting down...\n" ); | ||||
|             TvDeviceStop(); | ||||
|             exit( 0 ); | ||||
|         } else { | ||||
|             SampleUtil_Print( "\n   Unknown command: %s\n\n", cmd ); | ||||
|             SampleUtil_Print( "   Valid Commands:\n" ); | ||||
|             SampleUtil_Print( "     Exit\n\n" ); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     return NULL; | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * main | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Main entry point for tv device application. | ||||
|  *       Initializes and registers with the sdk. | ||||
|  *       Initializes the state stables of the service. | ||||
|  *       Starts the command loop. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    int argc  - count of arguments | ||||
|  *    char ** argv -arguments. The application  | ||||
|  *                  accepts the following optional arguments: | ||||
|  * | ||||
|  *                  -ip ipaddress  | ||||
|  *                  -port port | ||||
|  *		    -desc desc_doc_name  | ||||
|  *	            -webdir web_dir_path" | ||||
|  *		    -help  | ||||
|  *                  | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int main( IN int argc, IN char **argv ) | ||||
| { | ||||
|  | ||||
|     unsigned int portTemp = 0; | ||||
|     char *ip_address = NULL, | ||||
|      *desc_doc_name = NULL, | ||||
|      *web_dir_path = NULL; | ||||
|     int rc; | ||||
|     ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
|     int sig; | ||||
|     sigset_t sigs_to_catch; | ||||
| #endif | ||||
|     int code; | ||||
|     unsigned int port = 0; | ||||
|     int i = 0; | ||||
|  | ||||
|     SampleUtil_Initialize( linux_print ); | ||||
|  | ||||
|     // Parse options | ||||
|     for( i = 1; i < argc; i++ ) { | ||||
|         if( strcmp( argv[i], "-ip" ) == 0 ) { | ||||
|             ip_address = argv[++i]; | ||||
|         } else if( strcmp( argv[i], "-port" ) == 0 ) { | ||||
|             sscanf( argv[++i], "%u", &portTemp ); | ||||
|         } else if( strcmp( argv[i], "-desc" ) == 0 ) { | ||||
|             desc_doc_name = argv[++i]; | ||||
|         } else if( strcmp( argv[i], "-webdir" ) == 0 ) { | ||||
|             web_dir_path = argv[++i]; | ||||
|         } else if( strcmp( argv[i], "-help" ) == 0 ) { | ||||
|             SampleUtil_Print( "Usage: %s -ip ipaddress -port port" | ||||
|                               " -desc desc_doc_name -webdir web_dir_path" | ||||
|                               " -help (this message)\n", argv[0] ); | ||||
|             SampleUtil_Print( "\tipaddress:     IP address of the device" | ||||
|                               " (must match desc. doc)\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: 192.168.0.4\n" ); | ||||
|             SampleUtil_Print( "\tport:          Port number to use for " | ||||
|                               "receiving UPnP messages (must match desc. doc)\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: 5431\n" ); | ||||
|             SampleUtil_Print | ||||
|                 ( "\tdesc_doc_name: name of device description document\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: tvdevicedesc.xml\n" ); | ||||
|             SampleUtil_Print | ||||
|                 ( "\tweb_dir_path: Filesystem path where web files " | ||||
|                   "related to the device are stored\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" ); | ||||
|             return 1; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     port = ( unsigned short )portTemp; | ||||
|  | ||||
|     TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print ); | ||||
|  | ||||
|     /* start a command loop thread */ | ||||
|     code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop, NULL ); | ||||
|  | ||||
| #ifdef WIN32 | ||||
|     ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
|     /* | ||||
|        Catch Ctrl-C and properly shutdown  | ||||
|      */ | ||||
|     sigemptyset( &sigs_to_catch ); | ||||
|     sigaddset( &sigs_to_catch, SIGINT ); | ||||
|     sigwait( &sigs_to_catch, &sig ); | ||||
|  | ||||
|     SampleUtil_Print( "Shutting down on signal %d...\n", sig ); | ||||
| #endif | ||||
|     rc = TvDeviceStop(); | ||||
|      | ||||
|     return rc; | ||||
| } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,632 +0,0 @@ | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef UPNP_TV_DEVICE_H | ||||
| #define UPNP_TV_DEVICE_H | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <signal.h> | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include "sample_util.h" | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "upnp.h" | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| //Color constants | ||||
| #define MAX_COLOR 10 | ||||
| #define MIN_COLOR 1 | ||||
|  | ||||
| //Brightness constants | ||||
| #define MAX_BRIGHTNESS 10 | ||||
| #define MIN_BRIGHTNESS 1 | ||||
|  | ||||
| //Power constants | ||||
| #define POWER_ON 1 | ||||
| #define POWER_OFF 0 | ||||
|  | ||||
| //Tint constants | ||||
| #define MAX_TINT 10 | ||||
| #define MIN_TINT 1 | ||||
|  | ||||
| //Volume constants | ||||
| #define MAX_VOLUME 10 | ||||
| #define MIN_VOLUME 1 | ||||
|  | ||||
| //Contrast constants | ||||
| #define MAX_CONTRAST 10 | ||||
| #define MIN_CONTRAST 1 | ||||
|  | ||||
| //Channel constants | ||||
| #define MAX_CHANNEL 100 | ||||
| #define MIN_CHANNEL 1 | ||||
|  | ||||
| //Number of services. | ||||
| #define TV_SERVICE_SERVCOUNT  2 | ||||
|  | ||||
| //Index of control service | ||||
| #define TV_SERVICE_CONTROL    0 | ||||
|  | ||||
| //Index of picture service | ||||
| #define TV_SERVICE_PICTURE    1 | ||||
|  | ||||
| //Number of control variables | ||||
| #define TV_CONTROL_VARCOUNT   3 | ||||
|  | ||||
| //Index of power variable | ||||
| #define TV_CONTROL_POWER      0 | ||||
|  | ||||
| //Index of channel variable | ||||
| #define TV_CONTROL_CHANNEL    1 | ||||
|  | ||||
| //Index of volume variable | ||||
| #define TV_CONTROL_VOLUME     2 | ||||
|  | ||||
| //Number of picture variables | ||||
| #define TV_PICTURE_VARCOUNT   4 | ||||
|  | ||||
| //Index of color variable | ||||
| #define TV_PICTURE_COLOR      0 | ||||
|  | ||||
| //Index of tint variable | ||||
| #define TV_PICTURE_TINT       1 | ||||
|  | ||||
| //Index of contrast variable | ||||
| #define TV_PICTURE_CONTRAST   2 | ||||
|  | ||||
| //Index of brightness variable | ||||
| #define TV_PICTURE_BRIGHTNESS 3 | ||||
|  | ||||
| //Max value length | ||||
| #define TV_MAX_VAL_LEN 5 | ||||
|  | ||||
| //Max actions | ||||
| #define TV_MAXACTIONS 12 | ||||
|  | ||||
| /* This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS TV_PICTURE_VARCOUNT | ||||
|  | ||||
|  | ||||
| extern char TvDeviceType[]; | ||||
|  | ||||
| extern char *TvServiceType[]; | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * upnp_action | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prototype for all actions. For each action that a service  | ||||
|  *       implements, there is a corresponding function with this prototype. | ||||
|  *       Pointers to these functions, along with action names, are stored | ||||
|  *       in the service table. When an action request comes in the action | ||||
|  *       name is matched, and the appropriate function is called. | ||||
|  *       Each function returns UPNP_E_SUCCESS, on success, and a nonzero  | ||||
|  *       error code on failure. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * request - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out, char **errorString); | ||||
|  | ||||
| /* Structure for storing Tv Service | ||||
|    identifiers and state table */ | ||||
| struct TvService { | ||||
|    | ||||
|   char UDN[NAME_SIZE]; /* Universally Unique Device Name */ | ||||
|   char ServiceId[NAME_SIZE]; | ||||
|   char ServiceType[NAME_SIZE]; | ||||
|   char *VariableName[TV_MAXVARS];  | ||||
|   char *VariableStrVal[TV_MAXVARS]; | ||||
|   char *ActionNames[TV_MAXACTIONS]; | ||||
|   upnp_action actions[TV_MAXACTIONS]; | ||||
|   unsigned int  VariableCount; | ||||
| }; | ||||
|  | ||||
| //Array of service structures | ||||
| extern struct TvService tv_service_table[]; | ||||
|  | ||||
| //Device handle returned from sdk | ||||
| extern UpnpDevice_Handle device_handle; | ||||
|  | ||||
|  | ||||
| /* Mutex for protecting the global state table data | ||||
|    in a multi-threaded, asynchronous environment. | ||||
|    All functions should lock this mutex before reading | ||||
|    or writing the state table data. */ | ||||
| extern ithread_mutex_t TVDevMutex; | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * SetActionTable | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Initializes the action table for the specified service. | ||||
|  *       Note that  | ||||
|  *       knowledge of the service description is | ||||
|  *       assumed.  Action names are hardcoded. | ||||
|  * Parameters: | ||||
|  *   int serviceType - one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE | ||||
|  *   struct TvService *out - service containing action table to set. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int SetActionTable(int serviceType, struct TvService *out); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceStateTableInit | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Initialize the device state table for  | ||||
|  * 	 this TvDevice, pulling identifier info | ||||
|  *       from the description Document.  Note that  | ||||
|  *       knowledge of the service description is | ||||
|  *       assumed.  State table variables and default | ||||
|  *       values are currently hardcoded in this file | ||||
|  *       rather than being read from service description | ||||
|  *       documents. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   DescDocURL -- The description document URL | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceStateTableInit(char*); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleSubscriptionRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during a subscription request callback.  If the | ||||
|  *       subscription request is for this device and either its | ||||
|  *       control service or picture service, then accept it. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   sr_event -- The subscription request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleGetVarRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during a get variable request callback.  If the | ||||
|  *       request is for this device and either its control service | ||||
|  *       or picture service, then respond with the variable value. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   cgv_event -- The control get variable request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleActionRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during an action request callback.  If the | ||||
|  *       request is for this device and either its control service | ||||
|  *       or picture service, then perform the action and respond. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   ca_event -- The control action request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleActionRequest(struct Upnp_Action_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceCallbackEventHandler | ||||
|  * | ||||
|  * Description:  | ||||
|  *       The callback handler registered with the SDK while registering | ||||
|  *       root device.  Dispatches the request to the appropriate procedure | ||||
|  *       based on the value of EventType. The four requests handled by the  | ||||
|  *       device are:  | ||||
|  *                   1) Event Subscription requests.   | ||||
|  *                   2) Get Variable requests.  | ||||
|  *                   3) Action requests. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *   EventType -- The type of callback event | ||||
|  *   Event -- Data structure containing event data | ||||
|  *   Cookie -- Optional data specified during callback registration | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceCallbackEventHandler(Upnp_EventType, void*, void*); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetServiceTableVar | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Update the TvDevice service state table, and notify all subscribed  | ||||
|  *       control points of the updated state.  Note that since this function | ||||
|  *       blocks on the mutex TVDevMutex, to avoid a hang this function should  | ||||
|  *       not be called within any other function that currently has this mutex  | ||||
|  *       locked. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   service -- The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE) | ||||
|  *   variable -- The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL, | ||||
|  *                   TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT, | ||||
|  *                   TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS) | ||||
|  *   value -- The string representation of the new value | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*); | ||||
|  | ||||
| //Control Service Actions | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDevicePowerOn | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Turn the power on. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDevicePowerOff | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Turn the power off. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *     | ||||
|  *    IXML_Document * in - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the channel, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *     | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the channel.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the channel.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the volume, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the volume.  | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the volume. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
|  | ||||
| //Picture Service Actions | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the color, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the color. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the color.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the tint, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase tint. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease tint. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * TvDeviceSetContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the contrast, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  ****************************************************************************/ | ||||
| int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  *      Increase the contrast. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *        | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  *      Decrease the contrast. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *           | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the brightness, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   brightness -- The brightness value to change to. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase brightness. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease brightnesss. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString); | ||||
|  | ||||
| int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name, | ||||
| 				  char *web_dir_path, print_string pfun); | ||||
| int TvDeviceStop(void); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
| @@ -1,5 +1,3 @@ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \addtogroup UpnpString | ||||
|  * | ||||
| @@ -17,29 +15,50 @@ | ||||
|  * \brief UpnpString object implementation. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
|  | ||||
| #include "UpnpString.h" | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> /* for calloc(), free() */ | ||||
| #include <string.h> /* for strlen(), strdup() */ | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#define strcasecmp stricmp | ||||
| #else | ||||
| 	/* Other systems have strncasecmp */ | ||||
| #endif | ||||
|  | ||||
| #ifndef UPNP_USE_MSVCPP | ||||
| 	/* VC has strnlen which is already included but with (potentially) different linkage */ | ||||
| 	/* strnlen() is a GNU extension. */ | ||||
| 	#if HAVE_STRNLEN | ||||
| 		extern size_t strnlen(const char *s, size_t maxlen); | ||||
| 	#else /* HAVE_STRNLEN */ | ||||
| 		static size_t strnlen(const char *s, size_t n) | ||||
| 		{ | ||||
| 			const char *p = (const char *)memchr(s, 0, n); | ||||
| 			return p ? p - s : n; | ||||
| 		} | ||||
| 	#endif /* HAVE_STRNLEN */ | ||||
| #endif /* WIN32 */ | ||||
|  | ||||
| /* strndup() is a GNU extension. Other systems must fix it with elif's. */ | ||||
| #ifdef __GNUC__ | ||||
| /* strndup() is a GNU extension. */ | ||||
| #if HAVE_STRNDUP && !defined(WIN32) | ||||
| 	extern char *strndup(__const char *__string, size_t __n); | ||||
| #endif | ||||
| #else /* HAVE_STRNDUP && !defined(WIN32) */ | ||||
| 	static char *strndup(const char *__string, size_t __n) | ||||
| 	{ | ||||
| 		size_t strsize = strnlen(__string, __n); | ||||
| 		char *newstr = (char *)malloc(strsize + 1); | ||||
| 		if (newstr == NULL) | ||||
| 			return NULL; | ||||
|  | ||||
| 		strncpy(newstr, __string, strsize); | ||||
| 		newstr[strsize] = 0; | ||||
|  | ||||
| 		return newstr; | ||||
| 	} | ||||
| #endif /* HAVE_STRNDUP && !defined(WIN32) */ | ||||
|  | ||||
| /*! | ||||
|  * \brief Internal implementation of the class UpnpString. | ||||
| @@ -49,17 +68,16 @@ extern char *strndup(__const char *__string, size_t __n); | ||||
| struct SUpnpString | ||||
| { | ||||
| 	/*! \brief Length of the string. */ | ||||
| 	int m_length; | ||||
| 	size_t m_length; | ||||
| 	/*! \brief Pointer to a dynamically allocated area that holds the NULL | ||||
| 	 * terminated string. */ | ||||
| 	char *m_string; | ||||
| }; | ||||
|  | ||||
|  | ||||
| UpnpString *UpnpString_new() | ||||
| { | ||||
| 	// All bytes are zero, and so is the length of the string. | ||||
| 	struct SUpnpString *p = calloc(1, sizeof (struct SUpnpString)); | ||||
| 	/* All bytes are zero, and so is the length of the string. */ | ||||
| 	struct SUpnpString *p = calloc((size_t)1, sizeof (struct SUpnpString)); | ||||
| 	if (p == NULL) { | ||||
| 		goto error_handler1; | ||||
| 	} | ||||
| @@ -67,29 +85,28 @@ UpnpString *UpnpString_new() | ||||
| 	p->m_length = 0; | ||||
| #endif | ||||
|  | ||||
| 	// This byte is zero, calloc does initialize it. | ||||
| 	p->m_string = calloc(1, 1); | ||||
| 	/* This byte is zero, calloc does initialize it. */ | ||||
| 	p->m_string = calloc((size_t)1, (size_t)1); | ||||
| 	if (p->m_string == NULL) { | ||||
| 		goto error_handler2; | ||||
| 	} | ||||
|  | ||||
| 	return (UpnpString *)p; | ||||
|  | ||||
| 	//free(p->m_string); | ||||
| 	/*free(p->m_string); */ | ||||
| error_handler2: | ||||
| 	free(p); | ||||
| error_handler1: | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_delete(UpnpString *p) | ||||
| { | ||||
| 	struct SUpnpString *q = (struct SUpnpString *)p; | ||||
| 		 | ||||
| 	if (!q) return; | ||||
|  | ||||
| 	q->m_length = 0; | ||||
| 	q->m_length = (size_t)0; | ||||
|  | ||||
| 	free(q->m_string); | ||||
| 	q->m_string = NULL; | ||||
| @@ -97,10 +114,9 @@ void UpnpString_delete(UpnpString *p) | ||||
| 	free(p); | ||||
| } | ||||
|  | ||||
|  | ||||
| UpnpString *UpnpString_dup(const UpnpString *p) | ||||
| { | ||||
| 	struct SUpnpString *q = calloc(1, sizeof (struct SUpnpString)); | ||||
| 	struct SUpnpString *q = calloc((size_t)1, sizeof (struct SUpnpString)); | ||||
| 	if (q == NULL) { | ||||
| 		goto error_handler1; | ||||
| 	} | ||||
| @@ -112,14 +128,13 @@ UpnpString *UpnpString_dup(const UpnpString *p) | ||||
|  | ||||
| 	return (UpnpString *)q; | ||||
|  | ||||
| 	//free(q->m_string); | ||||
| 	/*free(q->m_string); */ | ||||
| error_handler2: | ||||
| 	free(q); | ||||
| error_handler1: | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_assign(UpnpString *p, const UpnpString *q) | ||||
| { | ||||
| 	if (p != q) { | ||||
| @@ -127,13 +142,11 @@ void UpnpString_assign(UpnpString *p, const UpnpString *q) | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| size_t UpnpString_get_Length(const UpnpString *p) | ||||
| { | ||||
| 	return ((struct SUpnpString *)p)->m_length; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_set_Length(UpnpString *p, size_t n) | ||||
| { | ||||
| 	if (((struct SUpnpString *)p)->m_length > n) { | ||||
| @@ -143,13 +156,11 @@ void UpnpString_set_Length(UpnpString *p, size_t n) | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| const char *UpnpString_get_String(const UpnpString *p) | ||||
| { | ||||
| 	return ((struct SUpnpString *)p)->m_string; | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpString_set_String(UpnpString *p, const char *s) | ||||
| { | ||||
| 	char *q = strdup(s); | ||||
| @@ -162,7 +173,6 @@ error_handler1: | ||||
| 	return q != NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpString_set_StringN(UpnpString *p, const char *s, size_t n) | ||||
| { | ||||
| 	char *q = strndup(s, n); | ||||
| @@ -175,15 +185,13 @@ error_handler1: | ||||
| 	return q != NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_clear(UpnpString *p) | ||||
| { | ||||
| 	((struct SUpnpString *)p)->m_length = 0; | ||||
| 	((struct SUpnpString *)p)->m_length = (size_t)0; | ||||
| 	/* No need to realloc now, will do later when needed. */ | ||||
| 	((struct SUpnpString *)p)->m_string[0] = 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpString_cmp(UpnpString *p, UpnpString *q) | ||||
| { | ||||
| 	const char *cp = UpnpString_get_String(p); | ||||
| @@ -192,7 +200,6 @@ int UpnpString_cmp(UpnpString *p, UpnpString *q) | ||||
| 	return strcmp(cp, cq); | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpString_casecmp(UpnpString *p, UpnpString *q) | ||||
| { | ||||
| 	const char *cp = UpnpString_get_String(p); | ||||
| @@ -202,4 +209,3 @@ int UpnpString_casecmp(UpnpString *p, UpnpString *q) | ||||
| } | ||||
|  | ||||
| /* @} UpnpString */ | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -29,21 +29,23 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #include "config.h" | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "ixml.h" | ||||
| #include "upnp.h" | ||||
| #include "upnpdebug.h" | ||||
|  | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| #ifdef DEBUG | ||||
|  | ||||
| /*! Mutex to synchronize all the log file opeartions in the debug mode */ | ||||
| static ithread_mutex_t GlobalDebugMutex; | ||||
| @@ -63,10 +65,6 @@ static const char *errFileName = "IUpnpErrFile.txt"; | ||||
| /*! Name of the info file */ | ||||
| static const char *infoFileName = "IUpnpInfoFile.txt"; | ||||
|  | ||||
|  | ||||
| #ifdef DEBUG | ||||
|  | ||||
|  | ||||
| int UpnpInitLog(void) | ||||
| { | ||||
| 	ithread_mutex_init(&GlobalDebugMutex, NULL); | ||||
| @@ -81,13 +79,11 @@ int UpnpInitLog(void) | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpSetLogLevel(Upnp_LogLevel log_level) | ||||
| { | ||||
| 	g_log_level = log_level; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpCloseLog(void) | ||||
| { | ||||
| 	if (DEBUG_TARGET == 1) { | ||||
| @@ -99,10 +95,7 @@ void UpnpCloseLog(void) | ||||
| 	ithread_mutex_destroy(&GlobalDebugMutex); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpSetLogFileNames( | ||||
| 	const char *ErrFileName, | ||||
| 	const char *InfoFileName) | ||||
| void UpnpSetLogFileNames(const char *ErrFileName, const char *InfoFileName) | ||||
| { | ||||
| 	if (ErrFileName) { | ||||
| 		errFileName = ErrFileName; | ||||
| @@ -112,10 +105,7 @@ void UpnpSetLogFileNames( | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| int DebugAtThisLevel( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	Dbg_Module Module) | ||||
| int DebugAtThisLevel(Upnp_LogLevel DLevel, Dbg_Module Module) | ||||
| { | ||||
| 	int ret = DLevel <= g_log_level; | ||||
| 	ret &= | ||||
| @@ -125,45 +115,37 @@ int DebugAtThisLevel( | ||||
| 	    (Module == GENA && DEBUG_GENA) || | ||||
| 	    (Module == TPOOL && DEBUG_TPOOL) || | ||||
| 	    (Module == MSERV && DEBUG_MSERV) || | ||||
| 		(Module == DOM   && DEBUG_DOM  ) || | ||||
| 		(Module == HTTP  && DEBUG_HTTP ); | ||||
| 	    (Module == DOM && DEBUG_DOM) || (Module == HTTP && DEBUG_HTTP); | ||||
|  | ||||
| 	return ret; | ||||
| 	Module = Module; /* VC complains about this being unreferenced */ | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpPrintf( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| void UpnpPrintf(Upnp_LogLevel DLevel, | ||||
| 		Dbg_Module Module, | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo, | ||||
| 	const char *FmtStr, | ||||
| 	...) | ||||
| 		const char *DbgFileName, int DbgLineNo, const char *FmtStr, ...) | ||||
| { | ||||
| 	va_list ArgList; | ||||
|  | ||||
| 	if (!DebugAtThisLevel(DLevel, Module)) { | ||||
| 	if (!DebugAtThisLevel(DLevel, Module)) | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| 	ithread_mutex_lock(&GlobalDebugMutex); | ||||
| 	va_start(ArgList, FmtStr); | ||||
| 	if (!DEBUG_TARGET) { | ||||
| 		if (DbgFileName) { | ||||
| 		if (DbgFileName) | ||||
| 			UpnpDisplayFileAndLine(stdout, DbgFileName, DbgLineNo); | ||||
| 		} | ||||
| 		vfprintf(stdout, FmtStr, ArgList); | ||||
| 		fflush(stdout); | ||||
| 	} else if (DLevel == 0) { | ||||
| 		if (DbgFileName) { | ||||
| 			UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, DbgLineNo); | ||||
| 		} | ||||
| 		if (DbgFileName) | ||||
| 			UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, | ||||
| 					       DbgLineNo); | ||||
| 		vfprintf(ErrFileHnd, FmtStr, ArgList); | ||||
| 		fflush(ErrFileHnd); | ||||
| 	} else { | ||||
| 		if (DbgFileName) { | ||||
| 			UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, DbgLineNo); | ||||
| 		} | ||||
| 		if (DbgFileName) | ||||
| 			UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, | ||||
| 					       DbgLineNo); | ||||
| 		vfprintf(InfoFileHnd, FmtStr, ArgList); | ||||
| 		fflush(InfoFileHnd); | ||||
| 	} | ||||
| @@ -171,31 +153,23 @@ void UpnpPrintf( | ||||
| 	ithread_mutex_unlock(&GlobalDebugMutex); | ||||
| } | ||||
|  | ||||
|  | ||||
| FILE *GetDebugFile(Upnp_LogLevel DLevel, Dbg_Module Module) | ||||
| { | ||||
| 	FILE *ret; | ||||
|  | ||||
| 	if (!DebugAtThisLevel(DLevel, Module)) { | ||||
| 	if (!DebugAtThisLevel(DLevel, Module)) | ||||
| 		ret = NULL; | ||||
| 	} | ||||
| 	 | ||||
| 	if (!DEBUG_TARGET) { | ||||
| 	if (!DEBUG_TARGET) | ||||
| 		ret = stdout; | ||||
| 	} else if (DLevel == 0) { | ||||
| 	else if (DLevel == 0) | ||||
| 		ret = ErrFileHnd; | ||||
| 	} else { | ||||
| 	else | ||||
| 		ret = InfoFileHnd; | ||||
| 	} | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpDisplayFileAndLine( | ||||
| 	FILE *fd, | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo) | ||||
| void UpnpDisplayFileAndLine(FILE *fd, const char *DbgFileName, int DbgLineNo) | ||||
| { | ||||
| #define NLINES 2 | ||||
| #define MAX_LINE_SIZE 512 | ||||
| @@ -205,10 +179,8 @@ void UpnpDisplayFileAndLine( | ||||
| 	int i; | ||||
|  | ||||
| 	/* Initialize the pointer array */ | ||||
| 	for (i = 0; i < NLINES; i++) { | ||||
| 	for (i = 0; i < NLINES; i++) | ||||
| 		lines[i] = buf[i]; | ||||
| 	} | ||||
|  | ||||
| 	/* Put the debug lines in the buffer */ | ||||
| 	sprintf(buf[0], "DEBUG - THREAD ID: 0x%lX", | ||||
| #ifdef WIN32 | ||||
| @@ -217,35 +189,26 @@ void UpnpDisplayFileAndLine( | ||||
| 		(unsigned long int)ithread_self() | ||||
| #endif | ||||
| 	    ); | ||||
| 	if (DbgFileName) { | ||||
| 		sprintf(buf[1], | ||||
| 			"FILE: %s, LINE: %d", | ||||
| 			DbgFileName, | ||||
| 			DbgLineNo); | ||||
| 	} | ||||
|  | ||||
| 	if (DbgFileName) | ||||
| 		sprintf(buf[1], "FILE: %s, LINE: %d", DbgFileName, DbgLineNo); | ||||
| 	/* Show the lines centered */ | ||||
| 	UpnpDisplayBanner(fd, lines, NLINES, NUMBER_OF_STARS); | ||||
| 	fflush(fd); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpDisplayBanner( | ||||
| 	FILE * fd, | ||||
| 	const char **lines, | ||||
| 	size_t size, | ||||
| 	int starLength) | ||||
| void UpnpDisplayBanner(FILE * fd, | ||||
| 		       const char **lines, size_t size, size_t starLength) | ||||
| { | ||||
| 	int leftMarginLength = starLength / 2 + 1; | ||||
| 	int rightMarginLength = starLength / 2 + 1; | ||||
| 	int i = 0; | ||||
| 	int LineSize = 0; | ||||
| 	int starLengthMinus2 = starLength - 2; | ||||
| 	size_t leftMarginLength = starLength / 2 + 1; | ||||
| 	size_t rightMarginLength = starLength / 2 + 1; | ||||
| 	size_t i = 0; | ||||
| 	size_t LineSize = 0; | ||||
| 	size_t starLengthMinus2 = starLength - 2; | ||||
|  | ||||
| 	char *leftMargin = ( char * )malloc( leftMarginLength ); | ||||
| 	char *rightMargin = ( char * )malloc( rightMarginLength ); | ||||
| 	char *stars = ( char * )malloc( starLength + 1 ); | ||||
| 	char *currentLine = ( char * )malloc( starLength + 1 ); | ||||
| 	char *leftMargin = malloc(leftMarginLength); | ||||
| 	char *rightMargin = malloc(rightMarginLength); | ||||
| 	char *stars = malloc(starLength + 1); | ||||
| 	char *currentLine = malloc(starLength + 1); | ||||
| 	const char *line = NULL; | ||||
|  | ||||
| 	memset(stars, '*', starLength); | ||||
| @@ -264,11 +227,10 @@ void UpnpDisplayBanner( | ||||
| 			line += starLengthMinus2; | ||||
| 		} | ||||
| 		leftMarginLength = (starLengthMinus2 - LineSize) / 2; | ||||
| 		if( LineSize % 2 == 0 ) { | ||||
| 		if (LineSize % 2 == 0) | ||||
| 			rightMarginLength = leftMarginLength; | ||||
| 		} else { | ||||
| 		else | ||||
| 			rightMarginLength = leftMarginLength + 1; | ||||
| 		} | ||||
| 		memset(leftMargin, ' ', leftMarginLength); | ||||
| 		memset(rightMargin, ' ', rightMarginLength); | ||||
| 		leftMargin[leftMarginLength] = 0; | ||||
| @@ -283,46 +245,4 @@ void UpnpDisplayBanner( | ||||
| 	free(leftMargin); | ||||
| } | ||||
|  | ||||
|  | ||||
| void PrintThreadPoolStats( | ||||
| 	ThreadPool *tp,  | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo, | ||||
| 	const char *msg) | ||||
| { | ||||
| 	ThreadPoolStats stats; | ||||
| 	ThreadPoolGetStats(tp, &stats); | ||||
| 	UpnpPrintf(UPNP_INFO, API, DbgFileName, DbgLineNo,  | ||||
| 		"%s\n" | ||||
| 		"High Jobs pending: %d\n" | ||||
| 		"Med Jobs Pending: %d\n" | ||||
| 		"Low Jobs Pending: %d\n" | ||||
| 		"Average wait in High Q in milliseconds: %lf\n" | ||||
| 		"Average wait in Med Q in milliseconds: %lf\n" | ||||
| 		"Average wait in Low Q in milliseconds: %lf\n" | ||||
| 		"Max Threads Used: %d\n" | ||||
| 		"Worker Threads: %d\n" | ||||
| 		"Persistent Threads: %d\n" | ||||
| 		"Idle Threads: %d\n" | ||||
| 		"Total Threads: %d\n" | ||||
| 		"Total Work Time: %lf\n" | ||||
| 		"Total Idle Time: %lf\n", | ||||
| 		msg, | ||||
| 		stats.currentJobsHQ, | ||||
| 		stats.currentJobsMQ, | ||||
| 		stats.currentJobsLQ, | ||||
| 		stats.avgWaitHQ, | ||||
| 		stats.avgWaitMQ, | ||||
| 		stats.avgWaitLQ, | ||||
| 		stats.maxThreads, | ||||
| 		stats.workerThreads, | ||||
| 		stats.persistentThreads, | ||||
| 		stats.idleThreads, | ||||
| 		stats.totalThreads, | ||||
| 		stats.totalWorkTime, | ||||
| 		stats.totalIdleTime); | ||||
| } | ||||
|  | ||||
|  | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -55,6 +56,9 @@ | ||||
| /*! Maximum action header buffer length. */ | ||||
| #define HEADER_LENGTH 2000 | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#define snprintf _snprintf | ||||
| #endif | ||||
|  | ||||
| /*! | ||||
|  * \brief Structure to maintain a error code and string associated with the | ||||
| @@ -119,10 +123,9 @@ struct ErrorString ErrorMessages[] = { | ||||
| 	{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"}, | ||||
| }; | ||||
|  | ||||
|  | ||||
| const char *UpnpGetErrorMessage(int rc) | ||||
| { | ||||
| 	int i; | ||||
| 	size_t i; | ||||
|  | ||||
| 	for (i = 0; i < sizeof (ErrorMessages) / sizeof (ErrorMessages[0]); ++i) { | ||||
| 		if (rc == ErrorMessages[i].rc) { | ||||
| @@ -133,7 +136,6 @@ const char *UpnpGetErrorMessage(int rc) | ||||
| 	return "Unknown error code"; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \todo There is some unnecessary allocation and deallocation going on here | ||||
|  * because of the way resolve_rel_url() was originally written and used. In the | ||||
| @@ -147,21 +149,39 @@ int UpnpResolveURL( | ||||
| 	int ret = UPNP_E_SUCCESS; | ||||
| 	char *tempRel = NULL; | ||||
|  | ||||
| 	if (RelURL == NULL) { | ||||
| 	if (!RelURL) { | ||||
| 		ret = UPNP_E_INVALID_PARAM; | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
|  | ||||
| 	tempRel = resolve_rel_url((char *)BaseURL, (char *)RelURL); | ||||
| 	if (tempRel) { | ||||
| 		strcpy(AbsURL, tempRel); | ||||
| 		free(tempRel); | ||||
| 	} else { | ||||
| 	} else | ||||
| 		ret = UPNP_E_INVALID_URL; | ||||
| 	} | ||||
|  | ||||
| ExitFunction: | ||||
| 	return UPNP_E_SUCCESS; | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpResolveURL2( | ||||
| 	const char *BaseURL, | ||||
| 	const char *RelURL, | ||||
| 	char **AbsURL) | ||||
| { | ||||
| 	int ret = UPNP_E_SUCCESS; | ||||
|  | ||||
| 	if (!RelURL) { | ||||
| 		ret = UPNP_E_INVALID_PARAM; | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
| 	*AbsURL = resolve_rel_url((char *)BaseURL, (char *)RelURL); | ||||
| 	if (!*AbsURL) | ||||
| 		ret = UPNP_E_INVALID_URL; | ||||
|  | ||||
| ExitFunction: | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -204,14 +224,18 @@ static int addToAction( | ||||
| 		} | ||||
|  | ||||
| 		if (response) { | ||||
| 			sprintf(ActBuff, | ||||
| 			rc = snprintf(ActBuff, HEADER_LENGTH, | ||||
| 				"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>", | ||||
| 				ActionName, ServType, ActionName); | ||||
| 		} else { | ||||
| 			sprintf(ActBuff, | ||||
| 			rc = snprintf(ActBuff, HEADER_LENGTH, | ||||
| 				"<u:%s xmlns:u=\"%s\">\r\n</u:%s>", | ||||
| 				ActionName, ServType, ActionName); | ||||
| 		} | ||||
| 		if (rc < 0 || (unsigned int) rc >= HEADER_LENGTH) { | ||||
| 			free(ActBuff); | ||||
| 			return UPNP_E_OUTOF_MEMORY; | ||||
| 		} | ||||
|  | ||||
| 		rc = ixmlParseBufferEx(ActBuff, ActionDoc); | ||||
| 		free(ActBuff); | ||||
| @@ -266,6 +290,7 @@ static IXML_Document *makeAction( | ||||
| 	IXML_Node *node; | ||||
| 	IXML_Element *Ele; | ||||
| 	IXML_Node *Txt = NULL; | ||||
| 	int rc = 0; | ||||
|  | ||||
| 	if (ActionName == NULL || ServType == NULL) { | ||||
| 		return NULL; | ||||
| @@ -277,15 +302,16 @@ static IXML_Document *makeAction( | ||||
| 	} | ||||
|  | ||||
| 	if (response) { | ||||
| 		sprintf(ActBuff, | ||||
| 		rc = snprintf(ActBuff, HEADER_LENGTH, | ||||
| 			"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>", | ||||
| 			ActionName, ServType, ActionName); | ||||
| 	} else { | ||||
| 		sprintf(ActBuff, | ||||
| 		rc = snprintf(ActBuff, HEADER_LENGTH, | ||||
| 			"<u:%s xmlns:u=\"%s\">\r\n</u:%s>", | ||||
| 			ActionName, ServType, ActionName); | ||||
| 	} | ||||
| 	if (ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) { | ||||
| 	if (rc < 0 || (unsigned int) rc >= HEADER_LENGTH || | ||||
| 		ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) { | ||||
| 		free(ActBuff); | ||||
| 		return NULL; | ||||
| 	} | ||||
| @@ -296,7 +322,7 @@ static IXML_Document *makeAction( | ||||
| 	} | ||||
|  | ||||
| 	if (NumArg > 0) { | ||||
| 		//va_start(ArgList, Arg); | ||||
| 		/*va_start(ArgList, Arg); */ | ||||
| 		ArgName = Arg; | ||||
| 		for ( ; ; ) { | ||||
| 			ArgValue = va_arg(ArgList, const char *); | ||||
| @@ -315,7 +341,7 @@ static IXML_Document *makeAction( | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		//va_end(ArgList); | ||||
| 		/*va_end(ArgList); */ | ||||
| 	} | ||||
|  | ||||
| 	return ActionDoc; | ||||
|   | ||||
| @@ -1,33 +1,33 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions are met: | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice, | ||||
|  * this list of conditions and the following disclaimer. | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice, | ||||
|  * this list of conditions and the following disclaimer in the documentation | ||||
|  * and/or other materials provided with the distribution. | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors | ||||
|  * may be used to endorse or promote products derived from this software | ||||
|  * without specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #include "config.h" | ||||
| #if EXCLUDE_GENA == 0 | ||||
| @@ -63,7 +63,7 @@ error_respond( IN SOCKINFO * info, | ||||
|     int major, | ||||
|       minor; | ||||
|  | ||||
|     // retrieve the minor and major version from the GENA request | ||||
|     /* retrieve the minor and major version from the GENA request */ | ||||
|     http_CalcResponseVersion( hmsg->major_version, | ||||
|                               hmsg->minor_version, &major, &minor ); | ||||
|  | ||||
| @@ -90,38 +90,40 @@ genaCallback( IN http_parser_t * parser, | ||||
|               IN http_message_t * request, | ||||
|               INOUT SOCKINFO * info ) | ||||
| { | ||||
|     xboolean found_function = FALSE; | ||||
|     int found_function = FALSE; | ||||
|  | ||||
|     if( request->method == HTTPMETHOD_SUBSCRIBE ) { | ||||
| #ifdef INCLUDE_DEVICE_APIS | ||||
|         found_function = TRUE; | ||||
|         if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL ) { | ||||
|             // renew subscription | ||||
|             /* renew subscription */ | ||||
|             gena_process_subscription_renewal_request | ||||
|             ( info, request ); | ||||
| 	} else { | ||||
|             // subscribe | ||||
|             /* subscribe */ | ||||
|             gena_process_subscription_request( info, request ); | ||||
| 	} | ||||
|         UpnpPrintf( UPNP_ALL, GENA, __FILE__, __LINE__, | ||||
|             "got subscription request\n" ); | ||||
|     } else if( request->method == HTTPMETHOD_UNSUBSCRIBE ) { | ||||
|         found_function = TRUE; | ||||
|         // unsubscribe | ||||
|         /* unsubscribe */ | ||||
|         gena_process_unsubscribe_request( info, request ); | ||||
| #endif | ||||
|     } else if( request->method == HTTPMETHOD_NOTIFY ) { | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
|         found_function = TRUE; | ||||
|         // notify | ||||
|         /* notify */ | ||||
|         gena_process_notification_event( info, request ); | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     if( !found_function ) { | ||||
|             // handle missing functions of device or ctrl pt | ||||
|             /* handle missing functions of device or ctrl pt */ | ||||
|             error_respond( info, HTTP_NOT_IMPLEMENTED, request ); | ||||
|     } | ||||
|     return; | ||||
|     parser = parser; | ||||
| } | ||||
| #endif // EXCLUDE_GENA | ||||
| #endif /* EXCLUDE_GENA */ | ||||
|  | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -51,6 +52,9 @@ | ||||
| #include "uuid.h" | ||||
| #include "upnpapi.h" | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#define snprintf _snprintf | ||||
| #endif | ||||
|  | ||||
| extern ithread_mutex_t GlobalClientSubscribeMutex; | ||||
|  | ||||
| @@ -106,7 +110,7 @@ static void GenaAutoRenewSubscription( | ||||
| 		} | ||||
| 		UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "HANDLE IS VALID"); | ||||
|  | ||||
| 		// make callback | ||||
| 		/* make callback */ | ||||
| 		callback_fun = handle_info->Callback; | ||||
| 		cookie = handle_info->Cookie; | ||||
| 		HandleUnlock(); | ||||
| @@ -142,6 +146,8 @@ static int ScheduleGenaAutoRenew( | ||||
| 	const UpnpString *tmpSID = UpnpClientSubscription_get_SID(sub); | ||||
| 	const UpnpString *tmpEventURL = UpnpClientSubscription_get_EventURL(sub); | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	if (TimeOut == UPNP_INFINITE) { | ||||
| 		return_code = GENA_SUCCESS; | ||||
| 		goto end_function; | ||||
| @@ -152,6 +158,7 @@ static int ScheduleGenaAutoRenew( | ||||
| 		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) { | ||||
| @@ -159,15 +166,17 @@ static int ScheduleGenaAutoRenew( | ||||
| 		return_code = UPNP_E_OUTOF_MEMORY; | ||||
| 		goto end_function; | ||||
| 	} | ||||
| 	memset(RenewEvent, 0, sizeof(upnp_timeout)); | ||||
|  | ||||
| 	// schedule expire event | ||||
| 	/* schedule expire event */ | ||||
| 	RenewEventStruct->ErrCode = UPNP_E_SUCCESS; | ||||
| 	RenewEventStruct->TimeOut = TimeOut; | ||||
| 	strcpy(RenewEventStruct->Sid, UpnpString_get_String(tmpSID)); | ||||
| 	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->EventType=UPNP_EVENT_SUBSCRIPTION_EXPIRE; */ | ||||
| 	RenewEvent->handle = client_handle; | ||||
| 	RenewEvent->Event = RenewEventStruct; | ||||
|  | ||||
| @@ -175,7 +184,7 @@ static int ScheduleGenaAutoRenew( | ||||
| 	TPJobSetFreeFunction(&job, (free_routine)free_upnp_timeout); | ||||
| 	TPJobSetPriority(&job, MED_PRIORITY); | ||||
|  | ||||
| 	// Schedule the job | ||||
| 	/* Schedule the job */ | ||||
| 	return_code = TimerThreadSchedule( | ||||
| 		&gTimerThread, | ||||
| 		TimeOut - AUTO_RENEW_TIME, | ||||
| @@ -215,7 +224,7 @@ static int gena_unsubscribe( | ||||
| 	uri_type dest_url; | ||||
| 	membuffer request; | ||||
|  | ||||
| 	// parse url | ||||
| 	/* parse url */ | ||||
| 	return_code = http_FixStrUrl( | ||||
| 		UpnpString_get_String(url), | ||||
| 		UpnpString_get_Length(url), | ||||
| @@ -224,7 +233,7 @@ static int gena_unsubscribe( | ||||
| 		return return_code; | ||||
| 	} | ||||
|  | ||||
| 	// make request msg | ||||
| 	/* make request msg */ | ||||
| 	membuffer_init(&request); | ||||
| 	request.size_inc = 30; | ||||
| 	return_code = http_MakeMessage( | ||||
| @@ -233,14 +242,14 @@ static int gena_unsubscribe( | ||||
| 		HTTPMETHOD_UNSUBSCRIBE, &dest_url, | ||||
| 		"SID: ", UpnpString_get_String(sid)); | ||||
|  | ||||
| 	// Not able to make the message so destroy the existing buffer | ||||
| 	/* Not able to make the message so destroy the existing buffer */ | ||||
| 	if (return_code != 0) { | ||||
| 		membuffer_destroy(&request); | ||||
|  | ||||
| 		return return_code; | ||||
| 	} | ||||
|  | ||||
| 	// send request and get reply | ||||
| 	/* send request and get reply */ | ||||
| 	return_code = http_RequestAndResponse( | ||||
| 		&dest_url, request.buf, request.length, | ||||
| 		HTTPMETHOD_UNSUBSCRIBE, HTTP_DEFAULT_TIMEOUT, response); | ||||
| @@ -283,22 +292,27 @@ static int gena_subscribe( | ||||
| 	membuffer request; | ||||
| 	uri_type dest_url; | ||||
| 	http_parser_t response; | ||||
| 	int rc = 0; | ||||
|  | ||||
| 	UpnpString_clear(sid); | ||||
|  | ||||
| 	// request timeout to string | ||||
| 	/* request timeout to string */ | ||||
| 	if (timeout == NULL) { | ||||
| 		timeout = &local_timeout; | ||||
| 	} | ||||
| 	if (*timeout < 0) { | ||||
| 		strcpy(timeout_str, "infinite"); | ||||
| 		memset(timeout_str, 0, sizeof(timeout_str)); | ||||
| 		strncpy(timeout_str, "infinite", sizeof(timeout_str) - 1); | ||||
| 	} else if(*timeout < CP_MINIMUM_SUBSCRIPTION_TIME) { | ||||
| 		sprintf(timeout_str, "%d", CP_MINIMUM_SUBSCRIPTION_TIME); | ||||
| 		rc = snprintf(timeout_str, sizeof(timeout_str), | ||||
| 			"%d", CP_MINIMUM_SUBSCRIPTION_TIME); | ||||
| 	} else { | ||||
| 		sprintf(timeout_str, "%d", *timeout); | ||||
| 		rc = snprintf(timeout_str, sizeof(timeout_str), "%d", *timeout); | ||||
| 	} | ||||
| 	if (rc < 0 || (unsigned int) rc >= sizeof(timeout_str)) | ||||
| 		return UPNP_E_OUTOF_MEMORY; | ||||
|  | ||||
| 	// parse url | ||||
| 	/* parse url */ | ||||
| 	return_code = http_FixStrUrl( | ||||
| 		UpnpString_get_String(url), | ||||
| 		UpnpString_get_Length(url), | ||||
| @@ -307,11 +321,11 @@ static int gena_subscribe( | ||||
| 		return return_code; | ||||
| 	} | ||||
|  | ||||
| 	// make request msg | ||||
| 	/* make request msg */ | ||||
| 	membuffer_init(&request); | ||||
| 	request.size_inc = 30; | ||||
| 	if (renewal_sid) { | ||||
| 		// renew subscription | ||||
| 		/* renew subscription */ | ||||
| 		return_code = http_MakeMessage( | ||||
| 			&request, 1, 1, | ||||
| 			"q" "ssc" "sscc", | ||||
| @@ -319,7 +333,7 @@ static int gena_subscribe( | ||||
| 			"SID: ", UpnpString_get_String(renewal_sid), | ||||
| 			"TIMEOUT: Second-", timeout_str ); | ||||
| 	} else { | ||||
| 		// subscribe | ||||
| 		/* subscribe */ | ||||
| 		if (dest_url.hostport.IPaddress.ss_family == AF_INET6) { | ||||
| 			struct sockaddr_in6* DestAddr6 = (struct sockaddr_in6*)&dest_url.hostport.IPaddress; | ||||
| 			return_code = http_MakeMessage( | ||||
| @@ -346,7 +360,7 @@ static int gena_subscribe( | ||||
| 		return return_code; | ||||
| 	} | ||||
|  | ||||
| 	// send request and get reply | ||||
| 	/* send request and get reply */ | ||||
| 	return_code = http_RequestAndResponse(&dest_url, request.buf, | ||||
| 		request.length, | ||||
| 		HTTPMETHOD_SUBSCRIBE, | ||||
| @@ -365,7 +379,7 @@ static int gena_subscribe( | ||||
| 		return UPNP_E_SUBSCRIBE_UNACCEPTED; | ||||
| 	} | ||||
|  | ||||
| 	// get SID and TIMEOUT | ||||
| 	/* get SID and TIMEOUT */ | ||||
| 	if (httpmsg_find_hdr(&response.msg, HDR_SID, &sid_hdr) == NULL || | ||||
| 	    sid_hdr.length == 0 || | ||||
| 	    httpmsg_find_hdr( &response.msg, HDR_TIMEOUT, &timeout_hdr ) == NULL || | ||||
| @@ -375,10 +389,10 @@ static int gena_subscribe( | ||||
| 		return UPNP_E_BAD_RESPONSE; | ||||
| 	} | ||||
|  | ||||
| 	// save timeout | ||||
| 	/* save timeout */ | ||||
| 	parse_ret = matchstr(timeout_hdr.buf, timeout_hdr.length, "%iSecond-%d%0", timeout); | ||||
| 	if (parse_ret == PARSE_OK) { | ||||
| 		// nothing to do | ||||
| 		/* nothing to do */ | ||||
| 	} else if (memptr_cmp_nocase(&timeout_hdr, "Second-infinite") == 0) { | ||||
| 		*timeout = -1; | ||||
| 	} else { | ||||
| @@ -387,7 +401,7 @@ static int gena_subscribe( | ||||
| 		return UPNP_E_BAD_RESPONSE; | ||||
| 	} | ||||
|  | ||||
| 	// save SID | ||||
| 	/* save SID */ | ||||
| 	UpnpString_set_StringN(sid, sid_hdr.buf, sid_hdr.length); | ||||
| 	if (UpnpString_get_String(sid) == NULL) { | ||||
| 		httpmsg_destroy(&response.msg); | ||||
| @@ -456,7 +470,7 @@ int genaUnSubscribe( | ||||
| 	ClientSubscription *sub_copy = UpnpClientSubscription_new(); | ||||
| 	http_parser_t response; | ||||
|  | ||||
| 	// validate handle and sid | ||||
| 	/* validate handle and sid */ | ||||
| 	HandleLock(); | ||||
| 	if (GetHandleInfo(client_handle, &handle_info) != HND_CLIENT) { | ||||
| 		HandleUnlock(); | ||||
| @@ -512,21 +526,25 @@ int genaSubscribe( | ||||
| 	UpnpString *ActualSID = UpnpString_new(); | ||||
| 	UpnpString *EventURL = UpnpString_new(); | ||||
| 	struct Handle_Info *handle_info; | ||||
| 	int rc = 0; | ||||
|  | ||||
| 	memset(temp_sid, 0, sizeof(temp_sid)); | ||||
| 	memset(temp_sid2, 0, sizeof(temp_sid2)); | ||||
|  | ||||
| 	UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, "GENA SUBSCRIBE BEGIN"); | ||||
|  | ||||
| 	UpnpString_clear(out_sid); | ||||
|  | ||||
| 	HandleReadLock(); | ||||
| 	// validate handle | ||||
| 	/* validate handle */ | ||||
| 	if (GetHandleInfo(client_handle, &handle_info) != HND_CLIENT) { | ||||
| 		HandleUnlock(); | ||||
|  | ||||
| 		return GENA_E_BAD_HANDLE; | ||||
| 		return_code = GENA_E_BAD_HANDLE; | ||||
| 		SubscribeLock(); | ||||
| 		goto error_handler; | ||||
| 	} | ||||
| 	HandleUnlock(); | ||||
|  | ||||
| 	// subscribe | ||||
| 	/* subscribe */ | ||||
| 	SubscribeLock(); | ||||
| 	return_code = gena_subscribe(PublisherURL, TimeOut, NULL, ActualSID); | ||||
| 	HandleLock(); | ||||
| @@ -542,16 +560,20 @@ int genaSubscribe( | ||||
| 		goto error_handler; | ||||
| 	} | ||||
|  | ||||
| 	// generate client SID | ||||
| 	/* generate client SID */ | ||||
| 	uuid_create(&uid ); | ||||
| 	uuid_unpack(&uid, temp_sid); | ||||
| 	sprintf(temp_sid2, "uuid:%s", temp_sid); | ||||
| 	rc = snprintf(temp_sid2, sizeof(temp_sid2), "uuid:%s", temp_sid); | ||||
| 	if (rc < 0 || (unsigned int) rc >= sizeof(temp_sid2)) { | ||||
| 		return_code = UPNP_E_OUTOF_MEMORY; | ||||
| 		goto error_handler; | ||||
| 	} | ||||
| 	UpnpString_set_String(out_sid, temp_sid2); | ||||
|  | ||||
| 	// create event url | ||||
| 	/* create event url */ | ||||
| 	UpnpString_assign(EventURL, PublisherURL); | ||||
|  | ||||
| 	// fill subscription | ||||
| 	/* fill subscription */ | ||||
| 	if (newSubscription == NULL) { | ||||
| 		return_code = UPNP_E_OUTOF_MEMORY; | ||||
| 		goto error_handler; | ||||
| @@ -563,15 +585,14 @@ int genaSubscribe( | ||||
| 	UpnpClientSubscription_set_Next(newSubscription, handle_info->ClientSubList); | ||||
| 	handle_info->ClientSubList = newSubscription; | ||||
|  | ||||
| 	// schedule expiration event | ||||
| 	/* schedule expiration event */ | ||||
| 	return_code = ScheduleGenaAutoRenew(client_handle, *TimeOut, newSubscription); | ||||
|  | ||||
| error_handler: | ||||
| 	if (return_code != UPNP_E_SUCCESS) { | ||||
| 	UpnpString_delete(ActualSID); | ||||
| 	UpnpString_delete(EventURL); | ||||
| 	if (return_code != UPNP_E_SUCCESS) | ||||
| 		UpnpClientSubscription_delete(newSubscription); | ||||
| 	} | ||||
| 	HandleUnlock(); | ||||
| 	SubscribeUnlock(); | ||||
|  | ||||
| @@ -594,7 +615,7 @@ int genaRenewSubscription( | ||||
|  | ||||
| 	HandleLock(); | ||||
|  | ||||
| 	// validate handle and sid | ||||
| 	/* validate handle and sid */ | ||||
| 	if (GetHandleInfo(client_handle, &handle_info) != HND_CLIENT) { | ||||
| 		HandleUnlock(); | ||||
|  | ||||
| @@ -610,7 +631,7 @@ int genaRenewSubscription( | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// remove old events | ||||
| 	/* remove old events */ | ||||
| 	if (TimerThreadRemove( | ||||
| 		&gTimerThread, | ||||
| 		UpnpClientSubscription_get_RenewEventId(sub), | ||||
| @@ -639,17 +660,17 @@ int genaRenewSubscription( | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// we just called GetHandleInfo, so we don't check for return value | ||||
| 	//GetHandleInfo(client_handle, &handle_info); | ||||
| 	/* we just called GetHandleInfo, so we don't check for return value */ | ||||
| 	/*GetHandleInfo(client_handle, &handle_info); */ | ||||
| 	if (return_code != UPNP_E_SUCCESS) { | ||||
| 		// network failure (remove client sub) | ||||
| 		/* network failure (remove client sub) */ | ||||
| 		RemoveClientSubClientSID(&handle_info->ClientSubList, in_sid); | ||||
| 		free_client_subscription(sub_copy); | ||||
| 		HandleUnlock(); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// get subscription | ||||
| 	/* get subscription */ | ||||
| 	sub = GetClientSubClientSID(handle_info->ClientSubList, in_sid); | ||||
| 	if (sub == NULL) { | ||||
| 		free_client_subscription(sub_copy); | ||||
| @@ -658,10 +679,10 @@ int genaRenewSubscription( | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// store actual sid | ||||
| 	/* store actual sid */ | ||||
| 	UpnpClientSubscription_set_ActualSID(sub, ActualSID); | ||||
|  | ||||
| 	// start renew subscription timer | ||||
| 	/* start renew subscription timer */ | ||||
| 	return_code = ScheduleGenaAutoRenew(client_handle, *TimeOut, sub); | ||||
| 	if (return_code != GENA_SUCCESS) { | ||||
| 		RemoveClientSubClientSID( | ||||
| @@ -698,7 +719,7 @@ void gena_process_notification_event( | ||||
| 	nts_hdr; | ||||
| 	memptr seq_hdr; | ||||
|  | ||||
| 	// get SID | ||||
| 	/* get SID */ | ||||
| 	if (httpmsg_find_hdr(event, HDR_SID, &sid_hdr) == NULL) { | ||||
| 		error_respond(info, HTTP_PRECONDITION_FAILED, event); | ||||
| 		goto exit_function; | ||||
| @@ -706,28 +727,28 @@ void gena_process_notification_event( | ||||
| 	sid.buff = sid_hdr.buf; | ||||
| 	sid.size = sid_hdr.length; | ||||
|  | ||||
| 	// get event key | ||||
| 	/* get event key */ | ||||
| 	if (httpmsg_find_hdr(event, HDR_SEQ, &seq_hdr) == NULL || | ||||
| 	    matchstr(seq_hdr.buf, seq_hdr.length, "%d%0", &eventKey) != PARSE_OK) { | ||||
| 		error_respond( info, HTTP_BAD_REQUEST, event ); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// get NT and NTS headers | ||||
| 	/* get NT and NTS headers */ | ||||
| 	if (httpmsg_find_hdr(event, HDR_NT, &nt_hdr) == NULL || | ||||
| 	    httpmsg_find_hdr(event, HDR_NTS, &nts_hdr) == NULL) { | ||||
| 		error_respond( info, HTTP_BAD_REQUEST, event ); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// verify NT and NTS headers | ||||
| 	/* verify NT and NTS headers */ | ||||
| 	if (memptr_cmp(&nt_hdr, "upnp:event") != 0 || | ||||
| 	    memptr_cmp(&nts_hdr, "upnp:propchange") != 0) { | ||||
| 		error_respond(info, HTTP_PRECONDITION_FAILED, event); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// parse the content (should be XML) | ||||
| 	/* parse the content (should be XML) */ | ||||
| 	if (!has_xml_content_type(event) || | ||||
| 	    event->msg.length == 0 || | ||||
| 	    ixmlParseBufferEx(event->entity.buf, &ChangedVars) != IXML_SUCCESS) { | ||||
| @@ -737,28 +758,28 @@ void gena_process_notification_event( | ||||
|  | ||||
| 	HandleLock(); | ||||
|  | ||||
| 	// get client info | ||||
| 	/* get client info */ | ||||
| 	if (GetClientHandleInfo(&client_handle, &handle_info) != HND_CLIENT) { | ||||
| 		error_respond(info, HTTP_PRECONDITION_FAILED, event); | ||||
| 		HandleUnlock(); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// get subscription based on SID | ||||
| 	/* get subscription based on SID */ | ||||
| 	subscription = GetClientSubActualSID(handle_info->ClientSubList, &sid); | ||||
| 	if (subscription == NULL) { | ||||
| 		if (eventKey == 0) { | ||||
| 			// wait until we've finished processing a subscription  | ||||
| 			//   (if we are in the middle) | ||||
| 			// this is to avoid mistakenly rejecting the first event if we  | ||||
| 			//   receive it before the subscription response | ||||
| 			/* wait until we've finished processing a subscription  */ | ||||
| 			/*   (if we are in the middle) */ | ||||
| 			/* this is to avoid mistakenly rejecting the first event if we  */ | ||||
| 			/*   receive it before the subscription response */ | ||||
| 			HandleUnlock(); | ||||
|  | ||||
| 			// try and get Subscription Lock  | ||||
| 			//   (in case we are in the process of subscribing) | ||||
| 			/* try and get Subscription Lock  */ | ||||
| 			/*   (in case we are in the process of subscribing) */ | ||||
| 			SubscribeLock(); | ||||
|  | ||||
| 			// get HandleLock again | ||||
| 			/* get HandleLock again */ | ||||
| 			HandleLock(); | ||||
|  | ||||
| 			if (GetClientHandleInfo(&client_handle, &handle_info) != HND_CLIENT) { | ||||
| @@ -784,25 +805,27 @@ void gena_process_notification_event( | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// success | ||||
| 	/* success */ | ||||
| 	error_respond(info, HTTP_OK, event); | ||||
|  | ||||
| 	// fill event struct | ||||
| 	/* fill event struct */ | ||||
| 	tmpSID = UpnpClientSubscription_get_SID(subscription); | ||||
| 	strcpy(event_struct.Sid, UpnpString_get_String(tmpSID)); | ||||
| 	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 | ||||
| 	/* copy callback */ | ||||
| 	callback = handle_info->Callback; | ||||
| 	cookie = handle_info->Cookie; | ||||
|  | ||||
| 	HandleUnlock(); | ||||
|  | ||||
| 	// make callback with event struct | ||||
| 	// In future, should find a way of mainting | ||||
| 	// that the handle is not unregistered in the middle of a | ||||
| 	// callback | ||||
| 	/* make callback with event struct */ | ||||
| 	/* 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); | ||||
|  | ||||
| exit_function: | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -29,19 +30,15 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
|  | ||||
| #if EXCLUDE_GENA == 0 | ||||
| #ifdef INCLUDE_DEVICE_APIS | ||||
|  | ||||
|  | ||||
| #include "gena.h" | ||||
| #include "httpparser.h" | ||||
| #include "httpreadwrite.h" | ||||
| @@ -53,6 +50,9 @@ | ||||
| #include "upnpapi.h" | ||||
| #include "uuid.h" | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#define snprintf _snprintf | ||||
| #endif | ||||
|  | ||||
| /*! | ||||
|  * \brief Unregisters a device. | ||||
| @@ -81,7 +81,6 @@ int genaUnregisterDevice( | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Generates XML property set for notifications. | ||||
|  * | ||||
| @@ -102,7 +101,7 @@ static int GeneratePropertySet( | ||||
| { | ||||
| 	char *buffer; | ||||
| 	int counter = 0; | ||||
| 	int size = 0; | ||||
| 	size_t size = 0; | ||||
| 	int temp_counter = 0; | ||||
|  | ||||
| 	/*size += strlen(XML_VERSION);*/ | ||||
| @@ -116,9 +115,8 @@ static int GeneratePropertySet( | ||||
| 	} | ||||
|  | ||||
| 	buffer = (char *)malloc(size + 1); | ||||
| 	if (buffer == NULL) { | ||||
| 	if (buffer == NULL) | ||||
| 		return UPNP_E_OUTOF_MEMORY; | ||||
| 	} | ||||
| 	memset(buffer, 0, size + 1); | ||||
| 	/* | ||||
| 	strcpy(buffer,XML_VERSION); | ||||
| @@ -140,7 +138,6 @@ static int GeneratePropertySet( | ||||
| 	return XML_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Frees memory used in notify_threads if the reference count is 0, | ||||
|  * otherwise decrements the refrence count. | ||||
| @@ -160,7 +157,6 @@ static void free_notify_struct( | ||||
| 	free(input); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sends the notify message and returns a reply. | ||||
|  * | ||||
| @@ -179,12 +175,13 @@ static UPNP_INLINE int notify_send_and_recv( | ||||
| 	http_parser_t *response) | ||||
| { | ||||
| 	uri_type url; | ||||
| 	int conn_fd; | ||||
| 	SOCKET conn_fd; | ||||
| 	membuffer start_msg; | ||||
| 	int ret_code; | ||||
| 	int err_code; | ||||
| 	int timeout; | ||||
| 	SOCKINFO info; | ||||
| 	const char *CRLF = "\r\n"; | ||||
|  | ||||
| 	/* connect */ | ||||
| 	UpnpPrintf(UPNP_ALL, GENA, __FILE__, __LINE__, | ||||
| @@ -193,16 +190,12 @@ static UPNP_INLINE int notify_send_and_recv( | ||||
| 		destination_url->hostport.text.buff); | ||||
|  | ||||
| 	conn_fd = http_Connect(destination_url, &url); | ||||
| 	if (conn_fd < 0) { | ||||
| 	if (conn_fd < 0) | ||||
| 		/* return UPNP error */ | ||||
|  | ||||
| 		return conn_fd; | ||||
| 	} | ||||
|  | ||||
| 		return UPNP_E_SOCKET_CONNECT; | ||||
| 	ret_code = sock_init(&info, conn_fd); | ||||
| 	if (ret_code) { | ||||
| 		sock_destroy(&info, SD_BOTH); | ||||
|  | ||||
| 		return ret_code; | ||||
| 	} | ||||
| 	/* make start line and HOST header */ | ||||
| @@ -214,35 +207,29 @@ static UPNP_INLINE int notify_send_and_recv( | ||||
| 			mid_msg->buf) != 0) { | ||||
| 		membuffer_destroy(&start_msg); | ||||
| 		sock_destroy(&info, SD_BOTH); | ||||
|  | ||||
| 		return UPNP_E_OUTOF_MEMORY; | ||||
| 	} | ||||
|  | ||||
| 	timeout = HTTP_DEFAULT_TIMEOUT; | ||||
|  | ||||
| 	timeout = GENA_NOTIFICATION_SENDING_TIMEOUT; | ||||
| 	/* send msg (note: end of notification will contain "\r\n" twice) */ | ||||
| 	ret_code = http_SendMessage(&info, &timeout, | ||||
| 		"bbb", | ||||
| 		start_msg.buf, start_msg.length, | ||||
| 		propertySet, strlen(propertySet), | ||||
| 		"\r\n", 2); | ||||
| 		CRLF, strlen(CRLF)); | ||||
| 	if (ret_code) { | ||||
| 		membuffer_destroy(&start_msg); | ||||
| 		sock_destroy(&info, SD_BOTH); | ||||
|  | ||||
| 		return ret_code; | ||||
| 	} | ||||
|  | ||||
| 	timeout = GENA_NOTIFICATION_ANSWERING_TIMEOUT; | ||||
| 	ret_code = http_RecvMessage(&info, response, | ||||
| 		HTTPMETHOD_NOTIFY, &timeout, &err_code); | ||||
| 	if (ret_code) { | ||||
| 		membuffer_destroy(&start_msg); | ||||
| 		sock_destroy(&info, SD_BOTH); | ||||
| 		httpmsg_destroy(&response->msg); | ||||
|  | ||||
| 		return ret_code; | ||||
| 	} | ||||
|  | ||||
| 	/* should shutdown completely when closing socket */ | ||||
| 	sock_destroy(&info, SD_BOTH); | ||||
| 	membuffer_destroy(&start_msg); | ||||
| @@ -250,7 +237,6 @@ static UPNP_INLINE int notify_send_and_recv( | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Function to Notify a particular subscription of a particular event. | ||||
|  * | ||||
| @@ -270,7 +256,7 @@ static int genaNotify( | ||||
| 	/*! [in] subscription to be Notified, assumes this is valid for life of function. */ | ||||
| 	subscription *sub) | ||||
| { | ||||
|     int i; | ||||
| 	size_t i; | ||||
| 	membuffer mid_msg; | ||||
| 	membuffer endmsg; | ||||
| 	uri_type *url; | ||||
| @@ -278,11 +264,9 @@ static int genaNotify( | ||||
| 	int return_code = -1; | ||||
|  | ||||
| 	membuffer_init(&mid_msg); | ||||
|  | ||||
|     // make 'end' msg (the part that won't vary with the destination) | ||||
| 	/* make 'end' msg (the part that won't vary with the destination) */ | ||||
| 	endmsg.size_inc = 30; | ||||
|     if( http_MakeMessage( | ||||
|         &mid_msg, 1, 1, | ||||
| 	if (http_MakeMessage(&mid_msg, 1, 1, | ||||
| 			     "s" "ssc" "sdcc", | ||||
| 			     headers, | ||||
| 			     "SID: ", sub->sid, | ||||
| @@ -290,31 +274,25 @@ static int genaNotify( | ||||
| 		membuffer_destroy(&mid_msg); | ||||
| 		return UPNP_E_OUTOF_MEMORY; | ||||
| 	} | ||||
|     // send a notify to each url until one goes thru | ||||
| 	/* send a notify to each url until one goes thru */ | ||||
| 	for (i = 0; i < sub->DeliveryURLs.size; i++) { | ||||
| 		url = &sub->DeliveryURLs.parsedURLs[i]; | ||||
|  | ||||
|         if( ( return_code = notify_send_and_recv( url, | ||||
|                                                   &mid_msg, propertySet, | ||||
|                                                   &response ) ) == | ||||
|             UPNP_E_SUCCESS ) { | ||||
| 		return_code = notify_send_and_recv( | ||||
| 			url, &mid_msg, propertySet, &response); | ||||
| 		if (return_code == UPNP_E_SUCCESS) | ||||
| 			break; | ||||
| 	} | ||||
|     } | ||||
|  | ||||
| 	membuffer_destroy(&mid_msg); | ||||
|  | ||||
| 	if (return_code == UPNP_E_SUCCESS) { | ||||
|         if( response.msg.status_code == HTTP_OK ) { | ||||
| 		if (response.msg.status_code == HTTP_OK) | ||||
| 			return_code = GENA_SUCCESS; | ||||
|         } else { | ||||
|             if( response.msg.status_code == HTTP_PRECONDITION_FAILED ) { | ||||
|                 //Invalid SID gets removed | ||||
| 		else { | ||||
| 			if (response.msg.status_code == HTTP_PRECONDITION_FAILED) | ||||
| 				/*Invalid SID gets removed */ | ||||
| 				return_code = GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB; | ||||
|             } else { | ||||
| 			else | ||||
| 				return_code = GENA_E_NOTIFY_UNACCEPTED; | ||||
| 		} | ||||
|         } | ||||
| 		httpmsg_destroy(&response.msg); | ||||
| 	} | ||||
|  | ||||
| @@ -342,13 +320,15 @@ static void genaNotifyThread( | ||||
| 	struct Handle_Info *handle_info; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	/* This should be a HandleLock and not a HandleReadLock otherwise if there | ||||
| 	 * is a lot of notifications, then multiple threads will acquire a read | ||||
| 	 * lock and the thread which sends the notification will be blocked forever | ||||
| 	 * on the HandleLock at the end of this function. */ | ||||
|     //HandleReadLock(); | ||||
| 	/*HandleReadLock(); */ | ||||
| 	HandleLock(); | ||||
|     //validate context | ||||
| 	/* validate context */ | ||||
|  | ||||
| 	if (GetHandleInfo(in->device_handle, &handle_info) != HND_DEVICE) { | ||||
| 		free_notify_struct(in); | ||||
| @@ -356,31 +336,25 @@ static void genaNotifyThread( | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
|     if( ( ( service = FindServiceId( &handle_info->ServiceTable, | ||||
|                                      in->servId, in->UDN ) ) == NULL ) | ||||
|         || ( !service->active ) | ||||
|         || ( ( sub = GetSubscriptionSID( in->sid, service ) ) == NULL ) | ||||
|         || ( ( copy_subscription( sub, &sub_copy ) != HTTP_SUCCESS ) ) ) { | ||||
| 	if (!(service = FindServiceId(&handle_info->ServiceTable, in->servId, in->UDN)) || | ||||
| 	    !service->active || | ||||
| 	    !(sub = GetSubscriptionSID(in->sid, service)) || | ||||
| 	    copy_subscription(sub, &sub_copy) != HTTP_SUCCESS) { | ||||
| 		free_notify_struct(in); | ||||
| 		HandleUnlock(); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| #ifdef UPNP_ENABLE_NOTIFICATION_REORDERING | ||||
|     //If the event is out of order push it back to the job queue | ||||
| 	/*If the event is out of order push it back to the job queue */ | ||||
| 	if (in->eventKey != sub->ToSendEventKey) { | ||||
|  | ||||
| 		TPJobInit(&job, (start_routine) genaNotifyThread, input); | ||||
| 		TPJobSetFreeFunction(&job, (free_function) free_notify_struct); | ||||
| 		TPJobSetPriority(&job, MED_PRIORITY); | ||||
|  | ||||
| 		/* Sleep a little before creating another thread otherwise if there is | ||||
| 		 * a lot of notifications to send, the device will take 100% of the CPU | ||||
| 		 * to create threads and push them back to the job queue. */ | ||||
| 		imillisleep(1); | ||||
|  | ||||
| 		ThreadPoolAdd(&gSendThreadPool, &job, NULL); | ||||
|  | ||||
| 		freeSubscription(&sub_copy); | ||||
| 		HandleUnlock(); | ||||
| 		return; | ||||
| @@ -389,38 +363,31 @@ static void genaNotifyThread( | ||||
|  | ||||
| 	HandleUnlock(); | ||||
|  | ||||
|     //send the notify | ||||
| 	/* send the notify */ | ||||
| 	return_code = genaNotify(in->headers, in->propertySet, &sub_copy); | ||||
|  | ||||
| 	freeSubscription(&sub_copy); | ||||
|  | ||||
| 	HandleLock(); | ||||
|  | ||||
| 	if (GetHandleInfo(in->device_handle, &handle_info) != HND_DEVICE) { | ||||
| 		free_notify_struct(in); | ||||
| 		HandleUnlock(); | ||||
| 		return; | ||||
| 	} | ||||
|     //validate context | ||||
|     if( ( ( service = FindServiceId( &handle_info->ServiceTable, | ||||
|                                      in->servId, in->UDN ) ) == NULL ) | ||||
|         || ( !service->active ) | ||||
|         || ( ( sub = GetSubscriptionSID( in->sid, service ) ) == NULL ) ) { | ||||
| 	/* validate context */ | ||||
| 	if (!(service = FindServiceId(&handle_info->ServiceTable, in->servId, in->UDN)) || | ||||
| 	    !service->active || | ||||
| 	    !(sub = GetSubscriptionSID(in->sid, service))) { | ||||
| 		free_notify_struct(in); | ||||
| 		HandleUnlock(); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	sub->ToSendEventKey++; | ||||
|  | ||||
|     if( sub->ToSendEventKey < 0 )   //wrap to 1 for overflow | ||||
| 	if (sub->ToSendEventKey < 0) | ||||
| 		/* wrap to 1 for overflow */ | ||||
| 		sub->ToSendEventKey = 1; | ||||
|  | ||||
|     if( return_code == GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB ) { | ||||
| 	if (return_code == GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB) | ||||
| 		RemoveSubscriptionSID(in->sid, service); | ||||
|     } | ||||
|  | ||||
| 	free_notify_struct(in); | ||||
|  | ||||
| 	HandleUnlock(); | ||||
| } | ||||
|  | ||||
| @@ -448,8 +415,9 @@ static char *AllocGenaHeaders( | ||||
| 	static const char *HEADER_LINE_4 = | ||||
| 		"NTS: upnp:propchange\r\n"; | ||||
| 	char *headers = NULL; | ||||
| 	int headers_size = 0; | ||||
| 	size_t headers_size = 0; | ||||
| 	int line = 0; | ||||
| 	int rc = 0; | ||||
|  | ||||
| 	headers_size = | ||||
| 		strlen(HEADER_LINE_1 ) + | ||||
| @@ -462,7 +430,7 @@ static char *AllocGenaHeaders( | ||||
| 		line = __LINE__; | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
| 	sprintf(headers, "%s%s%"PRIzu"%s%s%s", | ||||
| 	rc = snprintf(headers, headers_size, "%s%s%"PRIzu"%s%s%s", | ||||
| 		HEADER_LINE_1, | ||||
| 		HEADER_LINE_2A, | ||||
| 		strlen(propertySet) + 1, | ||||
| @@ -471,7 +439,7 @@ static char *AllocGenaHeaders( | ||||
| 		HEADER_LINE_4); | ||||
|  | ||||
| ExitFunction: | ||||
| 	if (headers == NULL) { | ||||
| 	if (headers == NULL || rc < 0 || (unsigned int) rc >= headers_size) { | ||||
| 		UpnpPrintf(UPNP_ALL, GENA, __FILE__, line, | ||||
| 			"AllocGenaHeaders(): Error UPNP_E_OUTOF_MEMORY\n"); | ||||
| 	} | ||||
| @@ -503,6 +471,8 @@ int genaInitNotify( | ||||
| 	struct Handle_Info *handle_info; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 		"GENA BEGIN INITIAL NOTIFY"); | ||||
|  | ||||
| @@ -528,8 +498,10 @@ int genaInitNotify( | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
|  | ||||
| 	strcpy(UDN_copy, UDN); | ||||
| 	strcpy(servId_copy, servId); | ||||
| 	memset(UDN_copy, 0, strlen(UDN) + 1); | ||||
| 	strncpy(UDN_copy, UDN, strlen(UDN)); | ||||
| 	memset(servId_copy, 0, strlen(servId) + 1); | ||||
| 	strncpy(servId_copy, servId, strlen(servId)); | ||||
|  | ||||
| 	HandleLock(); | ||||
|  | ||||
| @@ -593,7 +565,9 @@ int genaInitNotify( | ||||
| 		thread_struct->UDN = UDN_copy; | ||||
| 		thread_struct->headers = headers; | ||||
| 		thread_struct->propertySet = propertySet; | ||||
| 		strcpy(thread_struct->sid, sid); | ||||
| 		memset(thread_struct->sid, 0, sizeof(thread_struct->sid)); | ||||
| 		strncpy(thread_struct->sid, sid, | ||||
| 			sizeof(thread_struct->sid) - 1); | ||||
| 		thread_struct->eventKey = sub->eventKey++; | ||||
| 		thread_struct->reference_count = reference_count; | ||||
| 		thread_struct->device_handle = device_handle; | ||||
| @@ -656,6 +630,8 @@ int genaInitNotifyExt( | ||||
| 	struct Handle_Info *handle_info; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 		"GENA BEGIN INITIAL NOTIFY EXT"); | ||||
| 	 | ||||
| @@ -681,8 +657,10 @@ int genaInitNotifyExt( | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
|  | ||||
| 	strcpy(UDN_copy, UDN); | ||||
| 	strcpy(servId_copy, servId); | ||||
| 	memset(UDN_copy, 0, strlen(UDN) + 1); | ||||
| 	strncpy(UDN_copy, UDN, strlen(UDN)); | ||||
| 	memset(servId_copy, 0, strlen(servId) + 1); | ||||
| 	strncpy(servId_copy, servId, strlen(servId)); | ||||
|  | ||||
| 	HandleLock(); | ||||
|  | ||||
| @@ -747,7 +725,9 @@ int genaInitNotifyExt( | ||||
| 		thread_struct->UDN = UDN_copy; | ||||
| 		thread_struct->headers = headers; | ||||
| 		thread_struct->propertySet = propertySet; | ||||
| 		strcpy(thread_struct->sid, sid); | ||||
| 		memset(thread_struct->sid, 0, sizeof(thread_struct->sid)); | ||||
| 		strncpy(thread_struct->sid, sid, | ||||
| 			sizeof(thread_struct->sid) - 1); | ||||
| 		thread_struct->eventKey = sub->eventKey++; | ||||
| 		thread_struct->reference_count = reference_count; | ||||
| 		thread_struct->device_handle = device_handle; | ||||
| @@ -809,6 +789,8 @@ int genaNotifyAllExt( | ||||
| 	struct Handle_Info *handle_info; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 		"GENA BEGIN NOTIFY ALL EXT"); | ||||
|  | ||||
| @@ -834,8 +816,10 @@ int genaNotifyAllExt( | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
|  | ||||
| 	strcpy(UDN_copy, UDN); | ||||
| 	strcpy(servId_copy, servId); | ||||
| 	memset(UDN_copy, 0, strlen(UDN) + 1); | ||||
| 	strncpy(UDN_copy, UDN, strlen(UDN)); | ||||
| 	memset(servId_copy, 0, strlen(servId) + 1); | ||||
| 	strncpy(servId_copy, servId, strlen(servId)); | ||||
|  | ||||
| 	propertySet = ixmlPrintNode((IXML_Node *)PropSet); | ||||
| 	if (propertySet == NULL) { | ||||
| @@ -877,7 +861,10 @@ int genaNotifyAllExt( | ||||
| 				thread_struct->servId = servId_copy; | ||||
| 				thread_struct->headers = headers; | ||||
| 				thread_struct->propertySet = propertySet; | ||||
| 				strcpy(thread_struct->sid, finger->sid); | ||||
| 				memset(thread_struct->sid, 0, | ||||
| 					sizeof(thread_struct->sid)); | ||||
| 				strncpy(thread_struct->sid, finger->sid, | ||||
| 					sizeof(thread_struct->sid) - 1); | ||||
| 				thread_struct->eventKey = finger->eventKey++; | ||||
| 				thread_struct->device_handle = device_handle; | ||||
| 				/* if overflow, wrap to 1 */ | ||||
| @@ -948,6 +935,8 @@ int genaNotifyAll( | ||||
| 	struct Handle_Info *handle_info; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 		"GENA BEGIN NOTIFY ALL"); | ||||
|  | ||||
| @@ -973,8 +962,10 @@ int genaNotifyAll( | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
|  | ||||
| 	strcpy(UDN_copy, UDN); | ||||
| 	strcpy(servId_copy, servId); | ||||
| 	memset(UDN_copy, 0, strlen(UDN) + 1); | ||||
| 	strncpy(UDN_copy, UDN, strlen(UDN)); | ||||
| 	memset(servId_copy, 0, strlen(servId) + 1); | ||||
| 	strncpy(servId_copy, servId, strlen(servId)); | ||||
|  | ||||
| 	ret = GeneratePropertySet(VarNames, VarValues, var_count, &propertySet); | ||||
| 	if (ret != XML_SUCCESS) { | ||||
| @@ -1015,7 +1006,10 @@ int genaNotifyAll( | ||||
| 				thread_struct->servId = servId_copy; | ||||
| 				thread_struct->headers = headers; | ||||
| 				thread_struct->propertySet = propertySet; | ||||
| 				strcpy(thread_struct->sid, finger->sid); | ||||
| 				memset(thread_struct->sid, 0, | ||||
| 					sizeof(thread_struct->sid)); | ||||
| 				strncpy(thread_struct->sid, finger->sid, | ||||
| 					sizeof(thread_struct->sid) - 1); | ||||
| 				thread_struct->eventKey = finger->eventKey++; | ||||
| 				thread_struct->device_handle = device_handle; | ||||
| 				/* if overflow, wrap to 1 */ | ||||
| @@ -1085,14 +1079,22 @@ static int respond_ok( | ||||
|     int return_code; | ||||
|     char timeout_str[100]; | ||||
|     int upnp_timeout = UPNP_TIMEOUT; | ||||
|     int rc = 0; | ||||
|  | ||||
|     http_CalcResponseVersion( request->major_version, | ||||
|                               request->minor_version, &major, &minor ); | ||||
|  | ||||
|     if( time_out >= 0 ) { | ||||
|         sprintf( timeout_str, "TIMEOUT: Second-%d", time_out ); | ||||
|         rc = snprintf( timeout_str, sizeof ( timeout_str ), | ||||
|                        "TIMEOUT: Second-%d", time_out ); | ||||
|     } else { | ||||
|         strcpy( timeout_str, "TIMEOUT: Second-infinite" ); | ||||
|         memset( timeout_str, 0, sizeof( timeout_str ) ); | ||||
|         strncpy( timeout_str, "TIMEOUT: Second-infinite", | ||||
|                  sizeof ( timeout_str ) - 1); | ||||
|     } | ||||
|     if (rc < 0 || (unsigned int) rc >= sizeof ( timeout_str ) ) { | ||||
|         error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request );  | ||||
|         return UPNP_E_OUTOF_MEMORY; | ||||
|     } | ||||
|  | ||||
|     membuffer_init( &response ); | ||||
| @@ -1135,8 +1137,8 @@ static int create_url_list( | ||||
| 	/*! [out] . */ | ||||
| 	URL_list *out) | ||||
| { | ||||
|     int URLcount = 0; | ||||
|     int i; | ||||
|     size_t URLcount = 0; | ||||
|     size_t i; | ||||
|     int return_code = 0; | ||||
|     uri_type temp; | ||||
|     token urls; | ||||
| @@ -1166,10 +1168,9 @@ static int create_url_list( | ||||
|     } | ||||
|  | ||||
|     if( URLcount > 0 ) { | ||||
|         out->URLs = ( char * )malloc( URLS->size + 1 ); | ||||
|         out->parsedURLs = | ||||
|             ( uri_type * ) malloc( sizeof( uri_type ) * URLcount ); | ||||
|         if( ( out->URLs == NULL ) || ( out->parsedURLs == NULL ) ) { | ||||
|         out->URLs = malloc(URLS->size + 1); | ||||
|         out->parsedURLs = malloc(sizeof(uri_type) * URLcount); | ||||
|         if (!out->URLs || !out->parsedURLs) { | ||||
|             free(out->URLs); | ||||
|             free(out->parsedURLs); | ||||
|             out->URLs = NULL; | ||||
| @@ -1202,7 +1203,7 @@ static int create_url_list( | ||||
|     } | ||||
|     out->size = URLcount; | ||||
|  | ||||
|     return URLcount; | ||||
|     return (int)URLcount; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -1225,6 +1226,9 @@ void gena_process_subscription_request( | ||||
| 	char *event_url_path = NULL; | ||||
| 	memptr callback_hdr; | ||||
| 	memptr timeout_hdr; | ||||
| 	int rc = 0; | ||||
|  | ||||
| 	memset(&request_struct, 0, sizeof(request_struct)); | ||||
|  | ||||
| 	UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 		"Subscription Request Received:\n"); | ||||
| @@ -1234,20 +1238,20 @@ void gena_process_subscription_request( | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// check NT header | ||||
| 	// Windows Millenium Interoperability: | ||||
| 	// we accept either upnp:event, or upnp:propchange for the NT header | ||||
| 	/* check NT header */ | ||||
| 	/* Windows Millenium Interoperability: */ | ||||
| 	/* we accept either upnp:event, or upnp:propchange for the NT header */ | ||||
| 	if (memptr_cmp_nocase(&nt_hdr, "upnp:event") != 0) { | ||||
| 		error_respond(info, HTTP_PRECONDITION_FAILED, request); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
|  | ||||
| 	// if a SID is present then the we have a bad request "incompatible headers" | ||||
| 	/* if a SID is present then the we have a bad request "incompatible headers" */ | ||||
| 	if (httpmsg_find_hdr(request, HDR_SID, NULL) != NULL) { | ||||
| 		error_respond(info, HTTP_BAD_REQUEST, request); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
| 	// look up service by eventURL | ||||
| 	/* look up service by eventURL */ | ||||
| 	event_url_path = str_alloc(request->uri.pathquery.buff, request->uri.pathquery.size); | ||||
| 	if (event_url_path == NULL) { | ||||
| 		error_respond(info, HTTP_INTERNAL_SERVER_ERROR, request); | ||||
| @@ -1260,7 +1264,7 @@ void gena_process_subscription_request( | ||||
|  | ||||
| 	HandleLock(); | ||||
|  | ||||
| 	// CURRENTLY, ONLY ONE DEVICE | ||||
| 	/* CURRENTLY, ONLY ONE DEVICE */ | ||||
| 	if (GetDeviceHandleInfo(info->foreign_sockaddr.ss_family ,  | ||||
| 	    &device_handle, &handle_info) != HND_DEVICE) { | ||||
| 		free(event_url_path); | ||||
| @@ -1283,14 +1287,14 @@ void gena_process_subscription_request( | ||||
| 		service->TotalSubscriptions, | ||||
| 		handle_info->MaxSubscriptions); | ||||
|  | ||||
| 	// too many subscriptions | ||||
| 	/* too many subscriptions */ | ||||
| 	if (handle_info->MaxSubscriptions != -1 && | ||||
| 	    service->TotalSubscriptions >= handle_info->MaxSubscriptions) { | ||||
| 		error_respond(info, HTTP_INTERNAL_SERVER_ERROR, request); | ||||
| 		HandleUnlock(); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
| 	// generate new subscription | ||||
| 	/* generate new subscription */ | ||||
| 	sub = (subscription *)malloc(sizeof (subscription)); | ||||
| 	if (sub == NULL) { | ||||
| 		error_respond(info, HTTP_INTERNAL_SERVER_ERROR, request); | ||||
| @@ -1305,7 +1309,7 @@ void gena_process_subscription_request( | ||||
| 	sub->DeliveryURLs.URLs = NULL; | ||||
| 	sub->DeliveryURLs.parsedURLs = NULL; | ||||
|  | ||||
| 	// check for valid callbacks | ||||
| 	/* check for valid callbacks */ | ||||
| 	if (httpmsg_find_hdr( request, HDR_CALLBACK, &callback_hdr) == NULL) { | ||||
| 		error_respond(info, HTTP_PRECONDITION_FAILED, request); | ||||
| 		freeSubscriptionList(sub); | ||||
| @@ -1325,20 +1329,20 @@ void gena_process_subscription_request( | ||||
| 		HandleUnlock(); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
| 	// set the timeout | ||||
| 	/* set the timeout */ | ||||
| 	if (httpmsg_find_hdr(request, HDR_TIMEOUT, &timeout_hdr) != NULL) { | ||||
| 		if (matchstr(timeout_hdr.buf, timeout_hdr.length, | ||||
| 		    "%iSecond-%d%0", &time_out) == PARSE_OK) { | ||||
| 			// nothing | ||||
| 			/* nothing */ | ||||
| 		} else if(memptr_cmp_nocase(&timeout_hdr, "Second-infinite") == 0) { | ||||
| 			// infinite timeout | ||||
| 			/* infinite timeout */ | ||||
| 			time_out = -1; | ||||
| 		} else { | ||||
| 			// default is > 1800 seconds | ||||
| 			/* default is > 1800 seconds */ | ||||
| 			time_out = DEFAULT_TIMEOUT; | ||||
| 		} | ||||
| 	} | ||||
| 	// replace infinite timeout with max timeout, if possible | ||||
| 	/* replace infinite timeout with max timeout, if possible */ | ||||
| 	if (handle_info->MaxSubscriptionTimeOut != -1) { | ||||
| 		if (time_out == -1 || | ||||
| 		    time_out > handle_info->MaxSubscriptionTimeOut) { | ||||
| @@ -1348,40 +1352,43 @@ void gena_process_subscription_request( | ||||
| 	if (time_out >= 0) { | ||||
| 		sub->expireTime = time(NULL) + time_out; | ||||
| 	} else { | ||||
| 		// infinite time | ||||
| 		/* infinite time */ | ||||
| 		sub->expireTime = 0; | ||||
| 	} | ||||
|  | ||||
| 	// generate SID | ||||
| 	/* generate SID */ | ||||
| 	uuid_create(&uid); | ||||
| 	uuid_unpack(&uid, temp_sid); | ||||
| 	sprintf(sub->sid, "uuid:%s", temp_sid); | ||||
| 	rc = snprintf(sub->sid, sizeof(sub->sid), "uuid:%s", temp_sid); | ||||
|  | ||||
| 	// respond OK | ||||
| 	if (respond_ok(info, time_out, sub, request) != UPNP_E_SUCCESS) { | ||||
| 	/* respond OK */ | ||||
| 	if (rc < 0 || (unsigned int) rc >= sizeof(sub->sid) || | ||||
| 		(respond_ok(info, time_out, | ||||
| 		sub, request) != UPNP_E_SUCCESS)) { | ||||
| 		freeSubscriptionList(sub); | ||||
| 		HandleUnlock(); | ||||
| 		goto exit_function; | ||||
| 	} | ||||
| 	// add to subscription list | ||||
| 	/* add to subscription list */ | ||||
| 	sub->next = service->subscriptionList; | ||||
| 	service->subscriptionList = sub; | ||||
| 	service->TotalSubscriptions++; | ||||
|  | ||||
| 	// finally generate callback for init table dump | ||||
| 	/* finally generate callback for init table dump */ | ||||
| 	request_struct.ServiceId = service->serviceId; | ||||
| 	request_struct.UDN = service->UDN; | ||||
| 	strcpy((char *)request_struct.Sid, sub->sid); | ||||
| 	strncpy((char *)request_struct.Sid, sub->sid, | ||||
| 		sizeof(request_struct.Sid) - 1); | ||||
|  | ||||
| 	// copy callback | ||||
| 	/* copy callback */ | ||||
| 	callback_fun = handle_info->Callback; | ||||
| 	cookie = handle_info->Cookie; | ||||
|  | ||||
| 	HandleUnlock(); | ||||
|  | ||||
| 	// 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 | ||||
| 	/* 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); | ||||
|  | ||||
| exit_function: | ||||
| @@ -1403,13 +1410,13 @@ void gena_process_subscription_renewal_request( | ||||
|     membuffer event_url_path; | ||||
|     memptr timeout_hdr; | ||||
|  | ||||
|     // if a CALLBACK or NT header is present, then it is an error | ||||
|     /* if a CALLBACK or NT header is present, then it is an error */ | ||||
|     if( httpmsg_find_hdr( request, HDR_CALLBACK, NULL ) != NULL || | ||||
|         httpmsg_find_hdr( request, HDR_NT, NULL ) != NULL ) { | ||||
|         error_respond( info, HTTP_BAD_REQUEST, request ); | ||||
|         return; | ||||
|     } | ||||
|     // get SID | ||||
|     /* get SID */ | ||||
|     if( httpmsg_find_hdr( request, HDR_SID, &temp_hdr ) == NULL || | ||||
|         temp_hdr.length > SID_SIZE ) { | ||||
|         error_respond( info, HTTP_PRECONDITION_FAILED, request ); | ||||
| @@ -1418,7 +1425,7 @@ void gena_process_subscription_renewal_request( | ||||
|     memcpy( sid, temp_hdr.buf, temp_hdr.length ); | ||||
|     sid[temp_hdr.length] = '\0'; | ||||
|  | ||||
|     // lookup service by eventURL | ||||
|     /* lookup service by eventURL */ | ||||
|     membuffer_init( &event_url_path ); | ||||
|     if( membuffer_append( &event_url_path, request->uri.pathquery.buff, | ||||
|                           request->uri.pathquery.size ) != 0 ) { | ||||
| @@ -1428,7 +1435,7 @@ void gena_process_subscription_renewal_request( | ||||
|  | ||||
|     HandleLock(); | ||||
|  | ||||
|     // CURRENTLY, ONLY SUPPORT ONE DEVICE | ||||
|     /* CURRENTLY, ONLY SUPPORT ONE DEVICE */ | ||||
|     if( GetDeviceHandleInfo( info->foreign_sockaddr.ss_family, | ||||
|         &device_handle, &handle_info ) != HND_DEVICE ) { | ||||
|         error_respond( info, HTTP_PRECONDITION_FAILED, request ); | ||||
| @@ -1440,7 +1447,7 @@ void gena_process_subscription_renewal_request( | ||||
|                                        event_url_path.buf ); | ||||
|     membuffer_destroy( &event_url_path ); | ||||
|  | ||||
|     // get subscription | ||||
|     /* get subscription */ | ||||
|     if( service == NULL || | ||||
|         !service->active || | ||||
|         ( ( sub = GetSubscriptionSID( sid, service ) ) == NULL ) ) { | ||||
| @@ -1454,7 +1461,7 @@ void gena_process_subscription_renewal_request( | ||||
|         "Max Subscriptions allowed:%d\n", | ||||
|         service->TotalSubscriptions, | ||||
|         handle_info->MaxSubscriptions ); | ||||
|     // too many subscriptions | ||||
|     /* too many subscriptions */ | ||||
|     if( handle_info->MaxSubscriptions != -1 && | ||||
|             service->TotalSubscriptions > handle_info->MaxSubscriptions ) { | ||||
|         error_respond( info, HTTP_INTERNAL_SERVER_ERROR, request ); | ||||
| @@ -1462,25 +1469,25 @@ void gena_process_subscription_renewal_request( | ||||
|         HandleUnlock(); | ||||
|         return; | ||||
|     } | ||||
|     // set the timeout | ||||
|     /* set the timeout */ | ||||
|     if( httpmsg_find_hdr( request, HDR_TIMEOUT, &timeout_hdr ) != NULL ) { | ||||
|         if( matchstr( timeout_hdr.buf, timeout_hdr.length, | ||||
|                       "%iSecond-%d%0", &time_out ) == PARSE_OK ) { | ||||
|  | ||||
|             //nothing | ||||
|             /*nothing */ | ||||
|  | ||||
|         } else if( memptr_cmp_nocase( &timeout_hdr, "Second-infinite" ) == | ||||
|                    0 ) { | ||||
|  | ||||
|             time_out = -1;      // inifinite timeout | ||||
|             time_out = -1;      /* inifinite timeout */ | ||||
|  | ||||
|         } else { | ||||
|             time_out = DEFAULT_TIMEOUT; // default is > 1800 seconds | ||||
|             time_out = DEFAULT_TIMEOUT; /* default is > 1800 seconds */ | ||||
|  | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // replace infinite timeout with max timeout, if possible | ||||
|     /* replace infinite timeout with max timeout, if possible */ | ||||
|     if( handle_info->MaxSubscriptionTimeOut != -1 ) { | ||||
|         if( time_out == -1 || | ||||
|             time_out > handle_info->MaxSubscriptionTimeOut ) { | ||||
| @@ -1514,13 +1521,13 @@ void gena_process_unsubscribe_request( | ||||
|     memptr temp_hdr; | ||||
|     membuffer event_url_path; | ||||
|  | ||||
|     // if a CALLBACK or NT header is present, then it is an error | ||||
|     /* if a CALLBACK or NT header is present, then it is an error */ | ||||
|     if( httpmsg_find_hdr( request, HDR_CALLBACK, NULL ) != NULL || | ||||
|         httpmsg_find_hdr( request, HDR_NT, NULL ) != NULL ) { | ||||
|         error_respond( info, HTTP_BAD_REQUEST, request ); | ||||
|         return; | ||||
|     } | ||||
|     // get SID | ||||
|     /* get SID */ | ||||
|     if( httpmsg_find_hdr( request, HDR_SID, &temp_hdr ) == NULL || | ||||
|         temp_hdr.length > SID_SIZE ) { | ||||
|         error_respond( info, HTTP_PRECONDITION_FAILED, request ); | ||||
| @@ -1529,7 +1536,7 @@ void gena_process_unsubscribe_request( | ||||
|     memcpy( sid, temp_hdr.buf, temp_hdr.length ); | ||||
|     sid[temp_hdr.length] = '\0'; | ||||
|  | ||||
|     // lookup service by eventURL | ||||
|     /* lookup service by eventURL */ | ||||
|     membuffer_init( &event_url_path ); | ||||
|     if( membuffer_append( &event_url_path, request->uri.pathquery.buff, | ||||
|                           request->uri.pathquery.size ) != 0 ) { | ||||
| @@ -1539,7 +1546,7 @@ void gena_process_unsubscribe_request( | ||||
|  | ||||
|     HandleLock(); | ||||
|  | ||||
|     // CURRENTLY, ONLY SUPPORT ONE DEVICE | ||||
|     /* CURRENTLY, ONLY SUPPORT ONE DEVICE */ | ||||
|     if( GetDeviceHandleInfo( info->foreign_sockaddr.ss_family, | ||||
|         &device_handle, &handle_info ) != HND_DEVICE ) { | ||||
|         error_respond( info, HTTP_PRECONDITION_FAILED, request ); | ||||
| @@ -1551,7 +1558,7 @@ void gena_process_unsubscribe_request( | ||||
|                                        event_url_path.buf ); | ||||
|     membuffer_destroy( &event_url_path ); | ||||
|  | ||||
|     // validate service | ||||
|     /* validate service */ | ||||
|     if( service == NULL || | ||||
|         !service->active || GetSubscriptionSID( sid, service ) == NULL ) | ||||
|     { | ||||
| @@ -1561,7 +1568,7 @@ void gena_process_unsubscribe_request( | ||||
|     } | ||||
|  | ||||
|     RemoveSubscriptionSID(sid, service); | ||||
|     error_respond(info, HTTP_OK, request);    // success | ||||
|     error_respond(info, HTTP_OK, request);    /* success */ | ||||
|  | ||||
|     HandleUnlock(); | ||||
| } | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -44,9 +45,9 @@ | ||||
|  | ||||
|  | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| #if EXCLUDE_GENA == 0 | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> // for calloc(), free() | ||||
| #include <stdlib.h> /* for calloc(), free() */ | ||||
|  | ||||
|  | ||||
| struct SClientSubscription { | ||||
| @@ -113,12 +114,12 @@ ClientSubscription *UpnpClientSubscription_dup(const ClientSubscription *p) | ||||
| void UpnpClientSubscription_assign(ClientSubscription *q, const ClientSubscription *p) | ||||
| { | ||||
| 	if (q != p) { | ||||
| 		// Do not copy RenewEventId | ||||
| 		/* 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 | ||||
| 		/* Do not copy m_next */ | ||||
| 		((struct SClientSubscription *)q)->m_next = NULL; | ||||
| 	} | ||||
| } | ||||
| @@ -238,8 +239,8 @@ void free_client_subscription(ClientSubscription *sub) | ||||
| 		UpnpClientSubscription_strcpy_ActualSID(sub, ""); | ||||
| 		UpnpClientSubscription_strcpy_EventURL(sub, ""); | ||||
| 		if (renewEventId != -1) { | ||||
| 			// do not remove timer event of copy | ||||
| 			// invalid timer event id | ||||
| 			/* do not remove timer event of copy */ | ||||
| 			/* invalid timer event id */ | ||||
| 			if (TimerThreadRemove(&gTimerThread, renewEventId, &tempJob) == 0) { | ||||
| 				event = (upnp_timeout *)tempJob.arg; | ||||
| 				free_upnp_timeout(event); | ||||
| @@ -324,6 +325,6 @@ ClientSubscription *GetClientSubActualSID(ClientSubscription *head, token *sid) | ||||
| 	return next; | ||||
| } | ||||
|  | ||||
|  | ||||
| #endif /* EXCLUDE_GENA */ | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
|  | ||||
|   | ||||
| @@ -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: | ||||
| @@ -29,9 +30,9 @@ | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
| #if EXCLUDE_MINISERVER == 0 | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
| @@ -46,10 +47,8 @@ | ||||
|  * | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "miniserver.h" | ||||
|  | ||||
|  | ||||
| #include "httpreadwrite.h" | ||||
| #include "ithread.h" | ||||
| #include "ssdplib.h" | ||||
| @@ -59,7 +58,6 @@ | ||||
| #include "upnpapi.h" | ||||
| #include "upnputil.h" | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <errno.h> | ||||
| #include <stdio.h> | ||||
| @@ -67,19 +65,16 @@ | ||||
| #include <string.h> | ||||
| #include <sys/types.h> | ||||
|  | ||||
|  | ||||
| /*! . */ | ||||
| #define APPLICATION_LISTENING_PORT 49152 | ||||
|  | ||||
|  | ||||
| struct mserv_request_t { | ||||
| 	/*! Connection handle. */ | ||||
| 	int connfd; | ||||
| 	SOCKET connfd; | ||||
| 	/*! . */ | ||||
| 	struct sockaddr_storage foreign_sockaddr; | ||||
| }; | ||||
|  | ||||
|  | ||||
| /*! . */ | ||||
| typedef enum { | ||||
| 	/*! . */ | ||||
| @@ -90,26 +85,23 @@ typedef enum { | ||||
| 	MSERV_STOPPING | ||||
| } MiniServerState; | ||||
|  | ||||
|  | ||||
| /*! . */ | ||||
| unsigned short miniStopSockPort; | ||||
|  | ||||
| uint16_t miniStopSockPort; | ||||
|  | ||||
| /*! | ||||
|  * module vars | ||||
|  */ | ||||
| static MiniServerState gMServState = MSERV_IDLE; | ||||
| #ifdef INTERNAL_WEB_SERVER | ||||
| static MiniServerCallback gGetCallback = NULL; | ||||
| static MiniServerCallback gSoapCallback = NULL; | ||||
| static MiniServerCallback gGenaCallback = NULL; | ||||
| static MiniServerState gMServState = MSERV_IDLE; | ||||
|  | ||||
|  | ||||
| void SetHTTPGetCallback(MiniServerCallback callback) | ||||
| { | ||||
| 	gGetCallback = callback; | ||||
| } | ||||
|  | ||||
|  | ||||
| #ifdef INCLUDE_DEVICE_APIS | ||||
| void SetSoapCallback(MiniServerCallback callback) | ||||
| { | ||||
| @@ -122,8 +114,6 @@ void SetGenaCallback(MiniServerCallback callback) | ||||
| 	gGenaCallback = callback; | ||||
| } | ||||
|  | ||||
|  | ||||
| #ifdef INTERNAL_WEB_SERVER | ||||
| /*! | ||||
|  * \brief Based on the type pf message, appropriate callback is issued. | ||||
|  * | ||||
| @@ -169,7 +159,6 @@ static int dispatch_request( | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Send Error Message. | ||||
|  */ | ||||
| @@ -186,7 +175,6 @@ static UPNP_INLINE void handle_error( | ||||
| 	http_SendStatusResponse(info, http_error_code, major, minor); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Free memory assigned for handling request and unitialize socket | ||||
|  * functionality. | ||||
| @@ -201,7 +189,6 @@ static void free_handle_request_arg( | ||||
| 	free(request); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Receive the request and dispatch it for handling. | ||||
|  */ | ||||
| @@ -218,7 +205,7 @@ static void handle_request( | ||||
| 	http_message_t *hmsg = NULL; | ||||
| 	int timeout = HTTP_DEFAULT_TIMEOUT; | ||||
| 	struct mserv_request_t *request = (struct mserv_request_t *)args; | ||||
| 	int connfd = request->connfd; | ||||
| 	SOCKET connfd = request->connfd; | ||||
|  | ||||
| 	UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 		"miniserver %d: READING\n", connfd ); | ||||
| @@ -262,20 +249,21 @@ error_handler: | ||||
| 		"miniserver %d: COMPLETE\n", connfd); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Initilize the thread pool to handle a request, sets priority for the | ||||
|  * job and adds the job to the thread pool. | ||||
|  */ | ||||
| static UPNP_INLINE void schedule_request_job( | ||||
| 	/*! [in] Socket Descriptor on which connection is accepted. */ | ||||
| 	int connfd, | ||||
| 	SOCKET connfd, | ||||
| 	/*! [in] Clients Address information. */ | ||||
| 	struct sockaddr *clientAddr) | ||||
| { | ||||
| 	struct mserv_request_t *request; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	request = (struct mserv_request_t *)malloc( | ||||
| 		sizeof (struct mserv_request_t)); | ||||
| 	if (request == NULL) { | ||||
| @@ -301,26 +289,26 @@ static UPNP_INLINE void schedule_request_job( | ||||
| } | ||||
| #endif | ||||
|  | ||||
| static inline void fdset_if_valid(int sock, fd_set *set) | ||||
| static UPNP_INLINE void fdset_if_valid(SOCKET sock, fd_set *set) | ||||
| { | ||||
| 	if (sock != -1) { | ||||
| 	if (sock != INVALID_SOCKET) { | ||||
| 		FD_SET(sock, set); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| static void web_server_accept(int lsock, fd_set *set) | ||||
| static void web_server_accept(SOCKET lsock, fd_set *set) | ||||
| { | ||||
| #ifdef INTERNAL_WEB_SERVER | ||||
| 	int asock; | ||||
| 	SOCKET asock; | ||||
| 	socklen_t clientLen; | ||||
| 	struct sockaddr_storage clientAddr; | ||||
| 	char errorBuffer[ERROR_BUFFER_LEN]; | ||||
|  | ||||
| 	if (lsock != -1 && FD_ISSET(lsock, set)) { | ||||
| 	if (lsock != INVALID_SOCKET && FD_ISSET(lsock, set)) { | ||||
| 		clientLen = sizeof(clientAddr); | ||||
| 		asock = accept(lsock, (struct sockaddr *)&clientAddr, | ||||
| 			&clientLen); | ||||
| 		if (asock == -1) { | ||||
| 		if (asock == INVALID_SOCKET) { | ||||
| 			strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 			UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 				"miniserver: Error in accept(): %s\n", | ||||
| @@ -333,26 +321,26 @@ static void web_server_accept(int lsock, fd_set *set) | ||||
| #endif /* INTERNAL_WEB_SERVER */ | ||||
| } | ||||
|  | ||||
| static void ssdp_read(int rsock, fd_set *set) | ||||
| static void ssdp_read(SOCKET rsock, fd_set *set) | ||||
| { | ||||
| 	if (rsock != -1 && FD_ISSET(rsock, set)) { | ||||
| 	if (rsock != INVALID_SOCKET && FD_ISSET(rsock, set)) { | ||||
| 		readFromSSDPSocket(rsock); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| static int receive_from_stopSock(int ssock, fd_set *set) | ||||
| static int receive_from_stopSock(SOCKET ssock, fd_set *set) | ||||
| { | ||||
| 	int byteReceived; | ||||
| 	ssize_t byteReceived; | ||||
| 	socklen_t clientLen; | ||||
| 	struct sockaddr_storage clientAddr; | ||||
| 	char requestBuf[256]; | ||||
| 	char buf_ntop[64]; | ||||
| 	char buf_ntop[INET6_ADDRSTRLEN]; | ||||
|  | ||||
| 	if (FD_ISSET(ssock, set)) { | ||||
| 		clientLen = sizeof(clientAddr); | ||||
| 		memset((char *)&clientAddr, 0, sizeof(clientAddr)); | ||||
| 		byteReceived = recvfrom(ssock, requestBuf, | ||||
| 			25, 0, (struct sockaddr *)&clientAddr, &clientLen); | ||||
| 			(size_t)25, 0, (struct sockaddr *)&clientAddr, &clientLen); | ||||
| 		if (byteReceived > 0) { | ||||
| 			requestBuf[byteReceived] = '\0'; | ||||
| 			inet_ntop(AF_INET, | ||||
| @@ -387,9 +375,9 @@ static void RunMiniServer( | ||||
| 	char errorBuffer[ERROR_BUFFER_LEN]; | ||||
| 	fd_set expSet; | ||||
| 	fd_set rdSet; | ||||
| 	int maxMiniSock; | ||||
| 	SOCKET maxMiniSock; | ||||
| 	int ret = 0; | ||||
| 	int stopSock = 0; | ||||
| 	SOCKET stopSock = 0; | ||||
|  | ||||
| 	maxMiniSock = 0; | ||||
| 	maxMiniSock = max(maxMiniSock, miniSock->miniServerSock4); | ||||
| @@ -398,8 +386,10 @@ static void RunMiniServer( | ||||
| 	maxMiniSock = max(maxMiniSock, miniSock->ssdpSock4); | ||||
| 	maxMiniSock = max(maxMiniSock, miniSock->ssdpSock6); | ||||
| 	maxMiniSock = max(maxMiniSock, miniSock->ssdpSock6UlaGua); | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| 	maxMiniSock = max(maxMiniSock, miniSock->ssdpReqSock4); | ||||
| 	maxMiniSock = max(maxMiniSock, miniSock->ssdpReqSock6); | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
| 	++maxMiniSock; | ||||
|  | ||||
| 	gMServState = MSERV_RUNNING; | ||||
| @@ -414,14 +404,16 @@ static void RunMiniServer( | ||||
| 		fdset_if_valid(miniSock->ssdpSock4, &rdSet); | ||||
| 		fdset_if_valid(miniSock->ssdpSock6, &rdSet); | ||||
| 		fdset_if_valid(miniSock->ssdpSock6UlaGua, &rdSet); | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| 		fdset_if_valid(miniSock->ssdpReqSock4, &rdSet); | ||||
| 		fdset_if_valid(miniSock->ssdpReqSock6, &rdSet); | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
| 		/* select() */ | ||||
| 		ret = select(maxMiniSock, &rdSet, NULL, &expSet, NULL); | ||||
| 		if (ret == -1 && errno == EINTR) { | ||||
| 		ret = select((int) maxMiniSock, &rdSet, NULL, &expSet, NULL); | ||||
| 		if (ret == SOCKET_ERROR && errno == EINTR) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		if (ret == -1) { | ||||
| 		if (ret == SOCKET_ERROR) { | ||||
| 			strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 			UpnpPrintf(UPNP_CRITICAL, SSDP, __FILE__, __LINE__, | ||||
| 				"Error in select(): %s\n", errorBuffer); | ||||
| @@ -447,8 +439,10 @@ static void RunMiniServer( | ||||
| 	sock_close(miniSock->ssdpSock4); | ||||
| 	sock_close(miniSock->ssdpSock6); | ||||
| 	sock_close(miniSock->ssdpSock6UlaGua); | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| 	sock_close(miniSock->ssdpReqSock4); | ||||
| 	sock_close(miniSock->ssdpReqSock6); | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
| 	/* Free minisock. */ | ||||
| 	free(miniSock); | ||||
| 	gMServState = MSERV_IDLE; | ||||
| @@ -456,20 +450,20 @@ static void RunMiniServer( | ||||
| 	return; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns port to which socket, sockfd, is bound. | ||||
|  * | ||||
|  * \return -1 on error; check errno, otherwise > 0 means port number. | ||||
|  * \return -1 on error; check errno. 0 if successfull. | ||||
|  */ | ||||
| static int get_port( | ||||
| 	/*! [in] Socket descriptor. */ | ||||
| 	int sockfd) | ||||
| 	SOCKET sockfd, | ||||
| 	/*! [out] The port value if successful, otherwise, untouched. */ | ||||
| 	uint16_t *port) | ||||
| { | ||||
| 	struct sockaddr_storage sockinfo; | ||||
| 	socklen_t len; | ||||
| 	int code; | ||||
| 	int port = 0; | ||||
|  | ||||
| 	len = sizeof(sockinfo); | ||||
| 	code = getsockname(sockfd, (struct sockaddr *)&sockinfo, &len); | ||||
| @@ -477,17 +471,16 @@ static int get_port( | ||||
| 		return -1; | ||||
| 	} | ||||
| 	if (sockinfo.ss_family == AF_INET) { | ||||
| 		port = ntohs(((struct sockaddr_in*)&sockinfo)->sin_port); | ||||
| 		*port = ntohs(((struct sockaddr_in*)&sockinfo)->sin_port); | ||||
| 	} else if(sockinfo.ss_family == AF_INET6) { | ||||
| 		port = ntohs(((struct sockaddr_in6*)&sockinfo)->sin6_port); | ||||
| 		*port = ntohs(((struct sockaddr_in6*)&sockinfo)->sin6_port); | ||||
| 	} | ||||
| 	UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 		"sockfd = %d, .... port = %d\n", sockfd, port); | ||||
| 		"sockfd = %d, .... port = %d\n", sockfd, (int)*port); | ||||
|  | ||||
| 	return port; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| #ifdef INTERNAL_WEB_SERVER | ||||
| /*! | ||||
|  * \brief Creates a STREAM socket, binds to INADDR_ANY and listens for | ||||
| @@ -509,21 +502,22 @@ static int get_miniserver_sockets( | ||||
| 	MiniServerSockArray *out, | ||||
| 	/*! [in] port on which the server is listening for incoming IPv4 | ||||
| 	 * connections. */ | ||||
| 	unsigned short listen_port4, | ||||
| 	uint16_t listen_port4, | ||||
| 	/*! [in] port on which the server is listening for incoming IPv6 | ||||
| 	 * connections. */ | ||||
| 	unsigned short listen_port6) | ||||
| 	uint16_t listen_port6) | ||||
| { | ||||
| 	char errorBuffer[ERROR_BUFFER_LEN]; | ||||
| 	struct sockaddr_storage __ss_v4; | ||||
| 	struct sockaddr_in* serverAddr4 = (struct sockaddr_in*)&__ss_v4; | ||||
| 	SOCKET listenfd4; | ||||
| 	unsigned short actual_port4; | ||||
| 	uint16_t actual_port4 = 0u; | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 	struct sockaddr_storage __ss_v6; | ||||
| 	struct sockaddr_in6* serverAddr6 = (struct sockaddr_in6*)&__ss_v6; | ||||
| 	SOCKET listenfd6; | ||||
| 	unsigned short actual_port6; | ||||
| 	uint16_t actual_port6 = 0u; | ||||
| 	int onOff; | ||||
| #endif | ||||
| 	int ret_code; | ||||
| 	int reuseaddr_on = 0; | ||||
| @@ -533,31 +527,40 @@ static int get_miniserver_sockets( | ||||
| 	/* Create listen socket for IPv4/IPv6. An error here may indicate | ||||
| 	 * that we don't have an IPv4/IPv6 stack. */ | ||||
| 	listenfd4 = socket(AF_INET, SOCK_STREAM, 0); | ||||
| 	if (listenfd4 == -1) { | ||||
| 	if (listenfd4 == INVALID_SOCKET) { | ||||
| 		return UPNP_E_OUTOF_SOCKET; | ||||
| 	} | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 	listenfd6 = socket(AF_INET6, SOCK_STREAM, 0); | ||||
| 	if (listenfd6 == -1) { | ||||
| 	if (listenfd6 == INVALID_SOCKET) { | ||||
| 		sock_close(listenfd4); | ||||
| 		return UPNP_E_OUTOF_SOCKET; | ||||
| 	} | ||||
| 	onOff = 1; | ||||
| 	sockError = setsockopt(listenfd6, IPPROTO_IPV6, IPV6_V6ONLY, | ||||
| 			 (char *)&onOff, sizeof(onOff)); | ||||
| 	if (sockError == SOCKET_ERROR) { | ||||
| 		sock_close(listenfd4); | ||||
| 		sock_close(listenfd6); | ||||
| 		return UPNP_E_SOCKET_BIND; | ||||
| 	} | ||||
| #endif | ||||
| 	/* As per the IANA specifications for the use of ports by applications | ||||
| 	 * override the listen port passed in with the first available. */ | ||||
| 	if (listen_port4 < APPLICATION_LISTENING_PORT) { | ||||
| 		listen_port4 = APPLICATION_LISTENING_PORT; | ||||
| 		listen_port4 = (uint16_t)APPLICATION_LISTENING_PORT; | ||||
| 	} | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 	if (listen_port6 < APPLICATION_LISTENING_PORT) { | ||||
| 		listen_port6 = APPLICATION_LISTENING_PORT; | ||||
| 		listen_port6 = (uint16_t)APPLICATION_LISTENING_PORT; | ||||
| 	} | ||||
| #endif | ||||
| 	memset(&__ss_v4, 0, sizeof (__ss_v4)); | ||||
| 	serverAddr4->sin_family = AF_INET; | ||||
| 	serverAddr4->sin_family = (sa_family_t)AF_INET; | ||||
| 	serverAddr4->sin_addr.s_addr = htonl(INADDR_ANY); | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 	memset(&__ss_v6, 0, sizeof (__ss_v6)); | ||||
| 	serverAddr6->sin6_family = AF_INET6; | ||||
| 	serverAddr6->sin6_family = (sa_family_t)AF_INET6; | ||||
| 	serverAddr6->sin6_addr = in6addr_any; | ||||
| #endif | ||||
| 	/* Getting away with implementation of re-using address:port and | ||||
| @@ -572,11 +575,11 @@ static int get_miniserver_sockets( | ||||
| 		 * HOWEVER IT HAS BEEN SUGESTED FOR TCP SERVERS. */ | ||||
| 		UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 			"get_miniserver_sockets: resuseaddr is set.\n"); | ||||
| 		if (listenfd4 != -1) { | ||||
| 		if (listenfd4 != INVALID_SOCKET) { | ||||
| 			sockError = setsockopt(listenfd4, SOL_SOCKET, | ||||
| 				SO_REUSEADDR, | ||||
| 				(const char *)&reuseaddr_on, sizeof (int)); | ||||
| 			if (sockError == -1) { | ||||
| 			if (sockError == SOCKET_ERROR) { | ||||
| 				sock_close(listenfd4); | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 				sock_close(listenfd6); | ||||
| @@ -587,7 +590,7 @@ static int get_miniserver_sockets( | ||||
| 			sockError = bind(listenfd4, | ||||
| 				(struct sockaddr *)&__ss_v4, | ||||
| 				sizeof (__ss_v4)); | ||||
| 			if (sockError == -1) { | ||||
| 			if (sockError == SOCKET_ERROR) { | ||||
| 				strerror_r(errno, errorBuffer, | ||||
| 					ERROR_BUFFER_LEN); | ||||
| 				UpnpPrintf(UPNP_INFO, MSERV, | ||||
| @@ -604,11 +607,11 @@ static int get_miniserver_sockets( | ||||
| 			} | ||||
| 		} | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 		if (listenfd6 != -1) { | ||||
| 		if (listenfd6 != INVALID_SOCKET) { | ||||
| 			sockError = setsockopt(listenfd6, SOL_SOCKET, | ||||
| 				SO_REUSEADDR, | ||||
| 			(const char *)&reuseaddr_on, sizeof (int)); | ||||
| 			if (sockError == -1) { | ||||
| 			if (sockError == SOCKET_ERROR) { | ||||
| 				sock_close(listenfd4); | ||||
| 				sock_close(listenfd6); | ||||
| 				return UPNP_E_SOCKET_BIND; | ||||
| @@ -617,7 +620,7 @@ static int get_miniserver_sockets( | ||||
| 			sockError = bind(listenfd6, | ||||
| 				(struct sockaddr *)&__ss_v6, | ||||
| 				sizeof (__ss_v6)); | ||||
| 			if (sockError == -1) { | ||||
| 			if (sockError == SOCKET_ERROR) { | ||||
| 				strerror_r(errno, errorBuffer, | ||||
| 					ERROR_BUFFER_LEN); | ||||
| 				UpnpPrintf(UPNP_INFO, MSERV, | ||||
| @@ -633,14 +636,14 @@ static int get_miniserver_sockets( | ||||
| 		} | ||||
| #endif  /* IPv6 */ | ||||
| 	} else { | ||||
| 		if (listenfd4 != -1) { | ||||
| 			unsigned short orig_listen_port4 = listen_port4; | ||||
| 		if (listenfd4 != INVALID_SOCKET) { | ||||
| 			uint16_t orig_listen_port4 = listen_port4; | ||||
| 			do { | ||||
| 				serverAddr4->sin_port = htons(listen_port4++); | ||||
| 				sockError = bind(listenfd4, | ||||
| 					(struct sockaddr *)serverAddr4, | ||||
| 					sizeof(*serverAddr4)); | ||||
| 				if (sockError == -1) { | ||||
| 				if (sockError == SOCKET_ERROR) { | ||||
| #ifdef WIN32 | ||||
| 					errCode = WSAGetLastError(); | ||||
| #else | ||||
| @@ -654,7 +657,7 @@ static int get_miniserver_sockets( | ||||
| 				} | ||||
| 			} while (errCode != 0 && | ||||
| 				 listen_port4 >= orig_listen_port4); | ||||
| 			if (sockError == -1) { | ||||
| 			if (sockError == SOCKET_ERROR) { | ||||
| 				strerror_r(errno, errorBuffer, | ||||
| 					ERROR_BUFFER_LEN); | ||||
| 				UpnpPrintf(UPNP_INFO, MSERV, | ||||
| @@ -671,14 +674,14 @@ static int get_miniserver_sockets( | ||||
| 			} | ||||
| 		} | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 		if (listenfd6 != -1) { | ||||
| 			unsigned short orig_listen_port6 = listen_port6; | ||||
| 		if (listenfd6 != INVALID_SOCKET) { | ||||
| 			uint16_t orig_listen_port6 = listen_port6; | ||||
| 			do { | ||||
| 				serverAddr6->sin6_port = htons(listen_port6++); | ||||
| 				sockError = bind(listenfd6, | ||||
| 					(struct sockaddr *)serverAddr6, | ||||
| 					sizeof(*serverAddr6)); | ||||
| 				if (sockError == -1) { | ||||
| 				if (sockError == SOCKET_ERROR) { | ||||
| #ifdef WIN32 | ||||
| 					errCode = WSAGetLastError(); | ||||
| #else | ||||
| @@ -692,7 +695,7 @@ static int get_miniserver_sockets( | ||||
| 				} | ||||
| 			} while (errCode != 0 && | ||||
| 				 listen_port6 >= orig_listen_port6); | ||||
| 			if (sockError == -1) { | ||||
| 			if (sockError == SOCKET_ERROR) { | ||||
| 				strerror_r(errno, errorBuffer, | ||||
| 					ERROR_BUFFER_LEN); | ||||
| 				UpnpPrintf(UPNP_INFO, MSERV, | ||||
| @@ -710,9 +713,9 @@ static int get_miniserver_sockets( | ||||
| 	} | ||||
| 	UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 		"get_miniserver_sockets: bind successful\n"); | ||||
| 	if (listenfd4 != -1) { | ||||
| 	if (listenfd4 != INVALID_SOCKET) { | ||||
| 		ret_code = listen(listenfd4, SOMAXCONN); | ||||
| 		if (ret_code == -1) { | ||||
| 		if (ret_code == SOCKET_ERROR) { | ||||
| 			strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 			UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 				"mserv start: Error in IPv4 listen(): %s\n", | ||||
| @@ -723,8 +726,8 @@ static int get_miniserver_sockets( | ||||
| #endif | ||||
| 			return UPNP_E_LISTEN; | ||||
| 		} | ||||
| 		actual_port4 = get_port(listenfd4); | ||||
| 		if (actual_port4 <= 0) { | ||||
| 		ret_code = get_port(listenfd4, &actual_port4); | ||||
| 		if (ret_code < 0) { | ||||
| 			sock_close(listenfd4); | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 			sock_close(listenfd6); | ||||
| @@ -734,9 +737,9 @@ static int get_miniserver_sockets( | ||||
| 		out->miniServerPort4 = actual_port4; | ||||
| 	} | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 	if (listenfd6 != -1) { | ||||
| 	if (listenfd6 != INVALID_SOCKET) { | ||||
| 		ret_code = listen(listenfd6, SOMAXCONN); | ||||
| 		if (ret_code == -1) { | ||||
| 		if (ret_code == SOCKET_ERROR) { | ||||
| 			strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 			UpnpPrintf(UPNP_INFO, MSERV, __FILE__, __LINE__, | ||||
| 				"mserv start: Error in IPv6 listen(): %s\n", | ||||
| @@ -745,8 +748,8 @@ static int get_miniserver_sockets( | ||||
| 			sock_close(listenfd6); | ||||
| 			return UPNP_E_LISTEN; | ||||
| 		} | ||||
| 		actual_port6 = get_port(listenfd6); | ||||
| 		if (actual_port6 <= 0) { | ||||
| 		ret_code = get_port(listenfd6, &actual_port6); | ||||
| 		if (ret_code < 0) { | ||||
| 			sock_close(listenfd4); | ||||
| 			sock_close(listenfd6); | ||||
| 			return UPNP_E_INTERNAL_ERROR; | ||||
| @@ -757,12 +760,15 @@ static int get_miniserver_sockets( | ||||
| 	out->miniServerSock4 = listenfd4; | ||||
| #ifdef UPNP_ENABLE_IPV6 | ||||
| 	out->miniServerSock6 = listenfd6; | ||||
| #else | ||||
| 	/* Silence compiler warning message: | ||||
| 	 * warning: unused parameter ‘listen_port6’ */ | ||||
| 	listen_port6 = 0u; | ||||
| #endif | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
| #endif /* INTERNAL_WEB_SERVER */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Creates the miniserver STOP socket. This socket is created and  | ||||
|  *  listened on to know when it is time to stop the Miniserver. | ||||
| @@ -779,11 +785,11 @@ static int get_miniserver_stopsock( | ||||
| { | ||||
| 	char errorBuffer[ERROR_BUFFER_LEN]; | ||||
| 	struct sockaddr_in stop_sockaddr; | ||||
| 	int miniServerStopSock = 0; | ||||
| 	SOCKET miniServerStopSock = 0; | ||||
| 	int ret = 0; | ||||
|  | ||||
| 	miniServerStopSock = socket(AF_INET, SOCK_DGRAM, 0); | ||||
| 	if (miniServerStopSock == -1) { | ||||
| 	if (miniServerStopSock == INVALID_SOCKET) { | ||||
| 		strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 		UpnpPrintf(UPNP_CRITICAL, MSERV, __FILE__, __LINE__, | ||||
| 			"Error in socket(): %s\n", errorBuffer); | ||||
| @@ -791,19 +797,19 @@ static int get_miniserver_stopsock( | ||||
| 	} | ||||
| 	/* Bind to local socket. */ | ||||
| 	memset(&stop_sockaddr, 0, sizeof (stop_sockaddr)); | ||||
| 	stop_sockaddr.sin_family = AF_INET; | ||||
| 	stop_sockaddr.sin_family = (sa_family_t)AF_INET; | ||||
| 	stop_sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1"); | ||||
| 	ret = bind(miniServerStopSock, (struct sockaddr *)&stop_sockaddr, | ||||
| 		sizeof(stop_sockaddr)); | ||||
| 	if (ret == -1) { | ||||
| 	if (ret == SOCKET_ERROR) { | ||||
| 		UpnpPrintf(UPNP_CRITICAL, | ||||
| 		MSERV, __FILE__, __LINE__, | ||||
| 			"Error in binding localhost!!!\n"); | ||||
| 		sock_close(miniServerStopSock); | ||||
| 		return UPNP_E_SOCKET_BIND; | ||||
| 	} | ||||
| 	miniStopSockPort = get_port( miniServerStopSock ); | ||||
| 	if (miniStopSockPort <= 0) { | ||||
| 	ret = get_port(miniServerStopSock, &miniStopSockPort); | ||||
| 	if (ret < 0) { | ||||
| 		sock_close(miniServerStopSock); | ||||
| 		return UPNP_E_INTERNAL_ERROR; | ||||
| 	} | ||||
| @@ -813,28 +819,30 @@ static int get_miniserver_stopsock( | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| static inline void InitMiniServerSockArray(MiniServerSockArray *miniSocket) | ||||
| static UPNP_INLINE void InitMiniServerSockArray(MiniServerSockArray *miniSocket) | ||||
| { | ||||
| 	miniSocket->miniServerSock4 = -1; | ||||
| 	miniSocket->miniServerSock6 = -1; | ||||
| 	miniSocket->miniServerStopSock = -1; | ||||
| 	miniSocket->ssdpSock4 = -1; | ||||
| 	miniSocket->ssdpSock6 = -1; | ||||
| 	miniSocket->ssdpSock6UlaGua = -1; | ||||
| 	miniSocket->stopPort = -1; | ||||
| 	miniSocket->miniServerPort4 = -1; | ||||
| 	miniSocket->miniServerPort6 = -1; | ||||
| 	miniSocket->ssdpReqSock4 = -1; | ||||
| 	miniSocket->ssdpReqSock6 = -1; | ||||
| 	miniSocket->miniServerSock4 = INVALID_SOCKET; | ||||
| 	miniSocket->miniServerSock6 = INVALID_SOCKET; | ||||
| 	miniSocket->miniServerStopSock = INVALID_SOCKET; | ||||
| 	miniSocket->ssdpSock4 = INVALID_SOCKET; | ||||
| 	miniSocket->ssdpSock6 = INVALID_SOCKET; | ||||
| 	miniSocket->ssdpSock6UlaGua = INVALID_SOCKET; | ||||
| 	miniSocket->stopPort = 0u; | ||||
| 	miniSocket->miniServerPort4 = 0u; | ||||
| 	miniSocket->miniServerPort6 = 0u; | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| 	miniSocket->ssdpReqSock4 = INVALID_SOCKET; | ||||
| 	miniSocket->ssdpReqSock6 = INVALID_SOCKET; | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
| } | ||||
|  | ||||
| int StartMiniServer( | ||||
| 	/*! [in,out] Port on which the server listens for incoming IPv4 | ||||
| 	 * connections. */ | ||||
| 	unsigned short *listen_port4,  | ||||
| 	uint16_t *listen_port4,  | ||||
| 	/*! [in,out] Port on which the server listens for incoming IPv6 | ||||
| 	 * connections. */ | ||||
| 	unsigned short *listen_port6) | ||||
| 	uint16_t *listen_port6) | ||||
| { | ||||
| 	int ret_code; | ||||
| 	int count; | ||||
| @@ -842,7 +850,12 @@ int StartMiniServer( | ||||
| 	MiniServerSockArray *miniSocket; | ||||
| 	ThreadPoolJob job; | ||||
|  | ||||
| 	if (gMServState != MSERV_IDLE) { | ||||
| 	memset(&job, 0, sizeof(job)); | ||||
|  | ||||
| 	switch (gMServState) { | ||||
| 	case MSERV_IDLE: | ||||
| 		break; | ||||
| 	default: | ||||
| 		/* miniserver running. */ | ||||
| 		return UPNP_E_INTERNAL_ERROR; | ||||
| 	} | ||||
| @@ -889,15 +902,17 @@ int StartMiniServer( | ||||
| 		sock_close(miniSocket->ssdpSock4); | ||||
| 		sock_close(miniSocket->ssdpSock6); | ||||
| 		sock_close(miniSocket->ssdpSock6UlaGua); | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| 		sock_close(miniSocket->ssdpReqSock4); | ||||
| 		sock_close(miniSocket->ssdpReqSock6); | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
| 		return UPNP_E_OUTOF_MEMORY; | ||||
| 	} | ||||
| 	/* Wait for miniserver to start. */ | ||||
| 	count = 0; | ||||
| 	while (gMServState != MSERV_RUNNING && count < max_count) { | ||||
| 	while (gMServState != (MiniServerState)MSERV_RUNNING && count < max_count) { | ||||
| 		/* 0.05s */ | ||||
| 		usleep(50 * 1000); | ||||
| 		usleep(50u * 1000u); | ||||
| 		count++; | ||||
| 	} | ||||
| 	if (count >= max_count) { | ||||
| @@ -908,8 +923,10 @@ int StartMiniServer( | ||||
| 		sock_close(miniSocket->ssdpSock4); | ||||
| 		sock_close(miniSocket->ssdpSock6); | ||||
| 		sock_close(miniSocket->ssdpSock6UlaGua); | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
| 		sock_close(miniSocket->ssdpReqSock4); | ||||
| 		sock_close(miniSocket->ssdpReqSock6); | ||||
| #endif /* INCLUDE_CLIENT_APIS */ | ||||
| 		return UPNP_E_INTERNAL_ERROR; | ||||
| 	} | ||||
| #ifdef INTERNAL_WEB_SERVER | ||||
| @@ -920,43 +937,44 @@ int StartMiniServer( | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| int StopMiniServer() | ||||
| { | ||||
| 	char errorBuffer[ERROR_BUFFER_LEN]; | ||||
| 	int socklen = sizeof (struct sockaddr_in); | ||||
| 	socklen_t socklen = sizeof (struct sockaddr_in); | ||||
| 	SOCKET sock; | ||||
| 	struct sockaddr_in ssdpAddr; | ||||
| 	char buf[256] = "ShutDown"; | ||||
| 	int bufLen = strlen(buf); | ||||
| 	size_t bufLen = strlen(buf); | ||||
|  | ||||
| 	if(gMServState == MSERV_RUNNING) { | ||||
| 	switch(gMServState) { | ||||
| 	case MSERV_RUNNING: | ||||
| 		gMServState = MSERV_STOPPING; | ||||
| 	} else { | ||||
| 		break; | ||||
| 	default: | ||||
| 		return 0; | ||||
| 	} | ||||
| 	sock = socket(AF_INET, SOCK_DGRAM, 0); | ||||
| 	if (sock == -1) { | ||||
| 	if (sock == INVALID_SOCKET) { | ||||
| 		strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 		UpnpPrintf(UPNP_INFO, SSDP, __FILE__, __LINE__, | ||||
| 			"SSDP_SERVER: StopSSDPServer: Error in socket() %s\n", | ||||
| 			errorBuffer); | ||||
| 		return 0; | ||||
| 	} | ||||
| 	while(gMServState != MSERV_IDLE) { | ||||
| 		ssdpAddr.sin_family = AF_INET; | ||||
| 	while(gMServState != (MiniServerState)MSERV_IDLE) { | ||||
| 		ssdpAddr.sin_family = (sa_family_t)AF_INET; | ||||
| 		ssdpAddr.sin_addr.s_addr = inet_addr("127.0.0.1"); | ||||
| 		ssdpAddr.sin_port = htons(miniStopSockPort); | ||||
| 		sendto(sock, buf, bufLen, 0, (struct sockaddr *)&ssdpAddr, | ||||
| 			socklen); | ||||
| 		usleep(1000); | ||||
| 		if (gMServState == MSERV_IDLE) { | ||||
| 		sendto(sock, buf, bufLen, 0, | ||||
| 			(struct sockaddr *)&ssdpAddr, socklen); | ||||
| 		usleep(1000u); | ||||
| 		if (gMServState == (MiniServerState)MSERV_IDLE) { | ||||
| 			break; | ||||
| 		} | ||||
| 		isleep(1); | ||||
| 		isleep(1u); | ||||
| 	} | ||||
| 	sock_close(sock); | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| #endif /* EXCLUDE_MINISERVER */ | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,38 +1,41 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation | ||||
|  * All rights reserved. | ||||
|  * 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 a function to extract the header information from	* | ||||
| * an http message and then matches the data with XML data.				* | ||||
| ************************************************************************/ | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * Purpose: This file a function to extract the header information from | ||||
|  * an http message and then matches the data with XML data. | ||||
|  */ | ||||
|  | ||||
| #include "config.h" | ||||
| #include <assert.h> | ||||
| @@ -42,30 +45,21 @@ | ||||
| #include "statcodes.h" | ||||
| #include "parsetools.h" | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function: has_xml_content_type										 | ||||
| *																		 | ||||
| * Parameters:															 | ||||
| *	IN http_message_t* hmsg	; HTTP Message object | ||||
| *																		 | ||||
| * Description: Find the header from the HTTP message and match the		 | ||||
| *	header for xml data.												 | ||||
| *																		 | ||||
| * Returns:																 | ||||
| *	 BOOLEAN															 | ||||
| ************************************************************************/ | ||||
| xboolean | ||||
| has_xml_content_type( IN http_message_t * hmsg ) | ||||
| int has_xml_content_type(http_message_t *hmsg) | ||||
| { | ||||
| 	memptr hdr_value; | ||||
|  | ||||
| 	assert(hmsg); | ||||
|  | ||||
|     // find 'content-type' header which must have text/xml | ||||
|     if( httpmsg_find_hdr( hmsg, HDR_CONTENT_TYPE, &hdr_value ) != NULL && | ||||
|         matchstr( hdr_value.buf, hdr_value.length, | ||||
|                   "%itext%w/%wxml" ) == PARSE_OK ) { | ||||
| 	/* find 'content-type' header which must have text/xml */ | ||||
| 	if (httpmsg_find_hdr(hmsg, HDR_CONTENT_TYPE, &hdr_value)) { | ||||
| 		switch (matchstr(hdr_value.buf, hdr_value.length, "%itext%w/%wxml" )) { | ||||
| 		case PARSE_OK: | ||||
| 			return TRUE; | ||||
| 		default: | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| 	return FALSE; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,33 +1,34 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation | ||||
|  * All rights reserved. | ||||
|  * 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 status codes, buffers to store the status	* | ||||
| @@ -96,7 +97,7 @@ static const char *Http5xxStr = | ||||
|     "Service Unavailable\0" | ||||
|     "Gateway Timeout\0" "HTTP Version Not Supported\0"; | ||||
|  | ||||
| static xboolean gInitialized = FALSE; | ||||
| static int gInitialized = FALSE; | ||||
|  | ||||
| /************************************************************************ | ||||
| ************************* Functions ************************************* | ||||
| @@ -128,7 +129,7 @@ init_table( IN const char *encoded_str, | ||||
|  | ||||
|     for( i = 0; i < tbl_size; i++ ) { | ||||
|         table[i] = s; | ||||
|         s += strlen( s ) + 1;   // next entry | ||||
|         s += strlen( s ) + (size_t)1;   /* next entry */ | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -153,7 +154,7 @@ init_tables( void ) | ||||
|     init_table( Http4xxStr, Http4xxCodes, NUM_4XX_CODES ); | ||||
|     init_table( Http5xxStr, Http5xxCodes, NUM_5XX_CODES ); | ||||
|  | ||||
|     gInitialized = TRUE;        // mark only after complete | ||||
|     gInitialized = TRUE;        /* mark only after complete */ | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| @@ -179,7 +180,7 @@ http_get_code_text( int statusCode ) | ||||
|         init_tables(); | ||||
|     } | ||||
|  | ||||
|     if( statusCode < 100 && statusCode >= 600 ) { | ||||
|     if( statusCode < 100 || statusCode >= 600 ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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:  | ||||
| @@ -30,6 +31,10 @@ | ||||
|  **************************************************************************/ | ||||
|  | ||||
| /*! | ||||
|  * \addtogroup Sock | ||||
|  *  | ||||
|  * @{ | ||||
|  *  | ||||
|  * \file | ||||
|  * | ||||
|  * \brief Implements the sockets functionality. | ||||
| @@ -41,9 +46,14 @@ | ||||
|  | ||||
| #include "unixutil.h"	/* for socklen_t, EAFNOSUPPORT */ | ||||
| #include "upnp.h" | ||||
| #include "UpnpStdInt.h" /* for ssize_t */ | ||||
|  | ||||
| #include "upnpdebug.h" | ||||
| #include "upnputil.h" | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <errno.h> | ||||
| #include <fcntl.h>	/* for F_GETFL, F_SETFL, O_NONBLOCK */ | ||||
| #include <time.h> | ||||
| #include <string.h> | ||||
|  | ||||
| @@ -51,7 +61,7 @@ | ||||
| #define MSG_NOSIGNAL 0 | ||||
| #endif | ||||
|  | ||||
| int sock_init(OUT SOCKINFO *info, IN SOCKET sockfd) | ||||
| int sock_init(SOCKINFO *info, SOCKET sockfd) | ||||
| { | ||||
| 	assert(info); | ||||
|  | ||||
| @@ -61,8 +71,8 @@ int sock_init(OUT SOCKINFO *info, IN SOCKET sockfd) | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| int sock_init_with_ip(OUT SOCKINFO *info, IN SOCKET sockfd, | ||||
| 	IN struct sockaddr *foreign_sockaddr) | ||||
| int sock_init_with_ip(SOCKINFO *info, SOCKET sockfd, | ||||
| 	struct sockaddr *foreign_sockaddr) | ||||
| { | ||||
| 	int ret; | ||||
|  | ||||
| @@ -77,16 +87,21 @@ int sock_init_with_ip(OUT SOCKINFO *info, IN SOCKET sockfd, | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| int sock_destroy(INOUT SOCKINFO *info, int ShutdownMethod) | ||||
| int sock_destroy(SOCKINFO *info, int ShutdownMethod) | ||||
| { | ||||
| 	int ret = UPNP_E_SUCCESS; | ||||
| 	char errorBuffer[ERROR_BUFFER_LEN]; | ||||
|  | ||||
| 	if (info->socket != -1) { | ||||
| 		shutdown(info->socket, ShutdownMethod); | ||||
| 	if (info->socket != INVALID_SOCKET) { | ||||
| 		if (shutdown(info->socket, ShutdownMethod) == -1) { | ||||
| 			strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN); | ||||
| 			UpnpPrintf(UPNP_INFO, HTTP, __FILE__, __LINE__, | ||||
| 				   "Error in shutdown: %s\n", errorBuffer); | ||||
| 		} | ||||
| 		if (sock_close(info->socket) == -1) { | ||||
| 			ret = UPNP_E_SOCKET_ERROR; | ||||
| 		} | ||||
| 		info->socket = -1; | ||||
| 		info->socket = INVALID_SOCKET; | ||||
| 	} | ||||
|  | ||||
| 	return ret; | ||||
| @@ -102,58 +117,55 @@ int sock_destroy(INOUT SOCKINFO *info, int ShutdownMethod) | ||||
|  *	\li \c UPNP_E_SOCKET_ERROR - Error on socket calls | ||||
|  */ | ||||
| static int sock_read_write( | ||||
| 	/*! Socket Information Object. */ | ||||
| 	IN SOCKINFO *info, | ||||
| 	/*! Buffer to get data to or send data from. */ | ||||
| 	OUT char *buffer, | ||||
| 	/*! Size of the buffer. */ | ||||
| 	IN size_t bufsize, | ||||
| 	/*! timeout value. */ | ||||
| 	IN int *timeoutSecs, | ||||
| 	/*! Boolean value specifying read or write option. */ | ||||
| 	IN xboolean bRead) | ||||
| 	/*! [in] Socket Information Object. */ | ||||
| 	SOCKINFO *info, | ||||
| 	/*! [out] Buffer to get data to or send data from. */ | ||||
| 	char *buffer, | ||||
| 	/*! [in] Size of the buffer. */ | ||||
| 	size_t bufsize, | ||||
| 	/*! [in] timeout value. */ | ||||
| 	int *timeoutSecs, | ||||
| 	/*! [in] Boolean value specifying read or write option. */ | ||||
| 	int bRead) | ||||
| { | ||||
| 	int retCode; | ||||
| 	fd_set readSet; | ||||
| 	fd_set writeSet; | ||||
| 	struct timeval timeout; | ||||
| 	int numBytes; | ||||
| 	long numBytes; | ||||
| 	time_t start_time = time(NULL); | ||||
| 	SOCKET sockfd = info->socket; | ||||
| 	long bytes_sent = 0, byte_left = 0, num_written; | ||||
| 	long bytes_sent = 0; | ||||
| 	size_t byte_left = (size_t)0; | ||||
| 	ssize_t num_written; | ||||
|  | ||||
| 	if (*timeoutSecs < 0) { | ||||
| 	if (*timeoutSecs < 0) | ||||
| 		return UPNP_E_TIMEDOUT; | ||||
| 	} | ||||
| 	FD_ZERO(&readSet); | ||||
| 	FD_ZERO(&writeSet); | ||||
| 	if (bRead) { | ||||
| 	if (bRead) | ||||
| 		FD_SET(sockfd, &readSet); | ||||
| 	} else { | ||||
| 	else | ||||
| 		FD_SET(sockfd, &writeSet); | ||||
| 	} | ||||
| 	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 { | ||||
| 		else | ||||
| 			retCode = select(sockfd + 1, &readSet, &writeSet, | ||||
| 				NULL, &timeout); | ||||
| 		} | ||||
| 		if (retCode == 0) { | ||||
| 		if (retCode == 0) | ||||
| 			return UPNP_E_TIMEDOUT; | ||||
| 		} | ||||
| 		if (retCode == -1) { | ||||
| 			if (errno == EINTR) | ||||
| 				continue; | ||||
| 			return UPNP_E_SOCKET_ERROR; | ||||
| 		} else { | ||||
| 		} else | ||||
| 			/* read or write. */ | ||||
| 			break; | ||||
| 	} | ||||
| 	} | ||||
| #ifdef SO_NOSIGPIPE | ||||
| 	{ | ||||
| 		int old; | ||||
| @@ -164,11 +176,11 @@ static int sock_read_write( | ||||
| #endif | ||||
| 		if (bRead) { | ||||
| 			/* read data. */ | ||||
| 			numBytes = recv(sockfd, buffer, bufsize, MSG_NOSIGNAL); | ||||
| 			numBytes = (long)recv(sockfd, buffer, bufsize, MSG_NOSIGNAL); | ||||
| 		} else { | ||||
| 			byte_left = bufsize; | ||||
| 			bytes_sent = 0; | ||||
| 			while (byte_left > 0) { | ||||
| 			while (byte_left != (size_t)0) { | ||||
| 				/* write data. */ | ||||
| 				num_written = send(sockfd, | ||||
| 					buffer + bytes_sent, byte_left, | ||||
| @@ -178,9 +190,9 @@ static int sock_read_write( | ||||
| 					setsockopt(sockfd, SOL_SOCKET, | ||||
| 						SO_NOSIGPIPE, &old, olen); | ||||
| #endif | ||||
| 					return num_written; | ||||
| 					return (int)num_written; | ||||
| 				} | ||||
| 				byte_left = byte_left - num_written; | ||||
| 				byte_left -= (size_t)num_written; | ||||
| 				bytes_sent += num_written; | ||||
| 			} | ||||
| 			numBytes = bytes_sent; | ||||
| @@ -189,26 +201,57 @@ static int sock_read_write( | ||||
| 		setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen); | ||||
| 	} | ||||
| #endif | ||||
| 	if (numBytes < 0) { | ||||
| 	if (numBytes < 0) | ||||
| 		return UPNP_E_SOCKET_ERROR; | ||||
| 	} | ||||
| 	/* subtract time used for reading/writing. */ | ||||
| 	if (*timeoutSecs != 0) { | ||||
| 		*timeoutSecs -= time(NULL) - start_time; | ||||
| 	if (*timeoutSecs != 0) | ||||
| 		*timeoutSecs -= (int)(time(NULL) - start_time); | ||||
|  | ||||
| 	return (int)numBytes; | ||||
| } | ||||
|  | ||||
| 	return numBytes; | ||||
| } | ||||
|  | ||||
| int sock_read(IN SOCKINFO *info, OUT char *buffer, IN size_t bufsize, | ||||
| 	      INOUT int *timeoutSecs) | ||||
| int sock_read(SOCKINFO *info, char *buffer, size_t bufsize, int *timeoutSecs) | ||||
| { | ||||
| 	return sock_read_write(info, buffer, bufsize, timeoutSecs, TRUE); | ||||
| } | ||||
|  | ||||
| int sock_write(IN SOCKINFO *info, IN char *buffer, IN size_t bufsize, | ||||
| 	       INOUT int *timeoutSecs) | ||||
| int sock_write(SOCKINFO *info, const char *buffer, size_t bufsize, int *timeoutSecs) | ||||
| { | ||||
| 	return sock_read_write(info, buffer, bufsize, timeoutSecs, FALSE); | ||||
| 	/* Consciently removing constness. */ | ||||
| 	return sock_read_write(info, (char *)buffer, bufsize, timeoutSecs, FALSE); | ||||
| } | ||||
|  | ||||
| int sock_make_blocking(SOCKET sock) | ||||
| { | ||||
| #ifdef WIN32 | ||||
| 	u_long val = 0; | ||||
| 	return ioctlsocket(sock, FIONBIO, &val); | ||||
| #else | ||||
| 	int val; | ||||
|  | ||||
| 	val = fcntl(sock, F_GETFL, 0); | ||||
| 	if (fcntl(sock, F_SETFL, val & ~O_NONBLOCK) == -1) { | ||||
| 		return -1; | ||||
| 	} | ||||
| #endif | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| int sock_make_no_blocking(SOCKET sock) | ||||
| { | ||||
| #ifdef WIN32 | ||||
| 	u_long val = 1; | ||||
| 	return ioctlsocket(sock, FIONBIO, &val); | ||||
| #else /* WIN32 */ | ||||
| 	int val; | ||||
|  | ||||
| 	val = fcntl(sock, F_GETFL, 0); | ||||
| 	if (fcntl(sock, F_SETFL, val | O_NONBLOCK) == -1) { | ||||
| 		return -1; | ||||
| 	} | ||||
| #endif /* WIN32 */ | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /* @} Sock */ | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -43,6 +44,9 @@ | ||||
| 		#include <lwres/netdb.h> | ||||
| 	#endif | ||||
| #endif | ||||
| #ifdef WIN32 | ||||
| 	#define snprintf _snprintf | ||||
| #endif | ||||
| #include <assert.h> | ||||
|  | ||||
|  | ||||
| @@ -65,7 +69,7 @@ static int is_reserved( | ||||
| 	/*! [in] Char to be matched for RESERVED characters. */ | ||||
| 	char in) | ||||
| { | ||||
| 	if (strchr(RESERVED, in)) { | ||||
| 	if (strchr(RESERVED, (int)in)) { | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 		return 0; | ||||
| @@ -83,7 +87,7 @@ int is_mark( | ||||
| 	/*! [in] Char to be matched for MARKED characters. */ | ||||
| 	char in) | ||||
| { | ||||
| 	if (strchr(MARK, in)) { | ||||
| 	if (strchr(MARK, (int)in)) { | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 		return 0; | ||||
| @@ -128,23 +132,21 @@ int is_escaped( | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| int replace_escaped(char *in, int index, size_t *max) | ||||
| int replace_escaped(char *in, size_t index, size_t *max) | ||||
| { | ||||
| 	int tempInt = 0; | ||||
| 	char tempChar = 0; | ||||
| 	int i = 0; | ||||
| 	int j = 0; | ||||
| 	size_t i = (size_t)0; | ||||
| 	size_t j = (size_t)0; | ||||
|  | ||||
| 	if (in[index] == '%' && isxdigit(in[index + 1]) && isxdigit(in[index + 2])) { | ||||
| 	if (in[index] == '%' && isxdigit(in[index + (size_t)1]) && isxdigit(in[index + (size_t)2])) { | ||||
| 		/* Note the "%2x", makes sure that we convert a maximum of two | ||||
| 		 * characters. */ | ||||
| 		if (sscanf(&in[index + 1], "%2x", &tempInt) != 1) { | ||||
| 		if (sscanf(&in[index + (size_t)1], "%2x", &tempInt) != 1) { | ||||
| 			return 0; | ||||
| 		} | ||||
|  | ||||
| 		tempChar = (char)tempInt; | ||||
| 		for (i = index + 3, j = index; j < *max; i++, j++) { | ||||
| 		for (i = index + (size_t)3, j = index; j < *max; i++, j++) { | ||||
| 			in[j] = tempChar; | ||||
| 			if (i < *max) { | ||||
| 				tempChar = in[i]; | ||||
| @@ -152,7 +154,7 @@ int replace_escaped(char *in, int index, size_t *max) | ||||
| 				tempChar = 0; | ||||
| 			} | ||||
| 		} | ||||
| 		*max -= 2; | ||||
| 		*max -= (size_t)2; | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 		return 0; | ||||
| @@ -166,20 +168,20 @@ int replace_escaped(char *in, int index, size_t *max) | ||||
|  * | ||||
|  * \return  | ||||
|  */ | ||||
| static int parse_uric( | ||||
| static size_t parse_uric( | ||||
| 	/*! [in] String of characters. */ | ||||
| 	const char *in, | ||||
| 	/*! [in] Maximum limit. */ | ||||
| 	int max, | ||||
| 	size_t max, | ||||
| 	/*! [out] Token object where the string of characters is copied. */ | ||||
| 	token *out) | ||||
| { | ||||
| 	int i = 0; | ||||
| 	size_t i = (size_t)0; | ||||
|  | ||||
| 	while (i < max && | ||||
| 	       (is_unreserved(in[i]) || | ||||
| 	        is_reserved(in[i])   || | ||||
| 	        ((i + 2 < max) && is_escaped(&in[i])))) { | ||||
| 	        ((i + (size_t)2 < max) && is_escaped(&in[i])))) { | ||||
| 		i++; | ||||
| 	} | ||||
|  | ||||
| @@ -211,28 +213,24 @@ static void copy_token( | ||||
|  | ||||
| int copy_URL_list(URL_list *in, URL_list *out) | ||||
| { | ||||
|     int len = strlen( in->URLs ) + 1; | ||||
|     int i = 0; | ||||
|     size_t len = strlen(in->URLs) + (size_t)1; | ||||
|     size_t i = (size_t)0; | ||||
|  | ||||
|     out->URLs = NULL; | ||||
|     out->parsedURLs = NULL; | ||||
|     out->size = 0; | ||||
|     out->size = (size_t)0; | ||||
|  | ||||
|     out->URLs = ( char * )malloc( len ); | ||||
|     out->parsedURLs = | ||||
|         ( uri_type * ) malloc( sizeof( uri_type ) * in->size ); | ||||
|     out->URLs = malloc(len); | ||||
|     out->parsedURLs = malloc(sizeof(uri_type) * in->size); | ||||
|  | ||||
|     if( ( out->URLs == NULL ) || ( out->parsedURLs == NULL ) ) | ||||
|     if ( !out->URLs || !out->parsedURLs) | ||||
|         return UPNP_E_OUTOF_MEMORY; | ||||
|  | ||||
|     memcpy(out->URLs, in->URLs, len); | ||||
|  | ||||
|     for( i = 0; i < in->size; i++ ) { | ||||
|         //copy the parsed uri | ||||
|     for( i = (size_t)0; i < in->size; i++ ) { | ||||
|         /*copy the parsed uri */ | ||||
|         out->parsedURLs[i].type = in->parsedURLs[i].type; | ||||
|         copy_token( &in->parsedURLs[i].scheme, in->URLs, | ||||
|                     &out->parsedURLs[i].scheme, out->URLs ); | ||||
|  | ||||
|         out->parsedURLs[i].path_type = in->parsedURLs[i].path_type; | ||||
|         copy_token( &in->parsedURLs[i].pathquery, in->URLs, | ||||
|                     &out->parsedURLs[i].pathquery, out->URLs ); | ||||
| @@ -241,7 +239,6 @@ int copy_URL_list(URL_list *in, URL_list *out) | ||||
|         copy_token( &in->parsedURLs[i].hostport.text, | ||||
|                     in->URLs, &out->parsedURLs[i].hostport.text, | ||||
|                     out->URLs ); | ||||
|  | ||||
|         memcpy( &out->parsedURLs[i].hostport.IPaddress, | ||||
|             &in->parsedURLs[i].hostport.IPaddress,  | ||||
|             sizeof(struct sockaddr_storage) ); | ||||
| @@ -260,7 +257,7 @@ void free_URL_list(URL_list *list) | ||||
| 	if (list->parsedURLs) { | ||||
| 		free(list->parsedURLs); | ||||
| 	} | ||||
| 	list->size = 0; | ||||
| 	list->size = (size_t)0; | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -278,54 +275,56 @@ void print_uri(uri_type *in) | ||||
| #ifdef DEBUG | ||||
| void print_token(token * in) | ||||
| { | ||||
|     int i = 0; | ||||
| 	size_t i = 0; | ||||
|  | ||||
| 	printf("Token Size : %" PRIzu "\n\'", in->size); | ||||
|     for( i = 0; i < in->size; i++ ) { | ||||
| 	for (i = 0; i < in->size; i++) | ||||
| 		putchar(in->buff[i]); | ||||
|     } | ||||
| 	putchar('\''); | ||||
| 	putchar('\n'); | ||||
| } | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|  | ||||
| int token_string_casecmp(token *in1, char *in2) | ||||
| int token_string_casecmp(token *in1, const char *in2) | ||||
| { | ||||
| 	int in2_length = strlen(in2); | ||||
|  | ||||
| 	if (in1->size != in2_length) { | ||||
| 	size_t in2_length = strlen(in2); | ||||
| 	if (in1->size != in2_length) | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 	else | ||||
| 		return strncasecmp(in1->buff, in2, in1->size); | ||||
| } | ||||
| } | ||||
|  | ||||
|  | ||||
| int token_string_cmp(token * in1, char *in2) | ||||
| { | ||||
| 	int in2_length = strlen(in2); | ||||
|  | ||||
| 	if (in1->size != in2_length) { | ||||
| 	size_t in2_length = strlen(in2); | ||||
| 	if (in1->size != in2_length) | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 	else | ||||
| 		return strncmp(in1->buff, in2, in1->size); | ||||
| } | ||||
| } | ||||
|  | ||||
|  | ||||
| int token_cmp(token *in1, token *in2) | ||||
| { | ||||
| 	if (in1->size != in2->size) { | ||||
| 	if (in1->size != in2->size) | ||||
| 		return 1; | ||||
| 	} else { | ||||
| 	else | ||||
| 		return memcmp(in1->buff, in2->buff, in1->size); | ||||
| } | ||||
| } | ||||
|  | ||||
|  | ||||
| int parse_hostport( | ||||
| /*! | ||||
|  * \brief Parses a string representing a host and port (e.g. "127.127.0.1:80" | ||||
|  * or "localhost") and fills out a hostport_type struct with internet address | ||||
|  * and a token representing the full host and port. | ||||
|  * | ||||
|  * Uses gethostbyname. | ||||
|  */ | ||||
| static int parse_hostport( | ||||
| 	/*! [in] String of characters representing host and port. */ | ||||
| 	const char *in, | ||||
| 	int max, | ||||
| 	/*! [out] Output parameter where the host and port are represented as | ||||
| 	 * an internet address. */ | ||||
| 	hostport_type *out) | ||||
| { | ||||
| 	char workbuf[256]; | ||||
| @@ -337,54 +336,49 @@ int parse_hostport( | ||||
| 	char *last_dot = NULL; | ||||
| 	unsigned short int port; | ||||
| 	int af = AF_UNSPEC; | ||||
|     int hostport_size; | ||||
| 	size_t hostport_size; | ||||
| 	int has_port = 0; | ||||
| 	int ret; | ||||
|  | ||||
| 	memset(out, 0, sizeof(hostport_type)); | ||||
|  | ||||
|     // Work on a copy of the input string. | ||||
|     strncpy( workbuf, in, sizeof(workbuf) ); | ||||
|  | ||||
| 	memset(workbuf, 0, sizeof(workbuf)); | ||||
| 	/* Work on a copy of the input string. */ | ||||
| 	strncpy(workbuf, in, sizeof(workbuf) - 1); | ||||
| 	c = workbuf; | ||||
| 	if (*c == '[') { | ||||
|         // IPv6 addresses are enclosed in square brackets. | ||||
| 		/* IPv6 addresses are enclosed in square brackets. */ | ||||
| 		srvname = ++c; | ||||
|         while( *c != '\0'  &&  *c != ']' ) { | ||||
| 		while (*c != '\0' && *c != ']') | ||||
| 			c++; | ||||
|         } | ||||
|         if( *c == '\0' ) { | ||||
|             // did not find closing bracket. | ||||
| 		if (*c == '\0') | ||||
| 			/* did not find closing bracket. */ | ||||
| 			return UPNP_E_INVALID_URL; | ||||
|         } | ||||
|         // NULL terminate the srvname and then increment c. | ||||
|         *c++ = '\0';    // overwrite the ']' | ||||
| 		/* NULL terminate the srvname and then increment c. */ | ||||
| 		*c++ = '\0';	/* overwrite the ']' */ | ||||
| 		if (*c == ':') { | ||||
| 			has_port = 1; | ||||
| 			c++; | ||||
| 		} | ||||
| 		af = AF_INET6; | ||||
|     } | ||||
|     else { | ||||
|         // IPv4 address -OR- host name. | ||||
| 	} else { | ||||
| 		/* IPv4 address -OR- host name. */ | ||||
| 		srvname = c; | ||||
|         while( (*c != ':') && (*c != '/') && ( (isalnum(*c)) || (*c == '.') || (*c == '-') ) ) { | ||||
| 		while (*c != ':' && *c != '/' && | ||||
| 		       (isalnum(*c) || *c == '.' || *c == '-')) { | ||||
| 			if (*c == '.') | ||||
| 				last_dot = c; | ||||
| 			c++; | ||||
| 		} | ||||
| 		has_port = (*c == ':') ? 1 : 0; | ||||
|         // NULL terminate the srvname | ||||
| 		/* NULL terminate the srvname */ | ||||
| 		*c = '\0'; | ||||
| 		if (has_port == 1) | ||||
| 			c++; | ||||
|  | ||||
|         if( last_dot != NULL  &&  isdigit(*(last_dot+1)) ) { | ||||
|             // Must be an IPv4 address. | ||||
| 		if (last_dot != NULL && isdigit(*(last_dot + 1))) | ||||
| 			/* Must be an IPv4 address. */ | ||||
| 			af = AF_INET; | ||||
|         } | ||||
| 		else { | ||||
|             // Must be a host name. | ||||
| 			/* Must be a host name. */ | ||||
| 			struct addrinfo hints, *res, *res0; | ||||
|  | ||||
| 			memset(&hints, 0, sizeof(hints)); | ||||
| @@ -393,81 +387,74 @@ int parse_hostport( | ||||
|  | ||||
| 			ret = getaddrinfo(srvname, NULL, &hints, &res0); | ||||
| 			if (ret == 0) { | ||||
|                 for (res = res0; res; res = res->ai_next) { | ||||
|                     if( res->ai_family == AF_INET ||  | ||||
|                         res->ai_family == AF_INET6 ) { | ||||
|                         // Found a valid IPv4 or IPv6 address. | ||||
|                         memcpy( &out->IPaddress, res->ai_addr,  | ||||
| 				for (res = res0; res && !ret; res = res->ai_next) { | ||||
| 					switch (res->ai_family) { | ||||
| 					case AF_INET: | ||||
| 					case AF_INET6: | ||||
| 						/* Found a valid IPv4 or IPv6 address. */ | ||||
| 						memcpy(&out->IPaddress, | ||||
| 						       res->ai_addr, | ||||
| 						       res->ai_addrlen); | ||||
| 						ret=1; | ||||
| 						break; | ||||
| 					default: | ||||
| 						break; | ||||
| 					} | ||||
| 				} | ||||
| 				freeaddrinfo(res0); | ||||
|  | ||||
|                 if( res == NULL ) { | ||||
|                     // Didn't find an AF_INET or AF_INET6 address. | ||||
| 				if (res == NULL) | ||||
| 					/* Didn't find an AF_INET or AF_INET6 address. */ | ||||
| 					return UPNP_E_INVALID_URL; | ||||
| 			} else | ||||
| 				/* getaddrinfo failed. */ | ||||
| 				return UPNP_E_INVALID_URL; | ||||
| 		} | ||||
| 	} | ||||
|             else { | ||||
|                 // getaddrinfo failed. | ||||
|                 return UPNP_E_INVALID_URL; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // Check if a port is specified. | ||||
| 	/* Check if a port is specified. */ | ||||
| 	if (has_port == 1) { | ||||
|         // Port is specified. | ||||
| 		/* Port is specified. */ | ||||
| 		srvport = c; | ||||
|         while( *c != '\0'  &&  isdigit(*c) ) { | ||||
| 		while (*c != '\0' && isdigit(*c)) | ||||
| 			c++; | ||||
|         } | ||||
| 		port = (unsigned short int)atoi(srvport); | ||||
|         if( port == 0 ) { | ||||
|             // Bad port number. | ||||
| 		if (port == 0) | ||||
| 			/* Bad port number. */ | ||||
| 			return UPNP_E_INVALID_URL; | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|         // Port was not specified, use default port. | ||||
|         port = 80; | ||||
|     } | ||||
|  | ||||
|     // The length of the host and port string can be calculated by | ||||
|     // subtracting pointers. | ||||
|     hostport_size = (int)(c - workbuf); | ||||
|  | ||||
|     // Fill in the 'out' information. | ||||
|     if( af == AF_INET ) { | ||||
|         sai4->sin_family = AF_INET; | ||||
| 	} else | ||||
| 		/* Port was not specified, use default port. */ | ||||
| 		port = 80u; | ||||
| 	/* The length of the host and port string can be calculated by */ | ||||
| 	/* subtracting pointers. */ | ||||
| 	hostport_size = (size_t)c - (size_t)workbuf; | ||||
| 	/* Fill in the 'out' information. */ | ||||
| 	switch (af) { | ||||
| 	case AF_INET: | ||||
| 		sai4->sin_family = (sa_family_t)af; | ||||
| 		sai4->sin_port = htons(port); | ||||
| 		ret = inet_pton(AF_INET, srvname, &sai4->sin_addr); | ||||
|     } | ||||
|     else if( af == AF_INET6 ) { | ||||
|         sai6->sin6_family = AF_INET6; | ||||
| 		break; | ||||
| 	case AF_INET6: | ||||
| 		sai6->sin6_family = (sa_family_t)af; | ||||
| 		sai6->sin6_port = htons(port); | ||||
| 		sai6->sin6_scope_id = gIF_INDEX; | ||||
| 		ret = inet_pton(AF_INET6, srvname, &sai6->sin6_addr); | ||||
|     } else { | ||||
|         // IP address was set by the hostname (getaddrinfo). | ||||
|         // Override port: | ||||
|         if( out->IPaddress.ss_family == AF_INET ) | ||||
| 		break; | ||||
| 	default: | ||||
| 		/* IP address was set by the hostname (getaddrinfo). */ | ||||
| 		/* Override port: */ | ||||
| 		if (out->IPaddress.ss_family == (sa_family_t)AF_INET) | ||||
| 			sai4->sin_port = htons(port); | ||||
| 		else | ||||
| 			sai6->sin6_port = htons(port); | ||||
| 		ret = 1; | ||||
| 	} | ||||
|  | ||||
| 	/* Check if address was converted successfully. */ | ||||
|     if (ret <= 0) { | ||||
| 	if (ret <= 0) | ||||
| 		return UPNP_E_INVALID_URL; | ||||
|     } | ||||
|  | ||||
| 	out->text.size = hostport_size; | ||||
| 	out->text.buff = in; | ||||
|  | ||||
|     return hostport_size; | ||||
| 	return (int)hostport_size; | ||||
| } | ||||
|  | ||||
| /*! | ||||
| @@ -480,29 +467,27 @@ int parse_hostport( | ||||
|  * | ||||
|  * \return  | ||||
|  */ | ||||
| static int parse_scheme( | ||||
| static size_t parse_scheme( | ||||
| 	/*! [in] String of characters representing a scheme. */ | ||||
| 	const char *in, | ||||
| 	/*! [in] Maximum number of characters. */ | ||||
| 	int max, | ||||
| 	size_t max, | ||||
| 	/*! [out] Output parameter whose buffer is filled in with the scheme. */ | ||||
| 	token *out) | ||||
| { | ||||
|     int i = 0; | ||||
|     size_t i = (size_t)0; | ||||
|  | ||||
|     out->size = 0; | ||||
|     out->size = (size_t)0; | ||||
|     out->buff = NULL; | ||||
|  | ||||
|     if( ( max == 0 ) || ( !isalpha( in[0] ) ) ) | ||||
|         return FALSE; | ||||
|     if( ( max == (size_t)0 ) || ( !isalpha( in[0] ) ) ) | ||||
|         return (size_t)0; | ||||
|  | ||||
|     i++; | ||||
|     while( ( i < max ) && ( in[i] != ':' ) ) { | ||||
|  | ||||
|         if( !( isalnum( in[i] ) || ( in[i] == '+' ) || ( in[i] == '-' ) | ||||
|                || ( in[i] == '.' ) ) ) | ||||
|             return FALSE; | ||||
|  | ||||
|             return (size_t)0; | ||||
|         i++; | ||||
|     } | ||||
|     if( i < max ) { | ||||
| @@ -511,18 +496,18 @@ static int parse_scheme( | ||||
|         return i; | ||||
|     } | ||||
|  | ||||
|     return FALSE; | ||||
|  | ||||
|     return (size_t)0; | ||||
| } | ||||
|  | ||||
|  | ||||
| int remove_escaped_chars(INOUT char *in, INOUT size_t *size) | ||||
| { | ||||
|     int i = 0; | ||||
| 	size_t i = (size_t)0; | ||||
|  | ||||
|     for( i = 0; i < *size; i++ ) { | ||||
| 	for (i = (size_t)0; i < *size; i++) { | ||||
| 		replace_escaped(in, i, size); | ||||
| 	} | ||||
|  | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| @@ -562,7 +547,7 @@ int remove_dots(char *in, size_t size) | ||||
|                     copyTo = Segments[--lastSegment]; | ||||
|                 } else { | ||||
|                     free( Segments ); | ||||
|                     //TRACE("ERROR RESOLVING URL, ../ at ROOT"); | ||||
|                     /*TRACE("ERROR RESOLVING URL, ../ at ROOT"); */ | ||||
|                     return UPNP_E_INVALID_URL; | ||||
|                 } | ||||
|                 continue; | ||||
| @@ -597,20 +582,17 @@ char *resolve_rel_url(char *base_url, char *rel_url) | ||||
| { | ||||
|     uri_type base; | ||||
|     uri_type rel; | ||||
|     char temp_path = '/'; | ||||
|  | ||||
|     int i = 0; | ||||
|     size_t i = (size_t)0; | ||||
|     char *finger = NULL; | ||||
|  | ||||
|     char *last_slash = NULL; | ||||
|  | ||||
|     char *out = NULL; | ||||
|     char *out_finger = NULL; | ||||
|  | ||||
|     if( base_url && rel_url ) { | ||||
|         out = | ||||
|             ( char * )malloc( strlen( base_url ) + strlen( rel_url ) + 2 ); | ||||
|         out_finger = out; | ||||
|             ( char * )malloc( strlen( base_url ) + strlen( rel_url ) + (size_t)2 ); | ||||
|     } else { | ||||
|         if( rel_url ) | ||||
|             return strdup( rel_url ); | ||||
| @@ -621,51 +603,59 @@ char *resolve_rel_url(char *base_url, char *rel_url) | ||||
|     if( out == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|     memset( out, 0, strlen( base_url ) + strlen( rel_url ) + (size_t)2 ); | ||||
|  | ||||
|     if( ( parse_uri( rel_url, strlen( rel_url ), &rel ) ) == HTTP_SUCCESS ) { | ||||
|  | ||||
|         if( rel.type == ABSOLUTE ) { | ||||
|         if( rel.type == ( enum uriType) ABSOLUTE ) { | ||||
|  | ||||
|             strcpy( out, rel_url ); | ||||
|             strncpy( out, rel_url, strlen ( rel_url ) ); | ||||
|         } else { | ||||
|  | ||||
|             if( ( parse_uri( base_url, strlen( base_url ), &base ) == | ||||
|                   HTTP_SUCCESS ) | ||||
|                 && ( base.type == ABSOLUTE ) ) { | ||||
|                 && ( base.type == ( enum uriType ) ABSOLUTE ) ) { | ||||
|  | ||||
|                 if( strlen( rel_url ) == 0 ) { | ||||
|                     strcpy( out, base_url ); | ||||
|                 if( strlen( rel_url ) == (size_t)0 ) { | ||||
|                     strncpy( out, base_url, strlen ( base_url ) ); | ||||
|                 } else { | ||||
|                     char *out_finger = out; | ||||
|                     assert( base.scheme.size + (size_t)1 /* ':' */ <= strlen ( base_url ) ); | ||||
|                     memcpy( out, base.scheme.buff, base.scheme.size ); | ||||
|                     out_finger += base.scheme.size; | ||||
|                     ( *out_finger ) = ':'; | ||||
|                     out_finger++; | ||||
|  | ||||
|                     if( rel.hostport.text.size > 0 ) { | ||||
|                         sprintf( out_finger, "%s", rel_url ); | ||||
|                     if( rel.hostport.text.size > (size_t)0 ) { | ||||
|                         snprintf( out_finger, strlen( rel_url ) + (size_t)1, | ||||
|                                   "%s", rel_url ); | ||||
|                     } else { | ||||
|                         if( base.hostport.text.size > 0 ) { | ||||
|                             memcpy( out_finger, "//", 2 ); | ||||
|                         if( base.hostport.text.size > (size_t)0 ) { | ||||
|                             assert( base.scheme.size + (size_t)1 | ||||
|                                 + base.hostport.text.size + (size_t)2 /* "//" */ <= strlen ( base_url ) ); | ||||
|                             memcpy( out_finger, "//", (size_t)2 ); | ||||
|                             out_finger += 2; | ||||
|                             memcpy( out_finger, base.hostport.text.buff, | ||||
|                                     base.hostport.text.size ); | ||||
|                             out_finger += base.hostport.text.size; | ||||
|                         } | ||||
|  | ||||
|                         if( rel.path_type == ABS_PATH ) { | ||||
|                             strcpy( out_finger, rel_url ); | ||||
|                         if( rel.path_type == ( enum pathType ) ABS_PATH ) { | ||||
|                             strncpy( out_finger, rel_url, strlen ( rel_url ) ); | ||||
|  | ||||
|                         } else { | ||||
|                             char temp_path = '/'; | ||||
|  | ||||
|                             if( base.pathquery.size == 0 ) { | ||||
|                                 base.pathquery.size = 1; | ||||
|                             if( base.pathquery.size == (size_t)0 ) { | ||||
|                                 base.pathquery.size = (size_t)1; | ||||
|                                 base.pathquery.buff = &temp_path; | ||||
|                             } | ||||
|  | ||||
|                             assert( base.scheme.size + (size_t)1 + base.hostport.text.size + (size_t)2 | ||||
|                                 + base.pathquery.size <= strlen ( base_url ) + (size_t)1 /* temp_path */); | ||||
|                             finger = out_finger; | ||||
|                             last_slash = finger; | ||||
|                             i = 0; | ||||
|  | ||||
|                             i = (size_t)0; | ||||
|                             while( ( i < base.pathquery.size ) && | ||||
|                                    ( base.pathquery.buff[i] != '?' ) ) { | ||||
|                                 ( *finger ) = base.pathquery.buff[i]; | ||||
| @@ -675,8 +665,7 @@ char *resolve_rel_url(char *base_url, char *rel_url) | ||||
|                                 finger++; | ||||
|  | ||||
|                             } | ||||
|                             i = 0; | ||||
|                             strcpy( last_slash, rel_url ); | ||||
|                             strncpy( last_slash, rel_url, strlen ( rel_url ) ); | ||||
|                             if( remove_dots( out_finger, | ||||
|                                              strlen( out_finger ) ) != | ||||
|                                 UPNP_E_SUCCESS ) { | ||||
| @@ -705,13 +694,14 @@ char *resolve_rel_url(char *base_url, char *rel_url) | ||||
| } | ||||
|  | ||||
|  | ||||
| int parse_uri(const char *in, int max, uri_type *out) | ||||
| int parse_uri(const char *in, size_t max, uri_type *out) | ||||
| { | ||||
| 	int begin_path = 0; | ||||
|     int begin_hostport = 0; | ||||
|     int begin_fragment = 0; | ||||
| 	size_t begin_hostport = (size_t)0; | ||||
| 	size_t begin_fragment = (size_t)0; | ||||
|  | ||||
|     if( ( begin_hostport = parse_scheme( in, max, &out->scheme ) ) ) { | ||||
| 	begin_hostport = parse_scheme(in, max, &out->scheme); | ||||
| 	if (begin_hostport) { | ||||
| 		out->type = ABSOLUTE; | ||||
| 		out->path_type = OPAQUE_PART; | ||||
| 		begin_hostport++; | ||||
| @@ -719,44 +709,39 @@ int parse_uri(const char *in, int max, uri_type *out) | ||||
| 		out->type = RELATIVE; | ||||
| 		out->path_type = REL_PATH; | ||||
| 	} | ||||
|  | ||||
|     if( ( ( begin_hostport + 1 ) < max ) && ( in[begin_hostport] == '/' ) | ||||
|         && ( in[begin_hostport + 1] == '/' ) ) { | ||||
|         begin_hostport += 2; | ||||
|  | ||||
|         if( ( begin_path = parse_hostport( &in[begin_hostport], | ||||
|                                            max - begin_hostport, | ||||
|                                            &out->hostport ) ) >= 0 ) { | ||||
|             begin_path += begin_hostport; | ||||
| 	if (begin_hostport + (size_t)1 < max && | ||||
| 	    in[begin_hostport] == '/' && | ||||
| 	    in[begin_hostport + (size_t)1] == '/') { | ||||
| 		begin_hostport += (size_t)2; | ||||
| 		begin_path = parse_hostport(&in[begin_hostport], | ||||
| 			&out->hostport); | ||||
| 		if (begin_path >= 0) { | ||||
| 			begin_path += (int)begin_hostport; | ||||
| 		} else | ||||
| 			return begin_path; | ||||
|  | ||||
| 	} else { | ||||
| 		memset(&out->hostport, 0, sizeof(out->hostport)); | ||||
|         begin_path = begin_hostport; | ||||
| 		begin_path = (int)begin_hostport; | ||||
| 	} | ||||
|  | ||||
|     begin_fragment = | ||||
|         parse_uric( &in[begin_path], max - begin_path, | ||||
|                     &out->pathquery ) + begin_path; | ||||
|  | ||||
|     if( ( out->pathquery.size ) && ( out->pathquery.buff[0] == '/' ) ) { | ||||
| 	begin_fragment = parse_uric(&in[begin_path], | ||||
| 		max - (size_t)begin_path, | ||||
| 		&out->pathquery) + (size_t)begin_path; | ||||
| 	if (out->pathquery.size && out->pathquery.buff[0] == '/') { | ||||
| 		out->path_type = ABS_PATH; | ||||
| 	} | ||||
|  | ||||
|     if( ( begin_fragment < max ) && ( in[begin_fragment] == '#' ) ) { | ||||
| 	if (begin_fragment < max && in[begin_fragment] == '#') { | ||||
| 		begin_fragment++; | ||||
| 		parse_uric(&in[begin_fragment], max - begin_fragment, | ||||
| 			   &out->fragment); | ||||
| 	} else { | ||||
| 		out->fragment.buff = NULL; | ||||
|         out->fragment.size = 0; | ||||
| 		out->fragment.size = (size_t)0; | ||||
| 	} | ||||
|  | ||||
| 	return HTTP_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| int parse_uri_and_unescape(char *in, int max, uri_type *out) | ||||
| int parse_uri_and_unescape(char *in, size_t max, uri_type *out) | ||||
| { | ||||
| 	int ret = parse_uri(in, max, out); | ||||
|  | ||||
| @@ -764,10 +749,10 @@ int parse_uri_and_unescape(char *in, int max, uri_type *out) | ||||
| 		return ret; | ||||
| 	} | ||||
|  | ||||
| 	if (out->pathquery.size > 0) { | ||||
| 	if (out->pathquery.size > (size_t)0) { | ||||
| 		remove_escaped_chars((char *)out->pathquery.buff, &out->pathquery.size); | ||||
| 	} | ||||
| 	if (out->fragment.size > 0) { | ||||
| 	if (out->fragment.size > (size_t)0) { | ||||
| 		remove_escaped_chars((char *)out->fragment.buff, &out->fragment.size); | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -42,6 +43,7 @@ | ||||
|  | ||||
| #ifdef INCLUDE_DEVICE_APIS | ||||
|  | ||||
| #if EXCLUDE_GENA == 0 | ||||
| /************************************************************************ | ||||
| *	Function :	copy_subscription | ||||
| * | ||||
| @@ -52,7 +54,7 @@ | ||||
| *	Description :	Makes a copy of the subscription | ||||
| * | ||||
| *	Return : int ; | ||||
| *		HTTP_SUCCESS - On Sucess | ||||
| *		HTTP_SUCCESS - On success | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| @@ -135,7 +137,7 @@ subscription *GetSubscriptionSID(const Upnp_SID sid, service_info *service) | ||||
|         } | ||||
|     } | ||||
|     if( found ) { | ||||
|         //get the current_time | ||||
|         /*get the current_time */ | ||||
|         time( ¤t_time ); | ||||
|         if( ( found->expireTime != 0 ) | ||||
|             && ( found->expireTime < current_time ) ) { | ||||
| @@ -161,7 +163,7 @@ subscription *GetNextSubscription(service_info *service, subscription *current) | ||||
|     subscription *previous = NULL; | ||||
|     int notDone = 1; | ||||
|  | ||||
|     // get the current_time | ||||
|     /* get the current_time */ | ||||
|     time( ¤t_time ); | ||||
|     while( ( notDone ) && ( current ) ) { | ||||
|         previous = current; | ||||
| @@ -195,7 +197,7 @@ subscription *GetFirstSubscription(service_info *service) | ||||
| 	temp.next = service->subscriptionList; | ||||
| 	next = GetNextSubscription(service, &temp); | ||||
| 	service->subscriptionList = temp.next; | ||||
| 	// service->subscriptionList = next; | ||||
| 	/* service->subscriptionList = next; */ | ||||
| 	 | ||||
| 	return next; | ||||
| } | ||||
| @@ -321,6 +323,7 @@ FindServiceEventURLPath( service_table * table, | ||||
|  | ||||
|     return NULL; | ||||
| } | ||||
| #endif /* EXCLUDE_GENA */ | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	FindServiceControlURLPath | ||||
| @@ -338,6 +341,7 @@ FindServiceEventURLPath( service_table * table, | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| #if EXCLUDE_SOAP == 0 | ||||
| service_info * | ||||
| FindServiceControlURLPath( service_table * table, | ||||
|                            const char *controlURLPath ) | ||||
| @@ -369,6 +373,7 @@ FindServiceControlURLPath( service_table * table, | ||||
|     return NULL; | ||||
|  | ||||
| } | ||||
| #endif /* EXCLUDE_SOAP */ | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	printService | ||||
| @@ -514,6 +519,7 @@ void printServiceTable( | ||||
|     printServiceList( table->serviceList, level, module );} | ||||
| #endif | ||||
|  | ||||
| #if EXCLUDE_GENA == 0 | ||||
| /************************************************************************ | ||||
| *	Function :	freeService | ||||
| * | ||||
| @@ -718,8 +724,8 @@ getSubElement( const char *element_name, | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| service_info * | ||||
| getServiceList( IXML_Node * node, | ||||
| service_info *getServiceList( | ||||
| 	IXML_Node *node, | ||||
| 	service_info **end, | ||||
| 	char *URLBase) | ||||
| { | ||||
| @@ -737,43 +743,33 @@ getServiceList( IXML_Node * node, | ||||
| 	service_info *current = NULL; | ||||
| 	service_info *previous = NULL; | ||||
| 	IXML_NodeList *serviceNodeList = NULL; | ||||
|     int NumOfServices = 0; | ||||
|     int i = 0; | ||||
| 	long unsigned int NumOfServices = 0lu; | ||||
| 	long unsigned int i = 0lu; | ||||
| 	int fail = 0; | ||||
|  | ||||
| 	if (getSubElement("UDN", node, &UDN) && | ||||
| 	    getSubElement("serviceList", node, &serviceList)) { | ||||
|  | ||||
|         serviceNodeList = ixmlElement_getElementsByTagName( ( IXML_Element | ||||
|                                                               * ) | ||||
|                                                             serviceList, | ||||
|                                                             "service" ); | ||||
|  | ||||
| 		serviceNodeList = ixmlElement_getElementsByTagName( | ||||
| 			(IXML_Element *)serviceList, "service"); | ||||
| 		if (serviceNodeList != NULL) { | ||||
| 			NumOfServices = ixmlNodeList_length(serviceNodeList); | ||||
|             for( i = 0; i < NumOfServices; i++ ) { | ||||
|                 current_service = ixmlNodeList_item( serviceNodeList, i ); | ||||
| 			for (i = 0lu; i < NumOfServices; i++) { | ||||
| 				current_service = | ||||
| 				    ixmlNodeList_item(serviceNodeList, i); | ||||
| 				fail = 0; | ||||
|  | ||||
| 				if (current) { | ||||
|                     current->next = | ||||
|                         ( service_info * ) | ||||
|                         malloc( sizeof( service_info ) ); | ||||
|  | ||||
| 					current->next = malloc(sizeof(service_info)); | ||||
| 					previous = current; | ||||
| 					current = current->next; | ||||
| 				} else { | ||||
|                     head = | ||||
|                         ( service_info * ) | ||||
|                         malloc( sizeof( service_info ) ); | ||||
| 					head = malloc(sizeof(service_info)); | ||||
| 					current = head; | ||||
| 				} | ||||
|  | ||||
| 				if (!current) { | ||||
| 					freeServiceList(head); | ||||
| 					ixmlNodeList_free(serviceNodeList); | ||||
| 					return NULL; | ||||
| 				} | ||||
|  | ||||
| 				current->next = NULL; | ||||
| 				current->controlURL = NULL; | ||||
| 				current->eventURL = NULL; | ||||
| @@ -783,99 +779,65 @@ getServiceList( IXML_Node * node, | ||||
| 				current->active = 1; | ||||
| 				current->subscriptionList = NULL; | ||||
| 				current->TotalSubscriptions = 0; | ||||
|  | ||||
| 				if (!(current->UDN = getElementValue(UDN))) | ||||
| 					fail = 1; | ||||
|  | ||||
|                 if( ( !getSubElement( "serviceType", current_service, | ||||
|                                       &serviceType ) ) || | ||||
|                     ( !( current->serviceType = | ||||
|                          getElementValue( serviceType ) ) ) ) | ||||
| 				if (!getSubElement("serviceType", current_service, &serviceType) || | ||||
| 				    !(current->serviceType = getElementValue(serviceType))) | ||||
| 					fail = 1; | ||||
|  | ||||
|                 if( ( !getSubElement( "serviceId", current_service, | ||||
|                                       &serviceId ) ) || | ||||
|                     ( ! | ||||
|                       ( current->serviceId = | ||||
|                         getElementValue( serviceId ) ) ) ) | ||||
| 				if (!getSubElement("serviceId", current_service, &serviceId) || | ||||
| 				    !(current->serviceId = getElementValue(serviceId))) | ||||
| 					fail = 1; | ||||
|  | ||||
|                 if( ( ! | ||||
|                       ( getSubElement | ||||
|                         ( "SCPDURL", current_service, &SCPDURL ) ) ) | ||||
|                     || ( !( tempDOMString = getElementValue( SCPDURL ) ) ) | ||||
|                     || | ||||
|                     ( ! | ||||
|                       ( current->SCPDURL = | ||||
|                         resolve_rel_url( URLBase, tempDOMString ) ) ) ) | ||||
| 				if (!getSubElement("SCPDURL", current_service, &SCPDURL) || | ||||
| 				    !(tempDOMString = getElementValue(SCPDURL)) || | ||||
| 				    !(current->SCPDURL = resolve_rel_url(URLBase, tempDOMString))) | ||||
| 					fail = 1; | ||||
|  | ||||
| 				ixmlFreeDOMString(tempDOMString); | ||||
| 				tempDOMString = NULL; | ||||
|  | ||||
|                 if( ( ! | ||||
|                       ( getSubElement | ||||
|                         ( "controlURL", current_service, &controlURL ) ) ) | ||||
|                     || | ||||
|                     ( !( tempDOMString = getElementValue( controlURL ) ) ) | ||||
|                     || | ||||
|                     ( ! | ||||
|                       ( current->controlURL = | ||||
|                         resolve_rel_url( URLBase, tempDOMString ) ) ) ) { | ||||
|                     UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 				if (!(getSubElement("controlURL", current_service, &controlURL)) || | ||||
| 				    !(tempDOMString = getElementValue(controlURL)) || | ||||
| 				    !(current->controlURL = resolve_rel_url(URLBase, tempDOMString))) { | ||||
| 					UpnpPrintf(UPNP_INFO, GENA, __FILE__, | ||||
| 						   __LINE__, | ||||
| 						   "BAD OR MISSING CONTROL URL"); | ||||
|                     UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 					UpnpPrintf(UPNP_INFO, GENA, __FILE__, | ||||
| 						   __LINE__, | ||||
| 						   "CONTROL URL SET TO NULL IN SERVICE INFO"); | ||||
| 					current->controlURL = NULL; | ||||
| 					fail = 0; | ||||
| 				} | ||||
|  | ||||
| 				ixmlFreeDOMString(tempDOMString); | ||||
| 				tempDOMString = NULL; | ||||
|  | ||||
|                 if( ( ! | ||||
|                       ( getSubElement | ||||
|                         ( "eventSubURL", current_service, &eventURL ) ) ) | ||||
|                     || ( !( tempDOMString = getElementValue( eventURL ) ) ) | ||||
|                     || | ||||
|                     ( ! | ||||
|                       ( current->eventURL = | ||||
|                         resolve_rel_url( URLBase, tempDOMString ) ) ) ) { | ||||
|                     UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 				if (!getSubElement("eventSubURL", current_service, &eventURL) || | ||||
| 				    !(tempDOMString = getElementValue(eventURL)) || | ||||
| 				    !(current->eventURL = resolve_rel_url(URLBase, tempDOMString))) { | ||||
| 					UpnpPrintf(UPNP_INFO, GENA, __FILE__, | ||||
| 						   __LINE__, | ||||
| 						   "BAD OR MISSING EVENT URL"); | ||||
|                     UpnpPrintf( UPNP_INFO, GENA, __FILE__, __LINE__, | ||||
| 					UpnpPrintf(UPNP_INFO, GENA, __FILE__, | ||||
| 						   __LINE__, | ||||
| 						   "EVENT URL SET TO NULL IN SERVICE INFO"); | ||||
| 					current->eventURL = NULL; | ||||
| 					fail = 0; | ||||
| 				} | ||||
|  | ||||
| 				ixmlFreeDOMString(tempDOMString); | ||||
| 				tempDOMString = NULL; | ||||
|  | ||||
| 				if (fail) { | ||||
| 					freeServiceList(current); | ||||
|  | ||||
| 					if (previous) | ||||
| 						previous->next = NULL; | ||||
| 					else | ||||
| 						head = NULL; | ||||
|  | ||||
| 					current = previous; | ||||
| 				} | ||||
|  | ||||
| 			} | ||||
|  | ||||
| 			ixmlNodeList_free(serviceNodeList); | ||||
| 		} | ||||
|  | ||||
| 		(*end) = current; | ||||
|  | ||||
| 		return head; | ||||
| 	} else { | ||||
| 		(*end) = NULL; | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| @@ -905,28 +867,26 @@ getAllServiceList( IXML_Node * node, | ||||
| 	IXML_NodeList *deviceList = NULL; | ||||
| 	IXML_Node *currentDevice = NULL; | ||||
|  | ||||
|     int NumOfDevices = 0; | ||||
|     int i = 0; | ||||
| 	long unsigned int NumOfDevices = 0lu; | ||||
| 	long unsigned int i = 0lu; | ||||
|  | ||||
| 	(*out_end) = NULL; | ||||
|  | ||||
|     deviceList = | ||||
|         ixmlElement_getElementsByTagName( ( IXML_Element * ) node, | ||||
|                                           "device" ); | ||||
|     if( deviceList != NULL ) { | ||||
| 	deviceList = ixmlElement_getElementsByTagName( | ||||
| 		(IXML_Element *)node, "device"); | ||||
| 	if (deviceList) { | ||||
| 		NumOfDevices = ixmlNodeList_length(deviceList); | ||||
|         for( i = 0; i < NumOfDevices; i++ ) { | ||||
| 		for (i = 0lu; i < NumOfDevices; i++) { | ||||
| 			currentDevice = ixmlNodeList_item(deviceList, i); | ||||
| 			if (head) { | ||||
|                 end->next = | ||||
|                     getServiceList( currentDevice, &next_end, URLBase ); | ||||
| 				end->next = getServiceList(currentDevice, | ||||
| 					&next_end, URLBase); | ||||
| 				if (next_end) | ||||
| 					end = next_end; | ||||
| 			} else | ||||
|                 head = getServiceList( currentDevice, &end, URLBase ); | ||||
|  | ||||
| 				head = getServiceList(currentDevice, &end, | ||||
| 					URLBase); | ||||
| 		} | ||||
|  | ||||
| 		ixmlNodeList_free(deviceList); | ||||
| 	} | ||||
|  | ||||
| @@ -959,12 +919,11 @@ removeServiceTable( IXML_Node * node, | ||||
|     IXML_Node *currentUDN = NULL; | ||||
|     DOMString UDN = NULL; | ||||
|     IXML_NodeList *deviceList = NULL; | ||||
|     IXML_Node *currentDevice = NULL; | ||||
|     service_info *current_service = NULL; | ||||
|     service_info *start_search = NULL; | ||||
|     service_info *prev_service = NULL; | ||||
|     int NumOfDevices = 0; | ||||
|     int i = 0; | ||||
|     long unsigned int NumOfDevices = 0lu; | ||||
|     long unsigned int i = 0lu; | ||||
|  | ||||
|     if( getSubElement( "root", node, &root ) ) { | ||||
|         current_service = in->serviceList; | ||||
| @@ -974,18 +933,18 @@ removeServiceTable( IXML_Node * node, | ||||
|                                               "device" ); | ||||
|         if( deviceList != NULL ) { | ||||
|             NumOfDevices = ixmlNodeList_length( deviceList ); | ||||
|             for( i = 0; i < NumOfDevices; i++ ) { | ||||
|                 currentDevice = ixmlNodeList_item( deviceList, i ); | ||||
|             for( i = 0lu; i < NumOfDevices; i++ ) { | ||||
|                 if( ( start_search ) | ||||
|                     && ( ( getSubElement( "UDN", node, ¤tUDN ) ) | ||||
|                          && ( UDN = getElementValue( currentUDN ) ) ) ) { | ||||
|                     current_service = start_search; | ||||
|                     //Services are put in the service table in the order in which they appear in the  | ||||
|                     //description document, therefore we go through the list only once to remove a particular | ||||
|                     //root device | ||||
|                     /*Services are put in the service table in the order in which they appear in the  */ | ||||
|                     /*description document, therefore we go through the list only once to remove a particular */ | ||||
|                     /*root device */ | ||||
|                     while( ( current_service ) | ||||
|                            && ( strcmp( current_service->UDN, UDN ) ) ) { | ||||
|                         current_service = current_service->next; | ||||
| 			if( current_service != NULL)  | ||||
|                         	prev_service = current_service->next; | ||||
|                     } | ||||
|                     while( ( current_service ) | ||||
| @@ -1001,6 +960,8 @@ removeServiceTable( IXML_Node * node, | ||||
|                         freeService( current_service ); | ||||
|                         current_service = start_search; | ||||
|                     } | ||||
|                     ixmlFreeDOMString( UDN ); | ||||
|                     UDN = NULL; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @@ -1107,5 +1068,7 @@ getServiceTable( IXML_Node * node, | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
| #endif /* EXCLUDE_GENA */ | ||||
|  | ||||
| #endif /* INCLUDE_DEVICE_APIS */ | ||||
|  | ||||
| #endif // INCLUDE_DEVICE_APIS | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -29,48 +30,28 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| /************************************************************************ | ||||
| * Purpose: This file contains functions that operate on memory and  | ||||
| *	buffers, allocation, re-allocation, and modification of the memory  | ||||
| ************************************************************************/ | ||||
| /* | ||||
|  * \file | ||||
|  * | ||||
|  * \brief This file contains functions that operate on memory and buffers, | ||||
|  * allocation, re-allocation, and modification of the memory | ||||
|  */ | ||||
|  | ||||
| #include "config.h" | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <membuffer.h> | ||||
| #include "membuffer.h" | ||||
| #include "upnp.h" | ||||
| #include "unixutil.h" | ||||
|  | ||||
| /************************************************************************ | ||||
| *								 string									* | ||||
| ************************************************************************/ | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	str_alloc | ||||
| * | ||||
| *	Parameters : | ||||
| *		IN const char* str ;	input string object | ||||
| *		IN size_t str_len ;		input string length | ||||
| * | ||||
| *	Description :	Allocate memory and copy information from the input  | ||||
| *		string to the newly allocated memory. | ||||
| * | ||||
| *	Return : char* ; | ||||
| *		Pointer to the newly allocated memory. | ||||
| *		NULL if memory cannot be allocated. | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| char * | ||||
| str_alloc( IN const char *str, | ||||
|            IN size_t str_len ) | ||||
| char *str_alloc(const char *str, size_t str_len) | ||||
| { | ||||
| 	char *s; | ||||
|  | ||||
|     s = ( char * )malloc( str_len + 1 ); | ||||
| 	s = (char *)malloc(str_len + (size_t)1); | ||||
| 	if (s == NULL) { | ||||
|         return NULL;            // no mem | ||||
| 		return NULL;	/* no mem */ | ||||
| 	} | ||||
|  | ||||
| 	memcpy(s, str, str_len); | ||||
| @@ -79,145 +60,66 @@ str_alloc( IN const char *str, | ||||
| 	return s; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *								memptr									* | ||||
| ************************************************************************/ | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	memptr_cmp | ||||
| * | ||||
| *	Parameters : | ||||
| *		IN memptr* m ;	input memory object | ||||
| *		IN const char* s ;	constatnt string for the memory object to be  | ||||
| *					compared with | ||||
| * | ||||
| *	Description : Compares characters of strings passed for number of  | ||||
| *		bytes. If equal for the number of bytes, the length of the bytes  | ||||
| *		determines which buffer is shorter. | ||||
| * | ||||
| *	Return : int ; | ||||
| *		< 0 string1 substring less than string2 substring  | ||||
| *		0 string1 substring identical to string2 substring  | ||||
| *		> 0 string1 substring greater than string2 substring  | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| memptr_cmp( IN memptr * m, | ||||
|             IN const char *s ) | ||||
| int memptr_cmp(memptr * m, const char *s) | ||||
| { | ||||
| 	int cmp; | ||||
|  | ||||
| 	cmp = strncmp(m->buf, s, m->length); | ||||
|  | ||||
| 	if (cmp == 0 && m->length < strlen(s)) { | ||||
|         // both strings equal for 'm->length' chars | ||||
|         //  if m is shorter than s, then s is greater | ||||
| 		/* both strings equal for 'm->length' chars */ | ||||
| 		/*  if m is shorter than s, then s is greater */ | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	return cmp; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	memptr_cmp_nocase | ||||
| * | ||||
| *	Parameters : | ||||
| *		IN memptr* m ;	input memory object | ||||
| *		IN const char* s ;	constatnt string for the memory object to be  | ||||
| *					compared with | ||||
| * | ||||
| *	Description : Compares characters of 2 strings irrespective of the  | ||||
| *		case for a specific count of bytes  If the character comparison  | ||||
| *		is the same the length of the 2 srings determines the shorter  | ||||
| *		of the 2 strings. | ||||
| * | ||||
| *	Return : int ; | ||||
| *		< 0 string1 substring less than string2 substring  | ||||
| *		0 string1 substring identical to string2 substring  | ||||
| *		> 0 string1 substring greater than string2 substring  | ||||
| *   | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| memptr_cmp_nocase( IN memptr * m, | ||||
|                    IN const char *s ) | ||||
| int memptr_cmp_nocase(memptr * m, const char *s) | ||||
| { | ||||
| 	int cmp; | ||||
|  | ||||
| 	cmp = strncasecmp(m->buf, s, m->length); | ||||
| 	if (cmp == 0 && m->length < strlen(s)) { | ||||
|         // both strings equal for 'm->length' chars | ||||
|         //  if m is shorter than s, then s is greater | ||||
| 		/* both strings equal for 'm->length' chars */ | ||||
| 		/*  if m is shorter than s, then s is greater */ | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	return cmp; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *							 membuffer									* | ||||
| ************************************************************************/ | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_initialize | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ;	buffer to be initialized | ||||
| * | ||||
| *	Description :	Initialize the buffer | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| static UPNP_INLINE void | ||||
| membuffer_initialize( INOUT membuffer * m ) | ||||
| /*! | ||||
|  * \brief Initialize the buffer. | ||||
|  */ | ||||
| static UPNP_INLINE void membuffer_initialize( | ||||
| 	/*! [in,out] Buffer to be initialized. */ | ||||
| 	membuffer *m) | ||||
| { | ||||
| 	m->buf = NULL; | ||||
|     m->length = 0; | ||||
|     m->capacity = 0; | ||||
| 	m->length = (size_t)0; | ||||
| 	m->capacity = (size_t)0; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_set_size | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ;	buffer whose size is to be modified | ||||
| *		IN size_t new_length ;	new size to which the buffer will be  | ||||
| *					modified | ||||
| * | ||||
| *	Description : Increases or decreases buffer cap so that at least | ||||
| *	   'new_length' bytes can be stored | ||||
| * | ||||
| *	Return : int ; | ||||
| *		UPNP_E_SUCCESS - On Success | ||||
| *		UPNP_E_OUTOF_MEMORY - On failure to allocate memory. | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| membuffer_set_size( INOUT membuffer * m, | ||||
|                     IN size_t new_length ) | ||||
| int membuffer_set_size(membuffer *m, size_t new_length) | ||||
| { | ||||
| 	size_t diff; | ||||
| 	size_t alloc_len; | ||||
| 	char *temp_buf; | ||||
|  | ||||
|     if( new_length >= m->length )   // increase length | ||||
|     { | ||||
|         // need more mem? | ||||
| 	if (new_length >= m->length) {	/* increase length */ | ||||
| 		/* need more mem? */ | ||||
| 		if (new_length <= m->capacity) { | ||||
|             return 0;           // have enough mem; done | ||||
| 			return 0;	/* have enough mem; done */ | ||||
| 		} | ||||
|  | ||||
| 		diff = new_length - m->length; | ||||
| 		alloc_len = MAXVAL(m->size_inc, diff) + m->capacity; | ||||
|     } else                      // decrease length | ||||
|     { | ||||
| 	} else {		/* decrease length */ | ||||
|  | ||||
| 		assert(new_length <= m->length); | ||||
|  | ||||
|         // if diff is 0..m->size_inc, don't free | ||||
| 		/* if diff is 0..m->size_inc, don't free */ | ||||
| 		if ((m->capacity - new_length) <= m->size_inc) { | ||||
| 			return 0; | ||||
| 		} | ||||
| @@ -227,42 +129,27 @@ membuffer_set_size( INOUT membuffer * m, | ||||
|  | ||||
| 	assert(alloc_len >= new_length); | ||||
|  | ||||
|     temp_buf = realloc( m->buf, alloc_len + 1 );    //LEAK_FIX_MK | ||||
| 	temp_buf = realloc(m->buf, alloc_len + (size_t)1);	/*LEAK_FIX_MK */ | ||||
|  | ||||
|     //temp_buf = Realloc( m->buf,m->length, alloc_len + 1 );//LEAK_FIX_MK | ||||
| 	/*temp_buf = Realloc( m->buf,m->length, alloc_len + 1 );LEAK_FIX_MK */ | ||||
|  | ||||
| 	if (temp_buf == NULL) { | ||||
|         // try smaller size | ||||
| 		/* try smaller size */ | ||||
| 		alloc_len = new_length; | ||||
|         temp_buf = realloc( m->buf, alloc_len + 1 );    //LEAK_FIX_MK | ||||
|         //temp_buf = Realloc( m->buf,m->length, alloc_len + 1 );//LEAK_FIX_MK | ||||
| 		temp_buf = realloc(m->buf, alloc_len + (size_t)1);	/*LEAK_FIX_MK */ | ||||
| 		/*temp_buf = Realloc( m->buf,m->length, alloc_len + 1 );LEAK_FIX_MK */ | ||||
|  | ||||
| 		if (temp_buf == NULL) { | ||||
| 			return UPNP_E_OUTOF_MEMORY; | ||||
| 		} | ||||
| 	} | ||||
|     // save | ||||
| 	/* save */ | ||||
| 	m->buf = temp_buf; | ||||
| 	m->capacity = alloc_len; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_init | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ; buffer	to be initialized | ||||
| * | ||||
| *	Description : Wrapper to membuffer_initialize(). | ||||
| *		Set the size of the buffer to MEMBUF_DEF_SIZE_INC | ||||
| *		Initializes m->buf to NULL, length=0 | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| void | ||||
| membuffer_init( INOUT membuffer * m ) | ||||
| void membuffer_init(membuffer *m) | ||||
| { | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| @@ -270,20 +157,7 @@ membuffer_init( INOUT membuffer * m ) | ||||
| 	membuffer_initialize(m); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_destroy | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ;	buffer to be destroyed | ||||
| * | ||||
| *	Description : Free's memory allocated for membuffer* m. | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| void | ||||
| membuffer_destroy( INOUT membuffer * m ) | ||||
| void membuffer_destroy(membuffer *m) | ||||
| { | ||||
| 	if (m == NULL) { | ||||
| 		return; | ||||
| @@ -293,249 +167,110 @@ membuffer_destroy( INOUT membuffer * m ) | ||||
| 	membuffer_init(m); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_assign | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ; buffer whose memory is to be allocated and  | ||||
| *					assigned. | ||||
| *		IN const void* buf ; source buffer whose contents will be copied | ||||
| *		IN size_t buf_len ;	 length of the source buffer | ||||
| * | ||||
| *	Description : Allocate memory to membuffer* m and copy the contents  | ||||
| *		of the in parameter IN const void* buf. | ||||
| * | ||||
| *	Return : int ; | ||||
| *	 UPNP_E_SUCCESS | ||||
| *	 UPNP_E_OUTOF_MEMORY | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| membuffer_assign( INOUT membuffer * m, | ||||
|                   IN const void *buf, | ||||
|                   IN size_t buf_len ) | ||||
| int membuffer_assign(membuffer *m, const void *buf, size_t buf_len) | ||||
| { | ||||
| 	int return_code; | ||||
|  | ||||
| 	assert(m != NULL); | ||||
|  | ||||
|     // set value to null | ||||
| 	/* set value to null */ | ||||
| 	if (buf == NULL) { | ||||
| 		membuffer_destroy(m); | ||||
| 		return 0; | ||||
| 	} | ||||
|     // alloc mem | ||||
| 	/* alloc mem */ | ||||
| 	return_code = membuffer_set_size(m, buf_len); | ||||
|     if( return_code != 0 ) { | ||||
| 	if (return_code != 0) | ||||
| 		return return_code; | ||||
|     } | ||||
|     // copy | ||||
| 	/* copy */ | ||||
| 	if (buf_len) { | ||||
| 		memcpy(m->buf, buf, buf_len); | ||||
|         m->buf[buf_len] = 0;        // null-terminate | ||||
| 		m->buf[buf_len] = 0;	/* null-terminate */ | ||||
| 	} | ||||
| 	m->length = buf_len; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_assign_str | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ;	buffer to be allocated and assigned | ||||
| *		IN const char* c_str ;	source buffer whose contents will be  | ||||
| *					copied | ||||
| * | ||||
| *	Description : Wrapper function for membuffer_assign() | ||||
| * | ||||
| *	Return : int ; | ||||
| *	 UPNP_E_SUCCESS | ||||
| *	 UPNP_E_OUTOF_MEMORY | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| membuffer_assign_str( INOUT membuffer * m, | ||||
|                       IN const char *c_str ) | ||||
| int membuffer_assign_str(membuffer *m, const char *c_str) | ||||
| { | ||||
| 	return membuffer_assign(m, c_str, strlen(c_str)); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_append | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ; buffer whose memory is to be appended. | ||||
| *		IN const void* buf ; source buffer whose contents will be  | ||||
| *					copied | ||||
| *		IN size_t buf_len ;	length of the source buffer | ||||
| * | ||||
| *	Description : Invokes function to appends data from a constant buffer  | ||||
| *		to the buffer  | ||||
| * | ||||
| *	Return : int ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| membuffer_append( INOUT membuffer * m, | ||||
|                   IN const void *buf, | ||||
|                   IN size_t buf_len ) | ||||
| int membuffer_append(membuffer *m, const void *buf, size_t buf_len) | ||||
| { | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| 	return membuffer_insert(m, buf, buf_len, m->length); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_append_str | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ;	buffer whose memory is to be appended. | ||||
| *		IN const char* c_str ;	source buffer whose contents will be  | ||||
| *					copied | ||||
| * | ||||
| *	Description : Invokes function to appends data from a constant string  | ||||
| *		to the buffer 	 | ||||
| * | ||||
| *	Return : int ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| membuffer_append_str( INOUT membuffer * m, | ||||
|                       IN const char *c_str ) | ||||
| int membuffer_append_str(membuffer *m, const char *c_str) | ||||
| { | ||||
| 	return membuffer_insert(m, c_str, strlen(c_str), m->length); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_insert | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ; buffer whose memory size is to be increased   | ||||
| *					and appended. | ||||
| *		IN const void* buf ; source buffer whose contents will be  | ||||
| *					copied | ||||
| *		 IN size_t buf_len ; size of the source buffer | ||||
| *		int index ;	index to determine the bounds while movinf the data | ||||
| * | ||||
| *	Description : Allocates memory for the new data to be inserted. Does | ||||
| *		memory management by moving the data from the existing memory to  | ||||
| *		the newly allocated memory and then appending the new data. | ||||
| * | ||||
| *	Return : int ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| int | ||||
| membuffer_insert( INOUT membuffer * m, | ||||
|                   IN const void *buf, | ||||
|                   IN size_t buf_len, | ||||
|                   int index ) | ||||
| int membuffer_insert(membuffer * m, const void *buf, size_t buf_len, | ||||
| 		     size_t index) | ||||
| { | ||||
| 	int return_code; | ||||
|  | ||||
| 	assert(m != NULL); | ||||
|  | ||||
|     if( index < 0 || index > ( int )m->length ) | ||||
| 	if (index > m->length) | ||||
| 		return UPNP_E_OUTOF_BOUNDS; | ||||
|  | ||||
|     if( buf == NULL || buf_len == 0 ) { | ||||
| 	if (!buf || !buf_len) { | ||||
| 		return 0; | ||||
| 	} | ||||
|     // alloc mem | ||||
| 	/* alloc mem */ | ||||
| 	return_code = membuffer_set_size(m, m->length + buf_len); | ||||
|     if( return_code != 0 ) { | ||||
| 	if (return_code) { | ||||
| 		return return_code; | ||||
| 	} | ||||
|     // insert data | ||||
|  | ||||
|     // move data to right of insertion point | ||||
| 	/* insert data */ | ||||
| 	/* move data to right of insertion point */ | ||||
| 	memmove(m->buf + index + buf_len, m->buf + index, m->length - index); | ||||
| 	memcpy(m->buf + index, buf, buf_len); | ||||
| 	m->length += buf_len; | ||||
|     m->buf[m->length] = 0;      // null-terminate | ||||
| 	/* null-terminate */ | ||||
| 	m->buf[m->length] = 0; | ||||
|  | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_delete | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ; buffer whose memory size is to be decreased | ||||
| *					and copied to the odified location | ||||
| *		IN int index ;	index to determine bounds while moving data | ||||
| *		IN size_t num_bytes ;	number of bytes that the data needs to  | ||||
| *					shrink by | ||||
| * | ||||
| *	Description : Shrink the size of the buffer depending on the current  | ||||
| *		size of the bufer and te input parameters. Move contents from the  | ||||
| *		old buffer to the new sized buffer. | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| void | ||||
| membuffer_delete( INOUT membuffer * m, | ||||
|                   IN int index, | ||||
|                   IN size_t num_bytes ) | ||||
| void membuffer_delete(membuffer * m, size_t index, size_t num_bytes) | ||||
| { | ||||
| 	int return_value; | ||||
|     int new_length; | ||||
| 	size_t new_length; | ||||
| 	size_t copy_len; | ||||
|  | ||||
| 	assert(m != NULL); | ||||
|  | ||||
|     if (!m) return; | ||||
|  | ||||
|     if( m->length == 0 ) { | ||||
| 	if (!m || !m->length) | ||||
| 		return; | ||||
|     } | ||||
|  | ||||
|     assert( index >= 0 && index < ( int )m->length ); | ||||
|  | ||||
|     // shrink count if it goes beyond buffer | ||||
| 	/* shrink count if it goes beyond buffer */ | ||||
| 	if (index + num_bytes > m->length) { | ||||
|         num_bytes = m->length - ( size_t ) index; | ||||
|         copy_len = 0;           // every thing at and after index purged | ||||
| 		num_bytes = m->length - index; | ||||
| 		/* every thing at and after index purged */ | ||||
| 		copy_len = (size_t)0; | ||||
| 	} else { | ||||
|         // calc num bytes after deleted string | ||||
| 		/* calc num bytes after deleted string */ | ||||
| 		copy_len = m->length - (index + num_bytes); | ||||
| 	} | ||||
|  | ||||
| 	memmove(m->buf + index, m->buf + index + num_bytes, copy_len); | ||||
|  | ||||
| 	new_length = m->length - num_bytes; | ||||
|     return_value = membuffer_set_size( m, new_length ); // trim buffer | ||||
|     assert( return_value == 0 );    // shrinking should always work | ||||
| 	/* trim buffer */ | ||||
| 	return_value = membuffer_set_size(m, new_length); | ||||
| 	/* shrinking should always work */ | ||||
| 	assert(return_value == 0); | ||||
| 	if (return_value != 0) | ||||
| 		return; | ||||
|  | ||||
|     // don't modify until buffer is set | ||||
| 	/* don't modify until buffer is set */ | ||||
| 	m->length = new_length; | ||||
| 	m->buf[new_length] = 0; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_detach | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ; buffer to be returned and updated.	 | ||||
| * | ||||
| *	Description : Detaches current buffer and returns it. The caller | ||||
| *		must free the returned buffer using free(). | ||||
| *		After this call, length becomes 0. | ||||
| * | ||||
| *	Return : char* ; | ||||
| *		a pointer to the current buffer | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| char * | ||||
| membuffer_detach( INOUT membuffer * m ) | ||||
| char *membuffer_detach(membuffer *m) | ||||
| { | ||||
| 	char *buf; | ||||
|  | ||||
| @@ -543,33 +278,13 @@ membuffer_detach( INOUT membuffer * m ) | ||||
|  | ||||
| 	buf = m->buf; | ||||
|  | ||||
|     // free all | ||||
| 	/* free all */ | ||||
| 	membuffer_initialize(m); | ||||
|  | ||||
| 	return buf; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	membuffer_attach | ||||
| * | ||||
| *	Parameters : | ||||
| *		INOUT membuffer* m ;	buffer to be updated | ||||
| *		IN char* new_buf ;	 source buffer which will be assigned to the  | ||||
| *					buffer to be updated | ||||
| *		IN size_t buf_len ;	length of the source buffer  | ||||
| * | ||||
| *	Description : Free existing memory in membuffer and assign the new  | ||||
| *		buffer in its place. | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : 'new_buf' must be allocted using malloc or realloc so | ||||
| *		that it can be freed using free() | ||||
| ************************************************************************/ | ||||
| void | ||||
| membuffer_attach( INOUT membuffer * m, | ||||
|                   IN char *new_buf, | ||||
|                   IN size_t buf_len ) | ||||
| void membuffer_attach(membuffer *m, char *new_buf, size_t buf_len) | ||||
| { | ||||
| 	assert(m != NULL); | ||||
|  | ||||
|   | ||||
| @@ -1,33 +1,33 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without | ||||
|  * modification, are permitted provided that the following conditions are met: | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice, | ||||
|  * this list of conditions and the following disclaimer. | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice, | ||||
|  * this list of conditions and the following disclaimer in the documentation | ||||
|  * and/or other materials provided with the distribution. | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors | ||||
|  * may be used to endorse or promote products derived from this software | ||||
|  * without specific prior written permission. | ||||
|  * | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| /************************************************************************ | ||||
| * Purpose: This file contains string to integer and integer to string  | ||||
| @@ -48,7 +48,7 @@ | ||||
| *					matched. | ||||
| *		IN int num_entries ; number of entries in the table that need  | ||||
| *					to be searched. | ||||
| *		IN xboolean case_sensitive ; whether the case should be case | ||||
| *		IN int case_sensitive ; whether the case should be case | ||||
| *					sensitive or not | ||||
| * | ||||
| *	Description : Match the given name with names from the entries in the  | ||||
| @@ -65,7 +65,7 @@ map_str_to_int( IN const char *name, | ||||
|                 IN size_t name_len, | ||||
|                 IN str_int_entry * table, | ||||
|                 IN int num_entries, | ||||
|                 IN xboolean case_sensitive ) | ||||
|                 IN int case_sensitive ) | ||||
| { | ||||
|     int top, | ||||
|       mid, | ||||
| @@ -82,24 +82,24 @@ map_str_to_int( IN const char *name, | ||||
|     while( top <= bot ) { | ||||
|         mid = ( top + bot ) / 2; | ||||
|         if( case_sensitive ) { | ||||
|             //cmp = strcmp( name, table[mid].name ); | ||||
|             /*cmp = strcmp( name, table[mid].name ); */ | ||||
|             cmp = memptr_cmp( &name_ptr, table[mid].name ); | ||||
|         } else { | ||||
|             //cmp = strcasecmp( name, table[mid].name ); | ||||
|             /*cmp = strcasecmp( name, table[mid].name ); */ | ||||
|             cmp = memptr_cmp_nocase( &name_ptr, table[mid].name ); | ||||
|         } | ||||
|  | ||||
|         if( cmp > 0 ) { | ||||
|             top = mid + 1;      // look below mid | ||||
|             top = mid + 1;      /* look below mid */ | ||||
|         } else if( cmp < 0 ) { | ||||
|             bot = mid - 1;      // look above mid | ||||
|         } else                  // cmp == 0 | ||||
|             bot = mid - 1;      /* look above mid */ | ||||
|         } else                  /* cmp == 0 */ | ||||
|         { | ||||
|             return mid;         // match; return table index | ||||
|             return mid;         /* match; return table index */ | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     return -1;                  // header name not found | ||||
|     return -1;                  /* header name not found */ | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -29,90 +30,39 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| /************************************************************************ | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * Purpose: This file contains functions for copying strings based on | ||||
|  * different options. | ||||
| ************************************************************************/ | ||||
|  | ||||
|  */ | ||||
|  | ||||
| #include "config.h" | ||||
| #include "upnp.h" | ||||
| #include "upnputil.h" | ||||
|  | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	linecopy | ||||
| * | ||||
| *	Parameters : | ||||
| *		OUT char dest[LINE_SIZE] ;	output buffer | ||||
| *		IN const char* src ;	input buffer | ||||
| * | ||||
| *	Description : Copy no of bytes spcified by the LINE_SIZE constant,  | ||||
| *		from the source buffer. Null terminate the destination buffer | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| void | ||||
| linecopy( OUT char dest[LINE_SIZE], | ||||
|           IN const char *src ) | ||||
| void linecopy(char dest[LINE_SIZE], const char *src) | ||||
| { | ||||
|     strncpy( dest, src, LINE_SIZE - 1 ); | ||||
|     dest[LINE_SIZE - 1] = '\0'; // null-terminate if len(src) >= LINE_SIZE | ||||
| 	strncpy(dest, src, LINE_SIZE - (size_t)1); | ||||
| 	/* null-terminate if len(src) >= LINE_SIZE. */ | ||||
| 	dest[LINE_SIZE - 1] = '\0'; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	namecopy | ||||
| * | ||||
| *	Parameters : | ||||
| *		OUT char dest[NAME_SIZE] ;	output buffer | ||||
| *		IN const char* src ;	input buffer | ||||
| * | ||||
| *	Description : Copy no of bytes spcified by the NAME_SIZE constant,  | ||||
| *		from the source buffer. Null terminate the destination buffer | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| void | ||||
| namecopy( OUT char dest[NAME_SIZE], | ||||
|           IN const char *src ) | ||||
| void namecopy(char dest[NAME_SIZE], const char *src) | ||||
| { | ||||
|     strncpy( dest, src, NAME_SIZE - 1 ); | ||||
|     dest[NAME_SIZE - 1] = '\0'; // null-terminate if len(src) >= NAME_SIZE | ||||
| 	strncpy(dest, src, NAME_SIZE - (size_t)1); | ||||
| 	/* null-terminate if len(src) >= NAME_SIZE. */ | ||||
| 	dest[NAME_SIZE - 1] = '\0'; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	linecopylen | ||||
| * | ||||
| *	Parameters : | ||||
| *		OUT char dest[LINE_SIZE] ;	output buffer | ||||
| *		IN const char* src ;	input buffer | ||||
| *		IN size_t srclen ;	bytes to be copied. | ||||
| * | ||||
| *	Description : Determine if the srclen passed in paramter is less than  | ||||
| *		the permitted LINE_SIZE. If it is use the passed parameter, if not | ||||
| *		use the permitted LINE_SIZE as the length parameter | ||||
| *		Copy no of bytes spcified by the LINE_SIZE constant,  | ||||
| *		from the source buffer. Null terminate the destination buffer | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| void | ||||
| linecopylen( OUT char dest[LINE_SIZE], | ||||
|              IN const char *src, | ||||
|              IN size_t srclen ) | ||||
| void linecopylen(char dest[LINE_SIZE], const char *src, size_t srclen) | ||||
| { | ||||
|     int len; | ||||
| 	size_t len; | ||||
|  | ||||
|     len = srclen < ( LINE_SIZE - 1 ) ? srclen : ( LINE_SIZE - 1 ); | ||||
| 	len = srclen < (LINE_SIZE - (size_t)1) ? srclen : (LINE_SIZE - (size_t)1); | ||||
| 	strncpy(dest, src, len); | ||||
| 	dest[len] = '\0'; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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: | ||||
| @@ -125,7 +126,7 @@ | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
| #define THREAD_STACK_SIZE 0 | ||||
| #define THREAD_STACK_SIZE (size_t)0 | ||||
| /* @} */ | ||||
|  | ||||
|  | ||||
| @@ -178,7 +179,7 @@ | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
| #define SSDP_PAUSE  100 | ||||
| #define SSDP_PAUSE  100u | ||||
| /* @} */ | ||||
|  | ||||
| /*! | ||||
| @@ -189,7 +190,7 @@ | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
| #define WEB_SERVER_BUF_SIZE  (1024*1024) | ||||
| #define WEB_SERVER_BUF_SIZE  (size_t)(1024*1024) | ||||
| /* @} */ | ||||
|  | ||||
| /*! | ||||
| @@ -294,6 +295,50 @@ | ||||
| /* @} */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name GENA_NOTIFICATION_SENDING_TIMEOUT | ||||
|  * | ||||
|  * The {\tt GENA_NOTIFICATION_SENDING_TIMEOUT} specifies the number of seconds | ||||
|  * to wait for sending GENA notifications to the Control Point. | ||||
|  * | ||||
|  * This timeout will be used to know how many seconds GENA notification threads | ||||
|  * will wait to write on the socket to send the notification. By putting a | ||||
|  * lower value than HTTP_DEFAULT_TIMEOUT, the thread will not wait too long and | ||||
|  * will return quickly if writing is impossible. This is very useful as some | ||||
|  * Control Points disconnect from the network without unsubscribing as a result | ||||
|  * if HTTP_DEFAULT_TIMEOUT is used, all the GENA threads will be blocked to send | ||||
|  * notifications to those disconnected Control Points until the subscription | ||||
|  * expires. | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
| #define GENA_NOTIFICATION_SENDING_TIMEOUT HTTP_DEFAULT_TIMEOUT | ||||
| /* @} */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name GENA_NOTIFICATION_ANSWERING_TIMEOUT | ||||
|  * | ||||
|  * The {\tt GENA_NOTIFICATION_ANSWERING_TIMEOUT} specifies the number of seconds | ||||
|  * to wait for receiving the answer to a GENA notification from the Control | ||||
|  * Point. | ||||
|  * | ||||
|  * This timeout will be used to know how many seconds GENA notification threads | ||||
|  * will wait on the socket to read for an answer from the CP. By putting a | ||||
|  * lower value than HTTP_DEFAULT_TIMEOUT, the thread will not wait too long and | ||||
|  * will return quickly if there is no answer from the CP. This is very useful as | ||||
|  * some Control Points disconnect from the network without unsubscribing and if | ||||
|  * HTTP_DEFAULT_TIMEOUT is used, all the GENA threads will be blocked to wait | ||||
|  * for an answer from those disconnected Control Points until the subscription | ||||
|  * expires. However, it should be noted that UDA specifies a value of 30s for | ||||
|  * waiting the CP's answer. | ||||
|  * | ||||
|  * @{ | ||||
|  */ | ||||
| #define GENA_NOTIFICATION_ANSWERING_TIMEOUT HTTP_DEFAULT_TIMEOUT | ||||
| /* @} */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \name Module Exclusion | ||||
|  * | ||||
| @@ -391,11 +436,34 @@ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* configure --enable-webserver --enable-device */ | ||||
| /* configure --enable-webserver */ | ||||
| #if UPNP_HAVE_WEBSERVER | ||||
| #	define INTERNAL_WEB_SERVER	1 | ||||
| #endif | ||||
|  | ||||
| /* configure --enable-ssdp */ | ||||
| #undef EXCLUDE_SSDP | ||||
| #if UPNP_HAVE_SSDP | ||||
| #       define EXCLUDE_SSDP 0 | ||||
| #else | ||||
| #       define EXCLUDE_SSDP 1 | ||||
| #endif | ||||
|  | ||||
| /* configure --enable-soap */ | ||||
| #undef EXCLUDE_SOAP | ||||
| #if UPNP_HAVE_SOAP | ||||
| #	define EXCLUDE_SOAP 0 | ||||
| #else | ||||
| #	define EXCLUDE_SOAP 1 | ||||
| #endif | ||||
|  | ||||
| /* configure --enable-gena */ | ||||
| #undef EXCLUDE_GENA | ||||
| #if UPNP_HAVE_GENA | ||||
| #       define EXCLUDE_GENA 0 | ||||
| #else | ||||
| #       define EXCLUDE_GENA 1 | ||||
| #endif | ||||
|  | ||||
| #undef  EXCLUDE_WEB_SERVER | ||||
| #undef  EXCLUDE_MINISERVER | ||||
| @@ -408,7 +476,7 @@ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1 | ||||
| #if EXCLUDE_SSDP == 1 && EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1 | ||||
| #	undef  EXCLUDE_MINISERVER | ||||
| #	define EXCLUDE_MINISERVER 1 | ||||
| #	if INTERNAL_WEB_SERVER | ||||
| @@ -417,7 +485,7 @@ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0 | ||||
| #if EXCLUDE_SSDP == 0 || EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0 | ||||
| #	undef  EXCLUDE_MINISERVER | ||||
| #	define EXCLUDE_MINISERVER 0 | ||||
| #	if EXCLUDE_WEB_SERVER == 0 && !defined INTERNAL_WEB_SERVER | ||||
|   | ||||
| @@ -29,11 +29,9 @@ | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef GLOBAL_H | ||||
| #define GLOBAL_H | ||||
|  | ||||
|  | ||||
| /* GLOBAL.H - RSAREF types and constants */ | ||||
| /* PROTOTYPES should be set to one if and only if the compiler supports | ||||
|   function argument prototyping. | ||||
| @@ -42,7 +40,6 @@ | ||||
|   been defined with C compiler flags. | ||||
| */ | ||||
|  | ||||
|  | ||||
| #ifndef PROTOTYPES | ||||
| 	#define PROTOTYPES 1 | ||||
| #endif | ||||
|   | ||||
| @@ -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:  | ||||
| @@ -29,49 +30,45 @@ | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef GENLIB_NET_HTTP_HTTPPARSER_H | ||||
| #define GENLIB_NET_HTTP_HTTPPARSER_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "LinkedList.h" | ||||
| #include "membuffer.h" | ||||
| #include "uri.h" | ||||
| #include "upnputil.h" | ||||
|  | ||||
| /* private types */ | ||||
|  | ||||
| ////// private types //////////// | ||||
| /* scanner */ | ||||
|  | ||||
|  | ||||
| ////////////////////// | ||||
| // scanner | ||||
| /////////////////////// | ||||
| // Used to represent different types of tokens in input | ||||
| typedef enum // token_type_t | ||||
| /* Used to represent different types of tokens in input. */ | ||||
| typedef enum | ||||
| { | ||||
| 	TT_IDENTIFIER,  | ||||
| 	TT_WHITESPACE,  | ||||
| 	TT_CRLF,  | ||||
| 	TT_CTRL,				// needed ?? | ||||
| 	TT_SEPARATOR,			// ?? | ||||
| 	TT_QUOTEDSTRING,		// ?? | ||||
| 	TT_CTRL, | ||||
| 	TT_SEPARATOR, | ||||
| 	TT_QUOTEDSTRING, | ||||
| } token_type_t; | ||||
|  | ||||
| typedef struct // scanner_t | ||||
| typedef struct | ||||
| { | ||||
| 	membuffer* msg;				// raw http msg | ||||
| 	size_t cursor;				// current position in buffer | ||||
| 	xboolean entire_msg_loaded;	// set this to TRUE if the entire msg is loaded in | ||||
| 								//   in 'msg'; else FALSE if only partial msg in 'msg' | ||||
| 								//   (default is FALSE) | ||||
| 	/*! raw http msg. */ | ||||
| 	membuffer* msg; | ||||
| 	/*! current position in buffer. */ | ||||
| 	size_t cursor; | ||||
| 	/*! set this to TRUE if the entire msg is loaded in 'msg'; | ||||
| 	 * else FALSE if only partial msg in 'msg' (default is FALSE). */ | ||||
| 	int entire_msg_loaded; | ||||
| } scanner_t; | ||||
|  | ||||
| typedef enum // parser_pos_t | ||||
| typedef enum | ||||
| { | ||||
| 	POS_REQUEST_LINE, | ||||
| 	POS_RESPONSE_LINE, | ||||
| @@ -80,7 +77,6 @@ typedef enum // parser_pos_t | ||||
| 	POS_COMPLETE, | ||||
| } parser_pos_t; | ||||
|  | ||||
|  | ||||
| #define ENTREAD_DETERMINE_READ_METHOD	1 | ||||
| #define ENTREAD_USING_CLEN		2 | ||||
| #define ENTREAD_USING_CHUNKED		3 | ||||
| @@ -88,13 +84,10 @@ typedef enum // parser_pos_t | ||||
| #define ENTREAD_CHUNKY_BODY		5 | ||||
| #define ENTREAD_CHUNKY_HEADERS		6 | ||||
|  | ||||
| /* end of private section. */ | ||||
|  | ||||
| // end of private section | ||||
| ////////////////// | ||||
| // ################################################################################## | ||||
|  | ||||
| // method in a HTTP request | ||||
| typedef enum // http_method_t | ||||
| /* method in a HTTP request. */ | ||||
| typedef enum | ||||
| { | ||||
| 	HTTPMETHOD_POST,  | ||||
| 	HTTPMETHOD_MPOST,  | ||||
| @@ -105,11 +98,11 @@ typedef enum // http_method_t | ||||
| 	HTTPMETHOD_HEAD,  | ||||
| 	HTTPMETHOD_MSEARCH,  | ||||
| 	HTTPMETHOD_UNKNOWN, | ||||
|     SOAPMETHOD_POST,	 //murari | ||||
| 	SOAPMETHOD_POST, | ||||
| 	HTTPMETHOD_SIMPLEGET | ||||
| } http_method_t; | ||||
|  | ||||
| // different types of HTTP headers | ||||
| /* different types of HTTP headers */ | ||||
| #define HDR_UNKNOWN			-1 | ||||
| #define HDR_CACHE_CONTROL		1 | ||||
| #define HDR_CALLBACK			2 | ||||
| @@ -118,9 +111,9 @@ typedef enum // http_method_t | ||||
| #define HDR_DATE			5 | ||||
| #define HDR_EXT				6 | ||||
| #define HDR_HOST			7 | ||||
| //#define HDR_IF_MODIFIED_SINCE	8 | ||||
| //#define HDR_IF_UNMODIFIED_SINCE	9 | ||||
| //#define HDR_LAST_MODIFIED		10 | ||||
| /*define HDR_IF_MODIFIED_SINCE		8 */ | ||||
| /*define HDR_IF_UNMODIFIED_SINCE	9 */ | ||||
| /*define HDR_LAST_MODIFIED		10 */ | ||||
| #define HDR_LOCATION			11 | ||||
| #define HDR_MAN				12 | ||||
| #define HDR_MX				13 | ||||
| @@ -136,7 +129,7 @@ typedef enum // http_method_t | ||||
| #define HDR_USN				23 | ||||
| #define HDR_USER_AGENT			24 | ||||
|  | ||||
| //Adding new header difinition//Beg_Murari | ||||
| /* Adding new header difinition */ | ||||
| #define HDR_ACCEPT			25 | ||||
| #define HDR_ACCEPT_ENCODING		26 | ||||
| #define HDR_ACCEPT_CHARSET		27 | ||||
| @@ -149,89 +142,92 @@ typedef enum // http_method_t | ||||
| #define HDR_IF_RANGE			34 | ||||
| #define HDR_RANGE			35 | ||||
| #define HDR_TE				36 | ||||
| //End_Murari | ||||
|  | ||||
| // status of parsing | ||||
| typedef enum // parse_status_t | ||||
| { | ||||
| 	PARSE_SUCCESS = 0,	// msg was parsed successfully | ||||
| 	PARSE_INCOMPLETE,	// need more data to continue | ||||
| 	PARSE_INCOMPLETE_ENTITY,	// for responses that don't have length specified | ||||
| 	PARSE_FAILURE,		// parse failed; check status code for details | ||||
| 	PARSE_OK,			// done partial | ||||
| 	PARSE_NO_MATCH,		// token not matched | ||||
|  | ||||
| 	// private | ||||
| /*! status of parsing */ | ||||
| typedef enum { | ||||
| 	/*! msg was parsed successfully. */ | ||||
| 	PARSE_SUCCESS = 0, | ||||
| 	/*! need more data to continue. */ | ||||
| 	PARSE_INCOMPLETE, | ||||
| 	/*! for responses that don't have length specified. */ | ||||
| 	PARSE_INCOMPLETE_ENTITY, | ||||
| 	/*! parse failed; check status code for details. */ | ||||
| 	PARSE_FAILURE, | ||||
| 	/*! done partial. */ | ||||
| 	PARSE_OK, | ||||
| 	/*! token not matched. */ | ||||
| 	PARSE_NO_MATCH, | ||||
| 	/*! private. */ | ||||
| 	PARSE_CONTINUE_1 | ||||
| } parse_status_t; | ||||
|  | ||||
| typedef struct // http_header_t | ||||
| { | ||||
| 	memptr name;		// header name as a string | ||||
| 	int name_id;		// header name id (for a selective group of headers only) | ||||
| 	membuffer value;	// raw-value; could be multi-lined; min-length = 0 | ||||
|  | ||||
|     // private | ||||
| typedef struct { | ||||
| 	/*! header name as a string. */ | ||||
| 	memptr name; | ||||
| 	/*! header name id (for a selective group of headers only). */ | ||||
| 	int name_id; | ||||
| 	/*! raw-value; could be multi-lined; min-length = 0. */ | ||||
| 	membuffer value; | ||||
| 	/* private. */ | ||||
| 	membuffer name_buf; | ||||
| } http_header_t; | ||||
|  | ||||
| typedef struct // http_message_t | ||||
| { | ||||
| typedef struct { | ||||
| 	int initialized; | ||||
| 	// request only | ||||
| 	/*! request only. */ | ||||
| 	http_method_t method; | ||||
| 	/*! request only. */ | ||||
| 	uri_type uri; | ||||
|  | ||||
| 	// response only | ||||
| 	/*! response only. */ | ||||
| 	http_method_t request_method; | ||||
| 	/*! response only. */ | ||||
| 	int status_code; | ||||
| 	/*! response only. */ | ||||
| 	membuffer status_msg; | ||||
|  | ||||
| 	// fields used in both request or response messages | ||||
| 	xboolean is_request;	// if TRUE, msg is a request, else response | ||||
|  | ||||
| 	int major_version;		// http major.minor version | ||||
|        /*! response only. the amount of data that's been read by the user, that's no | ||||
|         *  longer in the raw message buffer. | ||||
|         */ | ||||
|        size_t amount_discarded; | ||||
| 	/* fields used in both request or response messages. */ | ||||
| 	/*! if TRUE, msg is a request, else response. */ | ||||
| 	int is_request; | ||||
| 	/* http major version. */ | ||||
| 	int major_version; | ||||
| 	/* http minor version. */ | ||||
| 	int minor_version; | ||||
|  | ||||
|  | ||||
| 	/*! . */ | ||||
| 	LinkedList headers; | ||||
| //NNS:	dlist headers;			// dlist<http_header_t *> | ||||
| 	memptr entity;			// message body(entity) | ||||
|  | ||||
| 	// private fields | ||||
| 	membuffer msg;		// entire raw message | ||||
|         char *urlbuf;	// storage for url string | ||||
|         size_t entity_offset; | ||||
| 	/*! message body(entity). */ | ||||
| 	memptr entity; | ||||
| 	/* private fields. */ | ||||
| 	/*! entire raw message. */ | ||||
| 	membuffer msg; | ||||
|         /*! storage for url string. */ | ||||
|         char *urlbuf; | ||||
| } http_message_t; | ||||
|  | ||||
| typedef struct // http_parser_t | ||||
| { | ||||
| typedef struct { | ||||
| 	http_message_t msg; | ||||
| 	int http_error_code;	// read-only; in case of parse error, this | ||||
| 							//  contains the HTTP error code (4XX or 5XX) | ||||
|  | ||||
|     // read-only; this is set to true if a NOTIFY request has no content-length. | ||||
|     //  used to read valid sspd notify msg. | ||||
|     xboolean valid_ssdp_notify_hack; | ||||
|  | ||||
| 	// private data -- don't touch | ||||
| 	/*! read-only; in case of parse error, this | ||||
| 	 * contains the HTTP error code (4XX or 5XX). */ | ||||
| 	int http_error_code; | ||||
| 	/*! read-only; this is set to true if a NOTIFY request has no | ||||
| 	 * content-length. used to read valid sspd notify msg. */ | ||||
| 	int valid_ssdp_notify_hack; | ||||
| 	/* private data -- don't touch. */ | ||||
| 	parser_pos_t position; | ||||
| 	int ent_position; | ||||
| 	unsigned int content_length; | ||||
| 	int chunk_size; | ||||
| 	size_t chunk_size; | ||||
|        /*! offset in the the raw message buffer, which contains the message body. | ||||
|         *  preceding this are the headers of the messsage. */ | ||||
| 	size_t entity_start_position; | ||||
| 	scanner_t scanner; | ||||
| } http_parser_t; | ||||
|  | ||||
|  | ||||
| //-------------------------------------------------- | ||||
| //////////////// functions ///////////////////////// | ||||
| //-------------------------------------------------- | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif // __cplusplus | ||||
|  | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	httpmsg_init | ||||
| @@ -273,7 +269,6 @@ void httpmsg_destroy( INOUT http_message_t* msg ); | ||||
| * | ||||
| *	Return : http_header_t* - Pointer to a header on success; | ||||
| *			 NULL on failure | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| http_header_t* httpmsg_find_hdr_str( IN http_message_t* msg, | ||||
| @@ -289,7 +284,7 @@ http_header_t* httpmsg_find_hdr_str( IN http_message_t* msg, | ||||
| * | ||||
| *	Description :	Finds header from a list, with the given 'name_id'. | ||||
| * | ||||
| *	Return : http_header_t*  - Pointer to a header on success;										* | ||||
| *	Return : http_header_t*  - Pointer to a header on success; | ||||
| *		 NULL on failure | ||||
| * | ||||
| *	Note : | ||||
| @@ -435,11 +430,7 @@ parse_status_t parser_append( INOUT http_parser_t* parser, | ||||
| *   PARSE_NO_MATCH -- failure to match pattern 'fmt'					 | ||||
| *   PARSE_FAILURE	-- 'str' is bad input							 | ||||
| ************************************************************************/ | ||||
| int matchstr( IN char *str, IN size_t slen, IN const char* fmt, ... ); | ||||
|  | ||||
| // ==================================================== | ||||
| // misc functions | ||||
|  | ||||
| parse_status_t matchstr( IN char *str, IN size_t slen, IN const char* fmt, ... ); | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function: raw_to_int													 | ||||
| @@ -481,11 +472,10 @@ int raw_find_str( IN memptr* raw_value, IN const char* str ); | ||||
| *	nameConverts a http_method id stored in the HTTP Method				 | ||||
| *																		 | ||||
| * Returns:																 | ||||
| *	 const char* ptr - Ptr to the HTTP Method																							* | ||||
| *	 const char* ptr - Ptr to the HTTP Method | ||||
| ************************************************************************/ | ||||
| const char* method_to_str( IN http_method_t method ); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Print the HTTP headers. | ||||
|  */ | ||||
| @@ -494,13 +484,16 @@ void print_http_headers( | ||||
| 	/*! [in] HTTP Message object. */ | ||||
| 	http_message_t *hmsg); | ||||
| #else | ||||
| static UPNP_INLINE void print_http_headers(http_message_t *hmsg) {} | ||||
| static UPNP_INLINE void print_http_headers(http_message_t *hmsg) | ||||
| { | ||||
| 	return; | ||||
| 	hmsg = hmsg; | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| }		/* extern "C" */ | ||||
| #endif	/* __cplusplus */ | ||||
|  | ||||
|  | ||||
| #endif /* GENLIB_NET_HTTP_HTTPPARSER_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,105 +1,97 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation | ||||
|  * All rights reserved. | ||||
|  * 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. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef GENLIB_NET_HTTP_HTTPREADWRITE_H | ||||
| #define GENLIB_NET_HTTP_HTTPREADWRITE_H | ||||
|  | ||||
| /* | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
| #include "config.h" | ||||
| #include "upnputil.h" | ||||
| #include "sock.h" | ||||
| #include "httpparser.h" | ||||
|  | ||||
| // timeout in secs | ||||
| /*! timeout in secs. */ | ||||
| #define HTTP_DEFAULT_TIMEOUT	30 | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| #extern "C" { | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| int | ||||
| http_CancelHttpGet( IN void *Handle ); | ||||
| int http_CancelHttpGet(IN void *Handle); | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_FixUrl | ||||
| /*! | ||||
|  * \brief Validates URL. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN uri_type* url;		URL to be validated and fixed | ||||
|  *	OUT uri_type* fixed_url;	URL after being fixed. | ||||
|  * | ||||
|  * Description: | ||||
|  *	Validates URL | ||||
|  * | ||||
|  * Returns: | ||||
|  *	 UPNP_E_INVALID_URL | ||||
|  * 	 UPNP_E_SUCCESS | ||||
|  ************************************************************************/ | ||||
| int http_FixUrl( IN uri_type* url, OUT uri_type* fixed_url ); | ||||
|  * \return | ||||
|  * 	\li \c UPNP_E_INVALID_URL | ||||
|  * 	\li \c UPNP_E_SUCCESS | ||||
|  */ | ||||
| int http_FixUrl( | ||||
| 	/*! [in] URL to be validated and fixed. */ | ||||
| 	uri_type *url, | ||||
| 	/*! [out] URL after being fixed. */ | ||||
| 	uri_type *fixed_url); | ||||
|  | ||||
| /*! | ||||
|  * \brief Parses URL and then validates URL. | ||||
|  * | ||||
|  * \return | ||||
|  * 	\li \c UPNP_E_INVALID_URL | ||||
|  * 	\li \c UPNP_E_SUCCESS | ||||
|  */ | ||||
| int http_FixStrUrl( | ||||
| 	/*! [in] Character string as a URL. */ | ||||
| 	const char *urlstr, | ||||
| 	/*! [in] Length of the character string. */ | ||||
| 	size_t urlstrlen, | ||||
| 	/*! [out] Fixed and corrected URL. */ | ||||
| 	uri_type *fixed_url); | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_FixStrUrl | ||||
| /*! | ||||
|  * \brief Gets destination address from URL and then connects to the | ||||
|  * remote end. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN char* urlstr ; 		Character string as a URL | ||||
|  *	IN int urlstrlen ; 		Length of the character string | ||||
|  *	OUT uri_type* fixed_url	;	Fixed and corrected URL | ||||
|  * | ||||
|  * Description: | ||||
|  *	Parses URL and then validates URL | ||||
|  * | ||||
|  * Returns: | ||||
|  *	 UPNP_E_INVALID_URL | ||||
|  * 	 UPNP_E_SUCCESS | ||||
|  ************************************************************************/ | ||||
| int http_FixStrUrl( IN const char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url ); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_Connect | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN uri_type* destination_url;	URL containing destination information | ||||
|  *	OUT uri_type *url;		Fixed and corrected URL | ||||
|  * | ||||
|  * Description: | ||||
|  *	Gets destination address from URL and then connects to the remote end | ||||
|  * | ||||
|  *  Returns: | ||||
|  *	socket descriptor on sucess | ||||
|  *	UPNP_E_OUTOF_SOCKET | ||||
|  *	UPNP_E_SOCKET_CONNECT on error | ||||
|  ************************************************************************/ | ||||
| int http_Connect( IN uri_type* destination_url, OUT uri_type *url ); | ||||
|  * \return Socket descriptor on success, or on error: | ||||
|  * 	\li \c UPNP_E_OUTOF_SOCKET | ||||
|  * 	\li \c UPNP_E_SOCKET_CONNECT | ||||
|  */ | ||||
| SOCKET http_Connect( | ||||
| 	/*! [in] URL containing destination information. */ | ||||
| 	uri_type *destination_url, | ||||
| 	/*! [out] Fixed and corrected URL. */ | ||||
| 	uri_type *url); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
| @@ -128,37 +120,37 @@ int http_RecvMessage( IN SOCKINFO *info, OUT http_parser_t* parser, | ||||
| 		OUT int* http_error_code ); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_SendMessage | ||||
| /*! | ||||
|  * \brief Sends a message to the destination based on the format parameter. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN SOCKINFO *info ;		Socket information object | ||||
|  *	IN OUT int * TimeOut ;		time out value | ||||
|  *	IN const char* fmt, ...	 Pattern format to take actions upon | ||||
|  * | ||||
|  * Description: | ||||
|  *	Sends a message to the destination based on the | ||||
|  *	IN const char* fmt parameter | ||||
|  * fmt types: | ||||
|  *		'f':	arg = const char * file name | ||||
|  *		'm':	arg1 = const char * mem_buffer; arg2= size_t buf_length | ||||
|  *	E.g.: | ||||
|  *		char *buf = "POST /xyz.cgi http/1.1\r\n\r\n"; | ||||
|  *		char *filename = "foo.dat"; | ||||
|  *		int status = http_SendMessage( tcpsock, "mf", | ||||
|  *			buf, strlen(buf),	// args for memory buffer | ||||
|  *			filename );		// arg for file | ||||
|  * \li \c 'f': arg = "const char *" file name | ||||
|  * \li \c 'b': arg1 = "const char *" mem_buffer; arg2 = "size_t" buffer length. | ||||
|  * \li \c 'I': arg = "struct SendInstruction *" | ||||
|  * | ||||
|  * Returns: | ||||
|  *	UPNP_E_OUTOF_MEMORY | ||||
|  * 	UPNP_E_FILE_READ_ERROR | ||||
|  *	UPNP_E_SUCCESS | ||||
|  ************************************************************************/ | ||||
|  * E.g.: | ||||
|  \verbatim | ||||
|  	char *buf = "POST /xyz.cgi http/1.1\r\n\r\n"; | ||||
|  	char *filename = "foo.dat"; | ||||
|  	int status = http_SendMessage(tcpsock, "bf", | ||||
|  		buf, strlen(buf),	// args for memory buffer | ||||
|  		filename);		// arg for file | ||||
|  \endverbatim | ||||
|  * | ||||
|  * \return | ||||
|  * \li \c UPNP_E_OUTOF_MEMORY | ||||
|  * \li \c UPNP_E_FILE_READ_ERROR | ||||
|  * \li \c UPNP_E_SUCCESS | ||||
|  */ | ||||
| int http_SendMessage( | ||||
| 	IN SOCKINFO *info, | ||||
| 	IN OUT int* timeout_secs,  | ||||
| 	IN const char* fmt, ... ); | ||||
|  | ||||
| 	/* [in] Socket information object. */ | ||||
| 	SOCKINFO *info, | ||||
| 	/* [in,out] Time out value. */ | ||||
| 	int* timeout_secs,  | ||||
| 	/* [in] Pattern format to take actions upon. */ | ||||
| 	const char* fmt, | ||||
| 	/* [in] Variable parameter list. */ | ||||
| 	...); | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_RequestAndResponse | ||||
| @@ -212,7 +204,7 @@ int http_RequestAndResponse( | ||||
|  *	IN int timeout_secs;	time out value | ||||
|  *	OUT char** document;	buffer to store the document extracted | ||||
|  *				from the donloaded message. | ||||
|  *	OUT int* doc_length;	length of the extracted document | ||||
|  *	OUT size_t* doc_length;	length of the extracted document | ||||
|  *	OUT char* content_type;	Type of content | ||||
|  * | ||||
|  * Description: | ||||
| @@ -227,7 +219,7 @@ int http_Download( | ||||
| 	IN const char* url,  | ||||
| 	IN int timeout_secs, | ||||
| 	OUT char** document, | ||||
| 	OUT int* doc_length, | ||||
| 	OUT size_t *doc_length, | ||||
| 	OUT char* content_type ); | ||||
|  | ||||
|  | ||||
| @@ -238,7 +230,7 @@ int http_Download( | ||||
|  *	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 unsigned int *size:	Size of the data to be sent. | ||||
|  *	IN size_t *size:	Size of the data to be sent. | ||||
|  *	IN int timeout:		time out value | ||||
|  * | ||||
|  * Description: | ||||
| @@ -252,7 +244,7 @@ int http_Download( | ||||
|  ************************************************************************/ | ||||
| int http_WriteHttpPost(IN void *Handle, | ||||
| 		       IN char *buf, | ||||
| 		       IN unsigned int *size, | ||||
| 		       IN size_t *size, | ||||
| 		       IN int timeout); | ||||
|  | ||||
|  | ||||
| @@ -271,7 +263,7 @@ int http_WriteHttpPost(IN void *Handle, | ||||
|  *	associated memory. Frees handle associated with the HTTP POST msg. | ||||
|  * | ||||
|  * Return: int | ||||
|  *	UPNP_E_SUCCESS		- On Sucess | ||||
|  *	UPNP_E_SUCCESS		- On success | ||||
|  *	UPNP_E_INVALID_PARAM	- Invalid Parameter | ||||
|  ************************************************************************/ | ||||
| int http_CloseHttpPost(IN void *Handle,  | ||||
| @@ -296,7 +288,7 @@ int http_CloseHttpPost(IN void *Handle, | ||||
|  *	such handles | ||||
|  * | ||||
|  * Return : int; | ||||
|  *	UPNP_E_SUCCESS		- On Sucess | ||||
|  *	UPNP_E_SUCCESS		- On success | ||||
|  *	UPNP_E_INVALID_PARAM	- Invalid Parameter | ||||
|  *	UPNP_E_OUTOF_MEMORY | ||||
|  *	UPNP_E_SOCKET_ERROR | ||||
| @@ -315,7 +307,7 @@ int http_OpenHttpPost(IN const char *url_str, | ||||
|  * Parameters: | ||||
|  *	IN void *Handle;	Handle to the HTTP get object | ||||
|  *	IN OUT char *buf;	Buffer to get the read and parsed data | ||||
|  *	IN OUT unsigned int *size;	Size of the buffer passed | ||||
|  *	IN OUT size_t *size;	Size of the buffer passed | ||||
|  *	IN int timeout;		time out value | ||||
|  * | ||||
|  * Description: | ||||
| @@ -323,7 +315,7 @@ int http_OpenHttpPost(IN const char *url_str, | ||||
|  *	Parses and extracts information from the new data. | ||||
|  * | ||||
|  * Return: int | ||||
|  *	UPNP_E_SUCCESS		- On Sucess | ||||
|  *	UPNP_E_SUCCESS		- On success | ||||
|  *	UPNP_E_INVALID_PARAM	- Invalid Parameter | ||||
|  *	UPNP_E_BAD_RESPONSE | ||||
|  *	UPNP_E_BAD_HTTPMSG | ||||
| @@ -332,7 +324,7 @@ int http_OpenHttpPost(IN const char *url_str, | ||||
| int http_ReadHttpGet( | ||||
| 	IN void *Handle, | ||||
| 	IN OUT char *buf, | ||||
| 	IN OUT unsigned int *size, | ||||
| 	IN OUT size_t *size, | ||||
| 	IN int timeout); | ||||
|  | ||||
|  | ||||
| @@ -341,8 +333,8 @@ int http_ReadHttpGet( | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN void *Handle;	Handle to the HTTP get object | ||||
|  *	OUT unsigned int *length;	Buffer to get the read and parsed data | ||||
|  *	OUT unsigned int *total;	Size of tge buffer passed | ||||
|  *	OUT size_t *length;	Buffer to get the read and parsed data | ||||
|  *	OUT size_t *total;	Size of tge buffer passed | ||||
|  * | ||||
|  * Description: | ||||
|  *	Extracts information from the Handle to the HTTP get object. | ||||
| @@ -353,9 +345,8 @@ int http_ReadHttpGet( | ||||
|  ************************************************************************/ | ||||
| int http_HttpGetProgress( | ||||
| 	IN void *Handle, | ||||
| 	OUT unsigned int *length, | ||||
| 	OUT unsigned int *total ); | ||||
|  | ||||
| 	OUT size_t *length, | ||||
| 	OUT size_t *total); | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_CloseHttpGet | ||||
| @@ -373,74 +364,61 @@ int http_HttpGetProgress( | ||||
|  ************************************************************************/ | ||||
| int http_CloseHttpGet(IN void *Handle); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_OpenHttpGet | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN const char *url_str:		String as a URL | ||||
|  *	IN OUT void **Handle:		Pointer to buffer to store HTTP | ||||
|  *					post handle | ||||
|  *	IN OUT char **contentType:	Type of content | ||||
|  *	OUT int *contentLength:		length of content | ||||
|  *	OUT int *httpStatus:		HTTP status returned on receiving a | ||||
|  *					response message | ||||
|  *	IN int timeout:			time out value | ||||
|  * | ||||
|  * Description: | ||||
|  *	Makes the HTTP GET message, connects to the peer,  | ||||
|  *	sends the HTTP GET request, gets the response and parses the  | ||||
|  *	response. | ||||
|  * | ||||
|  * Return: int | ||||
|  *	UPNP_E_SUCCESS		- On Success | ||||
|  *	UPNP_E_INVALID_PARAM	- Invalid Paramters | ||||
|  *	UPNP_E_OUTOF_MEMORY | ||||
|  *	UPNP_E_SOCKET_ERROR | ||||
|  *	UPNP_E_BAD_RESPONSE | ||||
|  ************************************************************************/ | ||||
| int http_OpenHttpGet( | ||||
| 	IN const char *url_str, | ||||
| 	IN OUT void **Handle, | ||||
| 	IN OUT char **contentType, | ||||
| 	OUT int *contentLength, | ||||
| 	OUT int *httpStatus, | ||||
| 	IN int timeout); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_OpenHttpGetProxy | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	IN const char *url_str;		String as a URL | ||||
|  *	IN const char *proxy_str;	String as a URL | ||||
|  *	IN OUT void **Handle;		Pointer to buffer to store HTTP | ||||
|  *					post handle | ||||
|  *	IN OUT char **contentType;	Type of content | ||||
|  *	OUT int *contentLength;		length of content | ||||
|  *	OUT int *httpStatus;		HTTP status returned on receiving a | ||||
|  *					response message | ||||
|  *	IN int timeout:			time out value | ||||
|  * | ||||
|  * Description: | ||||
|  *	Makes the HTTP GET message, connects to the peer,  | ||||
| /*! | ||||
|  * \brief Makes the HTTP GET message, connects to the peer, | ||||
|  * sends the HTTP GET request, gets the response and parses the response. | ||||
|  * | ||||
|  * If a proxy URL is defined then the connection is made there. | ||||
|  * | ||||
|  * Return: int | ||||
|  *	UPNP_E_SUCCESS		- On Success | ||||
|  *	UPNP_E_INVALID_PARAM	- Invalid Paramters | ||||
|  *	UPNP_E_OUTOF_MEMORY | ||||
|  *	UPNP_E_SOCKET_ERROR | ||||
|  *	UPNP_E_BAD_RESPONSE | ||||
|  ************************************************************************/ | ||||
| int http_OpenHttpGetProxy(IN const char *url_str, | ||||
| 					IN const char *proxy_str, | ||||
| 					IN OUT void **Handle, | ||||
| 					IN OUT char **contentType, | ||||
| 					OUT int *contentLength, | ||||
| 					OUT int *httpStatus, | ||||
| 					IN int timeout); | ||||
|  * \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 | ||||
|  */ | ||||
| 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] length of content. */ | ||||
| 	int *contentLength, | ||||
| 	/* [out] HTTP status returned on receiving a response message. */ | ||||
| 	int *httpStatus, | ||||
| 	/* [in] time out value. */ | ||||
| 	int timeout); | ||||
|  | ||||
| /*! | ||||
|  * \brief Makes the HTTP GET message, connects to the peer, | ||||
|  * sends the HTTP GET request, gets the response and parses the response. | ||||
|  * | ||||
|  * If a proxy URL is defined then the connection is made there. | ||||
|  * | ||||
|  * \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 | ||||
|  */ | ||||
| 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); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
| @@ -469,61 +447,55 @@ int http_SendStatusResponse( | ||||
| 	IN int request_major_version, | ||||
| 	IN int request_minor_version ); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
|  * Function: http_MakeMessage | ||||
| /*! | ||||
|  * \brief Generate an HTTP message based on the format that is specified in | ||||
|  * the input parameters. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	INOUT membuffer* buf;		buffer with the contents of the  | ||||
|  *					message | ||||
|  *	IN int http_major_version;	HTTP major version | ||||
|  *	IN int http_minor_version;	HTTP minor version | ||||
|  *	IN const char* fmt;		Pattern format  | ||||
|  *	...;	 | ||||
| \verbatim | ||||
| Format types: | ||||
| 	'B':	arg = int status_code		-- appends content-length, content-type and HTML body for given code. | ||||
| 	'b':	arg1 = const char *buf; | ||||
| 		arg2 = size_t buf_length memory ptr | ||||
| 	'C':	(no args)			-- appends a HTTP CONNECTION: close header depending on major, minor version. | ||||
| 	'c':	(no args)			-- appends CRLF "\r\n" | ||||
| 	'D':	(no args)			-- appends HTTP DATE: header | ||||
| 	'd':	arg = int number		-- appends decimal number | ||||
| 	'G':	arg = range information		-- add range header | ||||
| 	'h':	arg = off_t number		-- appends off_t number | ||||
| 	'K':	(no args)			-- add chunky header | ||||
| 	'L':	arg = language information	-- add Content-Language header if Accept-Language header is not empty and if | ||||
| 						   WEB_SERVER_CONTENT_LANGUAGE is not empty | ||||
| 	'N':	arg1 = off_t content_length	-- content-length header | ||||
| 	'q':	arg1 = http_method_t		-- request start line and HOST header | ||||
| 		arg2 = (uri_type *) | ||||
| 	'Q':	arg1 = http_method_t;		-- start line of request | ||||
| 		arg2 = char* url; | ||||
| 		arg3 = size_t url_length  | ||||
| 	'R':	arg = int status_code		-- adds a response start line | ||||
| 	'S':	(no args)			-- appends HTTP SERVER: header | ||||
| 	's':	arg = const char *		-- C_string | ||||
| 	'T':	arg = char * content_type;	-- format e.g: "text/html"; content-type header | ||||
| 	't':	arg = time_t * gmt_time		-- appends time in RFC 1123 fmt | ||||
| 	'U':	(no args)			-- appends HTTP USER-AGENT: header | ||||
| 	'X':	arg = const char *		-- useragent; "redsonic" HTTP X-User-Agent: useragent | ||||
| \endverbatim | ||||
|  * | ||||
|  * Description: | ||||
|  *	Generate an HTTP message based on the format that is specified | ||||
|  *	in the input parameters. | ||||
|  * | ||||
|  * fmt types: | ||||
|  *	'B':	arg = int status_code  | ||||
|  *		appends content-length, content-type and HTML body | ||||
|  *		for given code | ||||
|  *	'b':	arg1 = const char* buf; | ||||
|  *		arg2 = size_t buf_length memory ptr | ||||
|  *	'C':	(no args) appends a HTTP CONNECTION: close header  | ||||
|  *			depending on major,minor version | ||||
|  *	'c':	(no args) appends CRLF "\r\n" | ||||
|  *	'D':	(no args) appends HTTP DATE: header | ||||
|  *	'd':	arg = int number            // appends decimal number | ||||
|  *	'G':	arg = range information     // add range header | ||||
|  *	'h':	arg = off_t number          // appends off_t number | ||||
|  *	'K':	(no args)                   // add chunky header | ||||
|  *	'N':	arg1 = off_t content_length // content-length header | ||||
|  *	'q':    arg1 = http_method_t        // request start line and HOST header | ||||
|  *		arg2 = (uri_type *) | ||||
|  *	'Q':	arg1 = http_method_t;       // start line of request | ||||
|  *		arg2 = char* url;  | ||||
|  *		arg3 = size_t url_length  | ||||
|  *	'R':	arg = int status_code       // adds a response start line | ||||
|  *	'S':	(no args) appends HTTP SERVER: header | ||||
|  *	's':	arg = const char* C_string | ||||
|  *	'T':	arg = char * content_type; format | ||||
|  *		e.g: "text/html"; content-type header | ||||
|  *	't':	arg = time_t * gmt_time     // appends time in RFC 1123 fmt | ||||
|  *	'U':	(no args) appends HTTP USER-AGENT: header | ||||
|  *      'X':    arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent | ||||
|  * | ||||
|  * Return: int | ||||
|  *	0 - On Success | ||||
|  *	UPNP_E_OUTOF_MEMORY | ||||
|  *	UPNP_E_INVALID_URL | ||||
|  ************************************************************************/ | ||||
|  * \return | ||||
|  * 	\li \c 0 - On Success | ||||
|  * 	\li \c UPNP_E_OUTOF_MEMORY | ||||
|  * 	\li \c UPNP_E_INVALID_URL | ||||
|  */ | ||||
| int http_MakeMessage( | ||||
| 	/* [in,out] Buffer with the contents of the message. */ | ||||
| 	INOUT membuffer* buf,  | ||||
| 	/* [in] HTTP major version. */ | ||||
| 	IN int http_major_version, | ||||
| 	/* [in] HTTP minor version. */ | ||||
| 	IN int http_minor_version, | ||||
| 	IN const char* fmt, ... ); | ||||
| 	/* [in] Pattern format. */ | ||||
| 	IN const char* fmt, | ||||
| 	/* [in] Format arguments. */ | ||||
| 	... ); | ||||
|  | ||||
|  | ||||
| /************************************************************************ | ||||
| @@ -587,6 +559,7 @@ int http_OpenHttpGetEx(IN const char *url_str, | ||||
|  * | ||||
|  * Parameters: | ||||
|  *	OUT char *info;	buffer to store the operating system information | ||||
|  *	IN size_t infoSize; size of buffer | ||||
|  * | ||||
|  * Description: | ||||
|  *	Returns the server information for the operating system | ||||
| @@ -594,12 +567,12 @@ int http_OpenHttpGetEx(IN const char *url_str, | ||||
|  * Return: | ||||
|  *	UPNP_INLINE void | ||||
|  ************************************************************************/ | ||||
| void get_sdk_info( OUT char *info ); | ||||
| void get_sdk_info( OUT char *info, IN size_t infoSize ); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| }	// #extern "C" | ||||
| }	/* #extern "C" */ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #endif // GENLIB_NET_HTTP_HTTPREADWRITE_H | ||||
| #endif /* GENLIB_NET_HTTP_HTTPREADWRITE_H */ | ||||
|  | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user