upnp: support libupnp and libnatnatpmp simultaneously

Update libupnp to version 1.8.4.

For windows, the IPV6 preprocessor must be undefined. Or else
libupnp won't initialize. Added visual studio 2017 support
via one patch for windows that also combines previous windows
patches.

UPnPController: Class that the jami classes use to control the
opening and closing of ports. Every  service has it's own upnp
controller. The controller does it's actions by using the upnp
context class. Also refactored the functions used to add
mappings. Instead of using two different functions with
different types of parameters, we now use one function with
parameters that have default values. The logic stays the same
but the function call is more clear.

UPnPContext: Class that holds a (linked) list of discovered IGDs
and their corresponding protocols (which discovered them).
Whenever the controller wants to add or remove a mapping, the
context picks a valid IGD in it's list and uses the correct
protocol to complete the required action. This class also has
the ability to swap protocols for an IGD that was discovered
by more then one protocol.

UPnPProtocol: Virtual base class that defines the functions
needed by the context to use the corresponding protocol.

PUPnP: UPnPProtocol derived class that represents a upnp client
that uses the portable upnp library (libupnp). Every time the
client discovers a new IGD it uses a callback to add it to the
context's main IGD linked list. It also has an internal list of
IGDs that it discovered. Added features to this class include:
	- IGD event subscription.
	- Use UpnpInit2 function instead of deprecated UpnpInit
	  function. It's also supposed to support IPv6.

NatPmp: UPnPProtocol derived class that represents a upnp client
that uses the NAT-PMP library (libnatpmp). Unlike libupnp,
libnatpmp only supports discovering one IGD. Also uses callbacks
to add the IGD it finds to the context's main IGD class.

Also inclided debug warning prints whenever a controller opens
and closes the ports. That way we can keep track of whenever
the application opens and closes ports on the internet
gateway device.

Gitlab: #96

Change-Id: I199271edac2c6d93dc60c24e2e2aefe36de7950c
This commit is contained in:
Eden Abitbol
2019-06-03 12:23:00 -04:00
parent 3e2c8637b9
commit 60515d893a
44 changed files with 5890 additions and 3386 deletions

View File

@ -566,6 +566,7 @@ AS_IF([test "x$with_upnp" = "xyes"],
[AC_MSG_WARN([Missing libupnp development files])
AC_DEFINE([HAVE_LIBUPNP], 0, [Define if you have libupnp])])
])
AM_CONDITIONAL([BUILD_PUPNP], test "x$with_upnp" = "xyes")
# LIBNATPMP
dnl check for libnatpmp
@ -580,6 +581,7 @@ AS_IF([test "x$with_natpmp" != xno],
],[])
AC_DEFINE_UNQUOTED([HAVE_LIBNATPMP], `if test "x$with_natpmp" != xno; then echo 1; else echo 0; fi`, [Define if you have libnatpmp])
AM_CONDITIONAL([BUILD_NATPMP], test "x$with_natpmp" = "xyes")
AC_DEFINE_UNQUOTED([HAVE_SHM], `if test -z "${HAVE_LINUX_TRUE}" && test -z "${HAVE_ANDROID_FALSE}" ; then echo 1; else echo 0; fi`,
[Define if you have shared memory support])
@ -632,6 +634,9 @@ AC_CONFIG_FILES([Makefile \
src/media/video/winvideo/Makefile \
src/security/Makefile \
src/upnp/Makefile \
src/upnp/protocol/Makefile \
src/upnp/protocol/natpmp/Makefile \
src/upnp/protocol/pupnp/Makefile \
ringtones/Makefile \
test/Makefile\
test/sip/Makefile