INET Framework for OMNeT++/OMNEST
|
This class provides the generic interface for network addresses. More...
#include <L3Address.h>
Public Types | |
enum | AddressType { NONE, IPv4, IPv6, MAC, MODULEPATH, MODULEID } |
Public Member Functions | |
L3Address () | |
L3Address (const char *str) | |
L3Address (const IPv4Address &addr) | |
L3Address (const IPv6Address &addr) | |
L3Address (const MACAddress &addr) | |
L3Address (const ModuleIdAddress &addr) | |
L3Address (const ModulePathAddress &addr) | |
void | set (const IPv4Address &addr) |
void | set (const IPv6Address &addr) |
void | set (const MACAddress &addr) |
void | set (const ModuleIdAddress &addr) |
void | set (const ModulePathAddress &addr) |
IPv4Address | toIPv4 () const |
IPv6Address | toIPv6 () const |
MACAddress | toMAC () const |
ModuleIdAddress | toModuleId () const |
ModulePathAddress | toModulePath () const |
std::string | str () const |
AddressType | getType () const |
IL3AddressType * | getAddressType () const |
L3Address | getPrefix (int prefixLength) const |
Get the first prefixLength bits of the address, with the rest set to zero. More... | |
bool | tryParse (const char *addr) |
bool | isUnspecified () const |
bool | isUnicast () const |
bool | isMulticast () const |
bool | isBroadcast () const |
bool | isLinkLocal () const |
bool | operator< (const L3Address &other) const |
bool | operator> (const L3Address &other) const |
bool | operator== (const L3Address &other) const |
bool | operator!= (const L3Address &other) const |
bool | matches (const L3Address &other, int prefixLength) const |
Static Public Member Functions | |
static const char * | getTypeName (AddressType t) |
Private Member Functions | |
uint64 | get (AddressType type) const |
void | set (AddressType type, uint64 lo) |
Private Attributes | |
uint64 | hi |
uint64 | lo |
This class provides the generic interface for network addresses.
For efficiency reasons the implementation uses a 128 bits integer to represent all kinds of network addresses. The different address implementations should not subclass this class, they should rather provide conversions to and from this class.
|
inline |
Referenced by getPrefix().
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Referenced by inet::IPv4::arpResolutionTimedOut().
IL3AddressType * inet::L3Address::getAddressType | ( | ) | const |
Referenced by inet::GPSR::computeOptionLength(), inet::ProbabilisticBroadcast::encapsMsg(), inet::Flood::encapsMsg(), inet::WiseRoute::getRoute(), inet::WiseRoute::handleSelfMessage(), inet::WiseRoute::handleUpperPacket(), inet::GPSR::initialize(), inet::dymo::DYMO::initialize(), inet::AODVRouting::initialize(), inet::AODVRouting::receiveSignal(), inet::dymo::DYMO::receiveSignal(), inet::sctp::SCTP::sendAbortFromMain(), inet::UDP::sendDown(), inet::IPvXTrafGen::sendPacket(), inet::PingApp::sendPing(), inet::sctp::SCTP::sendShutdownCompleteFromMain(), inet::tcp::TCPSpoof::sendToIP(), and inet::tcp::TCPConnection::sendToIP().
L3Address inet::L3Address::getPrefix | ( | int | prefixLength | ) | const |
Get the first prefixLength bits of the address, with the rest set to zero.
L3Address::AddressType inet::L3Address::getType | ( | ) | const |
Referenced by inet::MultiFieldClassifier::addFilter(), inet::UDP::addMulticastAddressToInterface(), inet::IPv4::arpResolutionCompleted(), inet::IPv4::arpResolutionTimedOut(), inet::InterfaceEntry::changeMulticastGroupMembership(), inet::MultiFieldClassifier::configureFilters(), inet::serializer::SCTPSerializer::deserialize(), inet::sctp::SCTP::findAssocForInitAck(), inet::L3AddressResolver::findHostWithAddress(), inet::InterfaceTable::findInterfaceByAddress(), get(), inet::sctp::SCTPAssociation::getAddressLevel(), getAddressType(), getPrefix(), inet::GPSR::getSelfAddress(), isBroadcast(), isLinkLocal(), isMulticast(), inet::InterfaceTable::isNeighborAddress(), isUnicast(), isUnspecified(), inet::InterfaceEntry::joinMulticastGroup(), inet::GenericARP::mapUnicastAddress(), matches(), operator<(), operator==(), inet::UDP::processICMPError(), inet::sctp::SCTPAssociation::processInitAckArrived(), inet::sctp::SCTPAssociation::processInitArrived(), inet::PacketDump::sctpDump(), inet::sctp::SCTPAssociation::sendAsconf(), inet::UDP::sendDown(), inet::sctp::SCTPAssociation::sendInit(), set(), and str().
|
static |
Referenced by inet::InterfaceEntry::changeMulticastGroupMembership(), and inet::L3AddressResolver::findHostWithAddress().
bool inet::L3Address::isBroadcast | ( | ) | const |
Referenced by inet::AODVRouting::datagramForwardHook(), inet::GPSR::datagramLocalOutHook(), inet::GPSR::datagramPreRoutingHook(), inet::AODVRouting::ensureRouteForDatagram(), inet::dymo::DYMO::ensureRouteForDatagram(), inet::Flood::handleLowerPacket(), inet::WiseRoute::handleLowerPacket(), inet::WiseRoute::handleUpperPacket(), inet::dymo::DYMO::permissibleRteMsg(), inet::GenericARP::resolveL3Address(), and inet::AODVRouting::sendAODVPacket().
bool inet::L3Address::isLinkLocal | ( | ) | const |
Referenced by inet::RIPRouting::configureInitialRoutes(), and inet::RIPRouting::isValidResponse().
bool inet::L3Address::isMulticast | ( | ) | const |
Referenced by inet::UDP::addMulticastAddressToInterface(), inet::UDP::blockMulticastSources(), inet::RIPRouting::configureInitialRoutes(), inet::AODVRouting::datagramForwardHook(), inet::GenericNetworkProtocol::datagramLocalOut(), inet::GPSR::datagramLocalOutHook(), inet::GenericNetworkProtocol::datagramPreRouting(), inet::GPSR::datagramPreRoutingHook(), inet::AODVRouting::ensureRouteForDatagram(), inet::dymo::DYMO::ensureRouteForDatagram(), inet::L3AddressResolver::findHostWithAddress(), inet::GenericRoutingTable::isLocalMulticastAddress(), inet::UDP::joinMulticastGroups(), inet::UDP::joinMulticastSources(), inet::UDP::leaveMulticastSources(), inet::GenericARP::mapMulticastAddress(), inet::dymo::DYMO::permissibleRteMsg(), inet::UDP::processUDPPacket(), inet::GenericARP::resolveL3Address(), inet::RIPRouting::sendPacket(), inet::UDP::setMulticastSourceFilter(), inet::UDPSink::setSocketOptions(), and inet::UDP::unblockMulticastSources().
bool inet::L3Address::isUnicast | ( | ) | const |
Referenced by inet::RIPRouting::isValidResponse(), and inet::GenericARP::resolveL3Address().
bool inet::L3Address::isUnspecified | ( | ) | const |
Referenced by inet::MultiFieldClassifier::addFilter(), inet::sctp::SCTP::addLocalAddress(), inet::sctp::SCTP::addLocalAddressToAllRemoteAddresses(), inet::tcp::TCP::addSockPair(), inet::GenericNetworkConfigurator::addStaticRoutes(), inet::GenericRoutingTable::configureRouterId(), inet::TCPAppBase::connect(), inet::SCTPClient::connect(), inet::SCTPPeer::connect(), inet::UDPSocket::connect(), inet::UDP::connect(), inet::UDP::createSocket(), inet::GenericNetworkProtocol::encapsulate(), inet::AODVRouting::ensureRouteForDatagram(), inet::dymo::DYMO::ensureRouteForDatagram(), inet::UDP::findFirstSocketByLocalAddress(), inet::GPSR::findGreedyRoutingNextHop(), inet::L3AddressResolver::findHostWithAddress(), inet::InterfaceTable::findInterfaceByAddress(), inet::GPSR::findPerimeterRoutingNextHop(), inet::UDP::findSocketForUnicastPacket(), inet::UDP::findSocketsForMcastBcastPacket(), inet::InetPacketPrinter2::formatRIPPacket(), inet::IPvXTrafGen::handleMessage(), inet::PingApp::handleMessage(), inet::AODVRouting::handleRREP(), inet::GenericRoute::info(), inet::RIPRoute::info(), inet::InterfaceTable::isNeighborAddress(), inet::UDP::MulticastMembership::isSourceAllowed(), inet::dymo::DYMO::permissibleRteMsg(), inet::sctp::SCTPAssociation::process_ASSOCIATE(), inet::tcp::TCP_lwIP::process_OPEN_ACTIVE(), inet::tcp::TCP_NSC::process_OPEN_PASSIVE(), inet::sctp::SCTPAssociation::process_SEND(), inet::sctp::SCTPAssociation::processAsconfAckArrived(), inet::GPSR::processBeaconTimer(), inet::UDP::processPacketFromApp(), inet::RIPRouting::processResponse(), inet::UDPBasicApp::processStart(), inet::UDPSink::processStop(), inet::UDPVideoStreamCli::requestStream(), inet::GPSR::routeDatagram(), inet::GenericNetworkProtocol::routePacket(), inet::GenericNetworkProtocol::sendDatagramToOutput(), inet::UDP::sendDown(), inet::sctp::SCTPAssociation::sendInit(), inet::tcp::TCPConnection::sendSyn(), inet::SimpleVoIPSender::sendVoIPPacket(), inet::PositionTable::setPosition(), inet::UDPSink::setSocketOptions(), inet::NetPerfMeter::transmitFrame(), inet::L3AddressResolver::tryResolve(), and inet::WiseRoute::updateRouteTable().
bool inet::L3Address::matches | ( | const L3Address & | other, |
int | prefixLength | ||
) | const |
Referenced by inet::GenericRoutingTable::findBestMatchingRoute().
bool inet::L3Address::operator!= | ( | const L3Address & | other | ) | const |
bool inet::L3Address::operator< | ( | const L3Address & | other | ) | const |
bool inet::L3Address::operator== | ( | const L3Address & | other | ) | const |
Referenced by operator!=().
|
inline |
|
private |
|
inline |
void inet::L3Address::set | ( | const IPv6Address & | addr | ) |
|
inline |
|
inline |
|
inline |
std::string inet::L3Address::str | ( | ) | const |
Referenced by inet::tcp::TCP::addSockPair(), inet::UDP::bind(), inet::UDP::blockMulticastSources(), inet::tcp::TCP_NSC_Connection::connect(), inet::GenericNetworkProtocol::encapsulate(), inet::UDPSocket::getReceivedPacketInfo(), inet::tcp::TCP_NSC::initialize(), inet::UDP::joinMulticastGroups(), inet::UDP::joinMulticastSources(), inet::UDP::leaveMulticastSources(), inet::operator<<(), inet::utils::filters::MessageSourceAddrFilter::receiveSignal(), inet::RoutingTableRecorder::recordRouteChange(), inet::sctp::SCTP::removeAssociation(), inet::ARP::resolveL3Address(), inet::PacketDump::sctpDump(), inet::sctp::SCTPPathVariables::SCTPPathVariables(), inet::GenericNetworkProtocol::sendDatagramToOutput(), and inet::UDP::unblockMulticastSources().
|
inline |
Referenced by inet::UDP::addMulticastAddressToInterface(), inet::IPv4::arpResolutionCompleted(), inet::IPv4::arpResolutionTimedOut(), inet::InterfaceEntry::changeMulticastGroupMembership(), inet::IPv4::datagramForwardHook(), inet::IPv4::datagramLocalOutHook(), inet::IPv4::datagramPostRoutingHook(), inet::sctp::SCTPNatHook::datagramPreRoutingHook(), inet::IPv4::datagramPreRoutingHook(), inet::Define_Module(), inet::serializer::SCTPSerializer::deserialize(), inet::IPv4RoutingTable::findBestMatchingMulticastRoute(), inet::IPv4RoutingTable::findBestMatchingRoute(), inet::L3AddressResolver::findHostWithAddress(), inet::InterfaceTable::findInterfaceByAddress(), inet::IPv4::fragmentPostRouting(), inet::sctp::SCTPAssociation::getAddressLevel(), inet::IPv4RoutingTable::getInterfaceByAddress(), inet::IPv4RoutingTable::getNextHopForDestination(), inet::IPv4RoutingTable::getOutputInterfaceForDestination(), getPrefix(), inet::IPv4::handleIncomingDatagram(), inet::tcp::TCP_NSC::handleIpInputMessage(), inet::IPv4::handlePacketFromHL(), inet::ospf::ipv4AddressFromAddressString(), inet::ospf::ipv4NetmaskFromAddressString(), isBroadcast(), inet::IPv4RoutingTable::isLocalAddress(), inet::IPv4RoutingTable::isLocalMulticastAddress(), isMulticast(), inet::InterfaceTable::isNeighborAddress(), isUnicast(), isUnspecified(), inet::InterfaceEntry::joinMulticastGroup(), PacketDrill::makeIPPacket(), inet::tcp::TCP_NSC::mapRemote2Nsc(), matches(), operator<(), operator==(), inet::bgp::BGPRouting::processMessageFromTCP(), inet::LDP::processMessageFromTCP(), inet::ospf::HelloHandler::processPacket(), inet::IPv4NetworkConfigurator::readManualMulticastRouteConfiguration(), inet::IPv4NetworkConfigurator::readManualRouteConfiguration(), inet::IPv4NetworkConfigurator::resolveInterfaceAndGateway(), inet::GlobalARP::resolveL3Address(), inet::ARP::resolveL3Address(), inet::IPv4::routeUnicastPacket(), inet::UDP::sendDown(), inet::sctp::SCTPAssociation::sendInit(), inet::bgp::BGPSession::sendOpenMessage(), inet::IPv4Route::setDestination(), inet::IPv4ControlInfo::setDestinationAddress(), inet::IPv4Datagram::setDestinationAddress(), inet::IPv4MulticastRoute::setMulticastGroup(), inet::IPv4Route::setNextHop(), inet::IPv4MulticastRoute::setOrigin(), inet::IPv4ControlInfo::setSourceAddress(), inet::IPv4Datagram::setSourceAddress(), inet::DHCPServer::startApp(), and str().
|
inline |
Referenced by inet::UDP::addMulticastAddressToInterface(), inet::IPv6::datagramForwardHook(), inet::IPv6::datagramLocalOutHook(), inet::IPv6::datagramPostRoutingHook(), inet::IPv6::datagramPreRoutingHook(), inet::serializer::SCTPSerializer::deserialize(), inet::IPv6::endService(), inet::IPv6RoutingTable::findBestMatchingRoute(), inet::L3AddressResolver::findHostWithAddress(), inet::InterfaceTable::findInterfaceByAddress(), inet::sctp::SCTPAssociation::getAddressLevel(), inet::IPv6RoutingTable::getInterfaceByAddress(), inet::IPv6RoutingTable::getNextHopForDestination(), inet::IPv6RoutingTable::getOutputInterfaceForDestination(), getPrefix(), inet::IPv6::handleMessageFromHL(), isLinkLocal(), inet::IPv6RoutingTable::isLocalAddress(), isMulticast(), inet::InterfaceTable::isNeighborAddress(), isUnicast(), isUnspecified(), inet::InterfaceEntry::joinMulticastGroup(), matches(), operator<(), operator==(), inet::UDP::sendDown(), inet::IPv6Route::setDestination(), inet::IPv6ControlInfo::setDestinationAddress(), inet::IPv6Datagram::setDestinationAddress(), inet::IPv6Route::setNextHop(), inet::IPv6ControlInfo::setSourceAddress(), inet::IPv6Datagram::setSourceAddress(), and str().
|
inline |
Referenced by inet::InterfaceTable::findInterfaceByAddress(), isBroadcast(), isMulticast(), isUnicast(), isUnspecified(), inet::GenericARP::mapUnicastAddress(), matches(), operator<(), operator==(), and str().
|
inline |
Referenced by inet::InterfaceTable::findInterfaceByAddress(), isBroadcast(), isMulticast(), isUnicast(), isUnspecified(), inet::GenericARP::mapUnicastAddress(), matches(), operator<(), operator==(), inet::WiseRouteDatagram::setDestinationAddress(), inet::ProbabilisticBroadcastDatagram::setDestinationAddress(), inet::FloodDatagram::setDestinationAddress(), inet::WiseRouteDatagram::setSourceAddress(), inet::ProbabilisticBroadcastDatagram::setSourceAddress(), inet::FloodDatagram::setSourceAddress(), and str().
|
inline |
Referenced by inet::InterfaceTable::findInterfaceByAddress(), isBroadcast(), isMulticast(), isUnicast(), isUnspecified(), inet::GenericARP::mapUnicastAddress(), matches(), operator<(), operator==(), and str().
bool inet::L3Address::tryParse | ( | const char * | addr | ) |
Referenced by inet::L3AddressResolver::tryResolve().