multiple channel configuration support
Previously, the ipmi daemon only supported eth0 and hard-coded it
to channel 1. This allows one to map via a configuration. The
channel number provided is checked against a configuration to retrieve
the ethernet device identifier, e.g. eth0.
Tested: Ran on a quanta-q71l and was able to properly set MAC, IP,
Netmask, Gateway IP, and then verified the data was set for the eth1
via `ip addr show eth1`.
Change-Id: I92f63188297304e9454fd0d6fe32bc6cf84bb181
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/transporthandler.hpp b/transporthandler.hpp
index a101794..42bf717 100644
--- a/transporthandler.hpp
+++ b/transporthandler.hpp
@@ -32,6 +32,9 @@
constexpr uint8_t SET_COMMIT_WRITE = 2; //Optional
constexpr uint8_t SET_IN_PROGRESS_RESERVED = 3; //Reserved
+const int CHANNEL_MASK = 0x0f;
+const int NUM_CHANNELS = 0x0f;
+
struct ChannelConfig_t
{
std::string ipaddr;
@@ -56,3 +59,10 @@
lan_set_in_progress = SET_COMPLETE;
}
};
+
+// Given a channel, get the corresponding configuration,
+// or allocate it first.
+//
+// @param[in] channel the channel
+// @return the ChannelConfig_t pointer.
+struct ChannelConfig_t* getChannelConfig(int channel);