xref: /openbmc/phosphor-host-ipmid/transportconstants.hpp (revision de7abb95977c80f2d802c974562167b81f0a94f2)
1 #pragma once
2 
3 #include <ipmid/api-types.hpp>
4 #include <stdplus/zstring_view.hpp>
5 #include <xyz/openbmc_project/Network/IP/common.hpp>
6 
7 #include <cstdint>
8 
9 using NetworkIP = sdbusplus::common::xyz::openbmc_project::network::IP;
10 
11 namespace ipmi
12 {
13 namespace transport
14 {
15 
16 using stdplus::operator""_zsv;
17 
18 // D-Bus Network Daemon definitions
19 constexpr auto PATH_ROOT = "/xyz/openbmc_project/network"_zsv;
20 constexpr auto INTF_ETHERNET = "xyz.openbmc_project.Network.EthernetInterface";
21 constexpr auto INTF_IP_CREATE = "xyz.openbmc_project.Network.IP.Create";
22 constexpr auto INTF_MAC = "xyz.openbmc_project.Network.MACAddress";
23 constexpr auto INTF_NEIGHBOR = "xyz.openbmc_project.Network.Neighbor";
24 constexpr auto INTF_NEIGHBOR_CREATE_STATIC =
25     "xyz.openbmc_project.Network.Neighbor.CreateStatic";
26 constexpr auto INTF_VLAN = "xyz.openbmc_project.Network.VLAN";
27 constexpr auto INTF_VLAN_CREATE = "xyz.openbmc_project.Network.VLAN.Create";
28 
29 /** @brief IPMI LAN Parameters */
30 enum class LanParam : uint8_t
31 {
32     SetStatus = 0,
33     AuthSupport = 1,
34     AuthEnables = 2,
35     IP = 3,
36     IPSrc = 4,
37     MAC = 5,
38     SubnetMask = 6,
39     Gateway1 = 12,
40     Gateway1MAC = 13,
41     VLANId = 20,
42     CiphersuiteSupport = 22,
43     CiphersuiteEntries = 23,
44     cipherSuitePrivilegeLevels = 24,
45     IPFamilySupport = 50,
46     IPFamilyEnables = 51,
47     IPv6Status = 55,
48     IPv6StaticAddresses = 56,
49     IPv6DynamicAddresses = 59,
50     IPv6RouterControl = 64,
51     IPv6StaticRouter1IP = 65,
52     IPv6StaticRouter1MAC = 66,
53     IPv6StaticRouter1PrefixLength = 67,
54     IPv6StaticRouter1PrefixValue = 68,
55 };
56 
57 /** @brief IPMI IP Origin Types */
58 enum class IPSrc : uint8_t
59 {
60     Unspecified = 0,
61     Static = 1,
62     DHCP = 2,
63     BIOS = 3,
64     BMC = 4,
65 };
66 
67 /** @brief IPMI Set Status */
68 enum class SetStatus : uint8_t
69 {
70     Complete = 0,
71     InProgress = 1,
72     Commit = 2,
73 };
74 
75 /** @brief IPMI Family Suport Bits */
76 namespace IPFamilySupportFlag
77 {
78 constexpr uint8_t IPv6Only = 0;
79 constexpr uint8_t DualStack = 1;
80 constexpr uint8_t IPv6Alerts = 2;
81 } // namespace IPFamilySupportFlag
82 
83 /** @brief IPMI IPFamily Enables Flag */
84 enum class IPFamilyEnables : uint8_t
85 {
86     IPv4Only = 0,
87     IPv6Only = 1,
88     DualStack = 2,
89 };
90 
91 /** @brief IPMI IPv6 Dyanmic Status Bits */
92 namespace IPv6StatusFlag
93 {
94 constexpr uint8_t DHCP = 0;
95 constexpr uint8_t SLAAC = 1;
96 }; // namespace IPv6StatusFlag
97 
98 /** @brief IPMI IPv6 Source */
99 enum class IPv6Source : uint8_t
100 {
101     Static = 0,
102     SLAAC = 1,
103     DHCP = 2,
104 };
105 
106 /** @brief IPMI IPv6 Address Status */
107 enum class IPv6AddressStatus : uint8_t
108 {
109     Active = 0,
110     Disabled = 1,
111 };
112 
113 namespace IPv6RouterControlFlag
114 {
115 constexpr uint8_t Static = 0;
116 constexpr uint8_t Dynamic = 1;
117 }; // namespace IPv6RouterControlFlag
118 
119 // VLANs are a 12-bit value
120 constexpr uint16_t VLAN_VALUE_MASK = 0x0fff;
121 constexpr uint16_t VLAN_ENABLE_FLAG = 0x8000;
122 
123 // Arbitrary v4 Address Limits
124 constexpr uint8_t MAX_IPV4_ADDRESSES = 2;
125 
126 // Arbitrary v6 Address Limits to prevent too much output in ipmitool
127 constexpr uint8_t MAX_IPV6_STATIC_ADDRESSES = 15;
128 constexpr uint8_t MAX_IPV6_DYNAMIC_ADDRESSES = 15;
129 
130 // Prefix length limits of phosphor-networkd
131 constexpr uint8_t MIN_IPV4_PREFIX_LENGTH = 1;
132 constexpr uint8_t MAX_IPV4_PREFIX_LENGTH = 32;
133 constexpr uint8_t MIN_IPV6_PREFIX_LENGTH = 1;
134 constexpr uint8_t MAX_IPV6_PREFIX_LENGTH = 128;
135 
136 /** @enum SolConfParam
137  *
138  *  using for Set/Get SOL configuration parameters command.
139  */
140 enum class SolConfParam : uint8_t
141 {
142     Progress,       //!< Set In Progress.
143     Enable,         //!< SOL Enable.
144     Authentication, //!< SOL Authentication.
145     Accumulate,     //!< Character Accumulate Interval & Send Threshold.
146     Retry,          //!< SOL Retry.
147     NonVbitrate,    //!< SOL non-volatile bit rate.
148     Vbitrate,       //!< SOL volatile bit rate.
149     Channel,        //!< SOL payload channel.
150     Port,           //!< SOL payload port.
151 };
152 
153 } // namespace transport
154 } // namespace ipmi
155