spawn one rmcpp bridge per interface

According to the new architecture, each bridge should be a separate
process, or at the very least, be attached on a separate D-Bus
connection with a well-known name that corresponds to the channel name.

This commit brings netipmid to a state where it can be launched as:
systemctl start phosphor-ipmi-net@eth0

with a parameterized unit file and socket file that binds the socket to
the interface specified. If not launched this way, it will by default be
bound to all interfaces.

This includes the new parameterized service and socket file and the
autoconf/automake magic to install them to the correct place.

Tested-by: launch netipmid via current unit file/socket file
           launch netipmid via parameterize unit file/socket file

Change-Id: Ib202015fb560da269e535f11c0ac316b17f6c262
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/main.cpp b/main.cpp
index 8fc27f4..d26e032 100644
--- a/main.cpp
+++ b/main.cpp
@@ -16,6 +16,7 @@
 #include <systemd/sd-event.h>
 #include <unistd.h>
 
+#include <CLI/CLI.hpp>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/asio/connection.hpp>
 #include <tuple>
@@ -58,8 +59,17 @@
     return interfaceLAN1;
 }
 
-int main()
+int main(int argc, char* argv[])
 {
+    CLI::App app("KCS RMCP+ bridge");
+    std::string channel;
+    app.add_option("-c,--channel", channel, "channel name. e.g., eth0");
+    uint16_t port = ipmi::rmcpp::defaultPort;
+    app.add_option("-p,--port", port, "port number");
+    bool verbose = false;
+    app.add_option("-v,--verbose", verbose, "print more verbose output");
+    CLI11_PARSE(app, argc, argv);
+
     // Connect to system bus
     auto rc = sd_bus_default_system(&bus);
     if (rc < 0)
@@ -81,6 +91,12 @@
     // Register the phosphor-net-ipmid SOL commands
     sol::command::registerCommands();
 
+    auto& loop = std::get<eventloop::EventLoop&>(singletonPool);
+    if (loop.setupSocket(sdbusp, channel))
+    {
+        return EXIT_FAILURE;
+    }
+
     // Start Event Loop
-    return std::get<eventloop::EventLoop&>(singletonPool).startEventLoop();
+    return loop.startEventLoop();
 }