Fix for bug69: set local address correctly upon UDP connect; apply correct UDP connect() semantics (that sendto cannot override addresses on a connected socket); if destination is IPv4 limited broadcast address, convert to subnet-directed broadcast and send out on each interface; provide example csma-broadcast.cc script
This commit is contained in:
1 parent
e8f289a705
commit
97df9062ef
6 files changed
+229
-16
No files matched your search
@@ -99,6 +99,11 @@ Ipv4Mask::SetHostOrder (uint32_t value)
|
||||
{
|
||||
m_mask = value;
|
||||
}
|
||||
uint32_t
|
||||
Ipv4Mask::GetInverse (void) const
|
||||
{
|
||||
return ~m_mask;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4Mask::Print (std::ostream &os) const
|
||||
@@ -162,6 +167,18 @@ Ipv4Address::CombineMask (Ipv4Mask const &mask) const
|
||||
return Ipv4Address (GetHostOrder () & mask.GetHostOrder ());
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4Address::GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const
|
||||
{
|
||||
return Ipv4Address (GetHostOrder () | mask.GetInverse ());
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Address::IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const
|
||||
{
|
||||
return ( (GetHostOrder () | mask.GetInverse ()) == GetHostOrder () );
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Address::IsBroadcast (void) const
|
||||
{
|
||||
|
||||
@@ -119,6 +119,16 @@ public:
|
||||
* \param mask a network mask
|
||||
*/
|
||||
Ipv4Address CombineMask (Ipv4Mask const &mask) const;
|
||||
/**
|
||||
* \brief Generate subnet-directed broadcast address corresponding to mask
|
||||
*
|
||||
* The subnet-directed broadcast address has the host bits set to all
|
||||
* ones.
|
||||
*
|
||||
* \param mask a network mask
|
||||
*/
|
||||
Ipv4Address GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const;
|
||||
bool IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const;
|
||||
|
||||
static bool IsMatchingType (const Address &address);
|
||||
operator Address ();
|
||||
@@ -151,6 +161,10 @@ public:
|
||||
*/
|
||||
uint32_t GetHostOrder (void) const;
|
||||
void SetHostOrder (uint32_t value);
|
||||
/**
|
||||
* \brief Return the inverse mask in host order.
|
||||
*/
|
||||
uint32_t GetInverse (void) const;
|
||||
|
||||
void Print (std::ostream &os) const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user