Compare commits
	
		
			222 Commits
		
	
	
		
			release-1.
			...
			last_svn_1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 2d978c32b8 | ||
|   | e386dd0d68 | ||
|   | 5a2cc884c1 | ||
|   | a362d06dff | ||
|   | 0e73448ea8 | ||
|   | a7966b6597 | ||
|   | 2d5c6310a9 | ||
|   | c9bcee536e | ||
|   | 1605744278 | ||
|   | ce0d2833a3 | ||
|   | 74db05ff1e | ||
|   | 9468e0224a | ||
|   | cb89781a55 | ||
|   | 3de0765893 | ||
|   | ce0e5b664f | ||
|   | eec36896c3 | ||
|   | 00cf8052de | ||
|   | 74b8730f0f | ||
|   | 1b45bec411 | ||
|   | 21163f491d | ||
|   | a54e07bfb2 | ||
|   | 0dea692199 | ||
|   | dc457414d1 | ||
|   | e1d09004eb | ||
|   | 640fa8b1be | ||
|   | 2bcbdffd89 | ||
|   | 6c8a4dd361 | ||
|   | e9941f7ac8 | ||
|   | 5a465a5cf2 | ||
|   | 6aa2419cfd | ||
|   | 712ed6d2ff | ||
|   | 53d5e61b33 | ||
|   | 324931ca8f | ||
|   | edc0638640 | ||
|   | e1ea72a5fb | ||
|   | 5eb55e0fb2 | ||
|   | 9226dd833b | ||
|   | 25c908c558 | ||
|   | 16e91b5dcc | ||
|   | 01d17e5c4b | ||
|   | a1d707ac81 | ||
|   | 4ad6ea3545 | ||
|   | 70a0aff4e7 | ||
|   | aaacf65f41 | ||
|   | cd8ce90e19 | ||
|   | 812d019d12 | ||
|   | 881b212690 | ||
|   | 223c0e8816 | ||
|   | ceca478180 | ||
|   | 7963e97469 | ||
|   | 0080c080cd | ||
|   | 405451e34c | ||
|   | a772b1a754 | ||
|   | ffc4668e0b | ||
|   | 56a7f038dc | ||
|   | 3ba4e34662 | ||
|   | 515233ca56 | ||
|   | 423808a095 | ||
|   | f22a69b487 | ||
|   | bcf5a5c5e0 | ||
|   | e0c9de0b1d | ||
|   | 94e4a3bdda | ||
|   | b7b3bb7d05 | ||
|   | f0161c7274 | ||
|   | 4b40e94b03 | ||
|   | 1c9632dcc3 | ||
|   | cc0c2ffc50 | ||
|   | f812b124d7 | ||
|   | a785465222 | ||
|   | 078f3f8faf | ||
|   | 1eeaf99b83 | ||
|   | f6dd5062fe | ||
|   | 7d4a610b93 | ||
|   | 0a074d1989 | ||
|   | 0475a46680 | ||
|   | 2a76749682 | ||
|   | e4bcf18599 | ||
|   | c856356414 | ||
|   | 6acffb7ede | ||
|   | 837f31bacd | ||
|   | 5151d45203 | ||
|   | 114389589d | ||
|   | b817ec5152 | ||
|   | d9de9a486c | ||
|   | 13ebb40e08 | ||
|   | b614c81e94 | ||
|   | 53766465a9 | ||
|   | 9bc187d4c6 | ||
|   | 80517f26a6 | ||
|   | 468cb2a908 | ||
|   | d71db4c57c | ||
|   | 947dfd9a85 | ||
|   | 8f7fd0fc6d | ||
|   | 81635d74c1 | ||
|   | d8ba182d85 | ||
|   | 0a41ee988b | ||
|   | 907eb0636a | ||
|   | 80fc7c3bb0 | ||
|   | 83fb96fbe2 | ||
|   | 4e1240a0a8 | ||
|   | 2c1dba2942 | ||
|   | 4ceb6c67d1 | ||
|   | 3fa207984a | ||
|   | b82c9c6009 | ||
|   | b1f6e83380 | ||
|   | 00a33f5788 | ||
|   | dfec187e88 | ||
|   | dee3e96a63 | ||
|   | 23e8160417 | ||
|   | 99e11d4fd5 | ||
|   | fb4e7f659d | ||
|   | 28799f26c9 | ||
|   | c1e5e4d6a4 | ||
|   | c0d9908afe | ||
|   | e80cc3ac64 | ||
|   | e04192e1d0 | ||
|   | bbe85ef599 | ||
|   | 5c0893928c | ||
|   | 948c959be5 | ||
|   | f8c4d81ee5 | ||
|   | 286a45d4ad | ||
|   | 59e0e015be | ||
|   | bdda54a66b | ||
|   | 41cb45146c | ||
|   | 2c2a5f7c18 | ||
|   | 047b9534bb | ||
|   | 88076a3c4b | ||
|   | c3060e0d0b | ||
|   | 2ac3819f8c | ||
|   | 0d451c9c8e | ||
|   | bbd16d75ed | ||
|   | a225d3b54e | ||
|   | 08834bf0f0 | ||
|   | e31fcce11d | ||
|   | dce8f71256 | ||
|   | 7a359f29e3 | ||
|   | ed9a594e73 | ||
|   | 039b5fdae6 | ||
|   | f07bcb749f | ||
|   | f64c539395 | ||
|   | cab8e4f799 | ||
|   | 2331839f69 | ||
|   | 363ac6e007 | ||
|   | 5c4e45fb4d | ||
|   | 436bc8fc6d | ||
|   | c6d3d63223 | ||
|   | ae7ca6a2cf | ||
|   | 9595ddcf3a | ||
|   | fd19d54144 | ||
|   | 17db87ab96 | ||
|   | 3b12ced1f8 | ||
|   | 4abbd5a8a4 | ||
|   | 836069f43b | ||
|   | 353a876a54 | ||
|   | 2bc6a1f8dd | ||
|   | 1d9e8712b7 | ||
|   | 819ad1f365 | ||
|   | e9e8ea5636 | ||
|   | 14f72e1442 | ||
|   | ae13c481a7 | ||
|   | 38a91fdaec | ||
|   | 87f336c940 | ||
|   | 74d2b0049b | ||
|   | 635d6ffa93 | ||
|   | 8c56f16607 | ||
|   | 5d3ef166c1 | ||
|   | a4072c19b1 | ||
|   | 1716c7a10d | ||
|   | 83782e8ae2 | ||
|   | f1cc7db79d | ||
|   | e69d5a8609 | ||
|   | 16637892e3 | ||
|   | d19a57c866 | ||
|   | 8c21b2c4d9 | ||
|   | 736efca5dd | ||
|   | d5449dc948 | ||
|   | 7c49b3b8a4 | ||
|   | 5c03ebe6e1 | ||
|   | d17eb5fcfc | ||
|   | 8625298899 | ||
|   | 864d3db0ad | ||
|   | 1d4d1ff87e | ||
|   | a26769b27b | ||
|   | fbbec55457 | ||
|   | 8245b0d808 | ||
|   | 815d08420a | ||
|   | 1d0ce01f31 | ||
|   | 947896bcee | ||
|   | 7ed934d858 | ||
|   | 4a7708331c | ||
|   | ab66940a89 | ||
|   | ebac5fe596 | ||
|   | 11de68d0e3 | ||
|   | dfe3071af4 | ||
|   | cd50cb678f | ||
|   | f13fd3d522 | ||
|   | 927b86545f | ||
|   | a155612cba | ||
|   | df3df9eaed | ||
|   | eefeb86a96 | ||
|   | 0452011b99 | ||
|   | a20707485d | ||
|   | ec86a6f92b | ||
|   | 89e7a40fcc | ||
|   | 90c3db2a96 | ||
|   | cf9ae4f6e5 | ||
|   | f28f81f820 | ||
|   | bcaba51f57 | ||
|   | 4c5b61dc55 | ||
|   | 9147c3517e | ||
|   | cbefc2ff49 | ||
|   | 863e743c41 | ||
|   | 26bde09028 | ||
|   | bc2941c2a7 | ||
|   | 40186d3e9c | ||
|   | 01d26f8f74 | ||
|   | b2cb458ee3 | ||
|   | 16da6980d1 | ||
|   | 211973749c | ||
|   | a22ba2f159 | ||
|   | 142929623d | ||
|   | 3170fbd730 | 
							
								
								
									
										31
									
								
								Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								Makefile.am
									
									
									
									
									
								
							| @@ -1,18 +1,22 @@ | ||||
| # $Id: Makefile.am,v 1.5 2006/04/29 20:12:50 r3mi Exp $ | ||||
| # | ||||
| # Top-level "Makefile.am" for libupnp | ||||
| # | ||||
| # Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net> | ||||
| # Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net> | ||||
| # | ||||
|  | ||||
| ACLOCAL_AMFLAGS = -I m4 | ||||
|  | ||||
| DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-samples | ||||
|  | ||||
| SUBDIRS = ixml threadutil upnp docs/dist | ||||
| SUBDIRS = \ | ||||
| 	ixml \ | ||||
| 	threadutil \ | ||||
| 	upnp \ | ||||
| 	docs/dist | ||||
|  | ||||
|  | ||||
| EXTRA_DIST = \ | ||||
| 	Doxyfile \ | ||||
| 	libupnp.pc.in \ | ||||
| 	LICENSE \ | ||||
| 	THANKS \ | ||||
| @@ -23,7 +27,23 @@ EXTRA_DIST = \ | ||||
| 	build/libupnp.dsw \ | ||||
| 	build/inc/autoconfig.h \ | ||||
| 	build/inc/config.h \ | ||||
| 	build/inc/upnpconfig.h | ||||
| 	build/inc/upnpconfig.h \ | ||||
| 	build/msvc/inttypes.h \ | ||||
| 	build/msvc/stdint.h \ | ||||
| 	build/vc8/ixml.vcproj \ | ||||
| 	build/vc8/libupnp.sln \ | ||||
| 	build/vc8/libupnp.vcproj \ | ||||
| 	build/vc8/threadutil.vcproj \ | ||||
| 	build/vc8/tvcombo.vcproj \ | ||||
| 	build/vc8/tvctrlpt.vcproj \ | ||||
| 	build/vc8/tvdevice.vcproj \ | ||||
| 	build/vc9/ixml.vcproj \ | ||||
| 	build/vc9/libupnp.sln \ | ||||
| 	build/vc9/libupnp.vcproj \ | ||||
| 	build/vc9/threadutil.vcproj \ | ||||
| 	build/vc9/tvcombo.vcproj \ | ||||
| 	build/vc9/tvctrlpt.vcproj \ | ||||
| 	build/vc9/tvdevice.vcproj  | ||||
|  | ||||
|  | ||||
| # This variable must have 'exec' in its name, in order to be installed  | ||||
| @@ -31,11 +51,12 @@ EXTRA_DIST = \ | ||||
| pkgconfigexecdir = $(libdir)/pkgconfig | ||||
| pkgconfigexec_DATA = libupnp.pc | ||||
|  | ||||
|  | ||||
| $(pkgconfigexec_DATA): config.status | ||||
|  | ||||
|  | ||||
| if WITH_DOCUMENTATION | ||||
|     doc_DATA = LICENSE README NEWS TODO THANKS | ||||
| 	doc_DATA = LICENSE README NEWS TODO THANKS | ||||
| endif | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										37
									
								
								THANKS
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								THANKS
									
									
									
									
									
								
							| @@ -6,25 +6,52 @@ suggesting various improvements or submitting actual code. | ||||
| Here is a list of these people. Help us keep it complete and | ||||
| exempt of errors. | ||||
|  | ||||
| - Alex (afaucher) | ||||
| - Andre Sodermans (wienerschnitzel) | ||||
| - Anthony Viallard (homer242) | ||||
| - Apostolos Syropoulos | ||||
| - Arno Willig | ||||
| - Bob Ciora | ||||
| - Carlo Parata | ||||
| - Chaos | ||||
| - Charles Nepveu (cnepveu) | ||||
| - Chris Pickel | ||||
| - Chuck Thomason (cyt4) | ||||
| - Craig Nelson | ||||
| - David Maass | ||||
| - Emil Ljungdahl | ||||
| - Erik Johansson | ||||
| - Eric Tanguy | ||||
| - Erwan Velu | ||||
| - Eugene Christensen | ||||
| - Fabrice Fontaine | ||||
| - Fredrik Svensson | ||||
| - Glen Masgai | ||||
| - Hartmut Holzgraefe - hholzgra | ||||
| - Ingo Hofmann | ||||
| - Jiri Zouhar | ||||
| - John Dennis | ||||
| - Jonathan (no_dice) | ||||
| - Jonathan Casiot (no_dice) | ||||
| - Josh Carroll | ||||
| - Keith Brindley | ||||
| - Leuk_He | ||||
| - Loigu | ||||
| - Luke Kim | ||||
| - Marcelo Roberto Jimenez | ||||
| - Luke Kim (nereusuj) | ||||
| - Marcelo Roberto Jimenez (mroberto) | ||||
| - Markus Strobl | ||||
| - Nektarios K. Papadopoulos | ||||
| - Nektarios K. Papadopoulos (npapadop) | ||||
| - Nicholas Kraft | ||||
| - Nick Leverton (leveret) | ||||
| - Oskar Liljeblad | ||||
| - Michael (Oxy) | ||||
| - Michael (oxygenic) | ||||
| - Paul Vixie | ||||
| - Peter Hartley | ||||
| - Rene Hexel | ||||
| - Robert Gingher (robsbox) | ||||
| - Ronan Menard | ||||
| - Siva Chandran | ||||
| - Stéphane Corthésy | ||||
| - Steve Bresson | ||||
| - Timothy Redaelli | ||||
| - Titus Winters | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,3 @@ autoreconf --force --install -Wall -Wno-obsolete $* || exit 1 | ||||
| echo "Now run ./configure and then make." | ||||
| exit 0 | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| /* autoconfig.h.  Generated by configure.  */ | ||||
| /* autoconfig.h.  Generated from autoconfig.h.in by configure.  */ | ||||
| /* autoconfig.h.in.  Generated from configure.ac by autoheader.  */ | ||||
|  | ||||
| /* Define to 1 to compile debug code */ | ||||
| @@ -19,15 +19,18 @@ | ||||
| /* 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 | ||||
|  | ||||
| /* Define to 1 if you have the <malloc.h> header file. */ | ||||
| #define HAVE_MALLOC_H 1 | ||||
|  | ||||
| /* Define to 1 if you have the <memory.h> header file. */ | ||||
| #define HAVE_MEMORY_H 1 | ||||
|  | ||||
| @@ -92,19 +95,19 @@ | ||||
| #define PACKAGE "libupnp" | ||||
|  | ||||
| /* Define to the address where bug reports for this package should be sent. */ | ||||
| #define PACKAGE_BUGREPORT "virtual_worlds@gmx.de" | ||||
| #define PACKAGE_BUGREPORT "mroberto@users.sourceforge.net" | ||||
|  | ||||
| /* Define to the full name of this package. */ | ||||
| #define PACKAGE_NAME "libupnp" | ||||
|  | ||||
| /* Define to the full name and version of this package. */ | ||||
| #define PACKAGE_STRING "libupnp 1.4.0" | ||||
| #define PACKAGE_STRING "libupnp 1.4.7" | ||||
|  | ||||
| /* Define to the one symbol short name of this package. */ | ||||
| #define PACKAGE_TARNAME "libupnp" | ||||
|  | ||||
| /* Define to the version of this package. */ | ||||
| #define PACKAGE_VERSION "1.4.0" | ||||
| #define PACKAGE_VERSION "1.4.7" | ||||
|  | ||||
| /* Define to necessary symbol if this constant uses a non-standard name on | ||||
|    your system. */ | ||||
| @@ -135,27 +138,30 @@ | ||||
| #define UPNP_VERSION_MINOR 4 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_VERSION_PATCH 0 | ||||
| #define UPNP_VERSION_PATCH 7 | ||||
|  | ||||
| /* see upnpconfig.h */ | ||||
| #define UPNP_VERSION_STRING "1.4.0" | ||||
| #define UPNP_VERSION_STRING "1.4.7" | ||||
|  | ||||
| /* Version number of package */ | ||||
| #define VERSION "1.4.0" | ||||
| #define VERSION "1.4.7" | ||||
|  | ||||
| /* Number of bits in a file offset, on hosts where this is settable. */ | ||||
| /* 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 for large files, on AIX-style hosts. */ | ||||
| /* #undef _LARGE_FILES */ | ||||
| /* Large files support */ | ||||
| #define _LARGE_FILE_SOURCE  | ||||
|  | ||||
| /* Define to empty if `const' does not conform to ANSI C. */ | ||||
| /* #undef const */ | ||||
|  | ||||
| /* Define to `unsigned' if <sys/types.h> does not define. */ | ||||
| /* Define to `long int' if <sys/types.h> does not define. */ | ||||
| /* #undef off_t */ | ||||
|  | ||||
| /* Define to `unsigned int' if <sys/types.h> does not define. */ | ||||
| /* #undef size_t */ | ||||
|  | ||||
| /* Substitute for socklen_t */ | ||||
|   | ||||
| @@ -34,7 +34,6 @@ | ||||
|  | ||||
| #include "autoconfig.h" | ||||
|  | ||||
| #define MAX_JOBS_TOTAL 10 | ||||
|  | ||||
| /** @name Compile time configuration options | ||||
|  *  The Linux SDK for UPnP Devices contains some compile-time parameters  | ||||
| @@ -96,6 +95,17 @@ | ||||
| #define MAX_THREADS 12  | ||||
| //@} | ||||
|  | ||||
| /** @name MAX_JOBS_TOTAL | ||||
|  *  The {\tt MAX_JOBS_TOTAL} constant determines the maximum number of jobs | ||||
|  *  that can be queued. If this limit is reached further jobs will be thrown | ||||
|  *  to avoid memory exhaustion. The default value 100. | ||||
|  *  (Added by Axis.) | ||||
|  */ | ||||
|  | ||||
| //@{ | ||||
| #define MAX_JOBS_TOTAL 100 | ||||
| //@} | ||||
|  | ||||
| /** @name DEFAULT_SOAP_CONTENT_LENGTH | ||||
|  * SOAP messages will read at most {\tt DEFAULT_SOAP_CONTENT_LENGTH} bytes.   | ||||
|  * This prevents devices that have a misbehaving web server to send  | ||||
| @@ -251,18 +261,18 @@ | ||||
|  | ||||
| /** @name Other debugging features | ||||
|           The UPnP SDK contains other features to aid in debugging: | ||||
| 	  see <upnp/upnpdebug.h> | ||||
| 	  see <upnp/inc/upnpdebug.h> | ||||
|  */ | ||||
|  | ||||
| #define DEBUG_ALL		1    | ||||
| #define DEBUG_SSDP		0     | ||||
| #define DEBUG_SOAP		0     | ||||
| #define DEBUG_GENA		0     | ||||
| #define DEBUG_TPOOL		0      | ||||
| #define DEBUG_ALL		1 | ||||
| #define DEBUG_SSDP		0 | ||||
| #define DEBUG_SOAP		0 | ||||
| #define DEBUG_GENA		0 | ||||
| #define DEBUG_TPOOL		0 | ||||
| #define DEBUG_MSERV		0 | ||||
| #define DEBUG_DOM		0 | ||||
| #define DEBUG_HTTP		0 | ||||
| #define DEBUG_API		0     | ||||
| #define DEBUG_API		0 | ||||
|  | ||||
| //@} // Compile time configuration options | ||||
|  | ||||
| @@ -294,68 +304,40 @@ | ||||
|  | ||||
|  | ||||
|  | ||||
| /** @name DBGONLY | ||||
|           The {\bf DBGONLY} macro allows code to be marked so that it | ||||
|           is only included in the DEBUG build and not the release.  To | ||||
|           use this macro, put the code inside of the parentheses: | ||||
|  | ||||
|           {\tt DBGONLY(int i;)} | ||||
|  | ||||
|           This will cause a declaration of the integer {\tt i} only | ||||
|           in the debug build. | ||||
|   */ | ||||
|  | ||||
| //@{ | ||||
| #ifdef DEBUG | ||||
|  #define DBGONLY(x) x | ||||
| #else | ||||
|  #define DBGONLY(x) | ||||
| #endif | ||||
| //@} | ||||
|  | ||||
|  | ||||
|  | ||||
| #undef  EXCLUDE_WEB_SERVER | ||||
| #undef  EXCLUDE_MINISERVER | ||||
| #undef  EXCLUDE_WEB_SERVER  | ||||
| #undef  EXCLUDE_MINISERVER  | ||||
| #ifdef  INTERNAL_WEB_SERVER | ||||
|  #define EXCLUDE_WEB_SERVER 0 | ||||
|  #define EXCLUDE_MINISERVER 0 | ||||
| #	define EXCLUDE_WEB_SERVER 0 | ||||
| #	define EXCLUDE_MINISERVER 0 | ||||
| #else | ||||
|  #define EXCLUDE_WEB_SERVER 1 | ||||
|  #define EXCLUDE_MINISERVER 1 | ||||
| #	define EXCLUDE_WEB_SERVER 1 | ||||
| #	define EXCLUDE_MINISERVER 1 | ||||
| #endif | ||||
|  | ||||
| #if EXCLUDE_GENA == 1 && EXCLUDE_SOAP == 1 && EXCLUDE_WEB_SERVER == 1 | ||||
|  #undef  EXCLUDE_MINISERVER | ||||
|  #define EXCLUDE_MINISERVER 1 | ||||
|  #if INTERNAL_WEB_SERVER | ||||
|   #	error "conflicting settings: use configure --disable-webserver" | ||||
|  #endif | ||||
| #	undef  EXCLUDE_MINISERVER  | ||||
| #	define EXCLUDE_MINISERVER 1 | ||||
| #	if INTERNAL_WEB_SERVER | ||||
| #		error "conflicting settings: use configure --disable-webserver" | ||||
| #	endif | ||||
| #endif | ||||
|  | ||||
| #if EXCLUDE_GENA == 0 || EXCLUDE_SOAP == 0 || EXCLUDE_WEB_SERVER == 0 | ||||
|  #undef  EXCLUDE_MINISERVER | ||||
|  #define EXCLUDE_MINISERVER 0 | ||||
|  #if EXCLUDE_WEB_SERVER == 0 && !defined INTERNAL_WEB_SERVER | ||||
|   #error "conflicting settings : use configure --enable-webserver" | ||||
|  #endif | ||||
| #	undef  EXCLUDE_MINISERVER  | ||||
| #	define EXCLUDE_MINISERVER 0 | ||||
| #	if EXCLUDE_WEB_SERVER == 0 && !defined INTERNAL_WEB_SERVER | ||||
| #		error "conflicting settings : use configure --enable-webserver" | ||||
| #	endif | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
|  #define CLIENTONLY(x) x | ||||
| #else | ||||
|  #define CLIENTONLY(x) | ||||
| #endif | ||||
|  | ||||
| #ifdef INCLUDE_DEVICE_APIS | ||||
|  #define DEVICEONLY(x) x | ||||
| #else | ||||
|  #define DEVICEONLY(x) | ||||
| #	define CLIENTONLY(x) x | ||||
| #else  | ||||
| #	define CLIENTONLY(x) | ||||
| #endif | ||||
|  | ||||
| //@} | ||||
| #endif | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,46 +1,46 @@ | ||||
| /* upnp/inc/upnpconfig.h.  Generated by configure.  */ | ||||
| /* upnp/inc/upnpconfig.h.  Generated from upnpconfig.h.in by configure.  */ | ||||
| // -*- C -*- | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
| // All rights reserved. | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without | ||||
| // modification, are permitted provided that the following conditions are met: | ||||
| // 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 | ||||
| // * 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 | ||||
| //  | ||||
| // 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 | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #ifndef UPNP_CONFIG_H | ||||
| #define UPNP_CONFIG_H | ||||
| #define UPNP_CONFIG_H  | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Library version | ||||
|  ***************************************************************************/ | ||||
|  * Library version  | ||||
|  ***************************************************************************/  | ||||
|  | ||||
| /** The library version (string) e.g. "1.3.0" */ | ||||
| #define UPNP_VERSION_STRING "1.4.0" | ||||
| #define UPNP_VERSION_STRING "1.4.7" | ||||
|  | ||||
| /** Major version of the library */ | ||||
| #define UPNP_VERSION_MAJOR 1 | ||||
| @@ -49,7 +49,7 @@ | ||||
| #define UPNP_VERSION_MINOR 4 | ||||
|  | ||||
| /** Patch version of the library */ | ||||
| #define UPNP_VERSION_PATCH 0 | ||||
| #define UPNP_VERSION_PATCH 7 | ||||
|  | ||||
| /** The library version (numeric) e.g. 10300 means version 1.3.0 */ | ||||
| #define UPNP_VERSION	\ | ||||
| @@ -59,25 +59,25 @@ | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Library optional features | ||||
|  ***************************************************************************/ | ||||
|  ***************************************************************************/  | ||||
|  | ||||
| /* | ||||
|  * The following defines can be tested in order to know which | ||||
|  * The following defines can be tested in order to know which  | ||||
|  * optional features have been included in the installed library. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with DEBUG enabled | ||||
| /** Defined to 1 if the library has been compiled with DEBUG enabled  | ||||
|  *  (i.e. configure --enable-debug) : <upnp/upnpdebug.h> file is available */ | ||||
| #undef UPNP_HAVE_DEBUG | ||||
| /* #undef UPNP_HAVE_DEBUG */ | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with client API enabled | ||||
| /** Defined to 1 if the library has been compiled with client API enabled  | ||||
|  *  (i.e. configure --enable-client) */ | ||||
| #define UPNP_HAVE_CLIENT 1 | ||||
|  | ||||
|  | ||||
| /** Defined to 1 if the library has been compiled with device API enabled | ||||
| /** Defined to 1 if the library has been compiled with device API enabled  | ||||
|  *  (i.e. configure --enable-device) */ | ||||
| #define UPNP_HAVE_DEVICE 1 | ||||
|  | ||||
|   | ||||
							
								
								
									
										301
									
								
								build/msvc/inttypes.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								build/msvc/inttypes.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,301 @@ | ||||
| // ISO C9x  compliant inttypes.h for Microsoft Visual Studio | ||||
| // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124  | ||||
| //  | ||||
| //  Copyright (c) 2006 Alexander Chemeris | ||||
| //  | ||||
| // Redistribution and use in source and binary forms, with or without | ||||
| // modification, are permitted provided that the following conditions are met: | ||||
| //  | ||||
| //   1. Redistributions of source code must retain the above copyright notice, | ||||
| //      this list of conditions and the following disclaimer. | ||||
| //  | ||||
| //   2. Redistributions in binary form must reproduce the above copyright | ||||
| //      notice, this list of conditions and the following disclaimer in the | ||||
| //      documentation and/or other materials provided with the distribution. | ||||
| //  | ||||
| //   3. The name of the author may be used to endorse or promote products | ||||
| //      derived from this software without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||||
| // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||||
| // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||||
| // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||||
| // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||||
| // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  | ||||
| // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||||
| // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||||
| // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| //  | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #ifndef _MSC_VER // [ | ||||
| #error "Use this header only with Microsoft Visual C++ compilers!" | ||||
| #endif // _MSC_VER ] | ||||
|  | ||||
| #ifndef _MSC_INTTYPES_H_ // [ | ||||
| #define _MSC_INTTYPES_H_ | ||||
|  | ||||
| #if _MSC_VER > 1000 | ||||
| #pragma once | ||||
| #endif | ||||
|  | ||||
| #include <stdint.h> | ||||
|  | ||||
| // 7.8 Format conversion of integer types | ||||
|  | ||||
| typedef struct { | ||||
|    intmax_t quot; | ||||
|    intmax_t rem; | ||||
| } imaxdiv_t; | ||||
|  | ||||
| // 7.8.1 Macros for format specifiers | ||||
|  | ||||
| // The fprintf macros for signed integers are: | ||||
| #define PRId8       "d" | ||||
| #define PRIi8       "i" | ||||
| #define PRIdLEAST8  "d" | ||||
| #define PRIiLEAST8  "i" | ||||
| #define PRIdFAST8   "d" | ||||
| #define PRIiFAST8   "i" | ||||
|  | ||||
| #define PRId16       "hd" | ||||
| #define PRIi16       "hi" | ||||
| #define PRIdLEAST16  "hd" | ||||
| #define PRIiLEAST16  "hi" | ||||
| #define PRIdFAST16   "hd" | ||||
| #define PRIiFAST16   "hi" | ||||
|  | ||||
| #define PRId32       "I32d" | ||||
| #define PRIi32       "I32i" | ||||
| #define PRIdLEAST32  "I32d" | ||||
| #define PRIiLEAST32  "I32i" | ||||
| #define PRIdFAST32   "I32d" | ||||
| #define PRIiFAST32   "I32i" | ||||
|  | ||||
| #define PRId64       "I64d" | ||||
| #define PRIi64       "I64i" | ||||
| #define PRIdLEAST64  "I64d" | ||||
| #define PRIiLEAST64  "I64i" | ||||
| #define PRIdFAST64   "I64d" | ||||
| #define PRIiFAST64   "I64i" | ||||
|  | ||||
| #define PRIdMAX     "I64d" | ||||
| #define PRIiMAX     "I64i" | ||||
|  | ||||
| #define PRIdPTR     "Id" | ||||
| #define PRIiPTR     "Ii" | ||||
|  | ||||
| // The fprintf macros for unsigned integers are: | ||||
| #define PRIo8       "o" | ||||
| #define PRIu8       "u" | ||||
| #define PRIx8       "x" | ||||
| #define PRIX8       "X" | ||||
| #define PRIoLEAST8  "o" | ||||
| #define PRIuLEAST8  "u" | ||||
| #define PRIxLEAST8  "x" | ||||
| #define PRIXLEAST8  "X" | ||||
| #define PRIoFAST8   "o" | ||||
| #define PRIuFAST8   "u" | ||||
| #define PRIxFAST8   "x" | ||||
| #define PRIXFAST8   "X" | ||||
|  | ||||
| #define PRIo16       "ho" | ||||
| #define PRIu16       "hu" | ||||
| #define PRIx16       "hx" | ||||
| #define PRIX16       "hX" | ||||
| #define PRIoLEAST16  "ho" | ||||
| #define PRIuLEAST16  "hu" | ||||
| #define PRIxLEAST16  "hx" | ||||
| #define PRIXLEAST16  "hX" | ||||
| #define PRIoFAST16   "ho" | ||||
| #define PRIuFAST16   "hu" | ||||
| #define PRIxFAST16   "hx" | ||||
| #define PRIXFAST16   "hX" | ||||
|  | ||||
| #define PRIo32       "I32o" | ||||
| #define PRIu32       "I32u" | ||||
| #define PRIx32       "I32x" | ||||
| #define PRIX32       "I32X" | ||||
| #define PRIoLEAST32  "I32o" | ||||
| #define PRIuLEAST32  "I32u" | ||||
| #define PRIxLEAST32  "I32x" | ||||
| #define PRIXLEAST32  "I32X" | ||||
| #define PRIoFAST32   "I32o" | ||||
| #define PRIuFAST32   "I32u" | ||||
| #define PRIxFAST32   "I32x" | ||||
| #define PRIXFAST32   "I32X" | ||||
|  | ||||
| #define PRIo64       "I64o" | ||||
| #define PRIu64       "I64u" | ||||
| #define PRIx64       "I64x" | ||||
| #define PRIX64       "I64X" | ||||
| #define PRIoLEAST64  "I64o" | ||||
| #define PRIuLEAST64  "I64u" | ||||
| #define PRIxLEAST64  "I64x" | ||||
| #define PRIXLEAST64  "I64X" | ||||
| #define PRIoFAST64   "I64o" | ||||
| #define PRIuFAST64   "I64u" | ||||
| #define PRIxFAST64   "I64x" | ||||
| #define PRIXFAST64   "I64X" | ||||
|  | ||||
| #define PRIoMAX     "I64o" | ||||
| #define PRIuMAX     "I64u" | ||||
| #define PRIxMAX     "I64x" | ||||
| #define PRIXMAX     "I64X" | ||||
|  | ||||
| #define PRIoPTR     "Io" | ||||
| #define PRIuPTR     "Iu" | ||||
| #define PRIxPTR     "Ix" | ||||
| #define PRIXPTR     "IX" | ||||
|  | ||||
| // The fscanf macros for signed integers are: | ||||
| #define SCNd8       "d" | ||||
| #define SCNi8       "i" | ||||
| #define SCNdLEAST8  "d" | ||||
| #define SCNiLEAST8  "i" | ||||
| #define SCNdFAST8   "d" | ||||
| #define SCNiFAST8   "i" | ||||
|  | ||||
| #define SCNd16       "hd" | ||||
| #define SCNi16       "hi" | ||||
| #define SCNdLEAST16  "hd" | ||||
| #define SCNiLEAST16  "hi" | ||||
| #define SCNdFAST16   "hd" | ||||
| #define SCNiFAST16   "hi" | ||||
|  | ||||
| #define SCNd32       "ld" | ||||
| #define SCNi32       "li" | ||||
| #define SCNdLEAST32  "ld" | ||||
| #define SCNiLEAST32  "li" | ||||
| #define SCNdFAST32   "ld" | ||||
| #define SCNiFAST32   "li" | ||||
|  | ||||
| #define SCNd64       "I64d" | ||||
| #define SCNi64       "I64i" | ||||
| #define SCNdLEAST64  "I64d" | ||||
| #define SCNiLEAST64  "I64i" | ||||
| #define SCNdFAST64   "I64d" | ||||
| #define SCNiFAST64   "I64i" | ||||
|  | ||||
| #define SCNdMAX     "I64d" | ||||
| #define SCNiMAX     "I64i" | ||||
|  | ||||
| #ifdef _WIN64 // [ | ||||
| #  define SCNdPTR     "I64d" | ||||
| #  define SCNiPTR     "I64i" | ||||
| #else  // _WIN64 ][ | ||||
| #  define SCNdPTR     "ld" | ||||
| #  define SCNiPTR     "li" | ||||
| #endif  // _WIN64 ] | ||||
|  | ||||
| // The fscanf macros for unsigned integers are: | ||||
| #define SCNo8       "o" | ||||
| #define SCNu8       "u" | ||||
| #define SCNx8       "x" | ||||
| #define SCNX8       "X" | ||||
| #define SCNoLEAST8  "o" | ||||
| #define SCNuLEAST8  "u" | ||||
| #define SCNxLEAST8  "x" | ||||
| #define SCNXLEAST8  "X" | ||||
| #define SCNoFAST8   "o" | ||||
| #define SCNuFAST8   "u" | ||||
| #define SCNxFAST8   "x" | ||||
| #define SCNXFAST8   "X" | ||||
|  | ||||
| #define SCNo16       "ho" | ||||
| #define SCNu16       "hu" | ||||
| #define SCNx16       "hx" | ||||
| #define SCNX16       "hX" | ||||
| #define SCNoLEAST16  "ho" | ||||
| #define SCNuLEAST16  "hu" | ||||
| #define SCNxLEAST16  "hx" | ||||
| #define SCNXLEAST16  "hX" | ||||
| #define SCNoFAST16   "ho" | ||||
| #define SCNuFAST16   "hu" | ||||
| #define SCNxFAST16   "hx" | ||||
| #define SCNXFAST16   "hX" | ||||
|  | ||||
| #define SCNo32       "lo" | ||||
| #define SCNu32       "lu" | ||||
| #define SCNx32       "lx" | ||||
| #define SCNX32       "lX" | ||||
| #define SCNoLEAST32  "lo" | ||||
| #define SCNuLEAST32  "lu" | ||||
| #define SCNxLEAST32  "lx" | ||||
| #define SCNXLEAST32  "lX" | ||||
| #define SCNoFAST32   "lo" | ||||
| #define SCNuFAST32   "lu" | ||||
| #define SCNxFAST32   "lx" | ||||
| #define SCNXFAST32   "lX" | ||||
|  | ||||
| #define SCNo64       "I64o" | ||||
| #define SCNu64       "I64u" | ||||
| #define SCNx64       "I64x" | ||||
| #define SCNX64       "I64X" | ||||
| #define SCNoLEAST64  "I64o" | ||||
| #define SCNuLEAST64  "I64u" | ||||
| #define SCNxLEAST64  "I64x" | ||||
| #define SCNXLEAST64  "I64X" | ||||
| #define SCNoFAST64   "I64o" | ||||
| #define SCNuFAST64   "I64u" | ||||
| #define SCNxFAST64   "I64x" | ||||
| #define SCNXFAST64   "I64X" | ||||
|  | ||||
| #define SCNoMAX     "I64o" | ||||
| #define SCNuMAX     "I64u" | ||||
| #define SCNxMAX     "I64x" | ||||
| #define SCNXMAX     "I64X" | ||||
|  | ||||
| #ifdef _WIN64 // [ | ||||
| #  define SCNoPTR     "I64o" | ||||
| #  define SCNuPTR     "I64u" | ||||
| #  define SCNxPTR     "I64x" | ||||
| #  define SCNXPTR     "I64X" | ||||
| #else  // _WIN64 ][ | ||||
| #  define SCNoPTR     "lo" | ||||
| #  define SCNuPTR     "lu" | ||||
| #  define SCNxPTR     "lx" | ||||
| #  define SCNXPTR     "lX" | ||||
| #endif  // _WIN64 ] | ||||
|  | ||||
| // 7.8.2 Functions for greatest-width integer types | ||||
|  | ||||
| // 7.8.2.1 The imaxabs function | ||||
| #define imaxabs _abs64 | ||||
|  | ||||
| // 7.8.2.2 The imaxdiv function | ||||
|  | ||||
| // This is modified version of div() function from Microsoft's div.c found | ||||
| // in %MSVC.NET%\crt\src\div.c | ||||
| #ifdef STATIC_IMAXDIV // [ | ||||
| static | ||||
| #else // STATIC_IMAXDIV ][ | ||||
| _inline | ||||
| #endif // STATIC_IMAXDIV ] | ||||
| imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) | ||||
| { | ||||
|    imaxdiv_t result; | ||||
|  | ||||
|    result.quot = numer / denom; | ||||
|    result.rem = numer % denom; | ||||
|  | ||||
|    if (numer < 0 && result.rem > 0) { | ||||
|       // did division wrong; must fix up | ||||
|       ++result.quot; | ||||
|       result.rem -= denom; | ||||
|    } | ||||
|  | ||||
|    return result; | ||||
| } | ||||
|  | ||||
| // 7.8.2.3 The strtoimax and strtoumax functions | ||||
| #define strtoimax _strtoi64 | ||||
| #define strtoumax _strtoui64 | ||||
|  | ||||
| // 7.8.2.4 The wcstoimax and wcstoumax functions | ||||
| #define wcstoimax _wcstoi64 | ||||
| #define wcstoumax _wcstoui64 | ||||
|  | ||||
|  | ||||
| #endif // _MSC_INTTYPES_H_ ] | ||||
							
								
								
									
										222
									
								
								build/msvc/stdint.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										222
									
								
								build/msvc/stdint.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,222 @@ | ||||
| // ISO C9x  compliant stdint.h for Microsoft Visual Studio | ||||
| // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124  | ||||
| //  | ||||
| //  Copyright (c) 2006 Alexander Chemeris | ||||
| //  | ||||
| // Redistribution and use in source and binary forms, with or without | ||||
| // modification, are permitted provided that the following conditions are met: | ||||
| //  | ||||
| //   1. Redistributions of source code must retain the above copyright notice, | ||||
| //      this list of conditions and the following disclaimer. | ||||
| //  | ||||
| //   2. Redistributions in binary form must reproduce the above copyright | ||||
| //      notice, this list of conditions and the following disclaimer in the | ||||
| //      documentation and/or other materials provided with the distribution. | ||||
| //  | ||||
| //   3. The name of the author may be used to endorse or promote products | ||||
| //      derived from this software without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||||
| // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||||
| // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||||
| // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||||
| // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||||
| // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  | ||||
| // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||||
| // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||||
| // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| //  | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #ifndef _MSC_VER // [ | ||||
| #error "Use this header only with Microsoft Visual C++ compilers!" | ||||
| #endif // _MSC_VER ] | ||||
|  | ||||
| #ifndef _MSC_STDINT_H_ // [ | ||||
| #define _MSC_STDINT_H_ | ||||
|  | ||||
| #if _MSC_VER > 1000 | ||||
| #pragma once | ||||
| #endif | ||||
|  | ||||
| #include <limits.h> | ||||
|  | ||||
| // For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}' | ||||
| // or compiler give many errors like this: | ||||
| //   error C2733: second C linkage of overloaded function 'wmemchr' not allowed | ||||
| #if (_MSC_VER < 1300) && defined(__cplusplus) | ||||
|    extern "C++" { | ||||
| #endif  | ||||
| #     include <wchar.h> | ||||
| #if (_MSC_VER < 1300) && defined(__cplusplus) | ||||
|    } | ||||
| #endif | ||||
|  | ||||
| // 7.18.1 Integer types | ||||
|  | ||||
| // 7.18.1.1 Exact-width integer types | ||||
| typedef __int8            int8_t; | ||||
| typedef __int16           int16_t; | ||||
| typedef __int32           int32_t; | ||||
| typedef __int64           int64_t; | ||||
| typedef unsigned __int8   uint8_t; | ||||
| typedef unsigned __int16  uint16_t; | ||||
| typedef unsigned __int32  uint32_t; | ||||
| typedef unsigned __int64  uint64_t; | ||||
|  | ||||
| // 7.18.1.2 Minimum-width integer types | ||||
| typedef int8_t    int_least8_t; | ||||
| typedef int16_t   int_least16_t; | ||||
| typedef int32_t   int_least32_t; | ||||
| typedef int64_t   int_least64_t; | ||||
| typedef uint8_t   uint_least8_t; | ||||
| typedef uint16_t  uint_least16_t; | ||||
| typedef uint32_t  uint_least32_t; | ||||
| typedef uint64_t  uint_least64_t; | ||||
|  | ||||
| // 7.18.1.3 Fastest minimum-width integer types | ||||
| typedef int8_t    int_fast8_t; | ||||
| typedef int16_t   int_fast16_t; | ||||
| typedef int32_t   int_fast32_t; | ||||
| typedef int64_t   int_fast64_t; | ||||
| typedef uint8_t   uint_fast8_t; | ||||
| typedef uint16_t  uint_fast16_t; | ||||
| typedef uint32_t  uint_fast32_t; | ||||
| typedef uint64_t  uint_fast64_t; | ||||
|  | ||||
| // 7.18.1.4 Integer types capable of holding object pointers | ||||
| #ifdef _WIN64 // [ | ||||
|    typedef __int64           intptr_t; | ||||
|    typedef unsigned __int64  uintptr_t; | ||||
| #else // _WIN64 ][ | ||||
|    typedef int               intptr_t; | ||||
|    typedef unsigned int      uintptr_t; | ||||
| #endif // _WIN64 ] | ||||
|  | ||||
| // 7.18.1.5 Greatest-width integer types | ||||
| typedef int64_t   intmax_t; | ||||
| typedef uint64_t  uintmax_t; | ||||
|  | ||||
|  | ||||
| // 7.18.2 Limits of specified-width integer types | ||||
|  | ||||
| #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259 | ||||
|  | ||||
| // 7.18.2.1 Limits of exact-width integer types | ||||
| #define INT8_MIN     ((int8_t)_I8_MIN) | ||||
| #define INT8_MAX     _I8_MAX | ||||
| #define INT16_MIN    ((int16_t)_I16_MIN) | ||||
| #define INT16_MAX    _I16_MAX | ||||
| #define INT32_MIN    ((int32_t)_I32_MIN) | ||||
| #define INT32_MAX    _I32_MAX | ||||
| #define INT64_MIN    ((int64_t)_I64_MIN) | ||||
| #define INT64_MAX    _I64_MAX | ||||
| #define UINT8_MAX    _UI8_MAX | ||||
| #define UINT16_MAX   _UI16_MAX | ||||
| #define UINT32_MAX   _UI32_MAX | ||||
| #define UINT64_MAX   _UI64_MAX | ||||
|  | ||||
| // 7.18.2.2 Limits of minimum-width integer types | ||||
| #define INT_LEAST8_MIN    INT8_MIN | ||||
| #define INT_LEAST8_MAX    INT8_MAX | ||||
| #define INT_LEAST16_MIN   INT16_MIN | ||||
| #define INT_LEAST16_MAX   INT16_MAX | ||||
| #define INT_LEAST32_MIN   INT32_MIN | ||||
| #define INT_LEAST32_MAX   INT32_MAX | ||||
| #define INT_LEAST64_MIN   INT64_MIN | ||||
| #define INT_LEAST64_MAX   INT64_MAX | ||||
| #define UINT_LEAST8_MAX   UINT8_MAX | ||||
| #define UINT_LEAST16_MAX  UINT16_MAX | ||||
| #define UINT_LEAST32_MAX  UINT32_MAX | ||||
| #define UINT_LEAST64_MAX  UINT64_MAX | ||||
|  | ||||
| // 7.18.2.3 Limits of fastest minimum-width integer types | ||||
| #define INT_FAST8_MIN    INT8_MIN | ||||
| #define INT_FAST8_MAX    INT8_MAX | ||||
| #define INT_FAST16_MIN   INT16_MIN | ||||
| #define INT_FAST16_MAX   INT16_MAX | ||||
| #define INT_FAST32_MIN   INT32_MIN | ||||
| #define INT_FAST32_MAX   INT32_MAX | ||||
| #define INT_FAST64_MIN   INT64_MIN | ||||
| #define INT_FAST64_MAX   INT64_MAX | ||||
| #define UINT_FAST8_MAX   UINT8_MAX | ||||
| #define UINT_FAST16_MAX  UINT16_MAX | ||||
| #define UINT_FAST32_MAX  UINT32_MAX | ||||
| #define UINT_FAST64_MAX  UINT64_MAX | ||||
|  | ||||
| // 7.18.2.4 Limits of integer types capable of holding object pointers | ||||
| #ifdef _WIN64 // [ | ||||
| #  define INTPTR_MIN   INT64_MIN | ||||
| #  define INTPTR_MAX   INT64_MAX | ||||
| #  define UINTPTR_MAX  UINT64_MAX | ||||
| #else // _WIN64 ][ | ||||
| #  define INTPTR_MIN   INT32_MIN | ||||
| #  define INTPTR_MAX   INT32_MAX | ||||
| #  define UINTPTR_MAX  UINT32_MAX | ||||
| #endif // _WIN64 ] | ||||
|  | ||||
| // 7.18.2.5 Limits of greatest-width integer types | ||||
| #define INTMAX_MIN   INT64_MIN | ||||
| #define INTMAX_MAX   INT64_MAX | ||||
| #define UINTMAX_MAX  UINT64_MAX | ||||
|  | ||||
| // 7.18.3 Limits of other integer types | ||||
|  | ||||
| #ifdef _WIN64 // [ | ||||
| #  define PTRDIFF_MIN  _I64_MIN | ||||
| #  define PTRDIFF_MAX  _I64_MAX | ||||
| #else  // _WIN64 ][ | ||||
| #  define PTRDIFF_MIN  _I32_MIN | ||||
| #  define PTRDIFF_MAX  _I32_MAX | ||||
| #endif  // _WIN64 ] | ||||
|  | ||||
| #define SIG_ATOMIC_MIN  INT_MIN | ||||
| #define SIG_ATOMIC_MAX  INT_MAX | ||||
|  | ||||
| #ifndef SIZE_MAX // [ | ||||
| #  ifdef _WIN64 // [ | ||||
| #     define SIZE_MAX  _UI64_MAX | ||||
| #  else // _WIN64 ][ | ||||
| #     define SIZE_MAX  _UI32_MAX | ||||
| #  endif // _WIN64 ] | ||||
| #endif // SIZE_MAX ] | ||||
|  | ||||
| // WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> | ||||
| #ifndef WCHAR_MIN // [ | ||||
| #  define WCHAR_MIN  0 | ||||
| #endif  // WCHAR_MIN ] | ||||
| #ifndef WCHAR_MAX // [ | ||||
| #  define WCHAR_MAX  _UI16_MAX | ||||
| #endif  // WCHAR_MAX ] | ||||
|  | ||||
| #define WINT_MIN  0 | ||||
| #define WINT_MAX  _UI16_MAX | ||||
|  | ||||
| #endif // __STDC_LIMIT_MACROS ] | ||||
|  | ||||
|  | ||||
| // 7.18.4 Limits of other integer types | ||||
|  | ||||
| #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260 | ||||
|  | ||||
| // 7.18.4.1 Macros for minimum-width integer constants | ||||
|  | ||||
| #define INT8_C(val)  val##i8 | ||||
| #define INT16_C(val) val##i16 | ||||
| #define INT32_C(val) val##i32 | ||||
| #define INT64_C(val) val##i64 | ||||
|  | ||||
| #define UINT8_C(val)  val##ui8 | ||||
| #define UINT16_C(val) val##ui16 | ||||
| #define UINT32_C(val) val##ui32 | ||||
| #define UINT64_C(val) val##ui64 | ||||
|  | ||||
| // 7.18.4.2 Macros for greatest-width integer constants | ||||
| #define INTMAX_C   INT64_C | ||||
| #define UINTMAX_C  UINT64_C | ||||
|  | ||||
| #endif // __STDC_CONSTANT_MACROS ] | ||||
|  | ||||
|  | ||||
| #endif // _MSC_STDINT_H_ ] | ||||
							
								
								
									
										217
									
								
								build/vc8/ixml.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										217
									
								
								build/vc8/ixml.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,217 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="ixml" | ||||
| 	ProjectGUID="{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}" | ||||
| 	RootNamespace="ixml" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			UseOfMFC="0" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc" | ||||
| 				PreprocessorDefinitions="WIN32;IXML_INLINE=" | ||||
| 				RuntimeLibrary="0" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\attr.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\document.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\element.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixml.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmldebug.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlmembuf.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlparser.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\namedNodeMap.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\node.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\nodeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\inc\ixml.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\inc\ixmldebug.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\inc\ixmlmembuf.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\inc\ixmlparser.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										65
									
								
								build/vc8/libupnp.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								build/vc8/libupnp.sln
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 9.00 | ||||
| # Visual Studio 2005 | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libupnp", "libupnp.vcproj", "{6227F51A-1498-4C4A-B213-F6FDED605125}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "threadutil", "threadutil.vcproj", "{24884928-0501-4CF2-BC8A-180AFC23B2AF}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ixml", "ixml.vcproj", "{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvdevice", "tvdevice.vcproj", "{F592B023-E1F3-4A1E-841E-662DEE497435}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125} | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF} = {24884928-0501-4CF2-BC8A-180AFC23B2AF} | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} = {AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvctrlpt", "tvctrlpt.vcproj", "{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} = {AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF} = {24884928-0501-4CF2-BC8A-180AFC23B2AF} | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvcombo", "tvcombo.vcproj", "{B5D74697-F615-4DCB-AA8B-935F6372F01C}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125} | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF} = {24884928-0501-4CF2-BC8A-180AFC23B2AF} | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} = {AD489FAF-9CDD-411B-BFE9-1B9C6C16D427} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Win32 = Debug|Win32 | ||||
| 		Release|Win32 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{24884928-0501-4CF2-BC8A-180AFC23B2AF}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{AD489FAF-9CDD-411B-BFE9-1B9C6C16D427}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{F592B023-E1F3-4A1E-841E-662DEE497435}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{F592B023-E1F3-4A1E-841E-662DEE497435}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{F592B023-E1F3-4A1E-841E-662DEE497435}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{F592B023-E1F3-4A1E-841E-662DEE497435}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{B5D74697-F615-4DCB-AA8B-935F6372F01C}.Release|Win32.Build.0 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
							
								
								
									
										654
									
								
								build/vc8/libupnp.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										654
									
								
								build/vc8/libupnp.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,654 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="libupnp" | ||||
| 	ProjectGUID="{6227F51A-1498-4C4A-B213-F6FDED605125}" | ||||
| 	RootNamespace="libupnp" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Release/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="0" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile=".\Release/libupnp.pch" | ||||
| 				AssemblerListingLocation="$(OutDir)\" | ||||
| 				ObjectFile="$(OutDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="odbc32.lib odbccp32.lib ..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib  iphlpapi.lib" | ||||
| 				OutputFile="$(OutDir)\libupnp.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				ProgramDatabaseFile=".\Release/libupnp.pdb" | ||||
| 				ImportLibrary=".\Release/libupnp.lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile=".\Release/libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Debug/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="1" | ||||
| 				PrecompiledHeaderFile="$(OutDir)\libupnp.pch" | ||||
| 				AssemblerListingLocation="$(OutDir)\" | ||||
| 				ObjectFile="$(OutDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib ixml.lib" | ||||
| 				OutputFile="$(OutDir)\libupnp.dll" | ||||
| 				LinkIncremental="2" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				AdditionalLibraryDirectories="$(OutDir)\..\ixml" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\libupnp.pdb" | ||||
| 				ImportLibrary="$(OutDir)\libupnp.lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile="$(OutDir)\libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="sources" | ||||
| 			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\ActionComplete.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\ActionRequest.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\attr.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\client_table\client_table.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\Discovery.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\document.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\element.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\Event.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\EventSubscribe.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\FileInfo.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\FreeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\gena\gena_callback2.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\gena\gena_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\gena\gena_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\httpparser.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\httpreadwrite.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inet_pton.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixml.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlmembuf.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlparser.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\LinkedList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\uuid\md5.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\membuffer.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\miniserver\miniserver.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\namedNodeMap.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\node.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\nodeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\parsetools.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\service_table\service_table.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\soap\soap_common.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\soap\soap_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\soap\soap_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\sock.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_server.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\statcodes.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\StateVarComplete.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\StateVarRequest.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\strintmap.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\SubscriptionRequest.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\uuid\sysdep.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\ThreadPool.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\TimerThread.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\upnp_timeout.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\upnpapi.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\upnpdebug.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\UpnpString.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\upnptools.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\uri\uri.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\urlconfig\urlconfig.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\uuid\uuid.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\webserver.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\win_dll.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="headers" | ||||
| 			Filter="h;hpp;hxx;hm;inl" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\ActionComplete.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\actionrequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\client_table.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\config.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\discovery.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\Event.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\EventSubscribe.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\FileInfo.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gena.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gena_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gena_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\global.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gmtdate.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\http_client.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\httpparser.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\httpreadwrite.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\inet_pton.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\md5.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\membuffer.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\miniserver.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\netall.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\parsetools.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\server.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\service_table.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\soaplib.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\sock.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\ssdplib.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\statcodes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\StateVarComplete.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\statevarrequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\statuscodes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\strintmap.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\SubscriptionRequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\sysdep.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\unixutil.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnp.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnp_timeout.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnpapi.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnpclosesocket.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnpdebug.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpString.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnptools.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\uri.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\urlconfig.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\utilall.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\uuid.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\webserver.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath="..\..\..\..\libupnp_win32.patch" | ||||
| 			> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										213
									
								
								build/vc8/threadutil.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										213
									
								
								build/vc8/threadutil.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,213 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="threadutil" | ||||
| 	ProjectGUID="{24884928-0501-4CF2-BC8A-180AFC23B2AF}" | ||||
| 	RootNamespace="threadutil" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\lib" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\FreeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\LinkedList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\ThreadPool.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\TimerThread.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\FreeList.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\ithread.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\LinkedList.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\ThreadPool.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\TimerThread.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										216
									
								
								build/vc8/tvcombo.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								build/vc8/tvcombo.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,216 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="tvcombo" | ||||
| 	ProjectGUID="{B5D74697-F615-4DCB-AA8B-935F6372F01C}" | ||||
| 	RootNamespace="tvcombo" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvcombo;..\..\upnp\sample\tvcombo\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\linux\upnp_tv_combo_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										208
									
								
								build/vc8/tvctrlpt.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								build/vc8/tvctrlpt.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,208 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="tvctrlpt" | ||||
| 	ProjectGUID="{BC1557D9-9E84-4BA5-861E-CB04D767FBDC}" | ||||
| 	RootNamespace="tvctrlpt" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt;..\..\upnp\sample\tvctrlpt\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\linux\upnp_tv_ctrlpt_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										208
									
								
								build/vc8/tvdevice.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								build/vc8/tvdevice.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,208 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="8.00" | ||||
| 	Name="tvdevice" | ||||
| 	ProjectGUID="{F592B023-E1F3-4A1E-841E-662DEE497435}" | ||||
| 	RootNamespace="tvdevice" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc8.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";"out.vc8.$(ConfigurationName)\ixml";"out.vc8.$(ConfigurationName)\threadutil";"out.vc8.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				RuntimeLibrary="2" | ||||
| 				WarningLevel="3" | ||||
| 				Detect64BitPortabilityProblems="true" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebDeploymentTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\linux\upnp_tv_device_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										216
									
								
								build/vc9/ixml.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								build/vc9/ixml.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,216 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9.00" | ||||
| 	Name="ixml" | ||||
| 	ProjectGUID="{9C2C266D-35A3-465F-A297-0E21D54E5C89}" | ||||
| 	RootNamespace="ixml" | ||||
| 	TargetFrameworkVersion="196613" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc;..\..\upnp\inc" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\ixml\inc;..\..\ixml\src\inc;..\inc" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\attr.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\document.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\element.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixml.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmldebug.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlmembuf.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlparser.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\namedNodeMap.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\node.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\nodeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\inc\ixml.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\inc\ixmldebug.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\inc\ixmlmembuf.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\inc\ixmlparser.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										63
									
								
								build/vc9/libupnp.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								build/vc9/libupnp.sln
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 10.00 | ||||
| # Visual Studio 2008 | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libupnp", "libupnp.vcproj", "{6227F51A-1498-4C4A-B213-F6FDED605125}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89} = {9C2C266D-35A3-465F-A297-0E21D54E5C89} | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D} = {1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ixml", "ixml.vcproj", "{9C2C266D-35A3-465F-A297-0E21D54E5C89}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "threadutil", "threadutil.vcproj", "{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}" | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvctrlpt", "tvctrlpt.vcproj", "{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvdevice", "tvdevice.vcproj", "{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tvcombo", "tvcombo.vcproj", "{6365804B-22C6-4D5E-91F3-0C052EB55B4F}" | ||||
| 	ProjectSection(ProjectDependencies) = postProject | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125} = {6227F51A-1498-4C4A-B213-F6FDED605125} | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Win32 = Debug|Win32 | ||||
| 		Release|Win32 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{6227F51A-1498-4C4A-B213-F6FDED605125}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{9C2C266D-35A3-465F-A297-0E21D54E5C89}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}.Release|Win32.Build.0 = Release|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Debug|Win32.Build.0 = Debug|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|Win32.ActiveCfg = Release|Win32 | ||||
| 		{6365804B-22C6-4D5E-91F3-0C052EB55B4F}.Release|Win32.Build.0 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
							
								
								
									
										650
									
								
								build/vc9/libupnp.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										650
									
								
								build/vc9/libupnp.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,650 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9,00" | ||||
| 	Name="libupnp" | ||||
| 	ProjectGUID="{6227F51A-1498-4C4A-B213-F6FDED605125}" | ||||
| 	RootNamespace="libupnp" | ||||
| 	TargetFrameworkVersion="131072" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Release/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				InlineFunctionExpansion="1" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include,..\ixml\src\inc,..\ixml\inc,..\threadutil\inc,..\upnp\inc,..\upnp\src\inc,.\inc" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				StringPooling="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				PrecompiledHeaderFile=".\Release/libupnp.pch" | ||||
| 				AssemblerListingLocation=".\Release/" | ||||
| 				ObjectFile=".\Release/" | ||||
| 				ProgramDataBaseFileName=".\Release/" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="NDEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib" | ||||
| 				OutputFile=".\Release/libupnp.dll" | ||||
| 				LinkIncremental="1" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				ProgramDatabaseFile=".\Release/libupnp.pdb" | ||||
| 				RandomizedBaseAddress="1" | ||||
| 				DataExecutionPrevention="0" | ||||
| 				ImportLibrary=".\Release/libupnp.lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile=".\Release/libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="2" | ||||
| 			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops" | ||||
| 			UseOfMFC="0" | ||||
| 			ATLMinimizesCRunTimeLibraryUsage="false" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				MkTypLibCompatible="true" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				TargetEnvironment="1" | ||||
| 				TypeLibraryName=".\Debug/libupnp.tlb" | ||||
| 				HeaderFileName="" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\pthreads\include;..\..\ixml\src\inc;..\..\ixml\inc;..\..\threadutil\inc;..\..\upnp\inc;..\..\upnp\src\inc;..\inc;..\msvc" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				PrecompiledHeaderFile="$(OutDir)\libupnp.pch" | ||||
| 				AssemblerListingLocation="$(OutDir)\" | ||||
| 				ObjectFile="$(OutDir)\" | ||||
| 				ProgramDataBaseFileName="$(OutDir)\" | ||||
| 				BrowseInformation="1" | ||||
| 				WarningLevel="3" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 				PreprocessorDefinitions="_DEBUG" | ||||
| 				Culture="1031" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadvc2.lib ws2_32.lib iphlpapi.lib $(TargetDir)..\ixml\ixml.lib" | ||||
| 				OutputFile="$(OutDir)\libupnp.dll" | ||||
| 				LinkIncremental="2" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				ProgramDatabaseFile="$(OutDir)\libupnp.pdb" | ||||
| 				RandomizedBaseAddress="1" | ||||
| 				DataExecutionPrevention="0" | ||||
| 				ImportLibrary="$(OutDir)\libupnp.lib" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 				SuppressStartupBanner="true" | ||||
| 				OutputFile="$(OutDir)\libupnp.bsc" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="sources" | ||||
| 			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\ActionComplete.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\ActionRequest.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\attr.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\client_table\client_table.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\Discovery.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\document.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\element.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\Event.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\EventSubscribe.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\FileInfo.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\FreeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\gena\gena_callback2.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\gena\gena_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\gena\gena_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\httpparser.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\httpreadwrite.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inet_pton.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixml.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlmembuf.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\ixmlparser.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\LinkedList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\uuid\md5.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\membuffer.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\miniserver\miniserver.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\namedNodeMap.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\node.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\ixml\src\nodeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\parsetools.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\service_table\service_table.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\soap\soap_common.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\soap\soap_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\soap\soap_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\sock.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_server.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\statcodes.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\StateVarComplete.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\StateVarRequest.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\strintmap.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\SubscriptionRequest.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\uuid\sysdep.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\ThreadPool.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\TimerThread.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\upnp_timeout.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\upnpapi.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\upnpdebug.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\UpnpString.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\api\upnptools.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\uri\uri.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\urlconfig\urlconfig.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\util\util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\uuid\uuid.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\genlib\net\http\webserver.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\win_dll.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="headers" | ||||
| 			Filter="h;hpp;hxx;hm;inl" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\ActionComplete.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\ActionRequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\client_table.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\config.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\Discovery.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\Event.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\EventSubscribe.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\FileInfo.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gena.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gena_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gena_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\global.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\gmtdate.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\http_client.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\httpparser.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\httpreadwrite.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\inet_pton.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\md5.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\membuffer.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\miniserver.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\netall.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\parsetools.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\server.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\service_table.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\soaplib.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\sock.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\ssdp\ssdp_ResultData.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\ssdplib.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\statcodes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\StateVarComplete.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\StateVarRequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\statuscodes.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\strintmap.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\SubscriptionRequest.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\sysdep.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\unixutil.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnp.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnp_timeout.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnpapi.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\upnpclosesocket.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnpdebug.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\UpnpString.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\inc\upnptools.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\uri.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\urlconfig.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\utilall.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\uuid.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\src\inc\webserver.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<File | ||||
| 			RelativePath="..\..\..\..\libupnp_win32.patch" | ||||
| 			> | ||||
| 		</File> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										216
									
								
								build/vc9/threadutil.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								build/vc9/threadutil.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,216 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9,00" | ||||
| 	Name="threadutil" | ||||
| 	ProjectGUID="{1D3EEF7A-D248-48C0-B6B5-ECA229FE4B3D}" | ||||
| 	RootNamespace="threadutil" | ||||
| 	TargetFrameworkVersion="196613" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="4" | ||||
| 			CharacterSet="0" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32;_USRDLL;LIBUPNP_EXPORTS;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLibrarianTool" | ||||
| 				AdditionalDependencies="pthreadVC2.lib" | ||||
| 				AdditionalLibraryDirectories="..\..\pthreads\lib" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="0" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				AdditionalIncludeDirectories="..\..\threadutil\inc;..\..\upnp\inc;..\..\ixml\inc;..\..\pthreads\include" | ||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBUPNP_EXPORTS;PTW32_STATIC_LIB;UPNP_STATIC_LIB;UPNP_USE_MSVCPP;_CRT_SECURE_NO_WARNINGS" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\FreeList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\LinkedList.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\ThreadPool.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\src\TimerThread.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\FreeList.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\ithread.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\LinkedList.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\threadpool.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\threadutil\inc\TimerThread.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										214
									
								
								build/vc9/tvcombo.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										214
									
								
								build/vc9/tvcombo.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,214 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9,00" | ||||
| 	Name="tvcombo" | ||||
| 	ProjectGUID="{6365804B-22C6-4D5E-91F3-0C052EB55B4F}" | ||||
| 	RootNamespace="tvcombo" | ||||
| 	TargetFrameworkVersion="196613" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\upnp\sample;..\..\ixml\inc;..\..\pthreads\include;..\inc;..\..\threadutil\inc;..\..\upnp\sample\tvcombo" | ||||
| 				PreprocessorDefinitions="DEBUG;WIN32" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib $(TargetDir)..\libupnp\libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(TargetDir)..\ixml";"$(TargetDir)..\threadutil";"$(TargetDir)..\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 				CompileAs="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\linux\upnp_tv_combo_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvcombo\upnp_tv_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										204
									
								
								build/vc9/tvctrlpt.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								build/vc9/tvctrlpt.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,204 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9.00" | ||||
| 	Name="tvctrlpt" | ||||
| 	ProjectGUID="{8FB56F1C-E617-4B79-96AE-1FA499A3A9B5}" | ||||
| 	RootNamespace="sample" | ||||
| 	TargetFrameworkVersion="196613" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\upnp\sample\common;..\..\ixml\inc;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvctrlpt\linux;..\..\upnp\sample\tvctrlpt" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";".\out.vc9.$(ConfigurationName)\ixml";".\out.vc9.$(ConfigurationName)\threadutil";".\out.vc9.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\linux\upnp_tv_ctrlpt_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvctrlpt\upnp_tv_ctrlpt.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										204
									
								
								build/vc9/tvdevice.vcproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										204
									
								
								build/vc9/tvdevice.vcproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,204 @@ | ||||
| <?xml version="1.0" encoding="Windows-1252"?> | ||||
| <VisualStudioProject | ||||
| 	ProjectType="Visual C++" | ||||
| 	Version="9.00" | ||||
| 	Name="tvdevice" | ||||
| 	ProjectGUID="{7FB5F4A6-74F9-471D-B358-BAA0AC1CCA0A}" | ||||
| 	RootNamespace="tvdevice" | ||||
| 	TargetFrameworkVersion="196613" | ||||
| 	> | ||||
| 	<Platforms> | ||||
| 		<Platform | ||||
| 			Name="Win32" | ||||
| 		/> | ||||
| 	</Platforms> | ||||
| 	<ToolFiles> | ||||
| 	</ToolFiles> | ||||
| 	<Configurations> | ||||
| 		<Configuration | ||||
| 			Name="Debug|Win32" | ||||
| 			OutputDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			IntermediateDirectory=".\out.vc9.$(ConfigurationName)\$(ProjectName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="0" | ||||
| 				AdditionalIncludeDirectories="..\..\upnp\inc;..\..\ixml\inc;..\..\upnp\sample\common;..\inc;..\..\threadutil\inc;..\..\pthreads\include;..\..\upnp\sample\tvdevice;..\..\upnp\sample\tvdevice\linux" | ||||
| 				PreprocessorDefinitions="WIN32;DEBUG" | ||||
| 				MinimalRebuild="true" | ||||
| 				BasicRuntimeChecks="3" | ||||
| 				RuntimeLibrary="3" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="4" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				AdditionalDependencies="..\..\pthreads\lib\pthreadVC2.lib ixml.lib threadutil.lib libupnp.lib" | ||||
| 				AdditionalLibraryDirectories=""$(OutDir)";".\out.vc9.$(ConfigurationName)\ixml";".\out.vc9.$(ConfigurationName)\threadutil";".\out.vc9.$(ConfigurationName)\libupnp"" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 		<Configuration | ||||
| 			Name="Release|Win32" | ||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||||
| 			IntermediateDirectory="$(ConfigurationName)" | ||||
| 			ConfigurationType="1" | ||||
| 			CharacterSet="2" | ||||
| 			WholeProgramOptimization="1" | ||||
| 			> | ||||
| 			<Tool | ||||
| 				Name="VCPreBuildEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCustomBuildTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXMLDataGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCWebServiceProxyGeneratorTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCMIDLTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCCLCompilerTool" | ||||
| 				Optimization="2" | ||||
| 				EnableIntrinsicFunctions="true" | ||||
| 				RuntimeLibrary="2" | ||||
| 				EnableFunctionLevelLinking="true" | ||||
| 				WarningLevel="3" | ||||
| 				DebugInformationFormat="3" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManagedResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCResourceCompilerTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPreLinkEventTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCLinkerTool" | ||||
| 				GenerateDebugInformation="true" | ||||
| 				OptimizeReferences="2" | ||||
| 				EnableCOMDATFolding="2" | ||||
| 				TargetMachine="1" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCALinkTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCManifestTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCXDCMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCBscMakeTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCFxCopTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCAppVerifierTool" | ||||
| 			/> | ||||
| 			<Tool | ||||
| 				Name="VCPostBuildEventTool" | ||||
| 			/> | ||||
| 		</Configuration> | ||||
| 	</Configurations> | ||||
| 	<References> | ||||
| 	</References> | ||||
| 	<Files> | ||||
| 		<Filter | ||||
| 			Name="Source Files" | ||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\linux\upnp_tv_device_main.c" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Header Files" | ||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||||
| 			> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\common\sample_util.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 			<File | ||||
| 				RelativePath="..\..\upnp\sample\tvdevice\upnp_tv_device.h" | ||||
| 				> | ||||
| 			</File> | ||||
| 		</Filter> | ||||
| 		<Filter | ||||
| 			Name="Resource Files" | ||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||
| 			> | ||||
| 		</Filter> | ||||
| 	</Files> | ||||
| 	<Globals> | ||||
| 	</Globals> | ||||
| </VisualStudioProject> | ||||
							
								
								
									
										390
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										390
									
								
								configure.ac
									
									
									
									
									
								
							| @@ -1,53 +1,191 @@ | ||||
| # -*- Autoconf -*- | ||||
| # $Id: configure.ac,v 1.11 2006/04/09 13:59:44 r3mi Exp $ | ||||
| # | ||||
| # Top-level configure.ac file for libupnp | ||||
| # | ||||
| # Process this file with autoconf to produce a configure script. | ||||
| # | ||||
| # (C) Copyright 2005-2006 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net> | ||||
| # (C) Copyright 2005-2007 Rémi Turboult <r3mi@users.sourceforge.net> | ||||
| # | ||||
|  | ||||
| AC_PREREQ(2.60) | ||||
|  | ||||
| AC_INIT([libupnp], [1.4.4], [mroberto@users.sourceforge.net]) | ||||
| # *Independently* of the above libupnp package version, the libtool version | ||||
| # of the 3 libraries need to be updated whenever there is a change released : | ||||
| # "current:revision:age" (this is NOT the same as the package version), where: | ||||
| # 	- library code modified:		revision++ | ||||
| # 	- interfaces changed/added/removed:	current++ and revision=0 | ||||
| # 	- interfaces added: 			age++ | ||||
| # 	- interfaces removed:			age=0 | ||||
| # *please update only once, before a formal release, not for each change* | ||||
| # | ||||
| # For release 1.4.1, we had: | ||||
| #AC_SUBST([LT_VERSION_IXML],       [2:2:0]) | ||||
| #AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0]) | ||||
| #AC_SUBST([LT_VERSION_UPNP],       [2:2:0]) | ||||
| # | ||||
| # "current:revision:age" | ||||
| # | ||||
| # - Code has changed in ixml | ||||
| #	revision: 2 -> 3 | ||||
| # - Code has changed in threadutil | ||||
| #	revision: 2 -> 3 | ||||
| # - Interface added in threadutil | ||||
| #	current: 2 -> 3 | ||||
| #	revisiion: 3 -> 0 | ||||
| #	age: 0 -> 1 | ||||
| # - Code has changed in upnp (revision 2 -> 3) | ||||
| #	revision: 2 -> 3 | ||||
| AC_SUBST([LT_VERSION_IXML],       [2:3:0]) | ||||
| AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1]) | ||||
| AC_SUBST([LT_VERSION_UPNP],       [2:3:0]) | ||||
| AC_INIT([libupnp], [1.6.7], [mroberto@users.sourceforge.net]) | ||||
| dnl ############################################################################ | ||||
| dnl # *Independently* of the above libupnp package version, the libtool version | ||||
| dnl # of the 3 libraries need to be updated whenever there is a change released: | ||||
| dnl # "current:revision:age" (this is NOT the same as the package version), | ||||
| dnl # where: | ||||
| dnl # 	- library code modified:		revision++ | ||||
| dnl # 	- interfaces changed/added/removed:	current++ and revision=0 | ||||
| dnl # 	- interfaces added: 			age++ | ||||
| dnl # 	- interfaces removed:			age=0 | ||||
| dnl # *please update only once, before a formal release, not for each change* | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.4.1: | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:2:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [2:2:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.4.6: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in ixml | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # - Interface added in threadutil | ||||
| dnl #	current: 2 -> 3 | ||||
| dnl #	revisiion: 3 -> 0 | ||||
| dnl #	age: 0 -> 1 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:3:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [2:3:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.0: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in ixml | ||||
| dnl #	revision: 3 -> 4 | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 0 -> 1 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 3 -> 4 | ||||
| dnl # - Interface changed in upnp | ||||
| dnl #	current: 2 -> 3 | ||||
| dnl #	revision: 4 -> 0 | ||||
| dnl # - Interface removed in upnp | ||||
| dnl #	age: 0 -> 0 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:0:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.1: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 1 -> 2 | ||||
| dnl # - Interface added in threadutil | ||||
| dnl #	current: 3 -> 4 | ||||
| dnl #	revision: 2 -> 0 | ||||
| dnl # - Interface added in threadutil | ||||
| dnl #	age: 1 -> 2 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 0 -> 1 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:1:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.2: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 1 -> 2 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:2:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.3: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 0 -> 1 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:1:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:2:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.4: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 1 -> 2 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:3:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.5: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 3 -> 4 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:2:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:4:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.6: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 2 -> 3 | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 4 -> 5 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:3:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:5:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| dnl # Release 1.6.7: | ||||
| dnl # "current:revision:age" | ||||
| dnl # | ||||
| dnl # - Code has changed in upnp | ||||
| dnl #	revision: 5 -> 6 | ||||
| dnl # - Code has changed in threadutil | ||||
| dnl #	revision: 3 -> 4 | ||||
| dnl # - Interfaces have been changed, added and removed in upnp | ||||
| dnl #	current: 4 -> 5 | ||||
| dnl #   revision: 4 -> 0 | ||||
| dnl # | ||||
| dnl #AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| dnl #AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2]) | ||||
| dnl #AC_SUBST([LT_VERSION_UPNP],       [3:5:0]) | ||||
| dnl # | ||||
| dnl ############################################################################ | ||||
| AC_SUBST([LT_VERSION_IXML],       [2:4:0]) | ||||
| AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2]) | ||||
| AC_SUBST([LT_VERSION_UPNP],       [3:5:0]) | ||||
| dnl ############################################################################ | ||||
| dnl # Repeating the algorithm to place it closer to the modificatin place: | ||||
| dnl # 	- library code modified:		revision++ | ||||
| dnl # 	- interfaces changed/added/removed:	current++ and revision=0 | ||||
| dnl # 	- interfaces added: 			age++ | ||||
| dnl # 	- interfaces removed:			age=0 | ||||
| dnl # *please update only once, before a formal release, not for each change* | ||||
| dnl ############################################################################ | ||||
|  | ||||
|  | ||||
| AC_CONFIG_AUX_DIR(config.aux) | ||||
| AC_CONFIG_MACRO_DIR(m4) | ||||
| AC_CONFIG_SRCDIR(upnp/inc/upnp.h) | ||||
| AC_CONFIG_AUX_DIR([build-aux]) | ||||
| AC_CONFIG_MACRO_DIR([m4]) | ||||
| AC_CONFIG_SRCDIR([upnp/inc/upnp.h]) | ||||
|  | ||||
|  | ||||
| AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2]) | ||||
|  | ||||
|  | ||||
| # | ||||
| # Get canonical host names in host and host_os | ||||
| # | ||||
| AC_CANONICAL_HOST | ||||
|  | ||||
| # | ||||
| # There are 3 configuration files : | ||||
| # 1) "./autoconfig.h" is auto-generated and used only internally during build | ||||
| @@ -67,8 +205,7 @@ AC_REVISION([$Revision: 1.11 $]) | ||||
| upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' ` | ||||
| upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `] | ||||
| upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `] | ||||
| AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION", | ||||
| 	[see upnpconfig.h]) | ||||
| AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION", [see upnpconfig.h]) | ||||
| AC_DEFINE_UNQUOTED([UPNP_VERSION_MAJOR], $upnpmaj, [see upnpconfig.h]) | ||||
| AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h]) | ||||
| AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h]) | ||||
| @@ -90,7 +227,6 @@ fi | ||||
| # | ||||
| # Check for libupnp subsets | ||||
| # | ||||
|  | ||||
| RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)]) | ||||
| if test "x$enable_client" = xyes ; then | ||||
| 	AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h]) | ||||
| @@ -124,23 +260,30 @@ fi | ||||
| RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code]) | ||||
|  | ||||
|  | ||||
| # | ||||
| # doc installation | ||||
| # autoconf >= 2.60 already defines ${docdir}, but we will not use its  | ||||
| # default value, which is ${datarootdir}/doc/${PACKAGE_TARNAME}. | ||||
| # That would give us ${datarootdir}/doc/libupnp, and we want the package | ||||
| # version on that. | ||||
| # | ||||
| docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}" | ||||
| AC_MSG_CHECKING([for documentation directory]) | ||||
| AC_ARG_WITH([documentation],  | ||||
| 	AS_HELP_STRING([--with-documentation=directory_name], | ||||
| AC_ARG_WITH( | ||||
| 	[documentation],  | ||||
| 	AS_HELP_STRING( | ||||
| 		[--with-documentation=directory_name], | ||||
| 		[where documentation is installed  | ||||
| 		 @<:@[DATADIR/doc/]AC_PACKAGE_NAME[-]AC_PACKAGE_VERSION@:>@]) | ||||
| AS_HELP_STRING([--without-documentation], | ||||
| AS_HELP_STRING( | ||||
| 		[--without-documentation], | ||||
| 		[do not install the documentation]), | ||||
| 	[], | ||||
| 	[with_documentation=no]) | ||||
|  | ||||
| # | ||||
| # If something has been entered after an equal sign, assume it is the directory | ||||
| # | ||||
| if test x"$with_documentation" != xyes -a x"$with_documentation" != xno; then | ||||
| 	docdir="$with_documentation" | ||||
| fi | ||||
| @@ -159,42 +302,117 @@ AC_PROG_INSTALL | ||||
| AC_PROG_MAKE_SET | ||||
| AC_PROG_EGREP | ||||
|  | ||||
|  | ||||
| # | ||||
| # Default compilation flags | ||||
| # | ||||
| if test x"$enable_debug" = xyes; then | ||||
| 	# AC_PROG_CC already sets CFLAGS to "-g -O2" by default | ||||
| 	: | ||||
| else | ||||
| 	# add optimise for size | ||||
| 	AX_CFLAGS_GCC_OPTION([-Os]) | ||||
| fi | ||||
| echo "--------------------- Default compilation flags -------------------------------" | ||||
| echo host is $host | ||||
| echo host_os is $host_os | ||||
| case $host_os in | ||||
| freebsd*) | ||||
| 	echo "Using FreeBSD specific compiler settings" | ||||
| 	# Put FreeBSD specific compiler flags here | ||||
| 	;; | ||||
| *) | ||||
| 	echo "Using non-specific system compiler settings" | ||||
| 	if test x"$enable_debug" = xyes; then | ||||
| 		# AC_PROG_CC already sets CFLAGS to "-g -O2" by default | ||||
| 		#: | ||||
| 		# Use -O0 in debug so that variables do not get optimized out | ||||
| 		AX_CFLAGS_GCC_OPTION([-O0]) | ||||
| 	else | ||||
| 		# add optimise for size | ||||
| 		AX_CFLAGS_GCC_OPTION([-Os]) | ||||
| 	fi | ||||
| 	;; | ||||
| esac | ||||
|  | ||||
| AX_CFLAGS_WARN_ALL | ||||
| echo "-------------------------------------------------------------------------------" | ||||
|  | ||||
|  | ||||
| # | ||||
| # Lot's of stuff to ensure large file support | ||||
| # | ||||
| AC_TYPE_SIZE_T | ||||
| AC_TYPE_OFF_T | ||||
| AC_DEFINE(_LARGE_FILE_SOURCE, [], [Large files support]) | ||||
| AC_DEFINE(_FILE_OFFSET_BITS, [64], [File Offset size]) | ||||
| AC_DEFINE([_LARGE_FILE_SOURCE], [], [Large files support]) | ||||
| AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size]) | ||||
|  | ||||
|  | ||||
| # | ||||
| # Checks for header files | ||||
| # Are we targetting Win32? | ||||
| # | ||||
| AC_MSG_CHECKING([for Win32]) | ||||
| AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ | ||||
| #ifdef WIN32 | ||||
| 	#error Yup | ||||
| #endif | ||||
| ],[])], [ac_cv_win32="no"], [ac_cv_win32="yes"]) | ||||
| if test "$ac_cv_win32" = "yes"; then | ||||
| 	AC_MSG_RESULT([yes]) | ||||
| else | ||||
| 	AC_MSG_RESULT([no]) | ||||
| fi | ||||
|  | ||||
|  | ||||
| # | ||||
| # Checks for header files (which aren't needed on Win32) | ||||
| # | ||||
| AC_HEADER_STDC | ||||
| if test "$ac_cv_win32" = "no"; then | ||||
| # libupnp code doesn't use autoconf variables yet, | ||||
| # so just abort if a header file is not found. | ||||
| AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h],[],[AC_MSG_ERROR([required header file missing])]) | ||||
| AC_CHECK_HEADERS( | ||||
| 	[ \ | ||||
| 	arpa/inet.h \ | ||||
| 	fcntl.h \ | ||||
| 	inttypes.h \ | ||||
| 	limits.h \ | ||||
| 	netdb.h \ | ||||
| 	netinet/in.h \ | ||||
| 	stdlib.h \ | ||||
| 	string.h \ | ||||
| 	sys/ioctl.h \ | ||||
| 	sys/socket.h \ | ||||
| 	sys/time.h \ | ||||
| 	syslog.h \ | ||||
| 	unistd.h \ | ||||
| 	], | ||||
| 	[], | ||||
| 	[AC_MSG_ERROR([required header file missing])]) | ||||
| fi | ||||
|  | ||||
|  | ||||
| # | ||||
| # Checks for typedefs, structures, and compiler characteristics | ||||
| #	 | ||||
| AC_C_CONST | ||||
| AC_TYPE_SIZE_T | ||||
| TYPE_SOCKLEN_T | ||||
|  | ||||
| # The test for socklen_t was getting it wrong when it exists but is in ws2tcpip.h, | ||||
| # so we use a new test. | ||||
| #TYPE_SOCKLEN_T | ||||
|  | ||||
| AC_CHECK_HEADERS([sys/types.h sys/socket.h ws2tcpip.h]) | ||||
| AC_MSG_CHECKING(for socklen_t) | ||||
| AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ | ||||
| #ifdef HAVE_SYS_TYPES_H | ||||
| 	#include <sys/types.h> | ||||
| #endif | ||||
| #ifdef HAVE_SYS_SOCKET_H | ||||
| 	#include <sys/socket.h> | ||||
| #endif | ||||
| #ifdef HAVE_WS2TCPIP_H | ||||
| 	#include <ws2tcpip.h> | ||||
| #endif | ||||
| ],[ socklen_t t = 0; return t; ]) | ||||
| ],[ac_cv_socklen_t="yes"],[ac_cv_socklen_t="no"]) | ||||
| if test "$ac_cv_socklen_t" = "yes"; then | ||||
| 	AC_MSG_RESULT([yes]) | ||||
| else | ||||
| 	AC_MSG_RESULT([no, using int]) | ||||
| 	AC_DEFINE(socklen_t, int, [Type for storing the length of struct sockaddr]) | ||||
| fi | ||||
|  | ||||
|  | ||||
| # | ||||
| @@ -202,25 +420,65 @@ TYPE_SOCKLEN_T | ||||
| # | ||||
| AC_FUNC_VPRINTF | ||||
| AC_FUNC_FSEEKO | ||||
| AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)]) | ||||
| # | ||||
| # Solaris needs -lsocket -lnsl -lrt | ||||
| AC_SEARCH_LIBS([bind],           [socket]) | ||||
| AC_SEARCH_LIBS([gethostbyname],  [nsl]) | ||||
| AC_SEARCH_LIBS([sched_getparam], [rt]) | ||||
|  | ||||
|  | ||||
| # | ||||
| # Checks for POSIX Threads | ||||
| # | ||||
| ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])]) | ||||
| echo "--------------------------- pthread stuff -------------------------------------" | ||||
| ACX_PTHREAD( | ||||
| 	[], | ||||
| 	[AC_MSG_ERROR([POSIX threads are required to build this program])]) | ||||
| # | ||||
| # Update environment variables for pthreads | ||||
| # | ||||
| CC="$PTHREAD_CC" | ||||
| CFLAGS="$PTHREAD_CFLAGS $CFLAGS" | ||||
| LIBS="$PTHREAD_LIBS $LIBS" | ||||
| # | ||||
| # Determine if pthread_rwlock_t is available | ||||
| # | ||||
| echo "----------------------- pthread_rwlock_t stuff --------------------------------" | ||||
| AC_MSG_CHECKING([if pthread_rwlock_t is available]) | ||||
| AC_LANG([C]) | ||||
| AC_COMPILE_IFELSE( | ||||
| 	[AC_LANG_PROGRAM( | ||||
| 		[#include <pthread.h>], | ||||
| 		[pthread_rwlock_t *x;])], | ||||
| 	[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t]) | ||||
| 		AC_MSG_RESULT([yes, supported without any options])], | ||||
| 	[AC_COMPILE_IFELSE( | ||||
| 		[AC_LANG_PROGRAM( | ||||
| 			[#define _GNU_SOURCE | ||||
| 			#include <pthread.h>], | ||||
| 			[pthread_rwlock_t *x;])], | ||||
| 		[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t]) | ||||
| 			CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" | ||||
| 			AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])], | ||||
| 		[AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t]) | ||||
| 			AC_MSG_RESULT([no, needs to fallback to pthread_mutex]) | ||||
| 			AC_MSG_ERROR([pthread_rwlock_t not available])])]) | ||||
| echo "-------------------------------------------------------------------------------" | ||||
|  | ||||
|  | ||||
| AC_CONFIG_FILES([ | ||||
| 	Makefile | ||||
| 	ixml/Makefile | ||||
| 	ixml/doc/Makefile | ||||
| 	threadutil/Makefile | ||||
| 	upnp/Makefile | ||||
| 	upnp/doc/Makefile | ||||
| 	upnp/sample/Makefile | ||||
| 	docs/dist/Makefile | ||||
| 	libupnp.pc | ||||
| 	]) | ||||
|  | ||||
|  | ||||
| AC_CONFIG_FILES([Makefile | ||||
| 		 ixml/Makefile | ||||
| 		 ixml/doc/Makefile | ||||
|                  threadutil/Makefile | ||||
| 		 upnp/Makefile | ||||
| 		 upnp/doc/Makefile | ||||
| 		 docs/dist/Makefile | ||||
| 		 libupnp.pc | ||||
|                  ]) | ||||
|  | ||||
| AC_OUTPUT | ||||
|  | ||||
|   | ||||
							
								
								
									
										4
									
								
								docs/dist/Makefile.am
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								docs/dist/Makefile.am
									
									
									
									
										vendored
									
									
								
							| @@ -39,7 +39,7 @@ EXTRA_DIST = \ | ||||
|     ./html/upnp/UPNP_E_SOCKET_ERROR-208.html \ | ||||
|     ./html/upnp/UPNP_E_CANCELED-210.html \ | ||||
|     ./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \ | ||||
|     ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \ | ||||
|     ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \ | ||||
|     ./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \ | ||||
|     ./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \ | ||||
|     ./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \ | ||||
| @@ -295,7 +295,7 @@ if WITH_DOCUMENTATION | ||||
|         ./html/upnp/UPNP_E_SOCKET_ERROR-208.html \ | ||||
|         ./html/upnp/UPNP_E_CANCELED-210.html \ | ||||
|         ./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \ | ||||
|         ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \ | ||||
|         ./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \ | ||||
|         ./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \ | ||||
|         ./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \ | ||||
|         ./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \ | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
| # | ||||
| # "Makefile.am" for "libupnp/ixml" | ||||
| # | ||||
| # (C) Copyright 2005 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
| # (C) Copyright 2005 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
| # | ||||
|  | ||||
| SUBDIRS 		= doc | ||||
| @@ -24,15 +24,23 @@ libixml_la_LDFLAGS	= -version-info $(LT_VERSION_IXML) \ | ||||
| 			  -export-symbols-regex '^ixml.*' | ||||
|  | ||||
| libixml_la_SOURCES	= \ | ||||
| 			src/ixml.c src/node.c src/ixmlparser.c \ | ||||
| 			src/ixmlmembuf.c src/nodeList.c \ | ||||
| 			src/element.c src/attr.c src/document.c \ | ||||
| 			src/attr.c \ | ||||
| 			src/document.c \ | ||||
| 			src/element.c \ | ||||
| 			src/inc/ixmlmembuf.h \ | ||||
| 			src/inc/ixmlparser.h \ | ||||
| 			src/ixml.c \ | ||||
| 			src/ixmldebug.c \ | ||||
| 			src/ixmlparser.c \ | ||||
| 			src/ixmlmembuf.c \ | ||||
| 			src/namedNodeMap.c \ | ||||
| 			src/inc/ixmlmembuf.h src/inc/ixmlparser.h | ||||
| 			src/node.c \ | ||||
| 			src/nodeList.c | ||||
|  | ||||
| upnpincludedir		= $(includedir)/upnp | ||||
| upnpinclude_HEADERS	= inc/ixml.h  | ||||
|  | ||||
| upnpinclude_HEADERS	= \ | ||||
| 			inc/ixml.h \ | ||||
| 			inc/ixmldebug.h | ||||
|  | ||||
| check_PROGRAMS          = test_document | ||||
| TESTS                   = test/test_document.sh | ||||
| @@ -47,4 +55,3 @@ dist-hook: | ||||
| clean-local: | ||||
| 	@if [ -d bin ] ; then  rm -rf bin ; fi | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										3283
									
								
								ixml/inc/ixml.h
									
									
									
									
									
								
							
							
						
						
									
										3283
									
								
								ixml/inc/ixml.h
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										41
									
								
								ixml/inc/ixmldebug.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								ixml/inc/ixmldebug.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
|  | ||||
|  | ||||
| #ifndef IXMLDEBUG_H | ||||
| #define IXMLDEBUG_H | ||||
|  | ||||
|  | ||||
| #include "UpnpGlobal.h" | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * \brief Auxiliar routines to aid debugging. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Prints the debug statement either on the standard output or log file | ||||
|  * along with the information from where this debug statement is coming. | ||||
|  */  | ||||
| #ifdef DEBUG | ||||
| void IxmlPrintf( | ||||
| 	/*! [in] Printf like format specification. */ | ||||
| 	const char* FmtStr, | ||||
| 	/*! [in] Printf like Variable number of arguments that will go in the debug | ||||
| 	 * statement. */ | ||||
| 	...) | ||||
| #if (__GNUC__ >= 3) | ||||
| 	/* This enables printf like format checking by the compiler */ | ||||
| 	__attribute__((format (__printf__, 1, 2))) | ||||
| #endif | ||||
| ; | ||||
| #else /* DEBUG */ | ||||
| static UPNP_INLINE void IxmlPrintf( | ||||
| 	const char* FmtStr, | ||||
| 	...) {} | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|  | ||||
| #endif /* IXMLDEBUG_H */ | ||||
|  | ||||
| @@ -1,60 +1,53 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "ixmlparser.h" | ||||
|  | ||||
| /*================================================================ | ||||
| *   Function: Attr_init | ||||
| *       Initializes an attribute node | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlAttr_init( IN IXML_Attr * attr ) | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| void ixmlAttr_init(IN IXML_Attr *attr) | ||||
| { | ||||
|     if( attr != NULL ) { | ||||
|         memset( attr, 0, sizeof( IXML_Attr ) ); | ||||
|     } | ||||
| 	if (attr != NULL) { | ||||
| 		memset(attr, 0, sizeof (IXML_Attr)); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   Function: Attr_free | ||||
| *       Frees an attribute node. | ||||
| *       external function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlAttr_free( IN IXML_Attr * attr ) | ||||
|  | ||||
| void ixmlAttr_free(IN IXML_Attr *attr) | ||||
| { | ||||
|     if( attr != NULL ) { | ||||
|         ixmlNode_free( ( IXML_Node * ) attr ); | ||||
|     } | ||||
| 	if (attr != NULL) { | ||||
| 		ixmlNode_free((IXML_Node *)attr); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										1136
									
								
								ixml/src/document.c
									
									
									
									
									
								
							
							
						
						
									
										1136
									
								
								ixml/src/document.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1434
									
								
								ixml/src/element.c
									
									
									
									
									
								
							
							
						
						
									
										1434
									
								
								ixml/src/element.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,77 +1,173 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef IXML_MEMBUF_H | ||||
| #define IXML_MEMBUF_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
| #ifndef _IXML_MEMBUF_H | ||||
| #define _IXML_MEMBUF_H | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include "ixml.h" | ||||
|  | ||||
| #define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) ) | ||||
| #define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) ) | ||||
|  | ||||
| #ifndef WIN32 | ||||
|  #define	XINLINE inline | ||||
| #endif | ||||
|  | ||||
| #define MEMBUF_DEF_SIZE_INC		20 | ||||
| #include <stdlib.h> /* for size_t */ | ||||
|  | ||||
|  | ||||
| typedef struct // ixml_membuf  | ||||
| #define MINVAL(a, b) ( (a) < (b) ? (a) : (b) ) | ||||
| #define MAXVAL(a, b) ( (a) > (b) ? (a) : (b) ) | ||||
|  | ||||
|  | ||||
| #define MEMBUF_DEF_SIZE_INC 20 | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief The ixml_membuf type. | ||||
|  */ | ||||
| typedef struct | ||||
| { | ||||
| 	char	*buf; | ||||
| 				 | ||||
| 	size_t	length; | ||||
| 	size_t	capacity; | ||||
| 	size_t	size_inc; | ||||
|  | ||||
| 	char *buf;	 | ||||
| 	size_t length; | ||||
| 	size_t capacity; | ||||
| 	size_t size_inc; | ||||
| } ixml_membuf; | ||||
|  | ||||
| //-------------------------------------------------- | ||||
| //////////////// functions ///////////////////////// | ||||
| //-------------------------------------------------- | ||||
| /* | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif // __cplusplus | ||||
| */ | ||||
|  | ||||
| void ixml_membuf_init(INOUT ixml_membuf *m); | ||||
| void ixml_membuf_destroy(INOUT ixml_membuf *m); | ||||
| int ixml_membuf_assign(INOUT ixml_membuf *m, IN const void *buf,  | ||||
| 					 IN size_t buf_len ); | ||||
| int ixml_membuf_assign_str(INOUT ixml_membuf *m, IN const char *c_str ); | ||||
| int ixml_membuf_append(INOUT ixml_membuf *m, IN const void *buf); | ||||
| int ixml_membuf_append_str(INOUT ixml_membuf *m, IN const char *c_str); | ||||
| int ixml_membuf_insert(INOUT ixml_membuf *m, IN const void* buf,  | ||||
| 					 IN size_t buf_len, int index ); | ||||
| /*! | ||||
|  * \brief ixml_membuf initialization routine. | ||||
|  */ | ||||
| void ixml_membuf_init( | ||||
| 	/*! [in,out] The memory buffer to initializa. */ | ||||
| 	ixml_membuf *m); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief ixml_membuf clearing routine. | ||||
|  * | ||||
|  * The internal buffer is deleted and ixml_membuf_init() is called in the end | ||||
|  * to reinitialize the buffer. | ||||
|  */ | ||||
| void ixml_membuf_destroy( | ||||
| 	/*! [in,out] The memory buffer to clear. */ | ||||
| 	ixml_membuf *m); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Copies the contents o a buffer to the designated ixml_membuf. | ||||
|  * | ||||
|  * The previous contents of the ixml_membuf are destroyed. | ||||
|  * | ||||
|  * \return IXML_SUCCESS if successfull, or the error code returned | ||||
|  * by ixml_membuf_set_size(). | ||||
|  * | ||||
|  * \sa ixml_membuf_assign_str(). | ||||
|  */ | ||||
| int ixml_membuf_assign( | ||||
| 	/*! [in,out] The memory buffer on which to operate. */ | ||||
| 	ixml_membuf *m, | ||||
| 	/*! [in] The input buffer to copy from. */ | ||||
| 	const void *buf,  | ||||
| 	/*! [in] The number of bytes to copy from the input buffer. */ | ||||
| 	size_t buf_len); | ||||
|  | ||||
| /*! | ||||
|  * \brief Copies a \b NULL terminated string to the ixml_buffer. | ||||
|  * | ||||
|  * This is a convenience function that internally uses ixml_membuf_assign(). | ||||
|  * | ||||
|  * \return The return value of ixml_membuf_assign(). | ||||
|  * | ||||
|  * \sa ixml_membuf_assign(). | ||||
|  */ | ||||
| int ixml_membuf_assign_str( | ||||
| 	/*! [in,out] The memory buffer on which to operate. */ | ||||
| 	ixml_membuf *m, | ||||
| 	/*! [in] The input string to copy from. */ | ||||
| 	const char *c_str); | ||||
|  | ||||
| /*! | ||||
|  * \brief Appends one byte to the designated ixml_membuffer. | ||||
|  * | ||||
|  * This is a convenience function that internally uses ixml_membuf_insert(). | ||||
|  * | ||||
|  * \return The return value of ixml_membuf_insert(). | ||||
|  * | ||||
|  * \sa ixml_membuf_insert() | ||||
|  */ | ||||
| int ixml_membuf_append( | ||||
| 	/*! [in,out] The memory buffer on which to operate. */ | ||||
| 	ixml_membuf *m, | ||||
| 	/*! [in] The pointer to the byte to append. */ | ||||
| 	const void *buf); | ||||
|  | ||||
| /*! | ||||
|  * \brief Appends the contents of a \b NULL terminated string to the designated | ||||
|  * ixml_membuf. | ||||
|  * | ||||
|  * This is a convenience function that internally uses ixml_membuf_insert(). | ||||
|  * | ||||
|  * \return The return value of ixml_membuf_insert(). | ||||
|  * | ||||
|  * \sa ixml_membuf_insert(). | ||||
|  */ | ||||
| int ixml_membuf_append_str( | ||||
| 	/*! [in,out] The memory buffer on which to operate. */ | ||||
| 	ixml_membuf *m, | ||||
| 	/*! [in] The input string to copy from. */ | ||||
| 	const char *c_str); | ||||
|  | ||||
| /*! | ||||
|  * \brief  | ||||
|  * | ||||
|  * \return | ||||
|  * 	\li 0 if successfull. | ||||
|  * 	\li IXML_INDEX_SIZE_ERR if the index parameter is out of range. | ||||
|  * 	\li Or the return code of ixml_membuf_set_size() | ||||
|  * | ||||
|  * \sa ixml_membuf_set_size() | ||||
|  */ | ||||
| int ixml_membuf_insert( | ||||
| 	/*! [in,out] The memory buffer on which to operate. */ | ||||
| 	ixml_membuf *m, | ||||
| 	/*! [in] The pointer to the input buffer. */ | ||||
| 	const void *buf,  | ||||
| 	/*! [in] The buffer length. */ | ||||
| 	size_t buf_len, | ||||
| 	/*! [in] The point of insertion relative to the beggining of the | ||||
| 	 * ixml_membuf internal buffer. */ | ||||
| 	int index); | ||||
|  | ||||
|  | ||||
| #endif /* IXML_MEMBUF_H */ | ||||
|  | ||||
| #endif // _IXML_MEMBUF_H | ||||
|   | ||||
| @@ -1,41 +1,49 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|   | ||||
| #ifndef _IXMLPARSER_H | ||||
| #define _IXMLPARSER_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. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef IXMLPARSER_H | ||||
| #define IXMLPARSER_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ixml.h" | ||||
| #include "ixmlmembuf.h" | ||||
|  | ||||
| // Parser definitions | ||||
|  | ||||
| /* Parser definitions */ | ||||
| #define QUOT        """ | ||||
| #define LT          "<" | ||||
| #define GT          ">" | ||||
| @@ -44,77 +52,218 @@ | ||||
| #define ESC_HEX     "&#x" | ||||
| #define ESC_DEC     "&#" | ||||
|  | ||||
|  | ||||
| typedef struct _IXML_NamespaceURI  | ||||
| { | ||||
|     char                        *nsURI; | ||||
|     char                        *prefix; | ||||
|     struct _IXML_NamespaceURI   *nextNsURI; | ||||
| 	char *nsURI; | ||||
| 	char *prefix; | ||||
| 	struct _IXML_NamespaceURI *nextNsURI; | ||||
| } IXML_NamespaceURI; | ||||
|  | ||||
|  | ||||
| typedef struct _IXML_ElementStack | ||||
| { | ||||
|     char                    *element; | ||||
|     char                    *prefix; | ||||
|     char                    *namespaceUri; | ||||
|     IXML_NamespaceURI            *pNsURI; | ||||
|     struct _IXML_ElementStack    *nextElement; | ||||
| 	char *element; | ||||
| 	char *prefix; | ||||
| 	char *namespaceUri; | ||||
| 	IXML_NamespaceURI *pNsURI; | ||||
| 	struct _IXML_ElementStack *nextElement; | ||||
| } IXML_ElementStack; | ||||
|  | ||||
|  | ||||
| typedef enum | ||||
| { | ||||
|     eELEMENT, | ||||
|     eATTRIBUTE, | ||||
|     eCONTENT, | ||||
| 	eELEMENT, | ||||
| 	eATTRIBUTE, | ||||
| 	eCONTENT, | ||||
| } PARSER_STATE; | ||||
|  | ||||
|  | ||||
| typedef struct _Parser | ||||
| { | ||||
|     char            *dataBuffer;	//data buffer | ||||
|     char            *curPtr;		//ptr to the token parsed  | ||||
|     char            *savePtr;		//Saves for backup | ||||
|     ixml_membuf     lastElem; | ||||
|     ixml_membuf     tokenBuf;     | ||||
|  | ||||
|     IXML_Node           *pNeedPrefixNode; | ||||
|     IXML_ElementStack   *pCurElement; | ||||
|     IXML_Node           *currentNodePtr; | ||||
|     PARSER_STATE        state; | ||||
|  | ||||
|     BOOL                bHasTopLevel; | ||||
|  | ||||
| 	/*! Data buffer. */ | ||||
| 	char *dataBuffer; | ||||
| 	/*! Pointer to the token parsed. */ | ||||
| 	char *curPtr; | ||||
| 	/*! Saves for backup. */ | ||||
| 	char *savePtr; | ||||
| 	ixml_membuf lastElem; | ||||
| 	ixml_membuf tokenBuf;     | ||||
| 	IXML_Node *pNeedPrefixNode; | ||||
| 	IXML_ElementStack *pCurElement; | ||||
| 	IXML_Node *currentNodePtr; | ||||
| 	PARSER_STATE state; | ||||
| 	BOOL bHasTopLevel; | ||||
| } Parser; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Check to see whether name is a valid xml name. | ||||
|  */ | ||||
| BOOL Parser_isValidXmlName( | ||||
| 	/*! [in] The string to be checked. */ | ||||
| 	const DOMString name); | ||||
|  | ||||
| int     Parser_LoadDocument( IXML_Document **retDoc, const char * xmlFile, BOOL file); | ||||
| BOOL    Parser_isValidXmlName( const DOMString name); | ||||
| int     Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr); | ||||
| void    Parser_freeNodeContent( IXML_Node *IXML_Nodeptr); | ||||
|  | ||||
| void    Parser_setErrorChar( char c ); | ||||
| /*! | ||||
|  * \brief Sets the error character. | ||||
|  * | ||||
|  * If 'c' is 0 (default), the parser is strict about XML encoding: | ||||
|  * invalid UTF-8 sequences or "&" entities are rejected, and the parsing  | ||||
|  * aborts. | ||||
|  * | ||||
|  * If 'c' is not 0, the parser is relaxed: invalid UTF-8 characters | ||||
|  * are replaced by this character, and invalid "&" entities are left | ||||
|  * untranslated. The parsing is then allowed to continue. | ||||
|  */ | ||||
| void Parser_setErrorChar( | ||||
| 	/*! [in] The character to become the error character. */ | ||||
| 	char c); | ||||
|  | ||||
| void    ixmlAttr_free(IXML_Attr *attrNode); | ||||
| void    ixmlAttr_init(IXML_Attr *attrNode); | ||||
|  | ||||
| int     ixmlElement_setTagName(IXML_Element *element, const char *tagName); | ||||
| /*! | ||||
|  * \brief Fees a node contents. | ||||
|  */ | ||||
| void Parser_freeNodeContent( | ||||
| 	/*! [in] The Node to process. */ | ||||
| 	IXML_Node *IXML_Nodeptr); | ||||
|  | ||||
| void    ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap); | ||||
| int     ixmlNamedNodeMap_addToNamedNodeMap(IXML_NamedNodeMap **nnMap, IXML_Node *add); | ||||
| int Parser_LoadDocument(IXML_Document **retDoc, const char * xmlFile, BOOL file); | ||||
|  | ||||
| void    ixmlNode_init(IXML_Node *IXML_Nodeptr); | ||||
| BOOL    ixmlNode_compare(IXML_Node *srcIXML_Node, IXML_Node *destIXML_Node); | ||||
| int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr); | ||||
|  | ||||
| void    ixmlNode_getElementsByTagName( IXML_Node *n, const char *tagname, IXML_NodeList **list); | ||||
| void    ixmlNode_getElementsByTagNameNS( IXML_Node *IXML_Node, const char *namespaceURI, | ||||
|                 const char *localName, IXML_NodeList **list); | ||||
|  | ||||
| int     ixmlNode_setNodeProperties(IXML_Node* node, IXML_Node *src); | ||||
| int     ixmlNode_setNodeName( IXML_Node* node, const DOMString qualifiedName); | ||||
| void ixmlAttr_init(IXML_Attr *attrNode); | ||||
|  | ||||
| void    ixmlNodeList_init(IXML_NodeList *nList); | ||||
| int     ixmlNodeList_addToNodeList(IXML_NodeList **nList, IXML_Node *add); | ||||
| /*! | ||||
|  * \brief Set the given element's tagName. | ||||
|  * | ||||
|  * \return One of the following: | ||||
|  * 	\li \b IXML_SUCCESS, if successfull. | ||||
|  * 	\li \b IXML_FAILED, if element of tagname is \b NULL. | ||||
|  * 	\li \b IXML_INSUFFICIENT_MEMORY, if there is no memory to allocate the | ||||
|  * 		buffer for the element's tagname. | ||||
|  */ | ||||
| int ixmlElement_setTagName( | ||||
| 	/*! [in] The element to change the tagname. */ | ||||
| 	IXML_Element *element, | ||||
| 	/*! [in] The new tagName for the element. */ | ||||
| 	const char *tagName); | ||||
|  | ||||
| #endif  // _IXMLPARSER_H | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes a NamedNodeMap object. | ||||
|  */ | ||||
| void ixmlNamedNodeMap_init( | ||||
| 	/*! [in] The named node map to process. */ | ||||
| 	IXML_NamedNodeMap *nnMap); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Add a node to a NamedNodeMap. | ||||
|  * | ||||
|  * \return IXML_SUCCESS or failure. | ||||
|  */ | ||||
| int ixmlNamedNodeMap_addToNamedNodeMap( | ||||
| 	/* [in] The named node map. */ | ||||
| 	IXML_NamedNodeMap **nnMap, | ||||
| 	/* [in] The node to add. */ | ||||
| 	IXML_Node *add); | ||||
|  | ||||
| /*! | ||||
|  * \brief Add a node to nodelist. | ||||
|  */ | ||||
| int ixmlNodeList_addToNodeList( | ||||
| 	/*! [in] The pointer to the nodelist. */ | ||||
| 	IXML_NodeList **nList, | ||||
| 	/*! [in] The node to add. */ | ||||
| 	IXML_Node *add); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Intializes a node. | ||||
|  */ | ||||
| void ixmlNode_init( | ||||
| 	/*! [in] The \b Node to iniatialize. */ | ||||
| 	IN IXML_Node *nodeptr); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Compare two nodes to see whether they are the same node. | ||||
|  * Parent, sibling and children node are ignored. | ||||
|  * | ||||
|  * \return | ||||
|  * 	\li TRUE, the two nodes are the same. | ||||
|  * 	\li FALSE, the two nodes are not the same. | ||||
|  */ | ||||
| BOOL ixmlNode_compare( | ||||
| 	/*! [in] The first \b Node. */ | ||||
| 	IXML_Node *srcNode, | ||||
| 	/*! [in] The second \b Node. */ | ||||
|  	IXML_Node *destNode); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns a nodeList of all descendant Elements with a given tagName, | ||||
|  * in the order in which they are encountered in a traversal of this element | ||||
|  * tree. | ||||
|  */ | ||||
| void ixmlNode_getElementsByTagName( | ||||
| 	/*! [in] The \b Node tree. */ | ||||
| 	IXML_Node *n, | ||||
| 	/*! [in] The tag name to match. */ | ||||
| 	const char *tagname, | ||||
| 	/*! [out] The output \b NodeList. */ | ||||
| 	IXML_NodeList **list); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns a nodeList of all the descendant Elements with a given local | ||||
|  * name and namespace URI in the order in which they are encountered in a | ||||
|  * preorder traversal of this Elememt tree.		 | ||||
|  */ | ||||
| void ixmlNode_getElementsByTagNameNS( | ||||
| 	/*! [in] The \b Element tree. */ | ||||
| 	IXML_Node *n, | ||||
| 	/*! [in] The name space to match. */ | ||||
| 	const char *namespaceURI, | ||||
| 	/*! [in] The local name to match. */ | ||||
| 	const char *localName, | ||||
| 	/*! [out] The output \b NodeList. */ | ||||
| 	IXML_NodeList **list); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief  | ||||
|  * | ||||
|  * \return  | ||||
|  */ | ||||
| int ixmlNode_setNodeName( | ||||
| 	/*! [in] The \b Node. */ | ||||
| 	IXML_Node *node, | ||||
| 	/*! [in] . */ | ||||
| 	const DOMString qualifiedName); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief  | ||||
|  * | ||||
|  * \return  | ||||
|  */ | ||||
| int ixmlNode_setNodeProperties( | ||||
| 	/*! [in] . */ | ||||
| 	IXML_Node *destNode, | ||||
| 	/*! [in] . */ | ||||
| 	IXML_Node *src); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Initializes a nodelist  | ||||
|  */ | ||||
| void ixmlNodeList_init( | ||||
| 	/*! [in,out] The \b NodeList to initialize. */ | ||||
| 	IXML_NodeList *nList); | ||||
|  | ||||
|  | ||||
| #endif  /* IXMLPARSER_H */ | ||||
|  | ||||
|   | ||||
							
								
								
									
										956
									
								
								ixml/src/ixml.c
									
									
									
									
									
								
							
							
						
						
									
										956
									
								
								ixml/src/ixml.c
									
									
									
									
									
								
							| @@ -1,531 +1,469 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ixmldebug.h" | ||||
| #include "ixmlmembuf.h" | ||||
| #include "ixmlparser.h" | ||||
|  | ||||
| /*================================================================ | ||||
| *   copy_with_escape | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| static void | ||||
| copy_with_escape( INOUT ixml_membuf * buf, | ||||
|                   IN const char *p ) | ||||
|  | ||||
| #include <stdlib.h> /* for free() */ | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Appends a string to a buffer, substituting some characters by escape | ||||
|  * sequences. | ||||
|  */ | ||||
| static void copy_with_escape( | ||||
| 	/*! [in,out] The input/output buffer. */ | ||||
| 	ixml_membuf *buf, | ||||
| 	/*! [in] The string to copy from. */ | ||||
| 	const char *p) | ||||
| { | ||||
|     int i; | ||||
|     int plen; | ||||
|  | ||||
|     if( p == NULL ) | ||||
|         return; | ||||
|  | ||||
|     plen = strlen( p ); | ||||
|  | ||||
|     for( i = 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] ); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *	ixmlPrintDomTreeRecursive | ||||
| *       It is a recursive function to print all the node in a tree. | ||||
| *       Internal to parser only. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr, | ||||
|                            IN ixml_membuf * buf ) | ||||
| { | ||||
|     const char *nodeName = NULL; | ||||
|     const char *nodeValue = NULL; | ||||
|     IXML_Node *child = NULL, | ||||
|      *sibling = NULL; | ||||
|  | ||||
|     if( nodeptr != NULL ) { | ||||
|         nodeName = ( const char * )ixmlNode_getNodeName( nodeptr ); | ||||
|         nodeValue = ixmlNode_getNodeValue( nodeptr ); | ||||
|  | ||||
|         switch ( ixmlNode_getNodeType( nodeptr ) ) { | ||||
|  | ||||
|             case eTEXT_NODE: | ||||
|                 copy_with_escape( buf, nodeValue ); | ||||
|                 break; | ||||
|  | ||||
|             case eCDATA_SECTION_NODE: | ||||
|                 ixml_membuf_append_str( buf, "<![CDATA[" ); | ||||
|                 ixml_membuf_append_str( buf, nodeValue ); | ||||
|                 ixml_membuf_append_str( buf, "]]>" ); | ||||
|                 break; | ||||
|  | ||||
|             case ePROCESSING_INSTRUCTION_NODE: | ||||
|                 ixml_membuf_append_str( buf, "<?" ); | ||||
|                 ixml_membuf_append_str( buf, nodeName ); | ||||
|                 ixml_membuf_append_str( buf, " " ); | ||||
|                 copy_with_escape( buf, nodeValue ); | ||||
|                 ixml_membuf_append_str( buf, "?>\n" ); | ||||
|                 break; | ||||
|  | ||||
|             case eDOCUMENT_NODE: | ||||
|                 ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild | ||||
|                                            ( nodeptr ), buf ); | ||||
|                 break; | ||||
|  | ||||
|             case eATTRIBUTE_NODE: | ||||
|                 ixml_membuf_append_str( buf, nodeName ); | ||||
|                 ixml_membuf_append_str( buf, "=\"" ); | ||||
|                 copy_with_escape( buf, nodeValue ); | ||||
|                 ixml_membuf_append_str( buf, "\"" ); | ||||
|  | ||||
|                 if( nodeptr->nextSibling != NULL ) { | ||||
|                     ixml_membuf_append_str( buf, " " ); | ||||
|                     ixmlPrintDomTreeRecursive( nodeptr->nextSibling, buf ); | ||||
|                 } | ||||
|                 break; | ||||
|  | ||||
|             case eELEMENT_NODE: | ||||
|                 ixml_membuf_append_str( buf, "<" ); | ||||
|                 ixml_membuf_append_str( buf, nodeName ); | ||||
|  | ||||
|                 if( nodeptr->firstAttr != NULL ) { | ||||
|                     ixml_membuf_append_str( buf, " " ); | ||||
|                     ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf ); | ||||
|                 } | ||||
|  | ||||
|                 child = ixmlNode_getFirstChild( nodeptr ); | ||||
|                 if( ( child != NULL ) | ||||
|                     && ( ixmlNode_getNodeType( child ) == | ||||
|                          eELEMENT_NODE ) ) { | ||||
|                     ixml_membuf_append_str( buf, ">\r\n" ); | ||||
|                 } else { | ||||
|                     ixml_membuf_append_str( buf, ">" ); | ||||
|                 } | ||||
|  | ||||
|                 //  output the children | ||||
|                 ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild | ||||
|                                            ( nodeptr ), buf ); | ||||
|  | ||||
|                 // Done with children.  Output the end tag. | ||||
|                 ixml_membuf_append_str( buf, "</" ); | ||||
|                 ixml_membuf_append_str( buf, nodeName ); | ||||
|  | ||||
|                 sibling = ixmlNode_getNextSibling( nodeptr ); | ||||
|                 if( sibling != NULL | ||||
|                     && ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) { | ||||
|                     ixml_membuf_append_str( buf, ">" ); | ||||
|                 } else { | ||||
|                     ixml_membuf_append_str( buf, ">\r\n" ); | ||||
|                 } | ||||
|                 ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling | ||||
|                                            ( nodeptr ), buf ); | ||||
|                 break; | ||||
|  | ||||
|             default: | ||||
|                 break; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlPrintDomTree | ||||
| *       Print a DOM tree. | ||||
| *       Element, and Attribute nodes are handled differently. | ||||
| *       We don't want to print the Element and Attribute nodes' sibling. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlPrintDomTree( IN IXML_Node * nodeptr, | ||||
|                   IN ixml_membuf * buf ) | ||||
| { | ||||
|     const char *nodeName = NULL; | ||||
|     const char *nodeValue = NULL; | ||||
|     IXML_Node *child = NULL; | ||||
|  | ||||
|     if( ( nodeptr == NULL ) || ( buf == NULL ) ) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     nodeName = ( const char * )ixmlNode_getNodeName( nodeptr ); | ||||
|     nodeValue = ixmlNode_getNodeValue( nodeptr ); | ||||
|  | ||||
|     switch ( ixmlNode_getNodeType( nodeptr ) ) { | ||||
|  | ||||
|         case eTEXT_NODE: | ||||
|         case eCDATA_SECTION_NODE: | ||||
|         case ePROCESSING_INSTRUCTION_NODE: | ||||
|         case eDOCUMENT_NODE: | ||||
|             ixmlPrintDomTreeRecursive( nodeptr, buf ); | ||||
|             break; | ||||
|  | ||||
|         case eATTRIBUTE_NODE: | ||||
|             ixml_membuf_append_str( buf, nodeName ); | ||||
|             ixml_membuf_append_str( buf, "=\"" ); | ||||
|             copy_with_escape( buf, nodeValue ); | ||||
|             ixml_membuf_append_str( buf, "\"" ); | ||||
|             break; | ||||
|  | ||||
|         case eELEMENT_NODE: | ||||
|             ixml_membuf_append_str( buf, "<" ); | ||||
|             ixml_membuf_append_str( buf, nodeName ); | ||||
|  | ||||
|             if( nodeptr->firstAttr != NULL ) { | ||||
|                 ixml_membuf_append_str( buf, " " ); | ||||
|                 ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf ); | ||||
|             } | ||||
|  | ||||
|             child = ixmlNode_getFirstChild( nodeptr ); | ||||
|             if( ( child != NULL ) | ||||
|                 && ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) { | ||||
|                 ixml_membuf_append_str( buf, ">\r\n" ); | ||||
|             } else { | ||||
|                 ixml_membuf_append_str( buf, ">" ); | ||||
|             } | ||||
|  | ||||
|             //  output the children | ||||
|             ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ), | ||||
|                                        buf ); | ||||
|  | ||||
|             // 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" ); | ||||
|             break; | ||||
|  | ||||
|         default: | ||||
|             break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlDomTreetoString | ||||
| *       Converts a DOM tree into a text string | ||||
| *       Element, and Attribute nodes are handled differently. | ||||
| *       We don't want to print the Element and Attribute nodes' sibling. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlDomTreetoString( IN IXML_Node * nodeptr, | ||||
|                      IN ixml_membuf * buf ) | ||||
| { | ||||
|     const char *nodeName = NULL; | ||||
|     const char *nodeValue = NULL; | ||||
|     IXML_Node *child = NULL; | ||||
|  | ||||
|     if( ( nodeptr == NULL ) || ( buf == NULL ) ) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     nodeName = ( const char * )ixmlNode_getNodeName( nodeptr ); | ||||
|     nodeValue = ixmlNode_getNodeValue( nodeptr ); | ||||
|  | ||||
|     switch ( ixmlNode_getNodeType( nodeptr ) ) { | ||||
|  | ||||
|         case eTEXT_NODE: | ||||
|         case eCDATA_SECTION_NODE: | ||||
|         case ePROCESSING_INSTRUCTION_NODE: | ||||
|         case eDOCUMENT_NODE: | ||||
|             ixmlPrintDomTreeRecursive( nodeptr, buf ); | ||||
|             break; | ||||
|  | ||||
|         case eATTRIBUTE_NODE: | ||||
|             ixml_membuf_append_str( buf, nodeName ); | ||||
|             ixml_membuf_append_str( buf, "=\"" ); | ||||
|             copy_with_escape( buf, nodeValue ); | ||||
|             ixml_membuf_append_str( buf, "\"" ); | ||||
|             break; | ||||
|  | ||||
|         case eELEMENT_NODE: | ||||
|             ixml_membuf_append_str( buf, "<" ); | ||||
|             ixml_membuf_append_str( buf, nodeName ); | ||||
|  | ||||
|             if( nodeptr->firstAttr != NULL ) { | ||||
|                 ixml_membuf_append_str( buf, " " ); | ||||
|                 ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf ); | ||||
|             } | ||||
|  | ||||
|             child = ixmlNode_getFirstChild( nodeptr ); | ||||
|             if( ( child != NULL ) | ||||
|                 && ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) { | ||||
|                 ixml_membuf_append_str( buf, ">" ); | ||||
|             } else { | ||||
|                 ixml_membuf_append_str( buf, ">" ); | ||||
|             } | ||||
|  | ||||
|             //  output the children | ||||
|             ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ), | ||||
|                                        buf ); | ||||
|  | ||||
|             // Done with children.  Output the end tag. | ||||
|             ixml_membuf_append_str( buf, "</" ); | ||||
|             ixml_membuf_append_str( buf, nodeName ); | ||||
|             ixml_membuf_append_str( buf, ">" ); | ||||
|             break; | ||||
|  | ||||
|         default: | ||||
|             break; | ||||
|     } | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlLoadDocumentEx | ||||
| *       Parses the given file, and returns the DOM tree from it. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixmlLoadDocumentEx( IN const char *xmlFile, | ||||
|                     IXML_Document ** doc ) | ||||
| { | ||||
|  | ||||
|     if( ( xmlFile == NULL ) || ( doc == NULL ) ) { | ||||
|         return IXML_INVALID_PARAMETER; | ||||
|     } | ||||
|  | ||||
|     return Parser_LoadDocument( doc, xmlFile, TRUE ); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlLoadDocument | ||||
| *       Parses the given file, and returns the DOM tree from it. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| IXML_Document * | ||||
| ixmlLoadDocument( IN const char *xmlFile ) | ||||
| { | ||||
|  | ||||
|     IXML_Document *doc = NULL; | ||||
|  | ||||
|     ixmlLoadDocumentEx( xmlFile, &doc ); | ||||
|     return doc; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlPrintDocument | ||||
| *       Prints entire document, prepending XML prolog first. | ||||
| *       Puts lots of white spaces. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
|  | ||||
| DOMString | ||||
| ixmlPrintDocument(IXML_Document *doc) | ||||
| { | ||||
|     IXML_Node* rootNode = ( IXML_Node * )doc; | ||||
|     ixml_membuf memBuf; | ||||
|     ixml_membuf *buf = &memBuf; | ||||
|  | ||||
|     if( rootNode == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|     ixml_membuf_init( buf ); | ||||
|     ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" ); | ||||
|     ixmlPrintDomTree( rootNode, buf ); | ||||
|     return buf->buf; | ||||
|  | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlPrintNode | ||||
| *       Print DOM tree under node. Puts lots of white spaces | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| DOMString | ||||
| ixmlPrintNode( IN IXML_Node * node ) | ||||
| { | ||||
|  | ||||
|     ixml_membuf memBuf; | ||||
|     ixml_membuf *buf = &memBuf; | ||||
|  | ||||
|     if( node == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|     ixml_membuf_init( buf ); | ||||
|     ixmlPrintDomTree( node, buf ); | ||||
|     return buf->buf; | ||||
|  | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlDocumenttoString | ||||
| *       converts DOM tree under node to text string, | ||||
| *       prepending XML prolog first. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
|  | ||||
| DOMString | ||||
| ixmlDocumenttoString(IXML_Document *doc) | ||||
| { | ||||
|     IXML_Node* rootNode = ( IXML_Node * )doc; | ||||
|     ixml_membuf memBuf; | ||||
|     ixml_membuf *buf = &memBuf; | ||||
|  | ||||
|     if( rootNode == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|     ixml_membuf_init( buf ); | ||||
|     ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" ); | ||||
|     ixmlDomTreetoString( rootNode, buf ); | ||||
|     return buf->buf; | ||||
|  | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNodetoString | ||||
| *       converts DOM tree under node to text string | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| DOMString | ||||
| ixmlNodetoString( IN IXML_Node * node ) | ||||
| { | ||||
|  | ||||
|     ixml_membuf memBuf; | ||||
|     ixml_membuf *buf = &memBuf; | ||||
|  | ||||
|     if( node == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|     ixml_membuf_init( buf ); | ||||
|     ixmlDomTreetoString( node, buf ); | ||||
|     return buf->buf; | ||||
|  | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlRelaxParser | ||||
| *       Makes the XML parser more tolerant to malformed text. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlRelaxParser(char errorChar) | ||||
| { | ||||
|     Parser_setErrorChar( errorChar ); | ||||
| 	int i; | ||||
| 	int plen; | ||||
|  | ||||
| 	if (p == NULL) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	plen = strlen( p ); | ||||
|  | ||||
| 	for (i = 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; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlParseBufferEx | ||||
| *       Parse xml file stored in buffer. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixmlParseBufferEx( IN const char *buffer, | ||||
|                    IXML_Document ** retDoc ) | ||||
| /*! | ||||
|  * \brief Recursive function to print all the node in a tree. | ||||
|  * Internal to parser only. | ||||
|  */ | ||||
| static void ixmlPrintDomTreeRecursive( | ||||
| 	/*! [in] \todo documentation. */ | ||||
| 	IXML_Node *nodeptr, | ||||
| 	/*! [in] \todo documentation. */ | ||||
| 	ixml_membuf *buf) | ||||
| { | ||||
| 	const char *nodeName = NULL; | ||||
| 	const char *nodeValue = NULL; | ||||
| 	IXML_Node *child = NULL, | ||||
| 	*sibling = NULL; | ||||
|  | ||||
|     if( ( buffer == NULL ) || ( retDoc == NULL ) ) { | ||||
|         return IXML_INVALID_PARAMETER; | ||||
|     } | ||||
| 	if (nodeptr != NULL) { | ||||
| 		nodeName = (const char *)ixmlNode_getNodeName(nodeptr); | ||||
| 		nodeValue = ixmlNode_getNodeValue(nodeptr); | ||||
| 		 | ||||
| 		switch (ixmlNode_getNodeType(nodeptr)) { | ||||
| 		case eTEXT_NODE: | ||||
| 			copy_with_escape(buf, nodeValue); | ||||
| 			break; | ||||
|  | ||||
|     if( buffer[0] == '\0' ) { | ||||
|         return IXML_INVALID_PARAMETER; | ||||
|     } | ||||
| 		case eCDATA_SECTION_NODE: | ||||
| 			ixml_membuf_append_str(buf, "<![CDATA["); | ||||
| 			ixml_membuf_append_str(buf, nodeValue); | ||||
| 			ixml_membuf_append_str(buf, "]]>"); | ||||
| 			break; | ||||
|  | ||||
|     return Parser_LoadDocument( retDoc, buffer, FALSE ); | ||||
| 		case ePROCESSING_INSTRUCTION_NODE: | ||||
| 			ixml_membuf_append_str(buf, "<?"); | ||||
| 			ixml_membuf_append_str(buf, nodeName); | ||||
| 			ixml_membuf_append_str(buf, " "); | ||||
| 			copy_with_escape(buf, nodeValue); | ||||
| 			ixml_membuf_append_str(buf, "?>\n"); | ||||
| 			break; | ||||
|  | ||||
| 		case eDOCUMENT_NODE: | ||||
| 			ixmlPrintDomTreeRecursive( | ||||
| 				ixmlNode_getFirstChild(nodeptr), buf); | ||||
| 			break; | ||||
|  | ||||
| 		case eATTRIBUTE_NODE: | ||||
| 			ixml_membuf_append_str(buf, nodeName); | ||||
| 			ixml_membuf_append_str(buf, "=\""); | ||||
| 			copy_with_escape(buf, nodeValue); | ||||
| 			ixml_membuf_append_str(buf, "\""); | ||||
| 			if (nodeptr->nextSibling != NULL) { | ||||
| 				ixml_membuf_append_str(buf, " "); | ||||
| 				ixmlPrintDomTreeRecursive(nodeptr->nextSibling, buf); | ||||
| 			} | ||||
| 			break; | ||||
|  | ||||
| 		case eELEMENT_NODE: | ||||
| 			ixml_membuf_append_str(buf, "<"); | ||||
| 			ixml_membuf_append_str(buf, nodeName); | ||||
| 			if (nodeptr->firstAttr != NULL) { | ||||
| 				ixml_membuf_append_str(buf, " "); | ||||
| 				ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf); | ||||
| 			} | ||||
| 			child = ixmlNode_getFirstChild(nodeptr); | ||||
| 			if (child != NULL && | ||||
| 			    ixmlNode_getNodeType(child) == eELEMENT_NODE) { | ||||
| 				ixml_membuf_append_str(buf, ">\r\n"); | ||||
| 			} else { | ||||
| 				ixml_membuf_append_str(buf, ">"); | ||||
| 			} | ||||
| 			//  output the children | ||||
| 			ixmlPrintDomTreeRecursive( | ||||
| 				ixmlNode_getFirstChild(nodeptr), buf); | ||||
|  | ||||
| 			// Done with children.  Output the end tag. | ||||
| 			ixml_membuf_append_str(buf, "</"); | ||||
| 			ixml_membuf_append_str(buf, nodeName); | ||||
|  | ||||
| 			sibling = ixmlNode_getNextSibling(nodeptr); | ||||
| 			if (sibling != NULL && | ||||
| 			    ixmlNode_getNodeType(sibling) == eTEXT_NODE) { | ||||
| 				ixml_membuf_append_str( buf, ">" ); | ||||
| 			} else { | ||||
| 				ixml_membuf_append_str( buf, ">\r\n" ); | ||||
| 			} | ||||
| 			ixmlPrintDomTreeRecursive( | ||||
| 				ixmlNode_getNextSibling(nodeptr), buf); | ||||
| 			break; | ||||
|  | ||||
| 		default: | ||||
| 			IxmlPrintf("(%s::ixmlPrintDomTreeRecursive) line %d: " | ||||
| 				"Warning, unknown node type %d\n", | ||||
| 				__FILE__, __LINE__, ixmlNode_getNodeType(nodeptr)); | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlParseBuffer | ||||
| *       Parse xml file stored in buffer. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| IXML_Document * | ||||
| ixmlParseBuffer( IN const char *buffer ) | ||||
| { | ||||
|     IXML_Document *doc = NULL; | ||||
|  | ||||
|     ixmlParseBufferEx( buffer, &doc ); | ||||
|     return doc; | ||||
| /*! | ||||
|  * \brief Print a DOM tree. | ||||
|  * | ||||
|  * Element, and Attribute nodes are handled differently. We don't want to print | ||||
|  * the Element and Attribute nodes' sibling. | ||||
|  */ | ||||
| static void ixmlPrintDomTree( | ||||
| 	/*! [in] \todo documentation. */ | ||||
| 	IXML_Node *nodeptr, | ||||
| 	/*! [in] \todo documentation. */ | ||||
| 	ixml_membuf *buf) | ||||
| { | ||||
| 	const char *nodeName = NULL; | ||||
| 	const char *nodeValue = NULL; | ||||
| 	IXML_Node *child = NULL; | ||||
|  | ||||
| 	if (nodeptr == NULL || buf == NULL) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	nodeName = (const char *)ixmlNode_getNodeName(nodeptr); | ||||
| 	nodeValue = ixmlNode_getNodeValue(nodeptr); | ||||
| 	switch (ixmlNode_getNodeType(nodeptr)) { | ||||
| 	case eTEXT_NODE: | ||||
| 	case eCDATA_SECTION_NODE: | ||||
| 	case ePROCESSING_INSTRUCTION_NODE: | ||||
| 	case eDOCUMENT_NODE: | ||||
| 		ixmlPrintDomTreeRecursive(nodeptr, buf); | ||||
| 		break; | ||||
|  | ||||
| 	case eATTRIBUTE_NODE: | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		ixml_membuf_append_str(buf, "=\""); | ||||
| 		copy_with_escape(buf, nodeValue); | ||||
| 		ixml_membuf_append_str(buf, "\""); | ||||
| 		break; | ||||
|  | ||||
| 	case eELEMENT_NODE: | ||||
| 		ixml_membuf_append_str(buf, "<"); | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		if (nodeptr->firstAttr != NULL) { | ||||
| 			ixml_membuf_append_str(buf, " "); | ||||
| 			ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf); | ||||
| 		} | ||||
| 		child = ixmlNode_getFirstChild(nodeptr); | ||||
| 		if (child != NULL && | ||||
| 		    ixmlNode_getNodeType(child) == eELEMENT_NODE) { | ||||
| 			ixml_membuf_append_str(buf, ">\r\n"); | ||||
| 		} else { | ||||
| 			ixml_membuf_append_str(buf, ">"); | ||||
| 		} | ||||
|  | ||||
| 		// output the children | ||||
| 		ixmlPrintDomTreeRecursive( | ||||
| 			ixmlNode_getFirstChild(nodeptr), buf); | ||||
|  | ||||
| 		// 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"); | ||||
| 		break; | ||||
|  | ||||
| 	default: | ||||
| 		IxmlPrintf("(%s::ixmlPrintDomTree) line %d: " | ||||
| 			"Warning, unknown node type %d\n", | ||||
| 			__FILE__, __LINE__, ixmlNode_getNodeType(nodeptr)); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlCloneDOMString | ||||
| *       Clones a DOM String. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| DOMString | ||||
| ixmlCloneDOMString( IN const DOMString src ) | ||||
| { | ||||
|     if( src == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|     return ( strdup( src ) ); | ||||
| /*! | ||||
|  * \brief Converts a DOM tree into a text string. | ||||
|  * | ||||
|  * Element, and Attribute nodes are handled differently. We don't want to print | ||||
|  * the Element and Attribute nodes' sibling. | ||||
|  */ | ||||
| static void ixmlDomTreetoString( | ||||
| 	/*! [in] \todo documentation. */ | ||||
| 	IXML_Node *nodeptr, | ||||
| 	/*! [in] \todo documentation. */ | ||||
| 	ixml_membuf *buf) | ||||
| { | ||||
| 	const char *nodeName = NULL; | ||||
| 	const char *nodeValue = NULL; | ||||
| 	IXML_Node *child = NULL; | ||||
|  | ||||
| 	if (nodeptr == NULL || buf == NULL) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	nodeName = (const char *)ixmlNode_getNodeName(nodeptr); | ||||
| 	nodeValue = ixmlNode_getNodeValue(nodeptr); | ||||
|  | ||||
| 	switch (ixmlNode_getNodeType(nodeptr)) { | ||||
| 	case eTEXT_NODE: | ||||
| 	case eCDATA_SECTION_NODE: | ||||
| 	case ePROCESSING_INSTRUCTION_NODE: | ||||
| 	case eDOCUMENT_NODE: | ||||
| 		ixmlPrintDomTreeRecursive(nodeptr, buf); | ||||
| 		break; | ||||
|  | ||||
| 	case eATTRIBUTE_NODE: | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		ixml_membuf_append_str(buf, "=\""); | ||||
| 		copy_with_escape(buf, nodeValue ); | ||||
| 		ixml_membuf_append_str(buf, "\""); | ||||
| 		break; | ||||
|  | ||||
| 	case eELEMENT_NODE: | ||||
| 		ixml_membuf_append_str(buf, "<"); | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		if (nodeptr->firstAttr != NULL) { | ||||
| 			ixml_membuf_append_str(buf, " "); | ||||
| 			ixmlPrintDomTreeRecursive(nodeptr->firstAttr, buf); | ||||
| 		} | ||||
| 		child = ixmlNode_getFirstChild(nodeptr); | ||||
| 		if (child != NULL && | ||||
| 		    ixmlNode_getNodeType(child) == eELEMENT_NODE) { | ||||
| 			ixml_membuf_append_str(buf, ">"); | ||||
| 		} else { | ||||
| 			ixml_membuf_append_str(buf, ">"); | ||||
| 		} | ||||
|  | ||||
| 		//  output the children | ||||
| 		ixmlPrintDomTreeRecursive(ixmlNode_getFirstChild(nodeptr), buf); | ||||
|  | ||||
| 		// Done with children.  Output the end tag. | ||||
| 		ixml_membuf_append_str(buf, "</"); | ||||
| 		ixml_membuf_append_str(buf, nodeName); | ||||
| 		ixml_membuf_append_str(buf, ">"); | ||||
| 		break; | ||||
|  | ||||
| 	default: | ||||
| 		IxmlPrintf("(%s::ixmlDomTreetoString) line %d: " | ||||
| 			"Warning, unknown node type %d\n", | ||||
| 			__FILE__, __LINE__, ixmlNode_getNodeType(nodeptr)); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlFreeDOMString | ||||
| *       Frees a DOM String. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlFreeDOMString( IN DOMString buf ) | ||||
|  | ||||
| int ixmlLoadDocumentEx(const char *xmlFile, IXML_Document **doc) | ||||
| { | ||||
|     if( buf != NULL ) { | ||||
|         free( buf ); | ||||
|     } | ||||
| 	if (xmlFile == NULL || doc == NULL) { | ||||
| 		return IXML_INVALID_PARAMETER; | ||||
| 	} | ||||
|  | ||||
| 	return Parser_LoadDocument(doc, xmlFile, TRUE); | ||||
| } | ||||
|  | ||||
|  | ||||
| IXML_Document *ixmlLoadDocument(const char *xmlFile) | ||||
| { | ||||
| 	IXML_Document *doc = NULL; | ||||
|  | ||||
| 	ixmlLoadDocumentEx(xmlFile, &doc); | ||||
|  | ||||
| 	return doc; | ||||
| } | ||||
|  | ||||
|  | ||||
| DOMString ixmlPrintDocument(IXML_Document *doc) | ||||
| { | ||||
| 	IXML_Node* rootNode = (IXML_Node *)doc; | ||||
| 	ixml_membuf memBuf; | ||||
| 	ixml_membuf *buf = &memBuf; | ||||
|  | ||||
| 	if(rootNode == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	ixml_membuf_init(buf); | ||||
| 	ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n"); | ||||
| 	ixmlPrintDomTree(rootNode, buf); | ||||
|  | ||||
| 	return buf->buf; | ||||
| } | ||||
|  | ||||
|  | ||||
| DOMString ixmlPrintNode(IXML_Node *node) | ||||
| { | ||||
| 	ixml_membuf memBuf; | ||||
| 	ixml_membuf *buf = &memBuf; | ||||
|  | ||||
| 	if (node == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	ixml_membuf_init(buf); | ||||
| 	ixmlPrintDomTree(node, buf); | ||||
|  | ||||
| 	return buf->buf; | ||||
| } | ||||
|  | ||||
|  | ||||
| DOMString ixmlDocumenttoString(IXML_Document *doc) | ||||
| { | ||||
| 	IXML_Node* rootNode = (IXML_Node *)doc; | ||||
| 	ixml_membuf memBuf; | ||||
| 	ixml_membuf *buf = &memBuf; | ||||
|  | ||||
| 	if(rootNode == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	ixml_membuf_init(buf); | ||||
| 	ixml_membuf_append_str(buf, "<?xml version=\"1.0\"?>\r\n"); | ||||
| 	ixmlDomTreetoString(rootNode, buf); | ||||
|  | ||||
| 	return buf->buf; | ||||
| } | ||||
|  | ||||
|  | ||||
| DOMString ixmlNodetoString(IXML_Node *node) | ||||
| { | ||||
| 	ixml_membuf memBuf; | ||||
| 	ixml_membuf *buf = &memBuf; | ||||
|  | ||||
| 	if (node == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	ixml_membuf_init(buf); | ||||
| 	ixmlDomTreetoString(node, buf); | ||||
|  | ||||
| 	return buf->buf; | ||||
| } | ||||
|  | ||||
|  | ||||
| void ixmlRelaxParser(char errorChar) | ||||
| { | ||||
| 	Parser_setErrorChar(errorChar); | ||||
| } | ||||
|  | ||||
|  | ||||
| int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc) | ||||
| { | ||||
| 	if (buffer == NULL || retDoc == NULL) { | ||||
| 		return IXML_INVALID_PARAMETER; | ||||
| 	} | ||||
|  | ||||
| 	if (buffer[0] == '\0') { | ||||
| 		return IXML_INVALID_PARAMETER; | ||||
| 	} | ||||
|  | ||||
| 	return Parser_LoadDocument(retDoc, buffer, FALSE); | ||||
| } | ||||
|  | ||||
|  | ||||
| IXML_Document *ixmlParseBuffer(const char *buffer) | ||||
| { | ||||
| 	IXML_Document *doc = NULL; | ||||
|  | ||||
| 	ixmlParseBufferEx(buffer, &doc); | ||||
|  | ||||
| 	return doc; | ||||
| } | ||||
|  | ||||
|  | ||||
| DOMString ixmlCloneDOMString(const DOMString src) | ||||
| { | ||||
| 	if (src == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	return strdup(src); | ||||
| } | ||||
|  | ||||
|  | ||||
| void ixmlFreeDOMString(DOMString buf) | ||||
| { | ||||
| 	if (buf != NULL) { | ||||
| 		free(buf); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										31
									
								
								ixml/src/ixmldebug.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								ixml/src/ixmldebug.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "autoconfig.h" | ||||
|  | ||||
|  | ||||
| #include "ixmldebug.h" | ||||
|  | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| #ifdef DEBUG | ||||
| void IxmlPrintf( | ||||
| 	const char *FmtStr, | ||||
| 	...) | ||||
| { | ||||
| 	va_list ArgList; | ||||
| 	 | ||||
| 	va_start(ArgList, FmtStr); | ||||
| 	vfprintf(stdout, FmtStr, ArgList); | ||||
| 	fflush(stdout); | ||||
| 	va_end(ArgList); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| @@ -1,236 +1,218 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ixmlmembuf.h" | ||||
| #include "ixml.h" | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include "ixmlmembuf.h" | ||||
| #include "ixml.h" | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixml_membuf_set_size | ||||
| * | ||||
| *   Increases or decreases buffer cap so that at least | ||||
| *   'new_length' bytes can be stored | ||||
| * | ||||
| *   On error, m's fields do not change. | ||||
| * | ||||
| *   returns: | ||||
| *       UPNP_E_SUCCESS | ||||
| *       UPNP_E_OUTOF_MEMORY | ||||
| * | ||||
| *=================================================================*/ | ||||
| static int | ||||
| ixml_membuf_set_size( INOUT ixml_membuf * m, | ||||
|                       IN size_t new_length ) | ||||
|  | ||||
| /*! | ||||
|  * \brief Increases or decreases buffer capacity so that at least 'new_length' | ||||
|  * bytes can be stored. | ||||
|  * | ||||
|  * On error, m's fields do not change. | ||||
|  * | ||||
|  * \return | ||||
|  * 	\li UPNP_E_SUCCESS | ||||
|  * 	\li UPNP_E_OUTOF_MEMORY | ||||
|  */ | ||||
| static int ixml_membuf_set_size( | ||||
| 	/*! [in,out] The memory buffer. */ | ||||
| 	INOUT ixml_membuf *m, | ||||
| 	/*! [in] The new lenght. */ | ||||
| 	IN size_t new_length) | ||||
| { | ||||
|     size_t diff; | ||||
|     size_t alloc_len; | ||||
|     char *temp_buf; | ||||
| 	size_t diff; | ||||
| 	size_t alloc_len; | ||||
| 	char *temp_buf; | ||||
|  | ||||
|     if( new_length >= m->length )   // increase length | ||||
|     { | ||||
|         // need more mem? | ||||
|         if( new_length <= m->capacity ) { | ||||
|             return 0;           // have enough mem; done | ||||
|         } | ||||
| 	if (new_length >= m->length) { | ||||
| 		/* increase length */ | ||||
| 		/* need more mem? */ | ||||
| 		if (new_length <= m->capacity) { | ||||
| 			/* have enough mem; done */ | ||||
| 			return 0; | ||||
| 		} | ||||
|  | ||||
|         diff = new_length - m->length; | ||||
|         alloc_len = MAXVAL( m->size_inc, diff ) + m->capacity; | ||||
|     } else                      // decrease length | ||||
|     { | ||||
|         assert( new_length <= m->length ); | ||||
| 		diff = new_length - m->length; | ||||
| 		alloc_len = MAXVAL(m->size_inc, diff) + m->capacity; | ||||
| 	} else { | ||||
| 		// decrease length | ||||
| 		assert(new_length <= m->length); | ||||
|  | ||||
|         // if diff is 0..m->size_inc, don't free | ||||
|         if( ( m->capacity - new_length ) <= m->size_inc ) { | ||||
|             return 0; | ||||
|         } | ||||
| 		// if diff is 0..m->size_inc, don't free | ||||
| 		if ((m->capacity - new_length) <= m->size_inc) { | ||||
| 			return 0; | ||||
| 		} | ||||
| 		alloc_len = new_length + m->size_inc; | ||||
| 	} | ||||
|  | ||||
|         alloc_len = new_length + m->size_inc; | ||||
|     } | ||||
| 	assert(alloc_len >= new_length); | ||||
|  | ||||
|     assert( alloc_len >= new_length ); | ||||
| 	temp_buf = realloc(m->buf, alloc_len + 1); | ||||
| 	if (temp_buf == NULL) { | ||||
| 		/* try smaller size */ | ||||
| 		alloc_len = new_length; | ||||
| 		temp_buf = realloc(m->buf, alloc_len + 1); | ||||
| 		if (temp_buf == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
| 	} | ||||
| 	/* save */ | ||||
| 	m->buf = temp_buf; | ||||
| 	m->capacity = alloc_len; | ||||
|  | ||||
|     temp_buf = realloc( m->buf, alloc_len + 1 ); | ||||
|     if( temp_buf == NULL ) { | ||||
|         // try smaller size | ||||
|         alloc_len = new_length; | ||||
|         temp_buf = realloc( m->buf, alloc_len + 1 ); | ||||
|  | ||||
|         if( temp_buf == NULL ) { | ||||
|             return IXML_INSUFFICIENT_MEMORY; | ||||
|         } | ||||
|     } | ||||
|     // save | ||||
|     m->buf = temp_buf; | ||||
|     m->capacity = alloc_len; | ||||
|     return 0; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   membuffer_init | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixml_membuf_init( INOUT ixml_membuf * m ) | ||||
| { | ||||
|     assert( m != NULL ); | ||||
|  | ||||
|     m->size_inc = MEMBUF_DEF_SIZE_INC; | ||||
|     m->buf = NULL; | ||||
|     m->length = 0; | ||||
|     m->capacity = 0; | ||||
| void ixml_membuf_init(ixml_membuf *m) | ||||
| { | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| 	m->size_inc = MEMBUF_DEF_SIZE_INC; | ||||
| 	m->buf = NULL; | ||||
| 	m->length = 0; | ||||
| 	m->capacity = 0; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   membuffer_destroy | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixml_membuf_destroy( INOUT ixml_membuf * m ) | ||||
| { | ||||
|     if( m == NULL ) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     free( m->buf ); | ||||
|     ixml_membuf_init( m ); | ||||
| void ixml_membuf_destroy(ixml_membuf *m) | ||||
| { | ||||
| 	if (m == NULL) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	free(m->buf); | ||||
| 	ixml_membuf_init(m); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixml_membuf_assign | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixml_membuf_assign( INOUT ixml_membuf * m, | ||||
|                     IN const void *buf, | ||||
|                     IN size_t buf_len ) | ||||
|  | ||||
| int ixml_membuf_assign( | ||||
| 	ixml_membuf *m, | ||||
| 	const void *buf, | ||||
| 	size_t buf_len) | ||||
| { | ||||
|     int return_code; | ||||
| 	int return_code; | ||||
|  | ||||
|     assert( m != NULL ); | ||||
| 	assert(m != NULL); | ||||
|  | ||||
|     // set value to null | ||||
|     if( buf == NULL ) { | ||||
|         ixml_membuf_destroy( m ); | ||||
|         return IXML_SUCCESS; | ||||
|     } | ||||
|     // alloc mem | ||||
|     return_code = ixml_membuf_set_size( m, buf_len ); | ||||
|     if( return_code != 0 ) { | ||||
|         return return_code; | ||||
|     } | ||||
|     // copy | ||||
|     memcpy( m->buf, buf, buf_len ); | ||||
|     m->buf[buf_len] = 0;        // null-terminate | ||||
| 	// set value to null | ||||
| 	if (buf == NULL) { | ||||
| 		ixml_membuf_destroy(m); | ||||
| 		return IXML_SUCCESS; | ||||
| 	} | ||||
| 	// alloc mem | ||||
| 	return_code = ixml_membuf_set_size(m, buf_len); | ||||
| 	if (return_code != 0) { | ||||
| 		return return_code; | ||||
| 	} | ||||
|  | ||||
|     m->length = buf_len; | ||||
| 	// copy | ||||
| 	memcpy(m->buf, buf, buf_len); | ||||
|  | ||||
|     return IXML_SUCCESS; | ||||
| 	// null-terminate | ||||
| 	m->buf[buf_len] = 0; | ||||
| 	m->length = buf_len; | ||||
|  | ||||
| 	return IXML_SUCCESS; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixml_membuf_assign_str | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixml_membuf_assign_str( INOUT ixml_membuf * m, | ||||
|                         IN const char *c_str ) | ||||
|  | ||||
| int ixml_membuf_assign_str( | ||||
| 	ixml_membuf *m, | ||||
| 	const char *c_str) | ||||
| { | ||||
|     return ixml_membuf_assign( m, c_str, strlen( c_str ) ); | ||||
| 	return ixml_membuf_assign(m, c_str, strlen(c_str)); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixml_membuf_append | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixml_membuf_append( INOUT ixml_membuf * m, | ||||
|                     IN const void *buf ) | ||||
| { | ||||
|     assert( m != NULL ); | ||||
|  | ||||
|     return ixml_membuf_insert( m, buf, 1, m->length ); | ||||
| int ixml_membuf_append( | ||||
| 	INOUT ixml_membuf *m, | ||||
| 	IN const void *buf) | ||||
| { | ||||
| 	assert(m != NULL); | ||||
|  | ||||
| 	return ixml_membuf_insert(m, buf, 1, m->length); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixml_membuf_append_str | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixml_membuf_append_str( INOUT ixml_membuf * m, | ||||
|                         IN const char *c_str ) | ||||
|  | ||||
| int ixml_membuf_append_str( | ||||
| 	INOUT ixml_membuf *m, | ||||
| 	IN const char *c_str) | ||||
| { | ||||
|     return ixml_membuf_insert( m, c_str, strlen( c_str ), m->length ); | ||||
| 	return ixml_membuf_insert(m, c_str, strlen(c_str), m->length); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixml_membuf_insert | ||||
| * | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixml_membuf_insert( INOUT ixml_membuf * m, | ||||
|                     IN const void *buf, | ||||
|                     IN size_t buf_len, | ||||
|                     int index ) | ||||
|  | ||||
| int ixml_membuf_insert( | ||||
| 	INOUT ixml_membuf *m, | ||||
| 	IN const void *buf, | ||||
| 	IN size_t buf_len, | ||||
| 	int index) | ||||
| { | ||||
|     int return_code; | ||||
| 	int return_code = 0; | ||||
|  | ||||
|     assert( m != NULL ); | ||||
| 	assert(m != NULL); | ||||
|  | ||||
|     if( index < 0 || index > ( int )m->length ) | ||||
|         return IXML_INDEX_SIZE_ERR; | ||||
| 	if (index < 0 || index > (int)m->length) { | ||||
| 		return IXML_INDEX_SIZE_ERR; | ||||
| 	} | ||||
|  | ||||
|     if( buf == NULL || buf_len == 0 ) { | ||||
|         return 0; | ||||
|     } | ||||
|     // alloc mem | ||||
|     return_code = ixml_membuf_set_size( m, m->length + buf_len ); | ||||
|     if( return_code != 0 ) { | ||||
|         return return_code; | ||||
|     } | ||||
|     // insert data | ||||
|     // move data to right of insertion point | ||||
|     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 | ||||
| 	if (buf == NULL || buf_len == 0) { | ||||
| 		return 0; | ||||
| 	} | ||||
| 	/* alloc mem */ | ||||
| 	return_code = ixml_membuf_set_size(m, m->length + buf_len); | ||||
| 	if (return_code != 0) { | ||||
| 		return return_code; | ||||
| 	} | ||||
| 	/* insert data */ | ||||
| 	/* move data to right of insertion point */ | ||||
| 	memmove(m->buf + index + buf_len, m->buf + index, m->length - index); | ||||
| 	memcpy(m->buf + index, buf, buf_len); | ||||
| 	m->length += buf_len; | ||||
| 	/* Null terminate */ | ||||
| 	m->buf[m->length] = 0; | ||||
|  | ||||
|     return 0; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,242 +1,195 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ixmlparser.h" | ||||
|  | ||||
| /*================================================================ | ||||
| *   NamedNodeMap_getItemNumber | ||||
| *       return the item number of a item in NamedNodeMap. | ||||
| *       Internal to parser only. | ||||
| *   Parameters: | ||||
| *       name: the name of the item to find | ||||
| *    | ||||
| *=================================================================*/ | ||||
| unsigned long | ||||
| ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap, | ||||
|                                 IN const char *name ) | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <stdlib.h> /* for free(), malloc() */ | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Return the item number of a item in NamedNodeMap. | ||||
|  */ | ||||
| static unsigned long ixmlNamedNodeMap_getItemNumber( | ||||
| 	/*! [in] The named node map to process. */ | ||||
| 	IN IXML_NamedNodeMap *nnMap, | ||||
| 	/*! [in] The name of the item to find. */ | ||||
| 	IN const char *name) | ||||
| { | ||||
|     IXML_Node *tempNode; | ||||
|     unsigned long returnItemNo = 0; | ||||
| 	IXML_Node *tempNode; | ||||
| 	unsigned long returnItemNo = 0; | ||||
|  | ||||
|     assert( nnMap != NULL && name != NULL ); | ||||
|     if( ( nnMap == NULL ) || ( name == NULL ) ) { | ||||
|         return IXML_INVALID_ITEM_NUMBER; | ||||
|     } | ||||
| 	assert(nnMap != NULL && name != NULL); | ||||
| 	if (nnMap == NULL || name == NULL) { | ||||
| 		return IXML_INVALID_ITEM_NUMBER; | ||||
| 	} | ||||
|  | ||||
|     tempNode = nnMap->nodeItem; | ||||
|     while( tempNode != NULL ) { | ||||
|         if( strcmp( name, tempNode->nodeName ) == 0 ) { | ||||
|             return returnItemNo; | ||||
|         } | ||||
| 	tempNode = nnMap->nodeItem; | ||||
| 	while (tempNode != NULL) { | ||||
| 		if (strcmp(name, tempNode->nodeName) == 0) { | ||||
| 			return returnItemNo; | ||||
| 		} | ||||
| 		tempNode = tempNode->nextSibling; | ||||
| 		returnItemNo++; | ||||
| 	} | ||||
|  | ||||
|         tempNode = tempNode->nextSibling; | ||||
|         returnItemNo++; | ||||
|     } | ||||
|  | ||||
|     return IXML_INVALID_ITEM_NUMBER; | ||||
| 	return IXML_INVALID_ITEM_NUMBER; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   NamedNodeMap_init | ||||
| *       Initializes a NamedNodeMap object. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlNamedNodeMap_init( IN IXML_NamedNodeMap * nnMap ) | ||||
|  | ||||
| void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap) | ||||
| { | ||||
|     assert( nnMap != NULL ); | ||||
|     memset( nnMap, 0, sizeof( IXML_NamedNodeMap ) ); | ||||
| 	assert(nnMap != NULL); | ||||
|  | ||||
| 	memset(nnMap, 0, sizeof (IXML_NamedNodeMap)); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   NamedNodeMap_getNamedItem | ||||
| *       Retrieves a node specified by name. | ||||
| *       External function. | ||||
| * | ||||
| *   Parameter: | ||||
| *       name: type nodeName of a node to retrieve. | ||||
| * | ||||
| *   Return Value: | ||||
| *       A Node with the specified nodeName, or null if it | ||||
| *       does not identify any node in this map. | ||||
| * | ||||
| *=================================================================*/ | ||||
| IXML_Node * | ||||
| ixmlNamedNodeMap_getNamedItem( IN IXML_NamedNodeMap * nnMap, | ||||
|                                IN const char *name ) | ||||
|  | ||||
| IXML_Node *ixmlNamedNodeMap_getNamedItem( | ||||
| 	IXML_NamedNodeMap *nnMap, | ||||
| 	const DOMString name) | ||||
| { | ||||
|     long index; | ||||
| 	long index; | ||||
|  | ||||
|     if( ( nnMap == NULL ) || ( name == NULL ) ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	if (nnMap == NULL || name == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     index = ixmlNamedNodeMap_getItemNumber( nnMap, name ); | ||||
|     if( index == IXML_INVALID_ITEM_NUMBER ) { | ||||
|         return NULL; | ||||
|     } else { | ||||
|         return ( ixmlNamedNodeMap_item( nnMap, ( unsigned long )index ) ); | ||||
|     } | ||||
| 	index = ixmlNamedNodeMap_getItemNumber(nnMap, name); | ||||
| 	if (index == IXML_INVALID_ITEM_NUMBER) { | ||||
| 		return NULL; | ||||
| 	} else { | ||||
| 		return ixmlNamedNodeMap_item(nnMap, (unsigned long)index); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   NamedNodeMap_item | ||||
| *       Returns the indexth item in the map. If index is greater than or | ||||
| *       equal to the number of nodes in this map, this returns null. | ||||
| *       External function. | ||||
| * | ||||
| *   Parameter: | ||||
| *       index: index into this map. | ||||
| * | ||||
| *   Return Value: | ||||
| *       The node at the indexth position in the map, or null if that is | ||||
| *       not a valid index. | ||||
| * | ||||
| *=================================================================*/ | ||||
| IXML_Node * | ||||
| ixmlNamedNodeMap_item( IN IXML_NamedNodeMap * nnMap, | ||||
|                        IN unsigned long index ) | ||||
|  | ||||
| IXML_Node *ixmlNamedNodeMap_item( | ||||
| 	IN IXML_NamedNodeMap *nnMap, | ||||
| 	IN unsigned long index ) | ||||
| { | ||||
|     IXML_Node *tempNode; | ||||
|     unsigned int i; | ||||
| 	IXML_Node *tempNode; | ||||
| 	unsigned int i; | ||||
|  | ||||
|     if( nnMap == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	if (nnMap == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     if( index > ixmlNamedNodeMap_getLength( nnMap ) - 1 ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	if (index > ixmlNamedNodeMap_getLength(nnMap) - 1) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     tempNode = nnMap->nodeItem; | ||||
|     for( i = 0; i < index && tempNode != NULL; ++i ) { | ||||
|         tempNode = tempNode->nextSibling; | ||||
|     } | ||||
| 	tempNode = nnMap->nodeItem; | ||||
| 	for (i = 0; i < index && tempNode != NULL; ++i) { | ||||
| 		tempNode = tempNode->nextSibling; | ||||
| 	} | ||||
|  | ||||
|     return tempNode; | ||||
| 	return tempNode; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   NamedNodeMap_getLength	 | ||||
| *       Return the number of Nodes in this map.        | ||||
| *       External function. | ||||
| *    | ||||
| *   Parameters: | ||||
| * | ||||
| *=================================================================*/ | ||||
| unsigned long | ||||
| ixmlNamedNodeMap_getLength( IN IXML_NamedNodeMap * nnMap ) | ||||
| { | ||||
|     IXML_Node *tempNode; | ||||
|     unsigned long length = 0; | ||||
|  | ||||
|     if( nnMap != NULL ) { | ||||
|         tempNode = nnMap->nodeItem; | ||||
|         for( length = 0; tempNode != NULL; ++length ) { | ||||
|             tempNode = tempNode->nextSibling; | ||||
|         } | ||||
|     } | ||||
|     return length; | ||||
| unsigned long ixmlNamedNodeMap_getLength(IXML_NamedNodeMap *nnMap) | ||||
| { | ||||
| 	IXML_Node *tempNode; | ||||
| 	unsigned long length = 0; | ||||
|  | ||||
| 	if (nnMap != NULL) { | ||||
| 		tempNode = nnMap->nodeItem; | ||||
| 		for (length = 0; tempNode != NULL; ++length) { | ||||
| 			tempNode = tempNode->nextSibling; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return length; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNamedNodeMap_free | ||||
| *       frees a NamedNodeMap. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlNamedNodeMap_free( IXML_NamedNodeMap * nnMap ) | ||||
| { | ||||
|     IXML_NamedNodeMap *pNext; | ||||
|  | ||||
|     while( nnMap != NULL ) { | ||||
|         pNext = nnMap->next; | ||||
|         free( nnMap ); | ||||
|         nnMap = pNext; | ||||
|     } | ||||
| void ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap) | ||||
| { | ||||
| 	IXML_NamedNodeMap *pNext; | ||||
|  | ||||
| 	while (nnMap != NULL) { | ||||
| 		pNext = nnMap->next; | ||||
| 		free(nnMap); | ||||
| 		nnMap = pNext; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   NamedNodeMap_addToNamedNodeMap | ||||
| *       add a node to a NamedNodeMap. | ||||
| *       Internal to parser only. | ||||
| *   Parameters: | ||||
| *       add: the node to add into NamedNodeMap. | ||||
| *   Return: | ||||
| *       IXML_SUCCESS or failure. | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixmlNamedNodeMap_addToNamedNodeMap( IN IXML_NamedNodeMap ** nnMap, | ||||
|                                     IN IXML_Node * add ) | ||||
|  | ||||
| int ixmlNamedNodeMap_addToNamedNodeMap( | ||||
| 	IXML_NamedNodeMap **nnMap, | ||||
| 	IXML_Node *add) | ||||
| { | ||||
|     IXML_NamedNodeMap *traverse = NULL, | ||||
|      *p = NULL; | ||||
|     IXML_NamedNodeMap *newItem = NULL; | ||||
| 	IXML_NamedNodeMap *traverse = NULL; | ||||
| 	IXML_NamedNodeMap *p = NULL; | ||||
| 	IXML_NamedNodeMap *newItem = NULL; | ||||
|  | ||||
|     if( add == NULL ) { | ||||
|         return IXML_SUCCESS; | ||||
|     } | ||||
| 	if(add == NULL) { | ||||
| 		return IXML_SUCCESS; | ||||
| 	} | ||||
|  | ||||
|     if( *nnMap == NULL )        // nodelist is empty | ||||
|     { | ||||
|         *nnMap = | ||||
|             ( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) ); | ||||
|         if( *nnMap == NULL ) { | ||||
|             return IXML_INSUFFICIENT_MEMORY; | ||||
|         } | ||||
|         ixmlNamedNodeMap_init( *nnMap ); | ||||
|     } | ||||
| 	if (*nnMap == NULL) { | ||||
| 		// nodelist is empty | ||||
| 		*nnMap = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap)); | ||||
| 		if (*nnMap == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
| 		ixmlNamedNodeMap_init(*nnMap); | ||||
| 	} | ||||
| 	if ((*nnMap)->nodeItem == NULL) { | ||||
| 		(*nnMap)->nodeItem = add; | ||||
| 	} else { | ||||
| 		traverse = *nnMap; | ||||
| 		p = traverse; | ||||
| 		while (traverse != NULL) { | ||||
| 			p = traverse; | ||||
| 			traverse = traverse->next; | ||||
| 		} | ||||
| 		newItem = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap)); | ||||
| 		if (newItem == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
| 		p->next = newItem; | ||||
| 		newItem->nodeItem = add; | ||||
| 		newItem->next = NULL; | ||||
| 	} | ||||
|  | ||||
|     if( ( *nnMap )->nodeItem == NULL ) { | ||||
|         ( *nnMap )->nodeItem = add; | ||||
|     } else { | ||||
|         traverse = *nnMap; | ||||
|         p = traverse; | ||||
|         while( traverse != NULL ) { | ||||
|             p = traverse; | ||||
|             traverse = traverse->next; | ||||
|         } | ||||
|  | ||||
|         newItem = | ||||
|             ( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) ); | ||||
|         if( newItem == NULL ) { | ||||
|             return IXML_INSUFFICIENT_MEMORY; | ||||
|         } | ||||
|         p->next = newItem; | ||||
|         newItem->nodeItem = add; | ||||
|         newItem->next = NULL; | ||||
|     } | ||||
|  | ||||
|     return IXML_SUCCESS; | ||||
| 	return IXML_SUCCESS; | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										2790
									
								
								ixml/src/node.c
									
									
									
									
									
								
							
							
						
						
									
										2790
									
								
								ixml/src/node.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,176 +1,152 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ixmlparser.h" | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNodeList_init | ||||
| *       initializes a nodelist  | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlNodeList_init( IXML_NodeList * nList ) | ||||
|  | ||||
| #include <assert.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| void ixmlNodeList_init(IXML_NodeList *nList) | ||||
| { | ||||
|     assert( nList != NULL ); | ||||
|  | ||||
|     memset( nList, 0, sizeof( IXML_NodeList ) ); | ||||
| 	assert(nList != NULL); | ||||
|  | ||||
| 	memset(nList, 0, sizeof (IXML_NodeList)); | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNodeList_item | ||||
| *       Returns the indexth item in the collection. If index is greater | ||||
| *       than or equal to the number of nodes in the list, this returns  | ||||
| *       null. | ||||
| *       External function. | ||||
| * | ||||
| *=================================================================*/ | ||||
| IXML_Node * | ||||
| ixmlNodeList_item( IXML_NodeList * nList, | ||||
|                    unsigned long index ) | ||||
|  | ||||
| IXML_Node *ixmlNodeList_item( | ||||
| 	IXML_NodeList *nList, | ||||
| 	unsigned long index) | ||||
| { | ||||
|     IXML_NodeList *next; | ||||
|     unsigned int i; | ||||
| 	IXML_NodeList *next; | ||||
| 	unsigned int i; | ||||
|  | ||||
|     // if the list ptr is NULL | ||||
|     if( nList == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|     // if index is more than list length | ||||
|     if( index > ixmlNodeList_length( nList ) - 1 ) { | ||||
|         return 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) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     next = nList; | ||||
|     for( i = 0; i < index && next != NULL; ++i ) { | ||||
|         next = next->next; | ||||
|     } | ||||
| 	next = nList; | ||||
| 	for (i = 0; i < index && next != NULL; ++i) { | ||||
| 		next = next->next; | ||||
| 	} | ||||
|  | ||||
|     if( next == NULL ) return NULL; | ||||
|  | ||||
|     return next->nodeItem; | ||||
| 	if (next == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
| 	return next->nodeItem; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNodeList_addToNodeList | ||||
| *       Add a node to nodelist | ||||
| *       Internal to parser only. | ||||
| * | ||||
| *=================================================================*/ | ||||
| int | ||||
| ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList, | ||||
|                             IN IXML_Node * add ) | ||||
| int ixmlNodeList_addToNodeList( | ||||
| 	IXML_NodeList **nList, | ||||
| 	IXML_Node *add) | ||||
| { | ||||
|     IXML_NodeList *traverse, | ||||
|      *p = NULL; | ||||
|     IXML_NodeList *newListItem; | ||||
| 	IXML_NodeList *traverse = NULL; | ||||
| 	IXML_NodeList *p = NULL; | ||||
| 	IXML_NodeList *newListItem; | ||||
|  | ||||
|     assert( add != NULL ); | ||||
| 	assert(add != NULL); | ||||
|  | ||||
|     if( add == NULL ) { | ||||
|         return IXML_FAILED; | ||||
|     } | ||||
| 	if (add == NULL) { | ||||
| 		return IXML_FAILED; | ||||
| 	} | ||||
|  | ||||
|     if( *nList == NULL )        // nodelist is empty | ||||
|     { | ||||
|         *nList = ( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) ); | ||||
|         if( *nList == NULL ) { | ||||
|             return IXML_INSUFFICIENT_MEMORY; | ||||
|         } | ||||
| 	if (*nList == NULL) { | ||||
| 		// nodelist is empty | ||||
| 		*nList = (IXML_NodeList *)malloc(sizeof (IXML_NodeList)); | ||||
| 		if (*nList == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
|  | ||||
|         ixmlNodeList_init( *nList ); | ||||
|     } | ||||
| 		ixmlNodeList_init(*nList); | ||||
| 	} | ||||
|  | ||||
|     if( ( *nList )->nodeItem == NULL ) { | ||||
|         ( *nList )->nodeItem = add; | ||||
|     } else { | ||||
|         traverse = *nList; | ||||
|         while( traverse != NULL ) { | ||||
|             p = traverse; | ||||
|             traverse = traverse->next; | ||||
|         } | ||||
| 	if ((*nList)->nodeItem == NULL) { | ||||
| 		(*nList)->nodeItem = add; | ||||
| 	} else { | ||||
| 		traverse = *nList; | ||||
| 		while (traverse != NULL) { | ||||
| 			p = traverse; | ||||
| 			traverse = traverse->next; | ||||
| 		} | ||||
|  | ||||
|         newListItem = | ||||
|             ( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) ); | ||||
|         if( newListItem == NULL ) { | ||||
|             return IXML_INSUFFICIENT_MEMORY; | ||||
|         } | ||||
|         p->next = newListItem; | ||||
|         newListItem->nodeItem = add; | ||||
|         newListItem->next = NULL; | ||||
|     } | ||||
| 		newListItem = (IXML_NodeList *)malloc(sizeof (IXML_NodeList)); | ||||
| 		if (newListItem == NULL) { | ||||
| 			return IXML_INSUFFICIENT_MEMORY; | ||||
| 		} | ||||
| 		p->next = newListItem; | ||||
| 		newListItem->nodeItem = add; | ||||
| 		newListItem->next = NULL; | ||||
| 	} | ||||
|  | ||||
|     return IXML_SUCCESS; | ||||
| 	return IXML_SUCCESS; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNodeList_length | ||||
| *       Returns the number of nodes in the list.  The range of valid | ||||
| *       child node indices is 0 to length-1 inclusive. | ||||
| *       External function.        | ||||
| * | ||||
| *=================================================================*/ | ||||
| unsigned long | ||||
| ixmlNodeList_length( IN IXML_NodeList * nList ) | ||||
|  | ||||
| unsigned long ixmlNodeList_length(IXML_NodeList *nList) | ||||
| { | ||||
|     IXML_NodeList *list; | ||||
|     unsigned long length = 0; | ||||
| 	IXML_NodeList *list; | ||||
| 	unsigned long length = 0; | ||||
|  | ||||
|     list = nList; | ||||
|     while( list != NULL ) { | ||||
|         ++length; | ||||
|         list = list->next; | ||||
|     } | ||||
| 	list = nList; | ||||
| 	while (list != NULL) { | ||||
| 		++length; | ||||
| 		list = list->next; | ||||
| 	} | ||||
|  | ||||
|     return length; | ||||
| 	return length; | ||||
| } | ||||
|  | ||||
| /*================================================================ | ||||
| *   ixmlNodeList_free | ||||
| *       frees a nodeList | ||||
| *       External function | ||||
| *        | ||||
| *=================================================================*/ | ||||
| void | ||||
| ixmlNodeList_free( IN IXML_NodeList * nList ) | ||||
|  | ||||
| void ixmlNodeList_free(IXML_NodeList *nList) | ||||
| { | ||||
|     IXML_NodeList *next; | ||||
|  | ||||
|     while( nList != NULL ) { | ||||
|         next = nList->next; | ||||
|  | ||||
|         free( nList ); | ||||
|         nList = next; | ||||
|     } | ||||
| 	IXML_NodeList *next; | ||||
|  | ||||
| 	while (nList != NULL) { | ||||
| 		next = nList->next; | ||||
| 		free(nList); | ||||
| 		nList = next; | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										0
									
								
								ixml/test/test_document.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								ixml/test/test_document.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @@ -6,7 +6,6 @@ includedir=@includedir@ | ||||
| Name: libupnp | ||||
| Description: Linux SDK for UPnP Devices | ||||
| Version: @VERSION@ | ||||
| Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml  | ||||
| Cflags: @PTHREAD_CFLAGS@ -I${includedir} | ||||
|  | ||||
| Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml  | ||||
| Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| Version: 1.4.2 | ||||
| Version: 1.6.7 | ||||
| Summary: Universal Plug and Play (UPnP) SDK | ||||
| Name: libupnp | ||||
| Release: 1%{?dist} | ||||
| @@ -77,6 +77,12 @@ make install DESTDIR=$RPM_BUILD_ROOT | ||||
| rm -rf %{buildroot} | ||||
|  | ||||
| %changelog | ||||
| * Mon Nov 19 2007 Marcelo Jimenez <mroberto@users.sourceforge.net> - 1.6.2-1 | ||||
| - Update to version 1.6.2 | ||||
|  | ||||
| * Mon Nov 19 2007 Marcelo Jimenez <mroberto@users.sourceforge.net> - 1.4.7-1 | ||||
| - Update to version 1.4.7 | ||||
|  | ||||
| * Fri Feb 02 2007 Eric Tanguy <eric.tanguy@univ-nantes.fr> - 1.4.2-1 | ||||
| - Update to version 1.4.2 | ||||
|  | ||||
|   | ||||
| @@ -1,50 +1,88 @@ | ||||
| dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | ||||
| dnl | ||||
| dnl @summary figure out how to build C programs using POSIX threads | ||||
| dnl | ||||
| dnl This macro figures out how to build C programs using POSIX threads. | ||||
| dnl It sets the PTHREAD_LIBS output variable to the threads library and | ||||
| dnl linker flags, and the PTHREAD_CFLAGS output variable to any special | ||||
| dnl C compiler flags that are needed. (The user can also force certain | ||||
| dnl compiler flags/libs to be tested by setting these environment | ||||
| dnl variables.) | ||||
| dnl | ||||
| dnl Also sets PTHREAD_CC to any special C compiler that is needed for | ||||
| dnl multi-threaded programs (defaults to the value of CC otherwise). | ||||
| dnl (This is necessary on AIX to use the special cc_r compiler alias.) | ||||
| dnl | ||||
| dnl NOTE: You are assumed to not only compile your program with these | ||||
| dnl flags, but also link it with them as well. e.g. you should link | ||||
| dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS | ||||
| dnl $LIBS | ||||
| dnl | ||||
| dnl If you are only building threads programs, you may wish to use | ||||
| dnl these variables in your default LIBS, CFLAGS, and CC: | ||||
| dnl | ||||
| dnl        LIBS="$PTHREAD_LIBS $LIBS" | ||||
| dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | ||||
| dnl        CC="$PTHREAD_CC" | ||||
| dnl | ||||
| dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute | ||||
| dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to | ||||
| dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). | ||||
| dnl | ||||
| dnl ACTION-IF-FOUND is a list of shell commands to run if a threads | ||||
| dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to | ||||
| dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the | ||||
| dnl default action will define HAVE_PTHREAD. | ||||
| dnl | ||||
| dnl Please let the authors know if this macro fails on any platform, or | ||||
| dnl if you have any other suggestions or comments. This macro was based | ||||
| dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with | ||||
| dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros | ||||
| dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. | ||||
| dnl We are also grateful for the helpful feedback of numerous users. | ||||
| dnl | ||||
| dnl @category InstalledPackages | ||||
| dnl @author Steven G. Johnson <stevenj@alum.mit.edu> | ||||
| dnl @version 2005-06-15 | ||||
| dnl @license GPLWithACException | ||||
| ##### http://autoconf-archive.cryp.to/acx_pthread.html | ||||
| # | ||||
| # SYNOPSIS | ||||
| # | ||||
| #   ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | ||||
| # | ||||
| # DESCRIPTION | ||||
| # | ||||
| #   This macro figures out how to build C programs using POSIX threads. | ||||
| #   It sets the PTHREAD_LIBS output variable to the threads library and | ||||
| #   linker flags, and the PTHREAD_CFLAGS output variable to any special | ||||
| #   C compiler flags that are needed. (The user can also force certain | ||||
| #   compiler flags/libs to be tested by setting these environment | ||||
| #   variables.) | ||||
| # | ||||
| #   Also sets PTHREAD_CC to any special C compiler that is needed for | ||||
| #   multi-threaded programs (defaults to the value of CC otherwise). | ||||
| #   (This is necessary on AIX to use the special cc_r compiler alias.) | ||||
| # | ||||
| #   NOTE: You are assumed to not only compile your program with these | ||||
| #   flags, but also link it with them as well. e.g. you should link | ||||
| #   with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS | ||||
| #   $LIBS | ||||
| # | ||||
| #   If you are only building threads programs, you may wish to use | ||||
| #   these variables in your default LIBS, CFLAGS, and CC: | ||||
| # | ||||
| #          LIBS="$PTHREAD_LIBS $LIBS" | ||||
| #          CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | ||||
| #          CC="$PTHREAD_CC" | ||||
| # | ||||
| #   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute | ||||
| #   constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to | ||||
| #   that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). | ||||
| # | ||||
| #   ACTION-IF-FOUND is a list of shell commands to run if a threads | ||||
| #   library is found, and ACTION-IF-NOT-FOUND is a list of commands to | ||||
| #   run it if it is not found. If ACTION-IF-FOUND is not specified, the | ||||
| #   default action will define HAVE_PTHREAD. | ||||
| # | ||||
| #   Please let the authors know if this macro fails on any platform, or | ||||
| #   if you have any other suggestions or comments. This macro was based | ||||
| #   on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) | ||||
| #   (with help from M. Frigo), as well as ac_pthread and hb_pthread | ||||
| #   macros posted by Alejandro Forero Cuervo to the autoconf macro | ||||
| #   repository. We are also grateful for the helpful feedback of | ||||
| #   numerous users. | ||||
| # | ||||
| # LAST MODIFICATION | ||||
| # | ||||
| #   2006-05-29 | ||||
| # | ||||
| # COPYLEFT | ||||
| # | ||||
| #   Copyright (c) 2006 Steven G. Johnson <stevenj@alum.mit.edu> | ||||
| # | ||||
| #   This program is free software; you can redistribute it and/or | ||||
| #   modify it under the terms of the GNU General Public License as | ||||
| #   published by the Free Software Foundation; either version 2 of the | ||||
| #   License, or (at your option) any later version. | ||||
| # | ||||
| #   This program is distributed in the hope that it will be useful, but | ||||
| #   WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
| #   General Public License for more details. | ||||
| # | ||||
| #   You should have received a copy of the GNU General Public License | ||||
| #   along with this program; if not, write to the Free Software | ||||
| #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
| #   02111-1307, USA. | ||||
| # | ||||
| #   As a special exception, the respective Autoconf Macro's copyright | ||||
| #   owner gives unlimited permission to copy, distribute and modify the | ||||
| #   configure scripts that are the output of Autoconf when processing | ||||
| #   the Macro. You need not follow the terms of the GNU General Public | ||||
| #   License when using or distributing such scripts, even though | ||||
| #   portions of the text of the Macro appear in them. The GNU General | ||||
| #   Public License (GPL) does govern all other use of the material that | ||||
| #   constitutes the Autoconf Macro. | ||||
| # | ||||
| #   This special exception to the GPL applies to versions of the | ||||
| #   Autoconf Macro released by the Autoconf Macro Archive. When you | ||||
| #   make and distribute a modified version of the Autoconf Macro, you | ||||
| #   may extend this special exception to the GPL to apply to your | ||||
| #   modified version as well. | ||||
|  | ||||
| AC_DEFUN([ACX_PTHREAD], [ | ||||
| AC_REQUIRE([AC_CANONICAL_HOST]) | ||||
| @@ -216,8 +254,12 @@ if test "x$acx_pthread_ok" = xyes; then | ||||
|         LIBS="$save_LIBS" | ||||
|         CFLAGS="$save_CFLAGS" | ||||
|  | ||||
|         # More AIX lossage: must compile with cc_r | ||||
|         AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) | ||||
|         # More AIX lossage: must compile with xlc_r or cc_r | ||||
| 	if test x"$GCC" != xyes; then | ||||
|           AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) | ||||
|         else | ||||
|           PTHREAD_CC=$CC | ||||
| 	fi | ||||
| else | ||||
|         PTHREAD_CC="$CC" | ||||
| fi | ||||
|   | ||||
| @@ -1,48 +1,87 @@ | ||||
| dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]]) | ||||
| dnl | ||||
| dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like | ||||
| dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the | ||||
| dnl optionflag to CFLAGS if it is understood. You can override the | ||||
| dnl shellvar-default of CFLAGS of course. The order of arguments stems | ||||
| dnl from the explicit macros like AX_CFLAGS_WARN_ALL. | ||||
| dnl | ||||
| dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add | ||||
| dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C | ||||
| dnl (since it is possible to use different compilers for C and C++). | ||||
| dnl | ||||
| dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or | ||||
| dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options. | ||||
| dnl However, if you use this macro in a few places, it would be great | ||||
| dnl if you would make up a new function-macro and submit it to the | ||||
| dnl ac-archive. | ||||
| dnl | ||||
| dnl   - $1 option-to-check-for : required ("-option" as non-value) | ||||
| dnl   - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case) | ||||
| dnl   - $3 action-if-found : add value to shellvariable | ||||
| dnl   - $4 action-if-not-found : nothing | ||||
| dnl | ||||
| dnl note: in earlier versions, $1-$2 were swapped. We try to detect the | ||||
| dnl situation and accept a $2=~/-/ as being the old | ||||
| dnl option-to-check-for. | ||||
| dnl | ||||
| dnl also: there are other variants that emerged from the original macro | ||||
| dnl variant which did just test an option to be possibly added. | ||||
| dnl However, some compilers accept an option silently, or possibly for | ||||
| dnl just another option that was not intended. Therefore, we have to do | ||||
| dnl a generic test for a compiler family. For gcc we check "-pedantic" | ||||
| dnl being accepted which is also understood by compilers who just want | ||||
| dnl to be compatible with gcc even when not being made from gcc | ||||
| dnl sources. | ||||
| dnl | ||||
| dnl see also: | ||||
| dnl | ||||
| dnl       AX_CFLAGS_SUN_OPTION               AX_CFLAGS_HPUX_OPTION | ||||
| dnl       AX_CFLAGS_AIX_OPTION               AX_CFLAGS_IRIX_OPTION | ||||
| dnl | ||||
| dnl @category C | ||||
| dnl @author Guido Draheim <guidod@gmx.de> | ||||
| dnl @version 2003-11-04 | ||||
| dnl @license GPLWithACException | ||||
| ##### http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html | ||||
| # | ||||
| # SYNOPSIS | ||||
| # | ||||
| #   AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]]) | ||||
| # | ||||
| # DESCRIPTION | ||||
| # | ||||
| #   AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like | ||||
| #   "checking CFLAGS for gcc -fvomit-frame ... yes" and adds the | ||||
| #   optionflag to CFLAGS if it is understood. You can override the | ||||
| #   shellvar-default of CFLAGS of course. The order of arguments stems | ||||
| #   from the explicit macros like AX_CFLAGS_WARN_ALL. | ||||
| # | ||||
| #   The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add | ||||
| #   to CXXFLAGS - and it uses the autoconf setup for C++ instead of C | ||||
| #   (since it is possible to use different compilers for C and C++). | ||||
| # | ||||
| #   The macro is a lot simpler than any special AX_CFLAGS_* macro (or | ||||
| #   ac_cxx_rtti.m4 macro) but allows to check for arbitrary options. | ||||
| #   However, if you use this macro in a few places, it would be great | ||||
| #   if you would make up a new function-macro and submit it to the | ||||
| #   ac-archive. | ||||
| # | ||||
| #     - $1 option-to-check-for : required ("-option" as non-value) | ||||
| #     - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case) | ||||
| #     - $3 action-if-found : add value to shellvariable | ||||
| #     - $4 action-if-not-found : nothing | ||||
| # | ||||
| #   note: in earlier versions, $1-$2 were swapped. We try to detect the | ||||
| #   situation and accept a $2=~/-/ as being the old | ||||
| #   option-to-check-for. | ||||
| # | ||||
| #   also: there are other variants that emerged from the original macro | ||||
| #   variant which did just test an option to be possibly added. | ||||
| #   However, some compilers accept an option silently, or possibly for | ||||
| #   just another option that was not intended. Therefore, we have to do | ||||
| #   a generic test for a compiler family. For gcc we check "-pedantic" | ||||
| #   being accepted which is also understood by compilers who just want | ||||
| #   to be compatible with gcc even when not being made from gcc | ||||
| #   sources. | ||||
| # | ||||
| #   see also: | ||||
| # | ||||
| #         AX_CFLAGS_SUN_OPTION               AX_CFLAGS_HPUX_OPTION | ||||
| #         AX_CFLAGS_AIX_OPTION               AX_CFLAGS_IRIX_OPTION | ||||
| # | ||||
| # LAST MODIFICATION | ||||
| # | ||||
| #   2006-12-12 | ||||
| # | ||||
| # COPYLEFT | ||||
| # | ||||
| #   Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de> | ||||
| # | ||||
| #   This program is free software; you can redistribute it and/or | ||||
| #   modify it under the terms of the GNU General Public License as | ||||
| #   published by the Free Software Foundation; either version 2 of the | ||||
| #   License, or (at your option) any later version. | ||||
| # | ||||
| #   This program is distributed in the hope that it will be useful, but | ||||
| #   WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
| #   General Public License for more details. | ||||
| # | ||||
| #   You should have received a copy of the GNU General Public License | ||||
| #   along with this program; if not, write to the Free Software | ||||
| #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
| #   02111-1307, USA. | ||||
| # | ||||
| #   As a special exception, the respective Autoconf Macro's copyright | ||||
| #   owner gives unlimited permission to copy, distribute and modify the | ||||
| #   configure scripts that are the output of Autoconf when processing | ||||
| #   the Macro. You need not follow the terms of the GNU General Public | ||||
| #   License when using or distributing such scripts, even though | ||||
| #   portions of the text of the Macro appear in them. The GNU General | ||||
| #   Public License (GPL) does govern all other use of the material that | ||||
| #   constitutes the Autoconf Macro. | ||||
| # | ||||
| #   This special exception to the GPL applies to versions of the | ||||
| #   Autoconf Macro released by the Autoconf Macro Archive. When you | ||||
| #   make and distribute a modified version of the Autoconf Macro, you | ||||
| #   may extend this special exception to the GPL to apply to your | ||||
| #   modified version as well. | ||||
|  | ||||
| AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl | ||||
| AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl | ||||
| @@ -53,7 +92,8 @@ VAR,[VAR="no, unknown" | ||||
|  AC_LANG_C | ||||
|  ac_save_[]FLAGS="$[]FLAGS" | ||||
| for ac_arg dnl | ||||
| in "-pedantic  % m4_ifval($2,$2,-option)"  dnl   GCC | ||||
| in "-pedantic -Werror % m4_ifval($2,$2,-option)"  dnl   GCC | ||||
|    "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete"  dnl new GCC | ||||
|    # | ||||
| do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` | ||||
|    AC_TRY_COMPILE([],[return 0;], | ||||
| @@ -85,10 +125,11 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl | ||||
| AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], | ||||
| VAR,[VAR="no, unknown" | ||||
|  AC_LANG_SAVE | ||||
|  AC_LANG_CXX | ||||
|  AC_LANG_CPLUSPLUS | ||||
|  ac_save_[]FLAGS="$[]FLAGS" | ||||
| for ac_arg dnl | ||||
| in "-pedantic  % m4_ifval($2,$2,-option)"  dnl   GCC | ||||
| in "-pedantic -Werror % m4_ifval($2,$2,-option)"  dnl   GCC | ||||
|    "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete"  dnl new GCC | ||||
|    # | ||||
| do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` | ||||
|    AC_TRY_COMPILE([],[return 0;], | ||||
| @@ -122,7 +163,8 @@ VAR,[VAR="no, unknown" | ||||
|  AC_LANG_C | ||||
|  ac_save_[]FLAGS="$[]FLAGS" | ||||
| for ac_arg dnl | ||||
| in "-pedantic  % m4_ifval($1,$1,-option)"  dnl   GCC | ||||
| in "-pedantic -Werror % m4_ifval($1,$1,-option)"  dnl   GCC | ||||
|    "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete"  dnl new GCC | ||||
|    # | ||||
| do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` | ||||
|    AC_TRY_COMPILE([],[return 0;], | ||||
| @@ -154,10 +196,11 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl | ||||
| AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], | ||||
| VAR,[VAR="no, unknown" | ||||
|  AC_LANG_SAVE | ||||
|  AC_LANG_CXX | ||||
|  AC_LANG_CPLUSPLUS | ||||
|  ac_save_[]FLAGS="$[]FLAGS" | ||||
| for ac_arg dnl | ||||
| in "-pedantic  % m4_ifval($1,$1,-option)"  dnl   GCC | ||||
| in "-pedantic -Werror % m4_ifval($1,$1,-option)"  dnl   GCC | ||||
|    "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete"  dnl new GCC | ||||
|    # | ||||
| do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` | ||||
|    AC_TRY_COMPILE([],[return 0;], | ||||
|   | ||||
| @@ -1,27 +1,66 @@ | ||||
| dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] | ||||
| dnl | ||||
| dnl Try to find a compiler option that enables most reasonable | ||||
| dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS | ||||
| dnl which is split up into two AX_CFLAGS_WARN_ALL and | ||||
| dnl AX_CFLAGS_WARN_ALL_ANSI | ||||
| dnl | ||||
| dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The | ||||
| dnl result is added to the shellvar being CFLAGS by default. | ||||
| dnl | ||||
| dnl Currently this macro knows about GCC, Solaris C compiler, Digital | ||||
| dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C | ||||
| dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos | ||||
| dnl 10.0.0.8) C compiler. | ||||
| dnl | ||||
| dnl  - $1 shell-variable-to-add-to : CFLAGS | ||||
| dnl  - $2 add-value-if-not-found : nothing | ||||
| dnl  - $3 action-if-found : add value to shellvariable | ||||
| dnl  - $4 action-if-not-found : nothing | ||||
| dnl | ||||
| dnl @category C | ||||
| dnl @author Guido Draheim <guidod@gmx.de> | ||||
| dnl @version 2003-01-06 | ||||
| dnl @license GPLWithACException | ||||
| ##### http://autoconf-archive.cryp.to/ax_cflags_warn_all.html | ||||
| # | ||||
| # SYNOPSIS | ||||
| # | ||||
| #   AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] | ||||
| # | ||||
| # DESCRIPTION | ||||
| # | ||||
| #   Try to find a compiler option that enables most reasonable | ||||
| #   warnings. This macro is directly derived from VL_PROG_CC_WARNINGS | ||||
| #   which is split up into two AX_CFLAGS_WARN_ALL and | ||||
| #   AX_CFLAGS_WARN_ALL_ANSI | ||||
| # | ||||
| #   For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The | ||||
| #   result is added to the shellvar being CFLAGS by default. | ||||
| # | ||||
| #   Currently this macro knows about GCC, Solaris C compiler, Digital | ||||
| #   Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C | ||||
| #   compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos | ||||
| #   10.0.0.8) C compiler. | ||||
| # | ||||
| #    - $1 shell-variable-to-add-to : CFLAGS | ||||
| #    - $2 add-value-if-not-found : nothing | ||||
| #    - $3 action-if-found : add value to shellvariable | ||||
| #    - $4 action-if-not-found : nothing | ||||
| # | ||||
| # LAST MODIFICATION | ||||
| # | ||||
| #   2006-12-12 | ||||
| # | ||||
| # COPYLEFT | ||||
| # | ||||
| #   Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de> | ||||
| # | ||||
| #   This program is free software; you can redistribute it and/or | ||||
| #   modify it under the terms of the GNU General Public License as | ||||
| #   published by the Free Software Foundation; either version 2 of the | ||||
| #   License, or (at your option) any later version. | ||||
| # | ||||
| #   This program is distributed in the hope that it will be useful, but | ||||
| #   WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
| #   General Public License for more details. | ||||
| # | ||||
| #   You should have received a copy of the GNU General Public License | ||||
| #   along with this program; if not, write to the Free Software | ||||
| #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
| #   02111-1307, USA. | ||||
| # | ||||
| #   As a special exception, the respective Autoconf Macro's copyright | ||||
| #   owner gives unlimited permission to copy, distribute and modify the | ||||
| #   configure scripts that are the output of Autoconf when processing | ||||
| #   the Macro. You need not follow the terms of the GNU General Public | ||||
| #   License when using or distributing such scripts, even though | ||||
| #   portions of the text of the Macro appear in them. The GNU General | ||||
| #   Public License (GPL) does govern all other use of the material that | ||||
| #   constitutes the Autoconf Macro. | ||||
| # | ||||
| #   This special exception to the GPL applies to versions of the | ||||
| #   Autoconf Macro released by the Autoconf Macro Archive. When you | ||||
| #   make and distribute a modified version of the Autoconf Macro, you | ||||
| #   may extend this special exception to the GPL to apply to your | ||||
| #   modified version as well. | ||||
|  | ||||
| AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl | ||||
| AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl | ||||
| @@ -72,7 +111,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl | ||||
| AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], | ||||
| VAR,[VAR="no, unknown" | ||||
|  AC_LANG_SAVE | ||||
|  AC_LANG_CXX | ||||
|  AC_LANG_CPLUSPLUS | ||||
|  ac_save_[]FLAGS="$[]FLAGS" | ||||
| for ac_arg dnl | ||||
| in "-pedantic  % -Wall"       dnl   GCC | ||||
| @@ -115,4 +154,5 @@ dnl   compilers will fail about it. That was needed since a lot of | ||||
| dnl   compilers will give false positives for some option-syntax | ||||
| dnl   like -Woption or -Xoption as they think of it is a pass-through | ||||
| dnl   to later compile stages or something. The "%" is used as a | ||||
| dnl   delimimiter. A non-option comment can be given after "%%" marks. | ||||
| dnl   delimimiter. A non-option comment can be given after "%%" marks | ||||
| dnl   which will be shown but not added to the respective C/CXXFLAGS. | ||||
|   | ||||
| @@ -1,27 +1,66 @@ | ||||
| dnl @synopsis AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])] | ||||
| dnl | ||||
| dnl Try to find a compiler option that enables most reasonable | ||||
| dnl warnings. This macro is directly derived from VL_PROG_CC_WARNINGS | ||||
| dnl which is split up into two AX_CFLAGS_WARN_ALL and | ||||
| dnl AX_CFLAGS_WARN_ALL_ANSI | ||||
| dnl | ||||
| dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The | ||||
| dnl result is added to the shellvar being CFLAGS by default. | ||||
| dnl | ||||
| dnl Currently this macro knows about GCC, Solaris C compiler, Digital | ||||
| dnl Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C | ||||
| dnl compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos | ||||
| dnl 10.0.0.8) C compiler. | ||||
| dnl | ||||
| dnl  - $1 shell-variable-to-add-to : CFLAGS | ||||
| dnl  - $2 add-value-if-not-found : nothing | ||||
| dnl  - $3 action-if-found : add value to shellvariable | ||||
| dnl  - $4 action-if-not-found : nothing | ||||
| dnl | ||||
| dnl @category C | ||||
| dnl @author Guido Draheim <guidod@gmx.de> | ||||
| dnl @version 2003-01-06 | ||||
| dnl @license GPLWithACException | ||||
| ##### http://autoconf-archive.cryp.to/ax_cflags_warn_all_ansi.html | ||||
| # | ||||
| # SYNOPSIS | ||||
| # | ||||
| #   AX_CFLAGS_WARN_ALL_ANSI [(shellvar [,default, [A/NA]])] | ||||
| # | ||||
| # DESCRIPTION | ||||
| # | ||||
| #   Try to find a compiler option that enables most reasonable | ||||
| #   warnings. This macro is directly derived from VL_PROG_CC_WARNINGS | ||||
| #   which is split up into two AX_CFLAGS_WARN_ALL and | ||||
| #   AX_CFLAGS_WARN_ALL_ANSI | ||||
| # | ||||
| #   For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The | ||||
| #   result is added to the shellvar being CFLAGS by default. | ||||
| # | ||||
| #   Currently this macro knows about GCC, Solaris C compiler, Digital | ||||
| #   Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C | ||||
| #   compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos | ||||
| #   10.0.0.8) C compiler. | ||||
| # | ||||
| #    - $1 shell-variable-to-add-to : CFLAGS | ||||
| #    - $2 add-value-if-not-found : nothing | ||||
| #    - $3 action-if-found : add value to shellvariable | ||||
| #    - $4 action-if-not-found : nothing | ||||
| # | ||||
| # LAST MODIFICATION | ||||
| # | ||||
| #   2006-12-12 | ||||
| # | ||||
| # COPYLEFT | ||||
| # | ||||
| #   Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de> | ||||
| # | ||||
| #   This program is free software; you can redistribute it and/or | ||||
| #   modify it under the terms of the GNU General Public License as | ||||
| #   published by the Free Software Foundation; either version 2 of the | ||||
| #   License, or (at your option) any later version. | ||||
| # | ||||
| #   This program is distributed in the hope that it will be useful, but | ||||
| #   WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
| #   General Public License for more details. | ||||
| # | ||||
| #   You should have received a copy of the GNU General Public License | ||||
| #   along with this program; if not, write to the Free Software | ||||
| #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
| #   02111-1307, USA. | ||||
| # | ||||
| #   As a special exception, the respective Autoconf Macro's copyright | ||||
| #   owner gives unlimited permission to copy, distribute and modify the | ||||
| #   configure scripts that are the output of Autoconf when processing | ||||
| #   the Macro. You need not follow the terms of the GNU General Public | ||||
| #   License when using or distributing such scripts, even though | ||||
| #   portions of the text of the Macro appear in them. The GNU General | ||||
| #   Public License (GPL) does govern all other use of the material that | ||||
| #   constitutes the Autoconf Macro. | ||||
| # | ||||
| #   This special exception to the GPL applies to versions of the | ||||
| #   Autoconf Macro released by the Autoconf Macro Archive. When you | ||||
| #   make and distribute a modified version of the Autoconf Macro, you | ||||
| #   may extend this special exception to the GPL to apply to your | ||||
| #   modified version as well. | ||||
|  | ||||
| AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl | ||||
| AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl | ||||
| @@ -77,7 +116,7 @@ AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl | ||||
| AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings], | ||||
| VAR,[VAR="no, unknown" | ||||
|  AC_LANG_SAVE | ||||
|  AC_LANG_CXX | ||||
|  AC_LANG_CPLUSPLUS | ||||
|  ac_save_[]FLAGS="$[]FLAGS" | ||||
| # IRIX C compiler: | ||||
| #      -use_readonly_const is the default for IRIX C, | ||||
|   | ||||
| @@ -41,7 +41,7 @@ AC_DEFUN([RT_BOOL_ARG_ENABLE],[ | ||||
| 		               )]) | ||||
| 	test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl | ||||
| 		&& enable_[]Name=[$2] | ||||
| 	AC_MSG_RESULT($enable_[]Name)dnl | ||||
| 	AC_MSG_RESULT($enable_[]Name) | ||||
| 	AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes) | ||||
| 	dnl | ||||
| 	m4_popdef([NAME])dnl | ||||
|   | ||||
| @@ -1,13 +1,52 @@ | ||||
| dnl @synopsis TYPE_SOCKLEN_T | ||||
| dnl | ||||
| dnl Check whether sys/socket.h defines type socklen_t. Please note that | ||||
| dnl some systems require sys/types.h to be included before sys/socket.h | ||||
| dnl can be compiled. | ||||
| dnl | ||||
| dnl @category Misc | ||||
| dnl @author Lars Brinkhoff <lars@nocrew.org> | ||||
| dnl @version 2005-01-11 | ||||
| dnl @license GPLWithACException | ||||
| ##### http://autoconf-archive.cryp.to/type_socklen_t.html | ||||
| # | ||||
| # SYNOPSIS | ||||
| # | ||||
| #   TYPE_SOCKLEN_T | ||||
| # | ||||
| # DESCRIPTION | ||||
| # | ||||
| #   Check whether sys/socket.h defines type socklen_t. Please note that | ||||
| #   some systems require sys/types.h to be included before sys/socket.h | ||||
| #   can be compiled. | ||||
| # | ||||
| # LAST MODIFICATION | ||||
| # | ||||
| #   2005-01-11 | ||||
| # | ||||
| # COPYLEFT | ||||
| # | ||||
| #   Copyright (c) 2005 Lars Brinkhoff <lars@nocrew.org> | ||||
| # | ||||
| #   This program is free software; you can redistribute it and/or | ||||
| #   modify it under the terms of the GNU General Public License as | ||||
| #   published by the Free Software Foundation; either version 2 of the | ||||
| #   License, or (at your option) any later version. | ||||
| # | ||||
| #   This program is distributed in the hope that it will be useful, but | ||||
| #   WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
| #   General Public License for more details. | ||||
| # | ||||
| #   You should have received a copy of the GNU General Public License | ||||
| #   along with this program; if not, write to the Free Software | ||||
| #   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||||
| #   02111-1307, USA. | ||||
| # | ||||
| #   As a special exception, the respective Autoconf Macro's copyright | ||||
| #   owner gives unlimited permission to copy, distribute and modify the | ||||
| #   configure scripts that are the output of Autoconf when processing | ||||
| #   the Macro. You need not follow the terms of the GNU General Public | ||||
| #   License when using or distributing such scripts, even though | ||||
| #   portions of the text of the Macro appear in them. The GNU General | ||||
| #   Public License (GPL) does govern all other use of the material that | ||||
| #   constitutes the Autoconf Macro. | ||||
| # | ||||
| #   This special exception to the GPL applies to versions of the | ||||
| #   Autoconf Macro released by the Autoconf Macro Archive. When you | ||||
| #   make and distribute a modified version of the Autoconf Macro, you | ||||
| #   may extend this special exception to the GPL to apply to your | ||||
| #   modified version as well. | ||||
|  | ||||
| AC_DEFUN([TYPE_SOCKLEN_T], | ||||
| [AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, | ||||
|   | ||||
							
								
								
									
										14
									
								
								svnignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								svnignore
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| .deps | ||||
| .dirstamp | ||||
| .libs | ||||
| .*.swp | ||||
| *~ | ||||
| Makefile | ||||
| Makefile.in | ||||
| aclocal.m4 | ||||
| autoconfig.h* | ||||
| autom4te.cache | ||||
| config* | ||||
| libtool | ||||
| libupnp.pc | ||||
| stamp-h* | ||||
| @@ -6,7 +6,6 @@ | ||||
| # | ||||
|  | ||||
| AM_CPPFLAGS		= -I$(srcdir)/inc -I$(srcdir)/src/inc | ||||
| AM_CFLAGS		= $(PTHREAD_CFLAGS) | ||||
|  | ||||
| if ENABLE_DEBUG | ||||
|     AM_CPPFLAGS		+= -DDEBUG -DSTATS | ||||
| @@ -21,12 +20,11 @@ libthreadutil_la_LDFLAGS = -version-info $(LT_VERSION_THREADUTIL) | ||||
|  | ||||
| libthreadutil_la_SOURCES = \ | ||||
| 			src/FreeList.c src/LinkedList.c \ | ||||
| 			src/ThreadPool.c src/TimerThread.c \ | ||||
| 			src/iasnprintf.c | ||||
| 			src/ThreadPool.c src/TimerThread.c | ||||
|  | ||||
| upnpincludedir		= $(includedir)/upnp | ||||
| upnpinclude_HEADERS	= \ | ||||
| 			inc/FreeList.h inc/LinkedList.h \ | ||||
| 			inc/ThreadPool.h inc/TimerThread.h \ | ||||
| 			inc/iasnprintf.h inc/ithread.h | ||||
| 			inc/ithread.h | ||||
|  | ||||
|   | ||||
| @@ -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. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef FREE_LIST_H | ||||
| #define FREE_LIST_H | ||||
| @@ -36,9 +36,6 @@ | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| //#include <malloc.h> | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include <errno.h> | ||||
|  | ||||
| @@ -52,7 +49,7 @@ extern "C" { | ||||
|  *****************************************************************************/ | ||||
| typedef struct FREELISTNODE | ||||
| { | ||||
| 	struct FREELISTNODE*next; //pointer to next free node | ||||
| 	struct FREELISTNODE *next; | ||||
| } FreeListNode; | ||||
|  | ||||
|  | ||||
| @@ -65,12 +62,10 @@ typedef struct FREELISTNODE | ||||
|  *****************************************************************************/ | ||||
| typedef struct FREELIST | ||||
| { | ||||
| 	FreeListNode *head; //head of free list | ||||
| 	size_t element_size;	//size of elements in free  | ||||
|  							//list | ||||
|  	int maxFreeListLength; //max size of free structures  | ||||
| 						 //to keep | ||||
| 	int freeListLength; //current size of free list | ||||
| 	FreeListNode *head; | ||||
| 	size_t element_size; | ||||
|  	int maxFreeListLength; | ||||
| 	int freeListLength; | ||||
|          | ||||
| }FreeList; | ||||
|  | ||||
| @@ -141,4 +136,5 @@ int FreeListDestroy (FreeList *free_list); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif // FREE_LIST_H | ||||
| #endif /* FREE_LIST_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,33 +1,33 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * * Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * * Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * * Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef LINKED_LIST_H | ||||
| #define LINKED_LIST_H | ||||
| @@ -70,9 +70,9 @@ typedef int (*cmp_routine)(void *itemA,void *itemB); | ||||
|  *****************************************************************************/ | ||||
| typedef struct LISTNODE | ||||
| { | ||||
|   struct LISTNODE *prev; //previous node | ||||
|   struct LISTNODE *next; //next node | ||||
|   void *item; //item | ||||
|   struct LISTNODE *prev; | ||||
|   struct LISTNODE *next; | ||||
|   void *item; | ||||
| } ListNode; | ||||
|  | ||||
| /**************************************************************************** | ||||
| @@ -96,12 +96,12 @@ typedef struct LISTNODE | ||||
|  *****************************************************************************/ | ||||
| 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 | ||||
|   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 */ | ||||
| } LinkedList; | ||||
|  | ||||
| /**************************************************************************** | ||||
| @@ -327,4 +327,5 @@ int ListSize(LinkedList* list); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif //LINKED_LIST_H | ||||
| #endif /* LINKED_LIST_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,107 +1,162 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * * Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * * Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * * Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef THREADPOOL_H | ||||
| #define THREADPOOL_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "FreeList.h" | ||||
| #include "ithread.h" | ||||
| #include "LinkedList.h" | ||||
| #include "UpnpInet.h" | ||||
| #include "UpnpGlobal.h" /* for UPNP_INLINE, EXPORT_SPEC */ | ||||
|  | ||||
|  | ||||
| #include <errno.h> | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#include <time.h> | ||||
| 	struct timezone | ||||
| 	{ | ||||
| 		int  tz_minuteswest; /* minutes W of Greenwich */ | ||||
| 		int  tz_dsttime;     /* type of dst correction */ | ||||
| 	}; | ||||
| 	int gettimeofday(struct timeval *tv, struct timezone *tz); | ||||
| #else /* WIN32 */ | ||||
| 	#include <sys/param.h> | ||||
| 	#include <sys/time.h> /* for gettimeofday() */ | ||||
| 	#if defined(__OSX__) || defined(__APPLE__) || defined(__NetBSD__) | ||||
| 		#include <sys/resource.h>	/* for setpriority() */ | ||||
| 	#endif | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| //Size of job free list | ||||
|  | ||||
| /*! Size of job free list */ | ||||
| #define JOBFREELISTSIZE 100 | ||||
|  | ||||
|  | ||||
| #define INFINITE_THREADS -1 | ||||
|  | ||||
|  | ||||
| #define EMAXTHREADS (-8 & 1<<29) | ||||
|  | ||||
| //Invalid Policy | ||||
|  | ||||
| /*! Invalid Policy */ | ||||
| #define INVALID_POLICY (-9 & 1<<29) | ||||
|  | ||||
| //Invalid JOB Id | ||||
|  | ||||
| /*! Invalid JOB Id */ | ||||
| #define INVALID_JOB_ID (-2 & 1<<29) | ||||
|  | ||||
| typedef enum duration {SHORT_TERM,PERSISTENT} Duration; | ||||
|  | ||||
| typedef enum priority {LOW_PRIORITY, | ||||
| 		       MED_PRIORITY, | ||||
| 		       HIGH_PRIORITY} ThreadPriority; | ||||
|  | ||||
| #define DEFAULT_PRIORITY MED_PRIORITY //default priority used by TPJobInit | ||||
| #define DEFAULT_MIN_THREADS 1	      //default minimum used by TPAttrInit | ||||
| #define DEFAULT_MAX_THREADS 10	      //default max used by TPAttrInit	 | ||||
| #define DEFAULT_JOBS_PER_THREAD 10    //default jobs per thread used by TPAttrInit | ||||
| #define DEFAULT_STARVATION_TIME	500   //default starvation time used by TPAttrInit | ||||
| #define DEFAULT_IDLE_TIME 10 * 1000   //default idle time used by TPAttrInit | ||||
| #define DEFAULT_FREE_ROUTINE NULL     //default free routine used TPJobInit | ||||
| #define DEFAULT_MAX_JOBS_TOTAL 100    //default max jobs used TPAttrInit | ||||
|  | ||||
| #define STATS 1 //always include stats because code change is minimal | ||||
| typedef enum duration { | ||||
| 	SHORT_TERM, | ||||
| 	PERSISTENT | ||||
| } Duration; | ||||
|  | ||||
|  | ||||
| //Statistics | ||||
| #ifdef WIN32 // todo: check why STATSONLY fails during compilation | ||||
|  #undef STATS | ||||
| #endif | ||||
| 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 jobs per thread used by TPAttrInit */ | ||||
| #define DEFAULT_JOBS_PER_THREAD 10 | ||||
|  | ||||
|  | ||||
| /*! default starvation time used by TPAttrInit */ | ||||
| #define DEFAULT_STARVATION_TIME	500 | ||||
|  | ||||
|  | ||||
| /*! default idle time used by TPAttrInit */ | ||||
| #define DEFAULT_IDLE_TIME 10 * 1000 | ||||
|  | ||||
|  | ||||
| /*! default free routine used TPJobInit */ | ||||
| #define DEFAULT_FREE_ROUTINE NULL | ||||
|  | ||||
|  | ||||
| /*! default max jobs used TPAttrInit */ | ||||
| #define DEFAULT_MAX_JOBS_TOTAL 100 | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Statistics. | ||||
|  * | ||||
|  * Always include stats because code change is minimal. | ||||
|  */ | ||||
| #define STATS 1 | ||||
|  | ||||
| #ifdef STATS | ||||
|  #define STATSONLY(x) x | ||||
| #else | ||||
|  #define STATSONLY(x) | ||||
| #endif | ||||
|  | ||||
| #ifdef _DEBUG | ||||
|  #define DEBUG 1 | ||||
| 	#define DEBUG 1 | ||||
| #endif | ||||
|  | ||||
| //DEBUGGING | ||||
| #ifndef WIN32 | ||||
|  #ifdef DEBUG | ||||
|   #define DBGONLY(x) x | ||||
|  #else | ||||
|   #define DBGONLY(x) | ||||
|  #endif | ||||
| #endif | ||||
|  | ||||
| #include "LinkedList.h" | ||||
| #include <sys/timeb.h> | ||||
| #include "FreeList.h" | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include <errno.h> | ||||
| #include <sys/timeb.h> | ||||
| #define EXPORT | ||||
| typedef int PolicyType; | ||||
|  | ||||
|  | ||||
| #define DEFAULT_POLICY SCHED_OTHER | ||||
| #define DEFAULT_SCHED_PARAM 0 //default priority | ||||
|  | ||||
|  | ||||
| /*! Default priority */ | ||||
| #define DEFAULT_SCHED_PARAM 0 | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: free_routine | ||||
| @@ -111,6 +166,7 @@ typedef int PolicyType; | ||||
|  *****************************************************************************/ | ||||
| typedef void (*free_routine)(void *arg); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPoolAttr | ||||
|  * | ||||
| @@ -120,28 +176,31 @@ typedef void (*free_routine)(void *arg); | ||||
|  *****************************************************************************/ | ||||
| typedef struct THREADPOOLATTR | ||||
| { | ||||
|   int minThreads;     // minThreads, ThreadPool will always maintain at least | ||||
|                       // this many threads | ||||
| 	/* minThreads, ThreadPool will always maintain at least this many threads */ | ||||
| 	int minThreads; | ||||
|  | ||||
|   int maxThreads;     // maxThreads, ThreadPool will never have more than this | ||||
|                       // number of threads | ||||
| 	/* maxThreads, ThreadPool will never have more than this number of threads */ | ||||
| 	int maxThreads; | ||||
|  | ||||
|   int maxIdleTime;    // maxIdleTime (in milliseconds) | ||||
|                       // this is the maximum time a thread will remain idle | ||||
|                       // before dying | ||||
| 	/* maxIdleTime (in milliseconds) this is the maximum time a thread will | ||||
| 	 * remain idle before dying */ | ||||
| 	int maxIdleTime; | ||||
|  | ||||
|   int jobsPerThread;  // jobs per thread to maintain | ||||
| 	/* jobs per thread to maintain */ | ||||
| 	int jobsPerThread; | ||||
|  | ||||
|   int maxJobsTotal;   // maximum number of jobs that can be queued totally. | ||||
| 	/* maximum number of jobs that can be queued totally. */ | ||||
| 	int maxJobsTotal; | ||||
|  | ||||
|   int starvationTime; // the time a low priority or med priority | ||||
| 	              // job waits before getting bumped | ||||
|                       // up a priority (in milliseconds) | ||||
|  | ||||
|   PolicyType schedPolicy; // scheduling policy to use | ||||
| 	/* the time a low priority or med priority job waits before getting bumped | ||||
| 	 * up a priority (in milliseconds) */ | ||||
| 	int starvationTime; | ||||
|  | ||||
| 	/* scheduling policy to use */ | ||||
| 	PolicyType schedPolicy; | ||||
| } ThreadPoolAttr; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPool | ||||
|  * | ||||
| @@ -150,92 +209,80 @@ typedef struct THREADPOOLATTR | ||||
|  *****************************************************************************/ | ||||
| typedef struct THREADPOOLJOB | ||||
| { | ||||
|   start_routine func; //function | ||||
|   void *arg;          //arg | ||||
|   free_routine free_func; //free function | ||||
|   struct timeb requestTime; //time of request | ||||
|   int priority;       //priority of request | ||||
|   int jobId;         //id | ||||
| 	start_routine func; | ||||
| 	void *arg; | ||||
| 	free_routine free_func; | ||||
| 	struct timeval requestTime; | ||||
| 	int priority; | ||||
| 	int jobId; | ||||
| } ThreadPoolJob; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPoolStats | ||||
|  * | ||||
|  *  Description: | ||||
|  *     Structure to hold statistics | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| STATSONLY( | ||||
|  | ||||
| typedef struct TPOOLSTATS | ||||
| { | ||||
|   double totalTimeHQ; //total time spent by all jobs in high priority Q | ||||
|   int totalJobsHQ;    //total jobs in HQ run so far | ||||
|   double avgWaitHQ;   //average wait in HQ | ||||
|   double totalTimeMQ; //total time spent by all jobs in med priority Q | ||||
|   int totalJobsMQ;    //total jobs in MQ run so far | ||||
|   double avgWaitMQ;   //average wait in MQ | ||||
|   double totalTimeLQ; //total time spent by all jobs in low priority Q | ||||
|   int totalJobsLQ;    //total jobs in LQ run so far | ||||
|   double avgWaitLQ;	//average wait in LQ | ||||
|   double totalWorkTime; //total time spent working for all threads | ||||
|   double totalIdleTime; //total time spent idle for all threads | ||||
|   int workerThreads; //number of current workerThreads | ||||
|   int idleThreads;   //number of current idle threads | ||||
|   int persistentThreads; //number of persistent threads | ||||
|   int totalThreads; //total number of current threads | ||||
|   int maxThreads; //max threads so far | ||||
|   int currentJobsHQ; // current jobs in Q | ||||
|   int currentJobsLQ; //current jobs in Q | ||||
|   int currentJobsMQ; //current jobs in Q | ||||
| }ThreadPoolStats; | ||||
|  | ||||
| ) | ||||
| 	double totalTimeHQ; | ||||
| 	int totalJobsHQ; | ||||
| 	double avgWaitHQ; | ||||
| 	double totalTimeMQ; | ||||
| 	int totalJobsMQ; | ||||
| 	double avgWaitMQ; | ||||
| 	double totalTimeLQ; | ||||
| 	int totalJobsLQ; | ||||
| 	double avgWaitLQ; | ||||
| 	double totalWorkTime; | ||||
| 	double totalIdleTime; | ||||
| 	int workerThreads; | ||||
| 	int idleThreads; | ||||
| 	int persistentThreads; | ||||
| 	int totalThreads; | ||||
| 	int maxThreads; | ||||
| 	int currentJobsHQ; | ||||
| 	int currentJobsLQ; | ||||
| 	int currentJobsMQ; | ||||
| } ThreadPoolStats; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ThreadPool | ||||
| /*! | ||||
|  * \brief A thread pool similar to the thread pool in the UPnP SDK. | ||||
|  * | ||||
|  *  Description: | ||||
|  *     A thread pool similar to the thread pool in the UPnP SDK. | ||||
|  *     Allows jobs to be scheduled for running by threads in a  | ||||
|  *     thread pool. The thread pool is initialized with a  | ||||
|  *     minimum and maximum thread number as well as a  | ||||
|  *	   max idle time | ||||
|  *     and a jobs per thread ratio. If a worker thread waits the whole | ||||
|  *     max idle time without receiving a job and the thread pool | ||||
|  *     currently has more threads running than the minimum | ||||
|  *     then the worker thread will exit. If when  | ||||
|  *     scheduling a job the current job to thread ratio | ||||
|  *     becomes greater than the set ratio and the thread pool currently has | ||||
|  *     less than the maximum threads then a new thread will | ||||
|  *     be created. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
|  | ||||
|  * Allows jobs to be scheduled for running by threads in a  | ||||
|  * thread pool. The thread pool is initialized with a  | ||||
|  * minimum and maximum thread number as well as a max idle time | ||||
|  * and a jobs per thread ratio. If a worker thread waits the whole | ||||
|  * max idle time without receiving a job and the thread pool | ||||
|  * currently has more threads running than the minimum | ||||
|  * then the worker thread will exit. If when  | ||||
|  * scheduling a job the current job to thread ratio | ||||
|  * becomes greater than the set ratio and the thread pool currently has | ||||
|  * less than the maximum threads then a new thread will | ||||
|  * be created. | ||||
|  */ | ||||
| typedef struct THREADPOOL | ||||
| { | ||||
|   ithread_mutex_t mutex; //mutex to protect job qs | ||||
|   ithread_cond_t condition; //condition variable to signal Q | ||||
|   ithread_cond_t start_and_shutdown; //condition variable for start  | ||||
|                                      //and stop      | ||||
|   int lastJobId; //ids for jobs  | ||||
|   int shutdown;   //whether or not we are shutting down | ||||
|   int totalThreads;       //total number of threads	 | ||||
|   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  | ||||
|   STATSONLY(ThreadPoolStats stats;) | ||||
|   | ||||
| } 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 */ | ||||
| 	ThreadPoolStats stats; | ||||
| } ThreadPool; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
| @@ -274,8 +321,8 @@ typedef struct THREADPOOL | ||||
|  *      INVALID_POLICY if schedPolicy can't be set | ||||
|  *      EMAXTHREADS if minimum threads is greater than maximum threads | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolInit(ThreadPool *tp, | ||||
|   ThreadPoolAttr *attr); | ||||
| int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolAddPersistent | ||||
| @@ -297,9 +344,8 @@ int ThreadPoolInit(ThreadPool *tp, | ||||
|  *      EOUTOFMEM not enough memory to add job. | ||||
|  *      EMAXTHREADS not enough threads to add persistent job. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolAddPersistent (ThreadPool*tp, | ||||
|   ThreadPoolJob *job, | ||||
|   int *jobId); | ||||
| int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolGetAttr | ||||
| @@ -314,8 +360,9 @@ int ThreadPoolAddPersistent (ThreadPool*tp, | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolGetAttr(ThreadPool *tp, | ||||
|   ThreadPoolAttr *out); | ||||
| int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolSetAttr | ||||
|  * | ||||
| @@ -329,8 +376,8 @@ int ThreadPoolGetAttr(ThreadPool *tp, | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      Returns INVALID_POLICY if policy can not be set. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolSetAttr(ThreadPool *tp, | ||||
|   ThreadPoolAttr *attr); | ||||
| int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolAdd | ||||
| @@ -349,9 +396,8 @@ int ThreadPoolSetAttr(ThreadPool *tp, | ||||
|  *      0 on success, nonzero on failure | ||||
|  *      EOUTOFMEM if not enough memory to add job. | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolAdd (ThreadPool*tp, | ||||
|   ThreadPoolJob *job, | ||||
|   int *jobId); | ||||
| int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolRemove | ||||
| @@ -368,8 +414,7 @@ int ThreadPoolAdd (ThreadPool*tp, | ||||
|  *      0 on success, nonzero on failure. | ||||
|  *      INVALID_JOB_ID if job not found.  | ||||
|  *****************************************************************************/ | ||||
| int ThreadPoolRemove(ThreadPool *tp, | ||||
|   int jobId, ThreadPoolJob *out); | ||||
| int ThreadPoolRemove(ThreadPool *tp, int jobId, ThreadPoolJob *out); | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -406,6 +451,7 @@ int ThreadPoolShutdown(ThreadPool *tp); | ||||
|  *****************************************************************************/ | ||||
| int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPJobSetPriority | ||||
|  * | ||||
| @@ -419,6 +465,7 @@ int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg); | ||||
|  *****************************************************************************/ | ||||
| int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPJobSetFreeFunction | ||||
|  * | ||||
| @@ -446,6 +493,7 @@ int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrInit(ThreadPoolAttr *attr); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetMaxThreads | ||||
|  * | ||||
| @@ -459,6 +507,7 @@ int TPAttrInit(ThreadPoolAttr *attr); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetMinThreads | ||||
|  * | ||||
| @@ -472,6 +521,7 @@ int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetIdleTime | ||||
|  * | ||||
| @@ -484,6 +534,7 @@ int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetJobsPerThread | ||||
|  * | ||||
| @@ -497,6 +548,7 @@ int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetStarvationTime | ||||
|  * | ||||
| @@ -510,6 +562,7 @@ int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: TPAttrSetSchedPolicy | ||||
|  * | ||||
| @@ -537,6 +590,7 @@ int TPAttrSetSchedPolicy(ThreadPoolAttr *attr, PolicyType schedPolicy); | ||||
|  *****************************************************************************/ | ||||
| int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal); | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ThreadPoolGetStats | ||||
|  * | ||||
| @@ -550,12 +604,21 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal); | ||||
|  *  Returns: | ||||
|  *      Always returns 0. | ||||
|  *****************************************************************************/ | ||||
| STATSONLY( EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);); | ||||
| #ifdef STATS | ||||
| 	EXPORT_SPEC int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats); | ||||
|  | ||||
| 	EXPORT_SPEC void ThreadPoolPrintStats(ThreadPoolStats *stats); | ||||
| #else | ||||
| 	static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {} | ||||
|  | ||||
| 	static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {} | ||||
| #endif | ||||
|  | ||||
| STATSONLY(EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats);); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif //ThreadPool | ||||
|  | ||||
| #endif /* THREADPOOL_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,33 +1,33 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * * Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * * Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * * Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef TIMERTHREAD_H | ||||
| #define TIMERTHREAD_H | ||||
| @@ -43,9 +43,9 @@ extern "C" { | ||||
|  | ||||
| #define INVALID_EVENT_ID (-10 & 1<<29) | ||||
|  | ||||
| //Timeout Types | ||||
| //absolute means in seconds from Jan 1, 1970 | ||||
| //relative means in seconds from current time | ||||
| /* 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; | ||||
|  | ||||
|  | ||||
| @@ -63,13 +63,13 @@ typedef enum timeoutType {ABS_SEC,REL_SEC} TimeoutType; | ||||
|  *****************************************************************************/ | ||||
| typedef struct TIMERTHREAD | ||||
| { | ||||
|   ithread_mutex_t mutex; //mutex to protect eventQ | ||||
|   ithread_cond_t condition; //condition variable | ||||
|   int lastEventId;	//last event id | ||||
|   LinkedList eventQ; //event q | ||||
|   int shutdown;      //whether or not we are shutdown   | ||||
|   FreeList freeEvents; //FreeList for events | ||||
|   ThreadPool *tp;	 //ThreadPool to use | ||||
|   ithread_mutex_t mutex; | ||||
|   ithread_cond_t condition; | ||||
|   int lastEventId; | ||||
|   LinkedList eventQ; | ||||
|   int shutdown; | ||||
|   FreeList freeEvents; | ||||
|   ThreadPool *tp; | ||||
| } TimerThread; | ||||
|  | ||||
|  | ||||
| @@ -85,9 +85,9 @@ typedef struct TIMERTHREAD | ||||
| typedef struct TIMEREVENT | ||||
| { | ||||
|   ThreadPoolJob job; | ||||
|   time_t eventTime; //absolute time for event in seconds since Jan 1, 1970 | ||||
|   Duration persistent;          //long term or short term job | ||||
|   int id;                //id of job | ||||
|   time_t eventTime; /* absolute time for event in seconds since Jan 1, 1970 */ | ||||
|   Duration persistent;  /* long term or short term job */ | ||||
|   int id; | ||||
| } TimerEvent; | ||||
|  | ||||
|  | ||||
| @@ -188,4 +188,5 @@ int TimerThreadShutdown(TimerThread *timer); | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif //TIMER_THREAD_H | ||||
| #endif /* TIMER_THREAD_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,66 +0,0 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #include <stdarg.h> | ||||
|  | ||||
| #define EXPORT | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Allocates enough memory for the | ||||
|  * Formatted string, up to max | ||||
|  * specified. | ||||
|  * With max set to -1, allocates | ||||
|  * as much size as needed. | ||||
|  * Memory must be freed using free. | ||||
|  */ | ||||
|  | ||||
| EXPORT int iasnprintf(char **ret, | ||||
| 	       int incr, | ||||
| 	       int max, | ||||
| 	       const char * fmt, ...) | ||||
| #ifndef SPARC_SOLARIS | ||||
|  #if (__GNUC__ >= 3) | ||||
| 	__attribute__((format (__printf__, 4, 5))); | ||||
|  #else | ||||
|  ; | ||||
|  #endif | ||||
|  EXPORT void iasnprintfFree(char *); | ||||
| #else | ||||
| ; | ||||
| #endif | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
| @@ -1,174 +1,309 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * * Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * * Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * * Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef ITHREAD_H | ||||
| #define ITHREAD_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #if !defined(WIN32) | ||||
| 	#include <sys/param.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #include "UpnpGlobal.h" /* For UPNP_INLINE, EXPORT_SPEC */ | ||||
|  | ||||
|  | ||||
| #ifndef ITHREADH | ||||
| #define ITHREADH | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef DEBUG | ||||
| #define DEBUG_ONLY(x) x | ||||
| #include <pthread.h> | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| #define DEBUG_ONLY(x) | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
|  | ||||
| #include <pthread.h> | ||||
| #ifndef WIN32 | ||||
|  #include <unistd.h> | ||||
|  | ||||
| #if defined(BSD) | ||||
| 	#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef PTHREAD_MUTEX_RECURSIVE | ||||
| /* This system has SuS2-compliant mutex attributes. | ||||
|  * E.g. on Cygwin, where we don't have the old nonportable (NP) symbols | ||||
|  */ | ||||
| #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL | ||||
| #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE | ||||
| #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK | ||||
| #else | ||||
| #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP | ||||
| #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP | ||||
| #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP | ||||
| #endif | ||||
| 	/* This system has SuS2-compliant mutex attributes. | ||||
| 	 * E.g. on Cygwin, where we don't have the old nonportable (NP) symbols | ||||
| 	 */ | ||||
| 	#define ITHREAD_MUTEX_FAST_NP       PTHREAD_MUTEX_NORMAL | ||||
| 	#define ITHREAD_MUTEX_RECURSIVE_NP  PTHREAD_MUTEX_RECURSIVE | ||||
| 	#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK | ||||
| #else /* PTHREAD_MUTEX_RECURSIVE */ | ||||
| 	#define ITHREAD_MUTEX_FAST_NP       PTHREAD_MUTEX_FAST_NP | ||||
| 	#define ITHREAD_MUTEX_RECURSIVE_NP  PTHREAD_MUTEX_RECURSIVE_NP | ||||
| 	#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP | ||||
| #endif /* PTHREAD_MUTEX_RECURSIVE */ | ||||
|  | ||||
|  | ||||
| #define ITHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE | ||||
| #define ITHREAD_PROCESS_SHARED  PTHREAD_PROCESS_SHARED | ||||
|  | ||||
|  | ||||
| #define ITHREAD_CANCELED PTHREAD_CANCELED | ||||
|  | ||||
|    | ||||
|   /*************************************************************************** | ||||
|    * Name: ithread_t | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Thread handle. | ||||
|    *      typedef to pthread_t. | ||||
|    *      Internal Use Only. | ||||
|    ***************************************************************************/ | ||||
|   typedef pthread_t ithread_t;  | ||||
|    | ||||
|   /**************************************************************************** | ||||
|    * Name: ithread_attr_t | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Thread attribute. | ||||
|    *      typedef to pthread_attr_t | ||||
|    *      Internal Use Only | ||||
|    ***************************************************************************/ | ||||
|   typedef pthread_attr_t ithread_attr_t;	 | ||||
|  | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Name: start_routine | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Thread start routine  | ||||
|    *      Internal Use Only. | ||||
|    ***************************************************************************/ | ||||
|   typedef void * (*start_routine) (void *arg); | ||||
| /*************************************************************************** | ||||
|  * Name: ithread_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Thread handle. | ||||
|  *      typedef to pthread_t. | ||||
|  *      Internal Use Only. | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_t ithread_t; | ||||
|  | ||||
|    | ||||
|   /**************************************************************************** | ||||
|    * Name: ithread_cond_t | ||||
|    * | ||||
|    *  Description: | ||||
|    *      condition variable. | ||||
|    *      typedef to pthread_cond_t | ||||
|    *      Internal Use Only. | ||||
|    ***************************************************************************/ | ||||
|   typedef pthread_cond_t ithread_cond_t; | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_attr_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Thread attribute. | ||||
|  *      typedef to pthread_attr_t | ||||
|  *      Internal Use Only | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_attr_t ithread_attr_t;	 | ||||
|  | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Name: ithread_mutexattr_t | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Mutex attribute. | ||||
|    *      typedef to pthread_mutexattr_t | ||||
|    *      Internal Use Only | ||||
|    ***************************************************************************/ | ||||
|   typedef pthread_mutexattr_t ithread_mutexattr_t;	 | ||||
| /**************************************************************************** | ||||
|  * Name: start_routine | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Thread start routine  | ||||
|  *      Internal Use Only. | ||||
|  ***************************************************************************/ | ||||
| typedef void *(*start_routine)(void *arg); | ||||
|  | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Name: ithread_mutex_t | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Mutex. | ||||
|    *      typedef to pthread_mutex_t | ||||
|    *      Internal Use Only. | ||||
|    ***************************************************************************/ | ||||
|   typedef pthread_mutex_t ithread_mutex_t; | ||||
|  | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Name: ithread_condattr_t | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Condition attribute. | ||||
|    *      typedef to pthread_condattr_t | ||||
|    *      NOT USED | ||||
|    *      Internal Use Only | ||||
|    ***************************************************************************/ | ||||
|   typedef pthread_condattr_t ithread_condattr_t;	 | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Function: ithread_mutexattr_init | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Initializes a mutex attribute variable. | ||||
|    *      Used to set the type of the mutex. | ||||
|    *  Parameters: | ||||
|    *      ithread_mutexattr_init * attr (must be valid non NULL pointer to  | ||||
|    *                                     pthread_mutexattr_t) | ||||
|    *  Returns: | ||||
|    *      0 on success, Nonzero on failure. | ||||
|    *      Always returns 0. | ||||
|    *      See man page for pthread_mutexattr_init | ||||
|    ***************************************************************************/ | ||||
|    | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_cond_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      condition variable. | ||||
|  *      typedef to pthread_cond_t | ||||
|  *      Internal Use Only. | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_cond_t ithread_cond_t; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_mutexattr_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Mutex attribute. | ||||
|  *      typedef to pthread_mutexattr_t | ||||
|  *      Internal Use Only | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_mutexattr_t ithread_mutexattr_t;	 | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_mutex_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Mutex. | ||||
|  *      typedef to pthread_mutex_t | ||||
|  *      Internal Use Only. | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_mutex_t ithread_mutex_t; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_condattr_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Condition attribute. | ||||
|  *      typedef to pthread_condattr_t | ||||
|  *      NOT USED | ||||
|  *      Internal Use Only | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_condattr_t ithread_condattr_t;	 | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_rwlockattr_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Mutex attribute. | ||||
|  *      typedef to pthread_rwlockattr_t | ||||
|  *      Internal Use Only | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_rwlockattr_t ithread_rwlockattr_t;	 | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Name: ithread_rwlock_t | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Condition attribute. | ||||
|  *      typedef to pthread_rwlock_t | ||||
|  *      Internal Use Only | ||||
|  ***************************************************************************/ | ||||
| typedef pthread_rwlock_t ithread_rwlock_t; | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_initialize_library | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes the library. Does nothing in all implementations, except | ||||
|  *      when statically linked for WIN32. | ||||
|  *  Parameters: | ||||
|  *      none. | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  ***************************************************************************/ | ||||
| static UPNP_INLINE int ithread_initialize_library(void) { | ||||
| 	int ret = 0; | ||||
|  | ||||
| #if defined(WIN32) && defined(PTW32_STATIC_LIB) | ||||
| 	ret = !pthread_win32_process_attach_np(); | ||||
| #endif | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_cleanup_library | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Clean up library resources. Does nothing in all implementations, except | ||||
|  *      when statically linked for WIN32. | ||||
|  *  Parameters: | ||||
|  *      none. | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  ***************************************************************************/ | ||||
| static UPNP_INLINE int ithread_cleanup_library(void) { | ||||
| 	int ret = 0; | ||||
|  | ||||
| #if defined(WIN32) && defined(PTW32_STATIC_LIB) | ||||
| 	ret = !pthread_win32_process_detach_np(); | ||||
| #endif | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_initialize_thread | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes the thread. Does nothing in all implementations, except | ||||
|  *      when statically linked for WIN32. | ||||
|  *  Parameters: | ||||
|  *      none. | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  ***************************************************************************/ | ||||
| static UPNP_INLINE int ithread_initialize_thread(void) { | ||||
| 	int ret = 0; | ||||
|  | ||||
| #if defined(WIN32) && defined(PTW32_STATIC_LIB) | ||||
| 	ret = !pthread_win32_thread_attach_np(); | ||||
| #endif | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_cleanup_thread | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Clean up thread resources. Does nothing in all implementations, except | ||||
|  *      when statically linked for WIN32. | ||||
|  *  Parameters: | ||||
|  *      none. | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  ***************************************************************************/ | ||||
| static UPNP_INLINE int ithread_cleanup_thread(void) { | ||||
| 	int ret = 0; | ||||
|  | ||||
| #if defined(WIN32) && defined(PTW32_STATIC_LIB) | ||||
| 	ret = !pthread_win32_thread_detach_np(); | ||||
| #endif | ||||
|  | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_mutexattr_init | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes a mutex attribute variable. | ||||
|  *      Used to set the type of the mutex. | ||||
|  *  Parameters: | ||||
|  *      ithread_mutexattr_init * attr (must be valid non NULL pointer to  | ||||
|  *                                     pthread_mutexattr_t) | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_mutexattr_init | ||||
|  ***************************************************************************/ | ||||
| #define ithread_mutexattr_init pthread_mutexattr_init | ||||
|    | ||||
|   /**************************************************************************** | ||||
|    * Function: ithread_mutexattr_destroy | ||||
|    * | ||||
|    *  Description: | ||||
|    *      Releases any resources held by the mutex attribute. | ||||
|    *      Currently there are no resources associated with the attribute | ||||
|    *  Parameters: | ||||
|    *      ithread_mutexattr_t * attr (must be valid non NULL pointer to  | ||||
|    *                                  pthread_mutexattr_t) | ||||
|    *  Returns: | ||||
|    *      0 on success, Nonzero on failure. | ||||
|    *      Always returns 0. | ||||
|    *      See man page for pthread_mutexattr_destroy | ||||
|    ***************************************************************************/ | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_mutexattr_destroy | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Releases any resources held by the mutex attribute. | ||||
|  *      Currently there are no resources associated with the attribute | ||||
|  *  Parameters: | ||||
|  *      ithread_mutexattr_t * attr (must be valid non NULL pointer to  | ||||
|  *                                  pthread_mutexattr_t) | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_mutexattr_destroy | ||||
|  ***************************************************************************/ | ||||
| #define ithread_mutexattr_destroy pthread_mutexattr_destroy | ||||
|    | ||||
|    | ||||
| @@ -182,7 +317,7 @@ extern "C" { | ||||
|  *                       ITHREAD_MUTEX_ERRORCHECK_NP | ||||
|  * | ||||
|  *  Parameters: | ||||
|  *      ithread_mutexattr_t * mutex (must be valid non NULL pointer to  | ||||
|  *      ithread_mutexattr_t * attr (must be valid non NULL pointer to  | ||||
|  *                                   ithread_mutexattr_t) | ||||
|  *      int kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP | ||||
|  *                or ITHREAD_MUTEX_ERRORCHECK_NP) | ||||
| @@ -192,9 +327,9 @@ extern "C" { | ||||
|  *      See man page for pthread_mutexattr_setkind_np | ||||
|  *****************************************************************************/ | ||||
| #ifdef PTHREAD_MUTEX_RECURSIVE | ||||
| #define ithread_mutexattr_setkind_np pthread_mutexattr_settype | ||||
| 	#define ithread_mutexattr_setkind_np pthread_mutexattr_settype | ||||
| #else | ||||
| #define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np | ||||
| 	#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np | ||||
| #endif | ||||
|  | ||||
| /**************************************************************************** | ||||
| @@ -207,7 +342,7 @@ extern "C" { | ||||
|  *                       ITHREAD_MUTEX_ERRORCHECK_NP | ||||
|  * | ||||
|  *  Parameters: | ||||
|  *      ithread_mutexattr_t * mutex (must be valid non NULL pointer to  | ||||
|  *      ithread_mutexattr_t * attr (must be valid non NULL pointer to  | ||||
|  *                                   pthread_mutexattr_t) | ||||
|  *      int *kind (one of ITHREAD_MUTEX_FAST_NP or ITHREAD_MUTEX_RECURSIVE_NP | ||||
|  *                or ITHREAD_MUTEX_ERRORCHECK_NP) | ||||
| @@ -217,9 +352,9 @@ extern "C" { | ||||
|  *      See man page for pthread_mutexattr_getkind_np | ||||
|  *****************************************************************************/ | ||||
| #ifdef PTHREAD_MUTEX_RECURSIVE | ||||
| #define ithread_mutexattr_getkind_np pthread_mutexattr_gettype | ||||
| 	#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype | ||||
| #else | ||||
| #define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np | ||||
| 	#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np | ||||
| #endif | ||||
|  | ||||
|    | ||||
| @@ -239,7 +374,8 @@ extern "C" { | ||||
|  *      See man page for pthread_mutex_init | ||||
|  *****************************************************************************/ | ||||
| #define ithread_mutex_init pthread_mutex_init | ||||
|    | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_mutex_lock | ||||
|  * | ||||
| @@ -293,7 +429,170 @@ extern "C" { | ||||
|  *****************************************************************************/ | ||||
| #define ithread_mutex_destroy pthread_mutex_destroy | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlockattr_init | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes a rwlock attribute variable to default values. | ||||
|  *  Parameters: | ||||
|  *      const ithread_rwlockattr_init *attr (must be valid non NULL pointer to  | ||||
|  *                                           pthread_rwlockattr_t) | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlockattr_init | ||||
|  ***************************************************************************/ | ||||
| #define ithread_rwlockattr_init pthread_rwlockattr_init | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlockattr_destroy | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Releases any resources held by the rwlock attribute. | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlockattr_t *attr (must be valid non NULL pointer to  | ||||
|  *                                  pthread_rwlockattr_t) | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlockattr_destroy | ||||
|  ***************************************************************************/ | ||||
| #define ithread_rwlockattr_destroy pthread_rwlockattr_destroy | ||||
|    | ||||
|    | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlockatttr_setpshared | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Sets the rwlock type in the attribute. | ||||
|  *      Valid types are: ITHREAD_PROCESS_PRIVATE  | ||||
|  *                       ITHREAD_PROCESS_SHARED | ||||
|  * | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlockattr_t * attr (must be valid non NULL pointer to  | ||||
|  *                                   ithread_rwlockattr_t) | ||||
|  *      int kind (one of ITHREAD_PROCESS_PRIVATE or ITHREAD_PROCESS_SHARED) | ||||
|  * | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Returns EINVAL if the kind is not supported. | ||||
|  *      See man page for pthread_rwlockattr_setkind_np | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlockatttr_getpshared | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Gets the rwlock type in the attribute. | ||||
|  *      Valid types are: ITHREAD_PROCESS_PRIVATE  | ||||
|  *                       ITHREAD_PROCESS_SHARED  | ||||
|  * | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlockattr_t * attr (must be valid non NULL pointer to  | ||||
|  *                                   pthread_rwlockattr_t) | ||||
|  *      int *kind (one of ITHREAD_PROCESS_PRIVATE or ITHREAD_PROCESS_SHARED) | ||||
|  * | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlockatttr_getpshared | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared | ||||
|  | ||||
|    | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlock_init | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Initializes rwlock. | ||||
|  *      Must be called before use. | ||||
|  *       | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t) | ||||
|  *      const ithread_rwlockattr_t *rwlock_attr  | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlock_init | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlock_init pthread_rwlock_init | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlock_rdlock | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Locks rwlock for reading. | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t) | ||||
|  *      rwlock must be initialized. | ||||
|  *       | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlock_rdlock | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlock_rdlock pthread_rwlock_rdlock | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlock_wrlock | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Locks rwlock for writting. | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t) | ||||
|  *      rwlock must be initialized. | ||||
|  *       | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlock_wrlock | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlock_wrlock pthread_rwlock_wrlock | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlock_unlock | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Unlocks rwlock. | ||||
|  * | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t) | ||||
|  *      rwlock must be initialized. | ||||
|  *       | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlock_unlock | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlock_unlock pthread_rwlock_unlock | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_rwlock_destroy | ||||
|  * | ||||
|  *  Description: | ||||
|  *      Releases any resources held by the rwlock.  | ||||
|  *		rwlock can no longer be used after this call. | ||||
|  *		rwlock is only destroyed when there are no longer any threads waiting on it.  | ||||
|  *		rwlock cannot be destroyed if it is locked. | ||||
|  *  Parameters: | ||||
|  *      ithread_rwlock_t *rwlock (must be valid non NULL pointer to pthread_rwlock_t) | ||||
|  *      rwlock must be initialized. | ||||
|  *  Returns: | ||||
|  *      0 on success. Nonzero on failure. | ||||
|  *      Always returns 0. | ||||
|  *      See man page for pthread_rwlock_destroy | ||||
|  *****************************************************************************/ | ||||
| #define ithread_rwlock_destroy pthread_rwlock_destroy | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_cond_init | ||||
|  * | ||||
| @@ -301,8 +600,8 @@ extern "C" { | ||||
|  *      Initializes condition variable. | ||||
|  *      Must be called before use. | ||||
|  *  Parameters: | ||||
|  *      ithread_cond_t * cond (must be valid non NULL pointer to pthread_cond_t) | ||||
|  *      const ithread_condattr_t * cond_attr (ignored) | ||||
|  *      ithread_cond_t *cond (must be valid non NULL pointer to pthread_cond_t) | ||||
|  *      const ithread_condattr_t *cond_attr (ignored) | ||||
|  *  Returns: | ||||
|  *      0 on success, Nonzero on failure. | ||||
|  *      See man page for pthread_cond_init | ||||
| @@ -310,7 +609,6 @@ extern "C" { | ||||
| #define ithread_cond_init pthread_cond_init | ||||
|  | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: ithread_cond_signal | ||||
|  * | ||||
| @@ -318,7 +616,7 @@ extern "C" { | ||||
|  *      Wakes up exactly one thread waiting on condition. | ||||
|  *      Associated mutex MUST be locked by thread before entering this call. | ||||
|  *  Parameters: | ||||
|  *      ithread_cond_t * cond (must be valid non NULL pointer to  | ||||
|  *      ithread_cond_t *cond (must be valid non NULL pointer to  | ||||
|  *      ithread_cond_t) | ||||
|  *      cond must be initialized | ||||
|  *  Returns: | ||||
| @@ -335,7 +633,7 @@ extern "C" { | ||||
|  *      Wakes up all threads waiting on condition. | ||||
|  *      Associated mutex MUST be locked by thread before entering this call. | ||||
|  *  Parameters: | ||||
|  *      ithread_cond_t * cond (must be valid non NULL pointer to  | ||||
|  *      ithread_cond_t *cond (must be valid non NULL pointer to  | ||||
|  *      ithread_cond_t) | ||||
|  *      cond must be initialized | ||||
|  *  Returns: | ||||
| @@ -353,7 +651,7 @@ extern "C" { | ||||
|  *      Associated mutex MUST be locked by thread before entering this call. | ||||
|  *      Mutex is reacquired when call returns. | ||||
|  *  Parameters: | ||||
|  *      ithread_cond_t * cond (must be valid non NULL pointer to  | ||||
|  *      ithread_cond_t *cond (must be valid non NULL pointer to  | ||||
|  *      ithread_cond_t) | ||||
|  *      cond must be initialized | ||||
|  *      ithread_mutex_t *mutex (must be valid non NULL pointer to  | ||||
| @@ -369,23 +667,19 @@ extern "C" { | ||||
|   /**************************************************************************** | ||||
|    * Function: pthread_cond_timedwait | ||||
|    * | ||||
|    *  Description:       | ||||
|    *      Atomically releases the associated mutex and waits on the condition.  | ||||
|    *		If the condition is not signaled in the specified time  | ||||
|    *              than the  | ||||
|    *		call times out and returns. | ||||
|    *		Associated mutex MUST be locked by thread before entering  | ||||
|    *              this call. | ||||
|    *      Mutex is reacquired when call returns. | ||||
|    *	Description:       | ||||
|    *		Atomically releases the associated mutex and waits on the | ||||
|    *	condition. | ||||
|    *		If the condition is not signaled in the specified time than the | ||||
|    *	call times out and returns. | ||||
|    *		Associated mutex MUST be locked by thread before entering this call. | ||||
|    *		Mutex is reacquired when call returns. | ||||
|    *  Parameters: | ||||
|    *      ithread_cond_t * cond (must be valid non NULL pointer to  | ||||
|    *      ithread_cond_t) | ||||
|    *      cond must be initialized | ||||
|    *      ithread_mutex_t *mutex (must be valid non NULL pointer to  | ||||
|    *      ithread_mutex_t) | ||||
|    *      Mutex must be locked. | ||||
|    *      const struct timespec *abstime (absolute time, measured  | ||||
|    *      from Jan 1, 1970) | ||||
|    *      ithread_cond_t *cond (must be valid non NULL pointer to ithread_cond_t) | ||||
|    *      	cond must be initialized | ||||
|    *      ithread_mutex_t *mutex (must be valid non NULL pointer to ithread_mutex_t) | ||||
|    *      	Mutex must be locked. | ||||
|    *      const struct timespec *abstime (absolute time, measured from Jan 1, 1970) | ||||
|    *  Returns: | ||||
|    *      0 on success. ETIMEDOUT on timeout. Nonzero on failure. | ||||
|    *      See man page for pthread_cond_timedwait | ||||
| @@ -401,7 +695,7 @@ extern "C" { | ||||
|    *      Releases any resources held by the condition variable.  | ||||
|    *		Condition variable can no longer be used after this call.	 | ||||
|    *  Parameters: | ||||
|    *      ithread_cond_t * cond (must be valid non NULL pointer to  | ||||
|    *      ithread_cond_t *cond (must be valid non NULL pointer to  | ||||
|    *      ithread_cond_t) | ||||
|    *      cond must be initialized. | ||||
|    *  Returns: | ||||
| @@ -457,6 +751,7 @@ extern "C" { | ||||
|    ***************************************************************************/ | ||||
| #define ithread_exit pthread_exit | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|    * Function: ithread_get_current_thread_id | ||||
|    * | ||||
| @@ -480,6 +775,7 @@ extern "C" { | ||||
|    ***************************************************************************/ | ||||
| #define ithread_self pthread_self | ||||
|  | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Function: ithread_detach | ||||
|    * | ||||
| @@ -493,6 +789,7 @@ extern "C" { | ||||
|    ***************************************************************************/ | ||||
| #define ithread_detach pthread_detach   | ||||
|  | ||||
|  | ||||
|   /**************************************************************************** | ||||
|    * Function: ithread_join | ||||
|    * | ||||
| @@ -512,7 +809,6 @@ extern "C" { | ||||
| #define ithread_join pthread_join | ||||
|    | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: isleep | ||||
|  * | ||||
| @@ -526,7 +822,12 @@ extern "C" { | ||||
|  *		0 on success, Nonzero on failure. | ||||
|  *              See man page for sleep (man 3 sleep) | ||||
|  *****************************************************************************/ | ||||
| #define isleep sleep | ||||
| #ifdef WIN32 | ||||
| 	#define isleep(x) Sleep((x)*1000) | ||||
| #else | ||||
| 	#define isleep sleep | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /**************************************************************************** | ||||
|  * Function: isleep | ||||
| @@ -541,31 +842,23 @@ extern "C" { | ||||
|  *		0 on success, Nonzero on failure. | ||||
|  *              See man page for sleep (man 3 sleep) | ||||
|  *****************************************************************************/ | ||||
| #define imillisleep(x) usleep(1000*x) | ||||
|  | ||||
| #ifdef WIN32 | ||||
|  #ifndef UPNP_STATIC_LIB | ||||
|   #ifdef LIBUPNP_EXPORTS | ||||
|    // set up declspec for dll export to make functions visible to library users | ||||
|    #define EXPORT_SPEC __declspec(dllexport) | ||||
|   #else | ||||
|    #define EXPORT_SPEC __declspec(dllimport) | ||||
|   #endif | ||||
|  #else | ||||
|   #define EXPORT_SPEC | ||||
|  #endif | ||||
| 	#define imillisleep Sleep | ||||
| #else | ||||
|  #define EXPORT_SPEC | ||||
| 	#define imillisleep(x) usleep(1000*x) | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifndef PTHREAD_MUTEX_RECURSIVE | ||||
| //NK: Added for satisfying the gcc compiler   | ||||
| /* NK: Added for satisfying the gcc compiler */ | ||||
| EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind); | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif //ITHREADH | ||||
|  | ||||
| #endif /* ITHREAD_H */ | ||||
|  | ||||
|   | ||||
| @@ -30,10 +30,13 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #include "LinkedList.h" | ||||
| #ifdef __FreeBSD__ | ||||
| #include <stdlib.h> | ||||
| #ifndef WIN32 | ||||
| 	#include <sys/param.h> | ||||
| #endif | ||||
| #if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__) | ||||
| 	#include <stdlib.h> | ||||
| #else | ||||
| #include <malloc.h> | ||||
| 	#include <malloc.h> | ||||
| #endif | ||||
| #include <assert.h> | ||||
|  | ||||
| @@ -531,3 +534,4 @@ ListSize( LinkedList * list ) | ||||
|  | ||||
|     return list->size; | ||||
| } | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,152 +0,0 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <assert.h> | ||||
| #ifdef __FreeBSD__ | ||||
| #include <stdlib.h> | ||||
| #else | ||||
| #include <malloc.h> | ||||
| #endif | ||||
| #include <stdio.h> | ||||
| #include "iasnprintf.h" | ||||
|  | ||||
| #ifndef NULL | ||||
| #define NULL 0 | ||||
| #endif | ||||
|  | ||||
| #ifdef WIN32 | ||||
|  #define vsnprintf _vsnprintf | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Allocates enough memory for the | ||||
|  * Formatted string, up to max | ||||
|  * specified. | ||||
|  * With max set to -1, it allocates as | ||||
|  * much size as needed. | ||||
|  * Memory must be freed using free. | ||||
|  */ | ||||
|  | ||||
| int | ||||
| iasnprintf( char **ret, | ||||
|             int incr, | ||||
|             int max, | ||||
|             const char *fmt, | ||||
|             ... ) | ||||
| { | ||||
|     int size = incr; | ||||
|     int retc = 0; | ||||
|     va_list ap; | ||||
|     char *temp = NULL; | ||||
|  | ||||
|     assert( ret ); | ||||
|     assert( fmt ); | ||||
|     ( *ret ) = ( char * )malloc( incr ); | ||||
|  | ||||
|     if( ( *ret ) == NULL ) return -1; | ||||
|  | ||||
|     while( 1 ) { | ||||
|         va_start( ap, fmt ); | ||||
|         retc = vsnprintf( ( *ret ), size, fmt, ap ); | ||||
|         va_end( ap ); | ||||
|  | ||||
|         if( retc < 0 ) { | ||||
|             //size not big enough | ||||
|             //and vsnprintf does NOT return the | ||||
|             //necessary number of bytes | ||||
|             if( ( max != -1 ) && ( size == max ) )  //max reached | ||||
|             { | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
|             incr *= 2;          //increase increment | ||||
|             //increase size and try again   | ||||
|             if( ( max != -1 ) && ( ( size + incr ) > max ) ) { | ||||
|                 incr = ( max - size ); | ||||
|             } | ||||
|  | ||||
|             temp = ( char * )realloc( ( *ret ), size + incr ); | ||||
|             if( temp == NULL ) { | ||||
|                 break; | ||||
|             } | ||||
|             size += incr; | ||||
|             ( *ret ) = temp; | ||||
|  | ||||
|         } else { | ||||
|             if( ( retc + 1 ) > size ) { | ||||
|                 //size not big enough | ||||
|                 //and vsnprintf  | ||||
|                 //returns the necessary  | ||||
|                 //number of bytes | ||||
|                 if( ( max != -1 ) && ( retc + 1 > max ) ) { | ||||
|                     retc = -1; | ||||
|                     break; | ||||
|                 } | ||||
|  | ||||
|                 temp = ( char * )realloc( ( *ret ), retc + 1 ); | ||||
|                 if( temp == NULL ) { | ||||
|                     retc = -1; | ||||
|                     break; | ||||
|                 } | ||||
|                 size = retc + 1; | ||||
|                 ( *ret ) = temp;    //size increased try again | ||||
|             } else if( ( retc + 1 ) < size ) { | ||||
|                 //size is bigger than needed | ||||
|                 //try and reallocate smaller | ||||
|  | ||||
|                 temp = ( char * )realloc( ( *ret ), retc + 1 ); | ||||
|                 if( temp != NULL ) { | ||||
|                     ( *ret ) = temp; | ||||
|                 } | ||||
|                 break; | ||||
|             } else              //size is just right, exit | ||||
|             { | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if( retc < 0 ) { | ||||
|         free( ( *ret ) ); | ||||
|         ( *ret ) = NULL; | ||||
|     } | ||||
|  | ||||
|     return retc; | ||||
| } | ||||
|  | ||||
| void | ||||
| iasnprintfFree( char *fChar ) | ||||
| { | ||||
|     free( fChar ); | ||||
|     fChar = NULL; | ||||
| } | ||||
							
								
								
									
										238
									
								
								upnp/Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										238
									
								
								upnp/Makefile.am
									
									
									
									
									
								
							| @@ -1,163 +1,161 @@ | ||||
| # $Id: Makefile.am,v 1.10 2006/04/08 15:22:22 r3mi Exp $ | ||||
| # | ||||
| # "Makefile.am" for "libupnp/upnp" | ||||
| # | ||||
| # Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net> | ||||
| # Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net> | ||||
| # | ||||
|  | ||||
| SUBDIRS 		= doc | ||||
| SUBDIRS = doc . sample | ||||
|  | ||||
| AM_CPPFLAGS		= -I$(srcdir)/inc \ | ||||
| 			  -I$(top_srcdir)/threadutil/inc \ | ||||
| 			  -I$(top_srcdir)/ixml/inc | ||||
| AM_CPPFLAGS = \ | ||||
| 	-I$(srcdir)/inc \ | ||||
| 	-I$(top_srcdir)/threadutil/inc \ | ||||
| 	-I$(top_srcdir)/ixml/inc | ||||
|  | ||||
| AM_CFLAGS		= $(PTHREAD_CFLAGS) | ||||
|  | ||||
| AM_LDFLAGS		= $(PTHREAD_LIBS) | ||||
|  | ||||
| LDADD			= libupnp.la \ | ||||
| 			  $(top_builddir)/threadutil/libthreadutil.la \ | ||||
| 			  $(top_builddir)/ixml/libixml.la | ||||
| LDADD = \ | ||||
| 	libupnp.la \ | ||||
| 	$(top_builddir)/threadutil/libthreadutil.la \ | ||||
| 	$(top_builddir)/ixml/libixml.la | ||||
|  | ||||
|  | ||||
| upnpincludedir          = $(includedir)/upnp | ||||
| upnpinclude_HEADERS     = inc/upnp.h  | ||||
| upnpincludedir = $(includedir)/upnp | ||||
| upnpinclude_HEADERS = \ | ||||
| 	inc/UpnpString.h \ | ||||
| 	inc/upnp.h \ | ||||
| 	inc/upnpdebug.h \ | ||||
| 	inc/UpnpGlobal.h \ | ||||
| 	inc/UpnpInet.h | ||||
|  | ||||
| nodist_upnpinclude_HEADERS = inc/upnpconfig.h  | ||||
| if ENABLE_TOOLS | ||||
| upnpinclude_HEADERS	+= inc/upnptools.h  | ||||
| endif | ||||
| if ENABLE_DEBUG | ||||
| upnpinclude_HEADERS	+= inc/upnpdebug.h | ||||
| upnpinclude_HEADERS += inc/upnptools.h  | ||||
| endif | ||||
|  | ||||
| lib_LTLIBRARIES		= libupnp.la | ||||
|  | ||||
| libupnp_la_CPPFLAGS	= $(AM_CPPFLAGS) -I$(srcdir)/src/inc  | ||||
| libupnp_la_LDFLAGS	= -version-info $(LT_VERSION_UPNP) \ | ||||
| 			  -export-symbols-regex '^Upnp.*' \ | ||||
| 			  $(top_builddir)/threadutil/libthreadutil.la \ | ||||
| 			  $(top_builddir)/ixml/libixml.la | ||||
| lib_LTLIBRARIES = libupnp.la | ||||
|  | ||||
| libupnp_la_SOURCES	= \ | ||||
| 			src/inc/config.h \ | ||||
| 			src/inc/client_table.h src/inc/global.h \ | ||||
| 			src/inc/md5.h src/inc/ssdplib.h \ | ||||
| 			src/inc/unixutil.h src/inc/urlconfig.h \ | ||||
| 			src/inc/gmtdate.h src/inc/membuffer.h \ | ||||
| 			src/inc/server.h src/inc/statcodes.h \ | ||||
| 			src/inc/upnpapi.h src/inc/utilall.h \ | ||||
| 			src/inc/gena_ctrlpt.h src/inc/http_client.h \ | ||||
| 			src/inc/miniserver.h src/inc/service_table.h \ | ||||
| 			src/inc/statuscodes.h src/inc/upnpclosesocket.h \ | ||||
| 			src/inc/util.h src/inc/gena_device.h \ | ||||
| 			src/inc/httpparser.h src/inc/netall.h \ | ||||
| 			src/inc/soaplib.h src/inc/strintmap.h \ | ||||
| 			src/inc/upnp_timeout.h src/inc/uuid.h \ | ||||
| 			src/inc/gena.h src/inc/httpreadwrite.h \ | ||||
| 			src/inc/parsetools.h src/inc/sock.h \ | ||||
| 			src/inc/sysdep.h src/inc/uri.h \ | ||||
| 			src/inc/webserver.h | ||||
| libupnp_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/src/inc  | ||||
|  | ||||
| libupnp_la_LDFLAGS = \ | ||||
| 	-version-info $(LT_VERSION_UPNP) \ | ||||
| 	-export-symbols-regex '^Upnp.*' \ | ||||
| 	$(top_builddir)/threadutil/libthreadutil.la \ | ||||
| 	$(top_builddir)/ixml/libixml.la | ||||
|  | ||||
| libupnp_la_SOURCES = \ | ||||
| 	src/inc/config.h \ | ||||
| 	src/inc/client_table.h \ | ||||
| 	src/inc/gena.h \ | ||||
| 	src/inc/gena_ctrlpt.h \ | ||||
| 	src/inc/gena_device.h \ | ||||
| 	src/inc/global.h \ | ||||
| 	src/inc/gmtdate.h \ | ||||
| 	src/inc/httpparser.h \ | ||||
| 	src/inc/httpreadwrite.h \ | ||||
| 	src/inc/md5.h \ | ||||
| 	src/inc/membuffer.h \ | ||||
| 	src/inc/miniserver.h \ | ||||
| 	src/inc/netall.h \ | ||||
| 	src/inc/parsetools.h \ | ||||
| 	src/inc/server.h \ | ||||
| 	src/inc/service_table.h \ | ||||
| 	src/inc/soaplib.h \ | ||||
| 	src/inc/sock.h \ | ||||
| 	src/inc/statcodes.h \ | ||||
| 	src/inc/statuscodes.h \ | ||||
| 	src/inc/strintmap.h \ | ||||
| 	src/inc/ssdplib.h \ | ||||
| 	src/inc/sysdep.h \ | ||||
| 	src/inc/unixutil.h \ | ||||
| 	src/inc/upnpapi.h \ | ||||
| 	src/inc/upnpclosesocket.h \ | ||||
| 	src/inc/upnp_timeout.h \ | ||||
| 	src/inc/uri.h \ | ||||
| 	src/inc/urlconfig.h \ | ||||
| 	src/inc/util.h \ | ||||
| 	src/inc/utilall.h \ | ||||
| 	src/inc/uuid.h \ | ||||
| 	src/inc/VirtualDir.h \ | ||||
| 	src/inc/webserver.h | ||||
|  | ||||
| # ssdp | ||||
| libupnp_la_SOURCES	+= src/ssdp/ssdp_device.c src/ssdp/ssdp_ctrlpt.c \ | ||||
| 			src/ssdp/ssdp_server.c | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/ssdp/ssdp_device.c \ | ||||
| 	src/ssdp/ssdp_ctrlpt.c \ | ||||
| 	src/ssdp/ssdp_server.c | ||||
|  | ||||
| # soap | ||||
| libupnp_la_SOURCES	+= src/soap/soap_device.c src/soap/soap_ctrlpt.c \ | ||||
| 			src/soap/soap_common.c | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/soap/soap_device.c \ | ||||
| 	src/soap/soap_ctrlpt.c \ | ||||
| 	src/soap/soap_common.c | ||||
|  | ||||
| # genlib | ||||
| libupnp_la_SOURCES	+= \ | ||||
| 			src/genlib/miniserver/miniserver.c \ | ||||
| 			src/genlib/service_table/service_table.c \ | ||||
| 			src/genlib/util/membuffer.c \ | ||||
| 			src/genlib/util/strintmap.c \ | ||||
| 			src/genlib/util/upnp_timeout.c \ | ||||
| 			src/genlib/util/util.c \ | ||||
| 			src/genlib/client_table/client_table.c \ | ||||
| 			src/genlib/net/sock.c \ | ||||
| 			src/genlib/net/http/httpparser.c \ | ||||
| 			src/genlib/net/http/httpreadwrite.c \ | ||||
| 			src/genlib/net/http/statcodes.c \ | ||||
| 			src/genlib/net/http/webserver.c \ | ||||
| 			src/genlib/net/http/parsetools.c \ | ||||
| 			src/genlib/net/uri/uri.c | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/genlib/miniserver/miniserver.c \ | ||||
| 	src/genlib/service_table/service_table.c \ | ||||
| 	src/genlib/util/membuffer.c \ | ||||
| 	src/genlib/util/strintmap.c \ | ||||
| 	src/genlib/util/upnp_timeout.c \ | ||||
| 	src/genlib/util/util.c \ | ||||
| 	src/genlib/client_table/client_table.c \ | ||||
| 	src/genlib/net/sock.c \ | ||||
| 	src/genlib/net/http/httpparser.c \ | ||||
| 	src/genlib/net/http/httpreadwrite.c \ | ||||
| 	src/genlib/net/http/statcodes.c \ | ||||
| 	src/genlib/net/http/webserver.c \ | ||||
| 	src/genlib/net/http/parsetools.c \ | ||||
| 	src/genlib/net/uri/uri.c | ||||
|  | ||||
| # gena | ||||
| libupnp_la_SOURCES	+= src/gena/gena_device.c src/gena/gena_ctrlpt.c \ | ||||
| 			src/gena/gena_callback2.c | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/gena/gena_device.c \ | ||||
| 	src/gena/gena_ctrlpt.c \ | ||||
| 	src/gena/gena_callback2.c | ||||
|  | ||||
| # api | ||||
| libupnp_la_SOURCES	+= src/api/upnpapi.c | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/api/UpnpString.c \ | ||||
| 	src/api/upnpapi.c | ||||
|  | ||||
| if ENABLE_TOOLS | ||||
|     libupnp_la_SOURCES	+= src/api/upnptools.c | ||||
| libupnp_la_SOURCES += src/api/upnptools.c | ||||
| endif | ||||
|  | ||||
| if ENABLE_DEBUG | ||||
|     libupnp_la_SOURCES	+= src/api/upnpdebug.c  | ||||
| libupnp_la_SOURCES += src/api/upnpdebug.c  | ||||
| endif | ||||
|  | ||||
|  | ||||
| # uuid | ||||
| libupnp_la_SOURCES	+= src/uuid/md5.c src/uuid/sysdep.c src/uuid/uuid.c | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/uuid/md5.c \ | ||||
| 	src/uuid/sysdep.c \ | ||||
| 	src/uuid/uuid.c | ||||
|  | ||||
|  | ||||
| # urlconfig | ||||
| libupnp_la_SOURCES	+= src/urlconfig/urlconfig.c | ||||
| libupnp_la_SOURCES += src/urlconfig/urlconfig.c | ||||
|  | ||||
|  | ||||
| # samples | ||||
| noinst_PROGRAMS		= | ||||
| if ENABLE_SAMPLES | ||||
| if ENABLE_CLIENT | ||||
|     noinst_PROGRAMS	+= upnp_tv_ctrlpt | ||||
|     upnp_tv_ctrlpt_CPPFLAGS = $(AM_CPPFLAGS) \ | ||||
| 			-I$(srcdir)/sample/common/ \ | ||||
| 			-I$(srcdir)/sample/tvctrlpt | ||||
| endif | ||||
| if ENABLE_DEVICE | ||||
|     noinst_PROGRAMS	+= upnp_tv_device  | ||||
|     upnp_tv_device_CPPFLAGS = $(AM_CPPFLAGS) \ | ||||
| 			-I$(srcdir)/sample/common/ \ | ||||
| 			-I$(srcdir)/sample/tvdevice | ||||
| endif | ||||
| endif | ||||
| upnp_tv_device_SOURCES = \ | ||||
| 			sample/common/sample_util.c \ | ||||
| 			sample/common/sample_util.h \ | ||||
| 			sample/tvdevice/upnp_tv_device.c \ | ||||
| 			sample/tvdevice/upnp_tv_device.h \ | ||||
| 			sample/tvdevice/linux/upnp_tv_device_main.c | ||||
| upnp_tv_ctrlpt_SOURCES = \ | ||||
| 			sample/common/sample_util.c \ | ||||
| 			sample/common/sample_util.h \ | ||||
| 			sample/tvctrlpt/upnp_tv_ctrlpt.c \ | ||||
| 			sample/tvctrlpt/upnp_tv_ctrlpt.h \ | ||||
| 			sample/tvctrlpt/linux/upnp_tv_ctrlpt_main.c | ||||
|  | ||||
| if WITH_DOCUMENTATION | ||||
|     examplesdir 	= $(docdir)/examples | ||||
|     examples_DATA 	= $(upnp_tv_ctrlpt_SOURCES) $(upnp_tv_device_SOURCES) | ||||
| endif | ||||
| # inet_pton (needed on Win32, compiles to nothing elsewhere) | ||||
| libupnp_la_SOURCES += \ | ||||
| 	src/inet_pton.c \ | ||||
| 	src/inc/inet_pton.h | ||||
|  | ||||
|  | ||||
| # check / distcheck tests | ||||
| check_PROGRAMS		= test_init | ||||
| TESTS			= test_init | ||||
|  | ||||
| test_init_SOURCES	= test/test_init.c | ||||
| check_PROGRAMS = test_init | ||||
| TESTS = test_init | ||||
| test_init_SOURCES = test/test_init.c | ||||
|  | ||||
|  | ||||
| EXTRA_DIST 		= LICENSE \ | ||||
| 			sample/tvdevice/web/tvcontrolSCPD.xml \ | ||||
| 			sample/tvdevice/web/tvdevicedesc.xml \ | ||||
| 			sample/tvdevice/web/tvdevicepres.html \ | ||||
| 			sample/tvdevice/web/tvpictureSCPD.xml \ | ||||
| 			src/inc/inet_pton.h \ | ||||
| 			src/inet_pton.c \ | ||||
| 			src/win_dll.c | ||||
|  | ||||
|  | ||||
|  | ||||
| CLEANFILES		= IUpnpErrFile.txt IUpnpInfoFile.txt | ||||
|  | ||||
| EXTRA_DIST = \ | ||||
| 	LICENSE \ | ||||
| 	m4/libupnp.m4 \ | ||||
| 	src/win_dll.c | ||||
|  | ||||
|  | ||||
| CLEANFILES = \ | ||||
| 	IUpnpErrFile.txt \ | ||||
| 	IUpnpInfoFile.txt | ||||
|  | ||||
|   | ||||
							
								
								
									
										120
									
								
								upnp/inc/UpnpGlobal.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										120
									
								
								upnp/inc/UpnpGlobal.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,120 @@ | ||||
|  | ||||
|  | ||||
| #ifndef UPNPGLOBAL_H | ||||
| #define UPNPGLOBAL_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * \brief Defines constants that for some reason are not defined on some systems. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64 | ||||
| 	#if defined __GNUC__ | ||||
| 		#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE | ||||
| 	#else | ||||
| 		#error  libupnp requires largefile mode - use AC_SYS_LARGEFILE | ||||
| 	#endif | ||||
| #endif  | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* | ||||
| 	 * EXPORT_SPEC | ||||
| 	 */ | ||||
| 	#ifdef UPNP_STATIC_LIB | ||||
| 		#define EXPORT_SPEC | ||||
| 	#else /* UPNP_STATIC_LIB */ | ||||
| 		#ifdef LIBUPNP_EXPORTS | ||||
| 			/*! set up declspec for dll export to make functions | ||||
| 			 * visible to library users */ | ||||
| 			#define EXPORT_SPEC __declspec(dllexport) | ||||
| 		#else /* LIBUPNP_EXPORTS */ | ||||
| 			#define EXPORT_SPEC __declspec(dllimport) | ||||
| 		#endif /* LIBUPNP_EXPORTS */ | ||||
| 	#endif /* UPNP_STATIC_LIB */ | ||||
|  | ||||
|  | ||||
| 	/* | ||||
| 	 * UPNP_INLINE | ||||
| 	 * PRId64 | ||||
| 	 * PRIzu | ||||
| 	 */ | ||||
| 	#ifdef UPNP_USE_MSVCPP | ||||
| 		/* define some things the M$ VC++ doesn't know */ | ||||
| 		#define UPNP_INLINE | ||||
| 		typedef __int64 int64_t; | ||||
| 		#define PRId64 "I64d" | ||||
| 		#define PRIzu "lu" | ||||
| 	#endif /* UPNP_USE_MSVCPP */ | ||||
|  | ||||
|  | ||||
| 	#ifdef UPNP_USE_BCBPP | ||||
| 		/* define some things Borland Builder doesn't know */ | ||||
| 		#define UPNP_INLINE inline | ||||
| 		typedef __int64 int64_t; | ||||
| 		#warning The Borland C compiler is probably broken on PRId64, | ||||
| 		#warning please someone provide a proper fix here | ||||
| 		#define PRId64 "I64d" | ||||
| 		#define PRIzu "zu" | ||||
| 	#endif /* UPNP_USE_BCBPP */ | ||||
|  | ||||
|  | ||||
| 	#ifdef __GNUC__ | ||||
| 		#define UPNP_INLINE inline | ||||
|  | ||||
| 		/* Note with PRIzu that in the case of Mingw32, it's the MS C | ||||
| 		 * runtime printf which ends up getting called, not the glibc | ||||
| 		 * printf, so it genuinely doesn't have "zu" | ||||
| 		 */ | ||||
| 		#define PRIzu "lu" | ||||
| 	#endif /* __GNUC__ */ | ||||
| #else | ||||
| 	/*!  | ||||
| 	 * \brief Export functions on WIN32 DLLs. | ||||
| 	 * | ||||
| 	 * Every funtion that belongs to the library API must use this | ||||
| 	 * definition upon declaration or it will not be exported on WIN32 | ||||
| 	 * DLLs. | ||||
| 	 */ | ||||
| 	#define EXPORT_SPEC | ||||
|  | ||||
| 	/*! | ||||
| 	 * \brief Declares an inline function. | ||||
| 	 * | ||||
| 	 * Surprisingly, there are some compilers that do not understand the | ||||
| 	 * inline keyword. This definition makes the use of this keyword | ||||
| 	 * portable to these systems. | ||||
| 	 */ | ||||
| 	#define UPNP_INLINE inline | ||||
| 	 | ||||
| 	/*! | ||||
| 	 * \brief Supply the PRId64 printf() macro. | ||||
| 	 * | ||||
| 	 * MSVC still does not know about this. | ||||
| 	 */ | ||||
| 	/* #define PRId64 PRId64 */ | ||||
|  | ||||
| 	/*! | ||||
| 	 * \brief Supply the PRIzu printf() macro. | ||||
| 	 * | ||||
| 	 * This macro was invented so that we can live a little longer with | ||||
| 	 * MSVC lack of C99. "z" is the correct printf() size specifier for | ||||
| 	 * the size_t type. | ||||
| 	 */ | ||||
| 	#define PRIzu "zu" | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /* | ||||
|  * Defining this macro here gives some interesting information about unused | ||||
|  * functions in the code. Of course, this should never go uncommented on a | ||||
|  * release. | ||||
|  */ | ||||
| /*#define inline*/ | ||||
|  | ||||
|  | ||||
| #endif /* UPNPGLOBAL_H */ | ||||
|  | ||||
							
								
								
									
										30
									
								
								upnp/inc/UpnpInet.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								upnp/inc/UpnpInet.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
|  | ||||
|  | ||||
| #ifndef UPNPINET_H | ||||
| #define UPNPINET_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  * | ||||
|  * \brief Provides a platform independent way to include TCP/IP types and functions. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#include <winsock2.h> | ||||
| 	#include <Ws2tcpip.h> | ||||
| #else | ||||
| 	#include <sys/param.h> | ||||
| 	#if (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__) | ||||
| 		#include <ifaddrs.h> | ||||
| 		/* Do not move or remove the include below for "sys/socket"! | ||||
| 		 * Will break FreeBSD builds. */ | ||||
| 		#include <sys/socket.h> | ||||
| 	#endif | ||||
| 	#include <netinet/in.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #endif /* UPNPINET_H */ | ||||
|  | ||||
							
								
								
									
										133
									
								
								upnp/inc/UpnpString.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								upnp/inc/UpnpString.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,133 @@ | ||||
|  | ||||
|  | ||||
| #ifndef STRING_H | ||||
| #define STRING_H | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \defgroup UpnpString The UpnpString Class | ||||
|  * | ||||
|  * \brief Implements string operations in the UPnP library. | ||||
|  * | ||||
|  * \author Marcelo Roberto Jimenez | ||||
|  * | ||||
|  * \version 1.0 | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  * | ||||
|  * \brief UpnpString object declarartion. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "UpnpGlobal.h" /* for EXPORT_SPEC */ | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Type of the string objects inside libupnp. | ||||
|  */ | ||||
| typedef struct s_UpnpString UpnpString; | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Constructor. | ||||
|  * | ||||
|  * \return A pointer to a new allocated object. | ||||
|  */ | ||||
| EXPORT_SPEC UpnpString *UpnpString_new(); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Destructor. | ||||
|  */ | ||||
| EXPORT_SPEC void UpnpString_delete( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	UpnpString *p); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Copy Constructor. | ||||
|  * | ||||
|  * \return A pointer to a new allocated copy of the original object. | ||||
|  */ | ||||
| EXPORT_SPEC UpnpString *UpnpString_dup( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	const UpnpString *p); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Assignment operator. | ||||
|  */ | ||||
| EXPORT_SPEC void UpnpString_assign( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	UpnpString *p, | ||||
| 	/*! [in] The \em \b that pointer. */ | ||||
| 	const UpnpString *q); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the length of the string. | ||||
|  * | ||||
|  * \return The length of the string. | ||||
|  * */ | ||||
| EXPORT_SPEC int UpnpString_get_Length( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	const UpnpString *p); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns the pointer to char. | ||||
|  * | ||||
|  * \return The pointer to char. | ||||
|  */ | ||||
| EXPORT_SPEC const char *UpnpString_get_String( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	const UpnpString *p); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the string from a pointer to char. | ||||
|  */ | ||||
| EXPORT_SPEC void UpnpString_set_String( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	UpnpString *p, | ||||
| 	/*! [in] (char *) to copy from. */ | ||||
| 	const char *s); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Sets the string from a pointer to char using a maximum of N chars. | ||||
|  */ | ||||
| EXPORT_SPEC void UpnpString_set_StringN( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	UpnpString *p, | ||||
| 	/*! [in] (char *) to copy from. */ | ||||
| 	const char *s, | ||||
| 	/*! Maximum number of chars to copy.*/ | ||||
| 	int n); | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Clears the string, sets its size to zero. | ||||
|  */ | ||||
| EXPORT_SPEC void UpnpString_clear( | ||||
| 	/*! [in] The \em \b this pointer. */ | ||||
| 	UpnpString *p); | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| /* @} UpnpString The UpnpString API */ | ||||
|  | ||||
|  | ||||
| #endif /* STRING_H */ | ||||
|  | ||||
							
								
								
									
										4331
									
								
								upnp/inc/upnp.h
									
									
									
									
									
								
							
							
						
						
									
										4331
									
								
								upnp/inc/upnp.h
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,34 +1,34 @@ | ||||
| // -*- C -*- | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /* -*- C -*- */ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * * Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * * Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * * Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef UPNP_CONFIG_H | ||||
| #define UPNP_CONFIG_H  | ||||
| @@ -91,6 +91,5 @@ | ||||
| #undef UPNP_HAVE_TOOLS | ||||
|  | ||||
|  | ||||
| #endif // UPNP_CONFIG_H | ||||
|  | ||||
| #endif /* UPNP_CONFIG_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,59 +1,66 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * Copyright (c) 2006 R<>mi Turboult <r3mi@users.sourceforge.net> | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef UPNP_DEBUG_H | ||||
| #define UPNP_DEBUG_H  | ||||
|  | ||||
| #include "upnpconfig.h" | ||||
|  | ||||
| // Function declarations only if debug compiled into the library | ||||
| #if UPNP_HAVE_DEBUG | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "ThreadPool.h" | ||||
| #include "upnpconfig.h" | ||||
| #include "UpnpGlobal.h" /* for UPNP_INLINE */ | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /** @name Other debugging features | ||||
|           The UPnP SDK contains other features to aid in debugging. | ||||
| /** \name Other debugging features | ||||
|  * | ||||
|  * The UPnP SDK contains other features to aid in debugging. | ||||
|  */ | ||||
| /*@{*/ | ||||
|  | ||||
| //@{ | ||||
|  | ||||
| /** @name Upnp_LogLevel | ||||
| /** \name Upnp_LogLevel | ||||
|  *  The user has the option to select 4 different types of debugging levels, | ||||
|  *  see {\tt UpnpSetLogLevel}.  | ||||
|  *  see \c UpnpSetLogLevel.  | ||||
|  *  The critical level will show only those messages  | ||||
|  *  which can halt the normal processing of the library, like memory  | ||||
|  *  allocation errors. The remaining three levels are just for debugging  | ||||
| @@ -62,197 +69,264 @@ extern "C" { | ||||
|  *  Info Level displays the other important operational information  | ||||
|  *  regarding the working of the library. If the user selects All,  | ||||
|  *  then the library displays all the debugging information that it has. | ||||
|  *  \begin{itemize} | ||||
|  *    \item {\tt UPNP_CRITICAL [0]} | ||||
|  *    \item {\tt UPNP_PACKET [1]} | ||||
|  *    \item {\tt UPNP_INFO [2]} | ||||
|  *    \item {\tt UPNP_ALL [3]} | ||||
|  *  \end{itemize} | ||||
|  *    \li \c UPNP_CRITICAL [0] | ||||
|  *    \li \c UPNP_PACKET [1] | ||||
|  *    \li \c UPNP_INFO [2] | ||||
|  *    \li \c UPNP_ALL [3] | ||||
|  */ | ||||
| typedef enum Upnp_Module { | ||||
| 	SSDP, | ||||
| 	SOAP, | ||||
| 	GENA, | ||||
| 	TPOOL, | ||||
| 	MSERV, | ||||
| 	DOM, | ||||
| 	API, | ||||
| 	HTTP | ||||
| } Dbg_Module; | ||||
|  | ||||
| typedef enum Upnp_Module {SSDP,SOAP,GENA,TPOOL,MSERV,DOM,API, HTTP} Dbg_Module; | ||||
| //@{ | ||||
|  | ||||
| /*@{*/ | ||||
| typedef enum Upnp_LogLevel_e { | ||||
| 	UPNP_CRITICAL, | ||||
| 	UPNP_PACKET, | ||||
| 	UPNP_INFO, | ||||
| 	UPNP_ALL | ||||
| } Upnp_LogLevel; | ||||
| //@} | ||||
|  | ||||
| // for backward compatibility | ||||
| #define Dbg_Level	Upnp_LogLevel | ||||
| /*@}*/ | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Default log level : see {\tt Upnp_LogLevel} | ||||
|  * Default log level : see \c Upnp_LogLevel | ||||
|  */ | ||||
| #define UPNP_DEFAULT_LOG_LEVEL	UPNP_ALL | ||||
|  | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpInitLog						 | ||||
|  *								 | ||||
|  * Parameters:	void						 | ||||
|  *									 | ||||
|  * Description:								 | ||||
|  *	This functions initializes the log files | ||||
|  * Returns: int | ||||
|  *	-1 : If fails | ||||
|  *	UPNP_E_SUCCESS : if success | ||||
|  ***************************************************************************/ | ||||
| int UpnpInitLog(); | ||||
|  | ||||
| // for backward compatibility | ||||
| #define InitLog		UpnpInitLog | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpSetLogLevel | ||||
|  *				 | ||||
|  * Parameters:	void | ||||
| /*! | ||||
|  * \brief Initialize the log files. | ||||
|  * | ||||
|  * Description:							 | ||||
|  *	This functions set the log level (see {\tt Upnp_LogLevel} | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void UpnpSetLogLevel (Upnp_LogLevel); | ||||
|  * \return -1 if fails or UPNP_E_SUCCESS if succeeds. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| int UpnpInitLog(void); | ||||
| #else | ||||
| static UPNP_INLINE int UpnpInitLog(void) | ||||
| { | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpCloseLog						 | ||||
|  *								 | ||||
|  * Parameters:	void					 | ||||
|  *								 | ||||
|  * Description:							 | ||||
|  *	This functions closes the log files | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void UpnpCloseLog(); | ||||
|  | ||||
| // for backward compatibility | ||||
| #define CloseLog	UpnpCloseLog | ||||
| /*! | ||||
|  * \brief Set the log level (see \c Upnp_LogLevel). | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpSetLogLevel( | ||||
| 	/*! [in] Log level. */ | ||||
| 	Upnp_LogLevel log_level); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {} | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpSetLogFileNames		 | ||||
|  *							 | ||||
|  * Parameters:						 | ||||
|  *	IN const char* ErrFileName: name of the error file | ||||
|  *	IN const char *InfoFileName: name of the information file | ||||
|  *	IN int size: Size of the buffer | ||||
|  *	IN int starLength: This parameter provides the width of the banner | ||||
|  *								 | ||||
|  * Description:							 | ||||
|  *	This functions takes the buffer and writes the buffer in the file as  | ||||
|  *	per the requested banner	 | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void UpnpSetLogFileNames (const char* ErrFileName, const char* InfoFileName); | ||||
|  | ||||
| // for backward compatibility | ||||
| #define SetLogFileNames		UpnpSetLogFileNames | ||||
| /*! | ||||
|  * \brief Closes the log files. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpCloseLog(void); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpCloseLog(void) {} | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpGetDebugFile		 | ||||
|  *						 | ||||
|  * Parameters:					 | ||||
|  *	IN Dbg_Level DLevel: The level of the debug logging. It will decide  | ||||
|  *		whether debug statement will go to standard output,  | ||||
|  *		or any of the log files. | ||||
|  *	IN Dbg_Module Module: debug will go in the name of this module | ||||
|  *								 | ||||
|  * Description: | ||||
|  *	This function checks if the module is turned on for debug  | ||||
|  *	and returns the file descriptor corresponding to the debug level | ||||
|  * Returns: FILE * | ||||
|  *	NULL : if the module is turn off for debug  | ||||
|  *	else returns the right file descriptor | ||||
|  ***************************************************************************/ | ||||
| FILE* UpnpGetDebugFile (Upnp_LogLevel level, Dbg_Module module); | ||||
|  | ||||
| // for backward compatibility | ||||
| #define GetDebugFile	UpnpGetDebugFile | ||||
| /*! | ||||
|  * \brief Set the name for error and information files, respectively. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpSetLogFileNames( | ||||
| 	/*! [in] Name of the error file. */ | ||||
| 	const char *ErrFileName, | ||||
| 	/*! [in] Name of the information file. */ | ||||
| 	const char *InfoFileName); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpSetLogFileNames( | ||||
| 	const char *ErrFileName, | ||||
| 	const char *InfoFileName) {} | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpPrintf				 | ||||
|  *									 | ||||
|  * Parameters:								 | ||||
|  *	IN Dbg_Level DLevel: The level of the debug logging. It will decide  | ||||
|  *		whether debug statement will go to standard output,  | ||||
|  *		or any of the log files. | ||||
|  *	IN Dbg_Module Module: debug will go in the name of this module | ||||
|  *	IN char *DbgFileName: Name of the file from where debug statement is | ||||
|  *							coming | ||||
|  *	IN int DbgLineNo : Line number of the file from where debug statement  | ||||
|  *				is coming | ||||
|  *	IN char * FmtStr, ...: Variable number of arguments that will go  | ||||
|  *				in the debug statement | ||||
|  *					 | ||||
|  * Description:							 | ||||
|  *	This functions prints the debug statement either on the startdard  | ||||
|  *	output or log file along with the information from where this  | ||||
|  *	debug statement is coming | ||||
|  * Returns: void | ||||
|  ***************************************************************************/  | ||||
| void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module, | ||||
| 		 const char* DbgFileName, int DbgLineNo, | ||||
| 		 const char* FmtStr, | ||||
| 		 ...) | ||||
| /*! | ||||
|  * \brief Check if the module is turned on for debug and returns the file | ||||
|  * descriptor corresponding to the debug level | ||||
|  * | ||||
|  * \return NULL if the module is turn off for debug otheriwse returns the | ||||
|  *	right file descriptor. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| FILE *UpnpGetDebugFile( | ||||
| 	/*! [in] The level of the debug logging. It will decide whether debug | ||||
| 	 * statement will go to standard output, or any of the log files. */ | ||||
| 	Upnp_LogLevel level, | ||||
| 	/*! [in] debug will go in the name of this module. */ | ||||
| 	Dbg_Module module); | ||||
| #else | ||||
| static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module) | ||||
| { | ||||
| 	return NULL; | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Returns true if debug output should be done in this module. | ||||
|  * | ||||
|  * \return Nonzero value if true, zero if false. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| int DebugAtThisLevel( | ||||
| 	/*! [in] The level of the debug logging. It will decide whether debug | ||||
| 	 * statement will go to standard output, or any of the log files. */ | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	/*! [in] Debug will go in the name of this module. */ | ||||
| 	Dbg_Module Module); | ||||
| #else | ||||
| static UPNP_INLINE int DebugAtThisLevel( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	Dbg_Module Module) | ||||
| { | ||||
| 	return 0; | ||||
| } | ||||
| #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. | ||||
|  */  | ||||
| #ifdef DEBUG | ||||
| void UpnpPrintf( | ||||
| 	/*! [in] The level of the debug logging. It will decide whether debug | ||||
| 	 * statement will go to standard output, or any of the log files. */ | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	/*! [in] debug will go in the name of this module. */ | ||||
| 	Dbg_Module Module, | ||||
| 	/*! [in] Name of the file from where debug statement is coming. */ | ||||
| 	const char* DbgFileName, | ||||
| 	/*! [in] Line number of the file from where debug statement is coming. */ | ||||
| 	int DbgLineNo, | ||||
| 	/*! [in] Printf like format specification. */ | ||||
| 	const char* FmtStr, | ||||
| 	/*! [in] Printf like Variable number of arguments that will go in the debug | ||||
| 	 * statement. */ | ||||
| 	...) | ||||
| #if (__GNUC__ >= 3) | ||||
| 	/* This enables printf like format checking by the compiler */ | ||||
| 	__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, | ||||
| 	...) | ||||
| { | ||||
| } | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpDisplayBanner				 | ||||
|  *							 | ||||
|  * Parameters:							 | ||||
|  *	IN FILE *fd: file descriptor where the banner will be written | ||||
|  *	IN char **lines: The buffer that will be written | ||||
|  *	IN int size: Size of the buffer | ||||
|  *	IN int starLength: This parameter provides the width of the banner | ||||
|  *									 | ||||
|  * Description:							 | ||||
|  *	This functions takes the buffer and writes the buffer in the file as  | ||||
|  *	per the requested banner			 | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void UpnpDisplayBanner (FILE *fd, | ||||
| 			const char** lines, size_t size, int starlength); | ||||
| /*! | ||||
|  * \brief Writes the file name and file number from where debug statement is | ||||
|  * coming to the log file. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpDisplayFileAndLine( | ||||
| 	/*! [in] File descriptor where line number and file name will be written. */ | ||||
| 	FILE *fd, | ||||
| 	/*! [in] Name of the file. */ | ||||
| 	const char *DbgFileName, | ||||
| 	/*! [in] Line number of the file. */ | ||||
| 	int DbgLineNo); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpDisplayFileAndLine( | ||||
| 	FILE *fd, | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo) {} | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpDisplayFileAndLine				 | ||||
|  *								 | ||||
|  * Parameters:							 | ||||
|  *	IN FILE *fd: File descriptor where line number and file name will be  | ||||
|  *			written  | ||||
|  *	IN char *DbgFileName: Name of the file   | ||||
|  *	IN int DbgLineNo : Line number of the file | ||||
|  *								 | ||||
|  * Description: | ||||
|  *	This function writes the file name and file number from where | ||||
|  *		debug statement is coming to the log file | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void UpnpDisplayFileAndLine (FILE *fd, const char *DbgFileName, int DbgLineNo); | ||||
| /*! | ||||
|  * \brief Writes the buffer in the file as per the requested banner | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void UpnpDisplayBanner( | ||||
| 	/*! [in] file descriptor where the banner will be written. */ | ||||
| 	FILE *fd, | ||||
| 	/*! [in] The buffer that will be written. */ | ||||
| 	const char **lines, | ||||
| 	/*! [in] Size of the buffer. */ | ||||
| 	size_t size, | ||||
| 	/*! [in] This parameter provides the width of the banner. */ | ||||
| 	int starlength); | ||||
| #else | ||||
| static UPNP_INLINE void UpnpDisplayBanner( | ||||
| 	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) | ||||
| { | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Print the node names and values of a XML tree. | ||||
|  */ | ||||
| #ifdef DEBUG | ||||
| void printNodes( | ||||
| 	/*! [in] The root of the tree to print. */ | ||||
| 	IXML_Node *tmpRoot, | ||||
| 	/*! [in] The depth to print. */ | ||||
| 	int depth); | ||||
| #else | ||||
| static UPNP_INLINE void printNodes( | ||||
| 	IXML_Node *tmpRoot, | ||||
| 	int depth) | ||||
| { | ||||
| } | ||||
| #endif | ||||
|  | ||||
|  | ||||
| /*@}*/ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif // UPNP_HAVE_DEBUG | ||||
|  | ||||
| #endif // UPNP_DEBUG_H | ||||
|  | ||||
|  | ||||
| #endif /* UPNP_DEBUG_H */ | ||||
|  | ||||
|   | ||||
| @@ -1,33 +1,33 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * * Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * * Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * * Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| /** @name Optional Tool APIs | ||||
|  *  The Linux SDK for UPnP Devices contains some additional, optional  | ||||
| @@ -36,14 +36,14 @@ | ||||
|  *  size in the SDK. Refer to the README for details. | ||||
|  */ | ||||
|  | ||||
| //@{ | ||||
| /*! @{ */ | ||||
|  | ||||
| #ifndef UPNP_TOOLS_H | ||||
| #define UPNP_TOOLS_H | ||||
|  | ||||
| #include "upnp.h" | ||||
|  | ||||
| // Function declarations only if tools compiled into the library | ||||
| /* Function declarations only if tools compiled into the library */ | ||||
| #if UPNP_HAVE_TOOLS | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| @@ -217,14 +217,13 @@ EXPORT_SPEC const char * UpnpGetErrorMessage( | ||||
|         int errorcode  /** The SDK error code to convert. */ | ||||
|         ); | ||||
|  | ||||
| //@} | ||||
| /*! @} */ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif // UPNP_HAVE_TOOLS | ||||
|  | ||||
| #endif // UPNP_TOOLS_H | ||||
| #endif /* UPNP_HAVE_TOOLS */ | ||||
|  | ||||
| #endif /* UPNP_TOOLS_H */ | ||||
|  | ||||
|   | ||||
							
								
								
									
										97
									
								
								upnp/m4/libupnp.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								upnp/m4/libupnp.m4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | ||||
| #							-*- Autoconf -*- | ||||
| # This file is part of the aMule project. | ||||
| # This file is part of the libupnp library project. | ||||
| # | ||||
| # Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org ) | ||||
| # | ||||
| # This program is free software; you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation; either version 2 of the License, or | ||||
| # (at your option) any later version. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program; if not, write to the Free Software | ||||
| # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA | ||||
| # | ||||
|  | ||||
| dnl -------------------------------------------------------------------------- | ||||
| dnl LIBUPNP_CHECK([VERSION = 1.6.6], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | ||||
| dnl | ||||
| dnl Check for the libupnp library | ||||
| dnl -------------------------------------------------------------------------- | ||||
| dnl | ||||
| dnl This macro sets these variables: | ||||
| dnl - LIBUPNP_VERSION | ||||
| dnl 	Something like "1.6.7" | ||||
| dnl - LIBUPNP_CPPFLAGS | ||||
| dnl 	Flags to be added to CPPFLAGS | ||||
| dnl - LIBUPNP_CFLAGS | ||||
| dnl 	Flags to be added to CFLAGS | ||||
| dnl - LIBUPNP_LDFLAGS | ||||
| dnl 	Flags to be added to LDFLAGS | ||||
| dnl - LIBUPNP_LIBS | ||||
| dnl 	Library to be added to LIBS | ||||
| dnl | ||||
| dnl The LIBUPNP_CPPFLAGS, LIBUPNP_CFLAGS, LIBUPNP_LDFLAGS and LIBUPNP_LIBS variables are also substituted. | ||||
| dnl | ||||
| AC_DEFUN([LIBUPNP_CHECK], | ||||
| [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | ||||
| m4_define([MIN_LIBUPNP_VERSION], [m4_ifval([$1], [$1], [1.6.6])])dnl | ||||
|  | ||||
| dnl	Test for --with-libupnp-prefix | ||||
| 	AC_ARG_WITH( | ||||
| 		[libupnp-prefix], | ||||
| 		[AS_HELP_STRING( | ||||
| 			[--with-libupnp-prefix=PREFIX], | ||||
| 			[UPnP library location])], | ||||
| 		[export PKG_CONFIG_PATH=$withval/lib/pkgconfig]) | ||||
|  | ||||
| dnl	Check for libupnp >= MIN_LIBUPNP_VERSION | ||||
| 	AS_IF([test $cross_compiling = no], [ | ||||
| 		AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION]) | ||||
| 		AS_IF([test -n "$PKG_CONFIG"], [ | ||||
| 			AS_IF([$PKG_CONFIG libupnp --exists], [ | ||||
| 				LIBUPNP_VERSION=`$PKG_CONFIG libupnp --modversion` | ||||
| 				AS_IF([$PKG_CONFIG libupnp --atleast-version=MIN_LIBUPNP_VERSION], [ | ||||
| 					result=yes | ||||
| 					resultstr=" (version $LIBUPNP_VERSION)" | ||||
| 					LIBUPNP_CPPFLAGS=`$PKG_CONFIG libupnp --cflags-only-I` | ||||
| 					LIBUPNP_CFLAGS=`$PKG_CONFIG libupnp --cflags-only-other` | ||||
| 					LIBUPNP_LDFLAGS=`$PKG_CONFIG libupnp --libs-only-L` | ||||
| 					LIBUPNP_LIBS=`$PKG_CONFIG libupnp --libs-only-other` | ||||
| 					LIBUPNP_LIBS="$LIBUPNP_LIBS `$PKG_CONFIG libupnp --libs-only-l`" | ||||
| 				], [ | ||||
| 					result=no | ||||
| 					resultstr=" (version $LIBUPNP_VERSION is not new enough)" | ||||
| 				]) | ||||
| 			], [ | ||||
| 				result=no | ||||
| 				resultstr=" (try to use --with-libupnp-prefix=PREFIX)" | ||||
| 			]) | ||||
| 		], [ | ||||
| 			result=no | ||||
| 			resultstr=" (pkg-config not found)" | ||||
| 		]) | ||||
| 		AC_MSG_RESULT([$result$resultstr]) | ||||
| 		libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr" | ||||
| 	], [ | ||||
| dnl Currently cross-compilation with libupnp is not supported. | ||||
| 		result=no | ||||
| 		libupnp_error="cross compiling" | ||||
| 	]) | ||||
|  | ||||
| dnl	Execute the right action. | ||||
| 	AS_IF([test ${result:-no} = yes], [$2], [$3]) | ||||
|  | ||||
| dnl Exported symbols | ||||
| AC_SUBST([LIBUPNP_CPPFLAGS])dnl | ||||
| AC_SUBST([LIBUPNP_CFLAGS])dnl | ||||
| AC_SUBST([LIBUPNP_LDFLAGS])dnl | ||||
| AC_SUBST([LIBUPNP_LIBS])dnl | ||||
| m4_undefine([MIN_LIBUPNP_VERSION])dnl | ||||
| ]) | ||||
							
								
								
									
										84
									
								
								upnp/sample/Makefile.am
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								upnp/sample/Makefile.am
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,84 @@ | ||||
| # | ||||
| # "Makefile.am" for "libupnp/upnp/sample" | ||||
| # | ||||
| # Copyright (C) 2007 Marcelo Roberto Jimenez <mroberto@users.sourceforge.net> | ||||
| # | ||||
|  | ||||
| AM_CPPFLAGS = \ | ||||
| 	-I$(top_srcdir)/upnp/inc \ | ||||
| 	-I$(top_srcdir)/threadutil/inc \ | ||||
| 	-I$(top_srcdir)/ixml/inc | ||||
|  | ||||
| LDADD = \ | ||||
| 	$(top_builddir)/upnp/libupnp.la \ | ||||
| 	$(top_builddir)/threadutil/libthreadutil.la \ | ||||
| 	$(top_builddir)/ixml/libixml.la | ||||
|  | ||||
|  | ||||
| # samples | ||||
| noinst_PROGRAMS = | ||||
| if ENABLE_SAMPLES | ||||
| if ENABLE_CLIENT | ||||
| noinst_PROGRAMS += upnp_tv_ctrlpt | ||||
| upnp_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) \ | ||||
| 	-I$(srcdir)/common/ \ | ||||
| 	-I$(srcdir)/tvcombo | ||||
| endif | ||||
| endif | ||||
| if ENABLE_DEVICE | ||||
| noinst_PROGRAMS += upnp_tv_device | ||||
| upnp_tv_device_CPPFLAGS = \ | ||||
| 	$(AM_CPPFLAGS) \ | ||||
| 	-I$(srcdir)/common/ \ | ||||
| 	-I$(srcdir)/tvdevice | ||||
| endif | ||||
| endif | ||||
|  | ||||
|  | ||||
| upnp_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 | ||||
|  | ||||
|  | ||||
| upnp_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 | ||||
|  | ||||
| upnp_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 | ||||
|  | ||||
|  | ||||
| if WITH_DOCUMENTATION | ||||
| examplesdir = $(docdir)/examples | ||||
| examples_DATA = \ | ||||
| 		$(sort \ | ||||
| 			$(upnp_tv_ctrlpt_SOURCES) \ | ||||
| 			$(upnp_tv_device_SOURCES)) | ||||
| endif | ||||
|  | ||||
|  | ||||
| EXTRA_DIST = \ | ||||
| 	web/tvcombodesc.xml \ | ||||
| 	web/tvcontrolSCPD.xml \ | ||||
| 	web/tvdevicedesc.xml \ | ||||
| 	web/tvdevicepres.html \ | ||||
| 	web/tvpictureSCPD.xml | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -34,24 +34,26 @@ | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
| #include "upnptools.h" | ||||
| #include "ithread.h" | ||||
| #include "ixml.h" | ||||
| #include "upnptools.h" | ||||
|  | ||||
|  | ||||
| // mutex to control displaying of events | ||||
| extern ithread_mutex_t display_mutex; | ||||
|  | ||||
| //mutex to control displaying of events | ||||
| extern ithread_mutex_t display_mutex ; | ||||
|  | ||||
| typedef enum { | ||||
| 	STATE_UPDATE = 0, | ||||
| 	DEVICE_ADDED =1, | ||||
| 	DEVICE_REMOVED=2, | ||||
| 	GET_VAR_COMPLETE=3 | ||||
| 	DEVICE_ADDED = 1, | ||||
| 	DEVICE_REMOVED = 2, | ||||
| 	GET_VAR_COMPLETE = 3 | ||||
| } eventType; | ||||
|  | ||||
|  | ||||
| @@ -68,7 +70,7 @@ typedef enum { | ||||
|  *   node -- The DOM node from which to extract the value | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| char * SampleUtil_GetElementValue(IN IXML_Element *element); | ||||
| char *SampleUtil_GetElementValue(IN IXML_Element *element); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_GetFirstServiceList | ||||
| @@ -85,7 +87,7 @@ char * SampleUtil_GetElementValue(IN IXML_Element *element); | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
|  | ||||
| IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document * doc);  | ||||
| IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document *doc);  | ||||
|  | ||||
|  | ||||
| /******************************************************************************** | ||||
| @@ -100,7 +102,7 @@ IXML_NodeList *SampleUtil_GetFirstServiceList(IN IXML_Document * doc); | ||||
|  *   item -- The item to search for | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| char * SampleUtil_GetFirstDocumentItem(IN IXML_Document *doc, IN const char *item);  | ||||
| char *SampleUtil_GetFirstDocumentItem(IN IXML_Document *doc, IN const char *item);  | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -116,7 +118,7 @@ char * SampleUtil_GetFirstDocumentItem(IN IXML_Document *doc, IN const char *ite | ||||
|  *   item -- The item to search for | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| char * SampleUtil_GetFirstElementItem(IN IXML_Element *element, IN const char *item);  | ||||
| char *SampleUtil_GetFirstElementItem(IN IXML_Element *element, IN const char *item);  | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_PrintEventType | ||||
| @@ -162,9 +164,13 @@ int SampleUtil_PrintEvent(IN Upnp_EventType EventType, | ||||
|  *   controlURL -- OUT -- The control URL for the service | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_FindAndParseService (IN IXML_Document *DescDoc, IN char* location,  | ||||
| 				    IN char *serviceType, OUT char **serviceId,  | ||||
| 				    OUT char **eventURL, OUT char **controlURL); | ||||
| int SampleUtil_FindAndParseService ( | ||||
| 	IN IXML_Document *DescDoc, | ||||
| 	IN const char *location, | ||||
| 	IN char *serviceType, | ||||
| 	OUT char **serviceId,  | ||||
| 	OUT char **eventURL, | ||||
| 	OUT char **controlURL); | ||||
|  | ||||
|  | ||||
| /******************************************************************************** | ||||
| @@ -196,8 +202,11 @@ extern print_string gPrintFun; | ||||
|  *   const char * UDN | ||||
|  *   int          newDevice | ||||
|  ********************************************************************************/ | ||||
| typedef void (*state_update)( const char *varName, const char *varValue, const char *UDN, | ||||
| 							 eventType type); | ||||
| typedef void (*state_update)( | ||||
| 	const char *varName, | ||||
| 	const char *varValue, | ||||
| 	const char *UDN, | ||||
| 	eventType type); | ||||
|  | ||||
| //global state update function used by smaple util | ||||
| extern state_update gStateUpdateFun; | ||||
| @@ -224,7 +233,7 @@ int SampleUtil_Initialize(print_string print_function); | ||||
|  * Parameters: | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_Finish(void); | ||||
| int SampleUtil_Finish(); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_Print | ||||
| @@ -238,7 +247,7 @@ int SampleUtil_Finish(void); | ||||
|  *   . . .  - variable number of args. (see printf) | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_Print( char *fmt, ... ); | ||||
| int SampleUtil_Print(char *fmt, ...); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_RegisterUpdateFunction | ||||
| @@ -248,7 +257,7 @@ int SampleUtil_Print( char *fmt, ... ); | ||||
|  * Parameters: | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int SampleUtil_RegisterUpdateFunction( state_update update_function ); | ||||
| int SampleUtil_RegisterUpdateFunction(state_update update_function); | ||||
|  | ||||
| /******************************************************************************** | ||||
|  * SampleUtil_StateUpdate | ||||
| @@ -258,11 +267,22 @@ int SampleUtil_RegisterUpdateFunction( state_update update_function ); | ||||
|  * Parameters: | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void SampleUtil_StateUpdate( const char *varName, const char *varValue, const char *UDN, | ||||
| 							eventType type); | ||||
| void SampleUtil_StateUpdate( | ||||
| 	const char *varName, | ||||
| 	const char *varValue, | ||||
| 	const char *UDN, | ||||
| 	eventType type); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| }; | ||||
| #endif /* __cplusplus */ | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	#define snprintf	_snprintf | ||||
| 	#define strcasecmp	stricmp | ||||
| #endif | ||||
|  | ||||
| #endif /* UPNPSDK_UTIL_H */ | ||||
|  | ||||
| #endif /* SAMPLE_UTIL_H */ | ||||
|  | ||||
|   | ||||
							
								
								
									
										491
									
								
								upnp/sample/tvcombo/linux/upnp_tv_combo_main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										491
									
								
								upnp/sample/tvcombo/linux/upnp_tv_combo_main.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,491 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * 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; | ||||
| } | ||||
							
								
								
									
										1366
									
								
								upnp/sample/tvcombo/upnp_tv_ctrlpt.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1366
									
								
								upnp/sample/tvcombo/upnp_tv_ctrlpt.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										160
									
								
								upnp/sample/tvcombo/upnp_tv_ctrlpt.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										160
									
								
								upnp/sample/tvcombo/upnp_tv_ctrlpt.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,160 @@ | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #ifndef UPNP_TV_CTRLPT_H | ||||
| #define UPNP_TV_CTRLPT_H | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
| #include "ithread.h" | ||||
| #ifndef WIN32 | ||||
| #include <unistd.h> | ||||
| #endif | ||||
| #include <stdarg.h> | ||||
| #include <stdlib.h> | ||||
| #include <signal.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "upnp.h" | ||||
| #include "upnptools.h" | ||||
| #include "sample_util.h" | ||||
|  | ||||
| #define TV_SERVICE_SERVCOUNT	2 | ||||
| #define TV_SERVICE_CONTROL		0 | ||||
| #define TV_SERVICE_PICTURE		1 | ||||
|  | ||||
| #define TV_CONTROL_VARCOUNT		3 | ||||
| #define TV_CONTROL_POWER		0 | ||||
| #define TV_CONTROL_CHANNEL		1 | ||||
| #define TV_CONTROL_VOLUME		2 | ||||
|  | ||||
| #define TV_PICTURE_VARCOUNT		4 | ||||
| #define TV_PICTURE_COLOR		0 | ||||
| #define TV_PICTURE_TINT			1 | ||||
| #define TV_PICTURE_CONTRAST		2 | ||||
| #define TV_PICTURE_BRIGHTNESS	3 | ||||
|  | ||||
| #define TV_MAX_VAL_LEN			5 | ||||
|  | ||||
| #define TV_SUCCESS				0 | ||||
| #define TV_ERROR				(-1) | ||||
| #define TV_WARNING				1 | ||||
|  | ||||
| /* This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS				TV_PICTURE_VARCOUNT | ||||
|  | ||||
| extern char TvDeviceType[]; | ||||
| extern char *TvServiceType[]; | ||||
| extern char *TvServiceName[]; | ||||
| extern char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS]; | ||||
| extern char TvVarCount[]; | ||||
|  | ||||
| struct tv_service { | ||||
|     char ServiceId[NAME_SIZE]; | ||||
|     char ServiceType[NAME_SIZE]; | ||||
|     char *VariableStrVal[TV_MAXVARS]; | ||||
|     char EventURL[NAME_SIZE]; | ||||
|     char ControlURL[NAME_SIZE]; | ||||
|     char SID[NAME_SIZE]; | ||||
| }; | ||||
|  | ||||
| extern struct TvDeviceNode *GlobalDeviceList; | ||||
|  | ||||
| struct TvDevice { | ||||
|     char UDN[250]; | ||||
|     char DescDocURL[250]; | ||||
|     char FriendlyName[250]; | ||||
|     char PresURL[250]; | ||||
|     int  AdvrTimeOut; | ||||
|     struct tv_service TvService[TV_SERVICE_SERVCOUNT]; | ||||
| }; | ||||
|  | ||||
| struct TvDeviceNode { | ||||
|     struct TvDevice device; | ||||
|     struct TvDeviceNode *next; | ||||
| }; | ||||
|  | ||||
| extern ithread_mutex_t DeviceListMutex; | ||||
|  | ||||
| extern UpnpClient_Handle ctrlpt_handle; | ||||
|  | ||||
| void	TvCtrlPointPrintHelp( void ); | ||||
| int		TvCtrlPointDeleteNode(struct TvDeviceNode *); | ||||
| int		TvCtrlPointRemoveDevice(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 Upnp_SID, 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 | ||||
							
								
								
									
										1945
									
								
								upnp/sample/tvcombo/upnp_tv_device.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1945
									
								
								upnp/sample/tvcombo/upnp_tv_device.c
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										640
									
								
								upnp/sample/tvcombo/upnp_tv_device.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										640
									
								
								upnp/sample/tvcombo/upnp_tv_device.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,640 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #ifndef UPNP_TV_DEVICE_H | ||||
| #define UPNP_TV_DEVICE_H | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <signal.h> | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include <stdlib.h> | ||||
| #ifndef WIN32 | ||||
| #include <unistd.h> | ||||
| #endif | ||||
| #include <string.h> | ||||
| #include "upnp.h" | ||||
| #include "sample_util.h" | ||||
|  | ||||
| //Color constants | ||||
| #define MAX_COLOR 10 | ||||
| #define MIN_COLOR 1 | ||||
|  | ||||
| //Brightness constants | ||||
| #define MAX_BRIGHTNESS 10 | ||||
| #define MIN_BRIGHTNESS 1 | ||||
|  | ||||
| //Power constants | ||||
| #define POWER_ON 1 | ||||
| #define POWER_OFF 0 | ||||
|  | ||||
| //Tint constants | ||||
| #define MAX_TINT 10 | ||||
| #define MIN_TINT 1 | ||||
|  | ||||
| //Volume constants | ||||
| #define MAX_VOLUME 10 | ||||
| #define MIN_VOLUME 1 | ||||
|  | ||||
| //Contrast constants | ||||
| #define MAX_CONTRAST 10 | ||||
| #define MIN_CONTRAST 1 | ||||
|  | ||||
| //Channel constants | ||||
| #define MAX_CHANNEL 100 | ||||
| #define MIN_CHANNEL 1 | ||||
|  | ||||
| //Number of services. | ||||
| #define TV_SERVICE_SERVCOUNT  2 | ||||
|  | ||||
| //Index of control service | ||||
| #define TV_SERVICE_CONTROL    0 | ||||
|  | ||||
| //Index of picture service | ||||
| #define TV_SERVICE_PICTURE    1 | ||||
|  | ||||
| //Number of control variables | ||||
| #define TV_CONTROL_VARCOUNT   3 | ||||
|  | ||||
| //Index of power variable | ||||
| #define TV_CONTROL_POWER      0 | ||||
|  | ||||
| //Index of channel variable | ||||
| #define TV_CONTROL_CHANNEL    1 | ||||
|  | ||||
| //Index of volume variable | ||||
| #define TV_CONTROL_VOLUME     2 | ||||
|  | ||||
| //Number of picture variables | ||||
| #define TV_PICTURE_VARCOUNT   4 | ||||
|  | ||||
| //Index of color variable | ||||
| #define TV_PICTURE_COLOR      0 | ||||
|  | ||||
| //Index of tint variable | ||||
| #define TV_PICTURE_TINT       1 | ||||
|  | ||||
| //Index of contrast variable | ||||
| #define TV_PICTURE_CONTRAST   2 | ||||
|  | ||||
| //Index of brightness variable | ||||
| #define TV_PICTURE_BRIGHTNESS 3 | ||||
|  | ||||
| //Max value length | ||||
| #define TV_MAX_VAL_LEN 5 | ||||
|  | ||||
| //Max actions | ||||
| #define TV_MAXACTIONS 12 | ||||
|  | ||||
| /* This should be the maximum VARCOUNT from above */ | ||||
| #define TV_MAXVARS TV_PICTURE_VARCOUNT | ||||
|  | ||||
|  | ||||
| extern char TvDeviceType[]; | ||||
|  | ||||
| extern char *TvServiceType[]; | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * upnp_action | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Prototype for all actions. For each action that a service  | ||||
|  *       implements, there is a corresponding function with this prototype. | ||||
|  *       Pointers to these functions, along with action names, are stored | ||||
|  *       in the service table. When an action request comes in the action | ||||
|  *       name is matched, and the appropriate function is called. | ||||
|  *       Each function returns UPNP_E_SUCCESS, on success, and a nonzero  | ||||
|  *       error code on failure. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * request - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| typedef int (*upnp_action) (IXML_Document *request, IXML_Document **out,  | ||||
| 			    char **errorString); | ||||
|  | ||||
| /* Structure for storing Tv Service | ||||
|    identifiers and state table */ | ||||
| struct TvService { | ||||
|    | ||||
|   char UDN[NAME_SIZE]; /* Universally Unique Device Name */ | ||||
|   char ServiceId[NAME_SIZE]; | ||||
|   char ServiceType[NAME_SIZE]; | ||||
|   char *VariableName[TV_MAXVARS];  | ||||
|   char *VariableStrVal[TV_MAXVARS]; | ||||
|   char *ActionNames[TV_MAXACTIONS]; | ||||
|   upnp_action actions[TV_MAXACTIONS]; | ||||
|   unsigned int  VariableCount; | ||||
| }; | ||||
|  | ||||
| //Array of service structures | ||||
| extern struct TvService tv_service_table[]; | ||||
|  | ||||
| //Device handle returned from sdk | ||||
| extern UpnpDevice_Handle device_handle; | ||||
|  | ||||
|  | ||||
| /* Mutex for protecting the global state table data | ||||
|    in a multi-threaded, asynchronous environment. | ||||
|    All functions should lock this mutex before reading | ||||
|    or writing the state table data. */ | ||||
| extern ithread_mutex_t TVDevMutex; | ||||
|  | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * SetActionTable | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Initializes the action table for the specified service. | ||||
|  *       Note that  | ||||
|  *       knowledge of the service description is | ||||
|  *       assumed.  Action names are hardcoded. | ||||
|  * Parameters: | ||||
|  *   int serviceType - one of TV_SERVICE_CONTROL or, TV_SERVICE_PICTURE | ||||
|  *   struct TvService *out - service containing action table to set. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int SetActionTable(int serviceType, struct TvService * out); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceStateTableInit | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Initialize the device state table for  | ||||
|  * 	 this TvDevice, pulling identifier info | ||||
|  *       from the description Document.  Note that  | ||||
|  *       knowledge of the service description is | ||||
|  *       assumed.  State table variables and default | ||||
|  *       values are currently hardcoded in this file | ||||
|  *       rather than being read from service description | ||||
|  *       documents. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   DescDocURL -- The description document URL | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceStateTableInit(char*); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleSubscriptionRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during a subscription request callback.  If the | ||||
|  *       subscription request is for this device and either its | ||||
|  *       control service or picture service, then accept it. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   sr_event -- The subscription request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleSubscriptionRequest(struct Upnp_Subscription_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleGetVarRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during a get variable request callback.  If the | ||||
|  *       request is for this device and either its control service | ||||
|  *       or picture service, then respond with the variable value. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   cgv_event -- The control get variable request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleGetVarRequest(struct Upnp_State_Var_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleActionRequest | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Called during an action request callback.  If the | ||||
|  *       request is for this device and either its control service | ||||
|  *       or picture service, then perform the action and respond. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   ca_event -- The control action request event structure | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceHandleActionRequest(struct Upnp_Action_Request *); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceCallbackEventHandler | ||||
|  * | ||||
|  * Description:  | ||||
|  *       The callback handler registered with the SDK while registering | ||||
|  *       root device.  Dispatches the request to the appropriate procedure | ||||
|  *       based on the value of EventType. The four requests handled by the  | ||||
|  *       device are:  | ||||
|  *                   1) Event Subscription requests.   | ||||
|  *                   2) Get Variable requests.  | ||||
|  *                   3) Action requests. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *   EventType -- The type of callback event | ||||
|  *   Event -- Data structure containing event data | ||||
|  *   Cookie -- Optional data specified during callback registration | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceCallbackEventHandler(Upnp_EventType, void*, void*); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetServiceTableVar | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Update the TvDevice service state table, and notify all subscribed  | ||||
|  *       control points of the updated state.  Note that since this function | ||||
|  *       blocks on the mutex TVDevMutex, to avoid a hang this function should  | ||||
|  *       not be called within any other function that currently has this mutex  | ||||
|  *       locked. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   service -- The service number (TV_SERVICE_CONTROL or TV_SERVICE_PICTURE) | ||||
|  *   variable -- The variable number (TV_CONTROL_POWER, TV_CONTROL_CHANNEL, | ||||
|  *                   TV_CONTROL_VOLUME, TV_PICTURE_COLOR, TV_PICTURE_TINT, | ||||
|  *                   TV_PICTURE_CONTRAST, or TV_PICTURE_BRIGHTNESS) | ||||
|  *   value -- The string representation of the new value | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetServiceTableVar(unsigned int, unsigned int, char*); | ||||
|  | ||||
| //Control Service Actions | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDevicePowerOn | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Turn the power on. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDevicePowerOn(IN IXML_Document * in, OUT IXML_Document **out,  | ||||
| 		    OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDevicePowerOff | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Turn the power off. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *     | ||||
|  *    IXML_Document * in - document of action request | ||||
|  *    IXML_Document **out - action result | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDevicePowerOff(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 		     OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the channel, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *     | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetChannel(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 		       OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the channel.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			    OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseChannel | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the channel.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseChannel(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			    OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the volume, update the TvDevice control service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetVolume(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 		      OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the volume.  | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,  | ||||
| 			   OUT char **errorString); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseVolume | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the volume. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseVolume(IN IXML_Document *in, OUT IXML_Document**out,  | ||||
| 			   OUT char **errorString); | ||||
|  | ||||
|  | ||||
| //Picture Service Actions | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the color, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetColor(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 		     OUT char **errorString); | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase the color. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseColor(IN IXML_Document * in, OUT IXML_Document **out,  | ||||
| 			  OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseColor | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease the color.   | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseColor(IN IXML_Document * in, OUT IXML_Document **out,  | ||||
| 			  OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the tint, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetTint(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 		    OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase tint. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseTint(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			 OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseTint | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease tint. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseTint(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			 OUT char **errorString); | ||||
|  | ||||
| /***************************************************************************** | ||||
|  * TvDeviceSetContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the contrast, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  ****************************************************************************/ | ||||
| int TvDeviceSetContrast(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  * | ||||
|  *      Increase the contrast. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *        | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			     OUT char **errorString); | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseContrast | ||||
|  * | ||||
|  * Description:  | ||||
|  *      Decrease the contrast. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *           | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseContrast(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			     OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceSetBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Change the brightness, update the TvDevice picture service | ||||
|  *       state table, and notify all subscribed control points of the | ||||
|  *       updated state. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *   brightness -- The brightness value to change to. | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceSetBrightness(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			  OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceIncreaseBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Increase brightness. | ||||
|  * | ||||
|  * Parameters: | ||||
|  * | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceIncreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			       OUT char **errorString); | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceDecreaseBrightness | ||||
|  * | ||||
|  * Description:  | ||||
|  *       Decrease brightnesss. | ||||
|  * | ||||
|  * Parameters: | ||||
|  *    IXML_Document * in -  action request document | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,  | ||||
| 			       OUT char **errorString); | ||||
|  | ||||
| int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name, | ||||
| 				  char *web_dir_path, print_string pfun); | ||||
| int TvDeviceStop(); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
| @@ -1,37 +1,40 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include "sample_util.h" | ||||
| #include "upnp_tv_ctrlpt.h" | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include <string.h> | ||||
|  | ||||
| /* | ||||
| @@ -124,108 +127,72 @@ TvCtrlPointPrintLongHelp( void ) | ||||
|     SampleUtil_Print( "* TV Control Point Help Info *" ); | ||||
|     SampleUtil_Print( "******************************" ); | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print | ||||
|         ( "This sample control point application automatically searches" ); | ||||
|     SampleUtil_Print | ||||
|         ( "for and subscribes to the services of television device emulator" ); | ||||
|     SampleUtil_Print | ||||
|         ( "devices, described in the tvdevicedesc.xml description document." ); | ||||
|     SampleUtil_Print( "This sample control point application automatically searches" ); | ||||
|     SampleUtil_Print( "for and subscribes to the services of television device emulator" ); | ||||
|     SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." ); | ||||
|     SampleUtil_Print( "" ); | ||||
|     SampleUtil_Print( "Commands:" ); | ||||
|     SampleUtil_Print( "  Help" ); | ||||
|     SampleUtil_Print( "       Print this help info." ); | ||||
|     SampleUtil_Print( "  ListDev" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Print the current list of TV Device Emulators that this" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         control point is aware of.  Each device is preceded by a" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device number which corresponds to the devnum argument of" ); | ||||
|     SampleUtil_Print( "       Print the current list of TV Device Emulators that this" ); | ||||
|     SampleUtil_Print( "         control point is aware of.  Each device is preceded by a" ); | ||||
|     SampleUtil_Print( "         device number which corresponds to the devnum argument of" ); | ||||
|     SampleUtil_Print( "         commands listed below." ); | ||||
|     SampleUtil_Print( "  Refresh" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Delete all of the devices from the device list and issue new" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         search request to rebuild the list from scratch." ); | ||||
|     SampleUtil_Print( "       Delete all of the devices from the device list and issue new" ); | ||||
|     SampleUtil_Print( "         search request to rebuild the list from scratch." ); | ||||
|     SampleUtil_Print( "  PrintDev       <devnum>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Print the state table for the device <devnum>." ); | ||||
|     SampleUtil_Print | ||||
|         ( "         e.g., 'PrintDev 1' prints the state table for the first" ); | ||||
|     SampleUtil_Print( "       Print the state table for the device <devnum>." ); | ||||
|     SampleUtil_Print( "         e.g., 'PrintDev 1' prints the state table for the first" ); | ||||
|     SampleUtil_Print( "         device in the device list." ); | ||||
|     SampleUtil_Print( "  PowerOn        <devnum>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the PowerOn action to the Control Service of" ); | ||||
|     SampleUtil_Print( "       Sends the PowerOn action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>." ); | ||||
|     SampleUtil_Print( "  PowerOff       <devnum>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the PowerOff action to the Control Service of" ); | ||||
|     SampleUtil_Print( "       Sends the PowerOff action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>." ); | ||||
|     SampleUtil_Print( "  SetChannel     <devnum> <channel>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the SetChannel action to the Control Service of" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device <devnum>, requesting the channel to be changed" ); | ||||
|     SampleUtil_Print( "       Sends the SetChannel action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the channel to be changed" ); | ||||
|     SampleUtil_Print( "         to <channel>." ); | ||||
|     SampleUtil_Print( "  SetVolume      <devnum> <volume>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the SetVolume action to the Control Service of" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device <devnum>, requesting the volume to be changed" ); | ||||
|     SampleUtil_Print( "       Sends the SetVolume action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the volume to be changed" ); | ||||
|     SampleUtil_Print( "         to <volume>." ); | ||||
|     SampleUtil_Print( "  SetColor       <devnum> <color>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the SetColor action to the Control Service of" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device <devnum>, requesting the color to be changed" ); | ||||
|     SampleUtil_Print( "       Sends the SetColor action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the color to be changed" ); | ||||
|     SampleUtil_Print( "         to <color>." ); | ||||
|     SampleUtil_Print( "  SetTint        <devnum> <tint>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the SetTint action to the Control Service of" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device <devnum>, requesting the tint to be changed" ); | ||||
|     SampleUtil_Print( "       Sends the SetTint action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the tint to be changed" ); | ||||
|     SampleUtil_Print( "         to <tint>." ); | ||||
|     SampleUtil_Print( "  SetContrast    <devnum> <contrast>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the SetContrast action to the Control Service of" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device <devnum>, requesting the contrast to be changed" ); | ||||
|     SampleUtil_Print( "       Sends the SetContrast action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the contrast to be changed" ); | ||||
|     SampleUtil_Print( "         to <contrast>." ); | ||||
|     SampleUtil_Print( "  SetBrightness  <devnum> <brightness>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends the SetBrightness action to the Control Service of" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         device <devnum>, requesting the brightness to be changed" ); | ||||
|     SampleUtil_Print( "       Sends the SetBrightness action to the Control Service of" ); | ||||
|     SampleUtil_Print( "         device <devnum>, requesting the brightness to be changed" ); | ||||
|     SampleUtil_Print( "         to <brightness>." ); | ||||
|     SampleUtil_Print( "  CtrlAction     <devnum> <action>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         to the Control Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print | ||||
|         ( "         (e.g., \"CtrlAction 1 IncreaseChannel\")" ); | ||||
|     SampleUtil_Print( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print( "         to the Control Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print( "         (e.g., \"CtrlAction 1 IncreaseChannel\")" ); | ||||
|     SampleUtil_Print( "  PictAction     <devnum> <action>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         to the Picture Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print | ||||
|         ( "         (e.g., \"PictAction 1 DecreaseContrast\")" ); | ||||
|     SampleUtil_Print( "       Sends an action request specified by the string <action>" ); | ||||
|     SampleUtil_Print( "         to the Picture Service of device <devnum>.  This command" ); | ||||
|     SampleUtil_Print( "         only works for actions that have no arguments." ); | ||||
|     SampleUtil_Print( "         (e.g., \"PictAction 1 DecreaseContrast\")" ); | ||||
|     SampleUtil_Print( "  CtrlGetVar     <devnum> <varname>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         from the Control Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print( "         from the Control Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "         (e.g., \"CtrlGetVar 1 Volume\")" ); | ||||
|     SampleUtil_Print( "  PictGetVar     <devnum> <action>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print | ||||
|         ( "         from the Picture Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "       Requests the value of a variable specified by the string <varname>" ); | ||||
|     SampleUtil_Print( "         from the Picture Service of device <devnum>." ); | ||||
|     SampleUtil_Print( "         (e.g., \"PictGetVar 1 Tint\")" ); | ||||
|     SampleUtil_Print( "  Exit" ); | ||||
|     SampleUtil_Print( "       Exits the control point application." ); | ||||
| @@ -242,7 +209,7 @@ TvCtrlPointPrintLongHelp( void ) | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointPrintCommands(  ) | ||||
| TvCtrlPointPrintCommands() | ||||
| { | ||||
|     int i; | ||||
|     int numofcmds = sizeof( cmdloop_cmdlist ) / sizeof( cmdloop_commands ); | ||||
| @@ -321,11 +288,11 @@ TvCtrlPointProcessCommand( char *cmdline ) | ||||
|  | ||||
|     switch ( cmdnum ) { | ||||
|         case PRTHELP: | ||||
|             TvCtrlPointPrintShortHelp(  ); | ||||
|             TvCtrlPointPrintShortHelp(); | ||||
|             break; | ||||
|  | ||||
|         case PRTFULLHELP: | ||||
|             TvCtrlPointPrintLongHelp(  ); | ||||
|             TvCtrlPointPrintLongHelp(); | ||||
|             break; | ||||
|  | ||||
|         case POWON: | ||||
| @@ -411,15 +378,15 @@ TvCtrlPointProcessCommand( char *cmdline ) | ||||
|             break; | ||||
|  | ||||
|         case LSTDEV: | ||||
|             TvCtrlPointPrintList(  ); | ||||
|             TvCtrlPointPrintList(); | ||||
|             break; | ||||
|  | ||||
|         case REFRESH: | ||||
|             TvCtrlPointRefresh(  ); | ||||
|             TvCtrlPointRefresh(); | ||||
|             break; | ||||
|  | ||||
|         case EXITCMD: | ||||
|             rc = TvCtrlPointStop(  ); | ||||
|             rc = TvCtrlPointStop(); | ||||
|             exit( rc ); | ||||
|             break; | ||||
|  | ||||
| @@ -434,26 +401,29 @@ TvCtrlPointProcessCommand( char *cmdline ) | ||||
|     return TV_SUCCESS; | ||||
| } | ||||
|  | ||||
| int | ||||
| main( int argc, | ||||
|       char **argv ) | ||||
| int main( int argc, char **argv ) | ||||
| { | ||||
|     int rc; | ||||
|     ithread_t cmdloop_thread; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
|     int sig; | ||||
|     sigset_t sigs_to_catch; | ||||
| #endif | ||||
|     int code; | ||||
|  | ||||
|  | ||||
|     rc = TvCtrlPointStart( linux_print, NULL ); | ||||
|     if( rc != TV_SUCCESS ) { | ||||
|         SampleUtil_Print( "Error starting UPnP TV Control Point" ); | ||||
|         exit( rc ); | ||||
|         return rc; | ||||
|     } | ||||
|     // start a command loop thread | ||||
|     code = | ||||
|         ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, | ||||
|                         NULL ); | ||||
|     /* start a command loop thread */ | ||||
|     code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL ); | ||||
|  | ||||
| #ifdef WIN32 | ||||
|     ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
|     /* | ||||
|        Catch Ctrl-C and properly shutdown  | ||||
|      */ | ||||
| @@ -461,7 +431,11 @@ main( int argc, | ||||
|     sigaddset( &sigs_to_catch, SIGINT ); | ||||
|     sigwait( &sigs_to_catch, &sig ); | ||||
|  | ||||
|     SampleUtil_Print( "Shutting down on signal %d...", sig ); | ||||
|     rc = TvCtrlPointStop(  ); | ||||
|     exit( rc ); | ||||
|     SampleUtil_Print( "Shutting down on signal %d...\n", sig ); | ||||
| #endif | ||||
|  | ||||
|     rc = TvCtrlPointStop(); | ||||
|  | ||||
|     return rc; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,37 +1,42 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "upnp_tv_ctrlpt.h" | ||||
|  | ||||
| /* | ||||
|  | ||||
| #include "upnp.h" | ||||
|  | ||||
|  | ||||
| /*! | ||||
|    Mutex for protecting the global device list | ||||
|    in a multi-threaded, asynchronous environment. | ||||
|    All functions should lock this mutex before reading | ||||
| @@ -48,7 +53,7 @@ char *TvServiceType[] = { | ||||
| }; | ||||
| char *TvServiceName[] = { "Control", "Picture" }; | ||||
|  | ||||
| /* | ||||
| /*! | ||||
|    Global arrays for storing variable names and counts for  | ||||
|    TvControl and TvPicture services  | ||||
|  */ | ||||
| @@ -59,12 +64,12 @@ char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS] = { | ||||
| char TvVarCount[TV_SERVICE_SERVCOUNT] = | ||||
|     { TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT }; | ||||
|  | ||||
| /* | ||||
| /*! | ||||
|    Timeout to request during subscriptions  | ||||
|  */ | ||||
| int default_timeout = 1801; | ||||
|  | ||||
| /* | ||||
| /*! | ||||
|    The first node in the global device list, or NULL if empty  | ||||
|  */ | ||||
| struct TvDeviceNode *GlobalDeviceList = NULL; | ||||
| @@ -139,10 +144,10 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node ) | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int | ||||
| TvCtrlPointRemoveDevice( char *UDN ) | ||||
| TvCtrlPointRemoveDevice(const char *UDN) | ||||
| { | ||||
|     struct TvDeviceNode *curdevnode, | ||||
|      *prevdevnode; | ||||
|     struct TvDeviceNode *curdevnode; | ||||
|     struct TvDeviceNode *prevdevnode; | ||||
|  | ||||
|     ithread_mutex_lock( &DeviceListMutex ); | ||||
|  | ||||
| @@ -224,7 +229,7 @@ TvCtrlPointRefresh( void ) | ||||
| { | ||||
|     int rc; | ||||
|  | ||||
|     TvCtrlPointRemoveAll(  ); | ||||
|     TvCtrlPointRemoveAll(); | ||||
|  | ||||
|     /* | ||||
|        Search for all devices of type tvdevice version 1,  | ||||
| @@ -539,7 +544,7 @@ TvCtrlPointGetDevice( int devnum, | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int | ||||
| TvCtrlPointPrintList(  ) | ||||
| TvCtrlPointPrintList() | ||||
| { | ||||
|     struct TvDeviceNode *tmpdevnode; | ||||
|     int i = 0; | ||||
| @@ -668,8 +673,8 @@ TvCtrlPointPrintDevice( int devnum ) | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointAddDevice( IXML_Document * DescDoc, | ||||
|                       char *location, | ||||
| TvCtrlPointAddDevice( IXML_Document *DescDoc, | ||||
|                       const char *location, | ||||
|                       int expires ) | ||||
| { | ||||
|     char *deviceType = NULL; | ||||
| @@ -682,20 +687,19 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc, | ||||
|     char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL }; | ||||
|     char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL }; | ||||
|     Upnp_SID eventSID[TV_SERVICE_SERVCOUNT]; | ||||
|     int TimeOut[TV_SERVICE_SERVCOUNT] = | ||||
|         { default_timeout, default_timeout }; | ||||
|     int TimeOut[TV_SERVICE_SERVCOUNT] = { | ||||
|         default_timeout, | ||||
|         default_timeout }; | ||||
|     struct TvDeviceNode *deviceNode; | ||||
|     struct TvDeviceNode *tmpdevnode; | ||||
|     int ret = 1; | ||||
|     int found = 0; | ||||
|     int service, | ||||
|       var; | ||||
|     int service; | ||||
|     int var; | ||||
|  | ||||
|     ithread_mutex_lock( &DeviceListMutex ); | ||||
|  | ||||
|     /* | ||||
|        Read key elements from description document  | ||||
|      */ | ||||
|     /* Read key elements from description document */ | ||||
|     UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" ); | ||||
|     deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" ); | ||||
|     friendlyName = | ||||
| @@ -703,9 +707,8 @@ TvCtrlPointAddDevice( IXML_Document * DescDoc, | ||||
|     baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" ); | ||||
|     relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" ); | ||||
|  | ||||
|     ret = | ||||
|         UpnpResolveURL( ( baseURL ? baseURL : location ), relURL, | ||||
|                         presURL ); | ||||
|     ret = UpnpResolveURL( | ||||
|         ( baseURL ? baseURL : location ), relURL, presURL); | ||||
|  | ||||
|     if( UPNP_E_SUCCESS != ret ) | ||||
|         SampleUtil_Print( "Error generating presURL from %s + %s", baseURL, | ||||
| @@ -939,34 +942,36 @@ TvStateUpdate( char *UDN, | ||||
|  *   changes -- The DOM document representing the changes | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointHandleEvent( Upnp_SID sid, | ||||
|                         int evntkey, | ||||
|                         IXML_Document * changes ) | ||||
| void TvCtrlPointHandleEvent( | ||||
| 	const Upnp_SID sid, | ||||
| 	int evntkey, | ||||
| 	IXML_Document *changes) | ||||
| { | ||||
|     struct TvDeviceNode *tmpdevnode; | ||||
|     int service; | ||||
| 	struct TvDeviceNode *tmpdevnode; | ||||
| 	int service; | ||||
|  | ||||
|     ithread_mutex_lock( &DeviceListMutex ); | ||||
| 	ithread_mutex_lock(&DeviceListMutex); | ||||
|  | ||||
|     tmpdevnode = GlobalDeviceList; | ||||
|     while( tmpdevnode ) { | ||||
|         for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) { | ||||
|             if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) == | ||||
|                 0 ) { | ||||
|                 SampleUtil_Print( "Received Tv %s Event: %d for SID %s", | ||||
|                                   TvServiceName[service], evntkey, sid ); | ||||
| 	tmpdevnode = GlobalDeviceList; | ||||
| 	while (tmpdevnode) { | ||||
| 		for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) { | ||||
| 			if (strcmp(tmpdevnode->device.TvService[service].SID, sid) == 0) { | ||||
| 				SampleUtil_Print("Received Tv %s Event: %d for SID %s", | ||||
| 					TvServiceName[service], | ||||
| 					evntkey, | ||||
| 					sid); | ||||
| 				TvStateUpdate( | ||||
| 					tmpdevnode->device.UDN, | ||||
| 					service, | ||||
| 					changes, | ||||
| 					(char **)&tmpdevnode->device.TvService[service].VariableStrVal); | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		tmpdevnode = tmpdevnode->next; | ||||
| 	} | ||||
|  | ||||
|                 TvStateUpdate( tmpdevnode->device.UDN, service, changes, | ||||
|                                ( char ** )&tmpdevnode->device. | ||||
|                                TvService[service].VariableStrVal ); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|         tmpdevnode = tmpdevnode->next; | ||||
|     } | ||||
|  | ||||
|     ithread_mutex_unlock( &DeviceListMutex ); | ||||
| 	ithread_mutex_unlock(&DeviceListMutex); | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
| @@ -983,10 +988,10 @@ TvCtrlPointHandleEvent( Upnp_SID sid, | ||||
|  *   timeout  -- The new timeout for the subscription | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void | ||||
| TvCtrlPointHandleSubscribeUpdate( char *eventURL, | ||||
|                                   Upnp_SID sid, | ||||
|                                   int timeout ) | ||||
| void TvCtrlPointHandleSubscribeUpdate( | ||||
| 	const char *eventURL, | ||||
| 	const Upnp_SID sid, | ||||
| 	int timeout) | ||||
| { | ||||
|     struct TvDeviceNode *tmpdevnode; | ||||
|     int service; | ||||
| @@ -1015,9 +1020,9 @@ TvCtrlPointHandleSubscribeUpdate( char *eventURL, | ||||
| } | ||||
|  | ||||
| void | ||||
| TvCtrlPointHandleGetVar( char *controlURL, | ||||
|                          char *varName, | ||||
|                          DOMString varValue ) | ||||
| TvCtrlPointHandleGetVar( const char *controlURL, | ||||
|                          const char *varName, | ||||
|                          const DOMString varValue ) | ||||
| { | ||||
|  | ||||
|     struct TvDeviceNode *tmpdevnode; | ||||
| @@ -1026,14 +1031,11 @@ TvCtrlPointHandleGetVar( char *controlURL, | ||||
|     ithread_mutex_lock( &DeviceListMutex ); | ||||
|  | ||||
|     tmpdevnode = GlobalDeviceList; | ||||
|     while( tmpdevnode ) { | ||||
|         for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) { | ||||
|             if( strcmp | ||||
|                 ( tmpdevnode->device.TvService[service].ControlURL, | ||||
|                   controlURL ) == 0 ) { | ||||
|                 SampleUtil_StateUpdate( varName, varValue, | ||||
|                                         tmpdevnode->device.UDN, | ||||
|                                         GET_VAR_COMPLETE ); | ||||
|     while (tmpdevnode) { | ||||
|         for (service = 0; service < TV_SERVICE_SERVCOUNT; service++) { | ||||
|             if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL ) == 0 ) { | ||||
|                 SampleUtil_StateUpdate( | ||||
|                     varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE ); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
| @@ -1057,186 +1059,152 @@ TvCtrlPointHandleGetVar( char *controlURL, | ||||
|  *   Cookie -- Optional data specified during callback registration | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int | ||||
| TvCtrlPointCallbackEventHandler( Upnp_EventType EventType, | ||||
|                                  void *Event, | ||||
|                                  void *Cookie ) | ||||
| int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie) | ||||
| { | ||||
|     SampleUtil_PrintEvent( EventType, Event ); | ||||
| 	/*int errCode = 0;*/ | ||||
|  | ||||
|     switch ( EventType ) { | ||||
|             /* | ||||
|                SSDP Stuff  | ||||
|              */ | ||||
|         case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: | ||||
|         case UPNP_DISCOVERY_SEARCH_RESULT: | ||||
|             { | ||||
|                 struct Upnp_Discovery *d_event = | ||||
|                     ( struct Upnp_Discovery * )Event; | ||||
|                 IXML_Document *DescDoc = NULL; | ||||
|                 int ret; | ||||
| 	SampleUtil_PrintEvent(EventType, Event); | ||||
| 	switch ( EventType ) { | ||||
| 	/* SSDP Stuff */ | ||||
| 	case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: | ||||
| 	case UPNP_DISCOVERY_SEARCH_RESULT: { | ||||
| 		struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event; | ||||
| 		IXML_Document *DescDoc = NULL; | ||||
| 		int ret; | ||||
|  | ||||
|                 if( d_event->ErrCode != UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print( "Error in Discovery Callback -- %d", | ||||
|                                       d_event->ErrCode ); | ||||
|                 } | ||||
| 		if (d_event->ErrCode != UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print( | ||||
| 				"Error in Discovery Callback -- %d", d_event->ErrCode); | ||||
| 		} | ||||
|  | ||||
|                 if( ( ret = | ||||
|                       UpnpDownloadXmlDoc( d_event->Location, | ||||
|                                           &DescDoc ) ) != | ||||
|                     UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print | ||||
|                         ( "Error obtaining device description from %s -- error = %d", | ||||
|                           d_event->Location, ret ); | ||||
|                 } else { | ||||
|                     TvCtrlPointAddDevice( DescDoc, d_event->Location, | ||||
|                                           d_event->Expires ); | ||||
|                 } | ||||
| 		ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc); | ||||
| 		if (ret != UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print( | ||||
| 				"Error obtaining device description from %s -- error = %d", | ||||
| 				d_event->Location, ret ); | ||||
| 		} else { | ||||
| 			TvCtrlPointAddDevice( | ||||
| 				DescDoc, d_event->Location, d_event->Expires); | ||||
| 		} | ||||
|  | ||||
|                 if( DescDoc ) | ||||
|                     ixmlDocument_free( DescDoc ); | ||||
| 		if( DescDoc ) { | ||||
| 			ixmlDocument_free(DescDoc); | ||||
| 		} | ||||
|  | ||||
|                 TvCtrlPointPrintList(  ); | ||||
|                 break; | ||||
|             } | ||||
| 		TvCtrlPointPrintList(); | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
|         case UPNP_DISCOVERY_SEARCH_TIMEOUT: | ||||
|             /* | ||||
|                Nothing to do here...  | ||||
|              */ | ||||
|             break; | ||||
| 	case UPNP_DISCOVERY_SEARCH_TIMEOUT: | ||||
| 		/* Nothing to do here... */ | ||||
| 		break; | ||||
|  | ||||
|         case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: | ||||
|             { | ||||
|                 struct Upnp_Discovery *d_event = | ||||
|                     ( struct Upnp_Discovery * )Event; | ||||
| 	case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: { | ||||
| 		struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event; | ||||
|  | ||||
|                 if( d_event->ErrCode != UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print | ||||
|                         ( "Error in Discovery ByeBye Callback -- %d", | ||||
|                           d_event->ErrCode ); | ||||
|                 } | ||||
| 		if (d_event->ErrCode != UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print( | ||||
| 				"Error in Discovery ByeBye Callback -- %d", d_event->ErrCode); | ||||
| 		} | ||||
|  | ||||
|                 SampleUtil_Print( "Received ByeBye for Device: %s", | ||||
|                                   d_event->DeviceId ); | ||||
|                 TvCtrlPointRemoveDevice( d_event->DeviceId ); | ||||
| 		SampleUtil_Print("Received ByeBye for Device: %s", d_event->DeviceId); | ||||
| 		TvCtrlPointRemoveDevice(d_event->DeviceId); | ||||
|  | ||||
|                 SampleUtil_Print( "After byebye:" ); | ||||
|                 TvCtrlPointPrintList(  ); | ||||
| 		SampleUtil_Print("After byebye:"); | ||||
| 		TvCtrlPointPrintList(); | ||||
|  | ||||
|                 break; | ||||
|             } | ||||
| 		break; | ||||
| 	} | ||||
| 	/* SOAP Stuff */ | ||||
| 	case UPNP_CONTROL_ACTION_COMPLETE: { | ||||
| 		struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)Event; | ||||
|  | ||||
|             /* | ||||
|                SOAP Stuff  | ||||
|              */ | ||||
|         case UPNP_CONTROL_ACTION_COMPLETE: | ||||
|             { | ||||
|                 struct Upnp_Action_Complete *a_event = | ||||
|                     ( struct Upnp_Action_Complete * )Event; | ||||
| 		if (a_event->ErrCode != UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print( | ||||
| 				"Error in  Action Complete Callback -- %d", | ||||
| 				a_event->ErrCode); | ||||
| 		} | ||||
|  | ||||
|                 if( a_event->ErrCode != UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print | ||||
|                         ( "Error in  Action Complete Callback -- %d", | ||||
|                           a_event->ErrCode ); | ||||
|                 } | ||||
| 		/* No need for any processing here, just print out results. | ||||
| 		 * Service state table updates are handled by events. */ | ||||
|  | ||||
|                 /* | ||||
|                    No need for any processing here, just print out results.  Service state | ||||
|                    table updates are handled by events.  | ||||
|                  */ | ||||
| 		break; | ||||
| 	} | ||||
| 	case UPNP_CONTROL_GET_VAR_COMPLETE: { | ||||
| 		struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event; | ||||
|  | ||||
|                 break; | ||||
|             } | ||||
| 		if (sv_event->ErrCode != UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print( | ||||
| 				"Error in Get Var Complete Callback -- %d", | ||||
| 				sv_event->ErrCode); | ||||
| 		} else { | ||||
| 			TvCtrlPointHandleGetVar( | ||||
| 				sv_event->CtrlUrl, | ||||
| 				sv_event->StateVarName, | ||||
| 				sv_event->CurrentVal); | ||||
| 		} | ||||
| 		break; | ||||
| 	} | ||||
| 	/* GENA Stuff */ | ||||
| 	case UPNP_EVENT_RECEIVED: { | ||||
| 		struct Upnp_Event *e_event = (struct Upnp_Event *)Event; | ||||
|  | ||||
|         case UPNP_CONTROL_GET_VAR_COMPLETE: | ||||
|             { | ||||
|                 struct Upnp_State_Var_Complete *sv_event = | ||||
|                     ( struct Upnp_State_Var_Complete * )Event; | ||||
| 		TvCtrlPointHandleEvent( | ||||
| 			e_event->Sid, | ||||
| 			e_event->EventKey, | ||||
| 			e_event->ChangedVariables); | ||||
| 		break; | ||||
| 	} | ||||
| 	case UPNP_EVENT_SUBSCRIBE_COMPLETE: | ||||
| 	case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: | ||||
| 	case UPNP_EVENT_RENEWAL_COMPLETE: { | ||||
| 		struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event; | ||||
|  | ||||
|                 if( sv_event->ErrCode != UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print | ||||
|                         ( "Error in Get Var Complete Callback -- %d", | ||||
|                           sv_event->ErrCode ); | ||||
|                 } else { | ||||
|                     TvCtrlPointHandleGetVar( sv_event->CtrlUrl, | ||||
|                                              sv_event->StateVarName, | ||||
|                                              sv_event->CurrentVal ); | ||||
|                 } | ||||
| 		if (es_event->ErrCode != UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print( | ||||
| 				"Error in Event Subscribe Callback -- %d", | ||||
| 				es_event->ErrCode); | ||||
| 		} else { | ||||
| 			TvCtrlPointHandleSubscribeUpdate( | ||||
| 				es_event->PublisherUrl, | ||||
| 				es_event->Sid, | ||||
| 				es_event->TimeOut); | ||||
| 		} | ||||
|  | ||||
|                 break; | ||||
|             } | ||||
| 		break; | ||||
| 	} | ||||
| 	case UPNP_EVENT_AUTORENEWAL_FAILED: | ||||
| 	case UPNP_EVENT_SUBSCRIPTION_EXPIRED: { | ||||
| 		struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event; | ||||
| 		int TimeOut = default_timeout; | ||||
| 		Upnp_SID newSID; | ||||
| 		int ret; | ||||
|  | ||||
|             /* | ||||
|                GENA Stuff  | ||||
|              */ | ||||
|         case UPNP_EVENT_RECEIVED: | ||||
|             { | ||||
|                 struct Upnp_Event *e_event = ( struct Upnp_Event * )Event; | ||||
| 		ret = UpnpSubscribe( | ||||
| 			ctrlpt_handle, | ||||
| 			es_event->PublisherUrl, | ||||
| 			&TimeOut, | ||||
| 			newSID); | ||||
|  | ||||
|                 TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey, | ||||
|                                         e_event->ChangedVariables ); | ||||
|                 break; | ||||
|             } | ||||
| 		if (ret == UPNP_E_SUCCESS) { | ||||
| 			SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID); | ||||
| 			TvCtrlPointHandleSubscribeUpdate( | ||||
| 				es_event->PublisherUrl, | ||||
| 				newSID, | ||||
| 				TimeOut); | ||||
| 		} else { | ||||
| 			SampleUtil_Print("Error Subscribing to EventURL -- %d", ret); | ||||
| 		} | ||||
| 		break; | ||||
| 	} | ||||
| 	/* ignore these cases, since this is not a device */ | ||||
| 	case UPNP_EVENT_SUBSCRIPTION_REQUEST: | ||||
| 	case UPNP_CONTROL_GET_VAR_REQUEST: | ||||
| 	case UPNP_CONTROL_ACTION_REQUEST: | ||||
| 		break; | ||||
| 	} | ||||
|  | ||||
|         case UPNP_EVENT_SUBSCRIBE_COMPLETE: | ||||
|         case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: | ||||
|         case UPNP_EVENT_RENEWAL_COMPLETE: | ||||
|             { | ||||
|                 struct Upnp_Event_Subscribe *es_event = | ||||
|                     ( struct Upnp_Event_Subscribe * )Event; | ||||
|  | ||||
|                 if( es_event->ErrCode != UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print | ||||
|                         ( "Error in Event Subscribe Callback -- %d", | ||||
|                           es_event->ErrCode ); | ||||
|                 } else { | ||||
|                     TvCtrlPointHandleSubscribeUpdate( es_event-> | ||||
|                                                       PublisherUrl, | ||||
|                                                       es_event->Sid, | ||||
|                                                       es_event->TimeOut ); | ||||
|                 } | ||||
|  | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
|         case UPNP_EVENT_AUTORENEWAL_FAILED: | ||||
|         case UPNP_EVENT_SUBSCRIPTION_EXPIRED: | ||||
|             { | ||||
|                 int TimeOut = default_timeout; | ||||
|                 Upnp_SID newSID; | ||||
|                 int ret; | ||||
|  | ||||
|                 struct Upnp_Event_Subscribe *es_event = | ||||
|                     ( struct Upnp_Event_Subscribe * )Event; | ||||
|  | ||||
|                 ret = | ||||
|                     UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl, | ||||
|                                    &TimeOut, newSID ); | ||||
|  | ||||
|                 if( ret == UPNP_E_SUCCESS ) { | ||||
|                     SampleUtil_Print( "Subscribed to EventURL with SID=%s", | ||||
|                                       newSID ); | ||||
|                     TvCtrlPointHandleSubscribeUpdate( es_event-> | ||||
|                                                       PublisherUrl, newSID, | ||||
|                                                       TimeOut ); | ||||
|                 } else { | ||||
|                     SampleUtil_Print | ||||
|                         ( "Error Subscribing to EventURL -- %d", ret ); | ||||
|                 } | ||||
|                 break; | ||||
|             } | ||||
|  | ||||
|             /* | ||||
|                ignore these cases, since this is not a device  | ||||
|              */ | ||||
|         case UPNP_EVENT_SUBSCRIPTION_REQUEST: | ||||
|         case UPNP_CONTROL_GET_VAR_REQUEST: | ||||
|         case UPNP_CONTROL_ACTION_REQUEST: | ||||
|             break; | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| /******************************************************************************** | ||||
| @@ -1320,12 +1288,12 @@ TvCtrlPointVerifyTimeouts( int incr ) | ||||
|  *    None | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| void * | ||||
| TvCtrlPointTimerLoop( void *args ) | ||||
| static int TvCtrlPointTimerLoopRun = 1; | ||||
| void *TvCtrlPointTimerLoop(void *args) | ||||
| { | ||||
|     int incr = 30;              // how often to verify the timeouts, in seconds | ||||
|  | ||||
|     while( 1 ) { | ||||
|     while (TvCtrlPointTimerLoopRun) { | ||||
|         isleep( incr ); | ||||
|         TvCtrlPointVerifyTimeouts( incr ); | ||||
|     } | ||||
| @@ -1348,62 +1316,70 @@ TvCtrlPointTimerLoop( void *args ) | ||||
|  *		TV_SUCCESS if everything went well, else TV_ERROR | ||||
|  * | ||||
|  ********************************************************************************/ | ||||
| int | ||||
| TvCtrlPointStart( print_string printFunctionPtr, | ||||
|                   state_update updateFunctionPtr ) | ||||
| int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionPtr) | ||||
| { | ||||
|     ithread_t timer_thread; | ||||
|     int rc; | ||||
|     short int port = 0; | ||||
|     char *ip_address = NULL; | ||||
| 	ithread_t timer_thread; | ||||
| 	int rc; | ||||
| 	unsigned short port = 0; | ||||
| 	char *ip_address = NULL; | ||||
|  | ||||
|     SampleUtil_Initialize( printFunctionPtr ); | ||||
|     SampleUtil_RegisterUpdateFunction( updateFunctionPtr ); | ||||
| 	SampleUtil_Initialize(printFunctionPtr); | ||||
| 	SampleUtil_RegisterUpdateFunction(updateFunctionPtr); | ||||
|  | ||||
|     ithread_mutex_init( &DeviceListMutex, 0 ); | ||||
| 	ithread_mutex_init(&DeviceListMutex, 0); | ||||
|  | ||||
|     SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d", | ||||
|                       ip_address, port ); | ||||
|     rc = UpnpInit( ip_address, port ); | ||||
|     if( UPNP_E_SUCCESS != rc ) { | ||||
|         SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc ); | ||||
|         UpnpFinish(  ); | ||||
|         return TV_ERROR; | ||||
|     } | ||||
| 	SampleUtil_Print( | ||||
| 		"Initializing UPnP Sdk with\n" | ||||
| 		"\tipaddress = %s port = %u\n", | ||||
| 		ip_address, port); | ||||
|  | ||||
|     if( NULL == ip_address ) | ||||
|         ip_address = UpnpGetServerIpAddress(  ); | ||||
|     if( 0 == port ) | ||||
|         port = UpnpGetServerPort(  ); | ||||
| 	rc = UpnpInit(ip_address, port); | ||||
| 	if (rc != UPNP_E_SUCCESS) { | ||||
| 		SampleUtil_Print("WinCEStart: UpnpInit() Error: %d", rc); | ||||
| 		UpnpFinish(); | ||||
| 		return TV_ERROR; | ||||
| 	} | ||||
| 	if (!ip_address) { | ||||
| 		ip_address = UpnpGetServerIpAddress(); | ||||
| 	} | ||||
| 	if (!port) { | ||||
| 		port = UpnpGetServerPort(); | ||||
| 	} | ||||
|  | ||||
|     SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port ); | ||||
| 	SampleUtil_Print( | ||||
| 		"UPnP Initialized\n" | ||||
| 		"\tipaddress= %s port = %u\n", | ||||
| 		ip_address, port); | ||||
|  | ||||
|     SampleUtil_Print( "Registering Control Point" ); | ||||
|     rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler, | ||||
|                              &ctrlpt_handle, &ctrlpt_handle ); | ||||
|     if( UPNP_E_SUCCESS != rc ) { | ||||
|         SampleUtil_Print( "Error registering CP: %d", rc ); | ||||
|         UpnpFinish(  ); | ||||
|         return TV_ERROR; | ||||
|     } | ||||
| 	SampleUtil_Print("Registering Control Point"); | ||||
| 	rc = UpnpRegisterClient(TvCtrlPointCallbackEventHandler, | ||||
| 		&ctrlpt_handle, &ctrlpt_handle); | ||||
| 	if (rc != UPNP_E_SUCCESS) { | ||||
| 		SampleUtil_Print( "Error registering CP: %d", rc ); | ||||
| 		UpnpFinish(); | ||||
|  | ||||
|     SampleUtil_Print( "Control Point Registered" ); | ||||
| 		return TV_ERROR; | ||||
| 	} | ||||
|  | ||||
|     TvCtrlPointRefresh(  ); | ||||
| 	SampleUtil_Print("Control Point Registered"); | ||||
|  | ||||
|     // start a timer thread | ||||
|     ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL ); | ||||
| 	TvCtrlPointRefresh(); | ||||
|  | ||||
|     return TV_SUCCESS; | ||||
| 	/* start a timer thread */ | ||||
| 	ithread_create(&timer_thread, NULL, TvCtrlPointTimerLoop, NULL); | ||||
| 	ithread_detach(timer_thread); | ||||
|  | ||||
| 	return TV_SUCCESS; | ||||
| } | ||||
|  | ||||
| int | ||||
| TvCtrlPointStop( void ) | ||||
| int TvCtrlPointStop(void) | ||||
| { | ||||
|     TvCtrlPointRemoveAll(  ); | ||||
|     UpnpUnRegisterClient( ctrlpt_handle ); | ||||
|     UpnpFinish(  ); | ||||
|     SampleUtil_Finish(  ); | ||||
| 	TvCtrlPointTimerLoopRun = 0; | ||||
| 	TvCtrlPointRemoveAll(); | ||||
| 	UpnpUnRegisterClient( ctrlpt_handle ); | ||||
| 	UpnpFinish(); | ||||
| 	SampleUtil_Finish(); | ||||
|  | ||||
|     return TV_SUCCESS; | ||||
| 	return TV_SUCCESS; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,53 +1,65 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #ifndef UPNP_TV_CTRLPT_H | ||||
| #define UPNP_TV_CTRLPT_H | ||||
|  | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
| #include "sample_util.h" | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include <unistd.h> | ||||
| #include <stdarg.h> | ||||
| #include <stdlib.h> | ||||
| #include <signal.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "upnp.h" | ||||
| #include "upnptools.h" | ||||
| #include "sample_util.h" | ||||
|  | ||||
|  | ||||
| #include <signal.h> | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
| #ifdef WIN32 | ||||
| 	/* Do not #include <unistd.h> */ | ||||
| #else | ||||
| 	#include <unistd.h> | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #define TV_SERVICE_SERVCOUNT	2 | ||||
| #define TV_SERVICE_CONTROL		0 | ||||
| @@ -66,12 +78,12 @@ extern "C" { | ||||
|  | ||||
| #define TV_MAX_VAL_LEN			5 | ||||
|  | ||||
| #define TV_SUCCESS				0 | ||||
| #define TV_ERROR				(-1) | ||||
| #define TV_WARNING				1 | ||||
| #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 | ||||
| #define TV_MAXVARS			TV_PICTURE_VARCOUNT | ||||
|  | ||||
| extern char TvDeviceType[]; | ||||
| extern char *TvServiceType[]; | ||||
| @@ -108,11 +120,11 @@ extern ithread_mutex_t DeviceListMutex; | ||||
|  | ||||
| extern UpnpClient_Handle ctrlpt_handle; | ||||
|  | ||||
| void	TvCtrlPointPrintHelp( void ); | ||||
| void		TvCtrlPointPrintHelp(void); | ||||
| int		TvCtrlPointDeleteNode(struct TvDeviceNode*); | ||||
| int		TvCtrlPointRemoveDevice(char*); | ||||
| int		TvCtrlPointRemoveAll( void ); | ||||
| int		TvCtrlPointRefresh( void ); | ||||
| int		TvCtrlPointRemoveDevice(const char *); | ||||
| int		TvCtrlPointRemoveAll(void); | ||||
| int		TvCtrlPointRefresh(void); | ||||
|  | ||||
|  | ||||
| int		TvCtrlPointSendAction(int, int, char *, char **, char **, int); | ||||
| @@ -138,11 +150,11 @@ int		TvCtrlPointGetBrightness(int); | ||||
| int		TvCtrlPointGetDevice(int, struct TvDeviceNode **); | ||||
| int		TvCtrlPointPrintList( void ); | ||||
| int		TvCtrlPointPrintDevice(int); | ||||
| void	TvCtrlPointAddDevice (IXML_Document *, char *, int);  | ||||
| void    TvCtrlPointHandleGetVar(char *,char *,DOMString); | ||||
| void	TvCtrlPointAddDevice(IXML_Document *, const char *, int);  | ||||
| void    TvCtrlPointHandleGetVar(const char *, const char *, const DOMString); | ||||
| void	TvStateUpdate(char*,int, IXML_Document * , char **); | ||||
| void	TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);  | ||||
| void	TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);  | ||||
| void	TvCtrlPointHandleEvent(const Upnp_SID, int, IXML_Document *);  | ||||
| void	TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);  | ||||
| int		TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *); | ||||
| void	TvCtrlPointVerifyTimeouts(int); | ||||
| void	TvCtrlPointPrintCommands( void ); | ||||
|   | ||||
| @@ -1,38 +1,42 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
| #include "sample_util.h" | ||||
| #include "upnp_tv_device.h" | ||||
|  | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * linux_print | ||||
|  * | ||||
| @@ -82,7 +86,7 @@ TvDeviceCommandLoop( void *args ) | ||||
|  | ||||
|         if( strcasecmp( cmd, "exit" ) == 0 ) { | ||||
|             SampleUtil_Print( "Shutting down...\n" ); | ||||
|             TvDeviceStop(  ); | ||||
|             TvDeviceStop(); | ||||
|             exit( 0 ); | ||||
|         } else { | ||||
|             SampleUtil_Print( "\n   Unknown command: %s\n\n", cmd ); | ||||
| @@ -117,26 +121,27 @@ TvDeviceCommandLoop( void *args ) | ||||
|  *                  | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| main( IN int argc, | ||||
|       IN char **argv ) | ||||
| int main( IN int argc, IN char **argv ) | ||||
| { | ||||
|  | ||||
|     unsigned int portTemp = 0; | ||||
|     char *ip_address = NULL, | ||||
|      *desc_doc_name = NULL, | ||||
|      *web_dir_path = NULL; | ||||
|     int rc; | ||||
|     ithread_t cmdloop_thread; | ||||
|     int code; | ||||
|     unsigned int port = 0; | ||||
| #ifdef WIN32 | ||||
| #else | ||||
|     int sig; | ||||
|     sigset_t sigs_to_catch; | ||||
|  | ||||
| #endif | ||||
|     int code; | ||||
|     unsigned int port = 0; | ||||
|     int i = 0; | ||||
|  | ||||
|     SampleUtil_Initialize( linux_print ); | ||||
|  | ||||
|     //Parse options | ||||
|     // Parse options | ||||
|     for( i = 1; i < argc; i++ ) { | ||||
|         if( strcmp( argv[i], "-ip" ) == 0 ) { | ||||
|             ip_address = argv[++i]; | ||||
| @@ -163,21 +168,20 @@ main( IN int argc, | ||||
|                 ( "\tweb_dir_path: Filesystem path where web files " | ||||
|                   "related to the device are stored\n" ); | ||||
|             SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" ); | ||||
|             exit( 1 ); | ||||
|             return 1; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     port = ( unsigned short )portTemp; | ||||
|  | ||||
|     TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, | ||||
|                    linux_print ); | ||||
|     TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print ); | ||||
|  | ||||
|     /* | ||||
|        start a command loop thread  | ||||
|      */ | ||||
|     code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop, | ||||
|                            NULL ); | ||||
|     /* start a command loop thread */ | ||||
|     code = ithread_create( &cmdloop_thread, NULL, TvDeviceCommandLoop, NULL ); | ||||
|  | ||||
| #ifdef WIN32 | ||||
|     ithread_join(cmdloop_thread, NULL); | ||||
| #else | ||||
|     /* | ||||
|        Catch Ctrl-C and properly shutdown  | ||||
|      */ | ||||
| @@ -186,6 +190,9 @@ main( IN int argc, | ||||
|     sigwait( &sigs_to_catch, &sig ); | ||||
|  | ||||
|     SampleUtil_Print( "Shutting down on signal %d...\n", sig ); | ||||
|     TvDeviceStop(  ); | ||||
|     exit( 0 ); | ||||
| #endif | ||||
|     rc = TvDeviceStop(); | ||||
|      | ||||
|     return rc; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,40 +1,47 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "upnp_tv_device.h" | ||||
|  | ||||
|  | ||||
| #include <assert.h> | ||||
|  | ||||
|  | ||||
| #define DEFAULT_WEB_DIR "./web" | ||||
|  | ||||
|  | ||||
| #define DESC_URL_SIZE 200 | ||||
|  | ||||
|  | ||||
| /* | ||||
|    Device type for tv device  | ||||
|  */ | ||||
| @@ -180,7 +187,6 @@ SetServiceTable( IN int serviceType, | ||||
|     } | ||||
|  | ||||
|     return SetActionTable( serviceType, out ); | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -251,7 +257,6 @@ SetActionTable( IN int serviceType, | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -374,10 +379,10 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request | ||||
| { | ||||
|     unsigned int i = 0;         //,j=0; | ||||
|  | ||||
|     // IXML_Document *PropSet=NULL; | ||||
| 	// IXML_Document *PropSet = NULL; | ||||
|  | ||||
|     //lock state mutex | ||||
|     ithread_mutex_lock( &TVDevMutex ); | ||||
| 	// lock state mutex | ||||
| 	ithread_mutex_lock( &TVDevMutex ); | ||||
|  | ||||
|     for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) { | ||||
|         if( ( strcmp( sr_event->UDN, tv_service_table[i].UDN ) == 0 ) && | ||||
| @@ -385,44 +390,48 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request | ||||
|               == 0 ) ) { | ||||
|  | ||||
|             /* | ||||
|                PropSet = NULL; | ||||
| 			PropSet = NULL; | ||||
|  | ||||
|                for (j=0; j< tv_service_table[i].VariableCount; j++) | ||||
|                { | ||||
|                //add each variable to the property set | ||||
|                //for initial state dump | ||||
|                UpnpAddToPropertySet(&PropSet,  | ||||
|                tv_service_table[i].VariableName[j], | ||||
|                tv_service_table[i].VariableStrVal[j]); | ||||
|                } | ||||
| 			for (j = 0; j< tv_service_table[i].VariableCount; ++j) { | ||||
| 				// add each variable to the property set | ||||
| 				// for initial state dump | ||||
| 				UpnpAddToPropertySet( | ||||
| 					&PropSet,  | ||||
| 					tv_service_table[i].VariableName[j], | ||||
| 					tv_service_table[i].VariableStrVal[j]); | ||||
| 			} | ||||
|  | ||||
|                //dump initial state  | ||||
|                UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,  | ||||
|                sr_event->ServiceId, | ||||
|                PropSet,sr_event->Sid); | ||||
|                //free document | ||||
|                Document_free(PropSet); | ||||
| 			// dump initial state  | ||||
| 			UpnpAcceptSubscriptionExt( | ||||
| 				device_handle, | ||||
| 				sr_event->UDN,  | ||||
| 				sr_event->ServiceId, | ||||
| 				PropSet, | ||||
| 				sr_event->Sid); | ||||
| 			// free document | ||||
| 			Document_free(PropSet); | ||||
|  | ||||
|              */ | ||||
|  | ||||
|             UpnpAcceptSubscription( device_handle, | ||||
|                                     sr_event->UDN, | ||||
|                                     sr_event->ServiceId, | ||||
|                                     ( const char ** )tv_service_table[i]. | ||||
|                                     VariableName, | ||||
|                                     ( const char ** )tv_service_table[i]. | ||||
|                                     VariableStrVal, | ||||
|                                     tv_service_table[i].VariableCount, | ||||
|                                     sr_event->Sid ); | ||||
| 			UpnpAcceptSubscription( device_handle, | ||||
| 				sr_event->UDN, | ||||
| 				sr_event->ServiceId, | ||||
| 				(const char **)tv_service_table[i]. | ||||
| 				VariableName, | ||||
| 				(const char **)tv_service_table[i]. | ||||
| 				VariableStrVal, | ||||
| 				tv_service_table[i].VariableCount, | ||||
| 				sr_event->Sid); | ||||
|  | ||||
|         } | ||||
|     } | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|     ithread_mutex_unlock( &TVDevMutex ); | ||||
| 	ithread_mutex_unlock( &TVDevMutex ); | ||||
|  | ||||
|     return ( 1 ); | ||||
| 	return 1; | ||||
| } | ||||
|  | ||||
|  | ||||
| /****************************************************************************** | ||||
|  * TvDeviceHandleGetVarRequest | ||||
|  * | ||||
| @@ -439,8 +448,8 @@ int | ||||
| TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request | ||||
|                              *cgv_event ) | ||||
| { | ||||
|     unsigned int i = 0, | ||||
|       j = 0; | ||||
|     unsigned int i = 0; | ||||
|     unsigned int j = 0; | ||||
|     int getvar_succeeded = 0; | ||||
|  | ||||
|     cgv_event->CurrentVal = NULL; | ||||
| @@ -448,12 +457,12 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request | ||||
|     ithread_mutex_lock( &TVDevMutex ); | ||||
|  | ||||
|     for( i = 0; i < TV_SERVICE_SERVCOUNT; i++ ) { | ||||
|         //check udn and service id | ||||
|         // check udn and service id | ||||
|         if( ( strcmp( cgv_event->DevUDN, tv_service_table[i].UDN ) == 0 ) | ||||
|             && | ||||
|             ( strcmp( cgv_event->ServiceID, tv_service_table[i].ServiceId ) | ||||
|               == 0 ) ) { | ||||
|             //check variable name | ||||
|             // check variable name | ||||
|             for( j = 0; j < tv_service_table[i].VariableCount; j++ ) { | ||||
|                 if( strcmp( cgv_event->StateVarName, | ||||
|                             tv_service_table[i].VariableName[j] ) == 0 ) { | ||||
| @@ -498,7 +507,6 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request | ||||
| int | ||||
| TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event ) | ||||
| { | ||||
|  | ||||
|     /* | ||||
|        Defaults if action not found  | ||||
|      */ | ||||
| @@ -551,7 +559,7 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event ) | ||||
|                                                            ActionRequest, | ||||
|                                                            &ca_event-> | ||||
|                                                            ActionResult, | ||||
|                                                            &errorString ); | ||||
|                     &errorString ); | ||||
|             } else { | ||||
|                 errorString = "Power is Off"; | ||||
|                 retCode = UPNP_E_INTERNAL_ERROR; | ||||
| @@ -569,7 +577,7 @@ TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event ) | ||||
|         if( retCode == UPNP_E_SUCCESS ) { | ||||
|             ca_event->ErrCode = UPNP_E_SUCCESS; | ||||
|         } else { | ||||
|             //copy the error string  | ||||
|             // copy the error string | ||||
|             strcpy( ca_event->ErrStr, errorString ); | ||||
|             switch ( retCode ) { | ||||
|                 case UPNP_E_INVALID_PARAM: | ||||
| @@ -651,7 +659,6 @@ TvDeviceSetServiceTableVar( IN unsigned int service, | ||||
|     ithread_mutex_unlock( &TVDevMutex ); | ||||
|  | ||||
|     return ( 1 ); | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -674,7 +681,7 @@ TvDeviceSetPower( IN int on ) | ||||
|  | ||||
|     if( on != POWER_ON && on != POWER_OFF ) { | ||||
|         SampleUtil_Print( "error: can't set power to value %d\n", on ); | ||||
|         return ( 0 ); | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     /* | ||||
| @@ -685,7 +692,7 @@ TvDeviceSetPower( IN int on ) | ||||
|     ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER, | ||||
|                                       value ); | ||||
|  | ||||
|     return ( ret ); | ||||
|     return ret; | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -702,9 +709,7 @@ TvDeviceSetPower( IN int on ) | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDevicePowerOn( IN IXML_Document * in, | ||||
|                  OUT IXML_Document ** out, | ||||
|                  OUT char **errorString ) | ||||
| TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     ( *out ) = NULL; | ||||
|     ( *errorString ) = NULL; | ||||
| @@ -724,7 +729,6 @@ TvDevicePowerOn( IN IXML_Document * in, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -742,7 +746,7 @@ TvDevicePowerOn( IN IXML_Document * in, | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDevicePowerOff( IN IXML_Document * in, | ||||
|                   OUT IXML_Document ** out, | ||||
|                   OUT IXML_Document **out, | ||||
|                   OUT char **errorString ) | ||||
| { | ||||
|     ( *out ) = NULL; | ||||
| @@ -781,11 +785,8 @@ TvDevicePowerOff( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceSetChannel( IN IXML_Document * in, | ||||
|                     OUT IXML_Document ** out, | ||||
|                     OUT char **errorString ) | ||||
| TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     char *value = NULL; | ||||
|  | ||||
|     int channel = 0; | ||||
| @@ -830,7 +831,6 @@ TvDeviceSetChannel( IN IXML_Document * in, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -848,13 +848,10 @@ TvDeviceSetChannel( IN IXML_Document * in, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| IncrementChannel( IN int incr, | ||||
|                   IN IXML_Document * in, | ||||
|                   OUT IXML_Document ** out, | ||||
|                   OUT char **errorString ) | ||||
| IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     int curchannel, | ||||
|       newchannel; | ||||
|     int curchannel; | ||||
|     int newchannel; | ||||
|  | ||||
|     char *actionName = NULL; | ||||
|     char value[TV_MAX_VAL_LEN]; | ||||
| @@ -916,12 +913,9 @@ IncrementChannel( IN int incr, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceDecreaseChannel( IN IXML_Document * in, | ||||
|                          OUT IXML_Document ** out, | ||||
|                          OUT char **errorString ) | ||||
| TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     return IncrementChannel( -1, in, out, errorString ); | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -938,12 +932,9 @@ TvDeviceDecreaseChannel( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceIncreaseChannel( IN IXML_Document * in, | ||||
|                          OUT IXML_Document ** out, | ||||
|                          OUT char **errorString ) | ||||
| TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     return IncrementChannel( 1, in, out, errorString ); | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -962,13 +953,9 @@ TvDeviceIncreaseChannel( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceSetVolume( IN IXML_Document * in, | ||||
|                    OUT IXML_Document ** out, | ||||
|                    OUT char **errorString ) | ||||
| TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     char *value = NULL; | ||||
|  | ||||
|     int volume = 0; | ||||
|  | ||||
|     ( *out ) = NULL; | ||||
| @@ -1009,7 +996,6 @@ TvDeviceSetVolume( IN IXML_Document * in, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1028,10 +1014,7 @@ TvDeviceSetVolume( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| IncrementVolume( IN int incr, | ||||
|                  IN IXML_Document * in, | ||||
|                  OUT IXML_Document ** out, | ||||
|                  OUT char **errorString ) | ||||
| IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     int curvolume, | ||||
|       newvolume; | ||||
| @@ -1068,8 +1051,7 @@ IncrementVolume( IN int incr, | ||||
|                                     TV_CONTROL_VOLUME, value ) ) { | ||||
|         if( UpnpAddToActionResponse( out, actionName, | ||||
|                                      TvServiceType[TV_SERVICE_CONTROL], | ||||
|                                      "Volume", value ) != UPNP_E_SUCCESS ) | ||||
|         { | ||||
|                                      "Volume", value ) != UPNP_E_SUCCESS ) { | ||||
|             ( *out ) = NULL; | ||||
|             ( *errorString ) = "Internal Error"; | ||||
|             return UPNP_E_INTERNAL_ERROR; | ||||
| @@ -1079,7 +1061,6 @@ IncrementVolume( IN int incr, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1096,13 +1077,9 @@ IncrementVolume( IN int incr, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceIncreaseVolume( IN IXML_Document * in, | ||||
|                         OUT IXML_Document ** out, | ||||
|                         OUT char **errorString ) | ||||
| TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementVolume( 1, in, out, errorString ); | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1119,13 +1096,9 @@ TvDeviceIncreaseVolume( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceDecreaseVolume( IN IXML_Document * in, | ||||
|                         OUT IXML_Document ** out, | ||||
|                         OUT char **errorString ) | ||||
| TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementVolume( -1, in, out, errorString ); | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1144,13 +1117,9 @@ TvDeviceDecreaseVolume( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceSetColor( IN IXML_Document * in, | ||||
|                   OUT IXML_Document ** out, | ||||
|                   OUT char **errorString ) | ||||
| TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     char *value = NULL; | ||||
|  | ||||
|     int color = 0; | ||||
|  | ||||
|     ( *out ) = NULL; | ||||
| @@ -1190,7 +1159,6 @@ TvDeviceSetColor( IN IXML_Document * in, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1207,16 +1175,11 @@ TvDeviceSetColor( IN IXML_Document * in, | ||||
|  *    IXML_Document **out - action result document | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
|  | ||||
| int | ||||
| IncrementColor( IN int incr, | ||||
|                 IN IXML_Document * in, | ||||
|                 OUT IXML_Document ** out, | ||||
|                 OUT char **errorString ) | ||||
| IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     int curcolor, | ||||
|       newcolor; | ||||
|  | ||||
|     int curcolor; | ||||
|     int newcolor; | ||||
|     char *actionName; | ||||
|     char value[TV_MAX_VAL_LEN]; | ||||
|  | ||||
| @@ -1274,11 +1237,8 @@ IncrementColor( IN int incr, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceDecreaseColor( IN IXML_Document * in, | ||||
|                        OUT IXML_Document ** out, | ||||
|                        OUT char **errorString ) | ||||
| TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementColor( -1, in, out, errorString ); | ||||
| } | ||||
|  | ||||
| @@ -1295,11 +1255,8 @@ TvDeviceDecreaseColor( IN IXML_Document * in, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceIncreaseColor( IN IXML_Document * in, | ||||
|                        OUT IXML_Document ** out, | ||||
|                        OUT char **errorString ) | ||||
| TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementColor( 1, in, out, errorString ); | ||||
| } | ||||
|  | ||||
| @@ -1319,13 +1276,9 @@ TvDeviceIncreaseColor( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceSetTint( IN IXML_Document * in, | ||||
|                  OUT IXML_Document ** out, | ||||
|                  OUT char **errorString ) | ||||
| TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     char *value = NULL; | ||||
|  | ||||
|     int tint = -1; | ||||
|  | ||||
|     ( *out ) = NULL; | ||||
| @@ -1384,14 +1337,10 @@ TvDeviceSetTint( IN IXML_Document * in, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| IncrementTint( IN int incr, | ||||
|                IN IXML_Document * in, | ||||
|                OUT IXML_Document ** out, | ||||
|                OUT char **errorString ) | ||||
| IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     int curtint, | ||||
|       newtint; | ||||
|  | ||||
|     int curtint; | ||||
|     int newtint; | ||||
|     char *actionName = NULL; | ||||
|     char value[TV_MAX_VAL_LEN]; | ||||
|  | ||||
| @@ -1434,7 +1383,6 @@ IncrementTint( IN int incr, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1451,11 +1399,8 @@ IncrementTint( IN int incr, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceIncreaseTint( IN IXML_Document * in, | ||||
|                       OUT IXML_Document ** out, | ||||
|                       OUT char **errorString ) | ||||
| TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementTint( 1, in, out, errorString ); | ||||
| } | ||||
|  | ||||
| @@ -1473,11 +1418,8 @@ TvDeviceIncreaseTint( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceDecreaseTint( IN IXML_Document * in, | ||||
|                       OUT IXML_Document ** out, | ||||
|                       OUT char **errorString ) | ||||
| TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementTint( -1, in, out, errorString ); | ||||
| } | ||||
|  | ||||
| @@ -1497,11 +1439,8 @@ TvDeviceDecreaseTint( IN IXML_Document * in, | ||||
|  * | ||||
|  ****************************************************************************/ | ||||
| int | ||||
| TvDeviceSetContrast( IN IXML_Document * in, | ||||
|                      OUT IXML_Document ** out, | ||||
|                      OUT char **errorString ) | ||||
| TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     char *value = NULL; | ||||
|     int contrast = -1; | ||||
|  | ||||
| @@ -1562,14 +1501,10 @@ TvDeviceSetContrast( IN IXML_Document * in, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| IncrementContrast( IN int incr, | ||||
|                    IN IXML_Document * in, | ||||
|                    OUT IXML_Document ** out, | ||||
|                    OUT char **errorString ) | ||||
| IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     int curcontrast, | ||||
|       newcontrast; | ||||
|  | ||||
|     int curcontrast; | ||||
|     int newcontrast; | ||||
|     char *actionName = NULL; | ||||
|     char value[TV_MAX_VAL_LEN]; | ||||
|  | ||||
| @@ -1631,11 +1566,8 @@ IncrementContrast( IN int incr, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceIncreaseContrast( IN IXML_Document * in, | ||||
|                           OUT IXML_Document ** out, | ||||
|                           OUT char **errorString ) | ||||
| TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     return IncrementContrast( 1, in, out, errorString ); | ||||
| } | ||||
|  | ||||
| @@ -1653,9 +1585,7 @@ TvDeviceIncreaseContrast( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceDecreaseContrast( IXML_Document * in, | ||||
|                           IXML_Document ** out, | ||||
|                           char **errorString ) | ||||
| TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     return IncrementContrast( -1, in, out, errorString ); | ||||
| } | ||||
| @@ -1673,11 +1603,8 @@ TvDeviceDecreaseContrast( IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceSetBrightness( IN IXML_Document * in, | ||||
|                        OUT IXML_Document ** out, | ||||
|                        OUT char **errorString ) | ||||
| TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|  | ||||
|     char *value = NULL; | ||||
|     int brightness = -1; | ||||
|  | ||||
| @@ -1720,7 +1647,6 @@ TvDeviceSetBrightness( IN IXML_Document * in, | ||||
|         ( *errorString ) = "Internal Error"; | ||||
|         return UPNP_E_INTERNAL_ERROR; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1738,13 +1664,10 @@ TvDeviceSetBrightness( IN IXML_Document * in, | ||||
|  *    char **errorString - errorString (in case action was unsuccessful) | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| IncrementBrightness( IN int incr, | ||||
|                      IN IXML_Document * in, | ||||
|                      OUT IXML_Document ** out, | ||||
|                      OUT char **errorString ) | ||||
| IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     int curbrightness, | ||||
|       newbrightness; | ||||
|     int curbrightness; | ||||
|     int newbrightness; | ||||
|     char *actionName = NULL; | ||||
|     char value[TV_MAX_VAL_LEN]; | ||||
|  | ||||
| @@ -1805,9 +1728,7 @@ IncrementBrightness( IN int incr, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceIncreaseBrightness( IN IXML_Document * in, | ||||
|                             OUT IXML_Document ** out, | ||||
|                             OUT char **errorString ) | ||||
| TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     return IncrementBrightness( 1, in, out, errorString ); | ||||
| } | ||||
| @@ -1825,9 +1746,7 @@ TvDeviceIncreaseBrightness( IN IXML_Document * in, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceDecreaseBrightness( IN IXML_Document * in, | ||||
|                             OUT IXML_Document ** out, | ||||
|                             OUT char **errorString ) | ||||
| TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString ) | ||||
| { | ||||
|     return IncrementBrightness( -1, in, out, errorString ); | ||||
| } | ||||
| @@ -1851,14 +1770,9 @@ TvDeviceDecreaseBrightness( IN IXML_Document * in, | ||||
|  *   Cookie -- Optional data specified during callback registration | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceCallbackEventHandler( Upnp_EventType EventType, | ||||
|                               void *Event, | ||||
|                               void *Cookie ) | ||||
| int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Cookie) | ||||
| { | ||||
|  | ||||
|     switch ( EventType ) { | ||||
|  | ||||
|         case UPNP_EVENT_SUBSCRIPTION_REQUEST: | ||||
|  | ||||
|             TvDeviceHandleSubscriptionRequest( ( struct | ||||
| @@ -1892,17 +1806,14 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType, | ||||
|             break; | ||||
|  | ||||
|         default: | ||||
|             SampleUtil_Print | ||||
|                 ( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n", | ||||
|                   EventType ); | ||||
|             SampleUtil_Print( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n", | ||||
|                 EventType ); | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|        Print a summary of the event received  | ||||
|      */ | ||||
|     /* Print a summary of the event received */ | ||||
|     SampleUtil_PrintEvent( EventType, Event ); | ||||
|  | ||||
|     return ( 0 ); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| /****************************************************************************** | ||||
| @@ -1915,12 +1826,13 @@ TvDeviceCallbackEventHandler( Upnp_EventType EventType, | ||||
|  * | ||||
|  *****************************************************************************/ | ||||
| int | ||||
| TvDeviceStop(  ) | ||||
| TvDeviceStop(void) | ||||
| { | ||||
|     UpnpUnRegisterRootDevice( device_handle ); | ||||
|     UpnpFinish(  ); | ||||
|     SampleUtil_Finish(  ); | ||||
|     UpnpFinish(); | ||||
|     SampleUtil_Finish(); | ||||
|     ithread_mutex_destroy( &TVDevMutex ); | ||||
|  | ||||
|     return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| @@ -1953,79 +1865,83 @@ TvDeviceStart( char *ip_address, | ||||
|                print_string pfun ) | ||||
| { | ||||
|     int ret = UPNP_E_SUCCESS; | ||||
|  | ||||
|     char desc_doc_url[DESC_URL_SIZE]; | ||||
|  | ||||
|     ithread_mutex_init( &TVDevMutex, NULL ); | ||||
|  | ||||
|     SampleUtil_Initialize( pfun ); | ||||
|  | ||||
|     SampleUtil_Print | ||||
|         ( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n", | ||||
|           ip_address, port ); | ||||
|     SampleUtil_Print( | ||||
|         "Initializing UPnP Sdk with\n" | ||||
|         "\tipaddress = %s port = %u\n", | ||||
|         ip_address, port ); | ||||
|  | ||||
|     if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) { | ||||
|     ret = UpnpInit( ip_address, port ); | ||||
|     if( ret != UPNP_E_SUCCESS ) { | ||||
|         SampleUtil_Print( "Error with UpnpInit -- %d\n", ret ); | ||||
|         UpnpFinish(  ); | ||||
|         UpnpFinish(); | ||||
|         return ret; | ||||
|     } | ||||
|  | ||||
|     if( ip_address == NULL ) { | ||||
|         ip_address = UpnpGetServerIpAddress(  ); | ||||
|     ip_address = UpnpGetServerIpAddress(); | ||||
|     port = UpnpGetServerPort(); | ||||
|  | ||||
|     SampleUtil_Print( | ||||
|         "UPnP Initialized\n" | ||||
| 	"\tipaddress= %s port = %u\n", | ||||
|         ip_address, port ); | ||||
|  | ||||
|     if( desc_doc_name == NULL ) { | ||||
|         desc_doc_name = "tvdevicedesc.xml"; | ||||
|     } | ||||
|  | ||||
|         port = UpnpGetServerPort(  ); | ||||
|  | ||||
|     SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n", | ||||
|                       ip_address, port ); | ||||
|  | ||||
|     if( desc_doc_name == NULL ) | ||||
|         desc_doc_name = "tvdevicedesc.xml"; | ||||
|  | ||||
|     if( web_dir_path == NULL ) | ||||
|     if( web_dir_path == NULL ) { | ||||
|         web_dir_path = DEFAULT_WEB_DIR; | ||||
|     } | ||||
|  | ||||
|     snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address, | ||||
|               port, desc_doc_name ); | ||||
|  | ||||
|     SampleUtil_Print( "Specifying the webserver root directory -- %s\n", | ||||
|                       web_dir_path ); | ||||
|     if( ( ret = | ||||
|           UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) { | ||||
|         SampleUtil_Print | ||||
|             ( "Error specifying webserver root directory -- %s: %d\n", | ||||
|     ret = UpnpSetWebServerRootDir( web_dir_path ); | ||||
|     if( ret != UPNP_E_SUCCESS ) { | ||||
|         SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n", | ||||
|               web_dir_path, ret ); | ||||
|         UpnpFinish(  ); | ||||
|         UpnpFinish(); | ||||
|  | ||||
|         return ret; | ||||
|     } | ||||
|  | ||||
|     SampleUtil_Print | ||||
|         ( "Registering the RootDevice\n\t with desc_doc_url: %s\n", | ||||
|           desc_doc_url ); | ||||
|     SampleUtil_Print( | ||||
|         "Registering the RootDevice\n" | ||||
|         "\t with desc_doc_url: %s\n", | ||||
|         desc_doc_url ); | ||||
|  | ||||
|     if( ( ret = UpnpRegisterRootDevice( desc_doc_url, | ||||
|                                         TvDeviceCallbackEventHandler, | ||||
|                                         &device_handle, &device_handle ) ) | ||||
|         != UPNP_E_SUCCESS ) { | ||||
|     ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler, | ||||
|         &device_handle, &device_handle ); | ||||
|     if( ret != UPNP_E_SUCCESS ) { | ||||
|         SampleUtil_Print( "Error registering the rootdevice : %d\n", ret ); | ||||
|         UpnpFinish(  ); | ||||
|         UpnpFinish(); | ||||
|  | ||||
|         return ret; | ||||
|     } else { | ||||
|         SampleUtil_Print( "RootDevice Registered\n" ); | ||||
|  | ||||
|         SampleUtil_Print( "Initializing State Table\n" ); | ||||
|         SampleUtil_Print( | ||||
|             "RootDevice Registered\n" | ||||
|             "Initializing State Table\n"); | ||||
|         TvDeviceStateTableInit( desc_doc_url ); | ||||
|         SampleUtil_Print( "State Table Initialized\n" ); | ||||
|  | ||||
|         if( ( ret = | ||||
|               UpnpSendAdvertisement( device_handle, default_advr_expire ) ) | ||||
|             != UPNP_E_SUCCESS ) { | ||||
|         SampleUtil_Print("State Table Initialized\n"); | ||||
|         ret = UpnpSendAdvertisement( device_handle, default_advr_expire ); | ||||
|         if( ret != UPNP_E_SUCCESS ) { | ||||
|             SampleUtil_Print( "Error sending advertisements : %d\n", ret ); | ||||
|             UpnpFinish(  ); | ||||
|             UpnpFinish(); | ||||
|  | ||||
|             return ret; | ||||
|         } | ||||
|  | ||||
|         SampleUtil_Print( "Advertisements Sent\n" ); | ||||
|         SampleUtil_Print("Advertisements Sent\n"); | ||||
|     } | ||||
|  | ||||
|     return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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.  | ||||
|  * | ||||
|  * 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 | ||||
| @@ -41,7 +42,9 @@ extern "C" { | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include <stdlib.h> | ||||
| #ifndef WIN32 | ||||
| #include <unistd.h> | ||||
| #endif | ||||
| #include <string.h> | ||||
| #include "upnp.h" | ||||
| #include "sample_util.h" | ||||
| @@ -629,7 +632,7 @@ int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out, | ||||
|  | ||||
| int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name, | ||||
| 				  char *web_dir_path, print_string pfun); | ||||
| int TvDeviceStop(); | ||||
| int TvDeviceStop(void); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|   | ||||
							
								
								
									
										37
									
								
								upnp/sample/web/tvcombodesc.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								upnp/sample/web/tvcombodesc.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| <?xml version="1.0"?> | ||||
| <root xmlns="urn:schemas-upnp-org:device-1-0"> | ||||
|   <specVersion> | ||||
|     <major>1</major> | ||||
|     <minor>0</minor> | ||||
|   </specVersion> | ||||
|   <device> | ||||
|     <deviceType>urn:schemas-upnp-org:device:tvdevice:1</deviceType> | ||||
|     <friendlyName>UPnP Television Emulator</friendlyName> | ||||
|     <manufacturer>TV Manufacturer Name</manufacturer> | ||||
|     <manufacturerURL>http://www.manufacturer.com</manufacturerURL> | ||||
|     <modelDescription>UPnP Television Device Emulator 1.0</modelDescription> | ||||
|     <modelName>TVEmulator</modelName> | ||||
|     <modelNumber>1.0</modelNumber> | ||||
|     <modelURL>http://www.manufacturer.com/TVEmulator/</modelURL> | ||||
|     <serialNumber>123456789001</serialNumber> | ||||
|     <UDN>uuid:Upnp-TVEmulator-1_0-1234567890002</UDN> | ||||
|     <UPC>123456789</UPC> | ||||
|     <serviceList> | ||||
|       <service> | ||||
|         <serviceType>urn:schemas-upnp-org:service:tvcontrol:1</serviceType> | ||||
|         <serviceId>urn:upnp-org:serviceId:tvcontrol1</serviceId> | ||||
|         <controlURL>/upnp/control/tvcontrol1</controlURL> | ||||
|         <eventSubURL>/upnp/event/tvcontrol1</eventSubURL> | ||||
|         <SCPDURL>/tvcontrolSCPD.xml</SCPDURL> | ||||
|       </service> | ||||
|       <service> | ||||
|         <serviceType>urn:schemas-upnp-org:service:tvpicture:1</serviceType> | ||||
|         <serviceId>urn:upnp-org:serviceId:tvpicture1</serviceId> | ||||
|         <controlURL>/upnp/control/tvpicture1</controlURL> | ||||
|         <eventSubURL>/upnp/event/tvpicture1</eventSubURL> | ||||
|         <SCPDURL>/tvpictureSCPD.xml</SCPDURL> | ||||
|       </service> | ||||
|     </serviceList> | ||||
|    <presentationURL>/tvdevicepres.html</presentationURL> | ||||
| </device> | ||||
| </root> | ||||
| @@ -7,7 +7,6 @@ | ||||
|   </specVersion> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|   <actionList> | ||||
| 
 | ||||
|     <action> | ||||
| @@ -38,6 +37,12 @@ | ||||
|       <name>SetChannel</name> | ||||
|       <argumentList> | ||||
| 
 | ||||
|         <argument> | ||||
|         <name>Channel</name> | ||||
|           <relatedStateVariable>Channel</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|          <name>NewChannel</name> | ||||
|          <retval /> | ||||
| @@ -45,11 +50,6 @@ | ||||
|          <direction>out</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|         <name>Channel</name> | ||||
|           <relatedStateVariable>Channel</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|       </argumentList> | ||||
|     </action> | ||||
| 
 | ||||
| @@ -80,6 +80,11 @@ | ||||
|     <action> | ||||
|       <name>SetVolume</name> | ||||
|       <argumentList> | ||||
|         <argument> | ||||
|         <name>Volume</name> | ||||
|           <relatedStateVariable>Volume</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|          <name>NewVolume</name> | ||||
| @@ -87,11 +92,6 @@ | ||||
|          <relatedStateVariable>Volume</relatedStateVariable> | ||||
|          <direction>out</direction> | ||||
|          </argument> | ||||
|         <argument> | ||||
|         <name>Volume</name> | ||||
|           <relatedStateVariable>Volume</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|       </argumentList> | ||||
|     </action> | ||||
| 
 | ||||
| @@ -124,9 +124,6 @@ | ||||
| 
 | ||||
|   </actionList> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|   <serviceStateTable> | ||||
| 
 | ||||
|     <stateVariable sendEvents="yes"> | ||||
| @@ -12,6 +12,12 @@ | ||||
|     <action> | ||||
|       <name>SetColor</name> | ||||
|       <argumentList> | ||||
|         <argument> | ||||
|         <name>Color</name> | ||||
|           <relatedStateVariable>Color</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|         <name>NewColor</name> | ||||
|           <retval /> | ||||
| @@ -19,11 +25,6 @@ | ||||
|           <direction>out</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|         <name>Color</name> | ||||
|           <relatedStateVariable>Color</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|       </argumentList> | ||||
|     </action> | ||||
| 
 | ||||
| @@ -54,19 +55,19 @@ | ||||
|     <action> | ||||
|       <name>SetTint</name> | ||||
|       <argumentList> | ||||
|          <argument> | ||||
|         <argument> | ||||
|         <name>Tint</name> | ||||
|           <relatedStateVariable>Tint</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|         <argument> | ||||
|         <name>NewTint</name> | ||||
|           <retval /> | ||||
|           <relatedStateVariable>Tint</relatedStateVariable> | ||||
|           <direction>out</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|         <name>Tint</name> | ||||
|           <relatedStateVariable>Tint</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|       </argumentList> | ||||
|     </argumentList> | ||||
|     </action> | ||||
| 
 | ||||
|     <action> | ||||
| @@ -96,18 +97,18 @@ | ||||
|     <action> | ||||
|       <name>SetContrast</name> | ||||
|       <argumentList> | ||||
|         <argument> | ||||
|     	<argument> | ||||
|         	<name>Contrast</name> | ||||
| 	          <relatedStateVariable>Contrast</relatedStateVariable> | ||||
|     	      <direction>in</direction> | ||||
|        	</argument> | ||||
| 	    <argument> | ||||
|         <name>NewContrast</name> | ||||
|           <retval /> | ||||
|           <relatedStateVariable>Contrast</relatedStateVariable> | ||||
|           <direction>out</direction> | ||||
|         </argument>   | ||||
|         <argument> | ||||
|         <name>Contrast</name> | ||||
|           <relatedStateVariable>Contrast</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|       </argumentList> | ||||
|     </argumentList> | ||||
|     </action> | ||||
| 
 | ||||
|     <action> | ||||
| @@ -137,19 +138,17 @@ | ||||
|     <action> | ||||
|       <name>SetBrightness</name> | ||||
|       <argumentList> | ||||
| 
 | ||||
| 		<argument> | ||||
|         <name>Brightness</name> | ||||
|           <relatedStateVariable>Brightness</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|          <argument> | ||||
|         <name>NewBrightness</name> | ||||
|           <retval /> | ||||
|           <relatedStateVariable>Brightness</relatedStateVariable> | ||||
|           <direction>out</direction> | ||||
|         </argument> | ||||
| 
 | ||||
|         <argument> | ||||
|         <name>Brightness</name> | ||||
|           <relatedStateVariable>Brightness</relatedStateVariable> | ||||
|           <direction>in</direction> | ||||
|         </argument> | ||||
|       </argumentList> | ||||
|     </action> | ||||
| 
 | ||||
| @@ -182,7 +181,6 @@ | ||||
|   </actionList> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|   <serviceStateTable> | ||||
| 
 | ||||
|     <stateVariable sendEvents="yes"> | ||||
							
								
								
									
										156
									
								
								upnp/src/api/UpnpString.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								upnp/src/api/UpnpString.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,156 @@ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \addtogroup UpnpString | ||||
|  * | ||||
|  * Due to its heavy use, this class is coded for efficiency, not for beauty. | ||||
|  * Do not use this as example to other classes. Please take a look at any | ||||
|  * other one. | ||||
|  * | ||||
|  * \todo Always alloc a minimum size like 64 bytes or so and when shrinking | ||||
|  * do not perform a new memory allocation. | ||||
|  * | ||||
|  * @{ | ||||
|  * | ||||
|  * \file | ||||
|  * | ||||
|  * \brief UpnpString object implementation. | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
|  | ||||
| #include "UpnpString.h" | ||||
|  | ||||
|  | ||||
| #include <stdlib.h> /* for calloc(), free() */ | ||||
| #include <string.h> /* for strlen(), strdup() */ | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \brief Internal implementation of the class UpnpString. | ||||
|  * | ||||
|  * \internal | ||||
|  */ | ||||
| struct SUpnpString | ||||
| { | ||||
| 	/*! \brief Length of the string. */ | ||||
| 	int m_length; | ||||
| 	/*! \brief Pointer to a dynamically allocated area that holds the NULL | ||||
| 	 * terminated string. */ | ||||
| 	char *m_string; | ||||
| }; | ||||
|  | ||||
|  | ||||
| UpnpString *UpnpString_new() | ||||
| { | ||||
| 	// All bytes are zero, and so is the length of the string. | ||||
| 	struct SUpnpString *p = calloc(1, sizeof (struct SUpnpString)); | ||||
| 	if (p == NULL) { | ||||
| 		goto error_handler1; | ||||
| 	} | ||||
| #if 0 | ||||
| 	p->m_length = 0; | ||||
| #endif | ||||
|  | ||||
| 	// This byte is zero, calloc does initialize it. | ||||
| 	p->m_string = calloc(1, 1); | ||||
| 	if (p->m_string == NULL) { | ||||
| 		goto error_handler2; | ||||
| 	} | ||||
|  | ||||
| 	return (UpnpString *)p; | ||||
|  | ||||
| 	//free(p->m_string); | ||||
| error_handler2: | ||||
| 	free(p); | ||||
| error_handler1: | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_delete(UpnpString *p) | ||||
| { | ||||
| 	struct SUpnpString *q = (struct SUpnpString *)p; | ||||
| 		 | ||||
| 	if (!q) return; | ||||
|  | ||||
| 	q->m_length = 0; | ||||
|  | ||||
| 	free(q->m_string); | ||||
| 	q->m_string = NULL; | ||||
|  | ||||
| 	free(p); | ||||
| } | ||||
|  | ||||
|  | ||||
| UpnpString *UpnpString_dup(const UpnpString *p) | ||||
| { | ||||
| 	struct SUpnpString *q = calloc(1, sizeof (struct SUpnpString)); | ||||
| 	if (q == NULL) { | ||||
| 		goto error_handler1; | ||||
| 	} | ||||
| 	q->m_length = ((struct SUpnpString *)p)->m_length; | ||||
| 	q->m_string = strdup(((struct SUpnpString *)p)->m_string); | ||||
| 	if (q->m_string == NULL) { | ||||
| 		goto error_handler2; | ||||
| 	} | ||||
|  | ||||
| 	return (UpnpString *)q; | ||||
|  | ||||
| 	//free(q->m_string); | ||||
| error_handler2: | ||||
| 	free(q); | ||||
| error_handler1: | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_assign(UpnpString *p, const UpnpString *q) | ||||
| { | ||||
| 	if (p != q) { | ||||
| 		UpnpString_set_String(p, UpnpString_get_String(q)); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpString_get_Length(const UpnpString *p) | ||||
| { | ||||
| 	return ((struct SUpnpString *)p)->m_length; | ||||
| } | ||||
|  | ||||
|  | ||||
| const char *UpnpString_get_String(const UpnpString *p) | ||||
| { | ||||
| 	return ((struct SUpnpString *)p)->m_string; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_set_String(UpnpString *p, const char *s) | ||||
| { | ||||
| 	free(((struct SUpnpString *)p)->m_string); | ||||
| 	((struct SUpnpString *)p)->m_length = strlen(s); | ||||
| 	((struct SUpnpString *)p)->m_string = strdup(s); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_set_StringN(UpnpString *p, const char *s, int n) | ||||
| { | ||||
| 	free(((struct SUpnpString *)p)->m_string); | ||||
| 	((struct SUpnpString *)p)->m_length = n; | ||||
| 	((struct SUpnpString *)p)->m_string = (char *)malloc(n+1); | ||||
| 	strncpy(((struct SUpnpString *)p)->m_string, s, n); | ||||
| 	((struct SUpnpString *)p)->m_string[n] = 0; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpString_clear(UpnpString *p) | ||||
| { | ||||
| 	((struct SUpnpString *)p)->m_length = 0; | ||||
| 	// No need to realloc now, will do later when needed | ||||
| 	((struct SUpnpString *)p)->m_string[0] = 0; | ||||
| } | ||||
|  | ||||
| /* @} UpnpString */ | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,378 +1,355 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /******************************************************************************* | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  ******************************************************************************/ | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
|  | ||||
| #include "ithread.h" | ||||
| #include "ixml.h" | ||||
| #include "upnp.h" | ||||
| #include "upnpdebug.h" | ||||
|  | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <stdlib.h> | ||||
| #include <stdio.h> | ||||
| #include "ithread.h" | ||||
| #include "upnp.h" | ||||
| #include <stdarg.h> | ||||
| #include <string.h> | ||||
|  | ||||
|  | ||||
|  | ||||
| //Mutex to synchronize all the log file opeartions in the debug mode | ||||
| /*! Mutex to synchronize all the log file opeartions in the debug mode */ | ||||
| static ithread_mutex_t GlobalDebugMutex; | ||||
|  | ||||
| // Global log level | ||||
| /*! Global log level */ | ||||
| static Upnp_LogLevel g_log_level = UPNP_DEFAULT_LOG_LEVEL; | ||||
|  | ||||
| //File handle for the error log file | ||||
| /*! File handle for the error log file */ | ||||
| static FILE *ErrFileHnd = NULL; | ||||
|  | ||||
| //File handle for the information log file | ||||
| /*! File handle for the information log file */ | ||||
| static FILE *InfoFileHnd = NULL; | ||||
|  | ||||
| //Name of the error file | ||||
| /*! Name of the error file */ | ||||
| static const char *errFileName = "IUpnpErrFile.txt"; | ||||
|  | ||||
| //Name of the info file | ||||
| /*! Name of the info file */ | ||||
| static const char *infoFileName = "IUpnpInfoFile.txt"; | ||||
|  | ||||
|  | ||||
| #ifdef DEBUG | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpSetLogFileNames					 | ||||
|  *								 | ||||
|  * Parameters:							 | ||||
|  *	IN const char* ErrFileName: name of the error file | ||||
|  *	IN const char *InfoFileName: name of the information file | ||||
|  *	IN int size: Size of the buffer | ||||
|  *	IN int starLength: This parameter provides the width of the banner | ||||
|  *									 | ||||
|  * Description:							 | ||||
|  *	This functions takes the buffer and writes the buffer in the file as  | ||||
|  *	per the requested banner					 | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void | ||||
| UpnpSetLogFileNames ( IN const char *ErrFileName, | ||||
| 		      IN const char *InfoFileName ) | ||||
|  | ||||
| int UpnpInitLog(void) | ||||
| { | ||||
|     if( ErrFileName ) { | ||||
|         errFileName = ErrFileName; | ||||
|     } | ||||
|     if( InfoFileName ) { | ||||
|         infoFileName = InfoFileName; | ||||
|     } | ||||
| 	ithread_mutex_init(&GlobalDebugMutex, NULL); | ||||
| 	if(DEBUG_TARGET == 1) { | ||||
| 		if((ErrFileHnd = fopen( errFileName, "a")) == NULL) { | ||||
| 			return -1; | ||||
| 		} | ||||
| 		if((InfoFileHnd = fopen( infoFileName, "a")) == NULL) { | ||||
| 			return -1; | ||||
| 		} | ||||
| 	} | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpInitLog					 | ||||
|  *									 | ||||
|  * Parameters:	void							 | ||||
|  *						 | ||||
|  * Description:							 | ||||
|  *	This functions initializes the log files | ||||
|  * Returns: int | ||||
|  *	-1 : If fails | ||||
|  *	UPNP_E_SUCCESS : if success | ||||
|  ***************************************************************************/ | ||||
| int | ||||
| UpnpInitLog(  ) | ||||
| { | ||||
|     ithread_mutex_init( &GlobalDebugMutex, NULL ); | ||||
|  | ||||
|     if( DEBUG_TARGET == 1 ) { | ||||
|         if( ( ErrFileHnd = fopen( errFileName, "a" ) ) == NULL ) | ||||
|             return -1; | ||||
|         if( ( InfoFileHnd = fopen( infoFileName, "a" ) ) == NULL ) | ||||
|             return -1; | ||||
|     } | ||||
|     return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpSetLogLevel | ||||
|  *				 | ||||
|  * Parameters:	void | ||||
|  * | ||||
|  * Description:							 | ||||
|  *	This functions set the log level (see {\tt Upnp_LogLevel} | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void  | ||||
| UpnpSetLogLevel (Upnp_LogLevel log_level) | ||||
| void UpnpSetLogLevel(Upnp_LogLevel log_level) | ||||
| { | ||||
| 	g_log_level = log_level; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpCloseLog					 | ||||
|  *								 | ||||
|  * Parameters:	void					 | ||||
|  *								 | ||||
|  * Description:						 | ||||
|  *	This functions closes the log files | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| void | ||||
| UpnpCloseLog(  ) | ||||
| void UpnpCloseLog(void) | ||||
| { | ||||
|     if( DEBUG_TARGET == 1 ) { | ||||
|         fflush( ErrFileHnd ); | ||||
|         fflush( InfoFileHnd ); | ||||
|         fclose( ErrFileHnd ); | ||||
|         fclose( InfoFileHnd ); | ||||
|     } | ||||
|     ithread_mutex_destroy( &GlobalDebugMutex ); | ||||
|  | ||||
| 	if (DEBUG_TARGET == 1) { | ||||
| 		fflush(ErrFileHnd); | ||||
| 		fflush(InfoFileHnd); | ||||
| 		fclose(ErrFileHnd); | ||||
| 		fclose(InfoFileHnd); | ||||
| 	} | ||||
| 	ithread_mutex_destroy(&GlobalDebugMutex); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpPrintf					 | ||||
|  *									 | ||||
|  * Parameters:			 | ||||
|  *	IN Dbg_Level DLevel: The level of the debug logging. It will decide  | ||||
|  *		whether debug statement will go to standard output,  | ||||
|  *		or any of the log files. | ||||
|  *	IN Dbg_Module Module: debug will go in the name of this module | ||||
|  *	IN char *DbgFileName: Name of the file from where debug statement is | ||||
|  *							coming | ||||
|  *	IN int DbgLineNo : Line number of the file from where debug statement  | ||||
|  *				is coming | ||||
|  *	IN char * FmtStr, ...: Variable number of arguments that will go  | ||||
|  *				in the debug statement | ||||
|  *					 | ||||
|  * Description:					 | ||||
|  *	This functions prints the debug statement either on the startdard  | ||||
|  *	output or log file along with the information from where this debug  | ||||
|  *	statement is coming | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
| DBGONLY( void UpnpPrintf( IN Upnp_LogLevel DLevel, | ||||
|                           IN Dbg_Module Module, | ||||
|                           IN const char *DbgFileName, | ||||
|                           IN int DbgLineNo, | ||||
|                           IN const char *FmtStr, | ||||
|                           ... ) { | ||||
|  | ||||
|          va_list ArgList; | ||||
|          va_start( ArgList, FmtStr ); | ||||
|          if( g_log_level < DLevel ) return; if( DEBUG_ALL == 0 ) { | ||||
|          switch ( Module ) { | ||||
| case SSDP: | ||||
|          if( DEBUG_SSDP == 1 ) break; | ||||
|          else | ||||
| return; case SOAP: | ||||
|          if( DEBUG_SOAP == 1 ) break; | ||||
|          else | ||||
| return; case GENA: | ||||
|          if( DEBUG_GENA == 1 ) break; | ||||
|          else | ||||
| return; case TPOOL: | ||||
|          if( DEBUG_TPOOL == 1 ) break; | ||||
|          else | ||||
| return; case MSERV: | ||||
|          if( DEBUG_MSERV == 1 ) break; | ||||
|          else | ||||
| return; case DOM: | ||||
|          if( DEBUG_DOM == 1 ) break; | ||||
|          else | ||||
| return; case HTTP: | ||||
|          if( DEBUG_HTTP == 1 ) break; | ||||
|          else | ||||
| return; case API: | ||||
|          if( DEBUG_API == 1 ) break; | ||||
|          else | ||||
| return; default: | ||||
|          return;} | ||||
|          } | ||||
|  | ||||
|          ithread_mutex_lock( &GlobalDebugMutex ); if( DEBUG_TARGET == 0 ) { | ||||
|          if( DbgFileName ) { | ||||
|          UpnpDisplayFileAndLine( stdout, DbgFileName, DbgLineNo );} | ||||
|          vfprintf( stdout, FmtStr, ArgList ); fflush( stdout );} | ||||
|          else | ||||
|          { | ||||
|          if( DLevel == 0 ) { | ||||
|          if( DbgFileName ) { | ||||
|          UpnpDisplayFileAndLine( ErrFileHnd, DbgFileName, DbgLineNo );} | ||||
|          vfprintf( ErrFileHnd, FmtStr, ArgList ); fflush( ErrFileHnd );} | ||||
|          else | ||||
|          { | ||||
|          if( DbgFileName ) { | ||||
|          UpnpDisplayFileAndLine( InfoFileHnd, DbgFileName, DbgLineNo );} | ||||
|          vfprintf( InfoFileHnd, FmtStr, ArgList ); fflush( InfoFileHnd );} | ||||
|          } | ||||
|          va_end( ArgList ); ithread_mutex_unlock( &GlobalDebugMutex );} | ||||
|  | ||||
|  ) | ||||
| void UpnpSetLogFileNames( | ||||
| 	const char *ErrFileName, | ||||
| 	const char *InfoFileName) | ||||
| { | ||||
|     if (ErrFileName) { | ||||
|         errFileName = ErrFileName; | ||||
|     } | ||||
|     if (InfoFileName) { | ||||
|         infoFileName = InfoFileName; | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpGetDebugFile					 | ||||
|  *				 | ||||
|  * Parameters:			 | ||||
|  *	IN Dbg_Level DLevel: The level of the debug logging. It will decide  | ||||
|  *		whether debug statement will go to standard output,  | ||||
|  *		or any of the log files. | ||||
|  *	IN Dbg_Module Module: debug will go in the name of this module | ||||
|  *								 | ||||
|  * Description: | ||||
|  *	This function checks if the module is turned on for debug  | ||||
|  *	and returns the file descriptor corresponding to the debug level | ||||
|  * Returns: FILE * | ||||
|  *	NULL : if the module is turn off for debug  | ||||
|  *	else returns the right file descriptor | ||||
|  ***************************************************************************/ | ||||
|     DBGONLY( FILE * GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module ) { | ||||
|              if( g_log_level < DLevel ) return NULL; if( DEBUG_ALL == 0 ) { | ||||
|              switch ( Module ) { | ||||
| case SSDP: | ||||
|              if( DEBUG_SSDP == 1 ) break; | ||||
|              else | ||||
| return NULL; case SOAP: | ||||
|              if( DEBUG_SOAP == 1 ) break; | ||||
|              else | ||||
| return NULL; case GENA: | ||||
|              if( DEBUG_GENA == 1 ) break; | ||||
|              else | ||||
| return NULL; case TPOOL: | ||||
|              if( DEBUG_TPOOL == 1 ) break; | ||||
|              else | ||||
| return NULL; case MSERV: | ||||
|              if( DEBUG_MSERV == 1 ) break; | ||||
|              else | ||||
| return NULL; case DOM: | ||||
|              if( DEBUG_DOM == 1 ) break; | ||||
|              else | ||||
| return NULL; case API: | ||||
|              if( DEBUG_API == 1 ) break; | ||||
|              else | ||||
| return NULL; default: | ||||
|              return NULL;} | ||||
|              } | ||||
|  | ||||
|              if( DEBUG_TARGET == 0 ) { | ||||
|              return stdout;} | ||||
|              else | ||||
|              { | ||||
|              if( DLevel == 0 ) { | ||||
|              return ErrFileHnd;} | ||||
|              else | ||||
|              { | ||||
|              return InfoFileHnd;} | ||||
|              } | ||||
|              } | ||||
|  ) | ||||
| int DebugAtThisLevel( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	Dbg_Module Module) | ||||
| { | ||||
| 	int ret = DLevel <= g_log_level; | ||||
| 	ret &= | ||||
| 		DEBUG_ALL || | ||||
| 		(Module == SSDP  && DEBUG_SSDP ) || | ||||
| 		(Module == SOAP  && DEBUG_SOAP ) || | ||||
| 		(Module == GENA  && DEBUG_GENA ) || | ||||
| 		(Module == TPOOL && DEBUG_TPOOL) || | ||||
| 		(Module == MSERV && DEBUG_MSERV) || | ||||
| 		(Module == DOM   && DEBUG_DOM  ) || | ||||
| 		(Module == HTTP  && DEBUG_HTTP ); | ||||
| 	 | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpDisplayFileAndLine				 | ||||
|  *	 | ||||
|  * Parameters:	 | ||||
|  *	IN FILE *fd: File descriptor where line number and file name will be  | ||||
|  *			written  | ||||
|  *	IN char *DbgFileName: Name of the file   | ||||
|  *	IN int DbgLineNo : Line number of the file | ||||
|  *		 | ||||
|  * Description: | ||||
|  *	This function writes the file name and file number from where | ||||
|  *		debug statement is coming to the log file | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
|     DBGONLY( void UpnpDisplayFileAndLine( IN FILE * fd, | ||||
|                                           IN const char *DbgFileName, | ||||
|                                           IN int DbgLineNo ) { | ||||
|              int starlength = 66; | ||||
|              const char *lines[2]; | ||||
|              char FileAndLine[500]; lines[0] = "DEBUG"; if( DbgFileName ) { | ||||
|              sprintf( FileAndLine, "FILE: %s, LINE: %d", DbgFileName, | ||||
|                       DbgLineNo ); lines[1] = FileAndLine;} | ||||
|  | ||||
|              UpnpDisplayBanner( fd, lines, 2, starlength ); fflush( fd );} | ||||
|  ) | ||||
| void UpnpPrintf( | ||||
| 	Upnp_LogLevel DLevel, | ||||
| 	Dbg_Module Module, | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo, | ||||
| 	const char *FmtStr, | ||||
| 	...) | ||||
| { | ||||
| 	va_list ArgList; | ||||
| 	 | ||||
| 	if (!DebugAtThisLevel(DLevel, Module)) { | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| 	ithread_mutex_lock(&GlobalDebugMutex); | ||||
| 	va_start(ArgList, FmtStr); | ||||
| 	if (!DEBUG_TARGET) { | ||||
| 		if( DbgFileName ) { | ||||
| 			UpnpDisplayFileAndLine(stdout, DbgFileName, DbgLineNo); | ||||
| 		} | ||||
| 		vfprintf(stdout, FmtStr, ArgList); | ||||
| 		fflush(stdout); | ||||
| 	} else if (DLevel == 0) { | ||||
| 		if (DbgFileName) { | ||||
| 			UpnpDisplayFileAndLine(ErrFileHnd, DbgFileName, DbgLineNo); | ||||
| 		} | ||||
| 		vfprintf(ErrFileHnd, FmtStr, ArgList); | ||||
| 		fflush(ErrFileHnd); | ||||
| 	} else { | ||||
| 		if (DbgFileName) { | ||||
| 			UpnpDisplayFileAndLine(InfoFileHnd, DbgFileName, DbgLineNo); | ||||
| 		} | ||||
| 		vfprintf(InfoFileHnd, FmtStr, ArgList); | ||||
| 		fflush(InfoFileHnd); | ||||
| 	} | ||||
| 	va_end(ArgList); | ||||
| 	ithread_mutex_unlock(&GlobalDebugMutex); | ||||
| } | ||||
|  | ||||
|  | ||||
| /*************************************************************************** | ||||
|  * Function : UpnpDisplayBanner	 | ||||
|  * | ||||
|  * Parameters:			 | ||||
|  *	IN FILE *fd: file descriptor where the banner will be written | ||||
|  *	IN char **lines: The buffer that will be written | ||||
|  *	IN int size: Size of the buffer | ||||
|  *	IN int starLength: This parameter provides the width of the banner | ||||
|  *	 | ||||
|  * Description:			 | ||||
|  *	This functions takes the buffer and writes the buffer in the file as  | ||||
|  *	per the requested banner | ||||
|  * Returns: void | ||||
|  ***************************************************************************/ | ||||
|     DBGONLY( void UpnpDisplayBanner( IN FILE * fd, | ||||
|                                      IN const char **lines, | ||||
|                                      IN size_t size, | ||||
|                                      IN int starLength ) { | ||||
|              char *stars = ( char * )malloc( starLength + 1 ); | ||||
|              const char *line = NULL; | ||||
|              int leftMarginLength = starLength / 2 + 1; | ||||
|              int rightMarginLength = starLength / 2 + 1; | ||||
|              char *leftMargin = ( char * )malloc( leftMarginLength ); | ||||
|              char *rightMargin = ( char * )malloc( rightMarginLength ); | ||||
|              int i = 0; | ||||
|              int LineSize = 0; | ||||
|              char *currentLine = ( char * )malloc( starLength + 1 ); | ||||
|              memset( stars, '*', starLength ); | ||||
|              stars[starLength] = 0; | ||||
|              memset( leftMargin, 0, leftMarginLength ); | ||||
|              memset( rightMargin, 0, rightMarginLength ); | ||||
|              fprintf( fd, "\n%s\n", stars ); for( i = 0; i < size; i++ ) { | ||||
|              LineSize = strlen( lines[i] ); | ||||
|              line = lines[i]; while( LineSize > ( starLength - 2 ) ) { | ||||
|              memcpy( currentLine, line, ( starLength - 2 ) ); | ||||
|              currentLine[( starLength - 2 )] = 0; | ||||
|              fprintf( fd, "*%s*\n", currentLine ); | ||||
|              LineSize -= ( starLength - 2 ); line += ( starLength - 2 );} | ||||
| FILE *GetDebugFile(Upnp_LogLevel DLevel, Dbg_Module Module) | ||||
| { | ||||
| 	FILE *ret; | ||||
|  | ||||
|              if( LineSize % 2 == 0 ) { | ||||
|              leftMarginLength = rightMarginLength = | ||||
|              ( ( starLength - 2 ) - LineSize ) / 2;} | ||||
|              else | ||||
|              { | ||||
|              leftMarginLength = ( ( starLength - 2 ) - LineSize ) / 2; | ||||
|              rightMarginLength = | ||||
|              ( ( starLength - 2 ) - LineSize ) / 2 + 1;} | ||||
| 	if (!DebugAtThisLevel(DLevel, Module)) { | ||||
| 		ret = NULL; | ||||
| 	} | ||||
| 	 | ||||
| 	if (!DEBUG_TARGET) { | ||||
| 		ret = stdout; | ||||
| 	} else if (DLevel == 0) { | ||||
| 		ret = ErrFileHnd; | ||||
| 	} else { | ||||
| 		ret = InfoFileHnd; | ||||
| 	} | ||||
|  | ||||
|              memset( leftMargin, ' ', leftMarginLength ); | ||||
|              memset( rightMargin, ' ', rightMarginLength ); | ||||
|              leftMargin[leftMarginLength] = 0; | ||||
|              rightMargin[rightMarginLength] = 0; | ||||
|              fprintf( fd, "*%s%s%s*\n", leftMargin, line, rightMargin );} | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpDisplayFileAndLine( | ||||
| 	FILE *fd, | ||||
| 	const char *DbgFileName, | ||||
| 	int DbgLineNo) | ||||
| { | ||||
| #define NLINES 2 | ||||
| #define MAX_LINE_SIZE 512 | ||||
| #define NUMBER_OF_STARS 80 | ||||
| 	const char *lines[NLINES]; | ||||
| 	char buf[NLINES][MAX_LINE_SIZE]; | ||||
| 	int i; | ||||
|  | ||||
| 	/* Initialize the pointer array */ | ||||
| 	for (i = 0; i < NLINES; i++) { | ||||
| 		lines[i] = buf[i]; | ||||
| 	} | ||||
|  | ||||
| 	/* Put the debug lines in the buffer */ | ||||
| 	sprintf(buf[0], "DEBUG - THREAD ID: 0x%lX", | ||||
| #ifdef WIN32 | ||||
| 		(unsigned long int)ithread_self().p | ||||
| #else | ||||
| 		(unsigned long int)ithread_self() | ||||
| #endif | ||||
| 	); | ||||
| 	if (DbgFileName) { | ||||
| 		sprintf(buf[1], | ||||
| 			"FILE: %s, LINE: %d", | ||||
| 			DbgFileName, | ||||
| 			DbgLineNo); | ||||
| 	} | ||||
|  | ||||
| 	/* Show the lines centered */ | ||||
| 	UpnpDisplayBanner(fd, lines, NLINES, NUMBER_OF_STARS); | ||||
| 	fflush(fd); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpDisplayBanner( | ||||
| 	FILE * fd, | ||||
| 	const char **lines, | ||||
| 	size_t size, | ||||
| 	int starLength) | ||||
| { | ||||
| 	int leftMarginLength = starLength / 2 + 1; | ||||
| 	int rightMarginLength = starLength / 2 + 1; | ||||
| 	int i = 0; | ||||
| 	int LineSize = 0; | ||||
| 	int 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 ); | ||||
| 	const char *line = NULL; | ||||
|  | ||||
| 	memset( stars, '*', starLength ); | ||||
| 	stars[starLength] = 0; | ||||
| 	memset( leftMargin, 0, leftMarginLength ); | ||||
| 	memset( rightMargin, 0, rightMarginLength ); | ||||
| 	fprintf( fd, "\n%s\n", stars ); | ||||
| 	for( i = 0; i < size; i++ ) { | ||||
| 		LineSize = strlen( lines[i] ); | ||||
| 		line = lines[i]; | ||||
| 		while( LineSize > starLengthMinus2 ) { | ||||
| 			memcpy( currentLine, line, starLengthMinus2 ); | ||||
| 			currentLine[starLengthMinus2] = 0; | ||||
| 			fprintf( fd, "*%s*\n", currentLine ); | ||||
| 			LineSize -= starLengthMinus2; | ||||
| 			line += starLengthMinus2; | ||||
| 		} | ||||
| 		leftMarginLength = (starLengthMinus2 - LineSize)/2; | ||||
| 		if( LineSize % 2 == 0 ) { | ||||
| 			rightMarginLength = leftMarginLength; | ||||
| 		} else { | ||||
| 			rightMarginLength = leftMarginLength + 1; | ||||
| 		} | ||||
| 		memset( leftMargin, ' ', leftMarginLength ); | ||||
| 		memset( rightMargin, ' ', rightMarginLength ); | ||||
| 		leftMargin[leftMarginLength] = 0; | ||||
| 		rightMargin[rightMarginLength] = 0; | ||||
| 		fprintf( fd, "*%s%s%s*\n", leftMargin, line, rightMargin ); | ||||
| 	} | ||||
| 	fprintf(fd, "%s\n\n", stars); | ||||
|  | ||||
| 	free(currentLine); | ||||
| 	free(stars); | ||||
| 	free(rightMargin); | ||||
| 	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); | ||||
| } | ||||
|  | ||||
|  | ||||
| void printNodes(IXML_Node *tmpRoot, int depth) | ||||
| { | ||||
|     int i; | ||||
|     IXML_NodeList *NodeList1; | ||||
|     IXML_Node *ChildNode1; | ||||
|     unsigned short NodeType; | ||||
|     const DOMString NodeValue; | ||||
|     const DOMString NodeName; | ||||
|     NodeList1 = ixmlNode_getChildNodes(tmpRoot); | ||||
|     for (i = 0; i < 100; ++i) { | ||||
|         ChildNode1 = ixmlNodeList_item(NodeList1, i); | ||||
|         if (ChildNode1 == NULL) { | ||||
|             break; | ||||
|         } | ||||
|      | ||||
|         printNodes(ChildNode1, depth+1); | ||||
|         NodeType = ixmlNode_getNodeType(ChildNode1); | ||||
|         NodeValue = ixmlNode_getNodeValue(ChildNode1); | ||||
|         NodeName = ixmlNode_getNodeName(ChildNode1); | ||||
|         UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__, | ||||
|             "DEPTH-%2d-IXML_Node Type %d, " | ||||
|             "IXML_Node Name: %s, IXML_Node Value: %s\n", | ||||
|             depth, NodeType, NodeName, NodeValue); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| #endif /* DEBUG */ | ||||
|  | ||||
|              fprintf( fd, "%s\n\n", stars ); | ||||
|              free( leftMargin ); | ||||
|              free( rightMargin ); free( stars ); free( currentLine );} | ||||
|  ) | ||||
|   | ||||
| @@ -1,580 +1,475 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // Copyright (c) 2000-2003 Intel Corporation  | ||||
| // All rights reserved.  | ||||
| // | ||||
| // Redistribution and use in source and binary forms, with or without  | ||||
| // modification, are permitted provided that the following conditions are met:  | ||||
| // | ||||
| // * Redistributions of source code must retain the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer.  | ||||
| // * Redistributions in binary form must reproduce the above copyright notice,  | ||||
| // this list of conditions and the following disclaimer in the documentation  | ||||
| // and/or other materials provided with the distribution.  | ||||
| // * Neither name of Intel Corporation nor the names of its contributors  | ||||
| // may be used to endorse or promote products derived from this software  | ||||
| // without specific prior written permission. | ||||
| //  | ||||
| // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
| // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
| // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
| // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
| // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
| // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
| // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
| // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
| // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
| // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| // | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| /************************************************************************** | ||||
|  * | ||||
|  * Copyright (c) 2000-2003 Intel Corporation  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
|  * Redistribution and use in source and binary forms, with or without  | ||||
|  * modification, are permitted provided that the following conditions are met:  | ||||
|  * | ||||
|  * - Redistributions of source code must retain the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer.  | ||||
|  * - Redistributions in binary form must reproduce the above copyright notice,  | ||||
|  * this list of conditions and the following disclaimer in the documentation  | ||||
|  * and/or other materials provided with the distribution.  | ||||
|  * - Neither name of Intel Corporation nor the names of its contributors  | ||||
|  * may be used to endorse or promote products derived from this software  | ||||
|  * without specific prior written permission. | ||||
|  *  | ||||
|  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  | ||||
|  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  | ||||
|  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  | ||||
|  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR  | ||||
|  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  | ||||
|  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  | ||||
|  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  | ||||
|  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY  | ||||
|  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||||
|  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  * | ||||
|  **************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \file | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #if EXCLUDE_DOM == 0 | ||||
| #include <stdarg.h> | ||||
|  | ||||
|  | ||||
| #include "upnp.h" | ||||
| #include "upnptools.h" | ||||
|  | ||||
|  | ||||
| #include "uri.h" | ||||
|  | ||||
|  | ||||
| #include <stdarg.h> | ||||
| #include <stdio.h> | ||||
|  | ||||
|  | ||||
| /*! Maximum action header buffer length. */ | ||||
| #define HEADER_LENGTH 2000 | ||||
|  | ||||
| //Structure to maintain a error code and string associated with the  | ||||
| // error code | ||||
|  | ||||
| /*! | ||||
|  * \brief Structure to maintain a error code and string associated with the | ||||
|  * error code. | ||||
|  */ | ||||
| struct ErrorString { | ||||
|     int rc;                     /* error code */ | ||||
|     const char *rcError;        /* error description */ | ||||
|  | ||||
| 	/*! Error code. */ | ||||
| 	int rc; | ||||
| 	/*! Error description. */ | ||||
| 	const char *rcError; | ||||
| }; | ||||
|  | ||||
| //Intializing the array of error structures.  | ||||
| struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"}, | ||||
| {UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"}, | ||||
| {UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"}, | ||||
| {UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"}, | ||||
| {UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"}, | ||||
| {UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMOR"}, | ||||
| {UPNP_E_INIT, "UPNP_E_INIT"}, | ||||
| {UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"}, | ||||
| {UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"}, | ||||
| {UPNP_E_INVALID_URL, "UPNP_E_INVALID_URL"}, | ||||
| {UPNP_E_INVALID_SID, "UPNP_E_INVALID_SID"}, | ||||
| {UPNP_E_INVALID_DEVICE, "UPNP_E_INVALID_DEVICE"}, | ||||
| {UPNP_E_INVALID_SERVICE, "UPNP_E_INVALID_SERVICE"}, | ||||
| {UPNP_E_BAD_RESPONSE, "UPNP_E_BAD_RESPONSE"}, | ||||
| {UPNP_E_BAD_REQUEST, "UPNP_E_BAD_REQUEST"}, | ||||
| {UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"}, | ||||
| {UPNP_E_FINISH, "UPNP_E_FINISH"}, | ||||
| {UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"}, | ||||
| {UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"}, | ||||
| {UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"}, | ||||
| {UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"}, | ||||
| {UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"}, | ||||
| {UPNP_E_SOCKET_BIND, "UPNP_E_SOCKET_BIND"}, | ||||
| {UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"}, | ||||
| {UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"}, | ||||
| {UPNP_E_LISTEN, "UPNP_E_LISTEN"}, | ||||
| {UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"}, | ||||
| {UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"}, | ||||
| {UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"}, | ||||
| {UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"}, | ||||
| {UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"}, | ||||
| {UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"}, | ||||
| {UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"} | ||||
|  | ||||
| /*! | ||||
|  * \brief Array of error structures. | ||||
|  */ | ||||
| struct ErrorString ErrorMessages[] = { | ||||
| 	{UPNP_E_SUCCESS, "UPNP_E_SUCCESS"}, | ||||
| 	{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"}, | ||||
| 	{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"}, | ||||
| 	{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"}, | ||||
| 	{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"}, | ||||
| 	{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMORY"}, | ||||
| 	{UPNP_E_INIT, "UPNP_E_INIT"}, | ||||
| 	{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"}, | ||||
| 	{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"}, | ||||
| 	{UPNP_E_INVALID_URL, "UPNP_E_INVALID_URL"}, | ||||
| 	{UPNP_E_INVALID_SID, "UPNP_E_INVALID_SID"}, | ||||
| 	{UPNP_E_INVALID_DEVICE, "UPNP_E_INVALID_DEVICE"}, | ||||
| 	{UPNP_E_INVALID_SERVICE, "UPNP_E_INVALID_SERVICE"}, | ||||
| 	{UPNP_E_BAD_RESPONSE, "UPNP_E_BAD_RESPONSE"}, | ||||
| 	{UPNP_E_BAD_REQUEST, "UPNP_E_BAD_REQUEST"}, | ||||
| 	{UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"}, | ||||
| 	{UPNP_E_FINISH, "UPNP_E_FINISH"}, | ||||
| 	{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"}, | ||||
| 	{UPNP_E_URL_TOO_BIG, "UPNP_E_URL_TOO_BIG"}, | ||||
| 	{UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"}, | ||||
| 	{UPNP_E_ALREADY_REGISTERED, "UPNP_E_ALREADY_REGISTERED"}, | ||||
| 	{UPNP_E_INVALID_INTERFACE, "UPNP_E_INVALID_INTERFACE"}, | ||||
| 	{UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"}, | ||||
| 	{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"}, | ||||
| 	{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"}, | ||||
| 	{UPNP_E_SOCKET_BIND, "UPNP_E_SOCKET_BIND"}, | ||||
| 	{UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"}, | ||||
| 	{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"}, | ||||
| 	{UPNP_E_LISTEN, "UPNP_E_LISTEN"}, | ||||
| 	{UPNP_E_TIMEDOUT, "UPNP_E_TIMEDOUT"}, | ||||
| 	{UPNP_E_SOCKET_ERROR, "UPNP_E_SOCKET_ERROR"}, | ||||
| 	{UPNP_E_FILE_WRITE_ERROR, "UPNP_E_FILE_WRITE_ERROR"}, | ||||
| 	{UPNP_E_CANCELED, "UPNP_E_CANCELED"}, | ||||
| 	{UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"}, | ||||
| 	{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"}, | ||||
| 	{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"}, | ||||
| 	{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"}, | ||||
| 	{UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"}, | ||||
| 	{UPNP_E_FILE_NOT_FOUND, "UPNP_E_FILE_NOT_FOUND"}, | ||||
| 	{UPNP_E_FILE_READ_ERROR, "UPNP_E_FILE_READ_ERROR"}, | ||||
| 	{UPNP_E_EXT_NOT_XML, "UPNP_E_EXT_NOT_XML"}, | ||||
| 	{UPNP_E_NO_WEB_SERVER, "UPNP_E_NO_WEB_SERVER"}, | ||||
| 	{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"}, | ||||
| 	{UPNP_E_NOT_FOUND, "UPNP_E_NOT_FOUND"}, | ||||
| 	{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"}, | ||||
| }; | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpGetErrorMessage											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN int rc: error code | ||||
| *																	 | ||||
| * Description:														 | ||||
| *	This functions returns the error string mapped to the error code  | ||||
| * Returns: const char * | ||||
| *	return either the right string or "Unknown Error" | ||||
| ***************************************************************************/ | ||||
| const char * | ||||
| UpnpGetErrorMessage( IN int rc ) | ||||
|  | ||||
| const char *UpnpGetErrorMessage(int rc) | ||||
| { | ||||
|     int i; | ||||
| 	int i; | ||||
|  | ||||
|     for( i = 0; i < sizeof( ErrorMessages ) / sizeof( ErrorMessages[0] ); | ||||
|          i++ ) { | ||||
|         if( rc == ErrorMessages[i].rc ) | ||||
|             return ErrorMessages[i].rcError; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     return "Unknown Error"; | ||||
| 	for (i = 0; i < sizeof (ErrorMessages) / sizeof (ErrorMessages[0]); ++i) { | ||||
| 		if (rc == ErrorMessages[i].rc) { | ||||
| 			return ErrorMessages[i].rcError; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return "Unknown error code"; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpResolveURL											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN char * BaseURL: Base URL string | ||||
| *	IN char * RelURL: relative URL string | ||||
| *	OUT char * AbsURL: Absolute URL string | ||||
| * Description:														 | ||||
| *	This functions concatinates the base URL and relative URL to generate  | ||||
| *	the absolute URL | ||||
| * Returns: int | ||||
| *	return either UPNP_E_SUCCESS or appropriate error | ||||
| ***************************************************************************/ | ||||
| int | ||||
| UpnpResolveURL( IN const char *BaseURL, | ||||
|                 IN const char *RelURL, | ||||
|                 OUT char *AbsURL ) | ||||
|  | ||||
| /*! | ||||
|  * \todo There is some unnecessary allocation and deallocation going on here | ||||
|  * because of the way resolve_rel_url() was originally written and used. In the | ||||
|  * future it would be nice to clean this up. | ||||
|  */ | ||||
| int UpnpResolveURL( | ||||
| 	const char *BaseURL, | ||||
| 	const char *RelURL, | ||||
| 	char *AbsURL) | ||||
| { | ||||
|     // There is some unnecessary allocation and | ||||
|     // deallocation going on here because of the way | ||||
|     // resolve_rel_url was originally written and used | ||||
|     // in the future it would be nice to clean this up | ||||
| 	int ret = UPNP_E_SUCCESS; | ||||
| 	char *tempRel = NULL; | ||||
|  | ||||
|     char *tempRel; | ||||
| 	if (RelURL == NULL) { | ||||
| 		ret = UPNP_E_INVALID_PARAM; | ||||
| 		goto ExitFunction; | ||||
| 	} | ||||
|  | ||||
|     if( RelURL == NULL ) | ||||
|         return UPNP_E_INVALID_PARAM; | ||||
|  | ||||
|     tempRel = NULL; | ||||
|  | ||||
|     tempRel = resolve_rel_url((char*) BaseURL, (char*) RelURL ); | ||||
|  | ||||
|     if( tempRel ) { | ||||
|         strcpy( AbsURL, tempRel ); | ||||
|         free( tempRel ); | ||||
|     } else { | ||||
|         return UPNP_E_INVALID_URL; | ||||
|     } | ||||
|  | ||||
|     return UPNP_E_SUCCESS; | ||||
| 	tempRel = resolve_rel_url((char *)BaseURL, (char *)RelURL); | ||||
| 	if (tempRel) { | ||||
| 		strcpy(AbsURL, tempRel); | ||||
| 		free(tempRel); | ||||
| 	} else { | ||||
| 		ret = UPNP_E_INVALID_URL; | ||||
| 	} | ||||
|  | ||||
| ExitFunction: | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : addToAction											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN int response: flag to tell if the ActionDoc is for response  | ||||
| *					or request | ||||
| *	INOUT IXML_Document **ActionDoc: request or response document | ||||
| *	IN char *ActionName: Name of the action request or response | ||||
| *	IN char *ServType: Service type | ||||
| *	IN char * ArgName: Name of the argument | ||||
| *	IN char * ArgValue: Value of the argument | ||||
| * | ||||
| * Description:		 | ||||
| *	This function adds the argument in the action request or response.  | ||||
| * This function creates the action request or response if it is a first | ||||
| * argument else it will add the argument in the document | ||||
| * | ||||
| * Returns: int | ||||
| *	returns UPNP_E_SUCCESS if successful else returns appropriate error | ||||
| ***************************************************************************/ | ||||
| static int | ||||
| addToAction( IN int response, | ||||
|              INOUT IXML_Document ** ActionDoc, | ||||
|              IN const char *ActionName, | ||||
|              IN const char *ServType, | ||||
|              IN const char *ArgName, | ||||
|              IN const char *ArgValue ) | ||||
|  | ||||
| /*! | ||||
|  * \brief Adds the argument in the action request or response. | ||||
|  * | ||||
|  * This function creates the action request or response if it is a first | ||||
|  * argument, otherwise it will add the argument in the document. | ||||
|  * | ||||
|  * \returns UPNP_E_SUCCESS if successful, otherwise the appropriate error. | ||||
|  */ | ||||
| static int addToAction( | ||||
| 	/*! [in] flag to tell if the ActionDoc is for response or request. */ | ||||
| 	int response, | ||||
| 	/*! [in,out] Request or response document. */ | ||||
| 	IXML_Document **ActionDoc, | ||||
| 	/*! [in] Name of the action request or response. */ | ||||
| 	const char *ActionName, | ||||
| 	/*! [in] Service type. */ | ||||
| 	const char *ServType, | ||||
| 	/*! [in] Name of the argument. */ | ||||
| 	const char *ArgName, | ||||
| 	/*! [in] Value of the argument. */ | ||||
| 	const char *ArgValue) | ||||
| { | ||||
|     char *ActBuff = NULL; | ||||
|     IXML_Node *node = NULL; | ||||
|     IXML_Element *Ele = NULL; | ||||
|     IXML_Node *Txt = NULL; | ||||
|     int rc = 0; | ||||
| 	char *ActBuff = NULL; | ||||
| 	IXML_Node *node = NULL; | ||||
| 	IXML_Element *Ele = NULL; | ||||
| 	IXML_Node *Txt = NULL; | ||||
| 	int rc = 0; | ||||
|  | ||||
|     if( ActionName == NULL || ServType == NULL ) { | ||||
|         return UPNP_E_INVALID_PARAM; | ||||
|     } | ||||
| 	if (ActionName == NULL || ServType == NULL) { | ||||
| 		return UPNP_E_INVALID_PARAM; | ||||
| 	} | ||||
|  | ||||
|     if( *ActionDoc == NULL ) { | ||||
|         ActBuff = ( char * )malloc( HEADER_LENGTH ); | ||||
|         if( ActBuff == NULL ) { | ||||
|             return UPNP_E_OUTOF_MEMORY; | ||||
|         } | ||||
| 	if (*ActionDoc == NULL) { | ||||
| 		ActBuff = (char *)malloc(HEADER_LENGTH); | ||||
| 		if (ActBuff == NULL) { | ||||
| 			return UPNP_E_OUTOF_MEMORY; | ||||
| 		} | ||||
|  | ||||
|         if( response ) { | ||||
|             sprintf( ActBuff, | ||||
|                 "<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>", | ||||
|                 ActionName, ServType, ActionName ); | ||||
|         } else { | ||||
|             sprintf( ActBuff, | ||||
|                 "<u:%s xmlns:u=\"%s\">\r\n</u:%s>", | ||||
|                 ActionName, ServType, ActionName ); | ||||
|         } | ||||
| 		if (response) { | ||||
| 			sprintf(ActBuff, | ||||
| 				"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>", | ||||
| 				ActionName, ServType, ActionName); | ||||
| 		} else { | ||||
| 			sprintf(ActBuff, | ||||
| 				"<u:%s xmlns:u=\"%s\">\r\n</u:%s>", | ||||
| 				ActionName, ServType, ActionName); | ||||
| 		} | ||||
|  | ||||
|         rc = ixmlParseBufferEx( ActBuff, ActionDoc ); | ||||
|         free( ActBuff ); | ||||
|         if( rc != IXML_SUCCESS ) { | ||||
|             if( rc == IXML_INSUFFICIENT_MEMORY ) { | ||||
|                 return UPNP_E_OUTOF_MEMORY; | ||||
|             } else { | ||||
|                 return UPNP_E_INVALID_DESC; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 		rc = ixmlParseBufferEx(ActBuff, ActionDoc); | ||||
| 		free(ActBuff); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			if (rc == IXML_INSUFFICIENT_MEMORY) { | ||||
| 				return UPNP_E_OUTOF_MEMORY; | ||||
| 			} else { | ||||
| 				return UPNP_E_INVALID_DESC; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|     if( ArgName != NULL /*&& ArgValue != NULL */  ) { | ||||
|         node = ixmlNode_getFirstChild( ( IXML_Node * ) * ActionDoc ); | ||||
|         Ele = ixmlDocument_createElement( *ActionDoc, ArgName ); | ||||
|         if( ArgValue ) { | ||||
|             Txt = ixmlDocument_createTextNode( *ActionDoc, ArgValue ); | ||||
|             ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt ); | ||||
|         } | ||||
| 	if (ArgName != NULL /*&& ArgValue != NULL */) { | ||||
| 		node = ixmlNode_getFirstChild((IXML_Node *)*ActionDoc); | ||||
| 		Ele = ixmlDocument_createElement(*ActionDoc, ArgName); | ||||
| 		if(ArgValue) { | ||||
| 			Txt = ixmlDocument_createTextNode(*ActionDoc, ArgValue); | ||||
| 			ixmlNode_appendChild((IXML_Node *)Ele, Txt); | ||||
| 		} | ||||
| 		ixmlNode_appendChild(node, (IXML_Node *)Ele); | ||||
| 	} | ||||
|  | ||||
|         ixmlNode_appendChild( node, ( IXML_Node * ) Ele ); | ||||
|     } | ||||
|  | ||||
|     return UPNP_E_SUCCESS; | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : makeAction											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN int response: flag to tell if the ActionDoc is for response  | ||||
| *					or request | ||||
| *	IN char * ActionName: Name of the action request or response | ||||
| *	IN char * ServType: Service type | ||||
| *	IN int NumArg :Number of arguments in the action request or response | ||||
| *	IN char * Arg : pointer to the first argument | ||||
| *	IN va_list ArgList: Argument list | ||||
| * | ||||
| * Description:		 | ||||
| *	This function creates the action request or response from the argument | ||||
| * list. | ||||
| * Returns: IXML_Document * | ||||
| *	returns action request or response document if successful  | ||||
| *	else returns NULL | ||||
| ***************************************************************************/ | ||||
| static IXML_Document * | ||||
| makeAction( IN int response, | ||||
|             IN const char *ActionName, | ||||
|             IN const char *ServType, | ||||
|             IN int NumArg, | ||||
|             IN const char *Arg, | ||||
|             IN va_list ArgList ) | ||||
|  | ||||
| /*! | ||||
|  * \brief Creates the action request or response from the argument list. | ||||
|  * | ||||
|  * \return Action request or response document if successful, otherwise | ||||
|  * 	returns NULL | ||||
|  */ | ||||
| static IXML_Document *makeAction( | ||||
| 	/*! [in] flag to tell if the ActionDoc is for response or request. */ | ||||
| 	int response, | ||||
| 	/*! [in] Name of the action request or response. */ | ||||
| 	const char *ActionName, | ||||
| 	/*! [in] Service type. */ | ||||
| 	const char *ServType, | ||||
| 	/*! [in] Number of arguments in the action request or response. */ | ||||
| 	int NumArg, | ||||
| 	/*! [in] pointer to the first argument. */ | ||||
| 	const char *Arg, | ||||
| 	/*! [in] Argument list. */ | ||||
| 	va_list ArgList) | ||||
| { | ||||
|     const char *ArgName, | ||||
|      *ArgValue; | ||||
|     char *ActBuff; | ||||
|     int Idx = 0; | ||||
|     IXML_Document *ActionDoc; | ||||
|     IXML_Node *node; | ||||
|     IXML_Element *Ele; | ||||
|     IXML_Node *Txt = NULL; | ||||
| 	const char *ArgName; | ||||
| 	const char *ArgValue; | ||||
| 	char *ActBuff; | ||||
| 	int Idx = 0; | ||||
| 	IXML_Document *ActionDoc; | ||||
| 	IXML_Node *node; | ||||
| 	IXML_Element *Ele; | ||||
| 	IXML_Node *Txt = NULL; | ||||
|  | ||||
|     if( ActionName == NULL || ServType == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	if (ActionName == NULL || ServType == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     ActBuff = ( char * )malloc( HEADER_LENGTH ); | ||||
|     if( ActBuff == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	ActBuff = (char *)malloc(HEADER_LENGTH); | ||||
| 	if (ActBuff == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     if( response ) { | ||||
|         sprintf( ActBuff, | ||||
|             "<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>", | ||||
|             ActionName, ServType, ActionName ); | ||||
|     } else { | ||||
|         sprintf( ActBuff, | ||||
|             "<u:%s xmlns:u=\"%s\">\r\n</u:%s>", | ||||
|             ActionName, ServType, ActionName ); | ||||
|     } | ||||
| 	if (response) { | ||||
| 		sprintf(ActBuff, | ||||
| 			"<u:%sResponse xmlns:u=\"%s\">\r\n</u:%sResponse>", | ||||
| 			ActionName, ServType, ActionName); | ||||
| 	} else { | ||||
| 		sprintf(ActBuff, | ||||
| 			"<u:%s xmlns:u=\"%s\">\r\n</u:%s>", | ||||
| 			ActionName, ServType, ActionName); | ||||
| 	} | ||||
| 	if (ixmlParseBufferEx(ActBuff, &ActionDoc) != IXML_SUCCESS) { | ||||
| 		free(ActBuff); | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) { | ||||
|         free( ActBuff ); | ||||
|         return NULL; | ||||
|     } | ||||
| 	free(ActBuff); | ||||
| 	if(ActionDoc == NULL) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     free( ActBuff ); | ||||
| 	if (NumArg > 0) { | ||||
| 		//va_start(ArgList, Arg); | ||||
| 		ArgName = Arg; | ||||
| 		for ( ; ; ) { | ||||
| 			ArgValue = va_arg(ArgList, const char *); | ||||
| 			if (ArgName != NULL) { | ||||
| 				node = ixmlNode_getFirstChild((IXML_Node *)ActionDoc); | ||||
| 				Ele = ixmlDocument_createElement(ActionDoc, ArgName); | ||||
| 				if (ArgValue) { | ||||
| 					Txt = ixmlDocument_createTextNode(ActionDoc, ArgValue); | ||||
| 					ixmlNode_appendChild((IXML_Node *)Ele, Txt); | ||||
| 				} | ||||
| 				ixmlNode_appendChild(node, (IXML_Node *)Ele); | ||||
| 			} | ||||
| 			if (++Idx < NumArg) { | ||||
| 				ArgName = va_arg(ArgList, const char *); | ||||
| 			} else { | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		//va_end(ArgList); | ||||
| 	} | ||||
|  | ||||
|     if( ActionDoc == NULL ) { | ||||
|         return NULL; | ||||
|     } | ||||
|  | ||||
|     if( NumArg > 0 ) { | ||||
|         //va_start(ArgList, Arg); | ||||
|         ArgName = Arg; | ||||
|         while( Idx++ != NumArg ) { | ||||
|             ArgValue = va_arg( ArgList, const char * ); | ||||
|  | ||||
|             if( ArgName != NULL ) { | ||||
|                 node = ixmlNode_getFirstChild( ( IXML_Node * ) ActionDoc ); | ||||
|                 Ele = ixmlDocument_createElement( ActionDoc, ArgName ); | ||||
|                 if( ArgValue ) { | ||||
|                     Txt = | ||||
|                         ixmlDocument_createTextNode( ActionDoc, ArgValue ); | ||||
|                     ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt ); | ||||
|                 } | ||||
|  | ||||
|                 ixmlNode_appendChild( node, ( IXML_Node * ) Ele ); | ||||
|             } | ||||
|  | ||||
|             ArgName = va_arg( ArgList, const char * ); | ||||
|         } | ||||
|         //va_end(ArgList); | ||||
|     } | ||||
|  | ||||
|     return ActionDoc; | ||||
| 	return ActionDoc; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpMakeAction											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN char * ActionName: Name of the action request or response | ||||
| *	IN char * ServType: Service type | ||||
| *	IN int NumArg :Number of arguments in the action request or response | ||||
| *	IN char * Arg : pointer to the first argument | ||||
| *	IN ... : variable argument list | ||||
| *	IN va_list ArgList: Argument list | ||||
| * | ||||
| * Description:		 | ||||
| *	This function creates the action request from the argument | ||||
| * list. Its a wrapper function that calls makeAction function to create | ||||
| * the action request. | ||||
| * | ||||
| * Returns: IXML_Document * | ||||
| *	returns action request document if successful  | ||||
| *	else returns NULL | ||||
| ***************************************************************************/ | ||||
| IXML_Document * | ||||
| UpnpMakeAction( const char *ActionName, | ||||
|                 const char *ServType, | ||||
|                 int NumArg, | ||||
|                 const char *Arg, | ||||
|                 ... ) | ||||
|  | ||||
| IXML_Document *UpnpMakeAction( | ||||
| 	const char *ActionName, | ||||
| 	const char *ServType, | ||||
| 	int NumArg, | ||||
| 	const char *Arg, | ||||
| 	...) | ||||
| { | ||||
|     va_list ArgList; | ||||
|     IXML_Document *out = NULL; | ||||
| 	va_list ArgList; | ||||
| 	IXML_Document *out = NULL; | ||||
|  | ||||
|     va_start( ArgList, Arg ); | ||||
|     out = makeAction( 0, ActionName, ServType, NumArg, Arg, ArgList ); | ||||
|     va_end( ArgList ); | ||||
| 	va_start(ArgList, Arg); | ||||
| 	out = makeAction(0, ActionName, ServType, NumArg, Arg, ArgList); | ||||
| 	va_end(ArgList); | ||||
|  | ||||
|     return out; | ||||
| 	return out; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpMakeActionResponse											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN char * ActionName: Name of the action request or response | ||||
| *	IN char * ServType: Service type | ||||
| *	IN int NumArg :Number of arguments in the action request or response | ||||
| *	IN char * Arg : pointer to the first argument | ||||
| *	IN ... : variable argument list | ||||
| *	IN va_list ArgList: Argument list | ||||
| * | ||||
| * Description:		 | ||||
| *	This function creates the action response from the argument | ||||
| * list. Its a wrapper function that calls makeAction function to create | ||||
| * the action response. | ||||
| * | ||||
| * Returns: IXML_Document * | ||||
| *	returns action response document if successful  | ||||
| *	else returns NULL | ||||
| ***************************************************************************/ | ||||
| IXML_Document * | ||||
| UpnpMakeActionResponse( const char *ActionName, | ||||
|                         const char *ServType, | ||||
|                         int NumArg, | ||||
|                         const char *Arg, | ||||
|                         ... ) | ||||
|  | ||||
| IXML_Document *UpnpMakeActionResponse( | ||||
| 	const char *ActionName, | ||||
| 	const char *ServType, | ||||
| 	int NumArg, | ||||
| 	const char *Arg, | ||||
| 	...) | ||||
| { | ||||
|     va_list ArgList; | ||||
|     IXML_Document *out = NULL; | ||||
| 	va_list ArgList; | ||||
| 	IXML_Document *out = NULL; | ||||
|  | ||||
|     va_start( ArgList, Arg ); | ||||
|     out = makeAction( 1, ActionName, ServType, NumArg, Arg, ArgList ); | ||||
|     va_end( ArgList ); | ||||
| 	va_start(ArgList, Arg); | ||||
| 	out = makeAction(1, ActionName, ServType, NumArg, Arg, ArgList); | ||||
| 	va_end(ArgList); | ||||
|  | ||||
|     return out; | ||||
| 	return out; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpAddToActionResponse									 | ||||
| *																	 | ||||
| * Parameters: | ||||
| *	INOUT IXML_Document **ActionResponse: action response document	 | ||||
| *	IN char * ActionName: Name of the action request or response | ||||
| *	IN char * ServType: Service type | ||||
| *	IN int ArgName :Name of argument to be added in the action response | ||||
| *	IN char * ArgValue : value of the argument | ||||
| * | ||||
| * Description:		 | ||||
| *	This function adds the argument in the action response. Its a wrapper  | ||||
| * function that calls addToAction function to add the argument in the  | ||||
| * action response. | ||||
| * | ||||
| * Returns: int | ||||
| *	returns UPNP_E_SUCCESS if successful  | ||||
| *	else returns appropriate error | ||||
| ***************************************************************************/ | ||||
| int | ||||
| UpnpAddToActionResponse( INOUT IXML_Document ** ActionResponse, | ||||
|                          IN const char *ActionName, | ||||
|                          IN const char *ServType, | ||||
|                          IN const char *ArgName, | ||||
|                          IN const char *ArgValue ) | ||||
|  | ||||
| int UpnpAddToAction( | ||||
| 	IXML_Document **ActionDoc, | ||||
| 	const char *ActionName, | ||||
| 	const char *ServType, | ||||
| 	const char *ArgName, | ||||
| 	const char *ArgValue) | ||||
| { | ||||
|     return addToAction( 1, ActionResponse, ActionName, ServType, ArgName, | ||||
|                         ArgValue ); | ||||
| 	return addToAction(0, ActionDoc, ActionName, ServType, ArgName, ArgValue); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpAddToAction									 | ||||
| *																	 | ||||
| * Parameters: | ||||
| *	INOUT IXML_Document **ActionDoc: action request document	 | ||||
| *	IN char * ActionName: Name of the action request or response | ||||
| *	IN char * ServType: Service type | ||||
| *	IN int ArgName :Name of argument to be added in the action response | ||||
| *	IN char * ArgValue : value of the argument | ||||
| * | ||||
| * Description:		 | ||||
| *	This function adds the argument in the action request. Its a wrapper  | ||||
| * function that calls addToAction function to add the argument in the  | ||||
| * action request. | ||||
| * | ||||
| * Returns: int | ||||
| *	returns UPNP_E_SUCCESS if successful  | ||||
| *	else returns appropriate error | ||||
| ***************************************************************************/ | ||||
| int | ||||
| UpnpAddToAction( IXML_Document ** ActionDoc, | ||||
|                  const char *ActionName, | ||||
|                  const char *ServType, | ||||
|                  const char *ArgName, | ||||
|                  const char *ArgValue ) | ||||
| { | ||||
|  | ||||
|     return addToAction( 0, ActionDoc, ActionName, ServType, ArgName, | ||||
|                         ArgValue ); | ||||
| int UpnpAddToActionResponse( | ||||
| 	IXML_Document **ActionResponse, | ||||
| 	const char *ActionName, | ||||
| 	const char *ServType, | ||||
| 	const char *ArgName, | ||||
| 	const char *ArgValue) | ||||
| { | ||||
| 	return addToAction(1, ActionResponse, ActionName, ServType, ArgName, ArgValue); | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpAddToPropertySet											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	INOUT IXML_Document **PropSet: propertyset document | ||||
| *	IN char *ArgName: Name of the argument | ||||
| *	IN char *ArgValue: value of the argument | ||||
| * | ||||
| * Description:		 | ||||
| *	This function adds the argument in the propertyset node  | ||||
| * | ||||
| * Returns: int | ||||
| *	returns UPNP_E_SUCCESS if successful else returns appropriate error | ||||
| ***************************************************************************/ | ||||
| int | ||||
| UpnpAddToPropertySet( INOUT IXML_Document ** PropSet, | ||||
|                       IN const char *ArgName, | ||||
|                       IN const char *ArgValue ) | ||||
|  | ||||
| IXML_Document *UpnpCreatePropertySet( | ||||
| 	int NumArg, | ||||
| 	const char *Arg, | ||||
| 	...) | ||||
| { | ||||
| 	va_list ArgList; | ||||
| 	int Idx = 0; | ||||
| 	char BlankDoc[] = | ||||
| 		"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">" | ||||
| 		"</e:propertyset>"; | ||||
| 	const char *ArgName, | ||||
| 	*ArgValue; | ||||
| 	IXML_Node *node; | ||||
| 	IXML_Element *Ele; | ||||
| 	IXML_Element *Ele1; | ||||
| 	IXML_Node *Txt; | ||||
| 	IXML_Document *PropSet; | ||||
|  | ||||
|     char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas" | ||||
|         "-upnp-org:event-1-0\"></e:propertyset>"; | ||||
|     IXML_Node *node; | ||||
|     IXML_Element *Ele; | ||||
|     IXML_Element *Ele1; | ||||
|     IXML_Node *Txt; | ||||
|     int rc; | ||||
| 	if(ixmlParseBufferEx(BlankDoc, &PropSet) != IXML_SUCCESS) { | ||||
| 		return NULL; | ||||
| 	} | ||||
|  | ||||
|     if( ArgName == NULL ) { | ||||
|         return UPNP_E_INVALID_PARAM; | ||||
|     } | ||||
| 	if (NumArg < 1) { | ||||
| 		return PropSet; | ||||
| 	} | ||||
|  | ||||
|     if( *PropSet == NULL ) { | ||||
|         rc = ixmlParseBufferEx( BlankDoc, PropSet ); | ||||
|         if( rc != IXML_SUCCESS ) { | ||||
|             return UPNP_E_OUTOF_MEMORY; | ||||
|         } | ||||
|     } | ||||
| 	va_start(ArgList, Arg); | ||||
| 	ArgName = Arg; | ||||
| 	while (Idx++ != NumArg) { | ||||
| 		ArgValue = va_arg(ArgList, const char *); | ||||
| 		if (ArgName != NULL /*&& ArgValue != NULL */) { | ||||
| 			node = ixmlNode_getFirstChild((IXML_Node *)PropSet); | ||||
| 			Ele1 = ixmlDocument_createElement(PropSet, "e:property"); | ||||
| 			Ele = ixmlDocument_createElement(PropSet, ArgName); | ||||
| 			if (ArgValue) { | ||||
| 				Txt = ixmlDocument_createTextNode(PropSet, ArgValue); | ||||
| 				ixmlNode_appendChild((IXML_Node *)Ele, Txt); | ||||
| 			} | ||||
| 			ixmlNode_appendChild((IXML_Node *)Ele1, (IXML_Node *)Ele); | ||||
| 			ixmlNode_appendChild(             node, (IXML_Node *)Ele1); | ||||
| 		} | ||||
| 		ArgName = va_arg(ArgList, const char *); | ||||
| 	} | ||||
| 	va_end(ArgList); | ||||
|  | ||||
|     node = ixmlNode_getFirstChild( ( IXML_Node * ) * PropSet ); | ||||
|  | ||||
|     Ele1 = ixmlDocument_createElement( *PropSet, "e:property" ); | ||||
|     Ele = ixmlDocument_createElement( *PropSet, ArgName ); | ||||
|  | ||||
|     if( ArgValue ) { | ||||
|         Txt = ixmlDocument_createTextNode( *PropSet, ArgValue ); | ||||
|         ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt ); | ||||
|     } | ||||
|  | ||||
|     ixmlNode_appendChild( ( IXML_Node * ) Ele1, ( IXML_Node * ) Ele ); | ||||
|     ixmlNode_appendChild( node, ( IXML_Node * ) Ele1 ); | ||||
|  | ||||
|     return UPNP_E_SUCCESS; | ||||
| 	return PropSet; | ||||
| } | ||||
|  | ||||
| /************************************************************************ | ||||
| * Function : UpnpCreatePropertySet											 | ||||
| *																	 | ||||
| * Parameters:														 | ||||
| *	IN int NumArg: Number of argument that will go in the propertyset node | ||||
| *	IN char * Args: argument strings | ||||
| * | ||||
| * Description:		 | ||||
| *	This function creates a propertyset node and put all the input  | ||||
| *	parameters in the node as elements | ||||
| * | ||||
| * Returns: IXML_Document * | ||||
| *	returns the document containing propertyset node. | ||||
| ***************************************************************************/ | ||||
| IXML_Document * | ||||
| UpnpCreatePropertySet( IN int NumArg, | ||||
|                        IN const char *Arg, | ||||
|                        ... ) | ||||
|  | ||||
| int UpnpAddToPropertySet( | ||||
| 	IXML_Document **PropSet, | ||||
| 	const char *ArgName, | ||||
| 	const char *ArgValue) | ||||
| { | ||||
|     va_list ArgList; | ||||
|     int Idx = 0; | ||||
|     char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas-" | ||||
|         "upnp-org:event-1-0\"></e:propertyset>"; | ||||
|     const char *ArgName, | ||||
|      *ArgValue; | ||||
|     IXML_Node *node; | ||||
|     IXML_Element *Ele; | ||||
|     IXML_Element *Ele1; | ||||
|     IXML_Node *Txt; | ||||
|     IXML_Document *PropSet; | ||||
| 	char BlankDoc[] = | ||||
| 		"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">" | ||||
| 		"</e:propertyset>"; | ||||
| 	IXML_Node *node; | ||||
| 	IXML_Element *Ele; | ||||
| 	IXML_Element *Ele1; | ||||
| 	IXML_Node *Txt; | ||||
| 	int rc; | ||||
|  | ||||
|     if( ixmlParseBufferEx( BlankDoc, &PropSet ) != IXML_SUCCESS ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	if (ArgName == NULL) { | ||||
| 		return UPNP_E_INVALID_PARAM; | ||||
| 	} | ||||
|  | ||||
|     if( NumArg < 1 ) { | ||||
|         return NULL; | ||||
|     } | ||||
| 	if (*PropSet == NULL) { | ||||
| 		rc = ixmlParseBufferEx(BlankDoc, PropSet); | ||||
| 		if (rc != IXML_SUCCESS) { | ||||
| 			return UPNP_E_OUTOF_MEMORY; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|     va_start( ArgList, Arg ); | ||||
|     ArgName = Arg; | ||||
| 	node = ixmlNode_getFirstChild((IXML_Node *)*PropSet); | ||||
|  | ||||
|     while( Idx++ != NumArg ) { | ||||
|         ArgValue = va_arg( ArgList, const char * ); | ||||
| 	Ele1 = ixmlDocument_createElement(*PropSet, "e:property"); | ||||
| 	Ele = ixmlDocument_createElement(*PropSet, ArgName); | ||||
|  | ||||
|         if( ArgName != NULL /*&& ArgValue != NULL */  ) { | ||||
|             node = ixmlNode_getFirstChild( ( IXML_Node * ) PropSet ); | ||||
|             Ele1 = ixmlDocument_createElement( PropSet, "e:property" ); | ||||
|             Ele = ixmlDocument_createElement( PropSet, ArgName ); | ||||
|             if( ArgValue ) { | ||||
|                 Txt = ixmlDocument_createTextNode( PropSet, ArgValue ); | ||||
|                 ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt ); | ||||
|             } | ||||
| 	if (ArgValue) { | ||||
| 		Txt = ixmlDocument_createTextNode(*PropSet, ArgValue); | ||||
| 		ixmlNode_appendChild((IXML_Node *)Ele, Txt); | ||||
| 	} | ||||
|  | ||||
|             ixmlNode_appendChild( ( IXML_Node * ) Ele1, | ||||
|                                   ( IXML_Node * ) Ele ); | ||||
|             ixmlNode_appendChild( node, ( IXML_Node * ) Ele1 ); | ||||
|         } | ||||
| 	ixmlNode_appendChild((IXML_Node *)Ele1, (IXML_Node *)Ele); | ||||
| 	ixmlNode_appendChild(node, (IXML_Node *)Ele1); | ||||
|  | ||||
|         ArgName = va_arg( ArgList, const char * ); | ||||
|  | ||||
|     } | ||||
|     va_end( ArgList ); | ||||
|     return PropSet; | ||||
| 	return UPNP_E_SUCCESS; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif /* EXCLUDE_DOM == 0 */ | ||||
|  | ||||
|   | ||||
| @@ -93,37 +93,35 @@ genaCallback( IN http_parser_t * parser, | ||||
|     xboolean found_function = FALSE; | ||||
|  | ||||
|     if( request->method == HTTPMETHOD_SUBSCRIBE ) { | ||||
|         DEVICEONLY( found_function = TRUE; | ||||
|                     if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL ) | ||||
|                     { | ||||
|                     // renew subscription | ||||
|                     gena_process_subscription_renewal_request | ||||
|                     ( info, request );} | ||||
|                     else | ||||
|                     { | ||||
|                     // subscribe | ||||
|                     gena_process_subscription_request( info, request );} | ||||
| #ifdef INCLUDE_DEVICE_APIS | ||||
|         found_function = TRUE; | ||||
|         if( httpmsg_find_hdr( request, HDR_NT, NULL ) == NULL ) { | ||||
|             // renew subscription | ||||
|             gena_process_subscription_renewal_request | ||||
|             ( info, request ); | ||||
| 	} else { | ||||
|             // 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 | ||||
|         gena_process_unsubscribe_request( info, request ); | ||||
| #endif | ||||
|     } else if( request->method == HTTPMETHOD_NOTIFY ) { | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
|         found_function = TRUE; | ||||
|         // notify | ||||
|         gena_process_notification_event( info, request ); | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|                     DBGONLY( UpnpPrintf | ||||
|                              ( UPNP_ALL, GENA, __FILE__, __LINE__, | ||||
|                                "got subscription request\n" ); ) | ||||
|              ) | ||||
|             } | ||||
|             else | ||||
|         if( request->method == HTTPMETHOD_UNSUBSCRIBE ) { | ||||
|             DEVICEONLY( found_function = TRUE; | ||||
|                         // unsubscribe | ||||
|                         gena_process_unsubscribe_request( info, | ||||
|                                                           request ); ) | ||||
|         } else if( request->method == HTTPMETHOD_NOTIFY ) { | ||||
|             CLIENTONLY( found_function = TRUE; | ||||
|                         // notify | ||||
|                         gena_process_notification_event( info, request ); ) | ||||
|         } | ||||
|  | ||||
|         if( !found_function ) { | ||||
|     if( !found_function ) { | ||||
|             // handle missing functions of device or ctrl pt | ||||
|             error_respond( info, HTTP_NOT_IMPLEMENTED, request ); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| #endif // EXCLUDE_GENA | ||||
|  | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,209 +1,329 @@ | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // | ||||
| // 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 defines the functions for clients. It defines  | ||||
| * functions for adding and removing clients to and from the client table,  | ||||
| * adding and accessing subscription and other attributes pertaining to the  | ||||
| * client   | ||||
| ************************************************************************/ | ||||
|  * Purpose: This file defines the functions for clients. It defines  | ||||
|  * functions for adding and removing clients to and from the client table,  | ||||
|  * adding and accessing subscription and other attributes pertaining to the  | ||||
|  * client   | ||||
|  ************************************************************************/ | ||||
|  | ||||
|  | ||||
| #include "config.h" | ||||
|  | ||||
|  | ||||
| #include "client_table.h" | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	copy_client_subscription | ||||
| * | ||||
| *	Parameters : | ||||
| *		client_subscription * in ;	- source client subscription | ||||
| *		client_subscription * out ;	- destination client subscription | ||||
| * | ||||
| *	Description :	Make a copy of the client subscription data | ||||
| * | ||||
| *	Return : int ; | ||||
| *		UPNP_E_OUTOF_MEMORY - On Failure to allocate memory | ||||
| *		HTTP_SUCCESS - On Success | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
| CLIENTONLY( int copy_client_subscription( client_subscription * in, | ||||
|                                           client_subscription * out ) { | ||||
|             int len = strlen( in->ActualSID ) + 1; | ||||
|             int len1 = strlen( in->EventURL ) + 1; | ||||
|             memcpy( out->sid, in->sid, SID_SIZE ); | ||||
|             out->sid[SID_SIZE] = 0; | ||||
|             out->ActualSID = ( char * )malloc( len ); | ||||
|             if( out->ActualSID == NULL ) | ||||
|                 return UPNP_E_OUTOF_MEMORY; | ||||
|             out->EventURL = ( char * )malloc( len1 ); | ||||
|             if( out->EventURL == NULL ) { | ||||
|                 free(out->ActualSID); | ||||
|                 return UPNP_E_OUTOF_MEMORY; | ||||
|             } | ||||
|             memcpy( out->ActualSID, in->ActualSID, len ); | ||||
|             memcpy( out->EventURL, in->EventURL, len1 ); | ||||
|             //copies do not get RenewEvent Ids or next | ||||
|             out->RenewEventId = -1; out->next = NULL; return HTTP_SUCCESS;} | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	free_client_subscription | ||||
| * | ||||
| *	Parameters : | ||||
| *		client_subscription * sub ;	- Client subscription to be freed | ||||
| * | ||||
| *	Description :	Free memory allocated for client subscription data. | ||||
| *		Remove timer thread associated with this subscription event. | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
|             void free_client_subscription( client_subscription * sub ) { | ||||
|             upnp_timeout * event; ThreadPoolJob tempJob; if( sub ) { | ||||
|             if( sub->ActualSID ) | ||||
|             free( sub->ActualSID ); if( sub->EventURL ) | ||||
|             free( sub->EventURL ); if( sub->RenewEventId != -1 )    //do not remove timer event of copy | ||||
|             //invalid timer event id | ||||
|             { | ||||
|             if( TimerThreadRemove | ||||
|                 ( &gTimerThread, sub->RenewEventId, &tempJob ) == 0 ) { | ||||
|             event = ( upnp_timeout * ) tempJob.arg; | ||||
|             free_upnp_timeout( event );} | ||||
|             } | ||||
| #ifdef INCLUDE_CLIENT_APIS | ||||
|  | ||||
|             sub->RenewEventId = -1;} | ||||
|             } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	freeClientSubList | ||||
| * | ||||
| *	Parameters : | ||||
| *		client_subscription * list ; Client subscription  | ||||
| * | ||||
| *	Description :	Free the client subscription table. | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
|             void freeClientSubList( client_subscription * list ) { | ||||
|             client_subscription * next; while( list ) { | ||||
|             free_client_subscription( list ); | ||||
|             next = list->next; free( list ); list = next;} | ||||
|             } | ||||
| #include <stdlib.h> // for calloc(), free() | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	RemoveClientSubClientSID | ||||
| * | ||||
| *	Parameters : | ||||
| *		client_subscription **head ; Head of the subscription list	 | ||||
| *		const Upnp_SID sid ;		 Subscription ID to be mactched | ||||
| * | ||||
| *	Description :	Remove the client subscription matching the  | ||||
| *		subscritpion id represented by the const Upnp_SID sid parameter  | ||||
| *		from the table and update the table. | ||||
| * | ||||
| *	Return : void ; | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
|             void RemoveClientSubClientSID( client_subscription ** head, | ||||
|                                            const Upnp_SID sid ) { | ||||
|             client_subscription * finger = ( *head ); | ||||
|             client_subscription * previous = NULL; while( finger ) { | ||||
|             if( !( strcmp( sid, finger->sid ) ) ) { | ||||
|             if( previous ) | ||||
|             previous->next = finger->next; | ||||
|             else | ||||
|             ( *head ) = finger->next; | ||||
|             finger->next = NULL; | ||||
|             freeClientSubList( finger ); finger = NULL;} | ||||
|             else | ||||
|             { | ||||
|             previous = finger; finger = finger->next;} | ||||
|             } | ||||
|             } | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	GetClientSubClientSID | ||||
| * | ||||
| *	Parameters : | ||||
| *		client_subscription *head ; Head of the subscription list	 | ||||
| *		const Upnp_SID sid ;		Subscription ID to be matched | ||||
| * | ||||
| *	Description :	Return the client subscription from the client table  | ||||
| *		that matches const Upnp_SID sid subscrition id value.  | ||||
| * | ||||
| *	Return : client_subscription * ; The matching subscription | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
|             client_subscription * | ||||
|             GetClientSubClientSID( client_subscription * head, | ||||
|                                    const Upnp_SID sid ) { | ||||
|             client_subscription * next = head; while( next ) { | ||||
|             if( !strcmp( next->sid, sid ) ) | ||||
|             break; | ||||
|             else | ||||
|             { | ||||
|             next = next->next;} | ||||
|             } | ||||
|             return next;} | ||||
| struct SClientSubscription { | ||||
| 	int m_renewEventId; | ||||
| 	UpnpString *m_SID; | ||||
| 	UpnpString *m_actualSID; | ||||
| 	UpnpString *m_eventURL; | ||||
| 	struct SClientSubscription *m_next; | ||||
| }; | ||||
|  | ||||
| /************************************************************************ | ||||
| *	Function :	GetClientSubActualSID | ||||
| * | ||||
| *	Parameters : | ||||
| *		client_subscription *head ;	Head of the subscription list		 | ||||
| *		token * sid ;				Subscription ID to be matched | ||||
| * | ||||
| *	Description :	Returns the client subscription from the client  | ||||
| *		subscription table that has the matching token * sid buffer | ||||
| *		value. | ||||
| * | ||||
| *	Return : client_subscription * ; The matching subscription | ||||
| * | ||||
| *	Note : | ||||
| ************************************************************************/ | ||||
|             client_subscription * | ||||
|             GetClientSubActualSID( client_subscription * head, | ||||
|                                    token * sid ) { | ||||
|             client_subscription * next = head; while( next ) { | ||||
|  | ||||
|             if( !memcmp( next->ActualSID, sid->buff, sid->size ) ) | ||||
|             break; | ||||
|             else | ||||
|             { | ||||
|             next = next->next;} | ||||
|             } | ||||
|             return next;} | ||||
| /** Constructor */ | ||||
| ClientSubscription *UpnpClientSubscription_new() | ||||
| { | ||||
| 	struct SClientSubscription *p = calloc(1, sizeof (struct SClientSubscription)); | ||||
| #if 0 | ||||
| 	p->renewEventId =  0; | ||||
| #endif | ||||
| 	p->m_SID = UpnpString_new(); | ||||
| 	p->m_actualSID = UpnpString_new(); | ||||
| 	p->m_eventURL = UpnpString_new(); | ||||
| 	p->m_next = NULL; | ||||
|  | ||||
| 	return (ClientSubscription *)p; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** Destructor */ | ||||
| void UpnpClientSubscription_delete(ClientSubscription *p) | ||||
| { | ||||
| 	struct SClientSubscription *q = (struct SClientSubscription *)p; | ||||
|  | ||||
| 	if (!q) return; | ||||
|  | ||||
| 	q->m_renewEventId = 0; | ||||
|  | ||||
| 	UpnpString_delete(q->m_SID); | ||||
| 	q->m_SID = NULL; | ||||
|  | ||||
| 	UpnpString_delete(q->m_actualSID); | ||||
| 	q->m_actualSID = NULL; | ||||
|  | ||||
| 	UpnpString_delete(q->m_eventURL); | ||||
| 	q->m_eventURL = NULL; | ||||
|  | ||||
| 	q->m_next = NULL; | ||||
|  | ||||
| 	free(p); | ||||
| } | ||||
|  | ||||
|  | ||||
| /** Copy Constructor */ | ||||
| ClientSubscription *UpnpClientSubscription_dup(const ClientSubscription *p) | ||||
| { | ||||
| 	ClientSubscription *q = UpnpClientSubscription_new(); | ||||
| 	 | ||||
| 	UpnpClientSubscription_assign(q, p); | ||||
| 	 | ||||
| 	return q; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** Assignment operator */ | ||||
| void UpnpClientSubscription_assign(ClientSubscription *q, const ClientSubscription *p) | ||||
| { | ||||
| 	if (q != p) { | ||||
| 		// Do not copy RenewEventId | ||||
| 		((struct SClientSubscription *)q)->m_renewEventId = -1; | ||||
| 		UpnpClientSubscription_set_SID(q, UpnpClientSubscription_get_SID(p)); | ||||
| 		UpnpClientSubscription_set_ActualSID(q, UpnpClientSubscription_get_ActualSID(p)); | ||||
| 		UpnpClientSubscription_set_EventURL(q, UpnpClientSubscription_get_EventURL(p)); | ||||
| 		// Do not copy m_next | ||||
| 		((struct SClientSubscription *)q)->m_next = NULL; | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| int UpnpClientSubscription_get_RenewEventId(const ClientSubscription *p) | ||||
| { | ||||
| 	return ((struct SClientSubscription *)p)->m_renewEventId; | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_set_RenewEventId(ClientSubscription *p, int n) | ||||
| { | ||||
| 	((struct SClientSubscription *)p)->m_renewEventId = n; | ||||
| } | ||||
|  | ||||
|  | ||||
| const UpnpString *UpnpClientSubscription_get_SID(const ClientSubscription *p) | ||||
| { | ||||
| 	return ((struct SClientSubscription *)p)->m_SID; | ||||
| } | ||||
|  | ||||
| const char *UpnpClientSubscription_get_SID_cstr(const ClientSubscription *p) | ||||
| { | ||||
| 	return UpnpString_get_String(UpnpClientSubscription_get_SID(p)); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_set_SID(ClientSubscription *p, const UpnpString *s) | ||||
| { | ||||
| 	UpnpString_delete(((struct SClientSubscription *)p)->m_SID); | ||||
| 	((struct SClientSubscription *)p)->m_SID = UpnpString_dup(s); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_strcpy_SID(ClientSubscription *p, const char *s) | ||||
| { | ||||
| 	UpnpString_delete(((struct SClientSubscription *)p)->m_SID); | ||||
| 	((struct SClientSubscription *)p)->m_SID = UpnpString_new(); | ||||
| 	UpnpString_set_String(((struct SClientSubscription *)p)->m_SID, s); | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| const UpnpString *UpnpClientSubscription_get_ActualSID(const ClientSubscription *p) | ||||
| { | ||||
| 	return ((struct SClientSubscription *)p)->m_actualSID; | ||||
| } | ||||
|  | ||||
|  | ||||
| const char *UpnpClientSubscription_get_ActualSID_cstr(const ClientSubscription *p) | ||||
| { | ||||
| 	return UpnpString_get_String(UpnpClientSubscription_get_ActualSID(p)); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_set_ActualSID(ClientSubscription *p, const UpnpString *s) | ||||
| { | ||||
| 	UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID); | ||||
| 	((struct SClientSubscription *)p)->m_actualSID = UpnpString_dup(s); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_strcpy_ActualSID(ClientSubscription *p, const char *s) | ||||
| { | ||||
| 	UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID); | ||||
| 	((struct SClientSubscription *)p)->m_actualSID = UpnpString_new(); | ||||
| 	UpnpString_set_String(((struct SClientSubscription *)p)->m_actualSID, s); | ||||
| } | ||||
|  | ||||
|  | ||||
| const UpnpString *UpnpClientSubscription_get_EventURL(const ClientSubscription *p) | ||||
| { | ||||
| 	return ((struct SClientSubscription *)p)->m_eventURL; | ||||
| } | ||||
|  | ||||
|  | ||||
| const char *UpnpClientSubscription_get_EventURL_cstr(const ClientSubscription *p) | ||||
| { | ||||
| 	return UpnpString_get_String(UpnpClientSubscription_get_EventURL(p)); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_set_EventURL(ClientSubscription *p, const UpnpString *s) | ||||
| { | ||||
| 	UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL); | ||||
| 	((struct SClientSubscription *)p)->m_eventURL = UpnpString_dup(s); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_strcpy_EventURL(ClientSubscription *p, const char *s) | ||||
| { | ||||
| 	UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL); | ||||
| 	((struct SClientSubscription *)p)->m_eventURL = UpnpString_new(); | ||||
| 	UpnpString_set_String(((struct SClientSubscription *)p)->m_eventURL, s); | ||||
| } | ||||
|  | ||||
|  | ||||
| ClientSubscription *UpnpClientSubscription_get_Next(const ClientSubscription *p) | ||||
| { | ||||
| 	return (ClientSubscription *)(((struct SClientSubscription *)p)->m_next); | ||||
| } | ||||
|  | ||||
|  | ||||
| void UpnpClientSubscription_set_Next(ClientSubscription *p, ClientSubscription *q) | ||||
| { | ||||
| 	((struct SClientSubscription *)p)->m_next = (struct SClientSubscription *)q; | ||||
| } | ||||
|  | ||||
|  | ||||
| void free_client_subscription(ClientSubscription *sub) | ||||
| { | ||||
| 	upnp_timeout *event; | ||||
| 	ThreadPoolJob tempJob; | ||||
| 	if (sub) { | ||||
| 		int renewEventId = UpnpClientSubscription_get_RenewEventId(sub); | ||||
| 		UpnpClientSubscription_strcpy_ActualSID(sub, ""); | ||||
| 		UpnpClientSubscription_strcpy_EventURL(sub, ""); | ||||
| 		if (renewEventId != -1) { | ||||
| 			// do not remove timer event of copy | ||||
| 			// invalid timer event id | ||||
| 			if (TimerThreadRemove(&gTimerThread, renewEventId, &tempJob) == 0) { | ||||
| 				event = (upnp_timeout *)tempJob.arg; | ||||
| 				free_upnp_timeout(event); | ||||
| 			} | ||||
| 		} | ||||
| 		UpnpClientSubscription_set_RenewEventId(sub, -1); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| void freeClientSubList(ClientSubscription *list) | ||||
| { | ||||
| 	ClientSubscription *next; | ||||
| 	while (list) { | ||||
| 		free_client_subscription(list); | ||||
| 		next = UpnpClientSubscription_get_Next(list); | ||||
| 		UpnpClientSubscription_delete(list); | ||||
| 		list = next; | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| void RemoveClientSubClientSID(ClientSubscription **head, const UpnpString *sid) | ||||
| { | ||||
| 	ClientSubscription *finger = *head; | ||||
| 	ClientSubscription *previous = NULL; | ||||
| 	int found = 0; | ||||
| 	while (finger) { | ||||
| 		found = !strcmp( | ||||
| 			UpnpString_get_String(sid), | ||||
| 			UpnpClientSubscription_get_SID_cstr(finger)); | ||||
| 		if (found) { | ||||
| 			if (previous) { | ||||
| 				UpnpClientSubscription_set_Next(previous, | ||||
| 					UpnpClientSubscription_get_Next(finger)); | ||||
| 			} else { | ||||
| 				*head = UpnpClientSubscription_get_Next(finger); | ||||
| 			} | ||||
| 			UpnpClientSubscription_set_Next(finger, NULL); | ||||
| 			freeClientSubList(finger); | ||||
| 			finger = NULL; | ||||
| 		} else { | ||||
| 			previous = finger; | ||||
| 			finger = UpnpClientSubscription_get_Next(finger); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| ClientSubscription *GetClientSubClientSID(ClientSubscription *head, const UpnpString *sid) | ||||
| { | ||||
| 	ClientSubscription *next = head; | ||||
| 	int found = 0; | ||||
| 	while (next) { | ||||
| 		found = !strcmp( | ||||
| 			UpnpClientSubscription_get_SID_cstr(next), | ||||
| 			UpnpString_get_String(sid)); | ||||
| 		if(found) { | ||||
| 			break; | ||||
| 		} else { | ||||
| 			next = UpnpClientSubscription_get_Next(next); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return next; | ||||
| } | ||||
|  | ||||
|  | ||||
| ClientSubscription *GetClientSubActualSID(ClientSubscription *head, token *sid) | ||||
| { | ||||
| 	ClientSubscription *next = head; | ||||
| 	while (next) { | ||||
| 		if (!memcmp( | ||||
| 			UpnpClientSubscription_get_ActualSID_cstr(next), | ||||
| 			sid->buff, sid->size)) { | ||||
| 			break; | ||||
| 		} else { | ||||
| 			next = UpnpClientSubscription_get_Next(next); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	return next; | ||||
| } | ||||
|  | ||||
|  | ||||
|  #endif /* INCLUDE_CLIENT_APIS */ | ||||
|  | ||||
|  ) | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user