ns-3
|
Ipv4 addresses are stored in host order in this class. More...
#include <ipv4-address.h>
Public Member Functions | |
Ipv4Address (uint32_t address) | |
Ipv4Address (char const *address) | |
Constructs an Ipv4Address by parsing a the input C-string. | |
uint32_t | Get (void) const |
void | Set (uint32_t address) |
void | Set (char const *address) |
Sets an Ipv4Address by parsing a the input C-string. | |
bool | IsEqual (const Ipv4Address &other) const |
Comparison operation between two Ipv4Addresses. | |
void | Serialize (uint8_t buf[4]) const |
void | Print (std::ostream &os) const |
Print this address to the given output stream. | |
bool | IsBroadcast (void) const |
bool | IsMulticast (void) const |
bool | IsLocalMulticast (void) const |
Ipv4Address | CombineMask (Ipv4Mask const &mask) const |
Combine this address with a network mask. | |
Ipv4Address | GetSubnetDirectedBroadcast (Ipv4Mask const &mask) const |
Generate subnet-directed broadcast address corresponding to mask. | |
bool | IsSubnetDirectedBroadcast (Ipv4Mask const &mask) const |
Generate subnet-directed broadcast address corresponding to mask. | |
operator Address () const |
Static Public Member Functions | |
static Ipv4Address | Deserialize (const uint8_t buf[4]) |
static bool | IsMatchingType (const Address &address) |
static Ipv4Address | ConvertFrom (const Address &address) |
static Ipv4Address | GetZero (void) |
static Ipv4Address | GetAny (void) |
static Ipv4Address | GetBroadcast (void) |
static Ipv4Address | GetLoopback (void) |
Friends | |
bool | operator== (Ipv4Address const &a, Ipv4Address const &b) |
bool | operator!= (Ipv4Address const &a, Ipv4Address const &b) |
bool | operator< (Ipv4Address const &addrA, Ipv4Address const &addrB) |
Ipv4 addresses are stored in host order in this class.
|
explicit |
input address is in host order.
address | The host order 32-bit address |
ns3::Ipv4Address::Ipv4Address | ( | char const * | address | ) |
Constructs an Ipv4Address by parsing a the input C-string.
Input address is in format: hhh.xxx.xxx.lll where h is the high byte and l the low byte
address | C-string containing the address as described above |
Ipv4Address ns3::Ipv4Address::CombineMask | ( | Ipv4Mask const & | mask | ) | const |
Combine this address with a network mask.
This method returns an IPv4 address that is this address combined (bitwise and) with a network mask, yielding an IPv4 network address.
mask | a network mask |
References Get(), and ns3::Ipv4Mask::Get().
Referenced by ns3::Ipv4L3Protocol::GetInterfaceForPrefix(), ns3::Ipv4StaticRouting::NotifyAddAddress(), ns3::Ipv4StaticRouting::NotifyInterfaceUp(), ns3::Ipv4StaticRouting::NotifyRemoveAddress(), ns3::Ipv4L3Protocol::SelectSourceAddress(), and ns3::Ipv4L3Protocol::Send().
|
static |
address | a polymorphic address |
This function performs a type check and asserts if the type of the input address is not compatible with an Ipv4Address.
References ns3::Address::CheckCompatible(), ns3::Address::CopyTo(), Deserialize(), and NS_ASSERT.
|
static |
buf | buffer to read address from |
The input address is expected to be in network byte order format.
Referenced by ns3::InetSocketAddress::ConvertFrom(), ConvertFrom(), ns3::dsr::DsrOptionRreqHeader::Deserialize(), ns3::dsr::DsrOptionRrepHeader::Deserialize(), and ns3::dsr::DsrOptionSRHeader::Deserialize().
uint32_t ns3::Ipv4Address::Get | ( | void | ) | const |
Get the host-order 32-bit IP address
Referenced by CombineMask(), GetSubnetDirectedBroadcast(), ns3::Ipv4Mask::IsMatch(), IsSubnetDirectedBroadcast(), ns3::olsr::MessageHeader::Serialize(), ns3::Ipv4Header::Serialize(), and ns3::Ipv4AddressHelper::SetBase().
|
static |
Referenced by ns3::Ipv4RawSocketImpl::Bind(), ns3::UdpSocketImpl::Bind(), ns3::NscTcpSocketImpl::Bind(), ns3::TcpSocketBase::Bind(), ns3::EpcHelper::EpcHelper(), ns3::aodv::RoutingProtocol::NotifyAddAddress(), ns3::dsdv::RoutingProtocol::NotifyAddAddress(), ns3::aodv::RoutingProtocol::NotifyInterfaceUp(), ns3::dsdv::RoutingProtocol::NotifyInterfaceUp(), ns3::aodv::RoutingProtocol::NotifyRemoveAddress(), ns3::dsdv::RoutingProtocol::NotifyRemoveAddress(), and ns3::Ipv4RawSocketImpl::SendTo().
|
static |
Referenced by ns3::Ipv4FlowClassifier::Classify().
|
static |
Referenced by ns3::aodv::RoutingProtocol::SetIpv4(), and ns3::dsdv::RoutingProtocol::SetIpv4().
Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast | ( | Ipv4Mask const & | mask | ) | const |
Generate subnet-directed broadcast address corresponding to mask.
The subnet-directed broadcast address has the host bits set to all ones. If this method is called with a mask of 255.255.255.255, (i.e., the address is a /32 address), the program will assert, since there is no subnet associated with a /32 address.
mask | a network mask |
References Get(), ns3::Ipv4Mask::GetInverse(), ns3::Ipv4Mask::GetOnes(), and NS_ASSERT_MSG.
|
static |
Referenced by ns3::Ipv4RoutingTableEntry::CreateDefaultRoute(), ns3::Ipv4FlowClassifier::FindFlow(), ns3::UdpSocketImpl::GetSockName(), ns3::TcpSocketBase::GetSockName(), ns3::Ipv4RoutingTableEntry::IsDefault(), ns3::Ipv4RoutingTableEntry::IsGateway(), and ns3::TcpSocketBase::RecvFrom().
bool ns3::Ipv4Address::IsBroadcast | ( | void | ) | const |
Referenced by ns3::Ipv4L3Protocol::IsDestinationAddress(), ns3::dsr::RouteCache::RebuildBestRouteTable(), ns3::dsr::DsrRouting::Receive(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::Ipv4StaticRouting::RouteInput(), ns3::Ipv4GlobalRouting::RouteInput(), ns3::Ipv4Interface::Send(), and ns3::Ipv4L3Protocol::Send().
|
inline |
Comparison operation between two Ipv4Addresses.
other | address to which to compare this address |
Referenced by ns3::Ipv4RoutingTableEntry::IsDefault(), ns3::Ipv4RoutingTableEntry::IsGateway(), ns3::ArpL3Protocol::Receive(), ns3::Ipv4StaticRouting::RouteInput(), and ns3::Ipv4GlobalRouting::RouteInput().
bool ns3::Ipv4Address::IsLocalMulticast | ( | void | ) | const |
Referenced by ns3::Ipv4L3Protocol::Send().
|
static |
address | an address to compare type with |
References ns3::Address::CheckCompatible().
bool ns3::Ipv4Address::IsMulticast | ( | void | ) | const |
Referenced by ns3::dsr::DsrOptionRerr::DoSendError(), ns3::Ipv4L3Protocol::IsDestinationAddress(), ns3::dsr::DsrOptionSR::Process(), ns3::dsr::DsrRouting::Receive(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::Ipv4StaticRouting::RouteInput(), ns3::Ipv4ListRouting::RouteInput(), ns3::Ipv4GlobalRouting::RouteInput(), ns3::Ipv4StaticRouting::RouteOutput(), ns3::Ipv4GlobalRouting::RouteOutput(), and ns3::Ipv4Interface::Send().
bool ns3::Ipv4Address::IsSubnetDirectedBroadcast | ( | Ipv4Mask const & | mask | ) | const |
Generate subnet-directed broadcast address corresponding to mask.
The subnet-directed broadcast address has the host bits set to all ones. If this method is called with a mask of 255.255.255.255, (i.e., the address is a /32 address), the program will assert, since there is no subnet associated with a /32 address.
mask | a network mask |
References Get(), ns3::Ipv4Mask::GetInverse(), and ns3::Ipv4Mask::GetOnes().
Referenced by ns3::Ipv4Interface::Send(), and ns3::Ipv4L3Protocol::Send().
ns3::Ipv4Address::operator Address | ( | ) | const |
void ns3::Ipv4Address::Print | ( | std::ostream & | os | ) | const |
Print this address to the given output stream.
The print format is in the typical "192.168.1.1"
os | The output stream to which this Ipv4Address is printed |
Referenced by ns3::NscTcpSocketImpl::Connect(), and ns3::TcpL4Protocol::Receive().
void ns3::Ipv4Address::Serialize | ( | uint8_t | buf[4] | ) | const |
Serialize this address to a 4-byte buffer
buf | output buffer to which this address gets overwritten with this Ipv4Address |
Referenced by ns3::Mac48Address::GetMulticast(), ns3::Ipv6Address::MakeIpv4MappedAddress(), and ns3::Ipv4PacketInfoTag::Serialize().
void ns3::Ipv4Address::Set | ( | uint32_t | address | ) |
input address is in host order.
address | The host order 32-bit address |
Referenced by ns3::Ipv4Header::Deserialize(), and ns3::GlobalRouter::GlobalRouter().
void ns3::Ipv4Address::Set | ( | char const * | address | ) |
Sets an Ipv4Address by parsing a the input C-string.
Input address is in format: hhh.xxx.xxx.lll where h is the high byte and l the low byte
address | C-string containing the address as described above |