Compare commits
44 Commits
last_svn_1
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62903b80f0 | ||
|
|
6080414dc9 | ||
|
|
6cbd7f0159 | ||
|
|
c7c493c043 | ||
|
|
c2f8e8789a | ||
|
|
76457d0187 | ||
|
|
9f5d49f9fd | ||
|
|
cad4d05cd7 | ||
|
|
26b8968e0c | ||
|
|
d2eaa23b59 | ||
|
|
b8aec74782 | ||
|
|
851cfbc4db | ||
|
|
f42bbb6dc2 | ||
|
|
bd6027c3d1 | ||
|
|
e3865bf6b6 | ||
|
|
27af41e562 | ||
|
|
1f05f5d6cc | ||
|
|
43b9760840 | ||
|
|
0103424b91 | ||
|
|
13a1fff7a1 | ||
|
|
c9463545a8 | ||
|
|
de1d7e81a3 | ||
|
|
f87dbf8115 | ||
|
|
83ee32afb7 | ||
|
|
4f960c4e34 | ||
|
|
c85537df11 | ||
|
|
20905cb7a7 | ||
|
|
5b744169d5 | ||
|
|
c69e16b347 | ||
|
|
cb7e6b7472 | ||
|
|
fd80e5a8ff | ||
|
|
b29de32110 | ||
|
|
6455ac6eea | ||
|
|
f7bb1f9582 | ||
|
|
0728ab3b25 | ||
|
|
cb9ee8254c | ||
|
|
f08fdac9b6 | ||
|
|
0db035cc7b | ||
|
|
da11e52924 | ||
|
|
bc7b0c9d4d | ||
|
|
b2757d9d55 | ||
|
|
7967a0cd45 | ||
|
|
67b51187b9 | ||
|
|
491f5ffef6 |
708
ChangeLog
708
ChangeLog
@@ -1,647 +1,3 @@
|
|||||||
*******************************************************************************
|
|
||||||
Version 1.6.7
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* The last part of Ronan Menard's patch.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* upnp/src/ssdp/ssdp_device.c: Fix for IPV6 ULA/GUA issues.
|
|
||||||
* upnp/src/ssdp/ssdp_ctrlpt.c: Fix for IPV6 ULA/GUA issues.
|
|
||||||
* upnp/src/ssdp/ssdp_server.c: Fix for IPV6 ULA/GUA issues.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* upnp/src/genlib/miniserver/miniserver.c: Fix for IPV6 ULA/GUA issues.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* gena_subscribe(): Fix for IPV6 ULA/GUA issues.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SOCKET ssdpSock6UlaGua: created variable for later use.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SSDP_IPV6_SITELOCAL: new macro.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* The scope of the macro NUM_HANDLE is now restricted to upnpapi.c.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* InitHandleList() has never been implemented, I guess no one has ever
|
|
||||||
called it, so remove it.
|
|
||||||
* GetFreeHandle() and FreeHandle() are now static as they should.
|
|
||||||
|
|
||||||
2010-08-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* New internal buffer added to store global/ula IPV6 address.
|
|
||||||
* Macros to test whether an IPV6 address is global or ula.
|
|
||||||
* UpnpGetServerUlaGuaIp6Address(): added interface.
|
|
||||||
* IN6_IS_ADDR_GLOBAL, IN6_IS_ADDR_ULA: new macros.
|
|
||||||
* gIF_IPV6_ULA_GUA: new buffer.
|
|
||||||
* UpnpRegisterRootDevice3(): Change to the test of already registered
|
|
||||||
devices for IPV6.
|
|
||||||
* UpnpGetIfInfo(): gua/ula issues.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-19 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* libUPnP does support IPV6 now.
|
|
||||||
|
|
||||||
Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-08-19 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* HTTP version equal to 1.0 should fail as required by the UPnP
|
|
||||||
certification tool. Patch submitted by Ronan Menard.
|
|
||||||
|
|
||||||
2010-06-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
SF Bug Tracker [ 3022490 ] String declaration fix for patch applied in 3007407
|
|
||||||
Hello,
|
|
||||||
|
|
||||||
When my patch for tracker ID 3007407 was accepted, the definition of the
|
|
||||||
serviceList string was changed from
|
|
||||||
|
|
||||||
#define SERVICELIST_STR "serviceList"
|
|
||||||
|
|
||||||
to
|
|
||||||
|
|
||||||
static const char *SERVICELIST_STR = "serviceList";
|
|
||||||
|
|
||||||
During internal code review of the final patch, it was pointed out that
|
|
||||||
sizeof(SERVICELIST_STR) == 4 since SERVICELIST_STR is now declared as
|
|
||||||
a pointer instead of an array.
|
|
||||||
|
|
||||||
If you wish to use a variable instead of a define, I suggest the
|
|
||||||
following instead:
|
|
||||||
|
|
||||||
static const char SERVICELIST_STR[] = "serviceList";
|
|
||||||
|
|
||||||
Thanks,
|
|
||||||
Chuck Thomason
|
|
||||||
|
|
||||||
2010-06-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
SF Bug Tracker [ 3007407 ] Service traversal issue in AdvertiseAndReply()
|
|
||||||
Submitted: Chuck Thomason ( cyt4 ) - 2010-05-26 15:07:39 UTC
|
|
||||||
|
|
||||||
When the UPnP server is started, one alive message is broadcast for each
|
|
||||||
service in each device. It appears that libupnp's implementation of the
|
|
||||||
alive message generation does not correctly navigate the XML description
|
|
||||||
document when locating the services. This can result in the wrong UDN
|
|
||||||
being used in the alive message sent for a service.
|
|
||||||
|
|
||||||
In my specific case (see attached XML), the root EchoSTB device contains
|
|
||||||
no services, but its embedded MediaServer device contains 2 services.
|
|
||||||
When the existing libupnp code traverses the EchoSTB device in the XML,
|
|
||||||
it searches the global list of serviceLists within the document instead
|
|
||||||
of searching for a serviceList that is its direct child node. The
|
|
||||||
ContentDirectory and ConnectionManager services are then announced with
|
|
||||||
the UDN of EchoSTB1 (the root device) instead of with the UDN of
|
|
||||||
MediaServer, which is actually their parent device.
|
|
||||||
|
|
||||||
I discovered this behavior using libupnp-1.6.6. I have generated a patch
|
|
||||||
against branch-1.6.x that corrects the XML navigation such that all
|
|
||||||
services are traversed from their parent device, which results in the
|
|
||||||
correct UDN being sent in the alive message for each service. I built
|
|
||||||
from branch-1.6.x without this patch, tested, and confirmed that the
|
|
||||||
issue still exists as I observed it in libupnp-1.6.6. I then built
|
|
||||||
from branch-1.6.x with this patch, tested, and confirmed that the
|
|
||||||
issue was resolved.
|
|
||||||
|
|
||||||
Thanks,
|
|
||||||
Chuck Thomason
|
|
||||||
|
|
||||||
2010-05-07 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
SF Bug Tracker [ 2995758 ] libupnp 1.6.6, wrong bind when reuseaddr is
|
|
||||||
1.
|
|
||||||
Submitted: viallard anthony ( homer242 )
|
|
||||||
When trying to use reuseaddr option in miniserver/miniserver.c, there
|
|
||||||
isn't a affectation of the port chosen (serverAddr.sin_port isn't
|
|
||||||
receive listen_port variable value).
|
|
||||||
|
|
||||||
2010-04-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
Define PROTOTYPES to be one by default in global.h. This affects the
|
|
||||||
RSA MD5 code.
|
|
||||||
|
|
||||||
2010-03-27 Nick Leverton <nick@leverton.org>
|
|
||||||
Subscription auto-renewals copy the renewal time from old subscription.
|
|
||||||
|
|
||||||
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added API to ithread, created the following functions:
|
|
||||||
- int ithread_initialize_library(void);
|
|
||||||
- int ithread_cleanup_library(void);
|
|
||||||
- int ithread_initialize_thread(void);
|
|
||||||
- int ithread_cleanup_thread(void);
|
|
||||||
* SF Bug Tracker [ 2876374 ] Access Violation when compiling with Visual Studio 2008
|
|
||||||
Submitted: Stulle ( stulleamgym ) - 2009-10-10 19:05
|
|
||||||
|
|
||||||
Hi,
|
|
||||||
|
|
||||||
I am one of the devs of the MorphXT project and I use this lib in some
|
|
||||||
other of my projects, too. When I tried to upgrade the lib earlier for one
|
|
||||||
of my projects I had to realise that something did not work at first and
|
|
||||||
while most of the things were reasonably ease to be fixed. Now, the last
|
|
||||||
thing I encountered was not so easy to fix and I am uncertain if my fix is
|
|
||||||
any good so I'll just post it here and wait for some comments.
|
|
||||||
|
|
||||||
The problem was that I got an Access Violation when calling "UpnpInit". It
|
|
||||||
would call "ithread_rwlock_init(&GlobalHndRWLock, NULL)" which eventually
|
|
||||||
led to calling "pthread_cond_init" and I got the error notice at
|
|
||||||
"EnterCriticalSection (&ptw32_cond_list_lock);". It appeared that
|
|
||||||
"ptw32_cond_list_lock" was NULL. Now, I found two ways to fix this. Firstly
|
|
||||||
moving the whole block after at least one of the "ThreadPoolInit" calls
|
|
||||||
will fix the issue. Secondly, you could add:
|
|
||||||
#ifdef WIN32
|
|
||||||
#ifdef PTW32_STATIC_LIB
|
|
||||||
// to get the following working we need this... is it a good patch or
|
|
||||||
not... I do not know!
|
|
||||||
pthread_win32_process_attach_np();
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
right before "ithread_rwlock_init(&GlobalHndRWLock, NULL)".
|
|
||||||
|
|
||||||
Just so you know, I am using libupnp 1.6.6 and libpthreads 2.8.0 and both
|
|
||||||
are linked static into the binaries. I am currently using Visual Studio
|
|
||||||
2008 for development with Windows being the target OS. Any comment at your
|
|
||||||
end?
|
|
||||||
|
|
||||||
Regards, Stulle
|
|
||||||
|
|
||||||
2010-03-27 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
|
|
||||||
Submitted By: zephyrus ( zephyrus00jp )
|
|
||||||
This second part covers the issue on linking with -lsocket -lnsl -lrt.
|
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 2392166 ] ithread_detach not called for finished worker thread
|
|
||||||
Submitted: Ulrik ( ulsv_enea ) - 2008-12-05 08:24
|
|
||||||
|
|
||||||
Valgrind reports a memory leak due to that the function ithread_detach is
|
|
||||||
not called for finished worker threads in ThreadPool.c.
|
|
||||||
|
|
||||||
==21137== 2,176 bytes in 8 blocks are possibly lost in loss record 5 of 5
|
|
||||||
==21137== at 0x4C20F3F: calloc (vg_replace_malloc.c:279)
|
|
||||||
==21137== by 0x4010F58: _dl_allocate_tls (in /lib/ld-2.6.1.so)
|
|
||||||
==21137== by 0x544BA92: pthread_create@@GLIBC_2.2.5 (in
|
|
||||||
/lib/libpthread-2.6.1.so)
|
|
||||||
==21137== by 0x5F94592: CreateWorker (ThreadPool.c:639)
|
|
||||||
==21137== by 0x5F95079: ThreadPoolInit (ThreadPool.c:784)
|
|
||||||
|
|
||||||
I'm using libupnp 1.6.6
|
|
||||||
|
|
||||||
For more info on pthread_detach, see:
|
|
||||||
http://gelorakan.wordpress.com/2007/11/26/pthead_create-valgrind-memory-lea
|
|
||||||
k-solved/
|
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 2392304 ] Memory leak in SSDP AdvertiseAndReply
|
|
||||||
Submitted: Ulrik ( ulsv_enea ) - 2008-12-05 08:24
|
|
||||||
|
|
||||||
Valgrind reports a memory leak function in AdvertiseAndReply
|
|
||||||
(ssdp/ssdp_server.c) in libupnp 1.6.6
|
|
||||||
|
|
||||||
There are continue statements in many places in AdvertiseAndReply. In some
|
|
||||||
of those error handling cases the variable nodelist is not free'ed before
|
|
||||||
continuing to the next iteration. The next iteration will take care of
|
|
||||||
free'ing the nodelist from the previous iteration in most cases, but not
|
|
||||||
when breaking out of the for loop after the last element.
|
|
||||||
|
|
||||||
I belive this memory leak can be solved by makeing sure that the rows
|
|
||||||
|
|
||||||
ixmlNodeList_free( nodeList );
|
|
||||||
nodeList = NULL;
|
|
||||||
|
|
||||||
are always executed, also in the beginning of the last iteration when we
|
|
||||||
found out that there are not more elements.
|
|
||||||
|
|
||||||
==29110== at 0x4C21C16: malloc (vg_replace_malloc.c:149)
|
|
||||||
==29110== by 0x5D8DE0E: ixmlNodeList_addToNodeList (nodeList.c:106)
|
|
||||||
==29110== by 0x5D8B7E2: ixmlNode_getElementsByTagNameRecursive
|
|
||||||
(node.c:1438)
|
|
||||||
==29110== by 0x5D8E587: ixmlElement_getElementsByTagName
|
|
||||||
(element.c:491)
|
|
||||||
==29110== by 0x5B6C0F1: AdvertiseAndReply (ssdp_server.c:201)
|
|
||||||
==29110== by 0x5B7AB74: UpnpSendAdvertisement (upnpapi.c:1495)
|
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* libupnp and multi-flows scenario patch
|
|
||||||
Submited by Carlo Parata from STMicroelectronics.
|
|
||||||
|
|
||||||
Hi Roberto and Nektarios,
|
|
||||||
after an analysis of the problem of libupnp with a multi-flows scenario, I
|
|
||||||
noticed that the only cause of the freezed system is the ThreadPool
|
|
||||||
management. There are not mutex problems. In practise, if all threads in the
|
|
||||||
thread pool are busy executing jobs, a new worker thread should be created if
|
|
||||||
a job is scheduled (I inspired to tombupnp library). So I solved the problem
|
|
||||||
with a little patch in threadutil library that you can find attached in this
|
|
||||||
e-mail. I hope to have helped you.
|
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2964973 ] install: will not overwrite just-created
|
|
||||||
...blah... with...
|
|
||||||
Submitted: Nick Leverton ( leveret ) - 2010-03-07 05:18
|
|
||||||
|
|
||||||
Full error:
|
|
||||||
/usr/bin/install: will not overwrite just-created
|
|
||||||
`/tmp/buildd/libupnp-1.6.6/debian/tmp/usr/share/doc/libupnp3-dev/examples/s
|
|
||||||
ample_util.c' with `common/sample_util.c'
|
|
||||||
|
|
||||||
This seems to be from Automake 1.11 which doesn't like having duplicate
|
|
||||||
files in a Makefile.am. Patch attached, kindly provided by Stefan Potyra
|
|
||||||
for Debian (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=543068)
|
|
||||||
|
|
||||||
This fix will be needed for both 1.6.x and 1.8.x branches.
|
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Backport of svn revision 504:
|
|
||||||
SF Patch Tracker [ 2969188 ] 1.8.0: patch for FreeBSD compilation
|
|
||||||
Submitted By: Nick Leverton (leveret)
|
|
||||||
Fix the order of header inclusion for FreeBSD.
|
|
||||||
|
|
||||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
|
|
||||||
Submitted By: zephyrus ( zephyrus00jp )
|
|
||||||
Obs by Marcelo: The issue with linking with -lsocket -lnsl -lrt is not
|
|
||||||
covered in this changeset beacuse I don't have solaris to test. I will
|
|
||||||
need some help from zephyrus in this regard. The issue will be addressed
|
|
||||||
in a future changeset.
|
|
||||||
|
|
||||||
Compilation for solaris
|
|
||||||
|
|
||||||
I have used gcc3.x and gcc4.x under solaris 10 for x86 / 64 bits.
|
|
||||||
|
|
||||||
A couple of Source file fixes were necessary for successful compilation
|
|
||||||
and runtime behavior.
|
|
||||||
|
|
||||||
threadutil/src/ThreadPool.c
|
|
||||||
|
|
||||||
POSIX
|
|
||||||
sched_setschduler() returns non-negative value for success.
|
|
||||||
|
|
||||||
Without the fix, UpnpInit() fails immediately.
|
|
||||||
|
|
||||||
upnpp/src/api/upnpai.c
|
|
||||||
|
|
||||||
There is a typo of a macro name "__sun" in one of the
|
|
||||||
CPP conditional.
|
|
||||||
Without the fix, the compilation aborts due to unknown constant
|
|
||||||
in socket ioctl call.
|
|
||||||
|
|
||||||
A few structs and an array is not properly initialized.
|
|
||||||
Well, I think it may be safe as is, but when I checked it
|
|
||||||
using purify evaluation version, it was reported that
|
|
||||||
uninitizlied iszBuffer may cause read of uninitialized memory.
|
|
||||||
So play it safe.
|
|
||||||
|
|
||||||
Configure issue.
|
|
||||||
This has to be more of a configure magic.
|
|
||||||
To link a program successfully using network, we need
|
|
||||||
-lsocket and -lnsl library specifications on the link line.
|
|
||||||
We also need -lrt for programs that use thread scheduling features.
|
|
||||||
|
|
||||||
The sample program under upnp/sample requires
|
|
||||||
-lsocket -lnsl -lrt
|
|
||||||
for successful linking.
|
|
||||||
I added -lsocket -lnsl -lrt to Makefile.in.
|
|
||||||
configure probably needs to take care of these.
|
|
||||||
|
|
||||||
I don't know much about configure, automake, etc., so
|
|
||||||
I am just raising a flag here.
|
|
||||||
|
|
||||||
TIA
|
|
||||||
|
|
||||||
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2836704 ] Search for nested serviceList (not
|
|
||||||
stopping at the first lis
|
|
||||||
Submitted By: zephyrus ( zephyrus00jp )
|
|
||||||
|
|
||||||
Internet Gateway Device description contains nested serviceList (rootdevice
|
|
||||||
-> servicelist, subdevice
|
|
||||||
and subdevice has the lower-level serviceList, etc..)
|
|
||||||
|
|
||||||
Unfrotunately, the sample code sample_util.c used by tv_device sample,
|
|
||||||
etc.
|
|
||||||
has a code that looks for only the first top-level serviceList.
|
|
||||||
This results in the failure to read all the services of an IGD xml
|
|
||||||
description.
|
|
||||||
|
|
||||||
Attached patch modifies this behavior and looks for the service by
|
|
||||||
visiting all the serviceList in xml document in turn.
|
|
||||||
|
|
||||||
With the modified patch (ad additional modification), I could
|
|
||||||
simulate an IGD device and created a modified control program for that.
|
|
||||||
|
|
||||||
Patch against 1.6.6
|
|
||||||
|
|
||||||
TIA.
|
|
||||||
|
|
||||||
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2203721 ] timeb.h check obsolete
|
|
||||||
|
|
||||||
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2970872 ] Update ErrorMessages for latest return
|
|
||||||
code list
|
|
||||||
Submitted By: Nick Leverton ( leveret )
|
|
||||||
|
|
||||||
ErrorMessage[] in upnptools.c has got a bit out of sync, the attached
|
|
||||||
patch (generated from grep 'define UPNP_E_') should bring it up to date.
|
|
||||||
|
|
||||||
2010-03-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2857611 ] Declare a few functions to have proper
|
|
||||||
(void) argument list.
|
|
||||||
Submitted By: zephyrus ( zephyrus00jp )
|
|
||||||
|
|
||||||
In a publicly installed headers, a few functions are declared without any
|
|
||||||
arguments at all, a la "()".
|
|
||||||
When I used gcc's -Wimplict and -Wstrict-prototypes to check for the
|
|
||||||
mismatch of
|
|
||||||
function prototype declarations and their usage in my own program,
|
|
||||||
some headers from libupnp-1.6.6 produced warnings.
|
|
||||||
|
|
||||||
They are not strictly bugs, but pretty much annoying. This is 2009, and
|
|
||||||
almost all the important compilers
|
|
||||||
understand ISO-C.
|
|
||||||
|
|
||||||
So the offending functions are declared as "(void") to show that they have
|
|
||||||
no arguments at all.
|
|
||||||
|
|
||||||
2010-03-14 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patch Tracker [ 2546532 ] Missing carriage return between
|
|
||||||
SOAPACTION and User-Agent headers.
|
|
||||||
|
|
||||||
There is something going wrong in soap_ctrlpt.c at line 931 (based on
|
|
||||||
version 1.6.6 release).
|
|
||||||
|
|
||||||
The http_Makemessage call looks as follows:
|
|
||||||
|
|
||||||
if (http_MakeMessage(
|
|
||||||
&request, 1, 1,
|
|
||||||
"Q" "sbc" "N" "s" "s" "Ucc" "sss",
|
|
||||||
SOAPMETHOD_POST, path.buf, path.length,
|
|
||||||
"HOST: ", host.buf, host.length,
|
|
||||||
content_length,
|
|
||||||
ContentTypeHeader,
|
|
||||||
"SOAPACTION:
|
|
||||||
\"urn:schemas-upnp-org:control-1-0#QueryStateVariable\"",
|
|
||||||
xml_start, var_name, xml_end ) != 0 ) {
|
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
This will result in the SOAPACTION header to be immediately followed by the
|
|
||||||
User-Agent header, while a cr-lf should separate the two. I propose to fix
|
|
||||||
this by changing the second "s" to "sc" to force the addition of a cr-lf
|
|
||||||
after the SOAPACTION. This looks consistent to the other Makemessage calls.
|
|
||||||
|
|
||||||
2009-03-06 Oxygenic <oxygenic(at)users.sourceforge.net>
|
|
||||||
* parameter problem fixed in soap_request_and_response(), 2nd call to
|
|
||||||
http_RequestAndResponse() was wrong (thanks to Kim Kyungsan)
|
|
||||||
|
|
||||||
2008-07-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added upnp/m4/libupnp.m4 to the distribution tarball.
|
|
||||||
|
|
||||||
2008-07-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fixed a missing HandleUnlock() in upnp/src/gena/gena_device.c.
|
|
||||||
|
|
||||||
2008-07-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 2026431 ] pupnp does not build on GNU/KfreeBSD.
|
|
||||||
Submitted By: Nick Leverton - leveret
|
|
||||||
Gnu/KFreeBSD is one of the Debian architectures, it includes a FreeBSD
|
|
||||||
kernel with GNU userspace (glibc etc). The Gnu/KfreeBSD developers
|
|
||||||
provided the attached patch to test the appropriate #define and allow pupnp
|
|
||||||
to build in their environment, and asked me to forward it to you.
|
|
||||||
|
|
||||||
Since the test is a simple check for defined(__GLIBC__), this would
|
|
||||||
presumably also help with other ports of GNU libc to non-Linux kernels.
|
|
||||||
|
|
||||||
2008-07-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Andre Sodermans (wienerschnitzel) patch for building libupnp under
|
|
||||||
windows systems with VC9. This one fixes a missing include.
|
|
||||||
|
|
||||||
2008-06-30 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added an m4 macro to deal with finding libupnp in the users'
|
|
||||||
configure script.
|
|
||||||
|
|
||||||
2008-06-11 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fixed a buffer overflow due to a bug in the calculation of the
|
|
||||||
CONTENT-TYPE header line size, the length was beeing calculated with
|
|
||||||
the wrong string, there was a missing colon.
|
|
||||||
|
|
||||||
2008-06-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 1942285 ]
|
|
||||||
UpnpCreatePropertySet can leak memory.
|
|
||||||
Submitted By: Bob Ciora - bobciora
|
|
||||||
|
|
||||||
In file upnp/src/api/upnptools.c, function UpnpCreatePropertySet can leak
|
|
||||||
memory if no additional arguments are passed. This is because of the
|
|
||||||
'return' statement at (or near) line 554.
|
|
||||||
|
|
||||||
The prior call to ixmlParseBufferEx may succeed. This causes a basic ixml
|
|
||||||
tree to be created. The return statement at line 554 leaves this tree in
|
|
||||||
memory without cleaning it up.
|
|
||||||
|
|
||||||
There are two options: either add code prior to the return at 554 to clean
|
|
||||||
up the tree, or simply allow a NumArg parameter of 0 to be passed.
|
|
||||||
|
|
||||||
I prefer the second method -- there doesn't seem to be any need to pass
|
|
||||||
*any* arguments to this function.
|
|
||||||
|
|
||||||
In my local copy of upnptools.c, I have simply replaced the "return NULL"
|
|
||||||
in line 554 to "return PropSet".
|
|
||||||
|
|
||||||
I've attached the source file.
|
|
||||||
|
|
||||||
2008-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 1903069 ]
|
|
||||||
Subs (not services) not marked 'active'
|
|
||||||
Submitted By: Bob Ciora - bobciora
|
|
||||||
|
|
||||||
If the UpnpAcceptSubscription is not called, the subscription is not marked
|
|
||||||
as "active", so no state variables will ever be sent.
|
|
||||||
|
|
||||||
I have a "lazy" architecture where a service may not be ready to publish
|
|
||||||
any state data at the time of a subscription. Subscriptions are still
|
|
||||||
accepted, there's just nothing to send, so UpnpAcceptSubscription is never
|
|
||||||
called. As a result, the subscription is never marked as "active" via the
|
|
||||||
genaInitNotify functions.
|
|
||||||
|
|
||||||
A best course of action would be to modify UpnpAcceptSubscription<...>
|
|
||||||
functions so that they can accept *no* initial state information, but can
|
|
||||||
still result in the subscription being marked as active. Technically,
|
|
||||||
then, the "active" flag should be set here, not in the genaInitNotify<...>
|
|
||||||
functions.
|
|
||||||
|
|
||||||
But the UpnpAccept functions don't muck with the subscription table, and
|
|
||||||
it's more work than it's worth to move that code from the gena fucntions to
|
|
||||||
the upnpapi functions.
|
|
||||||
|
|
||||||
So--- what I've done to correct this problem is to modify both
|
|
||||||
UpnpAcceptSubscription<...> functions (in upnppapi.c) to accept an empty
|
|
||||||
state list and still call the gena layer functions. The gena layer
|
|
||||||
genaInitNotify<...> functions (gena_device.c) then mark the subscription as
|
|
||||||
"active" *before* checking for an empty state set.
|
|
||||||
|
|
||||||
In genaInitNotify, a check for "var_count <= 0" is added immediately after
|
|
||||||
the "subs->active = 1;" line. If this occurs, then all cleanup is
|
|
||||||
performed and the function returns GENA_SUCCESS (since now, an empty state
|
|
||||||
list is not an error). The same check is made for "PropSet == 0" in
|
|
||||||
genaInitNotifyExt (just after the "subs->active = 1;" line).
|
|
||||||
|
|
||||||
I've modifified my proxy layer to call UpnpAcceptSubscriptionExt even when
|
|
||||||
there is no state data to send. With the suggested changes to
|
|
||||||
gena_device.c, later state changes are sent correctly.
|
|
||||||
|
|
||||||
This has solved my problem.
|
|
||||||
|
|
||||||
2008-04-28 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fix in function SetSeed() in threadutil/src/ThreadPool.c for CYGWIN
|
|
||||||
compilation. Thanks to Gary Chan.
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.6.6
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2008-04-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added thread id's to the UpnpPrintf debug messages. Thanks to
|
|
||||||
Charles Nepveu for the idea.
|
|
||||||
|
|
||||||
2008-04-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 1948586 ]
|
|
||||||
Uppercase U in in "xmlns:U" in Invoke Action causes seg. f.
|
|
||||||
Submitted By: Thomas Norheim - kjakan_no
|
|
||||||
Device no longer segfaults with the following malformed xml action:
|
|
||||||
<u:SetColor xmlns:U="urn:schemas-upnp-org:service:tvpicture:1">
|
|
||||||
<Color>2</Color>
|
|
||||||
</u:SetColor>
|
|
||||||
|
|
||||||
2008-04-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Use -O0 in debug builds so that variables do not get optimized out.
|
|
||||||
|
|
||||||
2008-04-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Apostolos Syropoulos changes for OpenSolaris x86.
|
|
||||||
|
|
||||||
2008-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Andre Sodermans (wienerschnitzel) patch for building libupnp under
|
|
||||||
windows systems with VC9.
|
|
||||||
|
|
||||||
2008-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Andre Sodermans (wienerschnitzel) patch for building libupnp under
|
|
||||||
windows systems with VC8.
|
|
||||||
|
|
||||||
2008-03-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fixed a printf format problem on the upnp_tv_device.c from both
|
|
||||||
upnp/sample/tvdevie and upnp/sample/tvcombo directories. The variable
|
|
||||||
port was a short int instead of an unsigned short and it was beeing
|
|
||||||
print as a negative value.
|
|
||||||
|
|
||||||
2008-03-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Bug Tracker [ 1902668 ] Cannot compile on MSVC
|
|
||||||
Submitted By Luke Kim - nereusuj
|
|
||||||
Version 1.6.5 cannot be compiled because of some changes in 1.6.3.
|
|
||||||
MSVC does not support stdint.h, gettimeofday(), sys/param.h, const int
|
|
||||||
variables in array size and Windows does not define _WINDOWS_ but define
|
|
||||||
_WINDOWS.
|
|
||||||
* MSVC does not understand "const int"'s as declarators of array
|
|
||||||
dimensions, we must use #define'd constants.
|
|
||||||
* Use WIN32 instead of _WINDOWS_ or _WINDOWS.
|
|
||||||
|
|
||||||
2008-02-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* No longer ignore "upnp:rootdevice" advertisement. Thanks to Bob Ciora.
|
|
||||||
|
|
||||||
2008-02-10 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Changed "sys_errlist[errno]", which is deprecated, by
|
|
||||||
"strerror_r()", which is thread safe.
|
|
||||||
|
|
||||||
2008-02-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Slightly improved error report by showing the sys_errlist string
|
|
||||||
corresponding to errno.
|
|
||||||
|
|
||||||
2008-02-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Got rid of two useless constants: UPNP_SOCKETERROR and
|
|
||||||
UPNP_INVALID_SOCKET. They both mean the same, that a network API
|
|
||||||
function has failed. -1 is the value to check, not an invented constant.
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.6.5
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2008-02-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Peter Hartley's fix for wrong sized variable beeing passed to
|
|
||||||
http_MakeMessage() on 64 bit architectures.
|
|
||||||
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.6.4
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2008-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Workaround for a problem with the new automake AM_CONDITIONAL macro
|
|
||||||
from autotools-1.10. Thanks to Ingo Hofmann for helping with debugging
|
|
||||||
this one.
|
|
||||||
|
|
||||||
2008-01-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added quoting to macros AC_CONFIG_AUX_DIR, AC_CONFIG_MACRO_DIR and
|
|
||||||
AC_CONFIG_SRCDIR in configure.ac. Also changed the name of the
|
|
||||||
auxiliary directory in AC_CONFIG_AUX_DIR to build-aux.
|
|
||||||
|
|
||||||
2008-01-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fix for setsockopt() in Threadpool.c to allow more than one process
|
|
||||||
to join the multicast-group on OSX. Thanks to Ingo Hofmann.
|
|
||||||
|
|
||||||
2008-01-22 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Using defined(__OSX__) || defined(__APPLE__) instead of just
|
|
||||||
defined(__OSX__) in the code. Thanks to Ingo Hofmann and Chris
|
|
||||||
Pickel.
|
|
||||||
|
|
||||||
2008-01-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Fix for isFileInVirtualDir. Thanks to Peter Hartley for the patch.
|
|
||||||
|
|
||||||
2008-01-07 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Putting back a "defined(__OSX__)" that has been removed in the
|
|
||||||
previous *BSD patch. Thanks to Chris Pickel for pointing it out.
|
|
||||||
|
|
||||||
2008-01-07 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* SF Patches Tracker [ 1865812 ] typo in docs comment
|
|
||||||
Submitted By: Hartmut Holzgraefe - hholzgra
|
|
||||||
typo in docs comment ACCAPTED instead of ACCEPTED in
|
|
||||||
@name UPNP_E_UNSUBSCRIBE_UNACCAPTED [-302]
|
|
||||||
Also, the documentation file name was mispelled and was corrected in
|
|
||||||
the Makefile.am.
|
|
||||||
|
|
||||||
*******************************************************************************
|
|
||||||
Version 1.6.3
|
|
||||||
*******************************************************************************
|
|
||||||
|
|
||||||
2007-12-25 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Using pthread flags for the whole project, not just at the places
|
|
||||||
individually indicated by several Makefile.am files spread all over
|
|
||||||
the directories. That was too much error prone.
|
|
||||||
|
|
||||||
2007-12-24 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Added a configure test to check if pthread_rwlock_t is available.
|
|
||||||
Define _GNU_SOURCE if needed. The fallback behaviou will only be
|
|
||||||
implemented if _GNU_SOURCE prooves to be insufficient on some
|
|
||||||
platforms. Thanks to Jonathan Casiot (no_dice) and Robert Gingher
|
|
||||||
(robsbox).
|
|
||||||
|
|
||||||
2007-12-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Removed unused iasnprintf.{c,h} files.
|
|
||||||
|
|
||||||
2007-12-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Removed STATSONLY() macro from ThreadPool.{c,h}.
|
|
||||||
* Removed time() usage from ThreadPool.c.
|
|
||||||
* Fixed STATS = 0 compilation.
|
|
||||||
|
|
||||||
2007-12-16 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
|
||||||
* Library was not compiling on FreeBSD 7. Code now no longer uses
|
|
||||||
ftime(), using gettimeofday() instead. Thanks to Josh Carroll.
|
|
||||||
|
|
||||||
|
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
Version 1.6.2
|
Version 1.6.2
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
@@ -723,7 +79,7 @@ Version 1.6.1
|
|||||||
handle accordingly.
|
handle accordingly.
|
||||||
|
|
||||||
2007-08-05 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-08-05 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Merge of Mac OS X patch from Stéphane Corthésy (davelopper),
|
* Merge of Mac OS X patch from St<EFBFBD>phane Corth<EFBFBD>sy (davelopper),
|
||||||
SF Bug Tracker [ 1686420 ] Modifications for MacOSX.
|
SF Bug Tracker [ 1686420 ] Modifications for MacOSX.
|
||||||
Some of the proposed changes were already done by Rene Hexel's patch.
|
Some of the proposed changes were already done by Rene Hexel's patch.
|
||||||
|
|
||||||
@@ -1002,7 +358,7 @@ Version 1.4.2
|
|||||||
2007-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-01-23 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
|
||||||
* SF Tracker [ 1634922 ] Support for large files (>= 2 GiB), part 2
|
* SF Tracker [ 1634922 ] Support for large files (>= 2 GiB), part 2
|
||||||
Submitted By: Jonathan Casiot - no_dice
|
Submitted By: Jonathan - no_dice
|
||||||
Summary: This patch hopefully fixes the remaining types and related
|
Summary: This patch hopefully fixes the remaining types and related
|
||||||
code to enable files >= 2 GiB to be streamed. Jonathan claims to have
|
code to enable files >= 2 GiB to be streamed. Jonathan claims to have
|
||||||
tested this with a patched version of ushare-0.9.8 and a D-Link DSM-520.
|
tested this with a patched version of ushare-0.9.8 and a D-Link DSM-520.
|
||||||
@@ -1147,14 +503,14 @@ Version 1.4.0
|
|||||||
FORK FROM DEAD libupnp
|
FORK FROM DEAD libupnp
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
2006-04-29 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-04-29 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* THANKS: new file with list of contributors
|
* THANKS: new file with list of contributors
|
||||||
|
|
||||||
* upnp/src/gena/gena_device.c (respond_ok): add 'Content-Length: 0'
|
* upnp/src/gena/gena_device.c (respond_ok): add 'Content-Length: 0'
|
||||||
in subscription response. Patch by Chaos (Bug # 1455367).
|
in subscription response. Patch by Chaos (Bug # 1455367).
|
||||||
|
|
||||||
2006-04-08 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-04-08 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/doc/UPnP_Programming_Guide.pdf: replace this document with
|
* upnp/doc/UPnP_Programming_Guide.pdf: replace this document with
|
||||||
the one in libupnp-doc-1.2.1 because current CVS version
|
the one in libupnp-doc-1.2.1 because current CVS version
|
||||||
@@ -1165,20 +521,20 @@ FORK FROM DEAD libupnp
|
|||||||
* changes applied to several files to work under Sparc Solaris, temporarily
|
* changes applied to several files to work under Sparc Solaris, temporarily
|
||||||
requiring a define SPARC_SOLARIS
|
requiring a define SPARC_SOLARIS
|
||||||
|
|
||||||
2006-04-03 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-04-03 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/Makefile.am: install upnp samples in $(docdir)/examples
|
* upnp/Makefile.am: install upnp samples in $(docdir)/examples
|
||||||
|
|
||||||
2006-03-28 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-28 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* configure.ac: add --with-docdir option to choose where documentation
|
* configure.ac: add --with-docdir option to choose where documentation
|
||||||
is installed (or -without-docdir to not install the documentation)
|
is installed (or -without-docdir to not install the documentation)
|
||||||
|
|
||||||
2006-03-27 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-27 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* ixml/test: add simple test suite for xml parser
|
* ixml/test: add simple test suite for xml parser
|
||||||
|
|
||||||
2006-03-26 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-26 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* ixml/src/ixmlparser.c (Parser_processCDSect): fix bug which prevents
|
* ixml/src/ixmlparser.c (Parser_processCDSect): fix bug which prevents
|
||||||
CDATA sections which contain a 0 (zero) to be parsed (instead the
|
CDATA sections which contain a 0 (zero) to be parsed (instead the
|
||||||
@@ -1189,18 +545,18 @@ FORK FROM DEAD libupnp
|
|||||||
option, and move samples compilation from check_PROGRAMS to
|
option, and move samples compilation from check_PROGRAMS to
|
||||||
noinst_PROGRAMS
|
noinst_PROGRAMS
|
||||||
|
|
||||||
2006-03-25 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-25 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/src/genlib/miniserver/miniserver.c (get_miniserver_sockets):
|
* upnp/src/genlib/miniserver/miniserver.c (get_miniserver_sockets):
|
||||||
fix bug if new socket created has fd 0 (can only occur when stdin
|
fix bug if new socket created has fd 0 (can only occur when stdin
|
||||||
has been closed). Patch by Oskar Liljeblad 2004-07-02 :
|
has been closed). Patch by Oskar Liljeblad 2004-07-02 :
|
||||||
http://sourceforge.net/mailarchive/message.php?msg_id=8870528
|
http://sourceforge.net/mailarchive/message.php?msg_id=8870528
|
||||||
|
|
||||||
2006-03-21 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-21 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/test/test_init.c: add some version checks and exit if failure
|
* upnp/test/test_init.c: add some version checks and exit if failure
|
||||||
|
|
||||||
2006-03-05 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-05 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* libupnp version 1.3.1
|
* libupnp version 1.3.1
|
||||||
|
|
||||||
@@ -1215,11 +571,11 @@ FORK FROM DEAD libupnp
|
|||||||
dependencies between upnp and ixml / threadutil, so that programs
|
dependencies between upnp and ixml / threadutil, so that programs
|
||||||
linking against upnp only still work.
|
linking against upnp only still work.
|
||||||
|
|
||||||
2006-03-04 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-04 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* libupnp version 1.3.0
|
* libupnp version 1.3.0
|
||||||
|
|
||||||
2006-03-03 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-03-03 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/src/genlib/net/http/httpreadwrite.c (get_sdk_info): use
|
* upnp/src/genlib/net/http/httpreadwrite.c (get_sdk_info): use
|
||||||
package version string from configure to set sdk info
|
package version string from configure to set sdk info
|
||||||
@@ -1227,7 +583,7 @@ FORK FROM DEAD libupnp
|
|||||||
* upnp/Makefile.am: add sample/tvdevice/web/ files in EXTRA_DIST
|
* upnp/Makefile.am: add sample/tvdevice/web/ files in EXTRA_DIST
|
||||||
+ do not distribute generated upnpconfig.h file.
|
+ do not distribute generated upnpconfig.h file.
|
||||||
|
|
||||||
2006-02-28 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-02-28 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/src/inc/config.h, configure.ac: use only new defines
|
* upnp/src/inc/config.h, configure.ac: use only new defines
|
||||||
UPNP_HAVE_xx instead of INCLUDE_yyy_APIS and INTERNAL_WEB_SERVER
|
UPNP_HAVE_xx instead of INCLUDE_yyy_APIS and INTERNAL_WEB_SERVER
|
||||||
@@ -1236,7 +592,7 @@ FORK FROM DEAD libupnp
|
|||||||
the librarie LDFLAGS in order to export only the symbols defined
|
the librarie LDFLAGS in order to export only the symbols defined
|
||||||
in the API
|
in the API
|
||||||
|
|
||||||
2006-02-27 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-02-27 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* configure.ac: add libtool versions for the 3 libraries
|
* configure.ac: add libtool versions for the 3 libraries
|
||||||
|
|
||||||
@@ -1244,7 +600,7 @@ FORK FROM DEAD libupnp
|
|||||||
|
|
||||||
* threadutil/src/ThreadPool.c (SetSeed): add missing 'static'
|
* threadutil/src/ThreadPool.c (SetSeed): add missing 'static'
|
||||||
|
|
||||||
2006-02-26 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-02-26 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* threadutil/inc/iasnprintf.h: add gcc __printf__ format attribute
|
* threadutil/inc/iasnprintf.h: add gcc __printf__ format attribute
|
||||||
to "iasnprintf"
|
to "iasnprintf"
|
||||||
@@ -1265,11 +621,11 @@ FORK FROM DEAD libupnp
|
|||||||
the configuration of the installed libraries (generates installed
|
the configuration of the installed libraries (generates installed
|
||||||
file <upnp/upnpconfig.h>)
|
file <upnp/upnpconfig.h>)
|
||||||
|
|
||||||
2006-02-22 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-02-22 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/ : add missing include of config.h in some .c files
|
* upnp/ : add missing include of config.h in some .c files
|
||||||
|
|
||||||
2006-02-21 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-02-21 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/inc/upnp.h: move some definitions which should not be
|
* upnp/inc/upnp.h: move some definitions which should not be
|
||||||
exported into "upnp/src/inc/util.h"
|
exported into "upnp/src/inc/util.h"
|
||||||
@@ -1277,12 +633,12 @@ FORK FROM DEAD libupnp
|
|||||||
* import all modifications below from libupnp in djmount 0.51
|
* import all modifications below from libupnp in djmount 0.51
|
||||||
into official libupnp
|
into official libupnp
|
||||||
|
|
||||||
2006-01-17 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-01-17 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* threadutil/Makefile.am (libthreadutil_la_SOURCES): remove extraneous
|
* threadutil/Makefile.am (libthreadutil_la_SOURCES): remove extraneous
|
||||||
file
|
file
|
||||||
|
|
||||||
2006-01-15 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-01-15 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* configure.ac: add checks for large-file support
|
* configure.ac: add checks for large-file support
|
||||||
|
|
||||||
@@ -1302,53 +658,53 @@ FORK FROM DEAD libupnp
|
|||||||
* ixml/src/node.c (ixmlNode_getNodeType): fix compilation warning
|
* ixml/src/node.c (ixmlNode_getNodeType): fix compilation warning
|
||||||
on const return type
|
on const return type
|
||||||
|
|
||||||
2006-01-12 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-01-12 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/src/inc/readwrite.h : suppress unused C++ header file
|
* upnp/src/inc/readwrite.h : suppress unused C++ header file
|
||||||
|
|
||||||
2006-01-11 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2006-01-11 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/inc/config.h, upnp/src/inc/upnpapi.h,
|
* upnp/inc/config.h, upnp/src/inc/upnpapi.h,
|
||||||
upnp/src/inc/httpreadwrite.h: remove internal configuration variable
|
upnp/src/inc/httpreadwrite.h: remove internal configuration variable
|
||||||
MINIMUM_DELAY (no clear purpose)
|
MINIMUM_DELAY (no clear purpose)
|
||||||
|
|
||||||
2005-12-05 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-12-05 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/inc/upnp.h: re-declare obsolete method UpnpSetContentLength,
|
* upnp/inc/upnp.h: re-declare obsolete method UpnpSetContentLength,
|
||||||
for binary compatibility with previous libupnp version.
|
for binary compatibility with previous libupnp version.
|
||||||
|
|
||||||
* upnp/src/api/upnpapi.c: correct type of g_maxContentLength to size_t
|
* upnp/src/api/upnpapi.c: correct type of g_maxContentLength to size_t
|
||||||
|
|
||||||
2005-11-01 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-11-01 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* autoconfiscate library : replace all makefiles by Makefile.am
|
* autoconfiscate library : replace all makefiles by Makefile.am
|
||||||
for automake support, + preliminary autoconf support
|
for automake support, + preliminary autoconf support
|
||||||
(generated config.h not yet used in source files)
|
(generated config.h not yet used in source files)
|
||||||
|
|
||||||
2005-10-18 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-10-18 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/src/makefile: fix location of DEBUG STATIC libupnp library
|
* upnp/src/makefile: fix location of DEBUG STATIC libupnp library
|
||||||
|
|
||||||
* upnp/sample/tvctrlpt/linux/Makefile,
|
* upnp/sample/tvctrlpt/linux/Makefile,
|
||||||
upnp/sample/tvdevice/linux/Makefile: fix STATIC library support
|
upnp/sample/tvdevice/linux/Makefile: fix STATIC library support
|
||||||
|
|
||||||
2005-10-16 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-10-16 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* threadutil/src/Makefile (clean): remove built library
|
* threadutil/src/Makefile (clean): remove built library
|
||||||
|
|
||||||
2005-08-28 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-08-28 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* ixml/src/ixml.h, ixml/src/ixml.c (ixmlRelaxParser) : new function
|
* ixml/src/ixml.h, ixml/src/ixml.c (ixmlRelaxParser) : new function
|
||||||
|
|
||||||
* ixml/src/ixmlparser.h, ixml/src/ixmlparser.c (Parser_setErrorChar) :
|
* ixml/src/ixmlparser.h, ixml/src/ixmlparser.c (Parser_setErrorChar) :
|
||||||
new function
|
new function
|
||||||
|
|
||||||
2005-08-02 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-08-02 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* ixml/src/Makefile: correct bug for static library being incorrectly
|
* ixml/src/Makefile: correct bug for static library being incorrectly
|
||||||
stripped when building non-debug
|
stripped when building non-debug
|
||||||
|
|
||||||
2005-06-09 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-06-09 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* ixml/src/element.c (ixmlElement_removeAttributeNode):
|
* ixml/src/element.c (ixmlElement_removeAttributeNode):
|
||||||
remove some compilation warning
|
remove some compilation warning
|
||||||
@@ -1359,7 +715,7 @@ FORK FROM DEAD libupnp
|
|||||||
* upnp/inc/upnptools.h, upnp/src/api/upnptools.c :
|
* upnp/inc/upnptools.h, upnp/src/api/upnptools.c :
|
||||||
add missing const's in public API
|
add missing const's in public API
|
||||||
|
|
||||||
2005-05-28 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-05-28 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/inc/config.h: suppress HTTP_READ_BYTES (unused)
|
* upnp/inc/config.h: suppress HTTP_READ_BYTES (unused)
|
||||||
and replace by DEFAULT_SOAP_CONTENT_LENGTH (previously in upnpapi.h)
|
and replace by DEFAULT_SOAP_CONTENT_LENGTH (previously in upnpapi.h)
|
||||||
@@ -1380,7 +736,7 @@ FORK FROM DEAD libupnp
|
|||||||
* upnp/src/genlib/net/http/httpreadwrite.c : corrected an incorrect
|
* upnp/src/genlib/net/http/httpreadwrite.c : corrected an incorrect
|
||||||
sprintf format
|
sprintf format
|
||||||
|
|
||||||
2005-05-27 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-05-27 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/makefile, upnp/src/makefile,
|
* upnp/makefile, upnp/src/makefile,
|
||||||
ixml/Makefile, ixml/src/Makefile,
|
ixml/Makefile, ixml/src/Makefile,
|
||||||
@@ -1388,7 +744,7 @@ FORK FROM DEAD libupnp
|
|||||||
implement STATIC library support (from patch at
|
implement STATIC library support (from patch at
|
||||||
http://sourceforge.net/tracker/?group_id=7189&atid=307189 )
|
http://sourceforge.net/tracker/?group_id=7189&atid=307189 )
|
||||||
|
|
||||||
2005-05-26 Rémi Turboult <r3mi(at)users.sourceforge.net>
|
2005-05-26 R<EFBFBD>mi Turboult <r3mi(at)users.sourceforge.net>
|
||||||
|
|
||||||
* upnp/src/api/upnpapi.c, upnp/src/soap/soap_device.c,
|
* upnp/src/api/upnpapi.c, upnp/src/soap/soap_device.c,
|
||||||
upnp/src/soap/makefile :
|
upnp/src/soap/makefile :
|
||||||
|
|||||||
12
Doxyfile
12
Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = libUPnP
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 1.6.7
|
PROJECT_NUMBER = 1.4.7
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
@@ -91,7 +91,7 @@ ABBREVIATE_BRIEF =
|
|||||||
# Doxygen will generate a detailed section even if there is only a brief
|
# Doxygen will generate a detailed section even if there is only a brief
|
||||||
# description.
|
# description.
|
||||||
|
|
||||||
ALWAYS_DETAILED_SEC = YES
|
ALWAYS_DETAILED_SEC = NO
|
||||||
|
|
||||||
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
|
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
|
||||||
# inherited members of a class in the documentation of that class as if those
|
# inherited members of a class in the documentation of that class as if those
|
||||||
@@ -290,7 +290,7 @@ HIDE_IN_BODY_DOCS = NO
|
|||||||
# to NO (the default) then the documentation will be excluded.
|
# to NO (the default) then the documentation will be excluded.
|
||||||
# Set it to YES to include the internal documentation.
|
# Set it to YES to include the internal documentation.
|
||||||
|
|
||||||
INTERNAL_DOCS = YES
|
INTERNAL_DOCS = NO
|
||||||
|
|
||||||
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
|
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
|
||||||
# file names in lower-case letters. If set to YES upper-case letters are also
|
# file names in lower-case letters. If set to YES upper-case letters are also
|
||||||
@@ -462,7 +462,7 @@ WARN_LOGFILE =
|
|||||||
# directories like "/usr/src/myproject". Separate the files or directories
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# with spaces.
|
||||||
|
|
||||||
INPUT = upnp ixml threadutil
|
INPUT = ./upnp ./ixml ./threadutil
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files that
|
# This tag can be used to specify the character encoding of the source files that
|
||||||
# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
|
# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
|
||||||
@@ -995,7 +995,7 @@ ENABLE_PREPROCESSING = YES
|
|||||||
# compilation will be performed. Macro expansion can be done in a controlled
|
# compilation will be performed. Macro expansion can be done in a controlled
|
||||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
# way by setting EXPAND_ONLY_PREDEF to YES.
|
||||||
|
|
||||||
MACRO_EXPANSION = YES
|
MACRO_EXPANSION = NO
|
||||||
|
|
||||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||||
# then the macro expansion is limited to the macros specified with the
|
# then the macro expansion is limited to the macros specified with the
|
||||||
@@ -1029,7 +1029,7 @@ INCLUDE_FILE_PATTERNS =
|
|||||||
# undefined via #undef or recursively expanded use the := operator
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of the = operator.
|
# instead of the = operator.
|
||||||
|
|
||||||
PREDEFINED = DEBUG UPNP_HAVE_TOOLS INCLUDE_DEVICE_APIS INCLUDE_CLIENT_APIS EXCLUDE_GENA=0 EXCLUDE_DOM=0
|
PREDEFINED =
|
||||||
|
|
||||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||||
# this tag can be used to specify a list of macro names that should be expanded.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
|||||||
20
Makefile.am
20
Makefile.am
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Top-level "Makefile.am" for libupnp
|
# Top-level "Makefile.am" for libupnp
|
||||||
#
|
#
|
||||||
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
# Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
@@ -16,7 +16,6 @@ SUBDIRS = \
|
|||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
Doxyfile \
|
|
||||||
libupnp.pc.in \
|
libupnp.pc.in \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
THANKS \
|
THANKS \
|
||||||
@@ -28,22 +27,7 @@ EXTRA_DIST = \
|
|||||||
build/inc/autoconfig.h \
|
build/inc/autoconfig.h \
|
||||||
build/inc/config.h \
|
build/inc/config.h \
|
||||||
build/inc/upnpconfig.h \
|
build/inc/upnpconfig.h \
|
||||||
build/msvc/inttypes.h \
|
build/msvc/inttypes.h
|
||||||
build/msvc/stdint.h \
|
|
||||||
build/vc8/ixml.vcproj \
|
|
||||||
build/vc8/libupnp.sln \
|
|
||||||
build/vc8/libupnp.vcproj \
|
|
||||||
build/vc8/threadutil.vcproj \
|
|
||||||
build/vc8/tvcombo.vcproj \
|
|
||||||
build/vc8/tvctrlpt.vcproj \
|
|
||||||
build/vc8/tvdevice.vcproj \
|
|
||||||
build/vc9/ixml.vcproj \
|
|
||||||
build/vc9/libupnp.sln \
|
|
||||||
build/vc9/libupnp.vcproj \
|
|
||||||
build/vc9/threadutil.vcproj \
|
|
||||||
build/vc9/tvcombo.vcproj \
|
|
||||||
build/vc9/tvctrlpt.vcproj \
|
|
||||||
build/vc9/tvdevice.vcproj
|
|
||||||
|
|
||||||
|
|
||||||
# This variable must have 'exec' in its name, in order to be installed
|
# This variable must have 'exec' in its name, in order to be installed
|
||||||
|
|||||||
23
THANKS
23
THANKS
@@ -7,16 +7,9 @@ Here is a list of these people. Help us keep it complete and
|
|||||||
exempt of errors.
|
exempt of errors.
|
||||||
|
|
||||||
- Alex (afaucher)
|
- Alex (afaucher)
|
||||||
- Andre Sodermans (wienerschnitzel)
|
|
||||||
- Anthony Viallard (homer242)
|
|
||||||
- Apostolos Syropoulos
|
|
||||||
- Arno Willig
|
- Arno Willig
|
||||||
- Bob Ciora
|
- Bob Ciora
|
||||||
- Carlo Parata
|
|
||||||
- Chaos
|
- Chaos
|
||||||
- Charles Nepveu (cnepveu)
|
|
||||||
- Chris Pickel
|
|
||||||
- Chuck Thomason (cyt4)
|
|
||||||
- Craig Nelson
|
- Craig Nelson
|
||||||
- David Maass
|
- David Maass
|
||||||
- Emil Ljungdahl
|
- Emil Ljungdahl
|
||||||
@@ -27,28 +20,20 @@ exempt of errors.
|
|||||||
- Fabrice Fontaine
|
- Fabrice Fontaine
|
||||||
- Fredrik Svensson
|
- Fredrik Svensson
|
||||||
- Glen Masgai
|
- Glen Masgai
|
||||||
- Hartmut Holzgraefe - hholzgra
|
|
||||||
- Ingo Hofmann
|
|
||||||
- Jiri Zouhar
|
- Jiri Zouhar
|
||||||
- John Dennis
|
- John Dennis
|
||||||
- Jonathan Casiot (no_dice)
|
- Jonathan (no_dice)
|
||||||
- Josh Carroll
|
|
||||||
- Keith Brindley
|
- Keith Brindley
|
||||||
- Leuk_He
|
- Leuk_He
|
||||||
- Loigu
|
- Loigu
|
||||||
- Luke Kim (nereusuj)
|
- Luke Kim
|
||||||
- Marcelo Roberto Jimenez (mroberto)
|
- Marcelo Roberto Jimenez (mroberto)
|
||||||
- Markus Strobl
|
- Markus Strobl
|
||||||
- Nektarios K. Papadopoulos (npapadop)
|
- Nektarios K. Papadopoulos
|
||||||
- Nicholas Kraft
|
|
||||||
- Nick Leverton (leveret)
|
|
||||||
- Oskar Liljeblad
|
- Oskar Liljeblad
|
||||||
- Michael (oxygenic)
|
- Michael (Oxy)
|
||||||
- Paul Vixie
|
- Paul Vixie
|
||||||
- Peter Hartley
|
|
||||||
- Rene Hexel
|
- Rene Hexel
|
||||||
- Robert Gingher (robsbox)
|
|
||||||
- Ronan Menard
|
|
||||||
- Siva Chandran
|
- Siva Chandran
|
||||||
- Stéphane Corthésy
|
- Stéphane Corthésy
|
||||||
- Steve Bresson
|
- Steve Bresson
|
||||||
|
|||||||
@@ -1,222 +0,0 @@
|
|||||||
// 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_ ]
|
|
||||||
@@ -1,217 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
|
|
||||||
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
|
|
||||||
@@ -1,654 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
|
|
||||||
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
|
|
||||||
@@ -1,650 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,214 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
<?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>
|
|
||||||
361
configure.ac
361
configure.ac
@@ -4,178 +4,113 @@
|
|||||||
#
|
#
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
#
|
#
|
||||||
# (C) Copyright 2005-2007 Rémi Turboult <r3mi@users.sourceforge.net>
|
# (C) Copyright 2005-2007 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
|
|
||||||
AC_INIT([libupnp], [1.6.7], [mroberto@users.sourceforge.net])
|
AC_INIT([libupnp], [1.6.2], [mroberto@users.sourceforge.net])
|
||||||
dnl ############################################################################
|
###############################################################################
|
||||||
dnl # *Independently* of the above libupnp package version, the libtool version
|
# *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:
|
# 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),
|
# "current:revision:age" (this is NOT the same as the package version), where:
|
||||||
dnl # where:
|
# - library code modified: revision++
|
||||||
dnl # - library code modified: revision++
|
# - interfaces changed/added/removed: current++ and revision=0
|
||||||
dnl # - interfaces changed/added/removed: current++ and revision=0
|
# - interfaces added: age++
|
||||||
dnl # - interfaces added: age++
|
# - interfaces removed: age=0
|
||||||
dnl # - interfaces removed: age=0
|
# *please update only once, before a formal release, not for each change*
|
||||||
dnl # *please update only once, before a formal release, not for each change*
|
#
|
||||||
dnl #
|
###############################################################################
|
||||||
dnl ############################################################################
|
# Release 1.4.1:
|
||||||
dnl # Release 1.4.1:
|
#AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:2:0])
|
#AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [2:2:0])
|
#AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [2:2:0])
|
#
|
||||||
dnl #
|
###############################################################################
|
||||||
dnl ############################################################################
|
# Release 1.4.6:
|
||||||
dnl # Release 1.4.6:
|
# "current:revision:age"
|
||||||
dnl # "current:revision:age"
|
#
|
||||||
dnl #
|
# - Code has changed in ixml
|
||||||
dnl # - Code has changed in ixml
|
# revision: 2 -> 3
|
||||||
dnl # revision: 2 -> 3
|
# - Code has changed in threadutil
|
||||||
dnl # - Code has changed in threadutil
|
# revision: 2 -> 3
|
||||||
dnl # revision: 2 -> 3
|
# - Interface added in threadutil
|
||||||
dnl # - Interface added in threadutil
|
# current: 2 -> 3
|
||||||
dnl # current: 2 -> 3
|
# revisiion: 3 -> 0
|
||||||
dnl # revisiion: 3 -> 0
|
# age: 0 -> 1
|
||||||
dnl # age: 0 -> 1
|
# - Code has changed in upnp
|
||||||
dnl # - Code has changed in upnp
|
# revision: 2 -> 3
|
||||||
dnl # revision: 2 -> 3
|
#
|
||||||
dnl #
|
#AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:3:0])
|
#AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:0:1])
|
#AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [2:3:0])
|
#
|
||||||
dnl #
|
###############################################################################
|
||||||
dnl ############################################################################
|
# Release 1.6.0:
|
||||||
dnl # Release 1.6.0:
|
# "current:revision:age"
|
||||||
dnl # "current:revision:age"
|
#
|
||||||
dnl #
|
# - Code has changed in ixml
|
||||||
dnl # - Code has changed in ixml
|
# revision: 3 -> 4
|
||||||
dnl # revision: 3 -> 4
|
# - Code has changed in threadutil
|
||||||
dnl # - Code has changed in threadutil
|
# revision: 0 -> 1
|
||||||
dnl # revision: 0 -> 1
|
# - Code has changed in upnp
|
||||||
dnl # - Code has changed in upnp
|
# revision: 3 -> 4
|
||||||
dnl # revision: 3 -> 4
|
# - Interface changed in upnp
|
||||||
dnl # - Interface changed in upnp
|
# current: 2 -> 3
|
||||||
dnl # current: 2 -> 3
|
# revision: 4 -> 0
|
||||||
dnl # revision: 4 -> 0
|
# - Interface removed in upnp
|
||||||
dnl # - Interface removed in upnp
|
# age: 0 -> 0
|
||||||
dnl # age: 0 -> 0
|
#
|
||||||
dnl #
|
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
#AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [3:1:1])
|
#AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:0:0])
|
#
|
||||||
dnl #
|
###############################################################################
|
||||||
dnl ############################################################################
|
# Release 1.6.1:
|
||||||
dnl # Release 1.6.1:
|
# "current:revision:age"
|
||||||
dnl # "current:revision:age"
|
#
|
||||||
dnl #
|
# - Code has changed in threadutil
|
||||||
dnl # - Code has changed in threadutil
|
# revision: 1 -> 2
|
||||||
dnl # revision: 1 -> 2
|
# - Interface added in threadutil
|
||||||
dnl # - Interface added in threadutil
|
# current: 3 -> 4
|
||||||
dnl # current: 3 -> 4
|
# revision: 2 -> 0
|
||||||
dnl # revision: 2 -> 0
|
# - Interface added in threadutil
|
||||||
dnl # - Interface added in threadutil
|
# age: 1 -> 2
|
||||||
dnl # age: 1 -> 2
|
# - Code has changed in upnp
|
||||||
dnl # - Code has changed in upnp
|
# revision: 0 -> 1
|
||||||
dnl # revision: 0 -> 1
|
#
|
||||||
dnl #
|
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
#AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
#AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_UPNP], [3:1:0])
|
#
|
||||||
dnl #
|
###############################################################################
|
||||||
dnl ############################################################################
|
# Release 1.6.2:
|
||||||
dnl # Release 1.6.2:
|
# "current:revision:age"
|
||||||
dnl # "current:revision:age"
|
#
|
||||||
dnl #
|
# - Code has changed in upnp
|
||||||
dnl # - Code has changed in upnp
|
# revision: 1 -> 2
|
||||||
dnl # revision: 1 -> 2
|
#
|
||||||
dnl #
|
#AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
||||||
dnl #AC_SUBST([LT_VERSION_IXML], [2:4:0])
|
#AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||||
dnl #AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
#AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||||
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_IXML], [2:4:0])
|
||||||
AC_SUBST([LT_VERSION_THREADUTIL], [5:0:2])
|
AC_SUBST([LT_VERSION_THREADUTIL], [4:0:2])
|
||||||
AC_SUBST([LT_VERSION_UPNP], [3:5:0])
|
AC_SUBST([LT_VERSION_UPNP], [3:2:0])
|
||||||
dnl ############################################################################
|
###############################################################################
|
||||||
dnl # Repeating the algorithm to place it closer to the modificatin place:
|
# Repeating the algorithm so that it is closer to the modificatin place:
|
||||||
dnl # - library code modified: revision++
|
# - library code modified: revision++
|
||||||
dnl # - interfaces changed/added/removed: current++ and revision=0
|
# - interfaces changed/added/removed: current++ and revision=0
|
||||||
dnl # - interfaces added: age++
|
# - interfaces added: age++
|
||||||
dnl # - interfaces removed: age=0
|
# - interfaces removed: age=0
|
||||||
dnl # *please update only once, before a formal release, not for each change*
|
# *please update only once, before a formal release, not for each change*
|
||||||
dnl ############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR(config.aux)
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR(m4)
|
||||||
AC_CONFIG_SRCDIR([upnp/inc/upnp.h])
|
AC_CONFIG_SRCDIR(upnp/inc/upnp.h)
|
||||||
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
AM_INIT_AUTOMAKE([1.8 -Wall foreign subdir-objects dist-bzip2])
|
||||||
@@ -205,7 +140,8 @@ AC_REVISION([$Revision: 1.11 $])
|
|||||||
upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' `
|
upnpmaj=`echo "$PACKAGE_VERSION" | sed 's/\..*//' `
|
||||||
upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `]
|
upnpmin=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.// ; s/[^0-9].*$//' `]
|
||||||
upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `]
|
upnppatch=[`echo "$PACKAGE_VERSION" | sed 's/^[^.]\.[^.]\.// ; s/[^0-9].*$//' `]
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_STRING], "$PACKAGE_VERSION", [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_MAJOR], $upnpmaj, [see upnpconfig.h])
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h])
|
AC_DEFINE_UNQUOTED([UPNP_VERSION_MINOR], $upnpmin, [see upnpconfig.h])
|
||||||
AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h])
|
AC_DEFINE_UNQUOTED([UPNP_VERSION_PATCH], $upnppatch, [see upnpconfig.h])
|
||||||
@@ -227,6 +163,7 @@ fi
|
|||||||
#
|
#
|
||||||
# Check for libupnp subsets
|
# Check for libupnp subsets
|
||||||
#
|
#
|
||||||
|
|
||||||
RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)])
|
RT_BOOL_ARG_ENABLE([client], [yes], [control point code (client)])
|
||||||
if test "x$enable_client" = xyes ; then
|
if test "x$enable_client" = xyes ; then
|
||||||
AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h])
|
AC_DEFINE(UPNP_HAVE_CLIENT, 1, [see upnpconfig.h])
|
||||||
@@ -260,13 +197,11 @@ fi
|
|||||||
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
RT_BOOL_ARG_ENABLE([samples], [yes], [compilation of upnp/sample/ code])
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# doc installation
|
# doc installation
|
||||||
# autoconf >= 2.60 already defines ${docdir}, but we will not use its
|
# autoconf >= 2.60 already defines ${docdir}, but we will not use its
|
||||||
# default value, which is ${datarootdir}/doc/${PACKAGE_TARNAME}.
|
# default value, which is ${datarootdir}/doc/${PACKAGE_TARNAME}.
|
||||||
# That would give us ${datarootdir}/doc/libupnp, and we want the package
|
# That would give us ${datarootdir}/doc/libupnp, and we want the package
|
||||||
# version on that.
|
# version on that.
|
||||||
#
|
|
||||||
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
docdir="${datadir}/doc/${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
||||||
AC_MSG_CHECKING([for documentation directory])
|
AC_MSG_CHECKING([for documentation directory])
|
||||||
AC_ARG_WITH(
|
AC_ARG_WITH(
|
||||||
@@ -281,9 +216,7 @@ AS_HELP_STRING(
|
|||||||
[],
|
[],
|
||||||
[with_documentation=no])
|
[with_documentation=no])
|
||||||
|
|
||||||
#
|
|
||||||
# If something has been entered after an equal sign, assume it is the directory
|
# If something has been entered after an equal sign, assume it is the directory
|
||||||
#
|
|
||||||
if test x"$with_documentation" != xyes -a x"$with_documentation" != xno; then
|
if test x"$with_documentation" != xyes -a x"$with_documentation" != xno; then
|
||||||
docdir="$with_documentation"
|
docdir="$with_documentation"
|
||||||
fi
|
fi
|
||||||
@@ -317,9 +250,7 @@ freebsd*)
|
|||||||
echo "Using non-specific system compiler settings"
|
echo "Using non-specific system compiler settings"
|
||||||
if test x"$enable_debug" = xyes; then
|
if test x"$enable_debug" = xyes; then
|
||||||
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
|
||||||
#:
|
:
|
||||||
# Use -O0 in debug so that variables do not get optimized out
|
|
||||||
AX_CFLAGS_GCC_OPTION([-O0])
|
|
||||||
else
|
else
|
||||||
# add optimise for size
|
# add optimise for size
|
||||||
AX_CFLAGS_GCC_OPTION([-Os])
|
AX_CFLAGS_GCC_OPTION([-Os])
|
||||||
@@ -341,26 +272,9 @@ AC_DEFINE([_FILE_OFFSET_BITS], [64], [File Offset size])
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Are we targetting Win32?
|
# Checks for header files
|
||||||
#
|
|
||||||
AC_MSG_CHECKING([for Win32])
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
|
||||||
#ifdef WIN32
|
|
||||||
#error Yup
|
|
||||||
#endif
|
|
||||||
],[])], [ac_cv_win32="no"], [ac_cv_win32="yes"])
|
|
||||||
if test "$ac_cv_win32" = "yes"; then
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Checks for header files (which aren't needed on Win32)
|
|
||||||
#
|
#
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
if test "$ac_cv_win32" = "no"; then
|
|
||||||
# libupnp code doesn't use autoconf variables yet,
|
# libupnp code doesn't use autoconf variables yet,
|
||||||
# so just abort if a header file is not found.
|
# so just abort if a header file is not found.
|
||||||
AC_CHECK_HEADERS(
|
AC_CHECK_HEADERS(
|
||||||
@@ -376,43 +290,20 @@ AC_CHECK_HEADERS(
|
|||||||
sys/ioctl.h \
|
sys/ioctl.h \
|
||||||
sys/socket.h \
|
sys/socket.h \
|
||||||
sys/time.h \
|
sys/time.h \
|
||||||
|
sys/timeb.h \
|
||||||
syslog.h \
|
syslog.h \
|
||||||
unistd.h \
|
unistd.h \
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
[AC_MSG_ERROR([required header file missing])])
|
[AC_MSG_ERROR([required header file missing])])
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for typedefs, structures, and compiler characteristics
|
# Checks for typedefs, structures, and compiler characteristics
|
||||||
#
|
#
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
# The test for socklen_t was getting it wrong when it exists but is in ws2tcpip.h,
|
TYPE_SOCKLEN_T
|
||||||
# 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
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -421,50 +312,14 @@ fi
|
|||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
AC_CHECK_FUNCS(ftime,, [AC_CHECK_LIB(compat, ftime)])
|
||||||
#
|
|
||||||
# Solaris needs -lsocket -lnsl -lrt
|
|
||||||
AC_SEARCH_LIBS([bind], [socket])
|
|
||||||
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
|
||||||
AC_SEARCH_LIBS([sched_getparam], [rt])
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for POSIX Threads
|
# Checks for POSIX Threads
|
||||||
#
|
#
|
||||||
echo "--------------------------- pthread stuff -------------------------------------"
|
|
||||||
ACX_PTHREAD(
|
ACX_PTHREAD(
|
||||||
[],
|
[],
|
||||||
[AC_MSG_ERROR([POSIX threads are required to build this program])])
|
[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([
|
AC_CONFIG_FILES([
|
||||||
|
|||||||
4
docs/dist/Makefile.am
vendored
4
docs/dist/Makefile.am
vendored
@@ -39,7 +39,7 @@ EXTRA_DIST = \
|
|||||||
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
||||||
./html/upnp/UPNP_E_CANCELED-210.html \
|
./html/upnp/UPNP_E_CANCELED-210.html \
|
||||||
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
||||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \
|
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \
|
||||||
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
||||||
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
||||||
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
||||||
@@ -295,7 +295,7 @@ if WITH_DOCUMENTATION
|
|||||||
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
./html/upnp/UPNP_E_SOCKET_ERROR-208.html \
|
||||||
./html/upnp/UPNP_E_CANCELED-210.html \
|
./html/upnp/UPNP_E_CANCELED-210.html \
|
||||||
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
./html/upnp/UPNP_E_SUBSCRIBE_UNACCEPTED-301.html \
|
||||||
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCEPTED-302.html \
|
./html/upnp/UPNP_E_UNSUBSCRIBE_UNACCAPTED-302.html \
|
||||||
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
./html/upnp/UPNP_E_NOTIFY_UNACCEPTED-303.html \
|
||||||
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
./html/upnp/UPNP_E_INVALID_ARGUMENT-501.html \
|
||||||
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
./html/upnp/UPNP_E_FILE_NOT_FOUND-502.html \
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# "Makefile.am" for "libupnp/ixml"
|
# "Makefile.am" for "libupnp/ixml"
|
||||||
#
|
#
|
||||||
# (C) Copyright 2005 R<>mi Turboult <r3mi@users.sourceforge.net>
|
# (C) Copyright 2005 R<>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
SUBDIRS = doc
|
SUBDIRS = doc
|
||||||
@@ -24,23 +24,15 @@ libixml_la_LDFLAGS = -version-info $(LT_VERSION_IXML) \
|
|||||||
-export-symbols-regex '^ixml.*'
|
-export-symbols-regex '^ixml.*'
|
||||||
|
|
||||||
libixml_la_SOURCES = \
|
libixml_la_SOURCES = \
|
||||||
src/attr.c \
|
src/ixml.c src/node.c src/ixmlparser.c \
|
||||||
src/document.c \
|
src/ixmlmembuf.c src/nodeList.c \
|
||||||
src/element.c \
|
src/element.c src/attr.c src/document.c \
|
||||||
src/inc/ixmlmembuf.h \
|
|
||||||
src/inc/ixmlparser.h \
|
|
||||||
src/ixml.c \
|
|
||||||
src/ixmldebug.c \
|
|
||||||
src/ixmlparser.c \
|
|
||||||
src/ixmlmembuf.c \
|
|
||||||
src/namedNodeMap.c \
|
src/namedNodeMap.c \
|
||||||
src/node.c \
|
src/inc/ixmlmembuf.h src/inc/ixmlparser.h
|
||||||
src/nodeList.c
|
|
||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = \
|
upnpinclude_HEADERS = inc/ixml.h
|
||||||
inc/ixml.h \
|
|
||||||
inc/ixmldebug.h
|
|
||||||
|
|
||||||
check_PROGRAMS = test_document
|
check_PROGRAMS = test_document
|
||||||
TESTS = test/test_document.sh
|
TESTS = test/test_document.sh
|
||||||
@@ -55,3 +47,4 @@ dist-hook:
|
|||||||
clean-local:
|
clean-local:
|
||||||
@if [ -d bin ] ; then rm -rf bin ; fi
|
@if [ -d bin ] ; then rm -rf bin ; fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2712
ixml/inc/ixml.h
2712
ixml/inc/ixml.h
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#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,53 +1,60 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
#include <string.h>
|
* Function: Attr_init
|
||||||
|
* Initializes an attribute node
|
||||||
|
* External function.
|
||||||
void ixmlAttr_init(IN IXML_Attr *attr)
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlAttr_init( IN IXML_Attr * attr )
|
||||||
{
|
{
|
||||||
if( attr != NULL ) {
|
if( attr != NULL ) {
|
||||||
memset( attr, 0, sizeof( IXML_Attr ) );
|
memset( attr, 0, sizeof( IXML_Attr ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlAttr_free(IN IXML_Attr *attr)
|
* Function: Attr_free
|
||||||
|
* Frees an attribute node.
|
||||||
|
* external function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlAttr_free( IN IXML_Attr * attr )
|
||||||
{
|
{
|
||||||
if( attr != NULL ) {
|
if( attr != NULL ) {
|
||||||
ixmlNode_free( ( IXML_Node * ) attr );
|
ixmlNode_free( ( IXML_Node * ) attr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,97 +1,119 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ixmldebug.h"
|
|
||||||
#include "ixmlparser.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
void ixmlDocument_init(IXML_Document *doc)
|
/*================================================================
|
||||||
|
* ixmlDocument_init
|
||||||
|
* It initialize the document structure.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlDocument_init( IN IXML_Document * doc )
|
||||||
{
|
{
|
||||||
memset( doc, 0, sizeof( IXML_Document ) );
|
memset( doc, 0, sizeof( IXML_Document ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlDocument_free(IXML_Document *doc)
|
* ixmlDocument_free
|
||||||
|
* It frees the whole document tree.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlDocument_free( IN IXML_Document * doc )
|
||||||
{
|
{
|
||||||
if( doc != NULL ) {
|
if( doc != NULL ) {
|
||||||
ixmlNode_free( ( IXML_Node * ) doc );
|
ixmlNode_free( ( IXML_Node * ) doc );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
/*!
|
* ixmlDocument_setOwnerDocument
|
||||||
* When this function is called first time, nodeptr is the root of the subtree,
|
*
|
||||||
* so it is not necessay to do two steps recursion.
|
* When this function is called first time, nodeptr is the root
|
||||||
|
* of the subtree, so it is not necessay to do two steps
|
||||||
|
* recursion.
|
||||||
*
|
*
|
||||||
* Internal function called by ixmlDocument_importNode
|
* Internal function called by ixmlDocument_importNode
|
||||||
*/
|
*
|
||||||
static void ixmlDocument_setOwnerDocument(
|
*=================================================================*/
|
||||||
/*! [in] The document node. */
|
void
|
||||||
IXML_Document *doc,
|
ixmlDocument_setOwnerDocument( IN IXML_Document * doc,
|
||||||
/*! [in] \todo documentation. */
|
IN IXML_Node * nodeptr )
|
||||||
IXML_Node *nodeptr)
|
|
||||||
{
|
{
|
||||||
if( nodeptr != NULL ) {
|
if( nodeptr != NULL ) {
|
||||||
nodeptr->ownerDocument = doc;
|
nodeptr->ownerDocument = doc;
|
||||||
ixmlDocument_setOwnerDocument(
|
ixmlDocument_setOwnerDocument( doc,
|
||||||
doc, ixmlNode_getFirstChild(nodeptr));
|
ixmlNode_getFirstChild( nodeptr ) );
|
||||||
ixmlDocument_setOwnerDocument(
|
ixmlDocument_setOwnerDocument( doc,
|
||||||
doc, ixmlNode_getNextSibling(nodeptr));
|
ixmlNode_getNextSibling
|
||||||
|
( nodeptr ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
|
* ixmlDocument_importNode
|
||||||
|
* Imports a node from another document to this document. The
|
||||||
|
* returned node has no parent; (parentNode is null). The source
|
||||||
|
* node is not altered or removed from the original document;
|
||||||
|
* this method creates a new copy of the source node.
|
||||||
|
|
||||||
int ixmlDocument_importNode(
|
* For all nodes, importing a node creates a node object owned
|
||||||
IXML_Document *doc,
|
* by the importing document, with attribute values identical to
|
||||||
IXML_Node *importNode,
|
* the source node's nodeName and nodeType, plus the attributes
|
||||||
BOOL deep,
|
* related to namespaces (prefix, localName, and namespaceURI).
|
||||||
IXML_Node **rtNode)
|
* As in the cloneNode operation on a node, the source node is
|
||||||
|
* not altered.
|
||||||
|
*
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_importNode( IN IXML_Document * doc,
|
||||||
|
IN IXML_Node * importNode,
|
||||||
|
IN BOOL deep,
|
||||||
|
OUT IXML_Node ** rtNode )
|
||||||
{
|
{
|
||||||
unsigned short nodeType;
|
unsigned short nodeType;
|
||||||
IXML_Node *newNode;
|
IXML_Node *newNode;
|
||||||
|
|
||||||
*rtNode = NULL;
|
*rtNode = NULL;
|
||||||
|
|
||||||
if (doc == NULL || importNode == NULL) {
|
if( ( doc == NULL ) || ( importNode == NULL ) ) {
|
||||||
return IXML_INVALID_PARAMETER;
|
return IXML_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,16 +133,29 @@ int ixmlDocument_importNode(
|
|||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createElementEx(
|
* ixmlDocument_createElementEx
|
||||||
IXML_Document *doc,
|
* Creates an element of the type specified.
|
||||||
const DOMString tagName,
|
* External function.
|
||||||
IXML_Element **rtElement)
|
* Parameters:
|
||||||
|
* doc: pointer to document
|
||||||
|
* tagName: The name of the element, it is case-sensitive.
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INVALID_PARAMETER: if either doc or tagName is NULL
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createElementEx( IN IXML_Document * doc,
|
||||||
|
IN const DOMString tagName,
|
||||||
|
OUT IXML_Element ** rtElement )
|
||||||
{
|
{
|
||||||
|
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
|
|
||||||
if (doc == NULL || tagName == NULL) {
|
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
@@ -153,23 +188,46 @@ int ixmlDocument_createElementEx(
|
|||||||
|
|
||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtElement = newElement;
|
*rtElement = newElement;
|
||||||
|
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Element *ixmlDocument_createElement(
|
* ixmlDocument_createElement
|
||||||
IXML_Document *doc,
|
* Creates an element of the type specified.
|
||||||
const DOMString tagName)
|
* External function.
|
||||||
|
* Parameters:
|
||||||
|
* doc: pointer to document
|
||||||
|
* tagName: The name of the element, it is case-sensitive.
|
||||||
|
* Return Value:
|
||||||
|
* A new element object with the nodeName set to tagName, and
|
||||||
|
* localName, prefix and namespaceURI set to null.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Element *
|
||||||
|
ixmlDocument_createElement( IN IXML_Document * doc,
|
||||||
|
IN const DOMString tagName )
|
||||||
{
|
{
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
|
|
||||||
ixmlDocument_createElementEx( doc, tagName, &newElement );
|
ixmlDocument_createElementEx( doc, tagName, &newElement );
|
||||||
return newElement;
|
return newElement;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createDocumentEx(IXML_Document **rtDoc)
|
* ixmlDocument_createDocumentEx
|
||||||
|
* Creates an document object
|
||||||
|
* Internal function.
|
||||||
|
* Parameters:
|
||||||
|
* rtDoc: the document created or NULL on failure
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createDocumentEx( OUT IXML_Document ** rtDoc )
|
||||||
{
|
{
|
||||||
IXML_Document *doc;
|
IXML_Document *doc;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
@@ -199,27 +257,49 @@ ErrorHandler:
|
|||||||
return errCode;
|
return errCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Document *ixmlDocument_createDocument()
|
* ixmlDocument_createDocument
|
||||||
|
* Creates an document object
|
||||||
|
* Internal function.
|
||||||
|
* Parameters:
|
||||||
|
* none
|
||||||
|
* Return Value:
|
||||||
|
* A new document object with the nodeName set to "#document".
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Document *
|
||||||
|
ixmlDocument_createDocument( )
|
||||||
{
|
{
|
||||||
IXML_Document *doc = NULL;
|
IXML_Document *doc = NULL;
|
||||||
|
|
||||||
ixmlDocument_createDocumentEx( &doc );
|
ixmlDocument_createDocumentEx( &doc );
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createTextNodeEx(
|
* ixmlDocument_createTextNodeEx
|
||||||
IXML_Document *doc,
|
* Creates an text node.
|
||||||
const DOMString data,
|
* External function.
|
||||||
IXML_Node **textNode)
|
* Parameters:
|
||||||
|
* data: text data for the text node. It is stored in nodeValue field.
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INVALID_PARAMETER: if either doc or data is NULL
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createTextNodeEx( IN IXML_Document * doc,
|
||||||
|
IN const char *data,
|
||||||
|
OUT IXML_Node ** textNode )
|
||||||
{
|
{
|
||||||
IXML_Node *returnNode;
|
IXML_Node *returnNode;
|
||||||
int rc = IXML_SUCCESS;
|
int rc = IXML_SUCCESS;
|
||||||
|
|
||||||
returnNode = NULL;
|
returnNode = NULL;
|
||||||
if (doc == NULL || data == NULL) {
|
if( ( doc == NULL ) || ( data == NULL ) ) {
|
||||||
rc = IXML_INVALID_PARAMETER;
|
rc = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
@@ -256,12 +336,22 @@ int ixmlDocument_createTextNodeEx(
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*textNode = returnNode;
|
*textNode = returnNode;
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Node *ixmlDocument_createTextNode(
|
* ixmlDocument_createTextNode
|
||||||
IXML_Document *doc,
|
* Creates an text node.
|
||||||
const DOMString data)
|
* External function.
|
||||||
|
* Parameters:
|
||||||
|
* data: text data for the text node. It is stored in nodeValue field.
|
||||||
|
* Return Value:
|
||||||
|
* The new text node.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Node *
|
||||||
|
ixmlDocument_createTextNode( IN IXML_Document * doc,
|
||||||
|
IN const char *data )
|
||||||
{
|
{
|
||||||
IXML_Node *returnNode = NULL;
|
IXML_Node *returnNode = NULL;
|
||||||
|
|
||||||
@@ -270,11 +360,21 @@ IXML_Node *ixmlDocument_createTextNode(
|
|||||||
return returnNode;
|
return returnNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createAttributeEx(
|
* ixmlDocument_createAttributeEx
|
||||||
IXML_Document *doc,
|
* Creates an attribute of the given name.
|
||||||
const char *name,
|
* External function.
|
||||||
IXML_Attr **rtAttr)
|
* Parameters:
|
||||||
|
* name: The name of the Attribute node.
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createAttributeEx( IN IXML_Document * doc,
|
||||||
|
IN const char *name,
|
||||||
|
OUT IXML_Attr ** rtAttr )
|
||||||
{
|
{
|
||||||
IXML_Attr *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
@@ -285,7 +385,7 @@ int ixmlDocument_createAttributeEx(
|
|||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc == NULL || name == NULL) {
|
if( ( doc == NULL ) || ( name == NULL ) ) {
|
||||||
ixmlAttr_free( attrNode );
|
ixmlAttr_free( attrNode );
|
||||||
attrNode = NULL;
|
attrNode = NULL;
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
@@ -293,6 +393,7 @@ int ixmlDocument_createAttributeEx(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ixmlAttr_init( attrNode );
|
ixmlAttr_init( attrNode );
|
||||||
|
|
||||||
attrNode->n.nodeType = eATTRIBUTE_NODE;
|
attrNode->n.nodeType = eATTRIBUTE_NODE;
|
||||||
|
|
||||||
// set the node fields
|
// set the node fields
|
||||||
@@ -309,31 +410,56 @@ int ixmlDocument_createAttributeEx(
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtAttr = attrNode;
|
*rtAttr = attrNode;
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Attr *ixmlDocument_createAttribute(
|
* ixmlDocument_createAttribute
|
||||||
IXML_Document *doc,
|
* Creates an attribute of the given name.
|
||||||
const char *name)
|
* External function.
|
||||||
|
* Parameters:
|
||||||
|
* name: The name of the Attribute node.
|
||||||
|
* Return Value:
|
||||||
|
* A new attr object with the nodeName attribute set to the
|
||||||
|
* given name, and the localName, prefix and namespaceURI set to NULL.
|
||||||
|
* The value of the attribute is the empty string.
|
||||||
|
*
|
||||||
|
================================================================*/
|
||||||
|
IXML_Attr *
|
||||||
|
ixmlDocument_createAttribute( IN IXML_Document * doc,
|
||||||
|
IN const char *name )
|
||||||
{
|
{
|
||||||
IXML_Attr *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
|
|
||||||
ixmlDocument_createAttributeEx( doc, name, &attrNode );
|
ixmlDocument_createAttributeEx( doc, name, &attrNode );
|
||||||
|
|
||||||
return attrNode;
|
return attrNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createAttributeNSEx(
|
* ixmlDocument_createAttributeNSEx
|
||||||
IXML_Document *doc,
|
* Creates an attrbute of the given name and namespace URI
|
||||||
const DOMString namespaceURI,
|
* External function.
|
||||||
const DOMString qualifiedName,
|
* Parameters:
|
||||||
IXML_Attr **rtAttr )
|
* namespaceURI: the namespace fo the attribute to create
|
||||||
|
* qualifiedName: qualifiedName of the attribute to instantiate
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INVALID_PARAMETER: if either doc,namespaceURI or qualifiedName is NULL
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createAttributeNSEx( IN IXML_Document * doc,
|
||||||
|
IN const DOMString namespaceURI,
|
||||||
|
IN const DOMString qualifiedName,
|
||||||
|
OUT IXML_Attr ** rtAttr )
|
||||||
{
|
{
|
||||||
IXML_Attr *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
|
|
||||||
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
||||||
|
|| ( qualifiedName == NULL ) ) {
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
@@ -363,43 +489,68 @@ int ixmlDocument_createAttributeNSEx(
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtAttr = attrNode;
|
*rtAttr = attrNode;
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Attr *ixmlDocument_createAttributeNS(
|
* ixmlDocument_createAttributeNS
|
||||||
IXML_Document *doc,
|
* Creates an attrbute of the given name and namespace URI
|
||||||
const DOMString namespaceURI,
|
* External function.
|
||||||
const DOMString qualifiedName)
|
* Parameters:
|
||||||
|
* namespaceURI: the namespace fo the attribute to create
|
||||||
|
* qualifiedName: qualifiedName of the attribute to instantiate
|
||||||
|
* Return Value:
|
||||||
|
* Creates an attribute node with the given namespaceURI and
|
||||||
|
* qualifiedName. The prefix and localname are extracted from
|
||||||
|
* the qualifiedName. The node value is empty.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Attr *
|
||||||
|
ixmlDocument_createAttributeNS( IN IXML_Document * doc,
|
||||||
|
IN const DOMString namespaceURI,
|
||||||
|
IN const DOMString qualifiedName )
|
||||||
{
|
{
|
||||||
IXML_Attr *attrNode = NULL;
|
IXML_Attr *attrNode = NULL;
|
||||||
|
|
||||||
ixmlDocument_createAttributeNSEx(
|
ixmlDocument_createAttributeNSEx( doc, namespaceURI, qualifiedName,
|
||||||
doc, namespaceURI, qualifiedName, &attrNode);
|
&attrNode );
|
||||||
|
|
||||||
return attrNode;
|
return attrNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createCDATASectionEx(
|
* ixmlDocument_createCDATASectionEx
|
||||||
IXML_Document *doc,
|
* Creates an CDATASection node whose value is the specified string
|
||||||
const DOMString data,
|
* External function.
|
||||||
IXML_CDATASection **rtCD)
|
* Parameters:
|
||||||
|
* data: the data for the CDATASection contents.
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INVALID_PARAMETER: if either doc or data is NULL
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createCDATASectionEx( IN IXML_Document * doc,
|
||||||
|
IN const DOMString data,
|
||||||
|
OUT IXML_CDATASection ** rtCD )
|
||||||
{
|
{
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
IXML_CDATASection *cDSectionNode = NULL;
|
IXML_CDATASection *cDSectionNode = NULL;
|
||||||
|
|
||||||
if(doc == NULL || data == NULL) {
|
if( ( doc == NULL ) || ( data == NULL ) ) {
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
cDSectionNode = (IXML_CDATASection *)malloc(sizeof (IXML_CDATASection));
|
cDSectionNode =
|
||||||
|
( IXML_CDATASection * ) malloc( sizeof( IXML_CDATASection ) );
|
||||||
if( cDSectionNode == NULL ) {
|
if( cDSectionNode == NULL ) {
|
||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlCDATASection_init( cDSectionNode );
|
ixmlCDATASection_init( cDSectionNode );
|
||||||
|
|
||||||
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
|
cDSectionNode->n.nodeType = eCDATA_SECTION_NODE;
|
||||||
cDSectionNode->n.nodeName = strdup( CDATANODENAME );
|
cDSectionNode->n.nodeName = strdup( CDATANODENAME );
|
||||||
if( cDSectionNode->n.nodeName == NULL ) {
|
if( cDSectionNode->n.nodeName == NULL ) {
|
||||||
@@ -422,55 +573,77 @@ int ixmlDocument_createCDATASectionEx(
|
|||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtCD = cDSectionNode;
|
*rtCD = cDSectionNode;
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_CDATASection *ixmlDocument_createCDATASection(
|
* ixmlDocument_createCDATASection
|
||||||
IXML_Document *doc,
|
* Creates an CDATASection node whose value is the specified string
|
||||||
const DOMString data)
|
* External function.
|
||||||
|
* Parameters:
|
||||||
|
* data: the data for the CDATASection contents.
|
||||||
|
* Return Value:
|
||||||
|
* The new CDATASection object.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_CDATASection *
|
||||||
|
ixmlDocument_createCDATASection( IN IXML_Document * doc,
|
||||||
|
IN const DOMString data )
|
||||||
{
|
{
|
||||||
|
|
||||||
IXML_CDATASection *cDSectionNode = NULL;
|
IXML_CDATASection *cDSectionNode = NULL;
|
||||||
|
|
||||||
ixmlDocument_createCDATASectionEx( doc, data, &cDSectionNode );
|
ixmlDocument_createCDATASectionEx( doc, data, &cDSectionNode );
|
||||||
|
|
||||||
return cDSectionNode;
|
return cDSectionNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlDocument_createElementNSEx(
|
* ixmlDocument_createElementNSEx
|
||||||
IXML_Document *doc,
|
* Creates an element of the given qualified name and namespace URI.
|
||||||
const DOMString namespaceURI,
|
* External function.
|
||||||
const DOMString qualifiedName,
|
* Parameters:
|
||||||
IXML_Element **rtElement)
|
* namespaceURI: the namespace URI of the element to create.
|
||||||
|
* qualifiedName: the qualified name of the element to instantiate.
|
||||||
|
* Return Value:
|
||||||
|
* Return Value:
|
||||||
|
* IXML_SUCCESS
|
||||||
|
* IXML_INVALID_PARAMETER: if either doc,namespaceURI or qualifiedName is NULL
|
||||||
|
* IXML_INSUFFICIENT_MEMORY: if not enough memory to finish this operations.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlDocument_createElementNSEx( IN IXML_Document * doc,
|
||||||
|
IN const DOMString namespaceURI,
|
||||||
|
IN const DOMString qualifiedName,
|
||||||
|
OUT IXML_Element ** rtElement )
|
||||||
{
|
{
|
||||||
|
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
int errCode = IXML_SUCCESS;
|
int errCode = IXML_SUCCESS;
|
||||||
int line = 0;
|
|
||||||
|
|
||||||
if (doc == NULL || namespaceURI == NULL || qualifiedName == NULL) {
|
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
||||||
line = __LINE__;
|
|| ( qualifiedName == NULL ) ) {
|
||||||
errCode = IXML_INVALID_PARAMETER;
|
errCode = IXML_INVALID_PARAMETER;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
errCode = ixmlDocument_createElementEx(doc, qualifiedName, &newElement);
|
errCode =
|
||||||
|
ixmlDocument_createElementEx( doc, qualifiedName, &newElement );
|
||||||
if( errCode != IXML_SUCCESS ) {
|
if( errCode != IXML_SUCCESS ) {
|
||||||
line = __LINE__;
|
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the namespaceURI field
|
// set the namespaceURI field
|
||||||
newElement->n.namespaceURI = strdup( namespaceURI );
|
newElement->n.namespaceURI = strdup( namespaceURI );
|
||||||
if( newElement->n.namespaceURI == NULL ) {
|
if( newElement->n.namespaceURI == NULL ) {
|
||||||
line = __LINE__;
|
|
||||||
ixmlElement_free( newElement );
|
ixmlElement_free( newElement );
|
||||||
newElement = NULL;
|
newElement = NULL;
|
||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||||
goto ErrorHandler;
|
goto ErrorHandler;
|
||||||
}
|
}
|
||||||
// set the localName and prefix
|
// set the localName and prefix
|
||||||
errCode = ixmlNode_setNodeName((IXML_Node *)newElement, qualifiedName);
|
errCode =
|
||||||
|
ixmlNode_setNodeName( ( IXML_Node * ) newElement, qualifiedName );
|
||||||
if( errCode != IXML_SUCCESS ) {
|
if( errCode != IXML_SUCCESS ) {
|
||||||
line = __LINE__;
|
|
||||||
ixmlElement_free( newElement );
|
ixmlElement_free( newElement );
|
||||||
newElement = NULL;
|
newElement = NULL;
|
||||||
errCode = IXML_INSUFFICIENT_MEMORY;
|
errCode = IXML_INSUFFICIENT_MEMORY;
|
||||||
@@ -481,71 +654,115 @@ int ixmlDocument_createElementNSEx(
|
|||||||
|
|
||||||
ErrorHandler:
|
ErrorHandler:
|
||||||
*rtElement = newElement;
|
*rtElement = newElement;
|
||||||
if (errCode != IXML_SUCCESS) {
|
|
||||||
IxmlPrintf("(%s::ixmlDocument_createElementNSEx): Error %d, line %d\n",
|
|
||||||
__FILE__, errCode, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
return errCode;
|
return errCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Element *ixmlDocument_createElementNS(
|
* ixmlDocument_createElementNS
|
||||||
IXML_Document *doc,
|
* Creates an element of the given qualified name and namespace URI.
|
||||||
const DOMString namespaceURI,
|
* External function.
|
||||||
const DOMString qualifiedName)
|
* Parameters:
|
||||||
|
* namespaceURI: the namespace URI of the element to create.
|
||||||
|
* qualifiedName: the qualified name of the element to instantiate.
|
||||||
|
* Return Value:
|
||||||
|
* The new element object with tagName qualifiedName, prefix and
|
||||||
|
* localName extraced from qualfiedName, nodeName of qualfiedName,
|
||||||
|
* namespaceURI of namespaceURI.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Element *
|
||||||
|
ixmlDocument_createElementNS( IN IXML_Document * doc,
|
||||||
|
IN const DOMString namespaceURI,
|
||||||
|
IN const DOMString qualifiedName )
|
||||||
{
|
{
|
||||||
IXML_Element *newElement = NULL;
|
IXML_Element *newElement = NULL;
|
||||||
|
|
||||||
ixmlDocument_createElementNSEx(doc, namespaceURI, qualifiedName, &newElement);
|
ixmlDocument_createElementNSEx( doc, namespaceURI, qualifiedName,
|
||||||
|
&newElement );
|
||||||
return newElement;
|
return newElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_NodeList *ixmlDocument_getElementsByTagName(
|
* ixmlDocument_getElementsByTagName
|
||||||
IXML_Document *doc,
|
* Returns a nodeList of all the Elements with a given tag name
|
||||||
const DOMString tagName)
|
* in the order in which they are encountered in a preorder traversal
|
||||||
|
* of the document tree.
|
||||||
|
* External function.
|
||||||
|
* Parameters:
|
||||||
|
* tagName: the name of the tag to match on. The special value "*"
|
||||||
|
* matches all tags.
|
||||||
|
* Return Value:
|
||||||
|
* A new nodeList object containing all the matched Elements.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_NodeList *
|
||||||
|
ixmlDocument_getElementsByTagName( IN IXML_Document * doc,
|
||||||
|
IN const char *tagName )
|
||||||
{
|
{
|
||||||
IXML_NodeList *returnNodeList = NULL;
|
IXML_NodeList *returnNodeList = NULL;
|
||||||
|
|
||||||
if (doc == NULL || tagName == NULL) {
|
if( ( doc == NULL ) || ( tagName == NULL ) ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_getElementsByTagName((IXML_Node *)doc, tagName, &returnNodeList);
|
ixmlNode_getElementsByTagName( ( IXML_Node * ) doc, tagName,
|
||||||
|
&returnNodeList );
|
||||||
return returnNodeList;
|
return returnNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_NodeList *ixmlDocument_getElementsByTagNameNS(
|
* ixmlDocument_getElementsByTagNameNS
|
||||||
IXML_Document *doc,
|
* Returns a nodeList of all the Elements with a given local name and
|
||||||
const DOMString namespaceURI,
|
* namespace URI in the order in which they are encountered in a
|
||||||
const DOMString localName)
|
* preorder traversal of the document tree.
|
||||||
|
* External function.
|
||||||
|
* Parameters:
|
||||||
|
* namespaceURI: the namespace of the elements to match on. The special
|
||||||
|
* value "*" matches all namespaces.
|
||||||
|
* localName: the local name of the elements to match on. The special
|
||||||
|
* value "*" matches all local names.
|
||||||
|
* Return Value:
|
||||||
|
* A new nodeList object containing all the matched Elements.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_NodeList *
|
||||||
|
ixmlDocument_getElementsByTagNameNS( IN IXML_Document * doc,
|
||||||
|
IN const DOMString namespaceURI,
|
||||||
|
IN const DOMString localName )
|
||||||
{
|
{
|
||||||
IXML_NodeList *returnNodeList = NULL;
|
IXML_NodeList *returnNodeList = NULL;
|
||||||
|
|
||||||
if (doc == NULL || namespaceURI == NULL || localName == NULL) {
|
if( ( doc == NULL ) || ( namespaceURI == NULL )
|
||||||
|
|| ( localName == NULL ) ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_getElementsByTagNameNS(
|
ixmlNode_getElementsByTagNameNS( ( IXML_Node * ) doc, namespaceURI,
|
||||||
(IXML_Node *)doc, namespaceURI, localName, &returnNodeList);
|
localName, &returnNodeList );
|
||||||
|
|
||||||
return returnNodeList;
|
return returnNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Element *ixmlDocument_getElementById(
|
* ixmlDocument_getElementById
|
||||||
IXML_Document *doc,
|
* Returns the element whose ID is given by tagName. If no such
|
||||||
const DOMString tagName)
|
* element exists, returns null.
|
||||||
|
* External function.
|
||||||
|
* Parameter:
|
||||||
|
* tagName: the tag name for an element.
|
||||||
|
* Return Values:
|
||||||
|
* The matching element.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Element *
|
||||||
|
ixmlDocument_getElementById( IN IXML_Document * doc,
|
||||||
|
IN const DOMString tagName )
|
||||||
{
|
{
|
||||||
IXML_Element *rtElement = NULL;
|
IXML_Element *rtElement = NULL;
|
||||||
IXML_Node *nodeptr = ( IXML_Node * ) doc;
|
IXML_Node *nodeptr = ( IXML_Node * ) doc;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if (nodeptr == NULL || tagName == NULL) {
|
if( ( nodeptr == NULL ) || ( tagName == NULL ) ) {
|
||||||
return rtElement;
|
return rtElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,26 +776,29 @@ IXML_Element *ixmlDocument_getElementById(
|
|||||||
rtElement = ( IXML_Element * ) nodeptr;
|
rtElement = ( IXML_Element * ) nodeptr;
|
||||||
return rtElement;
|
return rtElement;
|
||||||
} else {
|
} else {
|
||||||
rtElement = ixmlDocument_getElementById(
|
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
||||||
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
|
ixmlNode_getFirstChild
|
||||||
|
( nodeptr ),
|
||||||
tagName );
|
tagName );
|
||||||
if( rtElement == NULL ) {
|
if( rtElement == NULL ) {
|
||||||
rtElement = ixmlDocument_getElementById(
|
rtElement = ixmlDocument_getElementById( ( IXML_Document
|
||||||
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
|
* )
|
||||||
|
ixmlNode_getNextSibling
|
||||||
|
( nodeptr ),
|
||||||
tagName );
|
tagName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rtElement = ixmlDocument_getElementById(
|
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
||||||
(IXML_Document *)ixmlNode_getFirstChild(nodeptr),
|
ixmlNode_getFirstChild
|
||||||
tagName);
|
( nodeptr ), tagName );
|
||||||
if( rtElement == NULL ) {
|
if( rtElement == NULL ) {
|
||||||
rtElement = ixmlDocument_getElementById(
|
rtElement = ixmlDocument_getElementById( ( IXML_Document * )
|
||||||
(IXML_Document *)ixmlNode_getNextSibling(nodeptr),
|
ixmlNode_getNextSibling
|
||||||
|
( nodeptr ),
|
||||||
tagName );
|
tagName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rtElement;
|
return rtElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,173 +1,77 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef IXML_MEMBUF_H
|
|
||||||
#define IXML_MEMBUF_H
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
#ifndef _IXML_MEMBUF_H
|
||||||
|
#define _IXML_MEMBUF_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for size_t */
|
|
||||||
|
|
||||||
|
|
||||||
#define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) )
|
#define MINVAL( a, b ) ( (a) < (b) ? (a) : (b) )
|
||||||
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
#define UPNP_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MEMBUF_DEF_SIZE_INC 20
|
#define MEMBUF_DEF_SIZE_INC 20
|
||||||
|
|
||||||
|
|
||||||
/*!
|
typedef struct // ixml_membuf
|
||||||
* \brief The ixml_membuf type.
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
size_t length;
|
size_t length;
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
size_t size_inc;
|
size_t size_inc;
|
||||||
|
|
||||||
} ixml_membuf;
|
} ixml_membuf;
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
/*!
|
//////////////// functions /////////////////////////
|
||||||
* \brief ixml_membuf initialization routine.
|
//--------------------------------------------------
|
||||||
|
/*
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
*/
|
*/
|
||||||
void ixml_membuf_init(
|
|
||||||
/*! [in,out] The memory buffer to initializa. */
|
|
||||||
ixml_membuf *m);
|
|
||||||
|
|
||||||
|
void ixml_membuf_init(INOUT ixml_membuf *m);
|
||||||
|
void ixml_membuf_destroy(INOUT ixml_membuf *m);
|
||||||
|
int ixml_membuf_assign(INOUT ixml_membuf *m, IN const void *buf,
|
||||||
|
IN size_t buf_len );
|
||||||
|
int ixml_membuf_assign_str(INOUT ixml_membuf *m, IN const char *c_str );
|
||||||
|
int ixml_membuf_append(INOUT ixml_membuf *m, IN const void *buf);
|
||||||
|
int ixml_membuf_append_str(INOUT ixml_membuf *m, IN const char *c_str);
|
||||||
|
int ixml_membuf_insert(INOUT ixml_membuf *m, IN const void* buf,
|
||||||
|
IN size_t buf_len, int index );
|
||||||
|
|
||||||
/*!
|
#endif // _IXML_MEMBUF_H
|
||||||
* \brief ixml_membuf clearing routine.
|
|
||||||
*
|
|
||||||
* The internal buffer is deleted and ixml_membuf_init() is called in the end
|
|
||||||
* to reinitialize the buffer.
|
|
||||||
*/
|
|
||||||
void ixml_membuf_destroy(
|
|
||||||
/*! [in,out] The memory buffer to clear. */
|
|
||||||
ixml_membuf *m);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Copies the contents o a buffer to the designated ixml_membuf.
|
|
||||||
*
|
|
||||||
* The previous contents of the ixml_membuf are destroyed.
|
|
||||||
*
|
|
||||||
* \return IXML_SUCCESS if successfull, or the error code returned
|
|
||||||
* by ixml_membuf_set_size().
|
|
||||||
*
|
|
||||||
* \sa ixml_membuf_assign_str().
|
|
||||||
*/
|
|
||||||
int ixml_membuf_assign(
|
|
||||||
/*! [in,out] The memory buffer on which to operate. */
|
|
||||||
ixml_membuf *m,
|
|
||||||
/*! [in] The input buffer to copy from. */
|
|
||||||
const void *buf,
|
|
||||||
/*! [in] The number of bytes to copy from the input buffer. */
|
|
||||||
size_t buf_len);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Copies a \b NULL terminated string to the ixml_buffer.
|
|
||||||
*
|
|
||||||
* This is a convenience function that internally uses ixml_membuf_assign().
|
|
||||||
*
|
|
||||||
* \return The return value of ixml_membuf_assign().
|
|
||||||
*
|
|
||||||
* \sa ixml_membuf_assign().
|
|
||||||
*/
|
|
||||||
int ixml_membuf_assign_str(
|
|
||||||
/*! [in,out] The memory buffer on which to operate. */
|
|
||||||
ixml_membuf *m,
|
|
||||||
/*! [in] The input string to copy from. */
|
|
||||||
const char *c_str);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Appends one byte to the designated ixml_membuffer.
|
|
||||||
*
|
|
||||||
* This is a convenience function that internally uses ixml_membuf_insert().
|
|
||||||
*
|
|
||||||
* \return The return value of ixml_membuf_insert().
|
|
||||||
*
|
|
||||||
* \sa ixml_membuf_insert()
|
|
||||||
*/
|
|
||||||
int ixml_membuf_append(
|
|
||||||
/*! [in,out] The memory buffer on which to operate. */
|
|
||||||
ixml_membuf *m,
|
|
||||||
/*! [in] The pointer to the byte to append. */
|
|
||||||
const void *buf);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Appends the contents of a \b NULL terminated string to the designated
|
|
||||||
* ixml_membuf.
|
|
||||||
*
|
|
||||||
* This is a convenience function that internally uses ixml_membuf_insert().
|
|
||||||
*
|
|
||||||
* \return The return value of ixml_membuf_insert().
|
|
||||||
*
|
|
||||||
* \sa ixml_membuf_insert().
|
|
||||||
*/
|
|
||||||
int ixml_membuf_append_str(
|
|
||||||
/*! [in,out] The memory buffer on which to operate. */
|
|
||||||
ixml_membuf *m,
|
|
||||||
/*! [in] The input string to copy from. */
|
|
||||||
const char *c_str);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*
|
|
||||||
* \return
|
|
||||||
* \li 0 if successfull.
|
|
||||||
* \li IXML_INDEX_SIZE_ERR if the index parameter is out of range.
|
|
||||||
* \li Or the return code of ixml_membuf_set_size()
|
|
||||||
*
|
|
||||||
* \sa ixml_membuf_set_size()
|
|
||||||
*/
|
|
||||||
int ixml_membuf_insert(
|
|
||||||
/*! [in,out] The memory buffer on which to operate. */
|
|
||||||
ixml_membuf *m,
|
|
||||||
/*! [in] The pointer to the input buffer. */
|
|
||||||
const void *buf,
|
|
||||||
/*! [in] The buffer length. */
|
|
||||||
size_t buf_len,
|
|
||||||
/*! [in] The point of insertion relative to the beggining of the
|
|
||||||
* ixml_membuf internal buffer. */
|
|
||||||
int index);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* IXML_MEMBUF_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +1,41 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef IXMLPARSER_H
|
|
||||||
#define IXMLPARSER_H
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
#ifndef _IXMLPARSER_H
|
||||||
|
#define _IXMLPARSER_H
|
||||||
|
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
#include "ixmlmembuf.h"
|
#include "ixmlmembuf.h"
|
||||||
|
|
||||||
|
// Parser definitions
|
||||||
/* Parser definitions */
|
|
||||||
#define QUOT """
|
#define QUOT """
|
||||||
#define LT "<"
|
#define LT "<"
|
||||||
#define GT ">"
|
#define GT ">"
|
||||||
@@ -52,7 +44,6 @@
|
|||||||
#define ESC_HEX "&#x"
|
#define ESC_HEX "&#x"
|
||||||
#define ESC_DEC "&#"
|
#define ESC_DEC "&#"
|
||||||
|
|
||||||
|
|
||||||
typedef struct _IXML_NamespaceURI
|
typedef struct _IXML_NamespaceURI
|
||||||
{
|
{
|
||||||
char *nsURI;
|
char *nsURI;
|
||||||
@@ -78,192 +69,52 @@ typedef enum
|
|||||||
eCONTENT,
|
eCONTENT,
|
||||||
} PARSER_STATE;
|
} PARSER_STATE;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _Parser
|
typedef struct _Parser
|
||||||
{
|
{
|
||||||
/*! Data buffer. */
|
char *dataBuffer; //data buffer
|
||||||
char *dataBuffer;
|
char *curPtr; //ptr to the token parsed
|
||||||
/*! Pointer to the token parsed. */
|
char *savePtr; //Saves for backup
|
||||||
char *curPtr;
|
|
||||||
/*! Saves for backup. */
|
|
||||||
char *savePtr;
|
|
||||||
ixml_membuf lastElem;
|
ixml_membuf lastElem;
|
||||||
ixml_membuf tokenBuf;
|
ixml_membuf tokenBuf;
|
||||||
|
|
||||||
IXML_Node *pNeedPrefixNode;
|
IXML_Node *pNeedPrefixNode;
|
||||||
IXML_ElementStack *pCurElement;
|
IXML_ElementStack *pCurElement;
|
||||||
IXML_Node *currentNodePtr;
|
IXML_Node *currentNodePtr;
|
||||||
PARSER_STATE state;
|
PARSER_STATE state;
|
||||||
|
|
||||||
BOOL bHasTopLevel;
|
BOOL bHasTopLevel;
|
||||||
|
|
||||||
} Parser;
|
} Parser;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Check to see whether name is a valid xml name.
|
|
||||||
*/
|
|
||||||
BOOL Parser_isValidXmlName(
|
|
||||||
/*! [in] The string to be checked. */
|
|
||||||
const DOMString name);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Sets the error character.
|
|
||||||
*
|
|
||||||
* If 'c' is 0 (default), the parser is strict about XML encoding:
|
|
||||||
* invalid UTF-8 sequences or "&" entities are rejected, and the parsing
|
|
||||||
* aborts.
|
|
||||||
*
|
|
||||||
* If 'c' is not 0, the parser is relaxed: invalid UTF-8 characters
|
|
||||||
* are replaced by this character, and invalid "&" entities are left
|
|
||||||
* untranslated. The parsing is then allowed to continue.
|
|
||||||
*/
|
|
||||||
void Parser_setErrorChar(
|
|
||||||
/*! [in] The character to become the error character. */
|
|
||||||
char c);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Fees a node contents.
|
|
||||||
*/
|
|
||||||
void Parser_freeNodeContent(
|
|
||||||
/*! [in] The Node to process. */
|
|
||||||
IXML_Node *IXML_Nodeptr);
|
|
||||||
|
|
||||||
int Parser_LoadDocument( IXML_Document **retDoc, const char * xmlFile, BOOL file);
|
int Parser_LoadDocument( IXML_Document **retDoc, const char * xmlFile, BOOL file);
|
||||||
|
BOOL Parser_isValidXmlName( const DOMString name);
|
||||||
int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
|
int Parser_setNodePrefixAndLocalName(IXML_Node *newIXML_NodeIXML_Attr);
|
||||||
|
void Parser_freeNodeContent( IXML_Node *IXML_Nodeptr);
|
||||||
|
|
||||||
|
void Parser_setErrorChar( char c );
|
||||||
|
|
||||||
|
void ixmlAttr_free(IXML_Attr *attrNode);
|
||||||
void ixmlAttr_init(IXML_Attr *attrNode);
|
void ixmlAttr_init(IXML_Attr *attrNode);
|
||||||
|
|
||||||
/*!
|
int ixmlElement_setTagName(IXML_Element *element, const char *tagName);
|
||||||
* \brief Set the given element's tagName.
|
|
||||||
*
|
|
||||||
* \return One of the following:
|
|
||||||
* \li \b IXML_SUCCESS, if successfull.
|
|
||||||
* \li \b IXML_FAILED, if element of tagname is \b NULL.
|
|
||||||
* \li \b IXML_INSUFFICIENT_MEMORY, if there is no memory to allocate the
|
|
||||||
* buffer for the element's tagname.
|
|
||||||
*/
|
|
||||||
int ixmlElement_setTagName(
|
|
||||||
/*! [in] The element to change the tagname. */
|
|
||||||
IXML_Element *element,
|
|
||||||
/*! [in] The new tagName for the element. */
|
|
||||||
const char *tagName);
|
|
||||||
|
|
||||||
|
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap);
|
||||||
|
int ixmlNamedNodeMap_addToNamedNodeMap(IXML_NamedNodeMap **nnMap, IXML_Node *add);
|
||||||
|
|
||||||
/*!
|
void ixmlNode_init(IXML_Node *IXML_Nodeptr);
|
||||||
* \brief Initializes a NamedNodeMap object.
|
BOOL ixmlNode_compare(IXML_Node *srcIXML_Node, IXML_Node *destIXML_Node);
|
||||||
*/
|
|
||||||
void ixmlNamedNodeMap_init(
|
|
||||||
/*! [in] The named node map to process. */
|
|
||||||
IXML_NamedNodeMap *nnMap);
|
|
||||||
|
|
||||||
|
void ixmlNode_getElementsByTagName( IXML_Node *n, const char *tagname, IXML_NodeList **list);
|
||||||
|
void ixmlNode_getElementsByTagNameNS( IXML_Node *IXML_Node, const char *namespaceURI,
|
||||||
|
const char *localName, IXML_NodeList **list);
|
||||||
|
|
||||||
/*!
|
int ixmlNode_setNodeProperties(IXML_Node* node, IXML_Node *src);
|
||||||
* \brief Add a node to a NamedNodeMap.
|
int ixmlNode_setNodeName( IXML_Node* node, const DOMString qualifiedName);
|
||||||
*
|
|
||||||
* \return IXML_SUCCESS or failure.
|
|
||||||
*/
|
|
||||||
int ixmlNamedNodeMap_addToNamedNodeMap(
|
|
||||||
/* [in] The named node map. */
|
|
||||||
IXML_NamedNodeMap **nnMap,
|
|
||||||
/* [in] The node to add. */
|
|
||||||
IXML_Node *add);
|
|
||||||
|
|
||||||
/*!
|
void ixmlNodeList_init(IXML_NodeList *nList);
|
||||||
* \brief Add a node to nodelist.
|
int ixmlNodeList_addToNodeList(IXML_NodeList **nList, IXML_Node *add);
|
||||||
*/
|
|
||||||
int ixmlNodeList_addToNodeList(
|
|
||||||
/*! [in] The pointer to the nodelist. */
|
|
||||||
IXML_NodeList **nList,
|
|
||||||
/*! [in] The node to add. */
|
|
||||||
IXML_Node *add);
|
|
||||||
|
|
||||||
|
#endif // _IXMLPARSER_H
|
||||||
/*!
|
|
||||||
* \brief Intializes a node.
|
|
||||||
*/
|
|
||||||
void ixmlNode_init(
|
|
||||||
/*! [in] The \b Node to iniatialize. */
|
|
||||||
IN IXML_Node *nodeptr);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Compare two nodes to see whether they are the same node.
|
|
||||||
* Parent, sibling and children node are ignored.
|
|
||||||
*
|
|
||||||
* \return
|
|
||||||
* \li TRUE, the two nodes are the same.
|
|
||||||
* \li FALSE, the two nodes are not the same.
|
|
||||||
*/
|
|
||||||
BOOL ixmlNode_compare(
|
|
||||||
/*! [in] The first \b Node. */
|
|
||||||
IXML_Node *srcNode,
|
|
||||||
/*! [in] The second \b Node. */
|
|
||||||
IXML_Node *destNode);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Returns a nodeList of all descendant Elements with a given tagName,
|
|
||||||
* in the order in which they are encountered in a traversal of this element
|
|
||||||
* tree.
|
|
||||||
*/
|
|
||||||
void ixmlNode_getElementsByTagName(
|
|
||||||
/*! [in] The \b Node tree. */
|
|
||||||
IXML_Node *n,
|
|
||||||
/*! [in] The tag name to match. */
|
|
||||||
const char *tagname,
|
|
||||||
/*! [out] The output \b NodeList. */
|
|
||||||
IXML_NodeList **list);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Returns a nodeList of all the descendant Elements with a given local
|
|
||||||
* name and namespace URI in the order in which they are encountered in a
|
|
||||||
* preorder traversal of this Elememt tree.
|
|
||||||
*/
|
|
||||||
void ixmlNode_getElementsByTagNameNS(
|
|
||||||
/*! [in] The \b Element tree. */
|
|
||||||
IXML_Node *n,
|
|
||||||
/*! [in] The name space to match. */
|
|
||||||
const char *namespaceURI,
|
|
||||||
/*! [in] The local name to match. */
|
|
||||||
const char *localName,
|
|
||||||
/*! [out] The output \b NodeList. */
|
|
||||||
IXML_NodeList **list);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
int ixmlNode_setNodeName(
|
|
||||||
/*! [in] The \b Node. */
|
|
||||||
IXML_Node *node,
|
|
||||||
/*! [in] . */
|
|
||||||
const DOMString qualifiedName);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*
|
|
||||||
* \return
|
|
||||||
*/
|
|
||||||
int ixmlNode_setNodeProperties(
|
|
||||||
/*! [in] . */
|
|
||||||
IXML_Node *destNode,
|
|
||||||
/*! [in] . */
|
|
||||||
IXML_Node *src);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Initializes a nodelist
|
|
||||||
*/
|
|
||||||
void ixmlNodeList_init(
|
|
||||||
/*! [in,out] The \b NodeList to initialize. */
|
|
||||||
IXML_NodeList *nList);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* IXMLPARSER_H */
|
|
||||||
|
|
||||||
|
|||||||
346
ixml/src/ixml.c
346
ixml/src/ixml.c
@@ -1,65 +1,51 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ixmldebug.h"
|
|
||||||
#include "ixmlmembuf.h"
|
#include "ixmlmembuf.h"
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
#include <stdlib.h> /* for free() */
|
* copy_with_escape
|
||||||
#include <string.h>
|
*
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
/*!
|
static void
|
||||||
* \brief Appends a string to a buffer, substituting some characters by escape
|
copy_with_escape( INOUT ixml_membuf * buf,
|
||||||
* sequences.
|
IN const char *p )
|
||||||
*/
|
|
||||||
static void copy_with_escape(
|
|
||||||
/*! [in,out] The input/output buffer. */
|
|
||||||
ixml_membuf *buf,
|
|
||||||
/*! [in] The string to copy from. */
|
|
||||||
const char *p)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int plen;
|
int plen;
|
||||||
|
|
||||||
if (p == NULL) {
|
if( p == NULL )
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
plen = strlen( p );
|
plen = strlen( p );
|
||||||
|
|
||||||
@@ -87,21 +73,19 @@ static void copy_with_escape(
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ixml_membuf_append( buf, &p[i] );
|
ixml_membuf_append( buf, &p[i] );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
/*!
|
* ixmlPrintDomTreeRecursive
|
||||||
* \brief Recursive function to print all the node in a tree.
|
* It is a recursive function to print all the node in a tree.
|
||||||
* Internal to parser only.
|
* Internal to parser only.
|
||||||
*/
|
*
|
||||||
static void ixmlPrintDomTreeRecursive(
|
*=================================================================*/
|
||||||
/*! [in] \todo documentation. */
|
void
|
||||||
IXML_Node *nodeptr,
|
ixmlPrintDomTreeRecursive( IN IXML_Node * nodeptr,
|
||||||
/*! [in] \todo documentation. */
|
IN ixml_membuf * buf )
|
||||||
ixml_membuf *buf)
|
|
||||||
{
|
{
|
||||||
const char *nodeName = NULL;
|
const char *nodeName = NULL;
|
||||||
const char *nodeValue = NULL;
|
const char *nodeValue = NULL;
|
||||||
@@ -113,6 +97,7 @@ static void ixmlPrintDomTreeRecursive(
|
|||||||
nodeValue = ixmlNode_getNodeValue( nodeptr );
|
nodeValue = ixmlNode_getNodeValue( nodeptr );
|
||||||
|
|
||||||
switch ( ixmlNode_getNodeType( nodeptr ) ) {
|
switch ( ixmlNode_getNodeType( nodeptr ) ) {
|
||||||
|
|
||||||
case eTEXT_NODE:
|
case eTEXT_NODE:
|
||||||
copy_with_escape( buf, nodeValue );
|
copy_with_escape( buf, nodeValue );
|
||||||
break;
|
break;
|
||||||
@@ -132,8 +117,8 @@ static void ixmlPrintDomTreeRecursive(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case eDOCUMENT_NODE:
|
case eDOCUMENT_NODE:
|
||||||
ixmlPrintDomTreeRecursive(
|
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
||||||
ixmlNode_getFirstChild(nodeptr), buf);
|
( nodeptr ), buf );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eATTRIBUTE_NODE:
|
case eATTRIBUTE_NODE:
|
||||||
@@ -141,6 +126,7 @@ static void ixmlPrintDomTreeRecursive(
|
|||||||
ixml_membuf_append_str( buf, "=\"" );
|
ixml_membuf_append_str( buf, "=\"" );
|
||||||
copy_with_escape( buf, nodeValue );
|
copy_with_escape( buf, nodeValue );
|
||||||
ixml_membuf_append_str( buf, "\"" );
|
ixml_membuf_append_str( buf, "\"" );
|
||||||
|
|
||||||
if( nodeptr->nextSibling != NULL ) {
|
if( nodeptr->nextSibling != NULL ) {
|
||||||
ixml_membuf_append_str( buf, " " );
|
ixml_membuf_append_str( buf, " " );
|
||||||
ixmlPrintDomTreeRecursive( nodeptr->nextSibling, buf );
|
ixmlPrintDomTreeRecursive( nodeptr->nextSibling, buf );
|
||||||
@@ -150,69 +136,71 @@ static void ixmlPrintDomTreeRecursive(
|
|||||||
case eELEMENT_NODE:
|
case eELEMENT_NODE:
|
||||||
ixml_membuf_append_str( buf, "<" );
|
ixml_membuf_append_str( buf, "<" );
|
||||||
ixml_membuf_append_str( buf, nodeName );
|
ixml_membuf_append_str( buf, nodeName );
|
||||||
|
|
||||||
if( nodeptr->firstAttr != NULL ) {
|
if( nodeptr->firstAttr != NULL ) {
|
||||||
ixml_membuf_append_str( buf, " " );
|
ixml_membuf_append_str( buf, " " );
|
||||||
ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf );
|
ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
child = ixmlNode_getFirstChild( nodeptr );
|
child = ixmlNode_getFirstChild( nodeptr );
|
||||||
if (child != NULL &&
|
if( ( child != NULL )
|
||||||
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
&& ( ixmlNode_getNodeType( child ) ==
|
||||||
|
eELEMENT_NODE ) ) {
|
||||||
ixml_membuf_append_str( buf, ">\r\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the children
|
// output the children
|
||||||
ixmlPrintDomTreeRecursive(
|
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild
|
||||||
ixmlNode_getFirstChild(nodeptr), buf);
|
( nodeptr ), buf );
|
||||||
|
|
||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str( buf, "</" );
|
ixml_membuf_append_str( buf, "</" );
|
||||||
ixml_membuf_append_str( buf, nodeName );
|
ixml_membuf_append_str( buf, nodeName );
|
||||||
|
|
||||||
sibling = ixmlNode_getNextSibling( nodeptr );
|
sibling = ixmlNode_getNextSibling( nodeptr );
|
||||||
if (sibling != NULL &&
|
if( sibling != NULL
|
||||||
ixmlNode_getNodeType(sibling) == eTEXT_NODE) {
|
&& ixmlNode_getNodeType( sibling ) == eTEXT_NODE ) {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">\r\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
}
|
}
|
||||||
ixmlPrintDomTreeRecursive(
|
ixmlPrintDomTreeRecursive( ixmlNode_getNextSibling
|
||||||
ixmlNode_getNextSibling(nodeptr), buf);
|
( nodeptr ), buf );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
IxmlPrintf("(%s::ixmlPrintDomTreeRecursive) line %d: "
|
|
||||||
"Warning, unknown node type %d\n",
|
|
||||||
__FILE__, __LINE__, ixmlNode_getNodeType(nodeptr));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
/*!
|
* ixmlPrintDomTree
|
||||||
* \brief Print a DOM tree.
|
* Print a DOM tree.
|
||||||
|
* Element, and Attribute nodes are handled differently.
|
||||||
|
* We don't want to print the Element and Attribute nodes' sibling.
|
||||||
|
* External function.
|
||||||
*
|
*
|
||||||
* Element, and Attribute nodes are handled differently. We don't want to print
|
*=================================================================*/
|
||||||
* the Element and Attribute nodes' sibling.
|
void
|
||||||
*/
|
ixmlPrintDomTree( IN IXML_Node * nodeptr,
|
||||||
static void ixmlPrintDomTree(
|
IN ixml_membuf * buf )
|
||||||
/*! [in] \todo documentation. */
|
|
||||||
IXML_Node *nodeptr,
|
|
||||||
/*! [in] \todo documentation. */
|
|
||||||
ixml_membuf *buf)
|
|
||||||
{
|
{
|
||||||
const char *nodeName = NULL;
|
const char *nodeName = NULL;
|
||||||
const char *nodeValue = NULL;
|
const char *nodeValue = NULL;
|
||||||
IXML_Node *child = NULL;
|
IXML_Node *child = NULL;
|
||||||
|
|
||||||
if (nodeptr == NULL || buf == NULL) {
|
if( ( nodeptr == NULL ) || ( buf == NULL ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeName = ( const char * )ixmlNode_getNodeName( nodeptr );
|
nodeName = ( const char * )ixmlNode_getNodeName( nodeptr );
|
||||||
nodeValue = ixmlNode_getNodeValue( nodeptr );
|
nodeValue = ixmlNode_getNodeValue( nodeptr );
|
||||||
|
|
||||||
switch ( ixmlNode_getNodeType( nodeptr ) ) {
|
switch ( ixmlNode_getNodeType( nodeptr ) ) {
|
||||||
|
|
||||||
case eTEXT_NODE:
|
case eTEXT_NODE:
|
||||||
case eCDATA_SECTION_NODE:
|
case eCDATA_SECTION_NODE:
|
||||||
case ePROCESSING_INSTRUCTION_NODE:
|
case ePROCESSING_INSTRUCTION_NODE:
|
||||||
@@ -230,21 +218,23 @@ static void ixmlPrintDomTree(
|
|||||||
case eELEMENT_NODE:
|
case eELEMENT_NODE:
|
||||||
ixml_membuf_append_str( buf, "<" );
|
ixml_membuf_append_str( buf, "<" );
|
||||||
ixml_membuf_append_str( buf, nodeName );
|
ixml_membuf_append_str( buf, nodeName );
|
||||||
|
|
||||||
if( nodeptr->firstAttr != NULL ) {
|
if( nodeptr->firstAttr != NULL ) {
|
||||||
ixml_membuf_append_str( buf, " " );
|
ixml_membuf_append_str( buf, " " );
|
||||||
ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf );
|
ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
child = ixmlNode_getFirstChild( nodeptr );
|
child = ixmlNode_getFirstChild( nodeptr );
|
||||||
if (child != NULL &&
|
if( ( child != NULL )
|
||||||
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
||||||
ixml_membuf_append_str( buf, ">\r\n" );
|
ixml_membuf_append_str( buf, ">\r\n" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the children
|
// output the children
|
||||||
ixmlPrintDomTreeRecursive(
|
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ),
|
||||||
ixmlNode_getFirstChild(nodeptr), buf);
|
buf );
|
||||||
|
|
||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str( buf, "</" );
|
ixml_membuf_append_str( buf, "</" );
|
||||||
@@ -253,31 +243,27 @@ static void ixmlPrintDomTree(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
IxmlPrintf("(%s::ixmlPrintDomTree) line %d: "
|
|
||||||
"Warning, unknown node type %d\n",
|
|
||||||
__FILE__, __LINE__, ixmlNode_getNodeType(nodeptr));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
/*!
|
* ixmlDomTreetoString
|
||||||
* \brief Converts a DOM tree into a text string.
|
* Converts a DOM tree into a text string
|
||||||
|
* Element, and Attribute nodes are handled differently.
|
||||||
|
* We don't want to print the Element and Attribute nodes' sibling.
|
||||||
|
* External function.
|
||||||
*
|
*
|
||||||
* Element, and Attribute nodes are handled differently. We don't want to print
|
*=================================================================*/
|
||||||
* the Element and Attribute nodes' sibling.
|
void
|
||||||
*/
|
ixmlDomTreetoString( IN IXML_Node * nodeptr,
|
||||||
static void ixmlDomTreetoString(
|
IN ixml_membuf * buf )
|
||||||
/*! [in] \todo documentation. */
|
|
||||||
IXML_Node *nodeptr,
|
|
||||||
/*! [in] \todo documentation. */
|
|
||||||
ixml_membuf *buf)
|
|
||||||
{
|
{
|
||||||
const char *nodeName = NULL;
|
const char *nodeName = NULL;
|
||||||
const char *nodeValue = NULL;
|
const char *nodeValue = NULL;
|
||||||
IXML_Node *child = NULL;
|
IXML_Node *child = NULL;
|
||||||
|
|
||||||
if (nodeptr == NULL || buf == NULL) {
|
if( ( nodeptr == NULL ) || ( buf == NULL ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,6 +271,7 @@ static void ixmlDomTreetoString(
|
|||||||
nodeValue = ixmlNode_getNodeValue( nodeptr );
|
nodeValue = ixmlNode_getNodeValue( nodeptr );
|
||||||
|
|
||||||
switch ( ixmlNode_getNodeType( nodeptr ) ) {
|
switch ( ixmlNode_getNodeType( nodeptr ) ) {
|
||||||
|
|
||||||
case eTEXT_NODE:
|
case eTEXT_NODE:
|
||||||
case eCDATA_SECTION_NODE:
|
case eCDATA_SECTION_NODE:
|
||||||
case ePROCESSING_INSTRUCTION_NODE:
|
case ePROCESSING_INSTRUCTION_NODE:
|
||||||
@@ -302,20 +289,23 @@ static void ixmlDomTreetoString(
|
|||||||
case eELEMENT_NODE:
|
case eELEMENT_NODE:
|
||||||
ixml_membuf_append_str( buf, "<" );
|
ixml_membuf_append_str( buf, "<" );
|
||||||
ixml_membuf_append_str( buf, nodeName );
|
ixml_membuf_append_str( buf, nodeName );
|
||||||
|
|
||||||
if( nodeptr->firstAttr != NULL ) {
|
if( nodeptr->firstAttr != NULL ) {
|
||||||
ixml_membuf_append_str( buf, " " );
|
ixml_membuf_append_str( buf, " " );
|
||||||
ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf );
|
ixmlPrintDomTreeRecursive( nodeptr->firstAttr, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
child = ixmlNode_getFirstChild( nodeptr );
|
child = ixmlNode_getFirstChild( nodeptr );
|
||||||
if (child != NULL &&
|
if( ( child != NULL )
|
||||||
ixmlNode_getNodeType(child) == eELEMENT_NODE) {
|
&& ( ixmlNode_getNodeType( child ) == eELEMENT_NODE ) ) {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
} else {
|
} else {
|
||||||
ixml_membuf_append_str( buf, ">" );
|
ixml_membuf_append_str( buf, ">" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// output the children
|
// output the children
|
||||||
ixmlPrintDomTreeRecursive(ixmlNode_getFirstChild(nodeptr), buf);
|
ixmlPrintDomTreeRecursive( ixmlNode_getFirstChild( nodeptr ),
|
||||||
|
buf );
|
||||||
|
|
||||||
// Done with children. Output the end tag.
|
// Done with children. Output the end tag.
|
||||||
ixml_membuf_append_str( buf, "</" );
|
ixml_membuf_append_str( buf, "</" );
|
||||||
@@ -324,35 +314,54 @@ static void ixmlDomTreetoString(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
IxmlPrintf("(%s::ixmlDomTreetoString) line %d: "
|
|
||||||
"Warning, unknown node type %d\n",
|
|
||||||
__FILE__, __LINE__, ixmlNode_getNodeType(nodeptr));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlLoadDocumentEx(const char *xmlFile, IXML_Document **doc)
|
* 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) {
|
|
||||||
|
if( ( xmlFile == NULL ) || ( doc == NULL ) ) {
|
||||||
return IXML_INVALID_PARAMETER;
|
return IXML_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Parser_LoadDocument( doc, xmlFile, TRUE );
|
return Parser_LoadDocument( doc, xmlFile, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Document *ixmlLoadDocument(const char *xmlFile)
|
* 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;
|
IXML_Document *doc = NULL;
|
||||||
|
|
||||||
ixmlLoadDocumentEx( xmlFile, &doc );
|
ixmlLoadDocumentEx( xmlFile, &doc );
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
|
* ixmlPrintDocument
|
||||||
|
* Prints entire document, prepending XML prolog first.
|
||||||
|
* Puts lots of white spaces.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
|
||||||
DOMString ixmlPrintDocument(IXML_Document *doc)
|
DOMString
|
||||||
|
ixmlPrintDocument(IXML_Document *doc)
|
||||||
{
|
{
|
||||||
IXML_Node* rootNode = ( IXML_Node * )doc;
|
IXML_Node* rootNode = ( IXML_Node * )doc;
|
||||||
ixml_membuf memBuf;
|
ixml_membuf memBuf;
|
||||||
@@ -365,13 +374,20 @@ DOMString ixmlPrintDocument(IXML_Document *doc)
|
|||||||
ixml_membuf_init( buf );
|
ixml_membuf_init( buf );
|
||||||
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
|
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
|
||||||
ixmlPrintDomTree( rootNode, buf );
|
ixmlPrintDomTree( rootNode, buf );
|
||||||
|
|
||||||
return buf->buf;
|
return buf->buf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
DOMString ixmlPrintNode(IXML_Node *node)
|
* ixmlPrintNode
|
||||||
|
* Print DOM tree under node. Puts lots of white spaces
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
DOMString
|
||||||
|
ixmlPrintNode( IN IXML_Node * node )
|
||||||
{
|
{
|
||||||
|
|
||||||
ixml_membuf memBuf;
|
ixml_membuf memBuf;
|
||||||
ixml_membuf *buf = &memBuf;
|
ixml_membuf *buf = &memBuf;
|
||||||
|
|
||||||
@@ -381,12 +397,20 @@ DOMString ixmlPrintNode(IXML_Node *node)
|
|||||||
|
|
||||||
ixml_membuf_init( buf );
|
ixml_membuf_init( buf );
|
||||||
ixmlPrintDomTree( node, buf );
|
ixmlPrintDomTree( node, buf );
|
||||||
|
|
||||||
return buf->buf;
|
return buf->buf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
|
* ixmlDocumenttoString
|
||||||
|
* converts DOM tree under node to text string,
|
||||||
|
* prepending XML prolog first.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
|
||||||
DOMString ixmlDocumenttoString(IXML_Document *doc)
|
DOMString
|
||||||
|
ixmlDocumenttoString(IXML_Document *doc)
|
||||||
{
|
{
|
||||||
IXML_Node* rootNode = ( IXML_Node * )doc;
|
IXML_Node* rootNode = ( IXML_Node * )doc;
|
||||||
ixml_membuf memBuf;
|
ixml_membuf memBuf;
|
||||||
@@ -399,13 +423,20 @@ DOMString ixmlDocumenttoString(IXML_Document *doc)
|
|||||||
ixml_membuf_init( buf );
|
ixml_membuf_init( buf );
|
||||||
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
|
ixml_membuf_append_str( buf, "<?xml version=\"1.0\"?>\r\n" );
|
||||||
ixmlDomTreetoString( rootNode, buf );
|
ixmlDomTreetoString( rootNode, buf );
|
||||||
|
|
||||||
return buf->buf;
|
return buf->buf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
DOMString ixmlNodetoString(IXML_Node *node)
|
* ixmlNodetoString
|
||||||
|
* converts DOM tree under node to text string
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
DOMString
|
||||||
|
ixmlNodetoString( IN IXML_Node * node )
|
||||||
{
|
{
|
||||||
|
|
||||||
ixml_membuf memBuf;
|
ixml_membuf memBuf;
|
||||||
ixml_membuf *buf = &memBuf;
|
ixml_membuf *buf = &memBuf;
|
||||||
|
|
||||||
@@ -415,20 +446,35 @@ DOMString ixmlNodetoString(IXML_Node *node)
|
|||||||
|
|
||||||
ixml_membuf_init( buf );
|
ixml_membuf_init( buf );
|
||||||
ixmlDomTreetoString( node, buf );
|
ixmlDomTreetoString( node, buf );
|
||||||
|
|
||||||
return buf->buf;
|
return buf->buf;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlRelaxParser(char errorChar)
|
* ixmlRelaxParser
|
||||||
|
* Makes the XML parser more tolerant to malformed text.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlRelaxParser(char errorChar)
|
||||||
{
|
{
|
||||||
Parser_setErrorChar( errorChar );
|
Parser_setErrorChar( errorChar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
|
/*================================================================
|
||||||
|
* ixmlParseBufferEx
|
||||||
|
* Parse xml file stored in buffer.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlParseBufferEx( IN const char *buffer,
|
||||||
|
IXML_Document ** retDoc )
|
||||||
{
|
{
|
||||||
if (buffer == NULL || retDoc == NULL) {
|
|
||||||
|
if( ( buffer == NULL ) || ( retDoc == NULL ) ) {
|
||||||
return IXML_INVALID_PARAMETER;
|
return IXML_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,31 +485,47 @@ int ixmlParseBufferEx(const char *buffer, IXML_Document **retDoc)
|
|||||||
return Parser_LoadDocument( retDoc, buffer, FALSE );
|
return Parser_LoadDocument( retDoc, buffer, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Document *ixmlParseBuffer(const char *buffer)
|
* ixmlParseBuffer
|
||||||
|
* Parse xml file stored in buffer.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Document *
|
||||||
|
ixmlParseBuffer( IN const char *buffer )
|
||||||
{
|
{
|
||||||
IXML_Document *doc = NULL;
|
IXML_Document *doc = NULL;
|
||||||
|
|
||||||
ixmlParseBufferEx( buffer, &doc );
|
ixmlParseBufferEx( buffer, &doc );
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
DOMString ixmlCloneDOMString(const DOMString src)
|
* ixmlCloneDOMString
|
||||||
|
* Clones a DOM String.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
DOMString
|
||||||
|
ixmlCloneDOMString( IN const DOMString src )
|
||||||
{
|
{
|
||||||
if( src == NULL ) {
|
if( src == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return strdup(src);
|
return ( strdup( src ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlFreeDOMString(DOMString buf)
|
* ixmlFreeDOMString
|
||||||
|
* Frees a DOM String.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlFreeDOMString( IN DOMString buf )
|
||||||
{
|
{
|
||||||
if( buf != NULL ) {
|
if( buf != NULL ) {
|
||||||
free( buf );
|
free( buf );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \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,87 +1,79 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlmembuf.h"
|
|
||||||
#include "ixml.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "ixmlmembuf.h"
|
||||||
|
#include "ixml.h"
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
/*!
|
* ixml_membuf_set_size
|
||||||
* \brief Increases or decreases buffer capacity so that at least 'new_length'
|
*
|
||||||
* bytes can be stored.
|
* Increases or decreases buffer cap so that at least
|
||||||
|
* 'new_length' bytes can be stored
|
||||||
*
|
*
|
||||||
* On error, m's fields do not change.
|
* On error, m's fields do not change.
|
||||||
*
|
*
|
||||||
* \return
|
* returns:
|
||||||
* \li UPNP_E_SUCCESS
|
* UPNP_E_SUCCESS
|
||||||
* \li UPNP_E_OUTOF_MEMORY
|
* UPNP_E_OUTOF_MEMORY
|
||||||
*/
|
*
|
||||||
static int ixml_membuf_set_size(
|
*=================================================================*/
|
||||||
/*! [in,out] The memory buffer. */
|
static int
|
||||||
INOUT ixml_membuf *m,
|
ixml_membuf_set_size( INOUT ixml_membuf * m,
|
||||||
/*! [in] The new lenght. */
|
|
||||||
IN size_t new_length )
|
IN size_t new_length )
|
||||||
{
|
{
|
||||||
size_t diff;
|
size_t diff;
|
||||||
size_t alloc_len;
|
size_t alloc_len;
|
||||||
char *temp_buf;
|
char *temp_buf;
|
||||||
|
|
||||||
if (new_length >= m->length) {
|
if( new_length >= m->length ) // increase length
|
||||||
/* increase length */
|
{
|
||||||
/* need more mem? */
|
// need more mem?
|
||||||
if( new_length <= m->capacity ) {
|
if( new_length <= m->capacity ) {
|
||||||
/* have enough mem; done */
|
return 0; // have enough mem; done
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
diff = new_length - m->length;
|
diff = new_length - m->length;
|
||||||
alloc_len = MAXVAL( m->size_inc, diff ) + m->capacity;
|
alloc_len = MAXVAL( m->size_inc, diff ) + m->capacity;
|
||||||
} else {
|
} else // decrease length
|
||||||
// decrease length
|
{
|
||||||
assert( new_length <= m->length );
|
assert( new_length <= m->length );
|
||||||
|
|
||||||
// if diff is 0..m->size_inc, don't free
|
// if diff is 0..m->size_inc, don't free
|
||||||
if( ( m->capacity - new_length ) <= m->size_inc ) {
|
if( ( m->capacity - new_length ) <= m->size_inc ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc_len = new_length + m->size_inc;
|
alloc_len = new_length + m->size_inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,22 +81,27 @@ static int ixml_membuf_set_size(
|
|||||||
|
|
||||||
temp_buf = realloc( m->buf, alloc_len + 1 );
|
temp_buf = realloc( m->buf, alloc_len + 1 );
|
||||||
if( temp_buf == NULL ) {
|
if( temp_buf == NULL ) {
|
||||||
/* try smaller size */
|
// try smaller size
|
||||||
alloc_len = new_length;
|
alloc_len = new_length;
|
||||||
temp_buf = realloc( m->buf, alloc_len + 1 );
|
temp_buf = realloc( m->buf, alloc_len + 1 );
|
||||||
|
|
||||||
if( temp_buf == NULL ) {
|
if( temp_buf == NULL ) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* save */
|
// save
|
||||||
m->buf = temp_buf;
|
m->buf = temp_buf;
|
||||||
m->capacity = alloc_len;
|
m->capacity = alloc_len;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixml_membuf_init(ixml_membuf *m)
|
* membuffer_init
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixml_membuf_init( INOUT ixml_membuf * m )
|
||||||
{
|
{
|
||||||
assert( m != NULL );
|
assert( m != NULL );
|
||||||
|
|
||||||
@@ -114,8 +111,13 @@ void ixml_membuf_init(ixml_membuf *m)
|
|||||||
m->capacity = 0;
|
m->capacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixml_membuf_destroy(ixml_membuf *m)
|
* membuffer_destroy
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixml_membuf_destroy( INOUT ixml_membuf * m )
|
||||||
{
|
{
|
||||||
if( m == NULL ) {
|
if( m == NULL ) {
|
||||||
return;
|
return;
|
||||||
@@ -125,11 +127,15 @@ void ixml_membuf_destroy(ixml_membuf *m)
|
|||||||
ixml_membuf_init( m );
|
ixml_membuf_init( m );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixml_membuf_assign(
|
* ixml_membuf_assign
|
||||||
ixml_membuf *m,
|
*
|
||||||
const void *buf,
|
*
|
||||||
size_t buf_len)
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixml_membuf_assign( INOUT ixml_membuf * m,
|
||||||
|
IN const void *buf,
|
||||||
|
IN size_t buf_len )
|
||||||
{
|
{
|
||||||
int return_code;
|
int return_code;
|
||||||
|
|
||||||
@@ -145,28 +151,35 @@ int ixml_membuf_assign(
|
|||||||
if( return_code != 0 ) {
|
if( return_code != 0 ) {
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy
|
// copy
|
||||||
memcpy( m->buf, buf, buf_len );
|
memcpy( m->buf, buf, buf_len );
|
||||||
|
m->buf[buf_len] = 0; // null-terminate
|
||||||
|
|
||||||
// null-terminate
|
|
||||||
m->buf[buf_len] = 0;
|
|
||||||
m->length = buf_len;
|
m->length = buf_len;
|
||||||
|
|
||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixml_membuf_assign_str(
|
* ixml_membuf_assign_str
|
||||||
ixml_membuf *m,
|
*
|
||||||
const char *c_str)
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixml_membuf_assign_str( INOUT ixml_membuf * m,
|
||||||
|
IN const char *c_str )
|
||||||
{
|
{
|
||||||
return ixml_membuf_assign( m, c_str, strlen( c_str ) );
|
return ixml_membuf_assign( m, c_str, strlen( c_str ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixml_membuf_append(
|
* ixml_membuf_append
|
||||||
INOUT ixml_membuf *m,
|
*
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixml_membuf_append( INOUT ixml_membuf * m,
|
||||||
IN const void *buf )
|
IN const void *buf )
|
||||||
{
|
{
|
||||||
assert( m != NULL );
|
assert( m != NULL );
|
||||||
@@ -174,45 +187,50 @@ int ixml_membuf_append(
|
|||||||
return ixml_membuf_insert( m, buf, 1, m->length );
|
return ixml_membuf_insert( m, buf, 1, m->length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixml_membuf_append_str(
|
* ixml_membuf_append_str
|
||||||
INOUT ixml_membuf *m,
|
*
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixml_membuf_append_str( INOUT ixml_membuf * m,
|
||||||
IN const char *c_str )
|
IN const char *c_str )
|
||||||
{
|
{
|
||||||
return ixml_membuf_insert( m, c_str, strlen( c_str ), m->length );
|
return ixml_membuf_insert( m, c_str, strlen( c_str ), m->length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixml_membuf_insert(
|
* ixml_membuf_insert
|
||||||
INOUT ixml_membuf *m,
|
*
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixml_membuf_insert( INOUT ixml_membuf * m,
|
||||||
IN const void *buf,
|
IN const void *buf,
|
||||||
IN size_t buf_len,
|
IN size_t buf_len,
|
||||||
int index )
|
int index )
|
||||||
{
|
{
|
||||||
int return_code = 0;
|
int return_code;
|
||||||
|
|
||||||
assert( m != NULL );
|
assert( m != NULL );
|
||||||
|
|
||||||
if (index < 0 || index > (int)m->length) {
|
if( index < 0 || index > ( int )m->length )
|
||||||
return IXML_INDEX_SIZE_ERR;
|
return IXML_INDEX_SIZE_ERR;
|
||||||
}
|
|
||||||
|
|
||||||
if( buf == NULL || buf_len == 0 ) {
|
if( buf == NULL || buf_len == 0 ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* alloc mem */
|
// alloc mem
|
||||||
return_code = ixml_membuf_set_size( m, m->length + buf_len );
|
return_code = ixml_membuf_set_size( m, m->length + buf_len );
|
||||||
if( return_code != 0 ) {
|
if( return_code != 0 ) {
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
/* insert data */
|
// insert data
|
||||||
/* move data to right of insertion point */
|
// move data to right of insertion point
|
||||||
memmove( m->buf + index + buf_len, m->buf + index, m->length - index );
|
memmove( m->buf + index + buf_len, m->buf + index, m->length - index );
|
||||||
memcpy( m->buf + index, buf, buf_len );
|
memcpy( m->buf + index, buf, buf_len );
|
||||||
m->length += buf_len;
|
m->length += buf_len;
|
||||||
/* Null terminate */
|
m->buf[m->length] = 0; // null-terminate
|
||||||
m->buf[m->length] = 0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,62 +1,53 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
#include <assert.h>
|
* NamedNodeMap_getItemNumber
|
||||||
#include <stdlib.h> /* for free(), malloc() */
|
* return the item number of a item in NamedNodeMap.
|
||||||
#include <string.h>
|
* Internal to parser only.
|
||||||
|
* Parameters:
|
||||||
|
* name: the name of the item to find
|
||||||
/*!
|
*
|
||||||
* \brief Return the item number of a item in NamedNodeMap.
|
*=================================================================*/
|
||||||
*/
|
unsigned long
|
||||||
static unsigned long ixmlNamedNodeMap_getItemNumber(
|
ixmlNamedNodeMap_getItemNumber( IN IXML_NamedNodeMap * nnMap,
|
||||||
/*! [in] The named node map to process. */
|
|
||||||
IN IXML_NamedNodeMap *nnMap,
|
|
||||||
/*! [in] The name of the item to find. */
|
|
||||||
IN const char *name )
|
IN const char *name )
|
||||||
{
|
{
|
||||||
IXML_Node *tempNode;
|
IXML_Node *tempNode;
|
||||||
unsigned long returnItemNo = 0;
|
unsigned long returnItemNo = 0;
|
||||||
|
|
||||||
assert( nnMap != NULL && name != NULL );
|
assert( nnMap != NULL && name != NULL );
|
||||||
if (nnMap == NULL || name == NULL) {
|
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
||||||
return IXML_INVALID_ITEM_NUMBER;
|
return IXML_INVALID_ITEM_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +56,7 @@ static unsigned long ixmlNamedNodeMap_getItemNumber(
|
|||||||
if( strcmp( name, tempNode->nodeName ) == 0 ) {
|
if( strcmp( name, tempNode->nodeName ) == 0 ) {
|
||||||
return returnItemNo;
|
return returnItemNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempNode = tempNode->nextSibling;
|
tempNode = tempNode->nextSibling;
|
||||||
returnItemNo++;
|
returnItemNo++;
|
||||||
}
|
}
|
||||||
@@ -72,22 +64,39 @@ static unsigned long ixmlNamedNodeMap_getItemNumber(
|
|||||||
return IXML_INVALID_ITEM_NUMBER;
|
return IXML_INVALID_ITEM_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlNamedNodeMap_init(IXML_NamedNodeMap *nnMap)
|
* NamedNodeMap_init
|
||||||
|
* Initializes a NamedNodeMap object.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlNamedNodeMap_init( IN IXML_NamedNodeMap * nnMap )
|
||||||
{
|
{
|
||||||
assert( nnMap != NULL );
|
assert( nnMap != NULL );
|
||||||
|
|
||||||
memset( nnMap, 0, sizeof( IXML_NamedNodeMap ) );
|
memset( nnMap, 0, sizeof( IXML_NamedNodeMap ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Node *ixmlNamedNodeMap_getNamedItem(
|
* NamedNodeMap_getNamedItem
|
||||||
IXML_NamedNodeMap *nnMap,
|
* Retrieves a node specified by name.
|
||||||
const DOMString name)
|
* External function.
|
||||||
|
*
|
||||||
|
* Parameter:
|
||||||
|
* name: type nodeName of a node to retrieve.
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* A Node with the specified nodeName, or null if it
|
||||||
|
* does not identify any node in this map.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
IXML_Node *
|
||||||
|
ixmlNamedNodeMap_getNamedItem( IN IXML_NamedNodeMap * nnMap,
|
||||||
|
IN const char *name )
|
||||||
{
|
{
|
||||||
long index;
|
long index;
|
||||||
|
|
||||||
if (nnMap == NULL || name == NULL) {
|
if( ( nnMap == NULL ) || ( name == NULL ) ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,13 +104,26 @@ IXML_Node *ixmlNamedNodeMap_getNamedItem(
|
|||||||
if( index == IXML_INVALID_ITEM_NUMBER ) {
|
if( index == IXML_INVALID_ITEM_NUMBER ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
return ixmlNamedNodeMap_item(nnMap, (unsigned long)index);
|
return ( ixmlNamedNodeMap_item( nnMap, ( unsigned long )index ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Node *ixmlNamedNodeMap_item(
|
* NamedNodeMap_item
|
||||||
IN IXML_NamedNodeMap *nnMap,
|
* 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 )
|
IN unsigned long index )
|
||||||
{
|
{
|
||||||
IXML_Node *tempNode;
|
IXML_Node *tempNode;
|
||||||
@@ -123,8 +145,16 @@ IXML_Node *ixmlNamedNodeMap_item(
|
|||||||
return tempNode;
|
return tempNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
unsigned long ixmlNamedNodeMap_getLength(IXML_NamedNodeMap *nnMap)
|
* NamedNodeMap_getLength
|
||||||
|
* Return the number of Nodes in this map.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
unsigned long
|
||||||
|
ixmlNamedNodeMap_getLength( IN IXML_NamedNodeMap * nnMap )
|
||||||
{
|
{
|
||||||
IXML_Node *tempNode;
|
IXML_Node *tempNode;
|
||||||
unsigned long length = 0;
|
unsigned long length = 0;
|
||||||
@@ -135,12 +165,17 @@ unsigned long ixmlNamedNodeMap_getLength(IXML_NamedNodeMap *nnMap)
|
|||||||
tempNode = tempNode->nextSibling;
|
tempNode = tempNode->nextSibling;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap)
|
* ixmlNamedNodeMap_free
|
||||||
|
* frees a NamedNodeMap.
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlNamedNodeMap_free( IXML_NamedNodeMap * nnMap )
|
||||||
{
|
{
|
||||||
IXML_NamedNodeMap *pNext;
|
IXML_NamedNodeMap *pNext;
|
||||||
|
|
||||||
@@ -151,27 +186,38 @@ void ixmlNamedNodeMap_free(IXML_NamedNodeMap *nnMap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
int ixmlNamedNodeMap_addToNamedNodeMap(
|
* NamedNodeMap_addToNamedNodeMap
|
||||||
IXML_NamedNodeMap **nnMap,
|
* add a node to a NamedNodeMap.
|
||||||
IXML_Node *add)
|
* 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 )
|
||||||
{
|
{
|
||||||
IXML_NamedNodeMap *traverse = NULL;
|
IXML_NamedNodeMap *traverse = NULL,
|
||||||
IXML_NamedNodeMap *p = NULL;
|
*p = NULL;
|
||||||
IXML_NamedNodeMap *newItem = NULL;
|
IXML_NamedNodeMap *newItem = NULL;
|
||||||
|
|
||||||
if( add == NULL ) {
|
if( add == NULL ) {
|
||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*nnMap == NULL) {
|
if( *nnMap == NULL ) // nodelist is empty
|
||||||
// nodelist is empty
|
{
|
||||||
*nnMap = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap));
|
*nnMap =
|
||||||
|
( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) );
|
||||||
if( *nnMap == NULL ) {
|
if( *nnMap == NULL ) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
ixmlNamedNodeMap_init( *nnMap );
|
ixmlNamedNodeMap_init( *nnMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( *nnMap )->nodeItem == NULL ) {
|
if( ( *nnMap )->nodeItem == NULL ) {
|
||||||
( *nnMap )->nodeItem = add;
|
( *nnMap )->nodeItem = add;
|
||||||
} else {
|
} else {
|
||||||
@@ -181,7 +227,9 @@ int ixmlNamedNodeMap_addToNamedNodeMap(
|
|||||||
p = traverse;
|
p = traverse;
|
||||||
traverse = traverse->next;
|
traverse = traverse->next;
|
||||||
}
|
}
|
||||||
newItem = (IXML_NamedNodeMap *)malloc(sizeof (IXML_NamedNodeMap));
|
|
||||||
|
newItem =
|
||||||
|
( IXML_NamedNodeMap * ) malloc( sizeof( IXML_NamedNodeMap ) );
|
||||||
if( newItem == NULL ) {
|
if( newItem == NULL ) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
@@ -192,4 +240,3 @@ int ixmlNamedNodeMap_addToNamedNodeMap(
|
|||||||
|
|
||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1088
ixml/src/node.c
1088
ixml/src/node.c
File diff suppressed because it is too large
Load Diff
@@ -1,57 +1,61 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ixmlparser.h"
|
#include "ixmlparser.h"
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
#include <assert.h>
|
* ixmlNodeList_init
|
||||||
#include <string.h>
|
* initializes a nodelist
|
||||||
|
* External function.
|
||||||
|
*
|
||||||
void ixmlNodeList_init(IXML_NodeList *nList)
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlNodeList_init( IXML_NodeList * nList )
|
||||||
{
|
{
|
||||||
assert( nList != NULL );
|
assert( nList != NULL );
|
||||||
|
|
||||||
memset( nList, 0, sizeof( IXML_NodeList ) );
|
memset( nList, 0, sizeof( IXML_NodeList ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
IXML_Node *ixmlNodeList_item(
|
* ixmlNodeList_item
|
||||||
IXML_NodeList *nList,
|
* 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 )
|
unsigned long index )
|
||||||
{
|
{
|
||||||
IXML_NodeList *next;
|
IXML_NodeList *next;
|
||||||
@@ -71,19 +75,24 @@ IXML_Node *ixmlNodeList_item(
|
|||||||
next = next->next;
|
next = next->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next == NULL) {
|
if( next == NULL ) return NULL;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return next->nodeItem;
|
return next->nodeItem;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ixmlNodeList_addToNodeList(
|
/*================================================================
|
||||||
IXML_NodeList **nList,
|
* ixmlNodeList_addToNodeList
|
||||||
IXML_Node *add)
|
* Add a node to nodelist
|
||||||
|
* Internal to parser only.
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
int
|
||||||
|
ixmlNodeList_addToNodeList( IN IXML_NodeList ** nList,
|
||||||
|
IN IXML_Node * add )
|
||||||
{
|
{
|
||||||
IXML_NodeList *traverse = NULL;
|
IXML_NodeList *traverse,
|
||||||
IXML_NodeList *p = NULL;
|
*p = NULL;
|
||||||
IXML_NodeList *newListItem;
|
IXML_NodeList *newListItem;
|
||||||
|
|
||||||
assert( add != NULL );
|
assert( add != NULL );
|
||||||
@@ -92,8 +101,8 @@ int ixmlNodeList_addToNodeList(
|
|||||||
return IXML_FAILED;
|
return IXML_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*nList == NULL) {
|
if( *nList == NULL ) // nodelist is empty
|
||||||
// nodelist is empty
|
{
|
||||||
*nList = ( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) );
|
*nList = ( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) );
|
||||||
if( *nList == NULL ) {
|
if( *nList == NULL ) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
@@ -111,7 +120,8 @@ int ixmlNodeList_addToNodeList(
|
|||||||
traverse = traverse->next;
|
traverse = traverse->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
newListItem = (IXML_NodeList *)malloc(sizeof (IXML_NodeList));
|
newListItem =
|
||||||
|
( IXML_NodeList * ) malloc( sizeof( IXML_NodeList ) );
|
||||||
if( newListItem == NULL ) {
|
if( newListItem == NULL ) {
|
||||||
return IXML_INSUFFICIENT_MEMORY;
|
return IXML_INSUFFICIENT_MEMORY;
|
||||||
}
|
}
|
||||||
@@ -123,8 +133,15 @@ int ixmlNodeList_addToNodeList(
|
|||||||
return IXML_SUCCESS;
|
return IXML_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
unsigned long ixmlNodeList_length(IXML_NodeList *nList)
|
* 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 )
|
||||||
{
|
{
|
||||||
IXML_NodeList *list;
|
IXML_NodeList *list;
|
||||||
unsigned long length = 0;
|
unsigned long length = 0;
|
||||||
@@ -138,15 +155,22 @@ unsigned long ixmlNodeList_length(IXML_NodeList *nList)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*================================================================
|
||||||
void ixmlNodeList_free(IXML_NodeList *nList)
|
* ixmlNodeList_free
|
||||||
|
* frees a nodeList
|
||||||
|
* External function
|
||||||
|
*
|
||||||
|
*=================================================================*/
|
||||||
|
void
|
||||||
|
ixmlNodeList_free( IN IXML_NodeList * nList )
|
||||||
{
|
{
|
||||||
IXML_NodeList *next;
|
IXML_NodeList *next;
|
||||||
|
|
||||||
while( nList != NULL ) {
|
while( nList != NULL ) {
|
||||||
next = nList->next;
|
next = nList->next;
|
||||||
|
|
||||||
free( nList );
|
free( nList );
|
||||||
nList = next;
|
nList = next;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ includedir=@includedir@
|
|||||||
Name: libupnp
|
Name: libupnp
|
||||||
Description: Linux SDK for UPnP Devices
|
Description: Linux SDK for UPnP Devices
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
Libs: @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml
|
||||||
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Version: 1.6.7
|
Version: 1.6.2
|
||||||
Summary: Universal Plug and Play (UPnP) SDK
|
Summary: Universal Plug and Play (UPnP) SDK
|
||||||
Name: libupnp
|
Name: libupnp
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ AC_DEFUN([RT_BOOL_ARG_ENABLE],[
|
|||||||
)])
|
)])
|
||||||
test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl
|
test "x$enable_[$1]" != [x]m4_if([$2],[yes],[no],[yes]) dnl
|
||||||
&& enable_[]Name=[$2]
|
&& enable_[]Name=[$2]
|
||||||
AC_MSG_RESULT($enable_[]Name)
|
AC_MSG_RESULT($enable_[]Name)dnl
|
||||||
AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes)
|
AM_CONDITIONAL([ENABLE_]NAME, test x"$enable_[]Name" = xyes)
|
||||||
dnl
|
dnl
|
||||||
m4_popdef([NAME])dnl
|
m4_popdef([NAME])dnl
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(srcdir)/inc -I$(srcdir)/src/inc
|
AM_CPPFLAGS = -I$(srcdir)/inc -I$(srcdir)/src/inc
|
||||||
|
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||||
|
|
||||||
if ENABLE_DEBUG
|
if ENABLE_DEBUG
|
||||||
AM_CPPFLAGS += -DDEBUG -DSTATS
|
AM_CPPFLAGS += -DDEBUG -DSTATS
|
||||||
@@ -20,11 +21,12 @@ libthreadutil_la_LDFLAGS = -version-info $(LT_VERSION_THREADUTIL)
|
|||||||
|
|
||||||
libthreadutil_la_SOURCES = \
|
libthreadutil_la_SOURCES = \
|
||||||
src/FreeList.c src/LinkedList.c \
|
src/FreeList.c src/LinkedList.c \
|
||||||
src/ThreadPool.c src/TimerThread.c
|
src/ThreadPool.c src/TimerThread.c \
|
||||||
|
src/iasnprintf.c
|
||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = \
|
upnpinclude_HEADERS = \
|
||||||
inc/FreeList.h inc/LinkedList.h \
|
inc/FreeList.h inc/LinkedList.h \
|
||||||
inc/ThreadPool.h inc/TimerThread.h \
|
inc/ThreadPool.h inc/TimerThread.h \
|
||||||
inc/ithread.h
|
inc/iasnprintf.h inc/ithread.h
|
||||||
|
|
||||||
|
|||||||
@@ -29,134 +29,70 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef THREADPOOL_H
|
#ifndef THREADPOOL_H
|
||||||
#define THREADPOOL_H
|
#define THREADPOOL_H
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "FreeList.h"
|
|
||||||
#include "ithread.h"
|
|
||||||
#include "LinkedList.h"
|
|
||||||
#include "UpnpInet.h"
|
|
||||||
#include "UpnpGlobal.h" /* for UPNP_INLINE, EXPORT_SPEC */
|
|
||||||
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#include <time.h>
|
|
||||||
struct timezone
|
|
||||||
{
|
|
||||||
int tz_minuteswest; /* minutes W of Greenwich */
|
|
||||||
int tz_dsttime; /* type of dst correction */
|
|
||||||
};
|
|
||||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
|
||||||
#else /* WIN32 */
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/time.h> /* for gettimeofday() */
|
|
||||||
#if defined(__OSX__) || defined(__APPLE__) || defined(__NetBSD__)
|
|
||||||
#include <sys/resource.h> /* for setpriority() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Size of job free list */
|
||||||
/*! Size of job free list */
|
|
||||||
#define JOBFREELISTSIZE 100
|
#define JOBFREELISTSIZE 100
|
||||||
|
|
||||||
|
|
||||||
#define INFINITE_THREADS -1
|
#define INFINITE_THREADS -1
|
||||||
|
|
||||||
|
|
||||||
#define EMAXTHREADS (-8 & 1<<29)
|
#define EMAXTHREADS (-8 & 1<<29)
|
||||||
|
|
||||||
|
/* Invalid Policy */
|
||||||
/*! Invalid Policy */
|
|
||||||
#define INVALID_POLICY (-9 & 1<<29)
|
#define INVALID_POLICY (-9 & 1<<29)
|
||||||
|
|
||||||
|
/* Invalid JOB Id */
|
||||||
/*! Invalid JOB Id */
|
|
||||||
#define INVALID_JOB_ID (-2 & 1<<29)
|
#define INVALID_JOB_ID (-2 & 1<<29)
|
||||||
|
|
||||||
|
typedef enum duration {SHORT_TERM,PERSISTENT} Duration;
|
||||||
|
|
||||||
typedef enum duration {
|
typedef enum priority {LOW_PRIORITY,
|
||||||
SHORT_TERM,
|
|
||||||
PERSISTENT
|
|
||||||
} Duration;
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum priority {
|
|
||||||
LOW_PRIORITY,
|
|
||||||
MED_PRIORITY,
|
MED_PRIORITY,
|
||||||
HIGH_PRIORITY
|
HIGH_PRIORITY} ThreadPriority;
|
||||||
} 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 */
|
||||||
|
|
||||||
|
|
||||||
/*! default priority used by TPJobInit */
|
/* Statistics */
|
||||||
#define DEFAULT_PRIORITY MED_PRIORITY
|
#ifdef WIN32 /* TODO: check why STATSONLY fails during compilation */
|
||||||
|
#undef STATS
|
||||||
|
#endif
|
||||||
/*! 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
|
#ifdef _DEBUG
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "LinkedList.h"
|
||||||
|
#include <sys/timeb.h>
|
||||||
|
#include "FreeList.h"
|
||||||
|
|
||||||
|
#include "ithread.h"
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/timeb.h>
|
||||||
|
#define EXPORT
|
||||||
typedef int PolicyType;
|
typedef int PolicyType;
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_POLICY SCHED_OTHER
|
#define DEFAULT_POLICY SCHED_OTHER
|
||||||
|
#define DEFAULT_SCHED_PARAM 0 /* default priority */
|
||||||
|
|
||||||
/*! Default priority */
|
|
||||||
#define DEFAULT_SCHED_PARAM 0
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: free_routine
|
* Name: free_routine
|
||||||
@@ -166,7 +102,6 @@ typedef int PolicyType;
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef void (*free_routine)(void *arg);
|
typedef void (*free_routine)(void *arg);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ThreadPoolAttr
|
* Name: ThreadPoolAttr
|
||||||
*
|
*
|
||||||
@@ -176,31 +111,28 @@ typedef void (*free_routine)(void *arg);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
typedef struct THREADPOOLATTR
|
typedef struct THREADPOOLATTR
|
||||||
{
|
{
|
||||||
/* minThreads, ThreadPool will always maintain at least this many threads */
|
int minThreads; /* minThreads, ThreadPool will always maintain at least
|
||||||
int minThreads;
|
this many threads */
|
||||||
|
|
||||||
/* maxThreads, ThreadPool will never have more than this number of threads */
|
int maxThreads; /* maxThreads, ThreadPool will never have more than this
|
||||||
int maxThreads;
|
number of threads */
|
||||||
|
|
||||||
/* maxIdleTime (in milliseconds) this is the maximum time a thread will
|
int maxIdleTime; /* maxIdleTime (in milliseconds)
|
||||||
* remain idle before dying */
|
this is the maximum time a thread will remain idle
|
||||||
int maxIdleTime;
|
before dying */
|
||||||
|
|
||||||
/* jobs per thread to maintain */
|
int jobsPerThread; /* jobs per thread to maintain */
|
||||||
int jobsPerThread;
|
|
||||||
|
|
||||||
/* maximum number of jobs that can be queued totally. */
|
int maxJobsTotal; /* maximum number of jobs that can be queued totally. */
|
||||||
int maxJobsTotal;
|
|
||||||
|
|
||||||
/* the time a low priority or med priority job waits before getting bumped
|
int starvationTime; /* the time a low priority or med priority
|
||||||
* up a priority (in milliseconds) */
|
job waits before getting bumped
|
||||||
int starvationTime;
|
up a priority (in milliseconds) */
|
||||||
|
|
||||||
|
PolicyType schedPolicy; /* scheduling policy to use */
|
||||||
|
|
||||||
/* scheduling policy to use */
|
|
||||||
PolicyType schedPolicy;
|
|
||||||
} ThreadPoolAttr;
|
} ThreadPoolAttr;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ThreadPool
|
* Name: ThreadPool
|
||||||
*
|
*
|
||||||
@@ -212,18 +144,20 @@ typedef struct THREADPOOLJOB
|
|||||||
start_routine func;
|
start_routine func;
|
||||||
void *arg;
|
void *arg;
|
||||||
free_routine free_func;
|
free_routine free_func;
|
||||||
struct timeval requestTime;
|
struct timeb requestTime;
|
||||||
int priority;
|
int priority;
|
||||||
int jobId;
|
int jobId;
|
||||||
} ThreadPoolJob;
|
} ThreadPoolJob;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ThreadPoolStats
|
* Name: ThreadPoolStats
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Structure to hold statistics
|
* Structure to hold statistics
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef STATS
|
||||||
|
|
||||||
typedef struct TPOOLSTATS
|
typedef struct TPOOLSTATS
|
||||||
{
|
{
|
||||||
double totalTimeHQ;
|
double totalTimeHQ;
|
||||||
@@ -247,13 +181,18 @@ typedef struct TPOOLSTATS
|
|||||||
int currentJobsMQ;
|
int currentJobsMQ;
|
||||||
}ThreadPoolStats;
|
}ThreadPoolStats;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief A thread pool similar to the thread pool in the UPnP SDK.
|
/****************************************************************************
|
||||||
|
* Name: ThreadPool
|
||||||
*
|
*
|
||||||
|
* Description:
|
||||||
|
* A thread pool similar to the thread pool in the UPnP SDK.
|
||||||
* Allows jobs to be scheduled for running by threads in a
|
* Allows jobs to be scheduled for running by threads in a
|
||||||
* thread pool. The thread pool is initialized with a
|
* thread pool. The thread pool is initialized with a
|
||||||
* minimum and maximum thread number as well as a max idle time
|
* 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
|
* and a jobs per thread ratio. If a worker thread waits the whole
|
||||||
* max idle time without receiving a job and the thread pool
|
* max idle time without receiving a job and the thread pool
|
||||||
* currently has more threads running than the minimum
|
* currently has more threads running than the minimum
|
||||||
@@ -262,29 +201,36 @@ typedef struct TPOOLSTATS
|
|||||||
* becomes greater than the set ratio and the thread pool currently has
|
* becomes greater than the set ratio and the thread pool currently has
|
||||||
* less than the maximum threads then a new thread will
|
* less than the maximum threads then a new thread will
|
||||||
* be created.
|
* be created.
|
||||||
*/
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
typedef struct THREADPOOL
|
typedef struct THREADPOOL
|
||||||
{
|
{
|
||||||
ithread_mutex_t mutex; /* mutex to protect job qs */
|
ithread_mutex_t mutex; /* mutex to protect job qs */
|
||||||
ithread_cond_t condition; /* condition variable to signal Q */
|
ithread_cond_t condition; /* condition variable to signal Q */
|
||||||
ithread_cond_t start_and_shutdown; /* condition variable for start and stop */
|
ithread_cond_t start_and_shutdown; /* condition variable for start
|
||||||
|
and stop */
|
||||||
int lastJobId; /* ids for jobs */
|
int lastJobId; /* ids for jobs */
|
||||||
int shutdown; /* whether or not we are shutting down */
|
int shutdown; /* whether or not we are shutting down */
|
||||||
int totalThreads; /* total number of threads */
|
int totalThreads; /* total number of threads */
|
||||||
int busyThreads; /* number of threads that are currently executing jobs */
|
|
||||||
int persistentThreads; /* number of persistent threads */
|
int persistentThreads; /* number of persistent threads */
|
||||||
FreeList jobFreeList; /* free list of jobs */
|
FreeList jobFreeList; /* free list of jobs */
|
||||||
LinkedList lowJobQ; /* low priority job Q */
|
LinkedList lowJobQ; /* low priority job Q */
|
||||||
LinkedList medJobQ; /* med priority job Q */
|
LinkedList medJobQ; /* med priority job Q */
|
||||||
LinkedList highJobQ; /* high priority job Q */
|
LinkedList highJobQ; /* high priority job Q */
|
||||||
ThreadPoolJob *persistentJob; /* persistent job */
|
ThreadPoolJob *persistentJob; /* persistent job */
|
||||||
|
|
||||||
ThreadPoolAttr attr; /* thread pool attributes */
|
ThreadPoolAttr attr; /* thread pool attributes */
|
||||||
|
|
||||||
|
#ifdef STATS
|
||||||
/* statistics */
|
/* statistics */
|
||||||
ThreadPoolStats stats;
|
ThreadPoolStats stats;
|
||||||
|
#endif
|
||||||
|
|
||||||
} ThreadPool;
|
} ThreadPool;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolInit
|
* Function: ThreadPoolInit
|
||||||
*
|
*
|
||||||
@@ -321,8 +267,8 @@ typedef struct THREADPOOL
|
|||||||
* INVALID_POLICY if schedPolicy can't be set
|
* INVALID_POLICY if schedPolicy can't be set
|
||||||
* EMAXTHREADS if minimum threads is greater than maximum threads
|
* EMAXTHREADS if minimum threads is greater than maximum threads
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
int ThreadPoolInit(ThreadPool *tp,
|
||||||
|
ThreadPoolAttr *attr);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolAddPersistent
|
* Function: ThreadPoolAddPersistent
|
||||||
@@ -344,8 +290,9 @@ int ThreadPoolInit(ThreadPool *tp, ThreadPoolAttr *attr);
|
|||||||
* EOUTOFMEM not enough memory to add job.
|
* EOUTOFMEM not enough memory to add job.
|
||||||
* EMAXTHREADS not enough threads to add persistent 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
|
* Function: ThreadPoolGetAttr
|
||||||
@@ -360,9 +307,8 @@ int ThreadPoolAddPersistent(ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
|||||||
* 0 on success, nonzero on failure
|
* 0 on success, nonzero on failure
|
||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
int ThreadPoolGetAttr(ThreadPool *tp,
|
||||||
|
ThreadPoolAttr *out);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolSetAttr
|
* Function: ThreadPoolSetAttr
|
||||||
*
|
*
|
||||||
@@ -376,8 +322,8 @@ int ThreadPoolGetAttr(ThreadPool *tp, ThreadPoolAttr *out);
|
|||||||
* 0 on success, nonzero on failure
|
* 0 on success, nonzero on failure
|
||||||
* Returns INVALID_POLICY if policy can not be set.
|
* Returns INVALID_POLICY if policy can not be set.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
int ThreadPoolSetAttr(ThreadPool *tp,
|
||||||
|
ThreadPoolAttr *attr);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolAdd
|
* Function: ThreadPoolAdd
|
||||||
@@ -396,8 +342,9 @@ int ThreadPoolSetAttr(ThreadPool *tp, ThreadPoolAttr *attr);
|
|||||||
* 0 on success, nonzero on failure
|
* 0 on success, nonzero on failure
|
||||||
* EOUTOFMEM if not enough memory to add job.
|
* 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
|
* Function: ThreadPoolRemove
|
||||||
@@ -414,7 +361,8 @@ int ThreadPoolAdd (ThreadPool*tp, ThreadPoolJob *job, int *jobId);
|
|||||||
* 0 on success, nonzero on failure.
|
* 0 on success, nonzero on failure.
|
||||||
* INVALID_JOB_ID if job not found.
|
* INVALID_JOB_ID if job not found.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int ThreadPoolRemove(ThreadPool *tp, int jobId, ThreadPoolJob *out);
|
int ThreadPoolRemove(ThreadPool *tp,
|
||||||
|
int jobId, ThreadPoolJob *out);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -451,7 +399,6 @@ int ThreadPoolShutdown(ThreadPool *tp);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPJobSetPriority
|
* Function: TPJobSetPriority
|
||||||
*
|
*
|
||||||
@@ -465,7 +412,6 @@ int TPJobInit(ThreadPoolJob *job, start_routine func, void *arg);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
int TPJobSetPriority(ThreadPoolJob *job, ThreadPriority priority);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPJobSetFreeFunction
|
* Function: TPJobSetFreeFunction
|
||||||
*
|
*
|
||||||
@@ -493,7 +439,6 @@ int TPJobSetFreeFunction(ThreadPoolJob *job, free_routine func);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrInit(ThreadPoolAttr *attr);
|
int TPAttrInit(ThreadPoolAttr *attr);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetMaxThreads
|
* Function: TPAttrSetMaxThreads
|
||||||
*
|
*
|
||||||
@@ -507,7 +452,6 @@ int TPAttrInit(ThreadPoolAttr *attr);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetMinThreads
|
* Function: TPAttrSetMinThreads
|
||||||
*
|
*
|
||||||
@@ -521,7 +465,6 @@ int TPAttrSetMaxThreads(ThreadPoolAttr *attr, int maxThreads);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetIdleTime
|
* Function: TPAttrSetIdleTime
|
||||||
*
|
*
|
||||||
@@ -534,7 +477,6 @@ int TPAttrSetMinThreads(ThreadPoolAttr *attr, int minThreads);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetJobsPerThread
|
* Function: TPAttrSetJobsPerThread
|
||||||
*
|
*
|
||||||
@@ -548,7 +490,6 @@ int TPAttrSetIdleTime(ThreadPoolAttr *attr, int idleTime);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetStarvationTime
|
* Function: TPAttrSetStarvationTime
|
||||||
*
|
*
|
||||||
@@ -562,7 +503,6 @@ int TPAttrSetJobsPerThread(ThreadPoolAttr *attr, int jobsPerThread);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime);
|
int TPAttrSetStarvationTime(ThreadPoolAttr *attr, int starvationTime);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: TPAttrSetSchedPolicy
|
* Function: TPAttrSetSchedPolicy
|
||||||
*
|
*
|
||||||
@@ -590,7 +530,6 @@ int TPAttrSetSchedPolicy(ThreadPoolAttr *attr, PolicyType schedPolicy);
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ThreadPoolGetStats
|
* Function: ThreadPoolGetStats
|
||||||
*
|
*
|
||||||
@@ -605,20 +544,18 @@ int TPAttrSetMaxJobsTotal(ThreadPoolAttr *attr, int maxJobsTotal);
|
|||||||
* Always returns 0.
|
* Always returns 0.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef STATS
|
#ifdef STATS
|
||||||
EXPORT_SPEC int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
EXPORT int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats);
|
||||||
|
|
||||||
EXPORT_SPEC void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
EXPORT void ThreadPoolPrintStats(ThreadPoolStats *stats);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
static UPNP_INLINE int ThreadPoolGetStats(ThreadPool *tp, ThreadPoolStats *stats) {}
|
||||||
|
|
||||||
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
static UPNP_INLINE void ThreadPoolPrintStats(ThreadPoolStats *stats) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* ThreadPool */
|
||||||
#endif /* THREADPOOL_H */
|
|
||||||
|
|
||||||
|
|||||||
66
threadutil/inc/iasnprintf.h
Normal file
66
threadutil/inc/iasnprintf.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
*
|
||||||
|
* 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
|
||||||
@@ -29,42 +29,22 @@
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ITHREADH
|
||||||
#ifndef ITHREAD_H
|
#define ITHREADH
|
||||||
#define ITHREAD_H
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "UpnpGlobal.h" /* For UPNP_INLINE, EXPORT_SPEC */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#ifdef WIN32
|
#ifndef WIN32
|
||||||
/* Do not #include <unistd.h> */
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
#if defined(BSD)
|
|
||||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef PTHREAD_MUTEX_RECURSIVE
|
#ifdef PTHREAD_MUTEX_RECURSIVE
|
||||||
/* This system has SuS2-compliant mutex attributes.
|
/* This system has SuS2-compliant mutex attributes.
|
||||||
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
|
||||||
@@ -96,7 +76,6 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_t ithread_t;
|
typedef pthread_t ithread_t;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: ithread_attr_t
|
* Name: ithread_attr_t
|
||||||
*
|
*
|
||||||
@@ -184,95 +163,6 @@ typedef pthread_rwlockattr_t ithread_rwlockattr_t;
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
typedef pthread_rwlock_t ithread_rwlock_t;
|
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
|
* Function: ithread_mutexattr_init
|
||||||
*
|
*
|
||||||
@@ -609,6 +499,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
#define ithread_cond_init pthread_cond_init
|
#define ithread_cond_init pthread_cond_init
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_cond_signal
|
* Function: ithread_cond_signal
|
||||||
*
|
*
|
||||||
@@ -668,18 +559,22 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
* Function: pthread_cond_timedwait
|
* Function: pthread_cond_timedwait
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Atomically releases the associated mutex and waits on the
|
* Atomically releases the associated mutex and waits on the condition.
|
||||||
* condition.
|
* If the condition is not signaled in the specified time
|
||||||
* If the condition is not signaled in the specified time than the
|
* than the
|
||||||
* call times out and returns.
|
* call times out and returns.
|
||||||
* Associated mutex MUST be locked by thread before entering this call.
|
* Associated mutex MUST be locked by thread before entering
|
||||||
|
* this call.
|
||||||
* Mutex is reacquired when call returns.
|
* Mutex is reacquired when call returns.
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ithread_cond_t *cond (must be valid non NULL pointer to ithread_cond_t)
|
* ithread_cond_t * cond (must be valid non NULL pointer to
|
||||||
|
* ithread_cond_t)
|
||||||
* cond must be initialized
|
* cond must be initialized
|
||||||
* ithread_mutex_t *mutex (must be valid non NULL pointer to ithread_mutex_t)
|
* ithread_mutex_t *mutex (must be valid non NULL pointer to
|
||||||
|
* ithread_mutex_t)
|
||||||
* Mutex must be locked.
|
* Mutex must be locked.
|
||||||
* const struct timespec *abstime (absolute time, measured from Jan 1, 1970)
|
* const struct timespec *abstime (absolute time, measured
|
||||||
|
* from Jan 1, 1970)
|
||||||
* Returns:
|
* Returns:
|
||||||
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
* 0 on success. ETIMEDOUT on timeout. Nonzero on failure.
|
||||||
* See man page for pthread_cond_timedwait
|
* See man page for pthread_cond_timedwait
|
||||||
@@ -751,7 +646,6 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_exit pthread_exit
|
#define ithread_exit pthread_exit
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_get_current_thread_id
|
* Function: ithread_get_current_thread_id
|
||||||
*
|
*
|
||||||
@@ -775,7 +669,6 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_self pthread_self
|
#define ithread_self pthread_self
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_detach
|
* Function: ithread_detach
|
||||||
*
|
*
|
||||||
@@ -789,7 +682,6 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
#define ithread_detach pthread_detach
|
#define ithread_detach pthread_detach
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: ithread_join
|
* Function: ithread_join
|
||||||
*
|
*
|
||||||
@@ -809,6 +701,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
#define ithread_join pthread_join
|
#define ithread_join pthread_join
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
*
|
*
|
||||||
@@ -822,12 +715,7 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
* 0 on success, Nonzero on failure.
|
* 0 on success, Nonzero on failure.
|
||||||
* See man page for sleep (man 3 sleep)
|
* See man page for sleep (man 3 sleep)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef WIN32
|
|
||||||
#define isleep(x) Sleep((x)*1000)
|
|
||||||
#else
|
|
||||||
#define isleep sleep
|
#define isleep sleep
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: isleep
|
* Function: isleep
|
||||||
@@ -842,10 +730,21 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
* 0 on success, Nonzero on failure.
|
* 0 on success, Nonzero on failure.
|
||||||
* See man page for sleep (man 3 sleep)
|
* See man page for sleep (man 3 sleep)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef WIN32
|
|
||||||
#define imillisleep Sleep
|
|
||||||
#else
|
|
||||||
#define imillisleep(x) usleep(1000*x)
|
#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
|
||||||
|
#else
|
||||||
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -854,11 +753,9 @@ static UPNP_INLINE int ithread_cleanup_thread(void) {
|
|||||||
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* ITHREADH */
|
||||||
#endif /* ITHREAD_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "LinkedList.h"
|
#include "LinkedList.h"
|
||||||
#ifndef WIN32
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__)
|
||||||
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__) || defined(__APPLE__)
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@@ -534,4 +532,3 @@ ListSize( LinkedList * list )
|
|||||||
|
|
||||||
return list->size;
|
return list->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
153
threadutil/src/iasnprintf.c
Normal file
153
threadutil/src/iasnprintf.c
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#if (defined(BSD) && BSD >= 199306) || defined(__OSX__)
|
||||||
|
#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;
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# "Makefile.am" for "libupnp/upnp"
|
# "Makefile.am" for "libupnp/upnp"
|
||||||
#
|
#
|
||||||
# Copyright (C) 2005 Rémi Turboult <r3mi@users.sourceforge.net>
|
# Copyright (C) 2005 R<EFBFBD>mi Turboult <r3mi@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
|
|
||||||
SUBDIRS = doc . sample
|
SUBDIRS = doc . sample
|
||||||
@@ -11,6 +11,10 @@ AM_CPPFLAGS = \
|
|||||||
-I$(top_srcdir)/threadutil/inc \
|
-I$(top_srcdir)/threadutil/inc \
|
||||||
-I$(top_srcdir)/ixml/inc
|
-I$(top_srcdir)/ixml/inc
|
||||||
|
|
||||||
|
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||||
|
|
||||||
|
AM_LDFLAGS = $(PTHREAD_LIBS)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
libupnp.la \
|
libupnp.la \
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
@@ -19,11 +23,8 @@ LDADD = \
|
|||||||
|
|
||||||
upnpincludedir = $(includedir)/upnp
|
upnpincludedir = $(includedir)/upnp
|
||||||
upnpinclude_HEADERS = \
|
upnpinclude_HEADERS = \
|
||||||
inc/UpnpString.h \
|
|
||||||
inc/upnp.h \
|
inc/upnp.h \
|
||||||
inc/upnpdebug.h \
|
inc/upnpdebug.h
|
||||||
inc/UpnpGlobal.h \
|
|
||||||
inc/UpnpInet.h
|
|
||||||
|
|
||||||
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
nodist_upnpinclude_HEADERS = inc/upnpconfig.h
|
||||||
if ENABLE_TOOLS
|
if ENABLE_TOOLS
|
||||||
@@ -49,6 +50,7 @@ libupnp_la_SOURCES = \
|
|||||||
src/inc/gena_device.h \
|
src/inc/gena_device.h \
|
||||||
src/inc/global.h \
|
src/inc/global.h \
|
||||||
src/inc/gmtdate.h \
|
src/inc/gmtdate.h \
|
||||||
|
src/inc/http_client.h \
|
||||||
src/inc/httpparser.h \
|
src/inc/httpparser.h \
|
||||||
src/inc/httpreadwrite.h \
|
src/inc/httpreadwrite.h \
|
||||||
src/inc/md5.h \
|
src/inc/md5.h \
|
||||||
@@ -74,7 +76,6 @@ libupnp_la_SOURCES = \
|
|||||||
src/inc/util.h \
|
src/inc/util.h \
|
||||||
src/inc/utilall.h \
|
src/inc/utilall.h \
|
||||||
src/inc/uuid.h \
|
src/inc/uuid.h \
|
||||||
src/inc/VirtualDir.h \
|
|
||||||
src/inc/webserver.h
|
src/inc/webserver.h
|
||||||
|
|
||||||
# ssdp
|
# ssdp
|
||||||
@@ -113,14 +114,10 @@ libupnp_la_SOURCES += \
|
|||||||
src/gena/gena_callback2.c
|
src/gena/gena_callback2.c
|
||||||
|
|
||||||
# api
|
# api
|
||||||
libupnp_la_SOURCES += \
|
libupnp_la_SOURCES += src/api/upnpapi.c
|
||||||
src/api/UpnpString.c \
|
|
||||||
src/api/upnpapi.c
|
|
||||||
|
|
||||||
if ENABLE_TOOLS
|
if ENABLE_TOOLS
|
||||||
libupnp_la_SOURCES += src/api/upnptools.c
|
libupnp_la_SOURCES += src/api/upnptools.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_DEBUG
|
if ENABLE_DEBUG
|
||||||
libupnp_la_SOURCES += src/api/upnpdebug.c
|
libupnp_la_SOURCES += src/api/upnpdebug.c
|
||||||
endif
|
endif
|
||||||
@@ -137,12 +134,6 @@ libupnp_la_SOURCES += \
|
|||||||
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
libupnp_la_SOURCES += src/urlconfig/urlconfig.c
|
||||||
|
|
||||||
|
|
||||||
# inet_pton (needed on Win32, compiles to nothing elsewhere)
|
|
||||||
libupnp_la_SOURCES += \
|
|
||||||
src/inet_pton.c \
|
|
||||||
src/inc/inet_pton.h
|
|
||||||
|
|
||||||
|
|
||||||
# check / distcheck tests
|
# check / distcheck tests
|
||||||
check_PROGRAMS = test_init
|
check_PROGRAMS = test_init
|
||||||
TESTS = test_init
|
TESTS = test_init
|
||||||
@@ -151,7 +142,8 @@ test_init_SOURCES = test/test_init.c
|
|||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
m4/libupnp.m4 \
|
src/inc/inet_pton.h \
|
||||||
|
src/inet_pton.c \
|
||||||
src/win_dll.c
|
src/win_dll.c
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#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 */
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#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 */
|
|
||||||
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#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 */
|
|
||||||
|
|
||||||
3663
upnp/inc/upnp.h
3663
upnp/inc/upnp.h
File diff suppressed because it is too large
Load Diff
@@ -7,12 +7,12 @@
|
|||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
* * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
* * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -33,34 +33,25 @@
|
|||||||
#ifndef UPNP_DEBUG_H
|
#ifndef UPNP_DEBUG_H
|
||||||
#define UPNP_DEBUG_H
|
#define UPNP_DEBUG_H
|
||||||
|
|
||||||
|
#include "upnp.h"
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ThreadPool.h"
|
|
||||||
#include "upnpconfig.h"
|
#include "upnpconfig.h"
|
||||||
#include "UpnpGlobal.h" /* for UPNP_INLINE */
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** \name Other debugging features
|
/** @name Other debugging features
|
||||||
*
|
The UPnP SDK contains other features to aid in debugging.
|
||||||
* The UPnP SDK contains other features to aid in debugging.
|
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
|
||||||
|
|
||||||
/** \name Upnp_LogLevel
|
/*! @{ */
|
||||||
|
|
||||||
|
/** @name Upnp_LogLevel
|
||||||
* The user has the option to select 4 different types of debugging levels,
|
* The user has the option to select 4 different types of debugging levels,
|
||||||
* see \c UpnpSetLogLevel.
|
* see {\tt UpnpSetLogLevel}.
|
||||||
* The critical level will show only those messages
|
* The critical level will show only those messages
|
||||||
* which can halt the normal processing of the library, like memory
|
* which can halt the normal processing of the library, like memory
|
||||||
* allocation errors. The remaining three levels are just for debugging
|
* allocation errors. The remaining three levels are just for debugging
|
||||||
@@ -69,11 +60,14 @@ extern "C" {
|
|||||||
* Info Level displays the other important operational information
|
* Info Level displays the other important operational information
|
||||||
* regarding the working of the library. If the user selects All,
|
* regarding the working of the library. If the user selects All,
|
||||||
* then the library displays all the debugging information that it has.
|
* then the library displays all the debugging information that it has.
|
||||||
* \li \c UPNP_CRITICAL [0]
|
* \begin{itemize}
|
||||||
* \li \c UPNP_PACKET [1]
|
* \item {\tt UPNP_CRITICAL [0]}
|
||||||
* \li \c UPNP_INFO [2]
|
* \item {\tt UPNP_PACKET [1]}
|
||||||
* \li \c UPNP_ALL [3]
|
* \item {\tt UPNP_INFO [2]}
|
||||||
|
* \item {\tt UPNP_ALL [3]}
|
||||||
|
* \end{itemize}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum Upnp_Module {
|
typedef enum Upnp_Module {
|
||||||
SSDP,
|
SSDP,
|
||||||
SOAP,
|
SOAP,
|
||||||
@@ -85,69 +79,91 @@ typedef enum Upnp_Module {
|
|||||||
HTTP
|
HTTP
|
||||||
} Dbg_Module;
|
} Dbg_Module;
|
||||||
|
|
||||||
|
/*! @{ */
|
||||||
/*@{*/
|
|
||||||
typedef enum Upnp_LogLevel_e {
|
typedef enum Upnp_LogLevel_e {
|
||||||
UPNP_CRITICAL,
|
UPNP_CRITICAL,
|
||||||
UPNP_PACKET,
|
UPNP_PACKET,
|
||||||
UPNP_INFO,
|
UPNP_INFO,
|
||||||
UPNP_ALL
|
UPNP_ALL
|
||||||
} Upnp_LogLevel;
|
} Upnp_LogLevel;
|
||||||
/*@}*/
|
/*! @} */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default log level : see \c Upnp_LogLevel
|
* Default log level : see {\tt Upnp_LogLevel}
|
||||||
*/
|
*/
|
||||||
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
#define UPNP_DEFAULT_LOG_LEVEL UPNP_ALL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Initialize the log files.
|
* Function : UpnpInitLog
|
||||||
*
|
*
|
||||||
* \return -1 if fails or UPNP_E_SUCCESS if succeeds.
|
* Parameters: void
|
||||||
*/
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions initializes the log files
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* -1 : If fails
|
||||||
|
* UPNP_E_SUCCESS : if success
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int UpnpInitLog(void);
|
int UpnpInitLog();
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE int UpnpInitLog(void)
|
static UPNP_INLINE int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
||||||
{
|
|
||||||
return UPNP_E_SUCCESS;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Set the log level (see \c Upnp_LogLevel).
|
* Function : UpnpSetLogLevel
|
||||||
*/
|
*
|
||||||
|
* Parameters: Upnp_LogLevel log_level
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpSetLogLevel(
|
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
||||||
/*! [in] Log level. */
|
|
||||||
Upnp_LogLevel log_level);
|
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Closes the log files.
|
* Function : UpnpCloseLog
|
||||||
*/
|
*
|
||||||
|
* Parameters: void
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions closes the log files
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpCloseLog(void);
|
void UpnpCloseLog();
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpCloseLog(void) {}
|
static UPNP_INLINE void UpnpCloseLog() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Set the name for error and information files, respectively.
|
* 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
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpSetLogFileNames(
|
void UpnpSetLogFileNames(
|
||||||
/*! [in] Name of the error file. */
|
|
||||||
const char *ErrFileName,
|
const char *ErrFileName,
|
||||||
/*! [in] Name of the information file. */
|
|
||||||
const char *InfoFileName);
|
const char *InfoFileName);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpSetLogFileNames(
|
static UPNP_INLINE void UpnpSetLogFileNames(
|
||||||
@@ -156,20 +172,24 @@ static UPNP_INLINE void UpnpSetLogFileNames(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Check if the module is turned on for debug and returns the file
|
* Function : UpnpGetDebugFile
|
||||||
* descriptor corresponding to the debug level
|
|
||||||
*
|
*
|
||||||
* \return NULL if the module is turn off for debug otheriwse returns the
|
* Parameters:
|
||||||
* right file descriptor.
|
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
||||||
*/
|
* whether debug statement will go to standard output,
|
||||||
|
* or any of the log files.
|
||||||
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function checks if the module is turned on for debug
|
||||||
|
* and returns the file descriptor corresponding to the debug level
|
||||||
|
* Returns: FILE *
|
||||||
|
* NULL : if the module is turn off for debug
|
||||||
|
* else returns the right file descriptor
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
FILE *UpnpGetDebugFile(
|
FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module);
|
||||||
/*! [in] The level of the debug logging. It will decide whether debug
|
|
||||||
* statement will go to standard output, or any of the log files. */
|
|
||||||
Upnp_LogLevel level,
|
|
||||||
/*! [in] debug will go in the name of this module. */
|
|
||||||
Dbg_Module module);
|
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
||||||
{
|
{
|
||||||
@@ -178,47 +198,60 @@ static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Returns true if debug output should be done in this module.
|
* Function : DebugAtThisLevel
|
||||||
*
|
*
|
||||||
* \return Nonzero value if true, zero if false.
|
* Parameters:
|
||||||
*/
|
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
||||||
|
* whether debug statement will go to standard output,
|
||||||
|
* or any of the log files.
|
||||||
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions returns true if debug output should be done in this
|
||||||
|
* module.
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int DebugAtThisLevel(
|
int DebugAtThisLevel(
|
||||||
/*! [in] The level of the debug logging. It will decide whether debug
|
IN Upnp_LogLevel DLevel,
|
||||||
* statement will go to standard output, or any of the log files. */
|
IN Dbg_Module Module);
|
||||||
Upnp_LogLevel DLevel,
|
|
||||||
/*! [in] Debug will go in the name of this module. */
|
|
||||||
Dbg_Module Module);
|
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE int DebugAtThisLevel(
|
static UPNP_INLINE int DebugAtThisLevel(
|
||||||
Upnp_LogLevel DLevel,
|
IN Upnp_LogLevel DLevel,
|
||||||
Dbg_Module Module)
|
IN Dbg_Module Module) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Prints the debug statement either on the standard output or log file
|
* Function : UpnpPrintf
|
||||||
* along with the information from where this debug statement is coming.
|
*
|
||||||
*/
|
* Parameters:
|
||||||
|
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
||||||
|
* whether debug statement will go to standard output,
|
||||||
|
* or any of the log files.
|
||||||
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
|
* IN char *DbgFileName: Name of the file from where debug statement is
|
||||||
|
* coming
|
||||||
|
* IN int DbgLineNo : Line number of the file from where debug statement
|
||||||
|
* is coming
|
||||||
|
* IN char * FmtStr, ...: Variable number of arguments that will go
|
||||||
|
* in the debug statement
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions prints the debug statement either on the startdard
|
||||||
|
* output or log file along with the information from where this
|
||||||
|
* debug statement is coming
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpPrintf(
|
void UpnpPrintf(
|
||||||
/*! [in] The level of the debug logging. It will decide whether debug
|
|
||||||
* statement will go to standard output, or any of the log files. */
|
|
||||||
Upnp_LogLevel DLevel,
|
Upnp_LogLevel DLevel,
|
||||||
/*! [in] debug will go in the name of this module. */
|
|
||||||
Dbg_Module Module,
|
Dbg_Module Module,
|
||||||
/*! [in] Name of the file from where debug statement is coming. */
|
|
||||||
const char* DbgFileName,
|
const char* DbgFileName,
|
||||||
/*! [in] Line number of the file from where debug statement is coming. */
|
|
||||||
int DbgLineNo,
|
int DbgLineNo,
|
||||||
/*! [in] Printf like format specification. */
|
|
||||||
const char* FmtStr,
|
const char* FmtStr,
|
||||||
/*! [in] Printf like Variable number of arguments that will go in the debug
|
|
||||||
* statement. */
|
|
||||||
...)
|
...)
|
||||||
#if (__GNUC__ >= 3)
|
#if (__GNUC__ >= 3)
|
||||||
/* This enables printf like format checking by the compiler */
|
/* This enables printf like format checking by the compiler */
|
||||||
@@ -232,44 +265,29 @@ static UPNP_INLINE void UpnpPrintf(
|
|||||||
const char* DbgFileName,
|
const char* DbgFileName,
|
||||||
int DbgLineNo,
|
int DbgLineNo,
|
||||||
const char* FmtStr,
|
const char* FmtStr,
|
||||||
...)
|
...) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Writes the file name and file number from where debug statement is
|
* Function : UpnpDisplayBanner
|
||||||
* coming to the log file.
|
*
|
||||||
*/
|
* Parameters:
|
||||||
#ifdef DEBUG
|
* IN FILE *fd: file descriptor where the banner will be written
|
||||||
void UpnpDisplayFileAndLine(
|
* IN char **lines: The buffer that will be written
|
||||||
/*! [in] File descriptor where line number and file name will be written. */
|
* IN int size: Size of the buffer
|
||||||
FILE *fd,
|
* IN int starLength: This parameter provides the width of the banner
|
||||||
/*! [in] Name of the file. */
|
*
|
||||||
const char *DbgFileName,
|
* Description:
|
||||||
/*! [in] Line number of the file. */
|
* This functions takes the buffer and writes the buffer in the file as
|
||||||
int DbgLineNo);
|
* per the requested banner
|
||||||
#else
|
* Returns: void
|
||||||
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
***************************************************************************/
|
||||||
FILE *fd,
|
|
||||||
const char *DbgFileName,
|
|
||||||
int DbgLineNo) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Writes the buffer in the file as per the requested banner
|
|
||||||
*/
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpDisplayBanner(
|
void UpnpDisplayBanner(
|
||||||
/*! [in] file descriptor where the banner will be written. */
|
|
||||||
FILE *fd,
|
FILE *fd,
|
||||||
/*! [in] The buffer that will be written. */
|
|
||||||
const char **lines,
|
const char **lines,
|
||||||
/*! [in] Size of the buffer. */
|
|
||||||
size_t size,
|
size_t size,
|
||||||
/*! [in] This parameter provides the width of the banner. */
|
|
||||||
int starlength);
|
int starlength);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void UpnpDisplayBanner(
|
static UPNP_INLINE void UpnpDisplayBanner(
|
||||||
@@ -280,49 +298,33 @@ static UPNP_INLINE void UpnpDisplayBanner(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/***************************************************************************
|
||||||
* \brief Prints thread pool statistics.
|
* Function : UpnpDisplayFileAndLine
|
||||||
*/
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN FILE *fd: File descriptor where line number and file name will be
|
||||||
|
* written
|
||||||
|
* IN char *DbgFileName: Name of the file
|
||||||
|
* IN int DbgLineNo : Line number of the file
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function writes the file name and file number from where
|
||||||
|
* debug statement is coming to the log file
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void PrintThreadPoolStats(
|
void UpnpDisplayFileAndLine(
|
||||||
/*! [in] The thread pool. */
|
FILE *fd,
|
||||||
ThreadPool *tp,
|
|
||||||
/*! [in] The file name that called this function, use the macro __FILE__. */
|
|
||||||
const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
/*! [in] The line number that the function was called, use the macro __LINE__. */
|
int DbgLineNo);
|
||||||
int DbgLineNo,
|
|
||||||
/*! [in] The message. */
|
|
||||||
const char *msg);
|
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void PrintThreadPoolStats(
|
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
||||||
ThreadPool *tp,
|
FILE *fd,
|
||||||
const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
int DbgLineNo,
|
int DbgLineNo) {}
|
||||||
const char *msg)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
#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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,97 +0,0 @@
|
|||||||
# -*- 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
|
|
||||||
])
|
|
||||||
@@ -9,6 +9,10 @@ AM_CPPFLAGS = \
|
|||||||
-I$(top_srcdir)/threadutil/inc \
|
-I$(top_srcdir)/threadutil/inc \
|
||||||
-I$(top_srcdir)/ixml/inc
|
-I$(top_srcdir)/ixml/inc
|
||||||
|
|
||||||
|
AM_CFLAGS = $(PTHREAD_CFLAGS)
|
||||||
|
|
||||||
|
AM_LDFLAGS = $(PTHREAD_LIBS)
|
||||||
|
|
||||||
LDADD = \
|
LDADD = \
|
||||||
$(top_builddir)/upnp/libupnp.la \
|
$(top_builddir)/upnp/libupnp.la \
|
||||||
$(top_builddir)/threadutil/libthreadutil.la \
|
$(top_builddir)/threadutil/libthreadutil.la \
|
||||||
@@ -69,9 +73,8 @@ upnp_tv_combo_SOURCES = \
|
|||||||
if WITH_DOCUMENTATION
|
if WITH_DOCUMENTATION
|
||||||
examplesdir = $(docdir)/examples
|
examplesdir = $(docdir)/examples
|
||||||
examples_DATA = \
|
examples_DATA = \
|
||||||
$(sort \
|
|
||||||
$(upnp_tv_ctrlpt_SOURCES) \
|
$(upnp_tv_ctrlpt_SOURCES) \
|
||||||
$(upnp_tv_device_SOURCES))
|
$(upnp_tv_device_SOURCES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34,21 +34,19 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "upnptools.h"
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
#include "upnptools.h"
|
|
||||||
|
|
||||||
|
|
||||||
//mutex to control displaying of events
|
//mutex to control displaying of events
|
||||||
extern ithread_mutex_t display_mutex ;
|
extern ithread_mutex_t display_mutex ;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
STATE_UPDATE = 0,
|
STATE_UPDATE = 0,
|
||||||
DEVICE_ADDED =1,
|
DEVICE_ADDED =1,
|
||||||
@@ -164,13 +162,9 @@ int SampleUtil_PrintEvent(IN Upnp_EventType EventType,
|
|||||||
* controlURL -- OUT -- The control URL for the service
|
* controlURL -- OUT -- The control URL for the service
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int SampleUtil_FindAndParseService (
|
int SampleUtil_FindAndParseService (IN IXML_Document *DescDoc, IN char* location,
|
||||||
IN IXML_Document *DescDoc,
|
IN char *serviceType, OUT char **serviceId,
|
||||||
IN const char *location,
|
OUT char **eventURL, OUT char **controlURL);
|
||||||
IN char *serviceType,
|
|
||||||
OUT char **serviceId,
|
|
||||||
OUT char **eventURL,
|
|
||||||
OUT char **controlURL);
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
@@ -202,10 +196,7 @@ extern print_string gPrintFun;
|
|||||||
* const char * UDN
|
* const char * UDN
|
||||||
* int newDevice
|
* int newDevice
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
typedef void (*state_update)(
|
typedef void (*state_update)( const char *varName, const char *varValue, const char *UDN,
|
||||||
const char *varName,
|
|
||||||
const char *varValue,
|
|
||||||
const char *UDN,
|
|
||||||
eventType type);
|
eventType type);
|
||||||
|
|
||||||
//global state update function used by smaple util
|
//global state update function used by smaple util
|
||||||
@@ -233,7 +224,7 @@ int SampleUtil_Initialize(print_string print_function);
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int SampleUtil_Finish();
|
int SampleUtil_Finish(void);
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* SampleUtil_Print
|
* SampleUtil_Print
|
||||||
@@ -267,22 +258,11 @@ int SampleUtil_RegisterUpdateFunction(state_update update_function);
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void SampleUtil_StateUpdate(
|
void SampleUtil_StateUpdate( const char *varName, const char *varValue, const char *UDN,
|
||||||
const char *varName,
|
|
||||||
const char *varValue,
|
|
||||||
const char *UDN,
|
|
||||||
eventType type);
|
eventType type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define strcasecmp stricmp
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* UPNPSDK_UTIL_H */
|
||||||
#endif /* SAMPLE_UTIL_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "sample_util.h"
|
#include "sample_util.h"
|
||||||
@@ -130,8 +130,7 @@ TvCtrlPointPrintLongHelp( void )
|
|||||||
SampleUtil_Print( "" );
|
SampleUtil_Print( "" );
|
||||||
SampleUtil_Print( "This sample control point application automatically searches" );
|
SampleUtil_Print( "This sample control point application automatically searches" );
|
||||||
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
||||||
SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." );
|
SampleUtil_Print( "devices. While registers a tv device itself." );
|
||||||
SampleUtil_Print( "It also registers itself as a tv device." );
|
|
||||||
SampleUtil_Print( "" );
|
SampleUtil_Print( "" );
|
||||||
SampleUtil_Print( "Commands:" );
|
SampleUtil_Print( "Commands:" );
|
||||||
SampleUtil_Print( " Help" );
|
SampleUtil_Print( " Help" );
|
||||||
@@ -450,18 +449,17 @@ device_main( int argc, char **argv )
|
|||||||
|
|
||||||
port = ( unsigned short )portTemp;
|
port = ( unsigned short )portTemp;
|
||||||
|
|
||||||
return TvDeviceStart( ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
return TvDeviceStart(
|
||||||
|
ip_address, port, desc_doc_name, web_dir_path, linux_print );
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int
|
||||||
|
main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ithread_t cmdloop_thread;
|
ithread_t cmdloop_thread;
|
||||||
#ifdef WIN32
|
|
||||||
#else
|
|
||||||
int sig;
|
int sig;
|
||||||
sigset_t sigs_to_catch;
|
sigset_t sigs_to_catch;
|
||||||
#endif
|
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
device_main(argc, argv);
|
device_main(argc, argv);
|
||||||
@@ -470,12 +468,11 @@ int main( int argc, char **argv )
|
|||||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/* start a command loop thread */
|
// start a command loop thread
|
||||||
code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL );
|
code =
|
||||||
|
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
||||||
|
NULL );
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
ithread_join(cmdloop_thread, NULL);
|
|
||||||
#else
|
|
||||||
/*
|
/*
|
||||||
Catch Ctrl-C and properly shutdown
|
Catch Ctrl-C and properly shutdown
|
||||||
*/
|
*/
|
||||||
@@ -483,9 +480,10 @@ int main( int argc, char **argv )
|
|||||||
sigaddset( &sigs_to_catch, SIGINT );
|
sigaddset( &sigs_to_catch, SIGINT );
|
||||||
sigwait( &sigs_to_catch, &sig );
|
sigwait( &sigs_to_catch, &sig );
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
||||||
#endif
|
|
||||||
TvDeviceStop();
|
TvDeviceStop();
|
||||||
rc = TvCtrlPointStop();
|
rc = TvCtrlPointStop();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
#include "upnp_tv_ctrlpt.h"
|
||||||
|
|
||||||
@@ -138,10 +138,11 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
|
|||||||
* UDN -- The Unique Device Name for the device to remove
|
* UDN -- The Unique Device Name for the device to remove
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int TvCtrlPointRemoveDevice(const char *UDN)
|
int
|
||||||
|
TvCtrlPointRemoveDevice( char *UDN )
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *curdevnode;
|
struct TvDeviceNode *curdevnode,
|
||||||
struct TvDeviceNode *prevdevnode;
|
*prevdevnode;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
@@ -668,7 +669,7 @@ TvCtrlPointPrintDevice( int devnum )
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void
|
||||||
TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
||||||
const char *location,
|
char *location,
|
||||||
int expires )
|
int expires )
|
||||||
{
|
{
|
||||||
char *deviceType = NULL;
|
char *deviceType = NULL;
|
||||||
@@ -681,19 +682,20 @@ TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
|||||||
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
||||||
int TimeOut[TV_SERVICE_SERVCOUNT] = {
|
int TimeOut[TV_SERVICE_SERVCOUNT] =
|
||||||
default_timeout,
|
{ default_timeout, default_timeout };
|
||||||
default_timeout };
|
|
||||||
struct TvDeviceNode *deviceNode;
|
struct TvDeviceNode *deviceNode;
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int service;
|
int service,
|
||||||
int var;
|
var;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
/* Read key elements from description document */
|
/*
|
||||||
|
Read key elements from description document
|
||||||
|
*/
|
||||||
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
||||||
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
||||||
friendlyName =
|
friendlyName =
|
||||||
@@ -701,8 +703,9 @@ TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
|||||||
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
||||||
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
||||||
|
|
||||||
ret = UpnpResolveURL(
|
ret =
|
||||||
( baseURL ? baseURL : location ), relURL, presURL);
|
UpnpResolveURL( ( baseURL ? baseURL : location ), relURL,
|
||||||
|
presURL );
|
||||||
|
|
||||||
if( UPNP_E_SUCCESS != ret )
|
if( UPNP_E_SUCCESS != ret )
|
||||||
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
||||||
@@ -936,8 +939,8 @@ TvStateUpdate( char *UDN,
|
|||||||
* changes -- The DOM document representing the changes
|
* changes -- The DOM document representing the changes
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void TvCtrlPointHandleEvent(
|
void
|
||||||
const Upnp_SID sid,
|
TvCtrlPointHandleEvent( Upnp_SID sid,
|
||||||
int evntkey,
|
int evntkey,
|
||||||
IXML_Document * changes )
|
IXML_Document * changes )
|
||||||
{
|
{
|
||||||
@@ -948,17 +951,15 @@ void TvCtrlPointHandleEvent(
|
|||||||
|
|
||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while( tmpdevnode ) {
|
while( tmpdevnode ) {
|
||||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) {
|
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
||||||
if(strcmp(tmpdevnode->device.TvService[service].SID, sid) == 0) {
|
if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) ==
|
||||||
|
0 ) {
|
||||||
SampleUtil_Print( "Received Tv %s Event: %d for SID %s",
|
SampleUtil_Print( "Received Tv %s Event: %d for SID %s",
|
||||||
TvServiceName[service],
|
TvServiceName[service], evntkey, sid );
|
||||||
evntkey,
|
|
||||||
sid );
|
TvStateUpdate( tmpdevnode->device.UDN, service, changes,
|
||||||
TvStateUpdate(
|
( char ** )&tmpdevnode->device.
|
||||||
tmpdevnode->device.UDN,
|
TvService[service].VariableStrVal );
|
||||||
service,
|
|
||||||
changes,
|
|
||||||
(char **)&tmpdevnode->device.TvService[service].VariableStrVal);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -982,9 +983,9 @@ void TvCtrlPointHandleEvent(
|
|||||||
* timeout -- The new timeout for the subscription
|
* timeout -- The new timeout for the subscription
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void TvCtrlPointHandleSubscribeUpdate(
|
void
|
||||||
const char *eventURL,
|
TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
||||||
const Upnp_SID sid,
|
Upnp_SID sid,
|
||||||
int timeout )
|
int timeout )
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1013,10 +1014,10 @@ void TvCtrlPointHandleSubscribeUpdate(
|
|||||||
ithread_mutex_unlock( &DeviceListMutex );
|
ithread_mutex_unlock( &DeviceListMutex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TvCtrlPointHandleGetVar(
|
void
|
||||||
const char *controlURL,
|
TvCtrlPointHandleGetVar( char *controlURL,
|
||||||
const char *varName,
|
char *varName,
|
||||||
const DOMString varValue)
|
DOMString varValue )
|
||||||
{
|
{
|
||||||
|
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1027,9 +1028,12 @@ void TvCtrlPointHandleGetVar(
|
|||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while( tmpdevnode ) {
|
while( tmpdevnode ) {
|
||||||
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
||||||
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL) == 0) {
|
if( strcmp
|
||||||
SampleUtil_StateUpdate(
|
( tmpdevnode->device.TvService[service].ControlURL,
|
||||||
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE);
|
controlURL ) == 0 ) {
|
||||||
|
SampleUtil_StateUpdate( varName, varValue,
|
||||||
|
tmpdevnode->device.UDN,
|
||||||
|
GET_VAR_COMPLETE );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1053,130 +1057,179 @@ void TvCtrlPointHandleGetVar(
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* 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 )
|
||||||
{
|
{
|
||||||
/*int errCode = 0;*/
|
|
||||||
|
|
||||||
SampleUtil_PrintEvent( EventType, Event );
|
SampleUtil_PrintEvent( EventType, Event );
|
||||||
|
|
||||||
switch ( EventType ) {
|
switch ( EventType ) {
|
||||||
/* SSDP Stuff */
|
/*
|
||||||
|
SSDP Stuff
|
||||||
|
*/
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||||
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
case UPNP_DISCOVERY_SEARCH_RESULT:
|
||||||
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
{
|
||||||
|
struct Upnp_Discovery *d_event =
|
||||||
|
( struct Upnp_Discovery * )Event;
|
||||||
IXML_Document *DescDoc = NULL;
|
IXML_Document *DescDoc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "Error in Discovery Callback -- %d",
|
||||||
"Error in Discovery Callback -- %d", d_event->ErrCode);
|
d_event->ErrCode );
|
||||||
}
|
}
|
||||||
ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc);
|
|
||||||
if (ret != UPNP_E_SUCCESS) {
|
if( ( ret =
|
||||||
SampleUtil_Print(
|
UpnpDownloadXmlDoc( d_event->Location,
|
||||||
"Error obtaining device description from %s -- error = %d",
|
&DescDoc ) ) !=
|
||||||
|
UPNP_E_SUCCESS ) {
|
||||||
|
SampleUtil_Print
|
||||||
|
( "Error obtaining device description from %s -- error = %d",
|
||||||
d_event->Location, ret );
|
d_event->Location, ret );
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointAddDevice(
|
TvCtrlPointAddDevice( DescDoc, d_event->Location,
|
||||||
DescDoc, d_event->Location, d_event->Expires);
|
d_event->Expires );
|
||||||
}
|
}
|
||||||
if (DescDoc) {
|
|
||||||
|
if( DescDoc )
|
||||||
ixmlDocument_free( DescDoc );
|
ixmlDocument_free( DescDoc );
|
||||||
}
|
|
||||||
TvCtrlPointPrintList( );
|
TvCtrlPointPrintList( );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||||
/* Nothing to do here... */
|
/*
|
||||||
|
Nothing to do here...
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
|
||||||
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 ) {
|
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
|
( "Error in Discovery ByeBye Callback -- %d",
|
||||||
|
d_event->ErrCode );
|
||||||
}
|
}
|
||||||
SampleUtil_Print("Received ByeBye for Device: %s", d_event->DeviceId);
|
|
||||||
|
SampleUtil_Print( "Received ByeBye for Device: %s",
|
||||||
|
d_event->DeviceId );
|
||||||
TvCtrlPointRemoveDevice( d_event->DeviceId );
|
TvCtrlPointRemoveDevice( d_event->DeviceId );
|
||||||
|
|
||||||
SampleUtil_Print( "After byebye:" );
|
SampleUtil_Print( "After byebye:" );
|
||||||
TvCtrlPointPrintList( );
|
TvCtrlPointPrintList( );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* SOAP Stuff */
|
|
||||||
case UPNP_CONTROL_ACTION_COMPLETE: {
|
/*
|
||||||
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 ) {
|
if( a_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Action Complete Callback -- %d", a_event->ErrCode);
|
( "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;
|
break;
|
||||||
}
|
}
|
||||||
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
|
||||||
struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
|
case UPNP_CONTROL_GET_VAR_COMPLETE:
|
||||||
|
{
|
||||||
|
struct Upnp_State_Var_Complete *sv_event =
|
||||||
|
( struct Upnp_State_Var_Complete * )Event;
|
||||||
|
|
||||||
if( sv_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( sv_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Get Var Complete Callback -- %d", sv_event->ErrCode);
|
( "Error in Get Var Complete Callback -- %d",
|
||||||
|
sv_event->ErrCode );
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleGetVar(
|
TvCtrlPointHandleGetVar( sv_event->CtrlUrl,
|
||||||
sv_event->CtrlUrl,
|
|
||||||
sv_event->StateVarName,
|
sv_event->StateVarName,
|
||||||
sv_event->CurrentVal );
|
sv_event->CurrentVal );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* GENA Stuff */
|
|
||||||
case UPNP_EVENT_RECEIVED: {
|
/*
|
||||||
|
GENA Stuff
|
||||||
|
*/
|
||||||
|
case UPNP_EVENT_RECEIVED:
|
||||||
|
{
|
||||||
struct Upnp_Event *e_event = ( struct Upnp_Event * )Event;
|
struct Upnp_Event *e_event = ( struct Upnp_Event * )Event;
|
||||||
|
|
||||||
TvCtrlPointHandleEvent(
|
TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey,
|
||||||
e_event->Sid,
|
|
||||||
e_event->EventKey,
|
|
||||||
e_event->ChangedVariables );
|
e_event->ChangedVariables );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
case UPNP_EVENT_RENEWAL_COMPLETE:
|
||||||
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
{
|
||||||
|
struct Upnp_Event_Subscribe *es_event =
|
||||||
|
( struct Upnp_Event_Subscribe * )Event;
|
||||||
|
|
||||||
if( es_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( es_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Event Subscribe Callback -- %d", es_event->ErrCode);
|
( "Error in Event Subscribe Callback -- %d",
|
||||||
|
es_event->ErrCode );
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleSubscribeUpdate(
|
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||||
es_event->PublisherUrl,
|
PublisherUrl,
|
||||||
es_event->Sid,
|
es_event->Sid,
|
||||||
es_event->TimeOut );
|
es_event->TimeOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
|
||||||
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
{
|
||||||
int TimeOut = default_timeout;
|
int TimeOut = default_timeout;
|
||||||
Upnp_SID newSID;
|
Upnp_SID newSID;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = UpnpSubscribe(
|
struct Upnp_Event_Subscribe *es_event =
|
||||||
ctrlpt_handle,
|
( struct Upnp_Event_Subscribe * )Event;
|
||||||
es_event->PublisherUrl,
|
|
||||||
&TimeOut,
|
ret =
|
||||||
newSID);
|
UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl,
|
||||||
|
&TimeOut, newSID );
|
||||||
|
|
||||||
if( ret == UPNP_E_SUCCESS ) {
|
if( ret == UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
|
SampleUtil_Print( "Subscribed to EventURL with SID=%s",
|
||||||
TvCtrlPointHandleSubscribeUpdate(
|
newSID );
|
||||||
es_event->PublisherUrl,
|
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||||
newSID,
|
PublisherUrl, newSID,
|
||||||
TimeOut );
|
TimeOut );
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print("Error Subscribing to EventURL -- %d", ret);
|
SampleUtil_Print
|
||||||
|
( "Error Subscribing to EventURL -- %d", ret );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* ignore these cases, since this is not a device */
|
|
||||||
|
/*
|
||||||
|
ignore these cases, since this is not a device
|
||||||
|
*/
|
||||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||||
case UPNP_CONTROL_ACTION_REQUEST:
|
case UPNP_CONTROL_ACTION_REQUEST:
|
||||||
@@ -1267,12 +1320,12 @@ TvCtrlPointVerifyTimeouts( int incr )
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
static int TvCtrlPointTimerLoopRun = 1;
|
void *
|
||||||
void *TvCtrlPointTimerLoop(void *args)
|
TvCtrlPointTimerLoop( void *args )
|
||||||
{
|
{
|
||||||
int incr = 30; // how often to verify the timeouts, in seconds
|
int incr = 30; // how often to verify the timeouts, in seconds
|
||||||
|
|
||||||
while (TvCtrlPointTimerLoopRun) {
|
while( 1 ) {
|
||||||
isleep( incr );
|
isleep( incr );
|
||||||
TvCtrlPointVerifyTimeouts( incr );
|
TvCtrlPointVerifyTimeouts( incr );
|
||||||
}
|
}
|
||||||
@@ -1295,11 +1348,13 @@ void *TvCtrlPointTimerLoop(void *args)
|
|||||||
* TV_SUCCESS if everything went well, else TV_ERROR
|
* 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;
|
ithread_t timer_thread;
|
||||||
int rc;
|
int rc;
|
||||||
unsigned short port = 0;
|
short int port = 0;
|
||||||
char *ip_address = NULL;
|
char *ip_address = NULL;
|
||||||
|
|
||||||
SampleUtil_Initialize( printFunctionPtr );
|
SampleUtil_Initialize( printFunctionPtr );
|
||||||
@@ -1307,38 +1362,28 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP
|
|||||||
|
|
||||||
ithread_mutex_init( &DeviceListMutex, 0 );
|
ithread_mutex_init( &DeviceListMutex, 0 );
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "Intializing UPnP with ipaddress=%s port=%d",
|
||||||
"Initializing UPnP Sdk with\n"
|
|
||||||
"\tipaddress = %s port = %u\n",
|
|
||||||
ip_address, port );
|
ip_address, port );
|
||||||
|
|
||||||
rc = UpnpInit( ip_address, port );
|
rc = UpnpInit( ip_address, port );
|
||||||
if (rc != UPNP_E_SUCCESS) {
|
if( UPNP_E_SUCCESS != rc ) {
|
||||||
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
|
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
|
||||||
/*
|
//UpnpFinish( );
|
||||||
UpnpFinish();
|
//return TV_ERROR;
|
||||||
return TV_ERROR;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
if (!ip_address) {
|
|
||||||
ip_address = UpnpGetServerIpAddress();
|
|
||||||
}
|
|
||||||
if (!port) {
|
|
||||||
port = UpnpGetServerPort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print(
|
if( NULL == ip_address )
|
||||||
"UPnP Initialized\n"
|
ip_address = UpnpGetServerIpAddress( );
|
||||||
"\tipaddress= %s port = %u\n",
|
if( 0 == port )
|
||||||
ip_address, port);
|
port = UpnpGetServerPort( );
|
||||||
|
|
||||||
|
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port );
|
||||||
|
|
||||||
SampleUtil_Print( "Registering Control Point" );
|
SampleUtil_Print( "Registering Control Point" );
|
||||||
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,
|
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,
|
||||||
&ctrlpt_handle, &ctrlpt_handle );
|
&ctrlpt_handle, &ctrlpt_handle );
|
||||||
if (rc != UPNP_E_SUCCESS) {
|
if( UPNP_E_SUCCESS != rc ) {
|
||||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return TV_ERROR;
|
return TV_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1346,16 +1391,15 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP
|
|||||||
|
|
||||||
TvCtrlPointRefresh( );
|
TvCtrlPointRefresh( );
|
||||||
|
|
||||||
/* start a timer thread */
|
// start a timer thread
|
||||||
ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL );
|
ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL );
|
||||||
ithread_detach(timer_thread);
|
|
||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TvCtrlPointStop(void)
|
int
|
||||||
|
TvCtrlPointStop( void )
|
||||||
{
|
{
|
||||||
TvCtrlPointTimerLoopRun = 0;
|
|
||||||
TvCtrlPointRemoveAll( );
|
TvCtrlPointRemoveAll( );
|
||||||
UpnpUnRegisterClient( ctrlpt_handle );
|
UpnpUnRegisterClient( ctrlpt_handle );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
@@ -1363,4 +1407,3 @@ int TvCtrlPointStop(void)
|
|||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef UPNP_TV_CTRLPT_H
|
#ifndef UPNP_TV_CTRLPT_H
|
||||||
#define UPNP_TV_CTRLPT_H
|
#define UPNP_TV_CTRLPT_H
|
||||||
@@ -39,9 +39,7 @@ extern "C" {
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#ifndef WIN32
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -112,7 +110,7 @@ extern UpnpClient_Handle ctrlpt_handle;
|
|||||||
|
|
||||||
void TvCtrlPointPrintHelp( void );
|
void TvCtrlPointPrintHelp( void );
|
||||||
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
||||||
int TvCtrlPointRemoveDevice(const char *);
|
int TvCtrlPointRemoveDevice(char*);
|
||||||
int TvCtrlPointRemoveAll( void );
|
int TvCtrlPointRemoveAll( void );
|
||||||
int TvCtrlPointRefresh( void );
|
int TvCtrlPointRefresh( void );
|
||||||
|
|
||||||
@@ -140,11 +138,11 @@ int TvCtrlPointGetBrightness(int);
|
|||||||
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
||||||
int TvCtrlPointPrintList( void );
|
int TvCtrlPointPrintList( void );
|
||||||
int TvCtrlPointPrintDevice(int);
|
int TvCtrlPointPrintDevice(int);
|
||||||
void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
void TvCtrlPointAddDevice (IXML_Document *, char *, int);
|
||||||
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
void TvCtrlPointHandleGetVar(char *,char *,DOMString);
|
||||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
||||||
void TvCtrlPointHandleEvent(const Upnp_SID, int, IXML_Document *);
|
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
||||||
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
||||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||||
void TvCtrlPointVerifyTimeouts(int);
|
void TvCtrlPointVerifyTimeouts(int);
|
||||||
void TvCtrlPointPrintCommands( void );
|
void TvCtrlPointPrintCommands( void );
|
||||||
|
|||||||
@@ -1,47 +1,40 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_device.h"
|
#include "upnp_tv_device.h"
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_WEB_DIR "./web"
|
#define DEFAULT_WEB_DIR "./web"
|
||||||
|
|
||||||
|
|
||||||
#define DESC_URL_SIZE 200
|
#define DESC_URL_SIZE 200
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Device type for tv device
|
Device type for tv device
|
||||||
*/
|
*/
|
||||||
@@ -185,6 +178,7 @@ SetServiceTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SetActionTable( serviceType, out );
|
return SetActionTable( serviceType, out );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -255,6 +249,7 @@ SetActionTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -390,22 +385,19 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|||||||
/*
|
/*
|
||||||
PropSet = NULL;
|
PropSet = NULL;
|
||||||
|
|
||||||
for (j = 0; j< tv_service_table[i].VariableCount; ++j) {
|
for (j=0; j< tv_service_table[i].VariableCount; j++)
|
||||||
|
{
|
||||||
//add each variable to the property set
|
//add each variable to the property set
|
||||||
//for initial state dump
|
//for initial state dump
|
||||||
UpnpAddToPropertySet(
|
UpnpAddToPropertySet(&PropSet,
|
||||||
&PropSet,
|
|
||||||
tv_service_table[i].VariableName[j],
|
tv_service_table[i].VariableName[j],
|
||||||
tv_service_table[i].VariableStrVal[j]);
|
tv_service_table[i].VariableStrVal[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//dump initial state
|
//dump initial state
|
||||||
UpnpAcceptSubscriptionExt(
|
UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,
|
||||||
device_handle,
|
|
||||||
sr_event->UDN,
|
|
||||||
sr_event->ServiceId,
|
sr_event->ServiceId,
|
||||||
PropSet,
|
PropSet,sr_event->Sid);
|
||||||
sr_event->Sid);
|
|
||||||
//free document
|
//free document
|
||||||
Document_free(PropSet);
|
Document_free(PropSet);
|
||||||
|
|
||||||
@@ -426,10 +418,9 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|||||||
|
|
||||||
ithread_mutex_unlock( &TVDevMutex );
|
ithread_mutex_unlock( &TVDevMutex );
|
||||||
|
|
||||||
return 1;
|
return ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceHandleGetVarRequest
|
* TvDeviceHandleGetVarRequest
|
||||||
*
|
*
|
||||||
@@ -446,8 +437,8 @@ int
|
|||||||
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||||
*cgv_event )
|
*cgv_event )
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i = 0,
|
||||||
unsigned int j = 0;
|
j = 0;
|
||||||
int getvar_succeeded = 0;
|
int getvar_succeeded = 0;
|
||||||
|
|
||||||
cgv_event->CurrentVal = NULL;
|
cgv_event->CurrentVal = NULL;
|
||||||
@@ -505,6 +496,7 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
int
|
int
|
||||||
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Defaults if action not found
|
Defaults if action not found
|
||||||
*/
|
*/
|
||||||
@@ -657,6 +649,7 @@ TvDeviceSetServiceTableVar( IN unsigned int service,
|
|||||||
ithread_mutex_unlock( &TVDevMutex );
|
ithread_mutex_unlock( &TVDevMutex );
|
||||||
|
|
||||||
return ( 1 );
|
return ( 1 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -679,7 +672,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
|
|
||||||
if( on != POWER_ON && on != POWER_OFF ) {
|
if( on != POWER_ON && on != POWER_OFF ) {
|
||||||
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
||||||
return 0;
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -690,7 +683,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
||||||
value );
|
value );
|
||||||
|
|
||||||
return ret;
|
return ( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -707,7 +700,9 @@ TvDeviceSetPower( IN int on )
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
( *out ) = NULL;
|
||||||
( *errorString ) = NULL;
|
( *errorString ) = NULL;
|
||||||
@@ -727,6 +722,7 @@ TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **error
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -783,8 +779,11 @@ TvDevicePowerOff( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
@@ -829,6 +828,7 @@ TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **er
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -846,10 +846,13 @@ TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **er
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curchannel,
|
||||||
int newchannel;
|
newchannel;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
@@ -911,9 +914,12 @@ IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, O
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementChannel( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -930,9 +936,12 @@ TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementChannel( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -951,9 +960,13 @@ TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int volume = 0;
|
int volume = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -994,6 +1007,7 @@ TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **err
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1012,7 +1026,10 @@ TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **err
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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,
|
int curvolume,
|
||||||
newvolume;
|
newvolume;
|
||||||
@@ -1049,7 +1066,8 @@ IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT
|
|||||||
TV_CONTROL_VOLUME, value ) ) {
|
TV_CONTROL_VOLUME, value ) ) {
|
||||||
if( UpnpAddToActionResponse( out, actionName,
|
if( UpnpAddToActionResponse( out, actionName,
|
||||||
TvServiceType[TV_SERVICE_CONTROL],
|
TvServiceType[TV_SERVICE_CONTROL],
|
||||||
"Volume", value ) != UPNP_E_SUCCESS ) {
|
"Volume", value ) != UPNP_E_SUCCESS )
|
||||||
|
{
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
@@ -1059,6 +1077,7 @@ IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1075,9 +1094,13 @@ IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementVolume( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1094,9 +1117,13 @@ TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementVolume( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1115,9 +1142,13 @@ TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int color = 0;
|
int color = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1157,6 +1188,7 @@ TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **erro
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1173,11 +1205,16 @@ TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **erro
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
IncrementColor( IN int incr, 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;
|
int curcolor,
|
||||||
int newcolor;
|
newcolor;
|
||||||
|
|
||||||
char *actionName;
|
char *actionName;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1235,8 +1272,11 @@ IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementColor( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1253,8 +1293,11 @@ TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementColor( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1274,9 +1317,13 @@ TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int tint = -1;
|
int tint = -1;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1335,10 +1382,14 @@ TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **error
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curtint,
|
||||||
int newtint;
|
newtint;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1381,6 +1432,7 @@ IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1397,8 +1449,11 @@ IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementTint( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1416,8 +1471,11 @@ TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementTint( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1437,8 +1495,11 @@ TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
int contrast = -1;
|
int contrast = -1;
|
||||||
|
|
||||||
@@ -1499,10 +1560,14 @@ TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **e
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curcontrast,
|
||||||
int newcontrast;
|
newcontrast;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1564,8 +1629,11 @@ IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, O
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementContrast( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1583,7 +1651,9 @@ TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT cha
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
TvDeviceDecreaseContrast( IXML_Document * in,
|
||||||
|
IXML_Document ** out,
|
||||||
|
char **errorString )
|
||||||
{
|
{
|
||||||
return IncrementContrast( -1, in, out, errorString );
|
return IncrementContrast( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1601,8 +1671,11 @@ TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT cha
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
int brightness = -1;
|
int brightness = -1;
|
||||||
|
|
||||||
@@ -1645,6 +1718,7 @@ TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1662,10 +1736,13 @@ TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curbrightness,
|
||||||
int newbrightness;
|
newbrightness;
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1726,7 +1803,9 @@ IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementBrightness( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1744,7 +1823,9 @@ TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementBrightness( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1768,9 +1849,14 @@ TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* 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 ) {
|
switch ( EventType ) {
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
|
|
||||||
TvDeviceHandleSubscriptionRequest( ( struct
|
TvDeviceHandleSubscriptionRequest( ( struct
|
||||||
@@ -1804,14 +1890,17 @@ int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Co
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SampleUtil_Print( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
SampleUtil_Print
|
||||||
|
( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||||
EventType );
|
EventType );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a summary of the event received */
|
/*
|
||||||
|
Print a summary of the event received
|
||||||
|
*/
|
||||||
SampleUtil_PrintEvent( EventType, Event );
|
SampleUtil_PrintEvent( EventType, Event );
|
||||||
|
|
||||||
return 0;
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1830,7 +1919,6 @@ TvDeviceStop()
|
|||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
SampleUtil_Finish( );
|
SampleUtil_Finish( );
|
||||||
ithread_mutex_destroy( &TVDevMutex );
|
ithread_mutex_destroy( &TVDevMutex );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1863,83 +1951,81 @@ TvDeviceStart( char *ip_address,
|
|||||||
print_string pfun )
|
print_string pfun )
|
||||||
{
|
{
|
||||||
int ret = UPNP_E_SUCCESS;
|
int ret = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
char desc_doc_url[DESC_URL_SIZE];
|
char desc_doc_url[DESC_URL_SIZE];
|
||||||
|
|
||||||
ithread_mutex_init( &TVDevMutex, NULL );
|
ithread_mutex_init( &TVDevMutex, NULL );
|
||||||
|
|
||||||
SampleUtil_Initialize( pfun );
|
SampleUtil_Initialize( pfun );
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Initializing UPnP Sdk with\n"
|
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
||||||
"\tipaddress = %s port = %u\n",
|
|
||||||
ip_address, port );
|
ip_address, port );
|
||||||
|
|
||||||
ret = UpnpInit( ip_address, port );
|
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ip_address == NULL ) {
|
||||||
ip_address = UpnpGetServerIpAddress( );
|
ip_address = UpnpGetServerIpAddress( );
|
||||||
port = UpnpGetServerPort();
|
}
|
||||||
|
|
||||||
SampleUtil_Print(
|
if( port == 0 ) {
|
||||||
"UPnP Initialized\n"
|
port = UpnpGetServerPort( );
|
||||||
"\tipaddress= %s port = %u\n",
|
}
|
||||||
|
|
||||||
|
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
||||||
ip_address, port );
|
ip_address, port );
|
||||||
|
|
||||||
if( desc_doc_name == NULL ) {
|
if( desc_doc_name == NULL )
|
||||||
desc_doc_name = "tvcombodesc.xml";
|
desc_doc_name = "tvcombodesc.xml";
|
||||||
}
|
|
||||||
|
|
||||||
if( web_dir_path == NULL ) {
|
if( web_dir_path == NULL )
|
||||||
web_dir_path = DEFAULT_WEB_DIR;
|
web_dir_path = DEFAULT_WEB_DIR;
|
||||||
}
|
|
||||||
|
|
||||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||||
port, desc_doc_name );
|
port, desc_doc_name );
|
||||||
|
|
||||||
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
||||||
web_dir_path );
|
web_dir_path );
|
||||||
ret = UpnpSetWebServerRootDir( web_dir_path );
|
if( ( ret =
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n",
|
SampleUtil_Print
|
||||||
|
( "Error specifying webserver root directory -- %s: %d\n",
|
||||||
web_dir_path, ret );
|
web_dir_path, ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Registering the RootDevice\n"
|
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
||||||
"\t with desc_doc_url: %s\n",
|
|
||||||
desc_doc_url );
|
desc_doc_url );
|
||||||
|
|
||||||
ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler,
|
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
||||||
&device_handle, &device_handle );
|
TvDeviceCallbackEventHandler,
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
&device_handle, &device_handle ) )
|
||||||
|
!= UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "RootDevice Registered\n" );
|
||||||
"RootDevice Registered\n"
|
|
||||||
"Initializing State Table\n");
|
SampleUtil_Print( "Initializing State Table\n" );
|
||||||
TvDeviceStateTableInit( desc_doc_url );
|
TvDeviceStateTableInit( desc_doc_url );
|
||||||
SampleUtil_Print( "State Table Initialized\n" );
|
SampleUtil_Print( "State Table Initialized\n" );
|
||||||
ret = UpnpSendAdvertisement( device_handle, default_advr_expire );
|
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
if( ( ret =
|
||||||
|
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
||||||
|
!= UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print( "Advertisements Sent\n" );
|
SampleUtil_Print( "Advertisements Sent\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef WIN32
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "sample_util.h"
|
#include "sample_util.h"
|
||||||
|
|||||||
@@ -1,40 +1,37 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "sample_util.h"
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "sample_util.h"
|
||||||
|
#include "upnp_tv_ctrlpt.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -127,72 +124,108 @@ TvCtrlPointPrintLongHelp( void )
|
|||||||
SampleUtil_Print( "* TV Control Point Help Info *" );
|
SampleUtil_Print( "* TV Control Point Help Info *" );
|
||||||
SampleUtil_Print( "******************************" );
|
SampleUtil_Print( "******************************" );
|
||||||
SampleUtil_Print( "" );
|
SampleUtil_Print( "" );
|
||||||
SampleUtil_Print( "This sample control point application automatically searches" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( "for and subscribes to the services of television device emulator" );
|
( "This sample control point application automatically searches" );
|
||||||
SampleUtil_Print( "devices, described in the tvdevicedesc.xml description document." );
|
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( "" );
|
||||||
SampleUtil_Print( "Commands:" );
|
SampleUtil_Print( "Commands:" );
|
||||||
SampleUtil_Print( " Help" );
|
SampleUtil_Print( " Help" );
|
||||||
SampleUtil_Print( " Print this help info." );
|
SampleUtil_Print( " Print this help info." );
|
||||||
SampleUtil_Print( " ListDev" );
|
SampleUtil_Print( " ListDev" );
|
||||||
SampleUtil_Print( " Print the current list of TV Device Emulators that this" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " control point is aware of. Each device is preceded by a" );
|
( " Print the current list of TV Device Emulators that this" );
|
||||||
SampleUtil_Print( " device number which corresponds to the devnum argument of" );
|
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( " commands listed below." );
|
||||||
SampleUtil_Print( " Refresh" );
|
SampleUtil_Print( " Refresh" );
|
||||||
SampleUtil_Print( " Delete all of the devices from the device list and issue new" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " search request to rebuild the list from scratch." );
|
( " 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( " PrintDev <devnum>" );
|
||||||
SampleUtil_Print( " Print the state table for the device <devnum>." );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " e.g., 'PrintDev 1' prints the state table for the first" );
|
( " 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( " device in the device list." );
|
||||||
SampleUtil_Print( " PowerOn <devnum>" );
|
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( " device <devnum>." );
|
||||||
SampleUtil_Print( " PowerOff <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( " device <devnum>." );
|
||||||
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
SampleUtil_Print( " SetChannel <devnum> <channel>" );
|
||||||
SampleUtil_Print( " Sends the SetChannel action to the Control Service of" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " device <devnum>, requesting the channel to be changed" );
|
( " 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( " to <channel>." );
|
||||||
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
SampleUtil_Print( " SetVolume <devnum> <volume>" );
|
||||||
SampleUtil_Print( " Sends the SetVolume action to the Control Service of" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " device <devnum>, requesting the volume to be changed" );
|
( " 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( " to <volume>." );
|
||||||
SampleUtil_Print( " SetColor <devnum> <color>" );
|
SampleUtil_Print( " SetColor <devnum> <color>" );
|
||||||
SampleUtil_Print( " Sends the SetColor action to the Control Service of" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " device <devnum>, requesting the color to be changed" );
|
( " 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( " to <color>." );
|
||||||
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
SampleUtil_Print( " SetTint <devnum> <tint>" );
|
||||||
SampleUtil_Print( " Sends the SetTint action to the Control Service of" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " device <devnum>, requesting the tint to be changed" );
|
( " 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( " to <tint>." );
|
||||||
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
SampleUtil_Print( " SetContrast <devnum> <contrast>" );
|
||||||
SampleUtil_Print( " Sends the SetContrast action to the Control Service of" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " device <devnum>, requesting the contrast to be changed" );
|
( " 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( " to <contrast>." );
|
||||||
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
SampleUtil_Print( " SetBrightness <devnum> <brightness>" );
|
||||||
SampleUtil_Print( " Sends the SetBrightness action to the Control Service of" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " device <devnum>, requesting the brightness to be changed" );
|
( " 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( " to <brightness>." );
|
||||||
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
SampleUtil_Print( " CtrlAction <devnum> <action>" );
|
||||||
SampleUtil_Print( " Sends an action request specified by the string <action>" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " to the Control Service of device <devnum>. This command" );
|
( " Sends an action request specified by the string <action>" );
|
||||||
SampleUtil_Print( " only works for actions that have no arguments." );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " (e.g., \"CtrlAction 1 IncreaseChannel\")" );
|
( " 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( " PictAction <devnum> <action>" );
|
||||||
SampleUtil_Print( " Sends an action request specified by the string <action>" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " to the Picture Service of device <devnum>. This command" );
|
( " Sends an action request specified by the string <action>" );
|
||||||
SampleUtil_Print( " only works for actions that have no arguments." );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " (e.g., \"PictAction 1 DecreaseContrast\")" );
|
( " 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( " CtrlGetVar <devnum> <varname>" );
|
||||||
SampleUtil_Print( " Requests the value of a variable specified by the string <varname>" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " from the Control Service of device <devnum>." );
|
( " 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( " (e.g., \"CtrlGetVar 1 Volume\")" );
|
||||||
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
SampleUtil_Print( " PictGetVar <devnum> <action>" );
|
||||||
SampleUtil_Print( " Requests the value of a variable specified by the string <varname>" );
|
SampleUtil_Print
|
||||||
SampleUtil_Print( " from the Picture Service of device <devnum>." );
|
( " 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( " (e.g., \"PictGetVar 1 Tint\")" );
|
||||||
SampleUtil_Print( " Exit" );
|
SampleUtil_Print( " Exit" );
|
||||||
SampleUtil_Print( " Exits the control point application." );
|
SampleUtil_Print( " Exits the control point application." );
|
||||||
@@ -401,29 +434,26 @@ TvCtrlPointProcessCommand( char *cmdline )
|
|||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main( int argc, char **argv )
|
int
|
||||||
|
main( int argc,
|
||||||
|
char **argv )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ithread_t cmdloop_thread;
|
ithread_t cmdloop_thread;
|
||||||
#ifdef WIN32
|
|
||||||
#else
|
|
||||||
int sig;
|
int sig;
|
||||||
sigset_t sigs_to_catch;
|
sigset_t sigs_to_catch;
|
||||||
#endif
|
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
|
|
||||||
rc = TvCtrlPointStart( linux_print, NULL );
|
rc = TvCtrlPointStart( linux_print, NULL );
|
||||||
if( rc != TV_SUCCESS ) {
|
if( rc != TV_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
SampleUtil_Print( "Error starting UPnP TV Control Point" );
|
||||||
return rc;
|
exit( rc );
|
||||||
}
|
}
|
||||||
/* start a command loop thread */
|
// start a command loop thread
|
||||||
code = ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop, NULL );
|
code =
|
||||||
|
ithread_create( &cmdloop_thread, NULL, TvCtrlPointCommandLoop,
|
||||||
|
NULL );
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
ithread_join(cmdloop_thread, NULL);
|
|
||||||
#else
|
|
||||||
/*
|
/*
|
||||||
Catch Ctrl-C and properly shutdown
|
Catch Ctrl-C and properly shutdown
|
||||||
*/
|
*/
|
||||||
@@ -431,11 +461,7 @@ int main( int argc, char **argv )
|
|||||||
sigaddset( &sigs_to_catch, SIGINT );
|
sigaddset( &sigs_to_catch, SIGINT );
|
||||||
sigwait( &sigs_to_catch, &sig );
|
sigwait( &sigs_to_catch, &sig );
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
SampleUtil_Print( "Shutting down on signal %d...", sig );
|
||||||
#endif
|
|
||||||
|
|
||||||
rc = TvCtrlPointStop( );
|
rc = TvCtrlPointStop( );
|
||||||
|
exit( rc );
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +1,37 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_ctrlpt.h"
|
#include "upnp_tv_ctrlpt.h"
|
||||||
|
|
||||||
|
/*
|
||||||
#include "upnp.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Mutex for protecting the global device list
|
Mutex for protecting the global device list
|
||||||
in a multi-threaded, asynchronous environment.
|
in a multi-threaded, asynchronous environment.
|
||||||
All functions should lock this mutex before reading
|
All functions should lock this mutex before reading
|
||||||
@@ -53,7 +48,7 @@ char *TvServiceType[] = {
|
|||||||
};
|
};
|
||||||
char *TvServiceName[] = { "Control", "Picture" };
|
char *TvServiceName[] = { "Control", "Picture" };
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Global arrays for storing variable names and counts for
|
Global arrays for storing variable names and counts for
|
||||||
TvControl and TvPicture services
|
TvControl and TvPicture services
|
||||||
*/
|
*/
|
||||||
@@ -64,12 +59,12 @@ char *TvVarName[TV_SERVICE_SERVCOUNT][TV_MAXVARS] = {
|
|||||||
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
char TvVarCount[TV_SERVICE_SERVCOUNT] =
|
||||||
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
{ TV_CONTROL_VARCOUNT, TV_PICTURE_VARCOUNT };
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Timeout to request during subscriptions
|
Timeout to request during subscriptions
|
||||||
*/
|
*/
|
||||||
int default_timeout = 1801;
|
int default_timeout = 1801;
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
The first node in the global device list, or NULL if empty
|
The first node in the global device list, or NULL if empty
|
||||||
*/
|
*/
|
||||||
struct TvDeviceNode *GlobalDeviceList = NULL;
|
struct TvDeviceNode *GlobalDeviceList = NULL;
|
||||||
@@ -144,10 +139,10 @@ TvCtrlPointDeleteNode( struct TvDeviceNode *node )
|
|||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
int
|
int
|
||||||
TvCtrlPointRemoveDevice(const char *UDN)
|
TvCtrlPointRemoveDevice( char *UDN )
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *curdevnode;
|
struct TvDeviceNode *curdevnode,
|
||||||
struct TvDeviceNode *prevdevnode;
|
*prevdevnode;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
@@ -674,7 +669,7 @@ TvCtrlPointPrintDevice( int devnum )
|
|||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void
|
void
|
||||||
TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
TvCtrlPointAddDevice( IXML_Document * DescDoc,
|
||||||
const char *location,
|
char *location,
|
||||||
int expires )
|
int expires )
|
||||||
{
|
{
|
||||||
char *deviceType = NULL;
|
char *deviceType = NULL;
|
||||||
@@ -687,19 +682,20 @@ TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
|||||||
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *eventURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
char *controlURL[TV_SERVICE_SERVCOUNT] = { NULL, NULL };
|
||||||
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
Upnp_SID eventSID[TV_SERVICE_SERVCOUNT];
|
||||||
int TimeOut[TV_SERVICE_SERVCOUNT] = {
|
int TimeOut[TV_SERVICE_SERVCOUNT] =
|
||||||
default_timeout,
|
{ default_timeout, default_timeout };
|
||||||
default_timeout };
|
|
||||||
struct TvDeviceNode *deviceNode;
|
struct TvDeviceNode *deviceNode;
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int service;
|
int service,
|
||||||
int var;
|
var;
|
||||||
|
|
||||||
ithread_mutex_lock( &DeviceListMutex );
|
ithread_mutex_lock( &DeviceListMutex );
|
||||||
|
|
||||||
/* Read key elements from description document */
|
/*
|
||||||
|
Read key elements from description document
|
||||||
|
*/
|
||||||
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
UDN = SampleUtil_GetFirstDocumentItem( DescDoc, "UDN" );
|
||||||
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
deviceType = SampleUtil_GetFirstDocumentItem( DescDoc, "deviceType" );
|
||||||
friendlyName =
|
friendlyName =
|
||||||
@@ -707,8 +703,9 @@ TvCtrlPointAddDevice( IXML_Document *DescDoc,
|
|||||||
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
baseURL = SampleUtil_GetFirstDocumentItem( DescDoc, "URLBase" );
|
||||||
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
relURL = SampleUtil_GetFirstDocumentItem( DescDoc, "presentationURL" );
|
||||||
|
|
||||||
ret = UpnpResolveURL(
|
ret =
|
||||||
( baseURL ? baseURL : location ), relURL, presURL);
|
UpnpResolveURL( ( baseURL ? baseURL : location ), relURL,
|
||||||
|
presURL );
|
||||||
|
|
||||||
if( UPNP_E_SUCCESS != ret )
|
if( UPNP_E_SUCCESS != ret )
|
||||||
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
SampleUtil_Print( "Error generating presURL from %s + %s", baseURL,
|
||||||
@@ -942,8 +939,8 @@ TvStateUpdate( char *UDN,
|
|||||||
* changes -- The DOM document representing the changes
|
* changes -- The DOM document representing the changes
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void TvCtrlPointHandleEvent(
|
void
|
||||||
const Upnp_SID sid,
|
TvCtrlPointHandleEvent( Upnp_SID sid,
|
||||||
int evntkey,
|
int evntkey,
|
||||||
IXML_Document * changes )
|
IXML_Document * changes )
|
||||||
{
|
{
|
||||||
@@ -954,17 +951,15 @@ void TvCtrlPointHandleEvent(
|
|||||||
|
|
||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while( tmpdevnode ) {
|
while( tmpdevnode ) {
|
||||||
for (service = 0; service < TV_SERVICE_SERVCOUNT; ++service) {
|
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
||||||
if (strcmp(tmpdevnode->device.TvService[service].SID, sid) == 0) {
|
if( strcmp( tmpdevnode->device.TvService[service].SID, sid ) ==
|
||||||
|
0 ) {
|
||||||
SampleUtil_Print( "Received Tv %s Event: %d for SID %s",
|
SampleUtil_Print( "Received Tv %s Event: %d for SID %s",
|
||||||
TvServiceName[service],
|
TvServiceName[service], evntkey, sid );
|
||||||
evntkey,
|
|
||||||
sid);
|
TvStateUpdate( tmpdevnode->device.UDN, service, changes,
|
||||||
TvStateUpdate(
|
( char ** )&tmpdevnode->device.
|
||||||
tmpdevnode->device.UDN,
|
TvService[service].VariableStrVal );
|
||||||
service,
|
|
||||||
changes,
|
|
||||||
(char **)&tmpdevnode->device.TvService[service].VariableStrVal);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -988,9 +983,9 @@ void TvCtrlPointHandleEvent(
|
|||||||
* timeout -- The new timeout for the subscription
|
* timeout -- The new timeout for the subscription
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
void TvCtrlPointHandleSubscribeUpdate(
|
void
|
||||||
const char *eventURL,
|
TvCtrlPointHandleSubscribeUpdate( char *eventURL,
|
||||||
const Upnp_SID sid,
|
Upnp_SID sid,
|
||||||
int timeout )
|
int timeout )
|
||||||
{
|
{
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1020,9 +1015,9 @@ void TvCtrlPointHandleSubscribeUpdate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TvCtrlPointHandleGetVar( const char *controlURL,
|
TvCtrlPointHandleGetVar( char *controlURL,
|
||||||
const char *varName,
|
char *varName,
|
||||||
const DOMString varValue )
|
DOMString varValue )
|
||||||
{
|
{
|
||||||
|
|
||||||
struct TvDeviceNode *tmpdevnode;
|
struct TvDeviceNode *tmpdevnode;
|
||||||
@@ -1033,9 +1028,12 @@ TvCtrlPointHandleGetVar( const char *controlURL,
|
|||||||
tmpdevnode = GlobalDeviceList;
|
tmpdevnode = GlobalDeviceList;
|
||||||
while( tmpdevnode ) {
|
while( tmpdevnode ) {
|
||||||
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
for( service = 0; service < TV_SERVICE_SERVCOUNT; service++ ) {
|
||||||
if (strcmp(tmpdevnode->device.TvService[service].ControlURL, controlURL ) == 0 ) {
|
if( strcmp
|
||||||
SampleUtil_StateUpdate(
|
( tmpdevnode->device.TvService[service].ControlURL,
|
||||||
varName, varValue, tmpdevnode->device.UDN, GET_VAR_COMPLETE );
|
controlURL ) == 0 ) {
|
||||||
|
SampleUtil_StateUpdate( varName, varValue,
|
||||||
|
tmpdevnode->device.UDN,
|
||||||
|
GET_VAR_COMPLETE );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1059,55 +1057,68 @@ TvCtrlPointHandleGetVar( const char *controlURL,
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* 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 )
|
||||||
{
|
{
|
||||||
/*int errCode = 0;*/
|
|
||||||
|
|
||||||
SampleUtil_PrintEvent( EventType, Event );
|
SampleUtil_PrintEvent( EventType, Event );
|
||||||
|
|
||||||
switch ( EventType ) {
|
switch ( EventType ) {
|
||||||
/* SSDP Stuff */
|
/*
|
||||||
|
SSDP Stuff
|
||||||
|
*/
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
|
||||||
case UPNP_DISCOVERY_SEARCH_RESULT: {
|
case UPNP_DISCOVERY_SEARCH_RESULT:
|
||||||
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
{
|
||||||
|
struct Upnp_Discovery *d_event =
|
||||||
|
( struct Upnp_Discovery * )Event;
|
||||||
IXML_Document *DescDoc = NULL;
|
IXML_Document *DescDoc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "Error in Discovery Callback -- %d",
|
||||||
"Error in Discovery Callback -- %d", d_event->ErrCode);
|
d_event->ErrCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = UpnpDownloadXmlDoc(d_event->Location, &DescDoc);
|
if( ( ret =
|
||||||
if (ret != UPNP_E_SUCCESS) {
|
UpnpDownloadXmlDoc( d_event->Location,
|
||||||
SampleUtil_Print(
|
&DescDoc ) ) !=
|
||||||
"Error obtaining device description from %s -- error = %d",
|
UPNP_E_SUCCESS ) {
|
||||||
|
SampleUtil_Print
|
||||||
|
( "Error obtaining device description from %s -- error = %d",
|
||||||
d_event->Location, ret );
|
d_event->Location, ret );
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointAddDevice(
|
TvCtrlPointAddDevice( DescDoc, d_event->Location,
|
||||||
DescDoc, d_event->Location, d_event->Expires);
|
d_event->Expires );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DescDoc ) {
|
if( DescDoc )
|
||||||
ixmlDocument_free( DescDoc );
|
ixmlDocument_free( DescDoc );
|
||||||
}
|
|
||||||
|
|
||||||
TvCtrlPointPrintList( );
|
TvCtrlPointPrintList( );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
case UPNP_DISCOVERY_SEARCH_TIMEOUT:
|
||||||
/* Nothing to do here... */
|
/*
|
||||||
|
Nothing to do here...
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
|
case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
|
||||||
struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
|
{
|
||||||
|
struct Upnp_Discovery *d_event =
|
||||||
|
( struct Upnp_Discovery * )Event;
|
||||||
|
|
||||||
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( d_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
|
( "Error in Discovery ByeBye Callback -- %d",
|
||||||
|
d_event->ErrCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print("Received ByeBye for Device: %s", d_event->DeviceId);
|
SampleUtil_Print( "Received ByeBye for Device: %s",
|
||||||
|
d_event->DeviceId );
|
||||||
TvCtrlPointRemoveDevice( d_event->DeviceId );
|
TvCtrlPointRemoveDevice( d_event->DeviceId );
|
||||||
|
|
||||||
SampleUtil_Print( "After byebye:" );
|
SampleUtil_Print( "After byebye:" );
|
||||||
@@ -1115,89 +1126,110 @@ int TvCtrlPointCallbackEventHandler(Upnp_EventType EventType, void *Event, void
|
|||||||
|
|
||||||
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 ) {
|
if( a_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Action Complete Callback -- %d",
|
( "Error in Action Complete Callback -- %d",
|
||||||
a_event->ErrCode );
|
a_event->ErrCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No need for any processing here, just print out results.
|
/*
|
||||||
* Service state table updates are handled by events. */
|
No need for any processing here, just print out results. Service state
|
||||||
|
table updates are handled by events.
|
||||||
|
*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UPNP_CONTROL_GET_VAR_COMPLETE: {
|
|
||||||
struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
|
case UPNP_CONTROL_GET_VAR_COMPLETE:
|
||||||
|
{
|
||||||
|
struct Upnp_State_Var_Complete *sv_event =
|
||||||
|
( struct Upnp_State_Var_Complete * )Event;
|
||||||
|
|
||||||
if( sv_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( sv_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Get Var Complete Callback -- %d",
|
( "Error in Get Var Complete Callback -- %d",
|
||||||
sv_event->ErrCode );
|
sv_event->ErrCode );
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleGetVar(
|
TvCtrlPointHandleGetVar( sv_event->CtrlUrl,
|
||||||
sv_event->CtrlUrl,
|
|
||||||
sv_event->StateVarName,
|
sv_event->StateVarName,
|
||||||
sv_event->CurrentVal );
|
sv_event->CurrentVal );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* GENA Stuff */
|
|
||||||
case UPNP_EVENT_RECEIVED: {
|
/*
|
||||||
|
GENA Stuff
|
||||||
|
*/
|
||||||
|
case UPNP_EVENT_RECEIVED:
|
||||||
|
{
|
||||||
struct Upnp_Event *e_event = ( struct Upnp_Event * )Event;
|
struct Upnp_Event *e_event = ( struct Upnp_Event * )Event;
|
||||||
|
|
||||||
TvCtrlPointHandleEvent(
|
TvCtrlPointHandleEvent( e_event->Sid, e_event->EventKey,
|
||||||
e_event->Sid,
|
|
||||||
e_event->EventKey,
|
|
||||||
e_event->ChangedVariables );
|
e_event->ChangedVariables );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_SUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
|
||||||
case UPNP_EVENT_RENEWAL_COMPLETE: {
|
case UPNP_EVENT_RENEWAL_COMPLETE:
|
||||||
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
{
|
||||||
|
struct Upnp_Event_Subscribe *es_event =
|
||||||
|
( struct Upnp_Event_Subscribe * )Event;
|
||||||
|
|
||||||
if( es_event->ErrCode != UPNP_E_SUCCESS ) {
|
if( es_event->ErrCode != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Error in Event Subscribe Callback -- %d",
|
( "Error in Event Subscribe Callback -- %d",
|
||||||
es_event->ErrCode );
|
es_event->ErrCode );
|
||||||
} else {
|
} else {
|
||||||
TvCtrlPointHandleSubscribeUpdate(
|
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||||
es_event->PublisherUrl,
|
PublisherUrl,
|
||||||
es_event->Sid,
|
es_event->Sid,
|
||||||
es_event->TimeOut );
|
es_event->TimeOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
case UPNP_EVENT_AUTORENEWAL_FAILED:
|
||||||
case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
|
case UPNP_EVENT_SUBSCRIPTION_EXPIRED:
|
||||||
struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
|
{
|
||||||
int TimeOut = default_timeout;
|
int TimeOut = default_timeout;
|
||||||
Upnp_SID newSID;
|
Upnp_SID newSID;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = UpnpSubscribe(
|
struct Upnp_Event_Subscribe *es_event =
|
||||||
ctrlpt_handle,
|
( struct Upnp_Event_Subscribe * )Event;
|
||||||
es_event->PublisherUrl,
|
|
||||||
&TimeOut,
|
ret =
|
||||||
newSID);
|
UpnpSubscribe( ctrlpt_handle, es_event->PublisherUrl,
|
||||||
|
&TimeOut, newSID );
|
||||||
|
|
||||||
if( ret == UPNP_E_SUCCESS ) {
|
if( ret == UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print("Subscribed to EventURL with SID=%s", newSID);
|
SampleUtil_Print( "Subscribed to EventURL with SID=%s",
|
||||||
TvCtrlPointHandleSubscribeUpdate(
|
newSID );
|
||||||
es_event->PublisherUrl,
|
TvCtrlPointHandleSubscribeUpdate( es_event->
|
||||||
newSID,
|
PublisherUrl, newSID,
|
||||||
TimeOut );
|
TimeOut );
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print("Error Subscribing to EventURL -- %d", ret);
|
SampleUtil_Print
|
||||||
|
( "Error Subscribing to EventURL -- %d", ret );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* ignore these cases, since this is not a device */
|
|
||||||
|
/*
|
||||||
|
ignore these cases, since this is not a device
|
||||||
|
*/
|
||||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
case UPNP_CONTROL_GET_VAR_REQUEST:
|
case UPNP_CONTROL_GET_VAR_REQUEST:
|
||||||
case UPNP_CONTROL_ACTION_REQUEST:
|
case UPNP_CONTROL_ACTION_REQUEST:
|
||||||
@@ -1288,12 +1320,12 @@ TvCtrlPointVerifyTimeouts( int incr )
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
static int TvCtrlPointTimerLoopRun = 1;
|
void *
|
||||||
void *TvCtrlPointTimerLoop(void *args)
|
TvCtrlPointTimerLoop( void *args )
|
||||||
{
|
{
|
||||||
int incr = 30; // how often to verify the timeouts, in seconds
|
int incr = 30; // how often to verify the timeouts, in seconds
|
||||||
|
|
||||||
while (TvCtrlPointTimerLoopRun) {
|
while( 1 ) {
|
||||||
isleep( incr );
|
isleep( incr );
|
||||||
TvCtrlPointVerifyTimeouts( incr );
|
TvCtrlPointVerifyTimeouts( incr );
|
||||||
}
|
}
|
||||||
@@ -1316,11 +1348,13 @@ void *TvCtrlPointTimerLoop(void *args)
|
|||||||
* TV_SUCCESS if everything went well, else TV_ERROR
|
* 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;
|
ithread_t timer_thread;
|
||||||
int rc;
|
int rc;
|
||||||
unsigned short port = 0;
|
short int port = 0;
|
||||||
char *ip_address = NULL;
|
char *ip_address = NULL;
|
||||||
|
|
||||||
SampleUtil_Initialize( printFunctionPtr );
|
SampleUtil_Initialize( printFunctionPtr );
|
||||||
@@ -1328,36 +1362,28 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP
|
|||||||
|
|
||||||
ithread_mutex_init( &DeviceListMutex, 0 );
|
ithread_mutex_init( &DeviceListMutex, 0 );
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "Initializing UPnP with ipaddress=%s port=%d",
|
||||||
"Initializing UPnP Sdk with\n"
|
|
||||||
"\tipaddress = %s port = %u\n",
|
|
||||||
ip_address, port );
|
ip_address, port );
|
||||||
|
|
||||||
rc = UpnpInit( ip_address, port );
|
rc = UpnpInit( ip_address, port );
|
||||||
if (rc != UPNP_E_SUCCESS) {
|
if( UPNP_E_SUCCESS != rc ) {
|
||||||
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
|
SampleUtil_Print( "WinCEStart: UpnpInit() Error: %d", rc );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
return TV_ERROR;
|
return TV_ERROR;
|
||||||
}
|
}
|
||||||
if (!ip_address) {
|
|
||||||
ip_address = UpnpGetServerIpAddress();
|
|
||||||
}
|
|
||||||
if (!port) {
|
|
||||||
port = UpnpGetServerPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
SampleUtil_Print(
|
if( NULL == ip_address )
|
||||||
"UPnP Initialized\n"
|
ip_address = UpnpGetServerIpAddress( );
|
||||||
"\tipaddress= %s port = %u\n",
|
if( 0 == port )
|
||||||
ip_address, port);
|
port = UpnpGetServerPort( );
|
||||||
|
|
||||||
|
SampleUtil_Print( "UPnP Initialized (%s:%d)", ip_address, port );
|
||||||
|
|
||||||
SampleUtil_Print( "Registering Control Point" );
|
SampleUtil_Print( "Registering Control Point" );
|
||||||
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,
|
rc = UpnpRegisterClient( TvCtrlPointCallbackEventHandler,
|
||||||
&ctrlpt_handle, &ctrlpt_handle );
|
&ctrlpt_handle, &ctrlpt_handle );
|
||||||
if (rc != UPNP_E_SUCCESS) {
|
if( UPNP_E_SUCCESS != rc ) {
|
||||||
SampleUtil_Print( "Error registering CP: %d", rc );
|
SampleUtil_Print( "Error registering CP: %d", rc );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return TV_ERROR;
|
return TV_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1365,16 +1391,15 @@ int TvCtrlPointStart(print_string printFunctionPtr, state_update updateFunctionP
|
|||||||
|
|
||||||
TvCtrlPointRefresh( );
|
TvCtrlPointRefresh( );
|
||||||
|
|
||||||
/* start a timer thread */
|
// start a timer thread
|
||||||
ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL );
|
ithread_create( &timer_thread, NULL, TvCtrlPointTimerLoop, NULL );
|
||||||
ithread_detach(timer_thread);
|
|
||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TvCtrlPointStop(void)
|
int
|
||||||
|
TvCtrlPointStop( void )
|
||||||
{
|
{
|
||||||
TvCtrlPointTimerLoopRun = 0;
|
|
||||||
TvCtrlPointRemoveAll( );
|
TvCtrlPointRemoveAll( );
|
||||||
UpnpUnRegisterClient( ctrlpt_handle );
|
UpnpUnRegisterClient( ctrlpt_handle );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
@@ -1382,4 +1407,3 @@ int TvCtrlPointStop(void)
|
|||||||
|
|
||||||
return TV_SUCCESS;
|
return TV_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +1,53 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_CTRLPT_H
|
#ifndef UPNP_TV_CTRLPT_H
|
||||||
#define UPNP_TV_CTRLPT_H
|
#define UPNP_TV_CTRLPT_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include "sample_util.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include "upnp.h"
|
#include <unistd.h>
|
||||||
#include "upnptools.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "upnp.h"
|
||||||
#ifdef WIN32
|
#include "upnptools.h"
|
||||||
/* Do not #include <unistd.h> */
|
#include "sample_util.h"
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define TV_SERVICE_SERVCOUNT 2
|
#define TV_SERVICE_SERVCOUNT 2
|
||||||
#define TV_SERVICE_CONTROL 0
|
#define TV_SERVICE_CONTROL 0
|
||||||
@@ -122,7 +110,7 @@ extern UpnpClient_Handle ctrlpt_handle;
|
|||||||
|
|
||||||
void TvCtrlPointPrintHelp( void );
|
void TvCtrlPointPrintHelp( void );
|
||||||
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
int TvCtrlPointDeleteNode(struct TvDeviceNode*);
|
||||||
int TvCtrlPointRemoveDevice(const char *);
|
int TvCtrlPointRemoveDevice(char*);
|
||||||
int TvCtrlPointRemoveAll( void );
|
int TvCtrlPointRemoveAll( void );
|
||||||
int TvCtrlPointRefresh( void );
|
int TvCtrlPointRefresh( void );
|
||||||
|
|
||||||
@@ -150,11 +138,11 @@ int TvCtrlPointGetBrightness(int);
|
|||||||
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
int TvCtrlPointGetDevice(int, struct TvDeviceNode **);
|
||||||
int TvCtrlPointPrintList( void );
|
int TvCtrlPointPrintList( void );
|
||||||
int TvCtrlPointPrintDevice(int);
|
int TvCtrlPointPrintDevice(int);
|
||||||
void TvCtrlPointAddDevice(IXML_Document *, const char *, int);
|
void TvCtrlPointAddDevice (IXML_Document *, char *, int);
|
||||||
void TvCtrlPointHandleGetVar(const char *, const char *, const DOMString);
|
void TvCtrlPointHandleGetVar(char *,char *,DOMString);
|
||||||
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
void TvStateUpdate(char*,int, IXML_Document * , char **);
|
||||||
void TvCtrlPointHandleEvent(const Upnp_SID, int, IXML_Document *);
|
void TvCtrlPointHandleEvent(Upnp_SID, int, IXML_Document *);
|
||||||
void TvCtrlPointHandleSubscribeUpdate(const char *, const Upnp_SID, int);
|
void TvCtrlPointHandleSubscribeUpdate(char *, Upnp_SID, int);
|
||||||
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
int TvCtrlPointCallbackEventHandler(Upnp_EventType, void *, void *);
|
||||||
void TvCtrlPointVerifyTimeouts(int);
|
void TvCtrlPointVerifyTimeouts(int);
|
||||||
void TvCtrlPointPrintCommands( void );
|
void TvCtrlPointPrintCommands( void );
|
||||||
|
|||||||
@@ -1,41 +1,37 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "sample_util.h"
|
|
||||||
#include "upnp_tv_device.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "sample_util.h"
|
||||||
|
#include "upnp_tv_device.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* linux_print
|
* linux_print
|
||||||
@@ -121,22 +117,21 @@ TvDeviceCommandLoop( void *args )
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int main( IN int argc, IN char **argv )
|
int
|
||||||
|
main( IN int argc,
|
||||||
|
IN char **argv )
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int portTemp = 0;
|
unsigned int portTemp = 0;
|
||||||
char *ip_address = NULL,
|
char *ip_address = NULL,
|
||||||
*desc_doc_name = NULL,
|
*desc_doc_name = NULL,
|
||||||
*web_dir_path = NULL;
|
*web_dir_path = NULL;
|
||||||
int rc;
|
|
||||||
ithread_t cmdloop_thread;
|
ithread_t cmdloop_thread;
|
||||||
#ifdef WIN32
|
|
||||||
#else
|
|
||||||
int sig;
|
|
||||||
sigset_t sigs_to_catch;
|
|
||||||
#endif
|
|
||||||
int code;
|
int code;
|
||||||
unsigned int port = 0;
|
unsigned int port = 0;
|
||||||
|
int sig;
|
||||||
|
sigset_t sigs_to_catch;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
SampleUtil_Initialize( linux_print );
|
SampleUtil_Initialize( linux_print );
|
||||||
@@ -168,20 +163,21 @@ int main( IN int argc, IN char **argv )
|
|||||||
( "\tweb_dir_path: Filesystem path where web files "
|
( "\tweb_dir_path: Filesystem path where web files "
|
||||||
"related to the device are stored\n" );
|
"related to the device are stored\n" );
|
||||||
SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" );
|
SampleUtil_Print( "\t\te.g.: /upnp/sample/tvdevice/web\n" );
|
||||||
return 1;
|
exit( 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
port = ( unsigned short )portTemp;
|
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
|
Catch Ctrl-C and properly shutdown
|
||||||
*/
|
*/
|
||||||
@@ -190,9 +186,6 @@ int main( IN int argc, IN char **argv )
|
|||||||
sigwait( &sigs_to_catch, &sig );
|
sigwait( &sigs_to_catch, &sig );
|
||||||
|
|
||||||
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
SampleUtil_Print( "Shutting down on signal %d...\n", sig );
|
||||||
#endif
|
TvDeviceStop( );
|
||||||
rc = TvDeviceStop();
|
exit( 0 );
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,40 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "upnp_tv_device.h"
|
#include "upnp_tv_device.h"
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define DEFAULT_WEB_DIR "./web"
|
#define DEFAULT_WEB_DIR "./web"
|
||||||
|
|
||||||
|
|
||||||
#define DESC_URL_SIZE 200
|
#define DESC_URL_SIZE 200
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Device type for tv device
|
Device type for tv device
|
||||||
*/
|
*/
|
||||||
@@ -187,6 +180,7 @@ SetServiceTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SetActionTable( serviceType, out );
|
return SetActionTable( serviceType, out );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -257,6 +251,7 @@ SetActionTable( IN int serviceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -392,22 +387,19 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|||||||
/*
|
/*
|
||||||
PropSet = NULL;
|
PropSet = NULL;
|
||||||
|
|
||||||
for (j = 0; j< tv_service_table[i].VariableCount; ++j) {
|
for (j=0; j< tv_service_table[i].VariableCount; j++)
|
||||||
|
{
|
||||||
//add each variable to the property set
|
//add each variable to the property set
|
||||||
//for initial state dump
|
//for initial state dump
|
||||||
UpnpAddToPropertySet(
|
UpnpAddToPropertySet(&PropSet,
|
||||||
&PropSet,
|
|
||||||
tv_service_table[i].VariableName[j],
|
tv_service_table[i].VariableName[j],
|
||||||
tv_service_table[i].VariableStrVal[j]);
|
tv_service_table[i].VariableStrVal[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//dump initial state
|
//dump initial state
|
||||||
UpnpAcceptSubscriptionExt(
|
UpnpAcceptSubscriptionExt(device_handle, sr_event->UDN,
|
||||||
device_handle,
|
|
||||||
sr_event->UDN,
|
|
||||||
sr_event->ServiceId,
|
sr_event->ServiceId,
|
||||||
PropSet,
|
PropSet,sr_event->Sid);
|
||||||
sr_event->Sid);
|
|
||||||
//free document
|
//free document
|
||||||
Document_free(PropSet);
|
Document_free(PropSet);
|
||||||
|
|
||||||
@@ -428,10 +420,9 @@ TvDeviceHandleSubscriptionRequest( IN struct Upnp_Subscription_Request
|
|||||||
|
|
||||||
ithread_mutex_unlock( &TVDevMutex );
|
ithread_mutex_unlock( &TVDevMutex );
|
||||||
|
|
||||||
return 1;
|
return ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TvDeviceHandleGetVarRequest
|
* TvDeviceHandleGetVarRequest
|
||||||
*
|
*
|
||||||
@@ -448,8 +439,8 @@ int
|
|||||||
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
||||||
*cgv_event )
|
*cgv_event )
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i = 0,
|
||||||
unsigned int j = 0;
|
j = 0;
|
||||||
int getvar_succeeded = 0;
|
int getvar_succeeded = 0;
|
||||||
|
|
||||||
cgv_event->CurrentVal = NULL;
|
cgv_event->CurrentVal = NULL;
|
||||||
@@ -507,6 +498,7 @@ TvDeviceHandleGetVarRequest( INOUT struct Upnp_State_Var_Request
|
|||||||
int
|
int
|
||||||
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
TvDeviceHandleActionRequest( INOUT struct Upnp_Action_Request *ca_event )
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Defaults if action not found
|
Defaults if action not found
|
||||||
*/
|
*/
|
||||||
@@ -659,6 +651,7 @@ TvDeviceSetServiceTableVar( IN unsigned int service,
|
|||||||
ithread_mutex_unlock( &TVDevMutex );
|
ithread_mutex_unlock( &TVDevMutex );
|
||||||
|
|
||||||
return ( 1 );
|
return ( 1 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -681,7 +674,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
|
|
||||||
if( on != POWER_ON && on != POWER_OFF ) {
|
if( on != POWER_ON && on != POWER_OFF ) {
|
||||||
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
SampleUtil_Print( "error: can't set power to value %d\n", on );
|
||||||
return 0;
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -692,7 +685,7 @@ TvDeviceSetPower( IN int on )
|
|||||||
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
ret = TvDeviceSetServiceTableVar( TV_SERVICE_CONTROL, TV_CONTROL_POWER,
|
||||||
value );
|
value );
|
||||||
|
|
||||||
return ret;
|
return ( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -709,7 +702,9 @@ TvDeviceSetPower( IN int on )
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
( *out ) = NULL;
|
||||||
( *errorString ) = NULL;
|
( *errorString ) = NULL;
|
||||||
@@ -729,6 +724,7 @@ TvDevicePowerOn( IN IXML_Document *in, OUT IXML_Document **out, OUT char **error
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -785,8 +781,11 @@ TvDevicePowerOff( IN IXML_Document * in,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int channel = 0;
|
int channel = 0;
|
||||||
@@ -831,6 +830,7 @@ TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **er
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -848,10 +848,13 @@ TvDeviceSetChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char **er
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curchannel,
|
||||||
int newchannel;
|
newchannel;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
@@ -913,9 +916,12 @@ IncrementChannel( IN int incr, IN IXML_Document * in, OUT IXML_Document **out, O
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementChannel( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -932,9 +938,12 @@ TvDeviceDecreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementChannel( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -953,9 +962,13 @@ TvDeviceIncreaseChannel( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int volume = 0;
|
int volume = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -996,6 +1009,7 @@ TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **err
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1014,7 +1028,10 @@ TvDeviceSetVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char **err
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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,
|
int curvolume,
|
||||||
newvolume;
|
newvolume;
|
||||||
@@ -1051,7 +1068,8 @@ IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT
|
|||||||
TV_CONTROL_VOLUME, value ) ) {
|
TV_CONTROL_VOLUME, value ) ) {
|
||||||
if( UpnpAddToActionResponse( out, actionName,
|
if( UpnpAddToActionResponse( out, actionName,
|
||||||
TvServiceType[TV_SERVICE_CONTROL],
|
TvServiceType[TV_SERVICE_CONTROL],
|
||||||
"Volume", value ) != UPNP_E_SUCCESS ) {
|
"Volume", value ) != UPNP_E_SUCCESS )
|
||||||
|
{
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
@@ -1061,6 +1079,7 @@ IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1077,9 +1096,13 @@ IncrementVolume( IN int incr, IN IXML_Document *in,OUT IXML_Document **out, OUT
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementVolume( 1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1096,9 +1119,13 @@ TvDeviceIncreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementVolume( -1, in, out, errorString );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1117,9 +1144,13 @@ TvDeviceDecreaseVolume( IN IXML_Document *in, OUT IXML_Document **out, OUT char
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int color = 0;
|
int color = 0;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1159,6 +1190,7 @@ TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **erro
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1175,11 +1207,16 @@ TvDeviceSetColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char **erro
|
|||||||
* IXML_Document **out - action result document
|
* IXML_Document **out - action result document
|
||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
IncrementColor( IN int incr, 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;
|
int curcolor,
|
||||||
int newcolor;
|
newcolor;
|
||||||
|
|
||||||
char *actionName;
|
char *actionName;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1237,8 +1274,11 @@ IncrementColor( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementColor( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1255,8 +1295,11 @@ TvDeviceDecreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementColor( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1276,9 +1319,13 @@ TvDeviceIncreaseColor( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
|
|
||||||
int tint = -1;
|
int tint = -1;
|
||||||
|
|
||||||
( *out ) = NULL;
|
( *out ) = NULL;
|
||||||
@@ -1337,10 +1384,14 @@ TvDeviceSetTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **error
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curtint,
|
||||||
int newtint;
|
newtint;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1383,6 +1434,7 @@ IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1399,8 +1451,11 @@ IncrementTint( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementTint( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1418,8 +1473,11 @@ TvDeviceIncreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementTint( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1439,8 +1497,11 @@ TvDeviceDecreaseTint( IN IXML_Document *in, OUT IXML_Document **out, OUT char **
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
int contrast = -1;
|
int contrast = -1;
|
||||||
|
|
||||||
@@ -1501,10 +1562,14 @@ TvDeviceSetContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **e
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curcontrast,
|
||||||
int newcontrast;
|
newcontrast;
|
||||||
|
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1566,8 +1631,11 @@ IncrementContrast( IN int incr, IN IXML_Document *in, OUT IXML_Document **out, O
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementContrast( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1585,7 +1653,9 @@ TvDeviceIncreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT cha
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT char **errorString )
|
TvDeviceDecreaseContrast( IXML_Document * in,
|
||||||
|
IXML_Document ** out,
|
||||||
|
char **errorString )
|
||||||
{
|
{
|
||||||
return IncrementContrast( -1, in, out, errorString );
|
return IncrementContrast( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1603,8 +1673,11 @@ TvDeviceDecreaseContrast( IN IXML_Document *in, OUT IXML_Document **out, OUT cha
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
char *value = NULL;
|
||||||
int brightness = -1;
|
int brightness = -1;
|
||||||
|
|
||||||
@@ -1647,6 +1720,7 @@ TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
( *errorString ) = "Internal Error";
|
( *errorString ) = "Internal Error";
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1664,10 +1738,13 @@ TvDeviceSetBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT char *
|
|||||||
* char **errorString - errorString (in case action was unsuccessful)
|
* char **errorString - errorString (in case action was unsuccessful)
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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;
|
int curbrightness,
|
||||||
int newbrightness;
|
newbrightness;
|
||||||
char *actionName = NULL;
|
char *actionName = NULL;
|
||||||
char value[TV_MAX_VAL_LEN];
|
char value[TV_MAX_VAL_LEN];
|
||||||
|
|
||||||
@@ -1728,7 +1805,9 @@ IncrementBrightness( IN int incr, IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementBrightness( 1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1746,7 +1825,9 @@ TvDeviceIncreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
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 );
|
return IncrementBrightness( -1, in, out, errorString );
|
||||||
}
|
}
|
||||||
@@ -1770,9 +1851,14 @@ TvDeviceDecreaseBrightness( IN IXML_Document *in, OUT IXML_Document **out, OUT c
|
|||||||
* Cookie -- Optional data specified during callback registration
|
* 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 ) {
|
switch ( EventType ) {
|
||||||
|
|
||||||
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
case UPNP_EVENT_SUBSCRIPTION_REQUEST:
|
||||||
|
|
||||||
TvDeviceHandleSubscriptionRequest( ( struct
|
TvDeviceHandleSubscriptionRequest( ( struct
|
||||||
@@ -1806,14 +1892,17 @@ int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Co
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SampleUtil_Print( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
SampleUtil_Print
|
||||||
|
( "Error in TvDeviceCallbackEventHandler: unknown event type %d\n",
|
||||||
EventType );
|
EventType );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a summary of the event received */
|
/*
|
||||||
|
Print a summary of the event received
|
||||||
|
*/
|
||||||
SampleUtil_PrintEvent( EventType, Event );
|
SampleUtil_PrintEvent( EventType, Event );
|
||||||
|
|
||||||
return 0;
|
return ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
@@ -1826,13 +1915,12 @@ int TvDeviceCallbackEventHandler(Upnp_EventType EventType, void *Event, void *Co
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
int
|
int
|
||||||
TvDeviceStop(void)
|
TvDeviceStop( )
|
||||||
{
|
{
|
||||||
UpnpUnRegisterRootDevice( device_handle );
|
UpnpUnRegisterRootDevice( device_handle );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
SampleUtil_Finish( );
|
SampleUtil_Finish( );
|
||||||
ithread_mutex_destroy( &TVDevMutex );
|
ithread_mutex_destroy( &TVDevMutex );
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1865,83 +1953,79 @@ TvDeviceStart( char *ip_address,
|
|||||||
print_string pfun )
|
print_string pfun )
|
||||||
{
|
{
|
||||||
int ret = UPNP_E_SUCCESS;
|
int ret = UPNP_E_SUCCESS;
|
||||||
|
|
||||||
char desc_doc_url[DESC_URL_SIZE];
|
char desc_doc_url[DESC_URL_SIZE];
|
||||||
|
|
||||||
ithread_mutex_init( &TVDevMutex, NULL );
|
ithread_mutex_init( &TVDevMutex, NULL );
|
||||||
|
|
||||||
SampleUtil_Initialize( pfun );
|
SampleUtil_Initialize( pfun );
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Initializing UPnP Sdk with\n"
|
( "Initializing UPnP Sdk with \n \t ipaddress = %s port = %d\n",
|
||||||
"\tipaddress = %s port = %u\n",
|
|
||||||
ip_address, port );
|
ip_address, port );
|
||||||
|
|
||||||
ret = UpnpInit( ip_address, port );
|
if( ( ret = UpnpInit( ip_address, port ) ) != UPNP_E_SUCCESS ) {
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
|
||||||
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
SampleUtil_Print( "Error with UpnpInit -- %d\n", ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ip_address == NULL ) {
|
||||||
ip_address = UpnpGetServerIpAddress( );
|
ip_address = UpnpGetServerIpAddress( );
|
||||||
|
}
|
||||||
|
|
||||||
port = UpnpGetServerPort( );
|
port = UpnpGetServerPort( );
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "UPnP Initialized\n \t ipaddress= %s port = %d\n",
|
||||||
"UPnP Initialized\n"
|
|
||||||
"\tipaddress= %s port = %u\n",
|
|
||||||
ip_address, port );
|
ip_address, port );
|
||||||
|
|
||||||
if( desc_doc_name == NULL ) {
|
if( desc_doc_name == NULL )
|
||||||
desc_doc_name = "tvdevicedesc.xml";
|
desc_doc_name = "tvdevicedesc.xml";
|
||||||
}
|
|
||||||
|
|
||||||
if( web_dir_path == NULL ) {
|
if( web_dir_path == NULL )
|
||||||
web_dir_path = DEFAULT_WEB_DIR;
|
web_dir_path = DEFAULT_WEB_DIR;
|
||||||
}
|
|
||||||
|
|
||||||
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
snprintf( desc_doc_url, DESC_URL_SIZE, "http://%s:%d/%s", ip_address,
|
||||||
port, desc_doc_name );
|
port, desc_doc_name );
|
||||||
|
|
||||||
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
SampleUtil_Print( "Specifying the webserver root directory -- %s\n",
|
||||||
web_dir_path );
|
web_dir_path );
|
||||||
ret = UpnpSetWebServerRootDir( web_dir_path );
|
if( ( ret =
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
UpnpSetWebServerRootDir( web_dir_path ) ) != UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error specifying webserver root directory -- %s: %d\n",
|
SampleUtil_Print
|
||||||
|
( "Error specifying webserver root directory -- %s: %d\n",
|
||||||
web_dir_path, ret );
|
web_dir_path, ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print(
|
SampleUtil_Print
|
||||||
"Registering the RootDevice\n"
|
( "Registering the RootDevice\n\t with desc_doc_url: %s\n",
|
||||||
"\t with desc_doc_url: %s\n",
|
|
||||||
desc_doc_url );
|
desc_doc_url );
|
||||||
|
|
||||||
ret = UpnpRegisterRootDevice( desc_doc_url, TvDeviceCallbackEventHandler,
|
if( ( ret = UpnpRegisterRootDevice( desc_doc_url,
|
||||||
&device_handle, &device_handle );
|
TvDeviceCallbackEventHandler,
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
&device_handle, &device_handle ) )
|
||||||
|
!= UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
SampleUtil_Print( "Error registering the rootdevice : %d\n", ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
SampleUtil_Print(
|
SampleUtil_Print( "RootDevice Registered\n" );
|
||||||
"RootDevice Registered\n"
|
|
||||||
"Initializing State Table\n");
|
SampleUtil_Print( "Initializing State Table\n" );
|
||||||
TvDeviceStateTableInit( desc_doc_url );
|
TvDeviceStateTableInit( desc_doc_url );
|
||||||
SampleUtil_Print( "State Table Initialized\n" );
|
SampleUtil_Print( "State Table Initialized\n" );
|
||||||
ret = UpnpSendAdvertisement( device_handle, default_advr_expire );
|
|
||||||
if( ret != UPNP_E_SUCCESS ) {
|
if( ( ret =
|
||||||
|
UpnpSendAdvertisement( device_handle, default_advr_expire ) )
|
||||||
|
!= UPNP_E_SUCCESS ) {
|
||||||
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
SampleUtil_Print( "Error sending advertisements : %d\n", ret );
|
||||||
UpnpFinish( );
|
UpnpFinish( );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleUtil_Print( "Advertisements Sent\n" );
|
SampleUtil_Print( "Advertisements Sent\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_TV_DEVICE_H
|
#ifndef UPNP_TV_DEVICE_H
|
||||||
#define UPNP_TV_DEVICE_H
|
#define UPNP_TV_DEVICE_H
|
||||||
@@ -42,9 +41,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef WIN32
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "sample_util.h"
|
#include "sample_util.h"
|
||||||
@@ -632,7 +629,7 @@ int TvDeviceDecreaseBrightness(IN IXML_Document *in, OUT IXML_Document **out,
|
|||||||
|
|
||||||
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
int TvDeviceStart(char * ip_address, unsigned short port,char * desc_doc_name,
|
||||||
char *web_dir_path, print_string pfun);
|
char *web_dir_path, print_string pfun);
|
||||||
int TvDeviceStop(void);
|
int TvDeviceStop();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,156 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \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,108 +1,82 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ithread.h"
|
|
||||||
#include "ixml.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnpdebug.h"
|
#include "upnpdebug.h"
|
||||||
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "ithread.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! Mutex to synchronize all the log file opeartions in the debug mode */
|
//Mutex to synchronize all the log file opeartions in the debug mode
|
||||||
static ithread_mutex_t GlobalDebugMutex;
|
static ithread_mutex_t GlobalDebugMutex;
|
||||||
|
|
||||||
/*! Global log level */
|
// Global log level
|
||||||
static Upnp_LogLevel g_log_level = UPNP_DEFAULT_LOG_LEVEL;
|
static Upnp_LogLevel g_log_level = UPNP_DEFAULT_LOG_LEVEL;
|
||||||
|
|
||||||
/*! File handle for the error log file */
|
//File handle for the error log file
|
||||||
static FILE *ErrFileHnd = NULL;
|
static FILE *ErrFileHnd = NULL;
|
||||||
|
|
||||||
/*! File handle for the information log file */
|
//File handle for the information log file
|
||||||
static FILE *InfoFileHnd = NULL;
|
static FILE *InfoFileHnd = NULL;
|
||||||
|
|
||||||
/*! Name of the error file */
|
//Name of the error file
|
||||||
static const char *errFileName = "IUpnpErrFile.txt";
|
static const char *errFileName = "IUpnpErrFile.txt";
|
||||||
|
|
||||||
/*! Name of the info file */
|
//Name of the info file
|
||||||
static const char *infoFileName = "IUpnpInfoFile.txt";
|
static const char *infoFileName = "IUpnpInfoFile.txt";
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
int UpnpInitLog(void)
|
* Function : UpnpSetLogFileNames
|
||||||
{
|
*
|
||||||
ithread_mutex_init(&GlobalDebugMutex, NULL);
|
* Parameters:
|
||||||
if(DEBUG_TARGET == 1) {
|
* IN const char* ErrFileName: name of the error file
|
||||||
if((ErrFileHnd = fopen( errFileName, "a")) == NULL) {
|
* IN const char *InfoFileName: name of the information file
|
||||||
return -1;
|
* IN int size: Size of the buffer
|
||||||
}
|
* IN int starLength: This parameter provides the width of the banner
|
||||||
if((InfoFileHnd = fopen( infoFileName, "a")) == NULL) {
|
*
|
||||||
return -1;
|
* Description:
|
||||||
}
|
* This functions takes the buffer and writes the buffer in the file as
|
||||||
}
|
* per the requested banner
|
||||||
return UPNP_E_SUCCESS;
|
* Returns: void
|
||||||
}
|
***************************************************************************/
|
||||||
|
void
|
||||||
|
UpnpSetLogFileNames ( IN const char *ErrFileName,
|
||||||
void UpnpSetLogLevel(Upnp_LogLevel log_level)
|
IN const char *InfoFileName )
|
||||||
{
|
|
||||||
g_log_level = log_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpCloseLog(void)
|
|
||||||
{
|
|
||||||
if (DEBUG_TARGET == 1) {
|
|
||||||
fflush(ErrFileHnd);
|
|
||||||
fflush(InfoFileHnd);
|
|
||||||
fclose(ErrFileHnd);
|
|
||||||
fclose(InfoFileHnd);
|
|
||||||
}
|
|
||||||
ithread_mutex_destroy(&GlobalDebugMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpSetLogFileNames(
|
|
||||||
const char *ErrFileName,
|
|
||||||
const char *InfoFileName)
|
|
||||||
{
|
{
|
||||||
if( ErrFileName ) {
|
if( ErrFileName ) {
|
||||||
errFileName = ErrFileName;
|
errFileName = ErrFileName;
|
||||||
@@ -113,9 +87,91 @@ void UpnpSetLogFileNames(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : UpnpInitLog
|
||||||
|
*
|
||||||
|
* Parameters: void
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions initializes the log files
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* -1 : If fails
|
||||||
|
* UPNP_E_SUCCESS : if success
|
||||||
|
***************************************************************************/
|
||||||
|
int
|
||||||
|
UpnpInitLog()
|
||||||
|
{
|
||||||
|
ithread_mutex_init( &GlobalDebugMutex, NULL );
|
||||||
|
|
||||||
|
if( DEBUG_TARGET == 1 ) {
|
||||||
|
if( ( ErrFileHnd = fopen( errFileName, "a" ) ) == NULL )
|
||||||
|
return -1;
|
||||||
|
if( ( InfoFileHnd = fopen( infoFileName, "a" ) ) == NULL )
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return UPNP_E_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : UpnpSetLogLevel
|
||||||
|
*
|
||||||
|
* Parameters: Upnp_LogLevel log_level
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions set the log level (see {\tt Upnp_LogLevel}
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
|
void
|
||||||
|
UpnpSetLogLevel (Upnp_LogLevel log_level)
|
||||||
|
{
|
||||||
|
g_log_level = log_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : UpnpCloseLog
|
||||||
|
*
|
||||||
|
* Parameters: void
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions closes the log files
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
|
void
|
||||||
|
UpnpCloseLog()
|
||||||
|
{
|
||||||
|
if( DEBUG_TARGET == 1 ) {
|
||||||
|
fflush( ErrFileHnd );
|
||||||
|
fflush( InfoFileHnd );
|
||||||
|
fclose( ErrFileHnd );
|
||||||
|
fclose( InfoFileHnd );
|
||||||
|
}
|
||||||
|
ithread_mutex_destroy( &GlobalDebugMutex );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : DebugAtThisLevel
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
||||||
|
* whether debug statement will go to standard output,
|
||||||
|
* or any of the log files.
|
||||||
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions returns true if debug output should be done in this
|
||||||
|
* module.
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
***************************************************************************/
|
||||||
|
#ifdef DEBUG
|
||||||
int DebugAtThisLevel(
|
int DebugAtThisLevel(
|
||||||
Upnp_LogLevel DLevel,
|
IN Upnp_LogLevel DLevel,
|
||||||
Dbg_Module Module)
|
IN Dbg_Module Module)
|
||||||
{
|
{
|
||||||
int ret = DLevel <= g_log_level;
|
int ret = DLevel <= g_log_level;
|
||||||
ret &=
|
ret &=
|
||||||
@@ -130,14 +186,37 @@ int DebugAtThisLevel(
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : UpnpPrintf
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
||||||
|
* whether debug statement will go to standard output,
|
||||||
|
* or any of the log files.
|
||||||
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
|
* IN char *DbgFileName: Name of the file from where debug statement is
|
||||||
|
* coming
|
||||||
|
* IN int DbgLineNo : Line number of the file from where debug statement
|
||||||
|
* is coming
|
||||||
|
* IN char * FmtStr, ...: Variable number of arguments that will go
|
||||||
|
* in the debug statement
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions prints the debug statement either on the startdard
|
||||||
|
* output or log file along with the information from where this debug
|
||||||
|
* statement is coming
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
|
#ifdef DEBUG
|
||||||
void UpnpPrintf(
|
void UpnpPrintf(
|
||||||
Upnp_LogLevel DLevel,
|
IN Upnp_LogLevel DLevel,
|
||||||
Dbg_Module Module,
|
IN Dbg_Module Module,
|
||||||
const char *DbgFileName,
|
IN const char *DbgFileName,
|
||||||
int DbgLineNo,
|
IN int DbgLineNo,
|
||||||
const char *FmtStr,
|
IN const char *FmtStr,
|
||||||
... )
|
... )
|
||||||
{
|
{
|
||||||
va_list ArgList;
|
va_list ArgList;
|
||||||
@@ -170,8 +249,26 @@ void UpnpPrintf(
|
|||||||
va_end(ArgList);
|
va_end(ArgList);
|
||||||
ithread_mutex_unlock(&GlobalDebugMutex);
|
ithread_mutex_unlock(&GlobalDebugMutex);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : UpnpGetDebugFile
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN Upnp_LogLevel DLevel: The level of the debug logging. It will decide
|
||||||
|
* whether debug statement will go to standard output,
|
||||||
|
* or any of the log files.
|
||||||
|
* IN Dbg_Module Module: debug will go in the name of this module
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function checks if the module is turned on for debug
|
||||||
|
* and returns the file descriptor corresponding to the debug level
|
||||||
|
* Returns: FILE *
|
||||||
|
* NULL : if the module is turn off for debug
|
||||||
|
* else returns the right file descriptor
|
||||||
|
***************************************************************************/
|
||||||
|
#ifdef DEBUG
|
||||||
FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
FILE *GetDebugFile( Upnp_LogLevel DLevel, Dbg_Module Module )
|
||||||
{
|
{
|
||||||
FILE *ret;
|
FILE *ret;
|
||||||
@@ -190,51 +287,65 @@ FILE *GetDebugFile(Upnp_LogLevel DLevel, Dbg_Module Module)
|
|||||||
|
|
||||||
return ret;
|
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
|
#endif
|
||||||
);
|
|
||||||
if (DbgFileName) {
|
|
||||||
sprintf(buf[1],
|
|
||||||
"FILE: %s, LINE: %d",
|
|
||||||
DbgFileName,
|
|
||||||
DbgLineNo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Show the lines centered */
|
|
||||||
UpnpDisplayBanner(fd, lines, NLINES, NUMBER_OF_STARS);
|
/***************************************************************************
|
||||||
|
* Function : UpnpDisplayFileAndLine
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN FILE *fd: File descriptor where line number and file name will be
|
||||||
|
* written
|
||||||
|
* IN char *DbgFileName: Name of the file
|
||||||
|
* IN int DbgLineNo : Line number of the file
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function writes the file name and file number from where
|
||||||
|
* debug statement is coming to the log file
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
|
#ifdef DEBUG
|
||||||
|
void UpnpDisplayFileAndLine(
|
||||||
|
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);
|
fflush(fd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Function : UpnpDisplayBanner
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN FILE *fd: file descriptor where the banner will be written
|
||||||
|
* IN char **lines: The buffer that will be written
|
||||||
|
* IN int size: Size of the buffer
|
||||||
|
* IN int starLength: This parameter provides the width of the banner
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This functions takes the buffer and writes the buffer in the file as
|
||||||
|
* per the requested banner
|
||||||
|
* Returns: void
|
||||||
|
***************************************************************************/
|
||||||
|
#ifdef DEBUG
|
||||||
void UpnpDisplayBanner(
|
void UpnpDisplayBanner(
|
||||||
FILE * fd,
|
IN FILE * fd,
|
||||||
const char **lines,
|
IN const char **lines,
|
||||||
size_t size,
|
IN size_t size,
|
||||||
int starLength)
|
IN int starLength)
|
||||||
{
|
{
|
||||||
int leftMarginLength = starLength / 2 + 1;
|
int leftMarginLength = starLength / 2 + 1;
|
||||||
int rightMarginLength = starLength / 2 + 1;
|
int rightMarginLength = starLength / 2 + 1;
|
||||||
@@ -282,74 +393,5 @@ void UpnpDisplayBanner(
|
|||||||
free( rightMargin );
|
free( rightMargin );
|
||||||
free( leftMargin );
|
free( leftMargin );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void PrintThreadPoolStats(
|
|
||||||
ThreadPool *tp,
|
|
||||||
const char *DbgFileName,
|
|
||||||
int DbgLineNo,
|
|
||||||
const char *msg)
|
|
||||||
{
|
|
||||||
ThreadPoolStats stats;
|
|
||||||
ThreadPoolGetStats(tp, &stats);
|
|
||||||
UpnpPrintf(UPNP_INFO, API, DbgFileName, DbgLineNo,
|
|
||||||
"%s\n"
|
|
||||||
"High Jobs pending: %d\n"
|
|
||||||
"Med Jobs Pending: %d\n"
|
|
||||||
"Low Jobs Pending: %d\n"
|
|
||||||
"Average wait in High Q in milliseconds: %lf\n"
|
|
||||||
"Average wait in Med Q in milliseconds: %lf\n"
|
|
||||||
"Average wait in Low Q in milliseconds: %lf\n"
|
|
||||||
"Max Threads Used: %d\n"
|
|
||||||
"Worker Threads: %d\n"
|
|
||||||
"Persistent Threads: %d\n"
|
|
||||||
"Idle Threads: %d\n"
|
|
||||||
"Total Threads: %d\n"
|
|
||||||
"Total Work Time: %lf\n"
|
|
||||||
"Total Idle Time: %lf\n",
|
|
||||||
msg,
|
|
||||||
stats.currentJobsHQ,
|
|
||||||
stats.currentJobsMQ,
|
|
||||||
stats.currentJobsLQ,
|
|
||||||
stats.avgWaitHQ,
|
|
||||||
stats.avgWaitMQ,
|
|
||||||
stats.avgWaitLQ,
|
|
||||||
stats.maxThreads,
|
|
||||||
stats.workerThreads,
|
|
||||||
stats.persistentThreads,
|
|
||||||
stats.idleThreads,
|
|
||||||
stats.totalThreads,
|
|
||||||
stats.totalWorkTime,
|
|
||||||
stats.totalIdleTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,83 +1,56 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if EXCLUDE_DOM == 0
|
#if EXCLUDE_DOM == 0
|
||||||
|
|
||||||
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnptools.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "uri.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include "upnptools.h"
|
||||||
|
#include "uri.h"
|
||||||
|
|
||||||
/*! Maximum action header buffer length. */
|
|
||||||
#define HEADER_LENGTH 2000
|
#define HEADER_LENGTH 2000
|
||||||
|
|
||||||
|
// Structure to maintain a error code and string associated with the
|
||||||
/*!
|
// error code
|
||||||
* \brief Structure to maintain a error code and string associated with the
|
|
||||||
* error code.
|
|
||||||
*/
|
|
||||||
struct ErrorString {
|
struct ErrorString {
|
||||||
/*! Error code. */
|
int rc; /* error code */
|
||||||
int rc;
|
const char *rcError; /* error description */
|
||||||
/*! Error description. */
|
|
||||||
const char *rcError;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Initializing the array of error structures.
|
||||||
/*!
|
struct ErrorString ErrorMessages[] = { {UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
||||||
* \brief Array of error structures.
|
|
||||||
*/
|
|
||||||
struct ErrorString ErrorMessages[] = {
|
|
||||||
{UPNP_E_SUCCESS, "UPNP_E_SUCCESS"},
|
|
||||||
{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"},
|
{UPNP_E_INVALID_HANDLE, "UPNP_E_INVALID_HANDLE"},
|
||||||
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
{UPNP_E_INVALID_PARAM, "UPNP_E_INVALID_PARAM"},
|
||||||
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
{UPNP_E_OUTOF_HANDLE, "UPNP_E_OUTOF_HANDLE"},
|
||||||
{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"},
|
{UPNP_E_OUTOF_CONTEXT, "UPNP_E_OUTOF_CONTEXT"},
|
||||||
{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMORY"},
|
{UPNP_E_OUTOF_MEMORY, "UPNP_E_OUTOF_MEMOR"},
|
||||||
{UPNP_E_INIT, "UPNP_E_INIT"},
|
{UPNP_E_INIT, "UPNP_E_INIT"},
|
||||||
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
{UPNP_E_BUFFER_TOO_SMALL, "UPNP_E_BUFFER_TOO_SMALL"},
|
||||||
{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"},
|
{UPNP_E_INVALID_DESC, "UPNP_E_INVALID_DESC"},
|
||||||
@@ -90,10 +63,7 @@ struct ErrorString ErrorMessages[] = {
|
|||||||
{UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"},
|
{UPNP_E_INVALID_ACTION, "UPNP_E_INVALID_ACTION"},
|
||||||
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
{UPNP_E_FINISH, "UPNP_E_FINISH"},
|
||||||
{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"},
|
{UPNP_E_INIT_FAILED, "UPNP_E_INIT_FAILED"},
|
||||||
{UPNP_E_URL_TOO_BIG, "UPNP_E_URL_TOO_BIG"},
|
|
||||||
{UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"},
|
{UPNP_E_BAD_HTTPMSG, "UPNP_E_BAD_HTTPMSG"},
|
||||||
{UPNP_E_ALREADY_REGISTERED, "UPNP_E_ALREADY_REGISTERED"},
|
|
||||||
{UPNP_E_INVALID_INTERFACE, "UPNP_E_INVALID_INTERFACE"},
|
|
||||||
{UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"},
|
{UPNP_E_NETWORK_ERROR, "UPNP_E_NETWORK_ERROR"},
|
||||||
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
{UPNP_E_SOCKET_WRITE, "UPNP_E_SOCKET_WRITE"},
|
||||||
{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"},
|
{UPNP_E_SOCKET_READ, "UPNP_E_SOCKET_READ"},
|
||||||
@@ -101,91 +71,112 @@ struct ErrorString ErrorMessages[] = {
|
|||||||
{UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"},
|
{UPNP_E_SOCKET_CONNECT, "UPNP_E_SOCKET_CONNECT"},
|
||||||
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
{UPNP_E_OUTOF_SOCKET, "UPNP_E_OUTOF_SOCKET"},
|
||||||
{UPNP_E_LISTEN, "UPNP_E_LISTEN"},
|
{UPNP_E_LISTEN, "UPNP_E_LISTEN"},
|
||||||
{UPNP_E_TIMEDOUT, "UPNP_E_TIMEDOUT"},
|
|
||||||
{UPNP_E_SOCKET_ERROR, "UPNP_E_SOCKET_ERROR"},
|
|
||||||
{UPNP_E_FILE_WRITE_ERROR, "UPNP_E_FILE_WRITE_ERROR"},
|
|
||||||
{UPNP_E_CANCELED, "UPNP_E_CANCELED"},
|
|
||||||
{UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"},
|
{UPNP_E_EVENT_PROTOCOL, "UPNP_E_EVENT_PROTOCOL"},
|
||||||
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
{UPNP_E_SUBSCRIBE_UNACCEPTED, "UPNP_E_SUBSCRIBE_UNACCEPTED"},
|
||||||
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
{UPNP_E_UNSUBSCRIBE_UNACCEPTED, "UPNP_E_UNSUBSCRIBE_UNACCEPTED"},
|
||||||
{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"},
|
{UPNP_E_NOTIFY_UNACCEPTED, "UPNP_E_NOTIFY_UNACCEPTED"},
|
||||||
{UPNP_E_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"},
|
{UPNP_E_INTERNAL_ERROR, "UPNP_E_INTERNAL_ERROR"},
|
||||||
|
{UPNP_E_INVALID_ARGUMENT, "UPNP_E_INVALID_ARGUMENT"},
|
||||||
|
{UPNP_E_OUTOF_BOUNDS, "UPNP_E_OUTOF_BOUNDS"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
const char *UpnpGetErrorMessage(int rc)
|
* 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 )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof (ErrorMessages) / sizeof (ErrorMessages[0]); ++i) {
|
for( i = 0; i < sizeof( ErrorMessages ) / sizeof( ErrorMessages[0] );
|
||||||
if (rc == ErrorMessages[i].rc) {
|
i++ ) {
|
||||||
|
if( rc == ErrorMessages[i].rc )
|
||||||
return ErrorMessages[i].rcError;
|
return ErrorMessages[i].rcError;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown error code";
|
return "Unknown Error";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : UpnpResolveURL
|
||||||
* \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
|
* Parameters:
|
||||||
* future it would be nice to clean this up.
|
* IN char * BaseURL: Base URL string
|
||||||
*/
|
* IN char * RelURL: relative URL string
|
||||||
int UpnpResolveURL(
|
* OUT char * AbsURL: Absolute URL string
|
||||||
const char *BaseURL,
|
* Description:
|
||||||
const char *RelURL,
|
* This functions concatinates the base URL and relative URL to generate
|
||||||
char *AbsURL)
|
* 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 )
|
||||||
{
|
{
|
||||||
int ret = UPNP_E_SUCCESS;
|
// There is some unnecessary allocation and
|
||||||
char *tempRel = NULL;
|
// 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
|
||||||
|
|
||||||
if (RelURL == NULL) {
|
char *tempRel;
|
||||||
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 );
|
tempRel = resolve_rel_url((char*) BaseURL, (char*) RelURL );
|
||||||
|
|
||||||
if( tempRel ) {
|
if( tempRel ) {
|
||||||
strcpy( AbsURL, tempRel );
|
strcpy( AbsURL, tempRel );
|
||||||
free( tempRel );
|
free( tempRel );
|
||||||
} else {
|
} else {
|
||||||
ret = UPNP_E_INVALID_URL;
|
return UPNP_E_INVALID_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitFunction:
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : addToAction
|
||||||
* \brief Adds the argument in the action request or response.
|
|
||||||
*
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN int response: flag to tell if the ActionDoc is for response
|
||||||
|
* or request
|
||||||
|
* INOUT IXML_Document **ActionDoc: request or response document
|
||||||
|
* IN char *ActionName: Name of the action request or response
|
||||||
|
* IN char *ServType: Service type
|
||||||
|
* IN char * ArgName: Name of the argument
|
||||||
|
* IN char * ArgValue: Value of the argument
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function adds the argument in the action request or response.
|
||||||
* This function creates the action request or response if it is a first
|
* This function creates the action request or response if it is a first
|
||||||
* argument, otherwise it will add the argument in the document.
|
* argument else it will add the argument in the document
|
||||||
*
|
*
|
||||||
* \returns UPNP_E_SUCCESS if successful, otherwise the appropriate error.
|
* Returns: int
|
||||||
*/
|
* returns UPNP_E_SUCCESS if successful else returns appropriate error
|
||||||
static int addToAction(
|
***************************************************************************/
|
||||||
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
static int
|
||||||
int response,
|
addToAction( IN int response,
|
||||||
/*! [in,out] Request or response document. */
|
INOUT IXML_Document ** ActionDoc,
|
||||||
IXML_Document **ActionDoc,
|
IN const char *ActionName,
|
||||||
/*! [in] Name of the action request or response. */
|
IN const char *ServType,
|
||||||
const char *ActionName,
|
IN const char *ArgName,
|
||||||
/*! [in] Service type. */
|
IN const char *ArgValue )
|
||||||
const char *ServType,
|
|
||||||
/*! [in] Name of the argument. */
|
|
||||||
const char *ArgName,
|
|
||||||
/*! [in] Value of the argument. */
|
|
||||||
const char *ArgValue)
|
|
||||||
{
|
{
|
||||||
char *ActBuff = NULL;
|
char *ActBuff = NULL;
|
||||||
IXML_Node *node = NULL;
|
IXML_Node *node = NULL;
|
||||||
@@ -231,32 +222,39 @@ static int addToAction(
|
|||||||
Txt = ixmlDocument_createTextNode( *ActionDoc, ArgValue );
|
Txt = ixmlDocument_createTextNode( *ActionDoc, ArgValue );
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : makeAction
|
||||||
* \brief Creates the action request or response from the argument list.
|
|
||||||
*
|
*
|
||||||
* \return Action request or response document if successful, otherwise
|
* Parameters:
|
||||||
* returns NULL
|
* IN int response: flag to tell if the ActionDoc is for response
|
||||||
*/
|
* or request
|
||||||
static IXML_Document *makeAction(
|
* IN char * ActionName: Name of the action request or response
|
||||||
/*! [in] flag to tell if the ActionDoc is for response or request. */
|
* IN char * ServType: Service type
|
||||||
int response,
|
* IN int NumArg :Number of arguments in the action request or response
|
||||||
/*! [in] Name of the action request or response. */
|
* IN char * Arg : pointer to the first argument
|
||||||
const char *ActionName,
|
* IN va_list ArgList: Argument list
|
||||||
/*! [in] Service type. */
|
*
|
||||||
const char *ServType,
|
* Description:
|
||||||
/*! [in] Number of arguments in the action request or response. */
|
* This function creates the action request or response from the argument
|
||||||
int NumArg,
|
* list.
|
||||||
/*! [in] pointer to the first argument. */
|
* Returns: IXML_Document *
|
||||||
const char *Arg,
|
* returns action request or response document if successful
|
||||||
/*! [in] Argument list. */
|
* else returns NULL
|
||||||
va_list ArgList)
|
***************************************************************************/
|
||||||
|
static IXML_Document *
|
||||||
|
makeAction( IN int response,
|
||||||
|
IN const char *ActionName,
|
||||||
|
IN const char *ServType,
|
||||||
|
IN int NumArg,
|
||||||
|
IN const char *Arg,
|
||||||
|
IN va_list ArgList )
|
||||||
{
|
{
|
||||||
const char *ArgName;
|
const char *ArgName;
|
||||||
const char *ArgValue;
|
const char *ArgValue;
|
||||||
@@ -285,12 +283,14 @@ static IXML_Document *makeAction(
|
|||||||
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
"<u:%s xmlns:u=\"%s\">\r\n</u:%s>",
|
||||||
ActionName, ServType, ActionName );
|
ActionName, ServType, ActionName );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) {
|
if( ixmlParseBufferEx( ActBuff, &ActionDoc ) != IXML_SUCCESS ) {
|
||||||
free( ActBuff );
|
free( ActBuff );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free( ActBuff );
|
free( ActBuff );
|
||||||
|
|
||||||
if( ActionDoc == NULL ) {
|
if( ActionDoc == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -300,15 +300,19 @@ static IXML_Document *makeAction(
|
|||||||
ArgName = Arg;
|
ArgName = Arg;
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
ArgValue = va_arg( ArgList, const char * );
|
ArgValue = va_arg( ArgList, const char * );
|
||||||
|
|
||||||
if( ArgName != NULL ) {
|
if( ArgName != NULL ) {
|
||||||
node = ixmlNode_getFirstChild( ( IXML_Node * ) ActionDoc );
|
node = ixmlNode_getFirstChild( ( IXML_Node * ) ActionDoc );
|
||||||
Ele = ixmlDocument_createElement( ActionDoc, ArgName );
|
Ele = ixmlDocument_createElement( ActionDoc, ArgName );
|
||||||
if( ArgValue ) {
|
if( ArgValue ) {
|
||||||
Txt = ixmlDocument_createTextNode(ActionDoc, ArgValue);
|
Txt =
|
||||||
|
ixmlDocument_createTextNode( ActionDoc, ArgValue );
|
||||||
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
||||||
}
|
}
|
||||||
|
|
||||||
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
ixmlNode_appendChild( node, ( IXML_Node * ) Ele );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++Idx < NumArg) {
|
if (++Idx < NumArg) {
|
||||||
ArgName = va_arg( ArgList, const char * );
|
ArgName = va_arg( ArgList, const char * );
|
||||||
} else {
|
} else {
|
||||||
@@ -321,9 +325,28 @@ static IXML_Document *makeAction(
|
|||||||
return ActionDoc;
|
return ActionDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
IXML_Document *UpnpMakeAction(
|
* Function : UpnpMakeAction
|
||||||
const char *ActionName,
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN char * ActionName: Name of the action request or response
|
||||||
|
* IN char * ServType: Service type
|
||||||
|
* IN int NumArg :Number of arguments in the action request or response
|
||||||
|
* IN char * Arg : pointer to the first argument
|
||||||
|
* IN ... : variable argument list
|
||||||
|
* IN va_list ArgList: Argument list
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function creates the action request from the argument
|
||||||
|
* list. Its a wrapper function that calls makeAction function to create
|
||||||
|
* the action request.
|
||||||
|
*
|
||||||
|
* Returns: IXML_Document *
|
||||||
|
* returns action request document if successful
|
||||||
|
* else returns NULL
|
||||||
|
***************************************************************************/
|
||||||
|
IXML_Document *
|
||||||
|
UpnpMakeAction( const char *ActionName,
|
||||||
const char *ServType,
|
const char *ServType,
|
||||||
int NumArg,
|
int NumArg,
|
||||||
const char *Arg,
|
const char *Arg,
|
||||||
@@ -339,9 +362,28 @@ IXML_Document *UpnpMakeAction(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
IXML_Document *UpnpMakeActionResponse(
|
* Function : UpnpMakeActionResponse
|
||||||
const char *ActionName,
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN char * ActionName: Name of the action request or response
|
||||||
|
* IN char * ServType: Service type
|
||||||
|
* IN int NumArg :Number of arguments in the action request or response
|
||||||
|
* IN char * Arg : pointer to the first argument
|
||||||
|
* IN ... : variable argument list
|
||||||
|
* IN va_list ArgList: Argument list
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function creates the action response from the argument
|
||||||
|
* list. Its a wrapper function that calls makeAction function to create
|
||||||
|
* the action response.
|
||||||
|
*
|
||||||
|
* Returns: IXML_Document *
|
||||||
|
* returns action response document if successful
|
||||||
|
* else returns NULL
|
||||||
|
***************************************************************************/
|
||||||
|
IXML_Document *
|
||||||
|
UpnpMakeActionResponse( const char *ActionName,
|
||||||
const char *ServType,
|
const char *ServType,
|
||||||
int NumArg,
|
int NumArg,
|
||||||
const char *Arg,
|
const char *Arg,
|
||||||
@@ -357,86 +399,89 @@ IXML_Document *UpnpMakeActionResponse(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : UpnpAddToActionResponse
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* INOUT IXML_Document **ActionResponse: action response document
|
||||||
|
* IN char * ActionName: Name of the action request or response
|
||||||
|
* IN char * ServType: Service type
|
||||||
|
* IN int ArgName :Name of argument to be added in the action response
|
||||||
|
* IN char * ArgValue : value of the argument
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function adds the argument in the action response. Its a wrapper
|
||||||
|
* function that calls addToAction function to add the argument in the
|
||||||
|
* action response.
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* returns UPNP_E_SUCCESS if successful
|
||||||
|
* else returns appropriate error
|
||||||
|
***************************************************************************/
|
||||||
|
int
|
||||||
|
UpnpAddToActionResponse( INOUT IXML_Document ** ActionResponse,
|
||||||
|
IN const char *ActionName,
|
||||||
|
IN const char *ServType,
|
||||||
|
IN const char *ArgName,
|
||||||
|
IN const char *ArgValue )
|
||||||
|
{
|
||||||
|
return addToAction( 1, ActionResponse, ActionName, ServType, ArgName,
|
||||||
|
ArgValue );
|
||||||
|
}
|
||||||
|
|
||||||
int UpnpAddToAction(
|
/************************************************************************
|
||||||
IXML_Document **ActionDoc,
|
* 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 *ActionName,
|
||||||
const char *ServType,
|
const char *ServType,
|
||||||
const char *ArgName,
|
const char *ArgName,
|
||||||
const char *ArgValue )
|
const char *ArgValue )
|
||||||
{
|
{
|
||||||
return addToAction(0, ActionDoc, ActionName, ServType, ArgName, ArgValue);
|
|
||||||
|
return addToAction( 0, ActionDoc, ActionName, ServType, ArgName,
|
||||||
|
ArgValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
int UpnpAddToActionResponse(
|
* Function : UpnpAddToPropertySet
|
||||||
IXML_Document **ActionResponse,
|
*
|
||||||
const char *ActionName,
|
* Parameters:
|
||||||
const char *ServType,
|
* INOUT IXML_Document **PropSet: propertyset document
|
||||||
const char *ArgName,
|
* IN char *ArgName: Name of the argument
|
||||||
const char *ArgValue)
|
* 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 )
|
||||||
{
|
{
|
||||||
return addToAction(1, ActionResponse, ActionName, ServType, ArgName, ArgValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas"
|
||||||
IXML_Document *UpnpCreatePropertySet(
|
"-upnp-org:event-1-0\"></e:propertyset>";
|
||||||
int NumArg,
|
|
||||||
const char *Arg,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list ArgList;
|
|
||||||
int Idx = 0;
|
|
||||||
char BlankDoc[] =
|
|
||||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
|
|
||||||
"</e:propertyset>";
|
|
||||||
const char *ArgName,
|
|
||||||
*ArgValue;
|
|
||||||
IXML_Node *node;
|
|
||||||
IXML_Element *Ele;
|
|
||||||
IXML_Element *Ele1;
|
|
||||||
IXML_Node *Txt;
|
|
||||||
IXML_Document *PropSet;
|
|
||||||
|
|
||||||
if(ixmlParseBufferEx(BlankDoc, &PropSet) != IXML_SUCCESS) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NumArg < 1) {
|
|
||||||
return PropSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(ArgList, Arg);
|
|
||||||
ArgName = Arg;
|
|
||||||
while (Idx++ != NumArg) {
|
|
||||||
ArgValue = va_arg(ArgList, const char *);
|
|
||||||
if (ArgName != NULL /*&& ArgValue != NULL */) {
|
|
||||||
node = ixmlNode_getFirstChild((IXML_Node *)PropSet);
|
|
||||||
Ele1 = ixmlDocument_createElement(PropSet, "e:property");
|
|
||||||
Ele = ixmlDocument_createElement(PropSet, ArgName);
|
|
||||||
if (ArgValue) {
|
|
||||||
Txt = ixmlDocument_createTextNode(PropSet, ArgValue);
|
|
||||||
ixmlNode_appendChild((IXML_Node *)Ele, Txt);
|
|
||||||
}
|
|
||||||
ixmlNode_appendChild((IXML_Node *)Ele1, (IXML_Node *)Ele);
|
|
||||||
ixmlNode_appendChild( node, (IXML_Node *)Ele1);
|
|
||||||
}
|
|
||||||
ArgName = va_arg(ArgList, const char *);
|
|
||||||
}
|
|
||||||
va_end(ArgList);
|
|
||||||
|
|
||||||
return PropSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UpnpAddToPropertySet(
|
|
||||||
IXML_Document **PropSet,
|
|
||||||
const char *ArgName,
|
|
||||||
const char *ArgValue)
|
|
||||||
{
|
|
||||||
char BlankDoc[] =
|
|
||||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"
|
|
||||||
"</e:propertyset>";
|
|
||||||
IXML_Node *node;
|
IXML_Node *node;
|
||||||
IXML_Element *Ele;
|
IXML_Element *Ele;
|
||||||
IXML_Element *Ele1;
|
IXML_Element *Ele1;
|
||||||
@@ -470,6 +515,71 @@ int UpnpAddToPropertySet(
|
|||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : UpnpCreatePropertySet
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN int NumArg: Number of argument that will go in the propertyset node
|
||||||
|
* IN char * Args: argument strings
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function creates a propertyset node and put all the input
|
||||||
|
* parameters in the node as elements
|
||||||
|
*
|
||||||
|
* Returns: IXML_Document *
|
||||||
|
* returns the document containing propertyset node.
|
||||||
|
***************************************************************************/
|
||||||
|
IXML_Document *
|
||||||
|
UpnpCreatePropertySet( IN int NumArg,
|
||||||
|
IN const char *Arg,
|
||||||
|
... )
|
||||||
|
{
|
||||||
|
va_list ArgList;
|
||||||
|
int Idx = 0;
|
||||||
|
char BlankDoc[] = "<e:propertyset xmlns:e=\"urn:schemas-"
|
||||||
|
"upnp-org:event-1-0\"></e:propertyset>";
|
||||||
|
const char *ArgName,
|
||||||
|
*ArgValue;
|
||||||
|
IXML_Node *node;
|
||||||
|
IXML_Element *Ele;
|
||||||
|
IXML_Element *Ele1;
|
||||||
|
IXML_Node *Txt;
|
||||||
|
IXML_Document *PropSet;
|
||||||
|
|
||||||
#endif /* EXCLUDE_DOM == 0 */
|
if( ixmlParseBufferEx( BlankDoc, &PropSet ) != IXML_SUCCESS ) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( NumArg < 1 ) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start( ArgList, Arg );
|
||||||
|
ArgName = Arg;
|
||||||
|
|
||||||
|
while( Idx++ != NumArg ) {
|
||||||
|
ArgValue = va_arg( ArgList, const char * );
|
||||||
|
|
||||||
|
if( ArgName != NULL /*&& ArgValue != NULL */ ) {
|
||||||
|
node = ixmlNode_getFirstChild( ( IXML_Node * ) PropSet );
|
||||||
|
Ele1 = ixmlDocument_createElement( PropSet, "e:property" );
|
||||||
|
Ele = ixmlDocument_createElement( PropSet, ArgName );
|
||||||
|
if( ArgValue ) {
|
||||||
|
Txt = ixmlDocument_createTextNode( PropSet, ArgValue );
|
||||||
|
ixmlNode_appendChild( ( IXML_Node * ) Ele, Txt );
|
||||||
|
}
|
||||||
|
|
||||||
|
ixmlNode_appendChild( ( IXML_Node * ) Ele1,
|
||||||
|
( IXML_Node * ) Ele );
|
||||||
|
ixmlNode_appendChild( node, ( IXML_Node * ) Ele1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgName = va_arg( ArgList, const char * );
|
||||||
|
|
||||||
|
}
|
||||||
|
va_end( ArgList );
|
||||||
|
return PropSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // EXCLUDE_DOM == 0
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file defines the functions for clients. It defines
|
* Purpose: This file defines the functions for clients. It defines
|
||||||
@@ -36,294 +36,174 @@
|
|||||||
* client
|
* client
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "client_table.h"
|
#include "client_table.h"
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
* Function : copy_client_subscription
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
#include <stdlib.h> // for calloc(), free()
|
* client_subscription * in ; - source client subscription
|
||||||
|
* client_subscription * out ; - destination client subscription
|
||||||
|
*
|
||||||
struct SClientSubscription {
|
* Description : Make a copy of the client subscription data
|
||||||
int m_renewEventId;
|
*
|
||||||
UpnpString *m_SID;
|
* Return : int ;
|
||||||
UpnpString *m_actualSID;
|
* UPNP_E_OUTOF_MEMORY - On Failure to allocate memory
|
||||||
UpnpString *m_eventURL;
|
* HTTP_SUCCESS - On Success
|
||||||
struct SClientSubscription *m_next;
|
*
|
||||||
};
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
CLIENTONLY( int copy_client_subscription( client_subscription * in,
|
||||||
/** Constructor */
|
client_subscription * out ) {
|
||||||
ClientSubscription *UpnpClientSubscription_new()
|
int len = strlen( in->ActualSID ) + 1;
|
||||||
{
|
int len1 = strlen( in->EventURL ) + 1;
|
||||||
struct SClientSubscription *p = calloc(1, sizeof (struct SClientSubscription));
|
memcpy( out->sid, in->sid, SID_SIZE );
|
||||||
#if 0
|
out->sid[SID_SIZE] = 0;
|
||||||
p->renewEventId = 0;
|
out->ActualSID = ( char * )malloc( len );
|
||||||
#endif
|
if( out->ActualSID == NULL )
|
||||||
p->m_SID = UpnpString_new();
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
p->m_actualSID = UpnpString_new();
|
out->EventURL = ( char * )malloc( len1 );
|
||||||
p->m_eventURL = UpnpString_new();
|
if( out->EventURL == NULL ) {
|
||||||
p->m_next = NULL;
|
free(out->ActualSID);
|
||||||
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
return (ClientSubscription *)p;
|
|
||||||
}
|
}
|
||||||
|
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;}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/** Destructor */
|
* Function : free_client_subscription
|
||||||
void UpnpClientSubscription_delete(ClientSubscription *p)
|
*
|
||||||
{
|
* Parameters :
|
||||||
struct SClientSubscription *q = (struct SClientSubscription *)p;
|
* client_subscription * sub ; - Client subscription to be freed
|
||||||
|
*
|
||||||
if (!q) return;
|
* Description : Free memory allocated for client subscription data.
|
||||||
|
* Remove timer thread associated with this subscription event.
|
||||||
q->m_renewEventId = 0;
|
*
|
||||||
|
* Return : void ;
|
||||||
UpnpString_delete(q->m_SID);
|
*
|
||||||
q->m_SID = NULL;
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
UpnpString_delete(q->m_actualSID);
|
void free_client_subscription( client_subscription * sub ) {
|
||||||
q->m_actualSID = NULL;
|
upnp_timeout * event; ThreadPoolJob tempJob; if( sub ) {
|
||||||
|
if( sub->ActualSID )
|
||||||
UpnpString_delete(q->m_eventURL);
|
free( sub->ActualSID ); if( sub->EventURL )
|
||||||
q->m_eventURL = NULL;
|
free( sub->EventURL ); if( sub->RenewEventId != -1 ) //do not remove timer event of copy
|
||||||
|
|
||||||
q->m_next = NULL;
|
|
||||||
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Copy Constructor */
|
|
||||||
ClientSubscription *UpnpClientSubscription_dup(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
ClientSubscription *q = UpnpClientSubscription_new();
|
|
||||||
|
|
||||||
UpnpClientSubscription_assign(q, p);
|
|
||||||
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Assignment operator */
|
|
||||||
void UpnpClientSubscription_assign(ClientSubscription *q, const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
if (q != p) {
|
|
||||||
// Do not copy RenewEventId
|
|
||||||
((struct SClientSubscription *)q)->m_renewEventId = -1;
|
|
||||||
UpnpClientSubscription_set_SID(q, UpnpClientSubscription_get_SID(p));
|
|
||||||
UpnpClientSubscription_set_ActualSID(q, UpnpClientSubscription_get_ActualSID(p));
|
|
||||||
UpnpClientSubscription_set_EventURL(q, UpnpClientSubscription_get_EventURL(p));
|
|
||||||
// Do not copy m_next
|
|
||||||
((struct SClientSubscription *)q)->m_next = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int UpnpClientSubscription_get_RenewEventId(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return ((struct SClientSubscription *)p)->m_renewEventId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_set_RenewEventId(ClientSubscription *p, int n)
|
|
||||||
{
|
|
||||||
((struct SClientSubscription *)p)->m_renewEventId = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpClientSubscription_get_SID(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return ((struct SClientSubscription *)p)->m_SID;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *UpnpClientSubscription_get_SID_cstr(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpClientSubscription_get_SID(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_set_SID(ClientSubscription *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
|
|
||||||
((struct SClientSubscription *)p)->m_SID = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_strcpy_SID(ClientSubscription *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SClientSubscription *)p)->m_SID);
|
|
||||||
((struct SClientSubscription *)p)->m_SID = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SClientSubscription *)p)->m_SID, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpClientSubscription_get_ActualSID(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return ((struct SClientSubscription *)p)->m_actualSID;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *UpnpClientSubscription_get_ActualSID_cstr(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpClientSubscription_get_ActualSID(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_set_ActualSID(ClientSubscription *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
|
|
||||||
((struct SClientSubscription *)p)->m_actualSID = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_strcpy_ActualSID(ClientSubscription *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SClientSubscription *)p)->m_actualSID);
|
|
||||||
((struct SClientSubscription *)p)->m_actualSID = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SClientSubscription *)p)->m_actualSID, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const UpnpString *UpnpClientSubscription_get_EventURL(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return ((struct SClientSubscription *)p)->m_eventURL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *UpnpClientSubscription_get_EventURL_cstr(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return UpnpString_get_String(UpnpClientSubscription_get_EventURL(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_set_EventURL(ClientSubscription *p, const UpnpString *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
|
|
||||||
((struct SClientSubscription *)p)->m_eventURL = UpnpString_dup(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_strcpy_EventURL(ClientSubscription *p, const char *s)
|
|
||||||
{
|
|
||||||
UpnpString_delete(((struct SClientSubscription *)p)->m_eventURL);
|
|
||||||
((struct SClientSubscription *)p)->m_eventURL = UpnpString_new();
|
|
||||||
UpnpString_set_String(((struct SClientSubscription *)p)->m_eventURL, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ClientSubscription *UpnpClientSubscription_get_Next(const ClientSubscription *p)
|
|
||||||
{
|
|
||||||
return (ClientSubscription *)(((struct SClientSubscription *)p)->m_next);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpClientSubscription_set_Next(ClientSubscription *p, ClientSubscription *q)
|
|
||||||
{
|
|
||||||
((struct SClientSubscription *)p)->m_next = (struct SClientSubscription *)q;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void free_client_subscription(ClientSubscription *sub)
|
|
||||||
{
|
|
||||||
upnp_timeout *event;
|
|
||||||
ThreadPoolJob tempJob;
|
|
||||||
if (sub) {
|
|
||||||
int renewEventId = UpnpClientSubscription_get_RenewEventId(sub);
|
|
||||||
UpnpClientSubscription_strcpy_ActualSID(sub, "");
|
|
||||||
UpnpClientSubscription_strcpy_EventURL(sub, "");
|
|
||||||
if (renewEventId != -1) {
|
|
||||||
// do not remove timer event of copy
|
|
||||||
//invalid timer event id
|
//invalid timer event id
|
||||||
if (TimerThreadRemove(&gTimerThread, renewEventId, &tempJob) == 0) {
|
{
|
||||||
|
if( TimerThreadRemove
|
||||||
|
( &gTimerThread, sub->RenewEventId, &tempJob ) == 0 ) {
|
||||||
event = ( upnp_timeout * ) tempJob.arg;
|
event = ( upnp_timeout * ) tempJob.arg;
|
||||||
free_upnp_timeout(event);
|
free_upnp_timeout( event );}
|
||||||
}
|
|
||||||
}
|
|
||||||
UpnpClientSubscription_set_RenewEventId(sub, -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub->RenewEventId = -1;}
|
||||||
|
}
|
||||||
|
|
||||||
void freeClientSubList(ClientSubscription *list)
|
/************************************************************************
|
||||||
{
|
* Function : freeClientSubList
|
||||||
ClientSubscription *next;
|
*
|
||||||
while (list) {
|
* 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 );
|
free_client_subscription( list );
|
||||||
next = UpnpClientSubscription_get_Next(list);
|
next = list->next; free( list ); list = next;}
|
||||||
UpnpClientSubscription_delete(list);
|
|
||||||
list = next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
void RemoveClientSubClientSID(ClientSubscription **head, const UpnpString *sid)
|
* 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
|
||||||
{
|
{
|
||||||
ClientSubscription *finger = *head;
|
previous = finger; finger = finger->next;}
|
||||||
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)
|
* Function : GetClientSubClientSID
|
||||||
{
|
*
|
||||||
ClientSubscription *next = head;
|
* Parameters :
|
||||||
int found = 0;
|
* client_subscription *head ; Head of the subscription list
|
||||||
while (next) {
|
* const Upnp_SID sid ; Subscription ID to be matched
|
||||||
found = !strcmp(
|
*
|
||||||
UpnpClientSubscription_get_SID_cstr(next),
|
* Description : Return the client subscription from the client table
|
||||||
UpnpString_get_String(sid));
|
* that matches const Upnp_SID sid subscrition id value.
|
||||||
if(found) {
|
*
|
||||||
|
* Return : client_subscription * ; The matching subscription
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
client_subscription *
|
||||||
|
GetClientSubClientSID( client_subscription * head,
|
||||||
|
const Upnp_SID sid ) {
|
||||||
|
client_subscription * next = head; while( next ) {
|
||||||
|
if( !strcmp( next->sid, sid ) )
|
||||||
break;
|
break;
|
||||||
} else {
|
else
|
||||||
next = UpnpClientSubscription_get_Next(next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ClientSubscription *GetClientSubActualSID(ClientSubscription *head, token *sid)
|
|
||||||
{
|
{
|
||||||
ClientSubscription *next = head;
|
next = next->next;}
|
||||||
while (next) {
|
}
|
||||||
if (!memcmp(
|
return next;}
|
||||||
UpnpClientSubscription_get_ActualSID_cstr(next),
|
|
||||||
sid->buff, sid->size)) {
|
/************************************************************************
|
||||||
|
* 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;
|
break;
|
||||||
} else {
|
else
|
||||||
next = UpnpClientSubscription_get_Next(next);
|
{
|
||||||
}
|
next = next->next;}
|
||||||
}
|
}
|
||||||
|
return next;}
|
||||||
|
|
||||||
return next;
|
)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,65 +1,52 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* \file
|
|
||||||
*
|
|
||||||
* \brief Contains functions for scanner and parser for http messages.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Purpose: This file contains functions for scanner and parser for http
|
||||||
|
* messages.
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
#define _GNU_SOURCE // For strcasestr() in string.h
|
#define _GNU_SOURCE // For strcasestr() in string.h
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include "strintmap.h"
|
#include "strintmap.h"
|
||||||
#include "httpparser.h"
|
#include "httpparser.h"
|
||||||
#include "statcodes.h"
|
#include "statcodes.h"
|
||||||
#include "unixutil.h"
|
#include "unixutil.h"
|
||||||
#include "upnpdebug.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* entity positions */
|
|
||||||
|
|
||||||
|
// entity positions
|
||||||
|
|
||||||
#define NUM_HTTP_METHODS 9
|
#define NUM_HTTP_METHODS 9
|
||||||
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
static str_int_entry Http_Method_Table[NUM_HTTP_METHODS] = {
|
||||||
@@ -408,13 +395,8 @@ scanner_get_str( IN scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef WIN32
|
|
||||||
#pragma message ("The only use of the function 'scanner_pushback()' in the code is commented out.")
|
|
||||||
#pragma message ("'scanner_pushback()' is a candidate for removal.")
|
|
||||||
#else
|
|
||||||
#warning The only use of the function 'scanner_pushback()' in the code is commented out.
|
#warning The only use of the function 'scanner_pushback()' in the code is commented out.
|
||||||
#warning 'scanner_pushback()' is a candidate for removal.
|
#warning 'scanner_pushback()' is a candidate for removal.
|
||||||
#endif
|
|
||||||
static UPNP_INLINE void
|
static UPNP_INLINE void
|
||||||
scanner_pushback( INOUT scanner_t * scanner,
|
scanner_pushback( INOUT scanner_t * scanner,
|
||||||
IN size_t pushback_bytes )
|
IN size_t pushback_bytes )
|
||||||
@@ -983,13 +965,8 @@ read_until_crlf( INOUT scanner_t * scanner,
|
|||||||
* PARSE_FAILURE
|
* PARSE_FAILURE
|
||||||
* PARSE_INCOMPLETE
|
* PARSE_INCOMPLETE
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
#ifdef WIN32
|
|
||||||
#pragma message("There are currently no uses of the function 'skip_to_end_of_header()' in the code.")
|
|
||||||
#pragma message("'skip_to_end_of_header()' is a candidate for removal.")
|
|
||||||
#else
|
|
||||||
#warning There are currently no uses of the function 'skip_to_end_of_header()' in the code.
|
#warning There are currently no uses of the function 'skip_to_end_of_header()' in the code.
|
||||||
#warning 'skip_to_end_of_header()' is a candidate for removal.
|
#warning 'skip_to_end_of_header()' is a candidate for removal.
|
||||||
#endif
|
|
||||||
static UPNP_INLINE int
|
static UPNP_INLINE int
|
||||||
skip_to_end_of_header( INOUT scanner_t * scanner )
|
skip_to_end_of_header( INOUT scanner_t * scanner )
|
||||||
{
|
{
|
||||||
@@ -1545,9 +1522,7 @@ parser_parse_responseline( INOUT http_parser_t * parser )
|
|||||||
|
|
||||||
if( num_scanned != 3 ||
|
if( num_scanned != 3 ||
|
||||||
hmsg->major_version < 0 ||
|
hmsg->major_version < 0 ||
|
||||||
/* HTTP version equals to 1.0 should fail as required by the
|
hmsg->minor_version < 0 || hmsg->status_code < 0 ) {
|
||||||
* UPnP certification tool */
|
|
||||||
hmsg->minor_version < 1 || hmsg->status_code < 0 ) {
|
|
||||||
// bad response line
|
// bad response line
|
||||||
return PARSE_FAILURE;
|
return PARSE_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -2511,15 +2486,26 @@ method_to_str( IN http_method_t method )
|
|||||||
return index == -1 ? NULL : Http_Method_Table[index].name;
|
return index == -1 ? NULL : Http_Method_Table[index].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function: print_http_headers
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* http_message_t* hmsg ; HTTP Message object
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* void
|
||||||
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_http_headers(http_message_t *hmsg)
|
void
|
||||||
|
print_http_headers( http_message_t * hmsg )
|
||||||
{
|
{
|
||||||
ListNode *node;
|
ListNode *node;
|
||||||
/* NNS: dlist_node *node; */
|
// NNS: dlist_node *node;
|
||||||
http_header_t *header;
|
http_header_t *header;
|
||||||
|
|
||||||
/* print start line */
|
// print start line
|
||||||
if( hmsg->is_request ) {
|
if( hmsg->is_request ) {
|
||||||
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
printf( "method = %d, version = %d.%d, url = %.*s\n",
|
||||||
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
hmsg->method, hmsg->major_version, hmsg->minor_version,
|
||||||
@@ -2530,18 +2516,18 @@ void print_http_headers(http_message_t *hmsg)
|
|||||||
(int)hmsg->status_msg.length, hmsg->status_msg.buf);
|
(int)hmsg->status_msg.length, hmsg->status_msg.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print headers */
|
// print headers
|
||||||
node = ListHead( &hmsg->headers );
|
node = ListHead( &hmsg->headers );
|
||||||
/* NNS: node = dlist_first_node( &hmsg->headers ); */
|
// NNS: node = dlist_first_node( &hmsg->headers );
|
||||||
while( node != NULL ) {
|
while( node != NULL ) {
|
||||||
header = ( http_header_t * ) node->item;
|
header = ( http_header_t * ) node->item;
|
||||||
/* NNS: header = (http_header_t *)node->data; */
|
// NNS: header = (http_header_t *)node->data;
|
||||||
printf( "hdr name: %.*s, value: %.*s\n",
|
printf( "hdr name: %.*s, value: %.*s\n",
|
||||||
(int)header->name.length, header->name.buf,
|
(int)header->name.length, header->name.buf,
|
||||||
(int)header->value.length, header->value.buf );
|
(int)header->value.length, header->value.buf );
|
||||||
|
|
||||||
node = ListNext( &hmsg->headers, node );
|
node = ListNext( &hmsg->headers, node );
|
||||||
/* NNS: node = dlist_next( &hmsg->headers, node ); */
|
// NNS: node = dlist_next( &hmsg->headers, node );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,34 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file defines the functionality making use of the http
|
* Purpose: This file defines the functionality making use of the http
|
||||||
@@ -36,28 +35,10 @@
|
|||||||
* messages
|
* messages
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "httpreadwrite.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "unixutil.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnpapi.h"
|
|
||||||
#include "membuffer.h"
|
|
||||||
#include "uri.h"
|
|
||||||
#include "statcodes.h"
|
|
||||||
#include "sock.h"
|
|
||||||
#include "UpnpInet.h"
|
|
||||||
#include "webserver.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
|
||||||
#ifndef UPNP_USE_BCBPP
|
#ifndef UPNP_USE_BCBPP
|
||||||
#ifndef UPNP_USE_MSVCPP
|
#ifndef UPNP_USE_MSVCPP
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
@@ -65,31 +46,33 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
#ifdef WIN32
|
|
||||||
#include <malloc.h>
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
#else
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "unixutil.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
#include "upnpapi.h"
|
||||||
|
#include "membuffer.h"
|
||||||
|
#include "uri.h"
|
||||||
|
#include "statcodes.h"
|
||||||
|
#include "httpreadwrite.h"
|
||||||
|
#include "sock.h"
|
||||||
|
#include "webserver.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Please, do not change these to const int while MSVC cannot understand
|
|
||||||
* const int in array dimensions.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
const int CHUNK_HEADER_SIZE = 10;
|
const int CHUNK_HEADER_SIZE = 10;
|
||||||
const int CHUNK_TAIL_SIZE = 10;
|
const int CHUNK_TAIL_SIZE = 10;
|
||||||
*/
|
|
||||||
#define CHUNK_HEADER_SIZE 10
|
|
||||||
#define CHUNK_TAIL_SIZE 10
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -135,7 +118,7 @@ http_FixUrl( IN uri_type * url,
|
|||||||
* Function: http_FixStrUrl
|
* Function: http_FixStrUrl
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN const char* urlstr; Character string as a URL
|
* IN char* urlstr ; Character string as a URL
|
||||||
* IN int urlstrlen ; Length of the character string
|
* IN int urlstrlen ; Length of the character string
|
||||||
* OUT uri_type* fixed_url ; Fixed and corrected URL
|
* OUT uri_type* fixed_url ; Fixed and corrected URL
|
||||||
*
|
*
|
||||||
@@ -147,7 +130,7 @@ http_FixUrl( IN uri_type * url,
|
|||||||
* UPNP_E_SUCCESS
|
* UPNP_E_SUCCESS
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int
|
||||||
http_FixStrUrl( IN const char *urlstr,
|
http_FixStrUrl( IN char *urlstr,
|
||||||
IN int urlstrlen,
|
IN int urlstrlen,
|
||||||
OUT uri_type * fixed_url )
|
OUT uri_type * fixed_url )
|
||||||
{
|
{
|
||||||
@@ -184,13 +167,13 @@ http_Connect( IN uri_type * destination_url,
|
|||||||
|
|
||||||
http_FixUrl( destination_url, url );
|
http_FixUrl( destination_url, url );
|
||||||
|
|
||||||
connfd = socket( url->hostport.IPaddress.ss_family, SOCK_STREAM, 0 );
|
connfd = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
if( connfd == -1 ) {
|
if( connfd == -1 ) {
|
||||||
return UPNP_E_OUTOF_SOCKET;
|
return UPNP_E_OUTOF_SOCKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( connect( connfd, ( struct sockaddr * )&url->hostport.IPaddress,
|
if( connect( connfd, ( struct sockaddr * )&url->hostport.IPv4address,
|
||||||
sizeof( url->hostport.IPaddress ) ) == -1 ) {
|
sizeof( struct sockaddr_in ) ) == -1 ) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
UpnpPrintf(UPNP_CRITICAL, HTTP, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_CRITICAL, HTTP, __FILE__, __LINE__,
|
||||||
"connect error: %d\n", WSAGetLastError());
|
"connect error: %d\n", WSAGetLastError());
|
||||||
@@ -204,12 +187,8 @@ http_Connect( IN uri_type * destination_url,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Get the data on the socket and take actions based on the read data to
|
* Function: http_RecvMessage
|
||||||
* modify the parser objects buffer.
|
|
||||||
*
|
|
||||||
* If an error is reported while parsing the data, the error code is passed in
|
|
||||||
* the http_errr_code parameter.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN SOCKINFO *info; Socket information object
|
* IN SOCKINFO *info; Socket information object
|
||||||
@@ -218,19 +197,23 @@ http_Connect( IN uri_type * destination_url,
|
|||||||
* IN OUT int* timeout_secs; time out
|
* IN OUT int* timeout_secs; time out
|
||||||
* OUT int* http_error_code; HTTP error code returned
|
* OUT int* http_error_code; HTTP error code returned
|
||||||
*
|
*
|
||||||
* \return
|
* Description:
|
||||||
* UPNP_E_SUCCESS
|
* Get the data on the socket and take actions based on the read data
|
||||||
|
* to modify the parser objects buffer. If an error is reported while
|
||||||
|
* parsing the data, the error code is passed in the http_errr_code
|
||||||
|
* parameter
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
* UPNP_E_BAD_HTTPMSG
|
* UPNP_E_BAD_HTTPMSG
|
||||||
*/
|
* UPNP_E_SUCCESS
|
||||||
int http_RecvMessage(
|
************************************************************************/
|
||||||
IN SOCKINFO *info,
|
int
|
||||||
|
http_RecvMessage( IN SOCKINFO * info,
|
||||||
OUT http_parser_t * parser,
|
OUT http_parser_t * parser,
|
||||||
IN http_method_t request_method,
|
IN http_method_t request_method,
|
||||||
IN OUT int *timeout_secs,
|
IN OUT int *timeout_secs,
|
||||||
OUT int *http_error_code )
|
OUT int *http_error_code )
|
||||||
{
|
{
|
||||||
int ret = UPNP_E_SUCCESS;
|
|
||||||
int line = 0;
|
|
||||||
parse_status_t status;
|
parse_status_t status;
|
||||||
int num_read;
|
int num_read;
|
||||||
xboolean ok_on_close = FALSE;
|
xboolean ok_on_close = FALSE;
|
||||||
@@ -243,37 +226,33 @@ int http_RecvMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
while( TRUE ) {
|
while( TRUE ) {
|
||||||
num_read = sock_read(info, buf, sizeof buf, timeout_secs);
|
num_read = sock_read( info, buf, sizeof( buf ), timeout_secs );
|
||||||
if( num_read > 0 ) {
|
if( num_read > 0 ) {
|
||||||
// got data
|
// got data
|
||||||
status = parser_append( parser, buf, num_read );
|
status = parser_append( parser, buf, num_read );
|
||||||
|
|
||||||
if( status == PARSE_SUCCESS ) {
|
if( status == PARSE_SUCCESS ) {
|
||||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
||||||
parser->msg.msg.buf );
|
parser->msg.msg.buf );
|
||||||
print_http_headers( &parser->msg );
|
print_http_headers( &parser->msg );
|
||||||
if (parser->content_length > (unsigned int)g_maxContentLength) {
|
|
||||||
|
if( parser->content_length >
|
||||||
|
( unsigned int )g_maxContentLength ) {
|
||||||
*http_error_code = HTTP_REQ_ENTITY_TOO_LARGE;
|
*http_error_code = HTTP_REQ_ENTITY_TOO_LARGE;
|
||||||
line = __LINE__;
|
return UPNP_E_OUTOF_BOUNDS;
|
||||||
ret = UPNP_E_OUTOF_BOUNDS;
|
|
||||||
goto ExitFunction;
|
|
||||||
}
|
}
|
||||||
line = __LINE__;
|
|
||||||
ret = 0;
|
return 0;
|
||||||
goto ExitFunction;
|
|
||||||
} else if( status == PARSE_FAILURE ) {
|
} else if( status == PARSE_FAILURE ) {
|
||||||
*http_error_code = parser->http_error_code;
|
*http_error_code = parser->http_error_code;
|
||||||
line = __LINE__;
|
return UPNP_E_BAD_HTTPMSG;
|
||||||
ret = UPNP_E_BAD_HTTPMSG;
|
|
||||||
goto ExitFunction;
|
|
||||||
} else if( status == PARSE_INCOMPLETE_ENTITY ) {
|
} else if( status == PARSE_INCOMPLETE_ENTITY ) {
|
||||||
// read until close
|
// read until close
|
||||||
ok_on_close = TRUE;
|
ok_on_close = TRUE;
|
||||||
} else if (status == PARSE_CONTINUE_1) {
|
} else if( status == PARSE_CONTINUE_1 ) //Web post request. murari
|
||||||
// Web post request.
|
{
|
||||||
line = __LINE__;
|
return PARSE_SUCCESS;
|
||||||
ret = PARSE_SUCCESS;
|
|
||||||
goto ExitFunction;
|
|
||||||
}
|
}
|
||||||
} else if( num_read == 0 ) {
|
} else if( num_read == 0 ) {
|
||||||
if( ok_on_close ) {
|
if( ok_on_close ) {
|
||||||
@@ -281,33 +260,18 @@ int http_RecvMessage(
|
|||||||
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
"<<< (RECVD) <<<\n%s\n-----------------\n",
|
||||||
parser->msg.msg.buf );
|
parser->msg.msg.buf );
|
||||||
print_http_headers( &parser->msg );
|
print_http_headers( &parser->msg );
|
||||||
line = __LINE__;
|
|
||||||
ret = 0;
|
return 0;
|
||||||
goto ExitFunction;
|
|
||||||
} else {
|
} else {
|
||||||
// partial msg
|
// partial msg
|
||||||
*http_error_code = HTTP_BAD_REQUEST; // or response
|
*http_error_code = HTTP_BAD_REQUEST; // or response
|
||||||
line = __LINE__;
|
return UPNP_E_BAD_HTTPMSG;
|
||||||
ret = UPNP_E_BAD_HTTPMSG;
|
|
||||||
goto ExitFunction;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*http_error_code = parser->http_error_code;
|
*http_error_code = parser->http_error_code;
|
||||||
line = __LINE__;
|
return num_read;
|
||||||
ret = num_read;
|
|
||||||
goto ExitFunction;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitFunction:
|
|
||||||
if (ret != UPNP_E_SUCCESS) {
|
|
||||||
UpnpPrintf(UPNP_ALL, HTTP, __FILE__, line,
|
|
||||||
"(http_RecvMessage): Error %d, http_error_code = %d.\n",
|
|
||||||
ret,
|
|
||||||
*http_error_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -549,7 +513,7 @@ http_RequestAndResponse( IN uri_type * destination,
|
|||||||
int http_error_code;
|
int http_error_code;
|
||||||
SOCKINFO info;
|
SOCKINFO info;
|
||||||
|
|
||||||
tcp_connection = socket( destination->hostport.IPaddress.ss_family, SOCK_STREAM, 0 );
|
tcp_connection = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
if( tcp_connection == -1 ) {
|
if( tcp_connection == -1 ) {
|
||||||
parser_response_init( response, req_method );
|
parser_response_init( response, req_method );
|
||||||
return UPNP_E_SOCKET_ERROR;
|
return UPNP_E_SOCKET_ERROR;
|
||||||
@@ -563,7 +527,7 @@ http_RequestAndResponse( IN uri_type * destination,
|
|||||||
// connect
|
// connect
|
||||||
ret_code = connect( info.socket,
|
ret_code = connect( info.socket,
|
||||||
( struct sockaddr * )&destination->hostport.
|
( struct sockaddr * )&destination->hostport.
|
||||||
IPaddress, sizeof( struct sockaddr_storage ) );
|
IPv4address, sizeof( struct sockaddr_in ) );
|
||||||
|
|
||||||
if( ret_code == -1 ) {
|
if( ret_code == -1 ) {
|
||||||
sock_destroy( &info, SD_BOTH );
|
sock_destroy( &info, SD_BOTH );
|
||||||
@@ -671,8 +635,7 @@ http_Download( IN const char *url_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"HTTP Buffer:\n%s\n" "----------END--------\n",
|
"HTTP Buffer:\n %s\n----------END--------\n", request.buf );
|
||||||
request.buf);
|
|
||||||
// get doc msg
|
// get doc msg
|
||||||
ret_code =
|
ret_code =
|
||||||
http_RequestAndResponse( &url, request.buf, request.length,
|
http_RequestAndResponse( &url, request.buf, request.length,
|
||||||
@@ -1034,7 +997,7 @@ http_OpenHttpPost( IN const char *url_str,
|
|||||||
|
|
||||||
handle->contentLength = contentLength;
|
handle->contentLength = contentLength;
|
||||||
|
|
||||||
tcp_connection = socket( url.hostport.IPaddress.ss_family, SOCK_STREAM, 0 );
|
tcp_connection = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
if( tcp_connection == -1 ) {
|
if( tcp_connection == -1 ) {
|
||||||
ret_code = UPNP_E_SOCKET_ERROR;
|
ret_code = UPNP_E_SOCKET_ERROR;
|
||||||
goto errorHandler;
|
goto errorHandler;
|
||||||
@@ -1048,8 +1011,8 @@ http_OpenHttpPost( IN const char *url_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret_code = connect( handle->sock_info.socket,
|
ret_code = connect( handle->sock_info.socket,
|
||||||
( struct sockaddr * )&url.hostport.IPaddress,
|
( struct sockaddr * )&url.hostport.IPv4address,
|
||||||
sizeof( struct sockaddr_storage ) );
|
sizeof( struct sockaddr_in ) );
|
||||||
|
|
||||||
if( ret_code == -1 ) {
|
if( ret_code == -1 ) {
|
||||||
sock_destroy( &handle->sock_info, SD_BOTH );
|
sock_destroy( &handle->sock_info, SD_BOTH );
|
||||||
@@ -1616,7 +1579,7 @@ http_OpenHttpGetProxy( IN const char *url_str,
|
|||||||
handle->cancel = 0;
|
handle->cancel = 0;
|
||||||
parser_response_init( &handle->response, HTTPMETHOD_GET );
|
parser_response_init( &handle->response, HTTPMETHOD_GET );
|
||||||
|
|
||||||
tcp_connection = socket( peer->hostport.IPaddress.ss_family, SOCK_STREAM, 0 );
|
tcp_connection = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
if( tcp_connection == -1 ) {
|
if( tcp_connection == -1 ) {
|
||||||
ret_code = UPNP_E_SOCKET_ERROR;
|
ret_code = UPNP_E_SOCKET_ERROR;
|
||||||
goto errorHandler;
|
goto errorHandler;
|
||||||
@@ -1630,8 +1593,8 @@ http_OpenHttpGetProxy( IN const char *url_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret_code = connect( handle->sock_info.socket,
|
ret_code = connect( handle->sock_info.socket,
|
||||||
( struct sockaddr * )&peer->hostport.IPaddress,
|
( struct sockaddr * )&peer->hostport.IPv4address,
|
||||||
sizeof( struct sockaddr_storage ) );
|
sizeof( struct sockaddr_in ) );
|
||||||
|
|
||||||
if( ret_code == -1 ) {
|
if( ret_code == -1 ) {
|
||||||
sock_destroy( &handle->sock_info, SD_BOTH );
|
sock_destroy( &handle->sock_info, SD_BOTH );
|
||||||
@@ -2265,7 +2228,7 @@ http_OpenHttpGetEx( IN const char *url_str,
|
|||||||
handle->entity_offset = 0;
|
handle->entity_offset = 0;
|
||||||
parser_response_init( &handle->response, HTTPMETHOD_GET );
|
parser_response_init( &handle->response, HTTPMETHOD_GET );
|
||||||
|
|
||||||
tcp_connection = socket( url.hostport.IPaddress.ss_family, SOCK_STREAM, 0 );
|
tcp_connection = socket( AF_INET, SOCK_STREAM, 0 );
|
||||||
if( tcp_connection == -1 ) {
|
if( tcp_connection == -1 ) {
|
||||||
errCode = UPNP_E_SOCKET_ERROR;
|
errCode = UPNP_E_SOCKET_ERROR;
|
||||||
free( handle );
|
free( handle );
|
||||||
@@ -2281,8 +2244,8 @@ http_OpenHttpGetEx( IN const char *url_str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
errCode = connect( handle->sock_info.socket,
|
errCode = connect( handle->sock_info.socket,
|
||||||
( struct sockaddr * )&url.hostport.IPaddress,
|
( struct sockaddr * )&url.hostport.IPv4address,
|
||||||
sizeof( struct sockaddr_storage ) );
|
sizeof( struct sockaddr_in ) );
|
||||||
if( errCode == -1 ) {
|
if( errCode == -1 ) {
|
||||||
sock_destroy( &handle->sock_info, SD_BOTH );
|
sock_destroy( &handle->sock_info, SD_BOTH );
|
||||||
errCode = UPNP_E_SOCKET_CONNECT;
|
errCode = UPNP_E_SOCKET_CONNECT;
|
||||||
|
|||||||
@@ -1,81 +1,65 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Purpose: This file defines the Web Server and has functions to carry out
|
* Purpose: This file defines the Web Server and has functions to carry out
|
||||||
* operations of the Web Server.
|
* operations of the Web Server.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "webserver.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "httpparser.h"
|
|
||||||
#include "httpreadwrite.h"
|
|
||||||
#include "ithread.h"
|
|
||||||
#include "membuffer.h"
|
|
||||||
#include "ssdplib.h"
|
|
||||||
#include "statcodes.h"
|
|
||||||
#include "strintmap.h"
|
|
||||||
#include "unixutil.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "upnpapi.h"
|
|
||||||
#include "util.h"
|
|
||||||
#include "VirtualDir.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#ifndef UPNP_USE_BCBPP
|
||||||
|
#ifndef UPNP_USE_MSVCPP
|
||||||
|
|
||||||
#ifdef UPNP_USE_BCBPP
|
|
||||||
/* Do not #include <inttypes.h> */
|
|
||||||
/* Do not #include <stdint.h> */
|
|
||||||
#else
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif /* !UPNP_USE_BCBPP */
|
#endif
|
||||||
|
#endif
|
||||||
|
#include "util.h"
|
||||||
|
#include "strintmap.h"
|
||||||
|
#include "membuffer.h"
|
||||||
|
#include "httpparser.h"
|
||||||
|
#include "httpreadwrite.h"
|
||||||
|
#include "statcodes.h"
|
||||||
|
#include "webserver.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
#include "upnpapi.h"
|
||||||
|
#include "ssdplib.h"
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
#ifdef WIN32
|
|
||||||
/* Do not #include <unistd.h> */
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include "ithread.h"
|
||||||
|
#include "unixutil.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Response Types
|
Response Types
|
||||||
@@ -312,8 +296,8 @@ get_content_type( IN const char *filename,
|
|||||||
OUT DOMString * content_type )
|
OUT DOMString * content_type )
|
||||||
{
|
{
|
||||||
const char *extension;
|
const char *extension;
|
||||||
const char *type;
|
const char *type,
|
||||||
const char *subtype;
|
*subtype;
|
||||||
xboolean ctype_found = FALSE;
|
xboolean ctype_found = FALSE;
|
||||||
char *temp = NULL;
|
char *temp = NULL;
|
||||||
int length = 0;
|
int length = 0;
|
||||||
@@ -336,9 +320,11 @@ get_content_type( IN const char *filename,
|
|||||||
|
|
||||||
length = strlen( type ) + strlen( "/" ) + strlen( subtype ) + 1;
|
length = strlen( type ) + strlen( "/" ) + strlen( subtype ) + 1;
|
||||||
temp = ( char * )malloc( length );
|
temp = ( char * )malloc( length );
|
||||||
|
|
||||||
if( !temp ) {
|
if( !temp ) {
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( temp, "%s/%s", type, subtype );
|
sprintf( temp, "%s/%s", type, subtype );
|
||||||
( *content_type ) = ixmlCloneDOMString( temp );
|
( *content_type ) = ixmlCloneDOMString( temp );
|
||||||
|
|
||||||
@@ -530,33 +516,40 @@ web_server_set_alias( IN const char *alias_name,
|
|||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
int web_server_init()
|
* Function: web_server_init
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* none
|
||||||
|
*
|
||||||
|
* Description: Initilialize the different documents. Initialize the
|
||||||
|
* memory for root directory for web server. Call to initialize global
|
||||||
|
* XML document. Sets bWebServerState to WEB_SERVER_ENABLED
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 - OK
|
||||||
|
* UPNP_E_OUTOF_MEMORY: note: alias_content is not freed here
|
||||||
|
************************************************************************/
|
||||||
|
int
|
||||||
|
web_server_init( void )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret_code;
|
||||||
|
|
||||||
if( bWebServerState == WEB_SERVER_DISABLED ) {
|
if( bWebServerState == WEB_SERVER_DISABLED ) {
|
||||||
// decode media list
|
media_list_init( ); // decode media list
|
||||||
media_list_init();
|
|
||||||
membuffer_init( &gDocumentRootDir );
|
membuffer_init( &gDocumentRootDir );
|
||||||
glob_alias_init( );
|
glob_alias_init( );
|
||||||
|
|
||||||
pVirtualDirList = NULL;
|
pVirtualDirList = NULL;
|
||||||
|
|
||||||
// Initialize callbacks
|
ret_code = ithread_mutex_init( &gWebMutex, NULL );
|
||||||
virtualDirCallback.get_info = NULL;
|
if( ret_code == -1 ) {
|
||||||
virtualDirCallback.open = NULL;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
virtualDirCallback.read = NULL;
|
}
|
||||||
virtualDirCallback.write = NULL;
|
|
||||||
virtualDirCallback.seek = NULL;
|
|
||||||
virtualDirCallback.close = NULL;
|
|
||||||
|
|
||||||
if (ithread_mutex_init(&gWebMutex, NULL) == -1) {
|
|
||||||
ret = UPNP_E_OUTOF_MEMORY;
|
|
||||||
} else {
|
|
||||||
bWebServerState = WEB_SERVER_ENABLED;
|
bWebServerState = WEB_SERVER_ENABLED;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -711,7 +704,9 @@ get_alias( IN const char *request_file,
|
|||||||
OUT struct xml_alias_t *alias,
|
OUT struct xml_alias_t *alias,
|
||||||
OUT struct File_Info *info )
|
OUT struct File_Info *info )
|
||||||
{
|
{
|
||||||
int cmp = strcmp(alias->name.buf, request_file);
|
int cmp;
|
||||||
|
|
||||||
|
cmp = strcmp( alias->name.buf, request_file );
|
||||||
if( cmp == 0 ) {
|
if( cmp == 0 ) {
|
||||||
// fill up info
|
// fill up info
|
||||||
info->file_length = alias->doc.length;
|
info->file_length = alias->doc.length;
|
||||||
@@ -750,7 +745,7 @@ isFileInVirtualDir( IN char *filePath )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
if( ( strncmp( pCurVirtualDir->dirName, filePath, webDirLen )
|
if( ( strncmp( pCurVirtualDir->dirName, filePath, webDirLen )
|
||||||
== 0 ) && ( filePath[webDirLen] == '/' || filePath[webDirLen] == '\0' || filePath[webDirLen] == '?' ) )
|
== 0 ) && ( filePath[webDirLen] == '/' ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1209,11 +1204,11 @@ process_request( IN http_message_t * req,
|
|||||||
xboolean using_virtual_dir;
|
xboolean using_virtual_dir;
|
||||||
uri_type *url;
|
uri_type *url;
|
||||||
char *temp_str;
|
char *temp_str;
|
||||||
int resp_major;
|
int resp_major,
|
||||||
int resp_minor;
|
resp_minor;
|
||||||
xboolean alias_grabbed;
|
xboolean alias_grabbed;
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
const char *extra_headers = NULL;
|
struct UpnpVirtualDirCallbacks *pVirtualDirCallback;
|
||||||
|
|
||||||
print_http_headers( req );
|
print_http_headers( req );
|
||||||
|
|
||||||
@@ -1265,7 +1260,9 @@ process_request( IN http_message_t * req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* try using alias */
|
//
|
||||||
|
// try using alias
|
||||||
|
//
|
||||||
if( is_valid_alias( &gAliasDoc ) ) {
|
if( is_valid_alias( &gAliasDoc ) ) {
|
||||||
alias_grab( alias );
|
alias_grab( alias );
|
||||||
alias_grabbed = TRUE;
|
alias_grabbed = TRUE;
|
||||||
@@ -1284,7 +1281,9 @@ process_request( IN http_message_t * req,
|
|||||||
if( using_virtual_dir ) {
|
if( using_virtual_dir ) {
|
||||||
if( req->method != HTTPMETHOD_POST ) {
|
if( req->method != HTTPMETHOD_POST ) {
|
||||||
// get file info
|
// get file info
|
||||||
if (virtualDirCallback.get_info(filename->buf, &finfo) != 0) {
|
pVirtualDirCallback = &virtualDirCallback;
|
||||||
|
if( pVirtualDirCallback->get_info( filename->buf, &finfo ) !=
|
||||||
|
0 ) {
|
||||||
err_code = HTTP_NOT_FOUND;
|
err_code = HTTP_NOT_FOUND;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@@ -1299,8 +1298,9 @@ process_request( IN http_message_t * req,
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
// get info
|
// get info
|
||||||
if( (virtualDirCallback.get_info(filename->buf, &finfo ) != UPNP_E_SUCCESS ) ||
|
if( ( pVirtualDirCallback->
|
||||||
finfo.is_directory) {
|
get_info( filename->buf, &finfo ) != UPNP_E_SUCCESS )
|
||||||
|
|| finfo.is_directory ) {
|
||||||
err_code = HTTP_NOT_FOUND;
|
err_code = HTTP_NOT_FOUND;
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@@ -1387,40 +1387,34 @@ process_request( IN http_message_t * req,
|
|||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*extra_headers = UpnpFileInfo_get_ExtraHeaders(finfo);*/
|
|
||||||
if (!extra_headers) {
|
|
||||||
extra_headers = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if( RespInstr->IsRangeActive && RespInstr->IsChunkActive ) {
|
if( RespInstr->IsRangeActive && RespInstr->IsChunkActive ) {
|
||||||
// Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
|
// Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
|
||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "T" "GKD" "s" "tcS" "Xc" "sCc",
|
"R" "T" "GKD" "s" "tcS" "XcCc",
|
||||||
HTTP_PARTIAL_CONTENT, // status code
|
HTTP_PARTIAL_CONTENT, // status code
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
RespInstr, // range info
|
RespInstr, // range info
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
} else if( RespInstr->IsRangeActive && !RespInstr->IsChunkActive ) {
|
} else if( RespInstr->IsRangeActive && !RespInstr->IsChunkActive ) {
|
||||||
|
|
||||||
// Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
|
// Content-Range: bytes 222-3333/4000 HTTP_PARTIAL_CONTENT
|
||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "N" "T" "GD" "s" "tcS" "Xc" "sCc",
|
"R" "N" "T" "GD" "s" "tcS" "XcCc",
|
||||||
HTTP_PARTIAL_CONTENT, // status code
|
HTTP_PARTIAL_CONTENT, // status code
|
||||||
RespInstr->ReadSendSize, // content length
|
RespInstr->ReadSendSize, // content length
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
RespInstr, // range info
|
RespInstr, // range info
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1429,13 +1423,12 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"RK" "TD" "s" "tcS" "Xc" "sCc",
|
"RK" "TD" "s" "tcS" "XcCc",
|
||||||
HTTP_OK, // status code
|
HTTP_OK, // status code
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1445,14 +1438,13 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "N" "TD" "s" "tcS" "Xc" "sCc",
|
"R" "N" "TD" "s" "tcS" "XcCc",
|
||||||
HTTP_OK, // status code
|
HTTP_OK, // status code
|
||||||
RespInstr->ReadSendSize, // content length
|
RespInstr->ReadSendSize, // content length
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1460,13 +1452,12 @@ process_request( IN http_message_t * req,
|
|||||||
// Transfer-Encoding: chunked
|
// Transfer-Encoding: chunked
|
||||||
if (http_MakeMessage(
|
if (http_MakeMessage(
|
||||||
headers, resp_major, resp_minor,
|
headers, resp_major, resp_minor,
|
||||||
"R" "TD" "s" "tcS" "b" "Xc" "sCc",
|
"R" "TD" "s" "tcS" "XcCc",
|
||||||
HTTP_OK, // status code
|
HTTP_OK, // status code
|
||||||
finfo.content_type, // content type
|
finfo.content_type, // content type
|
||||||
"LAST-MODIFIED: ",
|
"LAST-MODIFIED: ",
|
||||||
&finfo.last_modified,
|
&finfo.last_modified,
|
||||||
X_USER_AGENT,
|
X_USER_AGENT) != 0 ) {
|
||||||
extra_headers) != 0 ) {
|
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1539,10 +1530,12 @@ http_RecvPostMessage( http_parser_t *parser,
|
|||||||
int ret_code = 0;
|
int ret_code = 0;
|
||||||
|
|
||||||
if( Instr && Instr->IsVirtualFile ) {
|
if( Instr && Instr->IsVirtualFile ) {
|
||||||
|
|
||||||
Fp = (virtualDirCallback.open)( filename, UPNP_WRITE );
|
Fp = (virtualDirCallback.open)( filename, UPNP_WRITE );
|
||||||
if( Fp == NULL ) {
|
if( Fp == NULL ) {
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Fp = fopen( filename, "wb" );
|
Fp = fopen( filename, "wb" );
|
||||||
if( Fp == NULL ) {
|
if( Fp == NULL ) {
|
||||||
|
|||||||
@@ -1,55 +1,57 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file implements the sockets functionality
|
* Purpose: This file implements the sockets functionality
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#include "sock.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "unixutil.h" /* for socklen_t, EAFNOSUPPORT */
|
|
||||||
#include "upnp.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "sock.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
#ifndef WIN32
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#else
|
||||||
|
#include <winsock2.h>
|
||||||
|
#endif
|
||||||
|
#include "unixutil.h"
|
||||||
|
|
||||||
#ifndef MSG_NOSIGNAL
|
#ifndef MSG_NOSIGNAL
|
||||||
#define MSG_NOSIGNAL 0
|
#define MSG_NOSIGNAL 0
|
||||||
@@ -60,7 +62,7 @@
|
|||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* OUT SOCKINFO* info ; Socket Information Object
|
* OUT SOCKINFO* info ; Socket Information Object
|
||||||
* IN SOCKET sockfd ; Socket Descriptor
|
* IN int sockfd ; Socket Descriptor
|
||||||
*
|
*
|
||||||
* Description : Assign the passed in socket descriptor to socket
|
* Description : Assign the passed in socket descriptor to socket
|
||||||
* descriptor in the SOCKINFO structure.
|
* descriptor in the SOCKINFO structure.
|
||||||
@@ -74,7 +76,7 @@
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int
|
||||||
sock_init( OUT SOCKINFO * info,
|
sock_init( OUT SOCKINFO * info,
|
||||||
IN SOCKET sockfd )
|
IN int sockfd )
|
||||||
{
|
{
|
||||||
assert( info );
|
assert( info );
|
||||||
|
|
||||||
@@ -90,8 +92,9 @@ sock_init( OUT SOCKINFO * info,
|
|||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* OUT SOCKINFO* info ; Socket Information Object
|
* OUT SOCKINFO* info ; Socket Information Object
|
||||||
* IN SOCKET sockfd ; Socket Descriptor
|
* IN int sockfd ; Socket Descriptor
|
||||||
* IN struct sockaddr* foreign_sockaddr; remote socket address.
|
* IN struct in_addr foreign_ip_addr ; Remote IP Address
|
||||||
|
* IN unsigned short foreign_ip_port ; Remote Port number
|
||||||
*
|
*
|
||||||
* Description : Calls the sock_init function and assigns the passed in
|
* Description : Calls the sock_init function and assigns the passed in
|
||||||
* IP address and port to the IP address and port in the SOCKINFO
|
* IP address and port to the IP address and port in the SOCKINFO
|
||||||
@@ -106,8 +109,9 @@ sock_init( OUT SOCKINFO * info,
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int
|
||||||
sock_init_with_ip( OUT SOCKINFO * info,
|
sock_init_with_ip( OUT SOCKINFO * info,
|
||||||
IN SOCKET sockfd,
|
IN int sockfd,
|
||||||
IN struct sockaddr* foreign_sockaddr )
|
IN struct in_addr foreign_ip_addr,
|
||||||
|
IN unsigned short foreign_ip_port )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -116,8 +120,8 @@ sock_init_with_ip( OUT SOCKINFO * info,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( &info->foreign_sockaddr, foreign_sockaddr,
|
info->foreign_ip_addr = foreign_ip_addr;
|
||||||
sizeof( info->foreign_sockaddr) );
|
info->foreign_ip_port = foreign_ip_port;
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -145,12 +149,10 @@ int
|
|||||||
sock_destroy( INOUT SOCKINFO * info,
|
sock_destroy( INOUT SOCKINFO * info,
|
||||||
int ShutdownMethod )
|
int ShutdownMethod )
|
||||||
{
|
{
|
||||||
if( info->socket != INVALID_SOCKET ) {
|
|
||||||
shutdown( info->socket, ShutdownMethod );
|
shutdown( info->socket, ShutdownMethod );
|
||||||
if( UpnpCloseSocket( info->socket ) == -1 ) {
|
if( UpnpCloseSocket( info->socket ) == -1 ) {
|
||||||
return UPNP_E_SOCKET_ERROR;
|
return UPNP_E_SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -188,7 +190,7 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
int numBytes;
|
int numBytes;
|
||||||
time_t start_time = time( NULL );
|
time_t start_time = time( NULL );
|
||||||
SOCKET sockfd = info->socket;
|
int sockfd = info->socket;
|
||||||
long bytes_sent = 0,
|
long bytes_sent = 0,
|
||||||
byte_left = 0,
|
byte_left = 0,
|
||||||
num_written;
|
num_written;
|
||||||
@@ -200,9 +202,9 @@ sock_read_write( IN SOCKINFO * info,
|
|||||||
FD_ZERO( &readSet );
|
FD_ZERO( &readSet );
|
||||||
FD_ZERO( &writeSet );
|
FD_ZERO( &writeSet );
|
||||||
if( bRead ) {
|
if( bRead ) {
|
||||||
FD_SET( sockfd, &readSet );
|
FD_SET( ( unsigned )sockfd, &readSet );
|
||||||
} else {
|
} else {
|
||||||
FD_SET( sockfd, &writeSet );
|
FD_SET( ( unsigned )sockfd, &writeSet );
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout.tv_sec = *timeoutSecs;
|
timeout.tv_sec = *timeoutSecs;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,34 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file defines the functions for services. It defines
|
* Purpose: This file defines the functions for services. It defines
|
||||||
@@ -117,8 +116,25 @@ RemoveSubscriptionSID( Upnp_SID sid,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
subscription *GetSubscriptionSID(const Upnp_SID sid, service_info *service)
|
* Function : GetSubscriptionSID
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* Upnp_SID sid ; subscription ID
|
||||||
|
* service_info * service ; service object providing the list of
|
||||||
|
* subscriptions
|
||||||
|
*
|
||||||
|
* Description : Return the subscription from the service table
|
||||||
|
* that matches const Upnp_SID sid value.
|
||||||
|
*
|
||||||
|
* Return : subscription * - Pointer to the matching subscription
|
||||||
|
* node;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
subscription *
|
||||||
|
GetSubscriptionSID( Upnp_SID sid,
|
||||||
|
service_info * service )
|
||||||
{
|
{
|
||||||
subscription *next = service->subscriptionList;
|
subscription *next = service->subscriptionList;
|
||||||
subscription *previous = NULL;
|
subscription *previous = NULL;
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file contains functions that operate on memory and
|
* Purpose: This file contains functions that operate on memory and
|
||||||
@@ -491,8 +491,6 @@ membuffer_delete( INOUT membuffer * m,
|
|||||||
|
|
||||||
assert( m != NULL );
|
assert( m != NULL );
|
||||||
|
|
||||||
if (!m) return;
|
|
||||||
|
|
||||||
if( m->length == 0 ) {
|
if( m->length == 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +1,43 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Purpose: This file contains functions for copying strings based on
|
* Purpose: This file contains functions for copying strings based on
|
||||||
* different options.
|
* different options.
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : linecopy
|
* Function : linecopy
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef VIRTUALDIR_H
|
|
||||||
#define VIRTUALDIR_H
|
|
||||||
|
|
||||||
|
|
||||||
/** The \b VirtualDirCallbacks structure contains the pointers to
|
|
||||||
* file-related callback functions a device application can register to
|
|
||||||
* virtualize URLs.
|
|
||||||
*/
|
|
||||||
struct VirtualDirCallbacks
|
|
||||||
{
|
|
||||||
/** Called by the web server to query information on a file. The callback
|
|
||||||
* should return 0 on success or -1 on an error. */
|
|
||||||
VDCallback_GetInfo get_info;
|
|
||||||
|
|
||||||
/** Called by the web server to open a file. The callback should return
|
|
||||||
* a valid handle if the file can be opened. Otherwise, it should return
|
|
||||||
* \c NULL to signify an error. */
|
|
||||||
VDCallback_Open open;
|
|
||||||
|
|
||||||
/** Called by the web server to perform a sequential read from an open
|
|
||||||
* file. The callback should copy \b buflen bytes from the file into
|
|
||||||
* the buffer.
|
|
||||||
* @return An integer representing one of the following:
|
|
||||||
* \li <tt> 0</tt>: The file contains no more data (EOF).
|
|
||||||
* \li <tt> > 0</tt>: A successful read of the number of bytes in the
|
|
||||||
* return code.
|
|
||||||
* \li <tt> < 0</tt>: An error occurred reading the file.
|
|
||||||
*/
|
|
||||||
VDCallback_Read read;
|
|
||||||
|
|
||||||
/** Called by the web server to perform a sequential write to an open
|
|
||||||
* file. The callback should write \b buflen bytes into the file from
|
|
||||||
* the buffer. It should return the actual number of bytes written,
|
|
||||||
* which might be less than \b buflen in the case of a write error.
|
|
||||||
*/
|
|
||||||
VDCallback_Write write;
|
|
||||||
|
|
||||||
/** Called by the web server to move the file pointer, or offset, into
|
|
||||||
* an open file. The \b origin parameter determines where to start
|
|
||||||
* moving the file pointer. A value of \c SEEK_CUR moves the
|
|
||||||
* file pointer relative to where it is. The \b offset parameter can
|
|
||||||
* be either positive (move forward) or negative (move backward).
|
|
||||||
* \c SEEK_END moves relative to the end of the file. A positive
|
|
||||||
* \b offset extends the file. A negative \b offset moves backward
|
|
||||||
* in the file. Finally, \c SEEK_SET moves to an absolute position in
|
|
||||||
* the file. In this case, \b offset must be positive. The callback
|
|
||||||
* should return 0 on a successful seek or a non-zero value on an error.
|
|
||||||
*/
|
|
||||||
VDCallback_Seek seek;
|
|
||||||
|
|
||||||
/** Called by the web server to close a file opened via the \b open
|
|
||||||
* callback. It should return 0 on success, or a non-zero value on an
|
|
||||||
* error.
|
|
||||||
*/
|
|
||||||
VDCallback_Close close;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct virtual_Dir_List
|
|
||||||
{
|
|
||||||
struct virtual_Dir_List *next;
|
|
||||||
char dirName[NAME_SIZE];
|
|
||||||
} virtualDirList;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* VIRTUALDIR_H */
|
|
||||||
|
|
||||||
@@ -1,248 +1,167 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
|
// may be used to endorse or promote products derived from this software
|
||||||
|
// without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef CLIENT_TABLE_H
|
#ifndef _CLIENT_TABLE
|
||||||
#define CLIENT_TABLE_H
|
#define _CLIENT_TABLE
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "service_table.h"
|
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "UpnpString.h"
|
|
||||||
#include "upnp_timeout.h"
|
|
||||||
#include "uri.h"
|
|
||||||
#include "TimerThread.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
//#include <malloc.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "uri.h"
|
||||||
|
#include "service_table.h"
|
||||||
|
|
||||||
|
#include "TimerThread.h"
|
||||||
|
#include "upnp_timeout.h"
|
||||||
|
|
||||||
extern TimerThread gTimerThread;
|
extern TimerThread gTimerThread;
|
||||||
|
|
||||||
|
CLIENTONLY(
|
||||||
|
typedef struct CLIENT_SUBSCRIPTION {
|
||||||
|
Upnp_SID sid;
|
||||||
|
char * ActualSID;
|
||||||
|
char * EventURL;
|
||||||
|
int RenewEventId;
|
||||||
|
struct CLIENT_SUBSCRIPTION * next;
|
||||||
|
} client_subscription;
|
||||||
|
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
/************************************************************************
|
||||||
|
* Function : copy_client_subscription
|
||||||
|
|
||||||
typedef struct s_ClientSubscription ClientSubscription;
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Constructor.
|
|
||||||
*/
|
|
||||||
ClientSubscription *UpnpClientSubscription_new();
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Destructor.
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_delete(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Copy Constructor.
|
|
||||||
*/
|
|
||||||
ClientSubscription *UpnpClientSubscription_dup(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Assignment operator.
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_assign(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *q,
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
int UpnpClientSubscription_get_RenewEventId(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_set_RenewEventId(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
/*! [in] . */
|
|
||||||
int n);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
const UpnpString *UpnpClientSubscription_get_SID(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_set_SID(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
const UpnpString *s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_strcpy_SID(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
const char *s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
const UpnpString *UpnpClientSubscription_get_ActualSID(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_set_ActualSID(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
const UpnpString *s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_strcpy_ActualSID(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
const char *s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
const UpnpString *UpnpClientSubscription_get_EventURL(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_set_EventURL(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
const UpnpString *s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_strcpy_EventURL(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
const char *s);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
ClientSubscription *UpnpClientSubscription_get_Next(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
const ClientSubscription *p);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*/
|
|
||||||
void UpnpClientSubscription_set_Next(
|
|
||||||
/*! [in] The \b this pointer. */
|
|
||||||
ClientSubscription *p,
|
|
||||||
ClientSubscription *q);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Free memory allocated for client subscription data.
|
|
||||||
*
|
*
|
||||||
|
* Parameters :
|
||||||
|
* client_subscription * in ; - source client subscription
|
||||||
|
* client_subscription * out ; - destination client subscription
|
||||||
|
*
|
||||||
|
* Description : Make a copy of the client subscription data
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
* UPNP_E_OUTOF_MEMORY - On Failure to allocate memory
|
||||||
|
* HTTP_SUCCESS - On Success
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int copy_client_subscription(client_subscription * in, client_subscription * out);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : free_client_subscription
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* client_subscription * sub ; - Client subscription to be freed
|
||||||
|
*
|
||||||
|
* Description : Free memory allocated for client subscription data.
|
||||||
* Remove timer thread associated with this subscription event.
|
* Remove timer thread associated with this subscription event.
|
||||||
*/
|
|
||||||
void free_client_subscription(
|
|
||||||
/*! [in] Client subscription to be freed. */
|
|
||||||
ClientSubscription *sub);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Free the client subscription table.
|
|
||||||
*/
|
|
||||||
void freeClientSubList(
|
|
||||||
/*! [in] Client subscription list to be freed. */
|
|
||||||
ClientSubscription *list);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Remove the client subscription matching the subscritpion id
|
|
||||||
* represented by the const Upnp_SID sid parameter from the table and
|
|
||||||
* update the table.
|
|
||||||
*/
|
|
||||||
void RemoveClientSubClientSID(
|
|
||||||
/*! [in] Head of the subscription list. */
|
|
||||||
ClientSubscription **head,
|
|
||||||
/*! [in] Subscription ID to be mactched. */
|
|
||||||
const UpnpString *sid);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Return the client subscription from the client table that matches
|
|
||||||
* const Upnp_SID sid subscrition id value.
|
|
||||||
*
|
*
|
||||||
* \return The matching subscription.
|
* Return : void ;
|
||||||
*/
|
|
||||||
ClientSubscription *GetClientSubClientSID(
|
|
||||||
/*! [in] Head of the subscription list. */
|
|
||||||
ClientSubscription *head,
|
|
||||||
/*! [in] Subscription ID to be mactched. */
|
|
||||||
const UpnpString *sid);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Returns the client subscription from the client subscription table
|
|
||||||
* that has the matching token *sid buffer value.
|
|
||||||
*
|
*
|
||||||
* \return The matching subscription.
|
* Note :
|
||||||
*/
|
************************************************************************/
|
||||||
ClientSubscription *GetClientSubActualSID(
|
void free_client_subscription(client_subscription * sub);
|
||||||
/*! [in] Head of the subscription list. */
|
|
||||||
ClientSubscription *head,
|
|
||||||
/*! [in] Subscription ID to be mactched. */
|
|
||||||
token *sid);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
/************************************************************************
|
||||||
|
* Function : freeClientSubList
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* client_subscription * list ; Client subscription
|
||||||
|
*
|
||||||
|
* Description : Free the client subscription table.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void freeClientSubList(client_subscription * list);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : RemoveClientSubClientSID
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* client_subscription **head ; Head of the subscription list
|
||||||
|
* const Upnp_SID sid ; Subscription ID to be mactched
|
||||||
|
*
|
||||||
|
* Description : Remove the client subscription matching the
|
||||||
|
* subscritpion id represented by the const Upnp_SID sid parameter
|
||||||
|
* from the table and update the table.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void RemoveClientSubClientSID(client_subscription **head,
|
||||||
|
const Upnp_SID sid);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : GetClientSubClientSID
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* 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);
|
||||||
|
)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* CLIENT_TABLE_H */
|
|
||||||
|
|
||||||
|
#endif /* _CLIENT_TABLE */
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#ifndef INTERNAL_CONFIG_H
|
#ifndef INTERNAL_CONFIG_H
|
||||||
#define INTERNAL_CONFIG_H
|
#define INTERNAL_CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
#include "autoconfig.h"
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,83 +1,65 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef GENA_H
|
|
||||||
#define GENA_H
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _GENA_
|
||||||
|
#define _GENA_
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "service_table.h"
|
||||||
|
#include "miniserver.h"
|
||||||
|
#include "uri.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include "ThreadPool.h"
|
||||||
|
#include <string.h>
|
||||||
#include "client_table.h"
|
#include "client_table.h"
|
||||||
#include "httpparser.h"
|
#include "httpparser.h"
|
||||||
#include "miniserver.h"
|
|
||||||
#include "service_table.h"
|
|
||||||
#include "sock.h"
|
#include "sock.h"
|
||||||
#include "ThreadPool.h"
|
|
||||||
#include "upnp.h"
|
|
||||||
#include "UpnpString.h"
|
|
||||||
#include "uri.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN_C extern "C"
|
#define EXTERN_C extern "C"
|
||||||
#else /* __cplusplus */
|
#else
|
||||||
#ifndef EXTERN_C
|
#ifndef EXTERN_C
|
||||||
#define EXTERN_C
|
#define EXTERN_C
|
||||||
#endif /* EXTERN_C */
|
#endif
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief XML version comment. Not used because it is not interopeable with
|
|
||||||
* other UPnP vendors.
|
|
||||||
*/
|
|
||||||
#define XML_VERSION "<?xml version='1.0' encoding='ISO-8859-1' ?>\n"
|
#define XML_VERSION "<?xml version='1.0' encoding='ISO-8859-1' ?>\n"
|
||||||
#define XML_PROPERTYSET_HEADER \
|
#define XML_PROPERTYSET_HEADER \
|
||||||
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n"
|
"<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">\n"
|
||||||
|
|
||||||
|
|
||||||
#define UNABLE_MEMORY "HTTP/1.1 500 Internal Server Error\r\n\r\n"
|
#define UNABLE_MEMORY "HTTP/1.1 500 Internal Server Error\r\n\r\n"
|
||||||
#define UNABLE_SERVICE_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
|
#define UNABLE_SERVICE_UNKNOWN "HTTP/1.1 404 Not Found\r\n\r\n"
|
||||||
#define UNABLE_SERVICE_NOT_ACCEPT "HTTP/1.1 503 Service Not Available\r\n\r\n"
|
#define UNABLE_SERVICE_NOT_ACCEPT \
|
||||||
|
"HTTP/1.1 503 Service Not Available\r\n\r\n"
|
||||||
|
|
||||||
|
|
||||||
#define NOT_IMPLEMENTED "HTTP/1.1 501 Not Implemented\r\n\r\n"
|
#define NOT_IMPLEMENTED "HTTP/1.1 501 Not Implemented\r\n\r\n"
|
||||||
@@ -92,8 +74,6 @@
|
|||||||
#define MAX_SECONDS 10
|
#define MAX_SECONDS 10
|
||||||
#define MAX_EVENTS 20
|
#define MAX_EVENTS 20
|
||||||
#define MAX_PORT_SIZE 10
|
#define MAX_PORT_SIZE 10
|
||||||
|
|
||||||
|
|
||||||
#define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
#define GENA_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
||||||
#define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
|
#define GENA_E_BAD_SERVICE UPNP_E_INVALID_SERVICE
|
||||||
#define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
|
#define GENA_E_SUBSCRIPTION_UNACCEPTED UPNP_E_SUBSCRIBE_UNACCEPTED
|
||||||
@@ -102,23 +82,16 @@
|
|||||||
#define GENA_E_NOTIFY_UNACCEPTED UPNP_E_NOTIFY_UNACCEPTED
|
#define GENA_E_NOTIFY_UNACCEPTED UPNP_E_NOTIFY_UNACCEPTED
|
||||||
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
|
#define GENA_E_NOTIFY_UNACCEPTED_REMOVE_SUB -9
|
||||||
#define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
|
#define GENA_E_BAD_HANDLE UPNP_E_INVALID_HANDLE
|
||||||
|
|
||||||
|
|
||||||
#define XML_ERROR -5
|
#define XML_ERROR -5
|
||||||
#define XML_SUCCESS UPNP_E_SUCCESS
|
#define XML_SUCCESS UPNP_E_SUCCESS
|
||||||
#define GENA_SUCCESS UPNP_E_SUCCESS
|
#define GENA_SUCCESS UPNP_E_SUCCESS
|
||||||
|
|
||||||
|
|
||||||
#define CALLBACK_SUCCESS 0
|
#define CALLBACK_SUCCESS 0
|
||||||
#define DEFAULT_TIMEOUT 1801
|
#define DEFAULT_TIMEOUT 1801
|
||||||
|
|
||||||
|
|
||||||
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
extern ithread_mutex_t GlobalClientSubscribeMutex;
|
||||||
|
|
||||||
|
// Lock the subscription
|
||||||
/*!
|
|
||||||
* \brief Locks the subscription.
|
|
||||||
*/
|
|
||||||
#define SubscribeLock() \
|
#define SubscribeLock() \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||||
"Trying Subscribe Lock"); \
|
"Trying Subscribe Lock"); \
|
||||||
@@ -126,10 +99,7 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
|
|||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||||
"Subscribe Lock");
|
"Subscribe Lock");
|
||||||
|
|
||||||
|
// Unlock the subscription
|
||||||
/*!
|
|
||||||
* \brief Unlocks the subscription.
|
|
||||||
*/
|
|
||||||
#define SubscribeUnlock() \
|
#define SubscribeUnlock() \
|
||||||
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
UpnpPrintf(UPNP_INFO, GENA, __FILE__, __LINE__, \
|
||||||
"Trying Subscribe UnLock"); \
|
"Trying Subscribe UnLock"); \
|
||||||
@@ -138,9 +108,7 @@ extern ithread_mutex_t GlobalClientSubscribeMutex;
|
|||||||
"Subscribe UnLock");
|
"Subscribe UnLock");
|
||||||
|
|
||||||
|
|
||||||
/*!
|
// Structure to send NOTIFY message to all subscribed control points
|
||||||
* Structure to send NOTIFY message to all subscribed control points
|
|
||||||
*/
|
|
||||||
typedef struct NOTIFY_THREAD_STRUCT {
|
typedef struct NOTIFY_THREAD_STRUCT {
|
||||||
char * headers;
|
char * headers;
|
||||||
DOMString propertySet;
|
DOMString propertySet;
|
||||||
@@ -153,233 +121,282 @@ typedef struct NOTIFY_THREAD_STRUCT {
|
|||||||
} notify_thread_struct;
|
} notify_thread_struct;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief This is the callback function called by the miniserver to handle
|
* Function : genaCallback
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* IN http_parser_t *parser: represents the parse state of the request
|
||||||
|
* IN http_message_t* request: HTTP message containing GENA request
|
||||||
|
* INOUT SOCKINFO *info: Structure containing information about the socket
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This is the callback function called by the miniserver to handle
|
||||||
* incoming GENA requests.
|
* incoming GENA requests.
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
|
* Returns: int
|
||||||
*/
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
EXTERN_C void genaCallback(
|
***************************************************************************/
|
||||||
/*! [in] represents the parse state of the request */
|
EXTERN_C void genaCallback (IN http_parser_t *parser,
|
||||||
http_parser_t *parser,
|
IN http_message_t* request,
|
||||||
/*! [in] HTTP message containing GENA request */
|
IN SOCKINFO *info);
|
||||||
http_message_t* request,
|
|
||||||
/*! [in,out] Structure containing information about the socket */
|
|
||||||
SOCKINFO *info);
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : genaSubscribe
|
||||||
* \brief This function subscribes to a PublisherURL (also mentioned as EventURL
|
|
||||||
* in some places).
|
|
||||||
*
|
*
|
||||||
* It sends SUBSCRIBE http request to service processes request. Finally adds a
|
* Parameters:
|
||||||
* Subscription to the clients subscription list, if service responds with OK.
|
* IN UpnpClient_Handle client_handle:
|
||||||
|
* IN char * PublisherURL: NULL Terminated, of the form :
|
||||||
|
* "http://134.134.156.80:4000/RedBulb/Event"
|
||||||
|
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
||||||
|
* in the OUT case: actual Duration granted
|
||||||
|
* by Service, -1 for infinite
|
||||||
|
* OUT Upnp_SID out_sid:sid of subscription, memory passed in by caller
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
|
* Description:
|
||||||
* appropriate error code
|
* This function subscribes to a PublisherURL ( also mentioned as EventURL
|
||||||
*/
|
* some places). It sends SUBSCRIBE http request to service processes
|
||||||
|
* request. Finally adds a Subscription to
|
||||||
|
* the clients subscription list, if service responds with OK
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
|
* returns appropriate error
|
||||||
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaSubscribe(
|
EXTERN_C int genaSubscribe(
|
||||||
/*! [in] The client handle. */
|
|
||||||
UpnpClient_Handle client_handle,
|
UpnpClient_Handle client_handle,
|
||||||
/*! [in] Of the form: "http://134.134.156.80:4000/RedBulb/Event */
|
char * PublisherURL,
|
||||||
const UpnpString *PublisherURL,
|
|
||||||
/*! [in,out] requested Duration:
|
|
||||||
* \li if -1, then "infinite".
|
|
||||||
* \li in the OUT case: actual Duration granted by Service,
|
|
||||||
* -1 for infinite. */
|
|
||||||
int * TimeOut,
|
int * TimeOut,
|
||||||
/*! [out] sid of subscription, memory passed in by caller. */
|
Upnp_SID out_sid );
|
||||||
UpnpString *out_sid);
|
#endif
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Unsubscribes a SID.
|
* Function : genaUnSubscribe
|
||||||
*
|
*
|
||||||
* It first validates the SID and client_handle,copies the subscription, sends
|
* Parameters:
|
||||||
* UNSUBSCRIBE http request to service processes request and finally removes
|
* IN UpnpClient_Handle client_handle: UPnP client handle
|
||||||
* the subscription.
|
* IN SID in_sid: The subscription ID
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS if service response is OK, otherwise returns the
|
* Description:
|
||||||
* appropriate error code.
|
* This function unsubscribes a SID. It first validates the SID and
|
||||||
*/
|
* client_handle,copies the subscription, sends UNSUBSCRIBE http request
|
||||||
|
* to service processes request and finally removes the subscription
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
|
* returns appropriate error
|
||||||
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaUnSubscribe(
|
EXTERN_C int genaUnSubscribe(
|
||||||
/*! [in] UPnP client handle. */
|
|
||||||
UpnpClient_Handle client_handle,
|
UpnpClient_Handle client_handle,
|
||||||
/*! [in] The subscription ID. */
|
const Upnp_SID in_sid);
|
||||||
const UpnpString *in_sid);
|
#endif
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : genaUnregisterClient
|
||||||
* \brief Unsubcribes all the outstanding subscriptions and cleans the
|
|
||||||
* subscription list.
|
|
||||||
*
|
*
|
||||||
* This function is called when control point unregisters.
|
* Parameters:
|
||||||
|
* IN UpnpClient_Handle client_handle: Handle containing all the control
|
||||||
|
* point related information
|
||||||
*
|
*
|
||||||
* \returns UPNP_E_SUCCESS if successful, otherwise returns the appropriate
|
* Description:
|
||||||
* error code.
|
* This function unsubcribes all the outstanding subscriptions and cleans
|
||||||
*/
|
* the subscription list. This function is called when control point
|
||||||
|
* unregisters.
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* return UPNP_E_SUCCESS if successful else returns appropriate error
|
||||||
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaUnregisterClient(
|
EXTERN_C int genaUnregisterClient(UpnpClient_Handle client_handle);
|
||||||
/*! [in] Handle containing all the control point related information. */
|
#endif
|
||||||
UpnpClient_Handle client_handle);
|
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
|
||||||
|
|
||||||
|
//server
|
||||||
/*
|
/************************************************************************
|
||||||
* DEVICE
|
* Function : genaUnregisterDevice
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Cleans the service table of the device.
|
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS if successful, otherwise returns GENA_E_BAD_HANDLE
|
* Parameters:
|
||||||
*/
|
* IN UpnpDevice_Handle device_handle: Handle of the root device
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function cleans the service table of the device.
|
||||||
|
*
|
||||||
|
* Returns: int
|
||||||
|
* returns UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE
|
||||||
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaUnregisterDevice(
|
EXTERN_C int genaUnregisterDevice(UpnpDevice_Handle device_handle);
|
||||||
/*! [in] Handle of the root device */
|
#endif
|
||||||
UpnpDevice_Handle device_handle);
|
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Renews a SID.
|
* Function : genaRenewSubscription
|
||||||
*
|
*
|
||||||
* It first validates the SID and client_handle and copies the subscription.
|
* Parameters:
|
||||||
* It sends RENEW (modified SUBSCRIBE) http request to service and processes
|
* IN UpnpClient_Handle client_handle: Client handle
|
||||||
|
* IN const Upnp_SID in_sid: subscription ID
|
||||||
|
* INOUT int * TimeOut: requested Duration, if -1, then "infinite".
|
||||||
|
* in the OUT case: actual Duration granted
|
||||||
|
* by Service, -1 for infinite
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function renews a SID. It first validates the SID and
|
||||||
|
* client_handle and copies the subscription. It sends RENEW
|
||||||
|
* (modified SUBSCRIBE) http request to service and processes
|
||||||
* the response.
|
* the response.
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS if service response is OK, otherwise the
|
* Returns: int
|
||||||
* appropriate error code.
|
* return UPNP_E_SUCCESS if service response is OK else
|
||||||
*/
|
* returns appropriate error
|
||||||
|
***************************************************************************/
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
EXTERN_C int genaRenewSubscription(
|
EXTERN_C int genaRenewSubscription(
|
||||||
/*! [in] Client handle. */
|
IN UpnpClient_Handle client_handle,
|
||||||
UpnpClient_Handle client_handle,
|
IN const Upnp_SID in_sid,
|
||||||
/*! [in] Subscription ID. */
|
OUT int * TimeOut);
|
||||||
const UpnpString *in_sid,
|
#endif
|
||||||
/*! [in,out] requested Duration, if -1, then "infinite". In the OUT case:
|
/****************************************************************************
|
||||||
* actual Duration granted by Service, -1 for infinite. */
|
* Function : genaNotifyAll
|
||||||
int *TimeOut);
|
|
||||||
#endif /* INCLUDE_CLIENT_APIS */
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Sends a notification to all the subscribed control points.
|
|
||||||
*
|
*
|
||||||
* \return int
|
* Parameters :
|
||||||
|
* IN UpnpDevice_Handle device_handle : Device handle
|
||||||
|
* IN char *UDN : Device udn
|
||||||
|
* IN char *servId : Service ID
|
||||||
|
* IN char **VarNames : array of varible names
|
||||||
|
* IN char **VarValues : array of variable values
|
||||||
|
* IN int var_count : number of variables
|
||||||
*
|
*
|
||||||
* \note This function is similar to the genaNotifyAllExt. The only difference
|
* Description : This function sends a notification to all the subscribed
|
||||||
|
* control points
|
||||||
|
*
|
||||||
|
* Return : int
|
||||||
|
*
|
||||||
|
* Note : This function is similar to the genaNotifyAllExt. The only difference
|
||||||
* is it takes event variable array instead of xml document.
|
* is it takes event variable array instead of xml document.
|
||||||
*/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaNotifyAll(
|
EXTERN_C int genaNotifyAll(
|
||||||
/*! [in] Device handle. */
|
|
||||||
UpnpDevice_Handle device_handle,
|
UpnpDevice_Handle device_handle,
|
||||||
/*! [in] Device udn. */
|
|
||||||
char *UDN,
|
char *UDN,
|
||||||
/*! [in] Service ID. */
|
|
||||||
char *servId,
|
char *servId,
|
||||||
/*! [in] Array of varible names. */
|
|
||||||
char **VarNames,
|
char **VarNames,
|
||||||
/*! [in] Array of variable values. */
|
|
||||||
char **VarValues,
|
char **VarValues,
|
||||||
/*! [in] Number of variables. */
|
|
||||||
int var_count);
|
int var_count);
|
||||||
#endif /* INCLUDE_DEVICE_APIS */
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
/*!
|
* Function : genaNotifyAllExt
|
||||||
* \brief Sends a notification to all the subscribed control points.
|
|
||||||
*
|
*
|
||||||
* \return int
|
* Parameters :
|
||||||
|
* IN UpnpDevice_Handle device_handle : Device handle
|
||||||
|
* IN char *UDN : Device udn
|
||||||
|
* IN char *servId : Service ID
|
||||||
|
* IN IXML_Document *PropSet : XML document Event varible property set
|
||||||
*
|
*
|
||||||
* \note This function is similar to the genaNotifyAll. the only difference
|
* Description : This function sends a notification to all the subscribed
|
||||||
* is it takes the document instead of event variable array.
|
* control points
|
||||||
*/
|
*
|
||||||
|
* Return : int
|
||||||
|
*
|
||||||
|
* Note : This function is similar to the genaNotifyAll. the only difference
|
||||||
|
* is it takes the document instead of event variable array
|
||||||
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaNotifyAllExt(
|
EXTERN_C int genaNotifyAllExt(
|
||||||
/*! [in] Device handle. */
|
|
||||||
UpnpDevice_Handle device_handle,
|
UpnpDevice_Handle device_handle,
|
||||||
/*! [in] Device udn. */
|
|
||||||
char *UDN,
|
char *UDN,
|
||||||
/*! [in] Service ID. */
|
|
||||||
char *servId,
|
char *servId,
|
||||||
/*! [in] XML document Event varible property set. */
|
IN IXML_Document *PropSet);
|
||||||
IXML_Document *PropSet);
|
#endif
|
||||||
#endif /* INCLUDE_DEVICE_APIS */
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
/*!
|
* Function : genaInitNotify
|
||||||
* \brief Sends the intial state table dump to newly subscribed control point.
|
|
||||||
*
|
*
|
||||||
* \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
|
* Parameters :
|
||||||
|
* IN UpnpDevice_Handle device_handle : Device handle
|
||||||
|
* IN char *UDN : Device udn
|
||||||
|
* IN char *servId : Service ID
|
||||||
|
* IN char **VarNames : Array of variable names
|
||||||
|
* IN char **VarValues : Array of variable values
|
||||||
|
* IN int var_count : array size
|
||||||
|
* IN Upnp_SID sid : subscription ID
|
||||||
*
|
*
|
||||||
* \note No other event will be sent to this control point before the
|
* Description : This function sends the intial state table dump to
|
||||||
|
* newly subscribed control point.
|
||||||
|
*
|
||||||
|
* Return : int
|
||||||
|
* returns GENA_E_SUCCESS if successful else returns appropriate error
|
||||||
|
*
|
||||||
|
* Note : No other event will be sent to this control point before the
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
*/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaInitNotify(
|
EXTERN_C int genaInitNotify(IN UpnpDevice_Handle device_handle,
|
||||||
/*! [in] Device handle. */
|
IN char *UDN,
|
||||||
UpnpDevice_Handle device_handle,
|
IN char *servId,
|
||||||
/*! [in] Device udn. */
|
IN char **VarNames,
|
||||||
char *UDN,
|
IN char **VarValues,
|
||||||
/*! [in] Service ID. */
|
IN int var_count,
|
||||||
char *servId,
|
IN Upnp_SID sid);
|
||||||
/*! [in] Array of variable names. */
|
#endif
|
||||||
char **VarNames,
|
|
||||||
/*! [in] Array of variable values. */
|
|
||||||
char **VarValues,
|
|
||||||
/*! [in] Array size. */
|
|
||||||
int var_count,
|
|
||||||
/*! [in] Subscription ID. */
|
|
||||||
const Upnp_SID sid);
|
|
||||||
#endif /* INCLUDE_DEVICE_APIS */
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
/*!
|
* Function : genaInitNotifyExt
|
||||||
* \brief Similar to the genaInitNofity. The only difference is that it
|
|
||||||
* takes the xml document for the state table and sends the intial state
|
|
||||||
* table dump to newly subscribed control point.
|
|
||||||
*
|
*
|
||||||
* \return GENA_E_SUCCESS if successful, otherwise the appropriate error code.
|
* Parameters :
|
||||||
|
* IN UpnpDevice_Handle device_handle : Device handle
|
||||||
|
* IN char *UDN : Device udn
|
||||||
|
* IN char *servId : Service ID
|
||||||
|
* IN IXML_Document *PropSet : Document of the state table
|
||||||
|
* IN Upnp_SID sid : subscription ID
|
||||||
*
|
*
|
||||||
* \note No other event will be sent to this control point before the
|
* Description : This function is similar to the genaInitNofity. The only
|
||||||
|
* difference is that it takes the xml document for the state table and
|
||||||
|
* sends the intial state table dump to newly subscribed control point.
|
||||||
|
*
|
||||||
|
* Return : int
|
||||||
|
* returns GENA_E_SUCCESS if successful else returns appropriate error
|
||||||
|
*
|
||||||
|
* Note : No other event will be sent to this control point before the
|
||||||
* intial state table dump.
|
* intial state table dump.
|
||||||
*/
|
****************************************************************************/
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
EXTERN_C int genaInitNotifyExt(
|
EXTERN_C int genaInitNotifyExt(
|
||||||
/*! [in] Device handle. */
|
IN UpnpDevice_Handle device_handle,
|
||||||
UpnpDevice_Handle device_handle,
|
IN char *UDN,
|
||||||
/*! [in] Device udn. */
|
IN char *servId,
|
||||||
char *UDN,
|
IN IXML_Document *PropSet,
|
||||||
/*! [in] Service ID. */
|
IN Upnp_SID sid);
|
||||||
char *servId,
|
#endif
|
||||||
/*! [in] Document of the state table. */
|
|
||||||
IXML_Document *PropSet,
|
|
||||||
/*! [in] subscription ID. */
|
|
||||||
const Upnp_SID sid);
|
|
||||||
#endif /* INCLUDE_DEVICE_APIS */
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Sends an error message to the control point in the case of incorrect
|
* Function : error_respond
|
||||||
* GENA requests.
|
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS if successful, otherwise appropriate error code.
|
* Parameters:
|
||||||
*/
|
* IN SOCKINFO *info: Structure containing information about the socket
|
||||||
void error_respond(
|
* IN int error_code: error code that will be in the GENA response
|
||||||
/*! [in] Structure containing information about the socket. */
|
* IN http_message_t* hmsg: GENA request Packet
|
||||||
SOCKINFO *info,
|
*
|
||||||
/*! [in] error code that will be in the GENA response. */
|
* Description:
|
||||||
int error_code,
|
* This function send an error message to the control point in the case
|
||||||
/*! [in] GENA request Packet. */
|
* incorrect GENA requests.
|
||||||
http_message_t* hmsg);
|
*
|
||||||
|
* Returns: int
|
||||||
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
|
***************************************************************************/
|
||||||
|
void error_respond( IN SOCKINFO *info, IN int error_code,
|
||||||
|
IN http_message_t* hmsg );
|
||||||
|
|
||||||
|
|
||||||
|
#endif // GENA
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* GENA_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +1,44 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef GLOBAL_H
|
|
||||||
#define GLOBAL_H
|
|
||||||
|
|
||||||
|
|
||||||
/* GLOBAL.H - RSAREF types and constants */
|
/* GLOBAL.H - RSAREF types and constants */
|
||||||
/* PROTOTYPES should be set to one if and only if the compiler supports
|
/* PROTOTYPES should be set to one if and only if the compiler supports
|
||||||
function argument prototyping.
|
function argument prototyping.
|
||||||
|
|
||||||
The following makes PROTOTYPES default to 1 if it has not already
|
The following makes PROTOTYPES default to 0 if it has not already
|
||||||
been defined with C compiler flags.
|
been defined with C compiler flags.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef PROTOTYPES
|
#ifndef PROTOTYPES
|
||||||
#define PROTOTYPES 1
|
#define PROTOTYPES 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* POINTER defines a generic pointer type */
|
/* POINTER defines a generic pointer type */
|
||||||
@@ -56,17 +50,13 @@ typedef unsigned short int UINT2;
|
|||||||
/* UINT4 defines a four byte word */
|
/* UINT4 defines a four byte word */
|
||||||
typedef unsigned long int UINT4;
|
typedef unsigned long int UINT4;
|
||||||
|
|
||||||
/*
|
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
|
||||||
* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
|
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
|
||||||
* If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
|
returns an empty list.
|
||||||
* returns an empty list.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if PROTOTYPES
|
#if PROTOTYPES
|
||||||
#define PROTO_LIST(list) list
|
#define PROTO_LIST(list) list
|
||||||
#else
|
#else
|
||||||
#define PROTO_LIST(list) ()
|
#define PROTO_LIST(list) ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* GLOBAL_H */
|
|
||||||
|
|
||||||
|
|||||||
314
upnp/src/inc/http_client.h
Normal file
314
upnp/src/inc/http_client.h
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 _http_client_h_
|
||||||
|
#define _http_client_h_
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
#define EXTERN_C
|
||||||
|
#endif
|
||||||
|
#include "genlib/closesocket/upnpclosesocket.h"
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
//#include <malloc.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include "tools/config.h"
|
||||||
|
#include "upnp.h"
|
||||||
|
//#include "upnp_debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define HTTP_DATE_LENGTH 37 // length for HTTP DATE:
|
||||||
|
//"DATE: Sun, 01 Jul 2000 08:15:23 GMT<cr><lf>"
|
||||||
|
#define SEPARATORS "()<>@,;:\\\"/[]?={} \t"
|
||||||
|
#define MARK "-_.!~*'()"
|
||||||
|
#define RESERVED ";/?:@&=+$,"
|
||||||
|
#define HTTP_SUCCESS 1
|
||||||
|
#define HTTP_E_BAD_URL UPNP_E_INVALID_URL
|
||||||
|
#define HTTP_E_READ_SOCKET UPNP_E_SOCKET_READ
|
||||||
|
#define HTTP_E_BIND_SOCKET UPNP_E_SOCKET_BIND
|
||||||
|
#define HTTP_E_WRITE_SOCKET UPNP_E_SOCKET_WRITE
|
||||||
|
#define HTTP_E_CONNECT_SOCKET UPNP_E_SOCKET_CONNECT
|
||||||
|
#define HTTP_E_SOCKET UPNP_E_OUTOF_SOCKET
|
||||||
|
#define HTTP_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
||||||
|
#define HTTP_E_BAD_REQUEST UPNP_E_BAD_REQUEST
|
||||||
|
#define HTTP_E_BAD_IP_ADDRESS UPNP_E_INVALID_URL
|
||||||
|
#define FALSE 0
|
||||||
|
#define TAB 9
|
||||||
|
#define CR 13
|
||||||
|
#define LF 10
|
||||||
|
#define RESPONSE_TIMEOUT 30
|
||||||
|
#define SOCKET_BUFFER_SIZE 5000
|
||||||
|
|
||||||
|
enum hostType { HOSTNAME, IPv4address };
|
||||||
|
enum pathType { ABS_PATH, REL_PATH, OPAQUE_PART };
|
||||||
|
enum uriType { ABSOLUTE, RELATIVE };
|
||||||
|
|
||||||
|
//Buffer used to store data read from
|
||||||
|
//a socket during an http transfer
|
||||||
|
//in function read_bytes.
|
||||||
|
typedef struct SOCKET_BUFFER{
|
||||||
|
char buff[SOCKET_BUFFER_SIZE];
|
||||||
|
int size;
|
||||||
|
struct SOCKET_BUFFER *next;
|
||||||
|
} socket_buffer;
|
||||||
|
|
||||||
|
//Buffer used in parsing
|
||||||
|
//http messages, urls, etc.
|
||||||
|
//generally this simply
|
||||||
|
//holds a pointer into a larger array
|
||||||
|
typedef struct TOKEN {
|
||||||
|
char * buff;
|
||||||
|
size_t size;
|
||||||
|
} token;
|
||||||
|
|
||||||
|
|
||||||
|
//Represents a host port:
|
||||||
|
//e.g. :"127.127.0.1:80"
|
||||||
|
//text is a token pointing to
|
||||||
|
//the full string representation
|
||||||
|
typedef struct HOSTPORT {
|
||||||
|
token text; //full host port
|
||||||
|
struct sockaddr_in IPv4address; //Network Byte Order
|
||||||
|
} hostport_type;
|
||||||
|
|
||||||
|
//Represents a URI
|
||||||
|
//used in parse_uri and elsewhere
|
||||||
|
typedef struct URI{
|
||||||
|
enum uriType type;
|
||||||
|
token scheme;
|
||||||
|
enum pathType path_type;
|
||||||
|
token pathquery;
|
||||||
|
token fragment;
|
||||||
|
hostport_type hostport;
|
||||||
|
} uri_type;
|
||||||
|
|
||||||
|
//Represents a list of URLs as in
|
||||||
|
//the "callback" header of SUBSCRIBE
|
||||||
|
//message in GENA
|
||||||
|
//char * URLs holds dynamic memory
|
||||||
|
typedef struct URL_LIST {
|
||||||
|
int size;
|
||||||
|
char * URLs; //all the urls, delimited by <>
|
||||||
|
uri_type *parsedURLs;
|
||||||
|
} URL_list;
|
||||||
|
|
||||||
|
typedef struct HTTP_HEADER {
|
||||||
|
token header;
|
||||||
|
token value;
|
||||||
|
struct HTTP_HEADER * next;
|
||||||
|
} http_header;
|
||||||
|
|
||||||
|
typedef struct HTTP_STATUS_LINE{
|
||||||
|
token http_version;
|
||||||
|
token status_code;
|
||||||
|
token reason_phrase;
|
||||||
|
} http_status;
|
||||||
|
|
||||||
|
typedef struct HTTP_REQUEST_LINE {
|
||||||
|
token http_version;
|
||||||
|
uri_type request_uri;
|
||||||
|
token method;
|
||||||
|
} http_request;
|
||||||
|
|
||||||
|
//Represents a parsed HTTP_MESSAGE
|
||||||
|
//head_list is dynamically allocated
|
||||||
|
typedef struct HTTP_MESSAGE {
|
||||||
|
http_status status;
|
||||||
|
http_request request;
|
||||||
|
http_header * header_list;
|
||||||
|
token content;
|
||||||
|
} http_message;
|
||||||
|
|
||||||
|
|
||||||
|
EXTERN_C int transferHTTP( char * request, char * toSend,
|
||||||
|
int toSendSize, char **out, char * Url);
|
||||||
|
|
||||||
|
|
||||||
|
EXTERN_C int transferHTTPRaw( char * toSend, int toSendSize,
|
||||||
|
char **out, char *URL);
|
||||||
|
|
||||||
|
//helper function
|
||||||
|
EXTERN_C int transferHTTPparsedURL( char * request,
|
||||||
|
char * toSend, int toSendSize,
|
||||||
|
char **out, uri_type *URL);
|
||||||
|
|
||||||
|
//assumes that char * out has enough space ( 38 characters)
|
||||||
|
//outputs the current time in the following null terminated string:
|
||||||
|
// "DATE: Sun, Jul 06 2000 08:53:01 GMT\r\n"
|
||||||
|
EXTERN_C void currentTmToHttpDate(char *out);
|
||||||
|
|
||||||
|
//returns dynamic memory or NULL on error
|
||||||
|
EXTERN_C char * resolve_rel_url( char * base_url, char * rel_url);
|
||||||
|
|
||||||
|
EXTERN_C int parse_uri( char * in, int max, uri_type * out);
|
||||||
|
|
||||||
|
EXTERN_C int token_cmp( token *in1, token *in2);
|
||||||
|
|
||||||
|
EXTERN_C int token_string_casecmp( token * in1, char * in2);
|
||||||
|
|
||||||
|
EXTERN_C int token_string_cmp( token * in1, char * in2);
|
||||||
|
|
||||||
|
EXTERN_C int parse_http_response( char * in, http_message * out,
|
||||||
|
int max_len);
|
||||||
|
|
||||||
|
EXTERN_C int parse_http_request( char * in, http_message *out,
|
||||||
|
int max_len);
|
||||||
|
|
||||||
|
EXTERN_C int search_for_header( http_message * in,
|
||||||
|
char * header, token *out_value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EXTERN_C int parse_hostport( char* in, int max, hostport_type *out );
|
||||||
|
|
||||||
|
EXTERN_C size_t write_bytes(int fd, char * bytes, size_t n,
|
||||||
|
int timeout);
|
||||||
|
EXTERN_C void free_http_message(http_message * message);
|
||||||
|
EXTERN_C int copy_URL_list( URL_list *in, URL_list *out);
|
||||||
|
EXTERN_C void free_URL_list(URL_list * list);
|
||||||
|
EXTERN_C int parse_port(int max, char * port, unsigned short int * out);
|
||||||
|
|
||||||
|
EXTERN_C int parse_http_line( char * in, int max_size);
|
||||||
|
EXTERN_C int parse_not_LWS( char *in, token *out, int max_size);
|
||||||
|
EXTERN_C int parse_LWS( char * in, int max_size);
|
||||||
|
EXTERN_C int parse_token( char * in, token * out, int max_size);
|
||||||
|
EXTERN_C ssize_t readLine(int fd, char *out, int max, int *timeout);
|
||||||
|
EXTERN_C int remove_dots(char * in, int size);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
EXTERN_C void print_http_request(
|
||||||
|
http_message *message,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo);
|
||||||
|
#else
|
||||||
|
static inline void print_http_request(
|
||||||
|
http_message *message,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
EXTERN_C void print_http_response(
|
||||||
|
http_message *message,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo);
|
||||||
|
#else
|
||||||
|
static inline void print_http_response(
|
||||||
|
http_message *message,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
EXTERN_C void print_token(
|
||||||
|
token *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo);
|
||||||
|
#else
|
||||||
|
static inline void print_token(
|
||||||
|
token *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
EXTERN_C void print_status_line(
|
||||||
|
http_status *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo);
|
||||||
|
#else
|
||||||
|
static inline void print_status_line(
|
||||||
|
http_status *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
EXTERN_C void print_request_line(
|
||||||
|
http_request *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo);
|
||||||
|
#else
|
||||||
|
static inline void print_request_line(
|
||||||
|
http_request *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
EXTERN_C void print_uri(
|
||||||
|
uri_type *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo);
|
||||||
|
#else
|
||||||
|
static inline void print_uri(
|
||||||
|
uri_type *in,
|
||||||
|
Upnp_LogLevel DLevel,
|
||||||
|
Dbg_Module Module,
|
||||||
|
char *DbgFileName,
|
||||||
|
int DbgLineNo) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ int http_FixUrl( IN uri_type* url, OUT uri_type* fixed_url );
|
|||||||
* UPNP_E_INVALID_URL
|
* UPNP_E_INVALID_URL
|
||||||
* UPNP_E_SUCCESS
|
* UPNP_E_SUCCESS
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int http_FixStrUrl( IN const char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url );
|
int http_FixStrUrl( IN char* urlstr, IN int urlstrlen, OUT uri_type* fixed_url );
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
|||||||
@@ -1,100 +1,103 @@
|
|||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
#ifndef INET_PTON
|
#ifndef INET_PTON
|
||||||
#define INET_PTON
|
#define INET_PTON
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
|
|
||||||
#include "unixutil.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
typedef int socklen_t;
|
||||||
|
#define EAFNOSUPPORT 97
|
||||||
|
|
||||||
|
/*
|
||||||
/*!
|
* WARNING: Don't even consider trying to compile this on a system where
|
||||||
* \file
|
|
||||||
*
|
|
||||||
* \author: Paul Vixie, 1996.
|
|
||||||
*
|
|
||||||
* \brief Network support routines missing in WIN32.
|
|
||||||
*
|
|
||||||
* \warning Don't even consider trying to compile this on a system where
|
|
||||||
* sizeof(int) < 4. sizeof(int) 4 is fine; all the world's not a VAX.
|
* sizeof(int) < 4. sizeof(int) 4 is fine; all the world's not a VAX.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/* const char *
|
||||||
* \brief format an IPv4 address
|
* inet_ntop4(src, dst, size)
|
||||||
*
|
* format an IPv4 address
|
||||||
* \return `dst' (as a const)
|
* return:
|
||||||
*
|
* `dst' (as a const)
|
||||||
* \note
|
* notes:
|
||||||
* \li (1) uses no statics
|
* (1) uses no statics
|
||||||
* \li (2) takes a u_char* not an in_addr as input
|
* (2) takes a u_char* not an in_addr as input
|
||||||
*
|
* author:
|
||||||
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
extern const char * inet_ntop4(const u_char src, char *dst, socklen_t size);
|
extern const char * inet_ntop4(const u_char src, char *dst, socklen_t size);
|
||||||
|
|
||||||
|
/* const char *
|
||||||
/*!
|
* inet_ntop6(src, dst, size)
|
||||||
* \brief convert IPv6 binary address into presentation (printable) format
|
* convert IPv6 binary address into presentation (printable) format
|
||||||
|
* author:
|
||||||
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef INET_IPV6
|
#ifdef INET_IPV6
|
||||||
extern const char *inet_ntop6(const u_char *src, char *dst, socklen_t size);
|
|
||||||
|
extern const char * inet_ntop6(src, dst, size);
|
||||||
|
|
||||||
#endif /* INET_IPV6 */
|
#endif /* INET_IPV6 */
|
||||||
|
|
||||||
|
/* int
|
||||||
/*!
|
* inet_pton4(src, dst)
|
||||||
* \brief like inet_aton() but without all the hexadecimal and shorthand.
|
* like inet_aton() but without all the hexadecimal and shorthand.
|
||||||
*
|
* return:
|
||||||
* \return 1 if `src' is a valid dotted quad, else 0.
|
* 1 if `src' is a valid dotted quad, else 0.
|
||||||
*
|
* notice:
|
||||||
* \note does not touch `dst' unless it's returning 1.
|
* does not touch `dst' unless it's returning 1.
|
||||||
|
* author:
|
||||||
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
extern inet_pton4(const char *src,u_char *dst);
|
extern inet_pton4(const char *src,u_char *dst);
|
||||||
|
|
||||||
|
/* int
|
||||||
/*!
|
* inet_pton6(src, dst)
|
||||||
* \brief convert presentation level address to network order binary form.
|
* convert presentation level address to network order binary form.
|
||||||
*
|
* return:
|
||||||
* \return 1 if `src' is a valid [RFC1884 2.2] address, else 0.
|
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
|
||||||
*
|
* notice:
|
||||||
* \note
|
* (1) does not touch `dst' unless it's returning 1.
|
||||||
* \li (1) does not touch `dst' unless it's returning 1.
|
* (2) :: in a full address is silently ignored.
|
||||||
* \li (2) :: in a full address is silently ignored.
|
* credit:
|
||||||
|
* inspired by Mark Andrews.
|
||||||
|
* author:
|
||||||
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef INET_IPV6
|
#ifdef INET_IPV6
|
||||||
extern int inet_pton6(const char *src, u_char *dst);
|
|
||||||
|
extern int inet_pton6(src, dst);
|
||||||
|
|
||||||
#endif /* INET_IPV6 */
|
#endif /* INET_IPV6 */
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief convert a network format address to presentation format.
|
/* char *
|
||||||
*
|
* inet_ntop(af, src, dst, size)
|
||||||
* \return
|
* convert a network format address to presentation format.
|
||||||
|
* return:
|
||||||
* pointer to presentation format address (`dst'), or NULL (see errno).
|
* pointer to presentation format address (`dst'), or NULL (see errno).
|
||||||
|
* author:
|
||||||
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
extern const char *inet_ntop(int af,const void *src,char *dst,socklen_t size);
|
extern const char *inet_ntop(int af,const void *src,char *dst,socklen_t size);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/* int
|
||||||
* \brief convert from presentation format (which usually means ASCII printable)
|
* inet_pton(af, src, dst)
|
||||||
|
* convert from presentation format (which usually means ASCII printable)
|
||||||
* to network format (which is usually some kind of binary format).
|
* to network format (which is usually some kind of binary format).
|
||||||
*
|
* return:
|
||||||
* \return
|
* 1 if the address was valid for the specified address family
|
||||||
* \li 1 if the address was valid for the specified address family
|
* 0 if the address wasn't valid (`dst' is untouched in this case)
|
||||||
* \li 0 if the address wasn't valid (`dst' is untouched in this case)
|
* -1 if some other error occurred (`dst' is untouched in this case, too)
|
||||||
* \li -1 if some other error occurred (`dst' is untouched in this case, too)
|
* author:
|
||||||
|
* Paul Vixie, 1996.
|
||||||
*/
|
*/
|
||||||
extern int inet_pton(int af,const char *src,void *dst);
|
extern int inet_pton(int af,const char *src,void *dst);
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif /* WIN32 */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* INET_PTON */
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,22 +42,17 @@ extern SOCKET gMiniServerStopSock;
|
|||||||
|
|
||||||
typedef struct MServerSockArray {
|
typedef struct MServerSockArray {
|
||||||
/* socket for listening for miniserver requests */
|
/* socket for listening for miniserver requests */
|
||||||
SOCKET miniServerSock4;
|
int miniServerSock;
|
||||||
SOCKET miniServerSock6;
|
|
||||||
/* socket for stopping miniserver */
|
/* socket for stopping miniserver */
|
||||||
SOCKET miniServerStopSock;
|
int miniServerStopSock;
|
||||||
/* socket for incoming advertisments and search requests */
|
/* socket for incoming advertisments and search requests */
|
||||||
SOCKET ssdpSock4;
|
int ssdpSock;
|
||||||
SOCKET ssdpSock6;
|
|
||||||
SOCKET ssdpSock6UlaGua;
|
|
||||||
|
|
||||||
SOCKET stopPort;
|
int stopPort;
|
||||||
SOCKET miniServerPort4;
|
int miniServerPort;
|
||||||
SOCKET miniServerPort6;
|
|
||||||
|
|
||||||
/* socket for sending search requests and receiving search replies */
|
/* socket for sending search requests and receiving search replies */
|
||||||
CLIENTONLY(SOCKET ssdpReqSock4;)
|
CLIENTONLY(int ssdpReqSock;)
|
||||||
CLIENTONLY(SOCKET ssdpReqSock6;)
|
|
||||||
} MiniServerSockArray;
|
} MiniServerSockArray;
|
||||||
|
|
||||||
|
|
||||||
@@ -71,62 +66,78 @@ typedef void (*MiniServerCallback)(
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function: SetHTTPGetCallback
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* MiniServerCallback callback; - HTTP Callback to be invoked
|
||||||
|
*
|
||||||
|
* Description: Set HTTP Get Callback
|
||||||
|
*
|
||||||
|
* Return: void
|
||||||
|
************************************************************************/
|
||||||
|
void SetHTTPGetCallback( MiniServerCallback callback );
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Set HTTP Get Callback.
|
* Function: SetSoapCallback
|
||||||
*/
|
*
|
||||||
void SetHTTPGetCallback(
|
* Parameters:
|
||||||
/*! [in] HTTP Callback to be invoked . */
|
* MiniServerCallback callback; - SOAP Callback to be invoked
|
||||||
MiniServerCallback callback);
|
*
|
||||||
|
* Description: Set SOAP Callback
|
||||||
|
*
|
||||||
/*!
|
* Return: void
|
||||||
* \brief Set SOAP Callback.
|
************************************************************************/
|
||||||
*/
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
void SetSoapCallback(
|
void SetSoapCallback( MiniServerCallback callback );
|
||||||
/*! [in] SOAP Callback to be invoked . */
|
|
||||||
MiniServerCallback callback);
|
|
||||||
#else /* INCLUDE_DEVICE_APIS */
|
#else /* INCLUDE_DEVICE_APIS */
|
||||||
static inline void SetSoapCallback( MiniServerCallback callback ) {}
|
static inline void SetSoapCallback( MiniServerCallback callback ) {}
|
||||||
#endif /* INCLUDE_DEVICE_APIS */
|
#endif /* INCLUDE_DEVICE_APIS */
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function: SetGenaCallback
|
||||||
* \brief Set GENA Callback.
|
|
||||||
*/
|
|
||||||
void SetGenaCallback(
|
|
||||||
/*! [in] GENA Callback to be invoked. */
|
|
||||||
MiniServerCallback callback);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Initialize the sockets functionality for the Miniserver.
|
|
||||||
*
|
*
|
||||||
* Initialize a thread pool job to run the MiniServer and the job to the
|
* Parameters:
|
||||||
* thread pool.
|
* MiniServerCallback callback; - GENA Callback to be invoked
|
||||||
*
|
*
|
||||||
* If listen port is 0, port is dynamically picked.
|
* D6escription: Set GENA Callback
|
||||||
|
*
|
||||||
|
* Return: void
|
||||||
|
************************************************************************/
|
||||||
|
void SetGenaCallback( MiniServerCallback callback );
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function: StartMiniServer
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* unsigned short listen_port ; Port on which the server listens for
|
||||||
|
* incoming connections
|
||||||
|
*
|
||||||
|
* Description: Initialize the sockets functionality for the
|
||||||
|
* Miniserver. Initialize a thread pool job to run the MiniServer
|
||||||
|
* and the job to the thread pool. If listen port is 0, port is
|
||||||
|
* dynamically picked
|
||||||
*
|
*
|
||||||
* Use timer mechanism to start the MiniServer, failure to meet the
|
* Use timer mechanism to start the MiniServer, failure to meet the
|
||||||
* allowed delay aborts the attempt to launch the MiniServer.
|
* allowed delay aborts the attempt to launch the MiniServer.
|
||||||
*
|
*
|
||||||
* \return
|
* Return: int;
|
||||||
* \li On success: UPNP_E_SUCCESS.
|
* Actual port socket is bound to - On Success:
|
||||||
* \li On error: UPNP_E_XXX.
|
* A negative number UPNP_E_XXX - On Error
|
||||||
*/
|
************************************************************************/
|
||||||
int StartMiniServer(
|
int StartMiniServer( unsigned short listen_port );
|
||||||
/*! [in,out] Port on which the server listens for incoming IPv4 connections. */
|
|
||||||
unsigned short *listen_port4,
|
|
||||||
/*! [in,out] Port on which the server listens for incoming IPv6 connections. */
|
|
||||||
unsigned short *listen_port6);
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function: StopMiniServer
|
||||||
* \brief Stop and Shutdown the MiniServer and free socket resources.
|
|
||||||
*
|
*
|
||||||
* \return Always returns 0.
|
* Parameters:
|
||||||
*/
|
* void;
|
||||||
|
*
|
||||||
|
* Description: Stop and Shutdown the MiniServer and free socket resources.
|
||||||
|
*
|
||||||
|
* Return : int;
|
||||||
|
* Always returns 0
|
||||||
|
************************************************************************/
|
||||||
int StopMiniServer();
|
int StopMiniServer();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,66 +1,54 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef SERVICE_TABLE_H
|
|
||||||
#define SERVICE_TABLE_H
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
#ifndef _SERVICE_TABLE
|
||||||
|
#define _SERVICE_TABLE
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
|
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "upnpdebug.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
//#include <malloc.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
#define SID_SIZE 41
|
#define SID_SIZE 41
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
|
|
||||||
|
|
||||||
typedef struct SUBSCRIPTION {
|
typedef struct SUBSCRIPTION {
|
||||||
Upnp_SID sid;
|
Upnp_SID sid;
|
||||||
int eventKey;
|
int eventKey;
|
||||||
@@ -95,137 +83,191 @@ typedef struct SERVICE_TABLE {
|
|||||||
|
|
||||||
/* Functions for Subscriptions */
|
/* Functions for Subscriptions */
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : copy_subscription
|
||||||
* \brief Makes a copy of the subscription.
|
|
||||||
*
|
*
|
||||||
* \return HTTP_SUCCESS on Sucess.
|
* Parameters :
|
||||||
*/
|
* subscription *in ; Source subscription
|
||||||
int copy_subscription(
|
* subscription *out ; Destination subscription
|
||||||
/*! [in] Source subscription. */
|
|
||||||
subscription *in,
|
|
||||||
/*! [in] Destination subscription. */
|
|
||||||
subscription *out);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* \brief Remove the subscription represented by the const Upnp_SID sid parameter
|
|
||||||
* from the service table and update the service table.
|
|
||||||
*/
|
|
||||||
void RemoveSubscriptionSID(
|
|
||||||
/*! [in] Subscription ID. */
|
|
||||||
Upnp_SID sid,
|
|
||||||
/*! [in] Service object providing the list of subscriptions. */
|
|
||||||
service_info *service);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Return the subscription from the service table that matches
|
|
||||||
* const Upnp_SID sid value.
|
|
||||||
*
|
*
|
||||||
* \return Pointer to the matching subscription node.
|
* Description : Makes a copy of the subscription
|
||||||
*/
|
|
||||||
subscription *GetSubscriptionSID(
|
|
||||||
/*! [in] Subscription ID. */
|
|
||||||
const Upnp_SID sid,
|
|
||||||
/*! [in] Service object providing the list of subscriptions. */
|
|
||||||
service_info *service);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Gets pointer to the first subscription node in the service table.
|
|
||||||
*
|
*
|
||||||
* \return Pointer to the first subscription node.
|
* Return : int ;
|
||||||
*/
|
* HTTP_SUCCESS - On Sucess
|
||||||
subscription *GetFirstSubscription(
|
|
||||||
/*! [in] Service object providing the list of subscriptions. */
|
|
||||||
service_info *service);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Get current and valid subscription from the service table.
|
|
||||||
*
|
*
|
||||||
* \return Pointer to the next subscription node.
|
* Note :
|
||||||
*/
|
************************************************************************/
|
||||||
subscription *GetNextSubscription(
|
int copy_subscription(subscription *in, subscription *out);
|
||||||
/*! [in] Service object providing the list of subscriptions. */
|
|
||||||
service_info *service,
|
|
||||||
/*! [in] Current subscription object. */
|
|
||||||
subscription *current);
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : RemoveSubscriptionSID
|
||||||
* \brief Free's the memory allocated for storing the URL of the subscription.
|
|
||||||
*/
|
|
||||||
void freeSubscription(
|
|
||||||
/*! [in] Subscription object to be freed. */
|
|
||||||
subscription *sub);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Free's memory allocated for all the subscriptions in the service table.
|
|
||||||
*/
|
|
||||||
void freeSubscriptionList(
|
|
||||||
/*! [in] Head of the subscription list. */
|
|
||||||
subscription * head);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Traverses through the service table and returns a pointer to the
|
|
||||||
* service node that matches a known service id and a known UDN.
|
|
||||||
*
|
*
|
||||||
* \return Pointer to the matching service_info node.
|
* Parameters :
|
||||||
*/
|
* Upnp_SID sid ; subscription ID
|
||||||
service_info *FindServiceId(
|
* service_info * service ; service object providing the list of
|
||||||
/*! [in] Service table. */
|
* subscriptions
|
||||||
service_table *table,
|
|
||||||
/*! [in] String representing the service id to be found among those
|
|
||||||
* in the table. */
|
|
||||||
const char *serviceId,
|
|
||||||
/*! [in] String representing the UDN to be found among those in the
|
|
||||||
* table. */
|
|
||||||
const char *UDN);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Traverses the service table and finds the node whose event URL Path
|
|
||||||
* matches a know value.
|
|
||||||
*
|
*
|
||||||
* \return Pointer to the service list node from the service table whose event
|
* Description : Remove the subscription represented by the
|
||||||
* URL matches a known event URL.
|
* const Upnp_SID sid parameter from the service table and update
|
||||||
*/
|
* the service table.
|
||||||
service_info *FindServiceEventURLPath(
|
|
||||||
/*! [in] Service table. */
|
|
||||||
service_table *table,
|
|
||||||
/*! [in] Event URL path used to find a service from the table. */
|
|
||||||
char *eventURLPath);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Traverses the service table and finds the node whose control URL Path
|
|
||||||
* matches a know value.
|
|
||||||
*
|
*
|
||||||
* \return Pointer to the service list node from the service table whose control
|
* Return : void ;
|
||||||
* URL Path matches a known value.
|
*
|
||||||
*/
|
* Note :
|
||||||
service_info * FindServiceControlURLPath(
|
************************************************************************/
|
||||||
/*! [in] Service table. */
|
void RemoveSubscriptionSID(Upnp_SID sid, service_info * service);
|
||||||
service_table *table,
|
|
||||||
/*! [in] Control URL path used to find a service from the table. */
|
/************************************************************************
|
||||||
|
* Function : GetSubscriptionSID
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* Upnp_SID sid ; subscription ID
|
||||||
|
* service_info * service ; service object providing the list of
|
||||||
|
* subscriptions
|
||||||
|
*
|
||||||
|
* Description : Return the subscription from the service table
|
||||||
|
* that matches const Upnp_SID sid value.
|
||||||
|
*
|
||||||
|
* Return : subscription * - Pointer to the matching subscription
|
||||||
|
* node;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
subscription * GetSubscriptionSID(Upnp_SID sid,service_info * service);
|
||||||
|
|
||||||
|
//returns a pointer to the subscription with the SID, NULL if not found
|
||||||
|
|
||||||
|
subscription * CheckSubscriptionSID(Upnp_SID sid,service_info * service);
|
||||||
|
|
||||||
|
//returns a pointer to the first subscription
|
||||||
|
subscription * GetFirstSubscription(service_info *service);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : GetNextSubscription
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* service_info * service ; service object providing the list of
|
||||||
|
* subscriptions
|
||||||
|
* subscription *current ; current subscription object
|
||||||
|
*
|
||||||
|
* Description : Get current and valid subscription from the service
|
||||||
|
* table.
|
||||||
|
*
|
||||||
|
* Return : subscription * - Pointer to the next subscription node;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
subscription * GetNextSubscription(service_info * service, subscription *current);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : freeSubscription
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* subscription * sub ; subscription to be freed
|
||||||
|
*
|
||||||
|
* Description : Free's the memory allocated for storing the URL of
|
||||||
|
* the subscription.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void freeSubscription(subscription * sub);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : freeSubscriptionList
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* subscription * head ; head of the subscription list
|
||||||
|
*
|
||||||
|
* Description : Free's memory allocated for all the subscriptions
|
||||||
|
* in the service table.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void freeSubscriptionList(subscription * head);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : FindServiceId
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* service_table *table ; service table
|
||||||
|
* const char * serviceId ;string representing the service id
|
||||||
|
* to be found among those in the table
|
||||||
|
* const char * UDN ; string representing the UDN
|
||||||
|
* to be found among those in the table
|
||||||
|
*
|
||||||
|
* Description : Traverses through the service table and returns a
|
||||||
|
* pointer to the service node that matches a known service id
|
||||||
|
* and a known UDN
|
||||||
|
*
|
||||||
|
* Return : service_info * - pointer to the matching service_info node;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
service_info *FindServiceId( service_table * table,
|
||||||
|
const char * serviceId, const char * UDN);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : FindServiceEventURLPath
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* service_table *table ; service table
|
||||||
|
* char * eventURLPath ; event URL path used to find a service
|
||||||
|
* from the table
|
||||||
|
*
|
||||||
|
* Description : Traverses the service table and finds the node whose
|
||||||
|
* event URL Path matches a know value
|
||||||
|
*
|
||||||
|
* Return : service_info * - pointer to the service list node from the
|
||||||
|
* service table whose event URL matches a known event URL;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
service_info * FindServiceEventURLPath( service_table *table,
|
||||||
|
char * eventURLPath
|
||||||
|
);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : FindServiceControlURLPath
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* service_table * table ; service table
|
||||||
|
* char * controlURLPath ; control URL path used to find a service
|
||||||
|
* from the table
|
||||||
|
*
|
||||||
|
* Description : Traverses the service table and finds the node whose
|
||||||
|
* control URL Path matches a know value
|
||||||
|
*
|
||||||
|
* Return : service_info * - pointer to the service list node from the
|
||||||
|
* service table whose control URL Path matches a known value;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
service_info * FindServiceControlURLPath( service_table *table,
|
||||||
const char * controlURLPath);
|
const char * controlURLPath);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : printService
|
||||||
* \brief For debugging purposes prints information from the service passed
|
*
|
||||||
* into the function.
|
* Parameters :
|
||||||
*/
|
* service_info *service ;Service whose information is to be printed
|
||||||
|
* Upnp_LogLevel level ; Debug level specified to the print function
|
||||||
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
|
*
|
||||||
|
* Description : For debugging purposes prints information from the
|
||||||
|
* service passed into the function.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void printService(
|
void printService(
|
||||||
/*! [in] Service whose information is to be printed. */
|
|
||||||
service_info *service,
|
service_info *service,
|
||||||
/*! [in] Debug level specified to the print function. */
|
|
||||||
Upnp_LogLevel level,
|
Upnp_LogLevel level,
|
||||||
/*! [in] Debug module specified to the print function. */
|
|
||||||
Dbg_Module module);
|
Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void printService(
|
static UPNP_INLINE void printService(
|
||||||
@@ -234,18 +276,25 @@ static UPNP_INLINE void printService(
|
|||||||
Dbg_Module module) {}
|
Dbg_Module module) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : printServiceList
|
||||||
* \brief For debugging purposes prints information of each service from the
|
*
|
||||||
* service table passed into the function.
|
* Parameters :
|
||||||
*/
|
* service_info *service ; Service whose information is to be printed
|
||||||
|
* Upnp_LogLevel level ; Debug level specified to the print function
|
||||||
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
|
*
|
||||||
|
* Description : For debugging purposes prints information of each
|
||||||
|
* service from the service table passed into the function.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void printServiceList(
|
void printServiceList(
|
||||||
/*! [in] Service whose information is to be printed. */
|
|
||||||
service_info *service,
|
service_info *service,
|
||||||
/*! [in] Debug level specified to the print function. */
|
|
||||||
Upnp_LogLevel level,
|
Upnp_LogLevel level,
|
||||||
/*! [in] Debug module specified to the print function. */
|
|
||||||
Dbg_Module module);
|
Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void printServiceList(
|
static UPNP_INLINE void printServiceList(
|
||||||
@@ -254,18 +303,26 @@ static UPNP_INLINE void printServiceList(
|
|||||||
Dbg_Module module) {}
|
Dbg_Module module) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : printServiceTable
|
||||||
* \brief For debugging purposes prints the URL base of the table and information
|
*
|
||||||
* of each service from the service table passed into the function.
|
* Parameters :
|
||||||
*/
|
* service_table * table ; Service table to be printed
|
||||||
|
* Upnp_LogLevel level ; Debug level specified to the print function
|
||||||
|
* Dbg_Module module ; Debug module specified to the print function
|
||||||
|
*
|
||||||
|
* Description : For debugging purposes prints the URL base of the table
|
||||||
|
* and information of each service from the service table passed into
|
||||||
|
* the function.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void printServiceTable(
|
void printServiceTable(
|
||||||
/*! [in] Service table to be printed. */
|
|
||||||
service_table *table,
|
service_table *table,
|
||||||
/*! [in] Debug level specified to the print function. */
|
|
||||||
Upnp_LogLevel level,
|
Upnp_LogLevel level,
|
||||||
/*! [in] Debug module specified to the print function. */
|
|
||||||
Dbg_Module module);
|
Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void printServiceTable(
|
static UPNP_INLINE void printServiceTable(
|
||||||
@@ -274,105 +331,149 @@ static UPNP_INLINE void printServiceTable(
|
|||||||
Dbg_Module module) {}
|
Dbg_Module module) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : freeService
|
||||||
* \brief Free's memory allocated for the various components of the service
|
|
||||||
* entry in the service table.
|
|
||||||
*/
|
|
||||||
void freeService(
|
|
||||||
/*! [in] Service information that is to be freed. */
|
|
||||||
service_info *in);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Free's memory allocated for the various components of each service
|
|
||||||
* entry in the service table.
|
|
||||||
*/
|
|
||||||
void freeServiceList(
|
|
||||||
/*! [in] Head of the service list to be freed. */
|
|
||||||
service_info *head);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Free's dynamic memory in table (does not free table, only memory
|
|
||||||
* within the structure).
|
|
||||||
*/
|
|
||||||
void freeServiceTable(
|
|
||||||
/*! [in] Service table whose internal memory needs to be freed. */
|
|
||||||
service_table *table);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief This function assumes that services for a particular root device are
|
|
||||||
* placed linearly in the service table, and in the order in which they are
|
|
||||||
* found in the description document all services for this root device are
|
|
||||||
* removed from the list.
|
|
||||||
*
|
*
|
||||||
* \return An integer.
|
* Parameters :
|
||||||
*/
|
* service_info *in ; service information that is to be freed
|
||||||
int removeServiceTable(
|
*
|
||||||
/*! [in] XML node information. */
|
* Description : Free's memory allocated for the various components
|
||||||
IXML_Node *node,
|
* of the service entry in the service table.
|
||||||
/*! [in] Service table from which services will be removed. */
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void freeService(service_info * in);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : freeServiceList
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* service_info * head ; Head of the service list to be freed
|
||||||
|
*
|
||||||
|
* Description : Free's memory allocated for the various components
|
||||||
|
* of each service entry in the service table.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void freeServiceList(service_info * head);
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : freeServiceTable
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* service_table * table ; Service table whose memory needs to be
|
||||||
|
* freed
|
||||||
|
*
|
||||||
|
* Description : Free's dynamic memory in table.
|
||||||
|
* (does not free table, only memory within the structure)
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void freeServiceTable(service_table * table);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : removeServiceTable
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* IXML_Node *node ; XML node information
|
||||||
|
* service_table *in ; service table from which services will be
|
||||||
|
* removed
|
||||||
|
*
|
||||||
|
* Description : This function assumes that services for a particular
|
||||||
|
* root device are placed linearly in the service table, and in the
|
||||||
|
* order in which they are found in the description document
|
||||||
|
* all services for this root device are removed from the list
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int removeServiceTable(IXML_Node *node,
|
||||||
service_table *in);
|
service_table *in);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Add Service to the table.
|
* Function : addServiceTable
|
||||||
*/
|
|
||||||
int addServiceTable(
|
|
||||||
/*! [in] XML node information. */
|
|
||||||
IXML_Node *node,
|
|
||||||
/*! [in] Service table that will be initialized with services. */
|
|
||||||
service_table *in,
|
|
||||||
/*! [in] Default base URL on which the URL will be returned to the
|
|
||||||
* service list. */
|
|
||||||
const char *DefaultURLBase);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Retrieve service from the table.
|
|
||||||
*
|
*
|
||||||
* \return An integer
|
* Parameters :
|
||||||
*/
|
* IXML_Node *node ; XML node information
|
||||||
int getServiceTable(
|
* service_table *in ; service table that will be initialized with
|
||||||
/*! [in] XML node information. */
|
* services
|
||||||
IXML_Node *node,
|
* const char *DefaultURLBase ; Default base URL on which the URL
|
||||||
/*! [in] Output parameter which will contain the service list and URL. */
|
* will be returned to the service list.
|
||||||
service_table *out,
|
*
|
||||||
/*! [in] Default base URL on which the URL will be returned. */
|
* Description : Add Service to the table.
|
||||||
const char *DefaultURLBase);
|
*
|
||||||
|
* Return : int ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int addServiceTable(IXML_Node *node, service_table *in, const char *DefaultURLBase);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : getServiceTable
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* IXML_Node *node ; XML node information
|
||||||
|
* service_table *out ; output parameter which will contain the
|
||||||
|
* service list and URL
|
||||||
|
* const char *DefaultURLBase ; Default base URL on which the URL
|
||||||
|
* will be returned.
|
||||||
|
*
|
||||||
|
* Description : Retrieve service from the table
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int getServiceTable(IXML_Node *node, service_table * out, const char * DefaultURLBase);
|
||||||
|
|
||||||
|
|
||||||
/* Misc helper functions */
|
/* Misc helper functions */
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Returns the clone of the element value.
|
* Function : getElementValue
|
||||||
*
|
*
|
||||||
* \note Value must be freed with DOMString_free.
|
* Parameters :
|
||||||
|
* IXML_Node *node ; Input node which provides the list of child
|
||||||
|
* nodes
|
||||||
*
|
*
|
||||||
* \return DOMString
|
* Description : Returns the clone of the element value
|
||||||
*/
|
*
|
||||||
DOMString getElementValue(
|
* Return : DOMString ;
|
||||||
/*! [in] Input node which provides the list of child nodes. */
|
*
|
||||||
IXML_Node *node);
|
* Note : value must be freed with DOMString_free
|
||||||
|
************************************************************************/
|
||||||
|
DOMString getElementValue(IXML_Node *node);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : getSubElement
|
||||||
* \brief Traverses through a list of XML nodes to find the node with the
|
|
||||||
* known element name.
|
|
||||||
*
|
*
|
||||||
* \return
|
* Parameters :
|
||||||
* \li 1 - On Success
|
* const char *element_name ; sub element name to be searched for
|
||||||
* \li 0 - On Failure
|
* IXML_Node *node ; Input node which provides the list of child
|
||||||
*/
|
* nodes
|
||||||
int getSubElement(
|
* IXML_Node **out ; Ouput node to which the matched child node is
|
||||||
/*! [in] Sub element name to be searched for. */
|
* returned.
|
||||||
const char *element_name,
|
*
|
||||||
/*! [in] Input node which provides the list of child nodes. */
|
* Description : Traverses through a list of XML nodes to find the
|
||||||
IXML_Node *node,
|
* node with the known element name.
|
||||||
/*! [out] Ouput node to which the matched child node is returned. */
|
*
|
||||||
|
* Return : int ;
|
||||||
|
* 1 - On Success
|
||||||
|
* 0 - On Failure
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int getSubElement(const char *element_name, IXML_Node *node,
|
||||||
IXML_Node **out);
|
IXML_Node **out);
|
||||||
|
|
||||||
|
|
||||||
@@ -382,5 +483,5 @@ int getSubElement(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* SERVICE_TABLE */
|
#endif /* _SERVICE_TABLE */
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +1,44 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef GENLIB_NET_SOCK_H
|
#ifndef GENLIB_NET_SOCK_H
|
||||||
#define GENLIB_NET_SOCK_H
|
#define GENLIB_NET_SOCK_H
|
||||||
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
#ifdef WIN32
|
|
||||||
/* Do not #include <netinet/in.h> */
|
|
||||||
#else
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Following variable is not defined under winsock.h
|
||||||
/* Following variable is not defined under winsock.h */
|
|
||||||
#ifndef SD_RECEIVE
|
#ifndef SD_RECEIVE
|
||||||
#define SD_RECEIVE 0x00
|
#define SD_RECEIVE 0x00
|
||||||
#define SD_SEND 0x01
|
#define SD_SEND 0x01
|
||||||
@@ -54,25 +48,24 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/* handle/descriptor to a socket */
|
int socket; // handle/descriptor to a socket
|
||||||
SOCKET socket;
|
|
||||||
|
// the following two fields are filled only in incoming requests;
|
||||||
|
struct in_addr foreign_ip_addr;
|
||||||
|
unsigned short foreign_ip_port;
|
||||||
|
|
||||||
/* the following two fields are filled only in incoming requests; */
|
|
||||||
struct sockaddr_storage foreign_sockaddr;
|
|
||||||
} SOCKINFO;
|
} SOCKINFO;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#extern "C" {
|
#extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : sock_init
|
* Function : sock_init
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* OUT SOCKINFO* info ; Socket Information Object
|
* OUT SOCKINFO* info ; Socket Information Object
|
||||||
* IN SOCKET sockfd ; Socket Descriptor
|
* IN int sockfd ; Socket Descriptor
|
||||||
*
|
*
|
||||||
* Description : Assign the passed in socket descriptor to socket
|
* Description : Assign the passed in socket descriptor to socket
|
||||||
* descriptor in the SOCKINFO structure.
|
* descriptor in the SOCKINFO structure.
|
||||||
@@ -83,15 +76,16 @@ typedef struct
|
|||||||
* UPNP_E_SOCKET_ERROR
|
* UPNP_E_SOCKET_ERROR
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int sock_init(OUT SOCKINFO* info, IN SOCKET sockfd);
|
int sock_init( OUT SOCKINFO* info, IN int sockfd );
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : sock_init_with_ip
|
* Function : sock_init_with_ip
|
||||||
*
|
*
|
||||||
* Parameters :
|
* Parameters :
|
||||||
* OUT SOCKINFO* info ; Socket Information Object
|
* OUT SOCKINFO* info ; Socket Information Object
|
||||||
* IN SOCKET sockfd ; Socket Descriptor
|
* IN int sockfd ; Socket Descriptor
|
||||||
* IN struct sockaddr* foreign_sockaddr; Remote socket address
|
* IN struct in_addr foreign_ip_addr ; Remote IP Address
|
||||||
|
* IN unsigned short foreign_ip_port ; Remote Port number
|
||||||
*
|
*
|
||||||
* Description : Calls the sock_init function and assigns the passed in
|
* Description : Calls the sock_init function and assigns the passed in
|
||||||
* IP address and port to the IP address and port in the SOCKINFO
|
* IP address and port to the IP address and port in the SOCKINFO
|
||||||
@@ -104,10 +98,8 @@ int sock_init(OUT SOCKINFO* info, IN SOCKET sockfd);
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int sock_init_with_ip(
|
int sock_init_with_ip( OUT SOCKINFO* info, IN int sockfd,
|
||||||
OUT SOCKINFO* info,
|
IN struct in_addr foreign_ip_addr, IN unsigned short foreign_ip_port );
|
||||||
IN SOCKET sockfd,
|
|
||||||
IN struct sockaddr *foreign_sockaddr);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : sock_read
|
* Function : sock_read
|
||||||
@@ -172,11 +164,9 @@ int sock_write( IN SOCKINFO *info, IN char* buffer, IN size_t bufsize,
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
int sock_destroy( INOUT SOCKINFO* info,int );
|
int sock_destroy( INOUT SOCKINFO* info,int );
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* #extern "C" */
|
} // #extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* GENLIB_NET_SOCK_H */
|
#endif // GENLIB_NET_SOCK_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +1,59 @@
|
|||||||
/**************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
**************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef SSDPLIB_H
|
#ifndef SSDPLIB_H
|
||||||
#define SSDPLIB_H
|
#define SSDPLIB_H
|
||||||
|
|
||||||
#include "httpparser.h"
|
|
||||||
#include "httpreadwrite.h"
|
|
||||||
#include "miniserver.h"
|
|
||||||
#include "UpnpInet.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include "httpparser.h"
|
||||||
|
#include "httpreadwrite.h"
|
||||||
#ifdef WIN32
|
#include "miniserver.h"
|
||||||
#else
|
#ifndef WIN32
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <netinet/in_systm.h>
|
#include <netinet/in_systm.h>
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/ip_icmp.h>
|
#include <netinet/ip_icmp.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#else
|
||||||
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//Enumeration to define all different types of ssdp searches
|
||||||
/* Enumeration to define all different types of ssdp searches */
|
|
||||||
typedef enum SsdpSearchType{
|
typedef enum SsdpSearchType{
|
||||||
SSDP_SERROR=-1,
|
SSDP_SERROR=-1,
|
||||||
SSDP_ALL,SSDP_ROOTDEVICE,
|
SSDP_ALL,SSDP_ROOTDEVICE,
|
||||||
@@ -68,9 +63,8 @@ typedef enum SsdpSearchType{
|
|||||||
} SType;
|
} SType;
|
||||||
|
|
||||||
|
|
||||||
/* Enumeration to define all different type of ssdp messages */
|
//Enumeration to define all different type of ssdp messages
|
||||||
typedef enum SsdpCmdType{
|
typedef enum SsdpCmdType{SSDP_ERROR=-1,
|
||||||
SSDP_ERROR=-1,
|
|
||||||
SSDP_OK,
|
SSDP_OK,
|
||||||
SSDP_ALIVE,
|
SSDP_ALIVE,
|
||||||
SSDP_BYEBYE,
|
SSDP_BYEBYE,
|
||||||
@@ -81,19 +75,16 @@ typedef enum SsdpCmdType{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Constant */
|
//Constant
|
||||||
#define BUFSIZE 2500
|
#define BUFSIZE 2500
|
||||||
#define SSDP_IP "239.255.255.250"
|
#define SSDP_IP "239.255.255.250"
|
||||||
#define SSDP_IPV6_LINKLOCAL "FF02::C"
|
|
||||||
#define SSDP_IPV6_SITELOCAL "FF05::C"
|
|
||||||
#define SSDP_PORT 1900
|
#define SSDP_PORT 1900
|
||||||
#define NUM_TRY 3
|
#define NUM_TRY 3
|
||||||
#define NUM_COPY 1
|
#define NUM_COPY 1
|
||||||
#define THREAD_LIMIT 50
|
#define THREAD_LIMIT 50
|
||||||
#define COMMAND_LEN 300
|
#define COMMAND_LEN 300
|
||||||
|
|
||||||
/* can be overwritten by configure CFLAGS argument */
|
#ifndef X_USER_AGENT // can be overwritten by configure CFLAGS argument
|
||||||
#ifndef X_USER_AGENT
|
|
||||||
/** @name X_USER_AGENT
|
/** @name X_USER_AGENT
|
||||||
* The {\tt X_USER_AGENT} constant specifies the value of the X-User-Agent:
|
* The {\tt X_USER_AGENT} constant specifies the value of the X-User-Agent:
|
||||||
* HTTP header. The value "redsonic" is needed for the DSM-320. See
|
* HTTP header. The value "redsonic" is needed for the DSM-320. See
|
||||||
@@ -103,7 +94,7 @@ typedef enum SsdpCmdType{
|
|||||||
#define X_USER_AGENT "redsonic"
|
#define X_USER_AGENT "redsonic"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Error code */
|
//Error code
|
||||||
#define NO_ERROR_FOUND 0
|
#define NO_ERROR_FOUND 0
|
||||||
#define E_REQUEST_INVALID -3
|
#define E_REQUEST_INVALID -3
|
||||||
#define E_RES_EXPIRED -4
|
#define E_RES_EXPIRED -4
|
||||||
@@ -114,7 +105,7 @@ typedef enum SsdpCmdType{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Structure to store the SSDP information */
|
//Structure to store the SSDP information
|
||||||
typedef struct SsdpEventStruct
|
typedef struct SsdpEventStruct
|
||||||
{
|
{
|
||||||
enum SsdpCmdType Cmd;
|
enum SsdpCmdType Cmd;
|
||||||
@@ -130,7 +121,7 @@ typedef struct SsdpEventStruct
|
|||||||
char Os[LINE_SIZE];
|
char Os[LINE_SIZE];
|
||||||
char Ext[LINE_SIZE];
|
char Ext[LINE_SIZE];
|
||||||
char Date[LINE_SIZE];
|
char Date[LINE_SIZE];
|
||||||
struct sockaddr *DestAddr;
|
struct sockaddr_in * DestAddr;
|
||||||
void * Cookie;
|
void * Cookie;
|
||||||
} Event;
|
} Event;
|
||||||
|
|
||||||
@@ -152,7 +143,7 @@ typedef struct TData
|
|||||||
int Mx;
|
int Mx;
|
||||||
void * Cookie;
|
void * Cookie;
|
||||||
char * Data;
|
char * Data;
|
||||||
struct sockaddr_storage DestAddr;
|
struct sockaddr_in DestAddr;
|
||||||
|
|
||||||
}ThreadData;
|
}ThreadData;
|
||||||
|
|
||||||
@@ -160,7 +151,7 @@ typedef struct ssdpsearchreply
|
|||||||
{
|
{
|
||||||
int MaxAge;
|
int MaxAge;
|
||||||
UpnpDevice_Handle handle;
|
UpnpDevice_Handle handle;
|
||||||
struct sockaddr_storage dest_addr;
|
struct sockaddr_in dest_addr;
|
||||||
SsdpEvent event;
|
SsdpEvent event;
|
||||||
|
|
||||||
}SsdpSearchReply;
|
}SsdpSearchReply;
|
||||||
@@ -177,18 +168,21 @@ typedef struct ssdpsearcharg
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
http_parser_t parser;
|
http_parser_t parser;
|
||||||
struct sockaddr_storage dest_addr;
|
struct sockaddr_in dest_addr;
|
||||||
} ssdp_thread_data;
|
} ssdp_thread_data;
|
||||||
|
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
|
|
||||||
CLIENTONLY(extern SOCKET gSsdpReqSocket4;);
|
CLIENTONLY(extern SOCKET gSsdpReqSocket;);
|
||||||
CLIENTONLY(extern SOCKET gSsdpReqSocket6;);
|
|
||||||
|
|
||||||
typedef int (*ParserFun)(char *, Event *);
|
typedef int (*ParserFun)(char *, Event *);
|
||||||
|
|
||||||
|
|
||||||
|
//void InitParser();
|
||||||
|
|
||||||
|
//int AnalyzeCommand(char * szCommand, Event * Evt);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : Make_Socket_NoBlocking
|
* Function : Make_Socket_NoBlocking
|
||||||
*
|
*
|
||||||
@@ -220,11 +214,11 @@ int Make_Socket_NoBlocking (int sock);
|
|||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
void ssdp_handle_device_request(
|
void ssdp_handle_device_request(
|
||||||
IN http_message_t* hmsg,
|
IN http_message_t* hmsg,
|
||||||
IN struct sockaddr* dest_addr );
|
IN struct sockaddr_in* dest_addr );
|
||||||
#else
|
#else
|
||||||
static inline void ssdp_handle_device_request(
|
static inline void ssdp_handle_device_request(
|
||||||
IN http_message_t* hmsg,
|
IN http_message_t* hmsg,
|
||||||
IN struct sockaddr* dest_addr ) {}
|
IN struct sockaddr_in* dest_addr ) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -232,7 +226,7 @@ static inline void ssdp_handle_device_request(
|
|||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN http_message_t* hmsg: SSDP message from the device
|
* IN http_message_t* hmsg: SSDP message from the device
|
||||||
* IN struct sockaddr* dest_addr: Address of the device
|
* IN struct sockaddr_in* dest_addr: Address of the device
|
||||||
* IN xboolean timeout: timeout kept by the control point while sending
|
* IN xboolean timeout: timeout kept by the control point while sending
|
||||||
* search message
|
* search message
|
||||||
* IN void* cookie: Cookie stored by the control point application.
|
* IN void* cookie: Cookie stored by the control point application.
|
||||||
@@ -249,7 +243,7 @@ static inline void ssdp_handle_device_request(
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ssdp_handle_ctrlpt_msg(
|
void ssdp_handle_ctrlpt_msg(
|
||||||
IN http_message_t* hmsg,
|
IN http_message_t* hmsg,
|
||||||
IN struct sockaddr* dest_addr,
|
IN struct sockaddr_in* dest_addr,
|
||||||
IN xboolean timeout,
|
IN xboolean timeout,
|
||||||
IN void* cookie );
|
IN void* cookie );
|
||||||
|
|
||||||
@@ -362,7 +356,6 @@ int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
|||||||
* IN char *Udn :
|
* IN char *Udn :
|
||||||
* IN char *Location: Location URL.
|
* IN char *Location: Location URL.
|
||||||
* IN int Duration : Service duration in sec.
|
* IN int Duration : Service duration in sec.
|
||||||
* IN int AddressFamily: Device address family.
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the device advertisement request based on
|
* This function creates the device advertisement request based on
|
||||||
@@ -376,8 +369,7 @@ int DeviceAdvertisement(
|
|||||||
IN int RootDev,
|
IN int RootDev,
|
||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
IN char *Location,
|
IN char *Location,
|
||||||
IN int Duration,
|
IN int Duration);
|
||||||
IN int AddressFamily);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -390,7 +382,6 @@ int DeviceAdvertisement(
|
|||||||
* IN char *_Server:
|
* IN char *_Server:
|
||||||
* IN char *Location: Location URL
|
* IN char *Location: Location URL
|
||||||
* IN int Duration :Device duration in sec.
|
* IN int Duration :Device duration in sec.
|
||||||
* IN int AddressFamily: Device address family.
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates a HTTP device shutdown request packet
|
* This function creates a HTTP device shutdown request packet
|
||||||
@@ -405,14 +396,13 @@ int DeviceShutdown(
|
|||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
IN char *_Server,
|
IN char *_Server,
|
||||||
IN char *Location,
|
IN char *Location,
|
||||||
IN int Duration,
|
IN int Duration);
|
||||||
IN int AddressFamily);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceReply
|
* Function : DeviceReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr *DestAddr: destination IP address.
|
* IN struct sockaddr_in * DestAddr:destination IP address.
|
||||||
* IN char *DevType: Device type
|
* IN char *DevType: Device type
|
||||||
* IN int RootDev: 1 means root device 0 means embedded device.
|
* IN int RootDev: 1 means root device 0 means embedded device.
|
||||||
* IN char *Udn: Device UDN
|
* IN char *Udn: Device UDN
|
||||||
@@ -427,18 +417,17 @@ int DeviceShutdown(
|
|||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceReply(
|
int DeviceReply(
|
||||||
IN struct sockaddr *DestAddr,
|
IN struct sockaddr_in * DestAddr,
|
||||||
IN char *DevType,
|
IN char *DevType,
|
||||||
IN int RootDev,
|
IN int RootDev,
|
||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
IN char *Location,
|
IN char *Location, IN int Duration);
|
||||||
IN int Duration);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SendReply
|
* Function : SendReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr *DestAddr: destination IP address.
|
* IN struct sockaddr_in * DestAddr:destination IP address.
|
||||||
* IN char *DevType: Device type
|
* IN char *DevType: Device type
|
||||||
* IN int RootDev: 1 means root device 0 means embedded device.
|
* IN int RootDev: 1 means root device 0 means embedded device.
|
||||||
* IN char * Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
@@ -455,7 +444,7 @@ int DeviceReply(
|
|||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int SendReply(
|
int SendReply(
|
||||||
IN struct sockaddr *DestAddr,
|
IN struct sockaddr_in * DestAddr,
|
||||||
IN char *DevType,
|
IN char *DevType,
|
||||||
IN int RootDev,
|
IN int RootDev,
|
||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
@@ -471,7 +460,6 @@ int SendReply(
|
|||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
* IN int AddressFamily: Device address family
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the advertisement packet based
|
* This function creates the advertisement packet based
|
||||||
@@ -484,14 +472,13 @@ int ServiceAdvertisement(
|
|||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
IN char *ServType,
|
IN char *ServType,
|
||||||
IN char *Location,
|
IN char *Location,
|
||||||
IN int Duration,
|
IN int Duration);
|
||||||
IN int AddressFamily);
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceReply
|
* Function : ServiceReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr *DestAddr:
|
* IN struct sockaddr_in *DestAddr:
|
||||||
* IN char *Udn: Device UDN
|
* IN char *Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char *Server: Not used
|
* IN char *Server: Not used
|
||||||
@@ -506,7 +493,7 @@ int ServiceAdvertisement(
|
|||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceReply(
|
int ServiceReply(
|
||||||
IN struct sockaddr *DestAddr,
|
IN struct sockaddr_in *DestAddr,
|
||||||
IN char *ServType,
|
IN char *ServType,
|
||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
IN char *Location,
|
IN char *Location,
|
||||||
@@ -520,7 +507,6 @@ int ServiceReply(
|
|||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char *Location: Location of Device description document.
|
* IN char *Location: Location of Device description document.
|
||||||
* IN int Duration :Service duration in sec.
|
* IN int Duration :Service duration in sec.
|
||||||
* IN int AddressFamily: Device address family
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates a HTTP service shutdown request packet
|
* This function creates a HTTP service shutdown request packet
|
||||||
@@ -533,8 +519,7 @@ int ServiceShutdown(
|
|||||||
IN char *Udn,
|
IN char *Udn,
|
||||||
IN char *ServType,
|
IN char *ServType,
|
||||||
IN char *Location,
|
IN char *Location,
|
||||||
IN int Duration,
|
IN int Duration);
|
||||||
IN int AddressFamily);
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -561,7 +546,7 @@ void *advertiseAndReplyThread(IN void * data);
|
|||||||
* 1 = Send Advertisement
|
* 1 = Send Advertisement
|
||||||
* IN UpnpDevice_Handle Hnd: Device handle
|
* IN UpnpDevice_Handle Hnd: Device handle
|
||||||
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
||||||
* IN struct sockaddr *DestAddr:Destination address
|
* IN struct sockaddr_in *DestAddr:Destination address
|
||||||
* IN char *DeviceType:Device type
|
* IN char *DeviceType:Device type
|
||||||
* IN char *DeviceUDN:Device UDN
|
* IN char *DeviceUDN:Device UDN
|
||||||
* IN char *ServiceType:Service type
|
* IN char *ServiceType:Service type
|
||||||
@@ -577,10 +562,10 @@ int AdvertiseAndReply(
|
|||||||
IN int AdFlag,
|
IN int AdFlag,
|
||||||
IN UpnpDevice_Handle Hnd,
|
IN UpnpDevice_Handle Hnd,
|
||||||
IN enum SsdpSearchType SearchType,
|
IN enum SsdpSearchType SearchType,
|
||||||
IN struct sockaddr *DestAddr,
|
IN struct sockaddr_in *DestAddr,
|
||||||
IN char *DeviceType,
|
IN char *DeviceType,
|
||||||
IN char *DeviceUDN,
|
IN char *DeviceUDN,
|
||||||
IN char *ServiceType, int Exp);
|
IN char *ServiceType, int Exp);
|
||||||
|
|
||||||
#endif /* SSDPLIB_H */
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,90 +1,65 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
||||||
* Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
|
** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
|
||||||
* Digital Equipment Corporation, Maynard, Mass.
|
** Digital Equipment Corporation, Maynard, Mass.
|
||||||
* Copyright (c) 1998 Microsoft.
|
** Copyright (c) 1998 Microsoft.
|
||||||
* To anyone who acknowledges that this file is provided "AS IS"
|
** To anyone who acknowledges that this file is provided "AS IS"
|
||||||
* without any express or implied warranty: permission to use, copy,
|
** without any express or implied warranty: permission to use, copy,
|
||||||
* modify, and distribute this file for any purpose is hereby
|
** modify, and distribute this file for any purpose is hereby
|
||||||
* granted without fee, provided that the above copyright notices and
|
** granted without fee, provided that the above copyright notices and
|
||||||
* this notice appears in all source code copies, and that none of
|
** this notice appears in all source code copies, and that none of
|
||||||
* the names of Open Software Foundation, Inc., Hewlett-Packard
|
** the names of Open Software Foundation, Inc., Hewlett-Packard
|
||||||
* Company, or Digital Equipment Corporation be used in advertising
|
** Company, or Digital Equipment Corporation be used in advertising
|
||||||
* or publicity pertaining to distribution of the software without
|
** or publicity pertaining to distribution of the software without
|
||||||
* specific, written prior permission. Neither Open Software
|
** specific, written prior permission. Neither Open Software
|
||||||
* Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
|
** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
|
||||||
* Corporation makes any representations about the suitability of
|
** Corporation makes any representations about the suitability of
|
||||||
* this software for any purpose.
|
** this software for any purpose.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
#ifndef SYSDEP_H
|
#ifndef WIN32
|
||||||
#define SYSDEP_H
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
//#include <sys/sysinfo.h>
|
||||||
#include "ithread.h"
|
#include "ithread.h"
|
||||||
|
|
||||||
|
|
||||||
/* change to point to where MD5 .h's live */
|
/* change to point to where MD5 .h's live */
|
||||||
/* get MD5 sample implementation from RFC 1321 */
|
/* get MD5 sample implementation from RFC 1321 */
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "md5.h"
|
#include "md5.h"
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
/* Do not #include <sys/time.h> */
|
|
||||||
#else
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* set the following to the number of 100ns ticks of the actual
|
/* set the following to the number of 100ns ticks of the actual
|
||||||
resolution of
|
resolution of
|
||||||
your system's clock */
|
your system's clock */
|
||||||
#define UUIDS_PER_TICK 1024
|
#define UUIDS_PER_TICK 1024
|
||||||
|
|
||||||
|
|
||||||
/* Set the following to a call to acquire a system wide global lock
|
/* Set the following to a call to acquire a system wide global lock
|
||||||
*/
|
*/
|
||||||
extern ithread_mutex_t gUUIDMutex;
|
extern ithread_mutex_t gUUIDMutex;
|
||||||
|
|
||||||
|
|
||||||
#define UUIDLock() ithread_mutex_lock(&gUUIDMutex)
|
#define UUIDLock() ithread_mutex_lock(&gUUIDMutex)
|
||||||
#define UUIDUnlock() ithread_mutex_unlock(&gUUIDMutex)
|
#define UUIDUnlock() ithread_mutex_unlock(&gUUIDMutex)
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned long unsigned32;
|
typedef unsigned long unsigned32;
|
||||||
typedef unsigned short unsigned16;
|
typedef unsigned short unsigned16;
|
||||||
typedef unsigned char unsigned8;
|
typedef unsigned char unsigned8;
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
|
|
||||||
/* Set this to what your compiler uses for 64 bit data type */
|
/* Set this to what your compiler uses for 64 bit data type */
|
||||||
#ifdef WIN32
|
#ifndef WIN32
|
||||||
#define unsigned64_t __int64
|
|
||||||
#else
|
|
||||||
#define unsigned64_t unsigned long long
|
#define unsigned64_t unsigned long long
|
||||||
|
#else
|
||||||
|
#define unsigned64_t __int64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define I64(C) C##LL
|
#define I64(C) C##LL
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned64_t uuid_time_t;
|
typedef unsigned64_t uuid_time_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char nodeID[6];
|
char nodeID[6];
|
||||||
} uuid_node_t;
|
} uuid_node_t;
|
||||||
|
|
||||||
|
|
||||||
void get_ieee_node_identifier(uuid_node_t *node);
|
void get_ieee_node_identifier(uuid_node_t *node);
|
||||||
void get_system_time(uuid_time_t *uuid_time);
|
void get_system_time(uuid_time_t *uuid_time);
|
||||||
void get_random_info(unsigned char seed[16]);
|
void get_random_info(char seed[16]);
|
||||||
|
|
||||||
|
|
||||||
#endif /* SYSDEP_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +1,46 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/* Unix-specific network utilities */
|
|
||||||
|
|
||||||
|
// Unix-specific network utilities
|
||||||
|
|
||||||
#ifndef GENLIB_NET_UNIXUTIL_H
|
#ifndef GENLIB_NET_UNIXUTIL_H
|
||||||
#define GENLIB_NET_UNIXUTIL_H
|
#define GENLIB_NET_UNIXUTIL_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
#include "UpnpInet.h"
|
#ifndef WIN32
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#else
|
||||||
#ifdef WIN32
|
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#define EAFNOSUPPORT 97
|
#define EAFNOSUPPORT 97
|
||||||
#else
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // GENLIB_NET_UNIXUTIL_H
|
||||||
#endif /* GENLIB_NET_UNIXUTIL_H */
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,45 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* * Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// File : upnpapi.h
|
||||||
|
|
||||||
#ifndef UPNPAPI_H
|
#ifndef UPNPDK_H
|
||||||
#define UPNPAPI_H
|
#define UPNPDK_H
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "client_table.h"
|
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "VirtualDir.h" /* for struct VirtualDirCallbacks */
|
#include "client_table.h"
|
||||||
|
|
||||||
|
//#include "../ssdp/ssdplib.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_INTERFACES 256
|
#define MAX_INTERFACES 256
|
||||||
@@ -50,6 +48,8 @@
|
|||||||
|
|
||||||
#define DEV_LIMIT 200
|
#define DEV_LIMIT 200
|
||||||
|
|
||||||
|
#define NUM_HANDLE 200
|
||||||
|
|
||||||
#define DEFAULT_MX 5
|
#define DEFAULT_MX 5
|
||||||
|
|
||||||
#define DEFAULT_MAXAGE 1800
|
#define DEFAULT_MAXAGE 1800
|
||||||
@@ -59,145 +59,80 @@
|
|||||||
|
|
||||||
extern size_t g_maxContentLength;
|
extern size_t g_maxContentLength;
|
||||||
|
|
||||||
/* 30-second timeout */
|
// 30-second timeout
|
||||||
#define UPNP_TIMEOUT 30
|
#define UPNP_TIMEOUT 30
|
||||||
|
|
||||||
typedef enum {HND_INVALID=-1,HND_CLIENT,HND_DEVICE} Upnp_Handle_Type;
|
typedef enum {HND_INVALID=-1,HND_CLIENT,HND_DEVICE} Upnp_Handle_Type;
|
||||||
|
|
||||||
/* Data to be stored in handle table for */
|
// Data to be stored in handle table for
|
||||||
struct Handle_Info
|
struct Handle_Info
|
||||||
{
|
{
|
||||||
/*! . */
|
|
||||||
Upnp_Handle_Type HType;
|
Upnp_Handle_Type HType;
|
||||||
/*! Callback function pointer. */
|
Upnp_FunPtr Callback; // Callback function pointer.
|
||||||
Upnp_FunPtr Callback;
|
|
||||||
/*! . */
|
|
||||||
char * Cookie;
|
char * Cookie;
|
||||||
/*! 0 = not installed; otherwise installed. */
|
|
||||||
int aliasInstalled;
|
|
||||||
|
|
||||||
/* Device Only */
|
// Device Only
|
||||||
#ifdef INCLUDE_DEVICE_APIS
|
#ifdef INCLUDE_DEVICE_APIS
|
||||||
/*! URL for the use of SSDP. */
|
char DescURL[LINE_SIZE]; // URL for the use of SSDP
|
||||||
char DescURL[LINE_SIZE];
|
char DescXML[LINE_SIZE]; // XML file path for device
|
||||||
/*! XML file path for device description. */
|
//description
|
||||||
char DescXML[LINE_SIZE];
|
|
||||||
/* Advertisement timeout */
|
int MaxAge; // Advertisement timeout
|
||||||
int MaxAge;
|
IXML_Document *DescDocument;// Description parsed in
|
||||||
/*! Description parsed in terms of DOM document. */
|
//terms of DOM document
|
||||||
IXML_Document *DescDocument;
|
IXML_NodeList *DeviceList; // List of devices in the
|
||||||
/*! List of devices in the description document. */
|
//description document
|
||||||
IXML_NodeList *DeviceList;
|
IXML_NodeList *ServiceList; // List of services in the
|
||||||
/*! List of services in the description document. */
|
// description document
|
||||||
IXML_NodeList *ServiceList;
|
service_table ServiceTable; //table holding subscriptions and
|
||||||
/*! Table holding subscriptions and URL information. */
|
//URL information
|
||||||
service_table ServiceTable;
|
|
||||||
/*! . */
|
|
||||||
int MaxSubscriptions;
|
int MaxSubscriptions;
|
||||||
/*! . */
|
|
||||||
int MaxSubscriptionTimeOut;
|
int MaxSubscriptionTimeOut;
|
||||||
/*! Address family: AF_INET or AF_INET6. */
|
|
||||||
int DeviceAf;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Client only */
|
// Client only
|
||||||
#ifdef INCLUDE_CLIENT_APIS
|
#ifdef INCLUDE_CLIENT_APIS
|
||||||
/*! Client subscription list. */
|
client_subscription *ClientSubList; //client subscription list
|
||||||
ClientSubscription *ClientSubList;
|
LinkedList SsdpSearchList; // active ssdp searches
|
||||||
/*! Active SSDP searches. */
|
|
||||||
LinkedList SsdpSearchList;
|
|
||||||
#endif
|
#endif
|
||||||
|
int aliasInstalled; // 0 = not installed; otherwise installed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern ithread_rwlock_t GlobalHndRWLock;
|
extern ithread_rwlock_t GlobalHndRWLock;
|
||||||
|
Upnp_Handle_Type GetHandleInfo(int Hnd, struct Handle_Info **HndInfo);
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Get handle information.
|
|
||||||
*
|
|
||||||
* \return HND_DEVICE, UPNP_E_INVALID_HANDLE
|
|
||||||
*/
|
|
||||||
Upnp_Handle_Type GetHandleInfo(
|
|
||||||
/*! handle pointer (key for the client handle structure). */
|
|
||||||
int Hnd,
|
|
||||||
/*! handle structure passed by this function. */
|
|
||||||
struct Handle_Info **HndInfo);
|
|
||||||
|
|
||||||
|
|
||||||
#define HandleLock() HandleWriteLock()
|
#define HandleLock() HandleWriteLock()
|
||||||
|
|
||||||
|
|
||||||
#define HandleWriteLock() \
|
#define HandleWriteLock() \
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock"); \
|
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a write lock"); \
|
||||||
ithread_rwlock_wrlock(&GlobalHndRWLock); \
|
ithread_rwlock_wrlock(&GlobalHndRWLock); \
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired");
|
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Write lock acquired");
|
||||||
|
|
||||||
|
|
||||||
#define HandleReadLock() \
|
#define HandleReadLock() \
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock"); \
|
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Trying a read lock"); \
|
||||||
ithread_rwlock_rdlock(&GlobalHndRWLock); \
|
ithread_rwlock_rdlock(&GlobalHndRWLock); \
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired");
|
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Read lock acquired");
|
||||||
|
|
||||||
|
|
||||||
#define HandleUnlock() \
|
#define HandleUnlock() \
|
||||||
UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock"); \
|
UpnpPrintf(UPNP_INFO, API,__FILE__, __LINE__, "Trying Unlock"); \
|
||||||
ithread_rwlock_unlock(&GlobalHndRWLock); \
|
ithread_rwlock_unlock(&GlobalHndRWLock); \
|
||||||
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock");
|
UpnpPrintf(UPNP_INFO, API, __FILE__, __LINE__, "Unlocked rwlock");
|
||||||
|
|
||||||
|
Upnp_Handle_Type GetClientHandleInfo(int *client_handle_out,
|
||||||
/*!
|
|
||||||
* \brief Get client handle info.
|
|
||||||
*
|
|
||||||
* \note The logic around the use of this function should be revised.
|
|
||||||
*
|
|
||||||
* \return HND_CLIENT, HND_INVALID
|
|
||||||
*/
|
|
||||||
Upnp_Handle_Type GetClientHandleInfo(
|
|
||||||
/*! [in] client handle pointer (key for the client handle structure). */
|
|
||||||
int *client_handle_out,
|
|
||||||
/*! [out] Client handle structure passed by this function. */
|
|
||||||
struct Handle_Info **HndInfo);
|
struct Handle_Info **HndInfo);
|
||||||
/*!
|
Upnp_Handle_Type GetDeviceHandleInfo(int *device_handle_out,
|
||||||
* \brief Retrieves the device handle and information of the first device of
|
|
||||||
* the address family spcified.
|
|
||||||
*
|
|
||||||
* \return HND_DEVICE or HND_INVALID
|
|
||||||
*/
|
|
||||||
Upnp_Handle_Type GetDeviceHandleInfo(
|
|
||||||
/*! [in] Address family. */
|
|
||||||
const int AddressFamily,
|
|
||||||
/*! [out] Device handle pointer. */
|
|
||||||
int *device_handle_out,
|
|
||||||
/*! [out] Device handle structure passed by this function. */
|
|
||||||
struct Handle_Info **HndInfo);
|
struct Handle_Info **HndInfo);
|
||||||
|
|
||||||
|
|
||||||
extern char gIF_NAME[LINE_SIZE];
|
extern char LOCAL_HOST[LINE_SIZE];
|
||||||
/*! INET_ADDRSTRLEN. */
|
|
||||||
extern char gIF_IPV4[22];
|
|
||||||
/*! INET6_ADDRSTRLEN. */
|
|
||||||
extern char gIF_IPV6[65];
|
|
||||||
|
|
||||||
extern char gIF_IPV6_ULA_GUA[INET6_ADDRSTRLEN];
|
|
||||||
|
|
||||||
extern int gIF_INDEX;
|
|
||||||
|
|
||||||
|
|
||||||
extern unsigned short LOCAL_PORT_V4;
|
|
||||||
extern unsigned short LOCAL_PORT_V6;
|
|
||||||
|
|
||||||
|
|
||||||
/*! NLS uuid. */
|
|
||||||
extern Upnp_SID gUpnpSdkNLSuuid;
|
|
||||||
|
|
||||||
|
extern unsigned short LOCAL_PORT;
|
||||||
|
|
||||||
extern TimerThread gTimerThread;
|
extern TimerThread gTimerThread;
|
||||||
extern ThreadPool gRecvThreadPool;
|
extern ThreadPool gRecvThreadPool;
|
||||||
extern ThreadPool gSendThreadPool;
|
extern ThreadPool gSendThreadPool;
|
||||||
extern ThreadPool gMiniServerThreadPool;
|
extern ThreadPool gMiniServerThreadPool;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SUBSCRIBE,
|
SUBSCRIBE,
|
||||||
UNSUBSCRIBE,
|
UNSUBSCRIBE,
|
||||||
@@ -208,9 +143,7 @@ typedef enum {
|
|||||||
DEVDESCRIPTION,
|
DEVDESCRIPTION,
|
||||||
SERVDESCRIPTION,
|
SERVDESCRIPTION,
|
||||||
MINI,
|
MINI,
|
||||||
RENEW
|
RENEW} UpnpFunName;
|
||||||
} UpnpFunName;
|
|
||||||
|
|
||||||
|
|
||||||
struct UpnpNonblockParam
|
struct UpnpNonblockParam
|
||||||
{
|
{
|
||||||
@@ -234,81 +167,26 @@ struct UpnpNonblockParam
|
|||||||
|
|
||||||
|
|
||||||
extern virtualDirList *pVirtualDirList;
|
extern virtualDirList *pVirtualDirList;
|
||||||
extern struct VirtualDirCallbacks virtualDirCallback;
|
extern struct UpnpVirtualDirCallbacks virtualDirCallback;
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum { WEB_SERVER_DISABLED, WEB_SERVER_ENABLED } WebServerState;
|
||||||
WEB_SERVER_DISABLED,
|
|
||||||
WEB_SERVER_ENABLED
|
|
||||||
} WebServerState;
|
|
||||||
|
|
||||||
|
|
||||||
#define E_HTTP_SYNTAX -6
|
#define E_HTTP_SYNTAX -6
|
||||||
|
|
||||||
|
void InitHandleList();
|
||||||
/*!
|
int GetFreeHandle();
|
||||||
* \brief Retrieve interface information and keep it in global variables.
|
int FreeHandle(int Handle);
|
||||||
* If NULL, we'll find the first suitable interface for operation.
|
|
||||||
*
|
|
||||||
* The interface must fulfill these requirements:
|
|
||||||
* \li Be UP.
|
|
||||||
* \li Not be LOOPBACK.
|
|
||||||
* \li Support MULTICAST.
|
|
||||||
* \li Have a valid IPv4 or IPv6 address.
|
|
||||||
*
|
|
||||||
* We'll retrieve the following information from the interface:
|
|
||||||
* \li gIF_NAME -> Interface name (by input or found).
|
|
||||||
* \li gIF_IPV4 -> IPv4 address (if any).
|
|
||||||
* \li gIF_IPV6 -> IPv6 address (if any).
|
|
||||||
* \li gIF_IPV6_ULA_GUA -> ULA or GUA IPv6 address (if any)
|
|
||||||
* \li gIF_INDEX -> Interface index number.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS on success.
|
|
||||||
*/
|
|
||||||
int UpnpGetIfInfo(
|
|
||||||
/*! [in] Interface name (can be NULL). */
|
|
||||||
const char *IfName);
|
|
||||||
|
|
||||||
|
|
||||||
void UpnpThreadDistribution(struct UpnpNonblockParam * Param);
|
void UpnpThreadDistribution(struct UpnpNonblockParam * Param);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
void AutoAdvertise(void *input);
|
||||||
* \brief This function is a timer thread scheduled by UpnpSendAdvertisement
|
int getlocalhostname(char *out);
|
||||||
* to the send advetisement again.
|
|
||||||
*/
|
|
||||||
void AutoAdvertise(
|
|
||||||
/*! [in] Information provided to the thread. */
|
|
||||||
void *input);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Get local IP address.
|
|
||||||
*
|
|
||||||
* Gets the ip address for the DEFAULT_INTERFACE interface which is up and not
|
|
||||||
* a loopback. Assumes at most MAX_INTERFACES interfaces
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful or UPNP_E_INIT.
|
|
||||||
*/
|
|
||||||
int getlocalhostname(
|
|
||||||
/*! [out] IP address of the interface. */
|
|
||||||
char *out,
|
|
||||||
/*! [in] Length of the output buffer. */
|
|
||||||
const int out_len);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Print handle info.
|
|
||||||
*
|
|
||||||
* \return UPNP_E_SUCCESS if successful, otherwise returns appropriate error.
|
|
||||||
*/
|
|
||||||
int PrintHandleInfo(
|
|
||||||
/*! [in] Handle index. */
|
|
||||||
UpnpClient_Handle Hnd);
|
|
||||||
|
|
||||||
|
|
||||||
extern WebServerState bWebServerState;
|
extern WebServerState bWebServerState;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* UPNPAPI_H */
|
|
||||||
|
|
||||||
|
|
||||||
|
/************************ END OF upnpapi.h **********************/
|
||||||
|
|||||||
@@ -1,82 +1,65 @@
|
|||||||
/*******************************************************************************
|
///////////////////////////////////////////////////////////////////////////
|
||||||
*
|
//
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
// Copyright (c) 2000-2003 Intel Corporation
|
||||||
* All rights reserved.
|
// All rights reserved.
|
||||||
*
|
//
|
||||||
* Redistribution and use in source and binary forms, with or without
|
// Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
// modification, are permitted provided that the following conditions are met:
|
||||||
*
|
//
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
// and/or other materials provided with the distribution.
|
||||||
* - Neither name of Intel Corporation nor the names of its contributors
|
// * Neither name of Intel Corporation nor the names of its contributors
|
||||||
* may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
// without specific prior written permission.
|
||||||
*
|
//
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
//
|
||||||
******************************************************************************/
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef GENLIB_NET_URI_H
|
#ifndef GENLIB_NET_URI_H
|
||||||
#define GENLIB_NET_URI_H
|
#define GENLIB_NET_URI_H
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \file
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "UpnpGlobal.h" /* for */
|
|
||||||
#include "UpnpInet.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#if defined(BSD)
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#else
|
|
||||||
#include <arpa/inet.h> /* for inet_pton() */
|
|
||||||
#include <netdb.h> /* for struct addrinfo */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define strncasecmp strnicmp
|
|
||||||
#else
|
|
||||||
/* Other systems have strncasecmp */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
//#include <malloc.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifndef WIN32
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#else
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define strncasecmp strnicmp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "upnp.h"
|
||||||
|
//#include <upnp_debug.h>
|
||||||
|
|
||||||
|
|
||||||
#define HTTP_DATE_LENGTH 37 // length for HTTP DATE:
|
#define HTTP_DATE_LENGTH 37 // length for HTTP DATE:
|
||||||
//"DATE: Sun, 01 Jul 2000 08:15:23 GMT<cr><lf>"
|
//"DATE: Sun, 01 Jul 2000 08:15:23 GMT<cr><lf>"
|
||||||
@@ -85,66 +68,37 @@ extern "C" {
|
|||||||
#define RESERVED ";/?:@&=+$,{}" //added {} for compatibility
|
#define RESERVED ";/?:@&=+$,{}" //added {} for compatibility
|
||||||
#define HTTP_SUCCESS 1
|
#define HTTP_SUCCESS 1
|
||||||
|
|
||||||
|
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#define TAB 9
|
#define TAB 9
|
||||||
#define CR 13
|
#define CR 13
|
||||||
#define LF 10
|
#define LF 10
|
||||||
#define SOCKET_BUFFER_SIZE 5000
|
#define SOCKET_BUFFER_SIZE 5000
|
||||||
|
|
||||||
|
enum hostType { HOSTNAME, IPv4address };
|
||||||
enum hostType {
|
enum pathType { ABS_PATH, REL_PATH, OPAQUE_PART };
|
||||||
HOSTNAME,
|
#ifndef WIN32
|
||||||
IPv4address
|
// there is a conflict in windows with other symbols
|
||||||
};
|
enum uriType { ABSOLUTE, RELATIVE };
|
||||||
|
|
||||||
|
|
||||||
enum pathType {
|
|
||||||
ABS_PATH,
|
|
||||||
REL_PATH,
|
|
||||||
OPAQUE_PART
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
/* there is a conflict in windows with other symbols */
|
|
||||||
enum uriType {
|
|
||||||
absolute,
|
|
||||||
relative
|
|
||||||
};
|
|
||||||
#else
|
#else
|
||||||
enum uriType {
|
enum uriType { absolute, relative };
|
||||||
ABSOLUTE,
|
|
||||||
RELATIVE
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Buffer used in parsinghttp messages, urls, etc. generally this simply
|
||||||
/*!
|
* holds a pointer into a larger array */
|
||||||
* \brief Buffer used in parsinghttp messages, urls, etc. generally this simply
|
|
||||||
* holds a pointer into a larger array.
|
|
||||||
*/
|
|
||||||
typedef struct TOKEN {
|
typedef struct TOKEN {
|
||||||
const char *buff;
|
const char *buff;
|
||||||
size_t size;
|
size_t size;
|
||||||
} token;
|
} token;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/* Represents a host port:e.g. :"127.127.0.1:80"
|
||||||
* \brief Represents a host port: e.g. "127.127.0.1:80" text is a token
|
* text is a token pointing to the full string representation */
|
||||||
* pointing to the full string representation.
|
|
||||||
*/
|
|
||||||
typedef struct HOSTPORT {
|
typedef struct HOSTPORT {
|
||||||
/*! Full host port. */
|
token text; //full host port
|
||||||
token text;
|
struct sockaddr_in IPv4address; //Network Byte Order
|
||||||
/* Network Byte Order */
|
|
||||||
struct sockaddr_storage IPaddress;
|
|
||||||
} hostport_type;
|
} hostport_type;
|
||||||
|
|
||||||
|
/* Represents a URI used in parse_uri and elsewhere */
|
||||||
/*!
|
|
||||||
* \brief Represents a URI used in parse_uri and elsewhere
|
|
||||||
*/
|
|
||||||
typedef struct URI{
|
typedef struct URI{
|
||||||
enum uriType type;
|
enum uriType type;
|
||||||
token scheme;
|
token scheme;
|
||||||
@@ -154,181 +108,240 @@ typedef struct URI{
|
|||||||
hostport_type hostport;
|
hostport_type hostport;
|
||||||
} uri_type;
|
} uri_type;
|
||||||
|
|
||||||
|
/* Represents a list of URLs as in the "callback" header of SUBSCRIBE
|
||||||
/*!
|
* message in GENA
|
||||||
* \brief Represents a list of URLs as in the "callback" header of SUBSCRIBE
|
* char * URLs holds dynamic memory */
|
||||||
* message in GENA. "char *" URLs holds dynamic memory.
|
|
||||||
*/
|
|
||||||
typedef struct URL_LIST {
|
typedef struct URL_LIST {
|
||||||
/*! */
|
|
||||||
int size;
|
int size;
|
||||||
/*! All the urls, delimited by <> */
|
char * URLs; //all the urls, delimited by <>
|
||||||
char *URLs;
|
|
||||||
/*! */
|
|
||||||
uri_type *parsedURLs;
|
uri_type *parsedURLs;
|
||||||
} URL_list;
|
} URL_list;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Replaces an escaped sequence with its unescaped version as in
|
* Function : replace_escaped
|
||||||
* http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs)
|
|
||||||
*
|
*
|
||||||
|
* Parameters :
|
||||||
|
* char * in ; string of characters
|
||||||
|
* int index ; index at which to start checking the characters
|
||||||
|
* size_t *max ;
|
||||||
|
*
|
||||||
|
* Description : Replaces an escaped sequence with its unescaped version
|
||||||
|
* as in http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs)
|
||||||
* Size of array is NOT checked (MUST be checked by caller)
|
* Size of array is NOT checked (MUST be checked by caller)
|
||||||
*
|
*
|
||||||
* \note This function modifies the string. If the sequence is an escaped
|
* Return : int ;
|
||||||
* sequence it is replaced, the other characters in the string are shifted
|
|
||||||
* over, and NULL characters are placed at the end of the string.
|
|
||||||
*
|
*
|
||||||
* \return
|
* Note : This function modifies the string. If the sequence is an
|
||||||
*/
|
* escaped sequence it is replaced, the other characters in the
|
||||||
int replace_escaped(
|
* string are shifted over, and NULL characters are placed at the
|
||||||
/*! [in] String of characters. */
|
* end of the string.
|
||||||
char *in,
|
************************************************************************/
|
||||||
/*! [in] Index at which to start checking the characters. */
|
int replace_escaped(char * in, int index, size_t *max);
|
||||||
int index,
|
|
||||||
/*! [out] . */
|
|
||||||
size_t *max);
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : copy_URL_list
|
||||||
* \brief Copies one URL_list into another.
|
|
||||||
*
|
*
|
||||||
* This includes dynamically allocating the out->URLs field (the full string),
|
* Parameters :
|
||||||
* and the structures used to hold the parsedURLs. This memory MUST be freed
|
* URL_list *in ; Source URL list
|
||||||
* by the caller through: free_URL_list(&out).
|
* URL_list *out ; Destination URL list
|
||||||
*
|
*
|
||||||
* \return
|
* Description : Copies one URL_list into another. This includes
|
||||||
* \li HTTP_SUCCESS - On Success.
|
* dynamically allocating the out->URLs field (the full string),
|
||||||
* \li UPNP_E_OUTOF_MEMORY - On Failure to allocate memory.
|
* and the structures used to hold the parsedURLs. This memory MUST
|
||||||
*/
|
* be freed by the caller through: free_URL_list(&out)
|
||||||
int copy_URL_list(
|
|
||||||
/*! [in] Source URL list. */
|
|
||||||
URL_list *in,
|
|
||||||
/*! [out] Destination URL list. */
|
|
||||||
URL_list *out);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Frees the memory associated with a URL_list.
|
|
||||||
*
|
*
|
||||||
* Frees the dynamically allocated members of of list. Does NOT free the
|
* Return : int ;
|
||||||
* pointer to the list itself ( i.e. does NOT free(list)).
|
* HTTP_SUCCESS - On Success
|
||||||
*/
|
* UPNP_E_OUTOF_MEMORY - On Failure to allocate memory
|
||||||
void free_URL_list(
|
*
|
||||||
/*! [in] URL list object. */
|
* Note :
|
||||||
URL_list *list);
|
************************************************************************/
|
||||||
|
int copy_URL_list( URL_list *in, URL_list *out);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : free_URL_list
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* URL_list * list ; URL List object
|
||||||
|
*
|
||||||
|
* Description : Frees the memory associated with a URL_list. Frees the
|
||||||
|
* dynamically allocated members of of list. Does NOT free the
|
||||||
|
* pointer to the list itself ( i.e. does NOT free(list))
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
void free_URL_list(URL_list * list);
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Function useful in debugging for printing a parsed uri.
|
* Function : print_uri
|
||||||
*/
|
*
|
||||||
|
* Parameters :
|
||||||
|
* uri_type *in ; URI object
|
||||||
|
*
|
||||||
|
* Description : Function useful in debugging for printing a parsed uri.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_uri(
|
void print_uri(uri_type *in);
|
||||||
/*! [in] URI object to print. */
|
|
||||||
uri_type *in);
|
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void print_uri(uri_type *in) {}
|
static UPNP_INLINE void print_uri(uri_type *in) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : print_token
|
||||||
* \brief Function useful in debugging for printing a token.
|
*
|
||||||
*/
|
* Parameters :
|
||||||
|
* token * in ;
|
||||||
|
*
|
||||||
|
* Description : Function useful in debugging for printing a token.
|
||||||
|
*
|
||||||
|
* Return : void ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_token(
|
void print_token(token *in);
|
||||||
/*! [in] Token object to print. */
|
|
||||||
token *in);
|
|
||||||
#else
|
#else
|
||||||
static UPNP_INLINE void print_token(token * in) {}
|
static UPNP_INLINE void print_token(token * in) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : token_string_casecmp
|
||||||
* \brief Compares buffer in the token object with the buffer in in2.
|
|
||||||
*
|
*
|
||||||
* \return
|
* Parameters :
|
||||||
* \li < 0, if string1 is less than string2.
|
* token * in1 ; Token object whose buffer is to be compared
|
||||||
* \li == 0, if string1 is identical to string2 .
|
* char * in2 ; string of characters to compare with
|
||||||
* \li > 0, if string1 is greater than string2.
|
|
||||||
*/
|
|
||||||
int token_string_casecmp(
|
|
||||||
/*! [in] Token object whose buffer is to be compared. */
|
|
||||||
token *in1,
|
|
||||||
/*! [in] String of characters to compare with. */
|
|
||||||
char *in2);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Compares a null terminated string to a token (exact).
|
|
||||||
*
|
*
|
||||||
* \return
|
* Description : Compares buffer in the token object with the buffer
|
||||||
* \li < 0, if string1 is less than string2.
|
* in in2
|
||||||
* \li == 0, if string1 is identical to string2 .
|
|
||||||
* \li > 0, if string1 is greater than string2.
|
|
||||||
*/
|
|
||||||
int token_string_cmp(
|
|
||||||
/*! [in] Token object whose buffer is to be compared. */
|
|
||||||
token *in1,
|
|
||||||
/*! [in] String of characters to compare with. */
|
|
||||||
char *in2);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Compares two tokens.
|
|
||||||
*
|
*
|
||||||
* \return
|
* Return : int ;
|
||||||
* \li < 0, if string1 is less than string2.
|
* < 0 string1 less than string2
|
||||||
* \li == 0, if string1 is identical to string2 .
|
* 0 string1 identical to string2
|
||||||
* \li > 0, if string1 is greater than string2.
|
* > 0 string1 greater than string2
|
||||||
*/
|
|
||||||
int token_cmp(
|
|
||||||
/*! [in] First token object whose buffer is to be compared. */
|
|
||||||
token *in1,
|
|
||||||
/*! [in] Second token object used for the comparison. */
|
|
||||||
token *in2);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Parses a string representing a host and port (e.g. "127.127.0.1:80"
|
|
||||||
* or "localhost") and fills out a hostport_type struct with internet address
|
|
||||||
* and a token representing the full host and port.
|
|
||||||
*
|
*
|
||||||
* Uses gethostbyname.
|
* Note :
|
||||||
*/
|
************************************************************************/
|
||||||
int parse_hostport(
|
int token_string_casecmp( token * in1, char * in2);
|
||||||
/*! [in] String of characters representing host and port. */
|
|
||||||
const char *in,
|
|
||||||
/*! [in] Sets a maximum limit. */
|
|
||||||
int max,
|
|
||||||
/*! [out] Output parameter where the host and port are represented as
|
|
||||||
* an internet address. */
|
|
||||||
hostport_type *out);
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : token_string_cmp
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* token * in1 ; Token object whose buffer is to be compared
|
||||||
|
* char * in2 ; string of characters to compare with
|
||||||
|
*
|
||||||
|
* Description : Compares a null terminated string to a token (exact)
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
* < 0 string1 less than string2
|
||||||
|
* 0 string1 identical to string2
|
||||||
|
* > 0 string1 greater than string2
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int token_string_cmp( token * in1, char * in2);
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Removes http escaped characters such as: "%20" and replaces them with
|
* Function : token_cmp
|
||||||
* their character representation. i.e. "hello%20foo" -> "hello foo".
|
|
||||||
*
|
*
|
||||||
* The input IS MODIFIED in place (shortened). Extra characters are replaced
|
* Parameters :
|
||||||
* with \b NULL.
|
* token *in1 ; First token object whose buffer is to be compared
|
||||||
|
* token *in2 ; Second token object used for the comparison
|
||||||
*
|
*
|
||||||
* \return UPNP_E_SUCCESS.
|
* Description : Compares two tokens
|
||||||
*/
|
*
|
||||||
int remove_escaped_chars(
|
* Return : int ;
|
||||||
/*! [in,out] String of characters to be modified. */
|
* < 0 string1 less than string2
|
||||||
char *in,
|
* 0 string1 identical to string2
|
||||||
/*! [in,out] Size limit for the number of characters. */
|
* > 0 string1 greater than string2
|
||||||
size_t *size);
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int token_cmp( token *in1, token *in2);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : parse_port
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* int max ; sets a maximum limit
|
||||||
|
* char * port ; port to be parsed.
|
||||||
|
* unsigned short * out ; out parameter where the port is parsed
|
||||||
|
* and converted into network format
|
||||||
|
*
|
||||||
|
* Description : parses a port (i.e. '4000') and converts it into a
|
||||||
|
* network ordered unsigned short int.
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int parse_port(int max, const char *port, unsigned short int *out);
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief Removes ".", and ".." from a path.
|
* Function : parse_hostport
|
||||||
*
|
*
|
||||||
* If a ".." can not be resolved (i.e. the .. would go past the root of the
|
* Parameters :
|
||||||
* path) an error is returned.
|
* char *in ; string of characters representing host and port
|
||||||
|
* int max ; sets a maximum limit
|
||||||
|
* hostport_type *out ; out parameter where the host and port
|
||||||
|
* are represented as an internet address
|
||||||
*
|
*
|
||||||
* The input IS modified in place.)
|
* Description : Parses a string representing a host and port
|
||||||
|
* (e.g. "127.127.0.1:80" or "localhost") and fills out a
|
||||||
|
* hostport_type struct with internet address and a token
|
||||||
|
* representing the full host and port. uses gethostbyname.
|
||||||
*
|
*
|
||||||
* \note Examples
|
* Return : int ;
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int parse_hostport(const char *in, int max, hostport_type *out );
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : remove_escaped_chars
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* INOUT char *in ; string of characters to be modified
|
||||||
|
* INOUT size_t *size ; size limit for the number of characters
|
||||||
|
*
|
||||||
|
* Description : removes http escaped characters such as: "%20" and
|
||||||
|
* replaces them with their character representation. i.e.
|
||||||
|
* "hello%20foo" -> "hello foo". The input IS MODIFIED in place.
|
||||||
|
* (shortened). Extra characters are replaced with NULL.
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
* UPNP_E_SUCCESS
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int remove_escaped_chars(char *in, size_t *size);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : remove_dots
|
||||||
|
*
|
||||||
|
* Parameters :
|
||||||
|
* char *in ; string of characters from which "dots" have to be
|
||||||
|
* removed
|
||||||
|
* int size ; size limit for the number of characters
|
||||||
|
*
|
||||||
|
* Description : Removes ".", and ".." from a path. If a ".." can not
|
||||||
|
* be resolved (i.e. the .. would go past the root of the path) an
|
||||||
|
* error is returned. The input IS modified in place.)
|
||||||
|
*
|
||||||
|
* Return : int ;
|
||||||
|
* UPNP_E_SUCCESS - On Success
|
||||||
|
* UPNP_E_OUTOF_MEMORY - On failure to allocate memory
|
||||||
|
* UPNP_E_INVALID_URL - Failure to resolve URL
|
||||||
|
*
|
||||||
|
* Note :
|
||||||
|
* Examples
|
||||||
* char path[30]="/../hello";
|
* char path[30]="/../hello";
|
||||||
* remove_dots(path, strlen(path)) -> UPNP_E_INVALID_URL
|
* remove_dots(path, strlen(path)) -> UPNP_E_INVALID_URL
|
||||||
* char path[30]="/./hello";
|
* char path[30]="/./hello";
|
||||||
@@ -336,253 +349,177 @@ int remove_escaped_chars(
|
|||||||
* in = "/hello"
|
* in = "/hello"
|
||||||
* char path[30]="/./hello/foo/../goodbye" ->
|
* char path[30]="/./hello/foo/../goodbye" ->
|
||||||
* UPNP_E_SUCCESS, in = "/hello/goodbye"
|
* UPNP_E_SUCCESS, in = "/hello/goodbye"
|
||||||
*
|
|
||||||
* \return
|
|
||||||
* \li UPNP_E_SUCCESS - On Success.
|
|
||||||
* \li UPNP_E_OUTOF_MEMORY - On failure to allocate memory.
|
|
||||||
* \li UPNP_E_INVALID_URL - Failure to resolve URL.
|
|
||||||
*/
|
|
||||||
int remove_dots(
|
|
||||||
/*! [in] String of characters from which "dots" have to be removed. */
|
|
||||||
char *in,
|
|
||||||
/*! [in] Size limit for the number of characters. */
|
|
||||||
size_t size);
|
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
|
int remove_dots(char * in, int size);
|
||||||
|
|
||||||
/*!
|
/************************************************************************
|
||||||
* \brief resolves a relative url with a base url returning a NEW (dynamically
|
* Function : resolve_rel_url
|
||||||
* allocated with malloc) full url.
|
|
||||||
*
|
*
|
||||||
* If the base_url is \b NULL, then a copy of the rel_url is passed back if
|
* Parameters :
|
||||||
* the rel_url is absolute then a copy of the rel_url is passed back if neither
|
* char * base_url ; Base URL
|
||||||
* the base nor the rel_url are Absolute then NULL is returned. Otherwise it
|
* char * rel_url ; Relative URL
|
||||||
* tries and resolves the relative url with the base as described in
|
|
||||||
* http://www.ietf.org/rfc/rfc2396.txt (RFCs explaining URIs).
|
|
||||||
*
|
*
|
||||||
* The resolution of '..' is NOT implemented, but '.' is resolved.
|
* Description : resolves a relative url with a base url returning a NEW
|
||||||
|
* (dynamically allocated with malloc) full url. If the base_url is
|
||||||
|
* NULL, then a copy of the rel_url is passed back if the rel_url
|
||||||
|
* is absolute then a copy of the rel_url is passed back if neither
|
||||||
|
* the base nor the rel_url are Absolute then NULL is returned.
|
||||||
|
* otherwise it tries and resolves the relative url with the base
|
||||||
|
* as described in: http://www.ietf.org/rfc/rfc2396.txt (RFCs
|
||||||
|
* explaining URIs)
|
||||||
|
* : resolution of '..' is NOT implemented, but '.' is resolved
|
||||||
*
|
*
|
||||||
* \return
|
* Return : char * ;
|
||||||
*/
|
*
|
||||||
char *resolve_rel_url(
|
* Note :
|
||||||
/*! [in] Base URL. */
|
************************************************************************/
|
||||||
char *base_url,
|
char * resolve_rel_url( char * base_url, char * rel_url);
|
||||||
/*! [in] Relative URL. */
|
|
||||||
char *rel_url);
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
/*!
|
* Function : parse_uri
|
||||||
* \brief Parses a uri as defined in http://www.ietf.org/rfc/rfc2396.txt
|
|
||||||
* (RFC explaining URIs).
|
|
||||||
*
|
*
|
||||||
* Handles absolute, relative, and opaque uris. Parses into the following
|
* Parameters :
|
||||||
* pieces: scheme, hostport, pathquery, fragment (path and query are treated
|
* char * in ; character string containing uri information to be
|
||||||
* as one token)
|
* parsed
|
||||||
|
* int max ; maximum limit on the number of characters
|
||||||
|
* uri_type * out ; out parameter which will have the parsed uri
|
||||||
|
* information
|
||||||
*
|
*
|
||||||
|
* Description : parses a uri as defined in http://www.ietf.org/rfc/
|
||||||
|
* rfc2396.txt (RFC explaining URIs)
|
||||||
|
* Handles absolute, relative, and opaque uris. Parses into the
|
||||||
|
* following pieces: scheme, hostport, pathquery, fragment (path and
|
||||||
|
* query are treated as one token)
|
||||||
* Caller should check for the pieces they require.
|
* Caller should check for the pieces they require.
|
||||||
*
|
*
|
||||||
* \return
|
* Return : int ;
|
||||||
*/
|
|
||||||
int parse_uri(
|
|
||||||
/*! [in] Character string containing uri information to be parsed. */
|
|
||||||
const char *in,
|
|
||||||
/*! [in] Maximum limit on the number of characters. */
|
|
||||||
int max,
|
|
||||||
/*! [out] Output parameter which will have the parsed uri information. */
|
|
||||||
uri_type *out);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Same as parse_uri(), except that all strings are unescaped
|
|
||||||
* (%XX replaced by chars).
|
|
||||||
*
|
*
|
||||||
* \note This modifies 'pathquery' and 'fragment' parts of the input.
|
* Note :
|
||||||
|
************************************************************************/
|
||||||
|
int parse_uri(const char * in, int max, uri_type * out);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Function : parse_uri_and_unescape
|
||||||
*
|
*
|
||||||
* \return
|
* Parameters :
|
||||||
*/
|
* char * in ;
|
||||||
int parse_uri_and_unescape(
|
* int max ;
|
||||||
/*! [in] Character string containing uri information to be parsed. */
|
* uri_type * out ;
|
||||||
char *in,
|
|
||||||
/*! [in] Maximum limit on the number of characters. */
|
|
||||||
int max,
|
|
||||||
/*! [out] Output parameter which will have the parsed uri information. */
|
|
||||||
uri_type *out);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief
|
|
||||||
*
|
*
|
||||||
* \return
|
* Description : Same as parse_uri, except that all strings are
|
||||||
*/
|
* unescaped (%XX replaced by chars)
|
||||||
int parse_token(
|
*
|
||||||
/*! [in] . */
|
* Return : int ;
|
||||||
char *in,
|
*
|
||||||
/*! [out] . */
|
* Note: This modifies 'pathquery' and 'fragment' parts of the input
|
||||||
token *out,
|
************************************************************************/
|
||||||
/*! [in] . */
|
int parse_uri_and_unescape(char * in, int max, uri_type * out);
|
||||||
int max_size);
|
|
||||||
|
int parse_token( char * in, token * out, int max_size);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* commented #defines, functions and typdefs *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Commented #defines *
|
||||||
|
************************************************************************/
|
||||||
|
//#define HTTP_E_BAD_URL UPNP_E_INVALID_URL
|
||||||
|
//#define HTTP_E_READ_SOCKET UPNP_E_SOCKET_READ
|
||||||
|
//#define HTTP_E_BIND_SOCKET UPNP_E_SOCKET_BIND
|
||||||
|
//#define HTTP_E_WRITE_SOCKET UPNP_E_SOCKET_WRITE
|
||||||
|
//#define HTTP_E_CONNECT_SOCKET UPNP_E_SOCKET_CONNECT
|
||||||
|
//#define HTTP_E_SOCKET UPNP_E_OUTOF_SOCKET
|
||||||
|
//#define HTTP_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
||||||
|
//#define HTTP_E_BAD_REQUEST UPNP_E_BAD_REQUEST
|
||||||
|
//#define HTTP_E_BAD_IP_ADDRESS UPNP_E_INVALID_URL
|
||||||
|
|
||||||
|
//#define RESPONSE_TIMEOUT 30
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Commented typedefs *
|
||||||
|
************************************************************************/
|
||||||
|
//Buffer used to store data read from a socket during an http transfer
|
||||||
|
//in function read_bytes.
|
||||||
|
//typedef struct SOCKET_BUFFER{
|
||||||
|
// char buff[SOCKET_BUFFER_SIZE];
|
||||||
|
// int size;
|
||||||
|
// struct SOCKET_BUFFER *next;
|
||||||
|
//} socket_buffer;
|
||||||
|
|
||||||
|
//typedef struct HTTP_HEADER {
|
||||||
|
// token header;
|
||||||
|
// token value;
|
||||||
|
// struct HTTP_HEADER * next;
|
||||||
|
//} http_header;
|
||||||
|
|
||||||
|
//typedef struct HTTP_STATUS_LINE{
|
||||||
|
// token http_version;
|
||||||
|
// token status_code;
|
||||||
|
// token reason_phrase;
|
||||||
|
//} http_status;
|
||||||
|
|
||||||
|
//typedef struct HTTP_REQUEST_LINE {
|
||||||
|
// token http_version;
|
||||||
|
// uri_type request_uri;
|
||||||
|
// token method;
|
||||||
|
//} http_request;
|
||||||
|
|
||||||
|
//Represents a parsed HTTP_MESSAGE head_list is dynamically allocated
|
||||||
|
//typedef struct HTTP_MESSAGE {
|
||||||
|
// http_status status;
|
||||||
|
// http_request request;
|
||||||
|
// http_header * header_list;
|
||||||
|
// token content;
|
||||||
|
//} http_message;
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Commented functions *
|
||||||
|
************************************************************************
|
||||||
|
|
||||||
|
EXTERN_C int transferHTTP( char * request, char * toSend,
|
||||||
|
int toSendSize, char **out, char * Url);
|
||||||
|
|
||||||
|
|
||||||
/* Commented #defines, functions and typdefs */
|
EXTERN_C int transferHTTPRaw( char * toSend, int toSendSize,
|
||||||
|
char **out, char *URL);
|
||||||
|
|
||||||
#if 0
|
helper function
|
||||||
#define HTTP_E_BAD_URL UPNP_E_INVALID_URL
|
EXTERN_C int transferHTTPparsedURL( char * request,
|
||||||
#define HTTP_E_READ_SOCKET UPNP_E_SOCKET_READ
|
char * toSend, int toSendSize,
|
||||||
#define HTTP_E_BIND_SOCKET UPNP_E_SOCKET_BIND
|
char **out, uri_type *URL);
|
||||||
#define HTTP_E_WRITE_SOCKET UPNP_E_SOCKET_WRITE
|
|
||||||
#define HTTP_E_CONNECT_SOCKET UPNP_E_SOCKET_CONNECT
|
|
||||||
#define HTTP_E_SOCKET UPNP_E_OUTOF_SOCKET
|
|
||||||
#define HTTP_E_BAD_RESPONSE UPNP_E_BAD_RESPONSE
|
|
||||||
#define HTTP_E_BAD_REQUEST UPNP_E_BAD_REQUEST
|
|
||||||
#define HTTP_E_BAD_IP_ADDRESS UPNP_E_INVALID_URL
|
|
||||||
|
|
||||||
#define RESPONSE_TIMEOUT 30
|
assumes that char * out has enough space ( 38 characters)
|
||||||
#endif
|
outputs the current time in the following null terminated string:
|
||||||
|
"DATE: Sun, Jul 06 2000 08:53:01 GMT\r\n"
|
||||||
|
EXTERN_C void currentTmToHttpDate(char *out);
|
||||||
|
|
||||||
#if 0
|
EXTERN_C int parse_http_response( char * in, http_message * out,
|
||||||
/*!
|
|
||||||
* Buffer used to store data read from a socket during an http transfer in
|
|
||||||
* function read_bytes.
|
|
||||||
*/
|
|
||||||
typedef struct SOCKET_BUFFER{
|
|
||||||
char buff[SOCKET_BUFFER_SIZE];
|
|
||||||
int size;
|
|
||||||
struct SOCKET_BUFFER *next;
|
|
||||||
} socket_buffer;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct HTTP_HEADER {
|
|
||||||
token header;
|
|
||||||
token value;
|
|
||||||
struct HTTP_HEADER * next;
|
|
||||||
} http_header;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct HTTP_STATUS_LINE{
|
|
||||||
token http_version;
|
|
||||||
token status_code;
|
|
||||||
token reason_phrase;
|
|
||||||
} http_status;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct HTTP_REQUEST_LINE {
|
|
||||||
token http_version;
|
|
||||||
uri_type request_uri;
|
|
||||||
token method;
|
|
||||||
} http_request;
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Represents a parsed HTTP_MESSAGE head_list is dynamically allocated
|
|
||||||
*/
|
|
||||||
typedef struct HTTP_MESSAGE {
|
|
||||||
http_status status;
|
|
||||||
http_request request;
|
|
||||||
http_header * header_list;
|
|
||||||
token content;
|
|
||||||
} http_message;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
int transferHTTP(
|
|
||||||
char *request,
|
|
||||||
char *toSend,
|
|
||||||
int toSendSize,
|
|
||||||
char **out,
|
|
||||||
char *Url);
|
|
||||||
|
|
||||||
|
|
||||||
int transferHTTPRaw(
|
|
||||||
char *toSend,
|
|
||||||
int toSendSize,
|
|
||||||
char **out,
|
|
||||||
char *URL);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief helper function.
|
|
||||||
*/
|
|
||||||
int transferHTTPparsedURL(
|
|
||||||
char *request,
|
|
||||||
char *toSend,
|
|
||||||
int toSendSize,
|
|
||||||
char **out,
|
|
||||||
uri_type *URL);
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief assumes that char * out has enough space ( 38 characters)
|
|
||||||
* outputs the current time in the following null terminated string:
|
|
||||||
* "DATE: Sun, Jul 06 2000 08:53:01 GMT\r\n"
|
|
||||||
*/
|
|
||||||
void currentTmToHttpDate(
|
|
||||||
char *out);
|
|
||||||
|
|
||||||
|
|
||||||
int parse_http_response(
|
|
||||||
char *in,
|
|
||||||
http_message *out,
|
|
||||||
int max_len);
|
int max_len);
|
||||||
|
|
||||||
|
EXTERN_C int parse_http_request( char * in, http_message *out,
|
||||||
int parse_http_request(
|
|
||||||
char *in,
|
|
||||||
http_message *out,
|
|
||||||
int max_len);
|
int max_len);
|
||||||
|
|
||||||
|
EXTERN_C void print_http_message( http_message * message);
|
||||||
|
EXTERN_C int search_for_header( http_message * in,
|
||||||
|
char * header, token *out_value);
|
||||||
|
|
||||||
void print_http_message(
|
EXTERN_C void print_status_line(http_status *in);
|
||||||
http_message *message);
|
EXTERN_C void print_request_line(http_request *in);
|
||||||
|
EXTERN_C int parse_http_line( char * in, int max_size);
|
||||||
|
EXTERN_C int parse_not_LWS( char *in, token *out, int max_size);
|
||||||
|
EXTERN_C int parse_LWS( char * in, int max_size);
|
||||||
|
|
||||||
|
EXTERN_C size_t write_bytes(int fd, char * bytes, size_t n,
|
||||||
int search_for_header(
|
|
||||||
http_message *in,
|
|
||||||
char *header,
|
|
||||||
token *out_value);
|
|
||||||
|
|
||||||
|
|
||||||
void print_status_line(
|
|
||||||
http_status *in);
|
|
||||||
|
|
||||||
|
|
||||||
void print_request_line(
|
|
||||||
http_request *in);
|
|
||||||
|
|
||||||
|
|
||||||
int parse_http_line(
|
|
||||||
char *in,
|
|
||||||
int max_size);
|
|
||||||
|
|
||||||
|
|
||||||
int parse_not_LWS(
|
|
||||||
char *in,
|
|
||||||
token *out,
|
|
||||||
int max_size);
|
|
||||||
|
|
||||||
|
|
||||||
int parse_LWS(
|
|
||||||
char *in,
|
|
||||||
int max_size);
|
|
||||||
|
|
||||||
|
|
||||||
size_t write_bytes(
|
|
||||||
int fd,
|
|
||||||
char *bytes,
|
|
||||||
size_t n,
|
|
||||||
int timeout);
|
int timeout);
|
||||||
|
EXTERN_C void free_http_message(http_message * message);
|
||||||
|
|
||||||
|
************************************************************************/
|
||||||
void free_http_message(
|
|
||||||
http_message *message);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // GENLIB_NET_URI_H
|
||||||
#endif /* GENLIB_NET_URI_H */
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user