bug 146: s/HostOrder//
This commit is contained in:
@@ -54,9 +54,9 @@ Ipv4AddressHelper::SetBase (
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
m_network = network.GetHostOrder ();
|
||||
m_mask = mask.GetHostOrder ();
|
||||
m_base = m_address = address.GetHostOrder ();
|
||||
m_network = network.Get ();
|
||||
m_mask = mask.Get ();
|
||||
m_base = m_address = address.Get ();
|
||||
|
||||
//
|
||||
// Some quick reasonableness testing.
|
||||
|
||||
@@ -261,8 +261,8 @@ Ipv4Header::Serialize (Buffer::Iterator start) const
|
||||
i.WriteU8 (m_ttl);
|
||||
i.WriteU8 (m_protocol);
|
||||
i.WriteHtonU16 (0);
|
||||
i.WriteHtonU32 (m_source.GetHostOrder ());
|
||||
i.WriteHtonU32 (m_destination.GetHostOrder ());
|
||||
i.WriteHtonU32 (m_source.Get ());
|
||||
i.WriteHtonU32 (m_destination.Get ());
|
||||
|
||||
if (m_calcChecksum)
|
||||
{
|
||||
@@ -307,8 +307,8 @@ Ipv4Header::Deserialize (Buffer::Iterator start)
|
||||
m_ttl = i.ReadU8 ();
|
||||
m_protocol = i.ReadU8 ();
|
||||
i.Next (2); // checksum
|
||||
m_source.SetHostOrder (i.ReadNtohU32 ());
|
||||
m_destination.SetHostOrder (i.ReadNtohU32 ());
|
||||
m_source.Set (i.ReadNtohU32 ());
|
||||
m_destination.Set (i.ReadNtohU32 ());
|
||||
|
||||
if (m_calcChecksum)
|
||||
{
|
||||
|
||||
@@ -80,8 +80,8 @@ Ipv4Address
|
||||
Ipv4Interface::GetBroadcast (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
uint32_t mask = m_netmask.GetHostOrder ();
|
||||
uint32_t address = m_address.GetHostOrder ();
|
||||
uint32_t mask = m_netmask.Get ();
|
||||
uint32_t address = m_address.Get ();
|
||||
Ipv4Address broadcast = Ipv4Address (address | (~mask));
|
||||
return broadcast;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ns3 {
|
||||
|
||||
void WriteTo (Buffer::Iterator &i, Ipv4Address ad)
|
||||
{
|
||||
i.WriteHtonU32 (ad.GetHostOrder ());
|
||||
i.WriteHtonU32 (ad.Get ());
|
||||
}
|
||||
void WriteTo (Buffer::Iterator &i, const Address &ad)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ void WriteTo (Buffer::Iterator &i, Mac48Address ad)
|
||||
|
||||
void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad)
|
||||
{
|
||||
ad.SetHostOrder (i.ReadNtohU32 ());
|
||||
ad.Set (i.ReadNtohU32 ());
|
||||
}
|
||||
void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len)
|
||||
{
|
||||
|
||||
@@ -137,9 +137,9 @@ Ipv4AddressGeneratorImpl::Init (
|
||||
// We're going to be playing with the actual bits in the network and mask so
|
||||
// pull them out into ints.
|
||||
//
|
||||
uint32_t maskBits __attribute__((unused)) = mask.GetHostOrder ();
|
||||
uint32_t netBits = net.GetHostOrder ();
|
||||
uint32_t addrBits = addr.GetHostOrder ();
|
||||
uint32_t maskBits __attribute__((unused)) = mask.Get ();
|
||||
uint32_t netBits = net.Get ();
|
||||
uint32_t addrBits = addr.Get ();
|
||||
//
|
||||
// Some quick reasonableness testing.
|
||||
//
|
||||
@@ -203,7 +203,7 @@ Ipv4AddressGeneratorImpl::InitAddress (
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
uint32_t index = MaskToIndex (mask);
|
||||
uint32_t addrBits = addr.GetHostOrder ();
|
||||
uint32_t addrBits = addr.Get ();
|
||||
|
||||
NS_ASSERT_MSG (addrBits <= m_netTable[index].addrMax,
|
||||
"Ipv4AddressGeneratorImpl::InitAddress(): Address overflow");
|
||||
@@ -258,7 +258,7 @@ Ipv4AddressGeneratorImpl::AddAllocated (const Ipv4Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
|
||||
uint32_t addr = address.GetHostOrder ();
|
||||
uint32_t addr = address.Get ();
|
||||
|
||||
NS_ASSERT_MSG (addr, "Ipv4AddressGeneratorImpl::Add(): "
|
||||
"Allocating the broadcast address is not a good idea");
|
||||
@@ -367,7 +367,7 @@ Ipv4AddressGeneratorImpl::MaskToIndex (Ipv4Mask mask) const
|
||||
// We use the number of bits in the mask as the number of bits in the network
|
||||
// number and as the index into the network number state table.
|
||||
//
|
||||
uint32_t maskBits = mask.GetHostOrder ();
|
||||
uint32_t maskBits = mask.Get ();
|
||||
|
||||
for (uint32_t i = 0; i < N_BITS; ++i)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ Ipv4Mask::IsEqual (Ipv4Mask other) const
|
||||
bool
|
||||
Ipv4Mask::IsMatch (Ipv4Address a, Ipv4Address b) const
|
||||
{
|
||||
if ((a.GetHostOrder () & m_mask) == (b.GetHostOrder () & m_mask)) {
|
||||
if ((a.Get () & m_mask) == (b.Get () & m_mask)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -89,14 +89,14 @@ Ipv4Mask::IsMatch (Ipv4Address a, Ipv4Address b) const
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4Mask::GetHostOrder (void) const
|
||||
Ipv4Mask::Get (void) const
|
||||
{
|
||||
return m_mask;
|
||||
}
|
||||
void
|
||||
Ipv4Mask::SetHostOrder (uint32_t value)
|
||||
Ipv4Mask::Set (uint32_t mask)
|
||||
{
|
||||
m_mask = value;
|
||||
m_mask = mask;
|
||||
}
|
||||
uint32_t
|
||||
Ipv4Mask::GetInverse (void) const
|
||||
@@ -139,6 +139,11 @@ Ipv4Address::Ipv4Address (char const *address)
|
||||
m_address = AsciiToIpv4Host (address);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4Address::Get (void) const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
void
|
||||
Ipv4Address::Set (uint32_t address)
|
||||
{
|
||||
@@ -153,19 +158,19 @@ Ipv4Address::Set (char const *address)
|
||||
Ipv4Address
|
||||
Ipv4Address::CombineMask (Ipv4Mask const &mask) const
|
||||
{
|
||||
return Ipv4Address (GetHostOrder () & mask.GetHostOrder ());
|
||||
return Ipv4Address (Get () & mask.Get ());
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4Address::GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const
|
||||
{
|
||||
return Ipv4Address (GetHostOrder () | mask.GetInverse ());
|
||||
return Ipv4Address (Get () | mask.GetInverse ());
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Address::IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const
|
||||
{
|
||||
return ( (GetHostOrder () | mask.GetInverse ()) == GetHostOrder () );
|
||||
return ( (Get () | mask.GetInverse ()) == Get () );
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -184,16 +189,6 @@ Ipv4Address::IsMulticast (void) const
|
||||
return (m_address >= 0xe0000000 && m_address <= 0xefffffff);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Ipv4Address::GetHostOrder (void) const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
void
|
||||
Ipv4Address::SetHostOrder (uint32_t ip)
|
||||
{
|
||||
m_address = ip;
|
||||
}
|
||||
void
|
||||
Ipv4Address::Serialize (uint8_t buf[4]) const
|
||||
{
|
||||
@@ -287,7 +282,7 @@ Ipv4Address::GetLoopback (void)
|
||||
|
||||
size_t Ipv4AddressHash::operator()(Ipv4Address const &x) const
|
||||
{
|
||||
return x.GetHostOrder ();
|
||||
return x.Get ();
|
||||
}
|
||||
|
||||
std::ostream& operator<< (std::ostream& os, Ipv4Address const& address)
|
||||
|
||||
@@ -51,7 +51,11 @@ public:
|
||||
* \param address C-string containing the address as described above
|
||||
*/
|
||||
Ipv4Address (char const *address);
|
||||
|
||||
/**
|
||||
* Get the host-order 32-bit IP address
|
||||
* \return the host-order 32-bit IP address
|
||||
*/
|
||||
uint32_t Get (void) const;
|
||||
/**
|
||||
* input address is in host order.
|
||||
* \param address The host order 32-bit address
|
||||
@@ -67,7 +71,6 @@ public:
|
||||
* \param address C-string containing the address as described above
|
||||
*/
|
||||
void Set (char const *address);
|
||||
|
||||
/**
|
||||
* \brief Comparison operation between two Ipv4Addresses
|
||||
* \param other address to which to compare this address
|
||||
@@ -77,17 +80,6 @@ public:
|
||||
{
|
||||
return m_address == other.m_address;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the host-order 32-bit IP address
|
||||
*
|
||||
* Using this method is frowned upon.
|
||||
* Please, do _not_ use this method.
|
||||
* It is there only for chunk-ipv4.
|
||||
* \return the host-order 32-bit IP address
|
||||
*/
|
||||
uint32_t GetHostOrder (void) const;
|
||||
void SetHostOrder (uint32_t ip);
|
||||
/**
|
||||
* Serialize this address to a 4-byte buffer
|
||||
*
|
||||
@@ -162,13 +154,16 @@ public:
|
||||
bool IsMatch (Ipv4Address a, Ipv4Address b) const;
|
||||
|
||||
bool IsEqual (Ipv4Mask other) const;
|
||||
|
||||
|
||||
/* Using this method is frowned upon.
|
||||
* Please, do _not_ use this method.
|
||||
/**
|
||||
* Get the host-order 32-bit IP mask
|
||||
* \return the host-order 32-bit IP mask
|
||||
*/
|
||||
uint32_t GetHostOrder (void) const;
|
||||
void SetHostOrder (uint32_t value);
|
||||
uint32_t Get (void) const;
|
||||
/**
|
||||
* input mask is in host order.
|
||||
* \param mask The host order 32-bit mask
|
||||
*/
|
||||
void Set (uint32_t mask);
|
||||
/**
|
||||
* \brief Return the inverse mask in host order.
|
||||
*/
|
||||
|
||||
@@ -584,7 +584,7 @@ GlobalRouter::DiscoverLSAs (void)
|
||||
plr->SetLinkId (addrLocal.CombineMask(maskLocal));
|
||||
// Link Data is network mask; convert to Ipv4Address
|
||||
Ipv4Address maskLocalAddr;
|
||||
maskLocalAddr.Set(maskLocal.GetHostOrder ());
|
||||
maskLocalAddr.Set(maskLocal.Get ());
|
||||
plr->SetLinkData (maskLocalAddr);
|
||||
plr->SetMetric (metricLocal);
|
||||
pLSA->AddLinkRecord(plr);
|
||||
@@ -689,7 +689,7 @@ GlobalRouter::DiscoverLSAs (void)
|
||||
plr = new GlobalRoutingLinkRecord;
|
||||
plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork);
|
||||
plr->SetLinkId (addrRemote);
|
||||
plr->SetLinkData (Ipv4Address(maskRemote.GetHostOrder())); // Frown
|
||||
plr->SetLinkData (Ipv4Address(maskRemote.Get())); // Frown
|
||||
plr->SetMetric (metricLocal);
|
||||
pLSA->AddLinkRecord (plr);
|
||||
plr = 0;
|
||||
|
||||
@@ -211,7 +211,7 @@ MessageHeader::Serialize (Buffer::Iterator start) const
|
||||
i.WriteU8 (m_messageType);
|
||||
i.WriteU8 (m_vTime);
|
||||
i.WriteHtonU16 (GetSerializedSize ());
|
||||
i.WriteHtonU32 (m_originatorAddress.GetHostOrder ());
|
||||
i.WriteHtonU32 (m_originatorAddress.Get ());
|
||||
i.WriteU8 (m_timeToLive);
|
||||
i.WriteU8 (m_hopCount);
|
||||
i.WriteHtonU16 (m_messageSequenceNumber);
|
||||
@@ -293,7 +293,7 @@ MessageHeader::Mid::Serialize (Buffer::Iterator start) const
|
||||
for (std::vector<Ipv4Address>::const_iterator iter = this->interfaceAddresses.begin ();
|
||||
iter != this->interfaceAddresses.end (); iter++)
|
||||
{
|
||||
i.WriteHtonU32 (iter->GetHostOrder ());
|
||||
i.WriteHtonU32 (iter->Get ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ MessageHeader::Hello::Serialize (Buffer::Iterator start) const
|
||||
for (std::vector<Ipv4Address>::const_iterator neigh_iter = lm.neighborInterfaceAddresses.begin ();
|
||||
neigh_iter != lm.neighborInterfaceAddresses.end (); neigh_iter++)
|
||||
{
|
||||
i.WriteHtonU32 (neigh_iter->GetHostOrder ());
|
||||
i.WriteHtonU32 (neigh_iter->Get ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ MessageHeader::Tc::Serialize (Buffer::Iterator start) const
|
||||
for (std::vector<Ipv4Address>::const_iterator iter = this->neighborAddresses.begin ();
|
||||
iter != this->neighborAddresses.end (); iter++)
|
||||
{
|
||||
i.WriteHtonU32 (iter->GetHostOrder ());
|
||||
i.WriteHtonU32 (iter->Get ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,8 +478,8 @@ MessageHeader::Hna::Serialize (Buffer::Iterator start) const
|
||||
|
||||
for (size_t n = 0; n < this->associations.size (); ++n)
|
||||
{
|
||||
i.WriteHtonU32 (this->associations[n].address.GetHostOrder ());
|
||||
i.WriteHtonU32 (this->associations[n].mask.GetHostOrder ());
|
||||
i.WriteHtonU32 (this->associations[n].address.Get ());
|
||||
i.WriteHtonU32 (this->associations[n].mask.Get ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user