|
INET Framework for OMNeT++/OMNEST
|
Stores an IEEE 802 MAC address (6 octets = 48 bits). More...
#include <MacAddress.h>
Public Member Functions | |
| MacAddress () | |
| Default constructor initializes address bytes to zero. More... | |
| MacAddress (uint64_t 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 | isLocal () const |
| Returns true if this is a local address (first byte's second less significant bit 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_t | 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 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... | |
| static const MacAddress | CDP_MULTICAST_ADDRESS |
| The Cisco discovery protocol bridge's multicast address, 01:00:0C:CC:CC:CC. More... | |
| static const MacAddress | LLDP_MULTICAST_ADDRESS |
| The Local link discovery protocol bridge's multicast address, 01:80:C2:00:00:0E. More... | |
Private Attributes | |
| uint64_t | address |
Stores an IEEE 802 MAC address (6 octets = 48 bits).
|
inline |
|
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::ieee80211::Ieee80211MgmtAp::MacCompare::operator()(), and inet::MacForwardingTable::MacCompare::operator()().
|
inline |
Returns true if the two addresses are equal.
Referenced by 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::ShortcutMac::configureNetworkInterface(), inet::AckingMac::configureNetworkInterface(), inet::XMac::configureNetworkInterface(), inet::CsmaCaMac::configureNetworkInterface(), inet::LMac::configureNetworkInterface(), inet::BMac::configureNetworkInterface(), inet::Ieee802154Mac::configureNetworkInterface(), inet::VirtualTunnel::initialize(), and inet::NetworkInterface::initialize().
|
static |
Generates a unique address which begins with 0a:aa and ends in a unique suffix.
Referenced by inet::VirtualTunnel::initialize(), inet::NetworkInterface::initialize(), and inet::MacProtocolBase::parseMacAddressParameter().
| unsigned char inet::MacAddress::getAddressByte | ( | unsigned int | k | ) | const |
Returns the kth byte of the address.
Referenced by getAddressBytes(), str(), and inet::MemoryOutputStream::writeMacAddress().
|
inline |
Referenced by getAddressBytes().
| void inet::MacAddress::getAddressBytes | ( | unsigned char * | addrbytes | ) | const |
Copies the address to the given pointer (array of 6 unsigned chars).
|
inline |
Returns the address size in bytes, that is, 6.
|
inline |
Converts address to 48 bits integer.
Referenced by inet::doParsimPacking(), and inet::L3Address::set().
|
inline |
Returns true if this is the broadcast address (hex ff:ff:ff:ff:ff:ff).
Referenced by inet::AckingMac::encapsulate(), inet::L3AddressResolver::findInterfaceWithMacAddress(), inet::EthernetSocketTable::findSockets(), inet::Ieee802154Mac::handleLowerPacket(), inet::XMac::handleSelfMessage(), inet::LMac::handleSelfMessage(), inet::L3Address::isBroadcast(), inet::CsmaCaMac::isBroadcast(), inet::L3Address::isUnicast(), inet::NetworkInterface::matchesMacAddress(), inet::physicallayer::RadioMedium::matchesMacAddressFilter(), and inet::AckingMac::startTransmitting().
|
inline |
Returns true if this is a local address (first byte's second less significant bit is 1).
|
inline |
Returns true if this is a multicast logical address (first byte's lsb is 1).
Referenced by inet::MacForwardingTable::addMulticastAddressForwardingInterface(), inet::AckingMac::encapsulate(), inet::L3AddressResolver::findInterfaceWithMacAddress(), inet::ieee80211::QoSSequenceNumberAssignment::getCacheType(), inet::MacForwardingTable::getMulticastAddressForwardingInterfaces(), inet::MacForwardingTable::getUnicastAddressForwardingInterface(), inet::Ieee802154Mac::handleLowerPacket(), inet::L3Address::isMulticast(), inet::L3Address::isUnicast(), inet::MacForwardingTable::learnUnicastAddressForwardingInterface(), inet::NetworkInterface::matchesMacAddress(), inet::physicallayer::RadioMedium::matchesMacAddressFilter(), inet::NetworkInterface::matchesMulticastMacAddress(), inet::MacForwardingTable::parseForwardingTableParameter(), inet::MacForwardingTable::removeMulticastAddressForwardingInterface(), inet::MacForwardingTable::removeUnicastAddressForwardingInterface(), inet::MacForwardingTable::setUnicastAddressForwardingInterface(), inet::AckingMac::startTransmitting(), and inet::MacRelayUnitBase::updatePeerAddress().
|
inline |
Returns true if all address bytes are zero.
Referenced by inet::AckingMac::encapsulate(), inet::L3AddressResolver::findInterfaceWithMacAddress(), inet::L3AddressResolver::getInterfaceMacAddress(), inet::GlobalArp::getL3AddressFor(), inet::Arp::getL3AddressFor(), inet::EtherAppClient::handleMessageWhenUp(), inet::EtherTrafGen::handleMessageWhenUp(), inet::EthernetPauseCommandProcessor::handleSendPause(), inet::EthernetEncapsulation::handleSendPause(), inet::L3Address::isUnspecified(), inet::EthernetEncapsulation::Socket::matches(), inet::Arp::processArpPacket(), inet::ieee80211::Ieee80211AgentSta::processAssociateConfirm(), inet::Ipv6NeighbourDiscovery::processNaForIncompleteNceState(), inet::Ipv6NeighbourDiscovery::processNaForOtherNceStates(), inet::Ipv6NeighbourDiscovery::processNsWithSpecifiedSrcAddr(), inet::Ipv6NeighbourDiscovery::processRaForRouterUpdates(), inet::Ipv6::resolveMACAddressAndSendPacket(), inet::Arp::sendArpGratuitous(), inet::Arp::sendArpProbe(), inet::Arp::sendArpRequest(), inet::Ipv4::sendDatagramToOutput(), inet::Ipv6NeighbourDiscovery::sendSolicitedNa(), inet::DhcpMessageSerializer::serialize(), inet::ieee80211::MsduAggregation::setSubframeAddress(), inet::AckingMac::startTransmitting(), inet::NetworkInterface::str(), inet::Ipv6NeighbourDiscovery::validateNsPacket(), and inet::Ipv6NeighbourDiscovery::validateRsPacket().
|
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::MacProtocolBase::parseMacAddressParameter().
| void inet::MacAddress::setAddressByte | ( | unsigned int | k, |
| unsigned char | addrbyte | ||
| ) |
Sets the kth byte of the address.
Referenced by inet::L3Address::mapToMulticastMacAddress(), inet::Ipv6Address::mapToMulticastMacAddress(), inet::Ipv4Address::mapToMulticastMacAddress(), inet::MemoryInputStream::readMacAddress(), setAddressBytes(), and tryParse().
|
inline |
Referenced by setAddressBytes().
| void inet::MacAddress::setAddressBytes | ( | unsigned char * | addrbytes | ) |
Sets address bytes.
The argument should point to an array of 6 unsigned chars.
|
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::NetworkInterface::addMulticastMacAddress(), inet::PacketFilter::DynamicExpressionResolver::callMethod(), inet::MacForwardingTableConfigurator::extendConfiguration(), inet::MacForwardingTableConfigurator::findForwardingRule(), inet::operator<<(), inet::Rstp::printState(), inet::ieee80211::Ieee80211MgmtSta::processAssociateCommand(), inet::ieee80211::Ieee80211MgmtSta::processAuthenticateCommand(), inet::ieee80211::Ieee80211MgmtSta::processDeauthenticateCommand(), inet::Ipv6NeighbourDiscovery::processNudTimeout(), inet::ieee80211::Ieee80211Mib::refreshDisplay(), inet::NetworkInterface::removeMulticastMacAddress(), inet::NetworkInterface::resolveDirective(), inet::ieee80211::Ieee80211MgmtSta::startAssociation(), inet::ieee80211::Ieee80211MgmtSta::startAuthentication(), inet::L3Address::str(), and inet::ArpPacket::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::EtherAppClient::resolveDestMacAddress(), setAddress(), inet::L3Address::tryParse(), and inet::L3AddressResolver::tryParse().
|
private |
Referenced by compareTo(), equals(), formInterfaceIdentifier(), getAddressByte(), inet::ieee80211::Ieee80211MgmtSta::handleDisassociationFrame(), MacAddress(), operator!=(), operator<(), operator=(), operator==(), operator>(), inet::ieee80211::Ieee80211MgmtSta::processDisassociateCommand(), setAddressByte(), setAddressBytes(), inet::ieee80211::Ieee80211MgmtSta::storeAPInfo(), and tryParse().
|
static |
The broadcast MAC address, ff:ff:ff:ff:ff:ff.
Referenced by inet::Ipv6::datagramLocalOut(), inet::ProbabilisticBroadcast::encapsulate(), inet::Flooding::encapsulate(), inet::MacAddressType::getBroadcastAddress(), inet::ProbabilisticBroadcast::handleLowerPacket(), inet::Flooding::handleLowerPacket(), inet::BMac::handleSelfMessage(), inet::ProbabilisticBroadcast::handleSelfMessage(), inet::BMac::initialize(), inet::XMac::initialize(), inet::ieee80211::Ieee80211MgmtSta::processScanCommand(), inet::GlobalArp::resolveL3Address(), inet::Ipv4::resolveNextHopMacAddress(), inet::Ipv6::routeMulticastPacket(), inet::Arp::sendArpGratuitous(), inet::Arp::sendArpProbe(), inet::Arp::sendArpRequest(), inet::ieee80211::Ieee80211MgmtAp::sendBeacon(), and inet::BMac::sendPreamble().
|
static |
The Cisco discovery protocol bridge's multicast address, 01:00:0C:CC:CC:CC.
|
static |
The Local link discovery protocol bridge's multicast address, 01:80:C2:00:00:0E.
|
static |
The special multicast PAUSE MAC address, 01:80:C2:00:00:01.
Referenced by inet::EthernetMacBase::dropFrameNotForUs(), inet::EthernetPauseCommandProcessor::handleSendPause(), and inet::EthernetEncapsulation::handleSendPause().
|
static |
The spanning tree protocol bridge's multicast address, 01:80:C2:00:00:00.
Referenced by inet::Stp::generateTCN(), inet::Stp::handleBPDU(), inet::Rstp::initialize(), inet::Stp::initialize(), 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::EthernetMacBase::getMacAddress(), inet::MacAddressType::getUnspecifiedAddress(), inet::Arp::initiateArpResolution(), inet::ieee80211::Ieee80211Mac::isInterfaceRegistered(), inet::GlobalArp::mapUnicastAddress(), inet::Ipv6NeighbourDiscovery::processIpv6Datagram(), inet::Arp::requestTimedOut(), inet::Arp::resolveL3Address(), inet::Ipv6NeighbourDiscovery::resolveNeighbour(), inet::Arp::sendArpProbe(), and inet::NextHopForwarding::sendDatagramToOutput().