ns-3-click support for AddressInfo elements
This commit is contained in:
@@ -223,6 +223,15 @@ Ipv4ClickRouting::GetIpAddressFromInterfaceId (int ifid)
|
||||
return addr.str ();
|
||||
}
|
||||
|
||||
std::string
|
||||
Ipv4ClickRouting::GetIpPrefixFromInterfaceId (int ifid)
|
||||
{
|
||||
std::stringstream addr;
|
||||
m_ipv4->GetAddress (ifid, 0).GetMask ().Print (addr);
|
||||
|
||||
return addr.str ();
|
||||
}
|
||||
|
||||
std::string
|
||||
Ipv4ClickRouting::GetMacAddressFromInterfaceId (int ifid)
|
||||
{
|
||||
@@ -583,6 +592,27 @@ int simclick_sim_command (simclick_node_t *simnode, int cmd, ...)
|
||||
break;
|
||||
}
|
||||
|
||||
case SIMCLICK_IPPREFIX_FROM_NAME:
|
||||
{
|
||||
const char *ifname = va_arg (val, const char *);
|
||||
char *buf = va_arg (val, char *);
|
||||
int len = va_arg (val, int);
|
||||
|
||||
int ifid = clickInstance->GetInterfaceId (ifname);
|
||||
|
||||
if (ifid >= 0)
|
||||
{
|
||||
retval = simstrlcpy (buf, len, clickInstance->GetIpPrefixFromInterfaceId (ifid));
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
NS_LOG_DEBUG (clickInstance->GetNodeName () << " SIMCLICK_IPPREFIX_FROM_NAME: " << ifname << " " << buf << " " << len);
|
||||
break;
|
||||
}
|
||||
|
||||
case SIMCLICK_MACADDR_FROM_NAME:
|
||||
{
|
||||
const char *ifname = va_arg (val, const char *);
|
||||
|
||||
@@ -142,6 +142,13 @@ public:
|
||||
*/
|
||||
std::string GetIpAddressFromInterfaceId (int ifid);
|
||||
|
||||
/**
|
||||
* \brief Provides for SIMCLICK_IPPREFIX_FROM_NAME
|
||||
* \param ifid The interface ID for which the IP Prefix is required
|
||||
* \return The IP Prefix of the interface in string format
|
||||
*/
|
||||
std::string GetIpPrefixFromInterfaceId (int ifid);
|
||||
|
||||
/**
|
||||
* \brief Provides for SIMCLICK_MACADDR_FROM_NAME
|
||||
* \param ifid The interface ID for which the MAC Address is required
|
||||
|
||||
Reference in New Issue
Block a user