transporthandler: move IPMI definitions to header
Move the IPMI constants to a header file.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I70c932965d24e4c5368f772d5df649242f0fb701
diff --git a/transporthandler.cpp b/transporthandler.cpp
index e48137f..0012746 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -1,3 +1,5 @@
+#include "transporthandler.hpp"
+
#include "app/channel.hpp"
#include "user_channel/cipher_mgmt.hpp"
@@ -83,19 +85,6 @@
namespace transport
{
-// LAN Handler specific response codes
-constexpr Cc ccParamNotSupported = 0x80;
-constexpr Cc ccParamSetLocked = 0x81;
-constexpr Cc ccParamReadOnly = 0x82;
-
-// VLANs are a 12-bit value
-constexpr uint16_t VLAN_VALUE_MASK = 0x0fff;
-constexpr uint16_t VLAN_ENABLE_FLAG = 0x8000;
-
-// Arbitrary v6 Address Limits to prevent too much output in ipmitool
-constexpr uint8_t MAX_IPV6_STATIC_ADDRESSES = 15;
-constexpr uint8_t MAX_IPV6_DYNAMIC_ADDRESSES = 15;
-
// D-Bus Network Daemon definitions
constexpr auto PATH_ROOT = "/xyz/openbmc_project/network";
constexpr auto PATH_SYSTEMCONFIG = "/xyz/openbmc_project/network/config";
@@ -173,99 +162,9 @@
ether_addr mac;
};
-/** @brief IPMI LAN Parameters */
-enum class LanParam : uint8_t
-{
- SetStatus = 0,
- AuthSupport = 1,
- AuthEnables = 2,
- IP = 3,
- IPSrc = 4,
- MAC = 5,
- SubnetMask = 6,
- Gateway1 = 12,
- Gateway1MAC = 13,
- VLANId = 20,
- CiphersuiteSupport = 22,
- CiphersuiteEntries = 23,
- cipherSuitePrivilegeLevels = 24,
- IPFamilySupport = 50,
- IPFamilyEnables = 51,
- IPv6Status = 55,
- IPv6StaticAddresses = 56,
- IPv6DynamicAddresses = 59,
- IPv6RouterControl = 64,
- IPv6StaticRouter1IP = 65,
- IPv6StaticRouter1MAC = 66,
- IPv6StaticRouter1PrefixLength = 67,
- IPv6StaticRouter1PrefixValue = 68,
-};
-
static constexpr uint8_t oemCmdStart = 192;
static constexpr uint8_t oemCmdEnd = 255;
-/** @brief IPMI IP Origin Types */
-enum class IPSrc : uint8_t
-{
- Unspecified = 0,
- Static = 1,
- DHCP = 2,
- BIOS = 3,
- BMC = 4,
-};
-
-/** @brief IPMI Set Status */
-enum class SetStatus : uint8_t
-{
- Complete = 0,
- InProgress = 1,
- Commit = 2,
-};
-
-/** @brief IPMI Family Suport Bits */
-namespace IPFamilySupportFlag
-{
-constexpr uint8_t IPv6Only = 0;
-constexpr uint8_t DualStack = 1;
-constexpr uint8_t IPv6Alerts = 2;
-} // namespace IPFamilySupportFlag
-
-/** @brief IPMI IPFamily Enables Flag */
-enum class IPFamilyEnables : uint8_t
-{
- IPv4Only = 0,
- IPv6Only = 1,
- DualStack = 2,
-};
-
-/** @brief IPMI IPv6 Dyanmic Status Bits */
-namespace IPv6StatusFlag
-{
-constexpr uint8_t DHCP = 0;
-constexpr uint8_t SLAAC = 1;
-}; // namespace IPv6StatusFlag
-
-/** @brief IPMI IPv6 Source */
-enum class IPv6Source : uint8_t
-{
- Static = 0,
- SLAAC = 1,
- DHCP = 2,
-};
-
-/** @brief IPMI IPv6 Address Status */
-enum class IPv6AddressStatus : uint8_t
-{
- Active = 0,
- Disabled = 1,
-};
-
-namespace IPv6RouterControlFlag
-{
-constexpr uint8_t Static = 0;
-constexpr uint8_t Dynamic = 1;
-}; // namespace IPv6RouterControlFlag
-
/** @brief A trivial helper used to determine if two PODs are equal
*
* @params[in] a - The first object to compare
diff --git a/transporthandler.hpp b/transporthandler.hpp
new file mode 100644
index 0000000..c13e05a
--- /dev/null
+++ b/transporthandler.hpp
@@ -0,0 +1,115 @@
+#pragma once
+
+#include <cstdint>
+#include <ipmid/api-types.hpp>
+
+namespace ipmi
+{
+namespace transport
+{
+
+/** @brief IPMI LAN Parameters */
+enum class LanParam : uint8_t
+{
+ SetStatus = 0,
+ AuthSupport = 1,
+ AuthEnables = 2,
+ IP = 3,
+ IPSrc = 4,
+ MAC = 5,
+ SubnetMask = 6,
+ Gateway1 = 12,
+ Gateway1MAC = 13,
+ VLANId = 20,
+ CiphersuiteSupport = 22,
+ CiphersuiteEntries = 23,
+ cipherSuitePrivilegeLevels = 24,
+ IPFamilySupport = 50,
+ IPFamilyEnables = 51,
+ IPv6Status = 55,
+ IPv6StaticAddresses = 56,
+ IPv6DynamicAddresses = 59,
+ IPv6RouterControl = 64,
+ IPv6StaticRouter1IP = 65,
+ IPv6StaticRouter1MAC = 66,
+ IPv6StaticRouter1PrefixLength = 67,
+ IPv6StaticRouter1PrefixValue = 68,
+};
+
+/** @brief IPMI IP Origin Types */
+enum class IPSrc : uint8_t
+{
+ Unspecified = 0,
+ Static = 1,
+ DHCP = 2,
+ BIOS = 3,
+ BMC = 4,
+};
+
+/** @brief IPMI Set Status */
+enum class SetStatus : uint8_t
+{
+ Complete = 0,
+ InProgress = 1,
+ Commit = 2,
+};
+
+/** @brief IPMI Family Suport Bits */
+namespace IPFamilySupportFlag
+{
+constexpr uint8_t IPv6Only = 0;
+constexpr uint8_t DualStack = 1;
+constexpr uint8_t IPv6Alerts = 2;
+} // namespace IPFamilySupportFlag
+
+/** @brief IPMI IPFamily Enables Flag */
+enum class IPFamilyEnables : uint8_t
+{
+ IPv4Only = 0,
+ IPv6Only = 1,
+ DualStack = 2,
+};
+
+/** @brief IPMI IPv6 Dyanmic Status Bits */
+namespace IPv6StatusFlag
+{
+constexpr uint8_t DHCP = 0;
+constexpr uint8_t SLAAC = 1;
+}; // namespace IPv6StatusFlag
+
+/** @brief IPMI IPv6 Source */
+enum class IPv6Source : uint8_t
+{
+ Static = 0,
+ SLAAC = 1,
+ DHCP = 2,
+};
+
+/** @brief IPMI IPv6 Address Status */
+enum class IPv6AddressStatus : uint8_t
+{
+ Active = 0,
+ Disabled = 1,
+};
+
+namespace IPv6RouterControlFlag
+{
+constexpr uint8_t Static = 0;
+constexpr uint8_t Dynamic = 1;
+}; // namespace IPv6RouterControlFlag
+
+// LAN Handler specific response codes
+constexpr Cc ccParamNotSupported = 0x80;
+constexpr Cc ccParamSetLocked = 0x81;
+constexpr Cc ccParamReadOnly = 0x82;
+
+// VLANs are a 12-bit value
+constexpr uint16_t VLAN_VALUE_MASK = 0x0fff;
+constexpr uint16_t VLAN_ENABLE_FLAG = 0x8000;
+
+// Arbitrary v6 Address Limits to prevent too much output in ipmitool
+constexpr uint8_t MAX_IPV6_STATIC_ADDRESSES = 15;
+constexpr uint8_t MAX_IPV6_DYNAMIC_ADDRESSES = 15;
+
+} // namespace transport
+} // namespace ipmi