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 // LAN Handler specific response codes
118 constexpr Cc ccParamNotSupported = 0x80;
119 constexpr Cc ccParamSetLocked = 0x81;
120 constexpr Cc ccParamReadOnly = 0x82;
121 
122 // VLANs are a 12-bit value
123 constexpr uint16_t VLAN_VALUE_MASK = 0x0fff;
124 constexpr uint16_t VLAN_ENABLE_FLAG = 0x8000;
125 
126 // Arbitrary v4 Address Limits
127 constexpr uint8_t MAX_IPV4_ADDRESSES = 2;
128 
129 // Arbitrary v6 Address Limits to prevent too much output in ipmitool
130 constexpr uint8_t MAX_IPV6_STATIC_ADDRESSES = 15;
131 constexpr uint8_t MAX_IPV6_DYNAMIC_ADDRESSES = 15;
132 
133 // Prefix length limits of phosphor-networkd
134 constexpr uint8_t MIN_IPV4_PREFIX_LENGTH = 1;
135 constexpr uint8_t MAX_IPV4_PREFIX_LENGTH = 32;
136 constexpr uint8_t MIN_IPV6_PREFIX_LENGTH = 1;
137 constexpr uint8_t MAX_IPV6_PREFIX_LENGTH = 128;
138 
139 /** @enum SolConfParam
140  *
141  *  using for Set/Get SOL configuration parameters command.
142  */
143 enum class SolConfParam : uint8_t
144 {
145     Progress,       //!< Set In Progress.
146     Enable,         //!< SOL Enable.
147     Authentication, //!< SOL Authentication.
148     Accumulate,     //!< Character Accumulate Interval & Send Threshold.
149     Retry,          //!< SOL Retry.
150     NonVbitrate,    //!< SOL non-volatile bit rate.
151     Vbitrate,       //!< SOL volatile bit rate.
152     Channel,        //!< SOL payload channel.
153     Port,           //!< SOL payload port.
154 };
155 
156 constexpr uint8_t ipmiCCParamNotSupported = 0x80;
157 constexpr uint8_t ipmiCCWriteReadParameter = 0x82;
158 
159 } // namespace transport
160 } // namespace ipmi
161