aboutsummaryrefslogtreecommitdiffstats
path: root/jetting-proxy/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'jetting-proxy/main.cpp')
-rw-r--r--jetting-proxy/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/jetting-proxy/main.cpp b/jetting-proxy/main.cpp
new file mode 100644
index 0000000..0e14054
--- /dev/null
+++ b/jetting-proxy/main.cpp
@@ -0,0 +1,37 @@
+/**
+ * @file main.cpp
+ * @brief Jetting proxy — relay between one controller and N clients.
+ */
+#include "JettingProxy.h"
+
+#include <QCommandLineParser>
+#include <QCoreApplication>
+
+int
+main (int argc, char *argv[])
+{
+ qSetMessagePattern ("Proxy [%{time HH:mm:ss.zzz}] %{message}");
+
+ QCoreApplication app (argc, argv);
+
+ QCommandLineParser parser;
+ parser.addOption ({ "wire-debug", "Log forwarded frames to dev log" });
+ parser.addOption ({ "controller-port",
+ "Base port for controller side (default 9110)", "port",
+ "9110" });
+ parser.addOption ({ "client-port",
+ "Base port for client side (default 9210)", "port",
+ "9210" });
+ parser.addHelpOption ();
+ parser.process (app);
+
+ if (parser.isSet ("wire-debug"))
+ JettingProxy::enableWireDebug ();
+
+ quint16 controllerPort = parser.value ("controller-port").toUShort ();
+ quint16 clientPort = parser.value ("client-port").toUShort ();
+
+ new JettingProxy (controllerPort, clientPort, &app);
+
+ return app.exec ();
+}