Under development!
This is a fork of the Portable SDK for UPnP Devices (pupnp) with the aim of a complete re-engeneering based on UPnP™ Device Architecture 2.0.
The following general goals are in progress or planned:
- Suporting main Unix derivates (e.g. Debian/Ubuntu, macOS), MS Windows
- Drop in compatibillity with the old pUPnP library
- Continued optimization for embedded devices
- Including support of 32 bit architectures
- Based on C++ with exceptions instead of C
- Object oriented programming
- Unit-Test driven development
- Integrating CMake for managing the code
- Focus on IPv6 support
- Mandatory OpenSSL support
- Development for old pupnp code is not supported. No header files for pupnp are provided, only for the UPnPsdk.
- On the old Portable SDK for UPnP Devices (pupnp) already deprecated functions are not supported anymore. These are the functions
UpnpSetContentLength(), handle_query_variable(), UpnpGetServiceVarStatus(), UpnpGetServiceVarStatusAsync(). - Large-file support on 32 bit architectures is always enabled. Disabling lfs is not supported.
Here you can find the Technical Documentation.
If you want to be compatible with the classic pUPnP library here you find the Compatible API.
To use the new written object oriented part of the library here you find its UPnPsdk API.
We follow the Semantic Versioning. In short it defines
- MAJOR version when you make incompatible API changes,
- MINOR version when you add or modify functionality in a backwards compatible manner, and
- PATCH version when you make backwards compatible bug fixes.
The UPnPsdk version starts with 0.1.0. Major version 0 means it's not a productive version but under development. Because we will use CMake to manage the code it can be seen as integral part of the project. The UPnPsdk version number will also reflect changes to the CMake configuration.
This fork is based on release-1.14.30 of the pupnp library.
- Ongoing: create extensive Unit Tests without modification of the old source code
- Ongoing: define C++ interfaces for the API
- Ongoing: change old C program to C++ objects but preserve drop in compatibility
- Ongoing: support IP6
- Ongoing: support OpenSSL
You need to have git installed. On Microsoft Windows you must "Enable symbolic links" when asked for "Configuring extra options" while running the git installation program. Then just clone this repository:
~$ git clone https://github.com/UPnPsdk/UPnPsdk.git UPnPsdk-project/
~$ cd UPnPsdk-project/
You are now in the relative root directory of the program source tree. On Microsoft Windows you should first provide symbolic links with git config core.symlinks true on the command line. More details and troubleshooting at Git symbolic links in Windows.
All project directory references are relative to its root directory (CMAKE_SOURCE_DIR) that is UPnPsdk-project/ if you haven't used another directory name with the clone command above. If in daubt with file access or with executing you should first ensure that you are in the projects root directory.
Be in the projects root directory. First configure:
UPnPsdk-project$ cmake -S . -B build/
If you want to compile for a 32 bit architecture on a 64 bit host do:
UPnPsdk-project$ cmake -S . -B build/ -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32
Then build the project:
UPnPsdk-project$ cmake --build build/
To install the libraries and test-executables to /usr/local/bin and /usr/local/lib
UPnPsdk-project$ sudo cmake --install build/
To install the header files for development to /usr/local/include/
UPnPsdk-project$ sudo cmake --install build/ --component Development
To uninstall all as long as the build/ directory is available
UPnPsdk-project$ for f in build/install_manifest*.txt do cat $f && echo done | sudo xargs rm
To uninstall only components:
# Uninstall libraries and executable
UPnPsdk-project$ sudo xargs rm < build/install_manifest.txt
# Unistall Development components
UPnPsdk-project$ sudo xargs rm < build/install_manifest_Development.txt
Remove all CMake configuration and build. Consider to backup the install manifest files before doing this.
UPnPsdk-project$ rm -rf build/
Little helper:
UPnPsdk-project$ tree /usr/local
# Check the stored RPATH or RUNPATH needed to find the shared libraries, for example
UPnPsdk-project$ objdump -x /usr/local/bin/api_calls-csh | grep PATH
If you like you can backup the files build/install_manifest*.txt for later uninstallation without build/ directory.
The development of this UPnP Software Development Kit has started on Linux. So for historical reasons it uses POSIX threads (pthreads) as specified by The Open Group. Unfortunately Microsoft Windows does not support it so we have to use a third party library. I use the well known and well supported pthreads4w library. It will be downloaded on Microsoft Windows and compiled with building the project and should do out of the box.
To build the UPnPsdk you need a Developer Command Prompt. How to install it is out of scope of this description. Microsoft has good documentation about it. You can find it at Use the Microsoft C++ toolset from the command line. For example this is the prompt I used (example, maybe outdated):
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.11.1
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x86_x64'
ingo@WIN11-DEVEL C:\Users\ingo>pwsh
PowerShell 7.4.6
PS C:\Users\ingo>
First configure then build. Because CMake is confusing the architecture without hint it is important to always specify it with -A x64 even if it's the default. Otherwise CMake will install the SDK with 64 bit architecture to "C:\Program Files (x86)".
PS C: UPnPsdk-project> cmake -S . -B build/ -A x64
PS C: UPnPsdk-project> cmake --build build/ --config Release
As shown above you have used the "x64 Native Tools Command Prompt for VS 20xx" for the default 64 bit architecture. To compile for a 32 bit architecture you must use the "x86 Native Tools Command Prompt for VS 20xx" and specify the architecture with option -A Win32 to cmake as follows:
PS C: UPnPsdk-project> cmake -S . -B build/ -A Win32
PS C: UPnPsdk-project> cmake --build build/ --config Release
To install the SDK with test-executables do:
PS C: UPnPsdk-project> cmake --install build/ --config Release
To install the header files for development do:
PS C: UPnPsdk-project> cmake --install build/ --config Release --component Development
To uninstall the SDK do:
PS C: UPnPsdk-project> Remove-Item -Path "C:\Program Files\UPnPsdk\" -Recurse
PS C: UPnPsdk-project> Remove-Item -Path "C:\Program Files (x86)\UPnPsdk\" -Recurse
To uninstall only components as long as the build/ directory is available:
# Uninstall libraries and executable
PS C: UPnPsdk-project> Get-Content .\build\install_manifest.txt | %{Remove-Item -Path $_}
# Unistall Development components
PS C: UPnPsdk-project> Get-Content .\build\install_manifest_Development.txt | %{Remove-Item -Path $_}
Remove all CMake configuration and build. Consider to backup the install manifest files before doing this.
PS C: UPnPsdk-project> Remove-Item -Path ".\build\" -Recurse -Force
Little helper:
# Get the architecture (32 or 64 bit) from an executable or a library, for example:
PS C: UPnPsdk-project> dumpbin.exe -headers .\build\bin\Release\upnpsdk-compa.dll | Select-String -Pattern 'magic #'
If you need more details about installation of POSIX threads on Microsoft Windows I have made an example at github pthreadsWinLin.
UPnPsdk uses OpenSSL by default if it is supported by the underlaying operating system. You have always the option to build OpenSSL from the sources. But nearly all distributions for Unix like platforms support OpenSSL out of the box or have it available in their program repositories ready to install. Unfortunately Microsoft Windows does not support OpenSSL. You may use the build-from-source option or you look for a third party that provide pre compiled binaries for installation. For example I use the Win32/Win64 OpenSSL Installation from Shining Light Productions. With this installer I need to tell Windows where to find it after installation. The usual way is to add the program location to the PATH environment variable that would be in my case "C:/Program Files/OpenSSL-Win64". Look for the right place on your system. This makes OpenSSL available on the whole system. But I prefer to modify the environment of the platform as less as possible. So I only use the option "-D OPENSSL_ROOT_DIR" that CMake understands, for example:
cmake -S . -B build -A x64 -D OPENSSL_ROOT_DIR="C:/Program Files/OpenSSL-Win64"
Copyright (C) 2021+ GPL 3 and higher by Ingo Höft, Redistribution only with this Copyright remark. Last modified: 2025-05-01