transporthandler: Split constants into a standalone header.
In environments that disable exceptions, it's problematic to have
headers that depend on exceptions being enabled.
Split constant values out of transporthandler.hpp so that they can be
re-used.
Change-Id: If4ee8221f4350f1d63f87e3b7ced91472c52fad3
Signed-off-by: Peter Foley <pefoley@google.com>
diff --git a/transportconstants.hpp b/transportconstants.hpp
new file mode 100644
index 0000000..b9ce46b
--- /dev/null
+++ b/transportconstants.hpp
@@ -0,0 +1,157 @@
+#pragma once
+
+#include <ipmid/api-types.hpp>
+#include <stdplus/zstring_view.hpp>
+
+#include <cstdint>
+
+namespace ipmi
+{
+namespace transport
+{
+
+using stdplus::operator""_zsv;
+
+// D-Bus Network Daemon definitions
+constexpr auto PATH_ROOT = "/xyz/openbmc_project/network"_zsv;
+constexpr auto INTF_ETHERNET = "xyz.openbmc_project.Network.EthernetInterface";
+constexpr auto INTF_IP = "xyz.openbmc_project.Network.IP";
+constexpr auto INTF_IP_CREATE = "xyz.openbmc_project.Network.IP.Create";
+constexpr auto INTF_MAC = "xyz.openbmc_project.Network.MACAddress";
+constexpr auto INTF_NEIGHBOR = "xyz.openbmc_project.Network.Neighbor";
+constexpr auto INTF_NEIGHBOR_CREATE_STATIC =
+ "xyz.openbmc_project.Network.Neighbor.CreateStatic";
+constexpr auto INTF_VLAN = "xyz.openbmc_project.Network.VLAN";
+constexpr auto INTF_VLAN_CREATE = "xyz.openbmc_project.Network.VLAN.Create";
+
+/** @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;
+
+// Prefix length limits of phosphor-networkd
+constexpr uint8_t MIN_IPV4_PREFIX_LENGTH = 1;
+constexpr uint8_t MAX_IPV4_PREFIX_LENGTH = 32;
+constexpr uint8_t MIN_IPV6_PREFIX_LENGTH = 1;
+constexpr uint8_t MAX_IPV6_PREFIX_LENGTH = 128;
+
+/** @enum SolConfParam
+ *
+ * using for Set/Get SOL configuration parameters command.
+ */
+enum class SolConfParam : uint8_t
+{
+ Progress, //!< Set In Progress.
+ Enable, //!< SOL Enable.
+ Authentication, //!< SOL Authentication.
+ Accumulate, //!< Character Accumulate Interval & Send Threshold.
+ Retry, //!< SOL Retry.
+ NonVbitrate, //!< SOL non-volatile bit rate.
+ Vbitrate, //!< SOL volatile bit rate.
+ Channel, //!< SOL payload channel.
+ Port, //!< SOL payload port.
+};
+
+constexpr uint8_t ipmiCCParamNotSupported = 0x80;
+constexpr uint8_t ipmiCCWriteReadParameter = 0x82;
+
+} // namespace transport
+} // namespace ipmi
diff --git a/transporthandler.hpp b/transporthandler.hpp
index f4a7585..165eeda 100644
--- a/transporthandler.hpp
+++ b/transporthandler.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "app/channel.hpp"
+#include "transportconstants.hpp"
#include "user_channel/cipher_mgmt.hpp"
#include <ipmid/api-types.hpp>
@@ -38,127 +39,6 @@
namespace transport
{
-using stdplus::operator""_zsv;
-
-// D-Bus Network Daemon definitions
-constexpr auto PATH_ROOT = "/xyz/openbmc_project/network"_zsv;
-constexpr auto INTF_ETHERNET = "xyz.openbmc_project.Network.EthernetInterface";
-constexpr auto INTF_IP = "xyz.openbmc_project.Network.IP";
-constexpr auto INTF_IP_CREATE = "xyz.openbmc_project.Network.IP.Create";
-constexpr auto INTF_MAC = "xyz.openbmc_project.Network.MACAddress";
-constexpr auto INTF_NEIGHBOR = "xyz.openbmc_project.Network.Neighbor";
-constexpr auto INTF_NEIGHBOR_CREATE_STATIC =
- "xyz.openbmc_project.Network.Neighbor.CreateStatic";
-constexpr auto INTF_VLAN = "xyz.openbmc_project.Network.VLAN";
-constexpr auto INTF_VLAN_CREATE = "xyz.openbmc_project.Network.VLAN.Create";
-
-/** @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;
-
-// Prefix length limits of phosphor-networkd
-constexpr uint8_t MIN_IPV6_PREFIX_LENGTH = 1;
-constexpr uint8_t MAX_IPV6_PREFIX_LENGTH = 128;
-
/** @brief The dbus parameters for the interface corresponding to a channel
* This helps reduce the number of mapper lookups we need for each
* query and simplifies finding the VLAN interface if needed.
@@ -567,25 +447,5 @@
}
}
-/** @enum SolConfParam
- *
- * using for Set/Get SOL configuration parameters command.
- */
-enum class SolConfParam : uint8_t
-{
- Progress, //!< Set In Progress.
- Enable, //!< SOL Enable.
- Authentication, //!< SOL Authentication.
- Accumulate, //!< Character Accumulate Interval & Send Threshold.
- Retry, //!< SOL Retry.
- NonVbitrate, //!< SOL non-volatile bit rate.
- Vbitrate, //!< SOL volatile bit rate.
- Channel, //!< SOL payload channel.
- Port, //!< SOL payload port.
-};
-
-constexpr uint8_t ipmiCCParamNotSupported = 0x80;
-constexpr uint8_t ipmiCCWriteReadParameter = 0x82;
-
} // namespace transport
} // namespace ipmi