upnpctrl: add command to show all existing port mappings

This can be useful for debugging purposes.

Change-Id: I9da11d20a7a8cd9f7d1eae9d4aee45281c5cd4ad
diff --git a/include/upnp/upnp_context.h b/include/upnp/upnp_context.h
index 9941e3b..0958864 100644
--- a/include/upnp/upnp_context.h
+++ b/include/upnp/upnp_context.h
@@ -57,6 +57,14 @@
 class UPnPProtocol;
 class IGD;
 
+struct IGDInfo
+{
+    std::string uid;
+    IpAddr localIp;
+    IpAddr publicIp;
+    std::vector<MappingInfo> mappingInfoList;
+};
+
 enum class UpnpIgdEvent { ADDED, REMOVED, INVALID_STATE };
 
 // Interface used to report mapping event from the protocol implementations.
@@ -136,6 +144,11 @@
     // Generate random port numbers
     static uint16_t generateRandomPort(PortType type, bool mustBeEven = false);
 
+    // Return information about the UPnPContext's valid IGDs, including the list
+    // of all existing port mappings (for IGDs which support a protocol that allows
+    // querying that information -- UPnP does, but NAT-PMP doesn't for example)
+    std::vector<IGDInfo> getIgdsInfo() const;
+
     template <typename T>
     inline void dispatch(T&& f) {
         ctx->dispatch(std::move(f));