access to RouterInfo's addresses by index

This commit is contained in:
orignal 2022-12-16 15:12:30 -05:00
parent df737a65b2
commit 84d9c8f1b8
4 changed files with 116 additions and 106 deletions

View file

@ -60,13 +60,25 @@ namespace data
{
public:
enum SupportedTransportsIdx
{
eNTCP2V4Idx = 0,
eNTCP2V6Idx,
eSSU2V4Idx,
eSSU2V6Idx,
eNTCP2V6MeshIdx,
eNumTransports
};
#define TransportBit(tr) e##tr = (1 << e##tr##Idx)
enum SupportedTransports
{
eNTCP2V4 = 0x01,
eNTCP2V6 = 0x02,
eSSU2V4 = 0x04,
eSSU2V6 = 0x08,
eNTCP2V6Mesh = 0x10,
TransportBit(NTCP2V4), // 0x01
TransportBit(NTCP2V6), // 0x02
TransportBit(SSU2V4), // 0x04
TransportBit(SSU2V6), // 0x08
TransportBit(NTCP2V6Mesh), // 0x10
eAllTransports = 0xFF
};
typedef uint8_t CompatibleTransports;
@ -160,7 +172,7 @@ namespace data
Buffer (const uint8_t * buf, size_t len);
};
typedef std::vector<std::shared_ptr<Address> > Addresses;
typedef std::array<std::shared_ptr<Address>, eNumTransports> Addresses;
RouterInfo (const std::string& fullPath);
RouterInfo (const RouterInfo& ) = default;