More work in netconf cleanup.
This commit is contained in:
parent
9f107dbd4e
commit
b10871cedc
6 changed files with 146 additions and 33 deletions
|
@ -69,6 +69,16 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
MulticastGroup(const char *s)
|
||||
{
|
||||
fromString(s);
|
||||
}
|
||||
|
||||
MulticastGroup(const std::string &s)
|
||||
{
|
||||
fromString(s.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* Derive the multicast group used for address resolution (ARP/NDP) for an IP
|
||||
*
|
||||
|
@ -112,6 +122,24 @@ public:
|
|||
return std::string(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a human-readable multicast group
|
||||
*
|
||||
* @param s Multicast group in hex MAC/ADI format
|
||||
*/
|
||||
inline void fromString(const char *s)
|
||||
{
|
||||
char hex[17];
|
||||
unsigned int hexlen = 0;
|
||||
while ((*s)&&(*s != '/')&&(hexlen < sizeof(hex) - 1))
|
||||
hex[hexlen++] = *s;
|
||||
hex[hexlen] = (char)0;
|
||||
_mac.fromString(hex);
|
||||
if (*s == '/')
|
||||
_adi = (uint32_t)Utils::hexStrToULong(++s);
|
||||
else _adi = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Multicast address
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue