From e3373366bb81c57cdc3ec96c6936b6c9df535bb2 Mon Sep 17 00:00:00 2001 From: Aleksi Lindeman Date: Sat, 1 Dec 2018 12:43:06 +0100 Subject: Starting with upnp support --- include/sibs/DirectConnection.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include') 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 +#include 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> connectionResults; - std::mutex connectionResultsMutex; + std::mutex connectionResultsMutex; + + struct UPNPUrlData + { + UPNPUrls *upnpUrls; + IGDdatas *igdDatas; + bool portOpened; + }; + + UPNPDev *upnpDevList; + std::vector upnpData; }; struct DirectConnectionsUtils -- cgit v1.2.3