aboutsummaryrefslogtreecommitdiff
path: root/src/interface
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/node.cpp15
-rw-r--r--src/interface/node.h16
2 files changed, 31 insertions, 0 deletions
diff --git a/src/interface/node.cpp b/src/interface/node.cpp
index 4e3fa6ceb9..877c5f57a8 100644
--- a/src/interface/node.cpp
+++ b/src/interface/node.cpp
@@ -7,6 +7,9 @@
#include <chainparams.h>
#include <init.h>
#include <interface/handler.h>
+#include <net.h>
+#include <netaddress.h>
+#include <netbase.h>
#include <scheduler.h>
#include <ui_interface.h>
#include <util.h>
@@ -24,6 +27,8 @@ class NodeImpl : public Node
gArgs.ParseParameters(argc, argv);
}
void readConfigFile(const std::string& conf_path) override { gArgs.ReadConfigFile(conf_path); }
+ bool softSetArg(const std::string& arg, const std::string& value) override { return gArgs.SoftSetArg(arg, value); }
+ bool softSetBoolArg(const std::string& arg, bool value) override { return gArgs.SoftSetBoolArg(arg, value); }
void selectParams(const std::string& network) override { SelectParams(network); }
void initLogging() override { InitLogging(); }
void initParameterInteraction() override { InitParameterInteraction(); }
@@ -40,6 +45,16 @@ class NodeImpl : public Node
Shutdown();
}
void startShutdown() override { StartShutdown(); }
+ void mapPort(bool use_upnp) override
+ {
+ if (use_upnp) {
+ StartMapPort();
+ } else {
+ InterruptMapPort();
+ StopMapPort();
+ }
+ }
+ bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
{
return MakeHandler(::uiInterface.InitMessage.connect(fn));
diff --git a/src/interface/node.h b/src/interface/node.h
index b69ef160a3..368bade28b 100644
--- a/src/interface/node.h
+++ b/src/interface/node.h
@@ -5,10 +5,14 @@
#ifndef BITCOIN_INTERFACE_NODE_H
#define BITCOIN_INTERFACE_NODE_H
+#include <netaddress.h> // For Network
+
#include <functional>
#include <memory>
#include <string>
+class proxyType;
+
namespace interface {
class Handler;
@@ -22,6 +26,12 @@ public:
//! Set command line arguments.
virtual void parseParameters(int argc, const char* const argv[]) = 0;
+ //! Set a command line argument if it doesn't already have a value
+ virtual bool softSetArg(const std::string& arg, const std::string& value) = 0;
+
+ //! Set a command line boolean argument if it doesn't already have a value
+ virtual bool softSetBoolArg(const std::string& arg, bool value) = 0;
+
//! Load settings from configuration file.
virtual void readConfigFile(const std::string& conf_path) = 0;
@@ -49,6 +59,12 @@ public:
//! Start shutdown.
virtual void startShutdown() = 0;
+ //! Map port.
+ virtual void mapPort(bool use_upnp) = 0;
+
+ //! Get proxy.
+ virtual bool getProxy(Network net, proxyType& proxy_info) = 0;
+
//! Register handler for init messages.
using InitMessageFn = std::function<void(const std::string& message)>;
virtual std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) = 0;