1# The Portable SDK for UPnP\* Devices (libupnp) <!-- omit in toc -->
2
3- [The GitHub project page](https://github.com/pupnp/pupnp) is where all the real action happens.
4- [The old Source Forge project page is linked here.](https://sourceforge.net/projects/pupnp)
5
6| branch        | status                                                                                              |
7| ------------- | --------------------------------------------------------------------------------------------------- |
8| master        | ![master](https://github.com/pupnp/pupnp/workflows/Build/badge.svg)                                 |
9| branch-1.14.x | ![1.14.x](https://github.com/pupnp/pupnp/workflows/Build/badge.svg?branch=branch-1.14.x)            |
10| branch-1.12.x | ![1.12.x](https://github.com/pupnp/pupnp/workflows/C%2FC%2B%2B%20CI/badge.svg?branch=branch-1.12.x) |
11| branch-1.10.x | ![1.10.x](https://github.com/pupnp/pupnp/workflows/C%2FC%2B%2B%20CI/badge.svg?branch=branch-1.10.x) |
12| branch-1.8.x  | ![1.8.x](https://github.com/pupnp/pupnp/workflows/C%2FC%2B%2B%20CI/badge.svg?branch=branch-1.8.x)   |
13| branch-1.6.x  | ![1.6.x](https://github.com/pupnp/pupnp/workflows/C%2FC%2B%2B%20CI/badge.svg?branch=branch-1.6.x)   |
14| branch-1.4.x  | ![1.4.x](https://github.com/pupnp/pupnp/workflows/C%2FC%2B%2B%20CI/badge.svg?branch=branch-1.4.x)   |
15
16Copyright (c) 2000-2003 Intel Corporation - All Rights Reserved.
17
18Copyright (c) 2005-2006 Rémi Turboult <r3mi@users.sourceforge.net>
19
20Copyright (c) 2006 Michel Pfeiffer and others <virtual_worlds@gmx.de>
21
22See [LICENSE](site/LICENSE) for details.
23
24## Table of Contents <!-- omit in toc -->
25
26- [1. Overview](#1-overview)
27- [2. General Information](#2-general-information)
28- [3. Changelog](#3-changelog)
29- [4. Documentation](#4-documentation)
30- [5. Other projects that are using the SDK](#5-other-projects-that-are-using-the-sdk)
31- [6. License Conditions](#6-license-conditions)
32- [7. Release List](#7-release-list)
33- [8. Package Contents](#8-package-contents)
34- [9. System Requirements](#9-system-requirements)
35- [10. Build Instructions](#10-build-instructions)
36  - [10.1. Pre-requisites](#101-pre-requisites)
37  - [10.2. Core Libraries](#102-core-libraries)
38  - [10.3. Cross Compilation](#103-cross-compilation)
39  - [10.4. Samples](#104-samples)
40  - [10.5. Solaris Build](#105-solaris-build)
41  - [10.6. Windows Build](#106-windows-build)
42  - [10.7. CMake Build](#107-cmake-build)
43- [11. Install/Uninstall Instructions](#11-installuninstall-instructions)
44  - [11.1. Install](#111-install)
45  - [11.2. Uninstall](#112-uninstall)
46- [12. Product Release Notes](#12-product-release-notes)
47- [13. New Features](#13-new-features)
48- [14. Support and Contact Information](#14-support-and-contact-information)
49- [15. IXML support for scripting languages](#15-ixml-support-for-scripting-languages)
50- [16. Thanks](#16-thanks)
51
52## 1. Overview
53
54The Portable SDK for UPnP&trade; Devices is an SDK for development of UPnP device and control point applications. It consists of the core UPnP protocols along with a UPnP-specific eXtensible Markup Language (XML) parser supporting the Document Object Model (DOM) Level 2 API and an optional, integrated mini web server for serving UPnP related documents. It provides developers with an API and open source code for building control points, devices, and bridges that are compliant with Version 1.0 of the [Universal Plug and Play Device Architecture Specification](http://www.upnp.org/resources/upnpresources.zip) and supports several operating systems like Linux, *BSD, Solaris and others.
55
56## 2. General Information
57
58UPnP&trade; is an architecture that enables discovery, event notification, and control of devices on a network, independent of operating system, programming language, or physical network connection.&nbsp; UPnP&trade; is based on common Internet standards and specifications such as TCP/IP, HTTP, and XML. For detailed information about UPnP&trade;, including the UPnP&trade; Device Architecture Specification, please visit the [UPnP&trade; Forum web site](http://www.upnp.org/).
59
60In 2000, Intel created the first version of the Linux SDK for UPnP&trade; Devices and subsequently released it to the open source community to foster growth of UPnP&trade;.&nbsp; To learn more about&nbsp; Intel's involvement with both UPnP&trade; and the SDK, please visit [Intel's Universal Plug and Play web site](http://www.intel.com/cd/ids/developer/asmo-na/eng/downloads/upnp/index.htm").
61
62In 2006 this 100% compatible fork of the original project was created to
63support further development. This way, the project now continues using the name "Portable UPnP&trade;" and as a project that is more open to contributions of the community. The main goal is the availability of the project for all important platforms to become a standard for UPnP&trade;.
64
65## 3. [Changelog](ChangeLog)
66
67## 4. Documentation
68
69Documentation is available in PDF format from the [downloads](http://sourceforge.net/project/showfiles.php?group_id=166957) section. The documentation actually resides inside the source code itself and is built into the PDF file by an automated process using [Doxygen](https://www.doxygen.nl). Documentation for each function resides in a comment section immediately preceding the function.
70
71## 5. Other projects that are using the SDK
72
73This is a list of some of the projects and products that are based on the SDK for UPnP&trade; Devices.&nbsp; Please let us know if you are working on a project and would like to see it listed here!
74
75- [aMule](http://www.amule.org) has libupnp support to perform port forwarding.
76- [Gerbera](https://gerbera.io) UPnP&trade; media server.
77- [libmcupnp](http://sourceforge.net/projects/libmcupnp) is a Free UPnP(v1) library for easy "MediaServer:1 Client" implementations. The library is built on top of libupnp.
78- [HD Network DVD Media Player](http://www.z500series.com)
79- [eMule Morph](http://emulemorph.sourceforge.net) uses libupnp to forward ports automatically.
80- [PeerStream Audio Video Server](http://www.peerstream.net).
81- [GeeXboX uShare&trade;](https://github.com/ddugovic/uShare) A/V media server.
82- [MediaTomb](http://mediatomb.sourceforge.net) UPnP&trade; media server.
83- The [Linux UPnP&trade; Internet Gateway Device](http://linux-igd.sourceforge.net) This project is a daemon that emulates Microsoft's Internet Connection Service (ICS). It implements the UPnP&trade; Internet Gateway Device (IGD) specification and allows UPnP&trade;-aware clients, such as MSN Messenger, to work properly from behind a NAT firewall.
84- FreeBSD ports of both the [SDK for UPnP&trade; Devices](http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/upnp)"> and the [Linux UPnP&trade; IGD](http://www.freebsd.org/cgi/query-pr.cgi?pr=41295)" were contributed to the FreeBSD ports collection by [Yen-Ming Lee](http://www.leeym.com).
85- [PseudoICSD](http://pseudoicsd.sf.net) is another daemon that provides UPnP&trade; Internet Gateway Device functionality on Linux systems.
86- [IGD2 for linux](https://github.com/Orange-OpenSource/igd2-for-linux) is an updated version of [Linux-IGD implementation](http://linux-igd.sourceforge.net>http://linux-igd.sourceforge.net). This new version is created on top of UPnP IGD:2 specifications available from [https://openconnectivity.org/developer/specifications/upnp-resources/upnp/internet-gateway-device-igd-v-2-0](https://openconnectivity.org/developer/specifications/upnp-resources/upnp/internet-gateway-device-igd-v-2-0).
87- [gmrender-resurrect](https://github.com/hzeller/gmrender-resurrect) is a resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
88- [Music Player Daemon](https://github.com/MusicPlayerDaemon/MPD) uses libupnp to browse and play music stored on an UPnP Media Server.
89- [VLC media player](http://www.videolan.org/vlc) uses libupnp for services discovery.
90
91The links listed here point to external pages that are not under our control, that means we do not have any influence on their contents. Some jurisdictions have the point of view that the owner of a internet page is responsible for links to other webpages and the contents that can be found there. (Landgericht Hamburg, Judgement from 12th May 1998, 312 O 85/98).
92
93Because of that, the operator of these pages is dissociating explicitly from all links made from here. If we are informed about pages with penal relevant names, links, contents or something else we'll remove links to these pages immediately in case that is technically possible and reasonable.
94
95## 6. License Conditions
96
97The Portable SDK for UPnP&trade; Devices is distributed under the BSD (Berkeley Standard Distribution) license. This license allows you to use the source code royalty free and does not place any restrictions on what you do with source code derived from the SDK. For full details on the license conditions, please consult the [LICENSE](site/LICENSE) file located inside the SDK distribution.
98
99## 7. Release List
100
101| Release Number | Date       | History                                  |
102| -------------- | ---------- | ---------------------------------------- |
103| 1.18.0         | TBA ?      | [Portable UPnP SDK][Portable UPnP SDK]   |
104| 1.16.0         | TBA ?      | [Portable UPnP SDK][Portable UPnP SDK]   |
105| 1.14.13        | TBA        | [Portable UPnP SDK][Portable UPnP SDK]   |
106| 1.14.12        | 2021-09-26 | [Portable UPnP SDK][Portable UPnP SDK]   |
107| 1.14.11        | 2021-08-20 | [Portable UPnP SDK][Portable UPnP SDK]   |
108| 1.14.10        | 2021-08-17 | [Portable UPnP SDK][Portable UPnP SDK]   |
109| 1.14.9         | 2021-08-08 | [Portable UPnP SDK][Portable UPnP SDK]   |
110| 1.14.8         | 2021-08-07 | [Portable UPnP SDK][Portable UPnP SDK]   |
111| 1.14.7         | 2021-05-08 | [Portable UPnP SDK][Portable UPnP SDK]   |
112| 1.14.6         | 2021-04-19 | [Portable UPnP SDK][Portable UPnP SDK]   |
113| 1.14.5         | 2021-04-06 | [Portable UPnP SDK][Portable UPnP SDK]   |
114| 1.14.4         | 2021-03-29 | [Portable UPnP SDK][Portable UPnP SDK]   |
115| 1.14.3         | 2021-03-29 | [Portable UPnP SDK][Portable UPnP SDK]   |
116| 1.14.2         | 2021-02-28 | [Portable UPnP SDK][Portable UPnP SDK]   |
117| 1.14.1         | 2021-02-08 | [Portable UPnP SDK][Portable UPnP SDK]   |
118| 1.14.0         | 2020-07-20 | [Portable UPnP SDK][Portable UPnP SDK]   |
119| 1.12.1         | 2020-04-07 | [Portable UPnP SDK][Portable UPnP SDK]   |
120| 1.12.0         | 2020-01-22 | [Portable UPnP SDK][Portable UPnP SDK]   |
121| 1.10.1         | 2019-11-20 | [Portable UPnP SDK][Portable UPnP SDK]   |
122| 1.10.0         | 2019-11-01 | [Portable UPnP SDK][Portable UPnP SDK]   |
123| 1.8.7          | 2020-04-07 | [Portable UPnP SDK][Portable UPnP SDK]   |
124| 1.8.6          | 2019-11-20 | [Portable UPnP SDK][Portable UPnP SDK]   |
125| 1.8.5          | 2019-11-01 | [Portable UPnP SDK][Portable UPnP SDK]   |
126| 1.8.4          | 2018-10-25 | [Portable UPnP SDK][Portable UPnP SDK]   |
127| 1.8.3          | 2017-11-12 | [Portable UPnP SDK][Portable UPnP SDK]   |
128| 1.8.2          | 2017-11-12 | [Portable UPnP SDK][Portable UPnP SDK]   |
129| 1.8.1          | 2017-05-24 | [Portable UPnP SDK][Portable UPnP SDK]   |
130| 1.8.0          | 2017-01-04 | [Portable UPnP SDK][Portable UPnP SDK]   |
131| 1.6.25         | 2016-02-10 | [Portable UPnP SDK][Portable UPnP SDK]   |
132| 1.6.24         | 2017-11-19 | [Portable UPnP SDK][Portable UPnP SDK]   |
133| 1.6.23         | 2017-11-19 | [Portable UPnP SDK][Portable UPnP SDK]   |
134| 1.6.22         | 2017-05-30 | [Portable UPnP SDK][Portable UPnP SDK]   |
135| 1.6.21         | 2016-12-21 | [Portable UPnP SDK][Portable UPnP SDK]   |
136| 1.6.20         | 2016-07-07 | [Portable UPnP SDK][Portable UPnP SDK]   |
137| 1.6.19         | 2013-11-15 | [Portable UPnP SDK][Portable UPnP SDK]   |
138| 1.6.18         | 2013-01-29 | [Portable UPnP SDK][Portable UPnP SDK]   |
139| 1.6.17         | 2012-04-03 | [Portable UPnP SDK][Portable UPnP SDK]   |
140| 1.6.16         | 2012-03-21 | [Portable UPnP SDK][Portable UPnP SDK]   |
141| 1.6.15         | 2012-01-25 | [Portable UPnP SDK][Portable UPnP SDK]   |
142| 1.6.14         | 2011-11-17 | [Portable UPnP SDK][Portable UPnP SDK]   |
143| 1.6.13         | 2011-03-17 | [Portable UPnP SDK][Portable UPnP SDK]   |
144| 1.6.12         | 2011-02-08 | [Portable UPnP SDK][Portable UPnP SDK]   |
145| 1.6.11         | 2011-02-07 | [Portable UPnP SDK][Portable UPnP SDK]   |
146| 1.6.10         | 2011-01-30 | [Portable UPnP SDK][Portable UPnP SDK]   |
147| 1.6.9          | 2010-11-07 | [Portable UPnP SDK][Portable UPnP SDK]   |
148| 1.6.8          | 2010-10-21 | [Portable UPnP SDK][Portable UPnP SDK]   |
149| 1.6.7          | 2010-10-04 | [Portable UPnP SDK][Portable UPnP SDK]   |
150| 1.6.6          | 2008-04-25 | [Portable UPnP SDK][Portable UPnP SDK]   |
151| 1.6.5          | 2008-02-02 | [Portable UPnP SDK][Portable UPnP SDK]   |
152| 1.6.4          | 2008-01-26 | [Portable UPnP SDK][Portable UPnP SDK]   |
153| 1.6.3          | 2007-12-26 | [Portable UPnP SDK][Portable UPnP SDK]   |
154| 1.6.2          | 2007-12-10 | [Portable UPnP SDK][Portable UPnP SDK]   |
155| 1.6.1          | 2007-11-08 | [Portable UPnP SDK][Portable UPnP SDK]   |
156| 1.6.0          | 2007-06-23 | [Portable UPnP SDK][Portable UPnP SDK]   |
157| 1.4.6          | 2007-04-30 | [Portable UPnP SDK][Portable UPnP SDK]   |
158| 1.4.5          | 2007-04-28 | [Portable UPnP SDK][Portable UPnP SDK]   |
159| 1.4.4          | 2007-04-17 | [Portable UPnP SDK][Portable UPnP SDK]   |
160| 1.4.3          | 2007-03-06 | [Portable UPnP SDK][Portable UPnP SDK]   |
161| 1.4.2          | 2007-02-16 | [Portable UPnP SDK][Portable UPnP SDK]   |
162| 1.4.1          | 2006-08-11 | [Portable UPnP SDK][Portable UPnP SDK]   |
163| 1.4.0          | 2006-06-12 | [Portable UPnP SDK][Portable UPnP SDK]   |
164| 1.3.1          | 2006-03-05 | [UPnP SDK for Linux][UPnP SDK for Linux] |
165| 1.3.0          | 2006-03-04 | [UPnP SDK for Linux][UPnP SDK for Linux] |
166| 1.2.1a         | 2003-11-08 | [UPnP SDK for Linux][UPnP SDK for Linux] |
167| 1.2.1          | 2003-02-13 | [UPnP SDK for Linux][UPnP SDK for Linux] |
168| 1.0.4          | 2001-08-15 | [UPnP SDK for Linux][UPnP SDK for Linux] |
169| 1.0.3          | 2001-06-12 | [UPnP SDK for Linux][UPnP SDK for Linux] |
170| 1.0.2          | 2001-02-07 | [UPnP SDK for Linux][UPnP SDK for Linux] |
171| 1.0.1          | 2000-10-13 | [UPnP SDK for Linux][UPnP SDK for Linux] |
172| 1.0.0          | 2000-08-31 | [UPnP SDK for Linux][UPnP SDK for Linux] |
173| 0.9.1          | 2000-08-17 | [UPnP SDK for Linux][UPnP SDK for Linux] |
174| 0.9.0          | 2000-08-01 | [UPnP SDK for Linux][UPnP SDK for Linux] |
175
176[UPnP SDK for Linux]: https://sourceforge.net/projects/upnp/
177[Portable UPnP SDK]: https://sourceforge.net/projects/pupnp/
178
179## 8. Package Contents
180
181The SDK for UPnP Devices contains the following:
182
183| Path/File   | Description                                                                       |
184| ----------- | --------------------------------------------------------------------------------- |
185| README      | This file.  Contains the installation and build instructions.                     |
186| LICENSE     | The licensing terms the SDK is distributed under.                                 |
187| NEWS        | Changes and new features.                                                         |
188| ixml/doc    | The files for generating the XML parser documentation from the source code.       |
189| ixml/inc    | The public include files required to use the XML parser.                          |
190| ixml/src    | The source code to the XML parser library.                                        |
191| upnp/doc    | The files for generating the SDK documentation from the source code.              |
192| upnp/inc    | The public include files required to use the SDK.                                 |
193| upnp/src    | The source files comprising the SDK, libupnp.so.                                  |
194| upnp/sample | A sample device and control point application, illustrating the usage of the SDK. |
195
196## 9. System Requirements
197
198The SDK for UPnP Devices is designed to compile and run under several operating systems.  It does, however, have dependencies on some packages that may not be installed by default.  All packages that it requires are listed below.
199
200| Dependency | Description                                                                              |
201| ---------- | ---------------------------------------------------------------------------------------- |
202| libpthread | The header and library are installed as part of the glibc-devel package (or equivalent). |
203
204Additionally, the documentation for the SDK can be auto-generated from the upnp.h header file using Doxygen, a documentation system for C, C++, IDL, and Java\*.  Doxygen generates the documentation in HTML or TeX format. Using some additional tools, the TeX output can be converted into a PDF file. To generate the documentation these tools are required:
205
206| Package   | Description                                                                                                                                                                                                 |
207| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
208| Doxygen   | The homepage for Doxygen is <https://www.doxygen.nl/index.html>. The current version as of this release of the SDK is version 3.4.9. Doxygen is the only requirement for generating the HTML documentation. |
209| LaTeX/TeX | To generate the PDF documentation, LaTeX and TeX tools are necessary. The tetex and tetex-latex packages provide these tools.                                                                               |
210| dvips     | dvips converts the DVI file produced by LaTeX into a PostScript\* file. The tetex-dvips package provides this tool.                                                                                         |
211| ps2pdf    | The final step to making the PDF is converting the PostStript\* into Portable Document Format. The ghostscript package provides this tool.                                                                  |
212
213For the UPnP library to function correctly, networking must be configured properly for multicasting.  To do this:
214
215```bash
216% route add -net 239.0.0.0 netmask 255.0.0.0 eth0
217```
218
219where 'eth0' is the network adapter that the UPnP library will use.  Without this addition, device advertisements and control point searches will not function.
220
221## 10. Build Instructions
222
223### 10.1. Pre-requisites
224
225Some packages/tools are required to build the library. Here's a minimal 'inspirational example'
226that builds the library using a Docker Ubuntu image.
227
228```bash
229% docker run -it --rm ubuntu /bin/bash
230
231% apt update \
232  && apt install -y build-essential autoconf libtool pkg-config git shtool \
233  && git clone http://github.com/pupnp/pupnp.git \
234  && cd pupnp \
235  && ./bootstrap
236
237% ./configure
238% make
239```
240
241### 10.2. Core Libraries
242
243Note: On a git checkout, you need to run `./bootstrap` to generate the configure script.
244
245```bash
246% ./configure
247% make
248```
249
250will build a version of the binaries without debug support, and with default options enabled (see below for options available at configure time).
251
252```bash
253% ./configure CFLAGS="-DSPARC_SOLARIS -mtune=<cputype> -mcpu=<cputype>"
254% make
255```
256
257will build a Sparc Solaris version of the binaries without debug support and with default options enabled (see below for options available at configure time). Please note: \<cputype\> has to be replaced by a token that fits to your platform and CPU (e.g. "supersparc").
258
259To build the documentation, assuming all the necessary tools are installed (see section 3):
260
261To generate the HTML documentation:
262
263```bash
264% make html
265```
266
267To generate the PDF file:
268
269```bash
270% make pdf
271```
272
273A few options are available at configure time. Use "./configure --help" to display a complete list of options. Note that these options may be combined in any order. After installation, the file \<upnp/upnpconfig.h\> will provide a summary of the optional features that have been included in the library.
274
275```bash
276% ./configure --enable-debug
277% make
278```
279
280will build a debug version with symbols support.
281
282To build the library with the optional, integrated mini web server (note that this is the default):
283
284```bash
285% ./configure --enable-webserver
286% make
287```
288
289To build without:
290
291```bash
292% ./configure --disable-webserver
293% make
294```
295
296The SDK also contains some additional helper APIs, declared in inc/tools/upnptools.h.  If these additional tools are not required, they can be compiled out:
297
298```bash
299% ./configure --disable-tools
300% make
301```
302
303By default, the tools are included in the library.
304
305To further remove code that is not required, the library can be build with or with out the control point (client) or device specific code.  To remove this code:
306
307```bash
308% ./configure --disable-client
309% make
310```
311
312to remove client only code or:
313
314```bash
315% ./configure --disable-device
316% make
317```
318
319to remove device only code.
320
321By default, both client and device code is included in the library. The integrated web server is automatically removed when configuring with --disable-device.
322
323To build the library without large-file support (enabled by default):
324
325```bash
326% ./configure --disable-largefile
327% make
328```
329
330To remove all the targets, object files, and built documentation:
331
332```bash
333% make clean
334```
335
336### 10.3. Cross Compilation
337
338To cross compile the SDK, a special "configure" directive is all that is required:
339
340```bash
341% ./configure --host=arm-linux
342% make
343```
344
345This will invoke the "arm-linux-gcc" cross compiler to build the library.
346
347### 10.4. Samples
348
349The SDK contains two samples: a TV device application and a control point that talks with the TV device.  They are found in the $(LIBUPNP)/upnp/sample directory.
350
351To build the samples (note: this is the default behavior):
352
353```bash
354% ./configure --enable-samples
355% make
356```
357
358will build the sample device "$(LIBUPNP)/upnp/tv_device" and sample control point "$(LIBUPNP)/upnp/tv_ctrlpt". Note : the sample device won't be built if --disable-device has been configured, and the sample control point won't be build if --disable-client has been configured.
359
360To run the sample device, you need to create a tvdevice directory and move the web directory there, giving: "$(LIBUPNP)/upnp/sample/tvdevice/web". To run the sample invoke from the command line as follows:
361
362```bash
363% cd ./upnp/sample/tvdevice
364% ../tv_device
365```
366
367### 10.5. Solaris Build
368
369The building process for the Solaris operating system is similar to the one described above. Only the call to ./configure has to be done using an additional parameter:
370
371```bash
372% ./configure CFLAGS="-mcpu=<cputype> -mtune=<cputype> -DSPARC_SOLARIS"
373```
374
375where \<cputype\> has to be replaced by the appropriate CPU tuning flag (e.g. "supersparc"). Afterwards
376
377```bash
378% make
379% make install
380```
381
382can be called as described above.
383
384### 10.6. Windows Build
385
386In order to build libupnp under Windows the pthreads-w32 package is required. You can download a self-extracting ZIP file from the following location:
387
388<ftp://sources.redhat.com/pub/pthreads-win32/pthreads-w32-2-7-0-release.exe>
389
390or possibly newer versions if available.
391
392- Execute the self-extracting archive and copy the Pre-build.2 folder to the top level source folder.
393- Rename Pre-build.2 to pthreads.
394- Open the provided workspace build\libupnp.dsw with Visual C++ 6.0 and select Build->Build libupnp.dll (F7)
395- In the build directory there are also VC8, VC9 and VC10 folders containing solution files for Visual Studio 2005/2008/2010 respectively.
396
397If you use newer versions to build libupnp, eg Visual Studio 2003 or later, then you need to rebuild the pthreads package so it uses the same VC runtime as libupnp to prevent cross boundary runtime problems (see <http://msdn.microsoft.com/en-us/library/ms235460%28v=VS.100%29.aspx>). Just replace the files in the Pre-build.2 folder (renamed to pthreads as mentioned above) with the newly build versions. If you also use a newer version of pthreads-win32 then you should also replace the header files in that directory structure (obviously).
398
399For building a static library instead of a DLL and for using the static pthreads-w32 library following switches need to be defined additionally:
400
401UPNP_STATIC_LIB - for creating a statically linkable UPnP-library
402PTW32_STATIC_LIB - for using the static pthreads32 library
403
404### 10.7. CMake Build
405
406In Order to build everything using the cmake build system, you just need to install cmake for your platform.
407Standalone cmake is recommended, IDE's like Visual Studio have built-in support which works, but as cmake in general
408encourages out-of-source builds and VS writes it's config into the source, cmake-gui should be used on windows.
409
410All known options have the same meaning as stated in point 10.2. In Addition 2 options have been added.
411
412- DOWNLOAD_AND_BUILD_DEPS: This option is only available if a useable git program was found on your system.
413  With this option on, the pthread4w package will be downloaded while configuring the build-env, then it will be build and installed along with upnp.
414
415- BUILD_TESTING: This option activates the tests.
416
417If you don't want to build pthreads4w in the same build as upnp, you can download it from <https://github.com/Vollstrecker/pthreads4w>.
418Just build and install it. The libs and headers will be found, if you set CMAKE_INSTALL_PREFIX (the base install dir) to the same location.
419
420For information on general usage of the cmake build system see: <https://cmake.org/cmake/help/v3.19/guide/user-interaction/index.html>
421
422## 11. Install/Uninstall Instructions
423
424### 11.1. Install
425
426The top-level makefile for the UPnP SDK contains rules to install the necessary components.  To install the SDK, as root:
427
428```bash
429% make install
430```
431
432### 11.2. Uninstall
433
434Likewise, the top-level makefile contains an uninstall rule, reversing the steps in the install:
435
436```bash
437% make uninstall
438```
439
440## 12. Product Release Notes
441
442The SDK for UPnP Devices v1.2.1a has these known issues:
443
444- The UPnP library may not work with older versions of gcc and libstdc++, causing a segmentation fault when the library loads.  It is recommended that gcc version 2.9 or later be used in building library.
445- The UPnP library does not work the glibc 2.1.92-14 that ships with Red Hat 7.0.  For the library to function, you must updated the glibc and glibc-devel packages to 2.1.94-3 or later.  There is some issue with libpthreads that has been resolved in the 2.1.94 version.
446
447## 13. New Features
448
449See [ChangeLog file](https://github.com/pupnp/pupnp/blob/master/ChangeLog).
450
451## 14. Support and Contact Information
452
453Intel is not providing support for the SDK for UPnP Devices. Mailing lists and discussion boards can be found at <https://github.com/pupnp/pupnp/discussions>.
454
455If you find this SDK useful, please send an email to upnp@intel.com and let us know.
456
457\* Other brands, names, and trademarks are the property of their respective owners.
458
459## 15. IXML support for scripting languages
460
461The tree structure of XML documents created by IXML is hard to maintain when creating a binding for a scripting language. Even when many elements may never be used on the script side, it requires copying the entire tree structure once you start accessing elements several levels deep.Hence scriptsupport was added. To enable it compile while IXML_HAVE_SCRIPTSUPPORT has been defined (enabled by default). This allows control using only a list instead of a tree-like structure, and only nodes actually accessed need to be created instead of all the nodes in the tree.
462
463Here's how its supposed to work:
464
465- The scriptsupport allows you to add a callback when a node is freed on the C side, so appropriate action can be taken on the script side, see function ixmlSetBeforeFree().
466- Instead of recreating the tree structure, an intermediate object should be created only for the nodes actually accessed. The object should be containing a pointer to the node and a 'valid flag' which is initially set to TRUE (the valid flag, can simply be the pointer to the node being NULL or not). Before creating the intermediate object, the custom tag 'ctag' can be used to check whether one was already created.
467- the node object gets an extra 'void\* ctag' field, a custom tag to make a ross reference to the script side intermediate object. It can be set using ixmlNode_setCTag(), and read using ixmlNode_getCTag(). Whenever a new intermediate object is created, the ctag of the corresponding node should be set to point to this intermediate object.
468- The tree structure traversal is done on the C side (looking up parents, children and siblings)
469- Every intermediate object created should be kept in a list (preferably a key-value list, where the key is the pointer to the node and the value is the pointer to the intermediate object)
470- when the callback is called, the node should be looked up in the list, the flag set to false, the pointer to the C-side node be cleared and on the C-side the ctag should be cleared.
471- whenever the intermediate object is accessed and its flag is set to False, an error should be thrown that the XML document has been closed.
472
473Freeing resources can be done in 2 ways, C side by simply calling the free node methods, or script side by the garbage collector of the script engine.
474
475Script side steps:
476
477- if the valid flag is set to False (XML document is closed), then the intermediate object can be destroyed, no further action.
478- if the node has a parent, then the intermediate object can be destroyed after the ctag on the corresponding node has been cleared. Nothing needs to be freed on the C-side.
479- if the node has no parent, then the node must be freed on the C side by calling the corresponding free node methods. This will result in a chain of callbacks closing the node and all underlying nodes.
480
481## 16. Thanks
482
483- To all the people listed in [the THANKS file](THANKS).
484- To [JetBrains](https://www.jetbrains.com/?from=pupnp) for kindly providing us with open source licenses of their amazing products.
485
486![JetBrains Logo](site/jetbrains.svg)
487