aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAleksi Lindeman <dec05eba@protonmail.com>2018-12-01 12:43:06 +0100
committerAleksi Lindeman <dec05eba@protonmail.com>2018-12-01 12:43:06 +0100
commite3373366bb81c57cdc3ec96c6936b6c9df535bb2 (patch)
tree27b3f0299a3b955768625b8e8a85dd09b52ce6ac /include
parent9b5d7e4f7a402d52280015a12d2268eed060f1cd (diff)
Starting with upnp support
Diffstat (limited to 'include')
-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