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