--- a/examples/csma-broadcast.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/examples/csma-broadcast.cc Thu Sep 13 10:53:24 2007 -0700
@@ -49,7 +49,7 @@
#include "ns3/csma-net-device.h"
#include "ns3/csma-topology.h"
#include "ns3/csma-ipv4-topology.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ns3/ipv4-address.h"
#include "ns3/inet-socket-address.h"
#include "ns3/ipv4.h"
@@ -116,13 +116,13 @@
DataRate(5000000), MilliSeconds(2));
uint32_t n0ifIndex0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel0,
- Eui48Address("10:54:23:54:0:50"));
+ Mac48Address("10:54:23:54:0:50"));
uint32_t n0ifIndex1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, channel1,
- Eui48Address("10:54:23:54:0:51"));
+ Mac48Address("10:54:23:54:0:51"));
uint32_t n1ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, channel0,
- Eui48Address("10:54:23:54:23:51"));
+ Mac48Address("10:54:23:54:23:51"));
uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channel1,
- Eui48Address("10:54:23:54:23:52"));
+ Mac48Address("10:54:23:54:23:52"));
// Later, we add IP addresses.
CsmaIpv4Topology::AddIpv4Address (
--- a/examples/csma-multicast.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/examples/csma-multicast.cc Thu Sep 13 10:53:24 2007 -0700
@@ -44,7 +44,7 @@
#include "ns3/csma-net-device.h"
#include "ns3/csma-topology.h"
#include "ns3/csma-ipv4-topology.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ns3/ipv4-address.h"
#include "ns3/inet-socket-address.h"
#include "ns3/ipv4.h"
@@ -130,19 +130,19 @@
// connect to Lan0.
//
uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan0,
- Eui48Address("08:00:2e:00:00:00"));
+ Mac48Address("08:00:2e:00:00:00"));
uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan0,
- Eui48Address("08:00:2e:00:00:01"));
+ Mac48Address("08:00:2e:00:00:01"));
uint32_t nd2Lan0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan0,
- Eui48Address("08:00:2e:00:00:02"));
+ Mac48Address("08:00:2e:00:00:02"));
uint32_t nd2Lan1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan1,
- Eui48Address("08:00:2e:00:00:03"));
+ Mac48Address("08:00:2e:00:00:03"));
uint32_t nd3 __attribute__ ((unused)) =
CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan1,
- Eui48Address("08:00:2e:00:00:04"));
+ Mac48Address("08:00:2e:00:00:04"));
uint32_t nd4 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, lan1,
- Eui48Address("08:00:2e:00:00:05"));
+ Mac48Address("08:00:2e:00:00:05"));
NS_DEBUG ("nd0 = " << nd0);
NS_DEBUG ("nd1 = " << nd1);
--- a/examples/csma-one-subnet.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/examples/csma-one-subnet.cc Thu Sep 13 10:53:24 2007 -0700
@@ -40,7 +40,7 @@
#include "ns3/csma-net-device.h"
#include "ns3/csma-topology.h"
#include "ns3/csma-ipv4-topology.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ns3/ipv4-address.h"
#include "ns3/inet-socket-address.h"
#include "ns3/ipv4.h"
@@ -120,16 +120,16 @@
// zero.
//
uint32_t nd0 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n0, lan,
- Eui48Address("08:00:2e:00:00:00"));
+ Mac48Address("08:00:2e:00:00:00"));
uint32_t nd1 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n1, lan,
- Eui48Address("08:00:2e:00:00:01"));
+ Mac48Address("08:00:2e:00:00:01"));
uint32_t nd2 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, lan,
- Eui48Address("08:00:2e:00:00:02"));
+ Mac48Address("08:00:2e:00:00:02"));
uint32_t nd3 = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, lan,
- Eui48Address("08:00:2e:00:00:03"));
+ Mac48Address("08:00:2e:00:00:03"));
NS_DEBUG ("nd0 = " << nd0);
NS_DEBUG ("nd1 = " << nd1);
--- a/examples/csma-packet-socket.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/examples/csma-packet-socket.cc Thu Sep 13 10:53:24 2007 -0700
@@ -48,7 +48,7 @@
#include "ns3/internet-node.h"
#include "ns3/csma-channel.h"
#include "ns3/csma-net-device.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ns3/packet-socket-address.h"
#include "ns3/socket.h"
#include "ns3/onoff-application.h"
--- a/examples/mixed-global-routing.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/examples/mixed-global-routing.cc Thu Sep 13 10:53:24 2007 -0700
@@ -56,7 +56,7 @@
#include "ns3/csma-net-device.h"
#include "ns3/csma-topology.h"
#include "ns3/csma-ipv4-topology.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ns3/ipv4-address.h"
#include "ns3/ipv4.h"
#include "ns3/socket.h"
@@ -129,13 +129,13 @@
DataRate(5000000), MilliSeconds(2));
uint32_t n2ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n2, channelc0,
- Eui48Address("10:54:23:54:23:50"));
+ Mac48Address("10:54:23:54:23:50"));
uint32_t n3ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n3, channelc0,
- Eui48Address("10:54:23:54:23:51"));
+ Mac48Address("10:54:23:54:23:51"));
uint32_t n4ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n4, channelc0,
- Eui48Address("10:54:23:54:23:52"));
+ Mac48Address("10:54:23:54:23:52"));
uint32_t n5ifIndex = CsmaIpv4Topology::AddIpv4CsmaNetDevice (n5, channelc0,
- Eui48Address("10:54:23:54:23:53"));
+ Mac48Address("10:54:23:54:23:53"));
// Later, we add IP addresses.
PointToPointTopology::AddIpv4Addresses (
--- a/examples/simple-point-to-point.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/examples/simple-point-to-point.cc Thu Sep 13 10:53:24 2007 -0700
@@ -64,7 +64,7 @@
using namespace ns3;
-NS_DEBUG_COMPONENT_DEFINE ("Me");
+NS_DEBUG_COMPONENT_DEFINE ("SimplePointToPoint");
int
main (int argc, char *argv[])
@@ -74,7 +74,7 @@
// for selected modules; the below lines suggest how to do this
// remember to add #include "ns3/debug.h" before enabling these
#if 0
- DebugComponentEnable("Me");
+ DebugComponentEnable("SimplePointToPoint");
DebugComponentEnable("Object");
DebugComponentEnable("Queue");
DebugComponentEnable("DropTailQueue");
--- a/src/devices/csma/csma-ipv4-topology.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/src/devices/csma/csma-ipv4-topology.cc Thu Sep 13 10:53:24 2007 -0700
@@ -38,7 +38,7 @@
CsmaIpv4Topology::AddIpv4CsmaNetDevice(
Ptr<Node> node,
Ptr<CsmaChannel> channel,
- Eui48Address addr)
+ Mac48Address addr)
{
Ptr<Queue> q = Queue::CreateDefault ();
@@ -55,7 +55,7 @@
void
CsmaIpv4Topology::AddIpv4LlcCsmaNode(Ptr<Node> n1,
Ptr<CsmaChannel> ch,
- Eui48Address addr)
+ Mac48Address addr)
{
Ptr<Queue> q = Queue::CreateDefault ();
@@ -75,7 +75,7 @@
void
CsmaIpv4Topology::AddIpv4RawCsmaNode(Ptr<Node> n1,
Ptr<CsmaChannel> ch,
- Eui48Address addr)
+ Mac48Address addr)
{
Ptr<Queue> q = Queue::CreateDefault ();
--- a/src/devices/csma/csma-ipv4-topology.h Thu Sep 13 10:52:41 2007 -0700
+++ b/src/devices/csma/csma-ipv4-topology.h Thu Sep 13 10:53:24 2007 -0700
@@ -63,7 +63,7 @@
*/
static uint32_t AddIpv4CsmaNetDevice(Ptr<Node> node,
Ptr<CsmaChannel> channel,
- Eui48Address addr);
+ Mac48Address addr);
/**
* \param n1 Node to be attached to the Csma channel
@@ -76,7 +76,7 @@
*/
static void AddIpv4RawCsmaNode( Ptr<Node> n1,
Ptr<CsmaChannel> ch,
- Eui48Address addr);
+ Mac48Address addr);
/**
* \param n1 Node to be attached to the Csma channel
@@ -89,7 +89,7 @@
*/
static void AddIpv4LlcCsmaNode( Ptr<Node> n1,
Ptr<CsmaChannel> ch,
- Eui48Address addr);
+ Mac48Address addr);
--- a/src/devices/csma/csma-net-device.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/src/devices/csma/csma-net-device.cc Thu Sep 13 10:53:24 2007 -0700
@@ -69,7 +69,7 @@
}
CsmaNetDevice::CsmaNetDevice (Ptr<Node> node)
- : NetDevice (node, Eui48Address::Allocate ()),
+ : NetDevice (node, Mac48Address::Allocate ()),
m_bps (DataRate (0xffffffff))
{
NS_DEBUG ("CsmaNetDevice::CsmaNetDevice (" << node << ")");
@@ -77,7 +77,7 @@
Init(true, true);
}
-CsmaNetDevice::CsmaNetDevice (Ptr<Node> node, Eui48Address addr,
+CsmaNetDevice::CsmaNetDevice (Ptr<Node> node, Mac48Address addr,
CsmaEncapsulationMode encapMode)
: NetDevice(node, addr),
m_bps (DataRate (0xffffffff))
@@ -88,7 +88,7 @@
Init(true, true);
}
-CsmaNetDevice::CsmaNetDevice (Ptr<Node> node, Eui48Address addr,
+CsmaNetDevice::CsmaNetDevice (Ptr<Node> node, Mac48Address addr,
CsmaEncapsulationMode encapMode,
bool sendEnable, bool receiveEnable)
: NetDevice(node, addr),
@@ -138,8 +138,8 @@
m_channel = 0;
m_queue = 0;
- EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff"));
- EnableMulticast (Eui48Address ("01:00:5e:00:00:00"));
+ EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff"));
+ EnableMulticast (Mac48Address ("01:00:5e:00:00:00"));
SetSendEnable (sendEnable);
SetReceiveEnable (receiveEnable);
@@ -192,7 +192,7 @@
m_backoff.m_maxRetries = maxRetries;
}
void
-CsmaNetDevice::AddHeader (Packet& p, Eui48Address dest,
+CsmaNetDevice::AddHeader (Packet& p, Mac48Address dest,
uint16_t protocolNumber)
{
if (m_encapMode == RAW)
@@ -201,7 +201,7 @@
}
EthernetHeader header (false);
EthernetTrailer trailer;
- Eui48Address source = Eui48Address::ConvertFrom (GetAddress ());
+ Mac48Address source = Mac48Address::ConvertFrom (GetAddress ());
header.SetSource(source);
header.SetDestination(dest);
@@ -295,7 +295,7 @@
if (!IsSendEnabled())
return false;
- Eui48Address destination = Eui48Address::ConvertFrom (dest);
+ Mac48Address destination = Mac48Address::ConvertFrom (dest);
AddHeader(p, destination, protocolNumber);
// Place the packet to be sent on the send queue
@@ -509,9 +509,9 @@
{
EthernetHeader header (false);
EthernetTrailer trailer;
- Eui48Address broadcast;
- Eui48Address multicast;
- Eui48Address destination;
+ Mac48Address broadcast;
+ Mac48Address multicast;
+ Mac48Address destination;
Packet p = packet;
NS_DEBUG ("CsmaNetDevice::Receive (): UID is " << p.GetUid());
@@ -543,7 +543,7 @@
// We are going to receive all packets destined to any multicast address,
// which means clearing the low-order 23 bits the header destination
//
- Eui48Address mcDest;
+ Mac48Address mcDest;
uint8_t mcBuf[6];
header.GetDestination ().CopyTo (mcBuf);
@@ -552,9 +552,9 @@
mcBuf[5] = 0;
mcDest.CopyFrom (mcBuf);
- multicast = Eui48Address::ConvertFrom (GetMulticast ());
- broadcast = Eui48Address::ConvertFrom (GetBroadcast ());
- destination = Eui48Address::ConvertFrom (GetAddress ());
+ multicast = Mac48Address::ConvertFrom (GetMulticast ());
+ broadcast = Mac48Address::ConvertFrom (GetBroadcast ());
+ destination = Mac48Address::ConvertFrom (GetAddress ());
if ((header.GetDestination () != broadcast) &&
(mcDest != multicast) &&
@@ -609,7 +609,7 @@
// primarily since we know that by construction, but also since the parameter
// is an Ipv4Address.
//
- Eui48Address etherAddr = Eui48Address::ConvertFrom (hardwareDestination);
+ Mac48Address etherAddr = Mac48Address::ConvertFrom (hardwareDestination);
//
// We now have the multicast address in an abstract 48-bit container. We
// need to pull it out so we can play with it. When we're done, we have the
@@ -633,11 +633,11 @@
etherBuffer[5] = ipBuffer[3];
//
// Now, etherBuffer has the desired ethernet multicast address. We have to
-// suck these bits back into the Eui48Address,
+// suck these bits back into the Mac48Address,
//
etherAddr.CopyFrom (etherBuffer);
//
-// Implicit conversion (operator Address ()) is defined for Eui48Address, so
+// Implicit conversion (operator Address ()) is defined for Mac48Address, so
// use it by just returning the EUI-48 address which is automagically converted
// to an Address.
//
--- a/src/devices/csma/csma-net-device.h Thu Sep 13 10:52:41 2007 -0700
+++ b/src/devices/csma/csma-net-device.h Thu Sep 13 10:53:24 2007 -0700
@@ -34,7 +34,7 @@
#include "ns3/data-rate.h"
#include "ns3/ptr.h"
#include "ns3/random-variable.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
namespace ns3 {
@@ -109,7 +109,7 @@
* \param addr The source MAC address of the net device.
* \param pktType the type of encapsulation
*/
- CsmaNetDevice (Ptr<Node> node, Eui48Address addr, CsmaEncapsulationMode pktType);
+ CsmaNetDevice (Ptr<Node> node, Mac48Address addr, CsmaEncapsulationMode pktType);
/**
* Construct a CsmaNetDevice
@@ -124,7 +124,7 @@
* \param sendEnable whether this device is able to send
* \param receiveEnable whether this device is able to receive
*/
- CsmaNetDevice (Ptr<Node> node, Eui48Address addr,
+ CsmaNetDevice (Ptr<Node> node, Mac48Address addr,
CsmaEncapsulationMode pktType,
bool sendEnable, bool receiveEnable);
/**
@@ -231,7 +231,7 @@
* multicast group.
*
* @see Ipv4Address
- * @see Eui48Address
+ * @see Mac48Address
* @see Address
*/
Address MakeMulticastAddress (Ipv4Address multicastGroup) const;
@@ -279,7 +279,7 @@
* \param protocolNumber In some protocols, identifies the type of
* payload contained in this packet.
*/
- void AddHeader (Packet& p, Eui48Address dest,
+ void AddHeader (Packet& p, Mac48Address dest,
uint16_t protocolNumber);
/**
* Removes, from a packet of data, all headers and trailers that
--- a/src/devices/point-to-point/point-to-point-net-device.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/src/devices/point-to-point/point-to-point-net-device.cc Thu Sep 13 10:53:24 2007 -0700
@@ -24,7 +24,7 @@
#include "ns3/queue.h"
#include "ns3/simulator.h"
#include "ns3/composite-trace-resolver.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ns3/llc-snap-header.h"
#include "point-to-point-net-device.h"
#include "point-to-point-channel.h"
@@ -61,7 +61,7 @@
PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
const DataRate& rate)
:
- NetDevice(node, Eui48Address::Allocate ()),
+ NetDevice(node, Mac48Address::Allocate ()),
m_txMachineState (READY),
m_bps (rate),
m_tInterframeGap (Seconds(0)),
@@ -74,11 +74,11 @@
// BUGBUG FIXME
//
// You _must_ support broadcast to get any sort of packet from the ARP layer.
- EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff"));
+ EnableBroadcast (Mac48Address ("ff:ff:ff:ff:ff:ff"));
//
// We want to allow multicast packets to flow across this link
//
- EnableMulticast (Eui48Address ("01:00:5e:00:00:00"));
+ EnableMulticast (Mac48Address ("01:00:5e:00:00:00"));
EnablePointToPoint();
}
--- a/src/internet-node/arp-ipv4-interface.h Thu Sep 13 10:52:41 2007 -0700
+++ b/src/internet-node/arp-ipv4-interface.h Thu Sep 13 10:53:24 2007 -0700
@@ -24,7 +24,6 @@
#include "ipv4-interface.h"
#include "ns3/ptr.h"
-#include "ns3/eui48-address.h"
namespace ns3 {
--- a/src/internet-node/ipv4-loopback-interface.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/src/internet-node/ipv4-loopback-interface.cc Thu Sep 13 10:53:24 2007 -0700
@@ -23,7 +23,7 @@
#include "ns3/debug.h"
#include "ns3/net-device.h"
#include "ns3/node.h"
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
#include "ipv4-loopback-interface.h"
#include "ipv4-l3-protocol.h"
@@ -52,8 +52,8 @@
Ptr<Ipv4L3Protocol> ipv4 =
m_node->QueryInterface<Ipv4L3Protocol> (Ipv4L3Protocol::iid);
- ipv4->Receive (GetDevice (), packet, Ipv4L3Protocol::PROT_NUMBER,
- Eui48Address ("ff:ff:ff:ff:ff:ff"));
+ ipv4->Receive (0, packet, Ipv4L3Protocol::PROT_NUMBER,
+ Mac48Address ("ff:ff:ff:ff:ff:ff"));
}
}//namespace ns3
--- a/src/node/address-utils.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/src/node/address-utils.cc Thu Sep 13 10:53:24 2007 -0700
@@ -32,7 +32,7 @@
ad.CopyTo (mac);
i.Write (mac, ad.GetLength ());
}
-void WriteTo (Buffer::Iterator &i, Eui48Address ad)
+void WriteTo (Buffer::Iterator &i, Mac48Address ad)
{
uint8_t mac[6];
ad.CopyTo (mac);
@@ -49,7 +49,7 @@
i.Read (mac, len);
ad.CopyFrom (mac, len);
}
-void ReadFrom (Buffer::Iterator &i, Eui48Address &ad)
+void ReadFrom (Buffer::Iterator &i, Mac48Address &ad)
{
uint8_t mac[6];
i.Read (mac, 6);
--- a/src/node/address-utils.h Thu Sep 13 10:52:41 2007 -0700
+++ b/src/node/address-utils.h Thu Sep 13 10:53:24 2007 -0700
@@ -24,17 +24,17 @@
#include "ns3/buffer.h"
#include "ipv4-address.h"
#include "address.h"
-#include "eui48-address.h"
+#include "mac48-address.h"
namespace ns3 {
void WriteTo (Buffer::Iterator &i, Ipv4Address ad);
void WriteTo (Buffer::Iterator &i, const Address &ad);
-void WriteTo (Buffer::Iterator &i, Eui48Address ad);
+void WriteTo (Buffer::Iterator &i, Mac48Address ad);
void ReadFrom (Buffer::Iterator &i, Ipv4Address &ad);
void ReadFrom (Buffer::Iterator &i, Address &ad, uint32_t len);
-void ReadFrom (Buffer::Iterator &i, Eui48Address &ad);
+void ReadFrom (Buffer::Iterator &i, Mac48Address &ad);
};
--- a/src/node/ethernet-header.cc Thu Sep 13 10:52:41 2007 -0700
+++ b/src/node/ethernet-header.cc Thu Sep 13 10:53:24 2007 -0700
@@ -73,22 +73,22 @@
}
void
-EthernetHeader::SetSource (Eui48Address source)
+EthernetHeader::SetSource (Mac48Address source)
{
m_source = source;
}
-Eui48Address
+Mac48Address
EthernetHeader::GetSource (void) const
{
return m_source;
}
void
-EthernetHeader::SetDestination (Eui48Address dst)
+EthernetHeader::SetDestination (Mac48Address dst)
{
m_destination = dst;
}
-Eui48Address
+Mac48Address
EthernetHeader::GetDestination (void) const
{
return m_destination;
--- a/src/node/ethernet-header.h Thu Sep 13 10:52:41 2007 -0700
+++ b/src/node/ethernet-header.h Thu Sep 13 10:53:24 2007 -0700
@@ -24,7 +24,7 @@
#include "ns3/header.h"
#include <string>
-#include "ns3/eui48-address.h"
+#include "ns3/mac48-address.h"
namespace ns3 {
@@ -69,11 +69,11 @@
/**
* \param source The source address of this packet
*/
- void SetSource (Eui48Address source);
+ void SetSource (Mac48Address source);
/**
* \param destination The destination address of this packet.
*/
- void SetDestination (Eui48Address destination);
+ void SetDestination (Mac48Address destination);
/**
* \param preambleSfd The value that the preambleSfd field should take
*/
@@ -89,11 +89,11 @@
/**
* \return The source address of this packet
*/
- Eui48Address GetSource (void) const;
+ Mac48Address GetSource (void) const;
/**
* \return The destination address of this packet
*/
- Eui48Address GetDestination (void) const;
+ Mac48Address GetDestination (void) const;
/**
* \return The value of the PreambleSfd field
*/
@@ -119,8 +119,8 @@
bool m_enPreambleSfd;
uint64_t m_preambleSfd; /// Value of the Preamble/SFD fields
uint16_t m_lengthType; /// Length or type of the packet
- Eui48Address m_source; /// Source address
- Eui48Address m_destination; /// Destination address
+ Mac48Address m_source; /// Source address
+ Mac48Address m_destination; /// Destination address
};
}; // namespace ns3
--- a/src/node/eui48-address.cc Thu Sep 13 10:52:41 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * 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 "eui48-address.h"
-#include "address.h"
-#include "ns3/assert.h"
-#include <iomanip>
-#include <iostream>
-
-namespace ns3 {
-
-#define ASCII_a (0x41)
-#define ASCII_z (0x5a)
-#define ASCII_A (0x61)
-#define ASCII_Z (0x7a)
-#define ASCII_COLON (0x3a)
-#define ASCII_ZERO (0x30)
-
-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;
- }
-}
-
-
-Eui48Address::Eui48Address ()
-{
- memset (m_address, 0, 6);
-}
-Eui48Address::Eui48Address (const char *str)
-{
- int i = 0;
- while (*str != 0 && i < 6)
- {
- 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++;
- }
- NS_ASSERT (i == 6);
-}
-void
-Eui48Address::CopyFrom (const uint8_t buffer[6])
-{
- memcpy (m_address, buffer, 6);
-}
-void
-Eui48Address::CopyTo (uint8_t buffer[6]) const
-{
- memcpy (buffer, m_address, 6);
-}
-
-bool
-Eui48Address::IsMatchingType (const Address &address)
-{
- return address.CheckCompatible (GetType (), 6);
-}
-Eui48Address::operator Address ()
-{
- return ConvertTo ();
-}
-Address
-Eui48Address::ConvertTo (void) const
-{
- return Address (GetType (), m_address, 6);
-}
-Eui48Address
-Eui48Address::ConvertFrom (const Address &address)
-{
- NS_ASSERT (address.CheckCompatible (GetType (), 6));
- Eui48Address retval;
- address.CopyTo (retval.m_address);
- return retval;
-}
-Eui48Address
-Eui48Address::Allocate (void)
-{
- static uint64_t id = 0;
- id++;
- Eui48Address address;
- address.m_address[0] = (id >> 40) & 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)
-{
- static uint8_t type = Address::Register ();
- return type;
-}
-
-bool operator == (const Eui48Address &a, const Eui48Address &b)
-{
- uint8_t ada[6];
- uint8_t adb[6];
- a.CopyTo (ada);
- b.CopyTo (adb);
- return memcmp (ada, adb, 6) == 0;
-}
-bool operator != (const Eui48Address &a, const Eui48Address &b)
-{
- return ! (a == b);
-}
-
-std::ostream& operator<< (std::ostream& os, const Eui48Address & address)
-{
- uint8_t ad[6];
- address.CopyTo (ad);
-
- os.setf (std::ios::hex, std::ios::basefield);
- os.fill('0');
- for (uint8_t i=0; i < 5; i++)
- {
- os << std::setw(2) << (uint32_t)ad[i] << ":";
- }
- // Final byte not suffixed by ":"
- os << std::setw(2) << (uint32_t)ad[5];
- os.setf (std::ios::dec, std::ios::basefield);
- os.fill(' ');
- return os;
-}
-
-
-} // namespace ns3
--- a/src/node/eui48-address.h Thu Sep 13 10:52:41 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * 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 EUI48_ADDRESS_H
-#define EUI48_ADDRESS_H
-
-#include <stdint.h>
-#include <ostream>
-
-namespace ns3 {
-
-class Address;
-
-/**
- * \brief an EUI-48 address
- *
- * This class can contain 48 bit IEEE addresses.
- */
-class Eui48Address
-{
-public:
- Eui48Address ();
- /**
- * \param str a string representing the new Eui48Address
- *
- * The format of the string is "xx:xx:xx:xx:xx:xx"
- */
- Eui48Address (const char *str);
-
- /**
- * \param buffer address in network order
- *
- * Copy the input address to our internal buffer.
- */
- void CopyFrom (const uint8_t buffer[6]);
- /**
- * \param buffer address in network order
- *
- * Copy the internal address to the input buffer.
- */
- void CopyTo (uint8_t buffer[6]) const;
-
- /**
- * \returns a new Address instance
- *
- * Convert an instance of this class to a polymorphic Address instance.
- */
- operator Address ();
- /**
- * \param address a polymorphic address
- * \returns a new Eui48Address from the polymorphic address
- *
- * This function performs a type check and asserts if the
- * type of the input address is not compatible with an
- * Eui48Address.
- */
- static Eui48Address ConvertFrom (const Address &address);
- /**
- * \returns true if the address matches, false otherwise.
- */
- static bool IsMatchingType (const Address &address);
- /**
- * Allocate a new Eui48Address.
- */
- static Eui48Address Allocate (void);
-private:
- /**
- * \returns a new Address instance
- *
- * Convert an instance of this class to a polymorphic Address instance.
- */
- Address ConvertTo (void) const;
- static uint8_t GetType (void);
- uint8_t m_address[6];
-};
-
-bool operator == (const Eui48Address &a, const Eui48Address &b);
-bool operator != (const Eui48Address &a, const Eui48Address &b);
-std::ostream& operator<< (std::ostream& os, const Eui48Address & address);
-
-} // namespace ns3
-
-#endif /* EUI48_ADDRESS_H */
--- a/src/node/eui64-address.cc Thu Sep 13 10:52:41 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * 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 "eui64-address.h"
-#include "address.h"
-#include "ns3/assert.h"
-#include <iomanip>
-#include <iostream>
-
-namespace ns3 {
-
-#define ASCII_a (0x41)
-#define ASCII_z (0x5a)
-#define ASCII_A (0x61)
-#define ASCII_Z (0x7a)
-#define ASCII_COLON (0x3a)
-#define ASCII_ZERO (0x30)
-
-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;
- }
-}
-
-
-Eui64Address::Eui64Address ()
-{
- memset (m_address, 0, 8);
-}
-Eui64Address::Eui64Address (const char *str)
-{
- int i = 0;
- while (*str != 0 && i < 8)
- {
- 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++;
- }
- NS_ASSERT (i == 6);
-}
-void
-Eui64Address::CopyFrom (const uint8_t buffer[8])
-{
- memcpy (m_address, buffer, 8);
-}
-void
-Eui64Address::CopyTo (uint8_t buffer[8]) const
-{
- memcpy (buffer, m_address, 8);
-}
-
-bool
-Eui64Address::IsMatchingType (const Address &address)
-{
- return address.CheckCompatible (GetType (), 8);
-}
-Eui64Address::operator Address ()
-{
- return ConvertTo ();
-}
-Eui64Address
-Eui64Address::ConvertFrom (const Address &address)
-{
- NS_ASSERT (address.CheckCompatible (GetType (), 8));
- Eui64Address retval;
- address.CopyTo (retval.m_address);
- return retval;
-}
-Address
-Eui64Address::ConvertTo (void) const
-{
- return Address (GetType (), m_address, 8);
-}
-
-Eui64Address
-Eui64Address::Allocate (void)
-{
- static uint64_t id = 0;
- id++;
- Eui64Address address;
- address.m_address[0] = (id >> 56) & 0xff;
- address.m_address[1] = (id >> 48) & 0xff;
- address.m_address[2] = (id >> 40) & 0xff;
- address.m_address[3] = (id >> 32) & 0xff;
- address.m_address[4] = (id >> 24) & 0xff;
- address.m_address[5] = (id >> 16) & 0xff;
- address.m_address[6] = (id >> 8) & 0xff;
- address.m_address[7] = (id >> 0) & 0xff;
- return address;
-}
-uint8_t
-Eui64Address::GetType (void)
-{
- static uint8_t type = Address::Register ();
- return type;
-}
-
-bool operator == (const Eui64Address &a, const Eui64Address &b)
-{
- uint8_t ada[8];
- uint8_t adb[8];
- a.CopyTo (ada);
- b.CopyTo (adb);
- return memcmp (ada, adb, 8) == 0;
-}
-bool operator != (const Eui64Address &a, const Eui64Address &b)
-{
- return ! (a == b);
-}
-
-std::ostream& operator<< (std::ostream& os, const Eui64Address & address)
-{
- uint8_t ad[8];
- address.CopyTo (ad);
-
- os.setf (std::ios::hex, std::ios::basefield);
- os.fill('0');
- for (uint8_t i=0; i < 7; i++)
- {
- os << std::setw(2) << (uint32_t)ad[i] << ":";
- }
- // Final byte not suffixed by ":"
- os << std::setw(2) << (uint32_t)ad[7];
- os.setf (std::ios::dec, std::ios::basefield);
- os.fill(' ');
- return os;
-}
-
-
-} // namespace ns3
--- a/src/node/eui64-address.h Thu Sep 13 10:52:41 2007 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2007 INRIA
- *
- * 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 EUI64_ADDRESS_H
-#define EUI64_ADDRESS_H
-
-#include <stdint.h>
-#include <ostream>
-
-namespace ns3 {
-
-class Address;
-
-/**
- * \brief an EUI-64 address
- *
- * This class can contain 64 bit IEEE addresses.
- */
-class Eui64Address
-{
-public:
- Eui64Address ();
- /**
- * \param str a string representing the new Eui64Address
- *
- * The format of the string is "xx:xx:xx:xx:xx:xx"
- */
- Eui64Address (const char *str);
-
- /**
- * \param buffer address in network order
- *
- * Copy the input address to our internal buffer.
- */
- void CopyFrom (const uint8_t buffer[8]);
- /**
- * \param buffer address in network order
- *
- * Copy the internal address to the input buffer.
- */
- void CopyTo (uint8_t buffer[8]) const;
- /**
- * \returns a new Address instance
- *
- * Convert an instance of this class to a polymorphic Address instance.
- */
- operator Address ();
- /**
- * \param address a polymorphic address
- * \returns a new Eui64Address from the polymorphic address
- *
- * This function performs a type check and asserts if the
- * type of the input address is not compatible with an
- * Eui64Address.
- */
- static Eui64Address ConvertFrom (const Address &address);
- /**
- * \returns true if the address matches, false otherwise.
- */
- static bool IsMatchingType (const Address &address);
- /**
- * Allocate a new Eui64Address.
- */
- static Eui64Address Allocate (void);
-private:
- /**
- * \returns a new Address instance
- *
- * Convert an instance of this class to a polymorphic Address instance.
- */
- Address ConvertTo (void) const;
- static uint8_t GetType (void);
- uint8_t m_address[8];
-};
-
-bool operator == (const Eui64Address &a, const Eui64Address &b);
-bool operator != (const Eui64Address &a, const Eui64Address &b);
-std::ostream& operator<< (std::ostream& os, const Eui64Address & address);
-
-} // namespace ns3
-
-#endif /* EUI64_ADDRESS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mac48-address.cc Thu Sep 13 10:53:24 2007 -0700
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ *
+ * 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 "mac48-address.h"
+#include "address.h"
+#include "ns3/assert.h"
+#include <iomanip>
+#include <iostream>
+
+namespace ns3 {
+
+#define ASCII_a (0x41)
+#define ASCII_z (0x5a)
+#define ASCII_A (0x61)
+#define ASCII_Z (0x7a)
+#define ASCII_COLON (0x3a)
+#define ASCII_ZERO (0x30)
+
+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;
+ }
+}
+
+
+Mac48Address::Mac48Address ()
+{
+ memset (m_address, 0, 6);
+}
+Mac48Address::Mac48Address (const char *str)
+{
+ int i = 0;
+ while (*str != 0 && i < 6)
+ {
+ 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++;
+ }
+ NS_ASSERT (i == 6);
+}
+void
+Mac48Address::CopyFrom (const uint8_t buffer[6])
+{
+ memcpy (m_address, buffer, 6);
+}
+void
+Mac48Address::CopyTo (uint8_t buffer[6]) const
+{
+ memcpy (buffer, m_address, 6);
+}
+
+bool
+Mac48Address::IsMatchingType (const Address &address)
+{
+ return address.CheckCompatible (GetType (), 6);
+}
+Mac48Address::operator Address ()
+{
+ return ConvertTo ();
+}
+Address
+Mac48Address::ConvertTo (void) const
+{
+ return Address (GetType (), m_address, 6);
+}
+Mac48Address
+Mac48Address::ConvertFrom (const Address &address)
+{
+ NS_ASSERT (address.CheckCompatible (GetType (), 6));
+ Mac48Address retval;
+ address.CopyTo (retval.m_address);
+ return retval;
+}
+Mac48Address
+Mac48Address::Allocate (void)
+{
+ static uint64_t id = 0;
+ id++;
+ Mac48Address address;
+ address.m_address[0] = (id >> 40) & 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
+Mac48Address::GetType (void)
+{
+ static uint8_t type = Address::Register ();
+ return type;
+}
+
+bool operator == (const Mac48Address &a, const Mac48Address &b)
+{
+ uint8_t ada[6];
+ uint8_t adb[6];
+ a.CopyTo (ada);
+ b.CopyTo (adb);
+ return memcmp (ada, adb, 6) == 0;
+}
+bool operator != (const Mac48Address &a, const Mac48Address &b)
+{
+ return ! (a == b);
+}
+
+std::ostream& operator<< (std::ostream& os, const Mac48Address & address)
+{
+ uint8_t ad[6];
+ address.CopyTo (ad);
+
+ os.setf (std::ios::hex, std::ios::basefield);
+ os.fill('0');
+ for (uint8_t i=0; i < 5; i++)
+ {
+ os << std::setw(2) << (uint32_t)ad[i] << ":";
+ }
+ // Final byte not suffixed by ":"
+ os << std::setw(2) << (uint32_t)ad[5];
+ os.setf (std::ios::dec, std::ios::basefield);
+ os.fill(' ');
+ return os;
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mac48-address.h Thu Sep 13 10:53:24 2007 -0700
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ *
+ * 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 EUI48_ADDRESS_H
+#define EUI48_ADDRESS_H
+
+#include <stdint.h>
+#include <ostream>
+
+namespace ns3 {
+
+class Address;
+
+/**
+ * \brief an EUI-48 address
+ *
+ * This class can contain 48 bit IEEE addresses.
+ */
+class Mac48Address
+{
+public:
+ Mac48Address ();
+ /**
+ * \param str a string representing the new Mac48Address
+ *
+ * The format of the string is "xx:xx:xx:xx:xx:xx"
+ */
+ Mac48Address (const char *str);
+
+ /**
+ * \param buffer address in network order
+ *
+ * Copy the input address to our internal buffer.
+ */
+ void CopyFrom (const uint8_t buffer[6]);
+ /**
+ * \param buffer address in network order
+ *
+ * Copy the internal address to the input buffer.
+ */
+ void CopyTo (uint8_t buffer[6]) const;
+
+ /**
+ * \returns a new Address instance
+ *
+ * Convert an instance of this class to a polymorphic Address instance.
+ */
+ operator Address ();
+ /**
+ * \param address a polymorphic address
+ * \returns a new Mac48Address from the polymorphic address
+ *
+ * This function performs a type check and asserts if the
+ * type of the input address is not compatible with an
+ * Mac48Address.
+ */
+ static Mac48Address ConvertFrom (const Address &address);
+ /**
+ * \returns true if the address matches, false otherwise.
+ */
+ static bool IsMatchingType (const Address &address);
+ /**
+ * Allocate a new Mac48Address.
+ */
+ static Mac48Address Allocate (void);
+private:
+ /**
+ * \returns a new Address instance
+ *
+ * Convert an instance of this class to a polymorphic Address instance.
+ */
+ Address ConvertTo (void) const;
+ static uint8_t GetType (void);
+ uint8_t m_address[6];
+};
+
+bool operator == (const Mac48Address &a, const Mac48Address &b);
+bool operator != (const Mac48Address &a, const Mac48Address &b);
+std::ostream& operator<< (std::ostream& os, const Mac48Address & address);
+
+} // namespace ns3
+
+#endif /* EUI48_ADDRESS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mac64-address.cc Thu Sep 13 10:53:24 2007 -0700
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ *
+ * 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 "mac64-address.h"
+#include "address.h"
+#include "ns3/assert.h"
+#include <iomanip>
+#include <iostream>
+
+namespace ns3 {
+
+#define ASCII_a (0x41)
+#define ASCII_z (0x5a)
+#define ASCII_A (0x61)
+#define ASCII_Z (0x7a)
+#define ASCII_COLON (0x3a)
+#define ASCII_ZERO (0x30)
+
+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;
+ }
+}
+
+
+Mac64Address::Mac64Address ()
+{
+ memset (m_address, 0, 8);
+}
+Mac64Address::Mac64Address (const char *str)
+{
+ int i = 0;
+ while (*str != 0 && i < 8)
+ {
+ 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++;
+ }
+ NS_ASSERT (i == 6);
+}
+void
+Mac64Address::CopyFrom (const uint8_t buffer[8])
+{
+ memcpy (m_address, buffer, 8);
+}
+void
+Mac64Address::CopyTo (uint8_t buffer[8]) const
+{
+ memcpy (buffer, m_address, 8);
+}
+
+bool
+Mac64Address::IsMatchingType (const Address &address)
+{
+ return address.CheckCompatible (GetType (), 8);
+}
+Mac64Address::operator Address ()
+{
+ return ConvertTo ();
+}
+Mac64Address
+Mac64Address::ConvertFrom (const Address &address)
+{
+ NS_ASSERT (address.CheckCompatible (GetType (), 8));
+ Mac64Address retval;
+ address.CopyTo (retval.m_address);
+ return retval;
+}
+Address
+Mac64Address::ConvertTo (void) const
+{
+ return Address (GetType (), m_address, 8);
+}
+
+Mac64Address
+Mac64Address::Allocate (void)
+{
+ static uint64_t id = 0;
+ id++;
+ Mac64Address address;
+ address.m_address[0] = (id >> 56) & 0xff;
+ address.m_address[1] = (id >> 48) & 0xff;
+ address.m_address[2] = (id >> 40) & 0xff;
+ address.m_address[3] = (id >> 32) & 0xff;
+ address.m_address[4] = (id >> 24) & 0xff;
+ address.m_address[5] = (id >> 16) & 0xff;
+ address.m_address[6] = (id >> 8) & 0xff;
+ address.m_address[7] = (id >> 0) & 0xff;
+ return address;
+}
+uint8_t
+Mac64Address::GetType (void)
+{
+ static uint8_t type = Address::Register ();
+ return type;
+}
+
+bool operator == (const Mac64Address &a, const Mac64Address &b)
+{
+ uint8_t ada[8];
+ uint8_t adb[8];
+ a.CopyTo (ada);
+ b.CopyTo (adb);
+ return memcmp (ada, adb, 8) == 0;
+}
+bool operator != (const Mac64Address &a, const Mac64Address &b)
+{
+ return ! (a == b);
+}
+
+std::ostream& operator<< (std::ostream& os, const Mac64Address & address)
+{
+ uint8_t ad[8];
+ address.CopyTo (ad);
+
+ os.setf (std::ios::hex, std::ios::basefield);
+ os.fill('0');
+ for (uint8_t i=0; i < 7; i++)
+ {
+ os << std::setw(2) << (uint32_t)ad[i] << ":";
+ }
+ // Final byte not suffixed by ":"
+ os << std::setw(2) << (uint32_t)ad[7];
+ os.setf (std::ios::dec, std::ios::basefield);
+ os.fill(' ');
+ return os;
+}
+
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/node/mac64-address.h Thu Sep 13 10:53:24 2007 -0700
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2007 INRIA
+ *
+ * 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 EUI64_ADDRESS_H
+#define EUI64_ADDRESS_H
+
+#include <stdint.h>
+#include <ostream>
+
+namespace ns3 {
+
+class Address;
+
+/**
+ * \brief an EUI-64 address
+ *
+ * This class can contain 64 bit IEEE addresses.
+ */
+class Mac64Address
+{
+public:
+ Mac64Address ();
+ /**
+ * \param str a string representing the new Mac64Address
+ *
+ * The format of the string is "xx:xx:xx:xx:xx:xx"
+ */
+ Mac64Address (const char *str);
+
+ /**
+ * \param buffer address in network order
+ *
+ * Copy the input address to our internal buffer.
+ */
+ void CopyFrom (const uint8_t buffer[8]);
+ /**
+ * \param buffer address in network order
+ *
+ * Copy the internal address to the input buffer.
+ */
+ void CopyTo (uint8_t buffer[8]) const;
+ /**
+ * \returns a new Address instance
+ *
+ * Convert an instance of this class to a polymorphic Address instance.
+ */
+ operator Address ();
+ /**
+ * \param address a polymorphic address
+ * \returns a new Mac64Address from the polymorphic address
+ *
+ * This function performs a type check and asserts if the
+ * type of the input address is not compatible with an
+ * Mac64Address.
+ */
+ static Mac64Address ConvertFrom (const Address &address);
+ /**
+ * \returns true if the address matches, false otherwise.
+ */
+ static bool IsMatchingType (const Address &address);
+ /**
+ * Allocate a new Mac64Address.
+ */
+ static Mac64Address Allocate (void);
+private:
+ /**
+ * \returns a new Address instance
+ *
+ * Convert an instance of this class to a polymorphic Address instance.
+ */
+ Address ConvertTo (void) const;
+ static uint8_t GetType (void);
+ uint8_t m_address[8];
+};
+
+bool operator == (const Mac64Address &a, const Mac64Address &b);
+bool operator != (const Mac64Address &a, const Mac64Address &b);
+std::ostream& operator<< (std::ostream& os, const Mac64Address & address);
+
+} // namespace ns3
+
+#endif /* EUI64_ADDRESS_H */
--- a/src/node/packet-socket-address.h Thu Sep 13 10:52:41 2007 -0700
+++ b/src/node/packet-socket-address.h Thu Sep 13 10:53:24 2007 -0700
@@ -22,8 +22,8 @@
#include "ns3/ptr.h"
#include "address.h"
-#include "eui48-address.h"
-#include "eui64-address.h"
+#include "mac48-address.h"
+#include "mac64-address.h"
#include "net-device.h"
namespace ns3 {
@@ -54,7 +54,7 @@
/**
* \param address a polymorphic address
*
- * Convert a polymorphic address to an Eui48Address instance.
+ * Convert a polymorphic address to an Mac48Address instance.
* The conversion performs a type check.
*/
static PacketSocketAddress ConvertFrom (const Address &address);
--- a/src/node/wscript Thu Sep 13 10:52:41 2007 -0700
+++ b/src/node/wscript Thu Sep 13 10:53:24 2007 -0700
@@ -4,8 +4,8 @@
node = bld.create_ns3_module('node', ['core', 'common', 'simulator'])
node.source = [
'address.cc',
- 'eui48-address.cc',
- 'eui64-address.cc',
+ 'mac48-address.cc',
+ 'mac64-address.cc',
'inet-socket-address.cc',
'packet-socket-address.cc',
'node.cc',
@@ -32,8 +32,8 @@
headers = bld.create_obj('ns3header')
headers.source = [
'address.h',
- 'eui48-address.h',
- 'eui64-address.h',
+ 'mac48-address.h',
+ 'mac64-address.h',
'inet-socket-address.h',
'packet-socket-address.h',
'node.h',