blob: a1017948acb5c79c1602364e23d8a8b99e4213f7 [file] [log] [blame]
Ratan Guptab8e99552017-07-27 07:07:48 +05301#pragma once
2
Ratan Gupta533d03b2017-07-30 10:39:22 +05303#include "types.hpp"
Ratan Guptab8e99552017-07-27 07:07:48 +05304#include <string>
Adriana Kobylak5d6481f2015-10-29 21:44:55 -05005// IPMI commands for Transport net functions.
6enum ipmi_netfn_storage_cmds
7{
8 // Get capability bits
9 IPMI_CMD_SET_LAN = 0x01,
10 IPMI_CMD_GET_LAN = 0x02,
11};
12
13// Command specific completion codes
14enum ipmi_transport_return_codes
15{
16 IPMI_CC_PARM_NOT_SUPPORTED = 0x80,
17};
18
Adriana Kobylake08fbc62016-02-09 16:17:23 -060019// Parameters
20static const int LAN_PARM_INPROGRESS = 0;
21static const int LAN_PARM_AUTHSUPPORT = 1;
22static const int LAN_PARM_AUTHENABLES = 2;
23static const int LAN_PARM_IP = 3;
Ratan Guptacc6cdbf2017-09-01 23:06:25 +053024static const int LAN_PARM_IPSRC = 4;
Adriana Kobylake08fbc62016-02-09 16:17:23 -060025static const int LAN_PARM_MAC = 5;
26static const int LAN_PARM_SUBNET = 6;
27static const int LAN_PARM_GATEWAY = 12;
Ratan Gupta533d03b2017-07-30 10:39:22 +053028static const int LAN_PARM_VLAN = 20;
Adriana Kobylake08fbc62016-02-09 16:17:23 -060029
Patrick Venture585a1e92017-11-17 07:36:15 -080030constexpr uint8_t SET_COMPLETE = 0;
31constexpr uint8_t SET_IN_PROGRESS = 1;
32constexpr uint8_t SET_COMMIT_WRITE = 2; //Optional
33constexpr uint8_t SET_IN_PROGRESS_RESERVED = 3; //Reserved
34
Ratan Guptab8e99552017-07-27 07:07:48 +053035struct ChannelConfig_t
36{
37 std::string ipaddr;
Ratan Guptacc6cdbf2017-09-01 23:06:25 +053038 ipmi::network::IPOrigin ipsrc = ipmi::network::IPOrigin::UNSPECIFIED;
Ratan Guptab8e99552017-07-27 07:07:48 +053039 std::string netmask;
40 std::string gateway;
41 std::string macAddress;
Ratan Gupta533d03b2017-07-30 10:39:22 +053042 // IPMI stores the vlan info in 16 bits,32 bits is to aligned
43 // with phosphor-dbus interfaces.
44 // vlan id is in 12 bits and the 16th bit is for enable mask.
45 uint32_t vlanID = ipmi::network::VLAN_ID_MASK;
Patrick Venture585a1e92017-11-17 07:36:15 -080046 uint8_t lan_set_in_progress = SET_COMPLETE;
Ratan Gupta533d03b2017-07-30 10:39:22 +053047
Ratan Guptab8e99552017-07-27 07:07:48 +053048 void clear()
49 {
50 ipaddr.clear();
51 netmask.clear();
52 gateway.clear();
53 macAddress.clear();
Ratan Gupta533d03b2017-07-30 10:39:22 +053054 vlanID = ipmi::network::VLAN_ID_MASK;
Ratan Guptacc6cdbf2017-09-01 23:06:25 +053055 ipsrc = ipmi::network::IPOrigin::UNSPECIFIED;
Patrick Venture585a1e92017-11-17 07:36:15 -080056 lan_set_in_progress = SET_COMPLETE;
Ratan Guptab8e99552017-07-27 07:07:48 +053057 }
Nan Li3d0df912016-10-18 19:51:41 +080058};