Fabcoin Core  0.16.2
P2P Digital Currency
UPnP.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
23 #pragma once
24 
25 #include <set>
26 #include <string>
27 #include <memory>
28 #include <thread>
29 
30 struct UPNPUrls;
31 struct IGDdatas;
32 
33 namespace dev
34 {
35 namespace p2p
36 {
37 
38 class UPnP
39 {
40 public:
41  UPnP();
42  ~UPnP();
43 
44  std::string externalIP();
45  int addRedirect(char const* addr, int port);
46  void removeRedirect(int port);
47 
48  bool isValid() const { return m_ok; }
49 
50 private:
51  std::set<int> m_reg;
52  bool m_ok;
53  std::shared_ptr<UPNPUrls> m_urls;
54  std::shared_ptr<IGDdatas> m_data;
55 };
56 
57 }
58 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
bool isValid() const
Definition: UPnP.h:48
std::set< int > m_reg
Definition: UPnP.h:51
bool m_ok
Definition: UPnP.h:52
std::shared_ptr< UPNPUrls > m_urls
Definition: UPnP.h:53
void removeRedirect(int port)
Definition: UPnP.cpp:179
std::shared_ptr< IGDdatas > m_data
Definition: UPnP.h:54
std::string externalIP()
Definition: UPnP.cpp:110
int addRedirect(char const *addr, int port)
Definition: UPnP.cpp:121