aboutsummaryrefslogtreecommitdiff
path: root/include/sibs
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-12-01 12:43:06 +0100
committerdec05eba <dec05eba@protonmail.com>2020-08-18 22:56:48 +0200
commit39f3e2049813d2556309b4ee2064287b5781415f (patch)
tree6ee06ab49d356cb8e547b24c22bda562e585b2d2 /include/sibs
parente66f3b1adec087dd7d47c6e25d26961d768ee3b8 (diff)
Starting with upnp support
Diffstat (limited to 'include/sibs')
-rw-r--r--include/sibs/DirectConnection.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/sibs/DirectConnection.hpp b/include/sibs/DirectConnection.hpp
index 70eaf4f..1ba8659 100644
--- a/include/sibs/DirectConnection.hpp
+++ b/include/sibs/DirectConnection.hpp
@@ -14,6 +14,7 @@
#include "Socket.hpp"
#include "Message.hpp"
#include <future>
+#include <miniupnpc.h>
namespace sibs
{
@@ -88,6 +89,10 @@ namespace sibs
void removeDisconnectedPeers();
void receiveData();
int receiveDataFromPeer(const int socket, char *output, usize *receivedTotalSize);
+
+ void openPortUpnpDevice(const Ipv4 &myAddress, UPNPDev *device);
+ void openPort(const Ipv4 &myAddress);
+ int closeOpenedPort(const Ipv4 &myAddress, UPNPUrls *upnpUrls, IGDdatas *igdDatas);
private:
u16 port;
int eid;
@@ -97,7 +102,17 @@ namespace sibs
bool alive;
PubSubOnRemoveDisconnectedPeerCallback removeDisconnectedPeerCallback;
Ipv4Map<std::shared_future<PubSubConnectResult>> connectionResults;
- std::mutex connectionResultsMutex;
+ std::mutex connectionResultsMutex;
+
+ struct UPNPUrlData
+ {
+ UPNPUrls *upnpUrls;
+ IGDdatas *igdDatas;
+ bool portOpened;
+ };
+
+ UPNPDev *upnpDevList;
+ std::vector<UPNPUrlData> upnpData;
};
struct DirectConnectionsUtils