--- a/examples/simple-p2p.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/examples/simple-p2p.cc Thu Jul 26 17:36:53 2007 +0200
@@ -56,7 +56,6 @@
#include "ns3/internet-node.h"
#include "ns3/p2p-channel.h"
#include "ns3/p2p-net-device.h"
-#include "ns3/mac-address.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
#include "ns3/socket.h"
--- a/src/devices/p2p/p2p-net-device.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/devices/p2p/p2p-net-device.cc Thu Jul 26 17:36:53 2007 +0200
@@ -26,6 +26,7 @@
#include "ns3/queue.h"
#include "ns3/simulator.h"
#include "ns3/composite-trace-resolver.h"
+#include "ns3/eui48-address.h"
#include "p2p-net-device.h"
#include "p2p-channel.h"
@@ -38,10 +39,10 @@
"The default data rate for point to point links",
DataRate ("10Mb/s"));
- PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
- const DataRate& rate)
+PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
+ const DataRate& rate)
:
- NetDevice(node, MacAddress (6)),
+ NetDevice(node, Eui48Address::Allocate ().ConvertTo ()),
m_txMachineState (READY),
m_bps (rate),
m_tInterframeGap (Seconds(0)),
@@ -54,7 +55,7 @@
// BUGBUG FIXME
//
// You _must_ support broadcast to get any sort of packet from the ARP layer.
- EnableBroadcast (MacAddress ("ff:ff:ff:ff:ff:ff"));
+ EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff").ConvertTo ());
EnableMulticast();
EnablePointToPoint();
}
@@ -82,7 +83,7 @@
m_tInterframeGap = t;
}
-bool PointToPointNetDevice::SendTo (Packet& p, const MacAddress& dest)
+bool PointToPointNetDevice::SendTo (Packet& p, const Address& dest)
{
NS_DEBUG ("PointToPointNetDevice::SendTo (" << &p << ", " << &dest << ")");
NS_DEBUG ("PointToPointNetDevice::SendTo (): UID is " << p.GetUid () << ")");
--- a/src/devices/p2p/p2p-net-device.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/devices/p2p/p2p-net-device.h Thu Jul 26 17:36:53 2007 +0200
@@ -22,7 +22,7 @@
#define POINT_TO_POINT_NET_DEVICE_H
#include <string.h>
-#include "ns3/mac-address.h"
+#include "ns3/address.h"
#include "ns3/node.h"
#include "ns3/net-device.h"
#include "ns3/callback.h"
@@ -201,10 +201,10 @@
*
* @see NetDevice
* @param p a reference to the packet to send
- * @param dest a reference to the MacAddress of the destination device
+ * @param dest a reference to the Address of the destination device
* @returns true if success, false on failure
*/
- virtual bool SendTo (Packet& p, const MacAddress& dest);
+ virtual bool SendTo (Packet& p, const Address& dest);
/**
* Start Sending a Packet Down the Wire.
*
--- a/src/internet-node/arp-cache.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-cache.cc Thu Jul 26 17:36:53 2007 +0200
@@ -146,7 +146,7 @@
UpdateSeen ();
}
Packet
-ArpCache::Entry::MarkAlive (MacAddress macAddress)
+ArpCache::Entry::MarkAlive (Address macAddress)
{
NS_ASSERT (m_state == WAIT_REPLY);
//NS_ASSERT (m_waiting != 0);
@@ -180,7 +180,7 @@
UpdateSeen ();
}
-MacAddress
+Address
ArpCache::Entry::GetMacAddress (void)
{
NS_ASSERT (m_state == ALIVE);
--- a/src/internet-node/arp-cache.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-cache.h Thu Jul 26 17:36:53 2007 +0200
@@ -26,7 +26,7 @@
#include "ns3/nstime.h"
#include "ns3/net-device.h"
#include "ns3/ipv4-address.h"
-#include "ns3/mac-address.h"
+#include "ns3/address.h"
#include "ns3/ptr.h"
#include "sgi-hashmap.h"
@@ -101,7 +101,7 @@
* \param macAddress
* \return
*/
- Packet MarkAlive (MacAddress macAddress);
+ Packet MarkAlive (Address macAddress);
/**
* \param waiting
*/
@@ -127,7 +127,7 @@
/**
* \return The MacAddress of this entry
*/
- MacAddress GetMacAddress (void);
+ Address GetMacAddress (void);
/**
* \return True if this entry has timedout; false otherwise.
*/
@@ -143,7 +143,7 @@
ArpCache *m_arp;
ArpCacheEntryState_e m_state;
Time m_lastSeen;
- MacAddress m_macAddress;
+ Address m_macAddress;
Packet m_waiting;
};
--- a/src/internet-node/arp-header.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-header.cc Thu Jul 26 17:36:53 2007 +0200
@@ -29,9 +29,9 @@
{}
void
-ArpHeader::SetRequest (MacAddress sourceHardwareAddress,
+ArpHeader::SetRequest (Address sourceHardwareAddress,
Ipv4Address sourceProtocolAddress,
- MacAddress destinationHardwareAddress,
+ Address destinationHardwareAddress,
Ipv4Address destinationProtocolAddress)
{
m_type = ARP_TYPE_REQUEST;
@@ -41,9 +41,9 @@
m_ipv4Dest = destinationProtocolAddress;
}
void
-ArpHeader::SetReply (MacAddress sourceHardwareAddress,
+ArpHeader::SetReply (Address sourceHardwareAddress,
Ipv4Address sourceProtocolAddress,
- MacAddress destinationHardwareAddress,
+ Address destinationHardwareAddress,
Ipv4Address destinationProtocolAddress)
{
m_type = ARP_TYPE_REPLY;
@@ -62,12 +62,12 @@
{
return (m_type == ARP_TYPE_REPLY)?true:false;
}
-MacAddress
+Address
ArpHeader::GetSourceHardwareAddress (void)
{
return m_macSource;
}
-MacAddress
+Address
ArpHeader::GetDestinationHardwareAddress (void)
{
return m_macDest;
--- a/src/internet-node/arp-header.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-header.h Thu Jul 26 17:36:53 2007 +0200
@@ -23,7 +23,7 @@
#define ARP_HEADER_H
#include "ns3/header.h"
-#include "ns3/mac-address.h"
+#include "ns3/address.h"
#include "ns3/ipv4-address.h"
namespace ns3 {
@@ -34,18 +34,18 @@
public:
virtual ~ArpHeader ();
- void SetRequest (MacAddress sourceHardwareAddress,
+ void SetRequest (Address sourceHardwareAddress,
Ipv4Address sourceProtocolAddress,
- MacAddress destinationHardwareAddress,
+ Address destinationHardwareAddress,
Ipv4Address destinationProtocolAddress);
- void SetReply (MacAddress sourceHardwareAddress,
+ void SetReply (Address sourceHardwareAddress,
Ipv4Address sourceProtocolAddress,
- MacAddress destinationHardwareAddress,
+ Address destinationHardwareAddress,
Ipv4Address destinationProtocolAddress);
bool IsRequest (void) const;
bool IsReply (void) const;
- MacAddress GetSourceHardwareAddress (void);
- MacAddress GetDestinationHardwareAddress (void);
+ Address GetSourceHardwareAddress (void);
+ Address GetDestinationHardwareAddress (void);
Ipv4Address GetSourceIpv4Address (void);
Ipv4Address GetDestinationIpv4Address (void);
@@ -74,8 +74,8 @@
ARP_TYPE_REPLY = 2
};
uint16_t m_type;
- MacAddress m_macSource;
- MacAddress m_macDest;
+ Address m_macSource;
+ Address m_macDest;
Ipv4Address m_ipv4Source;
Ipv4Address m_ipv4Dest;
};
--- a/src/internet-node/arp-ipv4-interface.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-ipv4-interface.cc Thu Jul 26 17:36:53 2007 +0200
@@ -24,6 +24,7 @@
#include "ns3/composite-trace-resolver.h"
#include "ns3/node.h"
#include "ns3/net-device.h"
+#include "ns3/address.h"
#include "arp-ipv4-interface.h"
#include "arp-private.h"
@@ -59,7 +60,7 @@
if (GetDevice ()->NeedsArp ())
{
Ptr<ArpPrivate> arp = m_node->QueryInterface<ArpPrivate> (ArpPrivate::iid);
- MacAddress hardwareDestination;
+ Address hardwareDestination;
bool found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination);
if (found)
{
--- a/src/internet-node/arp-l3-protocol.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-l3-protocol.cc Thu Jul 26 17:36:53 2007 +0200
@@ -97,7 +97,7 @@
}
else if (arp.IsReply () &&
arp.GetDestinationIpv4Address ().IsEqual (cache->GetInterface ()->GetAddress ()) &&
- arp.GetDestinationHardwareAddress ().IsEqual (device->GetAddress ()))
+ arp.GetDestinationHardwareAddress () == device->GetAddress ())
{
Ipv4Address from = arp.GetSourceIpv4Address ();
ArpCache::Entry *entry = cache->Lookup (from);
@@ -108,7 +108,7 @@
NS_DEBUG ("node="<<m_node->GetId ()<<", got reply from " <<
arp.GetSourceIpv4Address ()
<< " for waiting entry -- flush");
- MacAddress from_mac = arp.GetSourceHardwareAddress ();
+ Address from_mac = arp.GetSourceHardwareAddress ();
Packet waiting = entry->MarkAlive (from_mac);
cache->GetInterface ()->Send (waiting, arp.GetSourceIpv4Address ());
}
@@ -131,8 +131,8 @@
}
bool
ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination,
- Ptr<NetDevice> device,
- MacAddress *hardwareDestination)
+ Ptr<NetDevice> device,
+ Address *hardwareDestination)
{
ArpCache *cache = FindCache (device);
ArpCache::Entry *entry = cache->Lookup (destination);
@@ -213,7 +213,7 @@
}
void
-ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac)
+ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, Address toMac)
{
ArpHeader arp;
arp.SetReply (cache->GetDevice ()->GetAddress (),
--- a/src/internet-node/arp-l3-protocol.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-l3-protocol.h Thu Jul 26 17:36:53 2007 +0200
@@ -23,7 +23,7 @@
#include <list>
#include "ns3/ipv4-address.h"
-#include "ns3/mac-address.h"
+#include "ns3/address.h"
#include "ns3/ptr.h"
#include "l3-protocol.h"
@@ -64,14 +64,14 @@
*/
bool Lookup (Packet &p, Ipv4Address destination,
Ptr<NetDevice> device,
- MacAddress *hardwareDestination);
+ Address *hardwareDestination);
protected:
virtual void DoDispose (void);
private:
typedef std::list<ArpCache *> CacheList;
ArpCache *FindCache (Ptr<NetDevice> device);
void SendArpRequest (ArpCache const *cache, Ipv4Address to);
- void SendArpReply (ArpCache const *cache, Ipv4Address toIp, MacAddress toMac);
+ void SendArpReply (ArpCache const *cache, Ipv4Address toIp, Address toMac);
CacheList m_cacheList;
Ptr<Node> m_node;
};
--- a/src/internet-node/arp-private.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-private.cc Thu Jul 26 17:36:53 2007 +0200
@@ -40,7 +40,7 @@
bool
ArpPrivate::Lookup (Packet &p, Ipv4Address destination,
Ptr<NetDevice> device,
- MacAddress *hardwareDestination)
+ Address *hardwareDestination)
{
return m_arp->Lookup (p, destination, device, hardwareDestination);
}
--- a/src/internet-node/arp-private.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/arp-private.h Thu Jul 26 17:36:53 2007 +0200
@@ -27,7 +27,7 @@
namespace ns3 {
class NetDevice;
-class MacAddress;
+class Address;
class Packet;
class ArpL3Protocol;
@@ -39,7 +39,7 @@
virtual ~ArpPrivate ();
bool Lookup (Packet &p, Ipv4Address destination,
Ptr<NetDevice> device,
- MacAddress *hardwareDestination);
+ Address *hardwareDestination);
protected:
virtual void DoDispose (void);
private:
--- a/src/internet-node/header-utils.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/header-utils.cc Thu Jul 26 17:36:53 2007 +0200
@@ -26,10 +26,10 @@
{
i.WriteHtonU32 (ad.GetHostOrder ());
}
-void WriteTo (Buffer::Iterator &i, MacAddress ad)
+void WriteTo (Buffer::Iterator &i, Address ad)
{
- uint8_t mac[MacAddress::MAX_LEN];
- ad.Peek (mac);
+ uint8_t mac[Address::MAX_SIZE];
+ ad.CopyTo (mac);
i.Write (mac, ad.GetLength ());
}
@@ -37,11 +37,11 @@
{
ad.SetHostOrder (i.ReadNtohU32 ());
}
-void ReadFrom (Buffer::Iterator &i, MacAddress &ad, uint32_t len)
+void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len)
{
- uint8_t mac[MacAddress::MAX_LEN];
+ uint8_t mac[Address::MAX_SIZE];
i.Read (mac, len);
- ad.Set (mac, len);
+ ad.CopyFrom (mac, len);
}
--- a/src/internet-node/header-utils.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/internet-node/header-utils.h Thu Jul 26 17:36:53 2007 +0200
@@ -23,15 +23,15 @@
#include "ns3/buffer.h"
#include "ns3/ipv4-address.h"
-#include "ns3/mac-address.h"
+#include "ns3/address.h"
namespace ns3 {
void WriteTo (Buffer::Iterator &i, Ipv4Address ad);
-void WriteTo (Buffer::Iterator &i, MacAddress ad);
+void WriteTo (Buffer::Iterator &i, Address ad);
void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad);
-void ReadFrom (Buffer::Iterator &i, MacAddress &ad, uint32_t len);
+void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len);
};
--- a/src/node/eui48-address.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/node/eui48-address.cc Thu Jul 26 17:36:53 2007 +0200
@@ -71,6 +71,20 @@
address.CopyTo (retval.m_address);
return retval;
}
+Eui48Address
+Eui48Address::Allocate (void)
+{
+ static uint64_t id = 0;
+ id++;
+ Eui48Address address;
+ address.m_address[0] = (id >> 48) & 0xff;
+ address.m_address[1] = (id >> 32) & 0xff;
+ address.m_address[2] = (id >> 24) & 0xff;
+ address.m_address[3] = (id >> 16) & 0xff;
+ address.m_address[4] = (id >> 8) & 0xff;
+ address.m_address[5] = (id >> 0) & 0xff;
+ return address;
+}
uint8_t
Eui48Address::GetType (void)
{
--- a/src/node/eui48-address.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/node/eui48-address.h Thu Jul 26 17:36:53 2007 +0200
@@ -14,6 +14,7 @@
Eui48Address (const char *str);
Address ConvertTo (void) const;
static Eui48Address ConvertFrom (const Address &address);
+ static Eui48Address Allocate (void);
private:
static uint8_t GetType (void);
uint8_t m_address[6];
--- a/src/node/mac-address.cc Thu Jul 26 17:23:55 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include <iostream>
-#include <iomanip>
-#include "ns3/assert.h"
-#include "mac-address.h"
-
-#define ASCII_a (0x41)
-#define ASCII_z (0x5a)
-#define ASCII_A (0x61)
-#define ASCII_Z (0x7a)
-#define ASCII_COLON (0x3a)
-#define ASCII_ZERO (0x30)
-
-namespace ns3 {
-
-// Static variables
-uint8_t MacAddress::g_nextAddress[MacAddress::MAX_LEN];
-
-static char
-AsciiToLowCase (char c)
-{
- if (c >= ASCII_a && c <= ASCII_z) {
- return c;
- } else if (c >= ASCII_A && c <= ASCII_Z) {
- return c + (ASCII_a - ASCII_A);
- } else {
- return c;
- }
-}
-
-
-MacAddress::MacAddress () : m_len(0)
-{
- for (int i=0; i < MacAddress::MAX_LEN; i++)
- {
- m_address[i] = 0;
- }
-}
-
-MacAddress::MacAddress(uint8_t len) : m_len(len)
-{
- NS_ASSERT (len <= MacAddress::MAX_LEN);
- AdvanceAddress();
- memcpy(m_address, g_nextAddress, len);
-}
-
-MacAddress::MacAddress (uint8_t const *address, uint8_t len)
-{
- NS_ASSERT (len <= MacAddress::MAX_LEN);
- for (int i=0; i < len; i++)
- {
- m_address[i] = address[i];
- }
- for (int i=len; i < MacAddress::MAX_LEN; i++)
- {
- m_address[i] = 0;
- }
- m_len = len;
-}
-
-MacAddress::MacAddress (char const *str)
-{
- int i = 0;
- while (*str != 0 && i < MacAddress::MAX_LEN) {
- uint8_t byte = 0;
- while (*str != ASCII_COLON && *str != 0) {
- byte <<= 4;
- char low = AsciiToLowCase (*str);
- if (low >= ASCII_a) {
- byte |= low - ASCII_a + 10;
- } else {
- byte |= low - ASCII_ZERO;
- }
- str++;
- }
- m_address[i] = byte;
- i++;
- if (*str == 0) {
- break;
- }
- str++;
- }
- m_len = i;
-}
-
-MacAddress::~MacAddress ()
-{}
-
-bool
-MacAddress::IsEqual (MacAddress other) const
-{
- if (memcmp(other.m_address, m_address, m_len))
- {
- return false;
- }
- else
- {
- return true;
- }
-}
-
-void
-MacAddress::Print (std::ostream &os) const
-{
- int i;
- if (m_len == 0)
- {
- os << "NULL-ADDRESS";
- return;
- }
- os.setf (std::ios::hex, std::ios::basefield);
- std::cout.fill('0');
- for (i=0; i< (m_len-1); i++)
- {
- os << std::setw(2) << (uint32_t)m_address[i] << ":";
- }
- // Final byte not suffixed by ":"
- os << std::setw(2) << (uint32_t)m_address[i];
- os.setf (std::ios::dec, std::ios::basefield);
- std::cout.fill(' ');
-}
-
-uint8_t
-MacAddress::GetLength () const
-{
- return m_len;
-}
-
-void
-MacAddress::Peek (uint8_t ad[MacAddress::MAX_LEN]) const
-{
- memcpy (ad, m_address, MacAddress::MAX_LEN);
-}
-void
-MacAddress::Set (uint8_t const ad[MacAddress::MAX_LEN], uint8_t len)
-{
- memcpy (m_address, ad, MacAddress::MAX_LEN);
- m_len = len;
-}
-
-// Static methods
-void MacAddress::AdvanceAddress()
- {
- // Advance to next address, little end first
- for(size_t i = 0; i < MAX_LEN; ++i)
- {
- if (++g_nextAddress[i] != 0) break;
- }
- }
-
-// Non-member operators
-bool operator == (MacAddress const&a, MacAddress const&b)
-{
- return a.IsEqual (b);
-}
-
-bool operator != (MacAddress const&a, MacAddress const&b)
-{
- return !a.IsEqual (b);
-}
-
-bool operator < (MacAddress const&a, MacAddress const&b)
-{
- uint8_t a_p[MacAddress::MAX_LEN];
- uint8_t b_p[MacAddress::MAX_LEN];
- a.Peek (a_p);
- b.Peek (b_p);
- NS_ASSERT (a.GetLength() == b.GetLength());
- for (uint8_t i = 0; i < a.GetLength(); i++)
- {
- if (a_p[i] < b_p[i])
- {
- return true;
- }
- else if (a_p[i] > b_p[i])
- {
- return false;
- }
- }
- return false;
-}
-
-std::ostream& operator<< (std::ostream& os, MacAddress const& address)
-{
- address.Print (os);
- return os;
-}
-
-
-}; // namespace ns3
--- a/src/node/mac-address.h Thu Jul 26 17:23:55 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2005 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#ifndef MAC_ADDRESS_H
-#define MAC_ADDRESS_H
-
-#include <stdint.h>
-#include <ostream>
-
-namespace ns3 {
-
-/**
- * \brief base class for Network Device addresses
- *
- * This class is a base class for different types of Network
- * Device addresses. It generically stores an address of
- * MAX_ADDR_LEN bytes, and provides methods to compare, print, and set
- * the address.
- */
-class MacAddress {
-public:
- enum {
- MAX_LEN = 32
- };
- /**
- * \brief Construct a null MacAddress
- *
- * This MacAddress has length of zero, and is internally all zeros
- */
- MacAddress (void);
- /**
- * \brief Construct a MacAddress using the next available
- * address.
- * \see MacAddres::Next
- * \param len length, in bytes, of the desired address
- */
- MacAddress(uint8_t len);
- /**
- * \brief Construct a MacAddress from a byte-array
- *
- * low byte should be first.
- * \param address a byte array indicating the address
- * \param len length, in bytes, of the address points to
- */
- MacAddress (uint8_t const *address, uint8_t len);
- /**
- * \brief Construct a MacAddress from a C-string
- *
- * The string should look like this:
- * hh:xx:xx:xx:xx:ll
- * where hh is the high byte and ll is
- * the low byte.
- * \param address the C-string representation of the address
- */
- MacAddress (char const *address);
- ~MacAddress ();
-
- /**
- * \brief Comparison operation between MacAddresses
- * \param other The address against which to compare this one
- * \return True if they are equal, false otherwise.
- */
- bool IsEqual (MacAddress other) const;
- /**
- * \brief Print this MacAddress to a stream
- *
- * The format is colon seperated groups of two hexadecimal digits
- * \param os The output stream desired
- */
- void Print (std::ostream &os) const;
-
- /**
- * \return The length in bytes of this MacAddress
- */
- uint8_t GetLength() const;
- /**
- * \brief Copy routine to peek the contents of the MacAddress
- *
- * \param ad Output parameter which holds a copy of this MacAddress
- */
- void Peek (uint8_t ad[MAX_LEN]) const;
- /**
- * \brief Sets this MacAddress to a specific value
- * \param ad byte buffer to set the MacAddress to
- * \param len the length of the buffer
- */
- void Set (uint8_t const ad[MAX_LEN], uint8_t len);
-
- // Static methods/members
- /**
- *
- * Advance the global to the next available mac address.
- */
- static void AdvanceAddress();
- static uint8_t g_nextAddress[MAX_LEN];
-
-private:
- uint8_t m_address[MAX_LEN];
- uint8_t m_len;
-};
-
-bool operator == (MacAddress const&a, MacAddress const&b);
-bool operator != (MacAddress const&a, MacAddress const&b);
-bool operator < (MacAddress const&a, MacAddress const&b);
-
-std::ostream& operator<< (std::ostream& os, MacAddress const& address);
-
-}; // namespace ns3
-
-#endif /* MAC_ADDRESS_H */
--- a/src/node/net-device.cc Thu Jul 26 17:23:55 2007 +0200
+++ b/src/node/net-device.cc Thu Jul 26 17:36:53 2007 +0200
@@ -32,7 +32,7 @@
const InterfaceId NetDevice::iid = MakeInterfaceId ("NetDevice", Object::iid);
-NetDevice::NetDevice(Ptr<Node> node, const MacAddress& addr) :
+NetDevice::NetDevice(Ptr<Node> node, const Address& addr) :
m_node (node),
m_name(""),
m_ifIndex (0),
@@ -50,7 +50,7 @@
NetDevice::~NetDevice ()
{}
-MacAddress
+Address
NetDevice::GetAddress (void) const
{
return m_address;
@@ -110,7 +110,7 @@
{
return m_isBroadcast;
}
-MacAddress const &
+Address const &
NetDevice::GetBroadcast (void) const
{
NS_ASSERT (m_isBroadcast);
@@ -118,7 +118,7 @@
}
void
-NetDevice::EnableBroadcast (MacAddress broadcast)
+NetDevice::EnableBroadcast (Address broadcast)
{
m_isBroadcast = true;
m_broadcast = broadcast;
@@ -168,7 +168,7 @@
// Receive packet from above
bool
-NetDevice::Send(Packet& p, const MacAddress& dest, uint16_t protocolNumber)
+NetDevice::Send(Packet& p, const Address& dest, uint16_t protocolNumber)
{
if (m_isUp)
{
--- a/src/node/net-device.h Thu Jul 26 17:23:55 2007 +0200
+++ b/src/node/net-device.h Thu Jul 26 17:36:53 2007 +0200
@@ -27,7 +27,7 @@
#include "ns3/packet.h"
#include "ns3/object.h"
#include "ns3/ptr.h"
-#include "mac-address.h"
+#include "address.h"
namespace ns3 {
@@ -78,9 +78,9 @@
Ptr<Channel> GetChannel (void) const;
/**
- * \return the current MacAddress of this interface.
+ * \return the current Address of this interface.
*/
- MacAddress GetAddress (void) const;
+ Address GetAddress (void) const;
/**
* \param mtu MTU value, in bytes, to set for the device
* \return whether the MTU value was within legal bounds
@@ -136,7 +136,7 @@
* Calling this method is invalid if IsBroadcast returns
* not true.
*/
- MacAddress const &GetBroadcast (void) const;
+ Address const &GetBroadcast (void) const;
/**
* \return value of m_isMulticast flag
*/
@@ -153,11 +153,11 @@
* is received.
*
* Called from higher layer to send packet into Network Device
- * to the specified destination MacAddress
+ * to the specified destination Address
*
* \return whether the Send operation succeeded
*/
- bool Send(Packet& p, const MacAddress& dest, uint16_t protocolNumber);
+ bool Send(Packet& p, const Address& dest, uint16_t protocolNumber);
/**
* \returns the node base class which contains this network
* interface.
@@ -187,12 +187,12 @@
* \param node base class node pointer of device's node
* \param addr MAC address of this device.
*/
- NetDevice(Ptr<Node> node, const MacAddress& addr);
+ NetDevice(Ptr<Node> node, const Address& addr);
/**
* Enable broadcast support. This method should be
* called by subclasses from their constructor
*/
- void EnableBroadcast (MacAddress broadcast);
+ void EnableBroadcast (Address broadcast);
/**
* Set m_isBroadcast flag to false
*/
@@ -255,7 +255,7 @@
* method. When the link is Up, this method is invoked to ask
* subclasses to forward packets. Subclasses MUST override this method.
*/
- virtual bool SendTo (Packet& p, const MacAddress& dest) = 0;
+ virtual bool SendTo (Packet& p, const Address& dest) = 0;
/**
* \returns true if this NetDevice needs the higher-layers
* to perform ARP over it, false otherwise.
@@ -282,8 +282,8 @@
Ptr<Node> m_node;
std::string m_name;
uint16_t m_ifIndex;
- MacAddress m_address;
- MacAddress m_broadcast;
+ Address m_address;
+ Address m_broadcast;
uint16_t m_mtu;
bool m_isUp;
bool m_isBroadcast;
--- a/src/node/wscript Thu Jul 26 17:23:55 2007 +0200
+++ b/src/node/wscript Thu Jul 26 17:36:53 2007 +0200
@@ -12,7 +12,6 @@
'node.cc',
'ipv4-address.cc',
'net-device.cc',
- 'mac-address.cc',
'llc-snap-header.cc',
'ipv4-route.cc',
'queue.cc',
@@ -35,7 +34,6 @@
'node.h',
'ipv4-address.h',
'net-device.h',
- 'mac-address.h',
'ipv4-route.h',
'queue.h',
'drop-tail-queue.h',