pull/61/head
Kurt Wachowski 2023-08-02 13:52:52 +00:00
parent 237bed1b72
commit 41d6927496
1 changed files with 496 additions and 287 deletions

View File

@ -2,6 +2,7 @@
#define __NETWORKID_H_ #define __NETWORKID_H_
#include <stdint.h> #include <stdint.h>
typedef uint16_t neonetid_t; typedef uint16_t neonetid_t;
typedef uint8_t neonettype_t; typedef uint8_t neonettype_t;
@ -12,258 +13,265 @@ typedef uint8_t neonettype_t;
namespace icsneo { namespace icsneo {
class Network { class Network {
public: static constexpr uint16_t OFFSET_PLASMA_SLAVE1 = 100;
enum class NetID : neonetid_t { static constexpr uint16_t OFFSET_PLASMA_SLAVE2 = 200;
Device = 0, static constexpr uint16_t COUNT_PLASMA_SLAVE = 51;
HSCAN = 1, static constexpr uint16_t OFFSET_PLASMA_SLAVE1_RANGE2 = 4608;
MSCAN = 2, static constexpr uint16_t OFFSET_PLASMA_SLAVE2_RANGE2 = 8704;
SWCAN = 3, static constexpr uint16_t OFFSET_PLASMA_SLAVE3_RANGE2 = 12800;
LSFTCAN = 4,
FordSCP = 5,
J1708 = 6,
Aux = 7,
J1850VPW = 8,
ISO9141 = 9,
ISOPIC = 10,
Main51 = 11,
RED = 12,
SCI = 13,
ISO9141_2 = 14,
ISO14230 = 15,
LIN = 16,
OP_Ethernet1 = 17,
OP_Ethernet2 = 18,
OP_Ethernet3 = 19,
// START Device Command Returns public:
// When we send a command, the device returns on one of these, depending on command enum class NetID : neonetid_t {
RED_EXT_MEMORYREAD = 20, Device = 0,
RED_INT_MEMORYREAD = 21, HSCAN = 1,
RED_DFLASH_READ = 22, MSCAN = 2,
NeoMemorySDRead = 23, // Response from NeoMemory (MemoryTypeSD) SWCAN = 3,
CAN_ERRBITS = 24, LSFTCAN = 4,
NeoMemoryWriteDone = 25, FordSCP = 5,
RED_WAVE_CAN1_LOGICAL = 26, J1708 = 6,
RED_WAVE_CAN2_LOGICAL = 27, Aux = 7,
RED_WAVE_LIN1_LOGICAL = 28, J1850VPW = 8,
RED_WAVE_LIN2_LOGICAL = 29, ISO9141 = 9,
RED_WAVE_LIN1_ANALOG = 30, ISOPIC = 10,
RED_WAVE_LIN2_ANALOG = 31, Main51 = 11,
RED_WAVE_MISC_ANALOG = 32, RED = 12,
RED_WAVE_MISCDIO2_LOGICAL = 33, SCI = 13,
RED_NETWORK_COM_ENABLE_EX = 34, ISO9141_2 = 14,
RED_NEOVI_NETWORK = 35, ISO14230 = 15,
RED_READ_BAUD_SETTINGS = 36, LIN = 16,
RED_OLDFORMAT = 37, OP_Ethernet1 = 17,
RED_SCOPE_CAPTURE = 38, OP_Ethernet2 = 18,
RED_HARDWARE_EXCEP = 39, OP_Ethernet3 = 19,
RED_GET_RTC = 40,
// END Device Command Returns
ISO9141_3 = 41, // START Device Command Returns
HSCAN2 = 42, // When we send a command, the device returns on one of these, depending on command
HSCAN3 = 44, RED_EXT_MEMORYREAD = 20,
OP_Ethernet4 = 45, RED_INT_MEMORYREAD = 21,
OP_Ethernet5 = 46, RED_DFLASH_READ = 22,
ISO9141_4 = 47, NeoMemorySDRead = 23, // Response from NeoMemory (MemoryTypeSD)
LIN2 = 48, CAN_ERRBITS = 24,
LIN3 = 49, NeoMemoryWriteDone = 25,
LIN4 = 50, RED_WAVE_CAN1_LOGICAL = 26,
// MOST = 51, Old and unused RED_WAVE_CAN2_LOGICAL = 27,
RED_App_Error = 52, RED_WAVE_LIN1_LOGICAL = 28,
CGI = 53, RED_WAVE_LIN2_LOGICAL = 29,
Reset_Status = 54, RED_WAVE_LIN1_ANALOG = 30,
FB_Status = 55, RED_WAVE_LIN2_ANALOG = 31,
App_Signal_Status = 56, RED_WAVE_MISC_ANALOG = 32,
Read_Datalink_Cm_Tx_Msg = 57, RED_WAVE_MISCDIO2_LOGICAL = 33,
Read_Datalink_Cm_Rx_Msg = 58, RED_NETWORK_COM_ENABLE_EX = 34,
Logging_Overflow = 59, RED_NEOVI_NETWORK = 35,
ReadSettings = 60, RED_READ_BAUD_SETTINGS = 36,
HSCAN4 = 61, RED_OLDFORMAT = 37,
HSCAN5 = 62, RED_SCOPE_CAPTURE = 38,
RS232 = 63, RED_HARDWARE_EXCEP = 39,
UART = 64, RED_GET_RTC = 40,
UART2 = 65, // END Device Command Returns
UART3 = 66,
UART4 = 67, ISO9141_3 = 41,
SWCAN2 = 68, HSCAN2 = 42,
Ethernet_DAQ = 69, HSCAN3 = 44,
Data_To_Host = 70, OP_Ethernet4 = 45,
TextAPI_To_Host = 71, OP_Ethernet5 = 46,
SPI1 = 72, ISO9141_4 = 47,
OP_Ethernet6 = 73, LIN2 = 48,
Red_VBat = 74, LIN3 = 49,
OP_Ethernet7 = 75, LIN4 = 50,
OP_Ethernet8 = 76, // MOST = 51, Old and unused
OP_Ethernet9 = 77, RED_App_Error = 52,
OP_Ethernet10 = 78, CGI = 53,
OP_Ethernet11 = 79, Reset_Status = 54,
FlexRay1a = 80, FB_Status = 55,
FlexRay1b = 81, App_Signal_Status = 56,
FlexRay2a = 82, Read_Datalink_Cm_Tx_Msg = 57,
FlexRay2b = 83, Read_Datalink_Cm_Rx_Msg = 58,
LIN5 = 84, Logging_Overflow = 59,
FlexRay = 85, ReadSettings = 60,
FlexRay2 = 86, HSCAN4 = 61,
OP_Ethernet12 = 87, HSCAN5 = 62,
I2C = 88, RS232 = 63,
MOST25 = 90, UART = 64,
MOST50 = 91, UART2 = 65,
MOST150 = 92, UART3 = 66,
Ethernet = 93, UART4 = 67,
GMFSA = 94, SWCAN2 = 68,
TCP = 95, Ethernet_DAQ = 69,
HSCAN6 = 96, Data_To_Host = 70,
HSCAN7 = 97, TextAPI_To_Host = 71,
LIN6 = 98, SPI1 = 72,
LSFTCAN2 = 99, OP_Ethernet6 = 73,
LogicalDiskInfo = 187, Red_VBat = 74,
WiVICommand = 221, OP_Ethernet7 = 75,
ScriptStatus = 224, OP_Ethernet8 = 76,
EthPHYControl = 239, OP_Ethernet9 = 77,
ExtendedCommand = 240, OP_Ethernet10 = 78,
ExtendedData = 242, OP_Ethernet11 = 79,
FlexRayControl = 243, FlexRay1a = 80,
CoreMiniPreLoad = 244, FlexRay1b = 81,
HW_COM_Latency_Test = 512, FlexRay2a = 82,
DeviceStatus = 513, FlexRay2b = 83,
UDP = 514, LIN5 = 84,
ForwardedMessage = 516, FlexRay = 85,
I2C2 = 517, FlexRay2 = 86,
I2C3 = 518, OP_Ethernet12 = 87,
I2C4 = 519, I2C = 88,
Ethernet2 = 520, MOST25 = 90,
A2B1 = 522, MOST50 = 91,
A2B2 = 523, MOST150 = 92,
Ethernet3 = 524, Ethernet = 93,
WBMS = 532, GMFSA = 94,
DWCAN9 = 534, TCP = 95,
DWCAN10 = 535, HSCAN6 = 96,
DWCAN11 = 536, HSCAN7 = 97,
DWCAN12 = 537, LIN6 = 98,
DWCAN13 = 538, LSFTCAN2 = 99,
DWCAN14 = 539, LogicalDiskInfo = 187,
DWCAN15 = 540, WiVICommand = 221,
DWCAN16 = 541, ScriptStatus = 224,
LIN7 = 542, EthPHYControl = 239,
LIN8 = 543, ExtendedCommand = 240,
SPI2 = 544, ExtendedData = 242,
MDIO1 = 545, FlexRayControl = 243,
MDIO2 = 546, CoreMiniPreLoad = 244,
MDIO3 = 547, HW_COM_Latency_Test = 512,
MDIO4 = 548, DeviceStatus = 513,
MDIO5 = 549, UDP = 514,
MDIO6 = 550, ForwardedMessage = 516,
MDIO7 = 551, I2C2 = 517,
MDIO8 = 552, I2C3 = 518,
Any = 0xfffe, // Never actually set as type, but used as flag for filtering I2C4 = 519,
Invalid = 0xffff Ethernet2 = 520,
}; A2B1 = 522,
enum class Type : neonettype_t { A2B2 = 523,
Invalid = 0, Ethernet3 = 524,
Internal = 1, // Used for statuses that don't actually need to be transferred to the client application WBMS = 532,
CAN = 2, DWCAN9 = 534,
LIN = 3, DWCAN10 = 535,
FlexRay = 4, DWCAN11 = 536,
MOST = 5, DWCAN12 = 537,
Ethernet = 6, DWCAN13 = 538,
LSFTCAN = 7, DWCAN14 = 539,
SWCAN = 8, DWCAN15 = 540,
ISO9141 = 9, DWCAN16 = 541,
I2C = 10, LIN7 = 542,
A2B = 11, LIN8 = 543,
SPI = 12, SPI2 = 544,
MDIO = 13, MDIO1 = 545,
Any = 0xFE, // Never actually set as type, but used as flag for filtering MDIO2 = 546,
Other = 0xFF MDIO3 = 547,
}; MDIO4 = 548,
enum class CoreMini : uint8_t { MDIO5 = 549,
HSCAN = 0, MDIO6 = 550,
MSCAN = 1, MDIO7 = 551,
LIN = 2, MDIO8 = 552,
LIN2 = 3, Any = 0xfffe, // Never actually set as type, but used as flag for filtering
Virtual = 4, Invalid = 0xffff
HSCAN2 = 5, };
LSFTCAN = 6, enum class Type : neonettype_t {
SWCAN = 7, Invalid = 0,
HSCAN3 = 8, Internal = 1, // Used for statuses that don't actually need to be transferred to the client application
CGI = 9, CAN = 2,
J1850VPW = 10, LIN = 3,
LIN3 = 11, FlexRay = 4,
LIN4 = 12, MOST = 5,
J1708 = 13, Ethernet = 6,
HSCAN4 = 14, LSFTCAN = 7,
HSCAN5 = 15, SWCAN = 8,
KLine1 = 16, ISO9141 = 9,
KLine2 = 17, I2C = 10,
KLine3 = 18, A2B = 11,
KLine4 = 19, SPI = 12,
FlexRay1a = 20, MDIO = 13,
UART = 21, Any = 0xFE, // Never actually set as type, but used as flag for filtering
UART2 = 22, Other = 0xFF
LIN5 = 23, };
MOST25 = 24, enum class CoreMini : uint8_t {
MOST50 = 25, HSCAN = 0,
FlexRay1b = 26, MSCAN = 1,
SWCAN2 = 27, LIN = 2,
EthernetDAQ = 28, LIN2 = 3,
Ethernet = 29, Virtual = 4,
FlexRay2a = 30, HSCAN2 = 5,
FlexRay2b = 31, LSFTCAN = 6,
HSCAN6 = 32, SWCAN = 7,
HSCAN7 = 33, HSCAN3 = 8,
LIN6 = 34, CGI = 9,
LSFTCAN2 = 35, J1850VPW = 10,
OP_Ethernet1 = 36, LIN3 = 11,
OP_Ethernet2 = 37, LIN4 = 12,
OP_Ethernet3 = 38, J1708 = 13,
OP_Ethernet4 = 39, HSCAN4 = 14,
OP_Ethernet5 = 40, HSCAN5 = 15,
OP_Ethernet6 = 41, KLine1 = 16,
OP_Ethernet7 = 42, KLine2 = 17,
OP_Ethernet8 = 43, KLine3 = 18,
OP_Ethernet9 = 44, KLine4 = 19,
OP_Ethernet10 = 45, FlexRay1a = 20,
OP_Ethernet11 = 46, UART = 21,
OP_Ethernet12 = 47, UART2 = 22,
TCPVirtual = 48, LIN5 = 23,
UDPVirtual = 49, MOST25 = 24,
FlexRay1 = 50, MOST50 = 25,
FlexRay2 = 51, FlexRay1b = 26,
ForwardedMessage = 52, SWCAN2 = 27,
I2C1 = 53, EthernetDAQ = 28,
I2C2 = 54, Ethernet = 29,
I2C3 = 55, FlexRay2a = 30,
I2C4 = 56, FlexRay2b = 31,
Ethernet2 = 57, HSCAN6 = 32,
A2B1 = 58, HSCAN7 = 33,
A2B2 = 59, LIN6 = 34,
Ethernet3 = 60, LSFTCAN2 = 35,
WBMS = 61, OP_Ethernet1 = 36,
DWCAN9 = 62, OP_Ethernet2 = 37,
DWCAN10 = 63, OP_Ethernet3 = 38,
DWCAN11 = 64, OP_Ethernet4 = 39,
DWCAN12 = 65, OP_Ethernet5 = 40,
DWCAN13 = 66, OP_Ethernet6 = 41,
DWCAN14 = 67, OP_Ethernet7 = 42,
DWCAN15 = 68, OP_Ethernet8 = 43,
DWCAN16 = 69, OP_Ethernet9 = 44,
LIN7 = 70, OP_Ethernet10 = 45,
LIN8 = 71, OP_Ethernet11 = 46,
SPI1 = 72, OP_Ethernet12 = 47,
SPI2 = 73, TCPVirtual = 48,
MDIO1 = 75, UDPVirtual = 49,
MDIO2 = 76, FlexRay1 = 50,
MDIO3 = 77, FlexRay2 = 51,
MDIO4 = 78, ForwardedMessage = 52,
MDIO5 = 79, I2C1 = 53,
MDIO6 = 80, I2C2 = 54,
MDIO7 = 81, I2C3 = 55,
MDIO8 = 82, I2C4 = 56,
}; Ethernet2 = 57,
static const char* GetTypeString(Type type) { A2B1 = 58,
switch(type) { A2B2 = 59,
Ethernet3 = 60,
WBMS = 61,
DWCAN9 = 62,
DWCAN10 = 63,
DWCAN11 = 64,
DWCAN12 = 65,
DWCAN13 = 66,
DWCAN14 = 67,
DWCAN15 = 68,
DWCAN16 = 69,
LIN7 = 70,
LIN8 = 71,
SPI1 = 72,
SPI2 = 73,
MDIO1 = 75,
MDIO2 = 76,
MDIO3 = 77,
MDIO4 = 78,
MDIO5 = 79,
MDIO6 = 80,
MDIO7 = 81,
MDIO8 = 82,
};
static const char* GetTypeString(Type type) {
switch (type) {
case Type::CAN: case Type::CAN:
return "CAN"; return "CAN";
case Type::LIN: case Type::LIN:
@ -295,10 +303,202 @@ public:
case Type::Invalid: case Type::Invalid:
default: default:
return "Invalid Type"; return "Invalid Type";
}
} }
}
static Type GetTypeOfNetID(NetID netid) { enum class VnetId : uint8_t {
switch(netid) { None = 0,
VNET_A = 1,
VNET_B = 2,
};
/**
* So if you are passing in the offset from OFFSET_PLASMA_SLAVE1 or
* the offset from OFFSET_PLASMA_SLAVE2, return the vnet agnostic
* netid so caller can commonize handlers without caring about WHICH slave.
*/
static NetID OffsetToSimpleNetworkId(uint16_t offset)
{
switch (offset)
{
default:
case 0:
return NetID::Device;
case 1:
return NetID::HSCAN;
case 2:
return NetID::MSCAN;
case 3:
return NetID::SWCAN;
case 4:
return NetID::LSFTCAN;
case 5:
return NetID::FordSCP;
case 6:
return NetID::J1708;
case 7:
return NetID::Aux;
case 8:
return NetID::J1850VPW;
case 9:
return NetID::ISO9141;
case 10:
return NetID::ISOPIC;
case 11:
return NetID::Main51;
case 12:
return NetID::RED;
case 13:
return NetID::SCI;
case 14:
return NetID::ISO9141_2;
case 15:
return NetID::ISO14230;
case 16:
return NetID::LIN;
case 17:
return NetID::ISO9141_3;
case 18:
return NetID::HSCAN2;
case 19:
return NetID::HSCAN3;
case 20:
return NetID::ISO9141_4;
case 21:
return NetID::LIN2;
case 22:
return NetID::LIN3;
case 23:
return NetID::LIN4;
//case 24:
// return NetID::MOST; // Deprecated
case 25:
return NetID::CGI;
case 26:
return NetID::I2C;
case 27:
return NetID::SPI1;
case 28:
return NetID::FlexRay1a;
case 29:
return NetID::MOST25;
case 30:
return NetID::MOST50;
case 31:
return NetID::MOST150;
case 32:
return NetID::HSCAN4;
case 33:
return NetID::HSCAN5;
case 34:
return NetID::RS232;
case 35:
return NetID::UART;
case 36:
return NetID::UART2;
case 37:
return NetID::UART3;
case 38:
return NetID::UART4;
case 39:
return NetID::SWCAN2;
case 40:
return NetID::FlexRay1b;
case 41:
return NetID::FlexRay2a;
case 42:
return NetID::FlexRay2b;
case 43:
return NetID::LIN5;
case 44:
return NetID::Ethernet;
case 45:
return NetID::Ethernet_DAQ;
case 46:
return NetID::RED_App_Error;
case 47:
return NetID::HSCAN6;
case 48:
return NetID::HSCAN7;
case 49:
return NetID::LIN6;
case 50:
return NetID::LSFTCAN2;
}
}
static bool Within(neonetid_t value, neonetid_t min, neonetid_t max)
{
return ((min <= value) && (value < max));
}
static bool IdIsSlaveARange1(neonetid_t fullNetid)
{
return Within(fullNetid, OFFSET_PLASMA_SLAVE1, OFFSET_PLASMA_SLAVE1 + COUNT_PLASMA_SLAVE);
}
static bool IdIsSlaveARange2(neonetid_t fullNetid)
{
return Within(fullNetid, OFFSET_PLASMA_SLAVE1_RANGE2, OFFSET_PLASMA_SLAVE2_RANGE2);
}
static bool IdIsSlaveBRange1(neonetid_t fullNetid)
{
return Within(fullNetid, OFFSET_PLASMA_SLAVE2, OFFSET_PLASMA_SLAVE2 + COUNT_PLASMA_SLAVE);
}
static bool IdIsSlaveBRange2(neonetid_t fullNetid)
{
return Within(fullNetid, OFFSET_PLASMA_SLAVE2_RANGE2, OFFSET_PLASMA_SLAVE3_RANGE2);
}
static std::pair<VnetId, NetID> GetVnetAgnosticNetid(neonetid_t fullNetid)
{
VnetId vnetId = VnetId::None;
NetID netId;
if (fullNetid < OFFSET_PLASMA_SLAVE1)
{
netId = static_cast<NetID>(fullNetid);
}
else if (IdIsSlaveARange1(fullNetid))
{
netId = OffsetToSimpleNetworkId(fullNetid - OFFSET_PLASMA_SLAVE1);
vnetId = VnetId::VNET_A;
}
else if (IdIsSlaveARange2(fullNetid))
{
netId = static_cast<NetID>((fullNetid - OFFSET_PLASMA_SLAVE1_RANGE2));
vnetId = VnetId::VNET_A;
}
else if (IdIsSlaveBRange1(fullNetid))
{
netId = OffsetToSimpleNetworkId(fullNetid - OFFSET_PLASMA_SLAVE2);
vnetId = VnetId::VNET_B;
}
else if (IdIsSlaveBRange2(fullNetid))
{
netId = static_cast<NetID>((fullNetid - OFFSET_PLASMA_SLAVE2_RANGE2));
vnetId = VnetId::VNET_B;
}
else
{
netId = static_cast<NetID>(fullNetid);
}
return std::make_pair(vnetId, netId);
}
static const char* GetVnetIdString(VnetId vnetId)
{
switch (vnetId)
{
case VnetId::None:
return "None";
case VnetId::VNET_A:
return "VNET A";
case VnetId::VNET_B:
return "VNET B";
}
return "Invalid VNET ID";
}
static Type GetTypeOfNetID(NetID netid) {
const auto [vnetId, commonNetId] = GetVnetAgnosticNetid((neonetid_t)netid);
(void)vnetId;
switch (commonNetId) {
case NetID::HSCAN: case NetID::HSCAN:
case NetID::MSCAN: case NetID::MSCAN:
case NetID::HSCAN2: case NetID::HSCAN2:
@ -408,10 +608,13 @@ public:
return Type::MDIO; return Type::MDIO;
default: default:
return Type::Other; return Type::Other;
}
} }
} static const char* GetNetIDString(NetID netid) {
static const char* GetNetIDString(NetID netid) { const auto [vnetId, commonNetId] = GetVnetAgnosticNetid((neonetid_t)netid);
switch(netid) { (void)vnetId;
switch (commonNetId) {
case NetID::Device: case NetID::Device:
return "neoVI"; return "neoVI";
case NetID::HSCAN: case NetID::HSCAN:
@ -687,11 +890,11 @@ public:
case NetID::Any: case NetID::Any:
case NetID::Invalid: case NetID::Invalid:
break; break;
}
return "Invalid Network";
} }
return "Invalid Network"; static std::optional<CoreMini> GetCoreMiniNetworkFromNetID(NetID netid) {
} switch (netid) {
static std::optional<CoreMini> GetCoreMiniNetworkFromNetID(NetID netid) {
switch(netid) {
case NetID::HSCAN: case NetID::HSCAN:
return CoreMini::HSCAN; return CoreMini::HSCAN;
case NetID::MSCAN: case NetID::MSCAN:
@ -858,10 +1061,10 @@ public:
return CoreMini::MDIO8; return CoreMini::MDIO8;
default: default:
return std::nullopt; return std::nullopt;
}
} }
} static NetID GetNetIDFromCoreMiniNetwork(CoreMini cm) {
static NetID GetNetIDFromCoreMiniNetwork(CoreMini cm) { switch (cm) {
switch(cm) {
case CoreMini::HSCAN: case CoreMini::HSCAN:
return NetID::HSCAN; return NetID::HSCAN;
case CoreMini::MSCAN: case CoreMini::MSCAN:
@ -1026,33 +1229,39 @@ public:
return NetID::MDIO7; return NetID::MDIO7;
case CoreMini::MDIO8: case CoreMini::MDIO8:
return NetID::MDIO8; return NetID::MDIO8;
}
return NetID::Invalid; // Should be unreachable, the compiler should warn about new CoreMini IDs
} }
return NetID::Invalid; // Should be unreachable, the compiler should warn about new CoreMini IDs
}
Network() { setValue(NetID::Invalid); } Network() { setValue(NetID::Invalid); }
Network(neonetid_t netid) { setValue((NetID)netid); } Network(neonetid_t netid) { setValue(static_cast<NetID>(netid)); }
Network(NetID netid) { setValue(netid); } Network(NetID netid) { setValue(netid); }
Network(CoreMini cm) { setValue(GetNetIDFromCoreMiniNetwork(cm)); } Network(CoreMini cm) { setValue(GetNetIDFromCoreMiniNetwork(cm)); }
NetID getNetID() const { return value; } NetID getNetID() const { return value; }
Type getType() const { return type; } Type getType() const { return type; }
std::optional<CoreMini> getCoreMini() const { return GetCoreMiniNetworkFromNetID(getNetID()); } VnetId getVnetId() const { return vnetId; }
friend std::ostream& operator<<(std::ostream& os, const Network& network) { std::optional<CoreMini> getCoreMini() const { return GetCoreMiniNetworkFromNetID(getNetID()); }
os << GetNetIDString(network.getNetID()); friend std::ostream& operator<<(std::ostream& os, const Network& network) {
return os; os << GetNetIDString(network.getNetID());
} return os;
friend bool operator==(const Network& net1, const Network& net2) { return net1.getNetID() == net2.getNetID(); } }
friend bool operator!=(const Network& net1, const Network& net2) { return !(net1 == net2); } friend bool operator==(const Network& net1, const Network& net2) { return net1.getNetID() == net2.getNetID(); }
friend bool operator!=(const Network& net1, const Network& net2) { return !(net1 == net2); }
private: private:
NetID value; // Always use setValue so that value and type stay in sync NetID value; // Always use setValue so that value and type stay in sync
Type type; Type type;
void setValue(NetID id) { NetID commonNetId;
value = id; VnetId vnetId;
type = GetTypeOfNetID(value); void setValue(NetID id) {
} value = id;
}; type = GetTypeOfNetID(value);
const auto vnetIdInfo = GetVnetAgnosticNetid((neonetid_t)id);
vnetId = vnetIdInfo.first;
commonNetId = vnetIdInfo.second;
}
};
} }