INET Framework for OMNeT++/OMNEST
|
Stores an IEEE 802 MAC address (6 octets = 48 bits). More...
#include <MACAddress.h>
Classes | |
class | SimulationLifecycleListener |
Public Member Functions | |
MACAddress () | |
Default constructor initializes address bytes to zero. More... | |
MACAddress (uint64 bits) | |
Initializes the address from the lower 48 bits of the 64-bit argument. More... | |
MACAddress (const char *hexstr) | |
Constructor which accepts a hex string (12 hex digits, may also contain spaces, hyphens and colons) More... | |
MACAddress (const MACAddress &other) | |
Copy constructor. More... | |
MACAddress & | operator= (const MACAddress &other) |
Assignment. More... | |
unsigned int | getAddressSize () const |
Returns the address size in bytes, that is, 6. More... | |
unsigned char | getAddressByte (unsigned int k) const |
Returns the kth byte of the address. More... | |
void | setAddressByte (unsigned int k, unsigned char addrbyte) |
Sets the kth byte of the address. More... | |
bool | tryParse (const char *hexstr) |
Sets the address and returns true if the syntax of the string is correct. More... | |
void | setAddress (const char *hexstr) |
Converts address value from hex string (12 hex digits, may also contain spaces, hyphens and colons) More... | |
void | getAddressBytes (unsigned char *addrbytes) const |
Copies the address to the given pointer (array of 6 unsigned chars). More... | |
void | getAddressBytes (char *addrbytes) const |
void | setAddressBytes (unsigned char *addrbytes) |
Sets address bytes. More... | |
void | setAddressBytes (char *addrbytes) |
void | setBroadcast () |
Sets the address to the broadcast address (hex ff:ff:ff:ff:ff:ff). More... | |
bool | isBroadcast () const |
Returns true if this is the broadcast address (hex ff:ff:ff:ff:ff:ff). More... | |
bool | isMulticast () const |
Returns true if this is a multicast logical address (first byte's lsb is 1). More... | |
bool | isUnspecified () const |
Returns true if all address bytes are zero. More... | |
std::string | str () const |
Converts address to a hex string. More... | |
uint64 | getInt () const |
Converts address to 48 bits integer. More... | |
bool | equals (const MACAddress &other) const |
Returns true if the two addresses are equal. More... | |
bool | operator== (const MACAddress &other) const |
Returns true if the two addresses are equal. More... | |
bool | operator!= (const MACAddress &other) const |
Returns true if the two addresses are not equal. More... | |
int | compareTo (const MACAddress &other) const |
Returns -1, 0 or 1 as result of comparison of 2 addresses. More... | |
InterfaceToken | formInterfaceIdentifier () const |
Create interface identifier (IEEE EUI-64) which can be used by IPv6 stateless address autoconfiguration. More... | |
bool | operator< (const MACAddress &other) const |
bool | operator> (const MACAddress &other) const |
Static Public Member Functions | |
static MACAddress | generateAutoAddress () |
Generates a unique address which begins with 0a:aa and ends in a unique suffix. More... | |
static MACAddress | makeMulticastAddress (IPv4Address addr) |
Form a MAC address for a multicast IPv4 address, see RFC 1112, section 6.4. More... | |
Static Public Attributes | |
static const MACAddress | UNSPECIFIED_ADDRESS |
The unspecified MAC address, 00:00:00:00:00:00. More... | |
static const MACAddress | BROADCAST_ADDRESS |
The broadcast MAC address, ff:ff:ff:ff:ff:ff. More... | |
static const MACAddress | MULTICAST_PAUSE_ADDRESS |
The special multicast PAUSE MAC address, 01:80:C2:00:00:01. More... | |
static const MACAddress | STP_MULTICAST_ADDRESS |
The spanning tree protocol bridge's multicast address, 01:80:C2:00:00:00. More... | |
Private Attributes | |
uint64 | address |
Static Private Attributes | |
static unsigned int | autoAddressCtr |
static bool | simulationLifecycleListenerAdded |
Stores an IEEE 802 MAC address (6 octets = 48 bits).
|
inline |
Default constructor initializes address bytes to zero.
|
inlineexplicit |
Initializes the address from the lower 48 bits of the 64-bit argument.
|
inlineexplicit |
Constructor which accepts a hex string (12 hex digits, may also contain spaces, hyphens and colons)
|
inline |
Copy constructor.
int inet::MACAddress::compareTo | ( | const MACAddress & | other | ) | const |
Returns -1, 0 or 1 as result of comparison of 2 addresses.
Referenced by inet::STP::compareBridgeIDs(), inet::RSTP::compareRSTPData(), inet::RSTP::handleIncomingFrame(), inet::MACAddressTable::MAC_compare::operator()(), inet::ieee80211::Ieee80211MgmtAP::MAC_compare::operator()(), and inet::RSTP::processBPDU().
|
inline |
Returns true if the two addresses are equal.
Referenced by inet::IdealMac::dropFrameNotForUs(), inet::EtherMACBase::dropFrameNotForUs(), inet::EtherMACFullDuplex::processFrameFromUpperLayer(), inet::EtherMAC::processFrameFromUpperLayer(), inet::IPv6NeighbourDiscovery::processNAForOtherNCEStates(), inet::IPv6NeighbourDiscovery::processNSWithSpecifiedSrcAddr(), and inet::IPv6NeighbourDiscovery::processRAForRouterUpdates().
InterfaceToken inet::MACAddress::formInterfaceIdentifier | ( | ) | const |
Create interface identifier (IEEE EUI-64) which can be used by IPv6 stateless address autoconfiguration.
Referenced by inet::IdealMac::createInterfaceEntry(), inet::ieee80211::Ieee80211Mac::createInterfaceEntry(), inet::LMacLayer::createInterfaceEntry(), inet::CsmaCaMac::createInterfaceEntry(), inet::BMacLayer::createInterfaceEntry(), inet::EtherMACBase::createInterfaceEntry(), and inet::CSMA::createInterfaceEntry().
|
static |
Generates a unique address which begins with 0a:aa and ends in a unique suffix.
Referenced by inet::ieee80211::Ieee80211Mac::initialize(), inet::CsmaCaMac::initialize(), inet::IdealMac::initializeMACAddress(), inet::LMacLayer::initializeMACAddress(), inet::EtherMACBase::initializeMACAddress(), inet::BMacLayer::initializeMACAddress(), and inet::CSMA::initializeMACAddress().
unsigned char inet::MACAddress::getAddressByte | ( | unsigned int | k | ) | const |
void inet::MACAddress::getAddressBytes | ( | unsigned char * | addrbytes | ) | const |
Copies the address to the given pointer (array of 6 unsigned chars).
Referenced by inet::serializer::Buffer::writeMACAddress().
|
inline |
Referenced by getAddressBytes().
|
inline |
Returns the address size in bytes, that is, 6.
|
inline |
Converts address to 48 bits integer.
|
inline |
Returns true if this is the broadcast address (hex ff:ff:ff:ff:ff:ff).
Referenced by inet::IdealMac::dropFrameNotForUs(), inet::EtherMACBase::dropFrameNotForUs(), inet::MACRelayUnit::handleAndDispatchFrame(), inet::Ieee8021dRelay::handleAndDispatchFrame(), inet::CSMA::handleLowerPacket(), inet::BMacLayer::handleSelfMessage(), inet::LMacLayer::handleSelfMessage(), inet::L3Address::isBroadcast(), inet::CsmaCaMac::isBroadcast(), inet::L3Address::isUnicast(), inet::CSMA::updateStatusTransmitFrame(), and inet::MACAddressTable::updateTableWithAddress().
|
inline |
Returns true if this is a multicast logical address (first byte's lsb is 1).
Referenced by inet::ieee80211::PendingQueue::cmpMgmtOverMulticastOverUnicast(), inet::ieee80211::OriginatorProtectionMechanism::computeDataFrameDurationField(), inet::ieee80211::SingleProtectionMechanism::computeDataOrMgmtFrameDurationField(), inet::ieee80211::RateSelection::computeDataOrMgmtFrameMode(), inet::ieee80211::QoSRateSelection::computeDataOrMgmtFrameMode(), inet::ieee80211::OriginatorProtectionMechanism::computeMgmtFrameDurationField(), inet::IdealMac::dropFrameNotForUs(), inet::EtherMACBase::dropFrameNotForUs(), inet::ieee80211::QoSSequenceNumberAssignment::getCacheType(), inet::ieee80211::Ieee80211MgmtAP::handleDataFrame(), inet::ieee80211::Ieee80211MgmtAP::handleUpperMessage(), inet::ieee80211::HcfFs::hasMoreTxOpsAndMulticast(), inet::ieee80211::RecipientAckPolicy::isAckNeeded(), inet::ieee80211::RecipientQoSAckPolicy::isAckNeeded(), inet::ieee80211::OriginatorQoSAckPolicy::isAckNeeded(), inet::ieee80211::DcfFs::isBroadcastManagementOrGroupDataSequenceNeeded(), inet::ieee80211::FrameSequenceContext::isForUs(), inet::ieee80211::Dcf::isForUs(), inet::ieee80211::Hcf::isForUs(), inet::L3Address::isMulticast(), inet::ieee80211::RtsPolicy::isRtsNeeded(), inet::ieee80211::QoSRtsPolicy::isRtsNeeded(), inet::L3Address::isUnicast(), inet::ieee80211::Hcf::originatorProcessTransmittedFrame(), and inet::ieee80211::HcfFs::selectHcfSequence().
|
inline |
Returns true if all address bytes are zero.
Referenced by inet::ieee80211::Ieee80211MgmtAPBase::distributeReceivedDataFrame(), inet::ieee80211::Ieee80211MgmtSTASimplified::encapsulate(), inet::L3AddressResolver::getInterfaceMACAddress(), inet::GlobalARP::getL3AddressFor(), inet::ARP::getL3AddressFor(), inet::WiseRoute::handleLowerPacket(), inet::EtherTrafGen::handleMessage(), inet::EtherAppCli::handleMessage(), inet::EtherEncap::handleSendPause(), inet::EtherLLC::handleSendPause(), inet::ieee80211::Ieee80211MgmtSTASimplified::handleUpperMessage(), inet::CsmaCaMac::handleUpperPacket(), inet::WiseRoute::handleUpperPacket(), inet::EthernetApplication::initialize(), inet::L3Address::isUnspecified(), inet::ARP::processARPPacket(), inet::ieee80211::Ieee80211AgentSTA::processAssociateConfirm(), inet::EtherMACFullDuplex::processFrameFromUpperLayer(), inet::EtherMAC::processFrameFromUpperLayer(), inet::IPv6NeighbourDiscovery::processNAForIncompleteNCEState(), inet::IPv6NeighbourDiscovery::processNAForOtherNCEStates(), inet::IPv6NeighbourDiscovery::processNSWithSpecifiedSrcAddr(), inet::IPv6NeighbourDiscovery::processRAForRouterUpdates(), inet::ieee80211::Ieee80211MgmtSTA::processScanCommand(), inet::ieee80211::Ieee80211Mac::processUpperFrame(), inet::IPv6::resolveMACAddressAndSendPacket(), inet::ARP::sendARPRequest(), inet::IPv6::sendDatagramToOutput(), inet::IPv4::sendDatagramToOutput(), inet::IPv6NeighbourDiscovery::sendSolicitedNA(), inet::EtherMACFullDuplex::startFrameTransmission(), inet::EtherMAC::startFrameTransmission(), inet::IPv6NeighbourDiscovery::validateNSPacket(), and inet::IPv6NeighbourDiscovery::validateRSPacket().
|
static |
Form a MAC address for a multicast IPv4 address, see RFC 1112, section 6.4.
Referenced by inet::IPv4::resolveNextHopMacAddress().
|
inline |
Returns true if the two addresses are not equal.
|
inline |
|
inline |
Assignment.
|
inline |
Returns true if the two addresses are equal.
|
inline |
void inet::MACAddress::setAddress | ( | const char * | hexstr | ) |
Converts address value from hex string (12 hex digits, may also contain spaces, hyphens and colons)
Referenced by inet::ieee80211::Ieee80211MgmtSTASimplified::initialize(), inet::ieee80211::Ieee80211MgmtBase::initialize(), inet::ieee80211::Ieee80211Mac::initialize(), inet::CsmaCaMac::initialize(), inet::IdealMac::initializeMACAddress(), inet::LMacLayer::initializeMACAddress(), inet::EtherMACBase::initializeMACAddress(), inet::BMacLayer::initializeMACAddress(), inet::CSMA::initializeMACAddress(), inet::EthernetApplication::resolveDestMACAddress(), inet::EtherTrafGen::resolveDestMACAddress(), and inet::EtherAppCli::resolveDestMACAddress().
void inet::MACAddress::setAddressByte | ( | unsigned int | k, |
unsigned char | addrbyte | ||
) |
Sets the kth byte of the address.
Referenced by makeMulticastAddress(), inet::GenericARP::mapMulticastAddress(), inet::serializer::Buffer::readMACAddress(), setAddressBytes(), and tryParse().
void inet::MACAddress::setAddressBytes | ( | unsigned char * | addrbytes | ) |
Sets address bytes.
The argument should point to an array of 6 unsigned chars.
|
inline |
Referenced by setAddressBytes().
|
inline |
Sets the address to the broadcast address (hex ff:ff:ff:ff:ff:ff).
std::string inet::MACAddress::str | ( | ) | const |
Converts address to a hex string.
Referenced by inet::InetPacketPrinter2::formatARPPacket(), inet::ieee80211::Ieee80211MgmtSTA::handleAssociationResponseFrame(), inet::CsmaCaMac::initialize(), inet::IdealMac::initializeMACAddress(), inet::LMacLayer::initializeMACAddress(), inet::EtherMACBase::initializeMACAddress(), inet::BMacLayer::initializeMACAddress(), inet::CSMA::initializeMACAddress(), inet::operator<<(), inet::RSTP::printState(), inet::ieee80211::Ieee80211MgmtSTA::processAssociateCommand(), inet::ieee80211::Ieee80211MgmtSTA::processAuthenticateCommand(), inet::ieee80211::Ieee80211MgmtSTA::processDeauthenticateCommand(), inet::EtherMACFullDuplex::processFrameFromUpperLayer(), inet::EtherMAC::processFrameFromUpperLayer(), inet::IPv6NeighbourDiscovery::processNUDTimeout(), inet::ieee80211::Ieee80211MgmtSTA::startAssociation(), inet::ieee80211::Ieee80211MgmtSTA::startAuthentication(), and inet::L3Address::str().
bool inet::MACAddress::tryParse | ( | const char * | hexstr | ) |
Sets the address and returns true if the syntax of the string is correct.
(See setAddress() for the syntax.)
Referenced by inet::EthernetApplication::resolveDestMACAddress(), inet::EtherTrafGen::resolveDestMACAddress(), inet::EtherAppCli::resolveDestMACAddress(), setAddress(), and inet::L3Address::tryParse().
|
private |
Referenced by compareTo(), equals(), formInterfaceIdentifier(), getAddressByte(), inet::ieee80211::Ieee80211MgmtSTA::handleBeaconFrame(), inet::ieee80211::Ieee80211MgmtSTA::handleDisassociationFrame(), MACAddress(), operator!=(), operator<(), operator=(), operator==(), operator>(), inet::ieee80211::Ieee80211MgmtSTA::processDisassociateCommand(), setAddressByte(), setAddressBytes(), and tryParse().
|
staticprivate |
Referenced by generateAutoAddress().
|
static |
The broadcast MAC address, ff:ff:ff:ff:ff:ff.
Referenced by inet::IPv6::datagramLocalOut(), inet::ProbabilisticBroadcast::encapsMsg(), inet::Flood::encapsMsg(), inet::MACAddressType::getBroadcastAddress(), inet::ProbabilisticBroadcast::handleLowerPacket(), inet::Flood::handleLowerPacket(), inet::WiseRoute::handleLowerPacket(), inet::BMacLayer::handleSelfMessage(), inet::ProbabilisticBroadcast::handleSelfMessage(), inet::WiseRoute::handleSelfMessage(), inet::WiseRoute::handleUpperPacket(), inet::BMacLayer::initialize(), inet::ieee80211::Ieee80211MgmtSTA::processScanCommand(), inet::GenericARP::resolveL3Address(), inet::IPv4::resolveNextHopMacAddress(), inet::IPv6::routeMulticastPacket(), inet::ARP::sendARPRequest(), inet::ieee80211::Ieee80211MgmtAP::sendBeacon(), and inet::BMacLayer::sendPreamble().
|
static |
The special multicast PAUSE MAC address, 01:80:C2:00:00:01.
Referenced by inet::EtherMACBase::dropFrameNotForUs(), inet::EtherEncap::handleSendPause(), and inet::EtherLLC::handleSendPause().
|
staticprivate |
Referenced by generateAutoAddress().
|
static |
The spanning tree protocol bridge's multicast address, 01:80:C2:00:00:00.
Referenced by inet::STP::generateTCN(), inet::Ieee8021dRelay::handleAndDispatchFrame(), inet::STP::handleBPDU(), inet::STP::numInitStages(), inet::RSTP::sendBPDU(), and inet::RSTP::sendTCNtoRoot().
|
static |
The unspecified MAC address, 00:00:00:00:00:00.
Referenced by inet::ieee80211::OriginatorQoSAckPolicy::computeBlockAckReqParameters(), inet::MACAddressType::getLinkLocalAddress(), inet::MACAddressType::getUnspecifiedAddress(), inet::ARP::initiateARPResolution(), inet::ieee80211::Ieee80211Mac::isInterfaceRegistered(), inet::IPv6NeighbourDiscovery::processIPv6Datagram(), inet::ARP::requestTimedOut(), inet::GlobalARP::resolveL3Address(), inet::ARP::resolveL3Address(), inet::IPv6NeighbourDiscovery::resolveNeighbour(), and inet::GenericNetworkProtocol::sendDatagramToOutput().